aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 17:29:19 +1000
committerDavid Walter Seikel2013-01-13 17:29:19 +1000
commit07274513e984f0b5544586c74508ccd16e7dcafa (patch)
treeb32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib
parentAdded Irrlicht 1.8, but without all the Windows binaries. (diff)
downloadSledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/ecore/src/lib')
-rw-r--r--libraries/ecore/src/lib/Makefile.am75
-rw-r--r--libraries/ecore/src/lib/Makefile.in835
-rw-r--r--libraries/ecore/src/lib/ecore/Ecore.h2502
-rw-r--r--libraries/ecore/src/lib/ecore/Ecore_Getopt.h419
-rw-r--r--libraries/ecore/src/lib/ecore/Makefile.am69
-rw-r--r--libraries/ecore/src/lib/ecore/Makefile.in871
-rw-r--r--libraries/ecore/src/lib/ecore/ecore.c753
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_alloc.c132
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_anim.c490
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_app.c95
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_events.c637
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_exe.c1880
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_exe_ps3.c20
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_exe_win32.c1055
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_exe_wince.c21
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_getopt.c1915
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_glib.c342
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_idle_enterer.c208
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_idle_exiter.c177
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_idler.c159
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_job.c123
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_main.c1958
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_pipe.c682
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_poll.c347
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_private.h378
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_signal.c565
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_thread.c1635
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_throttle.c99
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_time.c184
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_timer.c833
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h147
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h285
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/Makefile.am29
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/Makefile.in837
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m283
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h11
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m163
-rw-r--r--libraries/ecore/src/lib/ecore_con/Ecore_Con.h1938
-rw-r--r--libraries/ecore/src/lib/ecore_con/Makefile.am46
-rw-r--r--libraries/ecore/src/lib/ecore_con/Makefile.in935
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con.c2583
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c101
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_ares.c628
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_info.c449
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_local.c317
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c754
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_private.h397
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_socks.c940
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c2113
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_url.c1635
-rw-r--r--libraries/ecore/src/lib/ecore_config/Ecore_Config.h312
-rw-r--r--libraries/ecore/src/lib/ecore_config/Makefile.am62
-rw-r--r--libraries/ecore/src/lib/ecore_config/Makefile.in869
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config.c1870
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_db.c296
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_extra.c803
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h50
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c384
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c275
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_private.h70
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_storage.c176
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_util.c129
-rw-r--r--libraries/ecore/src/lib/ecore_config/ecore_config_util.h14
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h181
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/Makefile.am31
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/Makefile.in836
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c757
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h184
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/ecore_directfb_private.h52
-rw-r--r--libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h2079
-rw-r--r--libraries/ecore/src/lib/ecore_evas/Makefile.am160
-rw-r--r--libraries/ecore/src/lib/ecore_evas/Makefile.in965
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas.c2855
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c824
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c582
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c603
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c1467
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c2169
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c662
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h478
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c513
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c656
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c439
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c1017
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c1114
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c1452
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c992
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c4445
-rw-r--r--libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h100
-rw-r--r--libraries/ecore/src/lib/ecore_fb/Makefile.am34
-rw-r--r--libraries/ecore/src/lib/ecore_fb/Makefile.in845
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb.c111
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h129
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c708
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h94
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c355
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c322
-rw-r--r--libraries/ecore/src/lib/ecore_file/Ecore_File.h190
-rw-r--r--libraries/ecore/src/lib/ecore_file/Makefile.am41
-rw-r--r--libraries/ecore/src/lib/ecore_file/Makefile.in851
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file.c1109
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_download.c449
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c180
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c370
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c340
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_monitor_win32.c310
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_path.c185
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_private.h129
-rw-r--r--libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h526
-rw-r--r--libraries/ecore/src/lib/ecore_imf/Makefile.am28
-rw-r--r--libraries/ecore/src/lib/ecore_imf/Makefile.in836
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf.c73
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c1718
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c212
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h84
-rw-r--r--libraries/ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h50
-rw-r--r--libraries/ecore/src/lib/ecore_imf_evas/Makefile.am22
-rw-r--r--libraries/ecore/src/lib/ecore_imf_evas/Makefile.in829
-rw-r--r--libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c303
-rw-r--r--libraries/ecore/src/lib/ecore_input/Ecore_Input.h220
-rw-r--r--libraries/ecore/src/lib/ecore_input/Makefile.am24
-rw-r--r--libraries/ecore/src/lib/ecore_input/Makefile.in830
-rw-r--r--libraries/ecore/src/lib/ecore_input/ecore_input.c120
-rw-r--r--libraries/ecore/src/lib/ecore_input/ecore_input_private.h37
-rw-r--r--libraries/ecore/src/lib/ecore_input_evas/Ecore_Input_Evas.h64
-rw-r--r--libraries/ecore/src/lib/ecore_input_evas/Makefile.am29
-rw-r--r--libraries/ecore/src/lib/ecore_input_evas/Makefile.in836
-rw-r--r--libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c413
-rw-r--r--libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas_private.h37
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h325
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/Makefile.am29
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/Makefile.in836
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c1593
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h104
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h121
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h78
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Makefile.am30
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Makefile.in840
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c859
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h36
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/moveutil.c245
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/spursutil.c62
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h114
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h266
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/Makefile.am29
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/Makefile.in836
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c335
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h36
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h304
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Makefile.am33
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Makefile.in842
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl.c551
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c189
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl_input.c658
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c79
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h87
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl_window.c440
-rw-r--r--libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h526
-rw-r--r--libraries/ecore/src/lib/ecore_win32/Makefile.am42
-rw-r--r--libraries/ecore/src/lib/ecore_win32/Makefile.in901
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32.c841
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c306
-rwxr-xr-xlibraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c221
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp209
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h49
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp92
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h36
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp232
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h47
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp157
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h50
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c1295
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h170
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c1418
-rw-r--r--libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h314
-rw-r--r--libraries/ecore/src/lib/ecore_wince/Makefile.am35
-rw-r--r--libraries/ecore/src/lib/ecore_wince/Makefile.in843
-rw-r--r--libraries/ecore/src/lib/ecore_wince/ecore_wince.c400
-rw-r--r--libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c1074
-rw-r--r--libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h85
-rw-r--r--libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c827
-rw-r--r--libraries/ecore/src/lib/ecore_x/Ecore_X.h3714
-rw-r--r--libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h269
-rw-r--r--libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h87
-rw-r--r--libraries/ecore/src/lib/ecore_x/Makefile.am30
-rw-r--r--libraries/ecore/src/lib/ecore_x/Makefile.in948
-rw-r--r--libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h295
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/Makefile.am99
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/Makefile.in905
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c1470
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c421
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_composite.c289
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c400
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c155
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c688
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c318
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c123
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c1307
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c123
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c2805
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_extensions.c148
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c173
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c203
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c1569
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c740
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c274
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c490
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c104
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c1575
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c128
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h451
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c3699
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c159
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c225
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c338
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c1039
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c50
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c338
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c509
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c375
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c2234
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c720
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c408
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c790
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c116
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c750
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c139
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c215
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/Makefile.am94
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/Makefile.in888
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c2098
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c367
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c176
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c246
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c71
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c706
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c247
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c118
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c1293
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c125
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c2487
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c365
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c171
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c136
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c1214
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c600
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c106
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c2056
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c121
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h385
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c102
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h7
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c335
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c2360
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c463
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c68
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c158
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c173
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c1002
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c159
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c167
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c351
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c1723
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c752
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c658
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c283
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c91
267 files changed, 0 insertions, 154470 deletions
diff --git a/libraries/ecore/src/lib/Makefile.am b/libraries/ecore/src/lib/Makefile.am
deleted file mode 100644
index d43ad75..0000000
--- a/libraries/ecore/src/lib/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
1## Process this file with automake to produce Makefile.in
2MAINTAINERCLEANFILES = Makefile.in
3SUBDIRS = ecore
4
5if BUILD_ECORE_INPUT
6SUBDIRS += ecore_input
7endif
8
9if BUILD_ECORE_INPUT_EVAS
10SUBDIRS += ecore_input_evas
11endif
12
13if BUILD_ECORE_FB
14SUBDIRS += ecore_fb
15endif
16
17if BUILD_ECORE_DIRECTFB
18SUBDIRS += ecore_directfb
19endif
20
21if BUILD_ECORE_CON
22SUBDIRS += ecore_con
23endif
24
25if BUILD_ECORE_X
26SUBDIRS += ecore_x
27endif
28
29if BUILD_ECORE_WIN32
30SUBDIRS += ecore_win32
31endif
32
33if BUILD_ECORE_WINCE
34SUBDIRS += ecore_wince
35endif
36
37if BUILD_ECORE_SDL
38SUBDIRS += ecore_sdl
39endif
40
41if BUILD_ECORE_PSL1GHT
42SUBDIRS += ecore_psl1ght
43endif
44
45if BUILD_ECORE_COCOA
46SUBDIRS += ecore_cocoa
47endif
48
49if BUILD_ECORE_WAYLAND
50SUBDIRS += ecore_wayland
51endif
52
53if BUILD_ECORE_IPC
54SUBDIRS += ecore_ipc
55endif
56
57if BUILD_ECORE_EVAS
58SUBDIRS += ecore_evas
59endif
60
61if BUILD_ECORE_CONFIG
62SUBDIRS += ecore_config
63endif
64
65if BUILD_ECORE_FILE
66SUBDIRS += ecore_file
67endif
68
69if BUILD_ECORE_IMF
70SUBDIRS += ecore_imf
71endif
72
73if BUILD_ECORE_IMF_EVAS
74SUBDIRS += ecore_imf_evas
75endif
diff --git a/libraries/ecore/src/lib/Makefile.in b/libraries/ecore/src/lib/Makefile.in
deleted file mode 100644
index a5fd01f..0000000
--- a/libraries/ecore/src/lib/Makefile.in
+++ /dev/null
@@ -1,835 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17VPATH = @srcdir@
18pkgdatadir = $(datadir)/@PACKAGE@
19pkgincludedir = $(includedir)/@PACKAGE@
20pkglibdir = $(libdir)/@PACKAGE@
21pkglibexecdir = $(libexecdir)/@PACKAGE@
22am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
23install_sh_DATA = $(install_sh) -c -m 644
24install_sh_PROGRAM = $(install_sh) -c
25install_sh_SCRIPT = $(install_sh) -c
26INSTALL_HEADER = $(INSTALL_DATA)
27transform = $(program_transform_name)
28NORMAL_INSTALL = :
29PRE_INSTALL = :
30POST_INSTALL = :
31NORMAL_UNINSTALL = :
32PRE_UNINSTALL = :
33POST_UNINSTALL = :
34build_triplet = @build@
35host_triplet = @host@
36@BUILD_ECORE_INPUT_TRUE@am__append_1 = ecore_input
37@BUILD_ECORE_INPUT_EVAS_TRUE@am__append_2 = ecore_input_evas
38@BUILD_ECORE_FB_TRUE@am__append_3 = ecore_fb
39@BUILD_ECORE_DIRECTFB_TRUE@am__append_4 = ecore_directfb
40@BUILD_ECORE_CON_TRUE@am__append_5 = ecore_con
41@BUILD_ECORE_X_TRUE@am__append_6 = ecore_x
42@BUILD_ECORE_WIN32_TRUE@am__append_7 = ecore_win32
43@BUILD_ECORE_WINCE_TRUE@am__append_8 = ecore_wince
44@BUILD_ECORE_SDL_TRUE@am__append_9 = ecore_sdl
45@BUILD_ECORE_PSL1GHT_TRUE@am__append_10 = ecore_psl1ght
46@BUILD_ECORE_COCOA_TRUE@am__append_11 = ecore_cocoa
47@BUILD_ECORE_WAYLAND_TRUE@am__append_12 = ecore_wayland
48@BUILD_ECORE_IPC_TRUE@am__append_13 = ecore_ipc
49@BUILD_ECORE_EVAS_TRUE@am__append_14 = ecore_evas
50@BUILD_ECORE_CONFIG_TRUE@am__append_15 = ecore_config
51@BUILD_ECORE_FILE_TRUE@am__append_16 = ecore_file
52@BUILD_ECORE_IMF_TRUE@am__append_17 = ecore_imf
53@BUILD_ECORE_IMF_EVAS_TRUE@am__append_18 = ecore_imf_evas
54subdir = src/lib
55DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
56ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
57am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
58 $(top_srcdir)/m4/ac_path_generic.m4 \
59 $(top_srcdir)/m4/check_x_extension.m4 \
60 $(top_srcdir)/m4/ecore_check_module.m4 \
61 $(top_srcdir)/m4/ecore_check_options.m4 \
62 $(top_srcdir)/m4/efl_compiler_flag.m4 \
63 $(top_srcdir)/m4/efl_doxygen.m4 \
64 $(top_srcdir)/m4/efl_examples.m4 \
65 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
66 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
67 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
68 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
69 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
70 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
71 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
72 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
73 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
74am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
75 $(ACLOCAL_M4)
76mkinstalldirs = $(install_sh) -d
77CONFIG_HEADER = $(top_builddir)/config.h
78CONFIG_CLEAN_FILES =
79CONFIG_CLEAN_VPATH_FILES =
80AM_V_GEN = $(am__v_GEN_$(V))
81am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
82am__v_GEN_0 = @echo " GEN " $@;
83AM_V_at = $(am__v_at_$(V))
84am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
85am__v_at_0 = @
86SOURCES =
87DIST_SOURCES =
88RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
89 html-recursive info-recursive install-data-recursive \
90 install-dvi-recursive install-exec-recursive \
91 install-html-recursive install-info-recursive \
92 install-pdf-recursive install-ps-recursive install-recursive \
93 installcheck-recursive installdirs-recursive pdf-recursive \
94 ps-recursive uninstall-recursive
95RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
96 distclean-recursive maintainer-clean-recursive
97AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
98 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
99 distdir
100ETAGS = etags
101CTAGS = ctags
102DIST_SUBDIRS = ecore ecore_input ecore_input_evas ecore_fb \
103 ecore_directfb ecore_con ecore_x ecore_win32 ecore_wince \
104 ecore_sdl ecore_psl1ght ecore_cocoa ecore_wayland ecore_ipc \
105 ecore_evas ecore_config ecore_file ecore_imf ecore_imf_evas
106DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
107am__relativize = \
108 dir0=`pwd`; \
109 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
110 sed_rest='s,^[^/]*/*,,'; \
111 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
112 sed_butlast='s,/*[^/]*$$,,'; \
113 while test -n "$$dir1"; do \
114 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
115 if test "$$first" != "."; then \
116 if test "$$first" = ".."; then \
117 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
118 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
119 else \
120 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
121 if test "$$first2" = "$$first"; then \
122 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
123 else \
124 dir2="../$$dir2"; \
125 fi; \
126 dir0="$$dir0"/"$$first"; \
127 fi; \
128 fi; \
129 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
130 done; \
131 reldir="$$dir2"
132ACLOCAL = @ACLOCAL@
133ALLOCA = @ALLOCA@
134AMTAR = @AMTAR@
135AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
136AR = @AR@
137AS = @AS@
138AUTOCONF = @AUTOCONF@
139AUTOHEADER = @AUTOHEADER@
140AUTOMAKE = @AUTOMAKE@
141AWK = @AWK@
142CARES_CFLAGS = @CARES_CFLAGS@
143CARES_LIBS = @CARES_LIBS@
144CC = @CC@
145CCDEPMODE = @CCDEPMODE@
146CFLAGS = @CFLAGS@
147CHECK_CFLAGS = @CHECK_CFLAGS@
148CHECK_LIBS = @CHECK_LIBS@
149CPP = @CPP@
150CPPFLAGS = @CPPFLAGS@
151CURL_CFLAGS = @CURL_CFLAGS@
152CURL_LIBS = @CURL_LIBS@
153CXX = @CXX@
154CXXCPP = @CXXCPP@
155CXXDEPMODE = @CXXDEPMODE@
156CXXFLAGS = @CXXFLAGS@
157CYGPATH_W = @CYGPATH_W@
158DEFS = @DEFS@
159DEPDIR = @DEPDIR@
160DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
161DIRECTFB_LIBS = @DIRECTFB_LIBS@
162DLLTOOL = @DLLTOOL@
163DSYMUTIL = @DSYMUTIL@
164DUMPBIN = @DUMPBIN@
165ECHO_C = @ECHO_C@
166ECHO_N = @ECHO_N@
167ECHO_T = @ECHO_T@
168ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
169ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
170EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
171EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
172EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
173EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
174EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
175EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
176EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
177EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
178EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
179EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
180EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
181EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
182EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
183EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
184EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
185EGREP = @EGREP@
186EINA_CFLAGS = @EINA_CFLAGS@
187EINA_LIBS = @EINA_LIBS@
188ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
189ESCAPE_LIBS = @ESCAPE_LIBS@
190EVAS_CFLAGS = @EVAS_CFLAGS@
191EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@
200GLIB_LIBS = @GLIB_LIBS@
201GMSGFMT = @GMSGFMT@
202GMSGFMT_015 = @GMSGFMT_015@
203GREP = @GREP@
204INSTALL = @INSTALL@
205INSTALL_DATA = @INSTALL_DATA@
206INSTALL_PROGRAM = @INSTALL_PROGRAM@
207INSTALL_SCRIPT = @INSTALL_SCRIPT@
208INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
209INTLLIBS = @INTLLIBS@
210INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
211KEYSYMDEFS = @KEYSYMDEFS@
212LD = @LD@
213LDFLAGS = @LDFLAGS@
214LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
215LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
216LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
217LIBICONV = @LIBICONV@
218LIBINTL = @LIBINTL@
219LIBOBJS = @LIBOBJS@
220LIBS = @LIBS@
221LIBTOOL = @LIBTOOL@
222LIPO = @LIPO@
223LN_S = @LN_S@
224LTLIBICONV = @LTLIBICONV@
225LTLIBINTL = @LTLIBINTL@
226LTLIBOBJS = @LTLIBOBJS@
227MAKEINFO = @MAKEINFO@
228MKDIR_P = @MKDIR_P@
229MSGFMT = @MSGFMT@
230MSGFMT_015 = @MSGFMT_015@
231MSGMERGE = @MSGMERGE@
232NM = @NM@
233NMEDIT = @NMEDIT@
234OBJC = @OBJC@
235OBJCDEPMODE = @OBJCDEPMODE@
236OBJCFLAGS = @OBJCFLAGS@
237OBJDUMP = @OBJDUMP@
238OBJEXT = @OBJEXT@
239OTOOL = @OTOOL@
240OTOOL64 = @OTOOL64@
241PACKAGE = @PACKAGE@
242PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
243PACKAGE_NAME = @PACKAGE_NAME@
244PACKAGE_STRING = @PACKAGE_STRING@
245PACKAGE_TARNAME = @PACKAGE_TARNAME@
246PACKAGE_URL = @PACKAGE_URL@
247PACKAGE_VERSION = @PACKAGE_VERSION@
248PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
254POSUB = @POSUB@
255RANLIB = @RANLIB@
256SCIM_CFLAGS = @SCIM_CFLAGS@
257SCIM_LIBS = @SCIM_LIBS@
258SDL_CFLAGS = @SDL_CFLAGS@
259SDL_CONFIG = @SDL_CONFIG@
260SDL_LIBS = @SDL_LIBS@
261SED = @SED@
262SET_MAKE = @SET_MAKE@
263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@
268TLS2_CFLAGS = @TLS2_CFLAGS@
269TLS2_LIBS = @TLS2_LIBS@
270TLS_CFLAGS = @TLS_CFLAGS@
271TLS_LIBS = @TLS_LIBS@
272TSLIB_CFLAGS = @TSLIB_CFLAGS@
273TSLIB_LIBS = @TSLIB_LIBS@
274USE_NLS = @USE_NLS@
275VERSION = @VERSION@
276VMAJ = @VMAJ@
277WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
278WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
279WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
280WAYLAND_LIBS = @WAYLAND_LIBS@
281WIN32_CFLAGS = @WIN32_CFLAGS@
282WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
283WIN32_LIBS = @WIN32_LIBS@
284XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
285XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
286XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
287XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
288XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
289XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
290XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
291XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
292XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
293XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
294XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
295XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
296XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
297XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
298XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
299XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
300XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
301XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
302XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
303XCB_X11_LIBS = @XCB_X11_LIBS@
304XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
305XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
306XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
307XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
308XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
309XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
310XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
311XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
312XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
313XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
314XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
315XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
316XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
317XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
318XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
319XDAMAGE_LIBS = @XDAMAGE_LIBS@
320XDPMS_CFLAGS = @XDPMS_CFLAGS@
321XDPMS_LIBS = @XDPMS_LIBS@
322XFIXES_CFLAGS = @XFIXES_CFLAGS@
323XFIXES_LIBS = @XFIXES_LIBS@
324XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
325XGESTURE_LIBS = @XGESTURE_LIBS@
326XGETTEXT = @XGETTEXT@
327XGETTEXT_015 = @XGETTEXT_015@
328XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
329XI2_CFLAGS = @XI2_CFLAGS@
330XI2_LIBS = @XI2_LIBS@
331XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
332XINERAMA_LIBS = @XINERAMA_LIBS@
333XKB_CFLAGS = @XKB_CFLAGS@
334XKB_LIBS = @XKB_LIBS@
335XMKMF = @XMKMF@
336XPRINT_CFLAGS = @XPRINT_CFLAGS@
337XPRINT_LIBS = @XPRINT_LIBS@
338XRANDR_CFLAGS = @XRANDR_CFLAGS@
339XRANDR_LIBS = @XRANDR_LIBS@
340XRENDER_CFLAGS = @XRENDER_CFLAGS@
341XRENDER_LIBS = @XRENDER_LIBS@
342XSS_CFLAGS = @XSS_CFLAGS@
343XSS_LIBS = @XSS_LIBS@
344XTEST_CFLAGS = @XTEST_CFLAGS@
345XTEST_LIBS = @XTEST_LIBS@
346X_CFLAGS = @X_CFLAGS@
347X_EXTRA_LIBS = @X_EXTRA_LIBS@
348X_LIBS = @X_LIBS@
349X_PRE_LIBS = @X_PRE_LIBS@
350Xcursor_cflags = @Xcursor_cflags@
351Xcursor_libs = @Xcursor_libs@
352abs_builddir = @abs_builddir@
353abs_srcdir = @abs_srcdir@
354abs_top_builddir = @abs_top_builddir@
355abs_top_srcdir = @abs_top_srcdir@
356ac_ct_CC = @ac_ct_CC@
357ac_ct_CXX = @ac_ct_CXX@
358ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
359ac_ct_OBJC = @ac_ct_OBJC@
360am__include = @am__include@
361am__leading_dot = @am__leading_dot@
362am__quote = @am__quote@
363am__tar = @am__tar@
364am__untar = @am__untar@
365bindir = @bindir@
366build = @build@
367build_alias = @build_alias@
368build_cpu = @build_cpu@
369build_os = @build_os@
370build_vendor = @build_vendor@
371builddir = @builddir@
372cocoa_ldflags = @cocoa_ldflags@
373datadir = @datadir@
374datarootdir = @datarootdir@
375dlopen_libs = @dlopen_libs@
376docdir = @docdir@
377dvidir = @dvidir@
378ecore_cocoa_cflags = @ecore_cocoa_cflags@
379ecore_cocoa_libs = @ecore_cocoa_libs@
380ecore_con_cflags = @ecore_con_cflags@
381ecore_con_libs = @ecore_con_libs@
382ecore_directfb_cflags = @ecore_directfb_cflags@
383ecore_directfb_libs = @ecore_directfb_libs@
384ecore_evas_cflags = @ecore_evas_cflags@
385ecore_evas_libs = @ecore_evas_libs@
386ecore_fb_cflags = @ecore_fb_cflags@
387ecore_fb_libs = @ecore_fb_libs@
388ecore_file_cflags = @ecore_file_cflags@
389ecore_file_libs = @ecore_file_libs@
390ecore_imf_cflags = @ecore_imf_cflags@
391ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
392ecore_imf_evas_libs = @ecore_imf_evas_libs@
393ecore_imf_libs = @ecore_imf_libs@
394ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
395ecore_imf_scim_libs = @ecore_imf_scim_libs@
396ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
397ecore_imf_xim_libs = @ecore_imf_xim_libs@
398ecore_input_cflags = @ecore_input_cflags@
399ecore_input_evas_cflags = @ecore_input_evas_cflags@
400ecore_input_evas_libs = @ecore_input_evas_libs@
401ecore_input_libs = @ecore_input_libs@
402ecore_ipc_cflags = @ecore_ipc_cflags@
403ecore_ipc_libs = @ecore_ipc_libs@
404ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
405ecore_psl1ght_libs = @ecore_psl1ght_libs@
406ecore_sdl_cflags = @ecore_sdl_cflags@
407ecore_sdl_libs = @ecore_sdl_libs@
408ecore_wayland_cflags = @ecore_wayland_cflags@
409ecore_wayland_libs = @ecore_wayland_libs@
410ecore_win32_cflags = @ecore_win32_cflags@
411ecore_win32_libs = @ecore_win32_libs@
412ecore_wince_cflags = @ecore_wince_cflags@
413ecore_wince_libs = @ecore_wince_libs@
414ecore_x_cflags = @ecore_x_cflags@
415ecore_x_libs = @ecore_x_libs@
416ecore_x_libs_private = @ecore_x_libs_private@
417efl_doxygen = @efl_doxygen@
418efl_have_doxygen = @efl_have_doxygen@
419exec_prefix = @exec_prefix@
420have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
421host = @host@
422host_alias = @host_alias@
423host_cpu = @host_cpu@
424host_os = @host_os@
425host_vendor = @host_vendor@
426htmldir = @htmldir@
427includedir = @includedir@
428infodir = @infodir@
429install_sh = @install_sh@
430libdir = @libdir@
431libexecdir = @libexecdir@
432localedir = @localedir@
433localstatedir = @localstatedir@
434lt_ECHO = @lt_ECHO@
435lt_enable_auto_import = @lt_enable_auto_import@
436mandir = @mandir@
437mkdir_p = @mkdir_p@
438oldincludedir = @oldincludedir@
439pdfdir = @pdfdir@
440pkgconfig_requires_private = @pkgconfig_requires_private@
441prefix = @prefix@
442program_transform_name = @program_transform_name@
443psdir = @psdir@
444release_info = @release_info@
445requirements_ecore = @requirements_ecore@
446requirements_ecore_cocoa = @requirements_ecore_cocoa@
447requirements_ecore_con = @requirements_ecore_con@
448requirements_ecore_directfb = @requirements_ecore_directfb@
449requirements_ecore_evas = @requirements_ecore_evas@
450requirements_ecore_fb = @requirements_ecore_fb@
451requirements_ecore_file = @requirements_ecore_file@
452requirements_ecore_imf = @requirements_ecore_imf@
453requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
454requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
455requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
456requirements_ecore_input = @requirements_ecore_input@
457requirements_ecore_input_evas = @requirements_ecore_input_evas@
458requirements_ecore_ipc = @requirements_ecore_ipc@
459requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
460requirements_ecore_sdl = @requirements_ecore_sdl@
461requirements_ecore_wayland = @requirements_ecore_wayland@
462requirements_ecore_win32 = @requirements_ecore_win32@
463requirements_ecore_wince = @requirements_ecore_wince@
464requirements_ecore_x = @requirements_ecore_x@
465rt_libs = @rt_libs@
466sbindir = @sbindir@
467sharedstatedir = @sharedstatedir@
468srcdir = @srcdir@
469sysconfdir = @sysconfdir@
470target_alias = @target_alias@
471top_build_prefix = @top_build_prefix@
472top_builddir = @top_builddir@
473top_srcdir = @top_srcdir@
474version_info = @version_info@
475x_cflags = @x_cflags@
476x_includes = @x_includes@
477x_libs = @x_libs@
478MAINTAINERCLEANFILES = Makefile.in
479SUBDIRS = ecore $(am__append_1) $(am__append_2) $(am__append_3) \
480 $(am__append_4) $(am__append_5) $(am__append_6) \
481 $(am__append_7) $(am__append_8) $(am__append_9) \
482 $(am__append_10) $(am__append_11) $(am__append_12) \
483 $(am__append_13) $(am__append_14) $(am__append_15) \
484 $(am__append_16) $(am__append_17) $(am__append_18)
485all: all-recursive
486
487.SUFFIXES:
488$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
489 @for dep in $?; do \
490 case '$(am__configure_deps)' in \
491 *$$dep*) \
492 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
493 && { if test -f $@; then exit 0; else break; fi; }; \
494 exit 1;; \
495 esac; \
496 done; \
497 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \
498 $(am__cd) $(top_srcdir) && \
499 $(AUTOMAKE) --gnu src/lib/Makefile
500.PRECIOUS: Makefile
501Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
502 @case '$?' in \
503 *config.status*) \
504 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
505 *) \
506 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
507 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
508 esac;
509
510$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
511 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
512
513$(top_srcdir)/configure: $(am__configure_deps)
514 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
515$(ACLOCAL_M4): $(am__aclocal_m4_deps)
516 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
517$(am__aclocal_m4_deps):
518
519mostlyclean-libtool:
520 -rm -f *.lo
521
522clean-libtool:
523 -rm -rf .libs _libs
524
525# This directory's subdirectories are mostly independent; you can cd
526# into them and run `make' without going through this Makefile.
527# To change the values of `make' variables: instead of editing Makefiles,
528# (1) if the variable is set in `config.status', edit `config.status'
529# (which will cause the Makefiles to be regenerated when you run `make');
530# (2) otherwise, pass the desired values on the `make' command line.
531$(RECURSIVE_TARGETS):
532 @fail= failcom='exit 1'; \
533 for f in x $$MAKEFLAGS; do \
534 case $$f in \
535 *=* | --[!k]*);; \
536 *k*) failcom='fail=yes';; \
537 esac; \
538 done; \
539 dot_seen=no; \
540 target=`echo $@ | sed s/-recursive//`; \
541 list='$(SUBDIRS)'; for subdir in $$list; do \
542 echo "Making $$target in $$subdir"; \
543 if test "$$subdir" = "."; then \
544 dot_seen=yes; \
545 local_target="$$target-am"; \
546 else \
547 local_target="$$target"; \
548 fi; \
549 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
550 || eval $$failcom; \
551 done; \
552 if test "$$dot_seen" = "no"; then \
553 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
554 fi; test -z "$$fail"
555
556$(RECURSIVE_CLEAN_TARGETS):
557 @fail= failcom='exit 1'; \
558 for f in x $$MAKEFLAGS; do \
559 case $$f in \
560 *=* | --[!k]*);; \
561 *k*) failcom='fail=yes';; \
562 esac; \
563 done; \
564 dot_seen=no; \
565 case "$@" in \
566 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
567 *) list='$(SUBDIRS)' ;; \
568 esac; \
569 rev=''; for subdir in $$list; do \
570 if test "$$subdir" = "."; then :; else \
571 rev="$$subdir $$rev"; \
572 fi; \
573 done; \
574 rev="$$rev ."; \
575 target=`echo $@ | sed s/-recursive//`; \
576 for subdir in $$rev; do \
577 echo "Making $$target in $$subdir"; \
578 if test "$$subdir" = "."; then \
579 local_target="$$target-am"; \
580 else \
581 local_target="$$target"; \
582 fi; \
583 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
584 || eval $$failcom; \
585 done && test -z "$$fail"
586tags-recursive:
587 list='$(SUBDIRS)'; for subdir in $$list; do \
588 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
589 done
590ctags-recursive:
591 list='$(SUBDIRS)'; for subdir in $$list; do \
592 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
593 done
594
595ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
596 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
597 unique=`for i in $$list; do \
598 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
599 done | \
600 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
601 END { if (nonempty) { for (i in files) print i; }; }'`; \
602 mkid -fID $$unique
603tags: TAGS
604
605TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
606 $(TAGS_FILES) $(LISP)
607 set x; \
608 here=`pwd`; \
609 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
610 include_option=--etags-include; \
611 empty_fix=.; \
612 else \
613 include_option=--include; \
614 empty_fix=; \
615 fi; \
616 list='$(SUBDIRS)'; for subdir in $$list; do \
617 if test "$$subdir" = .; then :; else \
618 test ! -f $$subdir/TAGS || \
619 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
620 fi; \
621 done; \
622 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
623 unique=`for i in $$list; do \
624 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
625 done | \
626 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
627 END { if (nonempty) { for (i in files) print i; }; }'`; \
628 shift; \
629 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
630 test -n "$$unique" || unique=$$empty_fix; \
631 if test $$# -gt 0; then \
632 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
633 "$$@" $$unique; \
634 else \
635 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
636 $$unique; \
637 fi; \
638 fi
639ctags: CTAGS
640CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
641 $(TAGS_FILES) $(LISP)
642 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
643 unique=`for i in $$list; do \
644 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
645 done | \
646 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
647 END { if (nonempty) { for (i in files) print i; }; }'`; \
648 test -z "$(CTAGS_ARGS)$$unique" \
649 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
650 $$unique
651
652GTAGS:
653 here=`$(am__cd) $(top_builddir) && pwd` \
654 && $(am__cd) $(top_srcdir) \
655 && gtags -i $(GTAGS_ARGS) "$$here"
656
657distclean-tags:
658 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
659
660distdir: $(DISTFILES)
661 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
662 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
663 list='$(DISTFILES)'; \
664 dist_files=`for file in $$list; do echo $$file; done | \
665 sed -e "s|^$$srcdirstrip/||;t" \
666 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
667 case $$dist_files in \
668 */*) $(MKDIR_P) `echo "$$dist_files" | \
669 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
670 sort -u` ;; \
671 esac; \
672 for file in $$dist_files; do \
673 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
674 if test -d $$d/$$file; then \
675 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
676 if test -d "$(distdir)/$$file"; then \
677 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
678 fi; \
679 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
680 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
681 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
682 fi; \
683 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
684 else \
685 test -f "$(distdir)/$$file" \
686 || cp -p $$d/$$file "$(distdir)/$$file" \
687 || exit 1; \
688 fi; \
689 done
690 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
691 if test "$$subdir" = .; then :; else \
692 test -d "$(distdir)/$$subdir" \
693 || $(MKDIR_P) "$(distdir)/$$subdir" \
694 || exit 1; \
695 fi; \
696 done
697 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
698 if test "$$subdir" = .; then :; else \
699 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
700 $(am__relativize); \
701 new_distdir=$$reldir; \
702 dir1=$$subdir; dir2="$(top_distdir)"; \
703 $(am__relativize); \
704 new_top_distdir=$$reldir; \
705 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
706 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
707 ($(am__cd) $$subdir && \
708 $(MAKE) $(AM_MAKEFLAGS) \
709 top_distdir="$$new_top_distdir" \
710 distdir="$$new_distdir" \
711 am__remove_distdir=: \
712 am__skip_length_check=: \
713 am__skip_mode_fix=: \
714 distdir) \
715 || exit 1; \
716 fi; \
717 done
718check-am: all-am
719check: check-recursive
720all-am: Makefile
721installdirs: installdirs-recursive
722installdirs-am:
723install: install-recursive
724install-exec: install-exec-recursive
725install-data: install-data-recursive
726uninstall: uninstall-recursive
727
728install-am: all-am
729 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
730
731installcheck: installcheck-recursive
732install-strip:
733 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
734 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
735 `test -z '$(STRIP)' || \
736 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
737mostlyclean-generic:
738
739clean-generic:
740
741distclean-generic:
742 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
743 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
744
745maintainer-clean-generic:
746 @echo "This command is intended for maintainers to use"
747 @echo "it deletes files that may require special tools to rebuild."
748 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
749clean: clean-recursive
750
751clean-am: clean-generic clean-libtool mostlyclean-am
752
753distclean: distclean-recursive
754 -rm -f Makefile
755distclean-am: clean-am distclean-generic distclean-tags
756
757dvi: dvi-recursive
758
759dvi-am:
760
761html: html-recursive
762
763html-am:
764
765info: info-recursive
766
767info-am:
768
769install-data-am:
770
771install-dvi: install-dvi-recursive
772
773install-dvi-am:
774
775install-exec-am:
776
777install-html: install-html-recursive
778
779install-html-am:
780
781install-info: install-info-recursive
782
783install-info-am:
784
785install-man:
786
787install-pdf: install-pdf-recursive
788
789install-pdf-am:
790
791install-ps: install-ps-recursive
792
793install-ps-am:
794
795installcheck-am:
796
797maintainer-clean: maintainer-clean-recursive
798 -rm -f Makefile
799maintainer-clean-am: distclean-am maintainer-clean-generic
800
801mostlyclean: mostlyclean-recursive
802
803mostlyclean-am: mostlyclean-generic mostlyclean-libtool
804
805pdf: pdf-recursive
806
807pdf-am:
808
809ps: ps-recursive
810
811ps-am:
812
813uninstall-am:
814
815.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
816 install-am install-strip tags-recursive
817
818.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
819 all all-am check check-am clean clean-generic clean-libtool \
820 ctags ctags-recursive distclean distclean-generic \
821 distclean-libtool distclean-tags distdir dvi dvi-am html \
822 html-am info info-am install install-am install-data \
823 install-data-am install-dvi install-dvi-am install-exec \
824 install-exec-am install-html install-html-am install-info \
825 install-info-am install-man install-pdf install-pdf-am \
826 install-ps install-ps-am install-strip installcheck \
827 installcheck-am installdirs installdirs-am maintainer-clean \
828 maintainer-clean-generic mostlyclean mostlyclean-generic \
829 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
830 uninstall uninstall-am
831
832
833# Tell versions [3.59,3.63) of GNU make to not export all variables.
834# Otherwise a system limit (for SysV at least) may be exceeded.
835.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore/Ecore.h b/libraries/ecore/src/lib/ecore/Ecore.h
deleted file mode 100644
index eace560..0000000
--- a/libraries/ecore/src/lib/ecore/Ecore.h
+++ /dev/null
@@ -1,2502 +0,0 @@
1/**
2 @brief Ecore Library Public API Calls
3
4 These routines are used for Ecore Library interaction
5 */
6
7/**
8
9 @mainpage Ecore
10
11 @version 1.1
12 @date 2000-2012
13
14 Please see the @ref authors page for contact details.
15
16 @section intro Introduction
17
18 Ecore is a library of convenience functions. A brief explanation of how to use
19 it can be found in @ref Ecore_Main_Loop_Page.
20
21 The Ecore library provides the following modules:
22 @li @ref Ecore_Main_Loop_Group
23 @li @ref Ecore_File_Group
24 @li @ref Ecore_Con_Group
25 @li @ref Ecore_Evas_Group
26 @li @ref Ecore_FB_Group
27 @li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink
28 @li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink
29 @li @ref Ecore_Win32_Group
30 @li @ref Ecore_WinCE_Group
31
32 For more info on Ecore usage, there are these @ref Examples.
33
34 @section compiling How to compile using Ecore?
35 pkgconfig (.pc) files are installed for every ecore module.
36 Thus, to compile using any of them, you can use something like the following:
37
38@verbatim
39gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs)
40@endverbatim
41
42 @section install How is it installed?
43
44 Suggested configure options for ecore for a Linux desktop X display
45 with OpenGL and Software support, communication (networking) and
46 IPC (inter process communication):
47
48@verbatim
49./configure \
50 --enable-ecore-con \
51 --enable-ecore-ipc \
52 --enable-ecore-file \
53 --enable-ecore-input \
54 --enable-ecore-input-evas \
55 --enable-ecore-x \
56 --enable-ecore-evas \
57 --enable-ecore-evas-software-buffer \
58 --enable-ecore-evas-software-x11 \
59 --enable-ecore-evas-opengl-x11
60make
61sudo make install
62@endverbatim
63
64 */
65
66/**
67 @page authors Authors
68 @author Carsten Haitzler <raster@rasterman.com>
69 @author Tom Gilbert <tom@linuxbrit.co.uk>
70 @author Burra <burra@colorado.edu>
71 @author Chris Ross <chris@darkrock.co.uk>
72 @author Term <term@twistedpath.org>
73 @author Tilman Sauerbeck <tilman@code-monkey.de>
74 @author Ibukun Olumuyiwa <ibukun@computer.org>
75 @author Yuri <da2001@hotmail.ru>
76 @author Nicholas Curran <quasar@bigblue.net.au>
77 @author Howell Tam <pigeon@pigeond.net>
78 @author Nathan Ingersoll <rbdpngn@users.sourceforge.net>
79 @author Andrew Elcock <andy@elcock.org>
80 @author Kim Woelders <kim@woelders.dk>
81 @author Sebastian Dransfeld <sebastid@tango.flipp.net>
82 @author Simon Poole <simon.armlinux@themalago.net>
83 @author Jorge Luis Zapata Muga <jorgeluis.zapata@gmail.com>
84 @author dan sinclair <zero@everburning.com>
85 @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
86 @author David 'onefang' Seikel <onefang@gmail.com>
87 @author Hisham 'CodeWarrior' Mardam Bey <hisham@hisham.cc>
88 @author Brian 'rephorm' Mattern <rephorm@rephorm.com>
89 @author Tim Horton <hortont424@gmail.com>
90 @author Arnaud de Turckheim 'quarium' <quarium@gmail.com>
91 @author Matt Barclay <mbarclay@gmail.com>
92 @author Peter Wehrfritz <peter.wehrfritz@web.de>
93 @author Albin "Lutin" Tonnerre <albin.tonnerre@gmail.com>
94 @author Vincent Torri <vincent.torri@gmail.com>
95 @author Lars Munch <lars@segv.dk>
96 @author Andre Dieb <andre.dieb@gmail.com>
97 @author Mathieu Taillefumier <mathieu.taillefumier@free.fr>
98 @author Rui Miguel Silva Seabra <rms@1407.org>
99 @author Samsung Electronics
100 @author Samsung SAIT
101 @author Nicolas Aguirre <aguirre.nicolas@gmail.com>
102 @author Brett Nash <nash@nash.id.au>
103 @author Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
104 @author Leif Middelschulte <leif.middelschulte@gmail.com>
105 @author Mike McCormack <mj.mccormack@samsung.com>
106 @author Sangho Park <gouache95@gmail.com>
107 @author Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
108 @author PnB <Poor.NewBie@gmail.com>
109 @author Daniel Juyung Seo <seojuyung2@gmail.com> <juyung.seo@samsung.com>
110 @author Christopher 'devilhorns' Michael <cpmichael1@comcast.net>
111 @author ChunEon Park <hermet@hermet.pe.kr>
112 @author xlopez@igalia.com
113 @author Rafael Antognolli <antognolli@profusion.mobi>
114 @author Kim Yunhan <spbear@gmail.com>
115 @author Youness Alaoui <kakaroto@kakaroto.homelinux.net>
116 @author Bluezery <ohpowel@gmail.com>
117 @author Doyoun Kang <wayofmine@gmail.com> <doyoun.kang@samsung.com>
118 @author Haifeng Deng <haifeng.deng@samsung.com>
119
120 Please contact <enlightenment-devel@lists.sourceforge.net> to get in
121 contact with the developers and maintainers.
122 */
123
124/**
125 * @page Ecore_Main_Loop_Page The Ecore Main Loop
126 *
127 * @section intro What is Ecore?
128 *
129 * Ecore is a clean and tiny event loop library with many modules to do lots of
130 * convenient things for a programmer, to save time and effort. It's small and
131 * lean, designed to work from embedded systems all the way up to large and
132 * powerful multi-cpu workstations. The main loop has a number of primitives to
133 * be used with its main loop. It serializes all the primitives and allows for
134 * great responsiveness without the need for threads(or any other concurrency).
135 *
136 * @subsection timers Timers
137 *
138 * Timers serve two main purposes: doing something at a specified time and
139 * repeatedly doing something with a set interval.
140 * @see Ecore_Timer_Group
141 *
142 * @subsection poolers Poolers
143 *
144 * Poolers allow for pooling to be centralized into a single place therefore
145 * alleviating the need for different parts of the program to wake up at
146 * different times to do pooling, thereby making the code simpler and more
147 * efficient.
148 * @see Ecore_Poller_Group
149 *
150 * @subsection idler Idlers
151 *
152 * There are three types of idlers, enterers, idlers(proper) and exiters, they
153 * are called, respectively, when the program is about to enter an idle state,
154 * when the program is idle and when the program is leaving an idle state. Idler
155 * enterers are usually a good place to update the program state. Proper idlers
156 * are the appropriate place to do heavy computational tasks thereby using what
157 * would otherwise be wasted CPU cycles. Exiters are the perfect place to do
158 * anything your program should do just before processing events(also timers,
159 * poolers, file descriptor handlers and animators)
160 * @see Ecore_Idle_Group
161 *
162 * @subsection fd_handler File descriptor handlers
163 *
164 * File descriptor handlers allow you to monitor when there is data available to
165 * read on file descriptors, when writing will not block or if there was an
166 * error. Any valid file descriptor can be used with this API, regardless of if
167 * was gotten with an OS specific API or from ecore.
168 * @see Ecore_FD_Handler_Group
169 *
170 * @subsection animators Animators
171 *
172 * Ecore provides a facility called animators, so named since the intended use
173 * was in animations, that facilitates knowing what percentage of a given
174 * interval has elapsed. This is perfect for performing animations, but is not
175 * limited to that use, it can, for example, also be used to create a progress
176 * bar.
177 * @see Ecore_Animator_Group
178 *
179 * @subsection ev_handlers Event handlers
180 *
181 * Event handlers are, arguably, the most important feature of the ecore main
182 * loop, they are what allows the programmer to easily handle user interaction.
183 * Events however are not only things the user does, events can represent
184 * anything for which a type is created.
185 * @see Ecore_Event_Group
186 *
187 * All of these primitives are discussed in more detail in their respective
188 * pages linked above.
189 *
190 * Here is a diagram of the main loop flow of a simple program:
191 *
192 * @image html prog_flow.png
193 * @image latex prog_flow.eps width=\textwidth
194 *
195 *
196 *
197 * @section work How does Ecore work?
198 *
199 * Ecore is very easy to learn and use. All the function calls are designed to
200 * be easy to remember, explicit in describing what they do, and heavily
201 * name-spaced. Ecore programs can start and be very simple.
202 *
203 * For example:
204 *
205 * @code
206 * #include <Ecore.h>
207 *
208 * int
209 * main(int argc, const char **argv)
210 * {
211 * ecore_init();
212 * ecore_app_args_set(argc, argv);
213 * ecore_main_loop_begin();
214 * ecore_shutdown();
215 * return 0;
216 * }
217 * @endcode
218 *
219 * This program is very simple and doesn't check for errors, but it does start up
220 * and begin a main loop waiting for events or timers to tick off. This program
221 * doesn't set up any, but now we can expand on this simple program a little
222 * more by adding some event handlers and timers.
223 *
224 * @code
225 * #include <Ecore.h>
226 *
227 * Ecore_Timer *timer1 = NULL;
228 * Ecore_Event_Handler *handler1 = NULL;
229 * double start_time = 0.0;
230 *
231 * int
232 * timer_func(void *data)
233 * {
234 * printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time);
235 * return 1;
236 * }
237 *
238 * int
239 * exit_func(void *data, int ev_type, void *ev)
240 * {
241 * Ecore_Event_Signal_Exit *e;
242 *
243 * e = (Ecore_Event_Signal_Exit *)ev;
244 * if (e->interrupt) printf("Exit: interrupt\n");
245 * else if (e->quit) printf("Exit: quit\n");
246 * else if (e->terminate) printf("Exit: terminate\n");
247 * ecore_main_loop_quit();
248 * return 1;
249 * }
250 *
251 * int
252 * main(int argc, const char **argv)
253 * {
254 * ecore_init();
255 * ecore_app_args_set(argc, argv);
256 * start_time = ecore_time_get();
257 * handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
258 * timer1 = ecore_timer_add(0.5, timer_func, NULL);
259 * ecore_main_loop_begin();
260 * ecore_shutdown();
261 * return 0;
262 * }
263 * @endcode
264 *
265 * In the previous example, we initialize our application and get the time at
266 * which our program has started so we can calculate an offset. We set
267 * up a timer to tick off in 0.5 seconds, and since it returns 1, will
268 * keep ticking off every 0.5 seconds until it returns 0, or is deleted
269 * by hand. An event handler is set up to call a function -
270 * exit_func(),
271 * whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C
272 * on the command line will cause such an event to happen). If this event
273 * occurs it tells you what kind of exit signal was received, and asks
274 * the main loop to quit when it is finished by calling
275 * ecore_main_loop_quit().
276 *
277 * The handles returned by ecore_timer_add() and
278 * ecore_event_handler_add() are
279 * only stored here as an example. If you don't need to address the timer or
280 * event handler again you don't need to store the result, so just call the
281 * function, and don't assign the result to any variable.
282 *
283 * This program looks slightly more complex than needed to do these simple
284 * things, but in principle, programs don't get any more complex. You add more
285 * event handlers, for more events, will have more timers and such, BUT it all
286 * follows the same principles as shown in this example.
287 *
288 */
289
290/*
291 @page Ecore_Config_Page The Enlightened Property Library
292
293 The Enlightened Property Library (Ecore_Config) is an abstraction
294 from the complexities of writing your own configuration. It provides
295 many features using the Enlightenment 17 development libraries.
296
297 To use the library, you:
298 @li Set the default values of your properties.
299 @li Load the configuration from a file. You must set the default values
300 first, so that the library knows the correct type of each argument.
301
302 The following examples show how to use the Enlightened Property Library:
303 @li @link config_basic_example.c config_basic_example.c @endlink
304 @li @link config_listener_example.c config_listener_example.c @endlink
305
306 */
307
308/**
309 @page X_Window_System_Page X Window System
310
311 The Ecore library includes a wrapper for handling the X window system.
312 This page briefly explains what the X window system is and various terms
313 that are used.
314 */
315
316#ifndef _ECORE_H
317#define _ECORE_H
318
319#ifdef _MSC_VER
320# include <Evil.h>
321#endif
322
323#include <Eina.h>
324
325#ifdef EAPI
326# undef EAPI
327#endif
328
329#ifdef _WIN32
330# ifdef EFL_ECORE_BUILD
331# ifdef DLL_EXPORT
332# define EAPI __declspec(dllexport)
333# else
334# define EAPI
335# endif /* ! DLL_EXPORT */
336# else
337# define EAPI __declspec(dllimport)
338# endif /* ! EFL_ECORE_BUILD */
339#else
340# ifdef __GNUC__
341# if __GNUC__ >= 4
342# define EAPI __attribute__ ((visibility("default")))
343# else
344# define EAPI
345# endif
346# else
347# define EAPI
348# endif
349#endif /* ! _WIN32 */
350
351#ifdef _WIN32
352# include <winsock2.h>
353#elif (defined (__FreeBSD__) && (__FreeBSD_version >= 420001)) || defined (__OpenBSD__)
354# include <sys/select.h>
355# include <signal.h>
356#else
357# include <sys/time.h>
358# if !defined (EXOTIC_NO_SIGNAL)
359# include <signal.h>
360# endif
361#endif
362
363#include <sys/types.h>
364
365#ifdef __cplusplus
366extern "C" {
367#endif
368
369/**
370 * @defgroup Ecore_Init_Group Ecore initialization and shutdown functions.
371 *
372 * @{
373 */
374
375EAPI int ecore_init(void);
376EAPI int ecore_shutdown(void);
377
378/**
379 * @}
380 */
381
382/**
383 * @defgroup Ecore_Main_Loop_Group Ecore main loop
384 *
385 * This group discusses functions that are acting on Ecore's main loop itself or
386 * on events and infrastructure directly linked to it. Most programs only need
387 * to start and end the main loop, the rest of the function discussed here are
388 * meant to be used in special situations, and with great care.
389 *
390 * For details on the usage of ecore's main loop and how it interacts with other
391 * ecore facilities see: @ref Ecore_Main_Loop_Page.
392 *
393 * @{
394 */
395
396#define ECORE_VERSION_MAJOR 1
397#define ECORE_VERSION_MINOR 2
398
399typedef struct _Ecore_Version
400{
401 int major;
402 int minor;
403 int micro;
404 int revision;
405} Ecore_Version;
406
407EAPI extern Ecore_Version *ecore_version;
408
409#define ECORE_CALLBACK_CANCEL EINA_FALSE /**< Return value to remove a callback */
410#define ECORE_CALLBACK_RENEW EINA_TRUE /**< Return value to keep a callback */
411
412#define ECORE_CALLBACK_PASS_ON EINA_TRUE /**< Return value to pass event to next handler */
413#define ECORE_CALLBACK_DONE EINA_FALSE /**< Return value to stop event handling */
414
415/**
416 * @typedef Ecore_Task_Cb Ecore_Task_Cb
417 * A callback run for a task (timer, idler, poller, animator, etc)
418 */
419typedef Eina_Bool (*Ecore_Task_Cb)(void *data);
420
421/**
422 * @typedef Ecore_Eselect_Function
423 * A function which can be used to replace select() in the main loop
424 */
425typedef int (*Ecore_Select_Function)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
426
427EAPI void ecore_main_loop_iterate(void);
428
429EAPI void ecore_main_loop_select_func_set(Ecore_Select_Function func);
430EAPI Ecore_Select_Function ecore_main_loop_select_func_get(void);
431
432EAPI Eina_Bool ecore_main_loop_glib_integrate(void);
433EAPI void ecore_main_loop_glib_always_integrate_disable(void);
434
435EAPI void ecore_main_loop_begin(void);
436EAPI void ecore_main_loop_quit(void);
437
438/**
439 * @typedef Ecore_Cb Ecore_Cb
440 * A generic callback called as a hook when a certain point in
441 * execution is reached.
442 */
443typedef void (*Ecore_Cb)(void *data);
444
445/**
446 * @typedef Ecore_Data_Cb Ecore_Data_Cb
447 * A callback which is used to return data to the main function
448 */
449typedef void *(*Ecore_Data_Cb)(void *data);
450
451/**
452 * @brief Call callback asynchronously in the main loop.
453 * @since 1.1.0
454 *
455 * @param callback The callback to call in the main loop
456 * @param data The data to give to that call back
457 *
458 * For all calls that need to happen in the main loop (most EFL functions do),
459 * this helper function provides the infrastructure needed to do it safely
460 * by avoiding dead lock, race condition and properly wake up the main loop.
461 *
462 * Remember after that function call, you should never touch again the @p data
463 * in the thread, it is owned by the main loop and your callback should take
464 * care of freeing it if necessary.
465 */
466EAPI void ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, void *data);
467
468/**
469 * @brief Call callback synchronously in the main loop.
470 * @since 1.1.0
471 *
472 * @param callback The callback to call in the main loop
473 * @param data The data to give to that call back
474 * @return the value returned by the callback in the main loop
475 *
476 * For all calls that need to happen in the main loop (most EFL functions do),
477 * this helper function provides the infrastructure needed to do it safely
478 * by avoiding dead lock, race condition and properly wake up the main loop.
479 *
480 * Remember this function will block until the callback is executed in the
481 * main loop. It can take time and you have no guaranty about the timeline.
482 */
483EAPI void *ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, void *data);
484
485/**
486 * @brief This function suspend the main loop in a know state
487 * @since 1.1.0
488 *
489 * @result the number of time ecore_thread_main_loop_begin() has been called
490 * in this thread, if the main loop was suspended correctly. If not, it return @c -1.
491 *
492 * This function suspend the main loop in a know state, this let you
493 * use any EFL call you want after it return. Be carefully, the main loop
494 * is blocked until you call ecore_thread_main_loop_end(). This is
495 * the only sane way to achieve pseudo thread safety.
496 *
497 * Notice that until the main loop is blocked, the thread is blocked
498 * and their is noway around that.
499 *
500 * We still advise you, when possible, to use ecore_main_loop_thread_safe_call_async()
501 * as it will not block the thread nor the main loop.
502 */
503EAPI int ecore_thread_main_loop_begin(void);
504
505/**
506 * @brief Unlock the main loop.
507 * @since 1.1.0
508 *
509 * @result the number of time ecore_thread_main_loop_end() need to be called before
510 * the main loop is unlocked again. @c -1 will be returned if you are trying to unlock
511 * when there wasn't enough call to ecore_thread_main_loop_begin().
512 *
513 * After a call to ecore_thread_main_loop_begin(), you need to absolutely
514 * call ecore_thread_main_loop_end(), or you application will stay frozen.
515 */
516EAPI int ecore_thread_main_loop_end(void);
517
518/**
519 * @}
520 */
521
522/**
523 * @defgroup Ecore_Event_Group Ecore Event functions
524 *
525 * Ecore events provide two main features that are of use to those using ecore:
526 * creating events and being notified of events. Those two will usually be used
527 * in different contexts, creating events is mainly done by libraries wrapping
528 * some system functionality while being notified of events is mainly a
529 * necessity of applications.
530 *
531 * For a program to be notified of events it's interested in it needs to have a
532 * function to process the event and to register that function as the callback
533 * to the event, that's all:
534 * @code
535 * ecore_event_handler_add(EVENT_TYPE, _my_event_handler, some_data);
536 * ...
537 * static Eina_Bool
538 * _my_event_handler(void *data, int type, void *event)
539 * {
540 * //data is some_data
541 * //event is provided by whoever created the event
542 * //Do really cool stuff with event
543 * }
544 * @endcode
545 *
546 * One very important thing to note here is the @c EVENT_TYPE, to register a
547 * handler for an event you must know it's type before hand. This information
548 * can be found on the documentation of the library emitting the signal, so,
549 * for example, for events related to windowing one would look in @ref
550 * Ecore_Evas_Group.
551 *
552 * Examples of libraries that integrate into ecore's main loop by providing
553 * events are @ref Ecore_Con_Group, @ref Ecore_Evas_Group and @ref
554 * Ecore_Exe_Group amongst others. This usage can be divided into two parts,
555 * setup and adding events. The setup is very simple, all that needs doing is
556 * getting a type id for the event:
557 * @code
558 * int MY_EV_TYPE = ecore_event_type_new();
559 * @endcode
560 * @note This variable should be declared in the header since it'll be needed by
561 * anyone wishing to register a handler to your event.
562 *
563 * The complexity of adding of an event to the queue depends on whether that
564 * event sends uses @c event, if it doesn't it a one-liner:
565 * @code
566 * ecore_event_add(MY_EV_TYPE, NULL, NULL, NULL);
567 * @endcode
568 * The usage when an @c event is needed is not that much more complex and can be
569 * seen in @ref ecore_event_add.
570 *
571 * Example that deals with events:
572 *
573 * @li @ref ecore_event_example_c
574 *
575 * @ingroup Ecore_Main_Loop_Group
576 *
577 * @{
578 */
579
580#define ECORE_EVENT_NONE 0
581#define ECORE_EVENT_SIGNAL_USER 1 /**< User signal event */
582#define ECORE_EVENT_SIGNAL_HUP 2 /**< Hup signal event */
583#define ECORE_EVENT_SIGNAL_EXIT 3 /**< Exit signal event */
584#define ECORE_EVENT_SIGNAL_POWER 4 /**< Power signal event */
585#define ECORE_EVENT_SIGNAL_REALTIME 5 /**< Realtime signal event */
586#define ECORE_EVENT_COUNT 6
587
588typedef struct _Ecore_Win32_Handler Ecore_Win32_Handler; /**< A handle for HANDLE handlers on Windows */
589typedef struct _Ecore_Event_Handler Ecore_Event_Handler; /**< A handle for an event handler */
590typedef struct _Ecore_Event_Filter Ecore_Event_Filter; /**< A handle for an event filter */
591typedef struct _Ecore_Event Ecore_Event; /**< A handle for an event */
592typedef struct _Ecore_Event_Signal_User Ecore_Event_Signal_User; /**< User signal event */
593typedef struct _Ecore_Event_Signal_Hup Ecore_Event_Signal_Hup; /**< Hup signal event */
594typedef struct _Ecore_Event_Signal_Exit Ecore_Event_Signal_Exit; /**< Exit signal event */
595typedef struct _Ecore_Event_Signal_Power Ecore_Event_Signal_Power; /**< Power signal event */
596typedef struct _Ecore_Event_Signal_Realtime Ecore_Event_Signal_Realtime; /**< Realtime signal event */
597
598/**
599 * @typedef Ecore_Filter_Cb
600 * A callback used for filtering events from the main loop.
601 */
602typedef Eina_Bool (*Ecore_Filter_Cb)(void *data, void *loop_data, int type, void *event);
603
604/**
605 * @typedef Ecore_End_Cb Ecore_End_Cb
606 * This is the callback which is called at the end of a function,
607 * usually for cleanup purposes.
608 */
609typedef void (*Ecore_End_Cb)(void *user_data, void *func_data);
610
611/**
612 * @typedef Ecore_Event_Handler_Cb Ecore_Event_Handler_Cb
613 * A callback used by the main loop to handle events of a specified
614 * type.
615 */
616typedef Eina_Bool (*Ecore_Event_Handler_Cb)(void *data, int type, void *event);
617
618struct _Ecore_Event_Signal_User /** User signal event */
619{
620 int number; /**< The signal number. Either 1 or 2 */
621 void *ext_data; /**< Extension data - not used */
622
623#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
624 siginfo_t data; /**< Signal info */
625#endif
626};
627
628struct _Ecore_Event_Signal_Hup /** Hup signal event */
629{
630 void *ext_data; /**< Extension data - not used */
631
632#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
633 siginfo_t data; /**< Signal info */
634#endif
635};
636
637struct _Ecore_Event_Signal_Exit /** Exit request event */
638{
639 Eina_Bool interrupt : 1; /**< Set if the exit request was an interrupt signal*/
640 Eina_Bool quit : 1; /**< set if the exit request was a quit signal */
641 Eina_Bool terminate : 1; /**< Set if the exit request was a terminate signal */
642 void *ext_data; /**< Extension data - not used */
643
644#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
645 siginfo_t data; /**< Signal info */
646#endif
647};
648
649struct _Ecore_Event_Signal_Power /** Power event */
650{
651 void *ext_data; /**< Extension data - not used */
652
653#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
654 siginfo_t data; /**< Signal info */
655#endif
656};
657
658struct _Ecore_Event_Signal_Realtime /** Realtime event */
659{
660 int num; /**< The realtime signal's number */
661
662#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
663 siginfo_t data; /**< Signal info */
664#endif
665};
666
667/**
668 * @brief Add an event handler.
669 * @param type The type of the event this handler will get called for
670 * @param func The function to call when the event is found in the queue
671 * @param data A data pointer to pass to the called function @p func
672 * @return A new Event handler, or NULL on failure
673 *
674 * Add an event handler to the list of handlers. This will, on success, return
675 * a handle to the event handler object that was created, that can be used
676 * later to remove the handler using ecore_event_handler_del(). The @p type
677 * parameter is the integer of the event type that will trigger this callback
678 * to be called. The callback @p func is called when this event is processed
679 * and will be passed the event type, a pointer to the private event
680 * structure that is specific to that event type, and a data pointer that is
681 * provided in this call as the @p data parameter.
682 *
683 * When the callback @p func is called, it must return 1 or 0. If it returns
684 * 1 (or ECORE_CALLBACK_PASS_ON), It will keep being called as per normal, for
685 * each handler set up for that event type. If it returns 0 (or
686 * ECORE_CALLBACK_DONE), it will cease processing handlers for that particular
687 * event, so all handler set to handle that event type that have not already
688 * been called, will not be.
689 */
690EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data);
691/**
692 * @brief Delete an event handler.
693 * @param event_handler Event handler handle to delete
694 * @return Data passed to handler
695 *
696 * Delete a specified event handler from the handler list. On success this will
697 * delete the event handler and return the pointer passed as @p data when the
698 * handler was added by ecore_event_handler_add(). On failure NULL will be
699 * returned. Once a handler is deleted it will no longer be called.
700 */
701EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler);
702/**
703 * @brief Add an event to the event queue.
704 * @param type The event type to add to the end of the event queue
705 * @param ev The data structure passed as @c event to event handlers
706 * @param func_free The function to be called to free @a ev
707 * @param data The data pointer to be passed to the free function
708 * @return A Handle for that event on success, otherwise NULL
709 *
710 * If it succeeds, an event of type @a type will be added to the queue for
711 * processing by event handlers added by ecore_event_handler_add(). The @a ev
712 * parameter will be passed as the @c event parameter of the handler. When the
713 * event is no longer needed, @a func_free will be called and passed @a ev for
714 * cleaning up. If @p func_free is NULL, free() will be called with the private
715 * structure pointer.
716 */
717EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
718/**
719 * @brief Delete an event from the queue.
720 * @param event The event handle to delete
721 * @return The data pointer originally set for the event free function
722 *
723 * This deletes the event @p event from the event queue, and returns the
724 * @p data parameter originally set when adding it with ecore_event_add(). This
725 * does not immediately call the free function, and it may be called later on
726 * cleanup, and so if the free function depends on the data pointer to work,
727 * you should defer cleaning of this till the free function is called later.
728 */
729EAPI void *ecore_event_del(Ecore_Event *event);
730/**
731 * @brief Get the data associated with an #Ecore_Event_Handler
732 * @param eh The event handler
733 * @return The data
734 *
735 * This function returns the data previously associated with @p eh by
736 * ecore_event_handler_add().
737 */
738EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh);
739/**
740 * @brief Set the data associated with an #Ecore_Event_Handler
741 * @param eh The event handler
742 * @param data The data to associate
743 * @return The previous data
744 *
745 * This function sets @p data to @p eh and returns the old data pointer
746 * which was previously associated with @p eh by ecore_event_handler_add().
747 */
748EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data);
749/**
750 * @brief Allocate a new event type id sensibly and return the new id.
751 * @return A new event type id.
752 *
753 * This function allocates a new event type id and returns it. Once an event
754 * type has been allocated it can never be de-allocated during the life of
755 * the program. There is no guarantee of the contents of this event ID, or how
756 * it is calculated, except that the ID will be unique to the current instance
757 * of the process.
758 */
759EAPI int ecore_event_type_new(void);
760/**
761 * @brief Add a filter the current event queue.
762 *
763 * @param func_start Function to call just before filtering and return data
764 * @param func_filter Function to call on each event
765 * @param func_end Function to call after the queue has been filtered
766 * @param data Data to pass to the filter functions
767 * @return A filter handle on success, NULL otherwise
768 *
769 * Adds a callback to filter events from the event queue. Filters are called on
770 * the queue just before Event handler processing to try and remove redundant
771 * events. Just as processing is about to start @a func_start is called and
772 * passed the @a data pointer, the return value of this functions is passed to
773 * @a func_filter as loop_data. @a func_filter is also passed @a data and the
774 * event type and event structure. If this @a func_filter returns #EINA_FALSE,
775 * the event is removed from the queue, if it returns #EINA_TRUE, the event is
776 * kept. When processing is finished @p func_end is called and is passed the
777 * loop_data(returned by @c func_start) and @p data pointer to clean up.
778 */
779EAPI 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);
780/**
781 * @brief Delete an event filter.
782 * @param ef The event filter handle
783 * @return The data set for the filter on success, NULL otherwise
784 *
785 * Delete a filter that has been added by its @p ef handle.
786 */
787EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef);
788/**
789 * @brief Return the current event type being handled.
790 * @return The current event type being handled if inside a handler callback,
791 * ECORE_EVENT_NONE otherwise
792 *
793 * If the program is currently inside an Ecore event handler callback this
794 * will return the type of the current event being processed.
795 *
796 * This is useful when certain Ecore modules such as Ecore_Evas "swallow"
797 * events and not all the original information is passed on. In special cases
798 * this extra information may be useful or needed and using this call can let
799 * the program know if the event type being handled is one it wants to get more
800 * information about.
801 */
802EAPI int ecore_event_current_type_get(void);
803/**
804 * @brief Return the current event type pointer handled.
805 * @return The current event pointer being handled if inside a handler callback,
806 * NULL otherwise
807 *
808 * If the program is currently inside an Ecore event handler callback this
809 * will return the pointer of the current event being processed.
810 *
811 * This is useful when certain Ecore modules such as Ecore_Evas "swallow"
812 * events and not all the original information is passed on. In special cases
813 * this extra information may be useful or needed and using this call can let
814 * the program access the event data if the type of the event is handled by
815 * the program.
816 */
817EAPI void *ecore_event_current_event_get(void);
818
819/**
820 * @}
821 */
822
823/**
824 * @defgroup Ecore_Exe_Group Process Spawning Functions
825 *
826 * Functions that deal with and send signals to spawned processes.
827 *
828 * @ingroup Ecore_Main_Loop_Group
829 *
830 * @{
831 */
832
833/** Inherit priority from parent process */
834#define ECORE_EXE_PRIORITY_INHERIT 9999
835
836EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */
837EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistent with the rest of ecore). */
838EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */
839EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */
840
841enum _Ecore_Exe_Flags /* flags for executing a child with its stdin and/or stdout piped back */
842{
843 ECORE_EXE_NONE = 0, /**< No exe flags at all */
844 ECORE_EXE_PIPE_READ = 1, /**< Exe Pipe Read mask */
845 ECORE_EXE_PIPE_WRITE = 2, /**< Exe Pipe Write mask */
846 ECORE_EXE_PIPE_ERROR = 4, /**< Exe Pipe error mask */
847 ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and split 1 line per Ecore_Exe_Event_Data_Line */
848 ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and split 1 line per Ecore_Exe_Event_Data_Line */
849 ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
850 ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
851 ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */
852 ECORE_EXE_NOT_LEADER = 256, /**< Do not use setsid() to have the executed process be its own session leader */
853 ECORE_EXE_TERM_WITH_PARENT = 512 /**< Makes child receive SIGTERM when parent dies. */
854};
855typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
856
857enum _Ecore_Exe_Win32_Priority
858{
859 ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */
860 ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */
861 ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */
862 ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */
863 ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */
864 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 */
865};
866typedef enum _Ecore_Exe_Win32_Priority Ecore_Exe_Win32_Priority;
867
868typedef struct _Ecore_Exe Ecore_Exe; /**< A handle for spawned processes */
869
870/**
871 * @typedef Ecore_Exe_Cb Ecore_Exe_Cb
872 * A callback to run with the associated @ref Ecore_Exe, usually
873 * for cleanup purposes.
874 */
875typedef void (*Ecore_Exe_Cb)(void *data, const Ecore_Exe *exe);
876
877typedef struct _Ecore_Exe_Event_Add Ecore_Exe_Event_Add; /**< Spawned Exe add event */
878typedef struct _Ecore_Exe_Event_Del Ecore_Exe_Event_Del; /**< Spawned Exe exit event */
879typedef struct _Ecore_Exe_Event_Data_Line Ecore_Exe_Event_Data_Line; /**< Lines from a child process */
880typedef struct _Ecore_Exe_Event_Data Ecore_Exe_Event_Data; /**< Data from a child process */
881
882struct _Ecore_Exe_Event_Add /** Process add event */
883{
884 Ecore_Exe *exe; /**< The handle to the added process */
885 void *ext_data; /**< Extension data - not used */
886};
887
888struct _Ecore_Exe_Event_Del /** Process exit event */
889{
890 pid_t pid; /**< The process ID of the process that exited */
891 int exit_code; /**< The exit code of the process */
892 Ecore_Exe *exe; /**< The handle to the exited process, or NULL if not found */
893 int exit_signal; /** < The signal that caused the process to exit */
894 Eina_Bool exited : 1; /** < set to 1 if the process exited of its own accord */
895 Eina_Bool signalled : 1; /** < set to 1 id the process exited due to uncaught signal */
896 void *ext_data; /**< Extension data - not used */
897#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
898 siginfo_t data; /**< Signal info */
899#endif
900};
901
902struct _Ecore_Exe_Event_Data_Line /**< Lines from a child process */
903{
904 char *line;
905 int size;
906};
907
908struct _Ecore_Exe_Event_Data /** Data from a child process event */
909{
910 Ecore_Exe *exe; /**< The handle to the process */
911 void *data; /**< the raw binary data from the child process that was received */
912 int size; /**< the size of this data in bytes */
913 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 */
914};
915
916EAPI void ecore_exe_run_priority_set(int pri);
917EAPI int ecore_exe_run_priority_get(void);
918EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
919EAPI Ecore_Exe *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data);
920EAPI void ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func);
921EAPI Eina_Bool ecore_exe_send(Ecore_Exe *exe, const void *data, int size);
922EAPI void ecore_exe_close_stdin(Ecore_Exe *exe);
923EAPI void ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines);
924EAPI Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags);
925EAPI void ecore_exe_event_data_free(Ecore_Exe_Event_Data *data);
926EAPI void *ecore_exe_free(Ecore_Exe *exe);
927EAPI pid_t ecore_exe_pid_get(const Ecore_Exe *exe);
928EAPI void ecore_exe_tag_set(Ecore_Exe *exe, const char *tag);
929EAPI const char *ecore_exe_tag_get(const Ecore_Exe *exe);
930EAPI const char *ecore_exe_cmd_get(const Ecore_Exe *exe);
931EAPI void *ecore_exe_data_get(const Ecore_Exe *exe);
932EAPI void *ecore_exe_data_set(Ecore_Exe *exe, void *data);
933EAPI Ecore_Exe_Flags ecore_exe_flags_get(const Ecore_Exe *exe);
934EAPI void ecore_exe_pause(Ecore_Exe *exe);
935EAPI void ecore_exe_continue(Ecore_Exe *exe);
936EAPI void ecore_exe_interrupt(Ecore_Exe *exe);
937EAPI void ecore_exe_quit(Ecore_Exe *exe);
938EAPI void ecore_exe_terminate(Ecore_Exe *exe);
939EAPI void ecore_exe_kill(Ecore_Exe *exe);
940EAPI void ecore_exe_signal(Ecore_Exe *exe, int num);
941EAPI void ecore_exe_hup(Ecore_Exe *exe);
942
943/**
944 * @}
945 */
946
947/**
948 * @defgroup Ecore_FD_Handler_Group File Event Handling Functions
949 *
950 * @brief Functions that deal with file descriptor handlers.
951 *
952 * File descriptor handlers facilitate reading, writing and checking for errors
953 * without blocking the program or doing expensive pooling. This can be used to
954 * monitor a socket, pipe, or other stream for which an FD can be had.
955 *
956 * @warning This function @b can't be used for monitoring to regular files!
957 *
958 * One common FD to be monitored is the standard input(stdin), monitoring it for
959 * reading requires a single call:
960 * @code
961 * static Eina_Bool
962 * _my_cb_func(void *data, Ecore_Fd_Handler *handler)
963 * {
964 * char c;
965 * scanf("%c", &c); //Guaranteed not to block
966 * ... do stuff with c ...
967 * }
968 * ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _my_cb_func, NULL, NULL, NULL);
969 * @endcode
970 *
971 * When using a socket, pipe or other stream it's important to remember that
972 * errors may occur and as such to monitor not only for reading/writing but also
973 * for errors using the @ref ECORE_FD_ERROR flag.
974 *
975 * Example of use of a file descriptor handler:
976 * @li @ref ecore_fd_handler_example_c
977 *
978 * @ingroup Ecore_Main_Loop_Group
979 *
980 * @{
981 */
982
983typedef struct _Ecore_Fd_Handler Ecore_Fd_Handler; /**< A handle for Fd handlers */
984
985enum _Ecore_Fd_Handler_Flags
986{
987 ECORE_FD_READ = 1, /**< Fd Read mask */
988 ECORE_FD_WRITE = 2, /**< Fd Write mask */
989 ECORE_FD_ERROR = 4 /**< Fd Error mask */
990};
991typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
992
993/**
994 * @typedef Ecore_Fd_Cb Ecore_Fd_Cb
995 * A callback used by an @ref Ecore_Fd_Handler.
996 */
997typedef Eina_Bool (*Ecore_Fd_Cb)(void *data, Ecore_Fd_Handler *fd_handler);
998
999/**
1000 * @typedef Ecore_Fd_Prep_Cb Ecore_Fd_Prep_Cb
1001 * A callback used by an @ref Ecore_Fd_Handler.
1002 */
1003typedef void (*Ecore_Fd_Prep_Cb)(void *data, Ecore_Fd_Handler *fd_handler);
1004
1005/**
1006 * @typedef Ecore_Win32_Handle_Cb Ecore_Win32_Handle_Cb
1007 * A callback used by an @ref Ecore_Win32_Handler.
1008 */
1009typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh);
1010
1011/**
1012 * @brief Adds a callback for activity on the given file descriptor.
1013 *
1014 * @param fd The file descriptor to watch.
1015 * @param flags To monitor it for reading use @c ECORE_FD_READ, for writing @c
1016 * ECORE_FD_WRITE, and for error @c ECORE_FD_ERROR. Values bay |(ored).
1017 * @param func The callback function.
1018 * @param data The data to pass to the callback.
1019 * @param buf_func The function to call to check if any data has been buffered
1020 * and already read from the fd. May be @c NULL.
1021 * @param buf_data The data to pass to the @p buf_func function.
1022 * @return A fd handler handle on success, @c NULL otherwise.
1023 *
1024 * @a func will be called during the execution of @ref Ecore_Main_Loop_Page
1025 * when the file descriptor is available for reading, writing, or there has been
1026 * an error(depending on the given @a flags).
1027 *
1028 * When @a func returns ECORE_CALLBACK_CANCEL, it indicates that the
1029 * handler should be marked for deletion (identical to calling @ref
1030 * ecore_main_fd_handler_del).
1031 *
1032 * @warning @a buf_func is meant for @b internal use only and should be @b
1033 * avoided.
1034 *
1035 * The return value of @a buf_func has a different meaning, when it returns
1036 * ECORE_CALLBACK_CANCEL, it indicates that @a func @b shouldn't be called, and
1037 * when it returns ECORE_CALLBACK_RENEW it indicates @a func should be called.
1038 * The return value of @a buf_func will not cause the FD handler to be deleted.
1039 *
1040 * @a buf_func is called during event loop handling to check if data that has
1041 * been read from the file descriptor is in a buffer and is available to read.
1042 * Some systems, notably xlib, handle their own buffering, and would otherwise
1043 * not work with select(). These systems should use a @a buf_func. This is a
1044 * most annoying hack, only ecore_x uses it, so refer to that for an example.
1045 */
1046EAPI 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);
1047/**
1048 * @brief Set the prepare callback with data for a given #Ecore_Fd_Handler
1049 *
1050 * @param fd_handler The fd handler
1051 * @param func The prep function
1052 * @param data The data to pass to the prep function
1053 *
1054 * This function will be called prior to any fd handler's callback function
1055 * (even the other fd handlers), before entering the main loop select function.
1056 *
1057 * @note Once a prepare callback is set for a fd handler, it cannot be changed.
1058 * You need to delete the fd handler and create a new one, to set another
1059 * callback.
1060 * @note You probably don't need this function. It is only necessary for very
1061 * uncommon cases that need special behavior.
1062 */
1063EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data);
1064/**
1065 * @brief Marks an FD handler for deletion.
1066 * @param fd_handler The FD handler.
1067 * @return The data pointer set using @ref ecore_main_fd_handler_add, for @a
1068 * fd_handler on success, @c NULL otherwise.
1069 * This function marks an fd handler to be deleted during an iteration of the
1070 * main loop. It does NOT close the associated fd!
1071 *
1072 * @warning If the underlying fd is already closed ecore may complain if the
1073 * main loop is using epoll internally, and also in some rare cases this may
1074 * cause crashes and instability. Remember to delete your fd handlers before the
1075 * fds they listen to are closed.
1076 */
1077EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
1078/**
1079 * @brief Retrieves the file descriptor that the given handler is handling.
1080 * @param fd_handler The given FD handler.
1081 * @return The file descriptor the handler is watching.
1082 */
1083EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
1084/**
1085 * @brief Gets which flags are active on an FD handler.
1086 * @param fd_handler The given FD handler.
1087 * @param flags The flags, @c ECORE_FD_READ, @c ECORE_FD_WRITE or @c
1088 * ECORE_FD_ERROR to query.
1089 * @return #EINA_TRUE if any of the given flags are active, #EINA_FALSE
1090 * otherwise.
1091 */
1092EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
1093/**
1094 * @brief Set what active streams the given FD handler should be monitoring.
1095 * @param fd_handler The given FD handler.
1096 * @param flags The flags to be watching.
1097 */
1098EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
1099
1100EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data);
1101EAPI void *ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler);
1102
1103/**
1104 * @}
1105 */
1106
1107/**
1108 * @defgroup Ecore_Poller_Group Ecore Poll functions
1109 *
1110 * Ecore poller provides infrastructure for the creation of pollers. Pollers
1111 * are, in essence, callbacks that share a single timer per type. Because not
1112 * all pollers need to be called at the same frequency the user may specify the
1113 * frequency in ticks(each expiration of the shared timer is called a tick, in
1114 * ecore poller parlance) for each added poller. Ecore pollers should only be
1115 * used when the poller doesn't have specific requirements on the exact times
1116 * to poll.
1117 *
1118 * This architecture means that the main loop is only woken up once to handle
1119 * all pollers of that type, this will save power as the CPU has more of a
1120 * chance to go into a low power state the longer it is asleep for, so this
1121 * should be used in situations where power usage is a concern.
1122 *
1123 * For now only 1 core poller type is supported: ECORE_POLLER_CORE, the default
1124 * interval for ECORE_POLLER_CORE is 0.125(or 1/8th) second.
1125 *
1126 * The creation of a poller is extremely simple and only required one line:
1127 * @code
1128 * ecore_poller_add(ECORE_POLLER_CORE, 1, my_poller_function, NULL);
1129 * @endcode
1130 * This sample creates a poller to call @c my_poller_function at every tick with
1131 * @c NULL as data.
1132 *
1133 * Example:
1134 * @li @ref ecore_poller_example_c
1135 *
1136 * @ingroup Ecore_Main_Loop_Group
1137 *
1138 * @{
1139 */
1140
1141enum _Ecore_Poller_Type /* Poller types */
1142{
1143 ECORE_POLLER_CORE = 0 /**< The core poller interval */
1144};
1145typedef enum _Ecore_Poller_Type Ecore_Poller_Type;
1146
1147typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */
1148
1149/**
1150 * @brief Sets the time(in seconds) between ticks for the given poller type.
1151 * @param type The poller type to adjust.
1152 * @param poll_time The time(in seconds) between ticks of the timer.
1153 *
1154 * This will adjust the time between ticks of the given timer type defined by
1155 * @p type to the time period defined by @p poll_time.
1156 */
1157EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time);
1158/**
1159 * @brief Gets the time(in seconds) between ticks for the given poller type.
1160 * @param type The poller type to query.
1161 * @return The time in seconds between ticks of the poller timer.
1162 *
1163 * This will get the time between ticks of the specified poller timer.
1164 */
1165EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type);
1166/**
1167 * @brief Changes the polling interval rate of @p poller.
1168 * @param poller The Ecore_Poller to change the interval of.
1169 * @param interval The tick interval to set; must be a power of 2 and <= 32768.
1170 * @return Returns true on success, false on failure.
1171 *
1172 * This allows the changing of a poller's polling interval. It is useful when
1173 * you want to alter a poll rate without deleting and re-creating a poller.
1174 */
1175EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval);
1176/**
1177 * @brief Gets the polling interval rate of @p poller.
1178 * @param poller The Ecore_Poller to change the interval of.
1179 * @return Returns the interval, in ticks, that @p poller polls at.
1180 *
1181 * This returns a poller's polling interval, or 0 on error.
1182 */
1183EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller);
1184/**
1185 * @brief Creates a poller to call the given function at a particular tick interval.
1186 * @param type The ticker type to attach the poller to. Must be ECORE_POLLER_CORE.
1187 * @param interval The poll interval.
1188 * @param func The poller function.
1189 * @param data Data to pass to @a func when it is called.
1190 * @return A poller object on success, @c NULL otherwise.
1191 *
1192 * This function adds @a func as a poller callback that will be called every @a
1193 * interval ticks together with other pollers of type @a type. @a func will be
1194 * passed the @p data pointer as a parameter.
1195 *
1196 * The @p interval must be between 1 and 32768 inclusive, and must be a power of
1197 * 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768). The exact tick in which @a func
1198 * will be called is undefined, as only the interval between calls can be
1199 * defined. Ecore will endeavor to keep pollers synchronized and to call as
1200 * many in 1 wakeup event as possible. If @a interval is not a power of two, the
1201 * closest power of 2 greater than @a interval will be used.
1202 *
1203 * When the poller @p func is called, it must return a value of either
1204 * ECORE_CALLBACK_RENEW(or 1) or ECORE_CALLBACK_CANCEL(or 0). If it
1205 * returns 1, it will be called again at the next tick, or if it returns
1206 * 0 it will be deleted automatically making any references/handles for it
1207 * invalid.
1208 */
1209EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data);
1210/**
1211 * @brief Delete the specified poller from the timer list.
1212 * @param poller The poller to delete.
1213 * @return The data pointer set for the timer when @ref ecore_poller_add was
1214 * called on success, @c NULL otherwise.
1215 *
1216 * @note @a poller must be a valid handle. If the poller function has already
1217 * returned 0, the handle is no longer valid (and does not need to be deleted).
1218 */
1219EAPI void *ecore_poller_del(Ecore_Poller *poller);
1220
1221/**
1222 * @}
1223 */
1224
1225/**
1226 * @defgroup Ecore_Animator_Group Ecore Animator functions
1227 *
1228 * @brief Ecore animators are a helper to simplify creating
1229 * animations.
1230 *
1231 * Creating an animation is as simple as saying for how long it
1232 * should be run and having a callback that does the animation,
1233 * something like this:
1234 * @code
1235 * static Eina_Bool
1236 * _do_animation(void *data, double pos)
1237 * {
1238 * evas_object_move(data, 100 * pos, 100 * pos);
1239 * ... do some more animating ...
1240 * }
1241 * ...
1242 *ecore_animator_timeline_add(2, _do_animation, my_evas_object);
1243 * @endcode
1244 * In the sample above we create an animation to move
1245 * @c my_evas_object from position (0,0) to (100,100) in 2 seconds.
1246 *
1247 * If your animation will run for an unspecified amount of time you
1248 * can use ecore_animator_add(), which is like using
1249 *ecore_timer_add() with the interval being the
1250 * @ref ecore_animator_frametime_set "framerate". Note that this has
1251 * tangible benefits to creating a timer for each animation in terms
1252 * of performance.
1253 *
1254 * For a more detailed example that show several animation see
1255 * @ref tutorial_ecore_animator.
1256 *
1257 * @ingroup Ecore_Main_Loop_Group
1258 *
1259 * @{
1260 */
1261
1262typedef struct _Ecore_Animator Ecore_Animator; /**< A handle for animators */
1263
1264enum _Ecore_Pos_Map /* Position mappings */
1265{
1266 ECORE_POS_MAP_LINEAR, /**< Linear 0.0 -> 1.0 */
1267 ECORE_POS_MAP_ACCELERATE, /**< Start slow then speed up */
1268 ECORE_POS_MAP_DECELERATE, /**< Start fast then slow down */
1269 ECORE_POS_MAP_SINUSOIDAL, /**< Start slow, speed up then slow down at end */
1270 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. */
1271 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. */
1272 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. */
1273 ECORE_POS_MAP_DIVISOR_INTERP, /**< Start at gradient * v1, interpolated via power of v2 curve */
1274 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 */
1275 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 */
1276};
1277typedef enum _Ecore_Pos_Map Ecore_Pos_Map;
1278
1279enum _Ecore_Animator_Source /* Timing sources for animators */
1280{
1281 ECORE_ANIMATOR_SOURCE_TIMER, /**< The default system clock/timer based animator that ticks every "frametime" seconds */
1282 ECORE_ANIMATOR_SOURCE_CUSTOM /**< A custom animator trigger that you need to call ecore_animator_trigger() to make it tick */
1283};
1284typedef enum _Ecore_Animator_Source Ecore_Animator_Source;
1285
1286/**
1287 * @typedef Ecore_Timeline_Cb Ecore_Timeline_Cb
1288 * A callback run for a task (animators with runtimes)
1289 */
1290typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos);
1291
1292/**
1293 * @brief Add an animator to call @p func at every animation tick during main
1294 * loop execution.
1295 *
1296 * @param func The function to call when it ticks off
1297 * @param data The data to pass to the function
1298 * @return A handle to the new animator
1299 *
1300 * This function adds a animator and returns its handle on success and NULL on
1301 * failure. The function @p func will be called every N seconds where N is the
1302 * @p frametime interval set by ecore_animator_frametime_set(). The function
1303 * will be passed the @p data pointer as its parameter.
1304 *
1305 * When the animator @p func is called, it must return a value of either 1 or
1306 * 0. If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at
1307 * the next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be
1308 * deleted automatically making any references/handles for it invalid.
1309 *
1310 * @note The default @p frametime value is 1/30th of a second.
1311 *
1312 * @see ecore_animator_timeline_add()
1313 * @see ecore_animator_frametime_set()
1314 */
1315EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data);
1316/**
1317 * @brief Add a animator that runs for a limited time
1318 *
1319 * @param runtime The time to run in seconds
1320 * @param func The function to call when it ticks off
1321 * @param data The data to pass to the function
1322 * @return A handle to the new animator
1323 *
1324 * This function is just like ecore_animator_add() except the animator only
1325 * runs for a limited time specified in seconds by @p runtime. Once the
1326 * runtime the animator has elapsed (animator finished) it will automatically
1327 * be deleted. The callback function @p func can return ECORE_CALLBACK_RENEW
1328 * to keep the animator running or ECORE_CALLBACK_CANCEL ro stop it and have
1329 * it be deleted automatically at any time.
1330 *
1331 * The @p func will ALSO be passed a position parameter that will be in value
1332 * from 0.0 to 1.0 to indicate where along the timeline (0.0 start, 1.0 end)
1333 * the animator run is at. If the callback wishes not to have a linear
1334 * transition it can "map" this value to one of several curves and mappings
1335 * via ecore_animator_pos_map().
1336 *
1337 * @note The default @p frametime value is 1/30th of a second.
1338 *
1339 * @see ecore_animator_add()
1340 * @see ecore_animator_pos_map()
1341 * @since 1.1.0
1342 */
1343EAPI Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data);
1344/**
1345 * @brief Delete the specified animator from the animator list.
1346 *
1347 * @param animator The animator to delete
1348 * @return The data pointer set for the animator on add
1349 *
1350 * Delete the specified @p animator from the set of animators that are
1351 * executed during main loop execution. This function returns the data
1352 * parameter that was being passed to the callback on success, or NULL on
1353 * failure. After this call returns the specified animator object @p animator
1354 * is invalid and should not be used again. It will not get called again after
1355 * deletion.
1356 */
1357EAPI void *ecore_animator_del(Ecore_Animator *animator);
1358/**
1359 * @brief Suspend the specified animator.
1360 *
1361 * @param animator The animator to delete
1362 *
1363 * The specified @p animator will be temporarily removed from the set of
1364 * animators that are executed during main loop.
1365 *
1366 * @warning Freezing an animator doesn't freeze accounting of how long that
1367 * animator has been running. Therefore if the animator was created with
1368 *ecore_animator_timeline_add() the @p pos argument given to the callback
1369 * will increase as if the animator hadn't been frozen and the animator may
1370 * have it's execution halted if @p runtime elapsed.
1371 */
1372EAPI void ecore_animator_freeze(Ecore_Animator *animator);
1373/**
1374 * @brief Restore execution of the specified animator.
1375 *
1376 * @param animator The animator to delete
1377 *
1378 * The specified @p animator will be put back in the set of animators that are
1379 * executed during main loop.
1380 */
1381EAPI void ecore_animator_thaw(Ecore_Animator *animator);
1382/**
1383 * @brief Set the animator call interval in seconds.
1384 *
1385 * @param frametime The time in seconds in between animator ticks.
1386 *
1387 * This function sets the time interval (in seconds) between animator ticks.
1388 * At every tick the callback of every existing animator will be called.
1389 *
1390 * @warning Too small a value may cause performance issues and too high a
1391 * value may cause your animation to seem "jerky".
1392 *
1393 * @note The default @p frametime value is 1/30th of a second.
1394 */
1395EAPI void ecore_animator_frametime_set(double frametime);
1396/**
1397 * @brief Get the animator call interval in seconds.
1398 *
1399 * @return The time in second in between animator ticks.
1400 *
1401 * This function retrieves the time in seconds between animator ticks.
1402 *
1403 * @see ecore_animator_frametime_set()
1404 */
1405EAPI double ecore_animator_frametime_get(void);
1406/**
1407 * @brief Maps an input position from 0.0 to 1.0 along a timeline to a
1408 * position in a different curve.
1409 *
1410 * @param pos The input position to map
1411 * @param map The mapping to use
1412 * @param v1 A parameter use by the mapping (pass 0.0 if not used)
1413 * @param v2 A parameter use by the mapping (pass 0.0 if not used)
1414 * @return The mapped value
1415 *
1416 * Takes an input position (0.0 to 1.0) and maps to a new position (normally
1417 * between 0.0 and 1.0, but it may go above/below 0.0 or 1.0 to show that it
1418 * has "overshot" the mark) using some interpolation (mapping) algorithm.
1419 *
1420 * This function useful to create non-linear animations. It offers a variety
1421 * of possible animation curves to be used:
1422 * @li ECORE_POS_MAP_LINEAR - Linear, returns @p pos
1423 * @li ECORE_POS_MAP_ACCELERATE - Start slow then speed up
1424 * @li ECORE_POS_MAP_DECELERATE - Start fast then slow down
1425 * @li ECORE_POS_MAP_SINUSOIDAL - Start slow, speed up then slow down at end
1426 * @li ECORE_POS_MAP_ACCELERATE_FACTOR - Start slow then speed up, v1 being a
1427 * power factor, 0.0 being linear, 1.0 being ECORE_POS_MAP_ACCELERATE, 2.0
1428 * being much more pronounced accelerate (squared), 3.0 being cubed, etc.
1429 * @li ECORE_POS_MAP_DECELERATE_FACTOR - Start fast then slow down, v1 being a
1430 * power factor, 0.0 being linear, 1.0 being ECORE_POS_MAP_DECELERATE, 2.0
1431 * being much more pronounced decelerate (squared), 3.0 being cubed, etc.
1432 * @li ECORE_POS_MAP_SINUSOIDAL_FACTOR - Start slow, speed up then slow down
1433 * at end, v1 being a power factor, 0.0 being linear, 1.0 being
1434 * ECORE_POS_MAP_SINUSOIDAL, 2.0 being much more pronounced sinusoidal
1435 * (squared), 3.0 being cubed, etc.
1436 * @li ECORE_POS_MAP_DIVISOR_INTERP - Start at gradient * v1, interpolated via
1437 * power of v2 curve
1438 * @li ECORE_POS_MAP_BOUNCE - Start at 0.0 then "drop" like a ball bouncing to
1439 * the ground at 1.0, and bounce v2 times, with decay factor of v1
1440 * @li ECORE_POS_MAP_SPRING - Start at 0.0 then "wobble" like a spring rest
1441 * position 1.0, and wobble v2 times, with decay factor of v1
1442 * @note When not listed v1 and v2 have no effect.
1443 *
1444 * @image html ecore-pos-map.png
1445 * @image latex ecore-pos-map.eps width=\textwidth
1446 *
1447 * One way to use this would be:
1448 * @code
1449 * double pos; // input position in a timeline from 0.0 to 1.0
1450 * double out; // output position after mapping
1451 * int x1, y1, x2, y2; // x1 & y1 are start position, x2 & y2 are end position
1452 * int x, y; // x & y are the calculated position
1453 *
1454 * out = ecore_animator_pos_map(pos, ECORE_POS_MAP_BOUNCE, 1.8, 7);
1455 * x = (x1 * out) + (x2 * (1.0 - out));
1456 * y = (y1 * out) + (y2 * (1.0 - out));
1457 * move_my_object_to(myobject, x, y);
1458 * @endcode
1459 * This will make an animation that bounces 7 each times diminishing by a
1460 * factor of 1.8.
1461 *
1462 * @see _Ecore_Pos_Map
1463 *
1464 * @since 1.1.0
1465 */
1466EAPI double ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2);
1467/**
1468 * @brief Set the source of animator ticks for the mainloop
1469 *
1470 * @param source The source of animator ticks to use
1471 *
1472 * This sets the source of animator ticks. When an animator is active the
1473 * mainloop will "tick" over frame by frame calling all animators that are
1474 * registered until none are. The mainloop will tick at a given rate based
1475 * on the animator source. The default source is the system clock timer
1476 * source - ECORE_ANIMATOR_SOURCE_TIMER. This source uses the system clock
1477 * to tick over every N seconds (specified by ecore_animator_frametime_set(),
1478 * with the default being 1/30th of a second unless set otherwise). You can
1479 * set a custom tick source by setting the source to
1480 * ECORE_ANIMATOR_SOURCE_CUSTOM and then drive it yourself based on some input
1481 * tick source (like another application via ipc, some vertical blanking
1482 * interrupt interrupt etc.) using
1483 *ecore_animator_custom_source_tick_begin_callback_set() and
1484 *ecore_animator_custom_source_tick_end_callback_set() to set the functions
1485 * that will be called to start and stop the ticking source, which when it
1486 * gets a "tick" should call ecore_animator_custom_tick() to make the "tick" over 1
1487 * frame.
1488 */
1489EAPI void ecore_animator_source_set(Ecore_Animator_Source source);
1490/**
1491 * @brief Get the animator source currently set.
1492 *
1493 * @return The current animator source
1494 *
1495 * This gets the current animator source.
1496 *
1497 * @see ecore_animator_source_set()
1498 */
1499EAPI Ecore_Animator_Source ecore_animator_source_get(void);
1500/**
1501 * @brief Set the function that begins a custom animator tick source
1502 *
1503 * @param func The function to call when ticking is to begin
1504 * @param data The data passed to the tick begin function as its parameter
1505 *
1506 * The Ecore Animator infrastructure handles tracking if animators are needed
1507 * or not and which ones need to be called and when, but when the tick source
1508 * is custom, you have to provide a tick source by calling
1509 *ecore_animator_custom_tick() to indicate a frame tick happened. In order
1510 * to allow the source of ticks to be dynamically enabled or disabled as
1511 * needed, the @p func when set is called to enable the tick source to
1512 * produce tick events that call ecore_animator_custom_tick(). If @p func
1513 * is NULL then no function is called to begin custom ticking.
1514 *
1515 * @see ecore_animator_source_set()
1516 * @see ecore_animator_custom_source_tick_end_callback_set()
1517 * @see ecore_animator_custom_tick()
1518 */
1519EAPI void ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data);
1520/**
1521 * @brief Set the function that ends a custom animator tick source
1522 *
1523 * @param func The function to call when ticking is to end
1524 * @param data The data passed to the tick end function as its parameter
1525 *
1526 * This function is a matching pair to the function set by
1527 *ecore_animator_custom_source_tick_begin_callback_set() and is called
1528 * when ticking is to stop. If @p func is NULL then no function will be
1529 * called to stop ticking. For more information please see
1530 *ecore_animator_custom_source_tick_begin_callback_set().
1531 *
1532 * @see ecore_animator_source_set()
1533 * @see ecore_animator_custom_source_tick_begin_callback_set()
1534 * @see ecore_animator_custom_tick()
1535 */
1536EAPI void ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data);
1537/**
1538 * @brief Trigger a custom animator tick
1539 *
1540 * When animator source is set to ECORE_ANIMATOR_SOURCE_CUSTOM, then calling
1541 * this function triggers a run of all animators currently registered with
1542 * Ecore as this indicates a "frame tick" happened. This will do nothing if
1543 * the animator source(set by ecore_animator_source_set()) is not set to
1544 * ECORE_ANIMATOR_SOURCE_CUSTOM.
1545 *
1546 * @see ecore_animator_source_set()
1547 * @see ecore_animator_custom_source_tick_begin_callback_set
1548 * @see ecore_animator_custom_source_tick_end_callback_set()()
1549 */
1550EAPI void ecore_animator_custom_tick(void);
1551
1552/**
1553 * @}
1554 */
1555
1556/**
1557 * @defgroup Ecore_Time_Group Ecore time functions
1558 *
1559 * These are function to retrieve time in a given format.
1560 *
1561 * Examples:
1562 * @li @ref ecore_time_functions_example_c
1563 * @{
1564 */
1565EAPI double ecore_time_get(void);
1566EAPI double ecore_time_unix_get(void);
1567EAPI double ecore_loop_time_get(void);
1568
1569/**
1570 * @}
1571 */
1572
1573/**
1574 * @defgroup Ecore_Timer_Group Ecore Timer functions
1575 *
1576 * Ecore provides very flexible timer functionality. The basic usage of timers,
1577 * to call a certain function at a certain interval can be achieved with a
1578 * single line:
1579 * @code
1580 * Eina_Bool my_func(void *data) {
1581 * do_funky_stuff_with_data(data);
1582 * return EINA_TRUE;
1583 * }
1584 * ecore_timer_add(interval_in_seconds, my_func, data_given_to_function);
1585 * @endcode
1586 * @note If the function was to be executed only once simply return EINA_FALSE
1587 * instead.
1588 *
1589 * An example that shows the usage of a lot of these:
1590 * @li @ref ecore_timer_example_c
1591 *
1592 * @ingroup Ecore_Main_Loop_Group
1593 *
1594 * @{
1595 */
1596
1597typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */
1598
1599EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data);
1600EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
1601EAPI void *ecore_timer_del(Ecore_Timer *timer);
1602EAPI void ecore_timer_interval_set(Ecore_Timer *timer, double in);
1603EAPI double ecore_timer_interval_get(Ecore_Timer *timer);
1604EAPI void ecore_timer_freeze(Ecore_Timer *timer);
1605EAPI void ecore_timer_thaw(Ecore_Timer *timer);
1606EAPI void ecore_timer_delay(Ecore_Timer *timer, double add);
1607EAPI void ecore_timer_reset(Ecore_Timer *timer);
1608EAPI double ecore_timer_pending_get(Ecore_Timer *timer);
1609EAPI double ecore_timer_precision_get(void);
1610EAPI void ecore_timer_precision_set(double precision);
1611EAPI char *ecore_timer_dump(void);
1612
1613/**
1614 * @}
1615 */
1616
1617/**
1618 * @defgroup Ecore_Idle_Group Ecore Idle functions
1619 *
1620 * The idler functionality in Ecore allows for callbacks to be called when the
1621 * program isn't handling @ref Ecore_Event_Group "events", @ref Ecore_Timer_Group
1622 * "timers" or @ref Ecore_FD_Handler_Group "fd handlers".
1623 *
1624 * There are three types of idlers: Enterers, Idlers(proper) and Exiters. They
1625 * are called, respectively, when the program is about to enter an idle state,
1626 * when the program is in an idle state and when the program has just left an
1627 * idle state and will begin processing @ref Ecore_Event_Group "events", @ref
1628 * Ecore_Timer_Group "timers" or @ref Ecore_FD_Handler_Group "fd handlers".
1629 *
1630 * Enterer callbacks are good for updating your program's state, if
1631 * it has a state engine. Once all of the enterer handlers are
1632 * called, the program will enter a "sleeping" state.
1633 *
1634 * Idler callbacks are called when the main loop has called all
1635 * enterer handlers. They are useful for interfaces that require
1636 * polling and timers would be too slow to use.
1637 *
1638 * Exiter callbacks are called when the main loop wakes up from an idle state.
1639 *
1640 * If no idler callbacks are specified, then the process literally
1641 * goes to sleep. Otherwise, the idler callbacks are called
1642 * continuously while the loop is "idle", using as much CPU as is
1643 * available to the process.
1644 *
1645 * @note Idle state doesn't mean that the @b program is idle, but
1646 * that the <b>main loop</b> is idle. It doesn't have any timers,
1647 * events, fd handlers or anything else to process (which in most
1648 * <em>event driven</em> programs also means that the @b program is
1649 * idle too, but it's not a rule). The program itself may be doing
1650 * a lot of processing in the idler, or in another thread, for
1651 * example.
1652 *
1653 * Example with functions that deal with idle state:
1654 *
1655 * @li @ref ecore_idler_example_c
1656 *
1657 * @ingroup Ecore_Main_Loop_Group
1658 *
1659 * @{
1660 */
1661
1662typedef struct _Ecore_Idler Ecore_Idler; /**< A handle for idlers */
1663typedef struct _Ecore_Idle_Enterer Ecore_Idle_Enterer; /**< A handle for idle enterers */
1664typedef struct _Ecore_Idle_Exiter Ecore_Idle_Exiter; /**< A handle for idle exiters */
1665
1666/**
1667 * Add an idler handler.
1668 * @param func The function to call when idling.
1669 * @param data The data to be passed to this @p func call.
1670 * @return A idler handle if successfully added. NULL otherwise.
1671 *
1672 * Add an idler handle to the event loop, returning a handle on
1673 * success and NULL otherwise. The function @p func will be called
1674 * repeatedly while no other events are ready to be processed, as
1675 * long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
1676 * (or ECORE_CALLBACK_CANCEL) deletes the idler.
1677 *
1678 * Idlers are useful for progressively prossessing data without blocking.
1679 */
1680EAPI Ecore_Idler *ecore_idler_add(Ecore_Task_Cb func, const void *data);
1681
1682/**
1683 * Delete an idler callback from the list to be executed.
1684 * @param idler The handle of the idler callback to delete
1685 * @return The data pointer passed to the idler callback on success. NULL
1686 * otherwise.
1687 */
1688EAPI void *ecore_idler_del(Ecore_Idler *idler);
1689
1690EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data);
1691EAPI Ecore_Idle_Enterer *ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data);
1692EAPI void *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
1693
1694EAPI Ecore_Idle_Exiter *ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data);
1695EAPI void *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
1696
1697/**
1698 * @}
1699 */
1700
1701/**
1702 * @defgroup Ecore_Thread_Group Ecore Thread functions
1703 *
1704 * Facilities to run heavy tasks in different threads to avoid blocking
1705 * the main loop.
1706 *
1707 * The EFL is, for the most part, not thread safe. This means that if you
1708 * have some task running in another thread and you have, for example, an
1709 * Evas object to show the status progress of this task, you cannot update
1710 * the object from within the thread. This can only be done from the main
1711 * thread, the one running the main loop. This problem can be solved
1712 * by running a thread that sends messages to the main one using an
1713 * @ref Ecore_Pipe_Group "Ecore_Pipe", but when you need to handle other
1714 * things like cancelling the thread, your code grows in complexity and gets
1715 * much harder to maintain.
1716 *
1717 * Ecore Thread is here to solve that problem. It is @b not a simple wrapper
1718 * around standard POSIX threads (or the equivalent in other systems) and
1719 * it's not meant to be used to run parallel tasks throughout the entire
1720 * duration of the program, especially when these tasks are performance
1721 * critical, as Ecore manages these tasks using a pool of threads based on
1722 * system configuration.
1723 *
1724 * What Ecore Thread does, is make it a lot easier to dispatch a worker
1725 * function to perform some heavy task and then get the result once it
1726 * completes, without blocking the application's UI. In addition, cancelling
1727 * and rescheduling comes practically for free and the developer needs not
1728 * worry about how many threads are launched, since Ecore will schedule
1729 * them according to the number of processors the system has and maximum
1730 * amount of concurrent threads set for the application.
1731 *
1732 * At the system level, Ecore will start a new thread on an as-needed basis
1733 * until the maximum set is reached. When no more threads can be launched,
1734 * new worker functions will be queued in a waiting list until a thread
1735 * becomes available. This way, system threads will be shared throughout
1736 * different worker functions, but running only one at a time. At the same
1737 * time, a worker function that is rescheduled may be run on a different
1738 * thread the next time.
1739 *
1740 * The ::Ecore_Thread handler has two meanings, depending on what context
1741 * it is on. The one returned when starting a worker with any of the
1742 * functions ecore_thread_run() or ecore_thread_feedback_run() is an
1743 * identifier of that specific instance of the function and can be used from
1744 * the main loop with the ecore_thread_cancel() and ecore_thread_check()
1745 * functions. This handler must not be shared with the worker function
1746 * function running in the thread. This same handler will be the one received
1747 * on the @c end, @c cancel and @c feedback callbacks.
1748 *
1749 * The worker function, that's the one running in the thread, also receives
1750 * an ::Ecore_Thread handler that can be used with ecore_thread_cancel() and
1751 *ecore_thread_check(), sharing the flag with the main loop. But this
1752 * handler is also associated with the thread where the function is running.
1753 * This has strong implications when working with thread local data.
1754 *
1755 * There are two kinds of worker threads Ecore handles: simple, or short,
1756 * workers and feedback workers.
1757 *
1758 * The first kind is for simple functions that perform a
1759 * usually small but time consuming task. Ecore will run this function in
1760 * a thread as soon as one becomes available and notify the calling user of
1761 * its completion once the task is done.
1762 *
1763 * The following image shows the flow of a program running four tasks on
1764 * a pool of two threads.
1765 *
1766 * @image html ecore_thread.png
1767 * @image rtf ecore_thread.png
1768 * @image latex ecore_thread.eps width=\textwidth
1769 *
1770 * For larger tasks that may require continuous communication with the main
1771 * program, the feedback workers provide the same functionality plus a way
1772 * for the function running in the thread to send messages to the main
1773 * thread.
1774 *
1775 * The next diagram omits some details shown in the previous one regarding
1776 * how threads are spawned and tasks are queued, but illustrates how feedback
1777 * jobs communicate with the main loop and the special case of threads
1778 * running out of pool.
1779 *
1780 * @image html ecore_thread_feedback.png
1781 * @image rtf ecore_thread_feedback.png
1782 * @image latex ecore_thread_feedback.eps width=\textwidth
1783 *
1784 * See an overview example in @ref ecore_thread_example_c.
1785 *
1786 * @ingroup Ecore_Main_Loop_Group
1787 *
1788 * @{
1789 */
1790
1791typedef struct _Ecore_Thread Ecore_Thread; /**< A handle for threaded jobs */
1792
1793/**
1794 * @typedef Ecore_Thread_Cb Ecore_Thread_Cb
1795 * A callback used by Ecore_Thread helper.
1796 */
1797typedef void (*Ecore_Thread_Cb)(void *data, Ecore_Thread *thread);
1798/**
1799 * @typedef Ecore_Thread_Notify_Cb Ecore_Thread_Notify_Cb
1800 * A callback used by the main loop to receive data sent by an
1801 * @ref Ecore_Thread_Group.
1802 */
1803typedef void (*Ecore_Thread_Notify_Cb)(void *data, Ecore_Thread *thread, void *msg_data);
1804
1805/**
1806 * Schedule a task to run in a parallel thread to avoid locking the main loop
1807 *
1808 * @param func_blocking The function that should run in another thread.
1809 * @param func_end Function to call from main loop when @p func_blocking
1810 * completes its task successfully (may be NULL)
1811 * @param func_cancel Function to call from main loop if the thread running
1812 * @p func_blocking is cancelled or fails to start (may be NULL)
1813 * @param data User context data to pass to all callbacks.
1814 * @return A new thread handler, or NULL on failure
1815 *
1816 * This function will try to create a new thread to run @p func_blocking in,
1817 * or if the maximum number of concurrent threads has been reached, will
1818 * add it to the pending list, where it will wait until a thread becomes
1819 * available. The return value will be an ::Ecore_Thread handle that can
1820 * be used to cancel the thread before its completion.
1821 *
1822 * @note This function should always return immediately, but in the rare
1823 * case that Ecore is built with no thread support, @p func_blocking will
1824 * be called here, actually blocking the main loop.
1825 *
1826 * Once a thread becomes available, @p func_blocking will be run in it until
1827 * it finishes, then @p func_end is called from the thread containing the
1828 * main loop to inform the user of its completion. While in @p func_blocking,
1829 * no functions from the EFL can be used, except for those from Eina that are
1830 * marked to be thread-safe. Even for the latter, caution needs to be taken
1831 * if the data is shared across several threads.
1832 *
1833 * @p func_end will be called from the main thread when @p func_blocking ends,
1834 * so here it's safe to use anything from the EFL freely.
1835 *
1836 * The thread can also be cancelled before its completion calling
1837 *ecore_thread_cancel(), either from the main thread or @p func_blocking.
1838 * In this case, @p func_cancel will be called, also from the main thread
1839 * to inform of this happening. If the thread could not be created, this
1840 * function will be called and it's @c thread parameter will be NULL. It's
1841 * also safe to call any EFL function here, as it will be running in the
1842 * main thread.
1843 *
1844 * Inside @p func_blocking, it's possible to call ecore_thread_reschedule()
1845 * to tell Ecore that this function should be called again.
1846 *
1847 * Be aware that no assumptions can be made about the order in which the
1848 * @p func_end callbacks for each task will be called. Once the function is
1849 * running in a different thread, it's the OS that will handle its running
1850 * schedule, and different functions may take longer to finish than others.
1851 * Also remember that just starting several tasks together doesn't mean they
1852 * will be running at the same time. Ecore will schedule them based on the
1853 * number of threads available for the particular system it's running in,
1854 * so some of the jobs started may be waiting until another one finishes
1855 * before it can execute its own @p func_blocking.
1856 *
1857 * @see ecore_thread_feedback_run()
1858 * @see ecore_thread_cancel()
1859 * @see ecore_thread_reschedule()
1860 * @see ecore_thread_max_set()
1861 */
1862EAPI Ecore_Thread *ecore_thread_run(Ecore_Thread_Cb func_blocking, Ecore_Thread_Cb func_end, Ecore_Thread_Cb func_cancel, const void *data);
1863/**
1864 * Launch a thread to run a task than can talk back to the main thread
1865 *
1866 * @param func_heavy The function that should run in another thread.
1867 * @param func_notify Function that receives the data sent from the thread
1868 * @param func_end Function to call from main loop when @p func_heavy
1869 * completes its task successfully
1870 * @param func_cancel Function to call from main loop if the thread running
1871 * @p func_heavy is cancelled or fails to start
1872 * @param data User context data to pass to all callback.
1873 * @param try_no_queue If you want to run outside of the thread pool.
1874 * @return A new thread handler, or NULL on failure
1875 *
1876 * See ecore_thread_run() for a general description of this function.
1877 *
1878 * The difference with the above is that ecore_thread_run() is meant for
1879 * tasks that don't need to communicate anything until they finish, while
1880 * this function is provided with a new callback, @p func_notify, that will
1881 * be called from the main thread for every message sent from @p func_heavy
1882 * with ecore_thread_feedback().
1883 *
1884 * Like with ecore_thread_run(), a new thread will be launched to run
1885 * @p func_heavy unless the maximum number of simultaneous threads has been
1886 * reached, in which case the function will be scheduled to run whenever a
1887 * running task ends and a thread becomes free. But if @p try_no_queue is
1888 * set, Ecore will first try to launch a thread outside of the pool to run
1889 * the task. If it fails, it will revert to the normal behaviour of using a
1890 * thread from the pool as if @p try_no_queue had not been set.
1891 *
1892 * Keep in mind that Ecore handles the thread pool based on the number of
1893 * CPUs available, but running a thread outside of the pool doesn't count for
1894 * this, so having too many of them may have drastic effects over the
1895 * program's performance.
1896 *
1897 * @see ecore_thread_feedback()
1898 * @see ecore_thread_run()
1899 * @see ecore_thread_cancel()
1900 * @see ecore_thread_reschedule()
1901 * @see ecore_thread_max_set()
1902 */
1903EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, Ecore_Thread_Notify_Cb func_notify,
1904 Ecore_Thread_Cb func_end, Ecore_Thread_Cb func_cancel,
1905 const void *data, Eina_Bool try_no_queue);
1906/**
1907 * Cancel a running thread.
1908 *
1909 * @param thread The thread to cancel.
1910 * @return Will return EINA_TRUE if the thread has been cancelled,
1911 * EINA_FALSE if it is pending.
1912 *
1913 * This function can be called both in the main loop or in the running thread.
1914 *
1915 * This function cancels a running thread. If @p thread can be immediately
1916 * cancelled (it's still pending execution after creation or rescheduling),
1917 * then the @c cancel callback will be called, @p thread will be freed and
1918 * the function will return EINA_TRUE.
1919 *
1920 * If the thread is already running, then this function returns EINA_FALSE
1921 * after marking the @p thread as pending cancellation. For the thread to
1922 * actually be terminated, it needs to return from the user function back
1923 * into Ecore control. This can happen in several ways:
1924 * @li The function ends and returns normally. If it hadn't been cancelled,
1925 * @c func_end would be called here, but instead @c func_cancel will happen.
1926 * @li The function returns after requesting to be rescheduled with
1927 *ecore_thread_reschedule().
1928 * @li The function is prepared to leave early by checking if
1929 *ecore_thread_check() returns EINA_TRUE.
1930 *
1931 * The user function can cancel itself by calling ecore_thread_cancel(), but
1932 * it should always use the ::Ecore_Thread handle passed to it and never
1933 * share it with the main loop thread by means of shared user data or any
1934 * other way.
1935 *
1936 * @p thread will be freed and should not be used again if this function
1937 * returns EINA_TRUE or after the @c func_cancel callback returns.
1938 *
1939 * @see ecore_thread_check()
1940 */
1941EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread);
1942/**
1943 * Checks if a thread is pending cancellation
1944 *
1945 * @param thread The thread to test.
1946 * @return EINA_TRUE if the thread is pending cancellation,
1947 * EINA_FALSE if it is not.
1948 *
1949 * This function can be called both in the main loop or in the running thread.
1950 *
1951 * When ecore_thread_cancel() is called on an already running task, the
1952 * thread is marked as pending cancellation. This function returns EINA_TRUE
1953 * if this mark is set for the given @p thread and can be used from the
1954 * main loop thread to check if a still active thread has been cancelled,
1955 * or from the user function running in the thread to check if it should
1956 * stop doing what it's doing and return early, effectively cancelling the
1957 * task.
1958 *
1959 * @see ecore_thread_cancel()
1960 */
1961EAPI Eina_Bool ecore_thread_check(Ecore_Thread *thread);
1962/**
1963 * Sends data from the worker thread to the main loop
1964 *
1965 * @param thread The current ::Ecore_Thread context to send data from
1966 * @param msg_data Data to be transmitted to the main loop
1967 * @return EINA_TRUE if @p msg_data was successfully sent to main loop,
1968 * EINA_FALSE if anything goes wrong.
1969 *
1970 * You should use this function only in the @c func_heavy call.
1971 *
1972 * Only the address to @p msg_data will be sent and once this function
1973 * returns EINA_TRUE, the job running in the thread should never touch the
1974 * contents of it again. The data sent should be malloc()'ed or something
1975 * similar, as long as it's not memory local to the thread that risks being
1976 * overwritten or deleted once it goes out of scope or the thread finishes.
1977 *
1978 * Care must be taken that @p msg_data is properly freed in the @c func_notify
1979 * callback set when creating the thread.
1980 *
1981 * @see ecore_thread_feedback_run()
1982 */
1983EAPI Eina_Bool ecore_thread_feedback(Ecore_Thread *thread, const void *msg_data);
1984/**
1985 * Asks for the function in the thread to be called again at a later time
1986 *
1987 * @param thread The current ::Ecore_Thread context to rescheduled
1988 * @return EINA_TRUE if the task was successfully rescheduled,
1989 * EINA_FALSE if anything goes wrong.
1990 *
1991 * This function should be called only from the same function represented
1992 * by @p thread.
1993 *
1994 * Calling this function will mark the thread for a reschedule, so as soon
1995 * as it returns, it will be added to the end of the list of pending tasks.
1996 * If no other tasks are waiting or there are sufficient threads available,
1997 * the rescheduled task will be launched again immediately.
1998 *
1999 * This should never return EINA_FALSE, unless it was called from the wrong
2000 * thread or with the wrong arguments.
2001 *
2002 * The @c func_end callback set when the thread is created will not be
2003 * called until the function in the thread returns without being rescheduled.
2004 * Similarly, if the @p thread is cancelled, the reschedule will not take
2005 * effect.
2006 */
2007EAPI Eina_Bool ecore_thread_reschedule(Ecore_Thread *thread);
2008/**
2009 * Gets the number of active threads running jobs
2010 *
2011 * @return Number of active threads running jobs
2012 *
2013 * This returns the number of threads currently running jobs of any type
2014 * through the Ecore_Thread API.
2015 *
2016 * @note Jobs started through the ecore_thread_feedback_run() function with
2017 * the @c try_no_queue parameter set to EINA_TRUE will not be accounted for
2018 * in the return of this function unless the thread creation fails and it
2019 * falls back to using one from the pool.
2020 */
2021EAPI int ecore_thread_active_get(void);
2022/**
2023 * Gets the number of short jobs waiting for a thread to run
2024 *
2025 * @return Number of pending threads running "short" jobs
2026 *
2027 * This returns the number of tasks started with ecore_thread_run() that are
2028 * pending, waiting for a thread to become available to run them.
2029 */
2030EAPI int ecore_thread_pending_get(void);
2031/**
2032 * Gets the number of feedback jobs waiting for a thread to run
2033 *
2034 * @return Number of pending threads running "feedback" jobs
2035 *
2036 * This returns the number of tasks started with ecore_thread_feedback_run()
2037 * that are pending, waiting for a thread to become available to run them.
2038 */
2039EAPI int ecore_thread_pending_feedback_get(void);
2040/**
2041 * Gets the total number of pending jobs
2042 *
2043 * @return Number of pending threads running jobs
2044 *
2045 * Same as the sum of ecore_thread_pending_get() and
2046 *ecore_thread_pending_feedback_get().
2047 */
2048EAPI int ecore_thread_pending_total_get(void);
2049/**
2050 * Gets the maximum number of threads that can run simultaneously
2051 *
2052 * @return Max possible number of Ecore_Thread's running concurrently
2053 *
2054 * This returns the maximum number of Ecore_Thread's that may be running at
2055 * the same time. If this number is reached, new jobs started by either
2056 *ecore_thread_run() or ecore_thread_feedback_run() will be added to the
2057 * respective pending queue until one of the running threads finishes its
2058 * task and becomes available to run a new one.
2059 *
2060 * By default, this will be the number of available CPUs for the
2061 * running program (as returned by eina_cpu_count()), or 1 if this value
2062 * could not be fetched.
2063 *
2064 * @see ecore_thread_max_set()
2065 * @see ecore_thread_max_reset()
2066 */
2067EAPI int ecore_thread_max_get(void);
2068/**
2069 * Sets the maximum number of threads allowed to run simultaneously
2070 *
2071 * @param num The new maximum
2072 *
2073 * This sets a new value for the maximum number of concurrently running
2074 * Ecore_Thread's. It @b must an integer between 1 and (2 * @c x), where @c x
2075 * is the number for CPUs available.
2076 *
2077 * @see ecore_thread_max_get()
2078 * @see ecore_thread_max_reset()
2079 */
2080EAPI void ecore_thread_max_set(int num);
2081/**
2082 * Resets the maximum number of concurrently running threads to the default
2083 *
2084 * This resets the value returned by ecore_thread_max_get() back to its
2085 * default.
2086 *
2087 * @see ecore_thread_max_get()
2088 * @see ecore_thread_max_set()
2089 */
2090EAPI void ecore_thread_max_reset(void);
2091/**
2092 * Gets the number of threads available for running tasks
2093 *
2094 * @return The number of available threads
2095 *
2096 * Same as doing ecore_thread_max_get() - ecore_thread_active_get().
2097 *
2098 * This function may return a negative number only in the case the user
2099 * changed the maximum number of running threads while other tasks are
2100 * running.
2101 */
2102EAPI int ecore_thread_available_get(void);
2103/**
2104 * Adds some data to a hash local to the thread
2105 *
2106 * @param thread The thread context the data belongs to
2107 * @param key The name under which the data will be stored
2108 * @param value The data to add
2109 * @param cb Function to free the data when removed from the hash
2110 * @param direct If true, this will not copy the key string (like
2111 * eina_hash_direct_add())
2112 * @return EINA_TRUE on success, EINA_FALSE on failure
2113 *
2114 * Ecore Thread has a mechanism to share data across several worker functions
2115 * that run on the same system thread. That is, the data is stored per
2116 * thread and for a worker function to have access to it, it must be run
2117 * by the same thread that stored the data.
2118 *
2119 * When there are no more workers pending, the thread will be destroyed
2120 * along with the internal hash and any data left in it will be freed with
2121 * the @p cb function given.
2122 *
2123 * This set of functions is useful to share things around several instances
2124 * of a function when that thing is costly to create and can be reused, but
2125 * may only be used by one function at a time.
2126 *
2127 * For example, if you have a program doing requisitions to a database,
2128 * these requisitions can be done in threads so that waiting for the
2129 * database to respond doesn't block the UI. Each of these threads will
2130 * run a function, and each function will be dependent on a connection to
2131 * the database, which may not be able to handle more than one request at
2132 * a time so for each running function you will need one connection handle.
2133 * The options then are:
2134 * @li Each function opens a connection when it's called, does the work and
2135 * closes the connection when it finishes. This may be costly, wasting a lot
2136 * of time on resolving hostnames, negotiating permissions and allocating
2137 * memory.
2138 * @li Open the connections in the main loop and pass it to the threads
2139 * using the data pointer. Even worse, it's just as costly as before and now
2140 * it may even be kept with connections open doing nothing until a thread
2141 * becomes available to run the function.
2142 * @li Have a way to share connection handles, so that each instance of the
2143 * function can check if an available connection exists, and if it doesn't,
2144 * create one and add it to the pool. When no more connections are needed,
2145 * they are all closed.
2146 *
2147 * The last option is the most efficient, but it requires a lot of work to
2148 * implement properly. Using thread local data helps to achieve the same
2149 * result while avoiding doing all the tracking work on your code. The way
2150 * to use it would be, at the worker function, to ask for the connection
2151 * with ecore_thread_local_data_find() and if it doesn't exist, then open
2152 * a new one and save it with ecore_thread_local_data_add(). Do the work and
2153 * forget about the connection handle, when everything is done the function
2154 * just ends. The next worker to run on that thread will check if a
2155 * connection exists and find that it does, so the process of opening a
2156 * new one has been spared. When no more workers exist, the thread is
2157 * destroyed and the callback used when saving the connection will be called
2158 * to close it.
2159 *
2160 * This function adds the data @p value to the thread data under the given
2161 * @p key.
2162 * No other value in the hash may have the same @p key. If you need to
2163 * change the value under a @p key, or you don't know if one exists already,
2164 * you can use ecore_thread_local_data_set().
2165 *
2166 * Neither @p key nor @p value may be NULL and @p key will be copied in the
2167 * hash, unless @p direct is set, in which case the string used should not
2168 * be freed until the data is removed from the hash.
2169 *
2170 * The @p cb function will be called when the data in the hash needs to be
2171 * freed, be it because it got deleted with ecore_thread_local_data_del() or
2172 * because @p thread was terminated and the hash destroyed. This parameter
2173 * may be NULL, in which case @p value needs to be manually freed after
2174 * removing it from the hash with either ecore_thread_local_data_del() or
2175 *ecore_thread_local_data_set(), but it's very unlikely that this is what
2176 * you want.
2177 *
2178 * This function, and all of the others in the @c ecore_thread_local_data
2179 * family of functions, can only be called within the worker function running
2180 * in the thread. Do not call them from the main loop or from a thread
2181 * other than the one represented by @p thread.
2182 *
2183 * @see ecore_thread_local_data_set()
2184 * @see ecore_thread_local_data_find()
2185 * @see ecore_thread_local_data_del()
2186 */
2187EAPI Eina_Bool ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value,
2188 Eina_Free_Cb cb, Eina_Bool direct);
2189/**
2190 * Sets some data in the hash local to the given thread
2191 *
2192 * @param thread The thread context the data belongs to
2193 * @param key The name under which the data will be stored
2194 * @param value The data to add
2195 * @param cb Function to free the data when removed from the hash
2196 *
2197 * If no data exists in the hash under the @p key, this function adds
2198 * @p value in the hash under the given @p key and returns NULL.
2199 * The key itself is copied.
2200 *
2201 * If the hash already contains something under @p key, the data will be
2202 * replaced by @p value and the old value will be returned.
2203 *
2204 * NULL will also be returned if either @p key or @p value are NULL, or if
2205 * an error occurred.
2206 *
2207 * This function, and all of the others in the @c ecore_thread_local_data
2208 * family of functions, can only be called within the worker function running
2209 * in the thread. Do not call them from the main loop or from a thread
2210 * other than the one represented by @p thread.
2211 *
2212 * @see ecore_thread_local_data_add()
2213 * @see ecore_thread_local_data_del()
2214 * @see ecore_thread_local_data_find()
2215 */
2216EAPI void *ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb);
2217/**
2218 * Gets data stored in the hash local to the given thread
2219 *
2220 * @param thread The thread context the data belongs to
2221 * @param key The name under which the data is stored
2222 * @return The value under the given key, or NULL on error
2223 *
2224 * Finds and return the data stored in the shared hash under the key @p key.
2225 *
2226 * This function, and all of the others in the @c ecore_thread_local_data
2227 * family of functions, can only be called within the worker function running
2228 * in the thread. Do not call them from the main loop or from a thread
2229 * other than the one represented by @p thread.
2230 *
2231 * @see ecore_thread_local_data_add()
2232 * @see ecore_thread_local_data_wait()
2233 */
2234EAPI void *ecore_thread_local_data_find(Ecore_Thread *thread, const char *key);
2235/**
2236 * Deletes from the thread's hash the data corresponding to the given key
2237 *
2238 * @param thread The thread context the data belongs to
2239 * @param key The name under which the data is stored
2240 * @return EINA_TRUE on success, EINA_FALSE on failure
2241 *
2242 * If there's any data stored associated with @p key in the global hash,
2243 * this function will remove it from it and return EINA_TRUE. If no data
2244 * exists or an error occurs, it returns EINA_FALSE.
2245 *
2246 * If the data was added to the hash with a free function, then it will
2247 * also be freed after removing it from the hash, otherwise it requires
2248 * to be manually freed by the user, which means that if no other reference
2249 * to it exists before calling this function, it will result in a memory
2250 * leak.
2251 *
2252 * This function, and all of the others in the @c ecore_thread_local_data
2253 * family of functions, can only be called within the worker function running
2254 * in the thread. Do not call them from the main loop or from a thread
2255 * other than the one represented by @p thread.
2256 *
2257 * @see ecore_thread_local_data_add()
2258 */
2259EAPI Eina_Bool ecore_thread_local_data_del(Ecore_Thread *thread, const char *key);
2260
2261/**
2262 * Adds some data to a hash shared by all threads
2263 *
2264 * @param key The name under which the data will be stored
2265 * @param value The data to add
2266 * @param cb Function to free the data when removed from the hash
2267 * @param direct If true, this will not copy the key string (like
2268 * eina_hash_direct_add())
2269 * @return EINA_TRUE on success, EINA_FALSE on failure
2270 *
2271 * Ecore Thread keeps a hash that can be used to share data across several
2272 * threads, including the main loop one, without having to manually handle
2273 * mutexes to do so safely.
2274 *
2275 * This function adds the data @p value to this hash under the given @p key.
2276 * No other value in the hash may have the same @p key. If you need to
2277 * change the value under a @p key, or you don't know if one exists already,
2278 * you can use ecore_thread_global_data_set().
2279 *
2280 * Neither @p key nor @p value may be NULL and @p key will be copied in the
2281 * hash, unless @p direct is set, in which case the string used should not
2282 * be freed until the data is removed from the hash.
2283 *
2284 * The @p cb function will be called when the data in the hash needs to be
2285 * freed, be it because it got deleted with ecore_thread_global_data_del() or
2286 * because Ecore Thread was shut down and the hash destroyed. This parameter
2287 * may be NULL, in which case @p value needs to be manually freed after
2288 * removing it from the hash with either ecore_thread_global_data_del() or
2289 *ecore_thread_global_data_set().
2290 *
2291 * Manually freeing any data that was added to the hash with a @p cb function
2292 * is likely to produce a segmentation fault, or any other strange
2293 * happenings, later on in the program.
2294 *
2295 * @see ecore_thread_global_data_del()
2296 * @see ecore_thread_global_data_set()
2297 * @see ecore_thread_global_data_find()
2298 */
2299EAPI Eina_Bool ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct);
2300/**
2301 * Sets some data in the hash shared by all threads
2302 *
2303 * @param key The name under which the data will be stored
2304 * @param value The data to add
2305 * @param cb Function to free the data when removed from the hash
2306 *
2307 * If no data exists in the hash under the @p key, this function adds
2308 * @p value in the hash under the given @p key and returns NULL.
2309 * The key itself is copied.
2310 *
2311 * If the hash already contains something under @p key, the data will be
2312 * replaced by @p value and the old value will be returned.
2313 *
2314 * NULL will also be returned if either @p key or @p value are NULL, or if
2315 * an error occurred.
2316 *
2317 * @see ecore_thread_global_data_add()
2318 * @see ecore_thread_global_data_del()
2319 * @see ecore_thread_global_data_find()
2320 */
2321EAPI void *ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb);
2322/**
2323 * Gets data stored in the hash shared by all threads
2324 *
2325 * @param key The name under which the data is stored
2326 * @return The value under the given key, or NULL on error
2327 *
2328 * Finds and return the data stored in the shared hash under the key @p key.
2329 *
2330 * Keep in mind that the data returned may be used by more than one thread
2331 * at the same time and no reference counting is done on it by Ecore.
2332 * Freeing the data or modifying its contents may require additional
2333 * precautions to be considered, depending on the application's design.
2334 *
2335 * @see ecore_thread_global_data_add()
2336 * @see ecore_thread_global_data_wait()
2337 */
2338EAPI void *ecore_thread_global_data_find(const char *key);
2339/**
2340 * Deletes from the shared hash the data corresponding to the given key
2341 *
2342 * @param key The name under which the data is stored
2343 * @return EINA_TRUE on success, EINA_FALSE on failure
2344 *
2345 * If there's any data stored associated with @p key in the global hash,
2346 * this function will remove it from it and return EINA_TRUE. If no data
2347 * exists or an error occurs, it returns EINA_FALSE.
2348 *
2349 * If the data was added to the hash with a free function, then it will
2350 * also be freed after removing it from the hash, otherwise it requires
2351 * to be manually freed by the user, which means that if no other reference
2352 * to it exists before calling this function, it will result in a memory
2353 * leak.
2354 *
2355 * Note, also, that freeing data that other threads may be using will result
2356 * in a crash, so appropriate care must be taken by the application when
2357 * that possibility exists.
2358 *
2359 * @see ecore_thread_global_data_add()
2360 */
2361EAPI Eina_Bool ecore_thread_global_data_del(const char *key);
2362/**
2363 * Gets data stored in the shared hash, or wait for it if it doesn't exist
2364 *
2365 * @param key The name under which the data is stored
2366 * @param seconds The amount of time in seconds to wait for the data.
2367 * @return The value under the given key, or NULL on error
2368 *
2369 * Finds and return the data stored in the shared hash under the key @p key.
2370 *
2371 * If there's nothing in the hash under the given @p key, the function
2372 * will block and wait up to @p seconds seconds for some other thread to
2373 * add it with either ecore_thread_global_data_add() or
2374 *ecore_thread_global_data_set(). If after waiting there's still no data
2375 * to get, NULL will be returned.
2376 *
2377 * If @p seconds is 0, then no waiting will happen and this function works
2378 * like ecore_thread_global_data_find(). If @p seconds is less than 0, then
2379 * the function will wait indefinitely.
2380 *
2381 * Keep in mind that the data returned may be used by more than one thread
2382 * at the same time and no reference counting is done on it by Ecore.
2383 * Freeing the data or modifying its contents may require additional
2384 * precautions to be considered, depending on the application's design.
2385 *
2386 * @see ecore_thread_global_data_add()
2387 * @see ecore_thread_global_data_find()
2388 */
2389EAPI void *ecore_thread_global_data_wait(const char *key, double seconds);
2390
2391/**
2392 * @}
2393 */
2394
2395/**
2396 * @defgroup Ecore_Pipe_Group Pipe wrapper
2397 *
2398 * These functions wrap the pipe / write / read functions to easily
2399 * integrate its use into ecore's main loop.
2400 *
2401 * The ecore_pipe_add() function creates file descriptors (sockets
2402 * on Windows) and attach a handle to the ecore main loop. That
2403 * handle is called when data is read in the pipe. To write data in
2404 * the pipe, just call ecore_pipe_write(). When you are done, just
2405 * call ecore_pipe_del().
2406 *
2407 * For examples see here:
2408 * @li @ref tutorial_ecore_pipe_gstreamer_example
2409 * @li @ref tutorial_ecore_pipe_simple_example
2410 *
2411 * @ingroup Ecore_Main_Loop_Group
2412 *
2413 * @{
2414 */
2415
2416typedef struct _Ecore_Pipe Ecore_Pipe; /**< A handle for pipes */
2417
2418/**
2419 * @typedef Ecore_Pipe_Cb Ecore_Pipe_Cb
2420 * The callback that data written to the pipe is sent to.
2421 */
2422typedef void (*Ecore_Pipe_Cb)(void *data, void *buffer, unsigned int nbyte);
2423
2424EAPI Ecore_Pipe *ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data);
2425EAPI void *ecore_pipe_del(Ecore_Pipe *p);
2426EAPI Eina_Bool ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes);
2427EAPI void ecore_pipe_write_close(Ecore_Pipe *p);
2428EAPI void ecore_pipe_read_close(Ecore_Pipe *p);
2429EAPI void ecore_pipe_thaw(Ecore_Pipe *p);
2430EAPI void ecore_pipe_freeze(Ecore_Pipe *p);
2431EAPI int ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait);
2432
2433/**
2434 * @}
2435 */
2436
2437/**
2438 * @defgroup Ecore_Job_Group Ecore Job functions
2439 *
2440 * You can queue jobs that are to be done by the main loop when the
2441 * current event is dealt with.
2442 *
2443 * Jobs are processed by the main loop similarly to events. They
2444 * also will be executed in the order in which they were added.
2445 *
2446 * A good use for them is when you don't want to execute an action
2447 * immediately, but want to give the control back to the main loop
2448 * so that it will call your job callback when jobs start being
2449 * processed (and if there are other jobs added before yours, they
2450 * will be processed first). This also gives the chance to other
2451 * actions in your program to cancel the job before it is started.
2452 *
2453 * Examples of using @ref Ecore_Job :
2454 * @li @ref ecore_job_example_c
2455 *
2456 * @ingroup Ecore_Main_Loop_Group
2457 *
2458 * @{
2459 */
2460
2461typedef struct _Ecore_Job Ecore_Job; /**< A job handle */
2462
2463EAPI Ecore_Job *ecore_job_add(Ecore_Cb func, const void *data);
2464EAPI void *ecore_job_del(Ecore_Job *job);
2465
2466/**
2467 * @}
2468 */
2469
2470/**
2471 * @defgroup Ecore_Application_Group Ecore Application functions
2472 *
2473 * @{
2474 */
2475
2476EAPI void ecore_app_args_set(int argc, const char **argv);
2477EAPI void ecore_app_args_get(int *argc, char ***argv);
2478EAPI void ecore_app_restart(void);
2479
2480/**
2481 * @}
2482 */
2483
2484/**
2485 * @defgroup Ecore_Throttle_Group Ecore Throttle functions
2486 *
2487 * @ingroup Ecore_Main_Loop_Group
2488 *
2489 * @{
2490 */
2491
2492EAPI void ecore_throttle_adjust(double amount);
2493EAPI double ecore_throttle_get(void);
2494
2495/**
2496 * @}
2497 */
2498
2499#ifdef __cplusplus
2500}
2501#endif
2502#endif
diff --git a/libraries/ecore/src/lib/ecore/Ecore_Getopt.h b/libraries/ecore/src/lib/ecore/Ecore_Getopt.h
deleted file mode 100644
index 0a11787..0000000
--- a/libraries/ecore/src/lib/ecore/Ecore_Getopt.h
+++ /dev/null
@@ -1,419 +0,0 @@
1#ifndef _ECORE_GETOPT_H
2#define _ECORE_GETOPT_H
3
4#include <stdio.h>
5#include <Eina.h>
6
7#ifdef EAPI
8# undef EAPI
9#endif
10
11#ifdef _WIN32
12# ifdef EFL_ECORE_BUILD
13# ifdef DLL_EXPORT
14# define EAPI __declspec(dllexport)
15# else
16# define EAPI
17# endif /* ! DLL_EXPORT */
18# else
19# define EAPI __declspec(dllimport)
20# endif /* ! EFL_ECORE_BUILD */
21#else
22# ifdef __GNUC__
23# if __GNUC__ >= 4
24# define EAPI __attribute__ ((visibility("default")))
25# else
26# define EAPI
27# endif
28# else
29# define EAPI
30# endif
31#endif /* ! _WIN32 */
32
33/**
34 * @file Ecore_Getopt.h
35 * @brief Contains powerful getopt replacement.
36 *
37 * This replacement handles both short (-X) or long options (--ABC)
38 * options, with various actions supported, like storing one value and
39 * already converting to required type, counting number of
40 * occurrences, setting true or false values, show help, license,
41 * copyright and even support user-defined callbacks.
42 *
43 * It is provided a set of C Pre Processor macros so definition is
44 * straightforward.
45 *
46 * Values will be stored elsewhere indicated by an array of pointers
47 * to values, it is given in separate to parser description so you can
48 * use multiple values with the same parser.
49 */
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55typedef enum {
56 ECORE_GETOPT_ACTION_STORE,
57 ECORE_GETOPT_ACTION_STORE_CONST,
58 ECORE_GETOPT_ACTION_STORE_TRUE,
59 ECORE_GETOPT_ACTION_STORE_FALSE,
60 ECORE_GETOPT_ACTION_CHOICE,
61 ECORE_GETOPT_ACTION_APPEND,
62 ECORE_GETOPT_ACTION_COUNT,
63 ECORE_GETOPT_ACTION_CALLBACK,
64 ECORE_GETOPT_ACTION_HELP,
65 ECORE_GETOPT_ACTION_VERSION,
66 ECORE_GETOPT_ACTION_COPYRIGHT,
67 ECORE_GETOPT_ACTION_LICENSE
68} Ecore_Getopt_Action;
69
70typedef enum {
71 ECORE_GETOPT_TYPE_STR,
72 ECORE_GETOPT_TYPE_BOOL,
73 ECORE_GETOPT_TYPE_SHORT,
74 ECORE_GETOPT_TYPE_INT,
75 ECORE_GETOPT_TYPE_LONG,
76 ECORE_GETOPT_TYPE_USHORT,
77 ECORE_GETOPT_TYPE_UINT,
78 ECORE_GETOPT_TYPE_ULONG,
79 ECORE_GETOPT_TYPE_DOUBLE
80} Ecore_Getopt_Type;
81
82typedef enum {
83 ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO = 0,
84 ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES = 1,
85 ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL = 3
86} Ecore_Getopt_Desc_Arg_Requirement;
87
88typedef union _Ecore_Getopt_Value Ecore_Getopt_Value;
89
90typedef struct _Ecore_Getopt_Desc_Store Ecore_Getopt_Desc_Store;
91typedef struct _Ecore_Getopt_Desc_Callback Ecore_Getopt_Desc_Callback;
92typedef struct _Ecore_Getopt_Desc Ecore_Getopt_Desc;
93typedef struct _Ecore_Getopt Ecore_Getopt;
94
95union _Ecore_Getopt_Value
96{
97 char **strp;
98 unsigned char *boolp;
99 short *shortp;
100 int *intp;
101 long *longp;
102 unsigned short *ushortp;
103 unsigned int *uintp;
104 unsigned long *ulongp;
105 double *doublep;
106 Eina_List **listp;
107 void **ptrp;
108};
109
110struct _Ecore_Getopt_Desc_Store
111{
112 Ecore_Getopt_Type type; /**< type of data being handled */
113 Ecore_Getopt_Desc_Arg_Requirement arg_req;
114 union
115 {
116 const char *strv;
117 Eina_Bool boolv;
118 short shortv;
119 int intv;
120 long longv;
121 unsigned short ushortv;
122 unsigned int uintv;
123 unsigned long ulongv;
124 double doublev;
125 } def;
126};
127
128struct _Ecore_Getopt_Desc_Callback
129{
130 Eina_Bool (*func)(const Ecore_Getopt *parser,
131 const Ecore_Getopt_Desc *desc,
132 const char *str,
133 void *data,
134 Ecore_Getopt_Value *storage);
135 const void *data;
136 Ecore_Getopt_Desc_Arg_Requirement arg_req;
137 const char *def;
138};
139
140struct _Ecore_Getopt_Desc
141{
142 char shortname; /**< used with a single dash */
143 const char *longname; /**< used with double dashes */
144 const char *help; /**< used by --help/ecore_getopt_help() */
145 const char *metavar; /**< used by ecore_getopt_help() with nargs > 0 */
146
147 Ecore_Getopt_Action action; /**< define how to handle it */
148 union
149 {
150 const Ecore_Getopt_Desc_Store store;
151 const void *store_const;
152 const char *const *choices; /* NULL terminated. */
153 const Ecore_Getopt_Type append_type;
154 const Ecore_Getopt_Desc_Callback callback;
155 const void *dummy;
156 } action_param;
157};
158
159struct _Ecore_Getopt
160{
161 const char *prog; /**< to be used when ecore_app_args_get() fails */
162 const char *usage; /**< usage example, %prog is replaced */
163 const char *version; /**< if exists, --version will work */
164 const char *copyright; /**< if exists, --copyright will work */
165 const char *license; /**< if exists, --license will work */
166 const char *description; /**< long description, possible multiline */
167 Eina_Bool strict : 1; /**< fail on errors */
168 const Ecore_Getopt_Desc descs[]; /* NULL terminated. */
169};
170
171#define ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, arg_requirement, default_value) \
172 {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_STORE, \
173 {.store = {type, arg_requirement, default_value}}}
174
175#define ECORE_GETOPT_STORE(shortname, longname, help, type) \
176 ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
177 ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
178
179#define ECORE_GETOPT_STORE_STR(shortname, longname, help) \
180 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_STR)
181#define ECORE_GETOPT_STORE_BOOL(shortname, longname, help) \
182 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_BOOL)
183#define ECORE_GETOPT_STORE_SHORT(shortname, longname, help) \
184 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_SHORT)
185#define ECORE_GETOPT_STORE_INT(shortname, longname, help) \
186 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_INT)
187#define ECORE_GETOPT_STORE_LONG(shortname, longname, help) \
188 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_LONG)
189#define ECORE_GETOPT_STORE_USHORT(shortname, longname, help) \
190 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_USHORT)
191#define ECORE_GETOPT_STORE_UINT(shortname, longname, help) \
192 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_UINT)
193#define ECORE_GETOPT_STORE_ULONG(shortname, longname, help) \
194 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_ULONG)
195#define ECORE_GETOPT_STORE_DOUBLE(shortname, longname, help) \
196 ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_DOUBLE)
197
198#define ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, type) \
199 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, \
200 ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
201
202#define ECORE_GETOPT_STORE_METAVAR_STR(shortname, longname, help, metavar) \
203 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_STR)
204#define ECORE_GETOPT_STORE_METAVAR_BOOL(shortname, longname, help, metavar) \
205 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_BOOL)
206#define ECORE_GETOPT_STORE_METAVAR_SHORT(shortname, longname, help, metavar) \
207 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_SHORT)
208#define ECORE_GETOPT_STORE_METAVAR_INT(shortname, longname, help, metavar) \
209 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_INT)
210#define ECORE_GETOPT_STORE_METAVAR_LONG(shortname, longname, help, metavar) \
211 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_LONG)
212#define ECORE_GETOPT_STORE_METAVAR_USHORT(shortname, longname, help, metavar) \
213 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_USHORT)
214#define ECORE_GETOPT_STORE_METAVAR_UINT(shortname, longname, help, metavar) \
215 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_UINT)
216#define ECORE_GETOPT_STORE_METAVAR_ULONG(shortname, longname, help, metavar) \
217 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_ULONG)
218#define ECORE_GETOPT_STORE_METAVAR_DOUBLE(shortname, longname, help, metavar) \
219 ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_DOUBLE)
220
221#define ECORE_GETOPT_STORE_DEF(shortname, longname, help, type, default_value) \
222 ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
223 ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL, \
224 default_value)
225
226#define ECORE_GETOPT_STORE_DEF_STR(shortname, longname, help, default_value) \
227 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
228 ECORE_GETOPT_TYPE_STR, \
229 {.strv = default_value})
230#define ECORE_GETOPT_STORE_DEF_BOOL(shortname, longname, help, default_value) \
231 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
232 ECORE_GETOPT_TYPE_BOOL, \
233 {.boolv = default_value})
234#define ECORE_GETOPT_STORE_DEF_SHORT(shortname, longname, help, default_value) \
235 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
236 ECORE_GETOPT_TYPE_SHORT, \
237 {.shortv = default_value})
238#define ECORE_GETOPT_STORE_DEF_INT(shortname, longname, help, default_value) \
239 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
240 ECORE_GETOPT_TYPE_INT, \
241 {.intv = default_value})
242#define ECORE_GETOPT_STORE_DEF_LONG(shortname, longname, help, default_value) \
243 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
244 ECORE_GETOPT_TYPE_LONG, \
245 {.longv = default_value})
246#define ECORE_GETOPT_STORE_DEF_USHORT(shortname, longname, help, default_value) \
247 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
248 ECORE_GETOPT_TYPE_USHORT, \
249 {.ushortv = default_value})
250#define ECORE_GETOPT_STORE_DEF_UINT(shortname, longname, help, default_value) \
251 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
252 ECORE_GETOPT_TYPE_UINT, \
253 {.uintv = default_value})
254#define ECORE_GETOPT_STORE_DEF_ULONG(shortname, longname, help, default_value) \
255 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
256 ECORE_GETOPT_TYPE_ULONG, \
257 {.ulongv = default_value})
258#define ECORE_GETOPT_STORE_DEF_DOUBLE(shortname, longname, help, default_value) \
259 ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
260 ECORE_GETOPT_TYPE_DOUBLE, \
261 {.doublev = default_value})
262
263#define ECORE_GETOPT_STORE_FULL_STR(shortname, longname, help, metavar, arg_requirement, default_value) \
264 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
265 ECORE_GETOPT_TYPE_STR, \
266 arg_requirement, \
267 {.strv = default_value})
268#define ECORE_GETOPT_STORE_FULL_BOOL(shortname, longname, help, metavar, arg_requirement, default_value) \
269 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
270 ECORE_GETOPT_TYPE_BOOL, \
271 arg_requirement, \
272 {.boolv = default_value})
273#define ECORE_GETOPT_STORE_FULL_SHORT(shortname, longname, help, metavar, arg_requirement, default_value) \
274 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
275 ECORE_GETOPT_TYPE_SHORT, \
276 arg_requirement, \
277 {.shortv = default_value})
278#define ECORE_GETOPT_STORE_FULL_INT(shortname, longname, help, metavar, arg_requirement, default_value) \
279 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
280 ECORE_GETOPT_TYPE_INT, \
281 arg_requirement, \
282 {.intv = default_value})
283#define ECORE_GETOPT_STORE_FULL_LONG(shortname, longname, help, metavar, arg_requirement, default_value) \
284 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
285 ECORE_GETOPT_TYPE_LONG, \
286 arg_requirement, \
287 {.longv = default_value})
288#define ECORE_GETOPT_STORE_FULL_USHORT(shortname, longname, help, metavar, arg_requirement, default_value) \
289 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
290 ECORE_GETOPT_TYPE_USHORT, \
291 arg_requirement, \
292 {.ushortv = default_value})
293#define ECORE_GETOPT_STORE_FULL_UINT(shortname, longname, help, metavar, arg_requirement, default_value) \
294 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
295 ECORE_GETOPT_TYPE_UINT, \
296 arg_requirement, \
297 {.uintv = default_value})
298#define ECORE_GETOPT_STORE_FULL_ULONG(shortname, longname, help, metavar, arg_requirement, default_value) \
299 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
300 ECORE_GETOPT_TYPE_ULONG, \
301 arg_requirement, \
302 {.ulongv = default_value})
303#define ECORE_GETOPT_STORE_FULL_DOUBLE(shortname, longname, help, metavar, arg_requirement, default_value) \
304 ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
305 ECORE_GETOPT_TYPE_DOUBLE, \
306 arg_requirement, \
307 {.doublev = default_value})
308
309#define ECORE_GETOPT_STORE_CONST(shortname, longname, help, value) \
310 {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_CONST, \
311 {.store_const = value}}
312#define ECORE_GETOPT_STORE_TRUE(shortname, longname, help) \
313 {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_TRUE, \
314 {.dummy = NULL}}
315#define ECORE_GETOPT_STORE_FALSE(shortname, longname, help) \
316 {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_FALSE, \
317 {.dummy = NULL}}
318
319#define ECORE_GETOPT_CHOICE(shortname, longname, help, choices_array) \
320 {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_CHOICE, \
321 {.choices = choices_array}}
322#define ECORE_GETOPT_CHOICE_METAVAR(shortname, longname, help, metavar, choices_array) \
323 {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CHOICE, \
324 {.choices = choices_array}}
325
326#define ECORE_GETOPT_APPEND(shortname, longname, help, sub_type) \
327 {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_APPEND, \
328 {.append_type = sub_type}}
329#define ECORE_GETOPT_APPEND_METAVAR(shortname, longname, help, metavar, type) \
330 {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_APPEND, \
331 {.append_type = type}}
332
333#define ECORE_GETOPT_COUNT(shortname, longname, help) \
334 {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_COUNT, \
335 {.dummy = NULL}}
336
337#define ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, callback_func, callback_data, argument_requirement, default_value) \
338 {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CALLBACK, \
339 {.callback = {callback_func, callback_data, \
340 argument_requirement, default_value}}}
341#define ECORE_GETOPT_CALLBACK_NOARGS(shortname, longname, help, callback_func, callback_data) \
342 ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, NULL, \
343 callback_func, callback_data, \
344 ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO, \
345 NULL)
346#define ECORE_GETOPT_CALLBACK_ARGS(shortname, longname, help, metavar, callback_func, callback_data) \
347 ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, \
348 callback_func, callback_data, \
349 ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, \
350 NULL)
351
352#define ECORE_GETOPT_HELP(shortname, longname) \
353 {shortname, longname, "show this message.", NULL, \
354 ECORE_GETOPT_ACTION_HELP, \
355 {.dummy = NULL}}
356
357#define ECORE_GETOPT_VERSION(shortname, longname) \
358 {shortname, longname, "show program version.", NULL, \
359 ECORE_GETOPT_ACTION_VERSION, \
360 {.dummy = NULL}}
361
362#define ECORE_GETOPT_COPYRIGHT(shortname, longname) \
363 {shortname, longname, "show copyright.", NULL, \
364 ECORE_GETOPT_ACTION_COPYRIGHT, \
365 {.dummy = NULL}}
366
367#define ECORE_GETOPT_LICENSE(shortname, longname) \
368 {shortname, longname, "show license.", NULL, \
369 ECORE_GETOPT_ACTION_LICENSE, \
370 {.dummy = NULL}}
371
372#define ECORE_GETOPT_SENTINEL {0, NULL, NULL, NULL, 0, {.dummy = NULL}}
373
374#define ECORE_GETOPT_VALUE_STR(val) {.strp = &(val)}
375#define ECORE_GETOPT_VALUE_BOOL(val) {.boolp = &(val)}
376#define ECORE_GETOPT_VALUE_SHORT(val) {.shortp = &(val)}
377#define ECORE_GETOPT_VALUE_INT(val) {.intp = &(val)}
378#define ECORE_GETOPT_VALUE_LONG(val) {.longp = &(val)}
379#define ECORE_GETOPT_VALUE_USHORT(val) {.ushortp = &(val)}
380#define ECORE_GETOPT_VALUE_UINT(val) {.uintp = &(val)}
381#define ECORE_GETOPT_VALUE_ULONG(val) {.ulongp = &(val)}
382#define ECORE_GETOPT_VALUE_DOUBLE(val) {.doublep = &(val)}
383#define ECORE_GETOPT_VALUE_PTR(val) {.ptrp = &(val)}
384#define ECORE_GETOPT_VALUE_PTR_CAST(val) {.ptrp = (void **)&(val)}
385#define ECORE_GETOPT_VALUE_LIST(val) {.listp = &(val)}
386#define ECORE_GETOPT_VALUE_NONE {.ptrp = NULL}
387
388EAPI void
389ecore_getopt_help(FILE *fp,
390 const Ecore_Getopt *info);
391
392EAPI Eina_Bool
393 ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser);
394EAPI int
395 ecore_getopt_parse(const Ecore_Getopt *parser,
396 Ecore_Getopt_Value *values,
397 int argc,
398 char **argv);
399
400EAPI Eina_List *ecore_getopt_list_free(Eina_List *list);
401
402/* helper functions to be used with ECORE_GETOPT_CALLBACK_*() */
403EAPI Eina_Bool
404ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser,
405 const Ecore_Getopt_Desc *desc,
406 const char *str,
407 void *data,
408 Ecore_Getopt_Value *storage);
409EAPI Eina_Bool
410ecore_getopt_callback_size_parse(const Ecore_Getopt *parser,
411 const Ecore_Getopt_Desc *desc,
412 const char *str,
413 void *data,
414 Ecore_Getopt_Value *storage);
415
416#ifdef __cplusplus
417}
418#endif
419#endif /* _ECORE_GETOPT_H */
diff --git a/libraries/ecore/src/lib/ecore/Makefile.am b/libraries/ecore/src/lib/ecore/Makefile.am
deleted file mode 100644
index 6f14387..0000000
--- a/libraries/ecore/src/lib/ecore/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = @GLIB_CFLAGS@ @EVIL_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@
4AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@
5
6lib_LTLIBRARIES = libecore.la
7includes_HEADERS = \
8Ecore.h \
9Ecore_Getopt.h
10includesdir = $(includedir)/ecore-@VMAJ@
11
12libecore_la_SOURCES = \
13ecore.c \
14ecore_alloc.c \
15ecore_anim.c \
16ecore_app.c \
17ecore_events.c \
18ecore_getopt.c \
19ecore_idle_enterer.c \
20ecore_idle_exiter.c \
21ecore_idler.c \
22ecore_job.c \
23ecore_main.c \
24ecore_pipe.c \
25ecore_poll.c \
26ecore_time.c \
27ecore_timer.c \
28ecore_thread.c \
29ecore_glib.c \
30ecore_throttle.c
31
32if ECORE_HAVE_WIN32
33
34libecore_la_SOURCES += ecore_exe_win32.c
35
36else
37
38if ECORE_HAVE_WINCE
39
40libecore_la_SOURCES += ecore_exe_wince.c
41
42else
43
44if ECORE_HAVE_PS3
45
46libecore_la_SOURCES += ecore_exe_ps3.c
47
48else
49
50if ECORE_HAVE_EXOTIC
51
52libecore_la_SOURCES +=
53
54else
55
56libecore_la_SOURCES += ecore_signal.c ecore_exe.c
57
58endif
59
60endif
61
62endif
63
64endif
65
66libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm
67libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@
68
69EXTRA_DIST = ecore_private.h
diff --git a/libraries/ecore/src/lib/ecore/Makefile.in b/libraries/ecore/src/lib/ecore/Makefile.in
deleted file mode 100644
index 71e2ac4..0000000
--- a/libraries/ecore/src/lib/ecore/Makefile.in
+++ /dev/null
@@ -1,871 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38@ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_exe_win32.c
39@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__append_2 = ecore_exe_wince.c
40@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_3 = ecore_exe_ps3.c
41@ECORE_HAVE_EXOTIC_TRUE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_4 =
42@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_5 = ecore_signal.c ecore_exe.c
43subdir = src/lib/ecore
44DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
45 $(srcdir)/Makefile.in
46ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
47am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/ac_path_generic.m4 \
49 $(top_srcdir)/m4/check_x_extension.m4 \
50 $(top_srcdir)/m4/ecore_check_module.m4 \
51 $(top_srcdir)/m4/ecore_check_options.m4 \
52 $(top_srcdir)/m4/efl_compiler_flag.m4 \
53 $(top_srcdir)/m4/efl_doxygen.m4 \
54 $(top_srcdir)/m4/efl_examples.m4 \
55 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
56 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
57 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
58 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
59 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
60 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
61 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
62 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
63 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
64am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
65 $(ACLOCAL_M4)
66mkinstalldirs = $(install_sh) -d
67CONFIG_HEADER = $(top_builddir)/config.h
68CONFIG_CLEAN_FILES =
69CONFIG_CLEAN_VPATH_FILES =
70am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
71am__vpath_adj = case $$p in \
72 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
73 *) f=$$p;; \
74 esac;
75am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
76am__install_max = 40
77am__nobase_strip_setup = \
78 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
79am__nobase_strip = \
80 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
81am__nobase_list = $(am__nobase_strip_setup); \
82 for p in $$list; do echo "$$p $$p"; done | \
83 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
84 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
85 if (++n[$$2] == $(am__install_max)) \
86 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
87 END { for (dir in files) print dir, files[dir] }'
88am__base_list = \
89 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
90 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
91am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
92LTLIBRARIES = $(lib_LTLIBRARIES)
93libecore_la_DEPENDENCIES =
94am__libecore_la_SOURCES_DIST = ecore.c ecore_alloc.c ecore_anim.c \
95 ecore_app.c ecore_events.c ecore_getopt.c ecore_idle_enterer.c \
96 ecore_idle_exiter.c ecore_idler.c ecore_job.c ecore_main.c \
97 ecore_pipe.c ecore_poll.c ecore_time.c ecore_timer.c \
98 ecore_thread.c ecore_glib.c ecore_throttle.c ecore_exe_win32.c \
99 ecore_exe_wince.c ecore_exe_ps3.c ecore_signal.c ecore_exe.c
100@ECORE_HAVE_WIN32_TRUE@am__objects_1 = ecore_exe_win32.lo
101@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__objects_2 = ecore_exe_wince.lo
102@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_3 = ecore_exe_ps3.lo
103am__objects_4 =
104@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_5 = ecore_signal.lo \
105@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@ ecore_exe.lo
106am_libecore_la_OBJECTS = ecore.lo ecore_alloc.lo ecore_anim.lo \
107 ecore_app.lo ecore_events.lo ecore_getopt.lo \
108 ecore_idle_enterer.lo ecore_idle_exiter.lo ecore_idler.lo \
109 ecore_job.lo ecore_main.lo ecore_pipe.lo ecore_poll.lo \
110 ecore_time.lo ecore_timer.lo ecore_thread.lo ecore_glib.lo \
111 ecore_throttle.lo $(am__objects_1) $(am__objects_2) \
112 $(am__objects_3) $(am__objects_4) $(am__objects_5)
113libecore_la_OBJECTS = $(am_libecore_la_OBJECTS)
114AM_V_lt = $(am__v_lt_$(V))
115am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
116am__v_lt_0 = --silent
117libecore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
118 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
119 $(libecore_la_LDFLAGS) $(LDFLAGS) -o $@
120DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
121depcomp = $(SHELL) $(top_srcdir)/depcomp
122am__depfiles_maybe = depfiles
123am__mv = mv -f
124COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
125 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
126LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
127 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
128 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
129 $(AM_CFLAGS) $(CFLAGS)
130AM_V_CC = $(am__v_CC_$(V))
131am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
132am__v_CC_0 = @echo " CC " $@;
133AM_V_at = $(am__v_at_$(V))
134am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
135am__v_at_0 = @
136CCLD = $(CC)
137LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
138 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
139 $(AM_LDFLAGS) $(LDFLAGS) -o $@
140AM_V_CCLD = $(am__v_CCLD_$(V))
141am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
142am__v_CCLD_0 = @echo " CCLD " $@;
143AM_V_GEN = $(am__v_GEN_$(V))
144am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
145am__v_GEN_0 = @echo " GEN " $@;
146SOURCES = $(libecore_la_SOURCES)
147DIST_SOURCES = $(am__libecore_la_SOURCES_DIST)
148HEADERS = $(includes_HEADERS)
149ETAGS = etags
150CTAGS = ctags
151DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
152ACLOCAL = @ACLOCAL@
153ALLOCA = @ALLOCA@
154AMTAR = @AMTAR@
155AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
156AR = @AR@
157AS = @AS@
158AUTOCONF = @AUTOCONF@
159AUTOHEADER = @AUTOHEADER@
160AUTOMAKE = @AUTOMAKE@
161AWK = @AWK@
162CARES_CFLAGS = @CARES_CFLAGS@
163CARES_LIBS = @CARES_LIBS@
164CC = @CC@
165CCDEPMODE = @CCDEPMODE@
166CFLAGS = @CFLAGS@
167CHECK_CFLAGS = @CHECK_CFLAGS@
168CHECK_LIBS = @CHECK_LIBS@
169CPP = @CPP@
170CPPFLAGS = @CPPFLAGS@
171CURL_CFLAGS = @CURL_CFLAGS@
172CURL_LIBS = @CURL_LIBS@
173CXX = @CXX@
174CXXCPP = @CXXCPP@
175CXXDEPMODE = @CXXDEPMODE@
176CXXFLAGS = @CXXFLAGS@
177CYGPATH_W = @CYGPATH_W@
178DEFS = @DEFS@
179DEPDIR = @DEPDIR@
180DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
181DIRECTFB_LIBS = @DIRECTFB_LIBS@
182DLLTOOL = @DLLTOOL@
183DSYMUTIL = @DSYMUTIL@
184DUMPBIN = @DUMPBIN@
185ECHO_C = @ECHO_C@
186ECHO_N = @ECHO_N@
187ECHO_T = @ECHO_T@
188ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
189ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
190EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
191EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
192EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
193EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
194EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
195EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
196EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
197EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
198EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
199EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
200EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
201EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
202EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
203EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
204EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
205EGREP = @EGREP@
206EINA_CFLAGS = @EINA_CFLAGS@
207EINA_LIBS = @EINA_LIBS@
208ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
209ESCAPE_LIBS = @ESCAPE_LIBS@
210EVAS_CFLAGS = @EVAS_CFLAGS@
211EVAS_LIBS = @EVAS_LIBS@
212EVIL_CFLAGS = @EVIL_CFLAGS@
213EVIL_LIBS = @EVIL_LIBS@
214EXEEXT = @EXEEXT@
215EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
216EXOTIC_LIBS = @EXOTIC_LIBS@
217FGREP = @FGREP@
218GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
219GLIB_CFLAGS = @GLIB_CFLAGS@
220GLIB_LIBS = @GLIB_LIBS@
221GMSGFMT = @GMSGFMT@
222GMSGFMT_015 = @GMSGFMT_015@
223GREP = @GREP@
224INSTALL = @INSTALL@
225INSTALL_DATA = @INSTALL_DATA@
226INSTALL_PROGRAM = @INSTALL_PROGRAM@
227INSTALL_SCRIPT = @INSTALL_SCRIPT@
228INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
229INTLLIBS = @INTLLIBS@
230INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
231KEYSYMDEFS = @KEYSYMDEFS@
232LD = @LD@
233LDFLAGS = @LDFLAGS@
234LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
235LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
236LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
237LIBICONV = @LIBICONV@
238LIBINTL = @LIBINTL@
239LIBOBJS = @LIBOBJS@
240LIBS = @LIBS@
241LIBTOOL = @LIBTOOL@
242LIPO = @LIPO@
243LN_S = @LN_S@
244LTLIBICONV = @LTLIBICONV@
245LTLIBINTL = @LTLIBINTL@
246LTLIBOBJS = @LTLIBOBJS@
247MAKEINFO = @MAKEINFO@
248MKDIR_P = @MKDIR_P@
249MSGFMT = @MSGFMT@
250MSGFMT_015 = @MSGFMT_015@
251MSGMERGE = @MSGMERGE@
252NM = @NM@
253NMEDIT = @NMEDIT@
254OBJC = @OBJC@
255OBJCDEPMODE = @OBJCDEPMODE@
256OBJCFLAGS = @OBJCFLAGS@
257OBJDUMP = @OBJDUMP@
258OBJEXT = @OBJEXT@
259OTOOL = @OTOOL@
260OTOOL64 = @OTOOL64@
261PACKAGE = @PACKAGE@
262PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
263PACKAGE_NAME = @PACKAGE_NAME@
264PACKAGE_STRING = @PACKAGE_STRING@
265PACKAGE_TARNAME = @PACKAGE_TARNAME@
266PACKAGE_URL = @PACKAGE_URL@
267PACKAGE_VERSION = @PACKAGE_VERSION@
268PATH_SEPARATOR = @PATH_SEPARATOR@
269PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
270PIXMAN_LIBS = @PIXMAN_LIBS@
271PKG_CONFIG = @PKG_CONFIG@
272PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
273PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
274POSUB = @POSUB@
275RANLIB = @RANLIB@
276SCIM_CFLAGS = @SCIM_CFLAGS@
277SCIM_LIBS = @SCIM_LIBS@
278SDL_CFLAGS = @SDL_CFLAGS@
279SDL_CONFIG = @SDL_CONFIG@
280SDL_LIBS = @SDL_LIBS@
281SED = @SED@
282SET_MAKE = @SET_MAKE@
283SHELL = @SHELL@
284SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
285SSL_CFLAGS = @SSL_CFLAGS@
286SSL_LIBS = @SSL_LIBS@
287STRIP = @STRIP@
288TLS2_CFLAGS = @TLS2_CFLAGS@
289TLS2_LIBS = @TLS2_LIBS@
290TLS_CFLAGS = @TLS_CFLAGS@
291TLS_LIBS = @TLS_LIBS@
292TSLIB_CFLAGS = @TSLIB_CFLAGS@
293TSLIB_LIBS = @TSLIB_LIBS@
294USE_NLS = @USE_NLS@
295VERSION = @VERSION@
296VMAJ = @VMAJ@
297WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
298WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
299WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
300WAYLAND_LIBS = @WAYLAND_LIBS@
301WIN32_CFLAGS = @WIN32_CFLAGS@
302WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
303WIN32_LIBS = @WIN32_LIBS@
304XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
305XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
306XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
307XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
308XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
309XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
310XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
311XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
312XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
313XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
314XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
315XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
316XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
317XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
318XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
319XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
320XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
321XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
322XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
323XCB_X11_LIBS = @XCB_X11_LIBS@
324XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
325XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
326XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
327XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
328XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
329XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
330XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
331XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
332XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
333XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
334XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
335XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
336XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
337XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
338XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
339XDAMAGE_LIBS = @XDAMAGE_LIBS@
340XDPMS_CFLAGS = @XDPMS_CFLAGS@
341XDPMS_LIBS = @XDPMS_LIBS@
342XFIXES_CFLAGS = @XFIXES_CFLAGS@
343XFIXES_LIBS = @XFIXES_LIBS@
344XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
345XGESTURE_LIBS = @XGESTURE_LIBS@
346XGETTEXT = @XGETTEXT@
347XGETTEXT_015 = @XGETTEXT_015@
348XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
349XI2_CFLAGS = @XI2_CFLAGS@
350XI2_LIBS = @XI2_LIBS@
351XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
352XINERAMA_LIBS = @XINERAMA_LIBS@
353XKB_CFLAGS = @XKB_CFLAGS@
354XKB_LIBS = @XKB_LIBS@
355XMKMF = @XMKMF@
356XPRINT_CFLAGS = @XPRINT_CFLAGS@
357XPRINT_LIBS = @XPRINT_LIBS@
358XRANDR_CFLAGS = @XRANDR_CFLAGS@
359XRANDR_LIBS = @XRANDR_LIBS@
360XRENDER_CFLAGS = @XRENDER_CFLAGS@
361XRENDER_LIBS = @XRENDER_LIBS@
362XSS_CFLAGS = @XSS_CFLAGS@
363XSS_LIBS = @XSS_LIBS@
364XTEST_CFLAGS = @XTEST_CFLAGS@
365XTEST_LIBS = @XTEST_LIBS@
366X_CFLAGS = @X_CFLAGS@
367X_EXTRA_LIBS = @X_EXTRA_LIBS@
368X_LIBS = @X_LIBS@
369X_PRE_LIBS = @X_PRE_LIBS@
370Xcursor_cflags = @Xcursor_cflags@
371Xcursor_libs = @Xcursor_libs@
372abs_builddir = @abs_builddir@
373abs_srcdir = @abs_srcdir@
374abs_top_builddir = @abs_top_builddir@
375abs_top_srcdir = @abs_top_srcdir@
376ac_ct_CC = @ac_ct_CC@
377ac_ct_CXX = @ac_ct_CXX@
378ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
379ac_ct_OBJC = @ac_ct_OBJC@
380am__include = @am__include@
381am__leading_dot = @am__leading_dot@
382am__quote = @am__quote@
383am__tar = @am__tar@
384am__untar = @am__untar@
385bindir = @bindir@
386build = @build@
387build_alias = @build_alias@
388build_cpu = @build_cpu@
389build_os = @build_os@
390build_vendor = @build_vendor@
391builddir = @builddir@
392cocoa_ldflags = @cocoa_ldflags@
393datadir = @datadir@
394datarootdir = @datarootdir@
395dlopen_libs = @dlopen_libs@
396docdir = @docdir@
397dvidir = @dvidir@
398ecore_cocoa_cflags = @ecore_cocoa_cflags@
399ecore_cocoa_libs = @ecore_cocoa_libs@
400ecore_con_cflags = @ecore_con_cflags@
401ecore_con_libs = @ecore_con_libs@
402ecore_directfb_cflags = @ecore_directfb_cflags@
403ecore_directfb_libs = @ecore_directfb_libs@
404ecore_evas_cflags = @ecore_evas_cflags@
405ecore_evas_libs = @ecore_evas_libs@
406ecore_fb_cflags = @ecore_fb_cflags@
407ecore_fb_libs = @ecore_fb_libs@
408ecore_file_cflags = @ecore_file_cflags@
409ecore_file_libs = @ecore_file_libs@
410ecore_imf_cflags = @ecore_imf_cflags@
411ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
412ecore_imf_evas_libs = @ecore_imf_evas_libs@
413ecore_imf_libs = @ecore_imf_libs@
414ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
415ecore_imf_scim_libs = @ecore_imf_scim_libs@
416ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
417ecore_imf_xim_libs = @ecore_imf_xim_libs@
418ecore_input_cflags = @ecore_input_cflags@
419ecore_input_evas_cflags = @ecore_input_evas_cflags@
420ecore_input_evas_libs = @ecore_input_evas_libs@
421ecore_input_libs = @ecore_input_libs@
422ecore_ipc_cflags = @ecore_ipc_cflags@
423ecore_ipc_libs = @ecore_ipc_libs@
424ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
425ecore_psl1ght_libs = @ecore_psl1ght_libs@
426ecore_sdl_cflags = @ecore_sdl_cflags@
427ecore_sdl_libs = @ecore_sdl_libs@
428ecore_wayland_cflags = @ecore_wayland_cflags@
429ecore_wayland_libs = @ecore_wayland_libs@
430ecore_win32_cflags = @ecore_win32_cflags@
431ecore_win32_libs = @ecore_win32_libs@
432ecore_wince_cflags = @ecore_wince_cflags@
433ecore_wince_libs = @ecore_wince_libs@
434ecore_x_cflags = @ecore_x_cflags@
435ecore_x_libs = @ecore_x_libs@
436ecore_x_libs_private = @ecore_x_libs_private@
437efl_doxygen = @efl_doxygen@
438efl_have_doxygen = @efl_have_doxygen@
439exec_prefix = @exec_prefix@
440have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
441host = @host@
442host_alias = @host_alias@
443host_cpu = @host_cpu@
444host_os = @host_os@
445host_vendor = @host_vendor@
446htmldir = @htmldir@
447includedir = @includedir@
448infodir = @infodir@
449install_sh = @install_sh@
450libdir = @libdir@
451libexecdir = @libexecdir@
452localedir = @localedir@
453localstatedir = @localstatedir@
454lt_ECHO = @lt_ECHO@
455lt_enable_auto_import = @lt_enable_auto_import@
456mandir = @mandir@
457mkdir_p = @mkdir_p@
458oldincludedir = @oldincludedir@
459pdfdir = @pdfdir@
460pkgconfig_requires_private = @pkgconfig_requires_private@
461prefix = @prefix@
462program_transform_name = @program_transform_name@
463psdir = @psdir@
464release_info = @release_info@
465requirements_ecore = @requirements_ecore@
466requirements_ecore_cocoa = @requirements_ecore_cocoa@
467requirements_ecore_con = @requirements_ecore_con@
468requirements_ecore_directfb = @requirements_ecore_directfb@
469requirements_ecore_evas = @requirements_ecore_evas@
470requirements_ecore_fb = @requirements_ecore_fb@
471requirements_ecore_file = @requirements_ecore_file@
472requirements_ecore_imf = @requirements_ecore_imf@
473requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
474requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
475requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
476requirements_ecore_input = @requirements_ecore_input@
477requirements_ecore_input_evas = @requirements_ecore_input_evas@
478requirements_ecore_ipc = @requirements_ecore_ipc@
479requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
480requirements_ecore_sdl = @requirements_ecore_sdl@
481requirements_ecore_wayland = @requirements_ecore_wayland@
482requirements_ecore_win32 = @requirements_ecore_win32@
483requirements_ecore_wince = @requirements_ecore_wince@
484requirements_ecore_x = @requirements_ecore_x@
485rt_libs = @rt_libs@
486sbindir = @sbindir@
487sharedstatedir = @sharedstatedir@
488srcdir = @srcdir@
489sysconfdir = @sysconfdir@
490target_alias = @target_alias@
491top_build_prefix = @top_build_prefix@
492top_builddir = @top_builddir@
493top_srcdir = @top_srcdir@
494version_info = @version_info@
495x_cflags = @x_cflags@
496x_includes = @x_includes@
497x_libs = @x_libs@
498MAINTAINERCLEANFILES = Makefile.in
499AM_CPPFLAGS = @GLIB_CFLAGS@ @EVIL_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@
500AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@
501lib_LTLIBRARIES = libecore.la
502includes_HEADERS = \
503Ecore.h \
504Ecore_Getopt.h
505
506includesdir = $(includedir)/ecore-@VMAJ@
507libecore_la_SOURCES = ecore.c ecore_alloc.c ecore_anim.c ecore_app.c \
508 ecore_events.c ecore_getopt.c ecore_idle_enterer.c \
509 ecore_idle_exiter.c ecore_idler.c ecore_job.c ecore_main.c \
510 ecore_pipe.c ecore_poll.c ecore_time.c ecore_timer.c \
511 ecore_thread.c ecore_glib.c ecore_throttle.c $(am__append_1) \
512 $(am__append_2) $(am__append_3) $(am__append_4) \
513 $(am__append_5)
514libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm
515libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@
516EXTRA_DIST = ecore_private.h
517all: all-am
518
519.SUFFIXES:
520.SUFFIXES: .c .lo .o .obj
521$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
522 @for dep in $?; do \
523 case '$(am__configure_deps)' in \
524 *$$dep*) \
525 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
526 && { if test -f $@; then exit 0; else break; fi; }; \
527 exit 1;; \
528 esac; \
529 done; \
530 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore/Makefile'; \
531 $(am__cd) $(top_srcdir) && \
532 $(AUTOMAKE) --gnu src/lib/ecore/Makefile
533.PRECIOUS: Makefile
534Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
535 @case '$?' in \
536 *config.status*) \
537 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
538 *) \
539 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
540 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
541 esac;
542
543$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
544 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
545
546$(top_srcdir)/configure: $(am__configure_deps)
547 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
548$(ACLOCAL_M4): $(am__aclocal_m4_deps)
549 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
550$(am__aclocal_m4_deps):
551install-libLTLIBRARIES: $(lib_LTLIBRARIES)
552 @$(NORMAL_INSTALL)
553 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
554 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
555 list2=; for p in $$list; do \
556 if test -f $$p; then \
557 list2="$$list2 $$p"; \
558 else :; fi; \
559 done; \
560 test -z "$$list2" || { \
561 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
562 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
563 }
564
565uninstall-libLTLIBRARIES:
566 @$(NORMAL_UNINSTALL)
567 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
568 for p in $$list; do \
569 $(am__strip_dir) \
570 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
571 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
572 done
573
574clean-libLTLIBRARIES:
575 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
576 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
577 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
578 test "$$dir" != "$$p" || dir=.; \
579 echo "rm -f \"$${dir}/so_locations\""; \
580 rm -f "$${dir}/so_locations"; \
581 done
582libecore.la: $(libecore_la_OBJECTS) $(libecore_la_DEPENDENCIES)
583 $(AM_V_CCLD)$(libecore_la_LINK) -rpath $(libdir) $(libecore_la_OBJECTS) $(libecore_la_LIBADD) $(LIBS)
584
585mostlyclean-compile:
586 -rm -f *.$(OBJEXT)
587
588distclean-compile:
589 -rm -f *.tab.c
590
591@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore.Plo@am__quote@
592@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_alloc.Plo@am__quote@
593@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_anim.Plo@am__quote@
594@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_app.Plo@am__quote@
595@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_events.Plo@am__quote@
596@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe.Plo@am__quote@
597@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe_ps3.Plo@am__quote@
598@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe_win32.Plo@am__quote@
599@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe_wince.Plo@am__quote@
600@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_getopt.Plo@am__quote@
601@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_glib.Plo@am__quote@
602@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idle_enterer.Plo@am__quote@
603@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idle_exiter.Plo@am__quote@
604@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idler.Plo@am__quote@
605@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_job.Plo@am__quote@
606@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_main.Plo@am__quote@
607@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_pipe.Plo@am__quote@
608@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_poll.Plo@am__quote@
609@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_signal.Plo@am__quote@
610@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_thread.Plo@am__quote@
611@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_throttle.Plo@am__quote@
612@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_time.Plo@am__quote@
613@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_timer.Plo@am__quote@
614
615.c.o:
616@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
617@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
618@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
619@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
620@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
621@am__fastdepCC_FALSE@ $(COMPILE) -c $<
622
623.c.obj:
624@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
625@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
626@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
627@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
628@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
629@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
630
631.c.lo:
632@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
633@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
634@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
635@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
636@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
637@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
638
639mostlyclean-libtool:
640 -rm -f *.lo
641
642clean-libtool:
643 -rm -rf .libs _libs
644install-includesHEADERS: $(includes_HEADERS)
645 @$(NORMAL_INSTALL)
646 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
647 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
648 for p in $$list; do \
649 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
650 echo "$$d$$p"; \
651 done | $(am__base_list) | \
652 while read files; do \
653 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
654 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
655 done
656
657uninstall-includesHEADERS:
658 @$(NORMAL_UNINSTALL)
659 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
660 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
661 test -n "$$files" || exit 0; \
662 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
663 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
664
665ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
666 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
667 unique=`for i in $$list; do \
668 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
669 done | \
670 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
671 END { if (nonempty) { for (i in files) print i; }; }'`; \
672 mkid -fID $$unique
673tags: TAGS
674
675TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
676 $(TAGS_FILES) $(LISP)
677 set x; \
678 here=`pwd`; \
679 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
680 unique=`for i in $$list; do \
681 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
682 done | \
683 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
684 END { if (nonempty) { for (i in files) print i; }; }'`; \
685 shift; \
686 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
687 test -n "$$unique" || unique=$$empty_fix; \
688 if test $$# -gt 0; then \
689 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
690 "$$@" $$unique; \
691 else \
692 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
693 $$unique; \
694 fi; \
695 fi
696ctags: CTAGS
697CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
698 $(TAGS_FILES) $(LISP)
699 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
700 unique=`for i in $$list; do \
701 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
702 done | \
703 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
704 END { if (nonempty) { for (i in files) print i; }; }'`; \
705 test -z "$(CTAGS_ARGS)$$unique" \
706 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
707 $$unique
708
709GTAGS:
710 here=`$(am__cd) $(top_builddir) && pwd` \
711 && $(am__cd) $(top_srcdir) \
712 && gtags -i $(GTAGS_ARGS) "$$here"
713
714distclean-tags:
715 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
716
717distdir: $(DISTFILES)
718 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
719 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
720 list='$(DISTFILES)'; \
721 dist_files=`for file in $$list; do echo $$file; done | \
722 sed -e "s|^$$srcdirstrip/||;t" \
723 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
724 case $$dist_files in \
725 */*) $(MKDIR_P) `echo "$$dist_files" | \
726 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
727 sort -u` ;; \
728 esac; \
729 for file in $$dist_files; do \
730 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
731 if test -d $$d/$$file; then \
732 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
733 if test -d "$(distdir)/$$file"; then \
734 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
735 fi; \
736 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
737 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
738 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
739 fi; \
740 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
741 else \
742 test -f "$(distdir)/$$file" \
743 || cp -p $$d/$$file "$(distdir)/$$file" \
744 || exit 1; \
745 fi; \
746 done
747check-am: all-am
748check: check-am
749all-am: Makefile $(LTLIBRARIES) $(HEADERS)
750installdirs:
751 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
752 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
753 done
754install: install-am
755install-exec: install-exec-am
756install-data: install-data-am
757uninstall: uninstall-am
758
759install-am: all-am
760 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
761
762installcheck: installcheck-am
763install-strip:
764 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
765 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
766 `test -z '$(STRIP)' || \
767 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
768mostlyclean-generic:
769
770clean-generic:
771
772distclean-generic:
773 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
774 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
775
776maintainer-clean-generic:
777 @echo "This command is intended for maintainers to use"
778 @echo "it deletes files that may require special tools to rebuild."
779 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
780clean: clean-am
781
782clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
783 mostlyclean-am
784
785distclean: distclean-am
786 -rm -rf ./$(DEPDIR)
787 -rm -f Makefile
788distclean-am: clean-am distclean-compile distclean-generic \
789 distclean-tags
790
791dvi: dvi-am
792
793dvi-am:
794
795html: html-am
796
797html-am:
798
799info: info-am
800
801info-am:
802
803install-data-am: install-includesHEADERS
804
805install-dvi: install-dvi-am
806
807install-dvi-am:
808
809install-exec-am: install-libLTLIBRARIES
810
811install-html: install-html-am
812
813install-html-am:
814
815install-info: install-info-am
816
817install-info-am:
818
819install-man:
820
821install-pdf: install-pdf-am
822
823install-pdf-am:
824
825install-ps: install-ps-am
826
827install-ps-am:
828
829installcheck-am:
830
831maintainer-clean: maintainer-clean-am
832 -rm -rf ./$(DEPDIR)
833 -rm -f Makefile
834maintainer-clean-am: distclean-am maintainer-clean-generic
835
836mostlyclean: mostlyclean-am
837
838mostlyclean-am: mostlyclean-compile mostlyclean-generic \
839 mostlyclean-libtool
840
841pdf: pdf-am
842
843pdf-am:
844
845ps: ps-am
846
847ps-am:
848
849uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
850
851.MAKE: install-am install-strip
852
853.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
854 clean-libLTLIBRARIES clean-libtool ctags distclean \
855 distclean-compile distclean-generic distclean-libtool \
856 distclean-tags distdir dvi dvi-am html html-am info info-am \
857 install install-am install-data install-data-am install-dvi \
858 install-dvi-am install-exec install-exec-am install-html \
859 install-html-am install-includesHEADERS install-info \
860 install-info-am install-libLTLIBRARIES install-man install-pdf \
861 install-pdf-am install-ps install-ps-am install-strip \
862 installcheck installcheck-am installdirs maintainer-clean \
863 maintainer-clean-generic mostlyclean mostlyclean-compile \
864 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
865 tags uninstall uninstall-am uninstall-includesHEADERS \
866 uninstall-libLTLIBRARIES
867
868
869# Tell versions [3.59,3.63) of GNU make to not export all variables.
870# Otherwise a system limit (for SysV at least) may be exceeded.
871.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore/ecore.c b/libraries/ecore/src/lib/ecore/ecore.c
deleted file mode 100644
index d8b8723..0000000
--- a/libraries/ecore/src/lib/ecore/ecore.c
+++ /dev/null
@@ -1,753 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10#include <errno.h>
11
12#ifndef _MSC_VER
13# include <unistd.h>
14#endif
15
16#ifdef HAVE_LOCALE_H
17# include <locale.h>
18#endif
19
20#ifdef HAVE_LANGINFO_H
21# include <langinfo.h>
22#endif
23
24#ifdef HAVE_SYS_MMAN_H
25# include <sys/mman.h>
26#endif
27
28#ifdef HAVE_EVIL
29# include <Evil.h>
30#endif
31#include <Eina.h>
32
33#include "Ecore.h"
34#include "ecore_private.h"
35
36#if HAVE_MALLINFO
37#include <malloc.h>
38
39static Ecore_Version _version = { VERS_MAJ, VERS_MIN, VERS_MIC, VERS_REV };
40EAPI Ecore_Version *ecore_version = &_version;
41
42#define KEEP_MAX(Global, Local) \
43 if (Global < (Local)) \
44 Global = Local;
45
46static Eina_Bool _ecore_memory_statistic(void *data);
47static int _ecore_memory_max_total = 0;
48static int _ecore_memory_max_free = 0;
49static pid_t _ecore_memory_pid = 0;
50#endif
51
52static const char *_ecore_magic_string_get(Ecore_Magic m);
53static int _ecore_init_count = 0;
54int _ecore_log_dom = -1;
55int _ecore_fps_debug = 0;
56
57typedef struct _Ecore_Safe_Call Ecore_Safe_Call;
58struct _Ecore_Safe_Call
59{
60 union {
61 Ecore_Cb async;
62 Ecore_Data_Cb sync;
63 } cb;
64 void *data;
65
66 Eina_Lock m;
67 Eina_Condition c;
68
69 int current_id;
70
71 Eina_Bool sync : 1;
72 Eina_Bool suspend : 1;
73};
74
75static void _ecore_main_loop_thread_safe_call(Ecore_Safe_Call *order);
76static void _thread_safe_cleanup(void *data);
77static void _thread_callback(void *data,
78 void *buffer,
79 unsigned int nbyte);
80static Eina_List *_thread_cb = NULL;
81static Ecore_Pipe *_thread_call = NULL;
82static Eina_Lock _thread_safety;
83
84static int _thread_loop = 0;
85static Eina_Lock _thread_mutex;
86static Eina_Condition _thread_cond;
87static Eina_Lock _thread_feedback_mutex;
88static Eina_Condition _thread_feedback_cond;
89
90static Eina_Lock _thread_id_lock;
91static int _thread_id = -1;
92static int _thread_id_max = 0;
93static int _thread_id_update = 0;
94
95Eina_Lock _ecore_main_loop_lock;
96int _ecore_main_lock_count;
97
98/** OpenBSD does not define CODESET
99 * FIXME ??
100 */
101
102#ifndef CODESET
103# define CODESET "INVALID"
104#endif
105
106/**
107 * @addtogroup Ecore_Init_Group
108 *
109 * @{
110 */
111
112/**
113 * Set up connections, signal handlers, sockets etc.
114 * @return 1 or greater on success, 0 otherwise
115 *
116 * This function sets up all singal handlers and the basic event loop. If it
117 * succeeds, 1 will be returned, otherwise 0 will be returned.
118 *
119 * @code
120 * #include <Ecore.h>
121 *
122 * int main(int argc, char **argv)
123 * {
124 * if (!ecore_init())
125 * {
126 * printf("ERROR: Cannot init Ecore!\n");
127 * return -1;
128 * }
129 * ecore_main_loop_begin();
130 * ecore_shutdown();
131 * }
132 * @endcode
133 */
134EAPI int
135ecore_init(void)
136{
137 if (++_ecore_init_count != 1)
138 return _ecore_init_count;
139
140#ifdef HAVE_LOCALE_H
141 setlocale(LC_CTYPE, "");
142#endif
143 /*
144 if (strcmp(nl_langinfo(CODESET), "UTF-8"))
145 {
146 WRN("Not a utf8 locale!");
147 }
148 */
149#ifdef HAVE_EVIL
150 if (!evil_init())
151 return --_ecore_init_count;
152#endif
153 if (!eina_init())
154 goto shutdown_evil;
155 _ecore_log_dom = eina_log_domain_register("ecore", ECORE_DEFAULT_LOG_COLOR);
156 if (_ecore_log_dom < 0)
157 {
158 EINA_LOG_ERR("Ecore was unable to create a log domain.");
159 goto shutdown_log_dom;
160 }
161 if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
162 if (_ecore_fps_debug) _ecore_fps_debug_init();
163 if (!ecore_mempool_init()) goto shutdown_mempool;
164 _ecore_main_loop_init();
165 _ecore_signal_init();
166#ifndef HAVE_EXOTIC
167 _ecore_exe_init();
168#endif
169 _ecore_thread_init();
170 _ecore_glib_init();
171 _ecore_job_init();
172 _ecore_time_init();
173
174 eina_lock_new(&_thread_safety);
175 eina_lock_new(&_thread_mutex);
176 eina_condition_new(&_thread_cond, &_thread_mutex);
177 eina_lock_new(&_thread_feedback_mutex);
178 eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex);
179 _thread_call = ecore_pipe_add(_thread_callback, NULL);
180 eina_lock_new(&_thread_id_lock);
181
182 eina_lock_new(&_ecore_main_loop_lock);
183
184#if HAVE_MALLINFO
185 if (getenv("ECORE_MEM_STAT"))
186 {
187 _ecore_memory_pid = getpid();
188 ecore_animator_add(_ecore_memory_statistic, NULL);
189 }
190#endif
191
192#if defined(GLIB_INTEGRATION_ALWAYS)
193 if (_ecore_glib_always_integrate) ecore_main_loop_glib_integrate();
194#endif
195
196 return _ecore_init_count;
197
198shutdown_mempool:
199 ecore_mempool_shutdown();
200shutdown_log_dom:
201 eina_shutdown();
202shutdown_evil:
203#ifdef HAVE_EVIL
204 evil_shutdown();
205#endif
206 return --_ecore_init_count;
207}
208
209/**
210 * Shut down connections, signal handlers sockets etc.
211 *
212 * This function shuts down all things set up in ecore_init() and cleans up all
213 * event queues, handlers, filters, timers, idlers, idle enterers/exiters
214 * etc. set up after ecore_init() was called.
215 *
216 * Do not call this function from any callback that may be called from the main
217 * loop, as the main loop will then fall over and not function properly.
218 */
219EAPI int
220ecore_shutdown(void)
221{
222 /*
223 * take a lock here because _ecore_event_shutdown() does callbacks
224 */
225 _ecore_lock();
226 if (--_ecore_init_count != 0)
227 goto unlock;
228
229 /* this looks horrible - a hack for now, but something to note. as
230 * we delete the _thread_call pipe a thread COULD be doing
231 * ecore_pipe_write() or what not to it at the same time - we
232 * must ensure all possible users of this _thread_call are finished
233 * and exited before we delete it here */
234 /*
235 * ok - this causes other valgrind complaints regarding glib aquiring
236 * locks internally. so fix bug a or bug b. let's leave the original
237 * bug in then and leave this as a note for now
238 Ecore_Pipe *p;
239 p = _thread_call;
240 _thread_call = NULL;
241 ecore_pipe_wait(p, 1, 0.1);
242 ecore_pipe_del(p);
243 */
244 eina_lock_free(&_thread_safety);
245 eina_condition_free(&_thread_cond);
246 eina_lock_free(&_thread_mutex);
247 eina_condition_free(&_thread_feedback_cond);
248 eina_lock_free(&_thread_feedback_mutex);
249 eina_lock_free(&_thread_id_lock);
250
251 if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
252 _ecore_poller_shutdown();
253 _ecore_animator_shutdown();
254 _ecore_glib_shutdown();
255 _ecore_job_shutdown();
256 _ecore_thread_shutdown();
257#ifndef HAVE_EXOTIC
258 _ecore_exe_shutdown();
259#endif
260 _ecore_idle_enterer_shutdown();
261 _ecore_idle_exiter_shutdown();
262 _ecore_idler_shutdown();
263 _ecore_timer_shutdown();
264 _ecore_event_shutdown();
265 _ecore_main_shutdown();
266 _ecore_signal_shutdown();
267 _ecore_main_loop_shutdown();
268
269#if HAVE_MALLINFO
270 if (getenv("ECORE_MEM_STAT"))
271 {
272 _ecore_memory_statistic(NULL);
273
274 ERR("[%i] Memory MAX total: %i, free: %i",
275 _ecore_memory_pid,
276 _ecore_memory_max_total,
277 _ecore_memory_max_free);
278 }
279#endif
280 ecore_mempool_shutdown();
281 eina_log_domain_unregister(_ecore_log_dom);
282 _ecore_log_dom = -1;
283 eina_shutdown();
284#ifdef HAVE_EVIL
285 evil_shutdown();
286#endif
287unlock:
288 _ecore_unlock();
289
290 return _ecore_init_count;
291}
292
293/**
294 * @}
295 */
296
297static int wakeup = 42;
298
299EAPI void
300ecore_main_loop_thread_safe_call_async(Ecore_Cb callback,
301 void *data)
302{
303 Ecore_Safe_Call *order;
304
305 if (!callback) return;
306
307 if (eina_main_loop_is())
308 {
309 callback(data);
310 return;
311 }
312
313 order = malloc(sizeof (Ecore_Safe_Call));
314 if (!order) return;
315
316 order->cb.async = callback;
317 order->data = data;
318 order->sync = EINA_FALSE;
319 order->suspend = EINA_FALSE;
320
321 _ecore_main_loop_thread_safe_call(order);
322}
323
324EAPI void *
325ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback,
326 void *data)
327{
328 Ecore_Safe_Call *order;
329 void *ret;
330
331 if (!callback) return NULL;
332
333 if (eina_main_loop_is())
334 {
335 return callback(data);
336 }
337
338 order = malloc(sizeof (Ecore_Safe_Call));
339 if (!order) return NULL;
340
341 order->cb.sync = callback;
342 order->data = data;
343 eina_lock_new(&order->m);
344 eina_condition_new(&order->c, &order->m);
345 order->sync = EINA_TRUE;
346 order->suspend = EINA_FALSE;
347
348 _ecore_main_loop_thread_safe_call(order);
349
350 eina_lock_take(&order->m);
351 eina_condition_wait(&order->c);
352 eina_lock_release(&order->m);
353
354 ret = order->data;
355
356 order->sync = EINA_FALSE;
357 order->cb.async = _thread_safe_cleanup;
358 order->data = order;
359
360 _ecore_main_loop_thread_safe_call(order);
361
362 return ret;
363}
364
365EAPI int
366ecore_thread_main_loop_begin(void)
367{
368 Ecore_Safe_Call *order;
369
370 if (eina_main_loop_is())
371 {
372 return ++_thread_loop;
373 }
374
375 order = malloc(sizeof (Ecore_Safe_Call));
376 if (!order) return -1;
377
378 eina_lock_take(&_thread_id_lock);
379 order->current_id = ++_thread_id_max;
380 if (order->current_id < 0)
381 {
382 _thread_id_max = 0;
383 order->current_id = ++_thread_id_max;
384 }
385 eina_lock_release(&_thread_id_lock);
386
387 eina_lock_new(&order->m);
388 eina_condition_new(&order->c, &order->m);
389 order->suspend = EINA_TRUE;
390
391 _ecore_main_loop_thread_safe_call(order);
392
393 eina_lock_take(&order->m);
394 while (order->current_id != _thread_id)
395 eina_condition_wait(&order->c);
396 eina_lock_release(&order->m);
397
398 eina_main_loop_define();
399
400 _thread_loop = 1;
401
402 return EINA_TRUE;
403}
404
405EAPI int
406ecore_thread_main_loop_end(void)
407{
408 int current_id;
409
410 if (_thread_loop == 0)
411 {
412 ERR("the main loop is not locked ! No matching call to ecore_thread_main_loop_begin().");
413 return -1;
414 }
415
416 /* until we unlock the main loop, this thread has the main loop id */
417 if (!eina_main_loop_is())
418 {
419 ERR("Not in a locked thread !");
420 return -1;
421 }
422
423 _thread_loop--;
424 if (_thread_loop > 0)
425 return _thread_loop;
426
427 current_id = _thread_id;
428
429 eina_lock_take(&_thread_mutex);
430 _thread_id_update = _thread_id;
431 eina_condition_broadcast(&_thread_cond);
432 eina_lock_release(&_thread_mutex);
433
434 eina_lock_take(&_thread_feedback_mutex);
435 while (current_id == _thread_id && _thread_id != -1)
436 eina_condition_wait(&_thread_feedback_cond);
437 eina_lock_release(&_thread_feedback_mutex);
438
439 return 0;
440}
441
442EAPI void
443ecore_print_warning(const char *function,
444 const char *sparam)
445{
446 WRN("***** Developer Warning ***** :\n"
447 "\tThis program is calling:\n\n"
448 "\t%s();\n\n"
449 "\tWith the parameter:\n\n"
450 "\t%s\n\n"
451 "\tbeing NULL. Please fix your program.", function, sparam);
452 if (getenv("ECORE_ERROR_ABORT")) abort();
453}
454
455EAPI void
456_ecore_magic_fail(const void *d,
457 Ecore_Magic m,
458 Ecore_Magic req_m,
459 const char *fname)
460{
461 ERR("\n"
462 "*** ECORE ERROR: Ecore Magic Check Failed!!!\n"
463 "*** IN FUNCTION: %s()", fname);
464 if (!d)
465 ERR(" Input handle pointer is NULL!");
466 else if (m == ECORE_MAGIC_NONE)
467 ERR(" Input handle has already been freed!");
468 else if (m != req_m)
469 ERR(" Input handle is wrong type\n"
470 " Expected: %08x - %s\n"
471 " Supplied: %08x - %s",
472 (unsigned int)req_m, _ecore_magic_string_get(req_m),
473 (unsigned int)m, _ecore_magic_string_get(m));
474 ERR("*** NAUGHTY PROGRAMMER!!!\n"
475 "*** SPANK SPANK SPANK!!!\n"
476 "*** Now go fix your code. Tut tut tut!");
477 if (getenv("ECORE_ERROR_ABORT")) abort();
478}
479
480static const char *
481_ecore_magic_string_get(Ecore_Magic m)
482{
483 switch (m)
484 {
485 case ECORE_MAGIC_NONE:
486 return "None (Freed Object)";
487 break;
488
489 case ECORE_MAGIC_EXE:
490 return "Ecore_Exe (Executable)";
491 break;
492
493 case ECORE_MAGIC_TIMER:
494 return "Ecore_Timer (Timer)";
495 break;
496
497 case ECORE_MAGIC_IDLER:
498 return "Ecore_Idler (Idler)";
499 break;
500
501 case ECORE_MAGIC_IDLE_ENTERER:
502 return "Ecore_Idle_Enterer (Idler Enterer)";
503 break;
504
505 case ECORE_MAGIC_IDLE_EXITER:
506 return "Ecore_Idle_Exiter (Idler Exiter)";
507 break;
508
509 case ECORE_MAGIC_FD_HANDLER:
510 return "Ecore_Fd_Handler (Fd Handler)";
511 break;
512
513 case ECORE_MAGIC_WIN32_HANDLER:
514 return "Ecore_Win32_Handler (Win32 Handler)";
515 break;
516
517 case ECORE_MAGIC_EVENT_HANDLER:
518 return "Ecore_Event_Handler (Event Handler)";
519 break;
520
521 case ECORE_MAGIC_EVENT:
522 return "Ecore_Event (Event)";
523 break;
524
525 default:
526 return "<UNKNOWN>";
527 }
528}
529
530/* fps debug calls - for debugging how much time your app actually spends */
531/* "running" (and the inverse being time spent running)... this does not */
532/* account for other apps and multitasking... */
533
534static int _ecore_fps_debug_init_count = 0;
535static int _ecore_fps_debug_fd = -1;
536unsigned int *_ecore_fps_runtime_mmap = NULL;
537
538void
539_ecore_fps_debug_init(void)
540{
541 char buf[PATH_MAX];
542 const char *tmp;
543 int pid;
544
545 _ecore_fps_debug_init_count++;
546 if (_ecore_fps_debug_init_count > 1) return;
547
548#ifndef HAVE_EVIL
549 tmp = "/tmp";
550#else
551 tmp = evil_tmpdir_get ();
552#endif /* HAVE_EVIL */
553 pid = (int)getpid();
554 snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid);
555 _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
556 if (_ecore_fps_debug_fd < 0)
557 {
558 unlink(buf);
559 _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
560 }
561 if (_ecore_fps_debug_fd >= 0)
562 {
563 unsigned int zero = 0;
564 char *buf2 = (char *)&zero;
565 ssize_t todo = sizeof(unsigned int);
566
567 while (todo > 0)
568 {
569 ssize_t r = write(_ecore_fps_debug_fd, buf2, todo);
570 if (r > 0)
571 {
572 todo -= r;
573 buf2 += r;
574 }
575 else if ((r < 0) && (errno == EINTR))
576 continue;
577 else
578 {
579 ERR("could not write to file '%s' fd %d: %s",
580 tmp, _ecore_fps_debug_fd, strerror(errno));
581 close(_ecore_fps_debug_fd);
582 _ecore_fps_debug_fd = -1;
583 return;
584 }
585 }
586 _ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int),
587 PROT_READ | PROT_WRITE,
588 MAP_SHARED,
589 _ecore_fps_debug_fd, 0);
590 if (_ecore_fps_runtime_mmap == MAP_FAILED)
591 _ecore_fps_runtime_mmap = NULL;
592 }
593}
594
595void
596_ecore_fps_debug_shutdown(void)
597{
598 _ecore_fps_debug_init_count--;
599 if (_ecore_fps_debug_init_count > 0) return;
600 if (_ecore_fps_debug_fd >= 0)
601 {
602 char buf[4096];
603 const char *tmp;
604 int pid;
605
606#ifndef HAVE_EVIL
607 tmp = "/tmp";
608#else
609 tmp = (char *)evil_tmpdir_get ();
610#endif /* HAVE_EVIL */
611 pid = (int)getpid();
612 snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid);
613 unlink(buf);
614 if (_ecore_fps_runtime_mmap)
615 {
616 munmap(_ecore_fps_runtime_mmap, sizeof(int));
617 _ecore_fps_runtime_mmap = NULL;
618 }
619 close(_ecore_fps_debug_fd);
620 _ecore_fps_debug_fd = -1;
621 }
622}
623
624void
625_ecore_fps_debug_runtime_add(double t)
626{
627 if ((_ecore_fps_debug_fd >= 0) &&
628 (_ecore_fps_runtime_mmap))
629 {
630 unsigned int tm;
631
632 tm = (unsigned int)(t * 1000000.0);
633 /* i know its not 100% theoretically guaranteed, but i'd say a write */
634 /* of an int could be considered atomic for all practical purposes */
635 /* oh and since this is cumulative, 1 second = 1,000,000 ticks, so */
636 /* this can run for about 4294 seconds becore looping. if you are */
637 /* doing performance testing in one run for over an hour... well */
638 /* time to restart or handle a loop condition :) */
639 *(_ecore_fps_runtime_mmap) += tm;
640 }
641}
642
643#if HAVE_MALLINFO
644static Eina_Bool
645_ecore_memory_statistic(__UNUSED__ void *data)
646{
647 struct mallinfo mi;
648 static int uordblks = 0;
649 static int fordblks = 0;
650 Eina_Bool changed = EINA_FALSE;
651
652 mi = mallinfo();
653
654#define HAS_CHANGED(Global, Local) \
655 if (Global != Local) \
656 { \
657 Global = Local; \
658 changed = EINA_TRUE; \
659 }
660
661 HAS_CHANGED(uordblks, mi.uordblks);
662 HAS_CHANGED(fordblks, mi.fordblks);
663
664 if (changed)
665 ERR("[%i] Memory total: %i, free: %i",
666 _ecore_memory_pid,
667 mi.uordblks,
668 mi.fordblks);
669
670 KEEP_MAX(_ecore_memory_max_total, mi.uordblks);
671 KEEP_MAX(_ecore_memory_max_free, mi.fordblks);
672
673 return ECORE_CALLBACK_RENEW;
674}
675
676#endif
677
678static void
679_ecore_main_loop_thread_safe_call(Ecore_Safe_Call *order)
680{
681 Eina_Bool count;
682
683 eina_lock_take(&_thread_safety);
684
685 count = _thread_cb ? 0 : 1;
686 _thread_cb = eina_list_append(_thread_cb, order);
687 if (count) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
688
689 eina_lock_release(&_thread_safety);
690}
691
692static void
693_thread_safe_cleanup(void *data)
694{
695 Ecore_Safe_Call *call = data;
696
697 eina_condition_free(&call->c);
698 eina_lock_free(&call->m);
699}
700
701static void
702_thread_callback(void *data __UNUSED__,
703 void *buffer __UNUSED__,
704 unsigned int nbyte __UNUSED__)
705{
706 Ecore_Safe_Call *call;
707 Eina_List *callback;
708
709 eina_lock_take(&_thread_safety);
710 callback = _thread_cb;
711 _thread_cb = NULL;
712 eina_lock_release(&_thread_safety);
713
714 EINA_LIST_FREE(callback, call)
715 {
716 if (call->suspend)
717 {
718 eina_lock_take(&_thread_mutex);
719
720 eina_lock_take(&call->m);
721 _thread_id = call->current_id;
722 eina_condition_broadcast(&call->c);
723 eina_lock_release(&call->m);
724
725 while (_thread_id_update != _thread_id)
726 eina_condition_wait(&_thread_cond);
727 eina_lock_release(&_thread_mutex);
728
729 eina_main_loop_define();
730
731 eina_lock_take(&_thread_feedback_mutex);
732
733 _thread_id = -1;
734
735 eina_condition_broadcast(&_thread_feedback_cond);
736 eina_lock_release(&_thread_feedback_mutex);
737
738 _thread_safe_cleanup(call);
739 free(call);
740 }
741 else if (call->sync)
742 {
743 call->data = call->cb.sync(call->data);
744 eina_condition_broadcast(&call->c);
745 }
746 else
747 {
748 call->cb.async(call->data);
749 free(call);
750 }
751 }
752}
753
diff --git a/libraries/ecore/src/lib/ecore/ecore_alloc.c b/libraries/ecore/src/lib/ecore/ecore_alloc.c
deleted file mode 100644
index 412c383..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_alloc.c
+++ /dev/null
@@ -1,132 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdlib.h>
6
7#include <Eina.h>
8
9#include "Ecore.h"
10#include "ecore_private.h"
11
12typedef struct _Ecore_Mempool Ecore_Mempool;
13struct _Ecore_Mempool
14{
15 const char *name;
16 Eina_Mempool *mp;
17 size_t size;
18};
19
20#define GENERIC_ALLOC_FREE(TYPE, Type) \
21 extern size_t _ecore_sizeof_##TYPE; \
22 Ecore_Mempool Type##_mp = { #TYPE, NULL, 0 }; \
23 TYPE * \
24 Type##_calloc(unsigned int num) \
25 { \
26 return eina_mempool_calloc(Type##_mp.mp, \
27 num * _ecore_sizeof_##TYPE); \
28 } \
29 void \
30 Type##_mp_free(TYPE *e) \
31 { \
32 eina_mempool_free(Type##_mp.mp, e); \
33 }
34
35GENERIC_ALLOC_FREE(Ecore_Animator, ecore_animator);
36GENERIC_ALLOC_FREE(Ecore_Event_Handler, ecore_event_handler);
37GENERIC_ALLOC_FREE(Ecore_Event_Filter, ecore_event_filter);
38GENERIC_ALLOC_FREE(Ecore_Event, ecore_event);
39GENERIC_ALLOC_FREE(Ecore_Idle_Exiter, ecore_idle_exiter);
40GENERIC_ALLOC_FREE(Ecore_Idle_Enterer, ecore_idle_enterer);
41GENERIC_ALLOC_FREE(Ecore_Idler, ecore_idler);
42GENERIC_ALLOC_FREE(Ecore_Job, ecore_job);
43GENERIC_ALLOC_FREE(Ecore_Timer, ecore_timer);
44GENERIC_ALLOC_FREE(Ecore_Poller, ecore_poller);
45GENERIC_ALLOC_FREE(Ecore_Pipe, ecore_pipe);
46GENERIC_ALLOC_FREE(Ecore_Fd_Handler, ecore_fd_handler);
47#ifdef _WIN32
48GENERIC_ALLOC_FREE(Ecore_Win32_Handler, ecore_win32_handler);
49#endif
50
51static Ecore_Mempool *mempool_array[] = {
52 &ecore_animator_mp,
53 &ecore_event_handler_mp,
54 &ecore_event_filter_mp,
55 &ecore_event_mp,
56 &ecore_idle_exiter_mp,
57 &ecore_idle_enterer_mp,
58 &ecore_idler_mp,
59 &ecore_job_mp,
60 &ecore_timer_mp,
61 &ecore_poller_mp,
62 &ecore_pipe_mp,
63 &ecore_fd_handler_mp,
64#ifdef _WIN32
65 &ecore_win32_handler_mp
66#endif
67};
68
69Eina_Bool
70ecore_mempool_init(void)
71{
72 const char *choice;
73 unsigned int i;
74
75#define MP_SIZE_INIT(TYPE, Type) \
76 Type##_mp.size = _ecore_sizeof_##TYPE
77
78 MP_SIZE_INIT(Ecore_Animator, ecore_animator);
79 MP_SIZE_INIT(Ecore_Event_Handler, ecore_event_handler);
80 MP_SIZE_INIT(Ecore_Event_Filter, ecore_event_filter);
81 MP_SIZE_INIT(Ecore_Event, ecore_event);
82 MP_SIZE_INIT(Ecore_Idle_Exiter, ecore_idle_exiter);
83 MP_SIZE_INIT(Ecore_Idle_Enterer, ecore_idle_enterer);
84 MP_SIZE_INIT(Ecore_Idler, ecore_idler);
85 MP_SIZE_INIT(Ecore_Job, ecore_job);
86 MP_SIZE_INIT(Ecore_Timer, ecore_timer);
87 MP_SIZE_INIT(Ecore_Poller, ecore_poller);
88 MP_SIZE_INIT(Ecore_Pipe, ecore_pipe);
89 MP_SIZE_INIT(Ecore_Fd_Handler, ecore_fd_handler);
90#ifdef _WIN32
91 MP_SIZE_INIT(Ecore_Win32_Handler, ecore_win32_handler);
92#endif
93#undef MP_SIZE_INIT
94
95 choice = getenv("EINA_MEMPOOL");
96 if ((!choice) || (!choice[0]))
97 choice = "chained_mempool";
98
99 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
100 {
101 retry:
102 mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
103 if (!mempool_array[i]->mp)
104 {
105 if (!strcmp(choice, "pass_through"))
106 {
107 ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice);
108 choice = "pass_through";
109 goto retry;
110 }
111 else
112 {
113 ERR("Impossible to allocate mempool '%s' !", choice);
114 return EINA_FALSE;
115 }
116 }
117 }
118 return EINA_TRUE;
119}
120
121void
122ecore_mempool_shutdown(void)
123{
124 unsigned int i;
125
126 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
127 {
128 eina_mempool_del(mempool_array[i]->mp);
129 mempool_array[i]->mp = NULL;
130 }
131}
132
diff --git a/libraries/ecore/src/lib/ecore/ecore_anim.c b/libraries/ecore/src/lib/ecore/ecore_anim.c
deleted file mode 100644
index 22c1f8c..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_anim.c
+++ /dev/null
@@ -1,490 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <math.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10
11struct _Ecore_Animator
12{
13 EINA_INLIST;
14 ECORE_MAGIC;
15
16 Ecore_Task_Cb func;
17 void *data;
18
19 double start, run;
20 Ecore_Timeline_Cb run_func;
21 void *run_data;
22
23 Eina_Bool delete_me : 1;
24 Eina_Bool suspended : 1;
25 Eina_Bool just_added : 1;
26};
27
28GENERIC_ALLOC_SIZE_DECLARE(Ecore_Animator);
29
30static Eina_Bool _ecore_animator_run(void *data);
31static Eina_Bool _ecore_animator(void *data);
32
33static int animators_delete_me = 0;
34static Ecore_Animator *animators = NULL;
35static double animators_frametime = 1.0 / 30.0;
36
37static Ecore_Animator_Source src = ECORE_ANIMATOR_SOURCE_TIMER;
38static Ecore_Timer *timer = NULL;
39static int ticking = 0;
40static Ecore_Cb begin_tick_cb = NULL;
41static const void *begin_tick_data = NULL;
42static Ecore_Cb end_tick_cb = NULL;
43static const void *end_tick_data = NULL;
44
45static void
46_begin_tick(void)
47{
48 if (ticking) return;
49 ticking = 1;
50 switch (src)
51 {
52 case ECORE_ANIMATOR_SOURCE_TIMER:
53 if (!timer)
54 {
55 double t_loop = ecore_loop_time_get();
56 double sync_0 = 0.0;
57 double d = -fmod(t_loop - sync_0, animators_frametime);
58
59 timer = _ecore_timer_loop_add(animators_frametime,
60 _ecore_animator, NULL);
61 _ecore_timer_delay(timer, d);
62 }
63 break;
64
65 case ECORE_ANIMATOR_SOURCE_CUSTOM:
66 if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data);
67 break;
68
69 default:
70 break;
71 }
72}
73
74static void
75_end_tick(void)
76{
77 if (!ticking) return;
78 ticking = 0;
79 switch (src)
80 {
81 case ECORE_ANIMATOR_SOURCE_TIMER:
82 if (timer)
83 {
84 _ecore_timer_del(timer);
85 timer = NULL;
86 }
87 break;
88
89 case ECORE_ANIMATOR_SOURCE_CUSTOM:
90 if (end_tick_cb) end_tick_cb((void *)end_tick_data);
91 break;
92
93 default:
94 break;
95 }
96}
97
98static Eina_Bool
99_do_tick(void)
100{
101 Ecore_Animator *animator;
102
103 EINA_INLIST_FOREACH(animators, animator)
104 {
105 animator->just_added = EINA_FALSE;
106 }
107 EINA_INLIST_FOREACH(animators, animator)
108 {
109 if ((!animator->delete_me) &&
110 (!animator->suspended) &&
111 (!animator->just_added))
112 {
113 if (!_ecore_call_task_cb(animator->func, animator->data))
114 {
115 animator->delete_me = EINA_TRUE;
116 animators_delete_me++;
117 }
118 }
119 else animator->just_added = EINA_FALSE;
120 }
121 if (animators_delete_me)
122 {
123 Ecore_Animator *l;
124 for (l = animators; l; )
125 {
126 animator = l;
127 l = (Ecore_Animator *)EINA_INLIST_GET(l)->next;
128 if (animator->delete_me)
129 {
130 animators = (Ecore_Animator *)
131 eina_inlist_remove(EINA_INLIST_GET(animators),
132 EINA_INLIST_GET(animator));
133 ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
134 ecore_animator_mp_free(animator);
135 animators_delete_me--;
136 if (animators_delete_me == 0) break;
137 }
138 }
139 }
140 if (!animators)
141 {
142 _end_tick();
143 return ECORE_CALLBACK_CANCEL;
144 }
145 return ECORE_CALLBACK_RENEW;
146}
147
148static Ecore_Animator *
149_ecore_animator_add(Ecore_Task_Cb func,
150 const void *data)
151{
152 Ecore_Animator *animator = NULL;
153
154 if (!func) return animator;
155 animator = ecore_animator_calloc(1);
156 if (!animator) return animator;
157 ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR);
158 animator->func = func;
159 animator->data = (void *)data;
160 animator->just_added = EINA_TRUE;
161 animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
162 _begin_tick();
163 return animator;
164}
165
166EAPI Ecore_Animator *
167ecore_animator_add(Ecore_Task_Cb func,
168 const void *data)
169{
170 Ecore_Animator *animator;
171
172 _ecore_lock();
173 animator = _ecore_animator_add(func, data);
174 _ecore_unlock();
175
176 return animator;
177}
178
179EAPI Ecore_Animator *
180ecore_animator_timeline_add(double runtime,
181 Ecore_Timeline_Cb func,
182 const void *data)
183{
184 Ecore_Animator *animator;
185
186 _ecore_lock();
187 if (runtime <= 0.0) runtime = 0.0;
188 animator = _ecore_animator_add(_ecore_animator_run, NULL);
189 animator->data = animator;
190 animator->run_func = func;
191 animator->run_data = (void *)data;
192 animator->start = ecore_loop_time_get();
193 animator->run = runtime;
194 _ecore_unlock();
195 return animator;
196}
197
198static double
199_pos_map_sin(double in)
200{
201 return eina_f32p32_double_to(eina_f32p32_sin(eina_f32p32_double_from(in)));
202}
203
204static double
205_pos_map_cos(double in)
206{
207 return eina_f32p32_double_to(eina_f32p32_cos(eina_f32p32_double_from(in)));
208}
209
210static double
211_pos_map_accel_factor(double pos,
212 double v1)
213{
214 int i, fact = (int)v1;
215 double p, o1 = pos, o2 = pos, v;
216 p = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0));
217 o2 = p;
218 for (i = 0; i < fact; i++)
219 {
220 o1 = o2;
221 o2 = o2 * p;
222 }
223 v = v1 - (double)fact;
224 pos = (v * o2) + ((1.0 - v) * o1);
225 return pos;
226}
227
228static double
229_pos_map_pow(double pos,
230 double divis,
231 int p)
232{
233 double v = 1.0;
234 int i;
235 for (i = 0; i < p; i++) v *= pos;
236 return ((pos * divis) * (1.0 - v)) + (pos * v);
237}
238
239static double
240_pos_map_spring(double pos,
241 int bounces,
242 double decfac)
243{
244 int segnum, segpos, b1, b2;
245 double len, decay, decpos, p2;
246 if (bounces < 0) bounces = 0;
247 p2 = _pos_map_pow(pos, 0.5, 3);
248 len = (M_PI / 2.0) + ((double)bounces * M_PI);
249 segnum = (bounces * 2) + 1;
250 segpos = 2 * (((int)(p2 * segnum) + 1) / 2);
251 b1 = segpos;
252 b2 = segnum + 1;
253 if (b1 < 0) b1 = 0;
254 decpos = (double)b1 / (double)b2;
255 decay = _pos_map_accel_factor(1.0 - decpos, decfac);
256 return _pos_map_sin((M_PI / 2.0) + (p2 * len)) * decay;
257}
258
259EAPI double
260ecore_animator_pos_map(double pos,
261 Ecore_Pos_Map map,
262 double v1,
263 double v2)
264{
265 /* purely functional - locking not required */
266 if (pos > 1.0) pos = 1.0;
267 else if (pos < 0.0)
268 pos = 0.0;
269 switch (map)
270 {
271 case ECORE_POS_MAP_LINEAR:
272 return pos;
273
274 case ECORE_POS_MAP_ACCELERATE:
275 pos = 1.0 - _pos_map_sin(M_PI_2 + pos * M_PI_2);
276 return pos;
277
278 case ECORE_POS_MAP_DECELERATE:
279 pos = _pos_map_sin(pos * M_PI_2);
280 return pos;
281
282 case ECORE_POS_MAP_SINUSOIDAL:
283 pos = (1.0 - _pos_map_cos(pos * M_PI)) / 2.0;
284 return pos;
285
286 case ECORE_POS_MAP_ACCELERATE_FACTOR:
287 pos = _pos_map_accel_factor(pos, v1);
288 return pos;
289
290 case ECORE_POS_MAP_DECELERATE_FACTOR:
291 pos = 1.0 - _pos_map_accel_factor(1.0 - pos, v1);
292 return pos;
293
294 case ECORE_POS_MAP_SINUSOIDAL_FACTOR:
295 if (pos < 0.5) pos = _pos_map_accel_factor(pos * 2.0, v1) / 2.0;
296 else pos = 1.0 - (_pos_map_accel_factor((1.0 - pos) * 2.0, v1) / 2.0);
297 return pos;
298
299 case ECORE_POS_MAP_DIVISOR_INTERP:
300 pos = _pos_map_pow(pos, v1, (int)v2);
301 return pos;
302
303 case ECORE_POS_MAP_BOUNCE:
304 pos = _pos_map_spring(pos, (int)v2, v1);
305 if (pos < 0.0) pos = -pos;
306 pos = 1.0 - pos;
307 return pos;
308
309 case ECORE_POS_MAP_SPRING:
310 pos = 1.0 - _pos_map_spring(pos, (int)v2, v1);
311 return pos;
312
313 default:
314 return pos;
315 }
316 return pos;
317}
318
319EAPI void *
320ecore_animator_del(Ecore_Animator *animator)
321{
322 void *data = NULL;
323
324 _ecore_lock();
325 if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
326 {
327 ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
328 "ecore_animator_del");
329 goto unlock;
330 }
331 if (animator->delete_me)
332 {
333 data = animator->data;
334 goto unlock;
335 }
336 animator->delete_me = EINA_TRUE;
337 animators_delete_me++;
338 if (animator->run_func)
339 data = animator->run_data;
340 else
341 data = animator->data;
342unlock:
343 _ecore_unlock();
344 return data;
345}
346
347EAPI void
348ecore_animator_frametime_set(double frametime)
349{
350 _ecore_lock();
351 if (frametime < 0.0) frametime = 0.0;
352 if (animators_frametime == frametime) goto unlock;
353 animators_frametime = frametime;
354 _end_tick();
355 if (animators) _begin_tick();
356unlock:
357 _ecore_unlock();
358}
359
360EAPI double
361ecore_animator_frametime_get(void)
362{
363 return animators_frametime;
364}
365
366EAPI void
367ecore_animator_freeze(Ecore_Animator *animator)
368{
369 _ecore_lock();
370 if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
371 {
372 ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
373 "ecore_animator_del");
374 goto unlock;
375 }
376 if (animator->delete_me) goto unlock;
377 animator->suspended = EINA_TRUE;
378unlock:
379 _ecore_unlock();
380}
381
382EAPI void
383ecore_animator_thaw(Ecore_Animator *animator)
384{
385 _ecore_lock();
386 if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
387 {
388 ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
389 "ecore_animator_del");
390 goto unlock;
391 }
392 if (animator->delete_me) goto unlock;
393 animator->suspended = EINA_FALSE;
394unlock:
395 _ecore_unlock();
396}
397
398EAPI void
399ecore_animator_source_set(Ecore_Animator_Source source)
400{
401 _ecore_lock();
402 src = source;
403 _end_tick();
404 if (animators) _begin_tick();
405 _ecore_unlock();
406}
407
408EAPI Ecore_Animator_Source
409ecore_animator_source_get(void)
410{
411 return src;
412}
413
414EAPI void
415ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func,
416 const void *data)
417{
418 _ecore_lock();
419 begin_tick_cb = func;
420 begin_tick_data = data;
421 _end_tick();
422 if (animators) _begin_tick();
423 _ecore_unlock();
424}
425
426EAPI void
427ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func,
428 const void *data)
429{
430 _ecore_lock();
431 end_tick_cb = func;
432 end_tick_data = data;
433 _end_tick();
434 if (animators) _begin_tick();
435 _ecore_unlock();
436}
437
438EAPI void
439ecore_animator_custom_tick(void)
440{
441 _ecore_lock();
442 if (src == ECORE_ANIMATOR_SOURCE_CUSTOM) _do_tick();
443 _ecore_unlock();
444}
445
446void
447_ecore_animator_shutdown(void)
448{
449 _end_tick();
450 while (animators)
451 {
452 Ecore_Animator *animator;
453
454 animator = animators;
455 animators = (Ecore_Animator *)eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
456 ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
457 ecore_animator_mp_free(animator);
458 }
459}
460
461static Eina_Bool
462_ecore_animator_run(void *data)
463{
464 Ecore_Animator *animator = data;
465 double pos = 0.0, t;
466 Eina_Bool run_ret;
467
468 t = ecore_loop_time_get();
469 if (animator->run > 0.0)
470 {
471 pos = (t - animator->start) / animator->run;
472 if (pos > 1.0) pos = 1.0;
473 else if (pos < 0.0)
474 pos = 0.0;
475 }
476 run_ret = animator->run_func(animator->run_data, pos);
477 if (t >= (animator->start + animator->run)) run_ret = EINA_FALSE;
478 return run_ret;
479}
480
481static Eina_Bool
482_ecore_animator(void *data __UNUSED__)
483{
484 Eina_Bool r;
485 _ecore_lock();
486 r = _do_tick();
487 _ecore_unlock();
488 return r;
489}
490
diff --git a/libraries/ecore/src/lib/ecore/ecore_app.c b/libraries/ecore/src/lib/ecore/ecore_app.c
deleted file mode 100644
index 5e4bf02..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_app.c
+++ /dev/null
@@ -1,95 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#ifndef _MSC_VER
8# include <unistd.h>
9#else
10# include <process.h>
11#endif
12
13#ifdef HAVE_EVIL
14# include <Evil.h>
15#endif
16
17#include "Ecore.h"
18#include "ecore_private.h"
19
20static int app_argc = 0;
21static char **app_argv = NULL;
22
23/**
24 * @addtogroup Ecore_Application_Group
25 *
26 * @{
27 */
28
29/**
30 * Set up the programs command-line arguments.
31 * @param argc The same as passed as argc to the programs main() function
32 * @param argv The same as passed as argv to the programs main() function
33 *
34 * A call to this function will store the programs command-line arguments
35 * for later use by ecore_app_restart() or ecore_app_args_get().
36 */
37EAPI void
38ecore_app_args_set(int argc,
39 const char **argv)
40{
41 EINA_MAIN_LOOP_CHECK_RETURN;
42
43 if ((argc < 1) ||
44 (!argv)) return;
45 app_argc = argc;
46 app_argv = (char **)argv;
47}
48
49/**
50 * Return the programs stored command-line arguments.
51 * @param argc A pointer to the return value to hold argc
52 * @param argv A pointer to the return value to hold argv
53 *
54 * When called, this funciton returns the arguments for the program stored by
55 * ecore_app_args_set(). The integer pointed to by @p argc will be filled, if
56 * the pointer is not NULL, and the string array pointer @p argv will be filled
57 * also if the pointer is not NULL. The values they are filled with will be the
58 * same set by ecore_app_args_set().
59 */
60EAPI void
61ecore_app_args_get(int *argc,
62 char ***argv)
63{
64 EINA_MAIN_LOOP_CHECK_RETURN;
65
66 if (argc) *argc = app_argc;
67 if (argv) *argv = app_argv;
68}
69
70/**
71 * Restart the program executable with the command-line arguments stored.
72 *
73 * This function will restart & re-execute this program in place of itself
74 * using the command-line arguments stored by ecore_app_args_set(). This is
75 * an easy way for a program to restart itself for cleanup purposes,
76 * configuration reasons or in the event of a crash.
77 */
78EAPI void
79ecore_app_restart(void)
80{
81#ifdef HAVE_EXECVP
82 char *args[4096];
83 int i;
84
85 if ((app_argc < 1) || (!app_argv)) return;
86 if (app_argc >= 4096) return;
87 for (i = 0; i < app_argc; i++) args[i] = app_argv[i];
88 args[i] = NULL;
89 execvp(app_argv[0], args);
90#endif
91}
92
93/**
94 * @}
95 */
diff --git a/libraries/ecore/src/lib/ecore/ecore_events.c b/libraries/ecore/src/lib/ecore/ecore_events.c
deleted file mode 100644
index 500cf74..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_events.c
+++ /dev/null
@@ -1,637 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9
10static int inpurge = 0;
11
12struct _Ecore_Event_Handler
13{
14 EINA_INLIST;
15 ECORE_MAGIC;
16 int type;
17 Ecore_Event_Handler_Cb func;
18 void *data;
19 int references;
20 Eina_Bool delete_me : 1;
21};
22GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Handler);
23
24struct _Ecore_Event_Filter
25{
26 EINA_INLIST;
27 ECORE_MAGIC;
28 Ecore_Data_Cb func_start;
29 Ecore_Filter_Cb func_filter;
30 Ecore_End_Cb func_end;
31 void *loop_data;
32 void *data;
33 int references;
34 Eina_Bool delete_me : 1;
35};
36GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Filter);
37
38struct _Ecore_Event
39{
40 EINA_INLIST;
41 ECORE_MAGIC;
42 int type;
43 void *event;
44 Ecore_End_Cb func_free;
45 void *data;
46 int references;
47 Eina_Bool delete_me : 1;
48};
49GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event);
50
51static int events_num = 0;
52static Ecore_Event *events = NULL;
53static Ecore_Event *event_current = NULL;
54static Ecore_Event *purge_events = NULL;
55
56static Ecore_Event_Handler **event_handlers = NULL;
57static Ecore_Event_Handler *event_handler_current = NULL;
58static int event_handlers_num = 0;
59static int event_handlers_alloc_num = 0;
60static Eina_List *event_handlers_delete_list = NULL;
61
62static Ecore_Event_Handler *event_handlers_add_list = NULL;
63
64static Ecore_Event_Filter *event_filters = NULL;
65static Ecore_Event_Filter *event_filter_current = NULL;
66static Ecore_Event *event_filter_event_current = NULL;
67static int event_filters_delete_me = 0;
68static int event_id_max = ECORE_EVENT_COUNT;
69static int ecore_raw_event_type = ECORE_EVENT_NONE;
70static void *ecore_raw_event_event = NULL;
71
72static void _ecore_event_purge_deleted(void);
73static void *_ecore_event_del(Ecore_Event *event);
74
75EAPI Ecore_Event_Handler *
76ecore_event_handler_add(int type,
77 Ecore_Event_Handler_Cb func,
78 const void *data)
79{
80 Ecore_Event_Handler *eh = NULL;
81
82 _ecore_lock();
83
84 if (!func) goto unlock;
85 if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) goto unlock;
86 eh = ecore_event_handler_calloc(1);
87 if (!eh) goto unlock;
88 ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER);
89 eh->type = type;
90 eh->func = func;
91 eh->data = (void *)data;
92 if (type >= (event_handlers_num - 1))
93 {
94 int p_alloc_num;
95
96 p_alloc_num = event_handlers_alloc_num;
97 event_handlers_num = type + 1;
98 if (event_handlers_num > event_handlers_alloc_num)
99 {
100 Ecore_Event_Handler **new_handlers;
101 int i;
102
103 event_handlers_alloc_num = ((event_handlers_num + 16) / 16) * 16;
104 new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *));
105 if (!new_handlers)
106 {
107 ecore_event_handler_mp_free(eh);
108 goto unlock;
109 }
110 event_handlers = new_handlers;
111 for (i = p_alloc_num; i < event_handlers_alloc_num; i++)
112 event_handlers[i] = NULL;
113 }
114 }
115 if (ecore_raw_event_type == type)
116 event_handlers_add_list = (Ecore_Event_Handler *)eina_inlist_append(EINA_INLIST_GET(event_handlers_add_list), EINA_INLIST_GET(eh));
117 else if (type < event_handlers_alloc_num)
118 event_handlers[type] = (Ecore_Event_Handler *)eina_inlist_append(EINA_INLIST_GET(event_handlers[type]), EINA_INLIST_GET(eh));
119
120unlock:
121 _ecore_unlock();
122 return eh;
123}
124
125EAPI void *
126ecore_event_handler_del(Ecore_Event_Handler *event_handler)
127{
128 void *data = NULL;
129
130 _ecore_lock();
131 if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER))
132 {
133 ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
134 "ecore_event_handler_del");
135 goto unlock;
136 }
137 data = _ecore_event_handler_del(event_handler);
138unlock:
139 _ecore_unlock();
140
141 return data;
142}
143
144EAPI void *
145ecore_event_handler_data_get(Ecore_Event_Handler *eh)
146{
147 void *data = NULL;
148
149 _ecore_lock();
150 if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER))
151 {
152 ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_get");
153 goto unlock;
154 }
155 data = eh->data;
156unlock:
157 _ecore_unlock();
158 return data;
159}
160
161EAPI void *
162ecore_event_handler_data_set(Ecore_Event_Handler *eh,
163 const void *data)
164{
165 void *old = NULL;
166
167 _ecore_lock();
168 if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER))
169 {
170 ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_set");
171 goto unlock;
172 }
173 old = eh->data;
174 eh->data = (void *)data;
175unlock:
176 _ecore_unlock();
177
178 return old;
179}
180
181static void
182_ecore_event_generic_free(void *data __UNUSED__,
183 void *event)
184{ /* DO NOT MEMPOOL FREE THIS */
185 free(event);
186}
187
188EAPI Ecore_Event *
189ecore_event_add(int type,
190 void *ev,
191 Ecore_End_Cb func_free,
192 void *data)
193{
194 Ecore_Event *event = NULL;
195
196 _ecore_lock();
197
198/* if (!ev) goto unlock; */
199 if (type <= ECORE_EVENT_NONE) goto unlock;
200 if (type >= event_id_max) goto unlock;
201 if ((ev) && (!func_free)) func_free = _ecore_event_generic_free;
202 event = _ecore_event_add(type, ev, func_free, data);
203unlock:
204 _ecore_unlock();
205 return event;
206}
207
208EAPI void *
209ecore_event_del(Ecore_Event *event)
210{
211 void *data = NULL;
212
213 _ecore_lock();
214 if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT))
215 {
216 ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
217 goto unlock;
218 }
219 EINA_SAFETY_ON_TRUE_GOTO(event->delete_me, unlock);
220 event->delete_me = 1;
221 data = event->data;
222unlock:
223 _ecore_unlock();
224 return data;
225}
226
227EAPI int
228ecore_event_type_new(void)
229{
230 int id;
231
232 _ecore_lock();
233 id = event_id_max++;
234 _ecore_unlock();
235
236 return id;
237}
238
239EAPI Ecore_Event_Filter *
240ecore_event_filter_add(Ecore_Data_Cb func_start,
241 Ecore_Filter_Cb func_filter,
242 Ecore_End_Cb func_end,
243 const void *data)
244{
245 Ecore_Event_Filter *ef = NULL;
246
247 _ecore_lock();
248 if (!func_filter) goto unlock;
249 ef = ecore_event_filter_calloc(1);
250 if (!ef) goto unlock;
251 ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER);
252 ef->func_start = func_start;
253 ef->func_filter = func_filter;
254 ef->func_end = func_end;
255 ef->data = (void *)data;
256 event_filters = (Ecore_Event_Filter *)eina_inlist_append(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
257unlock:
258 _ecore_unlock();
259 return ef;
260}
261
262EAPI void *
263ecore_event_filter_del(Ecore_Event_Filter *ef)
264{
265 void *data = NULL;
266
267 _ecore_lock();
268 if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER))
269 {
270 ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del");
271 goto unlock;
272 }
273 EINA_SAFETY_ON_TRUE_GOTO(ef->delete_me, unlock);
274 ef->delete_me = 1;
275 event_filters_delete_me = 1;
276 data = ef->data;
277unlock:
278 _ecore_unlock();
279
280 return data;
281}
282
283EAPI int
284ecore_event_current_type_get(void)
285{
286 return ecore_raw_event_type;
287}
288
289EAPI void *
290ecore_event_current_event_get(void)
291{
292 return ecore_raw_event_event;
293}
294
295EAPI void *
296_ecore_event_handler_del(Ecore_Event_Handler *event_handler)
297{
298 EINA_SAFETY_ON_TRUE_RETURN_VAL(event_handler->delete_me, NULL);
299 event_handler->delete_me = 1;
300 event_handlers_delete_list = eina_list_append(event_handlers_delete_list, event_handler);
301 return event_handler->data;
302}
303
304void
305_ecore_event_shutdown(void)
306{
307 int i;
308 Ecore_Event_Handler *eh;
309 Ecore_Event_Filter *ef;
310
311 while (events) _ecore_event_del(events);
312 event_current = NULL;
313 for (i = 0; i < event_handlers_num; i++)
314 {
315 while ((eh = event_handlers[i]))
316 {
317 event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
318 ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
319 if (!eh->delete_me) ecore_event_handler_mp_free(eh);
320 }
321 }
322 EINA_LIST_FREE(event_handlers_delete_list, eh)
323 ecore_event_handler_mp_free(eh);
324 if (event_handlers) free(event_handlers);
325 event_handlers = NULL;
326 event_handlers_num = 0;
327 event_handlers_alloc_num = 0;
328 while ((ef = event_filters))
329 {
330 event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
331 ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
332 ecore_event_filter_mp_free(ef);
333 }
334 event_filters_delete_me = 0;
335 event_filter_current = NULL;
336 event_filter_event_current = NULL;
337}
338
339int
340_ecore_event_exist(void)
341{
342 Ecore_Event *e;
343 EINA_INLIST_FOREACH(events, e)
344 if (!e->delete_me) return 1;
345 return 0;
346}
347
348Ecore_Event *
349_ecore_event_add(int type,
350 void *ev,
351 Ecore_End_Cb func_free,
352 void *data)
353{
354 Ecore_Event *e;
355
356 e = ecore_event_calloc(1);
357 if (!e) return NULL;
358 ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT);
359 e->type = type;
360 e->event = ev;
361 e->func_free = func_free;
362 e->data = data;
363 if (inpurge > 0)
364 {
365 purge_events = (Ecore_Event *)eina_inlist_append(EINA_INLIST_GET(purge_events), EINA_INLIST_GET(e));
366 events_num++;
367 }
368 else
369 {
370 events = (Ecore_Event *)eina_inlist_append(EINA_INLIST_GET(events), EINA_INLIST_GET(e));
371 events_num++;
372 }
373 return e;
374}
375
376void *
377_ecore_event_del(Ecore_Event *event)
378{
379 void *data;
380
381 data = event->data;
382 if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event);
383 events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event));
384 ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE);
385 ecore_event_mp_free(event);
386 events_num--;
387 return data;
388}
389
390static void
391_ecore_event_purge_deleted(void)
392{
393 Ecore_Event *itr = events;
394
395 inpurge++;
396 while (itr)
397 {
398 Ecore_Event *next = (Ecore_Event *)EINA_INLIST_GET(itr)->next;
399 if ((!itr->references) && (itr->delete_me))
400 _ecore_event_del(itr);
401 itr = next;
402 }
403 inpurge--;
404 while (purge_events)
405 {
406 Ecore_Event *e = purge_events;
407 purge_events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(purge_events), EINA_INLIST_GET(purge_events));
408 events = (Ecore_Event *)eina_inlist_append(EINA_INLIST_GET(events), EINA_INLIST_GET(e));
409 }
410}
411
412static inline void
413_ecore_event_filters_apply()
414{
415 if (!event_filter_current)
416 {
417 /* regular main loop, start from head */
418 event_filter_current = event_filters;
419 }
420 else
421 {
422 /* recursive main loop, continue from where we were */
423 event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next;
424 }
425
426 while (event_filter_current)
427 {
428 Ecore_Event_Filter *ef = event_filter_current;
429
430 if (!ef->delete_me)
431 {
432 ef->references++;
433
434 if (ef->func_start)
435 ef->loop_data = _ecore_call_data_cb(ef->func_start, ef->data);
436
437 if (!event_filter_event_current)
438 {
439 /* regular main loop, start from head */
440 event_filter_event_current = events;
441 }
442 else
443 {
444 /* recursive main loop, continue from where we were */
445 event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next;
446 }
447
448 while (event_filter_event_current)
449 {
450 Ecore_Event *e = event_filter_event_current;
451
452 if (!_ecore_call_filter_cb(ef->func_filter, ef->data,
453 ef->loop_data, e->type, e->event))
454 {
455 ecore_event_del(e);
456 }
457
458 if (event_filter_event_current) /* may have changed in recursive main loops */
459 event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next;
460 }
461 if (ef->func_end)
462 _ecore_call_end_cb(ef->func_end, ef->data, ef->loop_data);
463
464 ef->references--;
465 }
466
467 if (event_filter_current) /* may have changed in recursive main loops */
468 event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next;
469 }
470 if (event_filters_delete_me)
471 {
472 int deleted_in_use = 0;
473 Ecore_Event_Filter *l;
474 for (l = event_filters; l; )
475 {
476 Ecore_Event_Filter *ef = l;
477 l = (Ecore_Event_Filter *)EINA_INLIST_GET(l)->next;
478 if (ef->delete_me)
479 {
480 if (ef->references)
481 {
482 deleted_in_use++;
483 continue;
484 }
485
486 event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
487 ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
488 ecore_event_filter_mp_free(ef);
489 }
490 }
491 if (!deleted_in_use)
492 event_filters_delete_me = 0;
493 }
494}
495
496void
497_ecore_event_call(void)
498{
499 Eina_List *l, *l_next;
500 Ecore_Event_Handler *eh;
501
502 _ecore_event_filters_apply();
503
504 if (!event_current)
505 {
506 /* regular main loop, start from head */
507 event_current = events;
508 event_handler_current = NULL;
509 }
510
511 while (event_current)
512 {
513 Ecore_Event *e = event_current;
514 int handle_count = 0;
515
516 if (e->delete_me)
517 {
518 event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next;
519 continue;
520 }
521
522 ecore_raw_event_type = e->type;
523 ecore_raw_event_event = e->event;
524 e->references++;
525 if ((e->type >= 0) && (e->type < event_handlers_num))
526 {
527 if (!event_handler_current)
528 {
529 /* regular main loop, start from head */
530 event_handler_current = event_handlers[e->type];
531 }
532 else
533 {
534 /* recursive main loop, continue from where we were */
535 event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next;
536 }
537
538 while ((event_handler_current) && (!e->delete_me))
539 {
540 eh = event_handler_current;
541 if (!eh->delete_me)
542 {
543 Eina_Bool ret;
544
545 handle_count++;
546
547 eh->references++;
548 ret = _ecore_call_handler_cb(eh->func, eh->data, e->type, e->event);
549 eh->references--;
550
551 if (!ret)
552 {
553 event_handler_current = NULL;
554 break; /* 0 == "call no further handlers" */
555 }
556 }
557
558 if (event_handler_current) /* may have changed in recursive main loops */
559 event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next;
560 }
561 }
562 while (event_handlers_add_list)
563 {
564 eh = event_handlers_add_list;
565 event_handlers_add_list = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers_add_list), EINA_INLIST_GET(eh));
566 event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_append(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
567 }
568 /* if no handlers were set for EXIT signal - then default is */
569 /* to quit the main loop */
570 if ((e->type == ECORE_EVENT_SIGNAL_EXIT) && (handle_count == 0))
571 ecore_main_loop_quit();
572 e->references--;
573 e->delete_me = 1;
574
575 if (event_current) /* may have changed in recursive main loops */
576 event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next;
577 }
578
579 ecore_raw_event_type = ECORE_EVENT_NONE;
580 ecore_raw_event_event = NULL;
581
582 _ecore_event_purge_deleted();
583
584 EINA_LIST_FOREACH_SAFE(event_handlers_delete_list, l, l_next, eh)
585 {
586 if (eh->references) continue;
587
588 event_handlers_delete_list = eina_list_remove_list(event_handlers_delete_list, l);
589
590 event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
591 ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
592 ecore_event_handler_mp_free(eh);
593 }
594}
595
596EAPI void *
597_ecore_event_signal_user_new(void)
598{
599 Ecore_Event_Signal_User *e;
600
601 e = calloc(1, sizeof(Ecore_Event_Signal_User));
602 return e;
603}
604
605void *
606_ecore_event_signal_hup_new(void)
607{
608 Ecore_Event_Signal_Hup *e;
609
610 e = calloc(1, sizeof(Ecore_Event_Signal_Hup));
611 return e;
612}
613
614void *
615_ecore_event_signal_exit_new(void)
616{
617 Ecore_Event_Signal_Exit *e;
618
619 e = calloc(1, sizeof(Ecore_Event_Signal_Exit));
620 return e;
621}
622
623void *
624_ecore_event_signal_power_new(void)
625{
626 Ecore_Event_Signal_Power *e;
627
628 e = calloc(1, sizeof(Ecore_Event_Signal_Power));
629 return e;
630}
631
632void *
633_ecore_event_signal_realtime_new(void)
634{
635 return calloc(1, sizeof(Ecore_Event_Signal_Realtime));
636}
637
diff --git a/libraries/ecore/src/lib/ecore/ecore_exe.c b/libraries/ecore/src/lib/ecore/ecore_exe.c
deleted file mode 100644
index 47f8dc9..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_exe.c
+++ /dev/null
@@ -1,1880 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__)
6# include <sys/time.h>
7# include <sys/resource.h>
8#endif
9
10#include <stdlib.h>
11#include <stdio.h>
12#include <string.h>
13#include <errno.h>
14#include <sys/types.h>
15#include <unistd.h>
16#include <fcntl.h>
17
18#ifdef HAVE_SYS_PRCTL_H
19# include <sys/prctl.h>
20#endif
21
22#ifdef HAVE_SYS_WAIT_H
23# include <sys/wait.h>
24#endif
25
26#include "Ecore.h"
27#include "ecore_private.h"
28
29/* FIXME: Getting respawn to work
30 *
31 * There is no way that we can do anything about the internal state info of
32 * an external exe. The same can be said about the state of user code. User
33 * code in this context means the code that is using ecore_exe to manage exe's
34 * for it.
35 *
36 * Document that the exe must be respawnable, in other words, there is no
37 * state that it cannot regenerate by just killing it and starting it again.
38 * This includes state that the user code knows about, as the respawn is
39 * transparent to that code. On the other hand, maybe a respawn event might
40 * be useful, or maybe resend the currently non existent add event. For
41 * consistancy with ecore_con, an add event is good anyway.
42 *
43 * The Ecore_exe structure is reused for respawning, so that the (opaque)
44 * pointer held by the user remains valid. This means that the Ecore_Exe
45 * init and del functions may need to be split into two parts each to avoid
46 * duplicating code - common code part, and the rest. This implies that
47 * the unchanging members mentioned next should NEVER change.
48 *
49 * These structure members don't need to change -
50 * __list_data - we stay on the list
51 * ECORE_MAGIC - this is a constant
52 * data - passed in originally
53 * cmd - passed in originally
54 * flags - passed in originally
55 *
56 * These structure members need to change -
57 * tag - state that must be regenerated, zap it
58 * pid - it will be different
59 * child_fd_write - it will be different
60 * child_fd_read - it will be different
61 * child_fd_error - it will be different
62 * write_fd_handler - we cannot change the fd used by a handler, this changes coz the fd changes.
63 * read_fd_handler - we cannot change the fd used by a handler, this changes coz the fd changes.
64 * error_fd_handler - we cannot change the fd used by a handler, this changes coz the fd changes.
65 *
66 * Hmm, the read, write, and error buffers could be tricky.
67 * They are not atomic, and could be in a semi complete state.
68 * They fall into the "state must be regenerated" mentioned above.
69 * A respawn/add event should take care of it.
70 *
71 * These structure members need to change -
72 * write_data_buf - state that must be regenerated, zap it
73 * write_data_size - state that must be regenerated, zap it
74 * write_data_offset - state that must be regenerated, zap it
75 * read_data_buf - state that must be regenerated, zap it
76 * read_data_size - state that must be regenerated, zap it
77 * error_data_buf - state that must be regenerated, zap it
78 * error_data_size - state that must be regenerated, zap it
79 * close_write - state that must be regenerated, zap it
80 *
81 * There is the problem that an exe that fell over and needs respawning
82 * might keep falling over, keep needing to be respawned, and tie up system
83 * resources with the constant respawning. An exponentially increasing
84 * timeout (with maximum timeout) between respawns should take care of that.
85 * Although this is not a "contention for a resource" problem, the exe falling
86 * over may be, so a random element added to the timeout may help, and won't
87 * hurt. The user code may need to be informed that a timeout is in progress.
88 */
89
90struct _Ecore_Exe
91{
92 EINA_INLIST;
93 ECORE_MAGIC;
94 pid_t pid;
95 void *data;
96 char *tag, *cmd;
97 Ecore_Exe_Flags flags;
98 Ecore_Fd_Handler *write_fd_handler; /* the fd_handler to handle write to child - if this was used, or NULL if not */
99 Ecore_Fd_Handler *read_fd_handler; /* the fd_handler to handle read from child - if this was used, or NULL if not */
100 Ecore_Fd_Handler *error_fd_handler; /* the fd_handler to handle errors from child - if this was used, or NULL if not */
101 void *write_data_buf; /* a data buffer for data to write to the child -
102 * realloced as needed for more data and flushed when the fd handler says writes are possible
103 */
104 int write_data_size; /* the size in bytes of the data buffer */
105 int write_data_offset; /* the offset in bytes in the data buffer */
106 void *read_data_buf; /* data read from the child awating delivery to an event */
107 int read_data_size; /* data read from child in bytes */
108 void *error_data_buf; /* errors read from the child awating delivery to an event */
109 int error_data_size; /* errors read from child in bytes */
110 int child_fd_write; /* fd to write TO to send data to the child */
111 int child_fd_read; /* fd to read FROM when child has sent us (the parent) data */
112 int child_fd_error; /* fd to read FROM when child has sent us (the parent) errors */
113 int child_fd_write_x; /* fd to write TO to send data to the child */
114 int child_fd_read_x; /* fd to read FROM when child has sent us (the parent) data */
115 int child_fd_error_x; /* fd to read FROM when child has sent us (the parent) errors */
116 Eina_Bool close_stdin : 1;
117
118 int start_bytes, end_bytes, start_lines, end_lines; /* Number of bytes/lines to auto pipe at start/end of stdout/stderr. */
119
120 Ecore_Timer *doomsday_clock; /* The Timer of Death. Muahahahaha. */
121 void *doomsday_clock_dead; /* data for the doomsday clock */
122
123 Ecore_Exe_Cb pre_free_cb;
124};
125
126/* TODO: Something to let people build a command line and does auto escaping -
127 *
128 * ecore_exe_snprintf()
129 *
130 * OR
131 *
132 * cmd = ecore_exe_comand_parameter_append(cmd, "firefox");
133 * cmd = ecore_exe_comand_parameter_append(cmd, "http://www.foo.com/bar.html?baz=yes");
134 * each parameter appended is one argument, and it gets escaped, quoted, and
135 * appended with a preceding space. The first is the command off course.
136 */
137
138struct _ecore_exe_dead_exe
139{
140 pid_t pid;
141 char *cmd;
142};
143
144static inline void _ecore_exe_exec_it(const char *exe_cmd,
145 Ecore_Exe_Flags flags);
146static Eina_Bool _ecore_exe_data_generic_handler(void *data,
147 Ecore_Fd_Handler *fd_handler,
148 Ecore_Exe_Flags flags);
149static Eina_Bool _ecore_exe_data_error_handler(void *data,
150 Ecore_Fd_Handler *fd_handler);
151static Eina_Bool _ecore_exe_data_read_handler(void *data,
152 Ecore_Fd_Handler *fd_handler);
153static Eina_Bool _ecore_exe_data_write_handler(void *data,
154 Ecore_Fd_Handler *fd_handler);
155static void _ecore_exe_flush(Ecore_Exe *exe);
156static void _ecore_exe_event_exe_data_free(void *data __UNUSED__,
157 void *ev);
158static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid);
159static Eina_Bool _ecore_exe_make_sure_its_dead(void *data);
160static Eina_Bool _ecore_exe_make_sure_its_really_dead(void *data);
161static Ecore_Exe_Event_Add *_ecore_exe_event_add_new(void);
162static void _ecore_exe_event_add_free(void *data,
163 void *ev);
164static void _ecore_exe_dead_attach(Ecore_Exe *exe);
165
166EAPI int ECORE_EXE_EVENT_ADD = 0;
167EAPI int ECORE_EXE_EVENT_DEL = 0;
168EAPI int ECORE_EXE_EVENT_DATA = 0;
169EAPI int ECORE_EXE_EVENT_ERROR = 0;
170
171static Ecore_Exe *exes = NULL;
172static const char *shell = NULL;
173
174/* FIXME: This errno checking stuff should be put elsewhere for everybody to use.
175 * For now it lives here though, just to make testing easier.
176 */
177static int _ecore_exe_check_errno(int result,
178 const char *file,
179 int line);
180
181#define E_IF_NO_ERRNO(result, foo, ok) \
182 while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) == -1) sleep(1); \
183 if (ok)
184
185#define E_NO_ERRNO(result, foo, ok) \
186 while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) == -1) sleep(1)
187
188#define E_IF_NO_ERRNO_NOLOOP(result, foo, ok) \
189 if (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)))
190
191static int
192_ecore_exe_check_errno(int result,
193 const char *file,
194 int line)
195{
196 int saved_errno = errno;
197
198 if (result == -1)
199 {
200 perror("*** errno reports ");
201/* What is currently supported -
202 *
203 * pipe
204 * EFAULT Argument is not valid.
205 * EMFILE Too many file descriptors used by process.
206 * ENFILE Too many open files by system.
207 * read
208 * EAGAIN No data now, try again.
209 * EBADF This is not an fd that can be read.
210 * EFAULT This is not a valid buffer.
211 * EINTR Interupted by signal, try again.
212 * EINVAL This is not an fd that can be read.
213 * EIO I/O error.
214 * EISDIR This is a directory, and cannot be read.
215 * others Depending on what sort of thing we are reading from.
216 * close
217 * EBADF This is not an fd that can be closed.
218 * EINTR Interupted by signal, try again.
219 * EIO I/O error.
220 * dup2
221 * EBADF This is not an fd that can be dup2'ed.
222 * EBUSY Race condition between open() and dup()
223 * EINTR Interupted by signal, try again.
224 * EMFILE Too many file descriptors used by process.
225 * fcntl
226 * EACCES, EAGAIN Locked or mapped by something else, try again later.
227 * EBADF This is not an fd that can be fcntl'ed.
228 * EDEADLK This will cause a deadlock.
229 * EFAULT This is not a valid lock.
230 * EINTR Interupted by signal, try again.
231 * EINVAL This is not a valid arg.
232 * EMFILE Too many file descriptors used by process.
233 * ENOLCK Problem getting a lock.
234 * EPERM Not allowed to do that.
235 * fsync
236 * EBADF This is not an fd that is open for writing.
237 * EINVAL, EROFS This is not an fd that can be fsynced.
238 * EIO I/O error.
239 *
240 * How to use it -
241 * int ok = 0;
242 * int result;
243 *
244 * E_IF_NO_ERRNO(result, foo(bar), ok)
245 * {
246 * E_IF_NO_ERRNO_NOLOOP(result, foo(bar), ok)
247 * {
248 * }
249 * }
250 *
251 * if (!ok)
252 * {
253 * // Something failed, cleanup.
254 * }
255 */
256 switch (saved_errno)
257 {
258 case EACCES:
259 case EAGAIN:
260 case EINTR:
261 { /* Not now, try later. */
262 ERR("*** Must try again in %s @%u.", file, line);
263 result = -1;
264 break;
265 }
266
267 case EMFILE:
268 case ENFILE:
269 case ENOLCK:
270 { /* Low on resources. */
271 ERR("*** Low on resources in %s @%u.", file,
272 line);
273 result = 0;
274 break;
275 }
276
277 case EIO:
278 { /* I/O error. */
279 ERR("*** I/O error in %s @%u.", file, line);
280 result = 0;
281 break;
282 }
283
284 case EFAULT:
285 case EBADF:
286 case EINVAL:
287 case EROFS:
288 case EISDIR:
289 case EDEADLK:
290 case EPERM:
291 case EBUSY:
292 { /* Programmer fucked up. */
293 ERR("*** NAUGHTY PROGRAMMER!!!\n"
294 "*** SPANK SPANK SPANK!!!\n"
295 "*** Now go fix your code in %s @%u. Tut tut tut!",
296 file, line);
297 result = 0;
298 break;
299 }
300
301 default:
302 { /* Unsupported errno code, please add this one. */
303 ERR("*** NAUGHTY PROGRAMMER!!!\n"
304 "*** SPANK SPANK SPANK!!!\n"
305 "*** Unsupported errno code %d, please add this one.\n"
306 "*** Now go fix your code in %s @%u, from %s @%u. Tut tut tut!",
307 saved_errno, __FILE__, __LINE__, file, line);
308 result = 0;
309 break;
310 }
311 }
312 }
313 else /* Everything is fine. */
314 result = 1;
315
316 errno = saved_errno;
317 return result;
318}
319
320/**
321 * @addtogroup Ecore_Exe_Group
322 *
323 * @{
324 */
325
326static int run_pri = ECORE_EXE_PRIORITY_INHERIT;
327
328/**
329 * Sets the priority at which to launch processes
330 *
331 * This sets the priority of processes run by ecore_exe_run() and
332 * ecore_exe_pipe_run().
333 * @li On Windows, the child process is created by default with the
334 * @ref ECORE_EXE_WIN32_PRIORITY_NORMAL priority, unless the calling
335 * process is in @ref ECORE_EXE_WIN32_PRIORITY_IDLE or
336 * @ref ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL priority. In that case, the
337 * child process inherits this priority.
338 * @li On other platforms, if set to @ref ECORE_EXE_PRIORITY_INHERIT child
339 * processes inherits the priority of their parent. This is the default.
340 *
341 * @param pri value a Ecore_Exe_Win32_Priority value on Windows, -20
342 * to 19 or @ref ECORE_EXE_PRIORITY_INHERIT on other OS.
343 */
344EAPI void
345ecore_exe_run_priority_set(int pri)
346{
347 run_pri = pri;
348}
349
350/**
351 * Gets the priority at which to launch processes
352 *
353 * This gets ths priority of launched processes. See
354 * ecore_exe_run_priority_set() for details. This just returns the value set
355 * by this call.
356 *
357 * @return the value set by ecore_exe_run_priority_set()
358 */
359EAPI int
360ecore_exe_run_priority_get(void)
361{
362 return run_pri;
363}
364
365/**
366 * Spawns a child process.
367 *
368 * This is now just a thin wrapper around ecore_exe_pipe_run()
369 *
370 * @param exe_cmd The command to run with @c /bin/sh.
371 * @param data Data to attach to the returned process handle.
372 * @return A process handle to the spawned process.
373 */
374EAPI Ecore_Exe *
375ecore_exe_run(const char *exe_cmd,
376 const void *data)
377{
378 return ecore_exe_pipe_run(exe_cmd, 0, data);
379}
380
381/**
382 * Spawns a child process with its stdin/out available for communication.
383 *
384 * This function forks and runs the given command using @c /bin/sh.
385 *
386 * Note that the process handle is only valid until a child process
387 * terminated event is received. After all handlers for the child process
388 * terminated event have been called, the handle will be freed by Ecore.
389 *
390 * This function does the same thing as ecore_exe_run(), but also makes the
391 * standard in and/or out as well as stderr from the child process available
392 * for reading or writing. To write use ecore_exe_send(). To read listen to
393 * ECORE_EXE_EVENT_DATA or ECORE_EXE_EVENT_ERROR events (set up handlers).
394 * Ecore may buffer read and error data until a newline character if asked
395 * for with the @p flags. All data will be included in the events (newlines
396 * will be replaced with NULLS if line buffered). ECORE_EXE_EVENT_DATA events
397 * will only happen if the process is run with ECORE_EXE_PIPE_READ enabled
398 * in the flags. The same with the error version. Writing will only be
399 * allowed with ECORE_EXE_PIPE_WRITE enabled in the flags.
400 *
401 * @param exe_cmd The command to run with @c /bin/sh.
402 * @param flags The flag parameters for how to deal with inter-process I/O
403 * @param data Data to attach to the returned process handle.
404 * @return A process handle to the spawned process.
405 */
406EAPI Ecore_Exe *
407ecore_exe_pipe_run(const char *exe_cmd,
408 Ecore_Exe_Flags flags,
409 const void *data)
410{
411 Ecore_Exe *exe = NULL;
412 int statusPipe[2] = { -1, -1 };
413 int errorPipe[2] = { -1, -1 };
414 int readPipe[2] = { -1, -1 };
415 int writePipe[2] = { -1, -1 };
416 int n = 0;
417 int ok = 1;
418 int result;
419
420 if (!exe_cmd) return NULL;
421 exe = calloc(1, sizeof(Ecore_Exe));
422 if (!exe) return NULL;
423
424 if ((flags & ECORE_EXE_PIPE_AUTO) && (!(flags & ECORE_EXE_PIPE_ERROR))
425 && (!(flags & ECORE_EXE_PIPE_READ)))
426 /* We need something to auto pipe. */
427 flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR;
428
429 exe->child_fd_error = -1;
430 exe->child_fd_read = -1;
431 exe->child_fd_write = -1;
432 exe->child_fd_error_x = -1;
433 exe->child_fd_read_x = -1;
434 exe->child_fd_write_x = -1;
435
436 /* Create some pipes. */
437 if (ok)
438 {
439 E_IF_NO_ERRNO_NOLOOP(result, pipe(statusPipe), ok)
440 {
441 }
442 }
443 if (ok && (flags & ECORE_EXE_PIPE_ERROR))
444 {
445 E_IF_NO_ERRNO_NOLOOP(result, pipe(errorPipe), ok)
446 {
447 exe->child_fd_error = errorPipe[0];
448 exe->child_fd_error_x = errorPipe[1];
449 }
450 }
451 if (ok && (flags & ECORE_EXE_PIPE_READ))
452 {
453 E_IF_NO_ERRNO_NOLOOP(result, pipe(readPipe), ok)
454 {
455 exe->child_fd_read = readPipe[0];
456 exe->child_fd_read_x = readPipe[1];
457 }
458 }
459 if (ok && (flags & ECORE_EXE_PIPE_WRITE))
460 {
461 E_IF_NO_ERRNO_NOLOOP(result, pipe(writePipe), ok)
462 {
463 exe->child_fd_write = writePipe[1];
464 exe->child_fd_write_x = writePipe[0];
465 }
466 }
467 if (ok)
468 {
469 pid_t pid = 0;
470 volatile int vfork_exec_errno = 0;
471
472 /* FIXME: I should double check this. After a quick look around, this is already done, but via a more modern method. */
473 /* signal(SIGPIPE, SIG_IGN); We only want EPIPE on errors */
474 pid = fork();
475
476 if (pid == -1)
477 {
478 ERR("Failed to fork process");
479 pid = 0;
480 }
481 else if (pid == 0) /* child */
482 {
483 if (run_pri != ECORE_EXE_PRIORITY_INHERIT)
484 {
485 if ((run_pri >= -20) && (run_pri <= 19))
486 setpriority(PRIO_PROCESS, 0, run_pri);
487 }
488 /* dup2 STDERR, STDIN, and STDOUT. dup2() allegedly closes the
489 * second pipe if it's open. On the other hand, there was the
490 * Great FD Leak Scare of '06, so let's be paranoid. */
491 if (ok && (flags & ECORE_EXE_PIPE_ERROR))
492 {
493 E_NO_ERRNO(result, close(STDERR_FILENO), ok);
494 E_NO_ERRNO(result, dup2(errorPipe[1], STDERR_FILENO), ok);
495 }
496 if (ok && (flags & ECORE_EXE_PIPE_READ))
497 {
498 E_NO_ERRNO(result, close(STDOUT_FILENO), ok);
499 E_NO_ERRNO(result, dup2(readPipe[1], STDOUT_FILENO), ok);
500 }
501 if (ok && (flags & ECORE_EXE_PIPE_WRITE))
502 {
503 E_NO_ERRNO(result, close(STDIN_FILENO), ok);
504 E_NO_ERRNO(result, dup2(writePipe[0], STDIN_FILENO), ok);
505 }
506
507 if (ok)
508 {
509 /* Setup the status pipe. */
510 E_NO_ERRNO(result, close(statusPipe[0]), ok);
511 E_IF_NO_ERRNO(result, fcntl(statusPipe[1], F_SETFD, FD_CLOEXEC), ok) /* close on exec shows success */
512 {
513 /* Run the actual command. */
514 _ecore_exe_exec_it(exe_cmd, flags); /* no return */
515 }
516 }
517
518 /* Something went 'orribly wrong. */
519 vfork_exec_errno = errno;
520
521 /* Close the pipes. */
522 if (flags & ECORE_EXE_PIPE_ERROR)
523 E_NO_ERRNO(result, close(errorPipe[1]), ok);
524 if (flags & ECORE_EXE_PIPE_READ)
525 E_NO_ERRNO(result, close(readPipe[1]), ok);
526 if (flags & ECORE_EXE_PIPE_WRITE)
527 E_NO_ERRNO(result, close(writePipe[0]), ok);
528 E_NO_ERRNO(result, close(statusPipe[1]), ok);
529
530 _exit(-1);
531 }
532 else /* parent */
533 {
534 /* Close the unused pipes. */
535 E_NO_ERRNO(result, close(statusPipe[1]), ok);
536
537 /* FIXME: after having a good look at the current e fd
538 * handling, investigate fcntl(dataPipe[x], F_SETSIG, ...) */
539 /* FIXME: above F_SETSIG etc. - this is async SIGIO based IO
540 * which is also linux specific so we probably don't want to
541 * do this as long as select() is working fine. the only time
542 * we really want to think of SIGIO async IO is when it all
543 * actually works basically everywhere and we can turn all
544 * IO into DMA async activities (i.e. you do a read() then
545 * the read is complete not on return but when you get a
546 * SIGIO - the read() just starts the transfer and it is
547 * completed in the background by DMA (or whatever mechanism
548 * the kernel choses)) */
549
550 /* Wait for it to start executing. */
551 /* FIXME: this doesn't seem very nice - we sit and block
552 * waiting on a child process... even though it's just
553 * the segment between the fork() and the exec) it just feels
554 * wrong */
555 for (;; )
556 {
557 char buf;
558
559 E_NO_ERRNO(result, read(statusPipe[0], &buf, 1), ok);
560 if (result == 0)
561 {
562 if (vfork_exec_errno != 0)
563 {
564 n = vfork_exec_errno;
565 ERR("Could not start \"%s\"", exe_cmd);
566 pid = 0;
567 }
568 break;
569 }
570 }
571
572 /* Close the status pipe. */
573 E_NO_ERRNO(result, close(statusPipe[0]), ok);
574 }
575
576 if (pid)
577 {
578 /* Setup the exe structure. */
579 ECORE_MAGIC_SET(exe, ECORE_MAGIC_EXE);
580 exe->start_bytes = -1;
581 exe->end_bytes = -1;
582 exe->start_lines = -1;
583 exe->end_lines = -1;
584 exe->pid = pid;
585 exe->flags = flags;
586 exe->data = (void *)data;
587 if ((exe->cmd = strdup(exe_cmd)))
588 {
589 if (flags & ECORE_EXE_PIPE_ERROR) /* Setup the error stuff. */
590 {
591 E_IF_NO_ERRNO(result,
592 fcntl(exe->child_fd_error, F_SETFL,
593 O_NONBLOCK), ok) {
594 }
595 E_IF_NO_ERRNO(result,
596 fcntl(exe->child_fd_error, F_SETFD,
597 FD_CLOEXEC), ok) {
598 }
599 E_IF_NO_ERRNO(result,
600 fcntl(exe->child_fd_error_x, F_SETFD,
601 FD_CLOEXEC), ok) {
602 }
603 {
604 exe->error_fd_handler =
605 ecore_main_fd_handler_add(exe->child_fd_error,
606 ECORE_FD_READ,
607 _ecore_exe_data_error_handler,
608 exe, NULL, NULL);
609 if (!exe->error_fd_handler)
610 ok = 0;
611 }
612 }
613 if (ok && (flags & ECORE_EXE_PIPE_READ)) /* Setup the read stuff. */
614 {
615 E_IF_NO_ERRNO(result,
616 fcntl(exe->child_fd_read, F_SETFL,
617 O_NONBLOCK), ok) {
618 }
619 E_IF_NO_ERRNO(result,
620 fcntl(exe->child_fd_read, F_SETFD,
621 FD_CLOEXEC), ok) {
622 }
623 E_IF_NO_ERRNO(result,
624 fcntl(exe->child_fd_read_x, F_SETFD,
625 FD_CLOEXEC), ok) {
626 }
627 {
628 exe->read_fd_handler =
629 ecore_main_fd_handler_add(exe->child_fd_read,
630 ECORE_FD_READ,
631 _ecore_exe_data_read_handler,
632 exe, NULL, NULL);
633 if (!exe->read_fd_handler)
634 ok = 0;
635 }
636 }
637 if (ok && (flags & ECORE_EXE_PIPE_WRITE)) /* Setup the write stuff. */
638 {
639 E_IF_NO_ERRNO(result,
640 fcntl(exe->child_fd_write, F_SETFL,
641 O_NONBLOCK), ok) {
642 }
643 E_IF_NO_ERRNO(result,
644 fcntl(exe->child_fd_write, F_SETFD,
645 FD_CLOEXEC), ok) {
646 }
647 E_IF_NO_ERRNO(result,
648 fcntl(exe->child_fd_write_x, F_SETFD,
649 FD_CLOEXEC), ok) {
650 }
651 {
652 exe->write_fd_handler =
653 ecore_main_fd_handler_add(exe->child_fd_write,
654 ECORE_FD_WRITE,
655 _ecore_exe_data_write_handler,
656 exe, NULL, NULL);
657 if (exe->write_fd_handler)
658 ecore_main_fd_handler_active_set(exe->write_fd_handler, 0); /* Nothing to write to start with. */
659 else
660 ok = 0;
661 }
662 }
663
664 exes = (Ecore_Exe *)eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
665 n = 0;
666 }
667 else
668 ok = 0;
669 }
670 else
671 ok = 0;
672 }
673
674 if (!ok) /* Something went wrong, so pull down everything. */
675 {
676 if (exe->pid) ecore_exe_terminate(exe);
677 IF_FN_DEL(ecore_exe_free, exe);
678 }
679 else
680 {
681 Ecore_Exe_Event_Add *e;
682
683 e = _ecore_exe_event_add_new();
684 e->exe = exe;
685 if (e) /* Send the event. */
686 ecore_event_add(ECORE_EXE_EVENT_ADD, e,
687 _ecore_exe_event_add_free, NULL);
688 /* INF("Running as %d for %s.\n", exe->pid, exe->cmd); */
689 }
690
691 errno = n;
692 return exe;
693}
694
695/**
696 * Defines a function to be called before really freeing the handle data.
697 *
698 * This might be useful for language bindings such as Python and Perl
699 * that need to deallocate wrappers associated with this handle.
700 *
701 * This handle should never be modified by this call. It should be
702 * considered informative only. All getters are valid when the given
703 * function is called back.
704 *
705 * @param exe The child process to attach the pre_free function.
706 * @param func The function to call before @a exe is freed.
707 */
708EAPI void
709ecore_exe_callback_pre_free_set(Ecore_Exe *exe,
710 Ecore_Exe_Cb func)
711{
712 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
713 {
714 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE,
715 "ecore_exe_callback_pre_free_set");
716 return;
717 }
718 exe->pre_free_cb = func;
719}
720
721/**
722 * Sends data to the given child process which it receives on stdin.
723 *
724 * This function writes to a child processes standard in, with unlimited
725 * buffering. This call will never block. It may fail if the system runs out
726 * of memory.
727 *
728 * @param exe The child process to send to
729 * @param data The data to send
730 * @param size The size of the data to send, in bytes
731 * @return EINA_TRUE if successful, EINA_FALSE on failure.
732 */
733EAPI Eina_Bool
734ecore_exe_send(Ecore_Exe *exe,
735 const void *data,
736 int size)
737{
738 void *buf;
739
740 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
741 {
742 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_send");
743 return EINA_FALSE;
744 }
745
746 if (exe->close_stdin)
747 {
748 ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p",
749 exe, size, data);
750 return EINA_FALSE;
751 }
752
753 if (exe->child_fd_write == -1)
754 {
755 ERR("Ecore_Exe %p created without ECORE_EXE_PIPE_WRITE! "
756 "Cannot send %d bytes from %p", exe, size, data);
757 return EINA_FALSE;
758 }
759
760 buf = realloc(exe->write_data_buf, exe->write_data_size + size);
761 if (!buf) return EINA_FALSE;
762
763 exe->write_data_buf = buf;
764 memcpy((char *)exe->write_data_buf + exe->write_data_size, data, size);
765 exe->write_data_size += size;
766
767 if (exe->write_fd_handler)
768 ecore_main_fd_handler_active_set(exe->write_fd_handler, ECORE_FD_WRITE);
769
770 return EINA_TRUE;
771}
772
773/**
774 * The stdin of the given child process will close when the write buffer is empty.
775 *
776 * @param exe The child process
777 */
778EAPI void
779ecore_exe_close_stdin(Ecore_Exe *exe)
780{
781 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
782 {
783 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_close_stdin");
784 return;
785 }
786 exe->close_stdin = 1;
787}
788
789/**
790 * Sets the auto pipe limits for the given process handle. On Windows
791 * this function does nothing.
792 *
793 * @param exe The given process handle.
794 * @param start_bytes limit of bytes at start of output to buffer.
795 * @param end_bytes limit of bytes at end of output to buffer.
796 * @param start_lines limit of lines at start of output to buffer.
797 * @param end_lines limit of lines at end of output to buffer.
798 */
799EAPI void
800ecore_exe_auto_limits_set(Ecore_Exe *exe,
801 int start_bytes,
802 int end_bytes,
803 int start_lines,
804 int end_lines)
805{
806 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
807 {
808 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_auto_limits_set");
809 return;
810 }
811 /* FIXME: sanitize the input. */
812 exe->start_bytes = start_bytes;
813 exe->end_bytes = end_bytes;
814 exe->start_lines = start_lines;
815 exe->end_lines = end_lines;
816
817 /* FIXME: get this can of worms working.
818 *
819 * capture stderr & stdout internally
820 *
821 * raster and onefang keep moving the goal posts on this one. It started out as
822 * "show users the error output if an exe fails" and is rapidly approaching
823 * "alternative method of getting the data, poll vs event driven". Some serious
824 * thinking needs to be applied to this. Do we really want to go that far? If
825 * so, we should change the names. The basic design will probably remain the
826 * same which ever way we go. The constant goal post moving is probably due to
827 * generic design methods leading to feature creep as we inspired each other to
828 * more generic designs. It does seem like the closer we get to poll driven,
829 * the more issues and corner cases there are.
830 *
831 * Instead of doing the usual register an event handler thing, we are ecore_exe,
832 * we can take some short cuts. Don't send the events, just leave the exe buffers
833 * as is until the user asks for them, then return the event.
834 *
835 * start = 0, end = 0; clogged arteries get flushed, everything is ignored.
836 * start = -1, end = -1; clogged arteries get transferred to internal buffers. Actually, either == -1 means buffer everything.
837 * start = X, end = 0; buffer first X out of clogged arteries, flush and ignore rest.
838 * start = 0, end = X; circular buffer X
839 * start = X, end = Y; buffer first X out of clogged arteries, circular buffer Y from beginning.
840 *
841 * bytes vs lines, which ever one reaches the limit first.
842 * Before we go beyond the start+end limit, leave the end buffer empty, and store both in the start buffer, coz they overlap.
843 * 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.
844 *
845 * Other issues -
846 * Spank programmer for polling data if polling is not turned on.
847 * Spank programmer for setting up event callbacks if polling is turned on.
848 * Spank programmer for freeing the event data if it came from the event system, as that autofrees.
849 * Spank the programmer if they try to set the limits bigger than what has been gathered & ignored already, coz they just lost data.
850 * Spank onefang and raster for opening this can of worms.
851 * Should we have separate out/err limits?
852 * Should we remove from the internal buffer the data that was delivered already?
853 * If so, what to do about limits, start, and end? They could loose their meaning.
854 */
855}
856
857/**
858 * Gets the auto pipe data for the given process handle
859 *
860 * @param exe The given process handle.
861 * @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR?
862 */
863EAPI Ecore_Exe_Event_Data *
864ecore_exe_event_data_get(Ecore_Exe *exe,
865 Ecore_Exe_Flags flags)
866{
867 Ecore_Exe_Event_Data *e = NULL;
868 int is_buffered = 0;
869 unsigned char *inbuf;
870 int inbuf_num;
871
872 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
873 {
874 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_event_data_get");
875 return NULL;
876 }
877
878 /* Sort out what sort of event we are. */
879 if (flags & ECORE_EXE_PIPE_READ)
880 {
881 flags = ECORE_EXE_PIPE_READ;
882 if (exe->flags & ECORE_EXE_PIPE_READ_LINE_BUFFERED)
883 is_buffered = 1;
884 }
885 else
886 {
887 flags = ECORE_EXE_PIPE_ERROR;
888 if (exe->flags & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED)
889 is_buffered = 1;
890 }
891
892 /* Get the data. */
893 if (flags & ECORE_EXE_PIPE_READ)
894 {
895 inbuf = exe->read_data_buf;
896 inbuf_num = exe->read_data_size;
897 exe->read_data_buf = NULL;
898 exe->read_data_size = 0;
899 }
900 else
901 {
902 inbuf = exe->error_data_buf;
903 inbuf_num = exe->error_data_size;
904 exe->error_data_buf = NULL;
905 exe->error_data_size = 0;
906 }
907
908 e = calloc(1, sizeof(Ecore_Exe_Event_Data));
909 if (e)
910 {
911 e->exe = exe;
912 e->data = inbuf;
913 e->size = inbuf_num;
914
915 if (is_buffered) /* Deal with line buffering. */
916 {
917 int max = 0;
918 int count = 0;
919 int i;
920 int last = 0;
921 char *c;
922
923 c = (char *)inbuf;
924 for (i = 0; i < inbuf_num; i++) /* Find the lines. */
925 {
926 if (inbuf[i] == '\n')
927 {
928 if (count >= max)
929 {
930 /* In testing, the lines seem to arrive in batches of 500 to 1000 lines at most, roughly speaking. */
931 max += 10; /* FIXME: Maybe keep track of the largest number of lines ever sent, and add half that many instead of 10. */
932 e->lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL termination. */
933 }
934 /* raster said to leave the line endings as line endings, however -
935 * This is line buffered mode, we are not dealing with binary here, but lines.
936 * If we are not dealing with binary, we must be dealing with ASCII, unicode, or some other text format.
937 * Thus the user is most likely gonna deal with this text as strings.
938 * Thus the user is most likely gonna pass this data to str functions.
939 * rasters way - the endings are always gonna be '\n'; onefangs way - they will always be '\0'
940 * We are handing them the string length as a convenience.
941 * Thus if they really want it in raw format, they can e->lines[i].line[e->lines[i].size - 1] = '\n'; easily enough.
942 * In the default case, we can do this conversion quicker than the user can, as we already have the index and pointer.
943 * Let's make it easy on them to use these as standard C strings.
944 *
945 * onefang is proud to announce that he has just set a new personal record for the
946 * most over documentation of a simple assignment statement. B-)
947 */
948 inbuf[i] = '\0';
949 e->lines[count].line = c;
950 e->lines[count].size = i - last;
951 last = i + 1;
952 c = (char *)&inbuf[last];
953 count++;
954 }
955 }
956 if (i > last) /* Partial line left over, save it for next time. */
957 {
958 if (count != 0) e->size = last;
959 if (flags & ECORE_EXE_PIPE_READ)
960 {
961 exe->read_data_size = i - last;
962 exe->read_data_buf = malloc(exe->read_data_size);
963 memcpy(exe->read_data_buf, c, exe->read_data_size);
964 }
965 else
966 {
967 exe->error_data_size = i - last;
968 exe->error_data_buf = malloc(exe->error_data_size);
969 memcpy(exe->error_data_buf, c, exe->error_data_size);
970 }
971 }
972 if (count == 0) /* No lines to send, cancel the event. */
973 {
974 _ecore_exe_event_exe_data_free(NULL, e);
975 e = NULL;
976 }
977 else /* NULL terminate the array, so that people know where the end is. */
978 {
979 e->lines[count].line = NULL;
980 e->lines[count].size = 0;
981 }
982 }
983 }
984
985 return e;
986}
987
988/**
989 * Sets the string tag for the given process handle
990 *
991 * @param exe The given process handle.
992 * @param tag The string tag to set on the process handle.
993 */
994EAPI void
995ecore_exe_tag_set(Ecore_Exe *exe,
996 const char *tag)
997{
998 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
999 {
1000 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_set");
1001 return;
1002 }
1003 IF_FREE(exe->tag);
1004 if (tag)
1005 exe->tag = strdup(tag);
1006 else
1007 exe->tag = NULL;
1008}
1009
1010/**
1011 * Retrieves the tag attached to the given process handle. There is no need to
1012 * free it as it just returns the internal pointer value. This value is only
1013 * valid as long as the @p exe is valid or until the tag is set to something
1014 * else on this @p exe.
1015 *
1016 * @param exe The given process handle.
1017 * @return The string attached to @p exe. It is a handle to existing
1018 * internal string and should not be modified, use
1019 * ecore_exe_tag_set() to change it. It might be @c NULL.
1020 */
1021EAPI const char *
1022ecore_exe_tag_get(const Ecore_Exe *exe)
1023{
1024 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1025 {
1026 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_get");
1027 return NULL;
1028 }
1029 return exe->tag;
1030}
1031
1032/**
1033 * Frees the given process handle.
1034 *
1035 * Note that the process that the handle represents is unaffected by this
1036 * function.
1037 *
1038 * @param exe The given process handle.
1039 * @return The data attached to the handle when @ref ecore_exe_run was
1040 * called.
1041 */
1042EAPI void *
1043ecore_exe_free(Ecore_Exe *exe)
1044{
1045 void *data;
1046 int ok = 0;
1047 int result;
1048
1049 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1050 {
1051 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_free");
1052 return NULL;
1053 }
1054
1055 data = exe->data;
1056
1057 if (exe->pre_free_cb)
1058 exe->pre_free_cb(data, exe);
1059
1060 if (exe->doomsday_clock)
1061 {
1062 struct _ecore_exe_dead_exe *dead;
1063
1064 ecore_timer_del(exe->doomsday_clock);
1065 exe->doomsday_clock = NULL;
1066 dead = exe->doomsday_clock_dead;
1067 if (dead)
1068 {
1069 IF_FREE(dead->cmd);
1070 free(dead);
1071 exe->doomsday_clock_dead = NULL;
1072 }
1073 }
1074 IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler);
1075 IF_FN_DEL(ecore_main_fd_handler_del, exe->read_fd_handler);
1076 IF_FN_DEL(ecore_main_fd_handler_del, exe->error_fd_handler);
1077 if (exe->child_fd_write_x != -1)
1078 E_NO_ERRNO(result, close(exe->child_fd_write_x), ok);
1079 if (exe->child_fd_read_x != -1)
1080 E_NO_ERRNO(result, close(exe->child_fd_read_x), ok);
1081 if (exe->child_fd_error_x != -1)
1082 E_NO_ERRNO(result, close(exe->child_fd_error_x), ok);
1083 if (exe->child_fd_write != -1)
1084 E_NO_ERRNO(result, close(exe->child_fd_write), ok);
1085 if (exe->child_fd_read != -1)
1086 E_NO_ERRNO(result, close(exe->child_fd_read), ok);
1087 if (exe->child_fd_error != -1)
1088 E_NO_ERRNO(result, close(exe->child_fd_error), ok);
1089 IF_FREE(exe->write_data_buf);
1090 IF_FREE(exe->read_data_buf);
1091 IF_FREE(exe->error_data_buf);
1092 IF_FREE(exe->cmd);
1093
1094 exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
1095 ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
1096 IF_FREE(exe->tag);
1097 free(exe);
1098 return data;
1099}
1100
1101/**
1102 * Frees the given event data.
1103 *
1104 * @param e The given event data.
1105 */
1106EAPI void
1107ecore_exe_event_data_free(Ecore_Exe_Event_Data *e)
1108{
1109 if (!e) return;
1110 IF_FREE(e->lines);
1111 IF_FREE(e->data);
1112 free(e);
1113}
1114
1115/**
1116 * Retrieves the process ID of the given spawned process.
1117 * @param exe Handle to the given spawned process.
1118 * @return The process ID on success. @c -1 otherwise.
1119 */
1120EAPI pid_t
1121ecore_exe_pid_get(const Ecore_Exe *exe)
1122{
1123 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1124 {
1125 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pid_get");
1126 return -1;
1127 }
1128 return exe->pid;
1129}
1130
1131/**
1132 * Retrieves the command of the given spawned process.
1133 * @param exe Handle to the given spawned process.
1134 * @return The command on success. NULL otherwise. This string is the
1135 * pointer to the internal value and must not be modified in
1136 * any way.
1137 */
1138EAPI const char *
1139ecore_exe_cmd_get(const Ecore_Exe *exe)
1140{
1141 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1142 {
1143 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_cmd_get");
1144 return NULL;
1145 }
1146 return exe->cmd;
1147}
1148
1149/**
1150 * Retrieves the data attached to the given process handle.
1151 * @param exe The given process handle.
1152 * @return The data pointer attached to @p exe Given to
1153 * ecore_exe_run() or ecore_exe_pipe_run()
1154 */
1155EAPI void *
1156ecore_exe_data_get(const Ecore_Exe *exe)
1157{
1158 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1159 {
1160 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get");
1161 return NULL;
1162 }
1163 return exe->data;
1164}
1165
1166/**
1167 * Sets the data attached to the given process handle.
1168 * @param exe The given process handle.
1169 * @param data The pointer to attach
1170 * @return The data pointer previously attached to @p exe with
1171 * ecore_exe_run(), ecore_exe_pipe_run(), or ecore_exe_data_set()
1172 * @since 1.1
1173 */
1174EAPI void *
1175ecore_exe_data_set(Ecore_Exe *exe,
1176 void *data)
1177{
1178 void *ret;
1179 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1180 {
1181 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, __func__);
1182 return NULL;
1183 }
1184 ret = exe->data;
1185 exe->data = data;
1186 return ret;
1187}
1188
1189/**
1190 * Retrieves the flags attached to the given process handle.
1191 * @param exe The given process handle.
1192 * @return The flags attached to @p exe.
1193 */
1194EAPI Ecore_Exe_Flags
1195ecore_exe_flags_get(const Ecore_Exe *exe)
1196{
1197 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1198 {
1199 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get");
1200 return 0;
1201 }
1202 return exe->flags;
1203}
1204
1205/**
1206 * Pauses the given process by sending it a @c SIGSTOP signal.
1207 * @param exe Process handle to the given process.
1208 */
1209EAPI void
1210ecore_exe_pause(Ecore_Exe *exe)
1211{
1212 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1213 {
1214 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pause");
1215 return;
1216 }
1217 kill(exe->pid, SIGSTOP);
1218}
1219
1220/**
1221 * Continues the given paused process by sending it a @c SIGCONT signal.
1222 * @param exe Process handle to the given process.
1223 */
1224EAPI void
1225ecore_exe_continue(Ecore_Exe *exe)
1226{
1227 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1228 {
1229 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_continue");
1230 return;
1231 }
1232 kill(exe->pid, SIGCONT);
1233}
1234
1235/**
1236 * Sends the given spawned process a interrupt (@c SIGINT) signal.
1237 * @param exe Process handle to the given process.
1238 */
1239EAPI void
1240ecore_exe_interrupt(Ecore_Exe *exe)
1241{
1242 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1243 {
1244 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_interrupt");
1245 return;
1246 }
1247 _ecore_exe_dead_attach(exe);
1248 kill(exe->pid, SIGINT);
1249}
1250
1251/**
1252 * Sends the given spawned process a quit (@c SIGQUIT) signal.
1253 * @param exe Process handle to the given process.
1254 */
1255EAPI void
1256ecore_exe_quit(Ecore_Exe *exe)
1257{
1258 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1259 {
1260 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_quit");
1261 return;
1262 }
1263 _ecore_exe_dead_attach(exe);
1264 kill(exe->pid, SIGQUIT);
1265}
1266
1267/**
1268 * Sends the given spawned process a terminate (@c SIGTERM) signal.
1269 * @param exe Process handle to the given process.
1270 */
1271EAPI void
1272ecore_exe_terminate(Ecore_Exe *exe)
1273{
1274 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1275 {
1276 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_terminate");
1277 return;
1278 }
1279 _ecore_exe_dead_attach(exe);
1280 INF("Sending TERM signal to %s (%d).", exe->cmd, exe->pid);
1281 kill(exe->pid, SIGTERM);
1282}
1283
1284/**
1285 * Kills the given spawned process by sending it a @c SIGKILL signal.
1286 * @param exe Process handle to the given process.
1287 */
1288EAPI void
1289ecore_exe_kill(Ecore_Exe *exe)
1290{
1291 struct _ecore_exe_dead_exe *dead;
1292
1293 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1294 {
1295 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_kill");
1296 return;
1297 }
1298
1299 dead = calloc(1, sizeof(struct _ecore_exe_dead_exe));
1300 if (dead)
1301 {
1302 dead->pid = exe->pid;
1303 dead->cmd = strdup(exe->cmd);
1304 IF_FN_DEL(ecore_timer_del, exe->doomsday_clock);
1305 exe->doomsday_clock =
1306 ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead, dead);
1307 }
1308
1309 INF("Sending KILL signal to %s (%d).", exe->cmd, exe->pid);
1310 kill(exe->pid, SIGKILL);
1311}
1312
1313/**
1314 * Sends a @c SIGUSR signal to the given spawned process.
1315 * @param exe Process handle to the given process.
1316 * @param num The number user signal to send. Must be either 1 or 2, or
1317 * the signal will be ignored.
1318 */
1319EAPI void
1320ecore_exe_signal(Ecore_Exe *exe,
1321 int num)
1322{
1323 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1324 {
1325 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_signal");
1326 return;
1327 }
1328 if (num == 1)
1329 kill(exe->pid, SIGUSR1);
1330 else if (num == 2)
1331 kill(exe->pid, SIGUSR2);
1332}
1333
1334/**
1335 * Sends a @c SIGHUP signal to the given spawned process.
1336 * @param exe Process handle to the given process.
1337 */
1338EAPI void
1339ecore_exe_hup(Ecore_Exe *exe)
1340{
1341 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1342 {
1343 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_hup");
1344 return;
1345 }
1346 kill(exe->pid, SIGHUP);
1347}
1348
1349/**
1350 * @}
1351 */
1352
1353static Ecore_Exe *
1354_ecore_exe_is_it_alive(pid_t pid)
1355{
1356 Ecore_Exe *exe = NULL;
1357
1358 /* FIXME: There is no nice, safe, OS independent way to tell if a
1359 * particular PID is still alive. I have written code to do so
1360 * for my urunlevel busybox applet (http://urunlevel.sourceforge.net/),
1361 * but it's for linux only, and still not guaranteed.
1362 *
1363 * So for now, we just check that a valid Ecore_Exe structure
1364 * exists for it. Even that is not a guarantee, as the structure
1365 * can be freed without killing the process.
1366 *
1367 * I think we can safely put exe's into two categories, those users
1368 * that care about the life of the exe, and the run and forget type.
1369 * The run and forget type starts up the exe, then free's the
1370 * Ecore_Exe structure straight away. They can never call any of
1371 * the functions that can call this, so we don't worry about them.
1372 *
1373 * Those user's that care about the life of exe's will keep the
1374 * Ecore_Exe structure around, terminate them eventually, or
1375 * register for exit events. For these ones the assumption
1376 * that valid Ecore_Exe struct == live exe is almost valid.
1377 *
1378 * I will probably copy my urunlevel code into here someday.
1379 */
1380 exe = _ecore_exe_find(pid);
1381 if (exe)
1382 {
1383 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
1384 exe = NULL;
1385 }
1386
1387 return exe;
1388}
1389
1390static Eina_Bool
1391_ecore_exe_make_sure_its_dead(void *data)
1392{
1393 struct _ecore_exe_dead_exe *dead;
1394
1395 dead = data;
1396 if (dead)
1397 {
1398 Ecore_Exe *exe = NULL;
1399
1400 if ((exe = _ecore_exe_is_it_alive(dead->pid)))
1401 {
1402 if (dead->cmd)
1403 INF("Sending KILL signal to allegedly dead %s (%d).",
1404 dead->cmd, dead->pid);
1405 else
1406 INF("Sending KILL signal to allegedly dead PID %d.",
1407 dead->pid);
1408 exe->doomsday_clock =
1409 ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead,
1410 dead);
1411 kill(dead->pid, SIGKILL);
1412 }
1413 else
1414 {
1415 IF_FREE(dead->cmd);
1416 free(dead);
1417 }
1418 }
1419 return ECORE_CALLBACK_CANCEL;
1420}
1421
1422static Eina_Bool
1423_ecore_exe_make_sure_its_really_dead(void *data)
1424{
1425 struct _ecore_exe_dead_exe *dead;
1426
1427 dead = data;
1428 if (dead)
1429 {
1430 Ecore_Exe *exe = NULL;
1431
1432 if ((exe = _ecore_exe_is_it_alive(dead->pid)))
1433 {
1434 ERR("RUN! The zombie wants to eat your brains! And your CPU!");
1435 if (dead->cmd)
1436 INF("%s (%d) is not really dead.", dead->cmd, dead->pid);
1437 else
1438 INF("PID %d is not really dead.", dead->pid);
1439 exe->doomsday_clock = NULL;
1440 }
1441 IF_FREE(dead->cmd);
1442 free(dead);
1443 }
1444 return ECORE_CALLBACK_CANCEL;
1445}
1446
1447void
1448_ecore_exe_init(void)
1449{
1450 ECORE_EXE_EVENT_ADD = ecore_event_type_new();
1451 ECORE_EXE_EVENT_DEL = ecore_event_type_new();
1452 ECORE_EXE_EVENT_DATA = ecore_event_type_new();
1453 ECORE_EXE_EVENT_ERROR = ecore_event_type_new();
1454}
1455
1456void
1457_ecore_exe_shutdown(void)
1458{
1459 while (exes)
1460 ecore_exe_free(exes);
1461}
1462
1463Ecore_Exe *
1464_ecore_exe_find(pid_t pid)
1465{
1466 Ecore_Exe *exe;
1467
1468 EINA_INLIST_FOREACH(exes, exe)
1469 {
1470 if (exe->pid == pid)
1471 return exe;
1472 }
1473 return NULL;
1474}
1475
1476Ecore_Timer *
1477_ecore_exe_doomsday_clock_get(Ecore_Exe *exe)
1478{
1479 return exe->doomsday_clock;
1480}
1481
1482void
1483_ecore_exe_doomsday_clock_set(Ecore_Exe *exe,
1484 Ecore_Timer *dc)
1485{
1486 exe->doomsday_clock = dc;
1487}
1488
1489static inline void
1490_ecore_exe_exec_it(const char *exe_cmd,
1491 Ecore_Exe_Flags flags)
1492{
1493 char use_sh = 1;
1494 char *buf = NULL;
1495 char **args = NULL;
1496 int save_errno = 0;
1497
1498 /* So what is this doing?
1499 *
1500 * We are trying to avoid wrapping the exe call with /bin/sh -c.
1501 * We conservatively search for certain shell meta characters,
1502 * If we don't find them, we can call the exe directly.
1503 */
1504 if (!strpbrk(exe_cmd, "|&;<>()$`\\\"'*?#"))
1505 {
1506 char *token;
1507 char pre_command = 1;
1508 int num_tokens = 0;
1509
1510 if (!(buf = strdup(exe_cmd)))
1511 return;
1512
1513 token = strtok(buf, " \t\n\v");
1514 while (token)
1515 {
1516 if (token[0] == '~')
1517 break;
1518 if (pre_command)
1519 {
1520 if (token[0] == '[')
1521 break;
1522 if (strchr(token, '='))
1523 break;
1524 else
1525 pre_command = 0;
1526 }
1527 num_tokens++;
1528 token = strtok(NULL, " \t\n\v");
1529 }
1530 IF_FREE(buf);
1531 if ((!token) && (num_tokens))
1532 {
1533 int i = 0;
1534
1535 if (!(buf = strdup(exe_cmd)))
1536 return;
1537
1538 token = strtok(buf, " \t\n\v");
1539 use_sh = 0;
1540 if (!(args = (char **)calloc(num_tokens + 1, sizeof(char *))))
1541 {
1542 IF_FREE(buf);
1543 return;
1544 }
1545 for (i = 0; i < num_tokens; i++)
1546 {
1547 if (token)
1548 args[i] = token;
1549 token = strtok(NULL, " \t\n\v");
1550 }
1551 args[num_tokens] = NULL;
1552 }
1553 }
1554
1555#ifdef HAVE_SYS_PRCTL_H
1556 if ((flags & ECORE_EXE_TERM_WITH_PARENT))
1557 {
1558 prctl(PR_SET_PDEATHSIG, SIGTERM);
1559 }
1560#endif
1561
1562 if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
1563 if ((flags & ECORE_EXE_USE_SH))
1564 {
1565 errno = 0;
1566 execl("/bin/sh", "/bin/sh", "-c", exe_cmd, (char *)NULL);
1567 }
1568 else if (use_sh) /* We have to use a shell to run this. */
1569 {
1570 if (!shell) /* Find users preferred shell. */
1571 {
1572 shell = getenv("SHELL");
1573 if (!shell)
1574 shell = "/bin/sh";
1575 }
1576 errno = 0;
1577 execl(shell, shell, "-c", exe_cmd, (char *)NULL);
1578 }
1579 else
1580 { /* We can run this directly. */
1581 if (!args)
1582 {
1583 IF_FREE(buf);
1584 IF_FREE(args);
1585 ERR("arg[0] is NULL!");
1586 return;
1587 }
1588 errno = 0;
1589 execvp(args[0], args);
1590 }
1591
1592 save_errno = errno;
1593 IF_FREE(buf);
1594 IF_FREE(args);
1595 errno = save_errno;
1596 return;
1597}
1598
1599static Eina_Bool
1600_ecore_exe_data_generic_handler(void *data,
1601 Ecore_Fd_Handler *fd_handler,
1602 Ecore_Exe_Flags flags)
1603{
1604 Ecore_Exe *exe;
1605 int child_fd;
1606 int event_type;
1607
1608 exe = data;
1609
1610 /* Sort out what sort of handler we are. */
1611 if (flags & ECORE_EXE_PIPE_READ)
1612 {
1613 flags = ECORE_EXE_PIPE_READ;
1614 event_type = ECORE_EXE_EVENT_DATA;
1615 child_fd = exe->child_fd_read;
1616 }
1617 else
1618 {
1619 flags = ECORE_EXE_PIPE_ERROR;
1620 event_type = ECORE_EXE_EVENT_ERROR;
1621 child_fd = exe->child_fd_error;
1622 }
1623
1624 if ((fd_handler)
1625 && (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)))
1626 {
1627 unsigned char *inbuf;
1628 int inbuf_num;
1629
1630 /* Get any left over data from last time. */
1631 if (flags & ECORE_EXE_PIPE_READ)
1632 {
1633 inbuf = exe->read_data_buf;
1634 inbuf_num = exe->read_data_size;
1635 exe->read_data_buf = NULL;
1636 exe->read_data_size = 0;
1637 }
1638 else
1639 {
1640 inbuf = exe->error_data_buf;
1641 inbuf_num = exe->error_data_size;
1642 exe->error_data_buf = NULL;
1643 exe->error_data_size = 0;
1644 }
1645
1646 for (;; )
1647 {
1648 int num, lost_exe;
1649 char buf[READBUFSIZ];
1650
1651 lost_exe = 0;
1652 errno = 0;
1653 if ((num = read(child_fd, buf, READBUFSIZ)) < 1)
1654 {
1655 /* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE
1656 * (currently 64k) to inbuf, use that instead of buf, and
1657 * save ourselves a memcpy(). */
1658 lost_exe = ((errno == EIO) ||
1659 (errno == EBADF) ||
1660 (errno == EPIPE) ||
1661 (errno == EINVAL) || (errno == ENOSPC));
1662 if ((errno != EAGAIN) && (errno != EINTR))
1663 perror("_ecore_exe_generic_handler() read problem ");
1664 }
1665 if (num > 0) /* data got read. */
1666 {
1667 inbuf = realloc(inbuf, inbuf_num + num);
1668 memcpy(inbuf + inbuf_num, buf, num);
1669 inbuf_num += num;
1670 }
1671 else
1672 { /* No more data to read. */
1673 if (inbuf)
1674 {
1675 Ecore_Exe_Event_Data *e;
1676
1677 /* Stash the data away for later. */
1678 if (flags & ECORE_EXE_PIPE_READ)
1679 {
1680 exe->read_data_buf = inbuf;
1681 exe->read_data_size = inbuf_num;
1682 }
1683 else
1684 {
1685 exe->error_data_buf = inbuf;
1686 exe->error_data_size = inbuf_num;
1687 }
1688
1689 if (!(exe->flags & ECORE_EXE_PIPE_AUTO))
1690 {
1691 e = ecore_exe_event_data_get(exe, flags);
1692 if (e) /* Send the event. */
1693 ecore_event_add(event_type, e,
1694 _ecore_exe_event_exe_data_free,
1695 NULL);
1696 }
1697 }
1698 if (lost_exe)
1699 {
1700 if (flags & ECORE_EXE_PIPE_READ)
1701 {
1702 if (exe->read_data_size)
1703 INF("There are %d bytes left unsent from the dead exe %s.",
1704 exe->read_data_size, exe->cmd);
1705 }
1706 else
1707 {
1708 if (exe->error_data_size)
1709 INF("There are %d bytes left unsent from the dead exe %s.",
1710 exe->error_data_size, exe->cmd);
1711 }
1712 /* Thought about this a bit. If the exe has actually
1713 * died, this won't do any harm as it must have died
1714 * recently and the pid has not had a chance to recycle.
1715 * It is also a paranoid catchall, coz the usual ecore_signal
1716 * mechenism should kick in. But let's give it a good
1717 * kick in the head anyway.
1718 */
1719 ecore_exe_terminate(exe);
1720 }
1721 break;
1722 }
1723 }
1724 }
1725
1726 return ECORE_CALLBACK_RENEW;
1727}
1728
1729static Eina_Bool
1730_ecore_exe_data_error_handler(void *data,
1731 Ecore_Fd_Handler *fd_handler)
1732{
1733 return _ecore_exe_data_generic_handler(data, fd_handler,
1734 ECORE_EXE_PIPE_ERROR);
1735}
1736
1737static Eina_Bool
1738_ecore_exe_data_read_handler(void *data,
1739 Ecore_Fd_Handler *fd_handler)
1740{
1741 return _ecore_exe_data_generic_handler(data, fd_handler,
1742 ECORE_EXE_PIPE_READ);
1743}
1744
1745static Eina_Bool
1746_ecore_exe_data_write_handler(void *data,
1747 Ecore_Fd_Handler *fd_handler __UNUSED__)
1748{
1749 Ecore_Exe *exe;
1750
1751 exe = data;
1752 if ((exe->write_fd_handler) &&
1753 (ecore_main_fd_handler_active_get
1754 (exe->write_fd_handler, ECORE_FD_WRITE)))
1755 _ecore_exe_flush(exe);
1756
1757 /* If we have sent all there is to send, and we need to close the pipe, then close it. */
1758 if ((exe->close_stdin == 1)
1759 && (exe->write_data_size == exe->write_data_offset))
1760 {
1761 int ok = 0;
1762 int result;
1763
1764 INF("Closing stdin for %s", exe->cmd);
1765 /* 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. */
1766 IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler);
1767 if (exe->child_fd_write != -1)
1768 E_NO_ERRNO(result, close(exe->child_fd_write), ok);
1769 exe->child_fd_write = -1;
1770 IF_FREE(exe->write_data_buf);
1771 }
1772
1773 return ECORE_CALLBACK_RENEW;
1774}
1775
1776static void
1777_ecore_exe_flush(Ecore_Exe *exe)
1778{
1779 int count;
1780
1781 /* check whether we need to write anything at all. */
1782 if ((exe->child_fd_write == -1) || (!exe->write_data_buf))
1783 return;
1784 if (exe->write_data_size == exe->write_data_offset)
1785 return;
1786
1787 count = write(exe->child_fd_write,
1788 (char *)exe->write_data_buf + exe->write_data_offset,
1789 exe->write_data_size - exe->write_data_offset);
1790 if (count < 1)
1791 {
1792 if (errno == EIO || errno == EBADF || errno == EPIPE || errno == EINVAL || errno == ENOSPC) /* we lost our exe! */
1793 {
1794 ecore_exe_terminate(exe);
1795 if (exe->write_fd_handler)
1796 ecore_main_fd_handler_active_set(exe->write_fd_handler, 0);
1797 }
1798 }
1799 else
1800 {
1801 exe->write_data_offset += count;
1802 if (exe->write_data_offset >= exe->write_data_size) /* Nothing left to write, clean up. */
1803 {
1804 exe->write_data_size = 0;
1805 exe->write_data_offset = 0;
1806 IF_FREE(exe->write_data_buf);
1807 if (exe->write_fd_handler)
1808 ecore_main_fd_handler_active_set(exe->write_fd_handler, 0);
1809 }
1810 }
1811}
1812
1813static void
1814_ecore_exe_event_exe_data_free(void *data __UNUSED__,
1815 void *ev)
1816{
1817 Ecore_Exe_Event_Data *e;
1818
1819 e = ev;
1820 ecore_exe_event_data_free(e);
1821}
1822
1823static Ecore_Exe_Event_Add *
1824_ecore_exe_event_add_new(void)
1825{
1826 Ecore_Exe_Event_Add *e;
1827
1828 e = calloc(1, sizeof(Ecore_Exe_Event_Add));
1829 return e;
1830}
1831
1832static void
1833_ecore_exe_event_add_free(void *data __UNUSED__,
1834 void *ev)
1835{
1836 Ecore_Exe_Event_Add *e;
1837
1838 e = ev;
1839 free(e);
1840}
1841
1842void *
1843_ecore_exe_event_del_new(void)
1844{
1845 Ecore_Exe_Event_Del *e;
1846
1847 e = calloc(1, sizeof(Ecore_Exe_Event_Del));
1848 return e;
1849}
1850
1851void
1852_ecore_exe_event_del_free(void *data __UNUSED__,
1853 void *ev)
1854{
1855 Ecore_Exe_Event_Del *e;
1856
1857 e = ev;
1858 if (e->exe)
1859 ecore_exe_free(e->exe);
1860 free(e);
1861}
1862
1863static void
1864_ecore_exe_dead_attach(Ecore_Exe *exe)
1865{
1866 struct _ecore_exe_dead_exe *dead;
1867
1868 if (exe->doomsday_clock_dead) return;
1869 dead = calloc(1, sizeof(struct _ecore_exe_dead_exe));
1870 if (dead)
1871 {
1872 dead->pid = exe->pid;
1873 dead->cmd = strdup(exe->cmd);
1874 IF_FN_DEL(ecore_timer_del, exe->doomsday_clock);
1875 exe->doomsday_clock =
1876 ecore_timer_add(10.0, _ecore_exe_make_sure_its_dead, dead);
1877 exe->doomsday_clock_dead = dead;
1878 }
1879}
1880
diff --git a/libraries/ecore/src/lib/ecore/ecore_exe_ps3.c b/libraries/ecore/src/lib/ecore/ecore_exe_ps3.c
deleted file mode 100644
index 1ef1e81..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_exe_ps3.c
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef HAVE_ESCAPE
6# include <Escape.h>
7#endif
8
9#include "Ecore.h"
10#include "ecore_private.h"
11
12void
13_ecore_exe_init(void)
14{
15}
16
17void
18_ecore_exe_shutdown(void)
19{
20}
diff --git a/libraries/ecore/src/lib/ecore/ecore_exe_win32.c b/libraries/ecore/src/lib/ecore/ecore_exe_win32.c
deleted file mode 100644
index 1f5cb4e..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_exe_win32.c
+++ /dev/null
@@ -1,1055 +0,0 @@
1/*
2 * TODO:
3 * - manage I/O pipes (several ones, and stdin)
4 * - manage SetConsoleCtrlHandler ?
5 * - the child process seems to still run after the DEL event
6 * - add log messages
7 */
8
9#ifdef HAVE_CONFIG_H
10# include <config.h>
11#endif
12
13#ifdef HAVE_EVIL
14# include <Evil.h>
15#endif
16
17#include "Ecore.h"
18#include "ecore_private.h"
19
20#define WIN32_LEAN_AND_MEAN
21#include <windows.h>
22#undef WIN32_LEAN_AND_MEAN
23#include <process.h>
24
25#define ECORE_EXE_WIN32_TIMEOUT 3000
26
27typedef enum
28{
29 ECORE_EXE_WIN32_SIGINT,
30 ECORE_EXE_WIN32_SIGQUIT,
31 ECORE_EXE_WIN32_SIGTERM,
32 ECORE_EXE_WIN32_SIGKILL
33} Ecore_Exe_Win32_Signal;
34
35struct _Ecore_Exe
36{
37 EINA_INLIST;
38 ECORE_MAGIC;
39
40 HANDLE process2;
41 HANDLE process; /* CloseHandle */
42 HANDLE process_thread;
43 DWORD process_id;
44 DWORD thread_id;
45 void *data;
46 char *tag;
47 char *cmd;
48 Ecore_Exe_Flags flags;
49 Ecore_Exe_Win32_Signal sig;
50 Ecore_Win32_Handler *h_close;
51 struct
52 {
53 HANDLE child_pipe;
54 HANDLE child_pipe_x;
55 Ecore_Pipe *p;
56 HANDLE thread;
57 void *data_buf;
58 int data_size;
59 } pipe_read;
60 struct
61 {
62 HANDLE child_pipe;
63 HANDLE child_pipe_x;
64 HANDLE thread;
65 Ecore_Win32_Handler *h;
66 void *data_buf;
67 int data_size;
68 } pipe_write;
69 struct
70 {
71 HANDLE child_pipe;
72 HANDLE child_pipe_x;
73 Ecore_Pipe *p;
74 HANDLE thread;
75 void *data_buf;
76 int data_size;
77 } pipe_error;
78 Eina_Bool close_stdin : 1;
79 Eina_Bool is_suspended : 1;
80
81 Ecore_Exe_Cb pre_free_cb;
82};
83
84static Ecore_Exe *exes = NULL;
85
86static int _ecore_exe_win32_pipes_set(Ecore_Exe *exe);
87static void _ecore_exe_win32_pipes_close(Ecore_Exe *exe);
88
89static BOOL CALLBACK _ecore_exe_enum_windows_procedure(HWND window,
90 LPARAM data);
91static void _ecore_exe_event_add_free(void *data,
92 void *ev);
93static void _ecore_exe_event_del_free(void *data,
94 void *ev);
95static void _ecore_exe_event_exe_data_free(void *data,
96 void *ev);
97static int _ecore_exe_win32_pipe_thread_generic_cb(void *data,
98 Ecore_Exe_Flags flags);
99static DWORD WINAPI _ecore_exe_win32_pipe_thread_read_cb(void *data);
100static DWORD WINAPI _ecore_exe_win32_pipe_thread_error_cb(void *data);
101static Eina_Bool _ecore_exe_close_cb(void *data,
102 Ecore_Win32_Handler *wh);
103static void _ecore_exe_pipe_read_cb(void *data,
104 void *buf,
105 unsigned int size);
106static int _ecore_exe_pipe_write_cb(void *data,
107 Ecore_Win32_Handler *wh);
108static void _ecore_exe_pipe_error_cb(void *data,
109 void *buf,
110 unsigned int size);
111
112EAPI int ECORE_EXE_EVENT_ADD = 0;
113EAPI int ECORE_EXE_EVENT_DEL = 0;
114EAPI int ECORE_EXE_EVENT_DATA = 0;
115EAPI int ECORE_EXE_EVENT_ERROR = 0;
116
117void
118_ecore_exe_init(void)
119{
120 ECORE_EXE_EVENT_ADD = ecore_event_type_new();
121 ECORE_EXE_EVENT_DEL = ecore_event_type_new();
122 ECORE_EXE_EVENT_DATA = ecore_event_type_new();
123 ECORE_EXE_EVENT_ERROR = ecore_event_type_new();
124}
125
126void
127_ecore_exe_shutdown(void)
128{
129 while (exes)
130 ecore_exe_free(exes);
131}
132
133static int run_pri = NORMAL_PRIORITY_CLASS;
134
135EAPI void
136ecore_exe_run_priority_set(int pri)
137{
138 switch (pri)
139 {
140 case ECORE_EXE_WIN32_PRIORITY_IDLE:
141 run_pri = IDLE_PRIORITY_CLASS;
142 break;
143
144 case ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL:
145 run_pri = BELOW_NORMAL_PRIORITY_CLASS;
146 break;
147
148 case ECORE_EXE_WIN32_PRIORITY_NORMAL:
149 run_pri = NORMAL_PRIORITY_CLASS;
150 break;
151
152 case ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL:
153 run_pri = ABOVE_NORMAL_PRIORITY_CLASS;
154 break;
155
156 case ECORE_EXE_WIN32_PRIORITY_HIGH:
157 run_pri = HIGH_PRIORITY_CLASS;
158 break;
159
160 case ECORE_EXE_WIN32_PRIORITY_REALTIME:
161 run_pri = REALTIME_PRIORITY_CLASS;
162 break;
163
164 default:
165 break;
166 }
167}
168
169EAPI int
170ecore_exe_run_priority_get(void)
171{
172 switch (run_pri)
173 {
174 case IDLE_PRIORITY_CLASS:
175 return ECORE_EXE_WIN32_PRIORITY_IDLE;
176
177 case BELOW_NORMAL_PRIORITY_CLASS:
178 return ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL;
179
180 case NORMAL_PRIORITY_CLASS:
181 return ECORE_EXE_WIN32_PRIORITY_NORMAL;
182
183 case ABOVE_NORMAL_PRIORITY_CLASS:
184 return ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL;
185
186 case HIGH_PRIORITY_CLASS:
187 return ECORE_EXE_WIN32_PRIORITY_HIGH;
188
189 case REALTIME_PRIORITY_CLASS:
190 return ECORE_EXE_WIN32_PRIORITY_REALTIME;
191
192 /* default should not be reached */
193 default:
194 return ECORE_EXE_WIN32_PRIORITY_NORMAL;
195 }
196}
197
198EAPI Ecore_Exe *
199ecore_exe_run(const char *exe_cmd,
200 const void *data)
201{
202 return ecore_exe_pipe_run(exe_cmd, 0, data);
203}
204
205EAPI Ecore_Exe *
206ecore_exe_pipe_run(const char *exe_cmd,
207 Ecore_Exe_Flags flags,
208 const void *data)
209{
210 STARTUPINFO si;
211 PROCESS_INFORMATION pi;
212 Ecore_Exe_Event_Add *e;
213 Ecore_Exe *exe;
214 char *ret = NULL;
215
216 exe = calloc(1, sizeof(Ecore_Exe));
217 if (!exe)
218 return NULL;
219
220 if ((flags & ECORE_EXE_PIPE_AUTO) && (!(flags & ECORE_EXE_PIPE_ERROR))
221 && (!(flags & ECORE_EXE_PIPE_READ)))
222 /* We need something to auto pipe. */
223 flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR;
224
225 exe->flags = flags;
226 if (exe->flags & ECORE_EXE_PIPE_READ)
227 if (!_ecore_exe_win32_pipes_set(exe))
228 goto free_exe;
229
230 if (exe->flags & ECORE_EXE_PIPE_WRITE)
231 if (!_ecore_exe_win32_pipes_set(exe))
232 goto close_pipes;
233
234 if (exe->flags & ECORE_EXE_PIPE_ERROR)
235 if (!_ecore_exe_win32_pipes_set(exe))
236 goto close_pipes;
237
238 if ((exe->flags & ECORE_EXE_USE_SH) ||
239 ((ret = strrstr(exe_cmd, ".bat")) && (ret[4] == '\0')))
240 {
241 char buf[PATH_MAX];
242 snprintf(buf, PATH_MAX, "cmd.exe /c %s", exe_cmd);
243 exe->cmd = strdup(buf);
244 }
245 else
246 exe->cmd = strdup(exe_cmd);
247
248 if (!exe->cmd)
249 goto close_pipes;
250
251 ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
252
253 ZeroMemory(&si, sizeof(STARTUPINFO));
254 si.cb = sizeof(STARTUPINFO);
255 si.hStdOutput = exe->pipe_read.child_pipe_x;
256 si.hStdInput = exe->pipe_write.child_pipe;
257 si.hStdError = exe->pipe_error.child_pipe_x;
258 si.dwFlags |= STARTF_USESTDHANDLES;
259
260 /* FIXME: gerer la priorite */
261
262 if (!CreateProcess(NULL, exe->cmd, NULL, NULL, EINA_TRUE,
263 run_pri | CREATE_SUSPENDED, NULL, NULL, &si, &pi))
264 goto free_exe_cmd;
265
266 /* be sure that the child process is running */
267 /* FIXME: This does not work if the child is an EFL-based app */
268 /* if (WaitForInputIdle(pi.hProcess, INFINITE) == WAIT_FAILED) */
269 /* goto free_exe_cmd; */
270
271 ECORE_MAGIC_SET(exe, ECORE_MAGIC_EXE);
272 exe->process = pi.hProcess;
273 exe->process_thread = pi.hThread;
274 exe->process_id = pi.dwProcessId;
275 exe->thread_id = pi.dwThreadId;
276 exe->data = (void *)data;
277
278 if (!(exe->process2 = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_SUSPEND_RESUME | PROCESS_TERMINATE | SYNCHRONIZE,
279 EINA_FALSE, pi.dwProcessId)))
280 goto close_thread;
281
282 exe->h_close = ecore_main_win32_handler_add(exe->process2, _ecore_exe_close_cb, exe);
283 if (!exe->h_close) goto close_process2;
284
285 if (ResumeThread(exe->process_thread) == ((DWORD)-1))
286 goto close_process2;
287
288 exes = (Ecore_Exe *)eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
289
290 e = (Ecore_Exe_Event_Add *)calloc(1, sizeof(Ecore_Exe_Event_Add));
291 if (!e) goto delete_h_close;
292
293 e->exe = exe;
294 ecore_event_add(ECORE_EXE_EVENT_ADD, e,
295 _ecore_exe_event_add_free, NULL);
296
297 return exe;
298
299delete_h_close:
300 ecore_main_win32_handler_del(exe->h_close);
301close_process2:
302 CloseHandle(exe->process2);
303close_thread:
304 CloseHandle(exe->process_thread);
305 CloseHandle(exe->process);
306free_exe_cmd:
307 free(exe->cmd);
308close_pipes:
309 _ecore_exe_win32_pipes_close(exe);
310free_exe:
311 free(exe);
312 return NULL;
313}
314
315EAPI void
316ecore_exe_callback_pre_free_set(Ecore_Exe *exe,
317 Ecore_Exe_Cb func)
318{
319 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
320 {
321 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE,
322 "ecore_exe_callback_pre_free_set");
323 return;
324 }
325 exe->pre_free_cb = func;
326}
327
328EAPI Eina_Bool
329ecore_exe_send(Ecore_Exe *exe,
330 const void *data,
331 int size)
332{
333 void *buf;
334
335 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
336 {
337 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_send");
338 return 0;
339 }
340
341 if (exe->close_stdin)
342 {
343 ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p",
344 exe, size, data);
345 return 0;
346 }
347
348 if (!exe->pipe_write.child_pipe)
349 {
350 ERR("Ecore_Exe %p created without ECORE_EXE_PIPE_WRITE! "
351 "Cannot send %d bytes from %p", exe, size, data);
352 return 0;
353 }
354
355 buf = realloc(exe->pipe_write.data_buf, exe->pipe_write.data_size + size);
356 if (!buf) return 0;
357
358 exe->pipe_write.data_buf = buf;
359 memcpy((char *)exe->pipe_write.data_buf + exe->pipe_write.data_size, data, size);
360 exe->pipe_write.data_size += size;
361
362 /* if (exe->pipe_write.) */
363 /* ecore_main_fd_handler_active_set(exe->pipe_write.h, ECORE_FD_WRITE); */
364
365 return 1;
366}
367
368EAPI void
369ecore_exe_close_stdin(Ecore_Exe *exe)
370{
371 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
372 {
373 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_close_stdin");
374 return;
375 }
376 exe->close_stdin = 1;
377}
378
379/* Not used on Windows */
380EAPI void
381ecore_exe_auto_limits_set(Ecore_Exe *exe __UNUSED__,
382 int start_bytes __UNUSED__,
383 int end_bytes __UNUSED__,
384 int start_lines __UNUSED__,
385 int end_lines __UNUSED__)
386{
387}
388
389EAPI Ecore_Exe_Event_Data *
390ecore_exe_event_data_get(Ecore_Exe *exe,
391 Ecore_Exe_Flags flags)
392{
393 Ecore_Exe_Event_Data *e = NULL;
394 unsigned char *inbuf;
395 int inbuf_num;
396
397 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
398 {
399 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_event_data_get");
400 return NULL;
401 }
402
403 /* Sort out what sort of event we are, */
404 /* And get the data. */
405 if (flags & ECORE_EXE_PIPE_READ)
406 {
407 inbuf = exe->pipe_read.data_buf;
408 inbuf_num = exe->pipe_read.data_size;
409 exe->pipe_read.data_buf = NULL;
410 exe->pipe_read.data_size = 0;
411 }
412 else
413 {
414 inbuf = exe->pipe_error.data_buf;
415 inbuf_num = exe->pipe_error.data_size;
416 exe->pipe_error.data_buf = NULL;
417 exe->pipe_error.data_size = 0;
418 }
419
420 e = calloc(1, sizeof(Ecore_Exe_Event_Data));
421 if (e)
422 {
423 e->exe = exe;
424 e->data = inbuf;
425 e->size = inbuf_num;
426 }
427
428 return e;
429}
430
431EAPI void
432ecore_exe_event_data_free(Ecore_Exe_Event_Data *e)
433{
434 if (!e) return;
435 IF_FREE(e->lines);
436 IF_FREE(e->data);
437 free(e);
438}
439
440EAPI void *
441ecore_exe_free(Ecore_Exe *exe)
442{
443 void *data;
444
445 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
446 {
447 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_free");
448 return NULL;
449 }
450
451 data = exe->data;
452
453 if (exe->pre_free_cb)
454 exe->pre_free_cb(data, exe);
455
456 CloseHandle(exe->process2);
457 CloseHandle(exe->process_thread);
458 CloseHandle(exe->process);
459 free(exe->cmd);
460 _ecore_exe_win32_pipes_close(exe);
461 exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
462 ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
463 if (exe->tag) free(exe->tag);
464 free(exe);
465
466 return data;
467}
468
469EAPI pid_t
470ecore_exe_pid_get(const Ecore_Exe *exe)
471{
472 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
473 {
474 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pid_get");
475 return -1;
476 }
477 return exe->process_id;
478}
479
480EAPI void
481ecore_exe_tag_set(Ecore_Exe *exe,
482 const char *tag)
483{
484 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
485 {
486 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_set");
487 return;
488 }
489 IF_FREE(exe->tag);
490 if (tag)
491 exe->tag = strdup(tag);
492}
493
494EAPI const char *
495ecore_exe_tag_get(const Ecore_Exe *exe)
496{
497 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
498 {
499 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_get");
500 return NULL;
501 }
502 return exe->tag;
503}
504
505EAPI const char *
506ecore_exe_cmd_get(const Ecore_Exe *exe)
507{
508 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
509 {
510 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_cmd_get");
511 return NULL;
512 }
513 return exe->cmd;
514}
515
516EAPI void *
517ecore_exe_data_get(const Ecore_Exe *exe)
518{
519 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
520 {
521 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get");
522 return NULL;
523 }
524 return exe->data;
525}
526
527EAPI Ecore_Exe_Flags
528ecore_exe_flags_get(const Ecore_Exe *exe)
529{
530 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
531 {
532 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get");
533 return 0;
534 }
535 return exe->flags;
536}
537
538EAPI void
539ecore_exe_pause(Ecore_Exe *exe)
540{
541 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
542 {
543 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pause");
544 return;
545 }
546
547 if (exe->is_suspended)
548 return;
549
550 if (SuspendThread(exe->process_thread) != (DWORD)-1)
551 exe->is_suspended = 1;
552}
553
554EAPI void
555ecore_exe_continue(Ecore_Exe *exe)
556{
557 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
558 {
559 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_continue");
560 return;
561 }
562
563 if (!exe->is_suspended)
564 return;
565
566 if (ResumeThread(exe->process_thread) != (DWORD)-1)
567 exe->is_suspended = 0;
568}
569
570EAPI void
571ecore_exe_interrupt(Ecore_Exe *exe)
572{
573 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
574 {
575 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_interrupt");
576 return;
577 }
578
579 CloseHandle(exe->process_thread);
580 CloseHandle(exe->process);
581 exe->sig = ECORE_EXE_WIN32_SIGINT;
582 while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
583}
584
585EAPI void
586ecore_exe_quit(Ecore_Exe *exe)
587{
588 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
589 {
590 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_quit");
591 return;
592 }
593
594 CloseHandle(exe->process_thread);
595 CloseHandle(exe->process);
596 exe->sig = ECORE_EXE_WIN32_SIGQUIT;
597 while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
598}
599
600EAPI void
601ecore_exe_terminate(Ecore_Exe *exe)
602{
603 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
604 {
605 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_terminate");
606 return;
607 }
608
609/* CloseHandle(exe->thread); */
610 CloseHandle(exe->process);
611 exe->sig = ECORE_EXE_WIN32_SIGTERM;
612 while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
613}
614
615EAPI void
616ecore_exe_kill(Ecore_Exe *exe)
617{
618 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
619 {
620 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_kill");
621 return;
622 }
623
624 CloseHandle(exe->process_thread);
625 CloseHandle(exe->process);
626 exe->sig = ECORE_EXE_WIN32_SIGKILL;
627 while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
628}
629
630EAPI void
631ecore_exe_signal(Ecore_Exe *exe,
632 int num __UNUSED__)
633{
634 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
635 {
636 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_signal");
637 return;
638 }
639
640 /* does nothing */
641}
642
643EAPI void
644ecore_exe_hup(Ecore_Exe *exe)
645{
646 if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
647 {
648 ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_hup");
649 return;
650 }
651
652 /* does nothing */
653}
654
655/* FIXME: manage error mode */
656static int
657_ecore_exe_win32_pipe_thread_generic_cb(void *data,
658 Ecore_Exe_Flags flags)
659{
660#define BUFSIZE 2048
661 char buf[BUFSIZE];
662 Ecore_Exe *exe;
663 char *current_buf = NULL;
664 HANDLE child_pipe;
665 Ecore_Pipe *ecore_pipe;
666 Ecore_Exe_Event_Data *event;
667 DWORD size;
668 DWORD current_size = 0;
669 BOOL res;
670
671 exe = (Ecore_Exe *)data;
672
673 /* Sort out what sort of handler we are. */
674 /* And get any left over data from last time. */
675 if ((exe->flags & ECORE_EXE_PIPE_READ) && (flags == ECORE_EXE_PIPE_READ))
676 {
677 child_pipe = exe->pipe_read.child_pipe;
678 ecore_pipe = exe->pipe_read.p;
679 flags = ECORE_EXE_PIPE_READ;
680 }
681 else if ((exe->flags & ECORE_EXE_PIPE_ERROR) && (flags == ECORE_EXE_PIPE_ERROR))
682 {
683 child_pipe = exe->pipe_error.child_pipe;
684 ecore_pipe = exe->pipe_error.p;
685 flags = ECORE_EXE_PIPE_ERROR;
686 }
687 else
688 return 0;
689
690 while (1)
691 {
692 if (!PeekNamedPipe(child_pipe, buf, sizeof(buf), &size, &current_size, NULL))
693 continue;
694 if (size == 0)
695 continue;
696 current_buf = (char *)malloc(current_size);
697 if (!current_buf)
698 continue;
699 res = ReadFile(child_pipe, current_buf, current_size, &size, NULL);
700 if (!res || (size == 0))
701 {
702 free(current_buf);
703 current_buf = NULL;
704 continue;
705 }
706 if (current_size != size)
707 {
708 free(current_buf);
709 current_buf = NULL;
710 continue;
711 }
712 current_size = size;
713
714 if (flags == ECORE_EXE_PIPE_READ)
715 {
716 exe->pipe_read.data_buf = current_buf;
717 exe->pipe_read.data_size = current_size;
718 }
719 else
720 {
721 exe->pipe_error.data_buf = current_buf;
722 exe->pipe_error.data_size = current_size;
723 }
724
725 event = ecore_exe_event_data_get(exe, flags);
726 if (event)
727 ecore_pipe_write(ecore_pipe, &event, sizeof(event));
728
729 current_buf = NULL;
730 current_size = 0;
731 }
732
733 return 1;
734}
735
736static DWORD WINAPI
737_ecore_exe_win32_pipe_thread_read_cb(void *data)
738{
739 return _ecore_exe_win32_pipe_thread_generic_cb(data, ECORE_EXE_PIPE_READ);
740}
741
742static DWORD WINAPI
743_ecore_exe_win32_pipe_thread_error_cb(void *data)
744{
745 return _ecore_exe_win32_pipe_thread_generic_cb(data, ECORE_EXE_PIPE_ERROR);
746}
747
748static int
749_ecore_exe_win32_pipes_set(Ecore_Exe *exe)
750{
751 SECURITY_ATTRIBUTES sa;
752 HANDLE child_pipe;
753 HANDLE child_pipe_x;
754
755 sa.nLength = sizeof(SECURITY_ATTRIBUTES);
756 sa.bInheritHandle = EINA_TRUE;
757 sa.lpSecurityDescriptor = NULL;
758
759 if (!CreatePipe(&child_pipe, &child_pipe_x, &sa, 0))
760 return 0;
761 if (exe->flags & ECORE_EXE_PIPE_WRITE)
762 {
763 if (!SetHandleInformation(child_pipe_x, HANDLE_FLAG_INHERIT, 0))
764 goto close_pipe;
765 }
766 else
767 {
768 if (!SetHandleInformation(child_pipe, HANDLE_FLAG_INHERIT, 0))
769 goto close_pipe;
770 }
771
772 if (exe->flags & ECORE_EXE_PIPE_READ)
773 {
774 exe->pipe_read.child_pipe = child_pipe;
775 exe->pipe_read.child_pipe_x = child_pipe_x;
776 exe->pipe_read.p = ecore_pipe_add(_ecore_exe_pipe_read_cb, exe);
777 exe->pipe_read.thread = CreateThread(NULL, 0,
778 _ecore_exe_win32_pipe_thread_read_cb,
779 exe, 0, NULL);
780 }
781 else if (exe->flags & ECORE_EXE_PIPE_WRITE)
782 {
783 exe->pipe_write.child_pipe = child_pipe;
784 exe->pipe_write.child_pipe_x = child_pipe_x;
785/* exe->pipe_write.thread = CreateThread(NULL, 0, */
786/* _ecore_exe_win32_pipe_thread_cb, */
787/* exe, 0, NULL); */
788 }
789 else
790 {
791 exe->pipe_error.child_pipe = child_pipe;
792 exe->pipe_error.child_pipe_x = child_pipe_x;
793 exe->pipe_error.p = ecore_pipe_add(_ecore_exe_pipe_error_cb, exe);
794 exe->pipe_error.thread = CreateThread(NULL, 0,
795 _ecore_exe_win32_pipe_thread_error_cb,
796 exe, 0, NULL);
797 }
798
799 return 1;
800
801close_pipe:
802 CloseHandle(child_pipe);
803 CloseHandle(child_pipe_x);
804
805 return 0;
806}
807
808static void
809_ecore_exe_win32_pipes_close(Ecore_Exe *exe)
810{
811 if (exe->flags & ECORE_EXE_PIPE_READ)
812 {
813 if (exe->pipe_read.child_pipe)
814 {
815 CloseHandle(exe->pipe_read.child_pipe);
816 exe->pipe_read.child_pipe = NULL;
817 }
818 if (exe->pipe_read.child_pipe_x)
819 {
820 CloseHandle(exe->pipe_read.child_pipe_x);
821 exe->pipe_read.child_pipe_x = NULL;
822 }
823 }
824
825 if (exe->flags & ECORE_EXE_PIPE_WRITE)
826 {
827 if (exe->pipe_write.child_pipe)
828 {
829 CloseHandle(exe->pipe_write.child_pipe);
830 exe->pipe_write.child_pipe = NULL;
831 }
832 if (exe->pipe_write.child_pipe_x)
833 {
834 CloseHandle(exe->pipe_write.child_pipe_x);
835 exe->pipe_write.child_pipe_x = NULL;
836 }
837 }
838
839 if (exe->flags & ECORE_EXE_PIPE_ERROR)
840 {
841 if (exe->pipe_error.child_pipe)
842 {
843 CloseHandle(exe->pipe_error.child_pipe);
844 exe->pipe_error.child_pipe = NULL;
845 }
846 if (exe->pipe_error.child_pipe_x)
847 {
848 CloseHandle(exe->pipe_error.child_pipe_x);
849 exe->pipe_error.child_pipe_x = NULL;
850 }
851 }
852}
853
854static DWORD WINAPI
855_ecore_exe_thread_procedure(LPVOID data __UNUSED__)
856{
857 GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
858 GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0);
859 return 1;
860}
861
862static BOOL CALLBACK
863_ecore_exe_enum_windows_procedure(HWND window,
864 LPARAM data)
865{
866 Ecore_Exe *exe;
867 DWORD thread_id;
868
869 exe = (Ecore_Exe *)data;
870 thread_id = GetWindowThreadProcessId(window, NULL);
871
872 if (thread_id == exe->thread_id)
873 {
874 /* Ctrl-C or Ctrl-Break */
875 if (CreateRemoteThread(exe->process, NULL, 0,
876 (LPTHREAD_START_ROUTINE)_ecore_exe_thread_procedure, NULL,
877 0, NULL))
878 {
879 printf ("remote thread\n");
880 return EINA_FALSE;
881 }
882
883 if ((exe->sig == ECORE_EXE_WIN32_SIGINT) ||
884 (exe->sig == ECORE_EXE_WIN32_SIGQUIT))
885 {
886 printf ("int or quit\n");
887 return EINA_FALSE;
888 }
889
890 /* WM_CLOSE message */
891 PostMessage(window, WM_CLOSE, 0, 0);
892 if (WaitForSingleObject(exe->process, ECORE_EXE_WIN32_TIMEOUT) == WAIT_OBJECT_0)
893 {
894 printf ("CLOSE\n");
895 return EINA_FALSE;
896 }
897
898 /* WM_QUIT message */
899 PostMessage(window, WM_QUIT, 0, 0);
900 if (WaitForSingleObject(exe->process, ECORE_EXE_WIN32_TIMEOUT) == WAIT_OBJECT_0)
901 {
902 printf ("QUIT\n");
903 return EINA_FALSE;
904 }
905
906 /* Exit process */
907 if (CreateRemoteThread(exe->process, NULL, 0,
908 (LPTHREAD_START_ROUTINE)ExitProcess, NULL,
909 0, NULL))
910 {
911 printf ("remote thread 2\n");
912 return EINA_FALSE;
913 }
914
915 if (exe->sig == ECORE_EXE_WIN32_SIGTERM)
916 {
917 printf ("term\n");
918 return EINA_FALSE;
919 }
920
921 TerminateProcess(exe->process, 0);
922
923 return EINA_FALSE;
924 }
925
926 return EINA_TRUE;
927}
928
929static void
930_ecore_exe_event_add_free(void *data __UNUSED__,
931 void *ev)
932{
933 Ecore_Exe_Event_Add *e;
934
935 e = (Ecore_Exe_Event_Add *)ev;
936 free(e);
937}
938
939static void
940_ecore_exe_event_del_free(void *data __UNUSED__,
941 void *ev)
942{
943 Ecore_Exe_Event_Del *e;
944
945 e = (Ecore_Exe_Event_Del *)ev;
946 if (e->exe)
947 ecore_exe_free(e->exe);
948 free(e);
949}
950
951static void
952_ecore_exe_event_exe_data_free(void *data __UNUSED__,
953 void *ev)
954{
955 Ecore_Exe_Event_Data *e;
956
957 e = (Ecore_Exe_Event_Data *)ev;
958 ecore_exe_event_data_free(e);
959}
960
961static Eina_Bool
962_ecore_exe_close_cb(void *data,
963 Ecore_Win32_Handler *wh __UNUSED__)
964{
965 Ecore_Exe_Event_Del *e;
966 Ecore_Exe *exe;
967 DWORD exit_code = 0;
968
969 e = calloc(1, sizeof(Ecore_Exe_Event_Del));
970 if (!e) return 0;
971
972 exe = (Ecore_Exe *)data;
973
974 if (GetExitCodeProcess(exe->process2, &exit_code))
975 {
976 e->exit_code = exit_code;
977 e->exited = 1;
978 }
979 else
980 {
981 char *msg;
982
983 msg = evil_last_error_get();
984 printf("%s\n", msg);
985 free(msg);
986 }
987 e->pid = exe->process_id;
988 e->exe = exe;
989
990 ecore_event_add(ECORE_EXE_EVENT_DEL, e,
991 _ecore_exe_event_del_free, NULL);
992
993 return 0;
994}
995
996static void
997_ecore_exe_pipe_read_cb(void *data,
998 void *buf,
999 unsigned int size)
1000{
1001 Ecore_Exe_Event_Data *e;
1002
1003 e = *((Ecore_Exe_Event_Data **)buf);
1004 if (e)
1005 ecore_event_add(ECORE_EXE_EVENT_DATA, e,
1006 _ecore_exe_event_exe_data_free,
1007 NULL);
1008}
1009
1010static int
1011_ecore_exe_pipe_write_cb(void *data,
1012 Ecore_Win32_Handler *wh __UNUSED__)
1013{
1014 char buf[READBUFSIZ];
1015 Ecore_Exe *exe;
1016 DWORD num_exe;
1017 BOOL res;
1018
1019 exe = (Ecore_Exe *)data;
1020
1021 res = WriteFile(exe->pipe_write.child_pipe_x, buf, READBUFSIZ, &num_exe, NULL);
1022 if (!res || num_exe == 0)
1023 {
1024 /* FIXME: what to do here ?? */
1025 }
1026
1027 if (exe->close_stdin == 1)
1028 {
1029 if (exe->pipe_write.h)
1030 {
1031 ecore_main_win32_handler_del(exe->pipe_write.h);
1032 exe->pipe_write.h = NULL;
1033 }
1034 exe->pipe_write.h = NULL;
1035 CloseHandle(exe->pipe_write.child_pipe);
1036 exe->pipe_write.child_pipe = NULL;
1037 }
1038
1039 return 1;
1040}
1041
1042static void
1043_ecore_exe_pipe_error_cb(void *data,
1044 void *buf,
1045 unsigned int size)
1046{
1047 Ecore_Exe_Event_Data *e;
1048
1049 e = *((Ecore_Exe_Event_Data **)buf);
1050 if (e)
1051 ecore_event_add(ECORE_EXE_EVENT_ERROR, e,
1052 _ecore_exe_event_exe_data_free,
1053 NULL);
1054}
1055
diff --git a/libraries/ecore/src/lib/ecore/ecore_exe_wince.c b/libraries/ecore/src/lib/ecore/ecore_exe_wince.c
deleted file mode 100644
index c07fcbe..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_exe_wince.c
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef HAVE_EVIL
6# include <Evil.h>
7#endif
8
9#include "Ecore.h"
10#include "ecore_private.h"
11
12void
13_ecore_exe_init(void)
14{
15}
16
17void
18_ecore_exe_shutdown(void)
19{
20}
21
diff --git a/libraries/ecore/src/lib/ecore/ecore_getopt.c b/libraries/ecore/src/lib/ecore/ecore_getopt.c
deleted file mode 100644
index cd68189..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_getopt.c
+++ /dev/null
@@ -1,1915 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef HAVE_ALLOCA_H
6# include <alloca.h>
7#elif defined __GNUC__
8# define alloca __builtin_alloca
9#elif defined _AIX
10# define alloca __alloca
11#elif defined _MSC_VER
12# include <malloc.h>
13# define alloca _alloca
14#else
15# include <stddef.h>
16# ifdef __cplusplus
17extern "C"
18# endif
19void *alloca(size_t);
20#endif
21
22#include <stdlib.h>
23#include <stdio.h>
24#include <string.h>
25#include <stdarg.h>
26#include <ctype.h>
27
28#ifdef ENABLE_NLS
29# include <libintl.h>
30#else
31# define gettext(x) (x)
32# define dgettext(domain, x) (x)
33#endif
34
35#define _(x) dgettext("ecore", x)
36
37#ifdef _WIN32_WCE
38# include <Evil.h>
39#endif
40
41#ifdef HAVE_EXOTIC
42# include <Exotic.h>
43#endif
44
45#include "Ecore.h"
46#include "Ecore_Getopt.h"
47
48static const char *prog = NULL;
49static char **argv = NULL;
50static int argc = 0;
51static int cols = 80;
52static int helpcol = 80 / 3;
53
54static void
55_ecore_getopt_help_print_replace_program(FILE *fp,
56 const Ecore_Getopt *parser __UNUSED__,
57 const char *text)
58{
59 do
60 {
61 const char *d = strchr(text, '%');
62
63 if (!d)
64 {
65 fputs(text, fp);
66 break;
67 }
68
69 if (fwrite(text, 1, d - text, fp) != (size_t)(d - text))
70 return;
71 d++;
72 if (strncmp(d, "prog", sizeof("prog") - 1) == 0)
73 {
74 fputs(prog ? prog : "???", fp);
75 d += sizeof("prog") - 1;
76 }
77 else
78 {
79 if (d[0] == '%')
80 d++;
81 fputc('%', fp);
82 }
83
84 text = d;
85 }
86 while (text[0] != '\0');
87
88 fputc('\n', fp);
89}
90
91static void
92_ecore_getopt_version(FILE *fp,
93 const Ecore_Getopt *parser)
94{
95 fputs(_("Version:"), fp);
96 fputc(' ', fp);
97 _ecore_getopt_help_print_replace_program(fp, parser, parser->version);
98}
99
100static void
101_ecore_getopt_help_usage(FILE *fp,
102 const Ecore_Getopt *parser)
103{
104 fputs(_("Usage:"), fp);
105 fputc(' ', fp);
106
107 if (!parser->usage)
108 {
109 fprintf(fp, _("%s [options]\n"), prog);
110 return;
111 }
112
113 _ecore_getopt_help_print_replace_program(fp, parser, gettext(parser->usage));
114}
115
116static int
117_ecore_getopt_help_line(FILE *fp,
118 const int base,
119 const int total,
120 int used,
121 const char *text,
122 int len)
123{
124 int linebreak = 0;
125 do
126 {
127 /* process line considering spaces (new line and tabs are spaces!) */
128 while ((used < total) && (len > 0))
129 {
130 const char *space = NULL;
131 int i, todo;
132
133 todo = total - used;
134 if (todo > len)
135 todo = len;
136
137 for (i = 0; i < todo; i++)
138 if (isspace((unsigned char)text[i]))
139 {
140 space = text + i;
141 break;
142 }
143
144 if (space)
145 {
146 i = fwrite(text, 1, i, fp);
147 i++;
148 text += i;
149 len -= i;
150 used += i;
151
152 if (linebreak)
153 {
154 linebreak = 0;
155 continue;
156 }
157
158 if (space[0] == '\n')
159 break;
160 else if (space[0] == '\t')
161 {
162 int c;
163
164 used--;
165 c = ((used / 8) + 1) * 8;
166 if (c < total)
167 {
168 for (; used < c; used++)
169 fputc(' ', fp);
170 }
171 else
172 {
173 text--;
174 len++;
175 break;
176 }
177 }
178 else if (used < total)
179 fputc(space[0], fp);
180 }
181 else
182 {
183 i = fwrite(text, 1, i, fp);
184 text += i;
185 len -= i;
186 used += i;
187 }
188 linebreak = 0;
189 }
190 if (len <= 0)
191 break;
192 linebreak = 1;
193 fputc('\n', fp);
194 for (used = 0; used < base; used++)
195 fputc(' ', fp);
196 }
197 while (1);
198
199 return used;
200}
201
202static void
203_ecore_getopt_help_description(FILE *fp,
204 const Ecore_Getopt *parser)
205{
206 const char *p, *prg, *ver;
207 int used, prglen, verlen;
208
209 p = gettext(parser->description);
210 if (!p)
211 return;
212
213 fputc('\n', fp);
214
215 prg = prog ? prog : "???";
216 ver = parser->version ? parser->version : "???";
217
218 prglen = strlen(prg);
219 verlen = strlen(ver);
220
221 used = 0;
222
223 do
224 {
225 const char *d = strchr(p, '%');
226
227 if (!d)
228 {
229 _ecore_getopt_help_line(fp, 0, cols, used, p, strlen(p));
230 break;
231 }
232
233 used = _ecore_getopt_help_line(fp, 0, cols, used, p, d - p);
234 d++;
235 if (strncmp(d, "prog", sizeof("prog") - 1) == 0)
236 {
237 used = _ecore_getopt_help_line(fp, 0, cols, used, prg, prglen);
238 d += sizeof("prog") - 1;
239 }
240 else if (strncmp(d, "version", sizeof("version") - 1) == 0)
241 {
242 used = _ecore_getopt_help_line(fp, 0, cols, used, ver, verlen);
243 d += sizeof("version") - 1;
244 }
245 else
246 {
247 if (d[0] == '%')
248 d++;
249 used = _ecore_getopt_help_line(fp, 0, cols, used, "%", 1);
250 }
251
252 p = d;
253 }
254 while (p[0] != '\0');
255
256 fputs("\n\n", fp);
257}
258
259static void
260_ecore_getopt_copyright(FILE *fp,
261 const Ecore_Getopt *parser)
262{
263 const char *txt = gettext(parser->copyright);
264 fputs(_("Copyright:"), fp);
265 fputs("\n ", fp);
266 _ecore_getopt_help_line
267 (fp, 3, cols, 3, txt, strlen(txt));
268 fputc('\n', fp);
269}
270
271static void
272_ecore_getopt_license(FILE *fp,
273 const Ecore_Getopt *parser)
274{
275 const char *txt = gettext(parser->license);
276 fputs(_("License:"), fp);
277 fputs("\n ", fp);
278 _ecore_getopt_help_line
279 (fp, 3, cols, 3, txt, strlen(txt));
280 fputc('\n', fp);
281}
282
283static Ecore_Getopt_Desc_Arg_Requirement
284_ecore_getopt_desc_arg_requirement(const Ecore_Getopt_Desc *desc)
285{
286 switch (desc->action)
287 {
288 case ECORE_GETOPT_ACTION_STORE:
289 return desc->action_param.store.arg_req;
290
291 case ECORE_GETOPT_ACTION_STORE_CONST:
292 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
293
294 case ECORE_GETOPT_ACTION_STORE_TRUE:
295 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
296
297 case ECORE_GETOPT_ACTION_STORE_FALSE:
298 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
299
300 case ECORE_GETOPT_ACTION_CHOICE:
301 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES;
302
303 case ECORE_GETOPT_ACTION_APPEND:
304 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES;
305
306 case ECORE_GETOPT_ACTION_COUNT:
307 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
308
309 case ECORE_GETOPT_ACTION_CALLBACK:
310 return desc->action_param.callback.arg_req;
311
312 case ECORE_GETOPT_ACTION_HELP:
313 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
314
315 case ECORE_GETOPT_ACTION_VERSION:
316 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
317
318 default:
319 return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
320 }
321}
322
323static void
324_ecore_getopt_help_desc_setup_metavar(const Ecore_Getopt_Desc *desc,
325 char *metavar,
326 int *metavarlen,
327 int maxsize)
328{
329 if (desc->metavar)
330 {
331 const char *txt = gettext(desc->metavar);
332 *metavarlen = strlen(txt);
333 if (*metavarlen > maxsize - 1)
334 *metavarlen = maxsize - 1;
335
336 memcpy(metavar, txt, *metavarlen);
337 metavar[*metavarlen] = '\0';
338 }
339 else if (desc->longname)
340 {
341 int i;
342
343 *metavarlen = strlen(desc->longname);
344 if (*metavarlen > maxsize - 1)
345 *metavarlen = maxsize - 1;
346
347 for (i = 0; i < *metavarlen; i++)
348 metavar[i] = toupper((int) desc->longname[i]);
349 metavar[i] = '\0';
350 }
351}
352
353static int
354_ecore_getopt_help_desc_show_arg(FILE *fp,
355 Ecore_Getopt_Desc_Arg_Requirement requirement,
356 const char *metavar,
357 int metavarlen)
358{
359 int used;
360
361 if (requirement == ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
362 return 0;
363
364 used = 0;
365
366 if (requirement == ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL)
367 {
368 fputc('[', fp);
369 used++;
370 }
371
372 if (requirement != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
373 {
374 fputc('=', fp);
375 fputs(metavar, fp);
376 used += metavarlen + 1;
377 }
378
379 if (requirement == ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL)
380 {
381 fputc(']', fp);
382 used++;
383 }
384
385 return used;
386}
387
388static int
389_ecore_getopt_help_desc_store(FILE *fp,
390 const int base,
391 const int total,
392 int used,
393 const Ecore_Getopt_Desc *desc)
394{
395 const Ecore_Getopt_Desc_Store *store = &desc->action_param.store;
396 char buf[64];
397 const char *str;
398 size_t len;
399
400 fputc('\n', fp);
401 for (used = 0; used < base; used++)
402 fputc(' ', fp);
403
404 switch (store->type)
405 {
406 case ECORE_GETOPT_TYPE_STR:
407 str = "STR";
408 len = sizeof("STR") - 1;
409 break;
410
411 case ECORE_GETOPT_TYPE_BOOL:
412 str = "BOOL";
413 len = sizeof("BOOL") - 1;
414 break;
415
416 case ECORE_GETOPT_TYPE_SHORT:
417 str = "SHORT";
418 len = sizeof("SHORT") - 1;
419 break;
420
421 case ECORE_GETOPT_TYPE_INT:
422 str = "INT";
423 len = sizeof("INT") - 1;
424 break;
425
426 case ECORE_GETOPT_TYPE_LONG:
427 str = "LONG";
428 len = sizeof("LONG") - 1;
429 break;
430
431 case ECORE_GETOPT_TYPE_USHORT:
432 str = "USHORT";
433 len = sizeof("USHORT") - 1;
434 break;
435
436 case ECORE_GETOPT_TYPE_UINT:
437 str = "UINT";
438 len = sizeof("UINT") - 1;
439 break;
440
441 case ECORE_GETOPT_TYPE_ULONG:
442 str = "ULONG";
443 len = sizeof("ULONG") - 1;
444 break;
445
446 case ECORE_GETOPT_TYPE_DOUBLE:
447 str = "DOUBLE";
448 len = sizeof("DOUBLE") - 1;
449 break;
450
451 default:
452 str = "???";
453 len = sizeof("???") - 1;
454 }
455
456 used = _ecore_getopt_help_line
457 (fp, base, total, used, _("Type: "), strlen(_("Type: ")));
458 used = _ecore_getopt_help_line(fp, base, total, used, str, len);
459
460 if (store->arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES)
461 goto end;
462
463 used = _ecore_getopt_help_line
464 (fp, base, total, used, ". ", sizeof(". ") - 1);
465
466 switch (store->type)
467 {
468 case ECORE_GETOPT_TYPE_STR:
469 str = store->def.strv;
470 len = str ? strlen(str) : 0;
471 break;
472
473 case ECORE_GETOPT_TYPE_BOOL:
474 str = store->def.boolv ? "true" : "false";
475 len = strlen(str);
476 break;
477
478 case ECORE_GETOPT_TYPE_SHORT:
479 str = buf;
480 len = snprintf(buf, sizeof(buf), "%hd", store->def.shortv);
481 if (len > sizeof(buf) - 1)
482 len = sizeof(buf) - 1;
483 break;
484
485 case ECORE_GETOPT_TYPE_INT:
486 str = buf;
487 len = snprintf(buf, sizeof(buf), "%d", store->def.intv);
488 if (len > sizeof(buf) - 1)
489 len = sizeof(buf) - 1;
490 break;
491
492 case ECORE_GETOPT_TYPE_LONG:
493 str = buf;
494 len = snprintf(buf, sizeof(buf), "%ld", store->def.longv);
495 if (len > sizeof(buf) - 1)
496 len = sizeof(buf) - 1;
497 break;
498
499 case ECORE_GETOPT_TYPE_USHORT:
500 str = buf;
501 len = snprintf(buf, sizeof(buf), "%hu", store->def.ushortv);
502 if (len > sizeof(buf) - 1)
503 len = sizeof(buf) - 1;
504 break;
505
506 case ECORE_GETOPT_TYPE_UINT:
507 str = buf;
508 len = snprintf(buf, sizeof(buf), "%u", store->def.uintv);
509 if (len > sizeof(buf) - 1)
510 len = sizeof(buf) - 1;
511 break;
512
513 case ECORE_GETOPT_TYPE_ULONG:
514 str = buf;
515 len = snprintf(buf, sizeof(buf), "%lu", store->def.ulongv);
516 if (len > sizeof(buf) - 1)
517 len = sizeof(buf) - 1;
518 break;
519
520 case ECORE_GETOPT_TYPE_DOUBLE:
521 str = buf;
522 len = snprintf(buf, sizeof(buf), "%f", store->def.doublev);
523 if (len > sizeof(buf) - 1)
524 len = sizeof(buf) - 1;
525 break;
526
527 default:
528 str = "???";
529 len = sizeof("???") - 1;
530 }
531
532 used = _ecore_getopt_help_line
533 (fp, base, total, used, _("Default: "), strlen(_("Default: ")));
534 used = _ecore_getopt_help_line(fp, base, total, used, str, len);
535
536end:
537 return _ecore_getopt_help_line(fp, base, total, used, ".", 1);
538}
539
540static int
541_ecore_getopt_help_desc_choices(FILE *fp,
542 const int base,
543 const int total,
544 int used,
545 const Ecore_Getopt_Desc *desc)
546{
547 const char *const *itr;
548 const char sep[] = ", ";
549 const int seplen = sizeof(sep) - 1;
550
551 if (used > 0)
552 {
553 fputc('\n', fp);
554 used = 0;
555 }
556 for (; used < base; used++)
557 fputc(' ', fp);
558
559 used = _ecore_getopt_help_line
560 (fp, base, total, used, _("Choices: "), strlen(_("Choices: ")));
561
562 for (itr = desc->action_param.choices; *itr; itr++)
563 {
564 used = _ecore_getopt_help_line
565 (fp, base, total, used, *itr, strlen(*itr));
566 if (itr[1])
567 used = _ecore_getopt_help_line(fp, base, total, used, sep, seplen);
568 }
569
570 return _ecore_getopt_help_line(fp, base, total, used, ".", 1);
571}
572
573static void
574_ecore_getopt_help_desc(FILE *fp,
575 const Ecore_Getopt_Desc *desc)
576{
577 Ecore_Getopt_Desc_Arg_Requirement arg_req;
578 char metavar[32] = "ARG";
579 int metavarlen = 3;
580 int used;
581
582 arg_req = _ecore_getopt_desc_arg_requirement(desc);
583 if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
584 _ecore_getopt_help_desc_setup_metavar
585 (desc, metavar, &metavarlen, sizeof(metavar));
586
587 fputs(" ", fp);
588 used = 2;
589
590 if (desc->shortname)
591 {
592 fputc('-', fp);
593 fputc(desc->shortname, fp);
594 used += 2;
595 used += _ecore_getopt_help_desc_show_arg
596 (fp, arg_req, metavar, metavarlen);
597 }
598
599 if (desc->shortname && desc->longname)
600 {
601 fputs(", ", fp);
602 used += 2;
603 }
604
605 if (desc->longname)
606 {
607 int namelen = strlen(desc->longname);
608
609 fputs("--", fp);
610 fputs(desc->longname, fp);
611 used += 2 + namelen;
612 used += _ecore_getopt_help_desc_show_arg
613 (fp, arg_req, metavar, metavarlen);
614 }
615
616 if (!desc->help)
617 goto end;
618
619 if (used + 3 >= helpcol)
620 {
621 fputc('\n', fp);
622 used = 0;
623 }
624
625 for (; used < helpcol; used++)
626 fputc(' ', fp);
627
628 used = _ecore_getopt_help_line
629 (fp, helpcol, cols, used, desc->help, strlen(desc->help));
630
631 switch (desc->action)
632 {
633 case ECORE_GETOPT_ACTION_STORE:
634 _ecore_getopt_help_desc_store(fp, helpcol, cols, used, desc);
635 break;
636
637 case ECORE_GETOPT_ACTION_CHOICE:
638 _ecore_getopt_help_desc_choices(fp, helpcol, cols, used, desc);
639 break;
640
641 default:
642 break;
643 }
644
645end:
646 fputc('\n', fp);
647}
648
649static Eina_Bool
650_ecore_getopt_desc_is_sentinel(const Ecore_Getopt_Desc *desc)
651{
652 return (desc->shortname == '\0') && (!desc->longname);
653}
654
655static void
656_ecore_getopt_help_options(FILE *fp,
657 const Ecore_Getopt *parser)
658{
659 const Ecore_Getopt_Desc *desc;
660
661 fputs(_("Options:\n"), fp);
662
663 for (desc = parser->descs; !_ecore_getopt_desc_is_sentinel(desc); desc++)
664 _ecore_getopt_help_desc(fp, desc);
665
666 fputc('\n', fp);
667}
668
669/**
670 * Show nicely formatted help message for the given parser.
671 *
672 * Message will be print to stderr.
673 */
674void
675ecore_getopt_help(FILE *fp,
676 const Ecore_Getopt *parser)
677{
678 const char *var;
679
680 if (!parser) return;
681
682 if (argc < 1)
683 {
684 ecore_app_args_get(&argc, &argv);
685 if ((argc > 0) && (argv[0]))
686 prog = argv[0];
687 else
688 prog = parser->prog;
689 }
690
691 var = getenv("COLUMNS");
692 if (var)
693 {
694 cols = atoi(var);
695 if (cols < 20)
696 cols = 20;
697
698 helpcol = cols / 3;
699 }
700
701 _ecore_getopt_help_usage(fp, parser);
702 _ecore_getopt_help_description(fp, parser);
703 _ecore_getopt_help_options(fp, parser);
704}
705
706static const Ecore_Getopt_Desc *
707_ecore_getopt_parse_find_long(const Ecore_Getopt *parser,
708 const char *name)
709{
710 const Ecore_Getopt_Desc *desc = parser->descs;
711 const char *p = strchr(name, '=');
712 int len = 0;
713
714 if (p)
715 len = p - name;
716
717 for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
718 {
719 if (!desc->longname)
720 continue;
721
722 if (p)
723 {
724 if ((strncmp(name, desc->longname, len) == 0) &&
725 (desc->longname[len] == '\0'))
726 return desc;
727 }
728 else
729 {
730 if (strcmp(name, desc->longname) == 0)
731 return desc;
732 }
733 }
734
735 return NULL;
736}
737
738static const Ecore_Getopt_Desc *
739_ecore_getopt_parse_find_short(const Ecore_Getopt *parser,
740 char name)
741{
742 const Ecore_Getopt_Desc *desc = parser->descs;
743 for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
744 if (name == desc->shortname)
745 return desc;
746 return NULL;
747}
748
749static int
750_ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser,
751 int argc,
752 char **argv)
753{
754 char **nonargs;
755 int src, dst, used, base;
756
757 nonargs = alloca(sizeof(char *) * argc);
758 src = 1;
759 dst = 1;
760 used = 0;
761 base = 0;
762 while (src < argc)
763 {
764 const Ecore_Getopt_Desc *desc;
765 Ecore_Getopt_Desc_Arg_Requirement arg_req;
766 char *arg = argv[src];
767
768 if (arg[0] != '-')
769 goto found_nonarg;
770
771 if (arg[1] == '-')
772 {
773 if (arg[2] == '\0') /* explicit end of options, "--" */
774 {
775 base = 1;
776 break;
777 }
778 desc = _ecore_getopt_parse_find_long(parser, arg + 2);
779 }
780 else
781 desc = _ecore_getopt_parse_find_short(parser, arg[1]);
782
783 if (!desc)
784 {
785 if (arg[1] == '-')
786 fprintf(stderr, _("ERROR: unknown option --%s.\n"), arg + 2);
787 else
788 fprintf(stderr, _("ERROR: unknown option -%c.\n"), arg[1]);
789 if (parser->strict)
790 {
791 memmove(argv + dst, nonargs, used * sizeof(char *));
792 return -1;
793 }
794 else
795 goto found_nonarg;
796 }
797
798 if (src != dst)
799 argv[dst] = argv[src];
800 src++;
801 dst++;
802
803 arg_req = _ecore_getopt_desc_arg_requirement(desc);
804 if (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
805 continue;
806
807 if (strchr(arg, '='))
808 continue;
809
810 if ((src >= argc) || (argv[src][0] == '-'))
811 continue;
812
813 if (src != dst)
814 argv[dst] = argv[src];
815 src++;
816 dst++;
817 continue;
818
819found_nonarg:
820 nonargs[used] = arg;
821 used++;
822 src++;
823 }
824
825 if (!base) /* '--' not found */
826 base = dst;
827 else
828 {
829 base = dst;
830 if (src != dst)
831 argv[dst] = argv[src];
832 dst++;
833 }
834
835 memmove(argv + dst, nonargs, used * sizeof(char *));
836 return base;
837}
838
839static void
840_ecore_getopt_desc_print_error(const Ecore_Getopt_Desc *desc,
841 const char *fmt,
842 ...)
843{
844 va_list ap;
845
846 fputs(_("ERROR: "), stderr);
847
848 if (desc->shortname)
849 {
850 fputc('-', stderr);
851 fputc(desc->shortname, stderr);
852 }
853
854 if (desc->shortname && desc->longname)
855 fputs(", ", stderr);
856
857 if (desc->longname)
858 {
859 fputs("--", stderr);
860 fputs(desc->longname, stderr);
861 }
862
863 fputs(": ", stderr);
864
865 va_start(ap, fmt);
866 vfprintf(stderr, fmt, ap);
867 va_end(ap);
868}
869
870static Eina_Bool
871_ecore_getopt_parse_bool(const char *str,
872 Eina_Bool *v)
873{
874 if ((strcmp(str, "0") == 0) ||
875 (strcasecmp(str, "f") == 0) ||
876 (strcasecmp(str, "false") == 0) ||
877 (strcasecmp(str, "no") == 0) ||
878 (strcasecmp(str, "off") == 0)
879 )
880 {
881 *v = EINA_FALSE;
882 return EINA_TRUE;
883 }
884 else if ((strcmp(str, "1") == 0) ||
885 (strcasecmp(str, "t") == 0) ||
886 (strcasecmp(str, "true") == 0) ||
887 (strcasecmp(str, "yes") == 0) ||
888 (strcasecmp(str, "on") == 0)
889 )
890 {
891 *v = EINA_TRUE;
892 return EINA_TRUE;
893 }
894
895 return EINA_FALSE;
896}
897
898static Eina_Bool
899_ecore_getopt_parse_long(const char *str,
900 long int *v)
901{
902 char *endptr = NULL;
903 *v = strtol(str, &endptr, 0);
904 return endptr > str;
905}
906
907static Eina_Bool
908_ecore_getopt_parse_double(const char *str,
909 double *v)
910{
911 char *endptr = NULL;
912 *v = strtod(str, &endptr);
913 return endptr > str;
914}
915
916static Eina_Bool
917_ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__,
918 const Ecore_Getopt_Desc *desc,
919 Ecore_Getopt_Value *value,
920 const char *arg_val)
921{
922 const Ecore_Getopt_Desc_Store *store = &desc->action_param.store;
923 long int v;
924 double d;
925 Eina_Bool b;
926
927 if (!value->ptrp)
928 {
929 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
930 return EINA_FALSE;
931 }
932
933 switch (store->arg_req)
934 {
935 case ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO:
936 goto use_optional;
937
938 case ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL:
939 if (!arg_val)
940 goto use_optional;
941
942 case ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES:
943 break;
944 }
945
946 switch (store->type)
947 {
948 case ECORE_GETOPT_TYPE_STR:
949 *value->strp = (char *)arg_val;
950 return EINA_TRUE;
951
952 case ECORE_GETOPT_TYPE_BOOL:
953 if (_ecore_getopt_parse_bool(arg_val, &b))
954 {
955 *value->boolp = b;
956 return EINA_TRUE;
957 }
958 else
959 {
960 _ecore_getopt_desc_print_error
961 (desc, _("unknown boolean value %s.\n"), arg_val);
962 return EINA_FALSE;
963 }
964
965 case ECORE_GETOPT_TYPE_SHORT:
966 if (!_ecore_getopt_parse_long(arg_val, &v))
967 goto error;
968 *value->shortp = v;
969 return EINA_TRUE;
970
971 case ECORE_GETOPT_TYPE_INT:
972 if (!_ecore_getopt_parse_long(arg_val, &v))
973 goto error;
974 *value->intp = v;
975 return EINA_TRUE;
976
977 case ECORE_GETOPT_TYPE_LONG:
978 if (!_ecore_getopt_parse_long(arg_val, &v))
979 goto error;
980 *value->longp = v;
981 return EINA_TRUE;
982
983 case ECORE_GETOPT_TYPE_USHORT:
984 if (!_ecore_getopt_parse_long(arg_val, &v))
985 goto error;
986 *value->ushortp = v;
987 return EINA_TRUE;
988
989 case ECORE_GETOPT_TYPE_UINT:
990 if (!_ecore_getopt_parse_long(arg_val, &v))
991 goto error;
992 *value->uintp = v;
993 return EINA_TRUE;
994
995 case ECORE_GETOPT_TYPE_ULONG:
996 if (!_ecore_getopt_parse_long(arg_val, &v))
997 goto error;
998 *value->ulongp = v;
999 return EINA_TRUE;
1000
1001 case ECORE_GETOPT_TYPE_DOUBLE:
1002 if (!_ecore_getopt_parse_double(arg_val, &d))
1003 goto error;
1004 *value->doublep = d;
1005 break;
1006 }
1007
1008 return EINA_TRUE;
1009
1010error:
1011 _ecore_getopt_desc_print_error
1012 (desc, _("invalid number format %s\n"), arg_val);
1013 return EINA_FALSE;
1014
1015use_optional:
1016 switch (store->type)
1017 {
1018 case ECORE_GETOPT_TYPE_STR:
1019 *value->strp = (char *)store->def.strv;
1020 break;
1021
1022 case ECORE_GETOPT_TYPE_BOOL:
1023 *value->boolp = store->def.boolv;
1024 break;
1025
1026 case ECORE_GETOPT_TYPE_SHORT:
1027 *value->shortp = store->def.shortv;
1028 break;
1029
1030 case ECORE_GETOPT_TYPE_INT:
1031 *value->intp = store->def.intv;
1032 break;
1033
1034 case ECORE_GETOPT_TYPE_LONG:
1035 *value->longp = store->def.longv;
1036 break;
1037
1038 case ECORE_GETOPT_TYPE_USHORT:
1039 *value->ushortp = store->def.ushortv;
1040 break;
1041
1042 case ECORE_GETOPT_TYPE_UINT:
1043 *value->uintp = store->def.uintv;
1044 break;
1045
1046 case ECORE_GETOPT_TYPE_ULONG:
1047 *value->ulongp = store->def.ulongv;
1048 break;
1049
1050 case ECORE_GETOPT_TYPE_DOUBLE:
1051 *value->doublep = store->def.doublev;
1052 break;
1053 }
1054
1055 return EINA_TRUE;
1056}
1057
1058static Eina_Bool
1059_ecore_getopt_parse_store_const(const Ecore_Getopt *parser __UNUSED__,
1060 const Ecore_Getopt_Desc *desc,
1061 Ecore_Getopt_Value *val,
1062 const char *arg_val __UNUSED__)
1063{
1064 if (!val->ptrp)
1065 {
1066 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1067 return EINA_FALSE;
1068 }
1069
1070 *val->ptrp = (void *)desc->action_param.store_const;
1071 return EINA_TRUE;
1072}
1073
1074static Eina_Bool
1075_ecore_getopt_parse_store_true(const Ecore_Getopt *parser __UNUSED__,
1076 const Ecore_Getopt_Desc *desc,
1077 Ecore_Getopt_Value *val,
1078 const char *arg_val __UNUSED__)
1079{
1080 if (!val->boolp)
1081 {
1082 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1083 return EINA_FALSE;
1084 }
1085 *val->boolp = EINA_TRUE;
1086 return EINA_TRUE;
1087}
1088
1089static Eina_Bool
1090_ecore_getopt_parse_store_false(const Ecore_Getopt *parser __UNUSED__,
1091 const Ecore_Getopt_Desc *desc,
1092 Ecore_Getopt_Value *val,
1093 const char *arg_val __UNUSED__)
1094{
1095 if (!val->boolp)
1096 {
1097 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1098 return EINA_FALSE;
1099 }
1100 *val->boolp = EINA_FALSE;
1101 return EINA_TRUE;
1102}
1103
1104static Eina_Bool
1105_ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__,
1106 const Ecore_Getopt_Desc *desc,
1107 Ecore_Getopt_Value *val,
1108 const char *arg_val)
1109{
1110 const char *const *pchoice;
1111
1112 if (!val->strp)
1113 {
1114 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1115 return EINA_FALSE;
1116 }
1117
1118 pchoice = desc->action_param.choices;
1119 for (; *pchoice; pchoice++)
1120 if (strcmp(*pchoice, arg_val) == 0)
1121 {
1122 *val->strp = (char *)*pchoice;
1123 return EINA_TRUE;
1124 }
1125
1126 _ecore_getopt_desc_print_error
1127 (desc, _("invalid choice \"%s\". Valid values are: "), arg_val);
1128
1129 pchoice = desc->action_param.choices;
1130 for (; *pchoice; pchoice++)
1131 {
1132 fputs(*pchoice, stderr);
1133 if (pchoice[1])
1134 fputs(", ", stderr);
1135 }
1136
1137 fputs(".\n", stderr);
1138 return EINA_FALSE;
1139}
1140
1141static Eina_Bool
1142_ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__,
1143 const Ecore_Getopt_Desc *desc,
1144 Ecore_Getopt_Value *val,
1145 const char *arg_val)
1146{
1147 void *data;
1148 long int v;
1149 double d;
1150 Eina_Bool b;
1151
1152 if (!arg_val)
1153 {
1154 _ecore_getopt_desc_print_error
1155 (desc, _("missing parameter to append.\n"));
1156 return EINA_FALSE;
1157 }
1158
1159 if (!val->listp)
1160 {
1161 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1162 return EINA_FALSE;
1163 }
1164
1165 switch (desc->action_param.append_type)
1166 {
1167 case ECORE_GETOPT_TYPE_STR:
1168 data = strdup(arg_val);
1169 break;
1170
1171 case ECORE_GETOPT_TYPE_BOOL:
1172 {
1173 if (_ecore_getopt_parse_bool(arg_val, &b))
1174 {
1175 data = malloc(sizeof(Eina_Bool));
1176 if (data)
1177 *(Eina_Bool *)data = b;
1178 }
1179 else
1180 {
1181 _ecore_getopt_desc_print_error(desc, _("unknown boolean value %s.\n"), arg_val);
1182 return EINA_FALSE;
1183 }
1184 }
1185 break;
1186
1187 case ECORE_GETOPT_TYPE_SHORT:
1188 {
1189 if (!_ecore_getopt_parse_long(arg_val, &v))
1190 goto error;
1191 data = malloc(sizeof(short));
1192 if (data)
1193 *(short *)data = (short)v;
1194 }
1195 break;
1196
1197 case ECORE_GETOPT_TYPE_INT:
1198 {
1199 if (!_ecore_getopt_parse_long(arg_val, &v))
1200 goto error;
1201 data = malloc(sizeof(int));
1202 if (data)
1203 *(int *)data = (int)v;
1204 }
1205 break;
1206
1207 case ECORE_GETOPT_TYPE_LONG:
1208 {
1209 if (!_ecore_getopt_parse_long(arg_val, &v))
1210 goto error;
1211 data = malloc(sizeof(long));
1212 if (data)
1213 *(long *)data = v;
1214 }
1215 break;
1216
1217 case ECORE_GETOPT_TYPE_USHORT:
1218 {
1219 if (!_ecore_getopt_parse_long(arg_val, &v))
1220 goto error;
1221 data = malloc(sizeof(unsigned short));
1222 if (data)
1223 *(unsigned short *)data = (unsigned short)v;
1224 }
1225 break;
1226
1227 case ECORE_GETOPT_TYPE_UINT:
1228 {
1229 if (!_ecore_getopt_parse_long(arg_val, &v))
1230 goto error;
1231 data = malloc(sizeof(unsigned int));
1232 if (data)
1233 *(unsigned int *)data = (unsigned int)v;
1234 }
1235 break;
1236
1237 case ECORE_GETOPT_TYPE_ULONG:
1238 {
1239 if (!_ecore_getopt_parse_long(arg_val, &v))
1240 goto error;
1241 data = malloc(sizeof(unsigned long));
1242 if (data)
1243 *(unsigned long *)data = v;
1244 }
1245 break;
1246
1247 case ECORE_GETOPT_TYPE_DOUBLE:
1248 {
1249 if (!_ecore_getopt_parse_double(arg_val, &d))
1250 goto error;
1251 data = malloc(sizeof(double));
1252 if (data)
1253 *(double *)data = d;
1254 }
1255 break;
1256
1257 default:
1258 {
1259 _ecore_getopt_desc_print_error(desc, _("could not parse value.\n"));
1260 return EINA_FALSE;
1261 }
1262 }
1263
1264 *val->listp = eina_list_append(*val->listp, data);
1265 return EINA_TRUE;
1266
1267error:
1268 _ecore_getopt_desc_print_error
1269 (desc, _("invalid number format %s\n"), arg_val);
1270 return EINA_FALSE;
1271}
1272
1273static Eina_Bool
1274_ecore_getopt_parse_count(const Ecore_Getopt *parser __UNUSED__,
1275 const Ecore_Getopt_Desc *desc,
1276 Ecore_Getopt_Value *val,
1277 const char *arg_val __UNUSED__)
1278{
1279 if (!val->intp)
1280 {
1281 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1282 return EINA_FALSE;
1283 }
1284
1285 (*val->intp)++;
1286 return EINA_TRUE;
1287}
1288
1289static Eina_Bool
1290_ecore_getopt_parse_callback(const Ecore_Getopt *parser,
1291 const Ecore_Getopt_Desc *desc,
1292 Ecore_Getopt_Value *val,
1293 const char *arg_val)
1294{
1295 const Ecore_Getopt_Desc_Callback *cb = &desc->action_param.callback;
1296
1297 switch (cb->arg_req)
1298 {
1299 case ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO:
1300 arg_val = cb->def;
1301 break;
1302
1303 case ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL:
1304 if (!arg_val)
1305 arg_val = cb->def;
1306 break;
1307
1308 case ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES:
1309 break;
1310 }
1311
1312 if (cb->arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
1313 {
1314 if ((!arg_val) || (arg_val[0] == '\0'))
1315 {
1316 _ecore_getopt_desc_print_error(desc, _("missing parameter.\n"));
1317 return EINA_FALSE;
1318 }
1319
1320 if (!val->ptrp)
1321 {
1322 _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
1323 return EINA_FALSE;
1324 }
1325 }
1326
1327 if (!cb->func)
1328 {
1329 _ecore_getopt_desc_print_error(desc, _("missing callback function!\n"));
1330 return EINA_FALSE;
1331 }
1332
1333 return cb->func(parser, desc, arg_val, (void *)cb->data, val);
1334}
1335
1336static Eina_Bool
1337_ecore_getopt_parse_help(const Ecore_Getopt *parser,
1338 const Ecore_Getopt_Desc *desc __UNUSED__,
1339 Ecore_Getopt_Value *val,
1340 const char *arg_val __UNUSED__)
1341{
1342 if (val->boolp)
1343 (*val->boolp) = EINA_TRUE;
1344 ecore_getopt_help(stdout, parser);
1345 return EINA_TRUE;
1346}
1347
1348static Eina_Bool
1349_ecore_getopt_parse_version(const Ecore_Getopt *parser,
1350 const Ecore_Getopt_Desc *desc,
1351 Ecore_Getopt_Value *val,
1352 const char *arg_val __UNUSED__)
1353{
1354 if (val->boolp)
1355 (*val->boolp) = EINA_TRUE;
1356 if (!parser->version)
1357 {
1358 _ecore_getopt_desc_print_error(desc, _("no version was defined.\n"));
1359 return EINA_FALSE;
1360 }
1361 _ecore_getopt_version(stdout, parser);
1362 return EINA_TRUE;
1363}
1364
1365static Eina_Bool
1366_ecore_getopt_parse_copyright(const Ecore_Getopt *parser,
1367 const Ecore_Getopt_Desc *desc,
1368 Ecore_Getopt_Value *val,
1369 const char *arg_val __UNUSED__)
1370{
1371 if (val->boolp)
1372 (*val->boolp) = EINA_TRUE;
1373 if (!parser->copyright)
1374 {
1375 _ecore_getopt_desc_print_error(desc, _("no copyright was defined.\n"));
1376 return EINA_FALSE;
1377 }
1378 _ecore_getopt_copyright(stdout, parser);
1379 return EINA_TRUE;
1380}
1381
1382static Eina_Bool
1383_ecore_getopt_parse_license(const Ecore_Getopt *parser,
1384 const Ecore_Getopt_Desc *desc,
1385 Ecore_Getopt_Value *val,
1386 const char *arg_val __UNUSED__)
1387{
1388 if (val->boolp)
1389 (*val->boolp) = EINA_TRUE;
1390 if (!parser->license)
1391 {
1392 _ecore_getopt_desc_print_error(desc, _("no license was defined.\n"));
1393 return EINA_FALSE;
1394 }
1395 _ecore_getopt_license(stdout, parser);
1396 return EINA_TRUE;
1397}
1398
1399static Eina_Bool
1400_ecore_getopt_desc_handle(const Ecore_Getopt *parser,
1401 const Ecore_Getopt_Desc *desc,
1402 Ecore_Getopt_Value *value,
1403 const char *arg_val)
1404{
1405 switch (desc->action)
1406 {
1407 case ECORE_GETOPT_ACTION_STORE:
1408 return _ecore_getopt_parse_store(parser, desc, value, arg_val);
1409
1410 case ECORE_GETOPT_ACTION_STORE_CONST:
1411 return _ecore_getopt_parse_store_const(parser, desc, value, arg_val);
1412
1413 case ECORE_GETOPT_ACTION_STORE_TRUE:
1414 return _ecore_getopt_parse_store_true(parser, desc, value, arg_val);
1415
1416 case ECORE_GETOPT_ACTION_STORE_FALSE:
1417 return _ecore_getopt_parse_store_false(parser, desc, value, arg_val);
1418
1419 case ECORE_GETOPT_ACTION_CHOICE:
1420 return _ecore_getopt_parse_choice(parser, desc, value, arg_val);
1421
1422 case ECORE_GETOPT_ACTION_APPEND:
1423 return _ecore_getopt_parse_append(parser, desc, value, arg_val);
1424
1425 case ECORE_GETOPT_ACTION_COUNT:
1426 return _ecore_getopt_parse_count(parser, desc, value, arg_val);
1427
1428 case ECORE_GETOPT_ACTION_CALLBACK:
1429 return _ecore_getopt_parse_callback(parser, desc, value, arg_val);
1430
1431 case ECORE_GETOPT_ACTION_HELP:
1432 return _ecore_getopt_parse_help(parser, desc, value, arg_val);
1433
1434 case ECORE_GETOPT_ACTION_VERSION:
1435 return _ecore_getopt_parse_version(parser, desc, value, arg_val);
1436
1437 case ECORE_GETOPT_ACTION_COPYRIGHT:
1438 return _ecore_getopt_parse_copyright(parser, desc, value, arg_val);
1439
1440 case ECORE_GETOPT_ACTION_LICENSE:
1441 return _ecore_getopt_parse_license(parser, desc, value, arg_val);
1442
1443 default:
1444 return EINA_FALSE;
1445 }
1446}
1447
1448static Eina_Bool
1449_ecore_getopt_parse_arg_long(const Ecore_Getopt *parser,
1450 Ecore_Getopt_Value *values,
1451 int argc __UNUSED__,
1452 char **argv,
1453 int *idx,
1454 int *nonargs,
1455 const char *arg)
1456{
1457 const Ecore_Getopt_Desc *desc;
1458 Ecore_Getopt_Desc_Arg_Requirement arg_req;
1459 const char *arg_val;
1460 int desc_idx;
1461 Ecore_Getopt_Value *value;
1462 Eina_Bool ret;
1463
1464 desc = _ecore_getopt_parse_find_long(parser, arg);
1465 if (!desc)
1466 {
1467 fprintf(stderr, _("ERROR: unknown option --%s, ignored.\n"), arg);
1468 if (parser->strict)
1469 return EINA_FALSE;
1470
1471 (*idx)++;
1472 return EINA_TRUE;
1473 }
1474
1475 (*idx)++;
1476
1477 arg_req = _ecore_getopt_desc_arg_requirement(desc);
1478 if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
1479 {
1480 arg_val = strchr(arg, '=');
1481 if (arg_val)
1482 arg_val++;
1483 else
1484 {
1485 if ((*idx < *nonargs) && (argv[*idx][0] != '-'))
1486 {
1487 arg_val = argv[*idx];
1488 (*idx)++;
1489 }
1490 else
1491 arg_val = NULL;
1492 }
1493
1494 if (arg_val && arg_val[0] == '\0')
1495 arg_val = NULL;
1496
1497 if ((!arg_val) && (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES))
1498 {
1499 fprintf
1500 (stderr, _("ERROR: option --%s requires an argument!\n"), arg);
1501 if (parser->strict)
1502 return EINA_FALSE;
1503 return EINA_TRUE;
1504 }
1505 }
1506 else
1507 arg_val = NULL;
1508
1509 desc_idx = desc - parser->descs;
1510 value = values + desc_idx;
1511 ret = _ecore_getopt_desc_handle(parser, desc, value, arg_val);
1512 if ((!ret) && parser->strict)
1513 return EINA_FALSE;
1514
1515 return EINA_TRUE;
1516}
1517
1518static Eina_Bool
1519_ecore_getopt_parse_arg_short(const Ecore_Getopt *parser,
1520 Ecore_Getopt_Value *values,
1521 int argc __UNUSED__,
1522 char **argv,
1523 int *idx,
1524 int *nonargs,
1525 const char *arg)
1526{
1527 int run = 1;
1528 while (run && (arg[0] != '\0'))
1529 {
1530 int opt = arg[0];
1531 const Ecore_Getopt_Desc *desc;
1532 Ecore_Getopt_Desc_Arg_Requirement arg_req;
1533 const char *arg_val;
1534 int desc_idx;
1535 Ecore_Getopt_Value *value;
1536 Eina_Bool ret;
1537
1538 desc = _ecore_getopt_parse_find_short(parser, arg[0]);
1539 if (!desc)
1540 {
1541 fprintf
1542 (stderr, _("ERROR: unknown option -%c, ignored.\n"), arg[0]);
1543 if (parser->strict)
1544 return EINA_FALSE;
1545
1546 arg++;
1547 continue;
1548 }
1549
1550 arg++;
1551
1552 arg_req = _ecore_getopt_desc_arg_requirement(desc);
1553 if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO)
1554 {
1555 (*idx)++;
1556 run = 0;
1557
1558 if (arg[0] == '=')
1559 arg_val = arg + 1;
1560 else if (arg[0] != '\0')
1561 arg_val = arg;
1562 else
1563 {
1564 if ((*idx < *nonargs) && (argv[*idx][0] != '-'))
1565 {
1566 arg_val = argv[*idx];
1567 (*idx)++;
1568 }
1569 else
1570 arg_val = NULL;
1571 }
1572
1573 if (arg_val && arg_val[0] == '\0')
1574 arg_val = NULL;
1575
1576 if ((!arg_val) &&
1577 (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES))
1578 {
1579 fprintf
1580 (stderr, _("ERROR: option -%c requires an argument!\n"),
1581 opt);
1582 if (parser->strict)
1583 return EINA_FALSE;
1584 return EINA_TRUE;
1585 }
1586 }
1587 else
1588 arg_val = NULL;
1589
1590 desc_idx = desc - parser->descs;
1591 value = values + desc_idx;
1592 ret = _ecore_getopt_desc_handle(parser, desc, value, arg_val);
1593 if ((!ret) && parser->strict)
1594 return EINA_FALSE;
1595 }
1596
1597 if (run)
1598 (*idx)++;
1599
1600 return EINA_TRUE;
1601}
1602
1603static Eina_Bool
1604_ecore_getopt_parse_arg(const Ecore_Getopt *parser,
1605 Ecore_Getopt_Value *values,
1606 int argc,
1607 char **argv,
1608 int *idx,
1609 int *nonargs)
1610{
1611 char *arg = argv[*idx];
1612
1613 if (arg[0] != '-')
1614 {
1615 char **dst, **src, **src_end;
1616
1617 dst = argv + *idx;
1618 src = dst + 1;
1619 src_end = src + *nonargs - *idx - 1;
1620
1621 for (; src < src_end; src++, dst++)
1622 *dst = *src;
1623
1624 *dst = arg;
1625 (*nonargs)--;
1626 return EINA_TRUE;
1627 }
1628
1629 if (arg[1] == '-')
1630 return _ecore_getopt_parse_arg_long(parser, values, argc, argv, idx, nonargs, arg + 2);
1631 else
1632 return _ecore_getopt_parse_arg_short(parser, values, argc, argv, idx, nonargs, arg + 1);
1633}
1634
1635static const Ecore_Getopt_Desc *
1636_ecore_getopt_parse_find_short_other(const Ecore_Getopt *parser,
1637 const Ecore_Getopt_Desc *orig)
1638{
1639 const Ecore_Getopt_Desc *desc = parser->descs;
1640 const char c = orig->shortname;
1641
1642 for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
1643 {
1644 if (desc == orig)
1645 return NULL;
1646
1647 if (c == desc->shortname)
1648 return desc;
1649 }
1650
1651 return NULL;
1652}
1653
1654static const Ecore_Getopt_Desc *
1655_ecore_getopt_parse_find_long_other(const Ecore_Getopt *parser,
1656 const Ecore_Getopt_Desc *orig)
1657{
1658 const Ecore_Getopt_Desc *desc = parser->descs;
1659 const char *name = orig->longname;
1660
1661 for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
1662 {
1663 if (desc == orig)
1664 return NULL;
1665
1666 if (desc->longname && (strcmp(name, desc->longname) == 0))
1667 return desc;
1668 }
1669
1670 return NULL;
1671}
1672
1673/**
1674 * Check parser for duplicate entries, print them out.
1675 *
1676 * @return EINA_TRUE if there are duplicates, EINA_FALSE otherwise.
1677 */
1678Eina_Bool
1679ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser)
1680{
1681 const Ecore_Getopt_Desc *desc = parser->descs;
1682 for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
1683 {
1684 if (desc->shortname)
1685 {
1686 const Ecore_Getopt_Desc *other;
1687 other = _ecore_getopt_parse_find_short_other(parser, desc);
1688 if (other)
1689 {
1690 _ecore_getopt_desc_print_error(desc, "short name -%c already exists.", desc->shortname);
1691
1692 if (other->longname)
1693 fprintf(stderr, " Other is --%s.\n", other->longname);
1694 else
1695 fputc('\n', stderr);
1696 return EINA_TRUE;
1697 }
1698 }
1699
1700 if (desc->longname)
1701 {
1702 const Ecore_Getopt_Desc *other;
1703 other = _ecore_getopt_parse_find_long_other(parser, desc);
1704 if (other)
1705 {
1706 _ecore_getopt_desc_print_error(desc, "long name --%s already exists.", desc->longname);
1707
1708 if (other->shortname)
1709 fprintf(stderr, " Other is -%c.\n", other->shortname);
1710 else
1711 fputc('\n', stderr);
1712 return EINA_TRUE;
1713 }
1714 }
1715 }
1716 return EINA_FALSE;
1717}
1718
1719static const Ecore_Getopt_Desc *
1720_ecore_getopt_find_help(const Ecore_Getopt *parser)
1721{
1722 const Ecore_Getopt_Desc *desc = parser->descs;
1723 for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
1724 if (desc->action == ECORE_GETOPT_ACTION_HELP)
1725 return desc;
1726 return NULL;
1727}
1728
1729/**
1730 * Parse command line parameters.
1731 *
1732 * Walks the command line parameters and parse them based on @a parser
1733 * description, doing actions based on @c parser->descs->action, like
1734 * showing help text, license, copyright, storing values in values and
1735 * so on.
1736 *
1737 * It is expected that values is of the same size than @c parser->descs,
1738 * options that do not need a value it will be left untouched.
1739 *
1740 * All values are expected to be initialized before use. Options with
1741 * action @c ECORE_GETOPT_ACTION_STORE and non required arguments
1742 * (others than @c ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES), are expected
1743 * to provide a value in @c def to be used.
1744 *
1745 * The following actions will store 1 on value as a boolean
1746 * (@c value->boolp) if it's not NULL to indicate these actions were executed:
1747 * - @c ECORE_GETOPT_ACTION_HELP
1748 * - @c ECORE_GETOPT_ACTION_VERSION
1749 * - @c ECORE_GETOPT_ACTION_COPYRIGHT
1750 * - @c ECORE_GETOPT_ACTION_LICENSE
1751 *
1752 * Just @c ECORE_GETOPT_ACTION_APPEND will allocate memory and thus
1753 * need to be freed. For consistency between all of appended subtypes,
1754 * @c eina_list->data will contain an allocated memory with the value,
1755 * that is, for @c ECORE_GETOPT_TYPE_STR it will contain a copy of the
1756 * argument, @c ECORE_GETOPT_TYPE_INT a pointer to an allocated
1757 * integer and so on.
1758 *
1759 * If parser is in strict mode (see @c Ecore_Getopt->strict), then any
1760 * error will abort parsing and -1 is returned. Otherwise it will try
1761 * to continue as far as possible.
1762 *
1763 * This function may reorder @a argv elements.
1764 *
1765 * Translation of help strings (description), metavar, usage, license
1766 * and copyright may be translated, standard/global gettext() call
1767 * will be applied on them if ecore was compiled with such support.
1768 *
1769 * @param parser description of how to work.
1770 * @param values where to store values, it is assumed that this is a vector
1771 * of the same size as @c parser->descs. Values should be previously
1772 * initialized.
1773 * @param argc how many elements in @a argv. If not provided it will be
1774 * retrieved with ecore_app_args_get().
1775 * @param argv command line parameters.
1776 *
1777 * @return index of first non-option parameter or -1 on error.
1778 */
1779int
1780ecore_getopt_parse(const Ecore_Getopt *parser,
1781 Ecore_Getopt_Value *values,
1782 int argc,
1783 char **argv)
1784{
1785 int i, nonargs;
1786
1787 if (!parser)
1788 {
1789 fputs(_("ERROR: no parser provided.\n"), stderr);
1790 return -1;
1791 }
1792 if (!values)
1793 {
1794 fputs(_("ERROR: no values provided.\n"), stderr);
1795 return -1;
1796 }
1797
1798 if ((argc < 1) || (!argv))
1799 ecore_app_args_get(&argc, &argv);
1800
1801 if (argc < 1)
1802 {
1803 fputs(_("ERROR: no arguments provided.\n"), stderr);
1804 return -1;
1805 }
1806
1807 if (argv[0])
1808 prog = argv[0];
1809 else
1810 prog = parser->prog;
1811
1812 nonargs = _ecore_getopt_parse_find_nonargs_base(parser, argc, argv);
1813 if (nonargs < 0)
1814 goto error;
1815
1816 if (nonargs > argc)
1817 nonargs = argc;
1818
1819 i = 1;
1820 while (i < nonargs)
1821 if (!_ecore_getopt_parse_arg(parser, values, argc, argv, &i, &nonargs))
1822 goto error;
1823
1824 return nonargs;
1825
1826error:
1827 {
1828 const Ecore_Getopt_Desc *help;
1829 fputs(_("ERROR: invalid options found."), stderr);
1830
1831 help = _ecore_getopt_find_help(parser);
1832 if (!help)
1833 fputc('\n', stderr);
1834 else if (help->longname)
1835 fprintf(stderr, _(" See --%s.\n"), help->longname);
1836 else
1837 fprintf(stderr, _(" See -%c.\n"), help->shortname);
1838 }
1839
1840 return -1;
1841}
1842
1843/**
1844 * Utility to free list and nodes allocated by @a ECORE_GETOPT_ACTION_APPEND.
1845 *
1846 * @param list pointer to list to be freed.
1847 * @return always NULL, so you can easily make your list head NULL.
1848 */
1849Eina_List *
1850ecore_getopt_list_free(Eina_List *list)
1851{
1852 void *data;
1853
1854 EINA_LIST_FREE(list, data)
1855 free(data);
1856 return NULL;
1857}
1858
1859/**
1860 * Helper ecore_getopt callback to parse geometry (x:y:w:h).
1861 *
1862 * @param str Geometry value
1863 * @param storage must be a pointer to @c Eina_Rectangle and will be used to
1864 * store the four values passed in the given string.
1865 *
1866 * @c callback_data value is ignored, you can safely use @c NULL.
1867 */
1868Eina_Bool
1869ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__,
1870 const Ecore_Getopt_Desc *desc __UNUSED__,
1871 const char *str,
1872 void *data __UNUSED__,
1873 Ecore_Getopt_Value *storage)
1874{
1875 Eina_Rectangle *v = (Eina_Rectangle *)storage->ptrp;
1876
1877 if (sscanf(str, "%d:%d:%d:%d", &v->x, &v->y, &v->w, &v->h) != 4)
1878 {
1879 fprintf(stderr, _("ERROR: incorrect geometry value '%s'\n"), str);
1880 return EINA_FALSE;
1881 }
1882
1883 return EINA_TRUE;
1884}
1885
1886/**
1887 * Helper ecore_getopt callback to parse geometry size (WxH).
1888 *
1889 * @param str size value
1890 * @param storage must be a pointer to @c Eina_Rectangle and will be used to
1891 * store the two values passed in the given string and 0 in the x and y
1892 * fields.
1893 *
1894 * @c callback_data value is ignored, you can safely use @c NULL.
1895 */
1896Eina_Bool
1897ecore_getopt_callback_size_parse(const Ecore_Getopt *parser __UNUSED__,
1898 const Ecore_Getopt_Desc *desc __UNUSED__,
1899 const char *str,
1900 void *data __UNUSED__,
1901 Ecore_Getopt_Value *storage)
1902{
1903 Eina_Rectangle *v = (Eina_Rectangle *)storage->ptrp;
1904
1905 if (sscanf(str, "%dx%d", &v->w, &v->h) != 2)
1906 {
1907 fprintf(stderr, _("ERROR: incorrect size value '%s'\n"), str);
1908 return EINA_FALSE;
1909 }
1910 v->x = 0;
1911 v->y = 0;
1912
1913 return EINA_TRUE;
1914}
1915
diff --git a/libraries/ecore/src/lib/ecore/ecore_glib.c b/libraries/ecore/src/lib/ecore/ecore_glib.c
deleted file mode 100644
index 7cea1c9..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_glib.c
+++ /dev/null
@@ -1,342 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10
11#ifdef HAVE_GLIB
12#include <glib.h>
13
14static Eina_Bool _ecore_glib_active = EINA_FALSE;
15static Ecore_Select_Function _ecore_glib_select_original;
16static GCond *_ecore_glib_cond = NULL;
17static GPollFD *_ecore_glib_fds = NULL;
18static size_t _ecore_glib_fds_size = 0;
19static const size_t ECORE_GLIB_FDS_INITIAL = 128;
20static const size_t ECORE_GLIB_FDS_STEP = 8;
21static const size_t ECORE_GLIB_FDS_MAX_FREE = 256;
22
23static Eina_Bool
24_ecore_glib_fds_resize(size_t size)
25{
26 void *tmp = realloc(_ecore_glib_fds, sizeof(GPollFD) * size);
27
28 if (!tmp)
29 {
30 ERR("Could not realloc from %zu to %zu buckets.",
31 _ecore_glib_fds_size, size);
32 return EINA_FALSE;
33 }
34
35 _ecore_glib_fds = tmp;
36 _ecore_glib_fds_size = size;
37 return EINA_TRUE;
38}
39
40static int
41_ecore_glib_context_query(GMainContext *ctx,
42 int priority,
43 int *p_timer)
44{
45 int reqfds;
46
47 if (_ecore_glib_fds_size == 0)
48 {
49 if (!_ecore_glib_fds_resize(ECORE_GLIB_FDS_INITIAL)) return -1;
50 }
51
52 while (1)
53 {
54 size_t size;
55
56 reqfds = g_main_context_query
57 (ctx, priority, p_timer, _ecore_glib_fds, _ecore_glib_fds_size);
58 if (reqfds <= (int)_ecore_glib_fds_size) break;
59
60 size = (1 + reqfds / ECORE_GLIB_FDS_STEP) * ECORE_GLIB_FDS_STEP;
61 if (!_ecore_glib_fds_resize(size)) return -1;
62 }
63
64 if (reqfds + ECORE_GLIB_FDS_MAX_FREE < _ecore_glib_fds_size)
65 {
66 size_t size;
67
68 size = (1 + reqfds / ECORE_GLIB_FDS_MAX_FREE) * ECORE_GLIB_FDS_MAX_FREE;
69 _ecore_glib_fds_resize(size);
70 }
71
72 return reqfds;
73}
74
75static int
76_ecore_glib_context_poll_from(const GPollFD *pfds,
77 int count,
78 fd_set *rfds,
79 fd_set *wfds,
80 fd_set *efds)
81{
82 const GPollFD *itr = pfds, *itr_end = pfds + count;
83 int glib_fds = -1;
84
85 for (; itr < itr_end; itr++)
86 {
87 if (glib_fds < itr->fd)
88 glib_fds = itr->fd;
89
90 if (itr->events & G_IO_IN)
91 FD_SET(itr->fd, rfds);
92 if (itr->events & G_IO_OUT)
93 FD_SET(itr->fd, wfds);
94 if (itr->events & (G_IO_HUP | G_IO_ERR))
95 FD_SET(itr->fd, efds);
96 }
97
98 return glib_fds + 1;
99}
100
101static int
102_ecore_glib_context_poll_to(GPollFD *pfds,
103 int count,
104 const fd_set *rfds,
105 const fd_set *wfds,
106 const fd_set *efds,
107 int ready)
108{
109 GPollFD *itr = pfds, *itr_end = pfds + count;
110
111 for (; itr < itr_end && ready > 0; itr++)
112 {
113 itr->revents = 0;
114 if (FD_ISSET(itr->fd, rfds))
115 {
116 itr->revents |= G_IO_IN;
117 ready--;
118 }
119 if (FD_ISSET(itr->fd, wfds))
120 {
121 itr->revents |= G_IO_OUT;
122 ready--;
123 }
124 if (FD_ISSET(itr->fd, efds))
125 {
126 itr->revents |= G_IO_ERR;
127 ready--;
128 }
129 }
130 return ready;
131}
132
133static int
134_ecore_glib_select__locked(GMainContext *ctx,
135 int ecore_fds,
136 fd_set *rfds,
137 fd_set *wfds,
138 fd_set *efds,
139 struct timeval *ecore_timeout)
140{
141 int priority, maxfds, glib_fds, reqfds, reqtimeout, ret;
142 struct timeval *timeout, glib_timeout;
143
144 g_main_context_prepare(ctx, &priority);
145 reqfds = _ecore_glib_context_query(ctx, priority, &reqtimeout);
146 if (reqfds < 0) goto error;
147
148 glib_fds = _ecore_glib_context_poll_from
149 (_ecore_glib_fds, reqfds, rfds, wfds, efds);
150
151 if (reqtimeout == -1)
152 timeout = ecore_timeout;
153 else
154 {
155 glib_timeout.tv_sec = reqtimeout / 1000;
156 glib_timeout.tv_usec = (reqtimeout % 1000) * 1000;
157
158 if (!ecore_timeout || timercmp(ecore_timeout, &glib_timeout, >))
159 timeout = &glib_timeout;
160 else
161 timeout = ecore_timeout;
162 }
163
164 maxfds = (ecore_fds >= glib_fds) ? ecore_fds : glib_fds;
165 ret = _ecore_glib_select_original(maxfds, rfds, wfds, efds, timeout);
166
167 ret = _ecore_glib_context_poll_to
168 (_ecore_glib_fds, reqfds, rfds, wfds, efds, ret);
169
170 if (g_main_context_check(ctx, priority, _ecore_glib_fds, reqfds))
171 g_main_context_dispatch(ctx);
172
173 return ret;
174
175error:
176 return _ecore_glib_select_original
177 (ecore_fds, rfds, wfds, efds, ecore_timeout);
178}
179
180static int
181_ecore_glib_select(int ecore_fds,
182 fd_set *rfds,
183 fd_set *wfds,
184 fd_set *efds,
185 struct timeval *ecore_timeout)
186{
187 GStaticMutex lock = G_STATIC_MUTEX_INIT;
188 GMutex *mutex = g_static_mutex_get_mutex(&lock);
189 GMainContext *ctx = g_main_context_default();
190 int ret;
191
192 if (g_main_context_acquire(ctx))
193 {
194 if (mutex) g_mutex_lock(mutex);
195 }
196 else
197 {
198 if (!_ecore_glib_cond)
199 _ecore_glib_cond = g_cond_new();
200
201 while (!g_main_context_wait(ctx, _ecore_glib_cond, mutex))
202 g_thread_yield();
203 }
204
205 ret = _ecore_glib_select__locked
206 (ctx, ecore_fds, rfds, wfds, efds, ecore_timeout);
207
208 if (mutex) g_mutex_unlock(mutex);
209 g_main_context_release(ctx);
210 g_static_mutex_free(&lock);
211
212 return ret;
213}
214
215#endif
216
217void
218_ecore_glib_init(void)
219{
220}
221
222void
223_ecore_glib_shutdown(void)
224{
225#ifdef HAVE_GLIB
226 if (!_ecore_glib_active) return;
227 _ecore_glib_active = EINA_FALSE;
228
229 if (ecore_main_loop_select_func_get() == _ecore_glib_select)
230 ecore_main_loop_select_func_set(_ecore_glib_select_original);
231
232 if (_ecore_glib_fds)
233 {
234 free(_ecore_glib_fds);
235 _ecore_glib_fds = NULL;
236 }
237 _ecore_glib_fds_size = 0;
238
239 if (_ecore_glib_cond)
240 {
241 g_cond_free(_ecore_glib_cond);
242 _ecore_glib_cond = NULL;
243 }
244#endif
245}
246
247/**
248 * @addtogroup Ecore_Main_Loop_Group
249 *
250 * @}
251 */
252
253/**
254 * Request ecore to integrate GLib's main loop.
255 *
256 * This will add a small overhead during every main loop interaction
257 * by checking glib's default main context (used by its main loop). If
258 * it have events to be checked (timers, file descriptors or idlers),
259 * then these will be polled alongside with Ecore's own events, then
260 * dispatched before Ecore's. This is done by calling
261 * ecore_main_loop_select_func_set().
262 *
263 * This will cooperate with previously set
264 * ecore_main_loop_select_func_set() by calling the old
265 * function. Similarly, if you want to override
266 * ecore_main_loop_select_func_set() after main loop is integrated,
267 * call the new select function set by this call (get it by calling
268 * ecore_main_loop_select_func_get() right after
269 * ecore_main_loop_glib_integrate()).
270 *
271 * This is useful to use GMainLoop libraries, like GTK, GUPnP,
272 * LibSoup, GConf and more. Adobe Flash plugin and other plugins
273 * systems depend on this as well.
274 *
275 * Once initialized/integrated, it will be valid until Ecore is
276 * completely shut down.
277 *
278 * Example of use:
279 * @code
280 *
281 * int main(void)
282 * {
283 * ecore_init();
284 * ecore_main_loop_glib_integrate();
285 *
286 * // some code here
287 *
288 * ecore_main_loop_begin();
289 *
290 * ecore_shutdown();
291 *
292 * return 0;
293 * }
294 *
295 * @endcode
296 *
297 * @note This is only available if Ecore was compiled with GLib support.
298 * @note You don't need to call this function if Ecore was compiled with
299 * --enable-glib-integration-always.
300 *
301 * @return @c EINA_TRUE on success of @c EINA_FALSE if it failed,
302 * likely no GLib support in Ecore.
303 */
304EAPI Eina_Bool
305ecore_main_loop_glib_integrate(void)
306{
307#ifdef HAVE_GLIB
308 void *func;
309
310 if (_ecore_glib_active) return EINA_TRUE;
311 func = ecore_main_loop_select_func_get();
312 if (func == _ecore_glib_select) return EINA_TRUE;
313 _ecore_glib_select_original = func;
314 ecore_main_loop_select_func_set(_ecore_glib_select);
315 _ecore_glib_active = EINA_TRUE;
316 return EINA_TRUE;
317#else
318 fputs("ERROR: no glib support in ecore.\n", stderr);
319 return EINA_FALSE;
320#endif
321}
322
323Eina_Bool _ecore_glib_always_integrate = 1;
324
325/**
326 * Disable always integrating glib
327 *
328 * If ecore is compiled with --enable-glib-integration-always (to always
329 * call ecore_main_loop_glib_integrate() when ecore_init() is called), then
330 * calling this before calling ecore_init() will disable the integration.
331 * This is for apps that explicitly do not want this to happen for whatever
332 * reasons they may have.
333 */
334EAPI void
335ecore_main_loop_glib_always_integrate_disable(void)
336{
337 _ecore_glib_always_integrate = 0;
338}
339
340/**
341 * @}
342 */
diff --git a/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c b/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c
deleted file mode 100644
index 8e4ae50..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c
+++ /dev/null
@@ -1,208 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9
10struct _Ecore_Idle_Enterer
11{
12 EINA_INLIST;
13 ECORE_MAGIC;
14 Ecore_Task_Cb func;
15 void *data;
16 int references;
17 Eina_Bool delete_me : 1;
18};
19GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Enterer);
20
21static Ecore_Idle_Enterer *idle_enterers = NULL;
22static Ecore_Idle_Enterer *idle_enterer_current = NULL;
23static int idle_enterers_delete_me = 0;
24
25static void *
26_ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
27
28/**
29 * @addtogroup Ecore_Idle_Group
30 *
31 * @{
32 */
33
34/**
35 * Add an idle enterer handler.
36 * @param func The function to call when entering an idle state.
37 * @param data The data to be passed to the @p func call
38 * @return A handle to the idle enterer callback if successful. Otherwise,
39 * NULL is returned.
40 * @note The function func will be called every time the main loop is entering
41 * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
42 * (or ECORE_CALLBACK_CANCEL) deletes the idle enterer.
43 */
44EAPI Ecore_Idle_Enterer *
45ecore_idle_enterer_add(Ecore_Task_Cb func,
46 const void *data)
47{
48 Ecore_Idle_Enterer *ie = NULL;
49
50 _ecore_lock();
51
52 if (!func) goto unlock;
53 ie = ecore_idle_enterer_calloc(1);
54 if (!ie) goto unlock;
55 ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
56 ie->func = func;
57 ie->data = (void *)data;
58 idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
59unlock:
60 _ecore_unlock();
61 return ie;
62}
63
64/**
65 * Add an idle enterer handler at the start of the list so it gets called earlier than others.
66 * @param func The function to call when entering an idle state.
67 * @param data The data to be passed to the @p func call
68 * @return A handle to the idle enterer callback if successful. Otherwise,
69 * NULL is returned.
70 * @note The function func will be called every time the main loop is entering
71 * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
72 * (or ECORE_CALLBACK_CANCEL) deletes the idle enterer.
73 */
74EAPI Ecore_Idle_Enterer *
75ecore_idle_enterer_before_add(Ecore_Task_Cb func,
76 const void *data)
77{
78 Ecore_Idle_Enterer *ie = NULL;
79
80 _ecore_lock();
81
82 if (!func) goto unlock;
83 ie = ecore_idle_enterer_calloc(1);
84 if (!ie) goto unlock;
85 ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
86 ie->func = func;
87 ie->data = (void *)data;
88 idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
89unlock:
90 _ecore_unlock();
91 return ie;
92}
93
94/**
95 * Delete an idle enterer callback.
96 * @param idle_enterer The idle enterer to delete
97 * @return The data pointer passed to the idler enterer callback on success.
98 * NULL otherwise.
99 */
100EAPI void *
101ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
102{
103 void *data;
104
105 if (!ECORE_MAGIC_CHECK(idle_enterer, ECORE_MAGIC_IDLE_ENTERER))
106 {
107 ECORE_MAGIC_FAIL(idle_enterer, ECORE_MAGIC_IDLE_ENTERER,
108 "ecore_idle_enterer_del");
109 return NULL;
110 }
111 _ecore_lock();
112 data = _ecore_idle_enterer_del(idle_enterer);
113 _ecore_unlock();
114 return data;
115}
116
117/**
118 * @}
119 */
120
121static void *
122_ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
123{
124 EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_enterer->delete_me, NULL);
125 idle_enterer->delete_me = 1;
126 idle_enterers_delete_me = 1;
127 return idle_enterer->data;
128}
129
130void
131_ecore_idle_enterer_shutdown(void)
132{
133 Ecore_Idle_Enterer *ie;
134 while ((ie = idle_enterers))
135 {
136 idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
137 ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
138 ecore_idle_enterer_mp_free(ie);
139 }
140 idle_enterers_delete_me = 0;
141 idle_enterer_current = NULL;
142}
143
144void
145_ecore_idle_enterer_call(void)
146{
147 if (!idle_enterer_current)
148 {
149 /* regular main loop, start from head */
150 idle_enterer_current = idle_enterers;
151 }
152 else
153 {
154 /* recursive main loop, continue from where we were */
155 idle_enterer_current =
156 (Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
157 }
158
159 while (idle_enterer_current)
160 {
161 Ecore_Idle_Enterer *ie = (Ecore_Idle_Enterer *)idle_enterer_current;
162 if (!ie->delete_me)
163 {
164 ie->references++;
165 if (!_ecore_call_task_cb(ie->func, ie->data))
166 {
167 if (!ie->delete_me) _ecore_idle_enterer_del(ie);
168 }
169 ie->references--;
170 }
171 if (idle_enterer_current) /* may have changed in recursive main loops */
172 idle_enterer_current =
173 (Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
174 }
175 if (idle_enterers_delete_me)
176 {
177 Ecore_Idle_Enterer *l;
178 int deleted_idler_enterers_in_use = 0;
179
180 for (l = idle_enterers; l; )
181 {
182 Ecore_Idle_Enterer *ie = l;
183 l = (Ecore_Idle_Enterer *)EINA_INLIST_GET(l)->next;
184 if (ie->delete_me)
185 {
186 if (ie->references)
187 {
188 deleted_idler_enterers_in_use++;
189 continue;
190 }
191
192 idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
193 ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
194 ecore_idle_enterer_mp_free(ie);
195 }
196 }
197 if (!deleted_idler_enterers_in_use)
198 idle_enterers_delete_me = 0;
199 }
200}
201
202int
203_ecore_idle_enterer_exist(void)
204{
205 if (idle_enterers) return 1;
206 return 0;
207}
208
diff --git a/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c b/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c
deleted file mode 100644
index 4e454e2..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c
+++ /dev/null
@@ -1,177 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9
10struct _Ecore_Idle_Exiter
11{
12 EINA_INLIST;
13 ECORE_MAGIC;
14 Ecore_Task_Cb func;
15 void *data;
16 int references;
17 Eina_Bool delete_me : 1;
18};
19GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Exiter);
20
21static Ecore_Idle_Exiter *idle_exiters = NULL;
22static Ecore_Idle_Exiter *idle_exiter_current = NULL;
23static int idle_exiters_delete_me = 0;
24
25static void *
26_ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
27
28/**
29 * @addtogroup Ecore_Idle_Group
30 *
31 * @{
32 */
33
34/**
35 * Add an idle exiter handler.
36 * @param func The function to call when exiting an idle state.
37 * @param data The data to be passed to the @p func call
38 * @return A handle to the idle exiter callback on success. NULL otherwise.
39 * @note The function func will be called every time the main loop is exiting
40 * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0
41 * (or ECORE_CALLBACK_CANCEL) deletes the idle exiter.
42 */
43EAPI Ecore_Idle_Exiter *
44ecore_idle_exiter_add(Ecore_Task_Cb func,
45 const void *data)
46{
47 Ecore_Idle_Exiter *ie = NULL;
48
49 _ecore_lock();
50 if (!func) goto unlock;
51 ie = ecore_idle_exiter_calloc(1);
52 if (!ie) goto unlock;
53 ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER);
54 ie->func = func;
55 ie->data = (void *)data;
56 idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
57unlock:
58 _ecore_unlock();
59 return ie;
60}
61
62/**
63 * Delete an idle exiter handler from the list to be run on exiting idle state.
64 * @param idle_exiter The idle exiter to delete
65 * @return The data pointer that was being being passed to the handler if
66 * successful. NULL otherwise.
67 */
68EAPI void *
69ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
70{
71 void *data;
72
73 if (!ECORE_MAGIC_CHECK(idle_exiter, ECORE_MAGIC_IDLE_EXITER))
74 {
75 ECORE_MAGIC_FAIL(idle_exiter, ECORE_MAGIC_IDLE_EXITER,
76 "ecore_idle_exiter_del");
77 return NULL;
78 }
79 _ecore_lock();
80 data = _ecore_idle_exiter_del(idle_exiter);
81 _ecore_unlock();
82 return data;
83}
84
85/**
86 * @}
87 */
88
89static void *
90_ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
91{
92 EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL);
93 idle_exiter->delete_me = 1;
94 idle_exiters_delete_me = 1;
95 return idle_exiter->data;
96}
97
98void
99_ecore_idle_exiter_shutdown(void)
100{
101 Ecore_Idle_Exiter *ie;
102 while ((ie = idle_exiters))
103 {
104 idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
105 ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
106 ecore_idle_exiter_mp_free(ie);
107 }
108 idle_exiters_delete_me = 0;
109 idle_exiter_current = NULL;
110}
111
112void
113_ecore_idle_exiter_call(void)
114{
115 if (!idle_exiter_current)
116 {
117 /* regular main loop, start from head */
118 idle_exiter_current = idle_exiters;
119 }
120 else
121 {
122 /* recursive main loop, continue from where we were */
123 idle_exiter_current =
124 (Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
125 }
126
127 while (idle_exiter_current)
128 {
129 Ecore_Idle_Exiter *ie = (Ecore_Idle_Exiter *)idle_exiter_current;
130 if (!ie->delete_me)
131 {
132 ie->references++;
133 if (!_ecore_call_task_cb(ie->func, ie->data))
134 {
135 if (!ie->delete_me) _ecore_idle_exiter_del(ie);
136 }
137 ie->references--;
138 }
139 if (idle_exiter_current) /* may have changed in recursive main loops */
140 idle_exiter_current =
141 (Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
142 }
143 if (idle_exiters_delete_me)
144 {
145 Ecore_Idle_Exiter *l;
146 int deleted_idler_exiters_in_use = 0;
147
148 for (l = idle_exiters; l; )
149 {
150 Ecore_Idle_Exiter *ie = l;
151
152 l = (Ecore_Idle_Exiter *)EINA_INLIST_GET(l)->next;
153 if (ie->delete_me)
154 {
155 if (ie->references)
156 {
157 deleted_idler_exiters_in_use++;
158 continue;
159 }
160
161 idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
162 ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
163 ecore_idle_exiter_mp_free(ie);
164 }
165 }
166 if (!deleted_idler_exiters_in_use)
167 idle_exiters_delete_me = 0;
168 }
169}
170
171int
172_ecore_idle_exiter_exist(void)
173{
174 if (idle_exiters) return 1;
175 return 0;
176}
177
diff --git a/libraries/ecore/src/lib/ecore/ecore_idler.c b/libraries/ecore/src/lib/ecore/ecore_idler.c
deleted file mode 100644
index 5114654..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_idler.c
+++ /dev/null
@@ -1,159 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9
10struct _Ecore_Idler
11{
12 EINA_INLIST;
13 ECORE_MAGIC;
14 Ecore_Task_Cb func;
15 void *data;
16 int references;
17 Eina_Bool delete_me : 1;
18};
19GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idler);
20
21static Ecore_Idler *idlers = NULL;
22static Ecore_Idler *idler_current = NULL;
23static int idlers_delete_me = 0;
24
25static void *
26_ecore_idler_del(Ecore_Idler *idler);
27
28EAPI Ecore_Idler *
29ecore_idler_add(Ecore_Task_Cb func,
30 const void *data)
31{
32 Ecore_Idler *ie = NULL;
33
34 _ecore_lock();
35 if (!func) goto unlock;
36 ie = ecore_idler_calloc(1);
37 if (!ie) goto unlock;
38 ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLER);
39 ie->func = func;
40 ie->data = (void *)data;
41 idlers = (Ecore_Idler *)eina_inlist_append(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
42unlock:
43 _ecore_unlock();
44 return ie;
45}
46
47EAPI void *
48ecore_idler_del(Ecore_Idler *idler)
49{
50 void *data = NULL;
51
52 if (!ECORE_MAGIC_CHECK(idler, ECORE_MAGIC_IDLER))
53 {
54 ECORE_MAGIC_FAIL(idler, ECORE_MAGIC_IDLER,
55 "ecore_idler_del");
56 return NULL;
57 }
58
59 _ecore_lock();
60 data = _ecore_idler_del(idler);
61 _ecore_unlock();
62 return data;
63}
64
65/**
66 * @}
67 */
68
69/**
70 * @}
71 */
72
73static void *
74_ecore_idler_del(Ecore_Idler *idler)
75{
76 EINA_SAFETY_ON_TRUE_RETURN_VAL(idler->delete_me, NULL);
77 idler->delete_me = 1;
78 idlers_delete_me = 1;
79 return idler->data;
80}
81
82void
83_ecore_idler_shutdown(void)
84{
85 Ecore_Idler *ie;
86 while ((ie = idlers))
87 {
88 idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
89 ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
90 ecore_idler_mp_free(ie);
91 }
92 idlers_delete_me = 0;
93 idler_current = NULL;
94}
95
96int
97_ecore_idler_all_call(void)
98{
99 if (!idler_current)
100 {
101 /* regular main loop, start from head */
102 idler_current = idlers;
103 }
104 else
105 {
106 /* recursive main loop, continue from where we were */
107 idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next;
108 }
109
110 while (idler_current)
111 {
112 Ecore_Idler *ie = (Ecore_Idler *)idler_current;
113 if (!ie->delete_me)
114 {
115 ie->references++;
116 if (!_ecore_call_task_cb(ie->func, ie->data))
117 {
118 if (!ie->delete_me) _ecore_idler_del(ie);
119 }
120 ie->references--;
121 }
122 if (idler_current) /* may have changed in recursive main loops */
123 idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next;
124 }
125 if (idlers_delete_me)
126 {
127 Ecore_Idler *l;
128 int deleted_idlers_in_use = 0;
129 for (l = idlers; l; )
130 {
131 Ecore_Idler *ie = l;
132 l = (Ecore_Idler *)EINA_INLIST_GET(l)->next;
133 if (ie->delete_me)
134 {
135 if (ie->references)
136 {
137 deleted_idlers_in_use++;
138 continue;
139 }
140
141 idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
142 ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
143 ecore_idler_mp_free(ie);
144 }
145 }
146 if (!deleted_idlers_in_use)
147 idlers_delete_me = 0;
148 }
149 if (idlers) return 1;
150 return 0;
151}
152
153int
154_ecore_idler_exist(void)
155{
156 if (idlers) return 1;
157 return 0;
158}
159
diff --git a/libraries/ecore/src/lib/ecore/ecore_job.c b/libraries/ecore/src/lib/ecore/ecore_job.c
deleted file mode 100644
index ac27c7a..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_job.c
+++ /dev/null
@@ -1,123 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9
10static Eina_Bool _ecore_job_event_handler(void *data,
11 int type,
12 void *ev);
13static void _ecore_job_event_free(void *data,
14 void *ev);
15
16static int ecore_event_job_type = 0;
17static Ecore_Event_Handler *_ecore_job_handler = NULL;
18
19struct _Ecore_Job
20{
21 ECORE_MAGIC;
22 Ecore_Event *event;
23 Ecore_Cb func;
24 void *data;
25};
26GENERIC_ALLOC_SIZE_DECLARE(Ecore_Job);
27
28void
29_ecore_job_init(void)
30{
31 ecore_event_job_type = ecore_event_type_new();
32 _ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL);
33}
34
35void
36_ecore_job_shutdown(void)
37{
38 _ecore_event_handler_del(_ecore_job_handler);
39 _ecore_job_handler = NULL;
40}
41
42/**
43 * @addtogroup Ecore_Job_Group
44 *
45 * @{
46 */
47
48/**
49 * Add a job to the event queue.
50 * @param func The function to call when the job gets handled.
51 * @param data Data pointer to be passed to the job function when the job is
52 * handled.
53 * @return The handle of the job. @c NULL is returned if the job could not be
54 * added to the queue.
55 * @note Once the job has been executed, the job handle is invalid.
56 */
57EAPI Ecore_Job *
58ecore_job_add(Ecore_Cb func,
59 const void *data)
60{
61 Ecore_Job *job;
62
63 if (!func) return NULL;
64
65 job = ecore_job_calloc(1);
66 if (!job) return NULL;
67 ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB);
68 job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, NULL);
69 if (!job->event)
70 {
71 ecore_job_mp_free(job);
72 return NULL;
73 }
74 job->func = func;
75 job->data = (void *)data;
76 return job;
77}
78
79/**
80 * Delete a queued job that has not yet been executed.
81 * @param job Handle of the job to delete.
82 * @return The data pointer that was to be passed to the job.
83 */
84EAPI void *
85ecore_job_del(Ecore_Job *job)
86{
87 void *data;
88
89 if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_JOB))
90 {
91 ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB,
92 "ecore_job_del");
93 return NULL;
94 }
95 data = job->data;
96 ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE);
97 ecore_event_del(job->event);
98 return data;
99}
100
101/**
102 * @}
103 */
104
105static Eina_Bool
106_ecore_job_event_handler(void *data __UNUSED__,
107 int type __UNUSED__,
108 void *ev)
109{
110 Ecore_Job *job;
111
112 job = ev;
113 job->func(job->data);
114 return ECORE_CALLBACK_CANCEL;
115}
116
117static void
118_ecore_job_event_free(void *data __UNUSED__,
119 void *job)
120{
121 ecore_job_mp_free(job);
122}
123
diff --git a/libraries/ecore/src/lib/ecore/ecore_main.c b/libraries/ecore/src/lib/ecore/ecore_main.c
deleted file mode 100644
index 587c83b..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_main.c
+++ /dev/null
@@ -1,1958 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef _WIN32
6# define WIN32_LEAN_AND_MEAN
7# include <winsock2.h>
8# undef WIN32_LEAN_AND_MEAN
9# ifndef USER_TIMER_MINIMUM
10# define USER_TIMER_MINIMUM 0x0a
11# endif
12#endif
13
14#ifdef __SUNPRO_C
15# include <ieeefp.h>
16# include <string.h>
17#endif
18
19#include <stdlib.h>
20#include <stdio.h>
21#include <math.h>
22#include <sys/types.h>
23#include <errno.h>
24#include <fcntl.h>
25
26#ifndef _MSC_VER
27# include <sys/time.h>
28# include <unistd.h>
29#else
30# include <float.h>
31#endif
32
33#ifdef HAVE_ISFINITE
34# define ECORE_FINITE(t) isfinite(t)
35#else
36# ifdef _MSC_VER
37# define ECORE_FINITE(t) _finite(t)
38# else
39# define ECORE_FINITE(t) finite(t)
40# endif
41#endif
42
43//#define FIX_HZ 1
44
45#ifdef FIX_HZ
46# ifndef _MSC_VER
47# include <sys/param.h>
48# endif
49# ifndef HZ
50# define HZ 100
51# endif
52#endif
53
54#ifdef HAVE_EVIL
55# include <Evil.h>
56#endif
57
58#include "Ecore.h"
59#include "ecore_private.h"
60
61#ifdef HAVE_SYS_EPOLL_H
62# define HAVE_EPOLL 1
63# include <sys/epoll.h>
64#else
65
66# define HAVE_EPOLL 0
67# define EPOLLIN 1
68# define EPOLLOUT 2
69# define EPOLLERR 8
70
71#define EPOLL_CTL_ADD 1
72#define EPOLL_CTL_DEL 2
73#define EPOLL_CTL_MOD 3
74
75typedef union epoll_data {
76 void *ptr;
77 int fd;
78 uint32_t u32;
79 uint64_t u64;
80} epoll_data_t;
81
82struct epoll_event
83{
84 uint32_t events;
85 epoll_data_t data;
86};
87
88static inline int
89epoll_create(int size __UNUSED__)
90{
91 return -1;
92}
93
94static inline int
95epoll_wait(int epfd __UNUSED__,
96 struct epoll_event *events __UNUSED__,
97 int maxevents __UNUSED__,
98 int timeout __UNUSED__)
99{
100 return -1;
101}
102
103static inline int
104epoll_ctl(int epfd __UNUSED__,
105 int op __UNUSED__,
106 int fd __UNUSED__,
107 struct epoll_event *event __UNUSED__)
108{
109 return -1;
110}
111
112#endif
113
114#ifdef HAVE_SYS_TIMERFD_H
115#include <sys/timerfd.h>
116#else
117/* fallback code if we don't have real timerfd - reduces number of ifdefs */
118#ifndef CLOCK_MONOTONIC
119#define CLOCK_MONOTONIC 0 /* bogus value */
120#endif
121#ifndef TFD_NONBLOCK
122#define TFD_NONBLOCK 0 /* bogus value */
123#endif
124static inline int
125timerfd_create(int clockid __UNUSED__,
126 int flags __UNUSED__)
127{
128 return -1;
129}
130
131static inline int
132timerfd_settime(int fd __UNUSED__,
133 int flags __UNUSED__,
134 const struct itimerspec *new_value __UNUSED__,
135 struct itimerspec *old_value __UNUSED__)
136{
137 return -1;
138}
139
140#endif /* HAVE_SYS_TIMERFD_H */
141
142#ifdef USE_G_MAIN_LOOP
143# include <glib.h>
144#endif
145
146#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0)
147
148struct _Ecore_Fd_Handler
149{
150 EINA_INLIST;
151 ECORE_MAGIC;
152 Ecore_Fd_Handler *next_ready;
153 int fd;
154 Ecore_Fd_Handler_Flags flags;
155 Ecore_Fd_Cb func;
156 void *data;
157 Ecore_Fd_Cb buf_func;
158 void *buf_data;
159 Ecore_Fd_Prep_Cb prep_func;
160 void *prep_data;
161 int references;
162 Eina_Bool read_active : 1;
163 Eina_Bool write_active : 1;
164 Eina_Bool error_active : 1;
165 Eina_Bool delete_me : 1;
166#if defined(USE_G_MAIN_LOOP)
167 GPollFD gfd;
168#endif
169};
170GENERIC_ALLOC_SIZE_DECLARE(Ecore_Fd_Handler);
171
172#ifdef _WIN32
173struct _Ecore_Win32_Handler
174{
175 EINA_INLIST;
176 ECORE_MAGIC;
177 HANDLE h;
178 Ecore_Win32_Handle_Cb func;
179 void *data;
180 int references;
181 Eina_Bool delete_me : 1;
182};
183GENERIC_ALLOC_SIZE_DECLARE(Ecore_Win32_Handler);
184#endif
185
186#ifndef USE_G_MAIN_LOOP
187static int _ecore_main_select(double timeout);
188#endif
189static void _ecore_main_prepare_handlers(void);
190static void _ecore_main_fd_handlers_cleanup(void);
191#ifndef _WIN32
192# ifndef USE_G_MAIN_LOOP
193static void _ecore_main_fd_handlers_bads_rem(void);
194# endif
195#endif
196static void _ecore_main_fd_handlers_call(void);
197static int _ecore_main_fd_handlers_buf_call(void);
198#ifndef USE_G_MAIN_LOOP
199static void _ecore_main_loop_iterate_internal(int once_only);
200#endif
201
202#ifdef _WIN32
203static int _ecore_main_win32_select(int nfds,
204 fd_set *readfds,
205 fd_set *writefds,
206 fd_set *exceptfds,
207 struct timeval *timeout);
208static void _ecore_main_win32_handlers_cleanup(void);
209#endif
210
211static int in_main_loop = 0;
212static int do_quit = 0;
213static Ecore_Fd_Handler *fd_handlers = NULL;
214static Ecore_Fd_Handler *fd_handler_current = NULL;
215static Eina_List *fd_handlers_with_prep = NULL;
216static Eina_List *fd_handlers_with_buffer = NULL;
217static Eina_List *fd_handlers_to_delete = NULL;
218
219/* single linked list of ready fdhs, terminated by loop to self */
220static Ecore_Fd_Handler *fd_handlers_to_call;
221static Ecore_Fd_Handler *fd_handlers_to_call_current;
222
223#ifdef _WIN32
224static Ecore_Win32_Handler *win32_handlers = NULL;
225static Ecore_Win32_Handler *win32_handler_current = NULL;
226static Eina_Bool win32_handlers_delete_me = EINA_FALSE;
227#endif
228
229#ifdef _WIN32
230Ecore_Select_Function main_loop_select = _ecore_main_win32_select;
231#else
232# if !defined EXOTIC_NO_SELECT
233# ifdef HAVE_SYS_SELECT_H
234# include <sys/select.h>
235# endif
236Ecore_Select_Function main_loop_select = select;
237# else
238Ecore_Select_Function main_loop_select = NULL;
239# endif
240#endif
241
242#ifndef USE_G_MAIN_LOOP
243static double t1 = 0.0;
244static double t2 = 0.0;
245#endif
246
247static int timer_fd = -1;
248static int epoll_fd = -1;
249static pid_t epoll_pid;
250
251#ifdef USE_G_MAIN_LOOP
252static GPollFD ecore_epoll_fd;
253static GPollFD ecore_timer_fd;
254static GSource *ecore_glib_source;
255static guint ecore_glib_source_id;
256static GMainLoop *ecore_main_loop;
257static gboolean ecore_idling;
258static gboolean _ecore_glib_idle_enterer_called;
259static gboolean ecore_fds_ready;
260#endif
261
262static inline void
263_ecore_fd_valid(void)
264{
265 if (HAVE_EPOLL && epoll_fd >= 0)
266 {
267 if (fcntl(epoll_fd, F_GETFD) < 0)
268 {
269 ERR("arghhh you caught me! report a backtrace to edevel!");
270 pause();
271 }
272 }
273}
274
275static inline void
276_ecore_try_add_to_call_list(Ecore_Fd_Handler *fdh)
277{
278 /* check if this fdh is already in the list */
279 if (fdh->next_ready)
280 return;
281 if (fdh->read_active || fdh->write_active || fdh->error_active)
282 {
283 /*
284 * make sure next_ready is non-null by pointing to ourselves
285 * use that to indicate this fdh is in the ready list
286 * insert at the head of the list to avoid trouble
287 */
288 fdh->next_ready = fd_handlers_to_call ? fd_handlers_to_call : fdh;
289 fd_handlers_to_call = fdh;
290 }
291}
292
293static inline int
294_ecore_get_epoll_fd(void)
295{
296 if (epoll_pid && epoll_pid != getpid())
297 {
298 /* forked! */
299 _ecore_main_loop_shutdown();
300 }
301 if (epoll_pid == 0 && epoll_fd < 0)
302 {
303 _ecore_main_loop_init();
304 }
305 return epoll_fd;
306}
307
308static inline int
309_ecore_epoll_add(int efd,
310 int fd,
311 int events,
312 void *ptr)
313{
314 struct epoll_event ev;
315
316 memset(&ev, 0, sizeof (ev));
317 ev.events = events;
318 ev.data.ptr = ptr;
319 INF("adding poll on %d %08x", fd, events);
320 return epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ev);
321}
322
323static inline int
324_ecore_poll_events_from_fdh(Ecore_Fd_Handler *fdh)
325{
326 int events = 0;
327 if (fdh->flags & ECORE_FD_READ) events |= EPOLLIN;
328 if (fdh->flags & ECORE_FD_WRITE) events |= EPOLLOUT;
329 if (fdh->flags & ECORE_FD_ERROR) events |= EPOLLERR;
330 return events;
331}
332
333#ifdef USE_G_MAIN_LOOP
334static inline int
335_gfd_events_from_fdh(Ecore_Fd_Handler *fdh)
336{
337 int events = 0;
338 if (fdh->flags & ECORE_FD_READ) events |= G_IO_IN;
339 if (fdh->flags & ECORE_FD_WRITE) events |= G_IO_OUT;
340 if (fdh->flags & ECORE_FD_ERROR) events |= G_IO_ERR;
341 return events;
342}
343
344#endif
345
346static inline int
347_ecore_main_fdh_poll_add(Ecore_Fd_Handler *fdh)
348{
349 int r = 0;
350
351 if (HAVE_EPOLL && epoll_fd >= 0)
352 {
353 r = _ecore_epoll_add(_ecore_get_epoll_fd(), fdh->fd,
354 _ecore_poll_events_from_fdh(fdh), fdh);
355 }
356 else
357 {
358#ifdef USE_G_MAIN_LOOP
359 fdh->gfd.fd = fdh->fd;
360 fdh->gfd.events = _gfd_events_from_fdh(fdh);
361 fdh->gfd.revents = 0;
362 INF("adding gpoll on %d %08x", fdh->fd, fdh->gfd.events);
363 g_source_add_poll(ecore_glib_source, &fdh->gfd);
364#endif
365 }
366 return r;
367}
368
369static inline void
370_ecore_main_fdh_poll_del(Ecore_Fd_Handler *fdh)
371{
372 if (HAVE_EPOLL && epoll_fd >= 0)
373 {
374 struct epoll_event ev;
375 int efd = _ecore_get_epoll_fd();
376
377 memset(&ev, 0, sizeof (ev));
378 INF("removing poll on %d", fdh->fd);
379 /* could get an EBADF if somebody closed the FD before removing it */
380 if ((epoll_ctl(efd, EPOLL_CTL_DEL, fdh->fd, &ev) < 0))
381 {
382 if (errno == EBADF)
383 {
384 WRN("fd %d was closed, can't remove from epoll - reinit!",
385 fdh->fd);
386 _ecore_main_loop_shutdown();
387 _ecore_main_loop_init();
388 }
389 else
390 {
391 ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno);
392 }
393 }
394 }
395 else
396 {
397#ifdef USE_G_MAIN_LOOP
398 fdh->gfd.fd = fdh->fd;
399 fdh->gfd.events = _gfd_events_from_fdh(fdh);
400 fdh->gfd.revents = 0;
401 INF("adding gpoll on %d %08x", fdh->fd, fdh->gfd.events);
402 g_source_add_poll(ecore_glib_source, &fdh->gfd);
403#endif
404 }
405}
406
407static inline int
408_ecore_main_fdh_poll_modify(Ecore_Fd_Handler *fdh)
409{
410 int r = 0;
411 if (HAVE_EPOLL && epoll_fd >= 0)
412 {
413 struct epoll_event ev;
414 int efd = _ecore_get_epoll_fd();
415
416 memset(&ev, 0, sizeof (ev));
417 ev.events = _ecore_poll_events_from_fdh(fdh);
418 ev.data.ptr = fdh;
419 INF("modifing epoll on %d to %08x", fdh->fd, ev.events);
420 r = epoll_ctl(efd, EPOLL_CTL_MOD, fdh->fd, &ev);
421 }
422 else
423 {
424#ifdef USE_G_MAIN_LOOP
425 fdh->gfd.fd = fdh->fd;
426 fdh->gfd.events = _gfd_events_from_fdh(fdh);
427 fdh->gfd.revents = 0;
428 INF("modifing gpoll on %d to %08x", fdh->fd, fdh->gfd.events);
429#endif
430 }
431 return r;
432}
433
434static inline int
435_ecore_main_fdh_epoll_mark_active(void)
436{
437 struct epoll_event ev[32];
438 int i, ret;
439 int efd = _ecore_get_epoll_fd();
440
441 memset(&ev, 0, sizeof (ev));
442 ret = epoll_wait(efd, ev, sizeof(ev) / sizeof(struct epoll_event), 0);
443 if (ret < 0)
444 {
445 if (errno == EINTR) return -1;
446 ERR("epoll_wait failed %d", errno);
447 return -1;
448 }
449
450 for (i = 0; i < ret; i++)
451 {
452 Ecore_Fd_Handler *fdh;
453
454 fdh = ev[i].data.ptr;
455 if (!ECORE_MAGIC_CHECK(fdh, ECORE_MAGIC_FD_HANDLER))
456 {
457 ECORE_MAGIC_FAIL(fdh, ECORE_MAGIC_FD_HANDLER,
458 "_ecore_main_fdh_epoll_mark_active");
459 continue;
460 }
461 if (fdh->delete_me)
462 {
463 ERR("deleted fd in epoll");
464 continue;
465 }
466
467 if (ev[i].events & EPOLLIN)
468 fdh->read_active = EINA_TRUE;
469 if (ev[i].events & EPOLLOUT)
470 fdh->write_active = EINA_TRUE;
471 if (ev[i].events & EPOLLERR)
472 fdh->error_active = EINA_TRUE;
473
474 _ecore_try_add_to_call_list(fdh);
475 }
476
477 return ret;
478}
479
480#ifdef USE_G_MAIN_LOOP
481
482static inline int
483_ecore_main_fdh_glib_mark_active(void)
484{
485 Ecore_Fd_Handler *fdh;
486 int ret = 0;
487
488 /* call the prepare callback for all handlers */
489 EINA_INLIST_FOREACH(fd_handlers, fdh)
490 {
491 if (fdh->delete_me)
492 continue;
493
494 if (fdh->gfd.revents & G_IO_IN)
495 fdh->read_active = EINA_TRUE;
496 if (fdh->gfd.revents & G_IO_OUT)
497 fdh->write_active = EINA_TRUE;
498 if (fdh->gfd.revents & G_IO_ERR)
499 fdh->error_active = EINA_TRUE;
500
501 _ecore_try_add_to_call_list(fdh);
502
503 if (fdh->gfd.revents & (G_IO_IN | G_IO_OUT | G_IO_ERR)) ret++;
504 }
505
506 return ret;
507}
508
509/* like we are about to enter main_loop_select in _ecore_main_select */
510static gboolean
511_ecore_main_gsource_prepare(GSource *source __UNUSED__,
512 gint *next_time)
513{
514 gboolean ready = FALSE;
515
516 _ecore_lock();
517 in_main_loop++;
518
519 if (!ecore_idling && !_ecore_glib_idle_enterer_called)
520 {
521 _ecore_time_loop_time = ecore_time_get();
522 _ecore_timer_expired_timers_call(_ecore_time_loop_time);
523 _ecore_timer_cleanup();
524
525 _ecore_idle_enterer_call();
526 _ecore_throttle();
527 _ecore_glib_idle_enterer_called = FALSE;
528
529 if (fd_handlers_with_buffer)
530 _ecore_main_fd_handlers_buf_call();
531 }
532
533 _ecore_signal_received_process();
534
535 /* don't check fds if somebody quit */
536 if (g_main_loop_is_running(ecore_main_loop))
537 {
538 /* only set idling state in dispatch */
539 if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist())
540 {
541 if (_ecore_timers_exists())
542 {
543 int r = -1;
544 double t = _ecore_timer_next_get();
545 if (timer_fd >= 0 && t > 0.0)
546 {
547 struct itimerspec ts;
548
549 ts.it_interval.tv_sec = 0;
550 ts.it_interval.tv_nsec = 0;
551 ts.it_value.tv_sec = t;
552 ts.it_value.tv_nsec = fmod(t * NS_PER_SEC, NS_PER_SEC);
553
554 /* timerfd cannot sleep for 0 time */
555 if (ts.it_value.tv_sec || ts.it_value.tv_nsec)
556 {
557 r = timerfd_settime(timer_fd, 0, &ts, NULL);
558 if (r < 0)
559 {
560 ERR("timer set returned %d (errno=%d)", r, errno);
561 close(timer_fd);
562 timer_fd = -1;
563 }
564 else
565 INF("sleeping for %ld s %06ldus",
566 ts.it_value.tv_sec,
567 ts.it_value.tv_nsec / 1000);
568 }
569 }
570 if (r == -1)
571 {
572 *next_time = ceil(t * 1000.0);
573 if (t == 0.0)
574 ready = TRUE;
575 }
576 }
577 else
578 *next_time = -1;
579 }
580 else
581 {
582 *next_time = 0;
583 if (_ecore_event_exist())
584 ready = TRUE;
585 }
586
587 if (fd_handlers_with_prep)
588 _ecore_main_prepare_handlers();
589 }
590 else
591 ready = TRUE;
592
593 in_main_loop--;
594 INF("leave, timeout = %d", *next_time);
595 _ecore_unlock();
596
597 /* ready if we're not running (about to quit) */
598 return ready;
599}
600
601static gboolean
602_ecore_main_gsource_check(GSource *source __UNUSED__)
603{
604 gboolean ret = FALSE;
605
606 _ecore_lock();
607 in_main_loop++;
608
609 /* check if old timers expired */
610 if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist())
611 {
612 if (timer_fd >= 0)
613 {
614 uint64_t count = 0;
615 int r = read(timer_fd, &count, sizeof count);
616 if (r == -1 && errno == EAGAIN)
617 ;
618 else if (r == sizeof count)
619 ret = TRUE;
620 else
621 {
622 /* unexpected things happened... fail back to old way */
623 ERR("timer read returned %d (errno=%d)", r, errno);
624 close(timer_fd);
625 timer_fd = -1;
626 }
627 }
628 }
629 else
630 ret = TRUE;
631
632 /* check if fds are ready */
633 if (HAVE_EPOLL && epoll_fd >= 0)
634 ecore_fds_ready = (_ecore_main_fdh_epoll_mark_active() > 0);
635 else
636 ecore_fds_ready = (_ecore_main_fdh_glib_mark_active() > 0);
637 _ecore_main_fd_handlers_cleanup();
638 if (ecore_fds_ready)
639 ret = TRUE;
640
641 /* check timers after updating loop time */
642 if (!ret && _ecore_timers_exists())
643 ret = (0.0 == _ecore_timer_next_get());
644
645 in_main_loop--;
646 _ecore_unlock();
647
648 return ret;
649}
650
651/* like we just came out of main_loop_select in _ecore_main_select */
652static gboolean
653_ecore_main_gsource_dispatch(GSource *source __UNUSED__,
654 GSourceFunc callback __UNUSED__,
655 gpointer user_data __UNUSED__)
656{
657 gboolean events_ready, timers_ready, idlers_ready;
658 double next_time;
659
660 _ecore_lock();
661 _ecore_time_loop_time = ecore_time_get();
662 _ecore_timer_enable_new();
663 next_time = _ecore_timer_next_get();
664
665 events_ready = _ecore_event_exist();
666 timers_ready = _ecore_timers_exists() && (0.0 == next_time);
667 idlers_ready = _ecore_idler_exist();
668
669 in_main_loop++;
670 INF("enter idling=%d fds=%d events=%d timers=%d (next=%.2f) idlers=%d",
671 ecore_idling, ecore_fds_ready, events_ready,
672 timers_ready, next_time, idlers_ready);
673
674 if (ecore_idling && events_ready)
675 {
676 _ecore_idle_exiter_call();
677 ecore_idling = 0;
678 }
679 else if (!ecore_idling && !events_ready)
680 {
681 ecore_idling = 1;
682 }
683
684 if (ecore_idling)
685 {
686 _ecore_idler_all_call();
687
688 events_ready = _ecore_event_exist();
689
690 if (ecore_fds_ready || events_ready || timers_ready)
691 {
692 _ecore_idle_exiter_call();
693 ecore_idling = 0;
694 }
695 }
696
697 /* process events */
698 if (!ecore_idling)
699 {
700 _ecore_main_fd_handlers_call();
701 if (fd_handlers_with_buffer)
702 _ecore_main_fd_handlers_buf_call();
703 _ecore_signal_received_process();
704 _ecore_event_call();
705 _ecore_main_fd_handlers_cleanup();
706
707 _ecore_timer_expired_timers_call(_ecore_time_loop_time);
708 _ecore_timer_cleanup();
709
710 _ecore_idle_enterer_call();
711 _ecore_throttle();
712 _ecore_glib_idle_enterer_called = TRUE;
713
714 if (fd_handlers_with_buffer)
715 _ecore_main_fd_handlers_buf_call();
716 }
717
718 in_main_loop--;
719 _ecore_unlock();
720
721 return TRUE; /* what should be returned here? */
722}
723
724static void
725_ecore_main_gsource_finalize(GSource *source __UNUSED__)
726{
727}
728
729static GSourceFuncs ecore_gsource_funcs =
730{
731 .prepare = _ecore_main_gsource_prepare,
732 .check = _ecore_main_gsource_check,
733 .dispatch = _ecore_main_gsource_dispatch,
734 .finalize = _ecore_main_gsource_finalize,
735};
736
737#endif
738
739void
740_ecore_main_loop_init(void)
741{
742 epoll_fd = epoll_create(1);
743 if (epoll_fd < 0)
744 WRN("Failed to create epoll fd!");
745 epoll_pid = getpid();
746
747 /* add polls on all our file descriptors */
748 Ecore_Fd_Handler *fdh;
749 EINA_INLIST_FOREACH(fd_handlers, fdh)
750 {
751 if (fdh->delete_me)
752 continue;
753 _ecore_epoll_add(epoll_fd, fdh->fd,
754 _ecore_poll_events_from_fdh(fdh), fdh);
755 _ecore_main_fdh_poll_add(fdh);
756 }
757
758 /* setup for the g_main_loop only integration */
759#ifdef USE_G_MAIN_LOOP
760 ecore_glib_source = g_source_new(&ecore_gsource_funcs, sizeof (GSource));
761 if (!ecore_glib_source)
762 CRIT("Failed to create glib source for epoll!");
763 else
764 {
765 g_source_set_priority(ecore_glib_source, G_PRIORITY_HIGH_IDLE + 20);
766 if (HAVE_EPOLL && epoll_fd >= 0)
767 {
768 /* epoll multiplexes fds into the g_main_loop */
769 ecore_epoll_fd.fd = epoll_fd;
770 ecore_epoll_fd.events = G_IO_IN;
771 ecore_epoll_fd.revents = 0;
772 g_source_add_poll(ecore_glib_source, &ecore_epoll_fd);
773 }
774
775 /* timerfd gives us better than millisecond accuracy in g_main_loop */
776 timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
777 if (timer_fd < 0)
778 WRN("failed to create timer fd!");
779 else
780 {
781 ecore_timer_fd.fd = timer_fd;
782 ecore_timer_fd.events = G_IO_IN;
783 ecore_timer_fd.revents = 0;
784 g_source_add_poll(ecore_glib_source, &ecore_timer_fd);
785 }
786
787 ecore_glib_source_id = g_source_attach(ecore_glib_source, NULL);
788 if (ecore_glib_source_id <= 0)
789 CRIT("Failed to attach glib source to default context");
790 }
791#endif
792}
793
794void
795_ecore_main_loop_shutdown(void)
796{
797#ifdef USE_G_MAIN_LOOP
798 if (ecore_glib_source)
799 {
800 g_source_destroy(ecore_glib_source);
801 ecore_glib_source = NULL;
802 }
803#endif
804
805 if (epoll_fd >= 0)
806 {
807 close(epoll_fd);
808 epoll_fd = -1;
809 }
810 epoll_pid = 0;
811
812 if (timer_fd >= 0)
813 {
814 close(timer_fd);
815 timer_fd = -1;
816 }
817}
818
819void *
820_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
821{
822 if (fd_handler->delete_me)
823 {
824 ERR("fdh %p deleted twice", fd_handler);
825 return NULL;
826 }
827
828 _ecore_main_fdh_poll_del(fd_handler);
829 fd_handler->delete_me = EINA_TRUE;
830 fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fd_handler);
831 if (fd_handler->prep_func && fd_handlers_with_prep)
832 fd_handlers_with_prep = eina_list_remove(fd_handlers_with_prep, fd_handler);
833 if (fd_handler->buf_func && fd_handlers_with_buffer)
834 fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fd_handler);
835 return fd_handler->data;
836}
837
838/**
839 * @addtogroup Ecore_Main_Loop_Group
840 *
841 * @{
842 */
843
844/**
845 * Runs a single iteration of the main loop to process everything on the
846 * queue.
847 *
848 * It does everything that is already done inside an @c Ecore main loop, like
849 * checking for expired timers, idlers, etc. But it will do it only once and
850 * return, instead of keep watching for new events.
851 *
852 * DO NOT use this function unless you are the person God comes to ask for
853 * advice when He has trouble managing the Universe.
854 */
855
856EAPI int
857ecore_main_loop_iterate_may_block(int may_block)
858{
859#ifndef USE_G_MAIN_LOOP
860 _ecore_lock();
861in_main_loop++;
862 _ecore_main_loop_iterate_internal(!may_block);
863in_main_loop--;
864 _ecore_unlock();
865 return _ecore_event_exist();
866#else
867 return g_main_context_iteration(NULL, may_block);
868#endif
869}
870EAPI void
871ecore_main_loop_iterate(void)
872{
873#ifndef USE_G_MAIN_LOOP
874 _ecore_lock();
875 _ecore_main_loop_iterate_internal(1);
876 _ecore_unlock();
877#else
878 g_main_context_iteration(NULL, 0);
879#endif
880}
881
882/**
883 * Runs the application main loop.
884 *
885 * This function will not return until @ref ecore_main_loop_quit is called. It
886 * will check for expired timers, idlers, file descriptors being watched by fd
887 * handlers, etc. Once everything is done, before entering again on idle state,
888 * any callback set as @c Idle_Enterer will be called.
889 *
890 * Each main loop iteration is done by calling ecore_main_loop_iterate()
891 * internally.
892 *
893 * The polling (select) function used can be changed with
894 * ecore_main_loop_select_func_set().
895 *
896 * The function used to check for file descriptors, events, and that has a
897 * timeout for the timers can be changed using
898 * ecore_main_loop_select_func_set().
899 */
900EAPI void
901ecore_main_loop_begin(void)
902{
903#ifndef USE_G_MAIN_LOOP
904 _ecore_lock();
905 in_main_loop++;
906 while (do_quit == 0) _ecore_main_loop_iterate_internal(0);
907 do_quit = 0;
908 in_main_loop--;
909 _ecore_unlock();
910#else
911 if (!do_quit)
912 {
913 if (!ecore_main_loop)
914 ecore_main_loop = g_main_loop_new(NULL, FALSE);
915 g_main_loop_run(ecore_main_loop);
916 }
917 do_quit = 0;
918#endif
919}
920
921/**
922 * Quits the main loop once all the events currently on the queue have
923 * been processed.
924 *
925 * This function returns immediately, but will mark the ecore_main_loop_begin()
926 * function to return at the end of the current main loop iteration.
927 */
928EAPI void
929ecore_main_loop_quit(void)
930{
931 do_quit = 1;
932#ifdef USE_G_MAIN_LOOP
933 if (ecore_main_loop)
934 g_main_loop_quit(ecore_main_loop);
935#endif
936}
937
938/**
939 * Sets the function to use when monitoring multiple file descriptors,
940 * and waiting until one of more of the file descriptors before ready
941 * for some class of I/O operation.
942 *
943 * This function will be used instead of the system call select and
944 * could possible be used to integrate the Ecore event loop with an
945 * external event loop.
946 *
947 * @warning you don't know how to use, don't even try to use it.
948 *
949 */
950EAPI void
951ecore_main_loop_select_func_set(Ecore_Select_Function func)
952{
953 main_loop_select = func;
954}
955
956/**
957 * Gets the select function set by ecore_select_func_set(),
958 * or the native select function if none was set.
959 *
960 */
961EAPI Ecore_Select_Function
962ecore_main_loop_select_func_get(void)
963{
964 return main_loop_select;
965}
966
967EAPI Ecore_Fd_Handler *
968ecore_main_fd_handler_add(int fd,
969 Ecore_Fd_Handler_Flags flags,
970 Ecore_Fd_Cb func,
971 const void *data,
972 Ecore_Fd_Cb buf_func,
973 const void *buf_data)
974{
975 Ecore_Fd_Handler *fdh = NULL;
976
977 _ecore_lock();
978
979 if ((fd < 0) || (flags == 0) || (!func)) goto unlock;
980
981 fdh = ecore_fd_handler_calloc(1);
982 if (!fdh) goto unlock;
983 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER);
984 fdh->next_ready = NULL;
985 fdh->fd = fd;
986 fdh->flags = flags;
987 if (_ecore_main_fdh_poll_add(fdh) < 0)
988 {
989 int err = errno;
990 ERR("Failed to add poll on fd %d (errno = %d: %s)!", fd, err, strerror(err));
991 ecore_fd_handler_mp_free(fdh);
992 fdh = NULL;
993 goto unlock;
994 }
995 fdh->read_active = EINA_FALSE;
996 fdh->write_active = EINA_FALSE;
997 fdh->error_active = EINA_FALSE;
998 fdh->delete_me = EINA_FALSE;
999 fdh->func = func;
1000 fdh->data = (void *)data;
1001 fdh->buf_func = buf_func;
1002 if (buf_func)
1003 fd_handlers_with_buffer = eina_list_append(fd_handlers_with_buffer, fdh);
1004 fdh->buf_data = (void *)buf_data;
1005 fd_handlers = (Ecore_Fd_Handler *)
1006 eina_inlist_append(EINA_INLIST_GET(fd_handlers),
1007 EINA_INLIST_GET(fdh));
1008unlock:
1009 _ecore_unlock();
1010
1011 return fdh;
1012}
1013
1014#ifdef _WIN32
1015EAPI Ecore_Win32_Handler *
1016ecore_main_win32_handler_add(void *h,
1017 Ecore_Win32_Handle_Cb func,
1018 const void *data)
1019{
1020 Ecore_Win32_Handler *wh;
1021
1022 if (!h || !func) return NULL;
1023
1024 wh = ecore_win32_handler_calloc(1);
1025 if (!wh) return NULL;
1026 ECORE_MAGIC_SET(wh, ECORE_MAGIC_WIN32_HANDLER);
1027 wh->h = (HANDLE)h;
1028 wh->delete_me = EINA_FALSE;
1029 wh->func = func;
1030 wh->data = (void *)data;
1031 win32_handlers = (Ecore_Win32_Handler *)
1032 eina_inlist_append(EINA_INLIST_GET(win32_handlers),
1033 EINA_INLIST_GET(wh));
1034 return wh;
1035}
1036
1037#else
1038EAPI Ecore_Win32_Handler *
1039ecore_main_win32_handler_add(void *h __UNUSED__,
1040 Ecore_Win32_Handle_Cb func __UNUSED__,
1041 const void *data __UNUSED__)
1042{
1043 return NULL;
1044}
1045
1046#endif
1047
1048EAPI void *
1049ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
1050{
1051 void *ret = NULL;
1052
1053 _ecore_lock();
1054
1055 if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
1056 {
1057 ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
1058 "ecore_main_fd_handler_del");
1059 goto unlock;
1060 }
1061 ret = _ecore_main_fd_handler_del(fd_handler);
1062unlock:
1063 _ecore_unlock();
1064 return ret;
1065}
1066
1067#ifdef _WIN32
1068EAPI void *
1069ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler)
1070{
1071 if (!ECORE_MAGIC_CHECK(win32_handler, ECORE_MAGIC_WIN32_HANDLER))
1072 {
1073 ECORE_MAGIC_FAIL(win32_handler, ECORE_MAGIC_WIN32_HANDLER,
1074 "ecore_main_win32_handler_del");
1075 return NULL;
1076 }
1077 win32_handler->delete_me = EINA_TRUE;
1078 win32_handlers_delete_me = EINA_TRUE;
1079 return win32_handler->data;
1080}
1081
1082#else
1083EAPI void *
1084ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__)
1085{
1086 return NULL;
1087}
1088
1089#endif
1090
1091EAPI void
1092ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler,
1093 Ecore_Fd_Prep_Cb func,
1094 const void *data)
1095{
1096 _ecore_lock();
1097
1098 if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
1099 {
1100 ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
1101 "ecore_main_fd_handler_prepare_callback_set");
1102 goto unlock;
1103 }
1104 fd_handler->prep_func = func;
1105 fd_handler->prep_data = (void *)data;
1106 if ((!fd_handlers_with_prep) ||
1107 (fd_handlers_with_prep && (!eina_list_data_find(fd_handlers_with_prep, fd_handler))))
1108 /* FIXME: THIS WILL NOT SCALE WITH LOTS OF PREP FUNCTIONS!!! */
1109 fd_handlers_with_prep = eina_list_append(fd_handlers_with_prep, fd_handler);
1110unlock:
1111 _ecore_unlock();
1112}
1113
1114EAPI int
1115ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
1116{
1117 int fd = -1;
1118
1119 _ecore_lock();
1120
1121 if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
1122 {
1123 ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
1124 "ecore_main_fd_handler_fd_get");
1125 goto unlock;
1126 }
1127 fd = fd_handler->fd;
1128unlock:
1129 _ecore_unlock();
1130 return fd;
1131}
1132
1133EAPI Eina_Bool
1134ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler,
1135 Ecore_Fd_Handler_Flags flags)
1136{
1137 int ret = EINA_FALSE;
1138
1139 _ecore_lock();
1140
1141 if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
1142 {
1143 ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
1144 "ecore_main_fd_handler_active_get");
1145 goto unlock;
1146 }
1147 if ((flags & ECORE_FD_READ) && (fd_handler->read_active)) ret = EINA_TRUE;
1148 if ((flags & ECORE_FD_WRITE) && (fd_handler->write_active)) ret = EINA_TRUE;
1149 if ((flags & ECORE_FD_ERROR) && (fd_handler->error_active)) ret = EINA_TRUE;
1150unlock:
1151 _ecore_unlock();
1152 return ret;
1153}
1154
1155EAPI void
1156ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler,
1157 Ecore_Fd_Handler_Flags flags)
1158{
1159 int ret;
1160
1161 _ecore_lock();
1162
1163 if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
1164 {
1165 ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
1166 "ecore_main_fd_handler_active_set");
1167 goto unlock;
1168 }
1169 fd_handler->flags = flags;
1170 ret = _ecore_main_fdh_poll_modify(fd_handler);
1171 if (ret < 0)
1172 {
1173 ERR("Failed to mod epoll fd %d: %s!", fd_handler->fd, strerror(ret));
1174 }
1175unlock:
1176 _ecore_unlock();
1177}
1178
1179/**
1180 * @}
1181 */
1182
1183void
1184_ecore_main_shutdown(void)
1185{
1186 if (in_main_loop)
1187 {
1188 ERR("\n"
1189 "*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n"
1190 "*** Program may crash or behave strangely now.");
1191 return;
1192 }
1193 while (fd_handlers)
1194 {
1195 Ecore_Fd_Handler *fdh;
1196
1197 fdh = fd_handlers;
1198 fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
1199 EINA_INLIST_GET(fdh));
1200 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
1201 ecore_fd_handler_mp_free(fdh);
1202 }
1203 if (fd_handlers_with_buffer)
1204 fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer);
1205 if (fd_handlers_with_prep)
1206 fd_handlers_with_prep = eina_list_free(fd_handlers_with_prep);
1207 if (fd_handlers_to_delete)
1208 fd_handlers_to_delete = eina_list_free(fd_handlers_to_delete);
1209
1210 fd_handlers_to_call = NULL;
1211 fd_handlers_to_call_current = NULL;
1212 fd_handlers_to_delete = NULL;
1213 fd_handler_current = NULL;
1214
1215#ifdef _WIN32
1216 while (win32_handlers)
1217 {
1218 Ecore_Win32_Handler *wh;
1219
1220 wh = win32_handlers;
1221 win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
1222 EINA_INLIST_GET(wh));
1223 ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
1224 ecore_win32_handler_mp_free(wh);
1225 }
1226 win32_handlers_delete_me = EINA_FALSE;
1227 win32_handler_current = NULL;
1228#endif
1229}
1230
1231static void
1232_ecore_main_prepare_handlers(void)
1233{
1234 Ecore_Fd_Handler *fdh;
1235 Eina_List *l, *l2;
1236
1237 /* call the prepare callback for all handlers with prep functions */
1238 EINA_LIST_FOREACH_SAFE(fd_handlers_with_prep, l, l2, fdh)
1239 {
1240 if (!fdh)
1241 {
1242 fd_handlers_with_prep = eina_list_remove_list(l, fd_handlers_with_prep);
1243 continue;
1244 }
1245 if (!fdh->delete_me && fdh->prep_func)
1246 {
1247 fdh->references++;
1248 _ecore_call_prep_cb(fdh->prep_func, fdh->prep_data, fdh);
1249 fdh->references--;
1250 }
1251 else
1252 fd_handlers_with_prep = eina_list_remove_list(fd_handlers_with_prep, l);
1253 }
1254}
1255
1256#ifndef USE_G_MAIN_LOOP
1257static int
1258_ecore_main_select(double timeout)
1259{
1260 struct timeval tv, *t;
1261 fd_set rfds, wfds, exfds;
1262 int max_fd;
1263 int ret;
1264
1265 t = NULL;
1266 if ((!ECORE_FINITE(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */
1267 {
1268 tv.tv_sec = 0;
1269 tv.tv_usec = 0;
1270 t = &tv;
1271 }
1272 else if (timeout > 0.0)
1273 {
1274 int sec, usec;
1275
1276#ifdef FIX_HZ
1277 timeout += (0.5 / HZ);
1278 sec = (int)timeout;
1279 usec = (int)((timeout - (double)sec) * 1000000);
1280#else
1281 sec = (int)timeout;
1282 usec = (int)((timeout - (double)sec) * 1000000);
1283#endif
1284 tv.tv_sec = sec;
1285 tv.tv_usec = usec;
1286 t = &tv;
1287 }
1288 max_fd = 0;
1289 FD_ZERO(&rfds);
1290 FD_ZERO(&wfds);
1291 FD_ZERO(&exfds);
1292
1293 /* call the prepare callback for all handlers */
1294 if (fd_handlers_with_prep)
1295 _ecore_main_prepare_handlers();
1296
1297 if (!HAVE_EPOLL || epoll_fd < 0)
1298 {
1299 Ecore_Fd_Handler *fdh;
1300
1301 EINA_INLIST_FOREACH(fd_handlers, fdh)
1302 {
1303 if (!fdh->delete_me)
1304 {
1305 if (fdh->flags & ECORE_FD_READ)
1306 {
1307 FD_SET(fdh->fd, &rfds);
1308 if (fdh->fd > max_fd) max_fd = fdh->fd;
1309 }
1310 if (fdh->flags & ECORE_FD_WRITE)
1311 {
1312 FD_SET(fdh->fd, &wfds);
1313 if (fdh->fd > max_fd) max_fd = fdh->fd;
1314 }
1315 if (fdh->flags & ECORE_FD_ERROR)
1316 {
1317 FD_SET(fdh->fd, &exfds);
1318 if (fdh->fd > max_fd) max_fd = fdh->fd;
1319 }
1320 }
1321 }
1322 }
1323 else
1324 {
1325 /* polling on the epoll fd will wake when an fd in the epoll set is active */
1326 max_fd = _ecore_get_epoll_fd();
1327 FD_SET(max_fd, &rfds);
1328 }
1329
1330 if (_ecore_signal_count_get()) return -1;
1331
1332 _ecore_unlock();
1333 ret = main_loop_select(max_fd + 1, &rfds, &wfds, &exfds, t);
1334 _ecore_lock();
1335
1336 _ecore_time_loop_time = ecore_time_get();
1337 if (ret < 0)
1338 {
1339#ifndef _WIN32
1340 if (errno == EINTR) return -1;
1341 else if (errno == EBADF)
1342 _ecore_main_fd_handlers_bads_rem();
1343#endif
1344 }
1345 if (ret > 0)
1346 {
1347 if (HAVE_EPOLL && epoll_fd >= 0)
1348 _ecore_main_fdh_epoll_mark_active();
1349 else
1350 {
1351 Ecore_Fd_Handler *fdh;
1352
1353 EINA_INLIST_FOREACH(fd_handlers, fdh)
1354 {
1355 if (!fdh->delete_me)
1356 {
1357 if (FD_ISSET(fdh->fd, &rfds))
1358 fdh->read_active = EINA_TRUE;
1359 if (FD_ISSET(fdh->fd, &wfds))
1360 fdh->write_active = EINA_TRUE;
1361 if (FD_ISSET(fdh->fd, &exfds))
1362 fdh->error_active = EINA_TRUE;
1363 _ecore_try_add_to_call_list(fdh);
1364 }
1365 }
1366 }
1367
1368 _ecore_main_fd_handlers_cleanup();
1369#ifdef _WIN32
1370 _ecore_main_win32_handlers_cleanup();
1371#endif
1372 return 1;
1373 }
1374 return 0;
1375}
1376
1377#endif
1378
1379#ifndef _WIN32
1380# ifndef USE_G_MAIN_LOOP
1381static void
1382_ecore_main_fd_handlers_bads_rem(void)
1383{
1384 Ecore_Fd_Handler *fdh;
1385 Eina_Inlist *l;
1386 int found = 0;
1387
1388 ERR("Removing bad fds");
1389 for (l = EINA_INLIST_GET(fd_handlers); l; )
1390 {
1391 fdh = (Ecore_Fd_Handler *)l;
1392 l = l->next;
1393 errno = 0;
1394
1395 if ((fcntl(fdh->fd, F_GETFD) < 0) && (errno == EBADF))
1396 {
1397 ERR("Found bad fd at index %d", fdh->fd);
1398 if (fdh->flags & ECORE_FD_ERROR)
1399 {
1400 ERR("Fd set for error! calling user");
1401 fdh->references++;
1402 if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh))
1403 {
1404 ERR("Fd function err returned 0, remove it");
1405 if (!fdh->delete_me)
1406 {
1407 fdh->delete_me = EINA_TRUE;
1408 fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh);
1409 }
1410 found++;
1411 }
1412 fdh->references--;
1413 }
1414 else
1415 {
1416 ERR("Problematic fd found at %d! setting it for delete", fdh->fd);
1417 if (!fdh->delete_me)
1418 {
1419 fdh->delete_me = EINA_TRUE;
1420 fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh);
1421 }
1422
1423 found++;
1424 }
1425 }
1426 }
1427 if (found == 0)
1428 {
1429# ifdef HAVE_GLIB
1430 ERR("No bad fd found. Maybe a foreign fd from glib?");
1431# else
1432 ERR("No bad fd found. EEEK!");
1433# endif
1434 }
1435 _ecore_main_fd_handlers_cleanup();
1436}
1437
1438# endif
1439#endif
1440
1441static void
1442_ecore_main_fd_handlers_cleanup(void)
1443{
1444 Ecore_Fd_Handler *fdh;
1445 Eina_List *l, *l2;
1446
1447 if (!fd_handlers_to_delete) return;
1448 EINA_LIST_FOREACH_SAFE(fd_handlers_to_delete, l, l2, fdh)
1449 {
1450 if (!fdh)
1451 {
1452 fd_handlers_to_delete = eina_list_remove_list(l, fd_handlers_to_delete);
1453 continue;
1454 }
1455 /* fdh->delete_me should be set for all fdhs at the start of the list */
1456 if (fdh->references)
1457 continue;
1458 if (fdh->buf_func && fd_handlers_with_buffer)
1459 fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fdh);
1460 if (fdh->prep_func && fd_handlers_with_prep)
1461 fd_handlers_with_prep = eina_list_remove(fd_handlers_with_prep, fdh);
1462 fd_handlers = (Ecore_Fd_Handler *)
1463 eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh));
1464 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
1465 ecore_fd_handler_mp_free(fdh);
1466 fd_handlers_to_delete = eina_list_remove_list(fd_handlers_to_delete, l);
1467 }
1468}
1469
1470#ifdef _WIN32
1471static void
1472_ecore_main_win32_handlers_cleanup(void)
1473{
1474 Ecore_Win32_Handler *wh;
1475 Eina_Inlist *l;
1476 int deleted_in_use = 0;
1477
1478 if (!win32_handlers_delete_me) return;
1479 for (l = EINA_INLIST_GET(win32_handlers); l; )
1480 {
1481 wh = (Ecore_Win32_Handler *)l;
1482
1483 l = l->next;
1484 if (wh->delete_me)
1485 {
1486 if (wh->references)
1487 {
1488 deleted_in_use++;
1489 continue;
1490 }
1491
1492 win32_handlers = (Ecore_Win32_Handler *)
1493 eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
1494 EINA_INLIST_GET(wh));
1495 ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
1496 ecore_win32_handler_mp_free(wh);
1497 }
1498 }
1499 if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE;
1500}
1501
1502#endif
1503
1504static void
1505_ecore_main_fd_handlers_call(void)
1506{
1507 /* grab a new list */
1508 if (!fd_handlers_to_call_current)
1509 {
1510 fd_handlers_to_call_current = fd_handlers_to_call;
1511 fd_handlers_to_call = NULL;
1512 }
1513
1514 while (fd_handlers_to_call_current)
1515 {
1516 Ecore_Fd_Handler *fdh = fd_handlers_to_call_current;
1517
1518 if (!fdh->delete_me)
1519 {
1520 if ((fdh->read_active) ||
1521 (fdh->write_active) ||
1522 (fdh->error_active))
1523 {
1524 fdh->references++;
1525 if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh))
1526 {
1527 if (!fdh->delete_me)
1528 {
1529 fdh->delete_me = EINA_TRUE;
1530 fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh);
1531 }
1532 }
1533 fdh->references--;
1534 _ecore_fd_valid();
1535
1536 fdh->read_active = EINA_FALSE;
1537 fdh->write_active = EINA_FALSE;
1538 fdh->error_active = EINA_FALSE;
1539 }
1540 }
1541
1542 /* stop when we point to ourselves */
1543 if (fdh->next_ready == fdh)
1544 {
1545 fdh->next_ready = NULL;
1546 fd_handlers_to_call_current = NULL;
1547 break;
1548 }
1549
1550 fd_handlers_to_call_current = fdh->next_ready;
1551 fdh->next_ready = NULL;
1552 }
1553}
1554
1555static int
1556_ecore_main_fd_handlers_buf_call(void)
1557{
1558 Ecore_Fd_Handler *fdh;
1559 Eina_List *l, *l2;
1560 int ret;
1561
1562 ret = 0;
1563 EINA_LIST_FOREACH_SAFE(fd_handlers_with_buffer, l, l2, fdh)
1564 {
1565 if (!fdh)
1566 {
1567 fd_handlers_with_buffer = eina_list_remove_list(l, fd_handlers_with_buffer);
1568 continue;
1569 }
1570 if ((!fdh->delete_me) && fdh->buf_func)
1571 {
1572 fdh->references++;
1573 if (_ecore_call_fd_cb(fdh->buf_func, fdh->buf_data, fdh))
1574 {
1575 ret |= _ecore_call_fd_cb(fdh->func, fdh->data, fdh);
1576 fdh->read_active = EINA_TRUE;
1577 _ecore_try_add_to_call_list(fdh);
1578 }
1579 fdh->references--;
1580 }
1581 else
1582 fd_handlers_with_buffer = eina_list_remove_list(fd_handlers_with_buffer, l);
1583 }
1584 return ret;
1585}
1586
1587#ifndef USE_G_MAIN_LOOP
1588
1589enum {
1590 SPIN_MORE,
1591 SPIN_RESTART,
1592 LOOP_CONTINUE
1593};
1594
1595static int
1596_ecore_main_loop_spin_core(void)
1597{
1598 /* as we are spinning we need to update loop time per spin */
1599 _ecore_time_loop_time = ecore_time_get();
1600 /* call all idlers, which returns false if no more idelrs exist */
1601 if (!_ecore_idler_all_call()) return SPIN_RESTART;
1602 /* sneaky - drop through or if checks - the first one to succeed
1603 * drops through and returns "continue" so further ones dont run */
1604 if ((_ecore_main_select(0.0) > 0) || (_ecore_event_exist()) ||
1605 (_ecore_signal_count_get() > 0) || (do_quit))
1606 return LOOP_CONTINUE;
1607 /* default - spin more */
1608 return SPIN_MORE;
1609}
1610
1611static int
1612_ecore_main_loop_spin_no_timers(void)
1613{
1614 /* if we have idlers we HAVE to spin and handle everything
1615 * in a polling way - spin in a tight polling loop */
1616 for (;; )
1617 {
1618 int action = _ecore_main_loop_spin_core();
1619 if (action != SPIN_MORE) return action;
1620 /* if an idler has added a timer then we need to go through
1621 * the start of the spin cycle again to handle cases properly */
1622 if (_ecore_timers_exists()) return SPIN_RESTART;
1623 }
1624 /* just contiune handling events etc. */
1625 return LOOP_CONTINUE;
1626}
1627
1628static int
1629_ecore_main_loop_spin_timers(void)
1630{
1631 /* if we have idlers we HAVE to spin and handle everything
1632 * in a polling way - spin in a tight polling loop */
1633 for (;; )
1634 {
1635 int action = _ecore_main_loop_spin_core();
1636 if (action != SPIN_MORE) return action;
1637 /* if next timer expires now or in the past - stop spinning and
1638 * continue the mainloop walk as our "select" timeout has
1639 * expired now */
1640 if (_ecore_timer_next_get() <= 0.0) return LOOP_CONTINUE;
1641 }
1642 /* just contiune handling events etc. */
1643 return LOOP_CONTINUE;
1644}
1645
1646static void
1647_ecore_fps_marker_1(void)
1648{
1649 if (!_ecore_fps_debug) return;
1650 t2 = ecore_time_get();
1651 if ((t1 > 0.0) && (t2 > 0.0)) _ecore_fps_debug_runtime_add(t2 - t1);
1652}
1653
1654static void
1655_ecore_fps_marker_2(void)
1656{
1657 if (!_ecore_fps_debug) return;
1658 t1 = ecore_time_get();
1659}
1660
1661static void
1662_ecore_main_loop_iterate_internal(int once_only)
1663{
1664 double next_time = -1.0;
1665
1666 in_main_loop++;
1667 /* expire any timers */
1668 _ecore_timer_expired_timers_call(_ecore_time_loop_time);
1669 _ecore_timer_cleanup();
1670
1671 /* process signals into events .... */
1672 _ecore_signal_received_process();
1673 /* if as a result of timers/animators or signals we have accumulated
1674 * events, then instantly handle them */
1675 if (_ecore_event_exist())
1676 {
1677 /* but first conceptually enter an idle state */
1678 _ecore_idle_enterer_call();
1679 _ecore_throttle();
1680 /* now quickly poll to see which input fd's are active */
1681 _ecore_main_select(0.0);
1682 /* allow newly queued timers to expire from now on */
1683 _ecore_timer_enable_new();
1684 /* go straight to processing the events we had queued */
1685 goto process_all;
1686 }
1687
1688 if (once_only)
1689 {
1690 /* in once_only mode we should quickly poll for inputs, signals
1691 * if we got any events or signals, allow new timers to process.
1692 * use bitwise or to force both conditions to be tested and
1693 * merged together */
1694 if (_ecore_main_select(0.0) | _ecore_signal_count_get())
1695 {
1696 _ecore_timer_enable_new();
1697 goto process_all;
1698 }
1699 }
1700 else
1701 {
1702 /* call idle enterers ... */
1703 _ecore_idle_enterer_call();
1704 _ecore_throttle();
1705 }
1706
1707 /* if these calls caused any buffered events to appear - deal with them */
1708 if (fd_handlers_with_buffer)
1709 _ecore_main_fd_handlers_buf_call();
1710
1711 /* if there are any (buffered fd handling may generate them)
1712 * then jump to processing them */
1713 if (_ecore_event_exist())
1714 {
1715 _ecore_main_select(0.0);
1716 _ecore_timer_enable_new();
1717 goto process_all;
1718 }
1719
1720 if (once_only)
1721 {
1722 /* in once_only mode enter idle here instead and then return */
1723 _ecore_idle_enterer_call();
1724 _ecore_throttle();
1725 _ecore_timer_enable_new();
1726 goto done;
1727 }
1728
1729 _ecore_fps_marker_1();
1730
1731 /* start of the sleeping or looping section */
1732start_loop: /***************************************************************/
1733 /* any timers re-added as a result of these are allowed to go */
1734 _ecore_timer_enable_new();
1735 /* if we have been asked to quit the mainloop then exit at this point */
1736 if (do_quit)
1737 {
1738 _ecore_timer_enable_new();
1739 goto done;
1740 }
1741 if (!_ecore_event_exist())
1742 {
1743 /* init flags */
1744 next_time = _ecore_timer_next_get();
1745 /* no idlers */
1746 if (!_ecore_idler_exist())
1747 {
1748 /* sleep until timeout or forever (-1.0) waiting for on fds */
1749 _ecore_main_select(next_time);
1750 }
1751 else
1752 {
1753 int action = LOOP_CONTINUE;
1754
1755 /* no timers - spin */
1756 if (next_time < 0) action = _ecore_main_loop_spin_no_timers();
1757 /* timers - spin */
1758 else action = _ecore_main_loop_spin_timers();
1759 if (action == SPIN_RESTART) goto start_loop;
1760 }
1761 }
1762 _ecore_fps_marker_2();
1763
1764 /* actually wake up and deal with input, events etc. */
1765process_all: /***********************************************************/
1766
1767 /* we came out of our "wait state" so idle has exited */
1768 if (!once_only) _ecore_idle_exiter_call();
1769 /* call the fd handler per fd that became alive... */
1770 /* this should read or write any data to the monitored fd and then */
1771 /* post events onto the ecore event pipe if necessary */
1772 _ecore_main_fd_handlers_call();
1773 if (fd_handlers_with_buffer) _ecore_main_fd_handlers_buf_call();
1774 /* process signals into events .... */
1775 _ecore_signal_received_process();
1776 /* handle events ... */
1777 _ecore_event_call();
1778 _ecore_main_fd_handlers_cleanup();
1779
1780 if (once_only)
1781 {
1782 /* if in once_only mode handle idle exiting */
1783 _ecore_idle_enterer_call();
1784 _ecore_throttle();
1785 }
1786
1787done: /*******************************************************************/
1788 in_main_loop--;
1789}
1790
1791#endif
1792
1793#ifdef _WIN32
1794static int
1795_ecore_main_win32_select(int nfds __UNUSED__,
1796 fd_set *readfds,
1797 fd_set *writefds,
1798 fd_set *exceptfds,
1799 struct timeval *tv)
1800{
1801 HANDLE objects[MAXIMUM_WAIT_OBJECTS];
1802 int sockets[MAXIMUM_WAIT_OBJECTS];
1803 Ecore_Fd_Handler *fdh;
1804 Ecore_Win32_Handler *wh;
1805 unsigned int objects_nbr = 0;
1806 unsigned int handles_nbr = 0;
1807 unsigned int events_nbr = 0;
1808 DWORD result;
1809 DWORD timeout;
1810 MSG msg;
1811 unsigned int i;
1812 int res;
1813
1814 /* Create an event object per socket */
1815 EINA_INLIST_FOREACH(fd_handlers, fdh)
1816 {
1817 WSAEVENT event;
1818 long network_event;
1819
1820 network_event = 0;
1821 if (FD_ISSET(fdh->fd, readfds))
1822 network_event |= FD_READ;
1823 if (FD_ISSET(fdh->fd, writefds))
1824 network_event |= FD_WRITE;
1825 if (FD_ISSET(fdh->fd, exceptfds))
1826 network_event |= FD_OOB;
1827
1828 if (network_event)
1829 {
1830 event = WSACreateEvent();
1831 WSAEventSelect(fdh->fd, event, network_event);
1832 objects[objects_nbr] = event;
1833 sockets[events_nbr] = fdh->fd;
1834 events_nbr++;
1835 objects_nbr++;
1836 }
1837 }
1838
1839 /* store the HANDLEs in the objects to wait for */
1840 EINA_INLIST_FOREACH(win32_handlers, wh)
1841 {
1842 objects[objects_nbr] = wh->h;
1843 handles_nbr++;
1844 objects_nbr++;
1845 }
1846
1847 /* Empty the queue before waiting */
1848 while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
1849 {
1850 TranslateMessage(&msg);
1851 DispatchMessage(&msg);
1852 }
1853
1854 /* Wait for any message sent or posted to this queue */
1855 /* or for one of the passed handles be set to signaled. */
1856 if (!tv)
1857 timeout = INFINITE;
1858 else
1859 timeout = (DWORD)((tv->tv_sec * 1000.0) + (tv->tv_usec / 1000.0));
1860
1861 if (timeout == 0) return 0;
1862
1863 result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects, EINA_FALSE,
1864 timeout, QS_ALLINPUT);
1865
1866 FD_ZERO(readfds);
1867 FD_ZERO(writefds);
1868 FD_ZERO(exceptfds);
1869
1870 /* The result tells us the type of event we have. */
1871 if (result == WAIT_FAILED)
1872 {
1873 char *m;
1874
1875 m = evil_last_error_get();
1876 ERR(" * %s\n", m);
1877 free(m);
1878 res = -1;
1879 }
1880 else if (result == WAIT_TIMEOUT)
1881 {
1882 /* ERR("time out\n"); */
1883 res = 0;
1884 }
1885 else if (result == (WAIT_OBJECT_0 + objects_nbr))
1886 {
1887 while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
1888 {
1889 TranslateMessage(&msg);
1890 DispatchMessage(&msg);
1891 }
1892
1893 res = 0;
1894 }
1895 else if ((result >= 0) && (result < WAIT_OBJECT_0 + events_nbr))
1896 {
1897 WSANETWORKEVENTS network_event;
1898
1899 WSAEnumNetworkEvents(sockets[result], objects[result], &network_event);
1900
1901 if (network_event.lNetworkEvents & FD_READ)
1902 FD_SET(sockets[result], readfds);
1903 if (network_event.lNetworkEvents & FD_WRITE)
1904 FD_SET(sockets[result], writefds);
1905 if (network_event.lNetworkEvents & FD_OOB)
1906 FD_SET(sockets[result], exceptfds);
1907
1908 res = 1;
1909 }
1910 else if ((result >= (WAIT_OBJECT_0 + events_nbr)) &&
1911 (result < (WAIT_OBJECT_0 + objects_nbr)))
1912 {
1913 if (!win32_handler_current)
1914 {
1915 /* regular main loop, start from head */
1916 win32_handler_current = win32_handlers;
1917 }
1918 else
1919 {
1920 /* recursive main loop, continue from where we were */
1921 win32_handler_current = (Ecore_Win32_Handler *)EINA_INLIST_GET(win32_handler_current)->next;
1922 }
1923
1924 while (win32_handler_current)
1925 {
1926 wh = win32_handler_current;
1927
1928 if (objects[result - WAIT_OBJECT_0] == wh->h)
1929 {
1930 if (!wh->delete_me)
1931 {
1932 wh->references++;
1933 if (!wh->func(wh->data, wh))
1934 {
1935 wh->delete_me = EINA_TRUE;
1936 win32_handlers_delete_me = EINA_TRUE;
1937 }
1938 wh->references--;
1939 }
1940 }
1941 if (win32_handler_current) /* may have changed in recursive main loops */
1942 win32_handler_current = (Ecore_Win32_Handler *)EINA_INLIST_GET(win32_handler_current)->next;
1943 }
1944 res = 1;
1945 }
1946 else
1947 {
1948 ERR("unknown result...\n");
1949 res = -1;
1950 }
1951
1952 /* Remove event objects again */
1953 for (i = 0; i < events_nbr; i++) WSACloseEvent(objects[i]);
1954
1955 return res;
1956}
1957
1958#endif
diff --git a/libraries/ecore/src/lib/ecore/ecore_pipe.c b/libraries/ecore/src/lib/ecore/ecore_pipe.c
deleted file mode 100644
index ea7453e..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_pipe.c
+++ /dev/null
@@ -1,682 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <errno.h>
8#include <math.h>
9
10#ifdef HAVE_ISFINITE
11# define ECORE_FINITE(t) isfinite(t)
12#else
13# ifdef _MSC_VER
14# define ECORE_FINITE(t) _finite(t)
15# else
16# define ECORE_FINITE(t) finite(t)
17# endif
18#endif
19
20#define FIX_HZ 1
21
22#ifdef FIX_HZ
23# ifndef _MSC_VER
24# include <sys/param.h>
25# endif
26# ifndef HZ
27# define HZ 100
28# endif
29#endif
30
31#ifdef HAVE_EVIL
32# include <Evil.h>
33#endif
34
35#ifdef HAVE_ESCAPE
36# include <Escape.h>
37#endif
38
39#ifdef HAVE_EXOTIC
40# include <Exotic.h>
41#endif
42
43#include "Ecore.h"
44#include "ecore_private.h"
45
46/* How of then we should retry to write to the pipe */
47#define ECORE_PIPE_WRITE_RETRY 6
48
49/*
50 * On Windows, pipe() is implemented with sockets.
51 * Contrary to Linux, Windows uses different functions
52 * for sockets and fd's: write() is for fd's and send
53 * is for sockets. So I need to put some win32 code
54 * here. I can't think of a solution where the win32
55 * code is in Evil and not here.
56 */
57
58#ifdef _WIN32
59
60# include <winsock2.h>
61
62# define pipe_write(fd, buffer, size) send((fd), (char *)(buffer), size, 0)
63# define pipe_read(fd, buffer, size) recv((fd), (char *)(buffer), size, 0)
64# define pipe_close(fd) closesocket(fd)
65# define PIPE_FD_INVALID INVALID_SOCKET
66# define PIPE_FD_ERROR SOCKET_ERROR
67
68#else
69
70# include <unistd.h>
71# include <fcntl.h>
72
73# define pipe_write(fd, buffer, size) write((fd), buffer, size)
74# define pipe_read(fd, buffer, size) read((fd), buffer, size)
75# define pipe_close(fd) close(fd)
76# define PIPE_FD_INVALID -1
77# define PIPE_FD_ERROR -1
78
79#endif /* ! _WIN32 */
80
81#include <Ecore.h>
82#include "ecore_private.h"
83
84struct _Ecore_Pipe
85{
86 ECORE_MAGIC;
87 int fd_read;
88 int fd_write;
89 Ecore_Fd_Handler *fd_handler;
90 const void *data;
91 Ecore_Pipe_Cb handler;
92 unsigned int len;
93 int handling;
94 size_t already_read;
95 void *passed_data;
96 int message;
97 Eina_Bool delete_me : 1;
98};
99GENERIC_ALLOC_SIZE_DECLARE(Ecore_Pipe);
100
101static Eina_Bool _ecore_pipe_read(void *data,
102 Ecore_Fd_Handler *fd_handler);
103
104/**
105 * @addtogroup Ecore_Pipe_Group
106 *
107 * @{
108 */
109
110/**
111 * Create two file descriptors (sockets on Windows). Add
112 * a callback that will be called when the file descriptor that
113 * is listened receives data. An event is also put in the event
114 * queue when data is received.
115 *
116 * @param handler The handler called when data is received.
117 * @param data Data to pass to @p handler when it is called.
118 * @return A newly created Ecore_Pipe object if successful.
119 * @c NULL otherwise.
120 */
121EAPI Ecore_Pipe *
122ecore_pipe_add(Ecore_Pipe_Cb handler,
123 const void *data)
124{
125 Ecore_Pipe *p;
126 int fds[2];
127
128 if (!handler) return NULL;
129
130 p = ecore_pipe_calloc(1);
131 if (!p) return NULL;
132
133 if (pipe(fds))
134 {
135 ecore_pipe_mp_free(p);
136 return NULL;
137 }
138
139 ECORE_MAGIC_SET(p, ECORE_MAGIC_PIPE);
140 p->fd_read = fds[0];
141 p->fd_write = fds[1];
142 p->handler = handler;
143 p->data = data;
144
145 fcntl(p->fd_read, F_SETFL, O_NONBLOCK);
146 p->fd_handler = ecore_main_fd_handler_add(p->fd_read,
147 ECORE_FD_READ,
148 _ecore_pipe_read,
149 p,
150 NULL, NULL);
151 return p;
152}
153
154/**
155 * Free an Ecore_Pipe object created with ecore_pipe_add().
156 *
157 * @param p The Ecore_Pipe object to be freed.
158 * @return The pointer to the private data
159 */
160EAPI void *
161ecore_pipe_del(Ecore_Pipe *p)
162{
163 void *data;
164
165 if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
166 {
167 ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_del");
168 return NULL;
169 }
170 p->delete_me = EINA_TRUE;
171 if (p->handling > 0) return (void *)p->data;
172 if (p->fd_handler) _ecore_main_fd_handler_del(p->fd_handler);
173 if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read);
174 if (p->fd_write != PIPE_FD_INVALID) pipe_close(p->fd_write);
175 data = (void *)p->data;
176 ecore_pipe_mp_free(p);
177 return data;
178}
179
180/**
181 * Close the read end of an Ecore_Pipe object created with ecore_pipe_add().
182 *
183 * @param p The Ecore_Pipe object.
184 */
185EAPI void
186ecore_pipe_read_close(Ecore_Pipe *p)
187{
188 if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
189 {
190 ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_close");
191 return;
192 }
193 if (p->fd_handler)
194 {
195 _ecore_main_fd_handler_del(p->fd_handler);
196 p->fd_handler = NULL;
197 }
198 if (p->fd_read != PIPE_FD_INVALID)
199 {
200 pipe_close(p->fd_read);
201 p->fd_read = PIPE_FD_INVALID;
202 }
203}
204
205/**
206 * Stop monitoring if necessary the pipe for reading. See ecore_pipe_thaw()
207 * for monitoring it again.
208 *
209 * @param p The Ecore_Pipe object.
210 * @since 1.1
211 */
212EAPI void
213ecore_pipe_freeze(Ecore_Pipe *p)
214{
215 if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
216 {
217 ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_freeze");
218 return;
219 }
220 if (p->fd_handler)
221 {
222 _ecore_main_fd_handler_del(p->fd_handler);
223 p->fd_handler = NULL;
224 }
225}
226
227/**
228 * Start monitoring again the pipe for reading. See ecore_pipe_freeze() for
229 * stopping the monitoring activity. This will not work if
230 * ecore_pipe_read_close() was previously called on the same pipe.
231 *
232 * @param p The Ecore_Pipe object.
233 * @since 1.1
234 */
235EAPI void
236ecore_pipe_thaw(Ecore_Pipe *p)
237{
238 if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
239 {
240 ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_thaw");
241 return;
242 }
243 if (!p->fd_handler && p->fd_read != PIPE_FD_INVALID)
244 {
245 p->fd_handler = ecore_main_fd_handler_add(p->fd_read,
246 ECORE_FD_READ,
247 _ecore_pipe_read,
248 p,
249 NULL, NULL);
250 }
251}
252
253/**
254 * @brief Wait from another thread on the read side of a pipe.
255 *
256 * @param p The pipe to watch on.
257 * @param message_count The minimal number of message to wait before exiting.
258 * @param wait The amount of time in second to wait before exiting.
259 * @return the number of message catched during that wait call.
260 * @since 1.1
261 *
262 * Negative value for @p wait means infite wait.
263 */
264EAPI int
265ecore_pipe_wait(Ecore_Pipe *p,
266 int message_count,
267 double wait)
268{
269 struct timeval tv, *t;
270 fd_set rset;
271 double end = 0.0;
272 double timeout;
273 int ret;
274 int total = 0;
275
276 if (p->fd_read == PIPE_FD_INVALID)
277 return -1;
278
279 FD_ZERO(&rset);
280 FD_SET(p->fd_read, &rset);
281
282 if (wait >= 0.0)
283 end = ecore_time_get() + wait;
284 timeout = wait;
285
286 while (message_count > 0 && (timeout > 0.0 || wait <= 0.0))
287 {
288 if (wait >= 0.0)
289 {
290 /* finite() tests for NaN, too big, too small, and infinity. */
291 if ((!ECORE_FINITE(timeout)) || (timeout == 0.0))
292 {
293 tv.tv_sec = 0;
294 tv.tv_usec = 0;
295 }
296 else if (timeout > 0.0)
297 {
298 int sec, usec;
299#ifdef FIX_HZ
300 timeout += (0.5 / HZ);
301 sec = (int)timeout;
302 usec = (int)((timeout - (double)sec) * 1000000);
303#else
304 sec = (int)timeout;
305 usec = (int)((timeout - (double)sec) * 1000000);
306#endif
307 tv.tv_sec = sec;
308 tv.tv_usec = usec;
309 }
310 t = &tv;
311 }
312 else
313 {
314 t = NULL;
315 }
316
317 ret = main_loop_select(p->fd_read + 1, &rset, NULL, NULL, t);
318
319 if (ret > 0)
320 {
321 _ecore_pipe_read(p, NULL);
322 message_count -= p->message;
323 total += p->message;
324 p->message = 0;
325 }
326 else if (ret == 0)
327 {
328 break;
329 }
330 else if (errno != EINTR)
331 {
332 close(p->fd_read);
333 p->fd_read = PIPE_FD_INVALID;
334 break;
335 }
336
337 if (wait >= 0.0)
338 timeout = end - ecore_time_get();
339 }
340
341 return total;
342}
343
344/**
345 * Close the write end of an Ecore_Pipe object created with ecore_pipe_add().
346 *
347 * @param p The Ecore_Pipe object.
348 */
349EAPI void
350ecore_pipe_write_close(Ecore_Pipe *p)
351{
352 if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
353 {
354 ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write_close");
355 return;
356 }
357 if (p->fd_write != PIPE_FD_INVALID)
358 {
359 pipe_close(p->fd_write);
360 p->fd_write = PIPE_FD_INVALID;
361 }
362}
363
364/**
365 * Write on the file descriptor the data passed as parameter.
366 *
367 * @param p The Ecore_Pipe object.
368 * @param buffer The data to write into the pipe.
369 * @param nbytes The size of the @p buffer in bytes
370 * @return Returns EINA_TRUE on a successful write, EINA_FALSE on an error
371 */
372EAPI Eina_Bool
373ecore_pipe_write(Ecore_Pipe *p,
374 const void *buffer,
375 unsigned int nbytes)
376{
377 ssize_t ret;
378 size_t already_written = 0;
379 int retry = ECORE_PIPE_WRITE_RETRY;
380
381 if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
382 {
383 ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write");
384 return EINA_FALSE;
385 }
386
387 if (p->delete_me) return EINA_FALSE;
388
389 if (p->fd_write == PIPE_FD_INVALID) return EINA_FALSE;
390
391 /* First write the len into the pipe */
392 do
393 {
394 ret = pipe_write(p->fd_write, &nbytes, sizeof(nbytes));
395 if (ret == sizeof(nbytes))
396 {
397 retry = ECORE_PIPE_WRITE_RETRY;
398 break;
399 }
400 else if (ret > 0)
401 {
402 /* XXX What should we do here? */
403 ERR("The length of the data was not written complete"
404 " to the pipe");
405 return EINA_FALSE;
406 }
407 else if (ret == PIPE_FD_ERROR && errno == EPIPE)
408 {
409 pipe_close(p->fd_write);
410 p->fd_write = PIPE_FD_INVALID;
411 return EINA_FALSE;
412 }
413 else if (ret == PIPE_FD_ERROR && errno == EINTR)
414 /* try it again */
415 ;
416 else
417 {
418 ERR("An unhandled error (ret: %zd errno: %d)"
419 "occurred while writing to the pipe the length",
420 ret, errno);
421 }
422 }
423 while (retry--);
424
425 if (retry != ECORE_PIPE_WRITE_RETRY) return EINA_FALSE;
426
427 /* and now pass the data to the pipe */
428 do
429 {
430 ret = pipe_write(p->fd_write,
431 ((unsigned char *)buffer) + already_written,
432 nbytes - already_written);
433
434 if (ret == (ssize_t)(nbytes - already_written))
435 return EINA_TRUE;
436 else if (ret >= 0)
437 {
438 already_written -= ret;
439 continue;
440 }
441 else if (ret == PIPE_FD_ERROR && errno == EPIPE)
442 {
443 pipe_close(p->fd_write);
444 p->fd_write = PIPE_FD_INVALID;
445 return EINA_FALSE;
446 }
447 else if (ret == PIPE_FD_ERROR && errno == EINTR)
448 /* try it again */
449 ;
450 else
451 {
452 ERR("An unhandled error (ret: %zd errno: %d)"
453 "occurred while writing to the pipe the length",
454 ret, errno);
455 }
456 }
457 while (retry--);
458
459 return EINA_FALSE;
460}
461
462/**
463 * @}
464 */
465
466/* Private function */
467static void
468_ecore_pipe_unhandle(Ecore_Pipe *p)
469{
470 p->handling--;
471 if (p->delete_me)
472 {
473 ecore_pipe_del(p);
474 }
475}
476
477static Eina_Bool
478_ecore_pipe_read(void *data,
479 Ecore_Fd_Handler *fd_handler __UNUSED__)
480{
481 Ecore_Pipe *p = (Ecore_Pipe *)data;
482 int i;
483
484 p->handling++;
485 for (i = 0; i < 16; i++)
486 {
487 ssize_t ret;
488
489 /* if we already have read some data we don't need to read the len
490 * but to finish the already started job
491 */
492 if (p->len == 0)
493 {
494 /* read the len of the passed data */
495 ret = pipe_read(p->fd_read, &p->len, sizeof(p->len));
496
497 /* catch the non error case first */
498 /* read amount ok - nothing more to do */
499 if (ret == sizeof(p->len))
500 ;
501 else if (ret > 0)
502 {
503 /* we got more data than we asked for - definite error */
504 ERR("Only read %i bytes from the pipe, although"
505 " we need to read %i bytes.",
506 (int)ret, (int)sizeof(p->len));
507 _ecore_pipe_unhandle(p);
508 return ECORE_CALLBACK_CANCEL;
509 }
510 else if (ret == 0)
511 {
512 /* we got no data */
513 if (i == 0)
514 {
515 /* no data on first try through means an error */
516 if (!p->delete_me)
517 p->handler((void *)p->data, NULL, 0);
518 if (p->passed_data) free(p->passed_data);
519 p->passed_data = NULL;
520 p->already_read = 0;
521 p->len = 0;
522 p->message++;
523 pipe_close(p->fd_read);
524 p->fd_read = PIPE_FD_INVALID;
525 p->fd_handler = NULL;
526 _ecore_pipe_unhandle(p);
527 return ECORE_CALLBACK_CANCEL;
528 }
529 else
530 {
531 /* no data after first loop try is ok */
532 _ecore_pipe_unhandle(p);
533 return ECORE_CALLBACK_RENEW;
534 }
535 }
536#ifndef _WIN32
537 else if ((ret == PIPE_FD_ERROR) &&
538 ((errno == EINTR) || (errno == EAGAIN)))
539 {
540 return ECORE_CALLBACK_RENEW;
541 }
542 else
543 {
544 ERR("An unhandled error (ret: %i errno: %i [%s])"
545 "occurred while reading from the pipe the length",
546 (int)ret, errno, strerror(errno));
547 return ECORE_CALLBACK_RENEW;
548 }
549#else
550 else /* ret == PIPE_FD_ERROR is the only other case on Windows */
551 {
552 if (WSAGetLastError() != WSAEWOULDBLOCK)
553 {
554 if (!p->delete_me)
555 p->handler((void *)p->data, NULL, 0);
556 if (p->passed_data) free(p->passed_data);
557 p->passed_data = NULL;
558 p->already_read = 0;
559 p->len = 0;
560 p->message++;
561 pipe_close(p->fd_read);
562 p->fd_read = PIPE_FD_INVALID;
563 p->fd_handler = NULL;
564 _ecore_pipe_unhandle(p);
565 return ECORE_CALLBACK_CANCEL;
566 }
567 }
568#endif
569 }
570
571 /* if somehow we got less than or equal to 0 we got an errnoneous
572 * messages so call callback with null and len we got. this case should
573 * never happen */
574 if (p->len == 0)
575 {
576 if (!p->delete_me)
577 p->handler((void *)p->data, NULL, 0);
578 /* reset all values to 0 */
579 if (p->passed_data) free(p->passed_data);
580 p->passed_data = NULL;
581 p->already_read = 0;
582 p->len = 0;
583 p->message++;
584 _ecore_pipe_unhandle(p);
585 return ECORE_CALLBACK_RENEW;
586 }
587
588 /* we dont have a buffer to hold the data, so alloc it */
589 if (!p->passed_data)
590 {
591 p->passed_data = malloc(p->len);
592 /* alloc failed - error case */
593 if (!p->passed_data)
594 {
595 if (!p->delete_me)
596 p->handler((void *)p->data, NULL, 0);
597 /* close the pipe */
598 p->already_read = 0;
599 p->len = 0;
600 p->message++;
601 pipe_close(p->fd_read);
602 p->fd_read = PIPE_FD_INVALID;
603 p->fd_handler = NULL;
604 _ecore_pipe_unhandle(p);
605 return ECORE_CALLBACK_CANCEL;
606 }
607 }
608
609 /* and read the passed data */
610 ret = pipe_read(p->fd_read,
611 ((unsigned char *)p->passed_data) + p->already_read,
612 p->len - p->already_read);
613
614 /* catch the non error case first */
615 /* if we read enough data to finish the message/buffer */
616 if (ret == (ssize_t)(p->len - p->already_read))
617 {
618 if (!p->delete_me)
619 p->handler((void *)p->data, p->passed_data, p->len);
620 free(p->passed_data);
621 /* reset all values to 0 */
622 p->passed_data = NULL;
623 p->already_read = 0;
624 p->len = 0;
625 p->message++;
626 }
627 else if (ret > 0)
628 {
629 /* more data left to read */
630 p->already_read += ret;
631 _ecore_pipe_unhandle(p);
632 return ECORE_CALLBACK_RENEW;
633 }
634 else if (ret == 0)
635 {
636 /* 0 bytes to read - could be more to read next select wake up */
637 _ecore_pipe_unhandle(p);
638 return ECORE_CALLBACK_RENEW;
639 }
640#ifndef _WIN32
641 else if ((ret == PIPE_FD_ERROR) &&
642 ((errno == EINTR) || (errno == EAGAIN)))
643 {
644 _ecore_pipe_unhandle(p);
645 return ECORE_CALLBACK_RENEW;
646 }
647 else
648 {
649 ERR("An unhandled error (ret: %zd errno: %d)"
650 "occurred while reading from the pipe the data",
651 ret, errno);
652 _ecore_pipe_unhandle(p);
653 return ECORE_CALLBACK_RENEW;
654 }
655#else
656 else /* ret == PIPE_FD_ERROR is the only other case on Windows */
657 {
658 if (WSAGetLastError() != WSAEWOULDBLOCK)
659 {
660 if (!p->delete_me)
661 p->handler((void *)p->data, NULL, 0);
662 if (p->passed_data) free(p->passed_data);
663 p->passed_data = NULL;
664 p->already_read = 0;
665 p->len = 0;
666 p->message++;
667 pipe_close(p->fd_read);
668 p->fd_read = PIPE_FD_INVALID;
669 p->fd_handler = NULL;
670 _ecore_pipe_unhandle(p);
671 return ECORE_CALLBACK_CANCEL;
672 }
673 else
674 break;
675 }
676#endif
677 }
678
679 _ecore_pipe_unhandle(p);
680 return ECORE_CALLBACK_RENEW;
681}
682
diff --git a/libraries/ecore/src/lib/ecore/ecore_poll.c b/libraries/ecore/src/lib/ecore/ecore_poll.c
deleted file mode 100644
index bf4da6a..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_poll.c
+++ /dev/null
@@ -1,347 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9
10struct _Ecore_Poller
11{
12 EINA_INLIST;
13 ECORE_MAGIC;
14 int ibit;
15 unsigned char delete_me : 1;
16 Ecore_Task_Cb func;
17 void *data;
18};
19GENERIC_ALLOC_SIZE_DECLARE(Ecore_Poller);
20
21static Ecore_Timer *timer = NULL;
22static int min_interval = -1;
23static int interval_incr = 0;
24static int at_tick = 0;
25static int just_added_poller = 0;
26static int poller_delete_count = 0;
27static int poller_walking = 0;
28static double poll_interval = 0.125;
29static double poll_cur_interval = 0.0;
30static double last_tick = 0.0;
31static Ecore_Poller *pollers[16] =
32{
33 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
34 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
35};
36static unsigned short poller_counters[16] =
37{
38 0, 0, 0, 0, 0, 0, 0, 0,
39 0, 0, 0, 0, 0, 0, 0, 0
40};
41
42static void _ecore_poller_next_tick_eval(void);
43static Eina_Bool _ecore_poller_cb_timer(void *data);
44
45static void
46_ecore_poller_next_tick_eval(void)
47{
48 int i;
49 double interval;
50
51 min_interval = -1;
52 for (i = 0; i < 15; i++)
53 {
54 if (pollers[i])
55 {
56 min_interval = i;
57 break;
58 }
59 }
60 if (min_interval < 0)
61 {
62 /* no pollers */
63 if (timer)
64 {
65 ecore_timer_del(timer);
66 timer = NULL;
67 }
68 return;
69 }
70 interval_incr = (1 << min_interval);
71 interval = interval_incr * poll_interval;
72 /* we are at the tick callback - so no need to do inter-tick adjustments
73 * so we can fasttrack this as t -= last_tick in theory is 0.0 (though
74 * in practice it will be a very very very small value. also the tick
75 * callback will adjust the timer interval at the end anyway */
76 if (at_tick)
77 {
78 if (!timer)
79 timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
80 }
81 else
82 {
83 double t;
84
85 if (!timer)
86 timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
87 else
88 {
89 t = ecore_time_get();
90 if (interval != poll_cur_interval)
91 {
92 t -= last_tick; /* time since we last ticked */
93 /* delete the timer and reset it to tick off in the new
94 * time interval. at the tick this will be adjusted */
95 ecore_timer_del(timer);
96 timer = ecore_timer_add(interval - t,
97 _ecore_poller_cb_timer, NULL);
98 }
99 }
100 }
101 poll_cur_interval = interval;
102}
103
104static Eina_Bool
105_ecore_poller_cb_timer(void *data __UNUSED__)
106{
107 int i;
108 Ecore_Poller *poller, *l;
109 int changes = 0;
110
111 at_tick++;
112 last_tick = ecore_time_get();
113 /* we have 16 counters - each increments every time the poller counter
114 * "ticks". it increments by the minimum interval (which can be 1, 2, 4,
115 * 7, 16 etc. up to 32768) */
116 for (i = 0; i < 15; i++)
117 {
118 poller_counters[i] += interval_incr;
119 /* wrap back to 0 if we exceed out loop count for the counter */
120 if (poller_counters[i] >= (1 << i)) poller_counters[i] = 0;
121 }
122
123 just_added_poller = 0;
124 /* walk the pollers now */
125 poller_walking++;
126 for (i = 0; i < 15; i++)
127 {
128 /* if the counter is @ 0 - this means that counter "went off" this
129 * tick interval, so run all pollers hooked to that counter */
130 if (poller_counters[i] == 0)
131 {
132 EINA_INLIST_FOREACH(pollers[i], poller)
133 {
134 if (!poller->delete_me)
135 {
136 if (!poller->func(poller->data))
137 {
138 if (!poller->delete_me)
139 {
140 poller->delete_me = 1;
141 poller_delete_count++;
142 }
143 }
144 }
145 }
146 }
147 }
148 poller_walking--;
149
150 /* handle deletes afterwards */
151 if (poller_delete_count > 0)
152 {
153 /* FIXME: walk all pollers and remove deleted ones */
154 for (i = 0; i < 15; i++)
155 {
156 for (l = pollers[i]; l; )
157 {
158 poller = l;
159 l = (Ecore_Poller *)EINA_INLIST_GET(l)->next;
160 if (poller->delete_me)
161 {
162 pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
163 ecore_poller_mp_free(poller);
164 poller_delete_count--;
165 changes++;
166 if (poller_delete_count <= 0) break;
167 }
168 }
169 if (poller_delete_count <= 0) break;
170 }
171 }
172 /* if we deleted or added any pollers, then we need to re-evaluate our
173 * minimum poll interval */
174 if ((changes > 0) || (just_added_poller > 0))
175 _ecore_poller_next_tick_eval();
176
177 just_added_poller = 0;
178 poller_delete_count = 0;
179
180 at_tick--;
181
182 /* if the timer was deleted then there is no point returning 1 - ambiguous
183 * if we do as it implies keep running me" but we have been deleted
184 * anyway */
185 if (!timer) return ECORE_CALLBACK_CANCEL;
186
187 /* adjust interval */
188 ecore_timer_interval_set(timer, poll_cur_interval);
189 return ECORE_CALLBACK_RENEW;
190}
191
192EAPI void
193ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__,
194 double poll_time)
195{
196 poll_interval = poll_time;
197 _ecore_poller_next_tick_eval();
198}
199
200EAPI double
201ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__)
202{
203 return poll_interval;
204}
205
206EAPI Ecore_Poller *
207ecore_poller_add(Ecore_Poller_Type type __UNUSED__,
208 int interval,
209 Ecore_Task_Cb func,
210 const void *data)
211{
212 Ecore_Poller *poller;
213 int ibit;
214
215 if (!func) return NULL;
216 if (interval < 1) interval = 1;
217
218 poller = ecore_poller_calloc(1);
219 if (!poller) return NULL;
220 ECORE_MAGIC_SET(poller, ECORE_MAGIC_POLLER);
221 /* interval MUST be a power of 2, so enforce it */
222 if (interval < 1) interval = 1;
223 ibit = -1;
224 while (interval != 0)
225 {
226 ibit++;
227 interval >>= 1;
228 }
229 /* only allow up to 32768 - i.e. ibit == 15, so limit it */
230 if (ibit > 15) ibit = 15;
231
232 poller->ibit = ibit;
233 poller->func = func;
234 poller->data = (void *)data;
235 pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
236 if (poller_walking)
237 just_added_poller++;
238 else
239 _ecore_poller_next_tick_eval();
240 return poller;
241}
242
243EAPI Eina_Bool
244ecore_poller_poller_interval_set(Ecore_Poller *poller,
245 int interval)
246{
247 int ibit;
248
249 if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER))
250 {
251 ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER,
252 "ecore_poller_poller_interval_set");
253 return EINA_FALSE;
254 }
255
256 /* interval MUST be a power of 2, so enforce it */
257 if (interval < 1) interval = 1;
258 ibit = -1;
259 while (interval != 0)
260 {
261 ibit++;
262 interval >>= 1;
263 }
264 /* only allow up to 32768 - i.e. ibit == 15, so limit it */
265 if (ibit > 15) ibit = 15;
266 /* if interval specified is the same as interval set, return true without wasting time */
267 if (poller->ibit == ibit)
268 return EINA_TRUE;
269 pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
270 poller->ibit = ibit;
271 pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
272 if (poller_walking)
273 just_added_poller++;
274 else
275 _ecore_poller_next_tick_eval();
276 return EINA_TRUE;
277}
278
279EAPI int
280ecore_poller_poller_interval_get(Ecore_Poller *poller)
281{
282 int ibit, interval = 1;
283
284 if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER))
285 {
286 ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER,
287 "ecore_poller_poller_interval_get");
288 return 0;
289 }
290
291 ibit = poller->ibit;
292 while (ibit != 0)
293 {
294 ibit--;
295 interval <<= 1;
296 }
297 return interval;
298}
299
300EAPI void *
301ecore_poller_del(Ecore_Poller *poller)
302{
303 void *data;
304
305 if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER))
306 {
307 ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER,
308 "ecore_poller_del");
309 return NULL;
310 }
311 /* we are walking the poller list - a bad idea to remove from it while
312 * walking it, so just flag it as delete_me and come back to it after
313 * the loop has finished */
314 if (poller_walking > 0)
315 {
316 poller_delete_count++;
317 poller->delete_me = 1;
318 return poller->data;
319 }
320 /* not in loop so safe - delete immediately */
321 data = poller->data;
322 pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
323 ecore_poller_mp_free(poller);
324 _ecore_poller_next_tick_eval();
325 return data;
326}
327
328/**
329 * @}
330 */
331
332void
333_ecore_poller_shutdown(void)
334{
335 int i;
336 Ecore_Poller *poller;
337
338 for (i = 0; i < 15; i++)
339 {
340 while ((poller = pollers[i]))
341 {
342 pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
343 ecore_poller_mp_free(poller);
344 }
345 }
346}
347
diff --git a/libraries/ecore/src/lib/ecore/ecore_private.h b/libraries/ecore/src/lib/ecore/ecore_private.h
deleted file mode 100644
index f0c5d6b..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_private.h
+++ /dev/null
@@ -1,378 +0,0 @@
1#ifndef _ECORE_PRIVATE_H
2#define _ECORE_PRIVATE_H
3
4#include <assert.h>
5
6extern int _ecore_log_dom;
7#ifdef _ECORE_DEFAULT_LOG_DOM
8# undef _ECORE_DEFAULT_LOG_DOM
9#endif
10#define _ECORE_DEFAULT_LOG_DOM _ecore_log_dom
11
12#ifdef ECORE_DEFAULT_LOG_COLOR
13# undef ECORE_DEFAULT_LOG_COLOR
14#endif
15#define ECORE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
16
17#ifdef ERR
18# undef ERR
19#endif
20#define ERR(...) EINA_LOG_DOM_ERR(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
21
22#ifdef DBG
23# undef DBG
24#endif
25#define DBG(...) EINA_LOG_DOM_DBG(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
26
27#ifdef INF
28# undef INF
29#endif
30#define INF(...) EINA_LOG_DOM_INFO(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
31
32#ifdef WRN
33# undef WRN
34#endif
35#define WRN(...) EINA_LOG_DOM_WARN(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
36
37#ifdef CRIT
38# undef CRIT
39#endif
40#define CRIT(...) EINA_LOG_DOM_CRIT(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
41
42#ifndef PATH_MAX
43# define PATH_MAX 4096
44#endif
45
46#ifndef MIN
47# define MIN(x, y) (((x) > (y)) ? (y) : (x))
48#endif
49
50#ifndef MAX
51# define MAX(x, y) (((x) > (y)) ? (x) : (y))
52#endif
53
54#ifndef ABS
55# define ABS(x) ((x) < 0 ? -(x) : (x))
56#endif
57
58#ifndef CLAMP
59# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
60#endif
61
62#define EVAS_FRAME_QUEUING 1 /* for test */
63
64#define READBUFSIZ 65536
65
66#define ECORE_MAGIC_NONE 0x1234fedc
67#define ECORE_MAGIC_EXE 0xf7e812f5
68#define ECORE_MAGIC_TIMER 0xf7d713f4
69#define ECORE_MAGIC_IDLER 0xf7c614f3
70#define ECORE_MAGIC_IDLE_ENTERER 0xf7b515f2
71#define ECORE_MAGIC_IDLE_EXITER 0xf7601afd
72#define ECORE_MAGIC_FD_HANDLER 0xf7a416f1
73#define ECORE_MAGIC_EVENT_HANDLER 0xf79317f0
74#define ECORE_MAGIC_EVENT_FILTER 0xf78218ff
75#define ECORE_MAGIC_EVENT 0xf77119fe
76#define ECORE_MAGIC_ANIMATOR 0xf7643ea5
77#define ECORE_MAGIC_POLLER 0xf7568127
78#define ECORE_MAGIC_PIPE 0xf7458226
79#define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3
80#define ECORE_MAGIC_JOB 0x76543210
81
82typedef unsigned int Ecore_Magic;
83#define ECORE_MAGIC Ecore_Magic __magic
84
85#define ECORE_MAGIC_SET(d, m) (d)->__magic = (m)
86#define ECORE_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m)))
87#define ECORE_MAGIC_FAIL(d, m, fn) _ecore_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn));
88
89/* undef the following, we want our version */
90#undef FREE
91#define FREE(ptr) free(ptr); ptr = NULL;
92
93#undef IF_FREE
94#define IF_FREE(ptr) if (ptr) free(ptr); ptr = NULL;
95
96#undef IF_FN_DEL
97#define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; }
98
99EAPI void
100ecore_print_warning(const char *function,
101 const char *sparam);
102
103/* convenience macros for checking pointer parameters for non-NULL */
104#undef CHECK_PARAM_POINTER_RETURN
105#define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \
106 if (!(param)) \
107 { \
108 ecore_print_warning(__FUNCTION__, sparam); \
109 return ret; \
110 }
111
112#undef CHECK_PARAM_POINTER
113#define CHECK_PARAM_POINTER(sparam, param) \
114 if (!(param)) \
115 { \
116 ecore_print_warning(__FUNCTION__, sparam); \
117 return; \
118 }
119
120EAPI void _ecore_magic_fail(const void *d,
121 Ecore_Magic m,
122 Ecore_Magic req_m,
123 const char *fname);
124
125void _ecore_time_init(void);
126
127Ecore_Timer *_ecore_timer_loop_add(double in,
128 Ecore_Task_Cb func,
129 const void *data);
130void *_ecore_timer_del(Ecore_Timer *timer);
131void _ecore_timer_delay(Ecore_Timer *timer,
132 double add);
133void _ecore_timer_shutdown(void);
134void _ecore_timer_cleanup(void);
135void _ecore_timer_enable_new(void);
136double _ecore_timer_next_get(void);
137void _ecore_timer_expired_timers_call(double when);
138int _ecore_timers_exists(void);
139
140int _ecore_timer_expired_call(double when);
141
142void _ecore_idler_shutdown(void);
143int _ecore_idler_all_call(void);
144int _ecore_idler_exist(void);
145
146void _ecore_idle_enterer_shutdown(void);
147void _ecore_idle_enterer_call(void);
148int _ecore_idle_enterer_exist(void);
149
150void _ecore_idle_exiter_shutdown(void);
151void _ecore_idle_exiter_call(void);
152int _ecore_idle_exiter_exist(void);
153
154void _ecore_event_shutdown(void);
155int _ecore_event_exist(void);
156Ecore_Event *_ecore_event_add(int type,
157 void *ev,
158 Ecore_End_Cb func_free,
159 void *data);
160void _ecore_event_call(void);
161void *_ecore_event_handler_del(Ecore_Event_Handler *event_handler);
162
163Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe);
164void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe,
165 Ecore_Timer *dc);
166
167EAPI void *_ecore_event_signal_user_new(void);
168void *_ecore_event_signal_hup_new(void);
169void *_ecore_event_signal_exit_new(void);
170void *_ecore_event_signal_power_new(void);
171void *_ecore_event_signal_realtime_new(void);
172
173void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
174
175void _ecore_main_shutdown(void);
176
177#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC)
178static inline void _ecore_signal_shutdown(void) { }
179
180static inline void _ecore_signal_init(void) { }
181
182static inline void _ecore_signal_received_process(void) { }
183
184static inline int _ecore_signal_count_get(void) { return 0; }
185
186static inline void _ecore_signal_call(void) { }
187
188#else
189void _ecore_signal_shutdown(void);
190void _ecore_signal_init(void);
191void _ecore_signal_received_process(void);
192int _ecore_signal_count_get(void);
193void _ecore_signal_call(void);
194#endif
195
196void _ecore_exe_init(void);
197void _ecore_exe_shutdown(void);
198#ifndef _WIN32
199Ecore_Exe *_ecore_exe_find(pid_t pid);
200void *_ecore_exe_event_del_new(void);
201void _ecore_exe_event_del_free(void *data,
202 void *ev);
203#endif
204
205void _ecore_animator_shutdown(void);
206
207void _ecore_poller_shutdown(void);
208
209void _ecore_fps_debug_init(void);
210void _ecore_fps_debug_shutdown(void);
211void _ecore_fps_debug_runtime_add(double t);
212
213void _ecore_thread_init(void);
214void _ecore_thread_shutdown(void);
215
216void _ecore_glib_init(void);
217void _ecore_glib_shutdown(void);
218
219void _ecore_job_init(void);
220void _ecore_job_shutdown(void);
221
222void _ecore_main_loop_init(void);
223void _ecore_main_loop_shutdown(void);
224
225void _ecore_throttle(void);
226
227extern int _ecore_main_lock_count;
228extern Eina_Lock _ecore_main_loop_lock;
229
230static inline void
231_ecore_lock(void)
232{
233#ifdef HAVE_THREAD_SAFETY
234 eina_lock_take(&_ecore_main_loop_lock);
235#else
236 /* at least check we're not being called from a thread */
237 EINA_MAIN_LOOP_CHECK_RETURN;
238#endif
239 _ecore_main_lock_count++;
240 /* assert(_ecore_main_lock_count == 1); */
241}
242
243static inline void
244_ecore_unlock(void)
245{
246 _ecore_main_lock_count--;
247 /* assert(_ecore_main_lock_count == 0); */
248#ifdef HAVE_THREAD_SAFETY
249 eina_lock_release(&_ecore_main_loop_lock);
250#endif
251}
252
253/*
254 * Callback wrappers all assume that ecore _ecore_lock has been called
255 */
256static inline Eina_Bool
257_ecore_call_task_cb(Ecore_Task_Cb func,
258 void *data)
259{
260 Eina_Bool r;
261
262 _ecore_unlock();
263 r = func(data);
264 _ecore_lock();
265
266 return r;
267}
268
269static inline void *
270_ecore_call_data_cb(Ecore_Data_Cb func,
271 void *data)
272{
273 void *r;
274
275 _ecore_unlock();
276 r = func(data);
277 _ecore_lock();
278
279 return r;
280}
281
282static inline void
283_ecore_call_end_cb(Ecore_End_Cb func,
284 void *user_data,
285 void *func_data)
286{
287 _ecore_unlock();
288 func(user_data, func_data);
289 _ecore_lock();
290}
291
292static inline Eina_Bool
293_ecore_call_filter_cb(Ecore_Filter_Cb func,
294 void *data,
295 void *loop_data,
296 int type,
297 void *event)
298{
299 Eina_Bool r;
300
301 _ecore_unlock();
302 r = func(data, loop_data, type, event);
303 _ecore_lock();
304
305 return r;
306}
307
308static inline Eina_Bool
309_ecore_call_handler_cb(Ecore_Event_Handler_Cb func,
310 void *data,
311 int type,
312 void *event)
313{
314 Eina_Bool r;
315
316 _ecore_unlock();
317 r = func(data, type, event);
318 _ecore_lock();
319
320 return r;
321}
322
323static inline void
324_ecore_call_prep_cb(Ecore_Fd_Prep_Cb func,
325 void *data,
326 Ecore_Fd_Handler *fd_handler)
327{
328 _ecore_unlock();
329 func(data, fd_handler);
330 _ecore_lock();
331}
332
333static inline Eina_Bool
334_ecore_call_fd_cb(Ecore_Fd_Cb func,
335 void *data,
336 Ecore_Fd_Handler *fd_handler)
337{
338 Eina_Bool r;
339
340 _ecore_unlock();
341 r = func(data, fd_handler);
342 _ecore_lock();
343
344 return r;
345}
346
347extern int _ecore_fps_debug;
348extern double _ecore_time_loop_time;
349extern Eina_Bool _ecore_glib_always_integrate;
350extern Ecore_Select_Function main_loop_select;
351
352Eina_Bool ecore_mempool_init(void);
353void ecore_mempool_shutdown(void);
354#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \
355 TYPE *Type##_calloc(unsigned int); \
356 void Type##_mp_free(TYPE *e);
357#define GENERIC_ALLOC_SIZE_DECLARE(TYPE) \
358 size_t _ecore_sizeof_##TYPE = sizeof (TYPE);
359
360GENERIC_ALLOC_FREE_HEADER(Ecore_Animator, ecore_animator);
361GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Handler, ecore_event_handler);
362GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Filter, ecore_event_filter);
363GENERIC_ALLOC_FREE_HEADER(Ecore_Event, ecore_event);
364GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Exiter, ecore_idle_exiter);
365GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Enterer, ecore_idle_enterer);
366GENERIC_ALLOC_FREE_HEADER(Ecore_Idler, ecore_idler);
367GENERIC_ALLOC_FREE_HEADER(Ecore_Job, ecore_job);
368GENERIC_ALLOC_FREE_HEADER(Ecore_Timer, ecore_timer);
369GENERIC_ALLOC_FREE_HEADER(Ecore_Poller, ecore_poller);
370GENERIC_ALLOC_FREE_HEADER(Ecore_Pipe, ecore_pipe);
371GENERIC_ALLOC_FREE_HEADER(Ecore_Fd_Handler, ecore_fd_handler);
372#ifdef _WIN32
373GENERIC_ALLOC_FREE_HEADER(Ecore_Win32_Handler, ecore_win32_handler);
374#endif
375
376#undef GENERIC_ALLOC_FREE_HEADER
377
378#endif
diff --git a/libraries/ecore/src/lib/ecore/ecore_signal.c b/libraries/ecore/src/lib/ecore/ecore_signal.c
deleted file mode 100644
index 78edb8c..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_signal.c
+++ /dev/null
@@ -1,565 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <sys/types.h>
7#include <sys/wait.h>
8#include <signal.h>
9#include <unistd.h>
10#include <assert.h>
11
12#include "Ecore.h"
13#include "ecore_private.h"
14
15/* make mono happy - this is evil though... */
16#undef SIGPWR
17/* valgrind in some versions/setups uses SIGRT's... hmmm */
18
19typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo);
20
21static void _ecore_signal_callback_set(int sig,
22 Signal_Handler func);
23static void _ecore_signal_callback_ignore(int sig,
24 siginfo_t *si,
25 void *foo);
26static void _ecore_signal_callback_sigchld(int sig,
27 siginfo_t *si,
28 void *foo);
29static void _ecore_signal_callback_sigusr1(int sig,
30 siginfo_t *si,
31 void *foo);
32static void _ecore_signal_callback_sigusr2(int sig,
33 siginfo_t *si,
34 void *foo);
35static void _ecore_signal_callback_sighup(int sig,
36 siginfo_t *si,
37 void *foo);
38static void _ecore_signal_callback_sigquit(int sig,
39 siginfo_t *si,
40 void *foo);
41static void _ecore_signal_callback_sigint(int sig,
42 siginfo_t *si,
43 void *foo);
44static void _ecore_signal_callback_sigterm(int sig,
45 siginfo_t *si,
46 void *foo);
47#ifdef SIGPWR
48static void _ecore_signal_callback_sigpwr(int sig,
49 siginfo_t *si,
50 void *foo);
51#endif
52
53static Eina_Bool _ecore_signal_exe_exit_delay(void *data);
54
55//#define MAXSIGQ 256 // 32k
56#define MAXSIGQ 64 // 8k
57
58static volatile sig_atomic_t sig_count = 0;
59static volatile sig_atomic_t sigchld_count = 0;
60static volatile sig_atomic_t sigusr1_count = 0;
61static volatile sig_atomic_t sigusr2_count = 0;
62static volatile sig_atomic_t sighup_count = 0;
63static volatile sig_atomic_t sigquit_count = 0;
64static volatile sig_atomic_t sigint_count = 0;
65static volatile sig_atomic_t sigterm_count = 0;
66#ifdef SIGPWR
67static volatile sig_atomic_t sigpwr_count = 0;
68#endif
69
70static volatile siginfo_t sigchld_info[MAXSIGQ];
71static volatile siginfo_t sigusr1_info[MAXSIGQ];
72static volatile siginfo_t sigusr2_info[MAXSIGQ];
73static volatile siginfo_t sighup_info[MAXSIGQ];
74static volatile siginfo_t sigquit_info[MAXSIGQ];
75static volatile siginfo_t sigint_info[MAXSIGQ];
76static volatile siginfo_t sigterm_info[MAXSIGQ];
77#ifdef SIGPWR
78static volatile siginfo_t sigpwr_info[MAXSIGQ];
79#endif
80
81void
82_ecore_signal_shutdown(void)
83{
84 _ecore_signal_callback_set(SIGPIPE, (Signal_Handler)SIG_DFL);
85 _ecore_signal_callback_set(SIGALRM, (Signal_Handler)SIG_DFL);
86 _ecore_signal_callback_set(SIGCHLD, (Signal_Handler)SIG_DFL);
87 _ecore_signal_callback_set(SIGUSR1, (Signal_Handler)SIG_DFL);
88 _ecore_signal_callback_set(SIGUSR2, (Signal_Handler)SIG_DFL);
89 _ecore_signal_callback_set(SIGHUP, (Signal_Handler)SIG_DFL);
90 _ecore_signal_callback_set(SIGQUIT, (Signal_Handler)SIG_DFL);
91 _ecore_signal_callback_set(SIGINT, (Signal_Handler)SIG_DFL);
92 _ecore_signal_callback_set(SIGTERM, (Signal_Handler)SIG_DFL);
93#ifdef SIGPWR
94 _ecore_signal_callback_set(SIGPWR, (Signal_Handler)SIG_DFL);
95 sigpwr_count = 0;
96#endif
97 sigchld_count = 0;
98 sigusr1_count = 0;
99 sigusr2_count = 0;
100 sighup_count = 0;
101 sigquit_count = 0;
102 sigint_count = 0;
103 sigterm_count = 0;
104 sig_count = 0;
105}
106
107void
108_ecore_signal_init(void)
109{
110 _ecore_signal_callback_set(SIGPIPE, _ecore_signal_callback_ignore);
111 _ecore_signal_callback_set(SIGALRM, _ecore_signal_callback_ignore);
112 _ecore_signal_callback_set(SIGCHLD, _ecore_signal_callback_sigchld);
113 _ecore_signal_callback_set(SIGUSR1, _ecore_signal_callback_sigusr1);
114 _ecore_signal_callback_set(SIGUSR2, _ecore_signal_callback_sigusr2);
115 _ecore_signal_callback_set(SIGHUP, _ecore_signal_callback_sighup);
116 _ecore_signal_callback_set(SIGQUIT, _ecore_signal_callback_sigquit);
117 _ecore_signal_callback_set(SIGINT, _ecore_signal_callback_sigint);
118 _ecore_signal_callback_set(SIGTERM, _ecore_signal_callback_sigterm);
119#ifdef SIGPWR
120 _ecore_signal_callback_set(SIGPWR, _ecore_signal_callback_sigpwr);
121#endif
122}
123
124void
125_ecore_signal_received_process(void)
126{
127 while (_ecore_signal_count_get()) _ecore_signal_call();
128}
129
130int
131_ecore_signal_count_get(void)
132{
133 return sig_count;
134}
135
136void
137_ecore_signal_call(void)
138{
139 volatile sig_atomic_t n;
140 sigset_t oldset, newset;
141
142 if (sig_count == 0) return;
143 sigemptyset(&newset);
144 sigaddset(&newset, SIGPIPE);
145 sigaddset(&newset, SIGALRM);
146 sigaddset(&newset, SIGCHLD);
147 sigaddset(&newset, SIGUSR1);
148 sigaddset(&newset, SIGUSR2);
149 sigaddset(&newset, SIGHUP);
150 sigaddset(&newset, SIGQUIT);
151 sigaddset(&newset, SIGINT);
152 sigaddset(&newset, SIGTERM);
153#ifdef SIGPWR
154 sigaddset(&newset, SIGPWR);
155#endif
156 sigprocmask(SIG_BLOCK, &newset, &oldset);
157 if (sigchld_count > MAXSIGQ)
158 WRN("%i SIGCHLD in queue. max queue size %i. losing "
159 "siginfo for extra signals.", sigchld_count, MAXSIGQ);
160 for (n = 0; n < sigchld_count; n++)
161 {
162 pid_t pid;
163 int status;
164
165 while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
166 {
167 Ecore_Exe_Event_Del *e;
168
169 /* FIXME: If this process is set respawn, respawn with a suitable backoff
170 * period for those that need too much respawning.
171 */
172 e = _ecore_exe_event_del_new();
173 if (e)
174 {
175 if (WIFEXITED(status))
176 {
177 e->exit_code = WEXITSTATUS(status);
178 e->exited = 1;
179 }
180 else if (WIFSIGNALED(status))
181 {
182 e->exit_signal = WTERMSIG(status);
183 e->signalled = 1;
184 }
185 e->pid = pid;
186 e->exe = _ecore_exe_find(pid);
187
188 if ((n < MAXSIGQ) && (sigchld_info[n].si_signo))
189 e->data = sigchld_info[n]; /* No need to clone this. */
190
191 if ((e->exe) && (ecore_exe_flags_get(e->exe) & (ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR)))
192 {
193 /* We want to report the Last Words of the exe, so delay this event.
194 * This is twice as relevant for stderr.
195 * There are three possibilities here -
196 * 1 There are no Last Words.
197 * 2 There are Last Words, they are not ready to be read.
198 * 3 There are Last Words, they are ready to be read.
199 *
200 * For 1 we don't want to delay, for 3 we want to delay.
201 * 2 is the problem. If we check for data now and there
202 * is none, then there is no way to differentiate 1 and 2.
203 * If we don't delay, we may loose data, but if we do delay,
204 * there may not be data and the exit event never gets sent.
205 *
206 * Any way you look at it, there has to be some time passed
207 * before the exit event gets sent. So the strategy here is
208 * to setup a timer event that will send the exit event after
209 * an arbitrary, but brief, time.
210 *
211 * This is probably paranoid, for the less paraniod, we could
212 * check to see for Last Words, and only delay if there are any.
213 * This has it's own set of problems.
214 */
215 Ecore_Timer *doomsday_clock;
216
217 doomsday_clock = _ecore_exe_doomsday_clock_get(e->exe);
218 IF_FN_DEL(ecore_timer_del, doomsday_clock);
219 _ecore_unlock();
220 doomsday_clock = ecore_timer_add
221 (0.1, _ecore_signal_exe_exit_delay, e);
222 _ecore_lock();
223 _ecore_exe_doomsday_clock_set(e->exe, doomsday_clock);
224 }
225 else
226 {
227 _ecore_event_add(ECORE_EXE_EVENT_DEL, e,
228 _ecore_exe_event_del_free, NULL);
229 }
230 }
231 }
232 sig_count--;
233 }
234 sigchld_count = 0;
235
236 if (sigusr1_count > MAXSIGQ)
237 WRN("%i SIGUSR1 in queue. max queue size %i. losing "
238 "siginfo for extra signals.", sigusr1_count, MAXSIGQ);
239 for (n = 0; n < sigusr1_count; n++)
240 {
241 Ecore_Event_Signal_User *e;
242
243 e = _ecore_event_signal_user_new();
244 if (e)
245 {
246 e->number = 1;
247
248 if ((n < MAXSIGQ) && (sigusr1_info[n].si_signo))
249 e->data = sigusr1_info[n];
250
251 _ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
252 }
253 sig_count--;
254 }
255 sigusr1_count = 0;
256
257 if (sigusr2_count > MAXSIGQ)
258 WRN("%i SIGUSR2 in queue. max queue size %i. losing "
259 "siginfo for extra signals.", sigusr2_count, MAXSIGQ);
260 for (n = 0; n < sigusr2_count; n++)
261 {
262 Ecore_Event_Signal_User *e;
263
264 e = _ecore_event_signal_user_new();
265 if (e)
266 {
267 e->number = 2;
268
269 if ((n < MAXSIGQ) && (sigusr2_info[n].si_signo))
270 e->data = sigusr2_info[n];
271
272 _ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
273 }
274 sig_count--;
275 }
276 sigusr2_count = 0;
277
278 if (sighup_count > MAXSIGQ)
279 WRN("%i SIGHUP in queue. max queue size %i. losing "
280 "siginfo for extra signals.", sighup_count, MAXSIGQ);
281 for (n = 0; n < sighup_count; n++)
282 {
283 Ecore_Event_Signal_Hup *e;
284
285 e = _ecore_event_signal_hup_new();
286 if (e)
287 {
288 if ((n < MAXSIGQ) && (sighup_info[n].si_signo))
289 e->data = sighup_info[n];
290
291 _ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, NULL, NULL);
292 }
293 sig_count--;
294 }
295 sighup_count = 0;
296
297 if (sigquit_count > MAXSIGQ)
298 WRN("%i SIGQUIT in queue. max queue size %i. losing "
299 "siginfo for extra signals.", sigquit_count, MAXSIGQ);
300 for (n = 0; n < sigquit_count; n++)
301 {
302 Ecore_Event_Signal_Exit *e;
303
304 e = _ecore_event_signal_exit_new();
305 if (e)
306 {
307 e->quit = 1;
308
309 if ((n < MAXSIGQ) && (sigquit_info[n].si_signo))
310 e->data = sigquit_info[n];
311
312 _ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
313 }
314 sig_count--;
315 }
316 sigquit_count = 0;
317
318 if (sigint_count > MAXSIGQ)
319 WRN("%i SIGINT in queue. max queue size %i. losing "
320 "siginfo for extra signals.", sigint_count, MAXSIGQ);
321 for (n = 0; n < sigint_count; n++)
322 {
323 Ecore_Event_Signal_Exit *e;
324
325 e = _ecore_event_signal_exit_new();
326 if (e)
327 {
328 e->interrupt = 1;
329
330 if ((n < MAXSIGQ) && (sigint_info[n].si_signo))
331 e->data = sigint_info[n];
332
333 _ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
334 }
335 sig_count--;
336 }
337 sigint_count = 0;
338
339 if (sigterm_count > MAXSIGQ)
340 WRN("%i SIGTERM in queue. max queue size %i. losing "
341 "siginfo for extra signals.", sigterm_count, MAXSIGQ);
342 for (n = 0; n < sigterm_count; n++)
343 {
344 Ecore_Event_Signal_Exit *e;
345
346 e = _ecore_event_signal_exit_new();
347 if (e)
348 {
349 e->terminate = 1;
350
351 if ((n < MAXSIGQ) && (sigterm_info[n].si_signo))
352 e->data = sigterm_info[n];
353
354 _ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
355 }
356 sig_count--;
357 }
358 sigterm_count = 0;
359
360#ifdef SIGPWR
361 if (sigpwr_count > MAXSIGQ)
362 WRN("%i SIGPWR in queue. max queue size %i. losing "
363 "siginfo for extra signals.", sigpwr_count, MAXSIGQ);
364 for (n = 0; n < sigpwr_count; n++)
365 {
366 Ecore_Event_Signal_Power *e;
367
368 e = _ecore_event_signal_power_new();
369 if (e)
370 {
371 if ((n < MAXSIGQ) && (sigpwr_info[n].si_signo))
372 e->data = sigpwr_info[n];
373
374 _ecore_event_add(ECORE_EVENT_SIGNAL_POWER, e, NULL, NULL);
375 }
376 sig_count--;
377 }
378 sigpwr_count = 0;
379#endif
380
381 sigprocmask(SIG_SETMASK, &oldset, NULL);
382}
383
384static void
385_ecore_signal_callback_set(int sig,
386 Signal_Handler func)
387{
388 struct sigaction sa;
389
390 sa.sa_sigaction = func;
391 sa.sa_flags = SA_RESTART | SA_SIGINFO;
392 sigemptyset(&sa.sa_mask);
393 sigaction(sig, &sa, NULL);
394}
395
396static void
397_ecore_signal_callback_ignore(int sig __UNUSED__,
398 siginfo_t *si __UNUSED__,
399 void *foo __UNUSED__)
400{
401}
402
403static void
404_ecore_signal_callback_sigchld(int sig __UNUSED__,
405 siginfo_t *si,
406 void *foo __UNUSED__)
407{
408 volatile sig_atomic_t n;
409 n = sigchld_count;
410 if (n < MAXSIGQ)
411 {
412 if (si)
413 sigchld_info[n] = *si;
414 else
415 sigchld_info[n].si_signo = 0;
416 }
417
418 sigchld_count++;
419 sig_count++;
420}
421
422static void
423_ecore_signal_callback_sigusr1(int sig __UNUSED__,
424 siginfo_t *si,
425 void *foo __UNUSED__)
426{
427 volatile sig_atomic_t n;
428 n = sigusr1_count;
429 if (n < MAXSIGQ)
430 {
431 if (si)
432 sigusr1_info[n] = *si;
433 else
434 sigusr1_info[n].si_signo = 0;
435 }
436 sigusr1_count++;
437 sig_count++;
438}
439
440static void
441_ecore_signal_callback_sigusr2(int sig __UNUSED__,
442 siginfo_t *si,
443 void *foo __UNUSED__)
444{
445 volatile sig_atomic_t n;
446 n = sigusr2_count;
447 if (n < MAXSIGQ)
448 {
449 if (si)
450 sigusr2_info[n] = *si;
451 else
452 sigusr2_info[n].si_signo = 0;
453 }
454 sigusr2_count++;
455 sig_count++;
456}
457
458static void
459_ecore_signal_callback_sighup(int sig __UNUSED__,
460 siginfo_t *si,
461 void *foo __UNUSED__)
462{
463 volatile sig_atomic_t n;
464 n = sighup_count;
465 if (n < MAXSIGQ)
466 {
467 if (si)
468 sighup_info[n] = *si;
469 else
470 sighup_info[n].si_signo = 0;
471 }
472 sighup_count++;
473 sig_count++;
474}
475
476static void
477_ecore_signal_callback_sigquit(int sig __UNUSED__,
478 siginfo_t *si,
479 void *foo __UNUSED__)
480{
481 volatile sig_atomic_t n;
482 n = sigquit_count;
483 if (n < MAXSIGQ)
484 {
485 if (si)
486 sigquit_info[n] = *si;
487 else
488 sigquit_info[n].si_signo = 0;
489 }
490 sigquit_count++;
491 sig_count++;
492}
493
494static void
495_ecore_signal_callback_sigint(int sig __UNUSED__,
496 siginfo_t *si,
497 void *foo __UNUSED__)
498{
499 volatile sig_atomic_t n;
500 n = sigint_count;
501 if (n < MAXSIGQ)
502 {
503 if (si)
504 sigint_info[n] = *si;
505 else
506 sigint_info[n].si_signo = 0;
507 }
508 sigint_count++;
509 sig_count++;
510}
511
512static void
513_ecore_signal_callback_sigterm(int sig __UNUSED__,
514 siginfo_t *si,
515 void *foo __UNUSED__)
516{
517 volatile sig_atomic_t n;
518 n = sigterm_count;
519 if (n < MAXSIGQ)
520 {
521 if (si)
522 sigterm_info[n] = *si;
523 else
524 sigterm_info[n].si_signo = 0;
525 }
526 sigterm_count++;
527 sig_count++;
528}
529
530#ifdef SIGPWR
531static void
532_ecore_signal_callback_sigpwr(int sig __UNUSED__,
533 siginfo_t *si,
534 void *foo __UNUSED__)
535{
536 volatile sig_atomic_t n;
537 n = sigpwr_count;
538 if (n < MAXSIGQ)
539 {
540 if (si)
541 sigpwr_info[n] = *si;
542 else
543 sigpwr_info[n].si_signo = 0;
544 }
545 sigpwr_count++;
546 sig_count++;
547}
548
549#endif
550
551static Eina_Bool
552_ecore_signal_exe_exit_delay(void *data)
553{
554 Ecore_Exe_Event_Del *e;
555
556 e = data;
557 if (e)
558 {
559 _ecore_exe_doomsday_clock_set(e->exe, NULL);
560 _ecore_event_add(ECORE_EXE_EVENT_DEL, e,
561 _ecore_exe_event_del_free, NULL);
562 }
563 return ECORE_CALLBACK_CANCEL;
564}
565
diff --git a/libraries/ecore/src/lib/ecore/ecore_thread.c b/libraries/ecore/src/lib/ecore/ecore_thread.c
deleted file mode 100644
index 85fbe64..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_thread.c
+++ /dev/null
@@ -1,1635 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <sys/time.h>
7#include <assert.h>
8#include <sys/types.h>
9#include <unistd.h>
10
11#ifdef HAVE_EVIL
12# include <Evil.h>
13#endif
14
15#include "Ecore.h"
16#include "ecore_private.h"
17
18#ifdef EFL_HAVE_THREADS
19
20# define LK(x) Eina_Lock x
21# define LKI(x) eina_lock_new(&(x))
22# define LKD(x) eina_lock_free(&(x))
23# define LKL(x) eina_lock_take(&(x))
24# define LKU(x) eina_lock_release(&(x))
25
26# define CD(x) Eina_Condition x
27# define CDI(x, m) eina_condition_new(&(x), &(m))
28# define CDD(x) eina_condition_free(&(x))
29# define CDB(x) eina_condition_broadcast(&(x))
30# define CDW(x, t) eina_condition_timedwait(&(x), t)
31
32# define LRWK(x) Eina_RWLock x
33# define LRWKI(x) eina_rwlock_new(&(x));
34# define LRWKD(x) eina_rwlock_free(&(x));
35# define LRWKWL(x) eina_rwlock_take_write(&(x));
36# define LRWKRL(x) eina_rwlock_take_read(&(x));
37# define LRWKU(x) eina_rwlock_release(&(x));
38
39# ifdef EFL_HAVE_POSIX_THREADS
40# include <pthread.h>
41# ifdef __linux__
42# include <sched.h>
43# include <sys/resource.h>
44# include <unistd.h>
45# include <sys/syscall.h>
46# include <errno.h>
47# endif
48
49# define PH(x) pthread_t x
50# define PHE(x, y) pthread_equal(x, y)
51# define PHS() pthread_self()
52# define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d)
53# define PHJ(x) pthread_join(x, NULL)
54# define PHA(x) pthread_cancel(x)
55
56# else /* EFL_HAVE_WIN32_THREADS */
57
58# define WIN32_LEAN_AND_MEAN
59# include <windows.h>
60# undef WIN32_LEAN_AND_MEAN
61
62typedef struct
63{
64 HANDLE thread;
65 void *val;
66} win32_thread;
67
68# define PH(x) win32_thread * x
69# define PHE(x, y) ((x) == (y))
70# define PHS() (HANDLE)GetCurrentThreadId()
71
72int
73_ecore_thread_win32_create(win32_thread **x,
74 LPTHREAD_START_ROUTINE f,
75 void *d)
76{
77 win32_thread *t;
78 t = (win32_thread *)calloc(1, sizeof(win32_thread));
79 if (!t)
80 return -1;
81
82 (t)->thread = CreateThread(NULL, 0, f, d, 0, NULL);
83 if (!t->thread)
84 {
85 free(t);
86 return -1;
87 }
88 t->val = d;
89 *x = t;
90
91 return 0;
92}
93
94# define PHC(x, f, d) _ecore_thread_win32_create(&(x), (LPTHREAD_START_ROUTINE)f, d)
95
96int
97_ecore_thread_win32_join(win32_thread *x,
98 void **res)
99{
100 if (!PHE(x, PHS()))
101 {
102 WaitForSingleObject(x->thread, INFINITE);
103 CloseHandle(x->thread);
104 }
105 if (res) *res = x->val;
106 free(x);
107
108 return 0;
109}
110
111# define PHJ(x) _ecore_thread_win32_join(x, NULL)
112# define PHA(x) TerminateThread(x->thread, 0)
113
114# endif
115
116#endif
117
118typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker;
119typedef struct _Ecore_Pthread Ecore_Pthread;
120typedef struct _Ecore_Thread_Data Ecore_Thread_Data;
121
122struct _Ecore_Thread_Data
123{
124 void *data;
125 Eina_Free_Cb cb;
126};
127
128struct _Ecore_Pthread_Worker
129{
130 union {
131 struct
132 {
133 Ecore_Thread_Cb func_blocking;
134 } short_run;
135 struct
136 {
137 Ecore_Thread_Cb func_heavy;
138 Ecore_Thread_Notify_Cb func_notify;
139
140 Ecore_Pthread_Worker *direct_worker;
141
142 int send;
143 int received;
144 } feedback_run;
145 struct {
146 Ecore_Thread_Cb func_main;
147 Ecore_Thread_Notify_Cb func_notify;
148
149 Ecore_Pipe *send;
150 Ecore_Pthread_Worker *direct_worker;
151
152 struct {
153 int send;
154 int received;
155 } from, to;
156 } message_run;
157 } u;
158
159 Ecore_Thread_Cb func_cancel;
160 Ecore_Thread_Cb func_end;
161#ifdef EFL_HAVE_THREADS
162 PH(self);
163 Eina_Hash *hash;
164 CD(cond);
165 LK(mutex);
166#endif
167
168 const void *data;
169
170 volatile int cancel;
171
172#ifdef EFL_HAVE_THREADS
173 LK(cancel_mutex);
174#endif
175
176 Eina_Bool message_run : 1;
177 Eina_Bool feedback_run : 1;
178 Eina_Bool kill : 1;
179 Eina_Bool reschedule : 1;
180 Eina_Bool no_queue : 1;
181};
182
183#ifdef EFL_HAVE_THREADS
184typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data;
185struct _Ecore_Pthread_Data
186{
187 Ecore_Pthread_Worker *death_job;
188 void *data;
189 PH(thread);
190};
191
192typedef struct _Ecore_Pthread_Notify Ecore_Pthread_Notify;
193struct _Ecore_Pthread_Notify
194{
195 Ecore_Pthread_Worker *work;
196 const void *user_data;
197};
198
199typedef void *(*Ecore_Thread_Sync_Cb)(void* data, Ecore_Thread *thread);
200
201typedef struct _Ecore_Pthread_Message Ecore_Pthread_Message;
202struct _Ecore_Pthread_Message
203{
204 union {
205 Ecore_Thread_Cb async;
206 Ecore_Thread_Sync_Cb sync;
207 } u;
208
209 const void *data;
210
211 int code;
212
213 Eina_Bool callback : 1;
214 Eina_Bool sync : 1;
215};
216
217#endif
218
219static int _ecore_thread_count_max = 0;
220
221#ifdef EFL_HAVE_THREADS
222
223static void _ecore_thread_handler(void *data);
224
225static int _ecore_thread_count = 0;
226
227static Eina_List *_ecore_active_job_threads = NULL;
228static Eina_List *_ecore_pending_job_threads = NULL;
229static Eina_List *_ecore_pending_job_threads_feedback = NULL;
230static LK(_ecore_pending_job_threads_mutex);
231
232static Eina_Hash *_ecore_thread_global_hash = NULL;
233static LRWK(_ecore_thread_global_hash_lock);
234static LK(_ecore_thread_global_hash_mutex);
235static CD(_ecore_thread_global_hash_cond);
236
237static Eina_Bool have_main_loop_thread = 0;
238
239static Eina_Trash *_ecore_thread_worker_trash = NULL;
240static int _ecore_thread_worker_count = 0;
241
242static void *_ecore_thread_worker(Ecore_Pthread_Data *pth);
243static Ecore_Pthread_Worker *_ecore_thread_worker_new(void);
244
245static PH(get_main_loop_thread) (void)
246{
247 static PH(main_loop_thread);
248 static pid_t main_loop_pid;
249 pid_t pid = getpid();
250
251 if (pid != main_loop_pid)
252 {
253 main_loop_pid = pid;
254 main_loop_thread = PHS();
255 have_main_loop_thread = 1;
256 }
257
258 return main_loop_thread;
259}
260
261static void
262_ecore_thread_worker_free(Ecore_Pthread_Worker *worker)
263{
264 LKD(worker->cancel_mutex);
265 CDD(worker->cond);
266 LKD(worker->mutex);
267
268 if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16)
269 {
270 free(worker);
271 return;
272 }
273
274 eina_trash_push(&_ecore_thread_worker_trash, worker);
275}
276
277static void
278_ecore_thread_data_free(void *data)
279{
280 Ecore_Thread_Data *d = data;
281
282 if (d->cb) d->cb(d->data);
283 free(d);
284}
285
286static void
287_ecore_thread_end(Ecore_Pthread_Data *pth,
288 Ecore_Thread *work)
289{
290 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work;
291
292 if (!worker->message_run || !worker->feedback_run || (worker->feedback_run && !worker->no_queue))
293 _ecore_thread_count--;
294
295 if (PHJ(pth->thread) != 0)
296 return;
297
298 if (eina_list_count(_ecore_pending_job_threads) > 0
299 && (unsigned int)_ecore_thread_count < eina_list_count(_ecore_pending_job_threads)
300 && _ecore_thread_count < _ecore_thread_count_max)
301 {
302 /* One more thread should be created. */
303 INF("spawning threads because of still pending jobs.");
304
305 pth->death_job = _ecore_thread_worker_new();
306 if (!pth->death_job) goto end;
307
308 eina_threads_init();
309
310 if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
311 {
312 _ecore_thread_count++;
313 return;
314 }
315
316 eina_threads_shutdown();
317
318end:
319 if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
320 }
321
322 _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth);
323
324 free(pth);
325}
326
327static void
328_ecore_thread_kill(Ecore_Pthread_Worker *work)
329{
330 if (work->cancel)
331 {
332 if (work->func_cancel)
333 work->func_cancel((void *)work->data, (Ecore_Thread *)work);
334 }
335 else
336 {
337 if (work->func_end)
338 work->func_end((void *)work->data, (Ecore_Thread *)work);
339 }
340
341 if (work->feedback_run)
342 {
343 if (work->u.feedback_run.direct_worker)
344 _ecore_thread_worker_free(work->u.feedback_run.direct_worker);
345 }
346 if (work->hash)
347 eina_hash_free(work->hash);
348 _ecore_thread_worker_free(work);
349}
350
351static void
352_ecore_thread_handler(void *data)
353{
354 Ecore_Pthread_Worker *work = data;
355
356 if (work->feedback_run)
357 {
358 if (work->u.feedback_run.send != work->u.feedback_run.received)
359 {
360 work->kill = EINA_TRUE;
361 return;
362 }
363 }
364
365 _ecore_thread_kill(work);
366}
367
368#if 0
369static void
370_ecore_nothing_handler(void *data __UNUSED__, void *buffer __UNUSED__, unsigned int nbyte __UNUSED__)
371{
372}
373#endif
374
375static void
376_ecore_notify_handler(void *data)
377{
378 Ecore_Pthread_Notify *notify = data;
379 Ecore_Pthread_Worker *work = notify->work;
380 void *user_data = (void*) notify->user_data;
381
382 work->u.feedback_run.received++;
383
384 if (work->u.feedback_run.func_notify)
385 work->u.feedback_run.func_notify((void *)work->data, (Ecore_Thread *)work, user_data);
386
387 /* Force reading all notify event before killing the thread */
388 if (work->kill && work->u.feedback_run.send == work->u.feedback_run.received)
389 {
390 _ecore_thread_kill(work);
391 }
392
393 free(notify);
394}
395
396static void
397_ecore_message_notify_handler(void *data)
398{
399 Ecore_Pthread_Notify *notify = data;
400 Ecore_Pthread_Worker *work = notify->work;
401 Ecore_Pthread_Message *user_data = (void *) notify->user_data;
402 Eina_Bool delete = EINA_TRUE;
403
404 work->u.message_run.from.received++;
405
406 if (!user_data->callback)
407 {
408 if (work->u.message_run.func_notify)
409 work->u.message_run.func_notify((void *) work->data, (Ecore_Thread *) work, (void *) user_data->data);
410 }
411 else
412 {
413 if (user_data->sync)
414 {
415 user_data->data = user_data->u.sync((void*) user_data->data, (Ecore_Thread *) work);
416 user_data->callback = EINA_FALSE;
417 user_data->code = INT_MAX;
418 ecore_pipe_write(work->u.message_run.send, &user_data, sizeof (Ecore_Pthread_Message *));
419
420 delete = EINA_FALSE;
421 }
422 else
423 {
424 user_data->u.async((void*) user_data->data, (Ecore_Thread *) work);
425 }
426 }
427
428 if (delete)
429 {
430 free(user_data);
431 }
432
433 /* Force reading all notify event before killing the thread */
434 if (work->kill && work->u.message_run.from.send == work->u.message_run.from.received)
435 {
436 _ecore_thread_kill(work);
437 }
438 free(notify);
439}
440
441static void
442_ecore_short_job(PH(thread))
443{
444 Ecore_Pthread_Worker *work;
445
446 while (_ecore_pending_job_threads)
447 {
448 int cancel;
449
450 LKL(_ecore_pending_job_threads_mutex);
451
452 if (!_ecore_pending_job_threads)
453 {
454 LKU(_ecore_pending_job_threads_mutex);
455 break;
456 }
457
458 work = eina_list_data_get(_ecore_pending_job_threads);
459 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads,
460 _ecore_pending_job_threads);
461
462 LKU(_ecore_pending_job_threads_mutex);
463
464 LKL(work->cancel_mutex);
465 cancel = work->cancel;
466 LKU(work->cancel_mutex);
467 work->self = thread;
468 if (!cancel)
469 work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work);
470
471 if (work->reschedule)
472 {
473 work->reschedule = EINA_FALSE;
474
475 LKL(_ecore_pending_job_threads_mutex);
476 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
477 LKU(_ecore_pending_job_threads_mutex);
478 }
479 else
480 {
481 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
482 }
483 }
484}
485
486static void
487_ecore_feedback_job(PH(thread))
488{
489 Ecore_Pthread_Worker *work;
490
491 while (_ecore_pending_job_threads_feedback)
492 {
493 int cancel;
494
495 LKL(_ecore_pending_job_threads_mutex);
496
497 if (!_ecore_pending_job_threads_feedback)
498 {
499 LKU(_ecore_pending_job_threads_mutex);
500 break;
501 }
502
503 work = eina_list_data_get(_ecore_pending_job_threads_feedback);
504 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback,
505 _ecore_pending_job_threads_feedback);
506
507 LKU(_ecore_pending_job_threads_mutex);
508
509 LKL(work->cancel_mutex);
510 cancel = work->cancel;
511 LKU(work->cancel_mutex);
512 work->self = thread;
513 if (!cancel)
514 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
515
516 if (work->reschedule)
517 {
518 work->reschedule = EINA_FALSE;
519
520 LKL(_ecore_pending_job_threads_mutex);
521 _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, work);
522 LKU(_ecore_pending_job_threads_mutex);
523 }
524 else
525 {
526 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
527 }
528 }
529}
530
531static void *
532_ecore_direct_worker(Ecore_Pthread_Worker *work)
533{
534 Ecore_Pthread_Worker *end;
535 Ecore_Pthread_Data *pth;
536
537#ifdef EFL_POSIX_THREADS
538 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
539 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
540#endif
541
542 eina_sched_prio_drop();
543
544 pth = malloc(sizeof (Ecore_Pthread_Data));
545 if (!pth) return NULL;
546
547 pth->thread = PHS();
548
549 work->self = pth->thread;
550 if (work->message_run)
551 work->u.message_run.func_main((void *) work->data, (Ecore_Thread *) work);
552 else
553 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
554
555 if (work->message_run)
556 {
557 end = work->u.message_run.direct_worker;
558 work->u.message_run.direct_worker = NULL;
559 }
560 else
561 {
562 end = work->u.feedback_run.direct_worker;
563 work->u.feedback_run.direct_worker = NULL;
564 }
565
566 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
567
568 if (!end)
569 {
570 free(pth);
571 return NULL;
572 }
573
574 end->data = pth;
575 end->u.short_run.func_blocking = NULL;
576 end->func_end = (void *)_ecore_thread_end;
577 end->func_cancel = NULL;
578 end->cancel = EINA_FALSE;
579 end->feedback_run = EINA_FALSE;
580 end->message_run = EINA_FALSE;
581 end->no_queue = EINA_FALSE;
582 end->kill = EINA_FALSE;
583 end->hash = NULL;
584 LKI(end->mutex);
585 CDI(end->cond, end->mutex);
586
587 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, end);
588
589 return NULL;
590}
591
592static void *
593_ecore_thread_worker(Ecore_Pthread_Data *pth)
594{
595 Ecore_Pthread_Worker *work;
596
597#ifdef EFL_POSIX_THREADS
598 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
599 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
600#endif
601
602 eina_sched_prio_drop();
603
604restart:
605 if (_ecore_pending_job_threads) _ecore_short_job(pth->thread);
606 if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->thread);
607
608 /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */
609
610 LKL(_ecore_pending_job_threads_mutex);
611 if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback)
612 {
613 LKU(_ecore_pending_job_threads_mutex);
614 goto restart;
615 }
616 LKU(_ecore_pending_job_threads_mutex);
617
618 /* Sleep a little to prevent premature death */
619#ifdef _WIN32
620 Sleep(1); /* around 50ms */
621#else
622 usleep(200);
623#endif
624
625 LKL(_ecore_pending_job_threads_mutex);
626 if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback)
627 {
628 LKU(_ecore_pending_job_threads_mutex);
629 goto restart;
630 }
631 LKU(_ecore_pending_job_threads_mutex);
632
633 work = pth->death_job;
634 if (!work) return NULL;
635
636 work->data = pth;
637 work->u.short_run.func_blocking = NULL;
638 work->func_end = (void *)_ecore_thread_end;
639 work->func_cancel = NULL;
640 work->cancel = EINA_FALSE;
641 work->feedback_run = EINA_FALSE;
642 work->message_run = EINA_FALSE;
643 work->kill = EINA_FALSE;
644 work->no_queue = EINA_FALSE;
645 work->hash = NULL;
646
647 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
648
649 return NULL;
650}
651
652#endif
653
654static Ecore_Pthread_Worker *
655_ecore_thread_worker_new(void)
656{
657#ifdef EFL_HAVE_THREADS
658 Ecore_Pthread_Worker *result;
659
660 result = eina_trash_pop(&_ecore_thread_worker_trash);
661
662 if (!result) result = malloc(sizeof (Ecore_Pthread_Worker));
663 else _ecore_thread_worker_count--;
664
665 LKI(result->cancel_mutex);
666 LKI(result->mutex);
667 CDI(result->cond, result->mutex);
668
669 return result;
670#else
671 return malloc(sizeof (Ecore_Pthread_Worker));
672#endif
673}
674
675void
676_ecore_thread_init(void)
677{
678 _ecore_thread_count_max = eina_cpu_count();
679 if (_ecore_thread_count_max <= 0)
680 _ecore_thread_count_max = 1;
681
682#ifdef EFL_HAVE_THREADS
683 LKI(_ecore_pending_job_threads_mutex);
684 LRWKI(_ecore_thread_global_hash_lock);
685 LKI(_ecore_thread_global_hash_mutex);
686 CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex);
687#endif
688}
689
690void
691_ecore_thread_shutdown(void)
692{
693 /* FIXME: If function are still running in the background, should we kill them ? */
694#ifdef EFL_HAVE_THREADS
695 Ecore_Pthread_Worker *work;
696 Ecore_Pthread_Data *pth;
697
698 LKL(_ecore_pending_job_threads_mutex);
699
700 EINA_LIST_FREE(_ecore_pending_job_threads, work)
701 {
702 if (work->func_cancel)
703 work->func_cancel((void *)work->data, (Ecore_Thread *) work);
704 free(work);
705 }
706
707 EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work)
708 {
709 if (work->func_cancel)
710 work->func_cancel((void *)work->data, (Ecore_Thread *) work);
711 free(work);
712 }
713
714 LKU(_ecore_pending_job_threads_mutex);
715
716 /* FIXME: Improve emergency shutdown, now that we use async call, we can do something */
717 EINA_LIST_FREE(_ecore_active_job_threads, pth)
718 {
719 PHA(pth->thread);
720 PHJ(pth->thread);
721 }
722 if (_ecore_thread_global_hash)
723 eina_hash_free(_ecore_thread_global_hash);
724 have_main_loop_thread = 0;
725
726 while ((work = eina_trash_pop(&_ecore_thread_worker_trash)))
727 {
728 free(work);
729 }
730
731 LKD(_ecore_pending_job_threads_mutex);
732 LRWKD(_ecore_thread_global_hash_lock);
733 LKD(_ecore_thread_global_hash_mutex);
734 CDD(_ecore_thread_global_hash_cond);
735#endif
736}
737
738void
739_ecore_thread_assert_main_loop_thread(const char *function)
740{
741 Eina_Bool good;
742#ifdef EFL_HAVE_THREADS
743 good = PHE(get_main_loop_thread(), PHS());
744#else
745 good = EINA_TRUE;
746#endif
747 if (!good)
748 {
749 EINA_LOG_CRIT("Call to %s from wrong thread!", function);
750 abort();
751 }
752}
753
754EAPI Ecore_Thread *
755ecore_thread_run(Ecore_Thread_Cb func_blocking,
756 Ecore_Thread_Cb func_end,
757 Ecore_Thread_Cb func_cancel,
758 const void *data)
759{
760 Ecore_Pthread_Worker *work;
761#ifdef EFL_HAVE_THREADS
762 Ecore_Pthread_Data *pth = NULL;
763#endif
764
765 if (!func_blocking) return NULL;
766
767 work = _ecore_thread_worker_new();
768 if (!work)
769 {
770 if (func_cancel)
771 func_cancel((void *)data, NULL);
772 return NULL;
773 }
774
775 work->u.short_run.func_blocking = func_blocking;
776 work->func_end = func_end;
777 work->func_cancel = func_cancel;
778 work->cancel = EINA_FALSE;
779 work->feedback_run = EINA_FALSE;
780 work->message_run = EINA_FALSE;
781 work->kill = EINA_FALSE;
782 work->reschedule = EINA_FALSE;
783 work->no_queue = EINA_FALSE;
784 work->data = data;
785
786#ifdef EFL_HAVE_THREADS
787 work->self = 0;
788 work->hash = NULL;
789
790 LKL(_ecore_pending_job_threads_mutex);
791 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
792
793 if (_ecore_thread_count == _ecore_thread_count_max)
794 {
795 LKU(_ecore_pending_job_threads_mutex);
796 return (Ecore_Thread *)work;
797 }
798
799 LKU(_ecore_pending_job_threads_mutex);
800
801 /* One more thread could be created. */
802 pth = malloc(sizeof (Ecore_Pthread_Data));
803 if (!pth) goto on_error;
804
805 pth->death_job = _ecore_thread_worker_new();
806 if (!pth->death_job) goto on_error;
807
808 eina_threads_init();
809
810 if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
811 {
812 _ecore_thread_count++;
813 return (Ecore_Thread *)work;
814 }
815
816 eina_threads_shutdown();
817
818on_error:
819 if (pth)
820 {
821 if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
822 free(pth);
823 }
824
825 if (_ecore_thread_count == 0)
826 {
827 LKL(_ecore_pending_job_threads_mutex);
828 _ecore_pending_job_threads = eina_list_remove(_ecore_pending_job_threads, work);
829 LKU(_ecore_pending_job_threads_mutex);
830
831 if (work->func_cancel)
832 work->func_cancel((void *) work->data, (Ecore_Thread *) work);
833
834 CDD(work->cond);
835 LKD(work->mutex);
836 LKD(work->cancel_mutex);
837 free(work);
838 work = NULL;
839 }
840 return (Ecore_Thread *)work;
841#else
842 /*
843 If no thread and as we don't want to break app that rely on this
844 facility, we will lock the interface until we are done.
845 */
846 do {
847 /* Handle reschedule by forcing it here. That would mean locking the app,
848 * would be better with an idler, but really to complex for a case where
849 * thread should really exist.
850 */
851 work->reschedule = EINA_FALSE;
852
853 func_blocking((void *)data, (Ecore_Thread *)work);
854 if (work->cancel == EINA_FALSE) func_end((void *)data, (Ecore_Thread *)work);
855 else func_cancel((void *)data, (Ecore_Thread *)work);
856 } while (work->reschedule == EINA_TRUE);
857
858 free(work);
859
860 return NULL;
861#endif
862}
863
864EAPI Eina_Bool
865ecore_thread_cancel(Ecore_Thread *thread)
866{
867#ifdef EFL_HAVE_THREADS
868 Ecore_Pthread_Worker *volatile work = (Ecore_Pthread_Worker *)thread;
869 Eina_List *l;
870 int cancel;
871
872 if (!work)
873 return EINA_TRUE;
874 LKL(work->cancel_mutex);
875 cancel = work->cancel;
876 LKU(work->cancel_mutex);
877 if (cancel)
878 return EINA_FALSE;
879
880 if (work->feedback_run)
881 {
882 if (work->kill)
883 return EINA_TRUE;
884 if (work->u.feedback_run.send != work->u.feedback_run.received)
885 goto on_exit;
886 }
887
888 LKL(_ecore_pending_job_threads_mutex);
889
890 if ((have_main_loop_thread) &&
891 (PHE(get_main_loop_thread(), PHS())))
892 {
893 if (!work->feedback_run)
894 EINA_LIST_FOREACH(_ecore_pending_job_threads, l, work)
895 {
896 if ((void *)work == (void *)thread)
897 {
898 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, l);
899
900 LKU(_ecore_pending_job_threads_mutex);
901
902 if (work->func_cancel)
903 work->func_cancel((void *)work->data, (Ecore_Thread *)work);
904 free(work);
905
906 return EINA_TRUE;
907 }
908 }
909 else
910 EINA_LIST_FOREACH(_ecore_pending_job_threads_feedback, l, work)
911 {
912 if ((void *)work == (void *)thread)
913 {
914 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, l);
915
916 LKU(_ecore_pending_job_threads_mutex);
917
918 if (work->func_cancel)
919 work->func_cancel((void *)work->data, (Ecore_Thread *)work);
920 free(work);
921
922 return EINA_TRUE;
923 }
924 }
925 }
926
927 LKU(_ecore_pending_job_threads_mutex);
928
929 work = (Ecore_Pthread_Worker *)thread;
930
931 /* Delay the destruction */
932 on_exit:
933 LKL(work->cancel_mutex);
934 work->cancel = EINA_TRUE;
935 LKU(work->cancel_mutex);
936
937 return EINA_FALSE;
938#else
939 (void) thread;
940 return EINA_TRUE;
941#endif
942}
943
944EAPI Eina_Bool
945ecore_thread_check(Ecore_Thread *thread)
946{
947 Ecore_Pthread_Worker *volatile worker = (Ecore_Pthread_Worker *) thread;
948 int cancel;
949
950 if (!worker) return EINA_TRUE;
951#ifdef EFL_HAVE_THREADS
952 LKL(worker->cancel_mutex);
953#endif
954 cancel = worker->cancel;
955 /* FIXME: there is an insane bug driving me nuts here. I don't know if
956 it's a race condition, some cache issue or some alien attack on our software.
957 But ecore_thread_check will only work correctly with a printf, all the volatile,
958 lock and even usleep don't help here... */
959 /* fprintf(stderr, "wc: %i\n", cancel); */
960#ifdef EFL_HAVE_THREADS
961 LKU(worker->cancel_mutex);
962#endif
963 return cancel;
964}
965
966EAPI Ecore_Thread *
967ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
968 Ecore_Thread_Notify_Cb func_notify,
969 Ecore_Thread_Cb func_end,
970 Ecore_Thread_Cb func_cancel,
971 const void *data,
972 Eina_Bool try_no_queue)
973{
974#ifdef EFL_HAVE_THREADS
975 Ecore_Pthread_Worker *worker;
976 Ecore_Pthread_Data *pth = NULL;
977
978 if (!func_heavy) return NULL;
979
980 worker = _ecore_thread_worker_new();
981 if (!worker) goto on_error;
982
983 worker->u.feedback_run.func_heavy = func_heavy;
984 worker->u.feedback_run.func_notify = func_notify;
985 worker->hash = NULL;
986 worker->func_cancel = func_cancel;
987 worker->func_end = func_end;
988 worker->data = data;
989 worker->cancel = EINA_FALSE;
990 worker->message_run = EINA_FALSE;
991 worker->feedback_run = EINA_TRUE;
992 worker->kill = EINA_FALSE;
993 worker->reschedule = EINA_FALSE;
994 worker->self = 0;
995
996 worker->u.feedback_run.send = 0;
997 worker->u.feedback_run.received = 0;
998
999 worker->u.feedback_run.direct_worker = NULL;
1000
1001 if (try_no_queue)
1002 {
1003 PH(t);
1004
1005 worker->u.feedback_run.direct_worker = _ecore_thread_worker_new();
1006 worker->no_queue = EINA_TRUE;
1007
1008 eina_threads_init();
1009
1010 if (PHC(t, _ecore_direct_worker, worker) == 0)
1011 return (Ecore_Thread *)worker;
1012
1013 if (worker->u.feedback_run.direct_worker)
1014 {
1015 _ecore_thread_worker_free(worker->u.feedback_run.direct_worker);
1016 worker->u.feedback_run.direct_worker = NULL;
1017 }
1018
1019 eina_threads_shutdown();
1020 }
1021
1022 worker->no_queue = EINA_FALSE;
1023
1024 LKL(_ecore_pending_job_threads_mutex);
1025 _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, worker);
1026
1027 if (_ecore_thread_count == _ecore_thread_count_max)
1028 {
1029 LKU(_ecore_pending_job_threads_mutex);
1030 return (Ecore_Thread *)worker;
1031 }
1032
1033 LKU(_ecore_pending_job_threads_mutex);
1034
1035 /* One more thread could be created. */
1036 pth = malloc(sizeof (Ecore_Pthread_Data));
1037 if (!pth) goto on_error;
1038
1039 pth->death_job = _ecore_thread_worker_new();
1040 if (!pth->death_job) goto on_error;
1041
1042 eina_threads_init();
1043
1044 if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
1045 {
1046 _ecore_thread_count++;
1047 return (Ecore_Thread *)worker;
1048 }
1049
1050 eina_threads_shutdown();
1051
1052on_error:
1053 if (pth)
1054 {
1055 if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
1056 free(pth);
1057 }
1058
1059 if (_ecore_thread_count == 0)
1060 {
1061 LKL(_ecore_pending_job_threads_mutex);
1062 _ecore_pending_job_threads_feedback = eina_list_remove(_ecore_pending_job_threads_feedback,
1063 worker);
1064 LKU(_ecore_pending_job_threads_mutex);
1065
1066 if (func_cancel) func_cancel((void *)data, NULL);
1067
1068 if (worker)
1069 {
1070 CDD(worker->cond);
1071 LKD(worker->mutex);
1072 free(worker);
1073 worker = NULL;
1074 }
1075 }
1076
1077 return (Ecore_Thread *)worker;
1078#else
1079 Ecore_Pthread_Worker worker;
1080
1081 (void)try_no_queue;
1082
1083 /*
1084 If no thread and as we don't want to break app that rely on this
1085 facility, we will lock the interface until we are done.
1086 */
1087 worker.u.feedback_run.func_heavy = func_heavy;
1088 worker.u.feedback_run.func_notify = func_notify;
1089 worker.u.feedback_run.send = 0;
1090 worker.u.feedback_run.received = 0;
1091 worker.func_cancel = func_cancel;
1092 worker.func_end = func_end;
1093 worker.data = data;
1094 worker.cancel = EINA_FALSE;
1095 worker.feedback_run = EINA_TRUE;
1096 worker.message_run = EINA_FALSE;
1097 worker.kill = EINA_FALSE;
1098
1099 do {
1100 worker.reschedule = EINA_FALSE;
1101
1102 func_heavy((void *)data, (Ecore_Thread *)&worker);
1103
1104 if (worker.cancel) func_cancel((void *)data, (Ecore_Thread *)&worker);
1105 else func_end((void *)data, (Ecore_Thread *)&worker);
1106 } while (worker.reschedule == EINA_TRUE);
1107
1108 return NULL;
1109#endif
1110}
1111
1112EAPI Eina_Bool
1113ecore_thread_feedback(Ecore_Thread *thread,
1114 const void *data)
1115{
1116 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1117
1118 if (!worker) return EINA_FALSE;
1119
1120#ifdef EFL_HAVE_THREADS
1121 if (!PHE(worker->self, PHS())) return EINA_FALSE;
1122
1123 if (worker->feedback_run)
1124 {
1125 Ecore_Pthread_Notify *notify;
1126
1127 notify = malloc(sizeof (Ecore_Pthread_Notify));
1128 if (!notify) return EINA_FALSE;
1129
1130 notify->user_data = data;
1131 notify->work = worker;
1132 worker->u.feedback_run.send++;
1133
1134 ecore_main_loop_thread_safe_call_async(_ecore_notify_handler, notify);
1135 }
1136 else if (worker->message_run)
1137 {
1138 Ecore_Pthread_Message *msg;
1139 Ecore_Pthread_Notify *notify;
1140
1141 msg = malloc(sizeof (Ecore_Pthread_Message*));
1142 if (!msg) return EINA_FALSE;
1143 msg->data = data;
1144 msg->callback = EINA_FALSE;
1145 msg->sync = EINA_FALSE;
1146
1147 notify = malloc(sizeof (Ecore_Pthread_Notify));
1148 if (!notify)
1149 {
1150 free(msg);
1151 return EINA_FALSE;
1152 }
1153 notify->work = worker;
1154 notify->user_data = msg;
1155
1156 worker->u.message_run.from.send++;
1157 ecore_main_loop_thread_safe_call_async(_ecore_message_notify_handler, notify);
1158 }
1159 else
1160 return EINA_FALSE;
1161
1162 return EINA_TRUE;
1163#else
1164 worker->u.feedback_run.func_notify((void *)worker->data, thread, (void *)data);
1165
1166 return EINA_TRUE;
1167#endif
1168}
1169
1170#if 0
1171EAPI Ecore_Thread *
1172ecore_thread_message_run(Ecore_Thread_Cb func_main,
1173 Ecore_Thread_Notify_Cb func_notify,
1174 Ecore_Thread_Cb func_end,
1175 Ecore_Thread_Cb func_cancel,
1176 const void *data)
1177{
1178#ifdef EFL_HAVE_THREADS
1179 Ecore_Pthread_Worker *worker;
1180 PH(t);
1181
1182 if (!func_main) return NULL;
1183
1184 worker = _ecore_thread_worker_new();
1185 if (!worker) return NULL;
1186
1187 worker->u.message_run.func_main = func_main;
1188 worker->u.message_run.func_notify = func_notify;
1189 worker->u.message_run.direct_worker = _ecore_thread_worker_new();
1190 worker->u.message_run.send = ecore_pipe_add(_ecore_nothing_handler, worker);
1191 worker->u.message_run.from.send = 0;
1192 worker->u.message_run.from.received = 0;
1193 worker->u.message_run.to.send = 0;
1194 worker->u.message_run.to.received = 0;
1195
1196 ecore_pipe_freeze(worker->u.message_run.send);
1197
1198 worker->func_cancel = func_cancel;
1199 worker->func_end = func_end;
1200 worker->hash = NULL;
1201 worker->data = data;
1202
1203 worker->cancel = EINA_FALSE;
1204 worker->message_run = EINA_TRUE;
1205 worker->feedback_run = EINA_FALSE;
1206 worker->kill = EINA_FALSE;
1207 worker->reschedule = EINA_FALSE;
1208 worker->no_queue = EINA_FALSE;
1209 worker->self = 0;
1210
1211 eina_threads_init();
1212
1213 if (PHC(t, _ecore_direct_worker, worker) == 0)
1214 return (Ecore_Thread*) worker;
1215
1216 eina_threads_shutdown();
1217
1218 if (worker->u.message_run.direct_worker) _ecore_thread_worker_free(worker->u.message_run.direct_worker);
1219 if (worker->u.message_run.send) ecore_pipe_del(worker->u.message_run.send);
1220
1221 CDD(worker->cond);
1222 LKD(worker->mutex);
1223#else
1224 /* Note: This type of thread can't and never will work without thread support */
1225 WRN("ecore_thread_message_run called, but threads disable in Ecore, things will go wrong. Starting now !");
1226# warning "You disabled threads support in ecore, I hope you know what you are doing !"
1227#endif
1228
1229 func_cancel((void *) data, NULL);
1230
1231 return NULL;
1232}
1233#endif
1234
1235EAPI Eina_Bool
1236ecore_thread_reschedule(Ecore_Thread *thread)
1237{
1238 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1239
1240 if (!worker) return EINA_FALSE;
1241
1242#ifdef EFL_HAVE_THREADS
1243 if (!PHE(worker->self, PHS())) return EINA_FALSE;
1244#endif
1245
1246 worker->reschedule = EINA_TRUE;
1247 return EINA_TRUE;
1248}
1249
1250EAPI int
1251ecore_thread_active_get(void)
1252{
1253#ifdef EFL_HAVE_THREADS
1254 return _ecore_thread_count;
1255#else
1256 return 0;
1257#endif
1258}
1259
1260EAPI int
1261ecore_thread_pending_get(void)
1262{
1263#ifdef EFL_HAVE_THREADS
1264 int ret;
1265
1266 LKL(_ecore_pending_job_threads_mutex);
1267 ret = eina_list_count(_ecore_pending_job_threads);
1268 LKU(_ecore_pending_job_threads_mutex);
1269 return ret;
1270#else
1271 return 0;
1272#endif
1273}
1274
1275EAPI int
1276ecore_thread_pending_feedback_get(void)
1277{
1278#ifdef EFL_HAVE_THREADS
1279 int ret;
1280
1281 LKL(_ecore_pending_job_threads_mutex);
1282 ret = eina_list_count(_ecore_pending_job_threads_feedback);
1283 LKU(_ecore_pending_job_threads_mutex);
1284 return ret;
1285#else
1286 return 0;
1287#endif
1288}
1289
1290EAPI int
1291ecore_thread_pending_total_get(void)
1292{
1293#ifdef EFL_HAVE_THREADS
1294 int ret;
1295
1296 LKL(_ecore_pending_job_threads_mutex);
1297 ret = eina_list_count(_ecore_pending_job_threads) + eina_list_count(_ecore_pending_job_threads_feedback);
1298 LKU(_ecore_pending_job_threads_mutex);
1299 return ret;
1300#else
1301 return 0;
1302#endif
1303}
1304
1305EAPI int
1306ecore_thread_max_get(void)
1307{
1308 return _ecore_thread_count_max;
1309}
1310
1311EAPI void
1312ecore_thread_max_set(int num)
1313{
1314 if (num < 1) return;
1315 /* avoid doing something hilarious by blocking dumb users */
1316 if (num >= (2 * eina_cpu_count())) return;
1317
1318 _ecore_thread_count_max = num;
1319}
1320
1321EAPI void
1322ecore_thread_max_reset(void)
1323{
1324 _ecore_thread_count_max = eina_cpu_count();
1325}
1326
1327EAPI int
1328ecore_thread_available_get(void)
1329{
1330#ifdef EFL_HAVE_THREADS
1331 int ret;
1332
1333 LKL(_ecore_pending_job_threads_mutex);
1334 ret = _ecore_thread_count_max - _ecore_thread_count;
1335 LKU(_ecore_pending_job_threads_mutex);
1336 return ret;
1337#else
1338 return 0;
1339#endif
1340}
1341
1342EAPI Eina_Bool
1343ecore_thread_local_data_add(Ecore_Thread *thread,
1344 const char *key,
1345 void *value,
1346 Eina_Free_Cb cb,
1347 Eina_Bool direct)
1348{
1349#ifdef EFL_HAVE_THREADS
1350 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1351 Ecore_Thread_Data *d;
1352 Eina_Bool ret;
1353#endif
1354
1355 if ((!thread) || (!key) || (!value))
1356 return EINA_FALSE;
1357#ifdef EFL_HAVE_THREADS
1358 if (!PHE(worker->self, PHS())) return EINA_FALSE;
1359
1360 if (!worker->hash)
1361 worker->hash = eina_hash_string_small_new(_ecore_thread_data_free);
1362
1363 if (!worker->hash)
1364 return EINA_FALSE;
1365
1366 if (!(d = malloc(sizeof(Ecore_Thread_Data))))
1367 return EINA_FALSE;
1368
1369 d->data = value;
1370 d->cb = cb;
1371
1372 if (direct)
1373 ret = eina_hash_direct_add(worker->hash, key, d);
1374 else
1375 ret = eina_hash_add(worker->hash, key, d);
1376 CDB(worker->cond);
1377 return ret;
1378#else
1379 (void) cb;
1380 (void) direct;
1381 return EINA_FALSE;
1382#endif
1383}
1384
1385EAPI void *
1386ecore_thread_local_data_set(Ecore_Thread *thread,
1387 const char *key,
1388 void *value,
1389 Eina_Free_Cb cb)
1390{
1391#ifdef EFL_HAVE_THREADS
1392 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1393 Ecore_Thread_Data *d, *r;
1394 void *ret;
1395#endif
1396
1397 if ((!thread) || (!key) || (!value))
1398 return NULL;
1399#ifdef EFL_HAVE_THREADS
1400 if (!PHE(worker->self, PHS())) return NULL;
1401
1402 if (!worker->hash)
1403 worker->hash = eina_hash_string_small_new(_ecore_thread_data_free);
1404
1405 if (!worker->hash)
1406 return NULL;
1407
1408 if (!(d = malloc(sizeof(Ecore_Thread_Data))))
1409 return NULL;
1410
1411 d->data = value;
1412 d->cb = cb;
1413
1414 r = eina_hash_set(worker->hash, key, d);
1415 CDB(worker->cond);
1416 ret = r->data;
1417 free(r);
1418 return ret;
1419#else
1420 (void) cb;
1421 return NULL;
1422#endif
1423}
1424
1425EAPI void *
1426ecore_thread_local_data_find(Ecore_Thread *thread,
1427 const char *key)
1428{
1429#ifdef EFL_HAVE_THREADS
1430 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1431 Ecore_Thread_Data *d;
1432#endif
1433
1434 if ((!thread) || (!key))
1435 return NULL;
1436#ifdef EFL_HAVE_THREADS
1437 if (!PHE(worker->self, PHS())) return NULL;
1438
1439 if (!worker->hash)
1440 return NULL;
1441
1442 d = eina_hash_find(worker->hash, key);
1443 if (d)
1444 return d->data;
1445 return NULL;
1446#else
1447 return NULL;
1448#endif
1449}
1450
1451EAPI Eina_Bool
1452ecore_thread_local_data_del(Ecore_Thread *thread,
1453 const char *key)
1454{
1455#ifdef EFL_HAVE_THREADS
1456 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1457#endif
1458
1459 if ((!thread) || (!key))
1460 return EINA_FALSE;
1461#ifdef EFL_HAVE_THREADS
1462 if (!PHE(worker->self, PHS())) return EINA_FALSE;
1463
1464 if (!worker->hash)
1465 return EINA_FALSE;
1466 return eina_hash_del_by_key(worker->hash, key);
1467#else
1468 return EINA_TRUE;
1469#endif
1470}
1471
1472EAPI Eina_Bool
1473ecore_thread_global_data_add(const char *key,
1474 void *value,
1475 Eina_Free_Cb cb,
1476 Eina_Bool direct)
1477{
1478#ifdef EFL_HAVE_THREADS
1479 Ecore_Thread_Data *d;
1480 Eina_Bool ret;
1481#endif
1482
1483 if ((!key) || (!value))
1484 return EINA_FALSE;
1485#ifdef EFL_HAVE_THREADS
1486 LRWKWL(_ecore_thread_global_hash_lock);
1487 if (!_ecore_thread_global_hash)
1488 _ecore_thread_global_hash = eina_hash_string_small_new(_ecore_thread_data_free);
1489 LRWKU(_ecore_thread_global_hash_lock);
1490
1491 if (!(d = malloc(sizeof(Ecore_Thread_Data))))
1492 return EINA_FALSE;
1493
1494 d->data = value;
1495 d->cb = cb;
1496
1497 if (!_ecore_thread_global_hash)
1498 return EINA_FALSE;
1499 LRWKWL(_ecore_thread_global_hash_lock);
1500 if (direct)
1501 ret = eina_hash_direct_add(_ecore_thread_global_hash, key, d);
1502 else
1503 ret = eina_hash_add(_ecore_thread_global_hash, key, d);
1504 LRWKU(_ecore_thread_global_hash_lock);
1505 CDB(_ecore_thread_global_hash_cond);
1506 return ret;
1507#else
1508 (void) cb;
1509 (void) direct;
1510 return EINA_TRUE;
1511#endif
1512}
1513
1514EAPI void *
1515ecore_thread_global_data_set(const char *key,
1516 void *value,
1517 Eina_Free_Cb cb)
1518{
1519#ifdef EFL_HAVE_THREADS
1520 Ecore_Thread_Data *d, *r;
1521 void *ret;
1522#endif
1523
1524 if ((!key) || (!value))
1525 return NULL;
1526#ifdef EFL_HAVE_THREADS
1527 LRWKWL(_ecore_thread_global_hash_lock);
1528 if (!_ecore_thread_global_hash)
1529 _ecore_thread_global_hash = eina_hash_string_small_new(_ecore_thread_data_free);
1530 LRWKU(_ecore_thread_global_hash_lock);
1531
1532 if (!_ecore_thread_global_hash)
1533 return NULL;
1534
1535 if (!(d = malloc(sizeof(Ecore_Thread_Data))))
1536 return NULL;
1537
1538 d->data = value;
1539 d->cb = cb;
1540
1541 LRWKWL(_ecore_thread_global_hash_lock);
1542 r = eina_hash_set(_ecore_thread_global_hash, key, d);
1543 LRWKU(_ecore_thread_global_hash_lock);
1544 CDB(_ecore_thread_global_hash_cond);
1545
1546 ret = r->data;
1547 free(r);
1548 return ret;
1549#else
1550 (void) cb;
1551 return NULL;
1552#endif
1553}
1554
1555EAPI void *
1556ecore_thread_global_data_find(const char *key)
1557{
1558#ifdef EFL_HAVE_THREADS
1559 Ecore_Thread_Data *ret;
1560#endif
1561
1562 if (!key)
1563 return NULL;
1564#ifdef EFL_HAVE_THREADS
1565 if (!_ecore_thread_global_hash) return NULL;
1566
1567 LRWKRL(_ecore_thread_global_hash_lock);
1568 ret = eina_hash_find(_ecore_thread_global_hash, key);
1569 LRWKU(_ecore_thread_global_hash_lock);
1570 if (ret)
1571 return ret->data;
1572 return NULL;
1573#else
1574 return NULL;
1575#endif
1576}
1577
1578EAPI Eina_Bool
1579ecore_thread_global_data_del(const char *key)
1580{
1581#ifdef EFL_HAVE_THREADS
1582 Eina_Bool ret;
1583#endif
1584
1585 if (!key)
1586 return EINA_FALSE;
1587#ifdef EFL_HAVE_THREADS
1588 if (!_ecore_thread_global_hash)
1589 return EINA_FALSE;
1590
1591 LRWKWL(_ecore_thread_global_hash_lock);
1592 ret = eina_hash_del_by_key(_ecore_thread_global_hash, key);
1593 LRWKU(_ecore_thread_global_hash_lock);
1594 return ret;
1595#else
1596 return EINA_TRUE;
1597#endif
1598}
1599
1600EAPI void *
1601ecore_thread_global_data_wait(const char *key,
1602 double seconds)
1603{
1604#ifdef EFL_HAVE_THREADS
1605 double tm = 0;
1606 Ecore_Thread_Data *ret = NULL;
1607#endif
1608
1609 if (!key)
1610 return NULL;
1611#ifdef EFL_HAVE_THREADS
1612 if (!_ecore_thread_global_hash)
1613 return NULL;
1614 if (seconds > 0)
1615 tm = ecore_time_get() + seconds;
1616
1617 while (1)
1618 {
1619 LRWKRL(_ecore_thread_global_hash_lock);
1620 ret = eina_hash_find(_ecore_thread_global_hash, key);
1621 LRWKU(_ecore_thread_global_hash_lock);
1622 if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get())))
1623 break;
1624 LKL(_ecore_thread_global_hash_mutex);
1625 CDW(_ecore_thread_global_hash_cond, tm);
1626 LKU(_ecore_thread_global_hash_mutex);
1627 }
1628 if (ret) return ret->data;
1629 return NULL;
1630#else
1631 (void) seconds;
1632 return NULL;
1633#endif
1634}
1635
diff --git a/libraries/ecore/src/lib/ecore/ecore_throttle.c b/libraries/ecore/src/lib/ecore/ecore_throttle.c
deleted file mode 100644
index b5e3133..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_throttle.c
+++ /dev/null
@@ -1,99 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <unistd.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10
11static int throttle_val = 0;
12
13/**
14 * @addtogroup Ecore_Throttle_Group Ecore Throttle functions
15 *
16 * @{
17 */
18
19/**
20 * Increase throttle amount
21 *
22 * This will increase or decrease (if @p amount is positive or negative) the
23 * amount of "voluntary throttling" ecore will do to its main loop while
24 * running. This is intended to be used to limit animations and wakeups when
25 * in a strict power management state. The higher the current throttle value
26 * (which can be retrieved by ecore_throttle_get() ), the more throttling
27 * takes place. If the current throttle value is 0, then no throttling takes
28 * place at all.
29 *
30 * The value represents how long the ecore main loop will sleep (in seconds)
31 * before it goes into a fully idle state waiting for events, input or
32 * timing events to wake it up. For example, if the current throttle level
33 * is 0.5, then after every time the main loop cycles and goes into idle
34 * affter processing all events, the main loop will explicitly sleep for 0.5
35 * seconds before sitting and waiting for incoming events or timeouts, thus
36 * preventing animation, async IO and network handling etc. for that period
37 * of time. Of course these events, data and timeouts will be buffered,
38 * thus not losing anything, simply delaying when they get handled by the
39 * throttle value.
40 *
41 * Example:
42 * @code
43 * void enter_powersave(void) {
44 * ecore_throttle_adjust(0.2);
45 * printf("Now at throttle level: %1.3f\n", ecore_throttle_get());
46 * }
47 *
48 * void enter_deep_powersave(void) {
49 * ecore_throttle_adjust(0.5);
50 * printf("Now at throttle level: %1.3f\n", ecore_throttle_get());
51 * }
52 *
53 * void exit_powersave(void) {
54 * ecore_throttle_adjust(-0.2);
55 * printf("Now at throttle level: %1.3f\n", ecore_throttle_get());
56 * }
57 *
58 * void exit_deep_powersave(void) {
59 * ecore_throttle_adjust(-0.5);
60 * printf("Now at throttle level: %1.3f\n", ecore_throttle_get());
61 * }
62 * @endcode
63 *
64 * @param amount Amount (in seconds) to adjust by
65 */
66EAPI void
67ecore_throttle_adjust(double amount)
68{
69 int adj = amount * 1000000.0;
70 throttle_val += adj;
71 if (throttle_val < 0) throttle_val = 0;
72}
73
74/**
75 * Get current throttle level
76 *
77 * This gets the current throttling level, which can be adjusted by
78 * ecore_throttle_adjust(). The value is in seconds. Please see
79 * ecore_throttle_adjust() for more information.
80 *
81 * @return The current throttle level
82 */
83EAPI double
84ecore_throttle_get(void)
85{
86 return (double)throttle_val / 1000000.0;
87}
88
89/**
90 * @}
91 */
92
93void
94_ecore_throttle(void)
95{
96 if (throttle_val <= 0) return;
97 usleep(throttle_val);
98}
99
diff --git a/libraries/ecore/src/lib/ecore/ecore_time.c b/libraries/ecore/src/lib/ecore/ecore_time.c
deleted file mode 100644
index 0eeb1d6..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_time.c
+++ /dev/null
@@ -1,184 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#ifdef HAVE_SYS_TIME_H
8# include <sys/time.h>
9#endif
10
11#ifdef HAVE_EVIL
12# include <Evil.h>
13#endif
14
15#if defined(__APPLE__) && defined(__MACH__)
16# include <mach/mach_time.h>
17#endif
18
19#include "Ecore.h"
20#include "ecore_private.h"
21
22#include <time.h>
23
24#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
25static clockid_t _ecore_time_clock_id = -1;
26#elif defined(__APPLE__) && defined(__MACH__)
27static double _ecore_time_clock_conversion = 1e-9;
28#endif
29double _ecore_time_loop_time = -1.0;
30
31/**
32 * @addtogroup Ecore_Time_Group
33 *
34 * @{
35 */
36
37/**
38 * Retrieves the current system time as a floating point value in seconds.
39 *
40 * This uses a monotonic clock and thus never goes back in time while
41 * machine is live (even if user changes time or timezone changes,
42 * however it may be reset whenever the machine is restarted).
43 *
44 * @see ecore_loop_time_get().
45 * @see ecore_time_unix_get().
46 *
47 * @return The number of seconds. Start time is not defined (it may be
48 * when the machine was booted, unix time, etc), all it is
49 * defined is that it never goes backwards (unless you got big critical
50 * messages when the application started).
51 */
52EAPI double
53ecore_time_get(void)
54{
55#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
56 struct timespec t;
57
58 if (EINA_UNLIKELY(_ecore_time_clock_id < 0))
59 return ecore_time_unix_get();
60
61 if (EINA_UNLIKELY(clock_gettime(_ecore_time_clock_id, &t)))
62 {
63 CRIT("Cannot get current time.");
64 /* Try to at least return the latest value retrieved*/
65 return _ecore_time_loop_time;
66 }
67
68 return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
69#elif defined(HAVE_EVIL)
70 return evil_time_get();
71#elif defined(__APPLE__) && defined(__MACH__)
72 return _ecore_time_clock_conversion * (double)mach_absolute_time();
73#else
74 return ecore_time_unix_get();
75#endif
76}
77
78/**
79 * Retrieves the current UNIX time as a floating point value in seconds.
80 *
81 * @see ecore_time_get().
82 * @see ecore_loop_time_get().
83 *
84 * @return The number of seconds since 12.00AM 1st January 1970.
85 */
86EAPI double
87ecore_time_unix_get(void)
88{
89#ifdef HAVE_GETTIMEOFDAY
90 struct timeval timev;
91
92 gettimeofday(&timev, NULL);
93 return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
94#else
95# error "Your platform isn't supported yet"
96#endif
97}
98
99/**
100 * Retrieves the time at which the last loop stopped waiting for timeouts or
101 * events.
102 *
103 * This gets the time that the main loop ceased waiting for timouts and/or
104 * events to come in or for signals or any other interrupt source. This should
105 * be considered a reference point for all time based activity that should
106 * calculate its timepoint from the return of ecore_loop_time_get(). Use this
107 * UNLESS you absolutely must get the current actual timepoint - then use
108 * ecore_time_get(). Note that this time is meant to be used as relative to
109 * other times obtained on this run. If you need absolute time references, use
110 * ecore_time_unix_get() instead.
111 *
112 * This function can be called before any loop has ever been run, but either
113 * ecore_init() or ecore_time_get() must have been called once.
114 *
115 * @return The number of seconds. Start time is not defined (it may be
116 * when the machine was booted, unix time, etc), all it is
117 * defined is that it never goes backwards (unless you got big critical
118 * messages when the application started).
119 */
120EAPI double
121ecore_loop_time_get(void)
122{
123 return _ecore_time_loop_time;
124}
125
126/**
127 * @}
128 */
129
130/********************** Internal methods ********************************/
131
132/* TODO: Documentation says "All implementations support the system-wide
133 * real-time clock, which is identified by CLOCK_REALTIME. Check if the fallback
134 * to unix time (without specifying the resolution) might be removed
135 */
136void
137_ecore_time_init(void)
138{
139#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
140 struct timespec t;
141
142 if (_ecore_time_clock_id != -1) return;
143
144 if (!clock_gettime(CLOCK_MONOTONIC, &t))
145 {
146 _ecore_time_clock_id = CLOCK_MONOTONIC;
147 DBG("using CLOCK_MONOTONIC.");
148 }
149 else if (!clock_gettime(CLOCK_REALTIME, &t))
150 {
151 /* may go backwards */
152 _ecore_time_clock_id = CLOCK_REALTIME;
153 WRN("CLOCK_MONOTONIC not available. Fallback to CLOCK_REALTIME.");
154 }
155 else
156 {
157 _ecore_time_clock_id = -2;
158 CRIT("Cannot get a valid clock_gettime() clock id! "
159 "Fallback to unix time.");
160 }
161#else
162# ifndef HAVE_EVIL
163# if defined(__APPLE__) && defined(__MACH__)
164 mach_timebase_info_data_t info;
165 kern_return_t err = mach_timebase_info(&info);
166 if (err == 0)
167 {
168 _ecore_time_clock_conversion = 1e-9 * (double)info.numer / (double)info.denom;
169 }
170 else
171 {
172 WRN("Unable to get timebase info. Fallback to nanoseconds.");
173 }
174# else
175# warning "Your platform isn't supported yet"
176 CRIT("Platform does not support clock_gettime. "
177 "Fallback to unix time.");
178# endif
179# endif
180#endif
181
182 _ecore_time_loop_time = ecore_time_get();
183}
184
diff --git a/libraries/ecore/src/lib/ecore/ecore_timer.c b/libraries/ecore/src/lib/ecore/ecore_timer.c
deleted file mode 100644
index d76733b..0000000
--- a/libraries/ecore/src/lib/ecore/ecore_timer.c
+++ /dev/null
@@ -1,833 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10
11#ifdef WANT_ECORE_TIMER_DUMP
12# include <string.h>
13# include <execinfo.h>
14# define ECORE_TIMER_DEBUG_BT_NUM 64
15typedef void (*Ecore_Timer_Bt_Func)();
16#endif
17
18struct _Ecore_Timer
19{
20 EINA_INLIST;
21 ECORE_MAGIC;
22 double in;
23 double at;
24 double pending;
25 Ecore_Task_Cb func;
26 void *data;
27
28#ifdef WANT_ECORE_TIMER_DUMP
29 Ecore_Timer_Bt_Func timer_bt[ECORE_TIMER_DEBUG_BT_NUM];
30 int timer_bt_num;
31#endif
32
33 int references;
34 unsigned char delete_me : 1;
35 unsigned char just_added : 1;
36 unsigned char frozen : 1;
37};
38GENERIC_ALLOC_SIZE_DECLARE(Ecore_Timer);
39
40static void _ecore_timer_set(Ecore_Timer *timer,
41 double at,
42 double in,
43 Ecore_Task_Cb func,
44 void *data);
45#ifdef WANT_ECORE_TIMER_DUMP
46static int _ecore_timer_cmp(const void *d1,
47 const void *d2);
48#endif
49
50static int timers_added = 0;
51static int timers_delete_me = 0;
52static Ecore_Timer *timers = NULL;
53static Ecore_Timer *timer_current = NULL;
54static Ecore_Timer *suspended = NULL;
55static double last_check = 0.0;
56static double precision = 10.0 / 1000000.0;
57
58/**
59 * @addtogroup Ecore_Timer_Group
60 *
61 * @{
62 */
63
64/**
65 * Retrieves the current precision used by timer infrastructure.
66 *
67 * @see ecore_timer_precision_set()
68 */
69EAPI double
70ecore_timer_precision_get(void)
71{
72 return precision;
73}
74
75/**
76 * @brief Sets the precision to be used by timer infrastructure.
77 *
78 * @param value allowed introduced timeout delay, in seconds.
79 *
80 * This sets the precision for @b all timers. The precision determines how much
81 * of an difference from the requested interval is acceptable. One common reason
82 * to use this function is to @b increase the allowed timeout and thus @b
83 * decrease precision of the timers, this is because less precise the timers
84 * result in the system waking up less often and thus consuming less resources.
85 *
86 * Be aware that kernel may delay delivery even further, these delays
87 * are always possible due other tasks having higher priorities or
88 * other scheduler policies.
89 *
90 * Example:
91 * We have 2 timers, one that expires in a 2.0s and another that
92 * expires in 2.1s, if precision is 0.1s, then the Ecore will request
93 * for the next expire to happen in 2.1s and not 2.0s and another one
94 * of 0.1 as it would before.
95 *
96 * @note Ecore is smart enough to see if there are timers in the
97 * precision range, if it does not, in our example if no second timer
98 * in (T + precision) existed, then it would use the minimum timeout.
99 */
100EAPI void
101ecore_timer_precision_set(double value)
102{
103 _ecore_lock();
104
105 if (value < 0.0)
106 {
107 ERR("Precision %f less than zero, ignored", value);
108 goto unlock;
109 }
110 precision = value;
111
112unlock:
113 _ecore_unlock();
114}
115
116/**
117 * Creates a timer to call the given function in the given period of time.
118 * @param in The interval in seconds.
119 * @param func The given function. If @p func returns 1, the timer is
120 * rescheduled for the next interval @p in.
121 * @param data Data to pass to @p func when it is called.
122 * @return A timer object on success. @c NULL on failure.
123 *
124 * This function adds a timer and returns its handle on success and NULL on
125 * failure. The function @p func will be called every @p in seconds. The
126 * function will be passed the @p data pointer as its parameter.
127 *
128 * When the timer @p func is called, it must return a value of either 1
129 * (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL).
130 * If it returns 1, it will be called again at the next tick, or if it returns
131 * 0 it will be deleted automatically making any references/handles for it
132 * invalid.
133 */
134EAPI Ecore_Timer *
135ecore_timer_add(double in,
136 Ecore_Task_Cb func,
137 const void *data)
138{
139 double now;
140 Ecore_Timer *timer = NULL;
141
142 _ecore_lock();
143 if (!func) goto unlock;
144 if (in < 0.0) in = 0.0;
145 timer = ecore_timer_calloc(1);
146 if (!timer) goto unlock;
147 ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER);
148 now = ecore_time_get();
149
150#ifdef WANT_ECORE_TIMER_DUMP
151 timer->timer_bt_num = backtrace((void **)(timer->timer_bt),
152 ECORE_TIMER_DEBUG_BT_NUM);
153#endif
154
155 _ecore_timer_set(timer, now + in, in, func, (void *)data);
156unlock:
157 _ecore_unlock();
158 return timer;
159}
160
161/**
162 * Creates a timer to call the given function in the given period of time.
163 * @param in The interval in seconds from current loop time.
164 * @param func The given function. If @p func returns 1, the timer is
165 * rescheduled for the next interval @p in.
166 * @param data Data to pass to @p func when it is called.
167 * @return A timer object on success. @c NULL on failure.
168 *
169 * This is the same as ecore_timer_add(), but "now" is the time from
170 * ecore_loop_time_get() not ecore_time_get() as ecore_timer_add() uses. See
171 * ecore_timer_add() for more details.
172 */
173EAPI Ecore_Timer *
174ecore_timer_loop_add(double in,
175 Ecore_Task_Cb func,
176 const void *data)
177{
178 Ecore_Timer *timer;
179
180 _ecore_lock();
181 timer = _ecore_timer_loop_add(in, func, data);
182 _ecore_unlock();
183
184 return timer;
185}
186
187/**
188 * Delete the specified timer from the timer list.
189 * @param timer The timer to delete.
190 * @return The data pointer set for the timer when @ref ecore_timer_add was
191 * called. @c NULL is returned if the function is unsuccessful.
192 *
193 * Note: @p timer must be a valid handle. If the timer function has already
194 * returned 0, the handle is no longer valid (and does not need to be delete).
195 */
196EAPI void *
197ecore_timer_del(Ecore_Timer *timer)
198{
199 void *data = NULL;
200
201 _ecore_lock();
202
203 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
204 {
205 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
206 "ecore_timer_del");
207 goto unlock;
208 }
209
210 data = _ecore_timer_del(timer);
211
212unlock:
213 _ecore_unlock();
214 return data;
215}
216
217/**
218 * Change the interval the timer ticks of. If set during
219 * a timer call, this will affect the next interval.
220 *
221 * @param timer The timer to change.
222 * @param in The interval in seconds.
223 */
224EAPI void
225ecore_timer_interval_set(Ecore_Timer *timer,
226 double in)
227{
228 _ecore_lock();
229
230 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
231 {
232 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
233 "ecore_timer_interval_set");
234 goto unlock;
235 }
236 timer->in = in;
237unlock:
238 _ecore_unlock();
239}
240
241/**
242 * Get the interval the timer ticks on.
243 *
244 * @param timer The timer to retrieve the interval from
245 * @return The interval on success. -1 on failure.
246 */
247EAPI double
248ecore_timer_interval_get(Ecore_Timer *timer)
249{
250 double interval;
251
252 _ecore_lock();
253
254 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
255 {
256 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
257 "ecore_timer_interval_get");
258 interval = -1.0;
259 goto unlock;
260 }
261
262 interval = timer->in;
263unlock:
264 _ecore_unlock();
265 return interval;
266}
267
268/**
269 * Add some delay for the next occurrence of a timer.
270 * This doesn't affect the interval of a timer.
271 *
272 * @param timer The timer to change.
273 * @param add The dalay to add to the next iteration.
274 */
275EAPI void
276ecore_timer_delay(Ecore_Timer *timer,
277 double add)
278{
279 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
280 {
281 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
282 "ecore_timer_delay");
283 return;
284 }
285
286 _ecore_lock();
287 _ecore_timer_delay(timer, add);
288 _ecore_unlock();
289}
290
291/**
292 * Reset a timer to its full interval
293 * This doesn't affect the interval of a timer
294 * @param timer The timer
295 * @since 1.2
296 * @note This is equivalent to (but faster than)
297 * @code
298 * ecore_timer_delay(timer, ecore_timer_interval_get(timer) - ecore_timer_pending_get(timer));
299 * @endcode
300 */
301EAPI void
302ecore_timer_reset(Ecore_Timer *timer)
303{
304 double now, add;
305 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
306 {
307 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
308 __func__);
309 return;
310 }
311 _ecore_lock();
312 now = ecore_time_get();
313
314 if (timer->frozen)
315 add = timer->pending;
316 else
317 add = timer->at - now;
318 _ecore_timer_delay(timer, timer->in - add);
319 _ecore_unlock();
320}
321
322/**
323 * Get the pending time regarding a timer.
324 *
325 * @param timer The timer to learn from.
326 * @ingroup Ecore_Timer_Group
327 */
328EAPI double
329ecore_timer_pending_get(Ecore_Timer *timer)
330{
331 double now;
332 double ret = 0.0;
333
334 _ecore_lock();
335
336 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
337 {
338 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
339 "ecore_timer_pending_get");
340 goto unlock;
341 }
342
343 now = ecore_time_get();
344
345 if (timer->frozen)
346 ret = timer->pending;
347 else
348 ret = timer->at - now;
349unlock:
350 _ecore_unlock();
351 return ret;
352}
353
354/**
355 * Pauses a running timer.
356 *
357 * @param timer The timer to be paused.
358 *
359 * The timer callback won't be called while the timer is paused. The remaining
360 * time until the timer expires will be saved, so the timer can be resumed with
361 * that same remaining time to expire, instead of expiring instantly. Use
362 * ecore_timer_thaw() to resume it.
363 *
364 * @note Nothing happens if the timer was already paused.
365 *
366 * @see ecore_timer_thaw()
367 */
368EAPI void
369ecore_timer_freeze(Ecore_Timer *timer)
370{
371 double now;
372
373 _ecore_lock();
374
375 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
376 {
377 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
378 "ecore_timer_freeze");
379 goto unlock;
380 }
381
382 /* Timer already frozen */
383 if (timer->frozen)
384 goto unlock;
385
386 timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
387 suspended = (Ecore_Timer *)eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
388
389 now = ecore_time_get();
390
391 timer->pending = timer->at - now;
392 timer->at = 0.0;
393 timer->frozen = 1;
394unlock:
395 _ecore_unlock();
396}
397
398/**
399 * Resumes a frozen (paused) timer.
400 *
401 * @param timer The timer to be resumed.
402 *
403 * The timer will be resumed from its previous relative position in time. That
404 * means, if it had X seconds remaining until expire when it was paused, it will
405 * be started now with those same X seconds remaining to expire again. But
406 * notice that the interval time won't be touched by this call or by
407 * ecore_timer_freeze().
408 *
409 * @see ecore_timer_freeze()
410 */
411EAPI void
412ecore_timer_thaw(Ecore_Timer *timer)
413{
414 double now;
415
416 _ecore_lock();
417
418 if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
419 {
420 ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
421 "ecore_timer_thaw");
422 goto unlock;
423 }
424
425 /* Timer not frozen */
426 if (!timer->frozen)
427 goto unlock;
428
429 suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
430 now = ecore_time_get();
431
432 _ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data);
433unlock:
434 _ecore_unlock();
435}
436
437EAPI char *
438ecore_timer_dump(void)
439{
440#ifdef WANT_ECORE_TIMER_DUMP
441 Eina_Strbuf *result;
442 char *out;
443 Ecore_Timer *tm;
444 Eina_List *tmp = NULL;
445 int living_timer = 0;
446 int unknow_timer = 0;
447
448 _ecore_lock();
449 result = eina_strbuf_new();
450
451 EINA_INLIST_FOREACH(timers, tm)
452 tmp = eina_list_sorted_insert(tmp, _ecore_timer_cmp, tm);
453
454 EINA_LIST_FREE(tmp, tm)
455 {
456 char **strings;
457 int j;
458
459 if (!tm->frozen && !tm->delete_me)
460 living_timer++;
461
462 strings = backtrace_symbols((void **)tm->timer_bt, tm->timer_bt_num);
463 if (tm->timer_bt_num <= 0 || strings == NULL)
464 {
465 unknow_timer++;
466 continue;
467 }
468
469 eina_strbuf_append_printf(result, "*** timer: %f ***\n", tm->in);
470 if (tm->frozen)
471 eina_strbuf_append(result, "FROZEN\n");
472 if (tm->delete_me)
473 eina_strbuf_append(result, "DELETED\n");
474 for (j = 0; j < tm->timer_bt_num; j++)
475 eina_strbuf_append_printf(result, "%s\n", strings[j]);
476
477 free(strings);
478 }
479
480 eina_strbuf_append_printf(result, "\n***\nThere is %i living timer.\nWe did lost track of %i timers.\n", living_timer, unknow_timer);
481
482 out = eina_strbuf_string_steal(result);
483 eina_strbuf_free(result);
484 _ecore_unlock();
485
486 return out;
487#else
488 return NULL;
489#endif
490}
491
492/**
493 * @}
494 */
495
496Ecore_Timer *
497_ecore_timer_loop_add(double in,
498 Ecore_Task_Cb func,
499 const void *data)
500{
501 double now;
502 Ecore_Timer *timer = NULL;
503
504 if (!func) return timer;
505 if (in < 0.0) in = 0.0;
506 timer = ecore_timer_calloc(1);
507 if (!timer) return timer;
508 ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER);
509 now = ecore_loop_time_get();
510
511#ifdef WANT_ECORE_TIMER_DUMP
512 timer->timer_bt_num = backtrace((void **)(timer->timer_bt),
513 ECORE_TIMER_DEBUG_BT_NUM);
514#endif
515 _ecore_timer_set(timer, now + in, in, func, (void *)data);
516 return timer;
517}
518
519EAPI void
520_ecore_timer_delay(Ecore_Timer *timer,
521 double add)
522{
523 if (timer->frozen)
524 {
525 timer->pending += add;
526 }
527 else
528 {
529 timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
530 _ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data);
531 }
532}
533
534void *
535_ecore_timer_del(Ecore_Timer *timer)
536{
537 if (timer->frozen && !timer->references)
538 {
539 void *data = timer->data;
540
541 suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
542
543 if (timer->delete_me)
544 timers_delete_me--;
545
546 ecore_timer_mp_free(timer);
547 return data;
548 }
549
550 EINA_SAFETY_ON_TRUE_RETURN_VAL(timer->delete_me, NULL);
551 timer->delete_me = 1;
552 timers_delete_me++;
553 return timer->data;
554}
555
556void
557_ecore_timer_shutdown(void)
558{
559 Ecore_Timer *timer;
560
561 while ((timer = timers))
562 {
563 timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
564 ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
565 ecore_timer_mp_free(timer);
566 }
567
568 while ((timer = suspended))
569 {
570 suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended));
571 ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
572 ecore_timer_mp_free(timer);
573 }
574
575 timer_current = NULL;
576}
577
578void
579_ecore_timer_cleanup(void)
580{
581 Ecore_Timer *l;
582 int in_use = 0, todo = timers_delete_me, done = 0;
583
584 if (!timers_delete_me) return;
585 for (l = timers; l; )
586 {
587 Ecore_Timer *timer = l;
588
589 l = (Ecore_Timer *)EINA_INLIST_GET(l)->next;
590 if (timer->delete_me)
591 {
592 if (timer->references)
593 {
594 in_use++;
595 continue;
596 }
597 timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
598 ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
599 ecore_timer_mp_free(timer);
600 timers_delete_me--;
601 done++;
602 if (timers_delete_me == 0) return;
603 }
604 }
605 for (l = suspended; l; )
606 {
607 Ecore_Timer *timer = l;
608
609 l = (Ecore_Timer *)EINA_INLIST_GET(l)->next;
610 if (timer->delete_me)
611 {
612 if (timer->references)
613 {
614 in_use++;
615 continue;
616 }
617 suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
618 ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
619 ecore_timer_mp_free(timer);
620 timers_delete_me--;
621 done++;
622 if (timers_delete_me == 0) return;
623 }
624 }
625
626 if ((!in_use) && (timers_delete_me))
627 {
628 ERR("%d timers to delete, but they were not found!"
629 "Stats: todo=%d, done=%d, pending=%d, in_use=%d. "
630 "reset counter.",
631 timers_delete_me, todo, done, todo - done, in_use);
632 timers_delete_me = 0;
633 }
634}
635
636void
637_ecore_timer_enable_new(void)
638{
639 Ecore_Timer *timer;
640
641 if (!timers_added) return;
642 timers_added = 0;
643 EINA_INLIST_FOREACH(timers, timer) timer->just_added = 0;
644}
645
646int
647_ecore_timers_exists(void)
648{
649 Ecore_Timer *timer = timers;
650
651 while ((timer) && (timer->delete_me))
652 timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next;
653
654 return !!timer;
655}
656
657static inline Ecore_Timer *
658_ecore_timer_first_get(void)
659{
660 Ecore_Timer *timer = timers;
661
662 while ((timer) && ((timer->delete_me) || (timer->just_added)))
663 timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next;
664
665 return timer;
666}
667
668static inline Ecore_Timer *
669_ecore_timer_after_get(Ecore_Timer *base)
670{
671 Ecore_Timer *timer = (Ecore_Timer *)EINA_INLIST_GET(base)->next;
672 Ecore_Timer *valid_timer = NULL;
673 double maxtime = base->at + precision;
674
675 while ((timer) && (timer->at < maxtime))
676 {
677 if (!((timer->delete_me) || (timer->just_added)))
678 valid_timer = timer;
679 timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next;
680 }
681
682 return valid_timer;
683}
684
685double
686_ecore_timer_next_get(void)
687{
688 double now;
689 double in;
690 Ecore_Timer *first, *second;
691
692 first = _ecore_timer_first_get();
693 if (!first) return -1;
694
695 second = _ecore_timer_after_get(first);
696 if (second) first = second;
697
698 now = ecore_loop_time_get();
699 in = first->at - now;
700 if (in < 0) in = 0;
701 return in;
702}
703
704static inline void
705_ecore_timer_reschedule(Ecore_Timer *timer,
706 double when)
707{
708 if ((timer->delete_me) || (timer->frozen)) return;
709
710 timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
711
712 /* if the timer would have gone off more than 15 seconds ago,
713 * assume that the system hung and set the timer to go off
714 * timer->in from now. this handles system hangs, suspends
715 * and more, so ecore will only "replay" the timers while
716 * the system is suspended if it is suspended for less than
717 * 15 seconds (basically). this also handles if the process
718 * is stopped in a debugger or IO and other handling gets
719 * really slow within the main loop.
720 */
721 if ((timer->at + timer->in) < (when - 15.0))
722 _ecore_timer_set(timer, when + timer->in, timer->in, timer->func, timer->data);
723 else
724 _ecore_timer_set(timer, timer->at + timer->in, timer->in, timer->func, timer->data);
725}
726
727/* assume that we hold the ecore lock when entering this function */
728void
729_ecore_timer_expired_timers_call(double when)
730{
731 /* call the first expired timer until no expired timers exist */
732 while (_ecore_timer_expired_call(when)) ;
733}
734
735/* assume that we hold the ecore lock when entering this function */
736int
737_ecore_timer_expired_call(double when)
738{
739 if (!timers) return 0;
740 if (last_check > when)
741 {
742 Ecore_Timer *timer;
743 /* User set time backwards */
744 EINA_INLIST_FOREACH(timers, timer) timer->at -= (last_check - when);
745 }
746 last_check = when;
747
748 if (!timer_current)
749 {
750 /* regular main loop, start from head */
751 timer_current = timers;
752 }
753 else
754 {
755 /* recursive main loop, continue from where we were */
756 Ecore_Timer *timer_old = timer_current;
757 timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
758 _ecore_timer_reschedule(timer_old, when);
759 }
760
761 while (timer_current)
762 {
763 Ecore_Timer *timer = timer_current;
764
765 if (timer->at > when)
766 {
767 timer_current = NULL; /* ended walk, next should restart. */
768 return 0;
769 }
770
771 if ((timer->just_added) || (timer->delete_me))
772 {
773 timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
774 continue;
775 }
776
777 timer->references++;
778 if (!_ecore_call_task_cb(timer->func, timer->data))
779 {
780 if (!timer->delete_me) _ecore_timer_del(timer);
781 }
782 timer->references--;
783
784 if (timer_current) /* may have changed in recursive main loops */
785 timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
786
787 _ecore_timer_reschedule(timer, when);
788 }
789 return 0;
790}
791
792static void
793_ecore_timer_set(Ecore_Timer *timer,
794 double at,
795 double in,
796 Ecore_Task_Cb func,
797 void *data)
798{
799 Ecore_Timer *t2;
800
801 timers_added = 1;
802 timer->at = at;
803 timer->in = in;
804 timer->func = func;
805 timer->data = data;
806 timer->just_added = 1;
807 timer->frozen = 0;
808 timer->pending = 0.0;
809 if (timers)
810 {
811 EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2)
812 {
813 if (timer->at > t2->at)
814 {
815 timers = (Ecore_Timer *)eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
816 return;
817 }
818 }
819 }
820 timers = (Ecore_Timer *)eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
821}
822
823#ifdef WANT_ECORE_TIMER_DUMP
824static int
825_ecore_timer_cmp(const void *d1,
826 const void *d2)
827{
828 const Ecore_Timer *t1 = d1;
829 const Ecore_Timer *t2 = d2;
830
831 return (int)((t1->in - t2->in) * 100);
832}
833#endif
diff --git a/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h b/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h
deleted file mode 100644
index 51c8ead..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ /dev/null
@@ -1,147 +0,0 @@
1#ifndef __ECORE_COCOA_H__
2#define __ECORE_COCOA_H__
3
4/*
5 * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
6 * THE API MAY CHANGE.
7 */
8
9#ifndef ECORE_COCOA_WIP_GNSIDNQI
10# warning "You are using a work in progress API. This API is not stable"
11# warning "and is subject to change. You use this at your own risk."
12#endif
13
14#ifdef EAPI
15# undef EAPI
16#endif
17
18#ifdef __GNUC__
19# if __GNUC__ >= 4
20# define EAPI __attribute__ ((visibility("default")))
21# else
22# define EAPI
23# endif
24#else
25# define EAPI
26#endif
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
33
34EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS;
35EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS;
36EAPI extern int ECORE_COCOA_EVENT_RESIZE;
37EAPI extern int ECORE_COCOA_EVENT_EXPOSE;
38
39typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize;
40struct _Ecore_Cocoa_Event_Video_Resize
41{
42 int w;
43 int h;
44};
45
46
47/* Core */
48
49EAPI int ecore_cocoa_init(void);
50EAPI int ecore_cocoa_shutdown(void);
51EAPI void ecore_cocoa_feed_events(void);
52
53/* Window */
54
55EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x,
56 int y,
57 int width,
58 int height);
59
60EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window);
61
62EAPI void *ecore_cocoa_window_hwnd_get(Ecore_Cocoa_Window *window);
63
64EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
65 int x,
66 int y);
67
68EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
69 int width,
70 int height);
71
72EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
73 int x,
74 int y,
75 int width,
76 int height);
77
78EAPI void ecore_cocoa_window_geometry_get(Ecore_Cocoa_Window *window,
79 int *x,
80 int *y,
81 int *width,
82 int *height);
83
84EAPI void ecore_cocoa_window_size_get(Ecore_Cocoa_Window *window,
85 int *width,
86 int *height);
87
88EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
89 unsigned int min_width,
90 unsigned int min_height);
91
92EAPI void ecore_cocoa_window_size_min_get(Ecore_Cocoa_Window *window,
93 unsigned int *min_width,
94 unsigned int *min_height);
95
96EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
97 unsigned int max_width,
98 unsigned int max_height);
99
100EAPI void ecore_cocoa_window_size_max_get(Ecore_Cocoa_Window *window,
101 unsigned int *max_width,
102 unsigned int *max_height);
103
104EAPI void ecore_cocoa_window_size_base_set(Ecore_Cocoa_Window *window,
105 unsigned int base_width,
106 unsigned int base_height);
107
108EAPI void ecore_cocoa_window_size_base_get(Ecore_Cocoa_Window *window,
109 unsigned int *base_width,
110 unsigned int *base_height);
111
112EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
113 unsigned int step_width,
114 unsigned int step_height);
115
116EAPI void ecore_cocoa_window_size_step_get(Ecore_Cocoa_Window *window,
117 unsigned int *step_width,
118 unsigned int *step_height);
119
120EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window);
121
122EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window);
123
124EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window);
125
126EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window);
127
128EAPI void ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window,
129 const char *title);
130
131EAPI void ecore_cocoa_window_focus_set(Ecore_Cocoa_Window *window);
132
133EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
134 int on);
135
136EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
137 int on);
138
139EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
140 void *view);
141
142
143#ifdef __cplusplus
144}
145#endif
146
147#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
deleted file mode 100644
index 7068bc2..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h
+++ /dev/null
@@ -1,285 +0,0 @@
1#ifndef ECORE_COCOA_KEYS_H__
2#define ECORE_COCOA_KEYS_H__
3
4struct _ecore_cocoa_keys_s
5{
6 int code;
7 const char *name;
8 const char *compose;
9};
10
11static const struct _ecore_cocoa_keys_s keystable[] =
12{
13
14{ 0, "0x00", "" },
15{ 0, "First", "" },
16{ 3, "Return", "\015" },
17{ 8, "BackSpace", "\010" },
18{ 9, "Tab", "\011" },
19{ 12, "Clear", "" },
20{ 13, "Return", "\015" },
21{ 19, "Pause", "" },
22{ 25, "BackTab", ""},
23{ 27, "Escape", "" },
24{ 32, "space", " " },
25{ 33, "exclam", "!" },
26{ 34, "quotedbl", "\"" },
27{ 35, "numbersign", "#" },
28{ 36, "dollar", "$" },
29{ 37, "percent", "%%" },
30{ 38, "ampersand", "&" },
31{ 39, "apostrophe", "'" },
32{ 40, "parenleft", "(" },
33{ 41, "parenright", ")" },
34{ 42, "asterisk", "*" },
35{ 43, "plus", "+" },
36{ 44, "comma", "," },
37{ 45, "minus", "-" },
38{ 46, "period", "." },
39{ 47, "slash", "/" },
40{ 48, "0", "0" },
41{ 49, "1", "1" },
42{ 50, "2", "2" },
43{ 51, "3", "3" },
44{ 52, "4", "4" },
45{ 53, "5", "5" },
46{ 54, "6", "6" },
47{ 55, "7", "7" },
48{ 56, "8", "8" },
49{ 57, "9", "9" },
50{ 58, "colon", ";" },
51{ 59, "semicolon", ";" },
52{ 60, "less", "<" },
53{ 61, "equal", "=" },
54{ 62, "greater", ">" },
55{ 63, "question", "?" },
56{ 64, "at", "@" },
57
58{ 91, "bracketleft", "[" },
59{ 92, "backslash", "\\" },
60{ 93, "bracketright", "]" },
61{ 94, "asciicircumm", "^" },
62{ 95, "underscore", "_" },
63{ 96, "backquote", "`" },
64{ 97, "a", "a" },
65{ 98, "b", "b" },
66{ 99, "c", "c" },
67{ 100, "d", "d" },
68{ 101, "e", "e" },
69{ 102, "f", "f" },
70{ 103, "g", "g" },
71{ 104, "h", "h" },
72{ 105, "i", "i" },
73{ 106, "j", "j" },
74{ 107, "k", "k" },
75{ 108, "l", "l" },
76{ 109, "m", "m" },
77{ 110, "n", "n" },
78{ 111, "o", "o" },
79{ 112, "p", "p" },
80{ 113, "q", "q" },
81{ 114, "r", "r" },
82{ 115, "s", "s" },
83{ 116, "t", "t" },
84{ 117, "u", "u" },
85{ 118, "v", "v" },
86{ 119, "w", "w" },
87{ 120, "x", "x" },
88{ 121, "y", "y" },
89{ 122, "z", "z" },
90{ 123, "braceleft", "" },
91{ 124, "pipe", "" },
92{ 125, "braceright", "" },
93{ 127, "Delete", "\177" },
94{ 126, "asciitilde", "~" },
95
96{ 160, "w0", "" },
97{ 161, "w1", "" },
98{ 162, "w2", "" },
99{ 163, "w3", "" },
100{ 164, "w4", "" },
101{ 165, "w5", "" },
102{ 166, "w6", "" },
103{ 167, "w7", "" },
104{ 168, "w8", "" },
105{ 169, "w9", "" },
106{ 170, "w10", "" },
107{ 171, "w11", "" },
108{ 172, "w12", "" },
109{ 173, "w13", "" },
110{ 174, "w14", "" },
111{ 175, "w15", "" },
112{ 176, "w16", "" },
113{ 177, "w17", "" },
114{ 178, "w18", "" },
115{ 179, "w19", "" },
116{ 180, "w20", "" },
117{ 181, "w21", "" },
118{ 182, "w22", "" },
119{ 183, "w23", "" },
120{ 184, "w24", "" },
121{ 185, "w25", "" },
122{ 186, "w26", "" },
123{ 187, "w27", "" },
124{ 188, "w28", "" },
125{ 189, "w29", "" },
126{ 190, "w30", "" },
127{ 191, "w31", "" },
128{ 192, "w32", "" },
129{ 193, "w33", "" },
130{ 194, "w34", "" },
131{ 195, "w35", "" },
132{ 196, "w36", "" },
133{ 197, "w37", "" },
134{ 198, "w38", "" },
135{ 199, "w39", "" },
136{ 200, "w40", "" },
137{ 201, "w41", "" },
138{ 202, "w42", "" },
139{ 203, "w43", "" },
140{ 204, "w44", "" },
141{ 205, "w45", "" },
142{ 206, "w46", "" },
143{ 207, "w47", "" },
144{ 208, "w48", "" },
145{ 209, "w49", "" },
146{ 210, "w50", "" },
147{ 211, "w51", "" },
148{ 212, "w52", "" },
149{ 213, "w53", "" },
150{ 214, "w54", "" },
151{ 215, "w55", "" },
152{ 216, "w56", "" },
153{ 217, "w57", "" },
154{ 218, "w58", "" },
155{ 219, "w59", "" },
156{ 220, "w60", "" },
157{ 221, "w61", "" },
158{ 222, "w62", "" },
159{ 223, "w63", "" },
160{ 224, "w64", "" },
161{ 225, "w65", "" },
162{ 226, "w66", "" },
163{ 227, "w67", "" },
164{ 228, "w68", "" },
165{ 229, "w69", "" },
166{ 230, "w70", "" },
167{ 231, "w71", "" },
168{ 232, "w72", "" },
169{ 233, "w73", "" },
170{ 234, "w74", "" },
171{ 235, "w75", "" },
172{ 236, "w76", "" },
173{ 237, "w77", "" },
174{ 238, "w78", "" },
175{ 239, "w79", "" },
176{ 240, "w80", "" },
177{ 241, "w81", "" },
178{ 242, "w82", "" },
179{ 243, "w83", "" },
180{ 244, "w84", "" },
181{ 245, "w85", "" },
182{ 246, "w86", "" },
183{ 247, "w87", "" },
184{ 248, "w88", "" },
185{ 249, "w89", "" },
186{ 250, "w90", "" },
187{ 251, "w91", "" },
188{ 252, "w92", "" },
189{ 253, "w93", "" },
190{ 254, "w94", "" },
191{ 255, "w95", "" },
192
193{ 256, "KP0", "0" },
194{ 257, "KP1", "1" },
195{ 258, "KP2", "2" },
196{ 259, "KP3", "3" },
197{ 260, "KP4", "4" },
198{ 261, "KP5", "5" },
199{ 262, "KP6", "6" },
200{ 263, "KP7", "7" },
201{ 264, "KP8", "8" },
202{ 265, "KP9", "9" },
203{ 266, "period", "." },
204{ 267, "KP_Divide", "/" },
205{ 268, "KP_Multiply", "*" },
206{ 269, "KP_Minus", "-" },
207{ 270, "KP_Plus", "+" },
208{ 271, "KP_Enter", "\015" },
209{ 272, "KP_Equals", "=" },
210
211{ NSUpArrowFunctionKey, "Up", "" },
212{ NSDownArrowFunctionKey, "Down", "" },
213{ NSRightArrowFunctionKey, "Right", "" },
214{ NSLeftArrowFunctionKey, "Left", "" },
215{ NSInsertFunctionKey, "Insert", "" },
216{ NSHomeFunctionKey, "Home", "" },
217{ NSEndFunctionKey, "End", "" },
218{ NSPageUpFunctionKey, "Page_Up", "" },
219{ NSPageDownFunctionKey, "Page_Down", "" },
220
221{ NSF1FunctionKey, "F1", "" },
222{ NSF2FunctionKey, "F2", "" },
223{ NSF3FunctionKey, "F3", "" },
224{ NSF4FunctionKey, "F4", "" },
225{ NSF5FunctionKey, "F5", "" },
226{ NSF6FunctionKey, "F6", "" },
227{ NSF7FunctionKey, "F7", "" },
228{ NSF8FunctionKey, "F8", "" },
229{ NSF9FunctionKey, "F9", "" },
230{ NSF10FunctionKey, "F10", "" },
231{ NSF11FunctionKey, "F11", "" },
232{ NSF12FunctionKey, "F12", "" },
233{ NSF13FunctionKey, "F13", "" },
234{ NSF14FunctionKey, "F14", "" },
235{ NSF15FunctionKey, "F15", "" },
236{ NSF16FunctionKey, "F16", "" },
237{ NSF17FunctionKey, "F17", "" },
238{ NSF18FunctionKey, "F18", "" },
239{ NSF19FunctionKey, "F19", "" },
240{ NSF20FunctionKey, "F20", "" },
241{ NSF21FunctionKey, "F21", "" },
242{ NSF22FunctionKey, "F22", "" },
243{ NSF23FunctionKey, "F23", "" },
244{ NSF24FunctionKey, "F24", "" },
245{ NSF25FunctionKey, "F25", "" },
246{ NSF26FunctionKey, "F26", "" },
247{ NSF27FunctionKey, "F27", "" },
248{ NSF28FunctionKey, "F28", "" },
249{ NSF29FunctionKey, "F29", "" },
250{ NSF30FunctionKey, "F30", "" },
251{ NSF31FunctionKey, "F31", "" },
252{ NSF32FunctionKey, "F32", "" },
253{ NSF33FunctionKey, "F33", "" },
254{ NSF34FunctionKey, "F34", "" },
255{ NSF35FunctionKey, "F35", "" },
256
257{ NSClearLineFunctionKey, "Num_Lock", "" },
258{ 301, "Caps_Lock", "" },
259{ NSScrollLockFunctionKey, "Scroll_Lock", "" },
260{ 303, "Shift_R", "" },
261{ 304, "Shift_L", "" },
262{ 305, "Control_R", "" },
263{ 306, "Control_L", "" },
264{ 307, "Alt_R", "" },
265{ 308, "Alt_L", "" },
266{ 309, "Meta_R", "" },
267{ 310, "Meta_L", "" },
268{ 311, "Super_L", "" },
269{ 312, "Super_R", "" },
270
271{ NSModeSwitchFunctionKey, "Mode", "" },
272{ 314, "Compose", "" },
273
274{ NSHelpFunctionKey, "Help", "" },
275{ NSPrintFunctionKey, "Print", "" },
276{ NSSysReqFunctionKey, "SysReq", "" },
277{ NSBreakFunctionKey, "Break", "" },
278{ NSMenuFunctionKey, "Menu", "" },
279{ 320, "Power", "" },
280{ 321, "Euro", "" },
281{ NSUndoFunctionKey, "Undo", "" }
282
283};
284
285#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
deleted file mode 100644
index 4ac7b11..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_input \
6-I$(top_builddir)/src/lib/ecore \
7-I$(top_builddir)/src/lib/ecore_input \
8@EVAS_CFLAGS@ \
9@EINA_CFLAGS@
10
11lib_LTLIBRARIES = libecore_cocoa.la
12includes_HEADERS = \
13Ecore_Cocoa.h \
14Ecore_Cocoa_Keys.h
15includesdir = $(includedir)/ecore-@VMAJ@
16
17libecore_cocoa_la_SOURCES = \
18ecore_cocoa.m \
19ecore_cocoa_window.m
20
21libecore_cocoa_la_LIBADD = \
22$(top_builddir)/src/lib/ecore/libecore.la \
23$(top_builddir)/src/lib/ecore_input/libecore_input.la \
24@EVAS_LIBS@ \
25@EINA_LIBS@
26
27libecore_cocoa_la_LDFLAGS = @cocoa_ldflags@ -version-info @version_info@ @release_info@
28
29EXTRA_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
deleted file mode 100644
index 447c3ef..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/Makefile.in
+++ /dev/null
@@ -1,837 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_cocoa
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_cocoa_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la \
90 $(top_builddir)/src/lib/ecore_input/libecore_input.la
91am_libecore_cocoa_la_OBJECTS = ecore_cocoa.lo ecore_cocoa_window.lo
92libecore_cocoa_la_OBJECTS = $(am_libecore_cocoa_la_OBJECTS)
93AM_V_lt = $(am__v_lt_$(V))
94am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
95am__v_lt_0 = --silent
96libecore_cocoa_la_LINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
97 $(LIBTOOLFLAGS) --mode=link $(OBJCLD) $(AM_OBJCFLAGS) \
98 $(OBJCFLAGS) $(libecore_cocoa_la_LDFLAGS) $(LDFLAGS) -o $@
99DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
100depcomp = $(SHELL) $(top_srcdir)/depcomp
101am__depfiles_maybe = depfiles
102am__mv = mv -f
103OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
104 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
105LTOBJCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
106 $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) \
107 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
108 $(AM_OBJCFLAGS) $(OBJCFLAGS)
109AM_V_OBJC = $(am__v_OBJC_$(V))
110am__v_OBJC_ = $(am__v_OBJC_$(AM_DEFAULT_VERBOSITY))
111am__v_OBJC_0 = @echo " OBJC " $@;
112AM_V_at = $(am__v_at_$(V))
113am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
114am__v_at_0 = @
115OBJCLD = $(OBJC)
116OBJCLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
117 --mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \
118 $(AM_LDFLAGS) $(LDFLAGS) -o $@
119AM_V_OBJCLD = $(am__v_OBJCLD_$(V))
120am__v_OBJCLD_ = $(am__v_OBJCLD_$(AM_DEFAULT_VERBOSITY))
121am__v_OBJCLD_0 = @echo " OBJCLD" $@;
122AM_V_GEN = $(am__v_GEN_$(V))
123am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
124am__v_GEN_0 = @echo " GEN " $@;
125SOURCES = $(libecore_cocoa_la_SOURCES)
126DIST_SOURCES = $(libecore_cocoa_la_SOURCES)
127HEADERS = $(includes_HEADERS)
128ETAGS = etags
129CTAGS = ctags
130DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
131ACLOCAL = @ACLOCAL@
132ALLOCA = @ALLOCA@
133AMTAR = @AMTAR@
134AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
135AR = @AR@
136AS = @AS@
137AUTOCONF = @AUTOCONF@
138AUTOHEADER = @AUTOHEADER@
139AUTOMAKE = @AUTOMAKE@
140AWK = @AWK@
141CARES_CFLAGS = @CARES_CFLAGS@
142CARES_LIBS = @CARES_LIBS@
143CC = @CC@
144CCDEPMODE = @CCDEPMODE@
145CFLAGS = @CFLAGS@
146CHECK_CFLAGS = @CHECK_CFLAGS@
147CHECK_LIBS = @CHECK_LIBS@
148CPP = @CPP@
149CPPFLAGS = @CPPFLAGS@
150CURL_CFLAGS = @CURL_CFLAGS@
151CURL_LIBS = @CURL_LIBS@
152CXX = @CXX@
153CXXCPP = @CXXCPP@
154CXXDEPMODE = @CXXDEPMODE@
155CXXFLAGS = @CXXFLAGS@
156CYGPATH_W = @CYGPATH_W@
157DEFS = @DEFS@
158DEPDIR = @DEPDIR@
159DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
160DIRECTFB_LIBS = @DIRECTFB_LIBS@
161DLLTOOL = @DLLTOOL@
162DSYMUTIL = @DSYMUTIL@
163DUMPBIN = @DUMPBIN@
164ECHO_C = @ECHO_C@
165ECHO_N = @ECHO_N@
166ECHO_T = @ECHO_T@
167ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
168ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
169EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
170EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
171EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
172EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
173EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
174EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
175EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
176EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
177EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
178EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
179EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
180EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
181EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
182EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
183EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
184EGREP = @EGREP@
185EINA_CFLAGS = @EINA_CFLAGS@
186EINA_LIBS = @EINA_LIBS@
187ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
188ESCAPE_LIBS = @ESCAPE_LIBS@
189EVAS_CFLAGS = @EVAS_CFLAGS@
190EVAS_LIBS = @EVAS_LIBS@
191EVIL_CFLAGS = @EVIL_CFLAGS@
192EVIL_LIBS = @EVIL_LIBS@
193EXEEXT = @EXEEXT@
194EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
195EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@
199GLIB_LIBS = @GLIB_LIBS@
200GMSGFMT = @GMSGFMT@
201GMSGFMT_015 = @GMSGFMT_015@
202GREP = @GREP@
203INSTALL = @INSTALL@
204INSTALL_DATA = @INSTALL_DATA@
205INSTALL_PROGRAM = @INSTALL_PROGRAM@
206INSTALL_SCRIPT = @INSTALL_SCRIPT@
207INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
208INTLLIBS = @INTLLIBS@
209INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
210KEYSYMDEFS = @KEYSYMDEFS@
211LD = @LD@
212LDFLAGS = @LDFLAGS@
213LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
214LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
215LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
216LIBICONV = @LIBICONV@
217LIBINTL = @LIBINTL@
218LIBOBJS = @LIBOBJS@
219LIBS = @LIBS@
220LIBTOOL = @LIBTOOL@
221LIPO = @LIPO@
222LN_S = @LN_S@
223LTLIBICONV = @LTLIBICONV@
224LTLIBINTL = @LTLIBINTL@
225LTLIBOBJS = @LTLIBOBJS@
226MAKEINFO = @MAKEINFO@
227MKDIR_P = @MKDIR_P@
228MSGFMT = @MSGFMT@
229MSGFMT_015 = @MSGFMT_015@
230MSGMERGE = @MSGMERGE@
231NM = @NM@
232NMEDIT = @NMEDIT@
233OBJC = @OBJC@
234OBJCDEPMODE = @OBJCDEPMODE@
235OBJCFLAGS = @OBJCFLAGS@
236OBJDUMP = @OBJDUMP@
237OBJEXT = @OBJEXT@
238OTOOL = @OTOOL@
239OTOOL64 = @OTOOL64@
240PACKAGE = @PACKAGE@
241PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
242PACKAGE_NAME = @PACKAGE_NAME@
243PACKAGE_STRING = @PACKAGE_STRING@
244PACKAGE_TARNAME = @PACKAGE_TARNAME@
245PACKAGE_URL = @PACKAGE_URL@
246PACKAGE_VERSION = @PACKAGE_VERSION@
247PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@
251PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
252PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
253POSUB = @POSUB@
254RANLIB = @RANLIB@
255SCIM_CFLAGS = @SCIM_CFLAGS@
256SCIM_LIBS = @SCIM_LIBS@
257SDL_CFLAGS = @SDL_CFLAGS@
258SDL_CONFIG = @SDL_CONFIG@
259SDL_LIBS = @SDL_LIBS@
260SED = @SED@
261SET_MAKE = @SET_MAKE@
262SHELL = @SHELL@
263SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
264SSL_CFLAGS = @SSL_CFLAGS@
265SSL_LIBS = @SSL_LIBS@
266STRIP = @STRIP@
267TLS2_CFLAGS = @TLS2_CFLAGS@
268TLS2_LIBS = @TLS2_LIBS@
269TLS_CFLAGS = @TLS_CFLAGS@
270TLS_LIBS = @TLS_LIBS@
271TSLIB_CFLAGS = @TSLIB_CFLAGS@
272TSLIB_LIBS = @TSLIB_LIBS@
273USE_NLS = @USE_NLS@
274VERSION = @VERSION@
275VMAJ = @VMAJ@
276WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
277WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
278WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
279WAYLAND_LIBS = @WAYLAND_LIBS@
280WIN32_CFLAGS = @WIN32_CFLAGS@
281WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
282WIN32_LIBS = @WIN32_LIBS@
283XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
284XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
285XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
286XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
287XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
288XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
289XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
290XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
291XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
292XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
293XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
294XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
295XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
296XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
297XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
298XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
299XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
300XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
301XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
302XCB_X11_LIBS = @XCB_X11_LIBS@
303XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
304XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
305XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
306XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
307XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
308XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
309XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
310XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
311XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
312XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
313XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
314XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
315XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
316XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
317XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
318XDAMAGE_LIBS = @XDAMAGE_LIBS@
319XDPMS_CFLAGS = @XDPMS_CFLAGS@
320XDPMS_LIBS = @XDPMS_LIBS@
321XFIXES_CFLAGS = @XFIXES_CFLAGS@
322XFIXES_LIBS = @XFIXES_LIBS@
323XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
324XGESTURE_LIBS = @XGESTURE_LIBS@
325XGETTEXT = @XGETTEXT@
326XGETTEXT_015 = @XGETTEXT_015@
327XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
328XI2_CFLAGS = @XI2_CFLAGS@
329XI2_LIBS = @XI2_LIBS@
330XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
331XINERAMA_LIBS = @XINERAMA_LIBS@
332XKB_CFLAGS = @XKB_CFLAGS@
333XKB_LIBS = @XKB_LIBS@
334XMKMF = @XMKMF@
335XPRINT_CFLAGS = @XPRINT_CFLAGS@
336XPRINT_LIBS = @XPRINT_LIBS@
337XRANDR_CFLAGS = @XRANDR_CFLAGS@
338XRANDR_LIBS = @XRANDR_LIBS@
339XRENDER_CFLAGS = @XRENDER_CFLAGS@
340XRENDER_LIBS = @XRENDER_LIBS@
341XSS_CFLAGS = @XSS_CFLAGS@
342XSS_LIBS = @XSS_LIBS@
343XTEST_CFLAGS = @XTEST_CFLAGS@
344XTEST_LIBS = @XTEST_LIBS@
345X_CFLAGS = @X_CFLAGS@
346X_EXTRA_LIBS = @X_EXTRA_LIBS@
347X_LIBS = @X_LIBS@
348X_PRE_LIBS = @X_PRE_LIBS@
349Xcursor_cflags = @Xcursor_cflags@
350Xcursor_libs = @Xcursor_libs@
351abs_builddir = @abs_builddir@
352abs_srcdir = @abs_srcdir@
353abs_top_builddir = @abs_top_builddir@
354abs_top_srcdir = @abs_top_srcdir@
355ac_ct_CC = @ac_ct_CC@
356ac_ct_CXX = @ac_ct_CXX@
357ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
358ac_ct_OBJC = @ac_ct_OBJC@
359am__include = @am__include@
360am__leading_dot = @am__leading_dot@
361am__quote = @am__quote@
362am__tar = @am__tar@
363am__untar = @am__untar@
364bindir = @bindir@
365build = @build@
366build_alias = @build_alias@
367build_cpu = @build_cpu@
368build_os = @build_os@
369build_vendor = @build_vendor@
370builddir = @builddir@
371cocoa_ldflags = @cocoa_ldflags@
372datadir = @datadir@
373datarootdir = @datarootdir@
374dlopen_libs = @dlopen_libs@
375docdir = @docdir@
376dvidir = @dvidir@
377ecore_cocoa_cflags = @ecore_cocoa_cflags@
378ecore_cocoa_libs = @ecore_cocoa_libs@
379ecore_con_cflags = @ecore_con_cflags@
380ecore_con_libs = @ecore_con_libs@
381ecore_directfb_cflags = @ecore_directfb_cflags@
382ecore_directfb_libs = @ecore_directfb_libs@
383ecore_evas_cflags = @ecore_evas_cflags@
384ecore_evas_libs = @ecore_evas_libs@
385ecore_fb_cflags = @ecore_fb_cflags@
386ecore_fb_libs = @ecore_fb_libs@
387ecore_file_cflags = @ecore_file_cflags@
388ecore_file_libs = @ecore_file_libs@
389ecore_imf_cflags = @ecore_imf_cflags@
390ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
391ecore_imf_evas_libs = @ecore_imf_evas_libs@
392ecore_imf_libs = @ecore_imf_libs@
393ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
394ecore_imf_scim_libs = @ecore_imf_scim_libs@
395ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
396ecore_imf_xim_libs = @ecore_imf_xim_libs@
397ecore_input_cflags = @ecore_input_cflags@
398ecore_input_evas_cflags = @ecore_input_evas_cflags@
399ecore_input_evas_libs = @ecore_input_evas_libs@
400ecore_input_libs = @ecore_input_libs@
401ecore_ipc_cflags = @ecore_ipc_cflags@
402ecore_ipc_libs = @ecore_ipc_libs@
403ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
404ecore_psl1ght_libs = @ecore_psl1ght_libs@
405ecore_sdl_cflags = @ecore_sdl_cflags@
406ecore_sdl_libs = @ecore_sdl_libs@
407ecore_wayland_cflags = @ecore_wayland_cflags@
408ecore_wayland_libs = @ecore_wayland_libs@
409ecore_win32_cflags = @ecore_win32_cflags@
410ecore_win32_libs = @ecore_win32_libs@
411ecore_wince_cflags = @ecore_wince_cflags@
412ecore_wince_libs = @ecore_wince_libs@
413ecore_x_cflags = @ecore_x_cflags@
414ecore_x_libs = @ecore_x_libs@
415ecore_x_libs_private = @ecore_x_libs_private@
416efl_doxygen = @efl_doxygen@
417efl_have_doxygen = @efl_have_doxygen@
418exec_prefix = @exec_prefix@
419have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
420host = @host@
421host_alias = @host_alias@
422host_cpu = @host_cpu@
423host_os = @host_os@
424host_vendor = @host_vendor@
425htmldir = @htmldir@
426includedir = @includedir@
427infodir = @infodir@
428install_sh = @install_sh@
429libdir = @libdir@
430libexecdir = @libexecdir@
431localedir = @localedir@
432localstatedir = @localstatedir@
433lt_ECHO = @lt_ECHO@
434lt_enable_auto_import = @lt_enable_auto_import@
435mandir = @mandir@
436mkdir_p = @mkdir_p@
437oldincludedir = @oldincludedir@
438pdfdir = @pdfdir@
439pkgconfig_requires_private = @pkgconfig_requires_private@
440prefix = @prefix@
441program_transform_name = @program_transform_name@
442psdir = @psdir@
443release_info = @release_info@
444requirements_ecore = @requirements_ecore@
445requirements_ecore_cocoa = @requirements_ecore_cocoa@
446requirements_ecore_con = @requirements_ecore_con@
447requirements_ecore_directfb = @requirements_ecore_directfb@
448requirements_ecore_evas = @requirements_ecore_evas@
449requirements_ecore_fb = @requirements_ecore_fb@
450requirements_ecore_file = @requirements_ecore_file@
451requirements_ecore_imf = @requirements_ecore_imf@
452requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
453requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
454requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
455requirements_ecore_input = @requirements_ecore_input@
456requirements_ecore_input_evas = @requirements_ecore_input_evas@
457requirements_ecore_ipc = @requirements_ecore_ipc@
458requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
459requirements_ecore_sdl = @requirements_ecore_sdl@
460requirements_ecore_wayland = @requirements_ecore_wayland@
461requirements_ecore_win32 = @requirements_ecore_win32@
462requirements_ecore_wince = @requirements_ecore_wince@
463requirements_ecore_x = @requirements_ecore_x@
464rt_libs = @rt_libs@
465sbindir = @sbindir@
466sharedstatedir = @sharedstatedir@
467srcdir = @srcdir@
468sysconfdir = @sysconfdir@
469target_alias = @target_alias@
470top_build_prefix = @top_build_prefix@
471top_builddir = @top_builddir@
472top_srcdir = @top_srcdir@
473version_info = @version_info@
474x_cflags = @x_cflags@
475x_includes = @x_includes@
476x_libs = @x_libs@
477MAINTAINERCLEANFILES = Makefile.in
478AM_CPPFLAGS = \
479-I$(top_srcdir)/src/lib/ecore \
480-I$(top_srcdir)/src/lib/ecore_input \
481-I$(top_builddir)/src/lib/ecore \
482-I$(top_builddir)/src/lib/ecore_input \
483@EVAS_CFLAGS@ \
484@EINA_CFLAGS@
485
486lib_LTLIBRARIES = libecore_cocoa.la
487includes_HEADERS = \
488Ecore_Cocoa.h \
489Ecore_Cocoa_Keys.h
490
491includesdir = $(includedir)/ecore-@VMAJ@
492libecore_cocoa_la_SOURCES = \
493ecore_cocoa.m \
494ecore_cocoa_window.m
495
496libecore_cocoa_la_LIBADD = \
497$(top_builddir)/src/lib/ecore/libecore.la \
498$(top_builddir)/src/lib/ecore_input/libecore_input.la \
499@EVAS_LIBS@ \
500@EINA_LIBS@
501
502libecore_cocoa_la_LDFLAGS = @cocoa_ldflags@ -version-info @version_info@ @release_info@
503EXTRA_DIST = ecore_cocoa_private.h
504all: all-am
505
506.SUFFIXES:
507.SUFFIXES: .lo .m .o .obj
508$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
509 @for dep in $?; do \
510 case '$(am__configure_deps)' in \
511 *$$dep*) \
512 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
513 && { if test -f $@; then exit 0; else break; fi; }; \
514 exit 1;; \
515 esac; \
516 done; \
517 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_cocoa/Makefile'; \
518 $(am__cd) $(top_srcdir) && \
519 $(AUTOMAKE) --gnu src/lib/ecore_cocoa/Makefile
520.PRECIOUS: Makefile
521Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
522 @case '$?' in \
523 *config.status*) \
524 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
525 *) \
526 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
527 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
528 esac;
529
530$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
531 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
532
533$(top_srcdir)/configure: $(am__configure_deps)
534 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
535$(ACLOCAL_M4): $(am__aclocal_m4_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(am__aclocal_m4_deps):
538install-libLTLIBRARIES: $(lib_LTLIBRARIES)
539 @$(NORMAL_INSTALL)
540 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
541 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
542 list2=; for p in $$list; do \
543 if test -f $$p; then \
544 list2="$$list2 $$p"; \
545 else :; fi; \
546 done; \
547 test -z "$$list2" || { \
548 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
549 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
550 }
551
552uninstall-libLTLIBRARIES:
553 @$(NORMAL_UNINSTALL)
554 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
555 for p in $$list; do \
556 $(am__strip_dir) \
557 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
558 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
559 done
560
561clean-libLTLIBRARIES:
562 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
563 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
564 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
565 test "$$dir" != "$$p" || dir=.; \
566 echo "rm -f \"$${dir}/so_locations\""; \
567 rm -f "$${dir}/so_locations"; \
568 done
569libecore_cocoa.la: $(libecore_cocoa_la_OBJECTS) $(libecore_cocoa_la_DEPENDENCIES)
570 $(AM_V_OBJCLD)$(libecore_cocoa_la_LINK) -rpath $(libdir) $(libecore_cocoa_la_OBJECTS) $(libecore_cocoa_la_LIBADD) $(LIBS)
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_cocoa.Plo@am__quote@
579@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_cocoa_window.Plo@am__quote@
580
581.m.o:
582@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
583@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
584@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@
585@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
586@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
587@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $<
588
589.m.obj:
590@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
591@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
592@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@
593@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
594@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
595@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
596
597.m.lo:
598@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
599@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
600@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@
601@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
602@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
603@am__fastdepOBJC_FALSE@ $(LTOBJCCOMPILE) -c -o $@ $<
604
605mostlyclean-libtool:
606 -rm -f *.lo
607
608clean-libtool:
609 -rm -rf .libs _libs
610install-includesHEADERS: $(includes_HEADERS)
611 @$(NORMAL_INSTALL)
612 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
613 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
614 for p in $$list; do \
615 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
616 echo "$$d$$p"; \
617 done | $(am__base_list) | \
618 while read files; do \
619 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
620 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
621 done
622
623uninstall-includesHEADERS:
624 @$(NORMAL_UNINSTALL)
625 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
626 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
627 test -n "$$files" || exit 0; \
628 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
629 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
630
631ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
632 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
633 unique=`for i in $$list; do \
634 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
635 done | \
636 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
637 END { if (nonempty) { for (i in files) print i; }; }'`; \
638 mkid -fID $$unique
639tags: TAGS
640
641TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
642 $(TAGS_FILES) $(LISP)
643 set x; \
644 here=`pwd`; \
645 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
646 unique=`for i in $$list; do \
647 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
648 done | \
649 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
650 END { if (nonempty) { for (i in files) print i; }; }'`; \
651 shift; \
652 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
653 test -n "$$unique" || unique=$$empty_fix; \
654 if test $$# -gt 0; then \
655 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
656 "$$@" $$unique; \
657 else \
658 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
659 $$unique; \
660 fi; \
661 fi
662ctags: CTAGS
663CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
664 $(TAGS_FILES) $(LISP)
665 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
666 unique=`for i in $$list; do \
667 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
668 done | \
669 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
670 END { if (nonempty) { for (i in files) print i; }; }'`; \
671 test -z "$(CTAGS_ARGS)$$unique" \
672 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
673 $$unique
674
675GTAGS:
676 here=`$(am__cd) $(top_builddir) && pwd` \
677 && $(am__cd) $(top_srcdir) \
678 && gtags -i $(GTAGS_ARGS) "$$here"
679
680distclean-tags:
681 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
682
683distdir: $(DISTFILES)
684 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
685 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
686 list='$(DISTFILES)'; \
687 dist_files=`for file in $$list; do echo $$file; done | \
688 sed -e "s|^$$srcdirstrip/||;t" \
689 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
690 case $$dist_files in \
691 */*) $(MKDIR_P) `echo "$$dist_files" | \
692 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
693 sort -u` ;; \
694 esac; \
695 for file in $$dist_files; do \
696 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
697 if test -d $$d/$$file; then \
698 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
699 if test -d "$(distdir)/$$file"; then \
700 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
701 fi; \
702 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
703 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
704 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
705 fi; \
706 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
707 else \
708 test -f "$(distdir)/$$file" \
709 || cp -p $$d/$$file "$(distdir)/$$file" \
710 || exit 1; \
711 fi; \
712 done
713check-am: all-am
714check: check-am
715all-am: Makefile $(LTLIBRARIES) $(HEADERS)
716installdirs:
717 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
718 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
719 done
720install: install-am
721install-exec: install-exec-am
722install-data: install-data-am
723uninstall: uninstall-am
724
725install-am: all-am
726 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
727
728installcheck: installcheck-am
729install-strip:
730 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
731 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
732 `test -z '$(STRIP)' || \
733 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
734mostlyclean-generic:
735
736clean-generic:
737
738distclean-generic:
739 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
740 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
741
742maintainer-clean-generic:
743 @echo "This command is intended for maintainers to use"
744 @echo "it deletes files that may require special tools to rebuild."
745 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
746clean: clean-am
747
748clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
749 mostlyclean-am
750
751distclean: distclean-am
752 -rm -rf ./$(DEPDIR)
753 -rm -f Makefile
754distclean-am: clean-am distclean-compile distclean-generic \
755 distclean-tags
756
757dvi: dvi-am
758
759dvi-am:
760
761html: html-am
762
763html-am:
764
765info: info-am
766
767info-am:
768
769install-data-am: install-includesHEADERS
770
771install-dvi: install-dvi-am
772
773install-dvi-am:
774
775install-exec-am: install-libLTLIBRARIES
776
777install-html: install-html-am
778
779install-html-am:
780
781install-info: install-info-am
782
783install-info-am:
784
785install-man:
786
787install-pdf: install-pdf-am
788
789install-pdf-am:
790
791install-ps: install-ps-am
792
793install-ps-am:
794
795installcheck-am:
796
797maintainer-clean: maintainer-clean-am
798 -rm -rf ./$(DEPDIR)
799 -rm -f Makefile
800maintainer-clean-am: distclean-am maintainer-clean-generic
801
802mostlyclean: mostlyclean-am
803
804mostlyclean-am: mostlyclean-compile mostlyclean-generic \
805 mostlyclean-libtool
806
807pdf: pdf-am
808
809pdf-am:
810
811ps: ps-am
812
813ps-am:
814
815uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
816
817.MAKE: install-am install-strip
818
819.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
820 clean-libLTLIBRARIES clean-libtool ctags distclean \
821 distclean-compile distclean-generic distclean-libtool \
822 distclean-tags distdir dvi dvi-am html html-am info info-am \
823 install install-am install-data install-data-am install-dvi \
824 install-dvi-am install-exec install-exec-am install-html \
825 install-html-am install-includesHEADERS install-info \
826 install-info-am install-libLTLIBRARIES install-man install-pdf \
827 install-pdf-am install-ps install-ps-am install-strip \
828 installcheck installcheck-am installdirs maintainer-clean \
829 maintainer-clean-generic mostlyclean mostlyclean-compile \
830 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
831 tags uninstall uninstall-am uninstall-includesHEADERS \
832 uninstall-libLTLIBRARIES
833
834
835# Tell versions [3.59,3.63) of GNU make to not export all variables.
836# Otherwise a system limit (for SysV at least) may be exceeded.
837.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m
deleted file mode 100644
index 3f6023a..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m
+++ /dev/null
@@ -1,283 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Cocoa/Cocoa.h>
6
7#include <Eina.h>
8
9#include <Ecore.h>
10#include <ecore_private.h>
11#include <Ecore_Input.h>
12
13#include "Ecore_Cocoa.h"
14#include "Ecore_Cocoa_Keys.h"
15
16
17EAPI int ECORE_COCOA_EVENT_GOT_FOCUS = 0;
18EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0;
19EAPI int ECORE_COCOA_EVENT_RESIZE = 0;
20EAPI int ECORE_COCOA_EVENT_EXPOSE = 0;
21
22static int _ecore_cocoa_init_count = 0;
23
24static int old_flags;
25
26EAPI int
27ecore_cocoa_init(void)
28{
29 if (++_ecore_cocoa_init_count != 1)
30 return _ecore_cocoa_init_count;
31
32 if (!ecore_event_init())
33 return --_ecore_cocoa_init_count;
34
35 NSApplicationLoad();
36
37 ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new();
38 ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new();
39 ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new();
40 ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new();
41
42 return _ecore_cocoa_init_count;
43}
44
45/**
46 * Shuts down the Ecore_Cocoa library.
47 * @return @c The number of times the system has been initialised without
48 * being shut down.
49 * @ingroup Ecore_Cocoa_Library_Group
50 */
51EAPI int
52ecore_cocoa_shutdown(void)
53{
54 if (--_ecore_cocoa_init_count != 0)
55 return _ecore_cocoa_init_count;
56
57 ecore_event_shutdown();
58
59 return _ecore_cocoa_init_count;
60}
61
62EAPI void
63ecore_cocoa_feed_events(void)
64{
65 NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0.001];
66 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
67 untilDate:date
68 inMode:NSDefaultRunLoopMode
69 dequeue:YES];
70 [date release];
71 if (!event) return; // SDL loops until null; maybe we should do that too. or not.
72
73 unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
74
75 switch([event type])
76 {
77 case NSMouseMoved:
78 case NSLeftMouseDragged:
79 case NSRightMouseDragged:
80 case NSOtherMouseDragged:
81 {
82 Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
83 if (!ev) return;
84 ev->x = [event locationInWindow].x;
85 ev->y = [event locationInWindow].y;
86 ev->root.x = ev->x;
87 ev->root.y = ev->y;
88 ev->timestamp = time;
89 ev->window = [event window];
90 ev->modifiers = 0; /* FIXME: keep modifier around. */
91
92 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
93
94 [NSApp sendEvent:event]; // pass along mouse events, for window manager
95 break;
96 }
97 case NSLeftMouseDown:
98 case NSRightMouseDown:
99 case NSOtherMouseDown:
100 {
101 Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
102 if (!ev) return;
103 ev->x = [event locationInWindow].x;
104 ev->y = [event locationInWindow].y;
105 ev->root.x = ev->x;
106 ev->root.y = ev->y;
107 ev->timestamp = time;
108 ev->buttons = [event buttonNumber] + 1; // Apple indexes buttons from 0
109
110 if ([event clickCount] == 2)
111 ev->double_click = 1;
112 else
113 ev->double_click = 0;
114
115 if ([event clickCount] >= 3)
116 ev->triple_click = 1;
117 else
118 ev->triple_click = 0;
119
120 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
121
122 [NSApp sendEvent:event]; // pass along mouse events, for window manager
123 break;
124 }
125 case NSLeftMouseUp:
126 case NSRightMouseUp:
127 case NSOtherMouseUp:
128 {
129 Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
130 if (!ev) return;
131 ev->x = [event locationInWindow].x;
132 ev->y = [event locationInWindow].y;
133 ev->root.x = ev->x;
134 ev->root.y = ev->y;
135 ev->timestamp = time;
136 ev->buttons = [event buttonNumber] + 1; // Apple indexes buttons from 0
137
138 if ([event clickCount] == 2)
139 ev->double_click = 1;
140 else
141 ev->double_click = 0;
142
143 if ([event clickCount] >= 3)
144 ev->triple_click = 1;
145 else
146 ev->triple_click = 0;
147
148 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
149
150 [NSApp sendEvent:event]; // pass along mouse events, for window manager
151 break;
152 }
153 case NSKeyDown:
154 {
155 Ecore_Event_Key *ev;
156 unsigned int i;
157
158 ev = calloc(1, sizeof (Ecore_Event_Key));
159 if (!ev) return;
160 ev->timestamp = time;
161
162 for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i)
163 {
164 if (keystable[i].code == tolower([[event charactersIgnoringModifiers] characterAtIndex:0]))
165 {
166 ev->keyname = keystable[i].name;
167 ev->string = keystable[i].compose;
168
169 ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
170 return;
171 }
172 }
173
174 break;
175 }
176 case NSKeyUp:
177 {
178 Ecore_Event_Key *ev;
179 unsigned int i;
180
181 ev = calloc(1, sizeof (Ecore_Event_Key));
182 if (!ev) return;
183 ev->timestamp = time;
184
185 for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i)
186 {
187 if (keystable[i].code == tolower([[event charactersIgnoringModifiers] characterAtIndex:0]))
188 {
189 ev->keyname = keystable[i].name;
190 ev->string = keystable[i].compose;
191
192 ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
193 return;
194 }
195 }
196
197 break;
198 }
199 case NSFlagsChanged:
200 {
201 int flags = [event modifierFlags];
202
203 Ecore_Event_Key *evDown = NULL;
204 Ecore_Event_Key *evUp = NULL;
205
206 evDown = calloc(1, sizeof (Ecore_Event_Key));
207 if (!evDown) return;
208
209 evUp = calloc(1, sizeof (Ecore_Event_Key));
210 if (!evUp)
211 {
212 free(evDown);
213 return;
214 }
215
216 // Turn special key flags on
217 if (flags & NSShiftKeyMask)
218 evDown->keyname = "Shift_L";
219 else if (flags & NSControlKeyMask)
220 evDown->keyname = "Control_L";
221 else if (flags & NSAlternateKeyMask)
222 evDown->keyname = "Alt_L";
223 else if (flags & NSCommandKeyMask)
224 evDown->keyname = "Super_L";
225 else if (flags & NSAlphaShiftKeyMask)
226 evDown->keyname = "Caps_Lock";
227
228 if (evDown->keyname)
229 {
230 evDown->timestamp = time;
231 evDown->string = "";
232 ecore_event_add(ECORE_EVENT_KEY_DOWN, evDown, NULL, NULL);
233 old_flags = flags;
234 break;
235 }
236
237 int changed_flags = flags ^ old_flags;
238
239 // Turn special key flags off
240 if (changed_flags & NSShiftKeyMask)
241 evUp->keyname = "Shift_L";
242 else if (changed_flags & NSControlKeyMask)
243 evUp->keyname = "Control_L";
244 else if (changed_flags & NSAlternateKeyMask)
245 evUp->keyname = "Alt_L";
246 else if (changed_flags & NSCommandKeyMask)
247 evUp->keyname = "Super_L";
248 else if (changed_flags & NSAlphaShiftKeyMask)
249 evUp->keyname = "Caps_Lock";
250
251 if (evUp->keyname)
252 {
253 evUp->timestamp = time;
254 evUp->string = "";
255 ecore_event_add(ECORE_EVENT_KEY_UP, evUp, NULL, NULL);
256 old_flags = flags;
257 break;
258 }
259
260 break;
261 }
262 case NSAppKitDefined:
263 {
264 if ([event subtype] == NSApplicationActivatedEventType)
265 ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, NULL, NULL, NULL);
266 else if ([event subtype] == NSApplicationDeactivatedEventType)
267 ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, NULL, NULL, NULL);
268 [NSApp sendEvent:event]; // pass along AppKit events, for window manager
269 break;
270 }
271 case NSScrollWheel:
272 {
273 break;
274 }
275 default:
276 {
277 [NSApp sendEvent:event];
278 break;
279 }
280 }
281
282 [event release];
283}
diff --git a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h
deleted file mode 100644
index 0b4cf31..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _ECORE_COCOA_PRIVATE_H
2#define _ECORE_COCOA_PRIVATE_H
3
4struct _Ecore_Cocoa_Window
5{
6 NSWindow *window;
7 unsigned int borderless : 1;
8};
9
10
11#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
deleted file mode 100644
index 2091a69..0000000
--- a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m
+++ /dev/null
@@ -1,163 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Cocoa/Cocoa.h>
6
7#include "Ecore_Cocoa.h"
8#include "ecore_cocoa_private.h"
9
10Ecore_Cocoa_Window *
11ecore_cocoa_window_new(int x,
12 int y,
13 int width,
14 int height)
15{
16 Ecore_Cocoa_Window *w;
17
18 NSWindow *window = [[NSWindow alloc]
19 initWithContentRect:NSMakeRect(x, y, width, height)
20 styleMask:(NSTitledWindowMask |
21 NSClosableWindowMask |
22 NSResizableWindowMask |
23 NSMiniaturizableWindowMask)
24 backing:NSBackingStoreBuffered
25 defer:NO
26 screen:nil
27 ];
28
29 if (!window)
30 return NULL;
31
32 [window setBackgroundColor:[NSColor whiteColor]];
33
34 w = calloc(1, sizeof(Ecore_Cocoa_Window));
35 w->window = window;
36 w->borderless = 0;
37
38 return w;
39}
40
41void
42ecore_cocoa_window_free(Ecore_Cocoa_Window *window)
43{
44 if (!window)
45 return;
46
47 [window->window release];
48 free(window);
49}
50
51void
52ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
53 int x,
54 int y)
55{
56 NSRect win_frame;
57
58 if (!window)
59 return;
60
61 win_frame = [window->window frame];
62 win_frame.origin.x = x;
63 win_frame.origin.y = y;
64
65 [window->window setFrame:win_frame display:YES];
66}
67
68void
69ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
70 int width,
71 int height)
72{
73 if (!window)
74 return;
75
76 NSRect win_frame;
77
78 if (!window)
79 return;
80
81 win_frame = [window->window frame];
82 win_frame.size.height = height;
83 win_frame.size.width = width;
84
85 [window->window setFrame:win_frame display:YES];
86}
87
88void
89ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
90 int x,
91 int y,
92 int width,
93 int height)
94{
95 if (!window)
96 return;
97
98 NSRect win_frame;
99
100 if (!window)
101 return;
102
103 win_frame = [window->window frame];
104 win_frame.size.height = height;
105 win_frame.size.width = width;
106 win_frame.origin.x = x;
107 win_frame.origin.y = y;
108
109 [window->window setFrame:win_frame display:YES];
110}
111
112void
113ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, const char *title)
114{
115 if (!window || !title)
116 return;
117
118 [window->window setTitle:[NSString stringWithUTF8String:title]];
119}
120
121void
122ecore_cocoa_window_show(Ecore_Cocoa_Window *window)
123{
124 if (!window || [window->window isVisible])
125 {
126 printf("Window(%p) is not visible\n", window->window);
127 return;
128 }
129
130 [window->window makeKeyAndOrderFront:NSApp];
131}
132
133void
134ecore_cocoa_window_hide(Ecore_Cocoa_Window *window)
135{
136 if (!window || ![window->window isVisible])
137 return;
138
139 [window->window orderOut:NSApp];
140}
141
142void
143ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
144 int on)
145{
146 if (!window)
147 return;
148
149 if (on)
150 [window->window setContentBorderThickness:0.0
151 forEdje:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge];
152}
153
154void
155ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
156 void *view)
157{
158 if (!window || !view)
159 return;
160
161 [[window->window contentView] addSubview:view];
162
163}
diff --git a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h
deleted file mode 100644
index d0ca6f6..0000000
--- a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h
+++ /dev/null
@@ -1,1938 +0,0 @@
1#ifndef _ECORE_CON_H
2#define _ECORE_CON_H
3
4#include <time.h>
5#include <libgen.h>
6#ifdef _WIN32
7# include <ws2tcpip.h>
8#else
9# include <netdb.h>
10#endif
11#include <Eina.h>
12
13#ifdef EAPI
14# undef EAPI
15#endif
16
17#ifdef _WIN32
18# ifdef EFL_ECORE_CON_BUILD
19# ifdef DLL_EXPORT
20# define EAPI __declspec(dllexport)
21# else
22# define EAPI
23# endif
24# else
25# define EAPI __declspec(dllimport)
26# endif
27#else
28# ifdef __GNUC__
29# if __GNUC__ >= 4
30# define EAPI __attribute__ ((visibility("default")))
31# else
32# define EAPI
33# endif
34# else
35# define EAPI
36# endif
37#endif
38
39/**
40 * @defgroup Ecore_Con_Group Ecore_Con - Connection functions
41 *
42 * The Ecore Connection Library ( @c Ecore_Con ) provides simple mechanisms
43 * for communications between programs using reliable sockets. It saves
44 * the programmer from having to worry about file descriptors and waiting
45 * for incoming connections.
46 *
47 * There are two main objects in the @c Ecore_Con library: the @c
48 * Ecore_Con_Server and the @c Ecore_Con_Client.
49 *
50 * The @c Ecore_Con_Server represents a server that can be connected to.
51 * It is used regardless of whether the program is acting as a server or
52 * client itself.
53 *
54 * To create a listening server call @c ecore_con_server_add(), optionally using
55 * an ECORE_CON_USE_* encryption type OR'ed with the type for encryption.
56 *
57 * To connect to a server, call @c ecore_con_server_connect(). Data can
58 * then be sent to the server using the @c ecore_con_server_send().
59 *
60 * Functions are described in the following groupings:
61 * @li @ref Ecore_Con_Lib_Group
62 * @li @ref Ecore_Con_Server_Group
63 * @li @ref Ecore_Con_Client_Group
64 * @li @ref Ecore_Con_Url_Group
65 *
66 * Events are described in @ref Ecore_Con_Events_Group.
67 */
68
69
70/**
71 * @defgroup Ecore_Con_Events_Group Events
72 *
73 * @li ECORE_CON_CLIENT_ADD: Whenever a client connection is made to an
74 * @c Ecore_Con_Server, an event of this type is emitted, allowing the
75 * retrieval of the client's ip with @ref ecore_con_client_ip_get and
76 * associating data with the client using ecore_con_client_data_set.
77 * @li ECORE_CON_EVENT_CLIENT_DEL: Whenever a client connection to an
78 * @c Ecore_Con_Server, an event of this type is emitted. The contents of
79 * the data with this event are variable, but if the client object in the data
80 * is non-null, it must be freed with @ref ecore_con_client_del.
81 * @li ECORE_CON_EVENT_SERVER_ADD: Whenever a server object is created
82 * with @ref ecore_con_server_connect, an event of this type is emitted,
83 * allowing for data to be serialized and sent to the server using
84 * @ref ecore_con_server_send. At this point, the http handshake has
85 * occurred.
86 * @li ECORE_CON_EVENT_SERVER_DEL: Whenever a server object is destroyed,
87 * usually by the server connection being refused or dropped, an event of this
88 * type is emitted. The contents of the data with this event are variable,
89 * but if the server object in the data is non-null, it must be freed
90 * with @ref ecore_con_server_del.
91 * @li ECORE_CON_EVENT_CLIENT_DATA: Whenever a client connects to your server
92 * object and sends data, an event of this type is emitted. The data will contain both
93 * the size and contents of the message sent by the client. It should be noted that
94 * data within this object is transient, so it must be duplicated in order to be
95 * retained. This event will continue to occur until the client has stopped sending its
96 * message, so a good option for storing this data is an Eina_Strbuf. Once the message has
97 * been received in full, the client object must be freed with ecore_con_client_free.
98 * @li ECORE_CON_EVENT_SERVER_DATA: Whenever your server object connects to its destination
99 * and receives data, an event of this type is emitted. The data will contain both
100 * the size and contents of the message sent by the server. It should be noted that
101 * data within this object is transient, so it must be duplicated in order to be
102 * retained. This event will continue to occur until the server has stopped sending its
103 * message, so a good option for storing this data is an Eina_Strbuf. Once the message has
104 * been received in full, the server object must be freed with ecore_con_server_free.
105 *
106 */
107
108/**
109 * @defgroup Ecore_Con_Buffer Buffering
110 *
111 * As Ecore_Con works on an event driven design, as data arrives, events will
112 * be produced containing the data that arrived. It is up to the user of
113 * Ecore_Con to either parse as they go, append to a file to later parse the
114 * whole file in one go, or append to memory to parse or handle leter.
115 *
116 * To help with this Eina has some handy API's. The Eina_Binbuf and
117 * Eina_Strbuf APIs, abstract dynamic buffer management and make it trivial
118 * to handle buffers at runtime, without having to manage them. Eina_Binbuf
119 * makes it possible to create, expand, reset and slice a blob of memory -
120 * all via API. No system calls, no pointer manipulations and no size
121 * calculation.
122 *
123 * Additional functions include adding content at specified byte positions in
124 * the buffer, escaping the inputs, find and replace strings. This provides
125 * extreme flexibility to play around, with a dynamic blob of memory.
126 *
127 * It is good to free it (using eina_binbuf_free()) after using it.
128 *
129 * Eina_Binbuf compliments Ecore_Con use cases, where dynamic sizes of data
130 * arrive from the network (think http download in chunks). Using
131 * Eina_Binbuf provides enough flexibility to handle data as it arrives and
132 * to defer its processing until desired, without having to think about
133 * where to store the temporary data and how to manage its size.
134 *
135 * An example of how to use these with Ecore_Con follows.
136 *
137 * @code
138 * #include <Eina.h>
139 * #include <Ecore.h>
140 * #include <Ecore_Con.h>
141 *
142 * static Eina_Bool
143 * data_callback(void *data, int type, void *event)
144 * {
145 * Ecore_Con_Event_Url_Data *url_data = event;
146 * if ( url_data->size > 0)
147 * {
148 * // append data as it arrives - don't worry where or how it gets stored.
149 * // Also don't worry about size, expanding, reallocing etc.
150 * // just keep appending - size is automatically handled.
151 *
152 * eina_binbuf_append_length(data, url_data->data, url_data->size);
153 *
154 * fprintf(stderr, "Appended %d \n", url_data->size);
155 * }
156 * return EINA_TRUE;
157 * }
158 *
159 *
160 *
161 * static Eina_Bool
162 * completion_callback(void *data, int type, void *event)
163 * {
164 * Ecore_Con_Event_Url_Complete *url_complete = event;
165 * printf("download completed with status code: %d\n", url_complete->status);
166 *
167 * // get the data back from Eina_Binbuf
168 * char *ptr = eina_binbuf_string_get(data);
169 * size_t size = eina_binbuf_length_get(data);
170 *
171 * // process data as required (write to file)
172 * fprintf(stderr, "Size of data = %d bytes\n", size);
173 * int fd = open("./elm.png", O_CREAT);
174 * write(fd, ptr, size);
175 * close(fd);
176 *
177 * // free it when done.
178 * eina_binbuf_free(data);
179 *
180 * ecore_main_loop_quit();
181 *
182 * return EINA_TRUE;
183 * }
184 *
185 *
186 * int
187 * main(int argc, char **argv)
188 * {
189 *
190 * const char *url = "http://www.enlightenment.org/p/index/d/logo.png";
191 *
192 * ecore_init();
193 * ecore_con_init();
194 * ecore_con_url_init();
195 *
196 *
197 * // This is single additional line to manage dynamic network data.
198 * Eina_Binbuf *data = eina_binbuf_new();
199 * Ecore_Con_Url *url_con = ecore_con_url_new(url);
200 *
201 * ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,
202 * completion_callback,
203 * data);
204 * ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA,
205 * data_callback,
206 * data);
207 * ecore_con_url_get(url_con);
208 *
209 * ecore_main_loop_begin();
210 * return 0;
211 * }
212 * @endcode
213 */
214
215#ifdef __cplusplus
216extern "C" {
217#endif
218#define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2
219#define ECORE_CON_REMOTE_SYSTEM ECORE_CON_REMOTE_TCP
220
221
222/**
223 * @typedef Ecore_Con_Server
224 * A connection handle to a server
225 * @ingroup Ecore_Con_Server_Group
226 */
227typedef struct _Ecore_Con_Server Ecore_Con_Server;
228
229/**
230 * @typedef Ecore_Con_Client
231 * A connection handle to a client
232 * @ingroup Ecore_Con_Client_Group
233 */
234typedef struct _Ecore_Con_Client Ecore_Con_Client;
235
236/**
237 * @typedef Ecore_Con_Socks
238 * An object representing a SOCKS proxy
239 * @ingroup Ecore_Con_Socks_Group
240 * @since 1.2
241 */
242typedef struct Ecore_Con_Socks Ecore_Con_Socks;
243
244/**
245 * @typedef Ecore_Con_Url
246 * A handle to an http upload/download object
247 * @ingroup Ecore_Con_Url_Group
248 */
249typedef struct _Ecore_Con_Url Ecore_Con_Url;
250
251
252/**
253 * @addtogroup Ecore_Con_Events_Group Events
254 * @{
255 */
256
257/**
258 * @typedef Ecore_Con_Event_Client_Add
259 * Used as the @p data param for the corresponding event
260 */
261typedef struct _Ecore_Con_Event_Client_Add Ecore_Con_Event_Client_Add;
262
263/**
264 * @typedef Ecore_Con_Event_Client_Upgrade
265 * Used as the @p data param for the corresponding event
266 * @since 1.1
267 */
268typedef struct _Ecore_Con_Event_Client_Upgrade Ecore_Con_Event_Client_Upgrade;
269
270/**
271 * @typedef Ecore_Con_Event_Client_Del
272 * Used as the @p data param for the corresponding event
273 */
274typedef struct _Ecore_Con_Event_Client_Del Ecore_Con_Event_Client_Del;
275
276/**
277 * @typedef Ecore_Con_Event_Client_Error
278 * Used as the @p data param for the corresponding event
279 * @since 1.1
280 */
281typedef struct _Ecore_Con_Event_Client_Error Ecore_Con_Event_Client_Error;
282
283/**
284 * @typedef Ecore_Con_Event_Server_Add
285 * Used as the @p data param for the corresponding event
286 */
287typedef struct _Ecore_Con_Event_Server_Add Ecore_Con_Event_Server_Add;
288
289/**
290 * @typedef Ecore_Con_Event_Server_Upgrade
291 * Used as the @p data param for the corresponding event
292 * @since 1.1
293 */
294typedef struct _Ecore_Con_Event_Server_Upgrade Ecore_Con_Event_Server_Upgrade;
295
296/**
297 * @typedef Ecore_Con_Event_Server_Del
298 * Used as the @p data param for the corresponding event
299 */
300typedef struct _Ecore_Con_Event_Server_Del Ecore_Con_Event_Server_Del;
301
302/**
303 * @typedef Ecore_Con_Event_Server_Error
304 * Used as the @p data param for the corresponding event
305 * @since 1.1
306 */
307typedef struct _Ecore_Con_Event_Server_Error Ecore_Con_Event_Server_Error;
308
309/**
310 * @typedef Ecore_Con_Event_Client_Data
311 * Used as the @p data param for the corresponding event
312 */
313typedef struct _Ecore_Con_Event_Client_Data Ecore_Con_Event_Client_Data;
314
315/**
316 * @typedef Ecore_Con_Event_Server_Data
317 * Used as the @p data param for the corresponding event
318 */
319typedef struct _Ecore_Con_Event_Server_Data Ecore_Con_Event_Server_Data;
320
321/**
322 * @typedef Ecore_Con_Event_Client_Write
323 * Used as the @p data param for the corresponding event
324 * @since 1.1
325 */
326typedef struct _Ecore_Con_Event_Client_Write Ecore_Con_Event_Client_Write;
327
328/**
329 * @typedef Ecore_Con_Event_Server_Write
330 * Used as the @p data param for the corresponding event
331 * @since 1.1
332 */
333typedef struct _Ecore_Con_Event_Server_Write Ecore_Con_Event_Server_Write;
334
335/**
336 * @typedef Ecore_Con_Event_Proxy_Bind
337 * Used as the @p data param for the corresponding event
338 * @since 1.2
339 */
340typedef struct _Ecore_Con_Event_Proxy_Bind Ecore_Con_Event_Proxy_Bind;
341
342/**
343 * @typedef Ecore_Con_Event_Url_Data
344 * Used as the @p data param for the corresponding event
345 * @ingroup Ecore_Con_Url_Group
346 */
347typedef struct _Ecore_Con_Event_Url_Data Ecore_Con_Event_Url_Data;
348
349/**
350 * @typedef Ecore_Con_Event_Url_Complete
351 * Used as the @p data param for the corresponding event
352 * @ingroup Ecore_Con_Url_Group
353 */
354typedef struct _Ecore_Con_Event_Url_Complete Ecore_Con_Event_Url_Complete;
355
356/**
357 * @typedef Ecore_Con_Event_Url_Progress
358 * Used as the @p data param for the corresponding event
359 * @ingroup Ecore_Con_Url_Group
360 */
361typedef struct _Ecore_Con_Event_Url_Progress Ecore_Con_Event_Url_Progress;
362
363/**
364 * @struct _Ecore_Con_Event_Client_Add
365 * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_ADD event
366 */
367struct _Ecore_Con_Event_Client_Add
368{
369 Ecore_Con_Client *client; /** the client that connected */
370};
371
372/**
373 * @struct _Ecore_Con_Event_Client_Upgrade
374 * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_UPGRADE event
375 * @since 1.1
376 */
377struct _Ecore_Con_Event_Client_Upgrade
378{
379 Ecore_Con_Client *client; /** the client that completed handshake */
380};
381
382/**
383 * @struct _Ecore_Con_Event_Client_Del
384 * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_DEL event
385 */
386struct _Ecore_Con_Event_Client_Del
387{
388 Ecore_Con_Client *client; /** the client that was lost */
389};
390
391/**
392 * @struct _Ecore_Con_Event_Client_Error
393 * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_ERROR event
394 */
395struct _Ecore_Con_Event_Client_Error
396{
397 Ecore_Con_Client *client; /** the client for which an error occurred */
398 char *error; /**< the error string describing what happened */
399};
400
401/**
402 * @struct _Ecore_Con_Event_Server_Add
403 * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_ADD event
404 */
405struct _Ecore_Con_Event_Server_Add
406{
407 Ecore_Con_Server *server; /** the server that was connected to */
408};
409
410/**
411 * @struct _Ecore_Con_Event_Server_Upgrade
412 * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_UPGRADE event
413 * @since 1.1
414 */
415struct _Ecore_Con_Event_Server_Upgrade
416{
417 Ecore_Con_Server *server; /** the server that was connected to */
418};
419
420/**
421 * @struct _Ecore_Con_Event_Server_Del
422 * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_DEL event
423 */
424struct _Ecore_Con_Event_Server_Del
425{
426 Ecore_Con_Server *server; /** the client that was lost */
427};
428
429/**
430 * @struct _Ecore_Con_Event_Server_Error
431 * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_ERROR event
432 */
433struct _Ecore_Con_Event_Server_Error
434{
435 Ecore_Con_Server *server; /** the server for which an error occurred */
436 char *error; /**< the error string describing what happened */
437};
438
439/**
440 * @struct _Ecore_Con_Event_Client_Data
441 * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_DATA event
442 */
443struct _Ecore_Con_Event_Client_Data
444{
445 Ecore_Con_Client *client; /**< the client that connected */
446 void *data; /**< the data that the client sent */
447 int size; /**< the length of the data sent */
448};
449
450/**
451 * @struct _Ecore_Con_Event_Server_Data
452 * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_DATA event
453 */
454struct _Ecore_Con_Event_Server_Data
455{
456 Ecore_Con_Server *server; /**< the server that was connected to */
457 void *data; /**< the data that the server sent */
458 int size; /**< the length of the data sent */
459};
460
461/**
462 * @struct _Ecore_Con_Event_Client_Write
463 * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_WRITE event
464 */
465struct _Ecore_Con_Event_Client_Write
466{
467 Ecore_Con_Client *client; /**< the client that connected */
468 int size; /**< the length of the data sent */
469};
470
471/**
472 * @struct _Ecore_Con_Event_Server_Write
473 * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_WRITE event
474 */
475struct _Ecore_Con_Event_Server_Write
476{
477 Ecore_Con_Server *server; /**< the server that was connected to */
478 int size; /**< the length of the data sent */
479};
480
481/**
482 * @struct _Ecore_Con_Event_Proxy_Bind
483 * Used as the @p data param for the @ref ECORE_CON_EVENT_PROXY_BIND event
484 * @ingroup Ecore_Con_Socks_Group
485 * @since 1.2
486 */
487struct _Ecore_Con_Event_Proxy_Bind
488{
489 Ecore_Con_Server *server; /**< the server object connected to the proxy */
490 const char *ip; /**< the proxy-bound ip address */
491 int port; /**< the proxy-bound port */
492};
493
494/**
495 * @struct _Ecore_Con_Event_Url_Data
496 * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_DATA event
497 * @ingroup Ecore_Con_Url_Group
498 */
499struct _Ecore_Con_Event_Url_Data
500{
501 Ecore_Con_Url *url_con; /**< a pointer to the connection object */
502 int size; /**< the size of the current received data (in bytes) */
503 unsigned char data[1]; /**< the data received on this event */
504};
505
506/**
507 * @struct _Ecore_Con_Event_Url_Complete
508 * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_COMPLETE event
509 * @ingroup Ecore_Con_Url_Group
510 */
511struct _Ecore_Con_Event_Url_Complete
512{
513 Ecore_Con_Url *url_con; /**< a pointer to the connection object */
514 int status; /**< HTTP status code of the operation (200, 404, 401, etc.) */
515};
516
517/**
518 * @struct _Ecore_Con_Event_Url_Progress
519 * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_PROGRESS event
520 * @ingroup Ecore_Con_Url_Group
521 */
522struct _Ecore_Con_Event_Url_Progress
523{
524 Ecore_Con_Url *url_con; /**< a pointer to the connection object */
525 struct
526 {
527 double total; /**< total size of the downloading data (in bytes) */
528 double now; /**< current size of the downloading data (in bytes) */
529 } down; /**< download info */
530 struct
531 {
532 double total; /**< total size of the uploading data (in bytes) */
533 double now; /**< current size of the uploading data (in bytes) */
534 } up; /**< upload info */
535};
536
537/** A client has connected to the server */
538EAPI extern int ECORE_CON_EVENT_CLIENT_ADD;
539/** A client has disconnected from the server */
540EAPI extern int ECORE_CON_EVENT_CLIENT_DEL;
541/** A client experienced an error
542 * @since 1.1
543 */
544EAPI extern int ECORE_CON_EVENT_CLIENT_ERROR;
545/** A client connection has been upgraded to SSL
546 * @since 1.1
547 */
548EAPI extern int ECORE_CON_EVENT_CLIENT_UPGRADE;
549/** A server was created */
550EAPI extern int ECORE_CON_EVENT_SERVER_ADD;
551/** A server connection was lost */
552EAPI extern int ECORE_CON_EVENT_SERVER_DEL;
553/** A server experienced an error
554 * @since 1.1
555 */
556EAPI extern int ECORE_CON_EVENT_SERVER_ERROR;
557/** A server connection has been upgraded to SSL
558 * @since 1.1
559 */
560EAPI extern int ECORE_CON_EVENT_SERVER_UPGRADE;
561/** A server connection has sent data to its client
562 * @since 1.1
563 */
564EAPI extern int ECORE_CON_EVENT_CLIENT_WRITE;
565/** A server connection object has sent data
566 * @since 1.1
567 */
568EAPI extern int ECORE_CON_EVENT_SERVER_WRITE;
569/** A client connected to the server has sent data */
570EAPI extern int ECORE_CON_EVENT_CLIENT_DATA;
571/** A server connection object has data */
572EAPI extern int ECORE_CON_EVENT_SERVER_DATA;
573/** A server connection has successfully negotiated an ip:port binding
574 * @since 1.2
575 */
576EAPI extern int ECORE_CON_EVENT_PROXY_BIND;
577/** A URL object has data */
578EAPI extern int ECORE_CON_EVENT_URL_DATA;
579/** A URL object has completed its transfer to and from the server and can be reused */
580EAPI extern int ECORE_CON_EVENT_URL_COMPLETE;
581/** A URL object has made progress in its transfer */
582EAPI extern int ECORE_CON_EVENT_URL_PROGRESS;
583
584/**
585 * @}
586 */
587
588/**
589 * @defgroup Ecore_Con_Lib_Group Ecore Connection Library Functions
590 *
591 * Utility functions that set up and shut down the Ecore Connection
592 * library.
593 *
594 * There's also ecore_con_lookup() that can be used to make simple asynchronous
595 * DNS lookups.
596 *
597 * A simple example of how to use these functions:
598 * @li @ref ecore_con_lookup_example_c
599 *
600 * @{
601 */
602
603/**
604 * @typedef Ecore_Con_Dns_Cb
605 * A callback type for use with @ref ecore_con_lookup.
606 */
607typedef void (*Ecore_Con_Dns_Cb)(const char *canonname,
608 const char *ip,
609 struct sockaddr *addr,
610 int addrlen,
611 void *data);
612
613/**
614 * @typedef Ecore_Con_Type
615 * @enum _Ecore_Con_Type
616 * Types for an ecore_con client/server object. A correct way to set this type is
617 * with an ECORE_CON_$TYPE, optionally OR'ed with an ECORE_CON_$USE if encryption is desired,
618 * and LOAD_CERT if the previously loaded certificate should be used.
619 * @code
620 * ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT
621 * @endcode
622 * @ingroup Ecore_Con_Server_Group
623 */
624typedef enum _Ecore_Con_Type
625{
626 /** Socket in ~/.ecore */
627 ECORE_CON_LOCAL_USER = 0,
628 /** Socket in /tmp */
629 ECORE_CON_LOCAL_SYSTEM = 1,
630 /** Abstract socket */
631 ECORE_CON_LOCAL_ABSTRACT = 2,
632 /** Remote server using TCP */
633 ECORE_CON_REMOTE_TCP = 3,
634 /** Remote multicast server */
635 ECORE_CON_REMOTE_MCAST = 4,
636 /** Remote server using UDP */
637 ECORE_CON_REMOTE_UDP = 5,
638 /** Remote broadcast using UDP */
639 ECORE_CON_REMOTE_BROADCAST = 6,
640 /** Remote connection sending packets immediately */
641 ECORE_CON_REMOTE_NODELAY = 7,
642 /** Remote connection sending data in large chunks
643 * @note Only available on Linux
644 * @since 1.2
645 */
646 ECORE_CON_REMOTE_CORK = 8,
647 /** Use SSL2: UNSUPPORTED. **/
648 ECORE_CON_USE_SSL2 = (1 << 4),
649 /** Use SSL3 */
650 ECORE_CON_USE_SSL3 = (1 << 5),
651 /** Use TLS */
652 ECORE_CON_USE_TLS = (1 << 6),
653 /** Use both TLS and SSL3 */
654 ECORE_CON_USE_MIXED = ECORE_CON_USE_SSL3 | ECORE_CON_USE_TLS,
655 /** Attempt to use the loaded certificate */
656 ECORE_CON_LOAD_CERT = (1 << 7)
657} Ecore_Con_Type;
658
659/**
660 * Initialises the Ecore_Con library.
661 * @return Number of times the library has been initialised without being
662 * shut down.
663 *
664 * @note This function already calls ecore_init() internally, so you don't need
665 * to call it explicitly.
666 */
667EAPI int ecore_con_init(void);
668
669/**
670 * Shuts down the Ecore_Con library.
671 * @return Number of times the library has been initialised without being
672 * shut down.
673 * @note This function already calls ecore_shutdown() internally, so you don't
674 * need to call it explicitly unless you called ecore_init() explicitly too.
675 */
676EAPI int ecore_con_shutdown(void);
677
678/**
679 * Do an asynchronous DNS lookup.
680 *
681 * @param name IP address or server name to translate.
682 * @param done_cb Callback to notify when done.
683 * @param data User data to be given to done_cb.
684 * @return EINA_TRUE if the request did not fail to be set up, EINA_FALSE if it
685 * failed.
686 *
687 * This function performs a DNS lookup on the hostname specified by @p name,
688 * then calls @p done_cb with the result and the @p data given as parameter.
689 * The result will be given to the @p done_cb as follows:
690 * @li @c canonname - the canonical name of the address
691 * @li @c ip - the resolved ip address
692 * @li @c addr - a pointer to the socket address
693 * @li @c addrlen - the length of the socket address, in bytes
694 * @li @c data - the data pointer given as parameter to ecore_con_lookup()
695 */
696EAPI Eina_Bool ecore_con_lookup(const char *name,
697 Ecore_Con_Dns_Cb done_cb,
698 const void *data);
699
700/**
701 * @}
702 */
703
704/**
705 * @defgroup Ecore_Con_SSL_Group Ecore Connection SSL Functions
706 *
707 * @{
708 */
709EAPI int ecore_con_ssl_available_get(void);
710EAPI Eina_Bool ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr, const char *cert);
711EAPI Eina_Bool ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr, const char *key_file);
712EAPI Eina_Bool ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr, const char *crl_file);
713EAPI Eina_Bool ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr, const char *ca_file);
714EAPI void ecore_con_ssl_server_verify(Ecore_Con_Server *svr);
715EAPI void ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr);
716EAPI void ecore_con_ssl_server_verify_name_set(Ecore_Con_Server *svr, const char *name);
717EAPI const char *ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr);
718EAPI Eina_Bool ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type compl_type);
719EAPI Eina_Bool ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type compl_type);
720
721/**
722 * @}
723 */
724
725EAPI Ecore_Con_Socks *ecore_con_socks4_remote_add(const char *ip, int port, const char *username);
726EAPI Eina_Bool ecore_con_socks4_remote_exists(const char *ip, int port, const char *username);
727EAPI void ecore_con_socks4_remote_del(const char *ip, int port, const char *username);
728EAPI Ecore_Con_Socks *ecore_con_socks5_remote_add(const char *ip, int port, const char *username, const char *password);
729EAPI Eina_Bool ecore_con_socks5_remote_exists(const char *ip, int port, const char *username, const char *password);
730EAPI void ecore_con_socks5_remote_del(const char *ip, int port, const char *username, const char *password);
731EAPI void ecore_con_socks_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable);
732EAPI Eina_Bool ecore_con_socks_lookup_get(Ecore_Con_Socks *ecs);
733EAPI void ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind);
734EAPI Eina_Bool ecore_con_socks_bind_get(Ecore_Con_Socks *ecs);
735EAPI unsigned int ecore_con_socks_version_get(Ecore_Con_Socks *ecs);
736EAPI void ecore_con_socks_remote_del(Ecore_Con_Socks *ecs);
737EAPI void ecore_con_socks_apply_once(Ecore_Con_Socks *ecs);
738EAPI void ecore_con_socks_apply_always(Ecore_Con_Socks *ecs);
739
740/**
741 * @defgroup Ecore_Con_Server_Group Ecore Connection Server Functions
742 *
743 * This group of functions is applied to an @ref Ecore_Con_Server object. It
744 * doesn't mean that they should be used in the server application, but on the
745 * server object. In fact, most of them should be used in the client
746 * application, when retrieving information or sending data.
747 *
748 * Setting up a server is very simple: you just need to start it with
749 * ecore_con_server_add() and setup some callbacks to the events
750 * @ref ECORE_CON_EVENT_CLIENT_ADD, @ref ECORE_CON_EVENT_CLIENT_DEL and
751 * @ref ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is
752 * communicating with the server:
753 *
754 * @code
755 * if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL)))
756 * exit(1);
757 *
758 * ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, _add_cb, NULL);
759 * ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, _del_cb, NULL);
760 * ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, _data_cb, NULL);
761 *
762 * ecore_main_loop_begin();
763 * @endcode
764 *
765 * The function ecore_con_server_connect() can be used to write a client that
766 * connects to a server. The resulting code will be very similar to the server
767 * code:
768 *
769 * @code
770 * if (!(svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL)))
771 * exit(1);
772 *
773 * ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _add_cb, NULL);
774 * ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _del_cb, NULL);
775 * ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _data_cb, NULL);
776 *
777 * ecore_main_loop_begin();
778 * @endcode
779 *
780 * After these two pieces of code are executed, respectively, in the server and
781 * client code, the server will be up and running and the client will try to
782 * connect to it. The connection, with its subsequent messages being sent from
783 * server to client and client to server, can be represented in the following
784 * sequence diagram:
785 *
786 * @htmlonly
787 * <img src="ecore_con-client-server.png" style="max-width: 400px"/>
788 * <a href="ecore_con-client-server.png">Full size</a>
789 * @endhtmlonly
790 *
791 * @image rtf ecore_con-client-server.png
792 * @image latex ecore_con-client-server.eps width=\textwidth
793 *
794 * Please notice the important difference between these two codes: the first is
795 * used for writing a @b server, while the second should be used for writing a
796 * @b client.
797 *
798 * A reference for the @c client functions can be found at @ref
799 * Ecore_Con_Client_Group.
800 *
801 * Examples of usage for this API can be found here:
802 * @li @ref ecore_con_server_simple_example_c
803 * @li @ref ecore_con_client_simple_example_c
804 *
805 * @{
806 */
807
808/**
809 * Creates a server to listen for connections.
810 *
811 * @param type The connection type.
812 * @param name Name to associate with the socket. It is used when
813 * generating the socket name of a Unix socket, or for
814 * determining what host to listen on for TCP sockets.
815 * @c NULL will not be accepted.
816 * @param port Number to identify socket. When a Unix socket is used,
817 * it becomes part of the socket name. When a TCP socket
818 * is used, it is used as the TCP port.
819 * @param data Data to associate with the created Ecore_Con_Server
820 * object.
821 * @return A new Ecore_Con_Server.
822 *
823 * The socket on which the server listens depends on the connection
824 * type:
825 * @li If @a type is @c ECORE_CON_LOCAL_USER, the server will listen on
826 * the Unix socket "~/.ecore/[name]/[port]".
827 * @li If @a type is @c ECORE_CON_LOCAL_SYSTEM, the server will listen
828 * on Unix socket "/tmp/.ecore_service|[name]|[port]".
829 * @li If @a type is @c ECORE_CON_REMOTE_TCP, the server will listen
830 * on TCP port @c port.
831 *
832 * More information about the @p type can be found at @ref _Ecore_Con_Type.
833 *
834 * The @p data parameter can be fetched later using ecore_con_server_data_get()
835 * or changed with ecore_con_server_data_set().
836 */
837EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type,
838 const char *name, int port,
839 const void *data);
840
841/**
842 * Creates a connection to the specified server and returns an associated object.
843 *
844 * @param type The connection type.
845 * @param name Name used when determining what socket to connect to.
846 * It is used to generate the socket name when the socket
847 * is a Unix socket. It is used as the hostname when
848 * connecting with a TCP socket.
849 * @param port Number to identify the socket to connect to. Used when
850 * generating the socket name for a Unix socket, or as the
851 * TCP port when connecting to a TCP socket.
852 * @param data Data to associate with the created Ecore_Con_Server
853 * object.
854 * @return A new Ecore_Con_Server.
855 *
856 * The socket to which the connection is made depends on the connection type:
857 * @li If @a type is @c ECORE_CON_LOCAL_USER, the function will
858 * connect to the server at the Unix socket
859 * "~/.ecore/[name]/[port]".
860 * @li If @a type is @c ECORE_CON_LOCAL_SYSTEM, the function will
861 * connect to the server at the Unix socket
862 * "/tmp/.ecore_service|[name]|[port]".
863 * @li If @a type is @c ECORE_CON_REMOTE_TCP, the function will
864 * connect to the server at the TCP port "[name]:[port]".
865 *
866 * More information about the @p type can be found at @ref _Ecore_Con_Type.
867 *
868 * This function won't block. It will either succeed, or fail due to invalid
869 * parameters, failed memory allocation, etc., returning @c NULL on that case.
870 *
871 * However, even if this call returns a valid @ref Ecore_Con_Server, the
872 * connection will only be successfully completed if an event of type
873 * @ref ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an
874 * @ref ECORE_CON_EVENT_SERVER_DEL will be received.
875 *
876 * The @p data parameter can be fetched later using ecore_con_server_data_get()
877 * or changed with ecore_con_server_data_set().
878 */
879EAPI Ecore_Con_Server *ecore_con_server_connect(Ecore_Con_Type type,
880 const char *name, int port,
881 const void *data);
882/**
883 * Closes the connection and frees the given server.
884 *
885 * @param svr The given server.
886 * @return Data associated with the server when it was created.
887 *
888 * All the clients connected to this server will be disconnected.
889 *
890 * @see ecore_con_server_add, ecore_con_server_connect
891 */
892EAPI void * ecore_con_server_del(Ecore_Con_Server *svr);
893
894/**
895 * Retrieves the data associated with the given server.
896 *
897 * @param svr The given server.
898 * @return The associated data.
899 *
900 * @see ecore_con_server_data_set()
901 */
902EAPI void * ecore_con_server_data_get(Ecore_Con_Server *svr);
903/**
904 * Sets the data associated with the given server.
905 *
906 * @param svr The given server.
907 * @param data The data to associate with @p svr
908 * @return The previously associated data, if any.
909 *
910 * @see ecore_con_server_data_get()
911 */
912EAPI void * ecore_con_server_data_set(Ecore_Con_Server *svr,
913 void *data);
914/**
915 * Retrieves whether the given server is currently connected.
916 *
917 * @param svr The given server.
918 * @return #EINA_TRUE if the server is connected. #EINA_FALSE otherwise.
919 */
920EAPI Eina_Bool ecore_con_server_connected_get(Ecore_Con_Server *svr);
921/**
922 * Retrieves the current list of clients.
923 *
924 * @param svr The given server.
925 * @return The list of clients on this server.
926 *
927 * Each node in the returned list points to an @ref Ecore_Con_Client. This list
928 * cannot be modified or freed. It can also change if new clients are connected
929 * or disconnected, and will become invalid when the server is deleted/freed.
930 */
931EAPI const Eina_List * ecore_con_server_clients_get(Ecore_Con_Server *svr);
932
933/**
934 * Retrieves the name of server.
935 *
936 * @param svr The given server.
937 * @return The name of the server.
938 *
939 * The name returned is the name used to connect on this server.
940 */
941EAPI const char * ecore_con_server_name_get(Ecore_Con_Server *svr);
942
943/**
944 * Retrieves the server port in use.
945 *
946 * @param svr The given server.
947 * @return The server port in use.
948 *
949 * The port where the server is listening for connections.
950 */
951EAPI int ecore_con_server_port_get(Ecore_Con_Server *svr);
952/**
953 * @brief Check how long a server has been connected
954 *
955 * @param svr The server to check
956 * @return The total time, in seconds, that the server has been
957 * connected/running
958 *
959 * This function is used to find out the time that has been elapsed since
960 * ecore_con_server_add() succeeded.
961 */
962EAPI double ecore_con_server_uptime_get(Ecore_Con_Server *svr);
963/**
964 * Sends the given data to the given server.
965 *
966 * @param svr The given server.
967 * @param data The given data.
968 * @param size Length of the data, in bytes, to send.
969 * @return The number of bytes sent. @c 0 will be returned if there is an
970 * error.
971 *
972 * This function will send the given data to the server as soon as the program
973 * is back to the main loop. Thus, this function returns immediately
974 * (non-blocking). If the data needs to be sent @b now, call
975 * ecore_con_server_flush() after this one.
976 *
977 * @see ecore_con_client_send()
978 * @see ecore_con_server_flush()
979 */
980EAPI int ecore_con_server_send(Ecore_Con_Server *svr,
981 const void *data,
982 int size);
983/**
984 * Sets a limit on the number of clients that can be handled concurrently
985 * by the given server, and a policy on what to do if excess clients try to
986 * connect.
987 *
988 * @param svr The given server.
989 * @param client_limit The maximum number of clients to handle
990 * concurrently. -1 means unlimited (default). 0
991 * effectively disables the server.
992 * @param reject_excess_clients Set to 1 to automatically disconnect
993 * excess clients as soon as they connect if you are
994 * already handling client_limit clients. Set to 0
995 * (default) to just hold off on the "accept()"
996 * system call until the number of active clients
997 * drops. This causes the kernel to queue up to 4096
998 * connections (or your kernel's limit, whichever is
999 * lower).
1000 *
1001 * Beware that if you set this once ecore is already running, you may
1002 * already have pending CLIENT_ADD events in your event queue. Those
1003 * clients have already connected and will not be affected by this call.
1004 * Only clients subsequently trying to connect will be affected.
1005 */
1006EAPI void ecore_con_server_client_limit_set(Ecore_Con_Server *svr,
1007 int client_limit,
1008 char reject_excess_clients);
1009/**
1010 * Gets the IP address of a server that has been connected to.
1011 *
1012 * @param svr The given server.
1013 * @return A pointer to an internal string that contains the IP address of
1014 * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
1015 * This string should not be modified or trusted to stay valid after
1016 * deletion for the @p svr object. If no IP is known NULL is returned.
1017 */
1018EAPI const char * ecore_con_server_ip_get(Ecore_Con_Server *svr);
1019/**
1020 * Flushes all pending data to the given server.
1021 *
1022 * @param svr The given server.
1023 *
1024 * This function will block until all data is sent to the server.
1025 *
1026 * @see ecore_con_server_send()
1027 * @see ecore_con_client_flush()
1028 */
1029EAPI void ecore_con_server_flush(Ecore_Con_Server *svr);
1030/**
1031 * Set the default time after which an inactive client will be disconnected
1032 *
1033 * @param svr The server object
1034 * @param timeout The timeout, in seconds, to disconnect after
1035 *
1036 * This function is used by the server to set the default idle timeout on
1037 * clients. If the any of the clients becomes idle for a time higher than this
1038 * value, it will be disconnected. A value of < 1 disables the idle timeout.
1039 *
1040 * This timeout is not affected by the one set by
1041 * ecore_con_client_timeout_set(). A client will be disconnected whenever the
1042 * client or the server timeout is reached. That means, the lower timeout value
1043 * will be used for that client if ecore_con_client_timeout_set() is used on it.
1044 *
1045 * @see ecore_con_server_timeout_get()
1046 * @see ecore_con_client_timeout_set()
1047 */
1048EAPI void ecore_con_server_timeout_set(Ecore_Con_Server *svr, double timeout);
1049/**
1050 * Get the default time after which an inactive client will be disconnected
1051 *
1052 * @param svr The server object
1053 * @return The timeout, in seconds, to disconnect after
1054 *
1055 * This function is used to get the idle timeout for clients. A value of < 1
1056 * means the idle timeout is disabled.
1057 *
1058 * @see ecore_con_server_timeout_set()
1059 * @see ecore_con_client_timeout_get()
1060 */
1061EAPI double ecore_con_server_timeout_get(Ecore_Con_Server *svr);
1062
1063/**
1064 * Get the fd that the server is connected to
1065 *
1066 * @param svr The server object
1067 * @return The fd, or -1 on failure
1068 *
1069 * This function returns the fd which is used by the underlying server connection.
1070 * It should not be tampered with unless you REALLY know what you are doing.
1071 * @note This function is only valid for servers created with ecore_con_server_connect()
1072 * @warning Seriously. Don't use this unless you know what you are doing.
1073 * @since 1.1
1074 */
1075EAPI int ecore_con_server_fd_get(Ecore_Con_Server *svr);
1076
1077/**
1078 * Get the fd that the client is connected to
1079 *
1080 * @param cl The client object
1081 * @return The fd, or -1 on failure
1082 *
1083 * This function returns the fd which is used by the underlying client connection.
1084 * It should not be tampered with unless you REALLY know what you are doing.
1085 * @since 1.1
1086 */
1087EAPI int ecore_con_client_fd_get(Ecore_Con_Client *cl);
1088/**
1089 * @}
1090 */
1091
1092/**
1093 * @defgroup Ecore_Con_Client_Group Ecore Connection Client Functions
1094 *
1095 * Functions to communicate with and/or set options on a client.
1096 *
1097 * This set of functions, as explained in @ref Ecore_Con_Server_Group, is used
1098 * to send data to a client, or to set options and get information about this
1099 * client. Most of them should be used on the server, applied on the client
1100 * object.
1101 *
1102 * If you need to implement a client, the way to connect to a server is
1103 * described in @ref Ecore_Con_Server_Group.
1104 *
1105 * An example of usage of these functions can be found at:
1106 * @li @ref ecore_con_client_simple_example_c
1107 *
1108 * @{
1109 */
1110
1111/**
1112 * Sends the given data to the given client.
1113 *
1114 * @param cl The given client.
1115 * @param data The given data.
1116 * @param size Length of the data, in bytes, to send.
1117 * @return The number of bytes sent. @c 0 will be returned if there is an
1118 * error.
1119 *
1120 * This function will send the given data to the client as soon as the program
1121 * is back to the main loop. Thus, this function returns immediately
1122 * (non-blocking). If the data needs to be sent @b now, call
1123 * ecore_con_client_flush() after this one.
1124 *
1125 * @see ecore_con_server_send()
1126 * @see ecore_con_client_flush()
1127 */
1128EAPI int ecore_con_client_send(Ecore_Con_Client *cl,
1129 const void *data,
1130 int size);
1131/**
1132 * Retrieves the server representing the socket the client has
1133 * connected to.
1134 *
1135 * @param cl The given client.
1136 * @return The server that the client connected to.
1137 */
1138EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl);
1139/**
1140 * Closes the connection and frees memory allocated to the given client.
1141 *
1142 * @param cl The given client.
1143 * @return Data associated with the client.
1144 */
1145EAPI void * ecore_con_client_del(Ecore_Con_Client *cl);
1146/**
1147 * Sets the data associated with the given client to @p data.
1148 *
1149 * @param cl The given client.
1150 * @param data What to set the data to.
1151 */
1152EAPI void ecore_con_client_data_set(Ecore_Con_Client *cl,
1153 const void *data);
1154/**
1155 * Retrieves the data associated with the given client.
1156 *
1157 * @param cl The given client.
1158 * @return The data associated with @p cl.
1159 */
1160EAPI void * ecore_con_client_data_get(Ecore_Con_Client *cl);
1161
1162/**
1163 * Gets the IP address of a client that has connected.
1164 *
1165 * @param cl The given client.
1166 * @return A pointer to an internal string that contains the IP address of
1167 * the connected client in the form "XXX.YYY.ZZZ.AAA" IP notation.
1168 *
1169 * The returned string should not be modified, freed or trusted to stay valid
1170 * after deletion for the @p cl object. If no IP is known NULL is returned.
1171 */
1172EAPI const char * ecore_con_client_ip_get(Ecore_Con_Client *cl);
1173/**
1174 * Flushes all pending data to the given client.
1175 *
1176 * @param cl The given client.
1177 *
1178 * This function will block until all data is sent to the server.
1179 *
1180 * @see ecore_con_client_send()
1181 * @see ecore_con_server_flush()
1182 */
1183EAPI void ecore_con_client_flush(Ecore_Con_Client *cl);
1184/**
1185 * @brief Check how long a client has been connected
1186 *
1187 * @param cl The client to check
1188 * @return The total time, in seconds, that the client has been connected to
1189 * the server
1190 *
1191 * This function is used to find out how long a client has been connected for.
1192 */
1193EAPI double ecore_con_client_uptime_get(Ecore_Con_Client *cl);
1194/**
1195 * Get the default time after which the client will be disconnected when
1196 * inactive
1197 *
1198 * @param cl The client object
1199 * @return The timeout, in seconds, to disconnect after
1200 *
1201 * This function is used to get the idle timeout for a client. A value of < 1
1202 * means the idle timeout is disabled.
1203 *
1204 * @see ecore_con_client_timeout_set()
1205 */
1206EAPI double ecore_con_client_timeout_get(Ecore_Con_Client *cl);
1207/**
1208 * Set the time after which the client will be disconnected when inactive
1209 *
1210 * @param cl The client object
1211 * @param timeout The timeout, in seconds, to disconnect after
1212 *
1213 * This function is used by the server to set the idle timeout on a specific
1214 * client. If the client becomes idle for a time higher than this value, it will
1215 * be disconnected. A value of < 1 disables the idle timeout.
1216 *
1217 * This timeout is not affected by the one set by
1218 * ecore_con_server_timeout_set(). A client will be disconnected whenever the
1219 * client or the server timeout is reached. That means, the lower timeout value
1220 * will be used for that client if ecore_con_server_timeout_set() is used on the
1221 * server.
1222 *
1223 * @see ecore_con_client_timeout_get()
1224 * @see ecore_con_server_timeout_set()
1225 */
1226EAPI void ecore_con_client_timeout_set(Ecore_Con_Client *cl, double timeout);
1227/**
1228 * Returns whether the client is still connected
1229 *
1230 * @param cl The given client.
1231 * @return #EINA_TRUE if connected, else EINA_FALSE
1232 */
1233EAPI Eina_Bool ecore_con_client_connected_get(Ecore_Con_Client *cl);
1234/**
1235 * @brief Return the port that the client has connected to
1236 *
1237 * @param cl The client
1238 * @return The port that @p cl has connected to, or -1 on error
1239 * Use this function to return the port on which a given client has connected.
1240 */
1241EAPI int ecore_con_client_port_get(Ecore_Con_Client *cl);
1242
1243
1244
1245/**
1246 * @}
1247 */
1248
1249/**
1250 * @defgroup Ecore_Con_Url_Group Ecore URL Connection Functions
1251 *
1252 * Utility functions that set up, use and shut down the Ecore URL
1253 * Connection library.
1254 *
1255 * These functions are a shortcut to make it easy to perform http requests
1256 * (POST, GET, etc).
1257 *
1258 * Brief usage:
1259 * 1. Create an Ecore_Con_Url object with ecore_con_url_new(url);
1260 * 2. Register to receive the #ECORE_CON_EVENT_URL_COMPLETE event
1261 * (and optionally the #ECORE_CON_EVENT_URL_DATA and
1262 * #ECORE_CON_EVENT_URL_PROGRESS event to receive
1263 * the response, e.g. for HTTP/FTP downloads)
1264 * 3. Perform the operation with ecore_con_url_get(...);
1265 *
1266 * Note that it is good to reuse @ref Ecore_Con_Url objects wherever possible,
1267 * but bear in mind that each one can only perform one operation at a time. You
1268 * need to wait for the #ECORE_CON_EVENT_URL_COMPLETE event before re-using or
1269 * destroying the object.
1270 *
1271 * If it's necessary to change the @ref Ecore_Con_Url object url, use
1272 * ecore_con_url_url_set().
1273 *
1274 * Simple Usage 1 (HTTP GET):
1275 * @code
1276 * ecore_con_url_url_set(url_con, "http://www.google.com");
1277 * ecore_con_url_get(url_con);
1278 * @endcode
1279 *
1280 * Simple usage 2 (HTTP POST):
1281 * @code
1282 * ecore_con_url_url_set(url_con, "http://www.example.com/post_handler.cgi");
1283 * ecore_con_url_post(url_con, data, data_length, "multipart/form-data");
1284 * @endcode
1285 *
1286 * Simple Usage 3 (FTP download):
1287 * @code
1288 * fd = creat(filename, 0644)
1289 * ecore_con_url_url_set(url_con, "ftp://ftp.example.com/pub/myfile");
1290 * ecore_con_url_fd_set(url_con, fd);
1291 * ecore_con_url_get(url_con);
1292 * @endcode
1293 *
1294 * Simple Usage 4 (FTP upload as ftp://ftp.example.com/file):
1295 * @code
1296 * ecore_con_url_url_set(url_con, "ftp://ftp.example.com");
1297 * ecore_con_url_ftp_upload(url_con, "/tmp/file", "user", "pass", NULL);
1298 * @endcode
1299 *
1300 * Simple Usage 5 (FTP upload as ftp://ftp.example.com/dir/file):
1301 * @code
1302 * ecore_con_url_url_set(url_con, "ftp://ftp.example.com");
1303 * ecore_con_url_ftp_upload(url_con, "/tmp/file", "user", "pass","dir");
1304 * @endcode
1305 *
1306 * These are complete examples for the API:
1307 * @li @ref ecore_con_url_download_example.c "Downloading a file"
1308 * @li @ref ecore_con_url_headers_example.c "Setting many options for the
1309 * connection"
1310 *
1311 * @{
1312 */
1313
1314/**
1315 * @typedef Ecore_Con_Url_Time
1316 * @enum _Ecore_Con_Url_Time
1317 * The type of condition to use when making an HTTP request dependent on time,
1318 * so that headers such as "If-Modified-Since" are used.
1319 */
1320typedef enum _Ecore_Con_Url_Time
1321{
1322 /**
1323 * Do not place time restrictions on the HTTP requests.
1324 */
1325 ECORE_CON_URL_TIME_NONE = 0,
1326 /**
1327 * Add the "If-Modified-Since" HTTP header, so that the request is performed
1328 * by the server only if the target has been modified since the time value
1329 * passed to it in the request.
1330 */
1331 ECORE_CON_URL_TIME_IFMODSINCE,
1332 /**
1333 * Add the "If-Unmodified-Since" HTTP header, so that the request is
1334 * performed by the server only if the target has NOT been modified since
1335 * the time value passed to it in the request.
1336 */
1337 ECORE_CON_URL_TIME_IFUNMODSINCE
1338} Ecore_Con_Url_Time;
1339
1340/**
1341 * @typedef Ecore_Con_Url_Http_Version
1342 * @enum _Ecore_Con_Url_Http_Version
1343 * The http version to use
1344 * @since 1.2
1345 */
1346typedef enum _Ecore_Con_Url_Http_Version
1347{
1348 /**
1349 * HTTP version 1.0
1350 * @since 1.2
1351 */
1352 ECORE_CON_URL_HTTP_VERSION_1_0,
1353 /**
1354 * HTTP version 1.1 (default)
1355 * @since 1.2
1356 */
1357 ECORE_CON_URL_HTTP_VERSION_1_1
1358} Ecore_Con_Url_Http_Version;
1359
1360/**
1361 * Change the HTTP version used for the request
1362 * @param version The version to be used
1363 * @return EINA_TRUE on success, EINA_FALSE on failure to change version
1364 * @since 1.2
1365 * @see ecore_con_url_pipeline_get()
1366 */
1367EAPI Eina_Bool ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version);
1368
1369/**
1370 * Initialises the Ecore_Con_Url library.
1371 * @return Number of times the library has been initialised without being
1372 * shut down.
1373 *
1374 * @note This function doesn't call ecore_con_init(). You still need to call it
1375 * explicitly before calling this one.
1376 */
1377EAPI int ecore_con_url_init(void);
1378
1379/**
1380 * Shuts down the Ecore_Con_Url library.
1381 * @return Number of calls that still uses Ecore_Con_Url
1382 *
1383 * @note This function doesn't call ecore_con_shutdown(). You still need to call
1384 * it explicitly after calling this one.
1385 */
1386EAPI int ecore_con_url_shutdown(void);
1387
1388/**
1389 * Enable or disable HTTP 1.1 pipelining.
1390 * @param enable EINA_TRUE will turn it on, EINA_FALSE will disable it.
1391 *
1392 * Pipelining allows to send one request after another one, without having to
1393 * wait for the reply of the first request. The respective replies are received
1394 * in the order that the requests were sent.
1395 *
1396 * Enabling this feature will be valid for all requests done using @c
1397 * ecore_con_url.
1398 *
1399 * See http://en.wikipedia.org/wiki/HTTP_pipelining for more info.
1400 *
1401 * @see ecore_con_url_pipeline_get()
1402 */
1403EAPI void ecore_con_url_pipeline_set(Eina_Bool enable);
1404/**
1405 * Is HTTP 1.1 pipelining enable ?
1406 * @return EINA_TRUE if it is enable.
1407 *
1408 * @see ecore_con_url_pipeline_set()
1409 */
1410EAPI Eina_Bool ecore_con_url_pipeline_get(void);
1411
1412/**
1413 * Creates and initializes a new Ecore_Con_Url connection object.
1414 *
1415 * @param url URL that will receive requests. Can be changed using
1416 * ecore_con_url_url_set.
1417 *
1418 * @return NULL on error, a new Ecore_Con_Url on success.
1419 *
1420 * Creates and initializes a new Ecore_Con_Url connection object that can be
1421 * used for sending requests.
1422 *
1423 * @see ecore_con_url_custom_new()
1424 * @see ecore_con_url_url_set()
1425 */
1426EAPI Ecore_Con_Url * ecore_con_url_new(const char *url);
1427/**
1428 * Creates a custom connection object.
1429 *
1430 * @param url URL that will receive requests
1431 * @param custom_request Custom request (e.g. GET, POST, HEAD, PUT, etc)
1432 *
1433 * @return NULL on error, a new Ecore_Con_Url on success.
1434 *
1435 * Creates and initializes a new Ecore_Con_Url for a custom request (e.g. HEAD,
1436 * SUBSCRIBE and other obscure HTTP requests). This object should be used like
1437 * one created with ecore_con_url_new().
1438 *
1439 * @see ecore_con_url_new()
1440 * @see ecore_con_url_url_set()
1441 */
1442EAPI Ecore_Con_Url * ecore_con_url_custom_new(const char *url,
1443 const char *custom_request);
1444/**
1445 * Destroys a Ecore_Con_Url connection object.
1446 *
1447 * @param url_con Connection object to free.
1448 *
1449 * @see ecore_con_url_new()
1450 */
1451EAPI void ecore_con_url_free(Ecore_Con_Url *url_con);
1452/**
1453 * Sets the URL to send the request to.
1454 *
1455 * @param url_con Connection object through which the request will be sent.
1456 * @param url URL that will receive the request
1457 *
1458 * @return EINA_TRUE on success, EINA_FALSE on error.
1459 *
1460 */
1461EAPI Eina_Bool ecore_con_url_url_set(Ecore_Con_Url *url_con,
1462 const char *url);
1463/**
1464 * Gets the URL to send the request to.
1465 *
1466 * @param url_con Connection object through which the request will be sent.
1467 * @return URL that will receive the request, NULL on failure. URL is stringshared.
1468 * @since 1.1
1469 */
1470EAPI const char *ecore_con_url_url_get(Ecore_Con_Url *url_con);
1471/**
1472 * Associates data with a connection object.
1473 *
1474 * @param url_con Connection object to associate data.
1475 * @param data Data to be set.
1476 *
1477 * Associates data with a connection object, which can be retrieved later with
1478 * ecore_con_url_data_get()).
1479 *
1480 * @see ecore_con_url_data_get()
1481 */
1482EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con,
1483 void *data);
1484/**
1485 * Retrieves data associated with a Ecore_Con_Url connection object.
1486 *
1487 * @param url_con Connection object to retrieve data from.
1488 *
1489 * @return Data associated with the given object.
1490 *
1491 * Retrieves data associated with a Ecore_Con_Url connection object (previously
1492 * set with ecore_con_url_data_set()).
1493 *
1494 * @see ecore_con_url_data_set()
1495 */
1496EAPI void * ecore_con_url_data_get(Ecore_Con_Url *url_con);
1497/**
1498 * Adds an additional header to the request connection object.
1499 *
1500 * @param url_con Connection object
1501 * @param key Header key
1502 * @param value Header value
1503 *
1504 * Adds an additional header (User-Agent, Content-Type, etc.) to the request
1505 * connection object. This addition will be valid for only one
1506 * ecore_con_url_get() or ecore_con_url_post() call.
1507 *
1508 * Some functions like ecore_con_url_time() also add headers to the request.
1509 *
1510 * @see ecore_con_url_get()
1511 * @see ecore_con_url_post()
1512 * @see ecore_con_url_additional_headers_clear()
1513 */
1514EAPI void ecore_con_url_additional_header_add(Ecore_Con_Url *url_con,
1515 const char *key,
1516 const char *value);
1517/**
1518 * Cleans additional headers.
1519 *
1520 * @param url_con Connection object to clean additional headers.
1521 *
1522 * Cleans additional headers associated with a connection object (previously
1523 * added with ecore_con_url_additional_header_add()).
1524 *
1525 * @see ecore_con_url_additional_header_add()
1526 * @see ecore_con_url_get()
1527 * @see ecore_con_url_post()
1528 */
1529EAPI void ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con);
1530/**
1531 * Retrieves headers from last request sent.
1532 *
1533 * @param url_con Connection object to retrieve response headers from.
1534 *
1535 * Retrieves a list containing the response headers. This function should be
1536 * used after an ECORE_CON_EVENT_URL_COMPLETE event (headers should normally be
1537 * ready at that time).
1538 *
1539 * @return List of response headers. This list must not be modified by the user.
1540 */
1541EAPI const Eina_List * ecore_con_url_response_headers_get(Ecore_Con_Url *url_con);
1542/**
1543 * Setup a file for receiving response data.
1544 *
1545 * @param url_con Connection object to set file
1546 * @param fd File descriptor associated with the file. A negative value will
1547 * unset any previously set fd.
1548 *
1549 * Sets up a file to have response data written into. Note that
1550 * ECORE_CON_EVENT_URL_DATA events will not be emitted if a file has been set to
1551 * receive the response data.
1552 *
1553 * This call can be used to easily setup a file where the downloaded data will
1554 * be saved.
1555 */
1556EAPI void ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd);
1557/**
1558 * Retrieves the number of bytes received.
1559 *
1560 * Retrieves the number of bytes received on the last request of the given
1561 * connection object.
1562 *
1563 * @param url_con Connection object which the request was sent on.
1564 *
1565 * @return Number of bytes received on request.
1566 *
1567 * @see ecore_con_url_get()
1568 * @see ecore_con_url_post()
1569 */
1570EAPI int ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con);
1571/**
1572 * Sets url_con to use http auth, with given username and password, "safely" or not.
1573 *
1574 * @param url_con Connection object to perform a request on, previously created
1575 * with ecore_con_url_new() or ecore_con_url_custom_new().
1576 * @param username Username to use in authentication
1577 * @param password Password to use in authentication
1578 * @param safe Whether to use "safer" methods (eg, NOT http basic auth)
1579 *
1580 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1581 *
1582 * ATTENTION: requires libcurl >= 7.19.1 to work, otherwise will always return 0.
1583 */
1584EAPI Eina_Bool ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
1585 const char *username,
1586 const char *password,
1587 Eina_Bool safe);
1588/**
1589 * Sends a get request.
1590 *
1591 * @param url_con Connection object to perform a request on, previously created
1592 *
1593 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1594 *
1595 * The request is performed immediately, but you need to setup event handlers
1596 * for #ECORE_CON_EVENT_URL_DATA, #ECORE_CON_EVENT_URL_COMPLETE or
1597 * #ECORE_CON_EVENT_URL_PROGRESS to get more information about its result.
1598 *
1599 * @see ecore_con_url_custom_new()
1600 * @see ecore_con_url_additional_headers_clear()
1601 * @see ecore_con_url_additional_header_add()
1602 * @see ecore_con_url_data_set()
1603 * @see ecore_con_url_data_get()
1604 * @see ecore_con_url_response_headers_get()
1605 * @see ecore_con_url_time()
1606 * @see ecore_con_url_post()
1607 */
1608EAPI Eina_Bool ecore_con_url_get(Ecore_Con_Url *url_con);
1609/**
1610 * Sends a post request.
1611 *
1612 * @param url_con Connection object to perform a request on, previously created
1613 * with ecore_con_url_new() or ecore_con_url_custom_new().
1614 * @param data Payload (data sent on the request). Can be @c NULL.
1615 * @param length Payload length. If @c -1, rely on automatic length
1616 * calculation via @c strlen() on @p data.
1617 * @param content_type Content type of the payload (e.g. text/xml). Can be @c
1618 * NULL.
1619 *
1620 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1621 *
1622 * The request starts immediately, but you need to setup event handlers
1623 * for #ECORE_CON_EVENT_URL_DATA, #ECORE_CON_EVENT_URL_COMPLETE or
1624 * #ECORE_CON_EVENT_URL_PROGRESS to get more information about its result.
1625 *
1626 * This call won't block your main loop.
1627 *
1628 * @see ecore_con_url_custom_new()
1629 * @see ecore_con_url_additional_headers_clear()
1630 * @see ecore_con_url_additional_header_add()
1631 * @see ecore_con_url_data_set()
1632 * @see ecore_con_url_data_get()
1633 * @see ecore_con_url_response_headers_get()
1634 * @see ecore_con_url_time()
1635 * @see ecore_con_url_get()
1636 */
1637EAPI Eina_Bool ecore_con_url_post(Ecore_Con_Url *url_con,
1638 const void *data, long length,
1639 const char *content_type);
1640/**
1641 * Sets whether HTTP requests should be conditional, dependent on
1642 * modification time.
1643 *
1644 * @param url_con Ecore_Con_Url to act upon.
1645 * @param time_condition Condition to use for HTTP requests.
1646 * @param timestamp Time since 1 Jan 1970 to use in the condition.
1647 *
1648 * This function may set the header "If-Modified-Since" or
1649 * "If-Unmodified-Since", depending on the value of @p time_condition, with the
1650 * value @p timestamp.
1651 *
1652 * @sa ecore_con_url_get()
1653 * @sa ecore_con_url_post()
1654 */
1655EAPI void ecore_con_url_time(Ecore_Con_Url *url_con,
1656 Ecore_Con_Url_Time time_condition,
1657 double timestamp);
1658
1659/**
1660 * @brief Uploads a file to an ftp site.
1661 * @param url_con The Ecore_Con_Url object to send with
1662 * @param filename The path to the file to send
1663 * @param user The username to log in with
1664 * @param pass The password to log in with
1665 * @param upload_dir The directory to which the file should be uploaded
1666 * @return #EINA_TRUE on success, else #EINA_FALSE.
1667 * Upload @p filename to an ftp server set in @p url_con using @p user
1668 * and @p pass to directory @p upload_dir
1669 */
1670EAPI Eina_Bool ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
1671 const char *filename,
1672 const char *user,
1673 const char *pass,
1674 const char *upload_dir);
1675/**
1676 * Toggle libcurl's verbose output.
1677 *
1678 * @param url_con Ecore_Con_Url instance which will be acted upon.
1679 * @param verbose Whether or not to enable libcurl's verbose output.
1680 *
1681 * If @p verbose is @c EINA_TRUE, libcurl will output a lot of verbose
1682 * information about its operations, which is useful for
1683 * debugging. The verbose information will be sent to stderr.
1684 */
1685EAPI void ecore_con_url_verbose_set(Ecore_Con_Url *url_con,
1686 Eina_Bool verbose);
1687/**
1688 * Enable or disable EPSV extension
1689 * @return FIXME: To be more documented.
1690 */
1691EAPI void ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con,
1692 Eina_Bool use_epsv);
1693
1694/**
1695 * Enables the cookie engine for subsequent HTTP requests.
1696 *
1697 * @param url_con Ecore_Con_Url instance which will be acted upon.
1698 *
1699 * After this function is called, cookies set by the server in HTTP responses
1700 * will be parsed and stored, as well as sent back to the server in new HTTP
1701 * requests.
1702 *
1703 * @note Even though this function is called @c ecore_con_url_cookies_init(),
1704 * there is no symmetrical shutdown operation.
1705 */
1706EAPI void ecore_con_url_cookies_init(Ecore_Con_Url *url_con);
1707/**
1708 * Controls whether session cookies from previous sessions shall be loaded.
1709 *
1710 * @param url_con Ecore_Con_Url instance which will be acted upon.
1711 * @param ignore If @c EINA_TRUE, ignore session cookies when loading cookies
1712 * from files. If @c EINA_FALSE, all cookies will be loaded.
1713 *
1714 * Session cookies are cookies with no expire date set, which usually means
1715 * they are removed after the current session is closed.
1716 *
1717 * By default, when Ecore_Con_Url loads cookies from a file, all cookies are
1718 * loaded, including session cookies, which, most of the time, were supposed
1719 * to be loaded and valid only for that session.
1720 *
1721 * If @p ignore is set to @c EINA_TRUE, when Ecore_Con_Url loads cookies from
1722 * the files passed to @c ecore_con_url_cookies_file_add(), session cookies
1723 * will not be loaded.
1724 *
1725 * @see ecore_con_url_cookies_file_add()
1726 */
1727EAPI void ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con,
1728 Eina_Bool ignore);
1729/**
1730 * Clears currently loaded cookies.
1731 * @param url_con Ecore_Con_Url instance which will be acted upon.
1732 *
1733 * The cleared cookies are removed and will not be sent in subsequent HTTP
1734 * requests, nor will they be written to the cookiejar file set via
1735 * @c ecore_con_url_cookies_jar_file_set().
1736 *
1737 * @note This function will initialize the cookie engine if it has not been
1738 * initialized yet.
1739 * @note The cookie files set by ecore_con_url_cookies_file_add() aren't loaded
1740 * immediately, just when the request is started. Thus, if you ask to
1741 * clear the cookies, but has a file already set by that function, the
1742 * cookies will then be loaded and you will have old cookies set. In order
1743 * to don't have any old cookie set, you need to don't call
1744 * ecore_con_url_cookies_file_add() ever on the @p url_con handler, and
1745 * call this function to clear any cookie set by a previous request on
1746 * this handler.
1747 *
1748 * @see ecore_con_url_cookies_session_clear()
1749 * @see ecore_con_url_cookies_ignore_old_session_set()
1750 */
1751EAPI void ecore_con_url_cookies_clear(Ecore_Con_Url *url_con);
1752/**
1753 * Clears currently loaded session cookies.
1754 *
1755 * @param url_con Ecore_Con_Url instance which will be acted upon.
1756 *
1757 * Session cookies are cookies with no expire date set, which usually means
1758 * they are removed after the current session is closed.
1759 *
1760 * The cleared cookies are removed and will not be sent in subsequent HTTP
1761 * requests, nor will they be written to the cookiejar file set via
1762 * @c ecore_con_url_cookies_jar_file_set().
1763 *
1764 * @note This function will initialize the cookie engine if it has not been
1765 * initialized yet.
1766 * @note The cookie files set by ecore_con_url_cookies_file_add() aren't loaded
1767 * immediately, just when the request is started. Thus, if you ask to
1768 * clear the session cookies, but has a file already set by that function,
1769 * the session cookies will then be loaded and you will have old cookies
1770 * set. In order to don't have any old session cookie set, you need to
1771 * don't call ecore_con_url_cookies_file_add() ever on the @p url_con
1772 * handler, and call this function to clear any session cookie set by a
1773 * previous request on this handler. An easier way to don't use old
1774 * session cookies is by using the function
1775 * ecore_con_url_cookies_ignore_old_session_set().
1776 *
1777 * @see ecore_con_url_cookies_clear()
1778 * @see ecore_con_url_cookies_ignore_old_session_set()
1779 */
1780EAPI void ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con);
1781/**
1782 * Adds a file to the list of files from which to load cookies.
1783 *
1784 * @param url_con Ecore_Con_Url instance which will be acted upon.
1785 * @param file_name Name of the file that will be added to the list.
1786 *
1787 * Files must contain cookies defined according to two possible formats:
1788 *
1789 * @li HTTP-style header ("Set-Cookie: ...").
1790 * @li <a href="http://www.cookiecentral.com/faq/#3.5">Netscape/Mozilla cookie data format.</a>
1791 *
1792 * Cookies will only be @b read from this file. If you want to save cookies to a
1793 * file, use ecore_con_url_cookies_jar_file_set(). Also notice that this
1794 * function supports the both types of cookie file cited above, while
1795 * ecore_con_url_cookies_jar_file_set() will save only in the Netscape/Mozilla's
1796 * format.
1797 *
1798 * Please notice that the file will not be read immediately, but rather added
1799 * to a list of files that will be loaded and parsed at a later time.
1800 *
1801 * @note This function will initialize the cookie engine if it has not been
1802 * initialized yet.
1803 *
1804 * @see ecore_con_url_cookies_ignore_old_session_set()
1805 * @see ecore_con_url_cookies_jar_file_set()
1806 */
1807EAPI void ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con,
1808 const char * const file_name);
1809/**
1810 * Sets the name of the file to which all current cookies will be written when
1811 * either cookies are flushed or Ecore_Con is shut down.
1812 *
1813 * @param url_con Ecore_Con_Url instance which will be acted upon.
1814 * @param cookiejar_file File to which the cookies will be written.
1815 *
1816 * @return @c EINA_TRUE is the file name has been set successfully,
1817 * @c EINA_FALSE otherwise.
1818 *
1819 * Cookies are written following Netscape/Mozilla's data format, also known as
1820 * cookie-jar.
1821 *
1822 * Cookies will only be @b saved to this file. If you need to read cookies from
1823 * a file, use ecore_con_url_cookies_file_add() instead.
1824 *
1825 * @note This function will initialize the cookie engine if it has not been
1826 * initialized yet.
1827 *
1828 * @see ecore_con_url_cookies_jar_write()
1829 */
1830EAPI Eina_Bool ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con,
1831 const char * const cookiejar_file);
1832/**
1833 * Writes all current cookies to the cookie jar immediately.
1834 *
1835 * @param url_con Ecore_Con_Url instance which will be acted upon.
1836 *
1837 * A cookie-jar file must have been previously set by
1838 * @c ecore_con_url_jar_file_set, otherwise nothing will be done.
1839 *
1840 * @note This function will initialize the cookie engine if it has not been
1841 * initialized yet.
1842 *
1843 * @see ecore_con_url_cookies_jar_file_set()
1844 */
1845EAPI void ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con);
1846
1847EAPI void ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con,
1848 Eina_Bool verify);
1849EAPI int ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con,
1850 const char *ca_path);
1851
1852/**
1853 * Set HTTP proxy to use.
1854 *
1855 * The parameter should be a char * to a zero terminated string holding
1856 * the host name or dotted IP address. To specify port number in this string,
1857 * append :[port] to the end of the host name.
1858 * The proxy string may be prefixed with [protocol]:// since any such prefix
1859 * will be ignored.
1860 * The proxy's port number may optionally be specified with the separate option.
1861 * If not specified, libcurl will default to using port 1080 for proxies.
1862 *
1863 * @param url_con Connection object that will use the proxy.
1864 * @param proxy Porxy string or @c NULL to disable
1865 *
1866 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1867 * @since 1.2
1868 */
1869EAPI Eina_Bool ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy);
1870
1871/**
1872 * Set zero terminated username to use for proxy.
1873 *
1874 * if socks protocol is used for proxy, protocol should be socks5 and above.
1875 *
1876 * @param url_con Connection object that will use the proxy.
1877 * @param username Username string.
1878 *
1879 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1880 *
1881 * @see ecore_con_url_proxy_set()
1882 *
1883 * @since 1.2
1884 */
1885EAPI Eina_Bool ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username);
1886
1887/**
1888 * Set zero terminated password to use for proxy.
1889 *
1890 * if socks protocol is used for proxy, protocol should be socks5 and above.
1891 *
1892 * @param url_con Connection object that will use the proxy.
1893 * @param password Password string.
1894 *
1895 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1896 *
1897 * @see ecore_con_url_proxy_set()
1898 *
1899 * @since 1.2
1900 */
1901EAPI Eina_Bool ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password);
1902
1903/**
1904 * Set timeout in seconds.
1905 *
1906 * the maximum time in seconds that you allow the ecore con url transfer
1907 * operation to take. Normally, name lookups can take a considerable time
1908 * and limiting operations to less than a few minutes risk aborting perfectly
1909 * normal operations.
1910 *
1911 * @param url_con Connection object that will use the timeout.
1912 * @param timeout time in seconds.
1913 *
1914 * @see ecore_con_url_cookies_jar_file_set()
1915 *
1916 * @since 1.2
1917 */
1918EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout);
1919
1920/**
1921 * Get the returned HTTP STATUS code
1922 *
1923 * This is used to, at any time, try to return the status code for a transmission.
1924 * @param url_con Connection object
1925 * @return A valid HTTP STATUS code, or 0 on failure
1926 *
1927 * @since 1.2
1928 */
1929EAPI int ecore_con_url_status_code_get(Ecore_Con_Url *url_con);
1930/**
1931 * @}
1932 */
1933
1934#ifdef __cplusplus
1935}
1936#endif
1937
1938#endif
diff --git a/libraries/ecore/src/lib/ecore_con/Makefile.am b/libraries/ecore/src/lib/ecore_con/Makefile.am
deleted file mode 100644
index 929b30e..0000000
--- a/libraries/ecore/src/lib/ecore_con/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_builddir)/src/lib/ecore \
5-I$(top_builddir)/src/lib/ecore_con \
6-I$(top_srcdir)/src/lib/ecore \
7-I$(top_srcdir)/src/lib/ecore_con \
8@EFL_ECORE_CON_BUILD@ \
9@SSL_CFLAGS@ \
10@CURL_CFLAGS@ \
11@EINA_CFLAGS@ \
12@TLS_CFLAGS@ \
13@CARES_CFLAGS@ \
14@WIN32_CPPFLAGS@
15
16lib_LTLIBRARIES = libecore_con.la
17includes_HEADERS = Ecore_Con.h
18includesdir = $(includedir)/ecore-@VMAJ@
19
20libecore_con_la_SOURCES = \
21ecore_con.c \
22ecore_con_socks.c \
23ecore_con_ssl.c \
24ecore_con_url.c \
25ecore_con_alloc.c
26
27if ECORE_HAVE_WIN32
28libecore_con_la_SOURCES += ecore_con_local_win32.c
29else
30libecore_con_la_SOURCES += ecore_con_local.c
31endif
32
33if HAVE_CARES
34libecore_con_la_SOURCES += ecore_con_ares.c
35else
36libecore_con_la_SOURCES += ecore_con_info.c
37endif
38
39libecore_con_la_CFLAGS = @WIN32_CFLAGS@
40libecore_con_la_LIBADD = \
41$(top_builddir)/src/lib/ecore/libecore.la \
42@SSL_LIBS@ @CURL_LIBS@ @EINA_LIBS@ @TLS_LIBS@ @CARES_LIBS@ @WIN32_LIBS@
43
44libecore_con_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
45
46EXTRA_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
deleted file mode 100644
index c35b08e..0000000
--- a/libraries/ecore/src/lib/ecore_con/Makefile.in
+++ /dev/null
@@ -1,935 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38@ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_con_local_win32.c
39@ECORE_HAVE_WIN32_FALSE@am__append_2 = ecore_con_local.c
40@HAVE_CARES_TRUE@am__append_3 = ecore_con_ares.c
41@HAVE_CARES_FALSE@am__append_4 = ecore_con_info.c
42subdir = src/lib/ecore_con
43DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
44 $(srcdir)/Makefile.in
45ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
46am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
47 $(top_srcdir)/m4/ac_path_generic.m4 \
48 $(top_srcdir)/m4/check_x_extension.m4 \
49 $(top_srcdir)/m4/ecore_check_module.m4 \
50 $(top_srcdir)/m4/ecore_check_options.m4 \
51 $(top_srcdir)/m4/efl_compiler_flag.m4 \
52 $(top_srcdir)/m4/efl_doxygen.m4 \
53 $(top_srcdir)/m4/efl_examples.m4 \
54 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
55 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
56 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
57 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
58 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
59 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
60 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
61 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
62 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
63am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 $(ACLOCAL_M4)
65mkinstalldirs = $(install_sh) -d
66CONFIG_HEADER = $(top_builddir)/config.h
67CONFIG_CLEAN_FILES =
68CONFIG_CLEAN_VPATH_FILES =
69am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
70am__vpath_adj = case $$p in \
71 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
72 *) f=$$p;; \
73 esac;
74am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
75am__install_max = 40
76am__nobase_strip_setup = \
77 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
78am__nobase_strip = \
79 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
80am__nobase_list = $(am__nobase_strip_setup); \
81 for p in $$list; do echo "$$p $$p"; done | \
82 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
83 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
84 if (++n[$$2] == $(am__install_max)) \
85 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
86 END { for (dir in files) print dir, files[dir] }'
87am__base_list = \
88 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
89 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
90am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
91LTLIBRARIES = $(lib_LTLIBRARIES)
92libecore_con_la_DEPENDENCIES = \
93 $(top_builddir)/src/lib/ecore/libecore.la
94am__libecore_con_la_SOURCES_DIST = ecore_con.c ecore_con_socks.c \
95 ecore_con_ssl.c ecore_con_url.c ecore_con_alloc.c \
96 ecore_con_local_win32.c ecore_con_local.c ecore_con_ares.c \
97 ecore_con_info.c
98@ECORE_HAVE_WIN32_TRUE@am__objects_1 = libecore_con_la-ecore_con_local_win32.lo
99@ECORE_HAVE_WIN32_FALSE@am__objects_2 = \
100@ECORE_HAVE_WIN32_FALSE@ libecore_con_la-ecore_con_local.lo
101@HAVE_CARES_TRUE@am__objects_3 = libecore_con_la-ecore_con_ares.lo
102@HAVE_CARES_FALSE@am__objects_4 = libecore_con_la-ecore_con_info.lo
103am_libecore_con_la_OBJECTS = libecore_con_la-ecore_con.lo \
104 libecore_con_la-ecore_con_socks.lo \
105 libecore_con_la-ecore_con_ssl.lo \
106 libecore_con_la-ecore_con_url.lo \
107 libecore_con_la-ecore_con_alloc.lo $(am__objects_1) \
108 $(am__objects_2) $(am__objects_3) $(am__objects_4)
109libecore_con_la_OBJECTS = $(am_libecore_con_la_OBJECTS)
110AM_V_lt = $(am__v_lt_$(V))
111am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
112am__v_lt_0 = --silent
113libecore_con_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
114 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
115 $(libecore_con_la_CFLAGS) $(CFLAGS) $(libecore_con_la_LDFLAGS) \
116 $(LDFLAGS) -o $@
117DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
118depcomp = $(SHELL) $(top_srcdir)/depcomp
119am__depfiles_maybe = depfiles
120am__mv = mv -f
121COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
122 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
123LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
124 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
125 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
126 $(AM_CFLAGS) $(CFLAGS)
127AM_V_CC = $(am__v_CC_$(V))
128am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
129am__v_CC_0 = @echo " CC " $@;
130AM_V_at = $(am__v_at_$(V))
131am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
132am__v_at_0 = @
133CCLD = $(CC)
134LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
135 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
136 $(AM_LDFLAGS) $(LDFLAGS) -o $@
137AM_V_CCLD = $(am__v_CCLD_$(V))
138am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
139am__v_CCLD_0 = @echo " CCLD " $@;
140AM_V_GEN = $(am__v_GEN_$(V))
141am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
142am__v_GEN_0 = @echo " GEN " $@;
143SOURCES = $(libecore_con_la_SOURCES)
144DIST_SOURCES = $(am__libecore_con_la_SOURCES_DIST)
145HEADERS = $(includes_HEADERS)
146ETAGS = etags
147CTAGS = ctags
148DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
149ACLOCAL = @ACLOCAL@
150ALLOCA = @ALLOCA@
151AMTAR = @AMTAR@
152AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
153AR = @AR@
154AS = @AS@
155AUTOCONF = @AUTOCONF@
156AUTOHEADER = @AUTOHEADER@
157AUTOMAKE = @AUTOMAKE@
158AWK = @AWK@
159CARES_CFLAGS = @CARES_CFLAGS@
160CARES_LIBS = @CARES_LIBS@
161CC = @CC@
162CCDEPMODE = @CCDEPMODE@
163CFLAGS = @CFLAGS@
164CHECK_CFLAGS = @CHECK_CFLAGS@
165CHECK_LIBS = @CHECK_LIBS@
166CPP = @CPP@
167CPPFLAGS = @CPPFLAGS@
168CURL_CFLAGS = @CURL_CFLAGS@
169CURL_LIBS = @CURL_LIBS@
170CXX = @CXX@
171CXXCPP = @CXXCPP@
172CXXDEPMODE = @CXXDEPMODE@
173CXXFLAGS = @CXXFLAGS@
174CYGPATH_W = @CYGPATH_W@
175DEFS = @DEFS@
176DEPDIR = @DEPDIR@
177DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
178DIRECTFB_LIBS = @DIRECTFB_LIBS@
179DLLTOOL = @DLLTOOL@
180DSYMUTIL = @DSYMUTIL@
181DUMPBIN = @DUMPBIN@
182ECHO_C = @ECHO_C@
183ECHO_N = @ECHO_N@
184ECHO_T = @ECHO_T@
185ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
186ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
187EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
188EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
189EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
190EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
191EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
192EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
193EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
194EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
195EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
196EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
197EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
198EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
199EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
200EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
201EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
202EGREP = @EGREP@
203EINA_CFLAGS = @EINA_CFLAGS@
204EINA_LIBS = @EINA_LIBS@
205ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
206ESCAPE_LIBS = @ESCAPE_LIBS@
207EVAS_CFLAGS = @EVAS_CFLAGS@
208EVAS_LIBS = @EVAS_LIBS@
209EVIL_CFLAGS = @EVIL_CFLAGS@
210EVIL_LIBS = @EVIL_LIBS@
211EXEEXT = @EXEEXT@
212EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
213EXOTIC_LIBS = @EXOTIC_LIBS@
214FGREP = @FGREP@
215GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
216GLIB_CFLAGS = @GLIB_CFLAGS@
217GLIB_LIBS = @GLIB_LIBS@
218GMSGFMT = @GMSGFMT@
219GMSGFMT_015 = @GMSGFMT_015@
220GREP = @GREP@
221INSTALL = @INSTALL@
222INSTALL_DATA = @INSTALL_DATA@
223INSTALL_PROGRAM = @INSTALL_PROGRAM@
224INSTALL_SCRIPT = @INSTALL_SCRIPT@
225INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
226INTLLIBS = @INTLLIBS@
227INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
228KEYSYMDEFS = @KEYSYMDEFS@
229LD = @LD@
230LDFLAGS = @LDFLAGS@
231LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
232LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
233LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
234LIBICONV = @LIBICONV@
235LIBINTL = @LIBINTL@
236LIBOBJS = @LIBOBJS@
237LIBS = @LIBS@
238LIBTOOL = @LIBTOOL@
239LIPO = @LIPO@
240LN_S = @LN_S@
241LTLIBICONV = @LTLIBICONV@
242LTLIBINTL = @LTLIBINTL@
243LTLIBOBJS = @LTLIBOBJS@
244MAKEINFO = @MAKEINFO@
245MKDIR_P = @MKDIR_P@
246MSGFMT = @MSGFMT@
247MSGFMT_015 = @MSGFMT_015@
248MSGMERGE = @MSGMERGE@
249NM = @NM@
250NMEDIT = @NMEDIT@
251OBJC = @OBJC@
252OBJCDEPMODE = @OBJCDEPMODE@
253OBJCFLAGS = @OBJCFLAGS@
254OBJDUMP = @OBJDUMP@
255OBJEXT = @OBJEXT@
256OTOOL = @OTOOL@
257OTOOL64 = @OTOOL64@
258PACKAGE = @PACKAGE@
259PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
260PACKAGE_NAME = @PACKAGE_NAME@
261PACKAGE_STRING = @PACKAGE_STRING@
262PACKAGE_TARNAME = @PACKAGE_TARNAME@
263PACKAGE_URL = @PACKAGE_URL@
264PACKAGE_VERSION = @PACKAGE_VERSION@
265PATH_SEPARATOR = @PATH_SEPARATOR@
266PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
267PIXMAN_LIBS = @PIXMAN_LIBS@
268PKG_CONFIG = @PKG_CONFIG@
269PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
270PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
271POSUB = @POSUB@
272RANLIB = @RANLIB@
273SCIM_CFLAGS = @SCIM_CFLAGS@
274SCIM_LIBS = @SCIM_LIBS@
275SDL_CFLAGS = @SDL_CFLAGS@
276SDL_CONFIG = @SDL_CONFIG@
277SDL_LIBS = @SDL_LIBS@
278SED = @SED@
279SET_MAKE = @SET_MAKE@
280SHELL = @SHELL@
281SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
282SSL_CFLAGS = @SSL_CFLAGS@
283SSL_LIBS = @SSL_LIBS@
284STRIP = @STRIP@
285TLS2_CFLAGS = @TLS2_CFLAGS@
286TLS2_LIBS = @TLS2_LIBS@
287TLS_CFLAGS = @TLS_CFLAGS@
288TLS_LIBS = @TLS_LIBS@
289TSLIB_CFLAGS = @TSLIB_CFLAGS@
290TSLIB_LIBS = @TSLIB_LIBS@
291USE_NLS = @USE_NLS@
292VERSION = @VERSION@
293VMAJ = @VMAJ@
294WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
295WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
296WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
297WAYLAND_LIBS = @WAYLAND_LIBS@
298WIN32_CFLAGS = @WIN32_CFLAGS@
299WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
300WIN32_LIBS = @WIN32_LIBS@
301XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
302XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
303XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
304XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
305XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
306XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
307XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
308XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
309XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
310XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
311XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
312XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
313XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
314XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
315XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
316XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
317XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
318XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
319XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
320XCB_X11_LIBS = @XCB_X11_LIBS@
321XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
322XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
323XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
324XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
325XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
326XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
327XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
328XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
329XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
330XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
331XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
332XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
333XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
334XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
335XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
336XDAMAGE_LIBS = @XDAMAGE_LIBS@
337XDPMS_CFLAGS = @XDPMS_CFLAGS@
338XDPMS_LIBS = @XDPMS_LIBS@
339XFIXES_CFLAGS = @XFIXES_CFLAGS@
340XFIXES_LIBS = @XFIXES_LIBS@
341XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
342XGESTURE_LIBS = @XGESTURE_LIBS@
343XGETTEXT = @XGETTEXT@
344XGETTEXT_015 = @XGETTEXT_015@
345XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
346XI2_CFLAGS = @XI2_CFLAGS@
347XI2_LIBS = @XI2_LIBS@
348XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
349XINERAMA_LIBS = @XINERAMA_LIBS@
350XKB_CFLAGS = @XKB_CFLAGS@
351XKB_LIBS = @XKB_LIBS@
352XMKMF = @XMKMF@
353XPRINT_CFLAGS = @XPRINT_CFLAGS@
354XPRINT_LIBS = @XPRINT_LIBS@
355XRANDR_CFLAGS = @XRANDR_CFLAGS@
356XRANDR_LIBS = @XRANDR_LIBS@
357XRENDER_CFLAGS = @XRENDER_CFLAGS@
358XRENDER_LIBS = @XRENDER_LIBS@
359XSS_CFLAGS = @XSS_CFLAGS@
360XSS_LIBS = @XSS_LIBS@
361XTEST_CFLAGS = @XTEST_CFLAGS@
362XTEST_LIBS = @XTEST_LIBS@
363X_CFLAGS = @X_CFLAGS@
364X_EXTRA_LIBS = @X_EXTRA_LIBS@
365X_LIBS = @X_LIBS@
366X_PRE_LIBS = @X_PRE_LIBS@
367Xcursor_cflags = @Xcursor_cflags@
368Xcursor_libs = @Xcursor_libs@
369abs_builddir = @abs_builddir@
370abs_srcdir = @abs_srcdir@
371abs_top_builddir = @abs_top_builddir@
372abs_top_srcdir = @abs_top_srcdir@
373ac_ct_CC = @ac_ct_CC@
374ac_ct_CXX = @ac_ct_CXX@
375ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
376ac_ct_OBJC = @ac_ct_OBJC@
377am__include = @am__include@
378am__leading_dot = @am__leading_dot@
379am__quote = @am__quote@
380am__tar = @am__tar@
381am__untar = @am__untar@
382bindir = @bindir@
383build = @build@
384build_alias = @build_alias@
385build_cpu = @build_cpu@
386build_os = @build_os@
387build_vendor = @build_vendor@
388builddir = @builddir@
389cocoa_ldflags = @cocoa_ldflags@
390datadir = @datadir@
391datarootdir = @datarootdir@
392dlopen_libs = @dlopen_libs@
393docdir = @docdir@
394dvidir = @dvidir@
395ecore_cocoa_cflags = @ecore_cocoa_cflags@
396ecore_cocoa_libs = @ecore_cocoa_libs@
397ecore_con_cflags = @ecore_con_cflags@
398ecore_con_libs = @ecore_con_libs@
399ecore_directfb_cflags = @ecore_directfb_cflags@
400ecore_directfb_libs = @ecore_directfb_libs@
401ecore_evas_cflags = @ecore_evas_cflags@
402ecore_evas_libs = @ecore_evas_libs@
403ecore_fb_cflags = @ecore_fb_cflags@
404ecore_fb_libs = @ecore_fb_libs@
405ecore_file_cflags = @ecore_file_cflags@
406ecore_file_libs = @ecore_file_libs@
407ecore_imf_cflags = @ecore_imf_cflags@
408ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
409ecore_imf_evas_libs = @ecore_imf_evas_libs@
410ecore_imf_libs = @ecore_imf_libs@
411ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
412ecore_imf_scim_libs = @ecore_imf_scim_libs@
413ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
414ecore_imf_xim_libs = @ecore_imf_xim_libs@
415ecore_input_cflags = @ecore_input_cflags@
416ecore_input_evas_cflags = @ecore_input_evas_cflags@
417ecore_input_evas_libs = @ecore_input_evas_libs@
418ecore_input_libs = @ecore_input_libs@
419ecore_ipc_cflags = @ecore_ipc_cflags@
420ecore_ipc_libs = @ecore_ipc_libs@
421ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
422ecore_psl1ght_libs = @ecore_psl1ght_libs@
423ecore_sdl_cflags = @ecore_sdl_cflags@
424ecore_sdl_libs = @ecore_sdl_libs@
425ecore_wayland_cflags = @ecore_wayland_cflags@
426ecore_wayland_libs = @ecore_wayland_libs@
427ecore_win32_cflags = @ecore_win32_cflags@
428ecore_win32_libs = @ecore_win32_libs@
429ecore_wince_cflags = @ecore_wince_cflags@
430ecore_wince_libs = @ecore_wince_libs@
431ecore_x_cflags = @ecore_x_cflags@
432ecore_x_libs = @ecore_x_libs@
433ecore_x_libs_private = @ecore_x_libs_private@
434efl_doxygen = @efl_doxygen@
435efl_have_doxygen = @efl_have_doxygen@
436exec_prefix = @exec_prefix@
437have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
438host = @host@
439host_alias = @host_alias@
440host_cpu = @host_cpu@
441host_os = @host_os@
442host_vendor = @host_vendor@
443htmldir = @htmldir@
444includedir = @includedir@
445infodir = @infodir@
446install_sh = @install_sh@
447libdir = @libdir@
448libexecdir = @libexecdir@
449localedir = @localedir@
450localstatedir = @localstatedir@
451lt_ECHO = @lt_ECHO@
452lt_enable_auto_import = @lt_enable_auto_import@
453mandir = @mandir@
454mkdir_p = @mkdir_p@
455oldincludedir = @oldincludedir@
456pdfdir = @pdfdir@
457pkgconfig_requires_private = @pkgconfig_requires_private@
458prefix = @prefix@
459program_transform_name = @program_transform_name@
460psdir = @psdir@
461release_info = @release_info@
462requirements_ecore = @requirements_ecore@
463requirements_ecore_cocoa = @requirements_ecore_cocoa@
464requirements_ecore_con = @requirements_ecore_con@
465requirements_ecore_directfb = @requirements_ecore_directfb@
466requirements_ecore_evas = @requirements_ecore_evas@
467requirements_ecore_fb = @requirements_ecore_fb@
468requirements_ecore_file = @requirements_ecore_file@
469requirements_ecore_imf = @requirements_ecore_imf@
470requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
471requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
472requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
473requirements_ecore_input = @requirements_ecore_input@
474requirements_ecore_input_evas = @requirements_ecore_input_evas@
475requirements_ecore_ipc = @requirements_ecore_ipc@
476requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
477requirements_ecore_sdl = @requirements_ecore_sdl@
478requirements_ecore_wayland = @requirements_ecore_wayland@
479requirements_ecore_win32 = @requirements_ecore_win32@
480requirements_ecore_wince = @requirements_ecore_wince@
481requirements_ecore_x = @requirements_ecore_x@
482rt_libs = @rt_libs@
483sbindir = @sbindir@
484sharedstatedir = @sharedstatedir@
485srcdir = @srcdir@
486sysconfdir = @sysconfdir@
487target_alias = @target_alias@
488top_build_prefix = @top_build_prefix@
489top_builddir = @top_builddir@
490top_srcdir = @top_srcdir@
491version_info = @version_info@
492x_cflags = @x_cflags@
493x_includes = @x_includes@
494x_libs = @x_libs@
495MAINTAINERCLEANFILES = Makefile.in
496AM_CPPFLAGS = \
497-I$(top_builddir)/src/lib/ecore \
498-I$(top_builddir)/src/lib/ecore_con \
499-I$(top_srcdir)/src/lib/ecore \
500-I$(top_srcdir)/src/lib/ecore_con \
501@EFL_ECORE_CON_BUILD@ \
502@SSL_CFLAGS@ \
503@CURL_CFLAGS@ \
504@EINA_CFLAGS@ \
505@TLS_CFLAGS@ \
506@CARES_CFLAGS@ \
507@WIN32_CPPFLAGS@
508
509lib_LTLIBRARIES = libecore_con.la
510includes_HEADERS = Ecore_Con.h
511includesdir = $(includedir)/ecore-@VMAJ@
512libecore_con_la_SOURCES = ecore_con.c ecore_con_socks.c \
513 ecore_con_ssl.c ecore_con_url.c ecore_con_alloc.c \
514 $(am__append_1) $(am__append_2) $(am__append_3) \
515 $(am__append_4)
516libecore_con_la_CFLAGS = @WIN32_CFLAGS@
517libecore_con_la_LIBADD = \
518$(top_builddir)/src/lib/ecore/libecore.la \
519@SSL_LIBS@ @CURL_LIBS@ @EINA_LIBS@ @TLS_LIBS@ @CARES_LIBS@ @WIN32_LIBS@
520
521libecore_con_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
522EXTRA_DIST = ecore_con_private.h
523all: all-am
524
525.SUFFIXES:
526.SUFFIXES: .c .lo .o .obj
527$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
528 @for dep in $?; do \
529 case '$(am__configure_deps)' in \
530 *$$dep*) \
531 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
532 && { if test -f $@; then exit 0; else break; fi; }; \
533 exit 1;; \
534 esac; \
535 done; \
536 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_con/Makefile'; \
537 $(am__cd) $(top_srcdir) && \
538 $(AUTOMAKE) --gnu src/lib/ecore_con/Makefile
539.PRECIOUS: Makefile
540Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
541 @case '$?' in \
542 *config.status*) \
543 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
544 *) \
545 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
546 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
547 esac;
548
549$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
550 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
551
552$(top_srcdir)/configure: $(am__configure_deps)
553 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
554$(ACLOCAL_M4): $(am__aclocal_m4_deps)
555 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
556$(am__aclocal_m4_deps):
557install-libLTLIBRARIES: $(lib_LTLIBRARIES)
558 @$(NORMAL_INSTALL)
559 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
560 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
561 list2=; for p in $$list; do \
562 if test -f $$p; then \
563 list2="$$list2 $$p"; \
564 else :; fi; \
565 done; \
566 test -z "$$list2" || { \
567 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
568 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
569 }
570
571uninstall-libLTLIBRARIES:
572 @$(NORMAL_UNINSTALL)
573 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
574 for p in $$list; do \
575 $(am__strip_dir) \
576 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
577 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
578 done
579
580clean-libLTLIBRARIES:
581 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
582 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
583 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
584 test "$$dir" != "$$p" || dir=.; \
585 echo "rm -f \"$${dir}/so_locations\""; \
586 rm -f "$${dir}/so_locations"; \
587 done
588libecore_con.la: $(libecore_con_la_OBJECTS) $(libecore_con_la_DEPENDENCIES)
589 $(AM_V_CCLD)$(libecore_con_la_LINK) -rpath $(libdir) $(libecore_con_la_OBJECTS) $(libecore_con_la_LIBADD) $(LIBS)
590
591mostlyclean-compile:
592 -rm -f *.$(OBJEXT)
593
594distclean-compile:
595 -rm -f *.tab.c
596
597@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con.Plo@am__quote@
598@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_alloc.Plo@am__quote@
599@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_ares.Plo@am__quote@
600@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_info.Plo@am__quote@
601@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_local.Plo@am__quote@
602@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_local_win32.Plo@am__quote@
603@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_socks.Plo@am__quote@
604@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_ssl.Plo@am__quote@
605@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_url.Plo@am__quote@
606
607.c.o:
608@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
609@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
610@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
611@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
612@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
613@am__fastdepCC_FALSE@ $(COMPILE) -c $<
614
615.c.obj:
616@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
617@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
618@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
619@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
620@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
621@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
622
623.c.lo:
624@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
625@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
626@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
627@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
628@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
629@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
630
631libecore_con_la-ecore_con.lo: ecore_con.c
632@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
633@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con.Tpo $(DEPDIR)/libecore_con_la-ecore_con.Plo
634@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
635@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con.c' object='libecore_con_la-ecore_con.lo' libtool=yes @AMDEPBACKSLASH@
636@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
637@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
638
639libecore_con_la-ecore_con_socks.lo: ecore_con_socks.c
640@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_socks.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_socks.Tpo -c -o libecore_con_la-ecore_con_socks.lo `test -f 'ecore_con_socks.c' || echo '$(srcdir)/'`ecore_con_socks.c
641@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_socks.Tpo $(DEPDIR)/libecore_con_la-ecore_con_socks.Plo
642@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
643@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_socks.c' object='libecore_con_la-ecore_con_socks.lo' libtool=yes @AMDEPBACKSLASH@
644@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
645@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_socks.lo `test -f 'ecore_con_socks.c' || echo '$(srcdir)/'`ecore_con_socks.c
646
647libecore_con_la-ecore_con_ssl.lo: ecore_con_ssl.c
648@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
649@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_ssl.Tpo $(DEPDIR)/libecore_con_la-ecore_con_ssl.Plo
650@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
651@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_ssl.c' object='libecore_con_la-ecore_con_ssl.lo' libtool=yes @AMDEPBACKSLASH@
652@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
653@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
654
655libecore_con_la-ecore_con_url.lo: ecore_con_url.c
656@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
657@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_url.Tpo $(DEPDIR)/libecore_con_la-ecore_con_url.Plo
658@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
659@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_url.c' object='libecore_con_la-ecore_con_url.lo' libtool=yes @AMDEPBACKSLASH@
660@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
661@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
662
663libecore_con_la-ecore_con_alloc.lo: ecore_con_alloc.c
664@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
665@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_alloc.Tpo $(DEPDIR)/libecore_con_la-ecore_con_alloc.Plo
666@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
667@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_alloc.c' object='libecore_con_la-ecore_con_alloc.lo' libtool=yes @AMDEPBACKSLASH@
668@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
669@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
670
671libecore_con_la-ecore_con_local_win32.lo: ecore_con_local_win32.c
672@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
673@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
674@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
675@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_local_win32.c' object='libecore_con_la-ecore_con_local_win32.lo' libtool=yes @AMDEPBACKSLASH@
676@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
677@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
678
679libecore_con_la-ecore_con_local.lo: ecore_con_local.c
680@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
681@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_local.Tpo $(DEPDIR)/libecore_con_la-ecore_con_local.Plo
682@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
683@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_local.c' object='libecore_con_la-ecore_con_local.lo' libtool=yes @AMDEPBACKSLASH@
684@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
685@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
686
687libecore_con_la-ecore_con_ares.lo: ecore_con_ares.c
688@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
689@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_ares.Tpo $(DEPDIR)/libecore_con_la-ecore_con_ares.Plo
690@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
691@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_ares.c' object='libecore_con_la-ecore_con_ares.lo' libtool=yes @AMDEPBACKSLASH@
692@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
693@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
694
695libecore_con_la-ecore_con_info.lo: ecore_con_info.c
696@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
697@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_info.Tpo $(DEPDIR)/libecore_con_la-ecore_con_info.Plo
698@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
699@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_info.c' object='libecore_con_la-ecore_con_info.lo' libtool=yes @AMDEPBACKSLASH@
700@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
701@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
702
703mostlyclean-libtool:
704 -rm -f *.lo
705
706clean-libtool:
707 -rm -rf .libs _libs
708install-includesHEADERS: $(includes_HEADERS)
709 @$(NORMAL_INSTALL)
710 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
711 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
712 for p in $$list; do \
713 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
714 echo "$$d$$p"; \
715 done | $(am__base_list) | \
716 while read files; do \
717 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
718 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
719 done
720
721uninstall-includesHEADERS:
722 @$(NORMAL_UNINSTALL)
723 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
724 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
725 test -n "$$files" || exit 0; \
726 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
727 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
728
729ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
730 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
731 unique=`for i in $$list; do \
732 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
733 done | \
734 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
735 END { if (nonempty) { for (i in files) print i; }; }'`; \
736 mkid -fID $$unique
737tags: TAGS
738
739TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
740 $(TAGS_FILES) $(LISP)
741 set x; \
742 here=`pwd`; \
743 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
744 unique=`for i in $$list; do \
745 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
746 done | \
747 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
748 END { if (nonempty) { for (i in files) print i; }; }'`; \
749 shift; \
750 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
751 test -n "$$unique" || unique=$$empty_fix; \
752 if test $$# -gt 0; then \
753 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
754 "$$@" $$unique; \
755 else \
756 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
757 $$unique; \
758 fi; \
759 fi
760ctags: CTAGS
761CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
762 $(TAGS_FILES) $(LISP)
763 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
764 unique=`for i in $$list; do \
765 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
766 done | \
767 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
768 END { if (nonempty) { for (i in files) print i; }; }'`; \
769 test -z "$(CTAGS_ARGS)$$unique" \
770 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
771 $$unique
772
773GTAGS:
774 here=`$(am__cd) $(top_builddir) && pwd` \
775 && $(am__cd) $(top_srcdir) \
776 && gtags -i $(GTAGS_ARGS) "$$here"
777
778distclean-tags:
779 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
780
781distdir: $(DISTFILES)
782 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
783 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
784 list='$(DISTFILES)'; \
785 dist_files=`for file in $$list; do echo $$file; done | \
786 sed -e "s|^$$srcdirstrip/||;t" \
787 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
788 case $$dist_files in \
789 */*) $(MKDIR_P) `echo "$$dist_files" | \
790 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
791 sort -u` ;; \
792 esac; \
793 for file in $$dist_files; do \
794 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
795 if test -d $$d/$$file; then \
796 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
797 if test -d "$(distdir)/$$file"; then \
798 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
799 fi; \
800 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
801 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
802 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
803 fi; \
804 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
805 else \
806 test -f "$(distdir)/$$file" \
807 || cp -p $$d/$$file "$(distdir)/$$file" \
808 || exit 1; \
809 fi; \
810 done
811check-am: all-am
812check: check-am
813all-am: Makefile $(LTLIBRARIES) $(HEADERS)
814installdirs:
815 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
816 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
817 done
818install: install-am
819install-exec: install-exec-am
820install-data: install-data-am
821uninstall: uninstall-am
822
823install-am: all-am
824 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
825
826installcheck: installcheck-am
827install-strip:
828 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
829 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
830 `test -z '$(STRIP)' || \
831 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
832mostlyclean-generic:
833
834clean-generic:
835
836distclean-generic:
837 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
838 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
839
840maintainer-clean-generic:
841 @echo "This command is intended for maintainers to use"
842 @echo "it deletes files that may require special tools to rebuild."
843 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
844clean: clean-am
845
846clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
847 mostlyclean-am
848
849distclean: distclean-am
850 -rm -rf ./$(DEPDIR)
851 -rm -f Makefile
852distclean-am: clean-am distclean-compile distclean-generic \
853 distclean-tags
854
855dvi: dvi-am
856
857dvi-am:
858
859html: html-am
860
861html-am:
862
863info: info-am
864
865info-am:
866
867install-data-am: install-includesHEADERS
868
869install-dvi: install-dvi-am
870
871install-dvi-am:
872
873install-exec-am: install-libLTLIBRARIES
874
875install-html: install-html-am
876
877install-html-am:
878
879install-info: install-info-am
880
881install-info-am:
882
883install-man:
884
885install-pdf: install-pdf-am
886
887install-pdf-am:
888
889install-ps: install-ps-am
890
891install-ps-am:
892
893installcheck-am:
894
895maintainer-clean: maintainer-clean-am
896 -rm -rf ./$(DEPDIR)
897 -rm -f Makefile
898maintainer-clean-am: distclean-am maintainer-clean-generic
899
900mostlyclean: mostlyclean-am
901
902mostlyclean-am: mostlyclean-compile mostlyclean-generic \
903 mostlyclean-libtool
904
905pdf: pdf-am
906
907pdf-am:
908
909ps: ps-am
910
911ps-am:
912
913uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
914
915.MAKE: install-am install-strip
916
917.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
918 clean-libLTLIBRARIES clean-libtool ctags distclean \
919 distclean-compile distclean-generic distclean-libtool \
920 distclean-tags distdir dvi dvi-am html html-am info info-am \
921 install install-am install-data install-data-am install-dvi \
922 install-dvi-am install-exec install-exec-am install-html \
923 install-html-am install-includesHEADERS install-info \
924 install-info-am install-libLTLIBRARIES install-man install-pdf \
925 install-pdf-am install-ps install-ps-am install-strip \
926 installcheck installcheck-am installdirs maintainer-clean \
927 maintainer-clean-generic mostlyclean mostlyclean-compile \
928 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
929 tags uninstall uninstall-am uninstall-includesHEADERS \
930 uninstall-libLTLIBRARIES
931
932
933# Tell versions [3.59,3.63) of GNU make to not export all variables.
934# Otherwise a system limit (for SysV at least) may be exceeded.
935.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con.c b/libraries/ecore/src/lib/ecore_con/ecore_con.c
deleted file mode 100644
index fe83478..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con.c
+++ /dev/null
@@ -1,2583 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <errno.h>
10#include <unistd.h>
11#include <fcntl.h>
12
13#ifdef HAVE_NETINET_TCP_H
14# include <netinet/tcp.h>
15#endif
16
17#ifdef HAVE_NETINET_IN_H
18# include <netinet/in.h>
19#endif
20
21#ifdef HAVE_ARPA_INET_H
22# include <arpa/inet.h>
23#endif
24
25#ifdef HAVE_SYS_SOCKET_H
26# include <sys/socket.h>
27#endif
28
29#ifdef HAVE_SYS_UN_H
30# include <sys/un.h>
31#endif
32
33#ifdef HAVE_WS2TCPIP_H
34# include <ws2tcpip.h>
35#endif
36
37#ifdef HAVE_EVIL
38# include <Evil.h>
39#endif
40
41#include "Ecore.h"
42#include "ecore_private.h"
43#include "Ecore_Con.h"
44#include "ecore_con_private.h"
45
46static Eina_Bool _ecore_con_client_timer(Ecore_Con_Client *cl);
47static void _ecore_con_cl_timer_update(Ecore_Con_Client *cl);
48static Eina_Bool _ecore_con_server_timer(Ecore_Con_Server *svr);
49static void _ecore_con_server_timer_update(Ecore_Con_Server *svr);
50
51static void _ecore_con_cb_tcp_connect(void *data,
52 Ecore_Con_Info *info);
53static void _ecore_con_cb_udp_connect(void *data,
54 Ecore_Con_Info *info);
55static void _ecore_con_cb_tcp_listen(void *data,
56 Ecore_Con_Info *info);
57static void _ecore_con_cb_udp_listen(void *data,
58 Ecore_Con_Info *info);
59
60static void _ecore_con_server_free(Ecore_Con_Server *svr);
61static void _ecore_con_client_free(Ecore_Con_Client *cl);
62
63static void _ecore_con_cl_read(Ecore_Con_Server *svr);
64static Eina_Bool _ecore_con_svr_tcp_handler(void *data,
65 Ecore_Fd_Handler *fd_handler);
66static Eina_Bool _ecore_con_cl_handler(void *data,
67 Ecore_Fd_Handler *fd_handler);
68static Eina_Bool _ecore_con_cl_udp_handler(void *data,
69 Ecore_Fd_Handler *fd_handler);
70static Eina_Bool _ecore_con_svr_udp_handler(void *data,
71 Ecore_Fd_Handler *fd_handler);
72
73static void _ecore_con_svr_cl_read(Ecore_Con_Client *cl);
74static Eina_Bool _ecore_con_svr_cl_handler(void *data,
75 Ecore_Fd_Handler *fd_handler);
76
77static void _ecore_con_server_flush(Ecore_Con_Server *svr);
78static void _ecore_con_client_flush(Ecore_Con_Client *cl);
79
80static void _ecore_con_event_client_add_free(Ecore_Con_Server *svr,
81 void *ev);
82static void _ecore_con_event_client_del_free(Ecore_Con_Server *svr,
83 void *ev);
84static void _ecore_con_event_client_data_free(Ecore_Con_Server *svr,
85 void *ev);
86static void _ecore_con_event_server_add_free(void *data,
87 void *ev);
88static void _ecore_con_event_server_del_free(void *data,
89 void *ev);
90static void _ecore_con_event_server_data_free(void *data,
91 void *ev);
92static void _ecore_con_event_server_error_free(void *data,
93 Ecore_Con_Event_Server_Error *e);
94static void _ecore_con_event_client_error_free(Ecore_Con_Server *svr,
95 Ecore_Con_Event_Client_Error *e);
96static void _ecore_con_event_server_write_free(void *data,
97 Ecore_Con_Event_Server_Write *e);
98static void _ecore_con_event_client_write_free(Ecore_Con_Server *svr,
99 Ecore_Con_Event_Client_Write *e);
100
101static void _ecore_con_lookup_done(void *data,
102 Ecore_Con_Info *infos);
103
104static const char * _ecore_con_pretty_ip(struct sockaddr *client_addr);
105
106
107void
108_ecore_con_client_kill(Ecore_Con_Client *cl)
109{
110 if (cl->delete_me)
111 DBG("Multi kill request for client %p", cl);
112 else
113 {
114 ecore_con_event_client_del(cl);
115 if (cl->buf) return;
116 }
117 INF("Lost client %s", (cl->ip) ? cl->ip : "");
118 if (cl->fd_handler)
119 ecore_main_fd_handler_del(cl->fd_handler);
120
121 cl->fd_handler = NULL;
122}
123
124void
125_ecore_con_server_kill(Ecore_Con_Server *svr)
126{
127 if (svr->delete_me)
128 DBG("Multi kill request for svr %p", svr);
129 else
130 ecore_con_event_server_del(svr);
131
132 if (svr->fd_handler)
133 ecore_main_fd_handler_del(svr->fd_handler);
134
135 svr->fd_handler = NULL;
136}
137
138#define _ecore_con_server_kill(svr) do { \
139 DBG("KILL %p", (svr)); \
140 _ecore_con_server_kill((svr)); \
141} while (0)
142
143#define _ecore_con_client_kill(cl) do { \
144 DBG("KILL %p", (cl)); \
145 _ecore_con_client_kill((cl)); \
146} while (0)
147
148EAPI int ECORE_CON_EVENT_CLIENT_ADD = 0;
149EAPI int ECORE_CON_EVENT_CLIENT_DEL = 0;
150EAPI int ECORE_CON_EVENT_SERVER_ADD = 0;
151EAPI int ECORE_CON_EVENT_SERVER_DEL = 0;
152EAPI int ECORE_CON_EVENT_CLIENT_DATA = 0;
153EAPI int ECORE_CON_EVENT_SERVER_DATA = 0;
154EAPI int ECORE_CON_EVENT_CLIENT_WRITE = 0;
155EAPI int ECORE_CON_EVENT_SERVER_WRITE = 0;
156EAPI int ECORE_CON_EVENT_CLIENT_ERROR = 0;
157EAPI int ECORE_CON_EVENT_SERVER_ERROR = 0;
158EAPI int ECORE_CON_EVENT_PROXY_BIND = 0;
159
160static Eina_List *servers = NULL;
161static int _ecore_con_init_count = 0;
162static int _ecore_con_event_count = 0;
163int _ecore_con_log_dom = -1;
164Ecore_Con_Socks *_ecore_con_proxy_once = NULL;
165Ecore_Con_Socks *_ecore_con_proxy_global = NULL;
166
167EAPI int
168ecore_con_init(void)
169{
170 if (++_ecore_con_init_count != 1)
171 return _ecore_con_init_count;
172
173#ifdef HAVE_EVIL
174 if (!evil_init())
175 return --_ecore_con_init_count;
176
177#endif
178
179 if (!ecore_init())
180 return --_ecore_con_init_count;
181
182 _ecore_con_log_dom = eina_log_domain_register
183 ("ecore_con", ECORE_CON_DEFAULT_LOG_COLOR);
184 if (_ecore_con_log_dom < 0)
185 {
186 EINA_LOG_ERR("Impossible to create a log domain for Ecore Con.");
187 ecore_shutdown();
188 return --_ecore_con_init_count;
189 }
190
191 ecore_con_mempool_init();
192
193 ECORE_CON_EVENT_CLIENT_ADD = ecore_event_type_new();
194 ECORE_CON_EVENT_CLIENT_DEL = ecore_event_type_new();
195 ECORE_CON_EVENT_SERVER_ADD = ecore_event_type_new();
196 ECORE_CON_EVENT_SERVER_DEL = ecore_event_type_new();
197 ECORE_CON_EVENT_CLIENT_DATA = ecore_event_type_new();
198 ECORE_CON_EVENT_SERVER_DATA = ecore_event_type_new();
199 ECORE_CON_EVENT_CLIENT_WRITE = ecore_event_type_new();
200 ECORE_CON_EVENT_SERVER_WRITE = ecore_event_type_new();
201 ECORE_CON_EVENT_CLIENT_ERROR = ecore_event_type_new();
202 ECORE_CON_EVENT_SERVER_ERROR = ecore_event_type_new();
203 ECORE_CON_EVENT_PROXY_BIND = ecore_event_type_new();
204
205
206 eina_magic_string_set(ECORE_MAGIC_CON_SERVER, "Ecore_Con_Server");
207 eina_magic_string_set(ECORE_MAGIC_CON_CLIENT, "Ecore_Con_Server");
208 eina_magic_string_set(ECORE_MAGIC_CON_URL, "Ecore_Con_Url");
209
210 /* TODO Remember return value, if it fails, use gethostbyname() */
211 ecore_con_socks_init();
212 ecore_con_ssl_init();
213 ecore_con_info_init();
214
215 return _ecore_con_init_count;
216}
217
218EAPI int
219ecore_con_shutdown(void)
220{
221 Eina_List *l, *l2;
222 Ecore_Con_Server *svr;
223
224 if (--_ecore_con_init_count != 0)
225 return _ecore_con_init_count;
226
227 EINA_LIST_FOREACH_SAFE(servers, l, l2, svr)
228 {
229 Ecore_Con_Event_Server_Add *ev;
230
231 svr->delete_me = EINA_TRUE;
232 INF("svr %p is dead", svr);
233 /* some pointer hacks here to prevent double frees if people are being stupid */
234 EINA_LIST_FREE(svr->event_count, ev)
235 ev->server = NULL;
236 _ecore_con_server_free(svr);
237 }
238
239 ecore_con_socks_shutdown();
240 if (!_ecore_con_event_count) ecore_con_mempool_shutdown();
241
242 ecore_con_info_shutdown();
243 ecore_con_ssl_shutdown();
244 eina_log_domain_unregister(_ecore_con_log_dom);
245 _ecore_con_log_dom = -1;
246 ecore_shutdown();
247#ifdef HAVE_EVIL
248 evil_shutdown();
249#endif
250
251 return _ecore_con_init_count;
252}
253
254EAPI Eina_Bool
255ecore_con_lookup(const char *name,
256 Ecore_Con_Dns_Cb done_cb,
257 const void *data)
258{
259 Ecore_Con_Server *svr;
260 Ecore_Con_Lookup *lk;
261 struct addrinfo hints;
262
263 if (!name || !done_cb)
264 return EINA_FALSE;
265
266 svr = calloc(1, sizeof(Ecore_Con_Server));
267 if (!svr)
268 return EINA_FALSE;
269
270 lk = malloc(sizeof (Ecore_Con_Lookup));
271 if (!lk)
272 {
273 free(svr);
274 return EINA_FALSE;
275 }
276
277 lk->done_cb = done_cb;
278 lk->data = data;
279
280 svr->name = strdup(name);
281 if (!svr->name)
282 goto on_error;
283
284 svr->type = ECORE_CON_REMOTE_TCP;
285 svr->port = 1025;
286 svr->data = lk;
287 svr->created = EINA_TRUE;
288 svr->reject_excess_clients = EINA_FALSE;
289 svr->client_limit = -1;
290 svr->clients = NULL;
291 svr->ppid = getpid();
292
293 memset(&hints, 0, sizeof(struct addrinfo));
294 hints.ai_family = AF_UNSPEC;
295 hints.ai_socktype = SOCK_STREAM;
296 hints.ai_flags = AI_CANONNAME;
297 hints.ai_protocol = IPPROTO_TCP;
298 hints.ai_canonname = NULL;
299 hints.ai_next = NULL;
300 hints.ai_addr = NULL;
301
302 if (ecore_con_info_get(svr, _ecore_con_lookup_done, svr,
303 &hints))
304 return EINA_TRUE;
305
306 free(svr->name);
307on_error:
308 free(lk);
309 free(svr);
310 return EINA_FALSE;
311}
312
313/**
314 * @addtogroup Ecore_Con_Server_Group Ecore Connection Server Functions
315 *
316 * Functions that operate on Ecore server objects.
317 *
318 * @{
319 */
320
321/**
322 * @example ecore_con_server_example.c
323 * Shows how to write a simple server using the Ecore_Con library.
324 */
325
326EAPI Ecore_Con_Server *
327ecore_con_server_add(Ecore_Con_Type compl_type,
328 const char *name,
329 int port,
330 const void *data)
331{
332 Ecore_Con_Server *svr;
333 Ecore_Con_Type type;
334
335 if (port < 0 || !name)
336 return NULL; /* local user socket: FILE: ~/.ecore/[name]/[port] */
337
338 /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
339 /* remote system socket: TCP/IP: [name]:[port] */
340 svr = calloc(1, sizeof(Ecore_Con_Server));
341 if (!svr)
342 return NULL;
343
344 svr->name = strdup(name);
345 if (!svr->name)
346 goto error;
347
348 svr->type = compl_type;
349 svr->port = port;
350 svr->data = (void *)data;
351 svr->created = EINA_TRUE;
352 svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
353 svr->reject_excess_clients = EINA_FALSE;
354 svr->client_limit = -1;
355 svr->clients = NULL;
356 svr->ppid = getpid();
357 if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL))
358 goto error;
359
360 type = compl_type & ECORE_CON_TYPE;
361
362 if ((type == ECORE_CON_LOCAL_USER) ||
363 (type == ECORE_CON_LOCAL_SYSTEM) ||
364 (type == ECORE_CON_LOCAL_ABSTRACT))
365 /* Local */
366#ifdef _WIN32
367 if (!ecore_con_local_listen(svr))
368 goto error;
369#else
370 if (!ecore_con_local_listen(svr, _ecore_con_svr_tcp_handler, svr))
371 goto error;
372#endif
373
374 if ((type == ECORE_CON_REMOTE_TCP) ||
375 (type == ECORE_CON_REMOTE_NODELAY) ||
376 (type == ECORE_CON_REMOTE_CORK))
377 {
378 /* TCP */
379 if (!ecore_con_info_tcp_listen(svr, _ecore_con_cb_tcp_listen,
380 svr))
381 goto error;
382 }
383 else if ((type == ECORE_CON_REMOTE_MCAST) ||
384 (type == ECORE_CON_REMOTE_UDP))
385 /* UDP and MCAST */
386 if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen,
387 svr))
388 goto error;
389
390 servers = eina_list_append(servers, svr);
391 ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
392
393 return svr;
394
395error:
396 if (svr->name)
397 free(svr->name);
398
399 if (svr->path)
400 free(svr->path);
401
402
403 if (svr->fd_handler)
404 ecore_main_fd_handler_del(svr->fd_handler);
405
406 if (svr->fd > 0)
407 close(svr->fd);
408
409 if (svr->buf)
410 eina_binbuf_free(svr->buf);
411
412 if (svr->ip)
413 eina_stringshare_del(svr->ip);
414
415 ecore_con_ssl_server_shutdown(svr);
416 free(svr);
417 return NULL;
418}
419
420EAPI Ecore_Con_Server *
421ecore_con_server_connect(Ecore_Con_Type compl_type,
422 const char *name,
423 int port,
424 const void *data)
425{
426 Ecore_Con_Server *svr;
427 Ecore_Con_Type type;
428
429 if ((!name) || (!name[0]))
430 return NULL;
431 /* local user socket: FILE: ~/.ecore/[name]/[port] */
432 /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
433 /* remote system socket: TCP/IP: [name]:[port] */
434 svr = calloc(1, sizeof(Ecore_Con_Server));
435 if (!svr)
436 return NULL;
437
438 svr->name = strdup(name);
439 if (!svr->name)
440 goto error;
441
442 svr->type = compl_type;
443 svr->port = port;
444 svr->data = (void *)data;
445 svr->created = EINA_FALSE;
446 svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
447 svr->reject_excess_clients = EINA_FALSE;
448 svr->clients = NULL;
449 svr->client_limit = -1;
450
451 type = compl_type & ECORE_CON_TYPE;
452
453 if (type > ECORE_CON_LOCAL_ABSTRACT)
454 {
455 /* never use proxies on local connections */
456 if (_ecore_con_proxy_once)
457 svr->ecs = _ecore_con_proxy_once;
458 else if (_ecore_con_proxy_global)
459 svr->ecs = _ecore_con_proxy_global;
460 _ecore_con_proxy_once = NULL;
461 if (svr->ecs)
462 {
463 if ((!svr->ecs->lookup) &&
464 (!ecore_con_lookup(svr->name, (Ecore_Con_Dns_Cb)ecore_con_socks_dns_cb, svr)))
465 goto error;
466 if (svr->ecs->lookup)
467 svr->ecs_state = ECORE_CON_PROXY_STATE_RESOLVED;
468 }
469 }
470 if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL))
471 goto error;
472
473 if (((type == ECORE_CON_REMOTE_TCP) ||
474 (type == ECORE_CON_REMOTE_NODELAY) ||
475 (type == ECORE_CON_REMOTE_CORK) ||
476 (type == ECORE_CON_REMOTE_UDP) ||
477 (type == ECORE_CON_REMOTE_BROADCAST)) &&
478 (port < 0))
479 goto error;
480
481 if ((type == ECORE_CON_LOCAL_USER) ||
482 (type == ECORE_CON_LOCAL_SYSTEM) ||
483 (type == ECORE_CON_LOCAL_ABSTRACT))
484 /* Local */
485#ifdef _WIN32
486 if (!ecore_con_local_connect(svr, _ecore_con_cl_handler))
487 goto error;
488#else
489 if (!ecore_con_local_connect(svr, _ecore_con_cl_handler, svr))
490 goto error;
491#endif
492
493 if ((type == ECORE_CON_REMOTE_TCP) ||
494 (type == ECORE_CON_REMOTE_NODELAY) ||
495 (type == ECORE_CON_REMOTE_CORK))
496 {
497 /* TCP */
498 if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect,
499 svr))
500 goto error;
501 }
502 else if ((type == ECORE_CON_REMOTE_UDP) ||
503 (type == ECORE_CON_REMOTE_BROADCAST))
504 /* UDP and MCAST */
505 if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect,
506 svr))
507 goto error;
508
509 servers = eina_list_append(servers, svr);
510 ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
511
512 return svr;
513
514error:
515 if (svr->name)
516 free(svr->name);
517
518 if (svr->path)
519 free(svr->path);
520
521 if (svr->fd_handler)
522 ecore_main_fd_handler_del(svr->fd_handler);
523
524 if (svr->fd > 0)
525 close(svr->fd);
526
527 ecore_con_ssl_server_shutdown(svr);
528 free(svr);
529 return NULL;
530}
531
532EAPI void
533ecore_con_server_timeout_set(Ecore_Con_Server *svr,
534 double timeout)
535{
536 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
537 {
538 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_timeout_set");
539 return;
540 }
541
542 if (svr->created)
543 svr->client_disconnect_time = timeout;
544 else
545 svr->disconnect_time = timeout;
546}
547
548EAPI double
549ecore_con_server_timeout_get(Ecore_Con_Server *svr)
550{
551 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
552 {
553 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_timeout_get");
554 return 0;
555 }
556
557 return svr->created ? svr->client_disconnect_time : svr->disconnect_time;
558}
559
560EAPI void *
561ecore_con_server_del(Ecore_Con_Server *svr)
562{
563 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
564 {
565 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del");
566 return NULL;
567 }
568
569 if (svr->delete_me)
570 return NULL;
571
572 _ecore_con_server_kill(svr);
573 return svr->data;
574}
575
576EAPI void *
577ecore_con_server_data_get(Ecore_Con_Server *svr)
578{
579 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
580 {
581 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get");
582 return NULL;
583 }
584
585 return svr->data;
586}
587
588EAPI void *
589ecore_con_server_data_set(Ecore_Con_Server *svr,
590 void *data)
591{
592 void *ret = NULL;
593
594 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
595 {
596 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get");
597 return NULL;
598 }
599
600 ret = svr->data;
601 svr->data = data;
602 return ret;
603}
604
605EAPI Eina_Bool
606ecore_con_server_connected_get(Ecore_Con_Server *svr)
607{
608 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
609 {
610 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_connected_get");
611 return EINA_FALSE;
612 }
613
614 if (svr->connecting)
615 return EINA_FALSE;
616
617 return EINA_TRUE;
618}
619
620EAPI const Eina_List *
621ecore_con_server_clients_get(Ecore_Con_Server *svr)
622{
623 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
624 {
625 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
626 "ecore_con_server_clients_get");
627 return NULL;
628 }
629
630 return svr->clients;
631}
632
633EAPI const char *
634ecore_con_server_name_get(Ecore_Con_Server *svr)
635{
636 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
637 {
638 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
639 "ecore_con_server_name_get");
640 return NULL;
641 }
642
643 return svr->name;
644}
645
646EAPI int
647ecore_con_server_port_get(Ecore_Con_Server *svr)
648{
649 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
650 {
651 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
652 "ecore_con_server_port_get");
653 return -1;
654 }
655 return svr->port;
656}
657
658EAPI int
659ecore_con_server_send(Ecore_Con_Server *svr,
660 const void *data,
661 int size)
662{
663 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
664 {
665 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_send");
666 return 0;
667 }
668
669 EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->delete_me, 0);
670
671 EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
672
673 EINA_SAFETY_ON_TRUE_RETURN_VAL(size < 1, 0);
674
675 if (svr->fd_handler)
676 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
677
678 if (!svr->buf)
679 {
680 svr->buf = eina_binbuf_new();
681 EINA_SAFETY_ON_NULL_RETURN_VAL(svr->buf, 0);
682#ifdef TCP_CORK
683 if ((svr->fd >= 0) && ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
684 {
685 int state = 1;
686 if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
687 /* realistically this isn't anything serious so we can just log and continue */
688 ERR("corking failed! %s", strerror(errno));
689 }
690#endif
691 }
692 eina_binbuf_append_length(svr->buf, data, size);
693
694 return size;
695}
696
697EAPI void
698ecore_con_server_client_limit_set(Ecore_Con_Server *svr,
699 int client_limit,
700 char reject_excess_clients)
701{
702 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
703 {
704 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
705 "ecore_con_server_client_limit_set");
706 return;
707 }
708
709 svr->client_limit = client_limit;
710 svr->reject_excess_clients = reject_excess_clients;
711}
712
713EAPI const char *
714ecore_con_server_ip_get(Ecore_Con_Server *svr)
715{
716 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
717 {
718 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_ip_get");
719 return NULL;
720 }
721
722 return svr->ip;
723}
724
725EAPI double
726ecore_con_server_uptime_get(Ecore_Con_Server *svr)
727{
728 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
729 {
730 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_uptime_get");
731 return -1;
732 }
733
734 return ecore_time_get() - svr->start_time;
735}
736
737EAPI void
738ecore_con_server_flush(Ecore_Con_Server *svr)
739{
740 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
741 {
742 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_flush");
743 return;
744 }
745
746 _ecore_con_server_flush(svr);
747}
748
749/**
750 * @}
751 */
752
753/**
754 * @addtogroup Ecore_Con_Client_Group Ecore Connection Client Functions
755 *
756 * Functions that operate on Ecore connection client objects.
757 *
758 * @{
759 */
760
761/**
762 * @example ecore_con_client_example.c
763 * Shows how to write a simple client that connects to the example server.
764 */
765
766EAPI int
767ecore_con_client_send(Ecore_Con_Client *cl,
768 const void *data,
769 int size)
770{
771 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
772 {
773 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_send");
774 return 0;
775 }
776
777 EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->delete_me, 0);
778
779 EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
780
781 EINA_SAFETY_ON_TRUE_RETURN_VAL(size < 1, 0);
782
783 if (cl->fd_handler)
784 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
785
786 if (cl->host_server && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP))
787 sendto(cl->host_server->fd, data, size, 0, (struct sockaddr *)cl->client_addr,
788 cl->client_addr_len);
789 else if (!cl->buf)
790 {
791 cl->buf = eina_binbuf_new();
792 EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0);
793#ifdef TCP_CORK
794 if ((cl->fd >= 0) && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
795 {
796 int state = 1;
797 if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
798 /* realistically this isn't anything serious so we can just log and continue */
799 ERR("corking failed! %s", strerror(errno));
800 }
801#endif
802 }
803 eina_binbuf_append_length(cl->buf, data, size);
804
805 return size;
806}
807
808EAPI Ecore_Con_Server *
809ecore_con_client_server_get(Ecore_Con_Client *cl)
810{
811 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
812 {
813 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
814 "ecore_con_client_server_get");
815 return NULL;
816 }
817
818 return cl->host_server;
819}
820
821EAPI Eina_Bool
822ecore_con_client_connected_get(Ecore_Con_Client *cl)
823{
824 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
825 {
826 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
827 "ecore_con_client_connected_get");
828 return EINA_FALSE;
829 }
830
831 return !cl->delete_me;
832}
833
834EAPI void
835ecore_con_client_timeout_set(Ecore_Con_Client *cl,
836 double timeout)
837{
838 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
839 {
840 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
841 "ecore_con_client_timeout_set");
842 return;
843 }
844
845 cl->disconnect_time = timeout;
846
847 _ecore_con_cl_timer_update(cl);
848}
849
850EAPI double
851ecore_con_client_timeout_get(Ecore_Con_Client *cl)
852{
853 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
854 {
855 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_timeout_get");
856 return 0;
857 }
858
859 return cl->disconnect_time;
860}
861
862EAPI void *
863ecore_con_client_del(Ecore_Con_Client *cl)
864{
865 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
866 {
867 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del");
868 return NULL;
869 }
870
871 _ecore_con_client_kill(cl);
872 return cl->data;
873}
874
875EAPI void
876ecore_con_client_data_set(Ecore_Con_Client *cl,
877 const void *data)
878{
879 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
880 {
881 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_set");
882 return;
883 }
884
885 cl->data = (void *)data;
886}
887
888EAPI void *
889ecore_con_client_data_get(Ecore_Con_Client *cl)
890{
891 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
892 {
893 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_get");
894 return NULL;
895 }
896
897 return cl->data;
898}
899
900EAPI const char *
901ecore_con_client_ip_get(Ecore_Con_Client *cl)
902{
903 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
904 {
905 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_ip_get");
906 return NULL;
907 }
908 if (!cl->ip)
909 cl->ip = _ecore_con_pretty_ip(cl->client_addr);
910
911 return cl->ip;
912}
913
914EAPI int
915ecore_con_client_port_get(Ecore_Con_Client *cl)
916{
917 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
918 {
919 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_port_get");
920 return -1;
921 }
922 if (cl->client_addr->sa_family == AF_INET)
923 return ((struct sockaddr_in*)cl->client_addr)->sin_port;
924#ifdef HAVE_IPV6
925 return ((struct sockaddr_in6*)cl->client_addr)->sin6_port;
926#else
927 return -1;
928#endif
929}
930
931EAPI double
932ecore_con_client_uptime_get(Ecore_Con_Client *cl)
933{
934 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
935 {
936 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_uptime_get");
937 return -1;
938 }
939
940 return ecore_time_get() - cl->start_time;
941}
942
943EAPI void
944ecore_con_client_flush(Ecore_Con_Client *cl)
945{
946 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
947 {
948 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_flush");
949 return;
950 }
951
952 _ecore_con_client_flush(cl);
953}
954
955EAPI int
956ecore_con_server_fd_get(Ecore_Con_Server *svr)
957{
958 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
959 {
960 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
961 return -1;
962 }
963 if (svr->created) return -1;
964 return ecore_main_fd_handler_fd_get(svr->fd_handler);
965}
966
967EAPI int
968ecore_con_client_fd_get(Ecore_Con_Client *cl)
969{
970 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
971 {
972 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, __func__);
973 return -1;
974 }
975 return ecore_main_fd_handler_fd_get(cl->fd_handler);
976}
977
978/**
979 * @}
980 */
981
982void
983ecore_con_event_proxy_bind(Ecore_Con_Server *svr)
984{
985 Ecore_Con_Event_Proxy_Bind *e;
986 int ev = ECORE_CON_EVENT_PROXY_BIND;
987
988 e = ecore_con_event_proxy_bind_alloc();
989 EINA_SAFETY_ON_NULL_RETURN(e);
990
991 svr->event_count = eina_list_append(svr->event_count, e);
992 _ecore_con_server_timer_update(svr);
993 e->server = svr;
994 e->ip = svr->proxyip;
995 e->port = svr->proxyport;
996 ecore_event_add(ev, e,
997 _ecore_con_event_server_add_free, NULL);
998 _ecore_con_event_count++;
999}
1000
1001void
1002ecore_con_event_server_add(Ecore_Con_Server *svr)
1003{
1004 /* we got our server! */
1005 Ecore_Con_Event_Server_Add *e;
1006 int ev = ECORE_CON_EVENT_SERVER_ADD;
1007
1008 e = ecore_con_event_server_add_alloc();
1009 EINA_SAFETY_ON_NULL_RETURN(e);
1010
1011 svr->connecting = EINA_FALSE;
1012 svr->start_time = ecore_time_get();
1013 svr->event_count = eina_list_append(svr->event_count, e);
1014 _ecore_con_server_timer_update(svr);
1015 e->server = svr;
1016 if (svr->upgrade) ev = ECORE_CON_EVENT_SERVER_UPGRADE;
1017 ecore_event_add(ev, e,
1018 _ecore_con_event_server_add_free, NULL);
1019 _ecore_con_event_count++;
1020}
1021
1022void
1023ecore_con_event_server_del(Ecore_Con_Server *svr)
1024{
1025 Ecore_Con_Event_Server_Del *e;
1026
1027 svr->delete_me = EINA_TRUE;
1028 INF("svr %p is dead", svr);
1029 e = ecore_con_event_server_del_alloc();
1030 EINA_SAFETY_ON_NULL_RETURN(e);
1031
1032 svr->event_count = eina_list_append(svr->event_count, e);
1033 _ecore_con_server_timer_update(svr);
1034 e->server = svr;
1035 if (svr->ecs)
1036 {
1037 svr->ecs_state = svr->ecs->lookup ? ECORE_CON_PROXY_STATE_RESOLVED : ECORE_CON_PROXY_STATE_DONE;
1038 eina_stringshare_replace(&svr->proxyip, NULL);
1039 svr->proxyport = 0;
1040 }
1041 ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e,
1042 _ecore_con_event_server_del_free, NULL);
1043 _ecore_con_event_count++;
1044}
1045
1046void
1047ecore_con_event_server_write(Ecore_Con_Server *svr, int num)
1048{
1049 Ecore_Con_Event_Server_Write *e;
1050
1051 e = ecore_con_event_server_write_alloc();
1052 EINA_SAFETY_ON_NULL_RETURN(e);
1053
1054 INF("Wrote %d bytes", num);
1055 svr->event_count = eina_list_append(svr->event_count, e);
1056 e->server = svr;
1057 e->size = num;
1058 ecore_event_add(ECORE_CON_EVENT_SERVER_WRITE, e,
1059 (Ecore_End_Cb)_ecore_con_event_server_write_free, NULL);
1060 _ecore_con_event_count++;
1061}
1062
1063void
1064ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate)
1065{
1066 Ecore_Con_Event_Server_Data *e;
1067
1068 e = ecore_con_event_server_data_alloc();
1069 EINA_SAFETY_ON_NULL_RETURN(e);
1070
1071 svr->event_count = eina_list_append(svr->event_count, e);
1072 _ecore_con_server_timer_update(svr);
1073 e->server = svr;
1074 if (duplicate)
1075 {
1076 e->data = malloc(num);
1077 if (!e->data)
1078 {
1079 ERR("server data allocation failure !");
1080 _ecore_con_event_server_data_free(NULL, e);
1081 return;
1082 }
1083 memcpy(e->data, buf, num);
1084 }
1085 else
1086 e->data = buf;
1087 e->size = num;
1088 ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
1089 _ecore_con_event_server_data_free, NULL);
1090 _ecore_con_event_count++;
1091}
1092
1093void
1094ecore_con_event_client_add(Ecore_Con_Client *cl)
1095{
1096 Ecore_Con_Event_Client_Add *e;
1097 int ev = ECORE_CON_EVENT_CLIENT_ADD;
1098
1099 e = ecore_con_event_client_add_alloc();
1100 EINA_SAFETY_ON_NULL_RETURN(e);
1101
1102 cl->event_count = eina_list_append(cl->event_count, e);
1103 cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e);
1104 _ecore_con_cl_timer_update(cl);
1105 e->client = cl;
1106 if (cl->upgrade) ev = ECORE_CON_EVENT_CLIENT_UPGRADE;
1107 ecore_event_add(ev, e,
1108 (Ecore_End_Cb)_ecore_con_event_client_add_free, cl->host_server);
1109 _ecore_con_event_count++;
1110}
1111
1112void
1113ecore_con_event_client_del(Ecore_Con_Client *cl)
1114{
1115 Ecore_Con_Event_Client_Del *e;
1116
1117 if (!cl) return;
1118 cl->delete_me = EINA_TRUE;
1119 INF("cl %p is dead", cl);
1120 e = ecore_con_event_client_del_alloc();
1121 EINA_SAFETY_ON_NULL_RETURN(e);
1122 cl->event_count = eina_list_append(cl->event_count, e);
1123
1124 cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e);
1125 _ecore_con_cl_timer_update(cl);
1126 e->client = cl;
1127 ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
1128 (Ecore_End_Cb)_ecore_con_event_client_del_free, cl->host_server);
1129 _ecore_con_event_count++;
1130}
1131
1132void
1133ecore_con_event_client_write(Ecore_Con_Client *cl, int num)
1134{
1135 Ecore_Con_Event_Client_Write *e;
1136
1137 e = ecore_con_event_client_write_alloc();
1138 EINA_SAFETY_ON_NULL_RETURN(e);
1139
1140 cl->event_count = eina_list_append(cl->event_count, e);
1141 cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e);
1142 e->client = cl;
1143 e->size = num;
1144 ecore_event_add(ECORE_CON_EVENT_CLIENT_WRITE, e,
1145 (Ecore_End_Cb)_ecore_con_event_client_write_free, cl->host_server);
1146 _ecore_con_event_count++;
1147}
1148
1149void
1150ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate)
1151{
1152 Ecore_Con_Event_Client_Data *e;
1153
1154 e = ecore_con_event_client_data_alloc();
1155 EINA_SAFETY_ON_NULL_RETURN(e);
1156
1157 cl->event_count = eina_list_append(cl->event_count, e);
1158 cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e);
1159 _ecore_con_cl_timer_update(cl);
1160 e->client = cl;
1161 if (duplicate)
1162 {
1163 e->data = malloc(num);
1164 if (!e->data)
1165 {
1166 ERR("client data allocation failure !");
1167 _ecore_con_event_client_data_free(cl->host_server, e);
1168 return;
1169 }
1170 memcpy(e->data, buf, num);
1171 }
1172 else
1173 e->data = buf;
1174 e->size = num;
1175 ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
1176 (Ecore_End_Cb)_ecore_con_event_client_data_free, cl->host_server);
1177 _ecore_con_event_count++;
1178}
1179
1180
1181void
1182ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info)
1183{
1184 svr->infos = eina_list_remove(svr->infos, info);
1185}
1186
1187void
1188_ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate)
1189{
1190 Ecore_Con_Event_Server_Error *e;
1191
1192 e = ecore_con_event_server_error_alloc();
1193 EINA_SAFETY_ON_NULL_RETURN(e);
1194
1195 e->server = svr;
1196 e->error = duplicate ? strdup(error) : error;
1197 ERR("%s", error);
1198 svr->event_count = eina_list_append(svr->event_count, e);
1199 ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL);
1200 _ecore_con_event_count++;
1201}
1202
1203void
1204ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error)
1205{
1206 Ecore_Con_Event_Client_Error *e;
1207
1208 e = ecore_con_event_client_error_alloc();
1209 EINA_SAFETY_ON_NULL_RETURN(e);
1210
1211 e->client = cl;
1212 e->error = strdup(error);
1213 ERR("%s", error);
1214 cl->event_count = eina_list_append(cl->event_count, e);
1215 cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e);
1216 ecore_event_add(ECORE_CON_EVENT_CLIENT_ERROR, e, (Ecore_End_Cb)_ecore_con_event_client_error_free, cl->host_server);
1217 _ecore_con_event_count++;
1218}
1219
1220static void
1221_ecore_con_server_free(Ecore_Con_Server *svr)
1222{
1223 Ecore_Con_Client *cl;
1224 double t_start, t;
1225
1226 if (svr->event_count) return;
1227
1228 while (svr->infos)
1229 {
1230 ecore_con_info_data_clear(svr->infos->data);
1231 svr->infos = eina_list_remove_list(svr->infos, svr->infos);
1232 }
1233
1234 t_start = ecore_time_get();
1235 while (svr->buf && (!svr->delete_me))
1236 {
1237 _ecore_con_server_flush(svr);
1238 t = ecore_time_get();
1239 if ((t - t_start) > 0.5)
1240 {
1241 WRN("ECORE_CON: EEK - stuck in _ecore_con_server_free() trying\n"
1242 " to flush data out from the server, and have been for\n"
1243 " %1.1f seconds. This is taking too long. Aborting flush.",
1244 (t - t_start));
1245 break;
1246 }
1247 }
1248
1249#ifdef _WIN32
1250 ecore_con_local_win32_server_del(svr);
1251#endif
1252 if (svr->event_count) return;
1253 ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE);
1254
1255 if (svr->buf)
1256 eina_binbuf_free(svr->buf);
1257
1258 EINA_LIST_FREE(svr->clients, cl)
1259 {
1260 Ecore_Con_Event_Server_Add *ev;
1261
1262 /* some pointer hacks here to prevent double frees if people are being stupid */
1263 EINA_LIST_FREE(cl->event_count, ev)
1264 ev->server = NULL;
1265 cl->delete_me = EINA_TRUE;
1266 INF("cl %p is dead", cl);
1267 _ecore_con_client_free(cl);
1268 }
1269 if ((svr->created) && (svr->path) && (svr->ppid == getpid()))
1270 unlink(svr->path);
1271
1272 ecore_con_ssl_server_shutdown(svr);
1273 free(svr->name);
1274
1275 free(svr->path);
1276
1277 eina_stringshare_del(svr->ip);
1278 eina_stringshare_del(svr->verify_name);
1279
1280 if (svr->ecs_buf) eina_binbuf_free(svr->ecs_buf);
1281 if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
1282
1283 if (svr->fd_handler)
1284 ecore_main_fd_handler_del(svr->fd_handler);
1285
1286 if (svr->fd > 0)
1287 close(svr->fd);
1288
1289 if (svr->until_deletion)
1290 ecore_timer_del(svr->until_deletion);
1291
1292 servers = eina_list_remove(servers, svr);
1293 svr->data = NULL;
1294 free(svr);
1295}
1296
1297static void
1298_ecore_con_client_free(Ecore_Con_Client *cl)
1299{
1300 double t_start, t;
1301
1302 if (cl->event_count) return;
1303
1304 t_start = ecore_time_get();
1305 while ((cl->buf) && (!cl->delete_me))
1306 {
1307 _ecore_con_client_flush(cl);
1308 t = ecore_time_get();
1309 if ((t - t_start) > 0.5)
1310 {
1311 WRN("EEK - stuck in _ecore_con_client_free() trying\n"
1312 " to flush data out from the client, and have been for\n"
1313 " %1.1f seconds. This is taking too long. Aborting flush.",
1314 (t - t_start));
1315 break;
1316 }
1317 }
1318
1319#ifdef _WIN32
1320 ecore_con_local_win32_client_del(cl);
1321#endif
1322
1323 if (cl->event_count) return;
1324 ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
1325
1326 if (cl->buf) eina_binbuf_free(cl->buf);
1327
1328 if (cl->host_server->type & ECORE_CON_SSL)
1329 ecore_con_ssl_client_shutdown(cl);
1330
1331 if (cl->fd_handler)
1332 ecore_main_fd_handler_del(cl->fd_handler);
1333
1334 if (cl->fd > 0)
1335 close(cl->fd);
1336
1337 free(cl->client_addr);
1338 cl->client_addr = NULL;
1339
1340 if (cl->until_deletion)
1341 ecore_timer_del(cl->until_deletion);
1342
1343 eina_stringshare_del(cl->ip);
1344 cl->data = NULL;
1345 free(cl);
1346 return;
1347}
1348
1349static Eina_Bool
1350_ecore_con_server_timer(Ecore_Con_Server *svr)
1351{
1352 ecore_con_server_del(svr);
1353
1354 svr->until_deletion = NULL;
1355 return ECORE_CALLBACK_CANCEL;
1356}
1357
1358static void
1359_ecore_con_server_timer_update(Ecore_Con_Server *svr)
1360{
1361 if (svr->disconnect_time)
1362 {
1363 if (svr->disconnect_time > 0)
1364 {
1365 if (svr->until_deletion)
1366 ecore_timer_interval_set(svr->until_deletion, svr->disconnect_time);
1367 else
1368 svr->until_deletion = ecore_timer_add(svr->disconnect_time, (Ecore_Task_Cb)_ecore_con_server_timer, svr);
1369 }
1370 else if (svr->until_deletion)
1371 {
1372 ecore_timer_del(svr->until_deletion);
1373 svr->until_deletion = NULL;
1374 }
1375 }
1376 else
1377 {
1378 if (svr->until_deletion)
1379 {
1380 ecore_timer_del(svr->until_deletion);
1381 svr->until_deletion = NULL;
1382 }
1383 }
1384}
1385
1386static Eina_Bool
1387_ecore_con_client_timer(Ecore_Con_Client *cl)
1388{
1389 ecore_con_client_del(cl);
1390
1391 cl->until_deletion = NULL;
1392 return ECORE_CALLBACK_CANCEL;
1393}
1394
1395static void
1396_ecore_con_cl_timer_update(Ecore_Con_Client *cl)
1397{
1398 if (cl->disconnect_time)
1399 {
1400 if (cl->disconnect_time > 0)
1401 {
1402 if (cl->until_deletion)
1403 ecore_timer_interval_set(cl->until_deletion, cl->disconnect_time);
1404 else
1405 cl->until_deletion = ecore_timer_add(cl->disconnect_time, (Ecore_Task_Cb)_ecore_con_client_timer, cl);
1406 }
1407 else if (cl->until_deletion)
1408 {
1409 ecore_timer_del(cl->until_deletion);
1410 cl->until_deletion = NULL;
1411 }
1412 }
1413 else
1414 {
1415 if (cl->host_server->client_disconnect_time > 0)
1416 {
1417 if (cl->until_deletion)
1418 ecore_timer_interval_set(cl->until_deletion, cl->host_server->client_disconnect_time);
1419 else
1420 cl->until_deletion = ecore_timer_add(cl->host_server->client_disconnect_time, (Ecore_Task_Cb)_ecore_con_client_timer, cl);
1421 }
1422 else if (cl->until_deletion)
1423 {
1424 ecore_timer_del(cl->until_deletion);
1425 cl->until_deletion = NULL;
1426 }
1427 }
1428}
1429
1430static void
1431_ecore_con_cb_tcp_listen(void *data,
1432 Ecore_Con_Info *net_info)
1433{
1434 Ecore_Con_Server *svr;
1435 struct linger lin;
1436 const char *memerr = NULL;
1437
1438 svr = data;
1439
1440 errno = 0;
1441 if (!net_info) /* error message has already been handled */
1442 goto error;
1443
1444 svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
1445 net_info->info.ai_protocol);
1446 if (svr->fd < 0) goto error;
1447 if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
1448 if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
1449
1450 lin.l_onoff = 1;
1451 lin.l_linger = 0;
1452 if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin,
1453 sizeof(struct linger)) < 0)
1454 goto error;
1455
1456 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
1457 {
1458#ifdef HAVE_NETINET_TCP_H
1459 int flag = 1;
1460
1461 if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
1462 sizeof(int)) < 0)
1463#endif
1464 {
1465 goto error;
1466 }
1467 }
1468
1469 if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
1470 goto error;
1471
1472 if (listen(svr->fd, 4096) < 0) goto error;
1473
1474 svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
1475 _ecore_con_svr_tcp_handler, svr, NULL, NULL);
1476 if (!svr->fd_handler)
1477 {
1478 memerr = "Memory allocation failure";
1479 goto error;
1480 }
1481
1482 return;
1483
1484error:
1485 if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
1486 ecore_con_ssl_server_shutdown(svr);
1487 _ecore_con_server_kill(svr);
1488}
1489
1490static void
1491_ecore_con_cb_udp_listen(void *data,
1492 Ecore_Con_Info *net_info)
1493{
1494 Ecore_Con_Server *svr;
1495 Ecore_Con_Type type;
1496 struct ip_mreq mreq;
1497#ifdef HAVE_IPV6
1498 struct ipv6_mreq mreq6;
1499#endif
1500 const int on = 1;
1501 const char *memerr = NULL;
1502
1503 svr = data;
1504 type = svr->type;
1505 type &= ECORE_CON_TYPE;
1506
1507 errno = 0;
1508 if (!net_info) /* error message has already been handled */
1509 goto error;
1510
1511 svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
1512 net_info->info.ai_protocol);
1513 if (svr->fd < 0) goto error;
1514
1515 if (type == ECORE_CON_REMOTE_MCAST)
1516 {
1517 if (net_info->info.ai_family == AF_INET)
1518 {
1519 if (!inet_pton(net_info->info.ai_family, net_info->ip,
1520 &mreq.imr_multiaddr))
1521 goto error;
1522
1523 mreq.imr_interface.s_addr = htonl(INADDR_ANY);
1524 if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
1525 (const void *)&mreq, sizeof(mreq)) != 0)
1526 goto error;
1527 }
1528#ifdef HAVE_IPV6
1529 else if (net_info->info.ai_family == AF_INET6)
1530 {
1531 if (!inet_pton(net_info->info.ai_family, net_info->ip,
1532 &mreq6.ipv6mr_multiaddr))
1533 goto error;
1534 mreq6.ipv6mr_interface = htonl(INADDR_ANY);
1535 if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
1536 (const void *)&mreq6, sizeof(mreq6)) != 0)
1537 goto error;
1538 }
1539#endif
1540 }
1541
1542 if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on)) != 0)
1543 goto error;
1544 if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
1545 if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
1546
1547 if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
1548 goto error;
1549
1550 svr->fd_handler =
1551 ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
1552 _ecore_con_svr_udp_handler, svr, NULL, NULL);
1553 if (!svr->fd_handler)
1554 {
1555 memerr = "Memory allocation failure";
1556 goto error;
1557 }
1558
1559 svr->ip = eina_stringshare_add(net_info->ip);
1560
1561 return;
1562
1563error:
1564 if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
1565 ecore_con_ssl_server_shutdown(svr);
1566 _ecore_con_server_kill(svr);
1567}
1568
1569static void
1570_ecore_con_cb_tcp_connect(void *data,
1571 Ecore_Con_Info *net_info)
1572{
1573 Ecore_Con_Server *svr;
1574 int res;
1575 int curstate = 0;
1576 const char *memerr = NULL;
1577
1578 svr = data;
1579
1580 errno = 0;
1581 if (!net_info) /* error message has already been handled */
1582 goto error;
1583
1584 svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
1585 net_info->info.ai_protocol);
1586 if (svr->fd < 0) goto error;
1587
1588 if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
1589 if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
1590
1591 if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0)
1592 goto error;
1593
1594 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
1595 {
1596#ifdef HAVE_NETINET_TCP_H
1597 int flag = 1;
1598
1599 if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0)
1600#endif
1601 {
1602 goto error;
1603 }
1604 }
1605
1606 res = connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen);
1607#ifdef _WIN32
1608 if (res == SOCKET_ERROR)
1609 {
1610 if (WSAGetLastError() != WSAEINPROGRESS)
1611 {
1612 char *err;
1613 err = evil_format_message(WSAGetLastError());
1614 _ecore_con_event_server_error(svr, err, EINA_FALSE);
1615 ecore_con_ssl_server_shutdown(svr);
1616 _ecore_con_server_kill(svr);
1617 return;
1618 }
1619
1620#else
1621 if (res < 0)
1622 {
1623 if (errno != EINPROGRESS) goto error;
1624#endif
1625 svr->connecting = EINA_TRUE;
1626 svr->fd_handler =
1627 ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
1628 _ecore_con_cl_handler, svr, NULL, NULL);
1629 }
1630 else
1631 svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
1632 _ecore_con_cl_handler, svr, NULL, NULL);
1633
1634 if (svr->type & ECORE_CON_SSL)
1635 {
1636 svr->handshaking = EINA_TRUE;
1637 svr->ssl_state = ECORE_CON_SSL_STATE_INIT;
1638 DBG("%s ssl handshake", svr->ecs_state ? "Queuing" : "Beginning");
1639 if ((!svr->ecs_state) && ecore_con_ssl_server_init(svr))
1640 goto error;
1641 }
1642
1643 if (!svr->fd_handler)
1644 {
1645 memerr = "Memory allocation failure";
1646 goto error;
1647 }
1648
1649 if ((!svr->ecs) || (svr->ecs->lookup))
1650 svr->ip = eina_stringshare_add(net_info->ip);
1651
1652 return;
1653
1654error:
1655 if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
1656 ecore_con_ssl_server_shutdown(svr);
1657 _ecore_con_server_kill(svr);
1658}
1659
1660static void
1661_ecore_con_cb_udp_connect(void *data,
1662 Ecore_Con_Info *net_info)
1663{
1664 Ecore_Con_Server *svr;
1665 int curstate = 0;
1666 int broadcast = 1;
1667 const char *memerr = NULL;
1668 svr = data;
1669
1670 errno = 0;
1671 if (!net_info) /* error message has already been handled */
1672 goto error;
1673
1674 svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
1675 net_info->info.ai_protocol);
1676 if (svr->fd < 0) goto error;
1677 if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
1678 if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
1679 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_BROADCAST)
1680 {
1681 if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST,
1682 (const void *)&broadcast,
1683 sizeof(broadcast)) < 0)
1684 {
1685 goto error;
1686 }
1687 }
1688 if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR,
1689 (const void *)&curstate, sizeof(curstate)) < 0)
1690 goto error;
1691
1692 if (connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
1693 goto error;
1694
1695 svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
1696 _ecore_con_cl_udp_handler, svr, NULL, NULL);
1697
1698 if (!svr->fd_handler)
1699 {
1700 memerr = "Memory allocation failure";
1701 goto error;
1702 }
1703
1704 if ((!svr->ecs) || (svr->ecs->lookup))
1705 svr->ip = eina_stringshare_add(net_info->ip);
1706
1707 return;
1708
1709error:
1710 if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
1711 ecore_con_ssl_server_shutdown(svr);
1712 _ecore_con_server_kill(svr);
1713}
1714
1715static Ecore_Con_State
1716svr_try_connect_plain(Ecore_Con_Server *svr)
1717{
1718 int res;
1719 int so_err = 0;
1720 socklen_t size = sizeof(int);
1721
1722 res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size);
1723#ifdef _WIN32
1724 if (res == SOCKET_ERROR)
1725 so_err = WSAGetLastError();
1726
1727 if ((so_err == WSAEINPROGRESS) && !svr->delete_me)
1728 return ECORE_CON_INPROGRESS;
1729
1730#else
1731 if (res < 0)
1732 so_err = errno;
1733
1734 if ((so_err == EINPROGRESS) && !svr->delete_me)
1735 return ECORE_CON_INPROGRESS;
1736
1737#endif
1738
1739 if (so_err)
1740 {
1741 /* we lost our server! */
1742 ecore_con_event_server_error(svr, strerror(so_err));
1743 ERR("Connection lost: %s", strerror(so_err));
1744 _ecore_con_server_kill(svr);
1745 return ECORE_CON_DISCONNECTED;
1746 }
1747
1748 if ((!svr->delete_me) && (!svr->handshaking) && svr->connecting)
1749 {
1750 if (svr->ecs)
1751 {
1752 if (ecore_con_socks_svr_init(svr))
1753 return ECORE_CON_INPROGRESS;
1754 }
1755 else
1756 ecore_con_event_server_add(svr);
1757 }
1758
1759 if (svr->fd_handler && (!svr->buf))
1760 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
1761
1762 if (!svr->delete_me)
1763 return ECORE_CON_CONNECTED;
1764 else
1765 return ECORE_CON_DISCONNECTED;
1766}
1767
1768static const char *
1769_ecore_con_pretty_ip(struct sockaddr *client_addr)
1770{
1771#ifndef HAVE_IPV6
1772 char ipbuf[INET_ADDRSTRLEN + 1];
1773#else
1774 char ipbuf[INET6_ADDRSTRLEN + 1];
1775#endif
1776 int family = client_addr->sa_family;
1777 void *src;
1778
1779 switch(family)
1780 {
1781 case AF_INET:
1782 src = &(((struct sockaddr_in *)client_addr)->sin_addr);
1783 break;
1784#ifdef HAVE_IPV6
1785 case AF_INET6:
1786 src = &(((struct sockaddr_in6 *)client_addr)->sin6_addr);
1787
1788 if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)src))
1789 {
1790 family = AF_INET;
1791 src = (char*)src + 12;
1792 }
1793 break;
1794#endif
1795 default:
1796 return eina_stringshare_add("0.0.0.0");
1797 }
1798
1799 if (!inet_ntop(family, src, ipbuf, sizeof(ipbuf)))
1800 return eina_stringshare_add("0.0.0.0");
1801
1802 ipbuf[sizeof(ipbuf) - 1] = 0;
1803 return eina_stringshare_add(ipbuf);
1804}
1805
1806static Eina_Bool
1807_ecore_con_svr_tcp_handler(void *data,
1808 Ecore_Fd_Handler *fd_handler __UNUSED__)
1809{
1810 Ecore_Con_Server *svr;
1811 Ecore_Con_Client *cl = NULL;
1812 unsigned char client_addr[256];
1813 unsigned int client_addr_len;
1814 const char *clerr = NULL;
1815
1816 svr = data;
1817 if (svr->delete_me)
1818 return ECORE_CALLBACK_RENEW;
1819
1820 if (svr->delete_me)
1821 return ECORE_CALLBACK_RENEW;
1822
1823 if ((svr->client_limit >= 0) && (!svr->reject_excess_clients) &&
1824 (svr->client_count >= (unsigned int)svr->client_limit))
1825 return ECORE_CALLBACK_RENEW;
1826
1827 /* a new client */
1828
1829 cl = calloc(1, sizeof(Ecore_Con_Client));
1830 if (!cl)
1831 {
1832 ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client");
1833 return ECORE_CALLBACK_RENEW;
1834 }
1835 cl->host_server = svr;
1836
1837 client_addr_len = sizeof(client_addr);
1838 memset(&client_addr, 0, client_addr_len);
1839 cl->fd = accept(svr->fd, (struct sockaddr *)&client_addr, (socklen_t *)&client_addr_len);
1840 if (cl->fd < 0) goto error;
1841 if ((svr->client_limit >= 0) && (svr->reject_excess_clients) &&
1842 (svr->client_count >= (unsigned int)svr->client_limit))
1843 {
1844 clerr = "Maximum client limit reached";
1845 goto error;
1846 }
1847
1848 if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
1849 if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
1850 cl->fd_handler = ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ,
1851 _ecore_con_svr_cl_handler, cl, NULL, NULL);
1852 if (!cl->fd_handler) goto error;
1853 ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
1854
1855 if ((!svr->upgrade) && (svr->type & ECORE_CON_SSL))
1856 {
1857 cl->handshaking = EINA_TRUE;
1858 cl->ssl_state = ECORE_CON_SSL_STATE_INIT;
1859 if (ecore_con_ssl_client_init(cl))
1860 goto error;
1861 }
1862
1863 cl->client_addr = malloc(client_addr_len);
1864 if (!cl->client_addr)
1865 {
1866 clerr = "Memory allocation failure when attempting to add a new client";
1867 goto error;
1868 }
1869 cl->client_addr_len = client_addr_len;
1870 memcpy(cl->client_addr, &client_addr, client_addr_len);
1871
1872 svr->clients = eina_list_append(svr->clients, cl);
1873 svr->client_count++;
1874
1875 if ((!cl->delete_me) && (!cl->handshaking))
1876 ecore_con_event_client_add(cl);
1877
1878 return ECORE_CALLBACK_RENEW;
1879
1880error:
1881 if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler);
1882 if (cl->fd >= 0) close(cl->fd);
1883 free(cl);
1884 if (clerr || errno) ecore_con_event_server_error(svr, clerr ?: strerror(errno));
1885 return ECORE_CALLBACK_RENEW;
1886}
1887
1888static void
1889_ecore_con_cl_read(Ecore_Con_Server *svr)
1890{
1891 int num = 0;
1892 Eina_Bool lost_server = EINA_TRUE;
1893 unsigned char buf[READBUFSIZ];
1894
1895 DBG("svr=%p", svr);
1896
1897 /* only possible with non-ssl connections */
1898 if (svr->connecting && (svr_try_connect_plain(svr) != ECORE_CON_CONNECTED))
1899 return;
1900
1901 if (svr->handshaking && (!svr->ecs_state))
1902 {
1903 DBG("Continuing ssl handshake");
1904 if (!ecore_con_ssl_server_init(svr))
1905 lost_server = EINA_FALSE;
1906 _ecore_con_server_timer_update(svr);
1907 }
1908
1909 if (svr->ecs_state || !(svr->type & ECORE_CON_SSL))
1910 {
1911 errno = 0;
1912 num = read(svr->fd, buf, sizeof(buf));
1913 /* 0 is not a valid return value for a tcp socket */
1914 if ((num > 0) || ((num < 0) && (errno == EAGAIN)))
1915 lost_server = EINA_FALSE;
1916 else if (num < 0)
1917 ecore_con_event_server_error(svr, strerror(errno));
1918 }
1919 else
1920 {
1921 num = ecore_con_ssl_server_read(svr, buf, sizeof(buf));
1922 /* this is not an actual 0 return, 0 here just means non-fatal error such as EAGAIN */
1923 if (num >= 0)
1924 lost_server = EINA_FALSE;
1925 }
1926
1927 if ((!svr->delete_me) && (num > 0))
1928 {
1929 if (svr->ecs_state)
1930 ecore_con_socks_read(svr, buf, num);
1931 else
1932 ecore_con_event_server_data(svr, buf, num, EINA_TRUE);
1933 }
1934
1935 if (lost_server)
1936 _ecore_con_server_kill(svr);
1937}
1938
1939static Eina_Bool
1940_ecore_con_cl_handler(void *data,
1941 Ecore_Fd_Handler *fd_handler)
1942{
1943 Ecore_Con_Server *svr;
1944 Eina_Bool want_read, want_write;
1945
1946 svr = data;
1947 if (svr->delete_me)
1948 return ECORE_CALLBACK_RENEW;
1949
1950 if (svr->delete_me)
1951 return ECORE_CALLBACK_RENEW;
1952
1953 want_read = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ);
1954 want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE);
1955
1956 if ((!svr->ecs_state) && svr->handshaking && (want_read || want_write))
1957 {
1958 DBG("Continuing ssl handshake: preparing to %s...", want_read ? "read" : "write");
1959#ifdef ISCOMFITOR
1960 if (want_read)
1961 {
1962 char buf[READBUFSIZ];
1963 ssize_t len;
1964 len = recv(svr->fd, buf, sizeof(buf), MSG_DONTWAIT | MSG_PEEK);
1965 DBG("%zu bytes in buffer", len);
1966 }
1967#endif
1968 if (ecore_con_ssl_server_init(svr))
1969 {
1970 ERR("ssl handshaking failed!");
1971 svr->handshaking = EINA_FALSE;
1972 }
1973 else if (!svr->ssl_state)
1974 ecore_con_event_server_add(svr);
1975 return ECORE_CALLBACK_RENEW;
1976 }
1977 if (svr->ecs && svr->ecs_state && (svr->ecs_state < ECORE_CON_PROXY_STATE_READ) && (!svr->ecs_buf))
1978 {
1979 if (svr->ecs_state < ECORE_CON_PROXY_STATE_INIT)
1980 {
1981 INF("PROXY STATE++");
1982 svr->ecs_state++;
1983 }
1984 if (ecore_con_socks_svr_init(svr)) return ECORE_CALLBACK_RENEW;
1985 }
1986 if (want_read)
1987 _ecore_con_cl_read(svr);
1988 else if (want_write) /* only possible with non-ssl connections */
1989 {
1990 if (svr->connecting && (!svr_try_connect_plain(svr)) && (!svr->ecs_state))
1991 return ECORE_CALLBACK_RENEW;
1992
1993 _ecore_con_server_flush(svr);
1994 }
1995
1996 return ECORE_CALLBACK_RENEW;
1997}
1998
1999static Eina_Bool
2000_ecore_con_cl_udp_handler(void *data,
2001 Ecore_Fd_Handler *fd_handler)
2002{
2003 unsigned char buf[READBUFSIZ];
2004 int num;
2005 Ecore_Con_Server *svr;
2006 Eina_Bool want_read, want_write;
2007
2008 want_read = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ);
2009 want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE);
2010
2011 svr = data;
2012 if (svr->delete_me || svr->delete_me || ((!want_read) && (!want_write)))
2013 return ECORE_CALLBACK_RENEW;
2014
2015 if (want_write)
2016 {
2017 _ecore_con_server_flush(svr);
2018 return ECORE_CALLBACK_RENEW;
2019 }
2020
2021 num = read(svr->fd, buf, READBUFSIZ);
2022
2023 if ((!svr->delete_me) && (num > 0))
2024 ecore_con_event_server_data(svr, buf, num, EINA_TRUE);
2025
2026 if (num < 0 && (errno != EAGAIN) && (errno != EINTR))
2027 {
2028 ecore_con_event_server_error(svr, strerror(errno));
2029 _ecore_con_server_kill(svr);
2030 }
2031
2032 return ECORE_CALLBACK_RENEW;
2033}
2034
2035static Eina_Bool
2036_ecore_con_svr_udp_handler(void *data,
2037 Ecore_Fd_Handler *fd_handler)
2038{
2039 unsigned char buf[READBUFSIZ];
2040 unsigned char client_addr[256];
2041 socklen_t client_addr_len = sizeof(client_addr);
2042 int num;
2043 Ecore_Con_Server *svr;
2044 Ecore_Con_Client *cl = NULL;
2045
2046 svr = data;
2047
2048 if (svr->delete_me)
2049 return ECORE_CALLBACK_RENEW;
2050
2051 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
2052 {
2053 _ecore_con_client_flush(cl);
2054 return ECORE_CALLBACK_RENEW;
2055 }
2056
2057 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
2058 return ECORE_CALLBACK_RENEW;
2059
2060#ifdef _WIN32
2061 num = fcntl(svr->fd, F_SETFL, O_NONBLOCK);
2062 if (num >= 0)
2063 num = recvfrom(svr->fd, (char *)buf, sizeof(buf), 0,
2064 (struct sockaddr *)&client_addr,
2065 &client_addr_len);
2066
2067#else
2068 num = recvfrom(svr->fd, buf, sizeof(buf), MSG_DONTWAIT,
2069 (struct sockaddr *)&client_addr,
2070 &client_addr_len);
2071#endif
2072
2073 if (num < 0 && (errno != EAGAIN) && (errno != EINTR))
2074 {
2075 ecore_con_event_server_error(svr, strerror(errno));
2076 if (!svr->delete_me)
2077 ecore_con_event_client_del(NULL);
2078 _ecore_con_server_kill(svr);
2079 return ECORE_CALLBACK_CANCEL;
2080 }
2081
2082
2083/* Create a new client for use in the client data event */
2084 cl = calloc(1, sizeof(Ecore_Con_Client));
2085 EINA_SAFETY_ON_NULL_RETURN_VAL(cl, ECORE_CALLBACK_RENEW);
2086
2087 cl->host_server = svr;
2088 cl->client_addr = malloc(client_addr_len);
2089 if (!cl->client_addr)
2090 {
2091 free(cl);
2092 return ECORE_CALLBACK_RENEW;
2093 }
2094 cl->client_addr_len = client_addr_len;
2095
2096 memcpy(cl->client_addr, &client_addr, client_addr_len);
2097 ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
2098 svr->clients = eina_list_append(svr->clients, cl);
2099 svr->client_count++;
2100
2101 ecore_con_event_client_add(cl);
2102 ecore_con_event_client_data(cl, buf, num, EINA_TRUE);
2103
2104 return ECORE_CALLBACK_RENEW;
2105}
2106
2107static void
2108_ecore_con_svr_cl_read(Ecore_Con_Client *cl)
2109{
2110 int num = 0;
2111 Eina_Bool lost_client = EINA_TRUE;
2112 unsigned char buf[READBUFSIZ];
2113
2114 DBG("cl=%p", cl);
2115
2116 if (cl->handshaking)
2117 {
2118 /* add an extra handshake attempt just before read, even though
2119 * read also attempts to handshake, to try to finish sooner
2120 */
2121 if (ecore_con_ssl_client_init(cl))
2122 lost_client = EINA_FALSE;
2123
2124 _ecore_con_cl_timer_update(cl);
2125 }
2126
2127 if (!(cl->host_server->type & ECORE_CON_SSL) || (!cl->upgrade))
2128 {
2129 num = read(cl->fd, buf, sizeof(buf));
2130 /* 0 is not a valid return value for a tcp socket */
2131 if ((num > 0) || ((num < 0) && ((errno == EAGAIN) || (errno == EINTR))))
2132 lost_client = EINA_FALSE;
2133 else if (num < 0)
2134 ecore_con_event_client_error(cl, strerror(errno));
2135 }
2136 else
2137 {
2138 num = ecore_con_ssl_client_read(cl, buf, sizeof(buf));
2139 /* this is not an actual 0 return, 0 here just means non-fatal error such as EAGAIN */
2140 if (num >= 0)
2141 lost_client = EINA_FALSE;
2142 }
2143
2144 if ((!cl->delete_me) && (num > 0))
2145 ecore_con_event_client_data(cl, buf, num, EINA_TRUE);
2146
2147 if (lost_client) _ecore_con_client_kill(cl);
2148}
2149
2150static Eina_Bool
2151_ecore_con_svr_cl_handler(void *data,
2152 Ecore_Fd_Handler *fd_handler)
2153{
2154 Ecore_Con_Client *cl;
2155
2156 cl = data;
2157 if (cl->delete_me)
2158 return ECORE_CALLBACK_RENEW;
2159
2160 if (cl->handshaking && ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ | ECORE_FD_WRITE))
2161 {
2162 if (ecore_con_ssl_client_init(cl))
2163 {
2164 ERR("ssl handshaking failed!");
2165 _ecore_con_client_kill(cl);
2166 return ECORE_CALLBACK_RENEW;
2167 }
2168 else if (!cl->ssl_state)
2169 ecore_con_event_client_add(cl);
2170 }
2171 else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
2172 _ecore_con_svr_cl_read(cl);
2173
2174 else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
2175 _ecore_con_client_flush(cl);
2176
2177 return ECORE_CALLBACK_RENEW;
2178}
2179
2180static void
2181_ecore_con_server_flush(Ecore_Con_Server *svr)
2182{
2183 int count, num;
2184 size_t buf_len, buf_offset;
2185 const void *buf;
2186
2187 DBG("(svr=%p,buf=%p)", svr, svr->buf);
2188#ifdef _WIN32
2189 if (ecore_con_local_win32_server_flush(svr))
2190 return;
2191#endif
2192
2193 if ((!svr->buf) && (!svr->ecs_buf) && svr->fd_handler)
2194 {
2195 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
2196 return;
2197 }
2198
2199 buf = svr->buf ? eina_binbuf_string_get(svr->buf) : eina_binbuf_string_get(svr->ecs_buf);
2200 buf_len = svr->buf ? eina_binbuf_length_get(svr->buf) : eina_binbuf_length_get(svr->ecs_buf);
2201 buf_offset = svr->buf ? svr->write_buf_offset : svr->ecs_buf_offset;
2202 num = buf_len - buf_offset;
2203
2204 /* check whether we need to write anything at all.
2205 * we must not write zero bytes with SSL_write() since it
2206 * causes undefined behaviour
2207 */
2208 /* we thank Tommy[D] for needing to check negative buffer sizes
2209 * here because his system is amazing.
2210 */
2211 if (num <= 0) return;
2212
2213 if ((!svr->ecs_state) && svr->handshaking)
2214 {
2215 DBG("Continuing ssl handshake");
2216 if (ecore_con_ssl_server_init(svr))
2217 _ecore_con_server_kill(svr);
2218 _ecore_con_server_timer_update(svr);
2219 return;
2220 }
2221
2222 if (svr->ecs_state || (!(svr->type & ECORE_CON_SSL)))
2223 count = write(svr->fd, buf + buf_offset, num);
2224 else
2225 count = ecore_con_ssl_server_write(svr, buf + buf_offset, num);
2226
2227 if (count < 0)
2228 {
2229 if ((errno != EAGAIN) && (errno != EINTR))
2230 {
2231 ecore_con_event_server_error(svr, strerror(errno));
2232 _ecore_con_server_kill(svr);
2233 }
2234 return;
2235 }
2236
2237 if (count && (!svr->ecs_state)) ecore_con_event_server_write(svr, count);
2238 if (svr->ecs_buf)
2239 buf_offset = svr->ecs_buf_offset += count;
2240 else
2241 buf_offset = svr->write_buf_offset += count;
2242 if (buf_offset >= buf_len)
2243 {
2244 if (svr->ecs_buf)
2245 {
2246 svr->ecs_buf_offset = 0;
2247 eina_binbuf_free(svr->ecs_buf);
2248 svr->ecs_buf = NULL;
2249 INF("PROXY STATE++");
2250 svr->ecs_state++;
2251 }
2252 else
2253 {
2254 svr->write_buf_offset = 0;
2255 eina_binbuf_free(svr->buf);
2256 svr->buf = NULL;
2257#ifdef TCP_CORK
2258 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)
2259 {
2260 int state = 0;
2261 if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
2262 /* realistically this isn't anything serious so we can just log and continue */
2263 ERR("uncorking failed! %s", strerror(errno));
2264 }
2265#endif
2266 }
2267 if (svr->fd_handler)
2268 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
2269 }
2270 else if ((count < num) && svr->fd_handler)
2271 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
2272}
2273
2274static void
2275_ecore_con_client_flush(Ecore_Con_Client *cl)
2276{
2277 int num = 0, count = 0;
2278
2279#ifdef _WIN32
2280 if (ecore_con_local_win32_client_flush(cl))
2281 return;
2282#endif
2283
2284 if (!cl->buf && cl->fd_handler)
2285 {
2286 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
2287 return;
2288 }
2289
2290 if (cl->handshaking)
2291 {
2292 if (ecore_con_ssl_client_init(cl))
2293 count = -1;
2294
2295 _ecore_con_cl_timer_update(cl);
2296 }
2297
2298 if (!count)
2299 {
2300 num = eina_binbuf_length_get(cl->buf) - cl->buf_offset;
2301 if (num <= 0) return;
2302 if (!(cl->host_server->type & ECORE_CON_SSL) || (!cl->upgrade))
2303 count = write(cl->fd, eina_binbuf_string_get(cl->buf) + cl->buf_offset, num);
2304 else
2305 count = ecore_con_ssl_client_write(cl, eina_binbuf_string_get(cl->buf) + cl->buf_offset, num);
2306 }
2307
2308 if (count < 0)
2309 {
2310 if ((errno != EAGAIN) && (errno != EINTR) && (!cl->delete_me))
2311 {
2312 ecore_con_event_client_error(cl, strerror(errno));
2313 _ecore_con_client_kill(cl);
2314 }
2315
2316 return;
2317 }
2318
2319 if (count) ecore_con_event_client_write(cl, count);
2320 cl->buf_offset += count, num -= count;
2321 if (cl->buf_offset >= eina_binbuf_length_get(cl->buf))
2322 {
2323 cl->buf_offset = 0;
2324 eina_binbuf_free(cl->buf);
2325 cl->buf = NULL;
2326#ifdef TCP_CORK
2327 if ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)
2328 {
2329 int state = 0;
2330 if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
2331 /* realistically this isn't anything serious so we can just log and continue */
2332 ERR("uncorking failed! %s", strerror(errno));
2333 }
2334#endif
2335 if (cl->fd_handler)
2336 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
2337 }
2338 else if (cl->fd_handler && (num >= 0))
2339 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
2340}
2341
2342static void
2343_ecore_con_event_client_add_free(Ecore_Con_Server *svr,
2344 void *ev)
2345{
2346 Ecore_Con_Event_Client_Add *e;
2347
2348 e = ev;
2349 if (e->client)
2350 {
2351 e->client->event_count = eina_list_remove(e->client->event_count, e);
2352 if (e->client->host_server)
2353 {
2354 e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
2355 if ((!svr->event_count) && (svr->delete_me))
2356 _ecore_con_server_free(svr);
2357 }
2358 if ((!e->client->event_count) && (e->client->delete_me))
2359 ecore_con_client_del(e->client);
2360 }
2361
2362 ecore_con_event_client_add_free(e);
2363 _ecore_con_event_count--;
2364 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2365 ecore_con_mempool_shutdown();
2366}
2367
2368static void
2369_ecore_con_event_client_del_free(Ecore_Con_Server *svr,
2370 void *ev)
2371{
2372 Ecore_Con_Event_Client_Del *e;
2373
2374 e = ev;
2375 if (e->client)
2376 {
2377 e->client->event_count = eina_list_remove(e->client->event_count, e);
2378 if (e->client->host_server)
2379 {
2380 e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
2381 if ((!svr->event_count) && (svr->delete_me))
2382 _ecore_con_server_free(svr);
2383 }
2384 if (!e->client->event_count)
2385 ecore_con_client_del(e->client);
2386 }
2387 ecore_con_event_client_del_free(e);
2388 _ecore_con_event_count--;
2389 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2390 ecore_con_mempool_shutdown();
2391}
2392
2393static void
2394_ecore_con_event_client_write_free(Ecore_Con_Server *svr,
2395 Ecore_Con_Event_Client_Write *e)
2396{
2397 if (e->client)
2398 {
2399 e->client->event_count = eina_list_remove(e->client->event_count, e);
2400 if (e->client->host_server)
2401 {
2402 e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
2403 if ((!svr->event_count) && (svr->delete_me))
2404 _ecore_con_server_free(svr);
2405 }
2406 if (((!e->client->event_count) && (e->client->delete_me)) ||
2407 ((e->client->host_server &&
2408 ((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP ||
2409 (e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST))))
2410 ecore_con_client_del(e->client);
2411 }
2412 ecore_con_event_client_write_free(e);
2413 _ecore_con_event_count--;
2414 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2415 ecore_con_mempool_shutdown();
2416}
2417
2418static void
2419_ecore_con_event_client_data_free(Ecore_Con_Server *svr,
2420 void *ev)
2421{
2422 Ecore_Con_Event_Client_Data *e;
2423
2424 e = ev;
2425 if (e->client)
2426 {
2427 e->client->event_count = eina_list_remove(e->client->event_count, e);
2428 if (e->client->host_server)
2429 {
2430 e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
2431 }
2432 if ((!svr->event_count) && (svr->delete_me))
2433 _ecore_con_server_free(svr);
2434 if (((!e->client->event_count) && (e->client->delete_me)) ||
2435 ((e->client->host_server &&
2436 ((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP ||
2437 (e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST))))
2438 ecore_con_client_del(e->client);
2439 }
2440 free(e->data);
2441 ecore_con_event_client_data_free(e);
2442 _ecore_con_event_count--;
2443 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2444 ecore_con_mempool_shutdown();
2445}
2446
2447static void
2448_ecore_con_event_server_add_free(void *data __UNUSED__,
2449 void *ev)
2450{
2451 Ecore_Con_Event_Server_Add *e;
2452
2453 e = ev;
2454 if (e->server)
2455 {
2456 e->server->event_count = eina_list_remove(e->server->event_count, ev);
2457 if ((!e->server->event_count) && (e->server->delete_me))
2458 _ecore_con_server_free(e->server);
2459 }
2460 ecore_con_event_server_add_free(e);
2461 _ecore_con_event_count--;
2462 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2463 ecore_con_mempool_shutdown();
2464}
2465
2466static void
2467_ecore_con_event_server_del_free(void *data __UNUSED__,
2468 void *ev)
2469{
2470 Ecore_Con_Event_Server_Del *e;
2471
2472 e = ev;
2473 if (e->server)
2474 {
2475 e->server->event_count = eina_list_remove(e->server->event_count, ev);
2476 if (!e->server->event_count)
2477 _ecore_con_server_free(e->server);
2478 }
2479 ecore_con_event_server_del_free(e);
2480 _ecore_con_event_count--;
2481 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2482 ecore_con_mempool_shutdown();
2483}
2484
2485static void
2486_ecore_con_event_server_write_free(void *data __UNUSED__,
2487 Ecore_Con_Event_Server_Write *e)
2488{
2489 if (e->server)
2490 {
2491 e->server->event_count = eina_list_remove(e->server->event_count, e);
2492 if ((!e->server->event_count) && (e->server->delete_me))
2493 _ecore_con_server_free(e->server);
2494 }
2495
2496 ecore_con_event_server_write_free(e);
2497 _ecore_con_event_count--;
2498 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2499 ecore_con_mempool_shutdown();
2500}
2501
2502static void
2503_ecore_con_event_server_data_free(void *data __UNUSED__,
2504 void *ev)
2505{
2506 Ecore_Con_Event_Server_Data *e;
2507
2508 e = ev;
2509 if (e->server)
2510 {
2511 e->server->event_count = eina_list_remove(e->server->event_count, ev);
2512 if ((!e->server->event_count) && (e->server->delete_me))
2513 _ecore_con_server_free(e->server);
2514 }
2515
2516 free(e->data);
2517 ecore_con_event_server_data_free(e);
2518 _ecore_con_event_count--;
2519 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2520 ecore_con_mempool_shutdown();
2521}
2522
2523
2524static void
2525_ecore_con_event_server_error_free(void *data __UNUSED__, Ecore_Con_Event_Server_Error *e)
2526{
2527 if (e->server)
2528 {
2529 e->server->event_count = eina_list_remove(e->server->event_count, e);
2530 if ((!e->server->event_count) && (e->server->delete_me))
2531 _ecore_con_server_free(e->server);
2532 }
2533 free(e->error);
2534 ecore_con_event_server_error_free(e);
2535 _ecore_con_event_count--;
2536 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2537 ecore_con_mempool_shutdown();
2538}
2539
2540static void
2541_ecore_con_event_client_error_free(Ecore_Con_Server *svr, Ecore_Con_Event_Client_Error *e)
2542{
2543 if (e->client)
2544 {
2545 e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
2546 if ((!e->client->event_count) && (e->client->delete_me))
2547 _ecore_con_client_free(e->client);
2548 if (e->client->host_server)
2549 {
2550 e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
2551 if ((!svr->event_count) && (svr->delete_me))
2552 _ecore_con_server_free(svr);
2553 }
2554 }
2555 free(e->error);
2556 ecore_con_event_client_error_free(e);
2557 _ecore_con_event_count--;
2558 if ((!_ecore_con_event_count) && (!_ecore_con_init_count))
2559 ecore_con_mempool_shutdown();
2560}
2561
2562static void
2563_ecore_con_lookup_done(void *data,
2564 Ecore_Con_Info *infos)
2565{
2566 Ecore_Con_Server *svr;
2567 Ecore_Con_Lookup *lk;
2568
2569 svr = data;
2570 lk = svr->data;
2571
2572 if (infos)
2573 lk->done_cb(infos->info.ai_canonname, infos->ip,
2574 infos->info.ai_addr, infos->info.ai_addrlen,
2575 (void *)lk->data);
2576 else
2577 lk->done_cb(NULL, NULL, NULL, 0, (void *)lk->data);
2578
2579 free(svr->name);
2580 free(lk);
2581 free(svr);
2582}
2583
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c b/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c
deleted file mode 100644
index d922f20..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c
+++ /dev/null
@@ -1,101 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "Ecore_Con.h"
8#include "ecore_con_private.h"
9
10typedef struct _Ecore_Con_Mempool Ecore_Con_Mempool;
11struct _Ecore_Con_Mempool
12{
13 const char *name;
14 Eina_Mempool *mp;
15 size_t size;
16};
17
18#define GENERIC_ALLOC_FREE(TYPE, Type) \
19 Ecore_Con_Mempool Type##_mp = { #TYPE, NULL, sizeof (TYPE) }; \
20 \
21 TYPE * \
22 Type##_alloc(void) \
23 { \
24 return eina_mempool_malloc(Type##_mp.mp, sizeof (TYPE)); \
25 } \
26 \
27 void \
28 Type##_free(TYPE *e) \
29 { \
30 eina_mempool_free(Type##_mp.mp, e); \
31 }
32
33GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Add, ecore_con_event_client_add);
34GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Del, ecore_con_event_client_del);
35GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Write, ecore_con_event_client_write);
36GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Data, ecore_con_event_client_data);
37GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Error, ecore_con_event_server_error);
38GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Error, ecore_con_event_client_error);
39GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Add, ecore_con_event_server_add);
40GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Del, ecore_con_event_server_del);
41GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Write, ecore_con_event_server_write);
42GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Data, ecore_con_event_server_data);
43GENERIC_ALLOC_FREE(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind);
44
45static Ecore_Con_Mempool *mempool_array[] = {
46 &ecore_con_event_client_add_mp,
47 &ecore_con_event_client_del_mp,
48 &ecore_con_event_client_write_mp,
49 &ecore_con_event_client_data_mp,
50 &ecore_con_event_server_error_mp,
51 &ecore_con_event_client_error_mp,
52 &ecore_con_event_server_add_mp,
53 &ecore_con_event_server_del_mp,
54 &ecore_con_event_server_write_mp,
55 &ecore_con_event_server_data_mp,
56 &ecore_con_event_proxy_bind_mp
57};
58
59void
60ecore_con_mempool_init(void)
61{
62 const char *choice;
63 unsigned int i;
64
65 choice = getenv("EINA_MEMPOOL");
66 if (!choice || !choice[0])
67 choice = "chained_mempool";
68
69 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
70 {
71 retry:
72 mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
73 if (!mempool_array[i]->mp)
74 {
75 if (strcmp(choice, "pass_through") != 0)
76 {
77 ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice);
78 choice = "pass_through";
79 goto retry;
80 }
81 else
82 {
83 ERR("Impossible to allocate mempool '%s' !", choice);
84 return ;
85 }
86 }
87 }
88}
89
90void
91ecore_con_mempool_shutdown(void)
92{
93 unsigned int i;
94
95 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
96 {
97 eina_mempool_del(mempool_array[i]->mp);
98 mempool_array[i]->mp = NULL;
99 }
100}
101
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c b/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c
deleted file mode 100644
index 5dfe70b..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c
+++ /dev/null
@@ -1,628 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5/*
6 * This version of ecore_con_info use c-ares to provide asynchronous dns lookup.
7 *
8 * Note: It doesn't fork nor does it use libc getaddrinfo.
9 * http://c-ares.haxx.se/docs.html
10 */
11
12#include <string.h>
13#include <sys/types.h>
14
15#ifdef HAVE_NETINET_IN_H
16# include <netinet/in.h>
17#endif
18
19#ifdef HAVE_ARPA_INET_H
20# include <arpa/inet.h>
21#endif
22
23#include <ares.h>
24
25#include "Ecore.h"
26#include "Ecore_Con.h"
27#include "ecore_con_private.h"
28
29typedef struct _Ecore_Con_FD Ecore_Con_FD;
30typedef struct _Ecore_Con_CAres Ecore_Con_CAres;
31
32struct _Ecore_Con_FD
33{
34 Ecore_Fd_Handler *handler;
35 Ecore_Timer *timer;
36 int fd;
37};
38
39struct _Ecore_Con_CAres
40{
41 Ecore_Con_Server *svr;
42 Ecore_Con_Info_Cb done_cb;
43 void *data;
44 struct addrinfo hints;
45 Ecore_Con_Info *result;
46
47 union {
48 struct in_addr v4;
49#ifdef HAVE_IPV6
50 struct in6_addr v6;
51#endif
52 } addr;
53
54 Eina_Bool byaddr : 1;
55 Eina_Bool isv6 : 1;
56};
57
58static ares_channel info_channel;
59static int info_init = 0;
60static Eina_List *info_fds = NULL;
61
62static void _ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg,
63 int status,
64 int timeouts,
65 char *node,
66 char *service);
67static void _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg,
68 int status,
69 int timeouts,
70 struct hostent *hostent);
71static Eina_Bool _ecore_con_info_cares_fd_cb(Ecore_Con_FD *ecf,
72 Ecore_Fd_Handler *fd_handler);
73static Eina_Bool _ecore_con_info_cares_timeout_cb(void *data);
74
75static void
76_ecore_con_info_cares_state_cb(void *data,
77 ares_socket_t fd,
78 int readable,
79 int writable);
80static int
81_ecore_con_info_fds_search(const Ecore_Con_FD *fd1,
82 const Ecore_Con_FD *fd2);
83
84int
85ecore_con_info_init(void)
86{
87 struct ares_options opts;
88
89 if (!info_init)
90 {
91 if (ares_library_init(ARES_LIB_INIT_ALL))
92 return 0;
93
94 opts.lookups = "fb"; /* hosts file then dns */
95 opts.sock_state_cb = _ecore_con_info_cares_state_cb;
96
97 if (ares_init_options(&info_channel, &opts,
98 ARES_OPT_LOOKUPS | ARES_OPT_SOCK_STATE_CB) != ARES_SUCCESS)
99 {
100 ares_library_cleanup();
101 return 0;
102 }
103 }
104
105 info_init++;
106 return info_init;
107}
108
109int
110ecore_con_info_shutdown(void)
111{
112 info_init--;
113 if (info_init == 0)
114 {
115 /* Cancel all ongoing request */
116 ares_cancel(info_channel);
117 ares_destroy(info_channel);
118
119 /* Shutdown ares */
120 ares_library_cleanup();
121 }
122
123 return info_init;
124}
125
126int
127ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
128 Ecore_Con_Info_Cb done_cb,
129 void *data)
130{
131 struct addrinfo hints;
132
133 memset(&hints, 0, sizeof(struct addrinfo));
134#ifdef HAVE_IPV6
135 hints.ai_family = AF_INET6;
136#else
137 hints.ai_family = AF_INET;
138#endif
139 hints.ai_socktype = SOCK_STREAM;
140 hints.ai_flags = AI_CANONNAME;
141 hints.ai_protocol = IPPROTO_TCP;
142 hints.ai_canonname = NULL;
143 hints.ai_next = NULL;
144 hints.ai_addr = NULL;
145
146 return ecore_con_info_get(svr, done_cb, data, &hints);
147}
148
149int
150ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
151 Ecore_Con_Info_Cb done_cb,
152 void *data)
153{
154 struct addrinfo hints;
155
156 memset(&hints, 0, sizeof(struct addrinfo));
157#ifdef HAVE_IPV6
158 hints.ai_family = AF_INET6;
159#else
160 hints.ai_family = AF_INET;
161#endif
162 hints.ai_socktype = SOCK_STREAM;
163 hints.ai_flags = AI_PASSIVE;
164 hints.ai_protocol = IPPROTO_TCP;
165 hints.ai_canonname = NULL;
166 hints.ai_next = NULL;
167 hints.ai_addr = NULL;
168
169 return ecore_con_info_get(svr, done_cb, data, &hints);
170}
171
172int
173ecore_con_info_udp_connect(Ecore_Con_Server *svr,
174 Ecore_Con_Info_Cb done_cb,
175 void *data)
176{
177 struct addrinfo hints;
178
179 memset(&hints, 0, sizeof(struct addrinfo));
180#ifdef HAVE_IPV6
181 hints.ai_family = AF_INET6;
182#else
183 hints.ai_family = AF_INET;
184#endif
185 hints.ai_socktype = SOCK_DGRAM;
186 hints.ai_flags = AI_CANONNAME;
187 hints.ai_protocol = IPPROTO_UDP;
188 hints.ai_canonname = NULL;
189 hints.ai_next = NULL;
190 hints.ai_addr = NULL;
191
192 return ecore_con_info_get(svr, done_cb, data, &hints);
193}
194
195int
196ecore_con_info_udp_listen(Ecore_Con_Server *svr,
197 Ecore_Con_Info_Cb done_cb,
198 void *data)
199{
200 struct addrinfo hints;
201
202 memset(&hints, 0, sizeof(struct addrinfo));
203#ifdef HAVE_IPV6
204 hints.ai_family = AF_INET6;
205#else
206 hints.ai_family = AF_INET;
207#endif
208 hints.ai_socktype = SOCK_DGRAM;
209 hints.ai_flags = AI_PASSIVE;
210 hints.ai_protocol = IPPROTO_UDP;
211 hints.ai_canonname = NULL;
212 hints.ai_next = NULL;
213 hints.ai_addr = NULL;
214
215 return ecore_con_info_get(svr, done_cb, data, &hints);
216}
217
218int
219ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
220 Ecore_Con_Info_Cb done_cb,
221 void *data)
222{
223 struct addrinfo hints;
224
225 memset(&hints, 0, sizeof(struct addrinfo));
226#ifdef HAVE_IPV6
227 hints.ai_family = AF_INET6;
228#else
229 hints.ai_family = AF_INET;
230#endif
231 hints.ai_socktype = SOCK_DGRAM;
232 hints.ai_flags = 0;
233 hints.ai_protocol = IPPROTO_UDP;
234 hints.ai_canonname = NULL;
235 hints.ai_next = NULL;
236 hints.ai_addr = NULL;
237
238 return ecore_con_info_get(svr, done_cb, data, &hints);
239}
240
241static Eina_Bool
242_ecore_con_info_ares_getnameinfo(Ecore_Con_CAres *arg,
243 int addrtype,
244 const char *name,
245 struct sockaddr *addr,
246 int addrlen)
247{
248 int length = 0;
249
250 if (name)
251 length = strlen(name) + 1;
252 else
253 length = 1;
254
255 arg->result = malloc(sizeof(Ecore_Con_Info) + length);
256 if (!arg->result)
257 return EINA_FALSE;
258
259 /* FIXME: What to do when hint is not set ? */
260 arg->result->info.ai_flags = arg->hints.ai_flags;
261 arg->result->info.ai_socktype = arg->hints.ai_socktype;
262 arg->result->info.ai_protocol = arg->hints.ai_protocol;
263
264 arg->result->info.ai_family = addrtype;
265 arg->result->info.ai_addrlen = addrlen;
266 arg->result->info.ai_addr = addr;
267 arg->result->info.ai_canonname = (char *)(arg->result + 1);
268
269 if (!name)
270 *arg->result->info.ai_canonname = '\0';
271 else
272 strcpy(arg->result->info.ai_canonname, name);
273
274 arg->result->info.ai_next = NULL;
275
276 ares_getnameinfo(
277 info_channel, addr, addrlen,
278 ARES_NI_NUMERICSERV | ARES_NI_NUMERICHOST |
279 ARES_NI_LOOKUPSERVICE | ARES_NI_LOOKUPHOST,
280 (ares_nameinfo_callback)_ecore_con_info_ares_nameinfo, arg);
281
282 return EINA_TRUE;
283}
284
285EAPI int
286ecore_con_info_get(Ecore_Con_Server *svr,
287 Ecore_Con_Info_Cb done_cb,
288 void *data,
289 struct addrinfo *hints)
290{
291 Ecore_Con_CAres *cares;
292#ifdef HAVE_IPV6
293 int ai_family = AF_INET6;
294#else
295 int ai_family = AF_INET;
296#endif
297
298 cares = calloc(1, sizeof(Ecore_Con_CAres));
299 if (!cares)
300 return 0;
301
302 cares->svr = svr;
303 cares->done_cb = done_cb;
304 cares->data = data;
305
306 if (hints)
307 {
308 ai_family = hints->ai_family;
309 memcpy(&cares->hints, hints, sizeof(struct addrinfo));
310 }
311
312 if (inet_pton(AF_INET, svr->ecs ? svr->ecs->ip : svr->name, &cares->addr.v4) == 1)
313 {
314 cares->byaddr = EINA_TRUE;
315 cares->isv6 = EINA_FALSE;
316 ares_gethostbyaddr(info_channel, &cares->addr.v4,
317 sizeof(cares->addr.v4),
318 AF_INET,
319 (ares_host_callback)_ecore_con_info_ares_host_cb,
320 cares);
321 }
322#ifdef HAVE_IPV6
323 else if (inet_pton(AF_INET6, svr->ecs ? svr->ecs->ip : svr->name, &cares->addr.v6) == 1)
324 {
325 cares->byaddr = EINA_TRUE;
326 cares->isv6 = EINA_TRUE;
327 ares_gethostbyaddr(info_channel, &cares->addr.v6,
328 sizeof(cares->addr.v6),
329 AF_INET6,
330 (ares_host_callback)_ecore_con_info_ares_host_cb,
331 cares);
332 }
333#endif
334 else
335 {
336 cares->byaddr = EINA_FALSE;
337 ares_gethostbyname(info_channel, svr->ecs ? svr->ecs->ip : svr->name, ai_family,
338 (ares_host_callback)_ecore_con_info_ares_host_cb,
339 cares);
340 }
341
342 svr->infos = eina_list_append(svr->infos, cares);
343 return 1;
344}
345
346void
347ecore_con_info_data_clear(void *info)
348{
349 Ecore_Con_CAres *cares = info;
350 if (cares) cares->data = NULL;
351}
352
353static Eina_Bool
354_ecore_con_info_cares_timeout_cb(void *data __UNUSED__)
355{
356 ares_process_fd(info_channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
357 return ECORE_CALLBACK_RENEW;
358}
359
360static Eina_Bool
361_ecore_con_info_cares_fd_cb(Ecore_Con_FD *ecf,
362 Ecore_Fd_Handler *fd_handler)
363{
364 ares_socket_t read_fd, write_fd;
365
366 read_fd = write_fd = ARES_SOCKET_BAD;
367
368 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
369 read_fd = ecf->fd;
370 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
371 write_fd = ecf->fd;
372
373 ares_process_fd(info_channel, read_fd, write_fd);
374
375 return ECORE_CALLBACK_RENEW;
376}
377
378static int
379_ecore_con_info_fds_search(const Ecore_Con_FD *fd1,
380 const Ecore_Con_FD *fd2)
381{
382 return fd1->fd - fd2->fd;
383}
384
385static void
386_ecore_con_info_cares_state_cb(void *data __UNUSED__,
387 ares_socket_t fd,
388 int readable,
389 int writable)
390{
391 int flags = 0;
392 Ecore_Con_FD *search = NULL, *ecf = NULL;
393
394 search = eina_list_search_unsorted(info_fds,
395 (Eina_Compare_Cb)_ecore_con_info_fds_search, &ecf);
396
397 if (!(readable | writable))
398 {
399 ares_process_fd(info_channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
400 if (search)
401 {
402 info_fds = eina_list_remove(info_fds, search);
403 ecore_timer_del(search->timer);
404 ecore_main_fd_handler_del(search->handler);
405 free(search);
406 }
407 return;
408 }
409
410 if (!search)
411 {
412 search = malloc(sizeof(Ecore_Con_FD));
413 EINA_SAFETY_ON_NULL_RETURN(search);
414
415 search->fd = fd;
416 search->handler = ecore_main_fd_handler_add(fd, ECORE_FD_WRITE | ECORE_FD_READ,
417 (Ecore_Fd_Cb)_ecore_con_info_cares_fd_cb, search, NULL, NULL);
418 /* c-ares default timeout is 5 seconds */
419 search->timer = ecore_timer_add(5, _ecore_con_info_cares_timeout_cb, NULL);
420 info_fds = eina_list_append(info_fds, search);
421 }
422
423 if (readable) flags |= ECORE_FD_READ;
424 if (writable) flags |= ECORE_FD_WRITE;
425 ecore_main_fd_handler_active_set(search->handler, flags);
426}
427
428static void
429_ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg,
430 int status,
431 int timeouts __UNUSED__,
432 struct hostent *hostent)
433{
434 struct sockaddr *addr;
435 int addrlen;
436
437 /* Found something ? */
438 switch (status)
439 {
440 case ARES_SUCCESS:
441 if (!hostent->h_addr_list[0])
442 {
443 ERR("No IP found");
444 goto on_error;
445 }
446
447 switch (hostent->h_addrtype)
448 {
449 case AF_INET:
450 {
451 struct sockaddr_in *addri;
452
453 addrlen = sizeof(struct sockaddr_in);
454 addri = malloc(addrlen);
455
456 if (!addri)
457 goto on_mem_error;
458
459 addri->sin_family = AF_INET;
460 addri->sin_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
461
462 memcpy(&addri->sin_addr.s_addr,
463 hostent->h_addr_list[0], sizeof(struct in_addr));
464
465 addr = (struct sockaddr *)addri;
466 break;
467 }
468#ifdef HAVE_IPV6
469 case AF_INET6:
470 {
471 struct sockaddr_in6 *addri6;
472
473 addrlen = sizeof(struct sockaddr_in6);
474 addri6 = malloc(addrlen);
475
476 if (!addri6)
477 goto on_mem_error;
478
479 addri6->sin6_family = AF_INET6;
480 addri6->sin6_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
481 addri6->sin6_flowinfo = 0;
482 addri6->sin6_scope_id = 0;
483
484 memcpy(&addri6->sin6_addr.s6_addr,
485 hostent->h_addr_list[0], sizeof(struct in6_addr));
486
487 addr = (struct sockaddr *)addri6;
488 break;
489 }
490#endif
491 default:
492 ERR("Unknown addrtype %i", hostent->h_addrtype);
493 goto on_error;
494 }
495
496 if (!_ecore_con_info_ares_getnameinfo(arg, hostent->h_addrtype,
497 hostent->h_name,
498 addr, addrlen))
499 goto on_error;
500
501 break;
502
503 case ARES_ENOTFOUND: /* address notfound */
504 if (arg->byaddr)
505 {
506#ifdef HAVE_IPV6
507 /* This happen when host doesn't have a reverse. */
508 if (arg->isv6)
509 {
510 struct sockaddr_in6 *addri6;
511
512 addrlen = sizeof(struct sockaddr_in6);
513 addri6 = malloc(addrlen);
514
515 if (!addri6)
516 goto on_mem_error;
517
518 addri6->sin6_family = AF_INET6;
519 addri6->sin6_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
520 addri6->sin6_flowinfo = 0;
521 addri6->sin6_scope_id = 0;
522
523 memcpy(&addri6->sin6_addr.s6_addr,
524 &arg->addr.v6, sizeof(struct in6_addr));
525
526 addr = (struct sockaddr *)addri6;
527 }
528 else
529#endif
530 {
531 struct sockaddr_in *addri;
532
533 addrlen = sizeof(struct sockaddr_in);
534 addri = malloc(addrlen);
535
536 if (!addri)
537 goto on_mem_error;
538
539 addri->sin_family = AF_INET;
540 addri->sin_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
541
542 memcpy(&addri->sin_addr.s_addr,
543 &arg->addr.v4, sizeof(struct in_addr));
544
545 addr = (struct sockaddr *)addri;
546 }
547
548 if (!_ecore_con_info_ares_getnameinfo(arg,
549#ifdef HAVE_IPV6
550 arg->isv6 ? AF_INET6 :
551#endif
552 AF_INET,
553 NULL, addr,
554 addrlen))
555 goto on_error;
556
557 break;
558 }
559
560 case ARES_ENOTIMP: /* unknown family */
561 case ARES_EBADNAME: /* not a valid internet address */
562 case ARES_ENOMEM: /* not enough memory */
563 case ARES_EDESTRUCTION: /* request canceled, shuting down */
564 case ARES_ENODATA: /* no data returned */
565 case ARES_ECONNREFUSED: /* connection refused */
566 case ARES_ETIMEOUT: /* connection timed out */
567 ecore_con_event_server_error(arg->svr, ares_strerror(status));
568 goto on_error;
569
570 default:
571 ERR("Unknown status returned by c-ares: %i assuming error", status);
572 ecore_con_event_server_error(arg->svr, ares_strerror(status));
573 goto on_error;
574 }
575
576 return;
577
578on_mem_error:
579 ERR("Not enough memory");
580
581on_error:
582 if (arg->data)
583 {
584 ecore_con_server_infos_del(arg->data, arg);
585 arg->done_cb(arg->data, NULL);
586 }
587 free(arg);
588}
589
590static void
591_ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg,
592 int status,
593 int timeouts __UNUSED__,
594 char *node,
595 char *service)
596{
597 switch (status)
598 {
599 case ARES_SUCCESS:
600 if (node)
601 strcpy(arg->result->ip, node);
602 else
603 *arg->result->ip = '\0';
604
605 if (service)
606 strcpy(arg->result->service, service);
607 else
608 *arg->result->service = '\0';
609
610 if (arg->data) arg->done_cb(arg->data, arg->result);
611 break;
612
613 case ARES_ENOTIMP:
614 case ARES_ENOTFOUND:
615 case ARES_ENOMEM:
616 case ARES_EDESTRUCTION:
617 case ARES_EBADFLAGS:
618 ecore_con_event_server_error(arg->svr, ares_strerror(status));
619 if (arg->data) arg->done_cb(arg->data, NULL);
620 break;
621 }
622
623 free(arg->result->info.ai_addr);
624 free(arg->result);
625 if (arg->data) ecore_con_server_infos_del(arg->data, arg);
626 free(arg);
627}
628
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_info.c b/libraries/ecore/src/lib/ecore_con/ecore_con_info.c
deleted file mode 100644
index fdcf0b9..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_info.c
+++ /dev/null
@@ -1,449 +0,0 @@
1/*
2 * getaddrinfo with callback
3 *
4 * man getaddrinfo
5 *
6 */
7
8#ifdef HAVE_CONFIG_H
9# include <config.h>
10#endif
11
12#ifdef HAVE_ALLOCA_H
13# include <alloca.h>
14#elif defined __GNUC__
15# define alloca __builtin_alloca
16#elif defined _AIX
17# define alloca __alloca
18#elif defined _MSC_VER
19# include <malloc.h>
20# define alloca _alloca
21#else
22# include <stddef.h>
23# ifdef __cplusplus
24extern "C"
25# endif
26void *alloca(size_t);
27#endif
28
29#include <string.h>
30#include <sys/types.h>
31#include <unistd.h>
32#include <ctype.h>
33#ifdef __OpenBSD__
34# include <sys/types.h>
35#endif
36
37#ifdef HAVE_NETINET_IN_H
38# include <netinet/in.h>
39#endif
40
41#ifdef HAVE_ARPA_INET_H
42# include <arpa/inet.h>
43#endif
44
45#ifdef HAVE_ARPA_NAMESER_H
46# include <arpa/nameser.h>
47#endif
48
49#ifdef HAVE_SYS_SOCKET_H
50# include <sys/socket.h>
51#endif
52
53#ifdef HAVE_NETDB_H
54# include <netdb.h>
55#endif
56
57#include <errno.h>
58
59#include "Ecore.h"
60#include "ecore_private.h"
61#include "ecore_con_private.h"
62
63typedef struct _CB_Data CB_Data;
64
65struct _CB_Data
66{
67 EINA_INLIST;
68 Ecore_Con_Info_Cb cb_done;
69 void *data;
70 Ecore_Fd_Handler *fdh;
71 pid_t pid;
72 Ecore_Event_Handler *handler;
73 int fd2;
74};
75
76static void _ecore_con_info_readdata(CB_Data *cbdata);
77static void _ecore_con_info_slave_free(CB_Data *cbdata);
78static Eina_Bool _ecore_con_info_data_handler(void *data,
79 Ecore_Fd_Handler *fd_handler);
80static Eina_Bool _ecore_con_info_exit_handler(void *data,
81 int type __UNUSED__,
82 void *event);
83
84static int info_init = 0;
85static CB_Data *info_slaves = NULL;
86
87int
88ecore_con_info_init(void)
89{
90 info_init++;
91 return info_init;
92}
93
94int
95ecore_con_info_shutdown(void)
96{
97 info_init--;
98 if (info_init == 0)
99 while (info_slaves) _ecore_con_info_slave_free(info_slaves);
100
101 return info_init;
102}
103
104int
105ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
106 Ecore_Con_Info_Cb done_cb,
107 void *data)
108{
109 struct addrinfo hints;
110
111 memset(&hints, 0, sizeof(struct addrinfo));
112 hints.ai_family = AF_UNSPEC;
113 hints.ai_socktype = SOCK_STREAM;
114 hints.ai_flags = AI_CANONNAME;
115 hints.ai_protocol = IPPROTO_TCP;
116 hints.ai_canonname = NULL;
117 hints.ai_next = NULL;
118 hints.ai_addr = NULL;
119
120 return ecore_con_info_get(svr, done_cb, data, &hints);
121}
122
123int
124ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
125 Ecore_Con_Info_Cb done_cb,
126 void *data)
127{
128 struct addrinfo hints;
129
130 memset(&hints, 0, sizeof(struct addrinfo));
131 hints.ai_family = AF_UNSPEC;
132 hints.ai_socktype = SOCK_STREAM;
133 hints.ai_flags = AI_PASSIVE;
134 hints.ai_protocol = IPPROTO_TCP;
135 hints.ai_canonname = NULL;
136 hints.ai_next = NULL;
137 hints.ai_addr = NULL;
138
139 return ecore_con_info_get(svr, done_cb, data, &hints);
140}
141
142int
143ecore_con_info_udp_connect(Ecore_Con_Server *svr,
144 Ecore_Con_Info_Cb done_cb,
145 void *data)
146{
147 struct addrinfo hints;
148
149 memset(&hints, 0, sizeof(struct addrinfo));
150 hints.ai_family = AF_UNSPEC;
151 hints.ai_socktype = SOCK_DGRAM;
152 hints.ai_flags = AI_CANONNAME;
153 hints.ai_protocol = IPPROTO_UDP;
154 hints.ai_canonname = NULL;
155 hints.ai_next = NULL;
156 hints.ai_addr = NULL;
157
158 return ecore_con_info_get(svr, done_cb, data, &hints);
159}
160
161int
162ecore_con_info_udp_listen(Ecore_Con_Server *svr,
163 Ecore_Con_Info_Cb done_cb,
164 void *data)
165{
166 struct addrinfo hints;
167
168 memset(&hints, 0, sizeof(struct addrinfo));
169 hints.ai_family = AF_UNSPEC;
170 hints.ai_socktype = SOCK_DGRAM;
171 hints.ai_flags = AI_PASSIVE;
172 hints.ai_protocol = IPPROTO_UDP;
173 hints.ai_canonname = NULL;
174 hints.ai_next = NULL;
175 hints.ai_addr = NULL;
176
177 return ecore_con_info_get(svr, done_cb, data, &hints);
178}
179
180int
181ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
182 Ecore_Con_Info_Cb done_cb,
183 void *data)
184{
185 struct addrinfo hints;
186
187 memset(&hints, 0, sizeof(struct addrinfo));
188 hints.ai_family = AF_UNSPEC;
189 hints.ai_socktype = SOCK_DGRAM;
190 hints.ai_flags = 0;
191 hints.ai_protocol = IPPROTO_UDP;
192 hints.ai_canonname = NULL;
193 hints.ai_next = NULL;
194 hints.ai_addr = NULL;
195
196 return ecore_con_info_get(svr, done_cb, data, &hints);
197}
198
199EAPI int
200ecore_con_info_get(Ecore_Con_Server *svr,
201 Ecore_Con_Info_Cb done_cb,
202 void *data,
203 struct addrinfo *hints)
204{
205 CB_Data *cbdata;
206 int fd[2];
207
208 if (pipe(fd) < 0)
209 {
210 ecore_con_event_server_error(svr, strerror(errno));
211 return 0;
212 }
213
214 cbdata = calloc(1, sizeof(CB_Data));
215 if (!cbdata)
216 {
217 close(fd[0]);
218 close(fd[1]);
219 return 0;
220 }
221
222 cbdata->cb_done = done_cb;
223 cbdata->data = data;
224 cbdata->fd2 = fd[1];
225 if (!(cbdata->fdh = ecore_main_fd_handler_add(fd[0], ECORE_FD_READ,
226 _ecore_con_info_data_handler,
227 cbdata,
228 NULL, NULL)))
229 {
230 ecore_con_event_server_error(svr, "Memory allocation failure");
231 free(cbdata);
232 close(fd[0]);
233 close(fd[1]);
234 return 0;
235 }
236
237 if ((cbdata->pid = fork()) == 0)
238 {
239 Ecore_Con_Info *container;
240 struct addrinfo *result = NULL;
241 char service[NI_MAXSERV] = {0};
242 char hbuf[NI_MAXHOST] = {0};
243 char sbuf[NI_MAXSERV] = {0};
244 unsigned char *tosend = NULL;
245 int tosend_len;
246 int canonname_len = 0;
247
248 eina_convert_itoa(svr->ecs ? svr->ecs->port : svr->port, service);
249 /* CHILD */
250 if (!getaddrinfo(svr->ecs ? svr->ecs->ip : svr->name, service, hints, &result) && result)
251 {
252 if (result->ai_canonname)
253 canonname_len = strlen(result->ai_canonname) + 1;
254
255 tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen +
256 canonname_len;
257
258 tosend = alloca(tosend_len);
259 memset(tosend, 0, tosend_len);
260
261 container = (Ecore_Con_Info *)tosend;
262 container->size = tosend_len;
263
264 memcpy(&container->info,
265 result,
266 sizeof(struct addrinfo));
267 memcpy(tosend + sizeof(Ecore_Con_Info),
268 result->ai_addr,
269 result->ai_addrlen);
270 if (result->ai_canonname) /* FIXME: else... */
271 memcpy(tosend + sizeof(Ecore_Con_Info) + result->ai_addrlen,
272 result->ai_canonname,
273 canonname_len);
274
275 if (!getnameinfo(result->ai_addr, result->ai_addrlen,
276 hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
277 NI_NUMERICHOST | NI_NUMERICSERV))
278 {
279 memcpy(container->ip, hbuf, sizeof(container->ip));
280 memcpy(container->service, sbuf, sizeof(container->service));
281 }
282
283 if (write(fd[1], tosend, tosend_len) < 0) perror("write");
284 }
285
286 if (result)
287 freeaddrinfo(result);
288
289 if (write(fd[1], "", 1) < 0) perror("write");
290 close(fd[1]);
291#if defined(__USE_ISOC99) && !defined(__UCLIBC__)
292 _Exit(0);
293#else
294 _exit(0);
295#endif
296 }
297
298 /* PARENT */
299 cbdata->handler =
300 ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _ecore_con_info_exit_handler,
301 cbdata);
302 close(fd[1]);
303 if (!cbdata->handler)
304 {
305 ecore_main_fd_handler_del(cbdata->fdh);
306 free(cbdata);
307 close(fd[0]);
308 return 0;
309 }
310
311 info_slaves = (CB_Data *)eina_inlist_append(EINA_INLIST_GET(
312 info_slaves),
313 EINA_INLIST_GET(cbdata));
314 svr->infos = eina_list_append(svr->infos, cbdata);
315 return 1;
316}
317
318void
319ecore_con_info_data_clear(void *info)
320{
321 CB_Data *cbdata = info;
322 cbdata->data = NULL;
323}
324
325static void
326_ecore_con_info_readdata(CB_Data *cbdata)
327{
328 Ecore_Con_Info container;
329 Ecore_Con_Info *recv_info;
330 unsigned char *torecv;
331 int torecv_len;
332
333 ssize_t size;
334
335 size = read(ecore_main_fd_handler_fd_get(cbdata->fdh), &container,
336 sizeof(Ecore_Con_Info));
337 if (size == sizeof(Ecore_Con_Info))
338 {
339 torecv_len = container.size;
340 torecv = malloc(torecv_len);
341
342 memcpy(torecv, &container, sizeof(Ecore_Con_Info));
343
344 size = read(ecore_main_fd_handler_fd_get(cbdata->fdh),
345 torecv + sizeof(Ecore_Con_Info),
346 torecv_len - sizeof(Ecore_Con_Info));
347 if ((size > 0) &&
348 ((size_t)size == torecv_len - sizeof(Ecore_Con_Info)))
349 {
350 recv_info = (Ecore_Con_Info *)torecv;
351
352 recv_info->info.ai_addr =
353 (struct sockaddr *)(torecv + sizeof(Ecore_Con_Info));
354 if ((size_t)torecv_len !=
355 (sizeof(Ecore_Con_Info) + recv_info->info.ai_addrlen))
356 recv_info->info.ai_canonname = (char *)
357 (torecv + sizeof(Ecore_Con_Info) + recv_info->info.ai_addrlen);
358 else
359 recv_info->info.ai_canonname = NULL;
360
361 recv_info->info.ai_next = NULL;
362
363 if (cbdata->data)
364 {
365 cbdata->cb_done(cbdata->data, recv_info);
366 ecore_con_server_infos_del(cbdata->data, cbdata);
367 }
368
369 free(torecv);
370 }
371 else
372 {
373 if (cbdata->data)
374 {
375 cbdata->cb_done(cbdata->data, NULL);
376 ecore_con_server_infos_del(cbdata->data, cbdata);
377 }
378 }
379 }
380 else
381 {
382 if (cbdata->data)
383 {
384 ecore_con_event_server_error(cbdata->data, strerror(errno));
385 cbdata->cb_done(cbdata->data, NULL);
386 ecore_con_server_infos_del(cbdata->data, cbdata);
387 }
388 }
389
390 cbdata->cb_done = NULL;
391}
392
393static void
394_ecore_con_info_slave_free(CB_Data *cbdata)
395{
396 info_slaves = (CB_Data *)eina_inlist_remove(EINA_INLIST_GET(info_slaves),
397 EINA_INLIST_GET(cbdata));
398 ecore_main_fd_handler_del(cbdata->fdh);
399 ecore_event_handler_del(cbdata->handler);
400 close(ecore_main_fd_handler_fd_get(cbdata->fdh));
401 if (cbdata->data) ecore_con_server_infos_del(cbdata->data, cbdata);
402 free(cbdata);
403}
404
405static Eina_Bool
406_ecore_con_info_data_handler(void *data,
407 Ecore_Fd_Handler *fd_handler)
408{
409 CB_Data *cbdata;
410
411 cbdata = data;
412 if (cbdata->cb_done)
413 {
414 if (ecore_main_fd_handler_active_get(fd_handler,
415 ECORE_FD_READ))
416 _ecore_con_info_readdata(cbdata);
417 else
418 {
419 if (cbdata->data)
420 {
421 cbdata->cb_done(cbdata->data, NULL);
422 cbdata->cb_done = NULL;
423 ecore_con_server_infos_del(cbdata->data, cbdata);
424 }
425 }
426 }
427
428 _ecore_con_info_slave_free(cbdata);
429 return ECORE_CALLBACK_CANCEL;
430}
431
432static Eina_Bool
433_ecore_con_info_exit_handler(void *data,
434 int type __UNUSED__,
435 void *event)
436{
437 CB_Data *cbdata;
438 Ecore_Exe_Event_Del *ev;
439
440 ev = event;
441 cbdata = data;
442 if (cbdata->pid != ev->pid)
443 return ECORE_CALLBACK_RENEW;
444
445 return ECORE_CALLBACK_CANCEL; /* FIXME: Woot ??? */
446 _ecore_con_info_slave_free(cbdata);
447 return ECORE_CALLBACK_CANCEL;
448}
449
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_local.c b/libraries/ecore/src/lib/ecore_con/ecore_con_local.c
deleted file mode 100644
index f02cc1f..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_local.c
+++ /dev/null
@@ -1,317 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7#include <unistd.h>
8#include <time.h>
9#include <fcntl.h>
10#include <sys/stat.h>
11
12#ifdef HAVE_SYS_SOCKET_H
13# include <sys/socket.h>
14#endif
15
16#ifdef HAVE_SYS_UN_H
17# include <sys/un.h>
18#endif
19
20#ifdef HAVE_WS2TCPIP_H
21# include <ws2tcpip.h>
22#endif
23
24#include <Ecore.h>
25#include <ecore_private.h>
26
27#include "Ecore_Con.h"
28#include "ecore_con_private.h"
29
30#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + \
31 (size_t)(((struct sockaddr_un *)NULL)-> \
32 sun_path))
33#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + \
34 (size_t)(((struct sockaddr_un \
35 *)NULL)->sun_path))
36
37static int _ecore_con_local_init_count = 0;
38
39int
40ecore_con_local_init(void)
41{
42 if (++_ecore_con_local_init_count != 1)
43 return _ecore_con_local_init_count;
44
45 return _ecore_con_local_init_count;
46}
47
48int
49ecore_con_local_shutdown(void)
50{
51 if (--_ecore_con_local_init_count != 0)
52 return _ecore_con_local_init_count;
53
54 return _ecore_con_local_init_count;
55}
56
57int
58ecore_con_local_connect(Ecore_Con_Server *svr,
59 Eina_Bool (*cb_done)(void *data, Ecore_Fd_Handler *fd_handler),
60 void *data __UNUSED__)
61{
62#ifndef HAVE_LOCAL_SOCKETS
63 return 0;
64#else
65 char buf[4096];
66 struct sockaddr_un socket_unix;
67 int curstate = 0;
68 const char *homedir;
69 int socket_unix_len;
70
71 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
72 {
73 homedir = getenv("HOME");
74 if (!homedir)
75 homedir = getenv("TMP");
76
77 if (!homedir)
78 homedir = "/tmp";
79
80 snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name,
81 svr->port);
82 }
83 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
84 {
85 if (svr->port < 0)
86 {
87 if (svr->name[0] == '/')
88 strncpy(buf, svr->name, sizeof(buf));
89 else
90 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name);
91 }
92 else
93 {
94 if (svr->name[0] ==
95 '/')
96 snprintf(buf, sizeof(buf), "%s|%i", svr->name,
97 svr->port);
98 else
99 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
100 svr->name,
101 svr->port);
102 }
103 }
104 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
105 strncpy(buf, svr->name,
106 sizeof(buf));
107
108 svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
109 if (svr->fd < 0)
110 return 0;
111
112 if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
113 return 0;
114
115 if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
116 return 0;
117
118 if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate,
119 sizeof(curstate)) < 0)
120 return 0;
121
122 socket_unix.sun_family = AF_UNIX;
123
124 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
125 {
126#ifdef HAVE_ABSTRACT_SOCKETS
127 /* copy name insto sun_path, prefixed by null to indicate abstract namespace */
128 snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s",
129 svr->name);
130 socket_unix.sun_path[0] = '\0';
131 socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix,
132 svr->name);
133#else
134 WRN("Your system does not support abstract sockets!");
135 return 0;
136#endif
137 }
138 else
139 {
140 strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
141 socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
142 }
143
144 if (connect(svr->fd, (struct sockaddr *)&socket_unix,
145 socket_unix_len) < 0)
146 return 0;
147
148 svr->path = strdup(buf);
149 if (!svr->path)
150 return 0;
151
152 if (svr->type & ECORE_CON_SSL)
153 ecore_con_ssl_server_init(svr);
154
155 svr->fd_handler =
156 ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
157 cb_done, svr, NULL, NULL);
158 if (!svr->fd_handler)
159 return 0;
160
161 if (!svr->delete_me) ecore_con_event_server_add(svr);
162
163 return 1;
164#endif
165}
166
167int
168ecore_con_local_listen(
169 Ecore_Con_Server *svr,
170 Eina_Bool (*
171 cb_listen)(void *data,
172 Ecore_Fd_Handler *
173 fd_handler),
174 void *data
175 __UNUSED__)
176{
177#ifdef HAVE_LOCAL_SOCKETS
178 char buf[4096];
179 struct sockaddr_un socket_unix;
180 struct linger lin;
181 mode_t pmode;
182 const char *homedir;
183 struct stat st;
184 mode_t mask;
185 int socket_unix_len;
186
187 mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH;
188
189 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
190 {
191 homedir = getenv("HOME");
192 if (!homedir)
193 homedir = getenv("TMP");
194
195 if (!homedir)
196 homedir = "/tmp";
197
198 mask = S_IRUSR | S_IWUSR | S_IXUSR;
199 snprintf(buf, sizeof(buf), "%s/.ecore", homedir);
200 if (stat(buf, &st) < 0)
201 mkdir(buf, mask);
202
203 snprintf(buf, sizeof(buf), "%s/.ecore/%s", homedir, svr->name);
204 if (stat(buf, &st) < 0)
205 mkdir(buf, mask);
206
207 snprintf(buf,
208 sizeof(buf),
209 "%s/.ecore/%s/%i",
210 homedir,
211 svr->name,
212 svr->port);
213 mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH;
214 }
215 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
216 {
217 mask = 0;
218 if (svr->name[0] == '/')
219 {
220 if (svr->port >= 0)
221 snprintf(buf,
222 sizeof(buf),
223 "%s|%i",
224 svr->name,
225 svr->port);
226 else
227 snprintf(buf,
228 sizeof(buf),
229 "%s",
230 svr->name);
231 }
232 else
233 snprintf(buf,
234 sizeof(buf),
235 "/tmp/.ecore_service|%s|%i",
236 svr->name,
237 svr->port);
238 }
239 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
240 strncpy(buf, svr->name,
241 sizeof(buf));
242
243 pmode = umask(mask);
244start:
245 svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
246 if (svr->fd < 0)
247 goto error_umask;
248
249 if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
250 goto error_umask;
251
252 if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
253 goto error_umask;
254
255 lin.l_onoff = 1;
256 lin.l_linger = 0;
257 if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin,
258 sizeof(struct linger)) < 0)
259 goto error_umask;
260
261 socket_unix.sun_family = AF_UNIX;
262 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
263 {
264#ifdef HAVE_ABSTRACT_SOCKETS
265 /* . is a placeholder */
266 snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s",
267 svr->name);
268 /* first char null indicates abstract namespace */
269 socket_unix.sun_path[0] = '\0';
270 socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix,
271 svr->name);
272#else
273 ERR("Your system does not support abstract sockets!");
274 goto error_umask;
275#endif
276 }
277 else
278 {
279 strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
280 socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
281 }
282
283 if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
284 {
285 if ((((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) ||
286 ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)) &&
287 (connect(svr->fd, (struct sockaddr *)&socket_unix,
288 socket_unix_len) < 0) &&
289 (unlink(buf) >= 0))
290 goto start;
291 else
292 goto error_umask;
293 }
294
295 if (listen(svr->fd, 4096) < 0)
296 goto error_umask;
297
298 svr->path = strdup(buf);
299 if (!svr->path)
300 goto error_umask;
301
302 svr->fd_handler =
303 ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
304 cb_listen, svr, NULL, NULL);
305 umask(pmode);
306 if (!svr->fd_handler)
307 goto error;
308
309 return 1;
310
311error_umask:
312 umask(pmode);
313error:
314#endif /* HAVE_LOCAL_SOCKETS */
315 return 0;
316}
317
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
deleted file mode 100644
index 2b7e5c5..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c
+++ /dev/null
@@ -1,754 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <process.h>
6
7#include <Evil.h>
8#include <Ecore.h>
9
10#include "Ecore_Con.h"
11#include "ecore_con_private.h"
12
13#define BUFSIZE 512
14
15
16static int _ecore_con_local_init_count = 0;
17
18int
19ecore_con_local_init(void)
20{
21 if (++_ecore_con_local_init_count != 1)
22 return _ecore_con_local_init_count;
23
24 return _ecore_con_local_init_count;
25}
26
27int
28ecore_con_local_shutdown(void)
29{
30 if (--_ecore_con_local_init_count != 0)
31 return _ecore_con_local_init_count;
32
33 return _ecore_con_local_init_count;
34}
35
36
37static Eina_Bool
38_ecore_con_local_win32_server_read_client_handler(void *data, Ecore_Win32_Handler *wh)
39{
40 Ecore_Con_Client *cl;
41 void *buf;
42 DWORD n;
43 Eina_Bool broken_pipe = EINA_FALSE;
44
45 cl = (Ecore_Con_Client *)data;
46
47 if (!ResetEvent(cl->host_server->event_read))
48 return ECORE_CALLBACK_RENEW;
49
50 buf = malloc(cl->host_server->nbr_bytes);
51 if (!buf)
52 return ECORE_CALLBACK_RENEW;
53
54 if (ReadFile(cl->host_server->pipe, buf, cl->host_server->nbr_bytes, &n, NULL))
55 {
56 if (!cl->delete_me)
57 ecore_con_event_client_data(cl, buf, cl->host_server->nbr_bytes, EINA_FALSE);
58 cl->host_server->want_write = 1;
59 }
60 else
61 {
62 if (GetLastError() == ERROR_BROKEN_PIPE)
63 broken_pipe = EINA_TRUE;
64 }
65
66 if (broken_pipe)
67 {
68#if 0
69 char *msg;
70
71 msg = evil_last_error_get();
72 if (msg)
73 {
74 ecore_con_event_client_error(cl, msg);
75 free(msg);
76 }
77#endif
78 _ecore_con_client_kill(cl);
79 return ECORE_CALLBACK_CANCEL;
80 }
81
82 if (cl->host_server->want_write)
83 ecore_con_local_win32_client_flush(cl);
84
85 ecore_main_win32_handler_del(wh);
86
87 return ECORE_CALLBACK_DONE;
88}
89
90static Eina_Bool
91_ecore_con_local_win32_server_peek_client_handler(void *data, Ecore_Win32_Handler *wh)
92{
93 Ecore_Con_Client *cl;
94#if 0
95 char *msg;
96#endif
97
98 cl = (Ecore_Con_Client *)data;
99
100 if (!ResetEvent(cl->host_server->event_peek))
101 return ECORE_CALLBACK_RENEW;
102
103#if 0
104 msg = evil_last_error_get();
105 if (msg)
106 {
107 ecore_con_event_server_error(cl->host_server, msg);
108 free(msg);
109 }
110#endif
111 _ecore_con_server_kill(cl->host_server);
112 return ECORE_CALLBACK_CANCEL;
113
114 ecore_main_win32_handler_del(wh);
115
116 return ECORE_CALLBACK_DONE;
117}
118
119static Eina_Bool
120_ecore_con_local_win32_client_peek_server_handler(void *data, Ecore_Win32_Handler *wh)
121{
122 Ecore_Con_Server *svr;
123#if 0
124 char *msg;
125#endif
126
127 svr = (Ecore_Con_Server *)data;
128
129 if (!ResetEvent(svr->event_peek))
130 return ECORE_CALLBACK_RENEW;
131#if 0
132 msg = evil_last_error_get();
133 if (msg)
134 {
135 ecore_con_event_server_error(svr, msg);
136 free(msg);
137 }
138#endif
139 _ecore_con_server_kill(svr);
140 return ECORE_CALLBACK_CANCEL;
141
142 ecore_main_win32_handler_del(wh);
143
144 return ECORE_CALLBACK_DONE;
145}
146
147static Eina_Bool
148_ecore_con_local_win32_client_read_server_handler(void *data, Ecore_Win32_Handler *wh)
149{
150 Ecore_Con_Server *svr;
151 void *buf;
152 DWORD n;
153 Eina_Bool broken_pipe = EINA_FALSE;
154
155 svr = (Ecore_Con_Server *)data;
156
157 if (!ResetEvent(svr->event_read))
158 return ECORE_CALLBACK_RENEW;
159
160 buf = malloc(svr->nbr_bytes);
161 if (!buf)
162 return ECORE_CALLBACK_RENEW;
163
164 if (ReadFile(svr->pipe, buf, svr->nbr_bytes, &n, NULL))
165 {
166 if (!svr->delete_me)
167 ecore_con_event_server_data(svr, buf, svr->nbr_bytes, EINA_FALSE);
168 svr->want_write = 1;
169 }
170 else
171 {
172 if (GetLastError() == ERROR_BROKEN_PIPE)
173 broken_pipe = EINA_TRUE;
174 }
175
176 if (broken_pipe)
177 {
178#if 0
179 char *msg;
180
181 msg = evil_last_error_get();
182 if (msg)
183 {
184 ecore_con_event_server_error(svr, msg);
185 free(msg);
186 }
187#endif
188 _ecore_con_server_kill(svr);
189 return ECORE_CALLBACK_CANCEL;
190 }
191
192 if (svr->want_write)
193 ecore_con_local_win32_server_flush(svr);
194
195 ecore_main_win32_handler_del(wh);
196
197 return ECORE_CALLBACK_DONE;
198}
199
200/* thread to read data sent by the server to the client */
201static unsigned int __stdcall
202_ecore_con_local_win32_client_read_server_thread(void *data)
203{
204 Ecore_Con_Server *svr;
205 DWORD nbr_bytes = 0;
206
207 svr = (Ecore_Con_Server *)data;
208
209 svr->read_stopped = EINA_FALSE;
210
211 while (!svr->read_stop)
212 {
213 if (PeekNamedPipe(svr->pipe, NULL, 0, NULL, &nbr_bytes, NULL))
214 {
215 if (nbr_bytes <= 0)
216 continue;
217
218 svr->nbr_bytes = nbr_bytes;
219 if (!SetEvent(svr->event_read))
220 continue;
221 }
222 else
223 {
224 if (GetLastError() == ERROR_BROKEN_PIPE)
225 {
226 if (!SetEvent(svr->event_peek))
227 continue;
228 break;
229 }
230 }
231 }
232
233 printf(" ### %s\n", __FUNCTION__);
234 svr->read_stopped = EINA_TRUE;
235 _endthreadex(0);
236 return 0;
237}
238
239/* thread to read data sent by the client to the server */
240static unsigned int __stdcall
241_ecore_con_local_win32_server_read_client_thread(void *data)
242{
243 Ecore_Con_Client *cl;
244 DWORD nbr_bytes = 0;
245
246 cl = (Ecore_Con_Client *)data;
247
248 cl->host_server->read_stopped = EINA_FALSE;
249
250 while (!cl->host_server->read_stop)
251 {
252 if (PeekNamedPipe(cl->host_server->pipe, NULL, 0, NULL, &nbr_bytes, NULL))
253 {
254 if (nbr_bytes <= 0)
255 continue;
256
257 cl->host_server->nbr_bytes = nbr_bytes;
258 if (!SetEvent(cl->host_server->event_read))
259 continue;
260 }
261 else
262 {
263 if (GetLastError() == ERROR_BROKEN_PIPE)
264 {
265 if (!SetEvent(cl->host_server->event_peek))
266 continue;
267 break;
268 }
269 }
270 }
271
272 printf(" ### %s\n", __FUNCTION__);
273 cl->host_server->read_stopped = EINA_TRUE;
274 _endthreadex(0);
275 return 0;
276}
277
278static Eina_Bool
279_ecore_con_local_win32_client_add(void *data, Ecore_Win32_Handler *wh)
280{
281 Ecore_Con_Client *cl = NULL;
282 Ecore_Con_Server *svr;
283 Ecore_Win32_Handler *handler_read;
284 Ecore_Win32_Handler *handler_peek;
285
286 svr = (Ecore_Con_Server *)data;
287
288 if (!svr->pipe)
289 return ECORE_CALLBACK_CANCEL;
290
291 if (svr->delete_me)
292 return ECORE_CALLBACK_CANCEL;
293
294 if ((svr->client_limit >= 0) && (!svr->reject_excess_clients) &&
295 (svr->client_count >= (unsigned int)svr->client_limit))
296 return ECORE_CALLBACK_CANCEL;
297
298 cl = calloc(1, sizeof(Ecore_Con_Client));
299 if (!cl)
300 {
301 ERR("allocation failed");
302 return ECORE_CALLBACK_CANCEL;
303 }
304
305 cl->host_server = svr;
306 ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
307
308 cl->host_server->event_read = CreateEvent(NULL, TRUE, FALSE, NULL);
309 if (!cl->host_server->event_read)
310 {
311 ERR("Can not create event read");
312 goto free_cl;
313 }
314
315 handler_read = ecore_main_win32_handler_add(cl->host_server->event_read,
316 _ecore_con_local_win32_server_read_client_handler,
317 cl);
318 if (!handler_read)
319 {
320 ERR("Can not create handler read");
321 goto close_event_read;
322 }
323
324 cl->host_server->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL);
325 if (!cl->host_server->event_peek)
326 {
327 ERR("Can not create event peek");
328 goto del_handler_read;
329 }
330
331 handler_peek = ecore_main_win32_handler_add(cl->host_server->event_peek,
332 _ecore_con_local_win32_server_peek_client_handler,
333 cl);
334 if (!handler_peek)
335 {
336 ERR("Can not create handler peek");
337 goto close_event_peek;
338 }
339
340 cl->host_server->read_stopped = EINA_TRUE;
341 cl->host_server->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_server_read_client_thread, cl, CREATE_SUSPENDED, NULL);
342 if (!cl->host_server->thread_read)
343 {
344 ERR("Can not launch thread");
345 goto del_handler_peek;
346 }
347
348 svr->clients = eina_list_append(svr->clients, cl);
349 svr->client_count++;
350
351 if (!cl->delete_me)
352 ecore_con_event_client_add(cl);
353
354 ecore_main_win32_handler_del(wh);
355
356 ResumeThread(cl->host_server->thread_read);
357 return ECORE_CALLBACK_DONE;
358
359 del_handler_peek:
360 ecore_main_win32_handler_del(handler_peek);
361 close_event_peek:
362 CloseHandle(cl->host_server->event_peek);
363 del_handler_read:
364 ecore_main_win32_handler_del(handler_read);
365 close_event_read:
366 CloseHandle(cl->host_server->event_read);
367 free_cl:
368 free(cl);
369
370 return ECORE_CALLBACK_CANCEL;
371}
372
373static unsigned int __stdcall
374_ecore_con_local_win32_listening(void *data)
375{
376 Ecore_Con_Server *svr;
377 BOOL res;
378
379 svr = (Ecore_Con_Server *)data;
380
381 while (1)
382 {
383 res = ConnectNamedPipe(svr->pipe, NULL);
384 if (!res)
385 {
386 ERR("Opening the connection to the client failed");
387 CloseHandle(svr->pipe);
388 svr->pipe = NULL;
389 }
390 break;
391 }
392
393 DBG("Client connected");
394
395 printf(" ### %s\n", __FUNCTION__);
396 _endthreadex(0);
397 return 0;
398}
399
400Eina_Bool
401ecore_con_local_listen(Ecore_Con_Server *svr)
402{
403 char buf[256];
404 HANDLE thread_listening;
405 Ecore_Win32_Handler *handler;
406
407 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
408 {
409 ERR("Your system does not support abstract sockets!");
410 return EINA_FALSE;
411 }
412
413 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
414 snprintf(buf, sizeof(buf), "\\\\.\\pipe\\%s", svr->name);
415 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
416 {
417 const char *computername;
418
419 computername = getenv("CoMPUTERNAME");
420 snprintf(buf, sizeof(buf), "\\\\%s\\pipe\\%s", computername, svr->name);
421 }
422
423 svr->path = strdup(buf);
424 if (!svr->path)
425 {
426 ERR("Allocation failed");
427 return EINA_FALSE;
428 }
429
430 /*
431 * synchronuous
432 * block mode
433 * wait mode
434 */
435 svr->pipe = CreateNamedPipe(svr->path,
436 PIPE_ACCESS_DUPLEX,
437 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
438 PIPE_UNLIMITED_INSTANCES,
439 BUFSIZE,
440 BUFSIZE,
441 5000,
442 NULL);
443 if (svr->pipe == INVALID_HANDLE_VALUE)
444 {
445 ERR("Creation of the named pipe failed");
446 goto free_path;
447 }
448
449 /*
450 * We use ConnectNamedPipe() to wait for a client to connect.
451 * As the function is blocking, to let the main loop continuing
452 * its iterations, we call ConnectNamedPipe() in a thread
453 */
454 thread_listening = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_listening, svr, CREATE_SUSPENDED, NULL);
455 if (!thread_listening)
456 {
457 ERR("Creation of the listening thread failed");
458 goto close_pipe;
459 }
460
461 handler = ecore_main_win32_handler_add(thread_listening,
462 _ecore_con_local_win32_client_add,
463 svr);
464 if (!handler)
465 {
466 ERR("Creation of the client add handler failed");
467 goto del_handler;
468 }
469
470 svr->read_stopped = EINA_TRUE;
471 ResumeThread(thread_listening);
472
473 return EINA_TRUE;
474
475 del_handler:
476 ecore_main_win32_handler_del(handler);
477 close_pipe:
478 CloseHandle(svr->pipe);
479 free_path:
480 free(svr->path);
481 svr->path = NULL;
482
483 return EINA_FALSE;
484}
485
486void
487ecore_con_local_win32_server_del(Ecore_Con_Server *svr)
488{
489 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
490 return;
491
492 if (((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) &&
493 ((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM))
494 return;
495
496 svr->read_stop = 1;
497 while (!svr->read_stopped)
498 Sleep(100);
499
500 if (svr->event_peek)
501 CloseHandle(svr->event_peek);
502 svr->event_peek = NULL;
503 if (svr->event_read)
504 CloseHandle(svr->event_read);
505 svr->event_read = NULL;
506 free(svr->path);
507 svr->path = NULL;
508 if (svr->pipe)
509 CloseHandle(svr->pipe);
510 svr->pipe = NULL;
511}
512
513void
514ecore_con_local_win32_client_del(Ecore_Con_Client *cl)
515{
516 if ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
517 return;
518
519 if (((cl->host_server->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) &&
520 ((cl->host_server->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM))
521 return;
522
523 cl->host_server->read_stop = 1;
524 while (!cl->host_server->read_stopped)
525 Sleep(100);
526
527 if (cl->host_server->event_peek)
528 CloseHandle(cl->host_server->event_peek);
529 cl->host_server->event_peek = NULL;
530 if (cl->host_server->event_read)
531 CloseHandle(cl->host_server->event_read);
532 cl->host_server->event_read = NULL;
533 free(cl->host_server->path);
534 cl->host_server->path = NULL;
535 if (cl->host_server->pipe)
536 CloseHandle(cl->host_server->pipe);
537 cl->host_server->pipe = NULL;
538}
539
540Eina_Bool
541ecore_con_local_connect(Ecore_Con_Server *svr,
542 Eina_Bool (*cb_done)(void *data,
543 Ecore_Fd_Handler *fd_handler))
544{
545 char buf[256];
546 Ecore_Win32_Handler *handler_read;
547 Ecore_Win32_Handler *handler_peek;
548
549 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
550 {
551 ERR("Your system does not support abstract sockets!");
552 return EINA_FALSE;
553 }
554
555 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
556 snprintf(buf, sizeof(buf), "\\\\.\\pipe\\%s", svr->name);
557 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
558 {
559 const char *computername;
560
561 computername = getenv("COMPUTERNAME");
562 snprintf(buf, sizeof(buf), "\\\\%s\\pipe\\%s", computername, svr->name);
563 }
564
565 while (1)
566 {
567 svr->pipe = CreateFile(buf,
568 GENERIC_READ | GENERIC_WRITE,
569 0,
570 NULL,
571 OPEN_EXISTING,
572 0,
573 NULL);
574 if (svr->pipe != INVALID_HANDLE_VALUE)
575 break;
576
577 /* if pipe not busy, we exit */
578 if (GetLastError() != ERROR_PIPE_BUSY)
579 {
580 ERR("Connection to a server failed");
581 return EINA_FALSE;
582 }
583
584 /* pipe busy, so we wait for it */
585 if (!WaitNamedPipe(buf, NMPWAIT_WAIT_FOREVER))
586 {
587 ERR("Can not wait for a server");
588 goto close_pipe;
589 }
590 }
591
592 svr->path = strdup(buf);
593 if (!svr->path)
594 {
595 ERR("Allocation failed");
596 goto close_pipe;
597 }
598
599 svr->event_read = CreateEvent(NULL, TRUE, FALSE, NULL);
600 if (!svr->event_read)
601 {
602 ERR("Can not create event read");
603 goto free_path;
604 }
605
606 handler_read = ecore_main_win32_handler_add(svr->event_read,
607 _ecore_con_local_win32_client_read_server_handler,
608 svr);
609 if (!handler_read)
610 {
611 ERR("Can not create handler read");
612 goto close_event_read;
613 }
614
615 svr->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL);
616 if (!svr->event_peek)
617 {
618 ERR("Can not create event peek");
619 goto del_handler_read;
620 }
621
622 handler_peek = ecore_main_win32_handler_add(svr->event_peek,
623 _ecore_con_local_win32_client_peek_server_handler,
624 svr);
625 if (!handler_peek)
626 {
627 ERR("Can not create handler peek");
628 goto close_event_peek;
629 }
630
631 svr->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_client_read_server_thread, svr, CREATE_SUSPENDED, NULL);
632 if (!svr->thread_read)
633 {
634 ERR("Can not launch thread");
635 goto del_handler_peek;
636 }
637
638 if (!svr->delete_me) ecore_con_event_server_add(svr);
639
640 ResumeThread(svr->thread_read);
641
642 return EINA_TRUE;
643
644 del_handler_peek:
645 ecore_main_win32_handler_del(handler_peek);
646 close_event_peek:
647 CloseHandle(svr->event_peek);
648 del_handler_read:
649 ecore_main_win32_handler_del(handler_read);
650 close_event_read:
651 CloseHandle(svr->event_read);
652 free_path:
653 free(svr->path);
654 svr->path = NULL;
655 close_pipe:
656 CloseHandle(svr->pipe);
657
658 return EINA_FALSE;
659}
660
661Eina_Bool
662ecore_con_local_win32_server_flush(Ecore_Con_Server *svr)
663{
664 int num;
665 BOOL res;
666 DWORD written;
667
668 /* This check should never be true */
669 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
670 return EINA_TRUE;
671
672 if (((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) &&
673 ((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM))
674 return EINA_FALSE;
675
676 num = eina_binbuf_length_get(svr->buf) - svr->write_buf_offset;
677 if (num <= 0) return EINA_TRUE;
678
679 res = WriteFile(svr->pipe, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num, &written, NULL);
680 if (!res)
681 {
682 char *msg;
683
684 msg = evil_last_error_get();
685 if (msg)
686 {
687 ecore_con_event_server_error(svr, msg);
688 free(msg);
689 }
690 _ecore_con_server_kill(svr);
691 }
692
693 svr->write_buf_offset += written;
694 if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf))
695 {
696 svr->write_buf_offset = 0;
697 eina_binbuf_free(svr->buf);
698 svr->buf = NULL;
699 svr->want_write = 0;
700 }
701 else if (written < (DWORD)num)
702 svr->want_write = 1;
703
704 return EINA_TRUE;
705}
706
707Eina_Bool
708ecore_con_local_win32_client_flush(Ecore_Con_Client *cl)
709{
710 Ecore_Con_Type type;
711 int num;
712 BOOL res;
713 DWORD written;
714
715 type = cl->host_server->type & ECORE_CON_TYPE;
716
717 /* This check should never be true */
718 if (type == ECORE_CON_LOCAL_ABSTRACT)
719 return EINA_TRUE;
720
721 if ((type != ECORE_CON_LOCAL_USER) &&
722 (type != ECORE_CON_LOCAL_SYSTEM))
723 return EINA_FALSE;
724
725 num = eina_binbuf_length_get(cl->buf) - cl->buf_offset;
726 if (num <= 0) return EINA_TRUE;
727
728 res = WriteFile(cl->host_server->pipe, eina_binbuf_string_get(cl->buf) + cl->buf_offset, num, &written, NULL);
729 if (!res)
730 {
731 char *msg;
732
733 msg = evil_last_error_get();
734 if (msg)
735 {
736 ecore_con_event_client_error(cl, msg);
737 free(msg);
738 }
739 _ecore_con_client_kill(cl);
740 }
741
742 cl->buf_offset += written;
743 if (cl->buf_offset >= eina_binbuf_length_get(cl->buf))
744 {
745 cl->buf_offset = 0;
746 eina_binbuf_free(cl->buf);
747 cl->buf = NULL;
748 cl->host_server->want_write = 0;
749 }
750 else if (written < (DWORD)num)
751 cl->host_server->want_write = 1;
752
753 return EINA_TRUE;
754}
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
deleted file mode 100644
index 91f5d39..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
+++ /dev/null
@@ -1,397 +0,0 @@
1#ifndef _ECORE_CON_PRIVATE_H
2#define _ECORE_CON_PRIVATE_H
3
4#include "ecore_private.h"
5#include "Ecore_Con.h"
6
7#define ECORE_MAGIC_CON_SERVER 0x77665544
8#define ECORE_MAGIC_CON_CLIENT 0x77556677
9#define ECORE_MAGIC_CON_URL 0x77074255
10
11#define ECORE_CON_TYPE 0x0f
12#define ECORE_CON_SSL 0xf0
13
14#if USE_GNUTLS
15# include <gnutls/gnutls.h>
16#elif USE_OPENSSL
17# include <openssl/ssl.h>
18#endif
19#ifdef HAVE_CURL
20#include <curl/curl.h>
21#endif
22
23#define READBUFSIZ 65536
24
25extern int _ecore_con_log_dom;
26
27#ifdef ECORE_CON_DEFAULT_LOG_COLOR
28#undef ECORE_LOG_DEFAULT_LOG_COLOR
29#endif
30#define ECORE_CON_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
31
32#ifdef ERR
33# undef ERR
34#endif
35#define ERR(...) EINA_LOG_DOM_ERR(_ecore_con_log_dom, __VA_ARGS__)
36
37#ifdef DBG
38# undef DBG
39#endif
40#define DBG(...) EINA_LOG_DOM_DBG(_ecore_con_log_dom, __VA_ARGS__)
41
42#ifdef INF
43# undef INF
44#endif
45#define INF(...) EINA_LOG_DOM_INFO(_ecore_con_log_dom, __VA_ARGS__)
46
47#ifdef WRN
48# undef WRN
49#endif
50#define WRN(...) EINA_LOG_DOM_WARN(_ecore_con_log_dom, __VA_ARGS__)
51
52#ifdef CRIT
53# undef CRIT
54#endif
55#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_con_log_dom, __VA_ARGS__)
56
57typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup;
58typedef struct _Ecore_Con_Info Ecore_Con_Info;
59typedef struct Ecore_Con_Socks Ecore_Con_Socks_v4;
60typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5;
61typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos);
62
63typedef enum _Ecore_Con_State
64{
65 ECORE_CON_CONNECTED,
66 ECORE_CON_DISCONNECTED,
67 ECORE_CON_INPROGRESS
68} Ecore_Con_State;
69
70typedef enum _Ecore_Con_Ssl_Error
71{
72 ECORE_CON_SSL_ERROR_NONE = 0,
73 ECORE_CON_SSL_ERROR_NOT_SUPPORTED,
74 ECORE_CON_SSL_ERROR_INIT_FAILED,
75 ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED,
76 ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED
77} Ecore_Con_Ssl_Error;
78
79typedef enum _Ecore_Con_Ssl_Handshake
80{
81 ECORE_CON_SSL_STATE_DONE = 0,
82 ECORE_CON_SSL_STATE_HANDSHAKING,
83 ECORE_CON_SSL_STATE_INIT
84} Ecore_Con_Ssl_State;
85
86typedef enum Ecore_Con_Proxy_State
87{ /* named PROXY instead of SOCKS in case some handsome and enterprising
88 * developer decides to add HTTP CONNECT support
89 */
90 ECORE_CON_PROXY_STATE_DONE = 0,
91 ECORE_CON_PROXY_STATE_RESOLVED,
92 ECORE_CON_PROXY_STATE_INIT,
93 ECORE_CON_PROXY_STATE_READ,
94 ECORE_CON_PROXY_STATE_AUTH,
95 ECORE_CON_PROXY_STATE_REQUEST,
96 ECORE_CON_PROXY_STATE_CONFIRM,
97} Ecore_Con_Proxy_State;
98
99struct _Ecore_Con_Client
100{
101 ECORE_MAGIC;
102 int fd;
103 Ecore_Con_Server *host_server;
104 void *data;
105 Ecore_Fd_Handler *fd_handler;
106 unsigned int buf_offset;
107 Eina_Binbuf *buf;
108 const char *ip;
109 Eina_List *event_count;
110 struct sockaddr *client_addr;
111 int client_addr_len;
112 double start_time;
113 Ecore_Timer *until_deletion;
114 double disconnect_time;
115#if USE_GNUTLS
116 gnutls_datum_t session_ticket;
117 gnutls_session_t session;
118#elif USE_OPENSSL
119 SSL *ssl;
120 int ssl_err;
121#endif
122 Ecore_Con_Ssl_State ssl_state;
123 Eina_Bool handshaking : 1;
124 Eina_Bool upgrade : 1; /* STARTTLS queued */
125 Eina_Bool delete_me : 1; /* del event has been queued */
126};
127
128struct _Ecore_Con_Server
129{
130 ECORE_MAGIC;
131 int fd;
132 Ecore_Con_Type type;
133 char *name;
134 int port;
135 char *path;
136 void *data;
137 Ecore_Fd_Handler *fd_handler;
138 Eina_List *clients;
139 unsigned int client_count;
140 Eina_Binbuf *buf;
141 unsigned int write_buf_offset;
142 Eina_List *infos;
143 Eina_List *event_count;
144 int client_limit;
145 pid_t ppid;
146 /* socks */
147 Ecore_Con_Socks *ecs;
148 Ecore_Con_Proxy_State ecs_state;
149 int ecs_addrlen;
150 unsigned char ecs_addr[16];
151 unsigned int ecs_buf_offset;
152 Eina_Binbuf *ecs_buf;
153 Eina_Binbuf *ecs_recvbuf;
154 const char *proxyip;
155 int proxyport;
156 /* endsocks */
157 const char *verify_name;
158#if USE_GNUTLS
159 gnutls_session_t session;
160 gnutls_anon_client_credentials_t anoncred_c;
161 gnutls_anon_server_credentials_t anoncred_s;
162 gnutls_psk_client_credentials_t pskcred_c;
163 gnutls_psk_server_credentials_t pskcred_s;
164 gnutls_certificate_credentials_t cert;
165 char *cert_file;
166 gnutls_dh_params_t dh_params;
167#elif USE_OPENSSL
168 SSL_CTX *ssl_ctx;
169 SSL *ssl;
170 int ssl_err;
171#endif
172 double start_time;
173 Ecore_Timer *until_deletion;
174 double disconnect_time;
175 double client_disconnect_time;
176 const char *ip;
177 Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */
178 Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */
179 Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */
180 Eina_Bool upgrade : 1; /* STARTTLS queued */
181 Eina_Bool ssl_prepared : 1;
182 Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */
183 Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */
184 Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */
185 Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */
186 Eina_Bool reject_excess_clients : 1;
187 Eina_Bool delete_me : 1; /* del event has been queued */
188#ifdef _WIN32
189 Eina_Bool want_write : 1;
190 Eina_Bool read_stop : 1;
191 Eina_Bool read_stopped : 1;
192 HANDLE pipe;
193 HANDLE thread_read;
194 HANDLE event_read;
195 HANDLE event_peek;
196 DWORD nbr_bytes;
197#endif
198};
199
200#ifdef HAVE_CURL
201struct _Ecore_Con_Url
202{
203 ECORE_MAGIC;
204 CURL *curl_easy;
205 struct curl_slist *headers;
206 Eina_List *additional_headers;
207 Eina_List *response_headers;
208 const char *url;
209 long proxy_type;
210 int status;
211
212 Ecore_Timer *timer;
213
214 Ecore_Con_Url_Time time_condition;
215 double timestamp;
216 void *data;
217
218 void *post_data;
219
220 int received;
221 int write_fd;
222
223 unsigned int event_count;
224 Eina_Bool dead : 1;
225 Eina_Bool multi : 1;
226};
227#endif
228
229struct _Ecore_Con_Info
230{
231 unsigned int size;
232 struct addrinfo info;
233 char ip[NI_MAXHOST];
234 char service[NI_MAXSERV];
235};
236
237struct _Ecore_Con_Lookup
238{
239 Ecore_Con_Dns_Cb done_cb;
240 const void *data;
241};
242
243#define ECORE_CON_SOCKS_CAST_ELSE(X) \
244 Ecore_Con_Socks_v4 *v4 = NULL; \
245 Ecore_Con_Socks_v5 *v5 = NULL; \
246 if ((X) && ((X)->version == 4)) \
247 v4 = (Ecore_Con_Socks_v4*)(X); \
248 else if ((X) && ((X)->version == 5)) \
249 v5 = (Ecore_Con_Socks_v5*)(X); \
250 else
251
252struct Ecore_Con_Socks /* v4 */
253{
254 unsigned char version;
255
256 const char *ip;
257 int port;
258 const char *username;
259 unsigned int ulen;
260 Eina_Bool lookup : 1;
261 Eina_Bool bind : 1;
262};
263
264struct Ecore_Con_Socks_v5
265{
266 unsigned char version;
267
268 const char *ip;
269 int port;
270 const char *username;
271 unsigned int ulen;
272 Eina_Bool lookup : 1;
273 Eina_Bool bind : 1;
274 /* v5 only */
275 unsigned char method;
276 const char *password;
277 unsigned int plen;
278};
279
280extern Ecore_Con_Socks *_ecore_con_proxy_once;
281extern Ecore_Con_Socks *_ecore_con_proxy_global;
282void ecore_con_socks_init(void);
283void ecore_con_socks_shutdown(void);
284Eina_Bool ecore_con_socks_svr_init(Ecore_Con_Server *svr);
285void ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num);
286void ecore_con_socks_dns_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr);
287/* from ecore_con.c */
288void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info);
289void ecore_con_event_proxy_bind(Ecore_Con_Server *svr);
290void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate);
291void ecore_con_event_server_del(Ecore_Con_Server *svr);
292#define ecore_con_event_server_error(svr, error) _ecore_con_event_server_error((svr), (char*)(error), EINA_TRUE)
293void _ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate);
294void ecore_con_event_client_add(Ecore_Con_Client *cl);
295void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate);
296void ecore_con_event_client_del(Ecore_Con_Client *cl);
297void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error);
298void _ecore_con_server_kill(Ecore_Con_Server *svr);
299void _ecore_con_client_kill(Ecore_Con_Client *cl);
300/* from ecore_local_win32.c */
301#ifdef _WIN32
302Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr);
303Eina_Bool ecore_con_local_connect(Ecore_Con_Server *svr,
304 Eina_Bool (*cb_done)(void *data,
305 Ecore_Fd_Handler *fd_handler));
306Eina_Bool ecore_con_local_win32_server_flush(Ecore_Con_Server *svr);
307Eina_Bool ecore_con_local_win32_client_flush(Ecore_Con_Client *cl);
308void ecore_con_local_win32_server_del(Ecore_Con_Server *svr);
309void ecore_con_local_win32_client_del(Ecore_Con_Client *cl);
310#else
311/* from ecore_local.c */
312int ecore_con_local_init(void);
313int ecore_con_local_shutdown(void);
314int ecore_con_local_connect(Ecore_Con_Server *svr,
315 Eina_Bool (*cb_done)(
316 void *data,
317 Ecore_Fd_Handler *fd_handler),
318 void *data);
319int ecore_con_local_listen(Ecore_Con_Server *svr,
320 Eina_Bool (*cb_listen)(
321 void *data,
322 Ecore_Fd_Handler *fd_handler),
323 void *data);
324#endif
325
326/* from ecore_con_info.c */
327int ecore_con_info_init(void);
328int ecore_con_info_shutdown(void);
329int ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
330 Ecore_Con_Info_Cb done_cb,
331 void *data);
332int ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
333 Ecore_Con_Info_Cb done_cb,
334 void *data);
335int ecore_con_info_udp_connect(Ecore_Con_Server *svr,
336 Ecore_Con_Info_Cb done_cb,
337 void *data);
338int ecore_con_info_udp_listen(Ecore_Con_Server *svr,
339 Ecore_Con_Info_Cb done_cb,
340 void *data);
341int ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
342 Ecore_Con_Info_Cb done_cb,
343 void *data);
344void ecore_con_info_data_clear(void *info);
345
346void ecore_con_event_server_add(Ecore_Con_Server *svr);
347
348
349/* from ecore_con_ssl.c */
350Ecore_Con_Ssl_Error ecore_con_ssl_init(void);
351Ecore_Con_Ssl_Error ecore_con_ssl_shutdown(void);
352Ecore_Con_Ssl_Error ecore_con_ssl_server_prepare(Ecore_Con_Server *svr, int ssl_type);
353Ecore_Con_Ssl_Error ecore_con_ssl_server_init(Ecore_Con_Server *svr);
354Ecore_Con_Ssl_Error ecore_con_ssl_server_shutdown(Ecore_Con_Server *svr);
355int ecore_con_ssl_server_read(Ecore_Con_Server *svr,
356 unsigned char *buf,
357 int size);
358int ecore_con_ssl_server_write(Ecore_Con_Server *svr,
359 const unsigned char *buf,
360 int size);
361Ecore_Con_Ssl_Error ecore_con_ssl_client_init(Ecore_Con_Client *svr);
362Ecore_Con_Ssl_Error ecore_con_ssl_client_shutdown(Ecore_Con_Client *svr);
363int ecore_con_ssl_client_read(Ecore_Con_Client *svr,
364 unsigned char *buf,
365 int size);
366int ecore_con_ssl_client_write(Ecore_Con_Client *svr,
367 const unsigned char *buf,
368 int size);
369
370int ecore_con_info_get(Ecore_Con_Server *svr,
371 Ecore_Con_Info_Cb done_cb,
372 void *data,
373 struct addrinfo *hints);
374
375
376#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \
377 TYPE *Type##_alloc(void); \
378 void Type##_free(TYPE *e);
379
380GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Add, ecore_con_event_client_add);
381GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Del, ecore_con_event_client_del);
382GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Write, ecore_con_event_client_write);
383GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Data, ecore_con_event_client_data);
384GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Error, ecore_con_event_server_error);
385GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Error, ecore_con_event_client_error);
386GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Add, ecore_con_event_server_add);
387GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del);
388GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write);
389GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data);
390GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind);
391
392void ecore_con_mempool_init(void);
393void ecore_con_mempool_shutdown(void);
394
395#undef GENERIC_ALLOC_FREE_HEADER
396
397#endif
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c b/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c
deleted file mode 100644
index 686f73b..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c
+++ /dev/null
@@ -1,940 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <errno.h>
10#include <unistd.h>
11#include <fcntl.h>
12
13#ifdef HAVE_SYS_SOCKET_H
14# include <sys/socket.h>
15#endif
16
17#ifdef HAVE_NETINET_TCP_H
18# include <netinet/tcp.h>
19#endif
20
21#ifdef HAVE_NET_IF_H
22# include <net/if.h>
23#endif
24
25/* if net/if.h is not found or if an older versions of net/if.h is provided
26 which does not define IF_NAMESIZE. We must define it ourselves */
27#ifndef IF_NAMESIZE
28# ifdef IFNAMSIZ
29# define IF_NAMESIZE IFNAMSIZ
30# else
31# define IF_NAMESIZE 16
32# endif
33#endif
34
35#ifdef HAVE_NETINET_IN_H
36# include <netinet/in.h>
37#endif
38
39#ifdef HAVE_ARPA_INET_H
40# include <arpa/inet.h>
41#endif
42
43#ifdef HAVE_SYS_UN_H
44# include <sys/un.h>
45#endif
46
47#ifdef HAVE_WS2TCPIP_H
48# include <ws2tcpip.h>
49#endif
50
51#ifdef HAVE_EVIL
52# include <Evil.h>
53#endif
54
55#include "Ecore.h"
56#include "ecore_private.h"
57#include "Ecore_Con.h"
58#include "ecore_con_private.h"
59
60/* http://tools.ietf.org/html/rfc1928
61 o X'00' NO AUTHENTICATION REQUIRED
62 o X'01' GSSAPI
63 o X'02' USERNAME/PASSWORD
64 o X'03' to X'7F' IANA ASSIGNED
65 o X'80' to X'FE' RESERVED FOR PRIVATE METHODS
66 o X'FF' NO ACCEPTABLE METHODS
67*/
68#define ECORE_CON_SOCKS_V5_METHOD_NONE 0
69#define ECORE_CON_SOCKS_V5_METHOD_GSSAPI 1
70#define ECORE_CON_SOCKS_V5_METHOD_USERPASS 2
71
72static int ECORE_CON_SOCKS_V5_METHODS[] =
73{
74 ECORE_CON_SOCKS_V5_METHOD_NONE,
75// ECORE_CON_SOCKS_V5_METHOD_GSSAPI, TODO
76 ECORE_CON_SOCKS_V5_METHOD_USERPASS
77};
78
79#define ECORE_CON_SOCKS_V5_TOTAL_METHODS sizeof(ECORE_CON_SOCKS_V5_METHODS)
80
81#define _ecore_con_server_kill(svr) do { \
82 DBG("KILL %p", (svr)); \
83 _ecore_con_server_kill((svr)); \
84} while (0)
85
86Eina_List *ecore_con_socks_proxies = NULL;
87
88static Ecore_Con_Socks *
89_ecore_con_socks_find(unsigned char version, const char *ip, int port, const char *username, size_t ulen, const char *password, size_t plen)
90{
91 Eina_List *l;
92 Ecore_Con_Socks_v5 *ecs;
93
94 if (!ecore_con_socks_proxies) return NULL;
95
96 EINA_LIST_FOREACH(ecore_con_socks_proxies, l, ecs)
97 {
98 if (ecs->version != version) continue;
99 if (strcmp(ecs->ip, ip)) continue;
100 if ((port != -1) && (port != ecs->port)) continue;
101 if (ulen != ecs->ulen) continue;
102 if (username && strcmp(ecs->username, username)) continue;
103 if (version == 5)
104 {
105 if (plen != ecs->plen) continue;
106 if (password && strcmp(ecs->password, password)) continue;
107 }
108 return (Ecore_Con_Socks*)ecs;
109 }
110 return NULL;
111}
112
113static void
114_ecore_con_socks_free(Ecore_Con_Socks *ecs)
115{
116 ECORE_CON_SOCKS_CAST_ELSE(ecs) return;
117
118 if (_ecore_con_proxy_once == ecs) _ecore_con_proxy_once = NULL;
119 if (_ecore_con_proxy_global == ecs) _ecore_con_proxy_global = NULL;
120 eina_stringshare_del(ecs->ip);
121 eina_stringshare_del(ecs->username);
122 free(ecs);
123}
124
125static Eina_Bool
126_ecore_con_socks_svr_init_v4(Ecore_Con_Server *svr, Ecore_Con_Socks_v4 *v4)
127{
128 size_t addrlen, buflen, ulen = 1;
129 unsigned char *sbuf;
130
131 addrlen = v4->lookup ? strlen(svr->name) + 1 : 0;
132 if (v4->username) ulen += v4->ulen;
133 buflen = sizeof(char) * (8 + ulen + addrlen);
134 sbuf = malloc(buflen);
135 if (!sbuf)
136 {
137 ecore_con_event_server_error(svr, "Memory allocation failure!");
138 _ecore_con_server_kill(svr);
139 return EINA_FALSE;
140 }
141 /* http://en.wikipedia.org/wiki/SOCKS */
142 sbuf[0] = 4;
143 sbuf[1] = v4->bind ? 2 : 1;
144 sbuf[2] = svr->port >> 8;
145 sbuf[3] = svr->port & 0xff;
146 if (addrlen)
147 {
148 sbuf[4] = sbuf[5] = sbuf[6] = 0;
149 sbuf[7] = 1;
150 }
151 else
152 /* SOCKSv4 only handles IPV4, so addrlen is always 4 */
153 memcpy(sbuf + 4, svr->ecs_addr, 4);
154 if (v4->username)
155 memcpy(sbuf + 8, v4->username, ulen);
156 else
157 sbuf[8] = 0;
158 if (addrlen) memcpy(sbuf + 8 + ulen, svr->name, addrlen);
159
160 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
161 return EINA_TRUE;
162}
163
164static Eina_Bool
165_ecore_con_socks_svr_init_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5)
166{
167 size_t buflen;
168 unsigned int x;
169 unsigned char *sbuf;
170
171 if (v5->username)
172 buflen = sizeof(char) * (2 + ECORE_CON_SOCKS_V5_TOTAL_METHODS);
173 else
174 buflen = 3;
175 sbuf = malloc(buflen);
176 if (!sbuf)
177 {
178 ecore_con_event_server_error(svr, "Memory allocation failure!");
179 _ecore_con_server_kill(svr);
180 return EINA_FALSE;
181 }
182 /* http://en.wikipedia.org/wiki/SOCKS
183 * http://tools.ietf.org/html/rfc1928
184 */
185 sbuf[0] = 5;
186 if (v5->username)
187 {
188 sbuf[1] = ECORE_CON_SOCKS_V5_TOTAL_METHODS;
189 for (x = 2; x < 2 + ECORE_CON_SOCKS_V5_TOTAL_METHODS; x++)
190 sbuf[x] = ECORE_CON_SOCKS_V5_METHODS[x - 2];
191 }
192 else
193 {
194 sbuf[1] = 1;
195 sbuf[2] = ECORE_CON_SOCKS_V5_METHOD_NONE;
196 }
197
198 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
199 return EINA_TRUE;
200}
201
202#define ECORE_CON_SOCKS_READ(EXACT) \
203 if (num < EXACT) \
204 { \
205 if (!svr->ecs_recvbuf) svr->ecs_recvbuf = eina_binbuf_new(); \
206 if (!svr->ecs_recvbuf) goto error; \
207 eina_binbuf_append_length(svr->ecs_recvbuf, buf, num); \
208 /* the slowest connection on earth */ \
209 if (eina_binbuf_length_get(svr->ecs_recvbuf) != EXACT) return; \
210 data = eina_binbuf_string_get(svr->ecs_recvbuf); \
211 } \
212 else if (num > EXACT) goto error; \
213 else \
214 data = buf
215
216static void
217_ecore_con_socks_read_v4(Ecore_Con_Server *svr, Ecore_Con_Socks_v4 *v4 __UNUSED__, const unsigned char *buf, unsigned int num)
218{
219 const unsigned char *data;
220 DBG("SOCKS: %d bytes", num);
221 ECORE_CON_SOCKS_READ(8);
222
223/* http://ufasoft.com/doc/socks4_protocol.htm */
224 if (data[0]) goto error;
225 switch (data[1])
226 {
227 case 90:
228 /* success! */
229 break;
230 case 91:
231 ecore_con_event_server_error(svr, "proxy request rejected or failed");
232 goto error;
233 case 92:
234 ecore_con_event_server_error(svr, "proxying SOCKS server could not perform authentication");
235 goto error;
236 case 93:
237 ecore_con_event_server_error(svr, "proxy request authentication rejected");
238 goto error;
239 default:
240 ecore_con_event_server_error(svr, "garbage data from proxy");
241 goto error;
242 }
243 if (svr->ecs->bind)
244 {
245 unsigned int nport;
246 char naddr[IF_NAMESIZE];
247
248 memcpy(&nport, &data[2], 2);
249 svr->proxyport = ntohl(nport);
250
251 if (!inet_ntop(AF_INET, &data[4], naddr, sizeof(naddr))) goto error;
252 svr->proxyip = eina_stringshare_add(naddr);
253 ecore_con_event_proxy_bind(svr);
254 }
255 svr->ecs_state = ECORE_CON_PROXY_STATE_DONE;
256 INF("PROXY CONNECTED");
257 if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
258 svr->ecs_recvbuf = NULL;
259 svr->ecs_buf_offset = svr->ecs_addrlen = 0;
260 memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr));
261 if (!svr->ssl_state)
262 ecore_con_event_server_add(svr);
263 if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf)))
264 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
265 return;
266error:
267 _ecore_con_server_kill(svr);
268}
269
270static Eina_Bool
271_ecore_con_socks_auth_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5)
272{
273 size_t size;
274 unsigned char *data;
275 switch (v5->method)
276 {
277 case ECORE_CON_SOCKS_V5_METHOD_NONE:
278 svr->ecs_state = ECORE_CON_PROXY_STATE_REQUEST;
279 return EINA_TRUE;
280 case ECORE_CON_SOCKS_V5_METHOD_GSSAPI:
281 return EINA_TRUE;
282 case ECORE_CON_SOCKS_V5_METHOD_USERPASS:
283 if (!v5->username) return EINA_FALSE;
284 if (!v5->password) v5->plen = 1;
285 /* http://tools.ietf.org/html/rfc1929 */
286 size = sizeof(char) * (3 + v5->ulen + v5->plen);
287 data = malloc(size);
288 if (!data) break;
289 data[0] = 1;
290 data[1] = v5->ulen;
291 memcpy(&data[2], v5->username, v5->ulen);
292 data[1 + v5->ulen] = v5->plen;
293 if (v5->password)
294 memcpy(&data[2 + v5->ulen], v5->password, v5->plen);
295 else
296 data[2 + v5->ulen] = 0;
297 svr->ecs_buf = eina_binbuf_manage_new_length(data, size);
298 return EINA_TRUE;
299 default:
300 break;
301 }
302 return EINA_FALSE;
303}
304
305static void
306_ecore_con_socks_read_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5, const unsigned char *buf, unsigned int num)
307{
308 const unsigned char *data;
309
310 DBG("SOCKS: %d bytes", num);
311 switch (svr->ecs_state)
312 {
313
314 case ECORE_CON_PROXY_STATE_READ:
315 ECORE_CON_SOCKS_READ(2);
316 /* http://en.wikipedia.org/wiki/SOCKS */
317 if (data[0] != 5) goto error;
318 if (data[1] == 0xFF)
319 {
320 ecore_con_event_server_error(svr, "proxy authentication methods rejected");
321 goto error;
322 }
323 v5->method = data[1];
324 if (!_ecore_con_socks_auth_v5(svr, v5)) goto error;
325 if (svr->ecs_state == ECORE_CON_PROXY_STATE_REQUEST)
326 {
327 /* run again to skip auth reading */
328 _ecore_con_socks_read_v5(svr, v5, NULL, 0);
329 return;
330 }
331 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
332 svr->ecs_state = ECORE_CON_PROXY_STATE_AUTH;
333 break;
334 case ECORE_CON_PROXY_STATE_AUTH:
335 ECORE_CON_SOCKS_READ(2);
336 switch (v5->method)
337 {
338 case ECORE_CON_SOCKS_V5_METHOD_NONE:
339 CRIT("HOW DID THIS HAPPEN?????????");
340 goto error;
341 case ECORE_CON_SOCKS_V5_METHOD_GSSAPI:
342 /* TODO: this */
343 break;
344 case ECORE_CON_SOCKS_V5_METHOD_USERPASS:
345 if (data[0] != 1)
346 {
347 ecore_con_event_server_error(svr, "protocol error");
348 goto error; /* wrong version */
349 }
350 if (data[1])
351 {
352 ecore_con_event_server_error(svr, "proxy request authentication rejected");
353 goto error;
354 }
355 default:
356 break;
357 }
358 case ECORE_CON_PROXY_STATE_REQUEST:
359 {
360 size_t addrlen, buflen;
361 unsigned char *sbuf;
362 addrlen = v5->lookup ? strlen(svr->name) + 1 : (unsigned int)svr->ecs_addrlen;
363 buflen = sizeof(char) * (6 + addrlen);
364 sbuf = malloc(buflen);
365 if (!sbuf)
366 {
367 ecore_con_event_server_error(svr, "Memory allocation failure!");
368 goto error;
369 }
370 sbuf[0] = 5;
371 sbuf[1] = v5->bind ? 2 : 1; /* TODO: 0x03 for UDP port association */
372 sbuf[2] = 0;
373 if (v5->lookup) /* domain name */
374 {
375 sbuf[3] = 3;
376 sbuf[4] = addrlen - 1;
377 memcpy(sbuf + 5, svr->name, addrlen - 1);
378 }
379 else
380 {
381 sbuf[3] = (svr->ecs_addrlen == 4) ? 1 : 4;
382 memcpy(sbuf + 4, svr->ecs_addr, addrlen);
383 }
384 sbuf[addrlen + 4] = svr->port >> 8;
385 sbuf[addrlen + 5] = svr->port & 0xff;
386
387 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
388 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
389 break;
390 }
391 case ECORE_CON_PROXY_STATE_CONFIRM:
392 {
393 /* this is ugly because we have to read an exact number of bytes,
394 * but we don't know what that number is until we've already read
395 * at least 5 bytes to determine the length of the unknown stream.
396 * yep.
397 */
398 size_t to_read, len = svr->ecs_recvbuf ? eina_binbuf_length_get(svr->ecs_recvbuf) : 0;
399 if (num + len < 5)
400 {
401 /* guarantees we get called again */
402 ECORE_CON_SOCKS_READ(5);
403 }
404 if (len >= 5)
405 {
406 data = eina_binbuf_string_get(svr->ecs_recvbuf);
407 data += 3;
408 }
409 else
410 data = buf + 3 - len;
411 switch (data[0])
412 {
413 case 1:
414 to_read = 4;
415 break;
416 case 3:
417 to_read = data[1] + 1;
418 break;
419 case 4:
420 to_read = 16;
421 /* lazy debugging stub comment */
422 break;
423 default:
424 ecore_con_event_server_error(svr, "protocol error");
425 goto error;
426 }
427 /* at this point, we finally know exactly how much we need to read */
428 ECORE_CON_SOCKS_READ(6 + to_read);
429
430 if (data[0] != 5)
431 {
432 ecore_con_event_server_error(svr, "protocol error");
433 goto error; /* wrong version */
434 }
435 switch (data[1])
436 {
437 case 0:
438 break;
439 case 1:
440 ecore_con_event_server_error(svr, "general proxy failure");
441 goto error;
442 case 2:
443 ecore_con_event_server_error(svr, "connection not allowed by ruleset");
444 goto error;
445 case 3:
446 ecore_con_event_server_error(svr, "network unreachable");
447 goto error;
448 case 4:
449 ecore_con_event_server_error(svr, "host unreachable");
450 goto error;
451 case 5:
452 ecore_con_event_server_error(svr, "connection refused by destination host");
453 goto error;
454 case 6:
455 ecore_con_event_server_error(svr, "TTL expired");
456 goto error;
457 case 7:
458 ecore_con_event_server_error(svr, "command not supported / protocol error");
459 goto error;
460 case 8:
461 ecore_con_event_server_error(svr, "address type not supported");
462 default:
463 goto error;
464 }
465 if (data[2])
466 {
467 ecore_con_event_server_error(svr, "protocol error");
468 goto error;
469 }
470 memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr));
471 if (!svr->ssl_state)
472 ecore_con_event_server_add(svr);
473 if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf)))
474 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
475 svr->ecs_buf_offset = svr->ecs_addrlen = 0;
476 svr->ecs_state = ECORE_CON_PROXY_STATE_DONE;
477 INF("PROXY CONNECTED");
478 break;
479 }
480 default:
481 break;
482 }
483 if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
484 svr->ecs_recvbuf = NULL;
485
486 return;
487error:
488 _ecore_con_server_kill(svr);
489}
490
491/////////////////////////////////////////////////////////////////////////////////////
492void
493ecore_con_socks_shutdown(void)
494{
495 Ecore_Con_Socks *ecs;
496 EINA_LIST_FREE(ecore_con_socks_proxies, ecs)
497 _ecore_con_socks_free(ecs);
498 _ecore_con_proxy_once = NULL;
499 _ecore_con_proxy_global = NULL;
500}
501
502void
503ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num)
504{
505 ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return;
506
507 if (svr->ecs_state < ECORE_CON_PROXY_STATE_READ) return;
508
509 if (v4) _ecore_con_socks_read_v4(svr, v4, buf, (unsigned int)num);
510 else _ecore_con_socks_read_v5(svr, v5, buf, (unsigned int)num);
511}
512
513Eina_Bool
514ecore_con_socks_svr_init(Ecore_Con_Server *svr)
515{
516 ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return EINA_FALSE;
517
518 if (!svr->ip) return EINA_FALSE;
519 if (svr->ecs_buf) return EINA_FALSE;
520 if (svr->ecs_state != ECORE_CON_PROXY_STATE_INIT) return EINA_FALSE;
521 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
522 if (v4) return _ecore_con_socks_svr_init_v4(svr, v4);
523 return _ecore_con_socks_svr_init_v5(svr, v5);
524}
525
526void
527ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen __UNUSED__, Ecore_Con_Server *svr)
528{
529 svr->ip = eina_stringshare_add(ip);
530 svr->ecs_state++;
531 if (addr->sa_family == AF_INET)
532 {
533 memcpy(svr->ecs_addr, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4);
534 svr->ecs_addrlen = 4;
535 }
536#ifdef HAVE_IPV6
537 else
538 {
539 memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, 16);
540 svr->ecs_addrlen = 16;
541 }
542#endif
543 ecore_con_socks_svr_init(svr);
544}
545
546void
547ecore_con_socks_init(void)
548{
549 const char *socks;
550 char *h, *p, *l, *u = NULL;
551 char buf[512];
552 int port, lookup = 0;
553 Eina_Bool v5 = EINA_FALSE;
554 Ecore_Con_Socks *ecs;
555 unsigned char addr[sizeof(struct in_addr)];
556#ifdef HAVE_IPV6
557 unsigned char addr6[sizeof(struct in6_addr)];
558#endif
559
560 /* ECORE_CON_SOCKS_V4=[user@]host:port-[1|0] */
561 socks = getenv("ECORE_CON_SOCKS_V4");
562 if (!socks)
563 {
564 /* ECORE_CON_SOCKS_V5=[user@]host-port:[1|0] */
565 socks = getenv("ECORE_CON_SOCKS_V5");
566 v5 = EINA_TRUE;
567 }
568 if ((!socks) || (!socks[0]) || (strlen(socks) > 512)) return;
569 strncpy(buf, socks, sizeof(buf));
570 h = strchr(buf, '@');
571 /* username */
572 if (h && (h - buf > 0)) *h++ = 0, u = buf;
573 else h = buf;
574
575 /* host ip; I ain't resolvin shit here */
576 p = strchr(h, '-');
577 if (!p) return;
578 *p++ = 0;
579 if (!inet_pton(AF_INET, h, addr))
580#ifdef HAVE_IPV6
581 {
582 if (!v5) return;
583 if (!inet_pton(AF_INET6, h, addr6))
584 return;
585 }
586#else
587 return;
588#endif
589
590 errno = 0;
591 port = strtol(p, &l, 10);
592 if (errno || (port < 0) || (port > 65535)) return;
593 if (l && (l[0] == ':'))
594 lookup = (l[1] == '1');
595 if (v5)
596 ecs = ecore_con_socks5_remote_add(h, port, u, NULL);
597 else
598 ecs = ecore_con_socks4_remote_add(h, port, u);
599 if (!ecs) return;
600 ecore_con_socks_lookup_set(ecs, lookup);
601 ecore_con_socks_apply_always(ecs);
602 INF("Added global proxy server %s%s%s:%d - DNS lookup %s",
603 u ?: "", u ? "@" : "", h, port, lookup ? "ENABLED" : "DISABLED");
604}
605
606/////////////////////////////////////////////////////////////////////////////////////
607
608/**
609 * @defgroup Ecore_Con_Socks_Group Ecore Connection SOCKS functions
610 * @{
611 */
612
613/**
614 * Add a SOCKS v4 proxy to the proxy list
615 *
616 * Use this to create (or return, if previously added) a SOCKS proxy
617 * object which can be used by any ecore_con servers.
618 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
619 * @param port The port to connect to on the proxy
620 * @param username The username to use for the proxy (OPTIONAL)
621 * @return An allocated proxy object, or NULL on failure
622 * @note This object NEVER needs to be explicitly freed.
623 * @since 1.2
624 */
625EAPI Ecore_Con_Socks *
626ecore_con_socks4_remote_add(const char *ip, int port, const char *username)
627{
628 Ecore_Con_Socks *ecs;
629 size_t ulen = 0;
630
631 if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL;
632
633 if (username)
634 {
635 ulen = strlen(username);
636 /* max length for protocol */
637 if ((!ulen) || (ulen > 255)) return NULL;
638 }
639 ecs = _ecore_con_socks_find(4, ip, port, username, ulen, NULL, 0);
640 if (ecs) return ecs;
641
642 ecs = calloc(1, sizeof(Ecore_Con_Socks_v4));
643 if (!ecs) return NULL;
644
645 ecs->version = 4;
646 ecs->ip = eina_stringshare_add(ip);
647 ecs->port = port;
648 ecs->username = eina_stringshare_add(username);
649 ecs->ulen = ulen;
650 ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs);
651 return ecs;
652}
653
654/**
655 * Find a SOCKS v4 proxy in the proxy list
656 *
657 * Use this to determine if a SOCKS proxy was previously added by checking
658 * the proxy list against the parameters given.
659 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
660 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
661 * @param username The username used for the proxy (OPTIONAL)
662 * @return true only if a proxy exists matching the given params
663 * @note This function matches slightly more loosely than ecore_con_socks4_remote_add(), and
664 * ecore_con_socks4_remote_add() should be used to return the actual object.
665 * @since 1.2
666 */
667EAPI Eina_Bool
668ecore_con_socks4_remote_exists(const char *ip, int port, const char *username)
669{
670 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])))
671 return EINA_FALSE;
672 return !!_ecore_con_socks_find(4, ip, port, username, username ? strlen(username) : 0, NULL, 0);
673}
674
675/**
676 * Remove a SOCKS v4 proxy from the proxy list and delete it
677 *
678 * Use this to remove a SOCKS proxy from the proxy list by checking
679 * the list against the parameters given. The proxy will then be deleted.
680 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
681 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
682 * @param username The username used for the proxy (OPTIONAL)
683 * @note This function matches in the same way as ecore_con_socks4_remote_exists().
684 * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
685 * @since 1.2
686 */
687EAPI void
688ecore_con_socks4_remote_del(const char *ip, int port, const char *username)
689{
690 Ecore_Con_Socks_v4 *v4;
691
692 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) return;
693 if (!ecore_con_socks_proxies) return;
694
695 v4 = (Ecore_Con_Socks_v4*)_ecore_con_socks_find(4, ip, port, username, username ? strlen(username) : 0, NULL, 0);
696 if (!v4) return;
697 ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4);
698 _ecore_con_socks_free((Ecore_Con_Socks*)v4);
699}
700/**
701 * Add a SOCKS v5 proxy to the proxy list
702 *
703 * Use this to create (or return, if previously added) a SOCKS proxy
704 * object which can be used by any ecore_con servers.
705 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
706 * @param port The port to connect to on the proxy
707 * @param username The username to use for the proxy (OPTIONAL)
708 * @param password The password to use for the proxy (OPTIONAL)
709 * @return An allocated proxy object, or NULL on failure
710 * @note This object NEVER needs to be explicitly freed.
711 * @since 1.2
712 */
713EAPI Ecore_Con_Socks *
714ecore_con_socks5_remote_add(const char *ip, int port, const char *username, const char *password)
715{
716 Ecore_Con_Socks_v5 *ecs5;
717 size_t ulen = 0, plen = 0;
718
719 if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL;
720
721 if (username)
722 {
723 ulen = strlen(username);
724 /* max length for protocol */
725 if ((!ulen) || (ulen > 255)) return NULL;
726 }
727 if (password)
728 {
729 plen = strlen(password);
730 /* max length for protocol */
731 if ((!plen) || (plen > 255)) return NULL;
732 }
733 ecs5 = (Ecore_Con_Socks_v5*)_ecore_con_socks_find(5, ip, port, username, ulen, password, plen);
734 if (ecs5) return (Ecore_Con_Socks*)ecs5;
735
736 ecs5 = calloc(1, sizeof(Ecore_Con_Socks_v5));
737 if (!ecs5) return NULL;
738
739 ecs5->version = 5;
740 ecs5->ip = eina_stringshare_add(ip);
741 ecs5->port = port;
742 ecs5->username = eina_stringshare_add(username);
743 ecs5->ulen = ulen;
744 ecs5->password = eina_stringshare_add(password);
745 ecs5->plen = plen;
746 ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs5);
747 return (Ecore_Con_Socks*)ecs5;
748}
749
750/**
751 * Find a SOCKS v5 proxy in the proxy list
752 *
753 * Use this to determine if a SOCKS proxy was previously added by checking
754 * the proxy list against the parameters given.
755 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
756 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
757 * @param username The username used for the proxy (OPTIONAL)
758 * @param password The password used for the proxy (OPTIONAL)
759 * @return true only if a proxy exists matching the given params
760 * @note This function matches slightly more loosely than ecore_con_socks5_remote_add(), and
761 * ecore_con_socks5_remote_add() should be used to return the actual object.
762 * @since 1.2
763 */
764EAPI Eina_Bool
765ecore_con_socks5_remote_exists(const char *ip, int port, const char *username, const char *password)
766{
767 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])) || (password && (!password[0])))
768 return EINA_FALSE;
769 return !!_ecore_con_socks_find(5, ip, port, username, username ? strlen(username) : 0, password, password ? strlen(password) : 0);
770}
771
772/**
773 * Remove a SOCKS v5 proxy from the proxy list and delete it
774 *
775 * Use this to remove a SOCKS proxy from the proxy list by checking
776 * the list against the parameters given. The proxy will then be deleted.
777 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
778 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
779 * @param username The username used for the proxy (OPTIONAL)
780 * @param password The password used for the proxy (OPTIONAL)
781 * @note This function matches in the same way as ecore_con_socks4_remote_exists().
782 * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
783 * @since 1.2
784 */
785EAPI void
786ecore_con_socks5_remote_del(const char *ip, int port, const char *username, const char *password)
787{
788 Ecore_Con_Socks_v5 *v5;
789
790 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])) || (password && (!password[0])))
791 return;
792 if (!ecore_con_socks_proxies) return;
793
794 v5 = (Ecore_Con_Socks_v5*)_ecore_con_socks_find(5, ip, port, username, username ? strlen(username) : 0, password, password ? strlen(password) : 0);
795 if (!v5) return;
796 ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v5);
797 _ecore_con_socks_free((Ecore_Con_Socks*)v5);
798}
799
800/**
801 * Set DNS lookup mode on an existing SOCKS proxy
802 *
803 * According to RFC, SOCKS v4 does not require that a proxy perform
804 * its own DNS lookups for addresses. SOCKS v4a specifies the protocol
805 * for this. SOCKS v5 allows DNS lookups.
806 * If you want to enable remote DNS lookup and are sure that your
807 * proxy supports it, use this function.
808 * @param ecs The proxy object
809 * @param enable If true, the proxy will perform the dns lookup
810 * @note By default, this setting is DISABLED.
811 * @since 1.2
812 */
813EAPI void
814ecore_con_socks_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable)
815{
816 ECORE_CON_SOCKS_CAST_ELSE(ecs) return;
817 ecs->lookup = !!enable;
818}
819
820/**
821 * Get DNS lookup mode on an existing SOCKS proxy
822 *
823 * According to RFC, SOCKS v4 does not require that a proxy perform
824 * its own DNS lookups for addresses. SOCKS v4a specifies the protocol
825 * for this. SOCKS v5 allows DNS lookups.
826 * This function returns whether lookups are enabled on a proxy object.
827 * @param ecs The proxy object
828 * @return If true, the proxy will perform the dns lookup
829 * @note By default, this setting is DISABLED.
830 * @since 1.2
831 */
832EAPI Eina_Bool
833ecore_con_socks_lookup_get(Ecore_Con_Socks *ecs)
834{
835 ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE;
836 return ecs->lookup;
837}
838
839/**
840 * Enable bind mode on a SOCKS proxy
841 *
842 * Use this function to enable binding a remote port for use with a remote server.
843 * For more information, see http://ufasoft.com/doc/socks4_protocol.htm
844 * @param ecs The proxy object
845 * @param is_bind If true, the connection established will be a port binding
846 * @warning Be aware that changing the operation mode of an active proxy may result in undefined behavior
847 * @since 1.2
848 */
849EAPI void
850ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind)
851{
852 EINA_SAFETY_ON_NULL_RETURN(ecs);
853 ecs->bind = !!is_bind;
854}
855
856/**
857 * Return bind mode of a SOCKS proxy
858 *
859 * Use this function to return bind mode of a proxy (binding a remote port for use with a remote server).
860 * For more information, see http://ufasoft.com/doc/socks4_protocol.htm
861 * @param ecs The proxy object
862 * @return If true, the connection established will be a port binding
863 * @since 1.2
864 */
865EAPI Eina_Bool
866ecore_con_socks_bind_get(Ecore_Con_Socks *ecs)
867{
868 EINA_SAFETY_ON_NULL_RETURN_VAL(ecs, EINA_FALSE);
869 return ecs->bind;
870}
871
872/**
873 * Return SOCKS version of a SOCKS proxy
874 *
875 * Use this function to return the SOCKS protocol version of a proxy
876 * @param ecs The proxy object
877 * @return 0 on error, else 4/5
878 * @since 1.2
879 */
880EAPI unsigned int
881ecore_con_socks_version_get(Ecore_Con_Socks *ecs)
882{
883 EINA_SAFETY_ON_NULL_RETURN_VAL(ecs, 0);
884 return ecs->version;
885}
886
887/**
888 * Remove a SOCKS v4 proxy from the proxy list and delete it
889 *
890 * Use this to remove a SOCKS proxy from the proxy list by directly deleting the object given.
891 * @param ecs The proxy object to delete
892 * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
893 * @since 1.2
894 */
895EAPI void
896ecore_con_socks_remote_del(Ecore_Con_Socks *ecs)
897{
898 EINA_SAFETY_ON_NULL_RETURN(ecs);
899 if (!ecore_con_socks_proxies) return;
900
901 ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, ecs);
902 _ecore_con_socks_free(ecs);
903}
904
905/**
906 * Set a proxy object to be used with the next server created with ecore_con_server_connect()
907 *
908 * This function sets a proxy for the next ecore_con connection. After the next server is created,
909 * the proxy will NEVER be applied again unless explicitly enabled.
910 * @param ecs The proxy object
911 * @see ecore_con_socks_apply_always()
912 * @since 1.2
913 */
914EAPI void
915ecore_con_socks_apply_once(Ecore_Con_Socks *ecs)
916{
917 _ecore_con_proxy_once = ecs;
918}
919
920/**
921 * Set a proxy object to be used with all servers created with ecore_con_server_connect()
922 *
923 * This function sets a proxy for all ecore_con connections. It will always be used.
924 * @param ecs The proxy object
925 * @see ecore_con_socks_apply_once()
926 * @since 1.2
927 * @note ecore-con supports setting this through environment variables like so:
928 * ECORE_CON_SOCKS_V4=[user@]server-port:lookup
929 * ECORE_CON_SOCKS_V5=[user@]server-port:lookup
930 * user is the OPTIONAL string that would be passed to the proxy as the username
931 * server is the IP_ADDRESS of the proxy server
932 * port is the port to connect to on the proxy server
933 * lookup is 1 if the proxy should perform all DNS lookups, otherwise 0 or omitted
934 */
935EAPI void
936ecore_con_socks_apply_always(Ecore_Con_Socks *ecs)
937{
938 _ecore_con_proxy_global = ecs;
939}
940/** @} */
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c b/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c
deleted file mode 100644
index cd8b9c6..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c
+++ /dev/null
@@ -1,2113 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#if USE_GNUTLS
6# include <gnutls/gnutls.h>
7# include <gnutls/x509.h>
8# include <gcrypt.h>
9#elif USE_OPENSSL
10# include <openssl/ssl.h>
11# include <openssl/err.h>
12# include <openssl/dh.h>
13#endif
14
15#ifdef HAVE_WS2TCPIP_H
16# include <ws2tcpip.h>
17#endif
18
19#include <sys/stat.h>
20#include "Ecore.h"
21#include "ecore_con_private.h"
22
23EAPI int ECORE_CON_EVENT_CLIENT_UPGRADE = 0;
24EAPI int ECORE_CON_EVENT_SERVER_UPGRADE = 0;
25
26static int _init_con_ssl_init_count = 0;
27
28#ifdef USE_GNUTLS
29# ifdef EINA_HAVE_THREADS
30GCRY_THREAD_OPTION_PTHREAD_IMPL;
31# endif
32
33static int _client_connected = 0;
34
35# define SSL_SUFFIX(ssl_func) ssl_func ## _gnutls
36# define _ECORE_CON_SSL_AVAILABLE 1
37
38#elif USE_OPENSSL
39
40# define SSL_SUFFIX(ssl_func) ssl_func ## _openssl
41# define _ECORE_CON_SSL_AVAILABLE 2
42
43#else
44# define SSL_SUFFIX(ssl_func) ssl_func ## _none
45# define _ECORE_CON_SSL_AVAILABLE 0
46
47#endif
48
49#if USE_GNUTLS
50static void
51_gnutls_print_errors(void *conn, int type, int ret)
52{
53 char buf[1024];
54
55 if (!ret) return;
56
57 snprintf(buf, sizeof(buf), "GNUTLS error: %s - %s", gnutls_strerror_name(ret), gnutls_strerror(ret));
58 if (type == ECORE_CON_EVENT_CLIENT_ERROR)
59 ecore_con_event_client_error(conn, buf);
60 else
61 ecore_con_event_server_error(conn, buf);
62}
63
64static void
65_gnutls_print_session(const gnutls_datum_t *cert_list, unsigned int cert_list_size)
66{
67 char *c = NULL;
68 gnutls_x509_crt_t crt;
69 unsigned int x;
70
71 if (!eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) return;
72 for (x = 0; x < cert_list_size; x++)
73 {
74 gnutls_x509_crt_init(&crt);
75 gnutls_x509_crt_import(crt, &cert_list[x], GNUTLS_X509_FMT_DER);
76 gnutls_x509_crt_print(crt, GNUTLS_CRT_PRINT_FULL, (gnutls_datum_t*)&c);
77 INF("CERTIFICATE:\n%s", c);
78 gnutls_free(c);
79 gnutls_x509_crt_deinit(crt);
80 crt = NULL;
81 }
82}
83
84#ifdef ISCOMFITOR
85static void
86_gnutls_log_func(int level,
87 const char *str)
88{
89 char buf[128];
90 strncat(buf, str, strlen(str) - 1);
91 DBG("|<%d>| %s", level, buf);
92}
93#endif
94
95static const char *
96SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_description_t status)
97{
98 switch (status)
99 {
100 case GNUTLS_HANDSHAKE_HELLO_REQUEST:
101 return "Hello request";
102
103 case GNUTLS_HANDSHAKE_CLIENT_HELLO:
104 return "Client hello";
105
106 case GNUTLS_HANDSHAKE_SERVER_HELLO:
107 return "Server hello";
108
109 case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET:
110 return "New session ticket";
111
112 case GNUTLS_HANDSHAKE_CERTIFICATE_PKT:
113 return "Certificate packet";
114
115 case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE:
116 return "Server key exchange";
117
118 case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST:
119 return "Certificate request";
120
121 case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE:
122 return "Server hello done";
123
124 case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY:
125 return "Certificate verify";
126
127 case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE:
128 return "Client key exchange";
129
130 case GNUTLS_HANDSHAKE_FINISHED:
131 return "Finished";
132
133 case GNUTLS_HANDSHAKE_SUPPLEMENTAL:
134 return "Supplemental";
135 }
136 return NULL;
137}
138
139#elif USE_OPENSSL
140
141static void
142_openssl_print_verify_error(int error)
143{
144 switch (error)
145 {
146#define ERROR(X) \
147 case (X): \
148 ERR("%s", #X); \
149 break
150#ifdef X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
151 ERROR(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT);
152#endif
153#ifdef X509_V_ERR_UNABLE_TO_GET_CRL
154 ERROR(X509_V_ERR_UNABLE_TO_GET_CRL);
155#endif
156#ifdef X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
157 ERROR(X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE);
158#endif
159#ifdef X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
160 ERROR(X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE);
161#endif
162#ifdef X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
163 ERROR(X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY);
164#endif
165#ifdef X509_V_ERR_CERT_SIGNATURE_FAILURE
166 ERROR(X509_V_ERR_CERT_SIGNATURE_FAILURE);
167#endif
168#ifdef X509_V_ERR_CRL_SIGNATURE_FAILURE
169 ERROR(X509_V_ERR_CRL_SIGNATURE_FAILURE);
170#endif
171#ifdef X509_V_ERR_CERT_NOT_YET_VALID
172 ERROR(X509_V_ERR_CERT_NOT_YET_VALID);
173#endif
174#ifdef X509_V_ERR_CERT_HAS_EXPIRED
175 ERROR(X509_V_ERR_CERT_HAS_EXPIRED);
176#endif
177#ifdef X509_V_ERR_CRL_NOT_YET_VALID
178 ERROR(X509_V_ERR_CRL_NOT_YET_VALID);
179#endif
180#ifdef X509_V_ERR_CRL_HAS_EXPIRED
181 ERROR(X509_V_ERR_CRL_HAS_EXPIRED);
182#endif
183#ifdef X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
184 ERROR(X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD);
185#endif
186#ifdef X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
187 ERROR(X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD);
188#endif
189#ifdef X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
190 ERROR(X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD);
191#endif
192#ifdef X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
193 ERROR(X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD);
194#endif
195#ifdef X509_V_ERR_OUT_OF_MEM
196 ERROR(X509_V_ERR_OUT_OF_MEM);
197#endif
198#ifdef X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
199 ERROR(X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT);
200#endif
201#ifdef X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
202 ERROR(X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN);
203#endif
204#ifdef X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
205 ERROR(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY);
206#endif
207#ifdef X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
208 ERROR(X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
209#endif
210#ifdef X509_V_ERR_CERT_CHAIN_TOO_LONG
211 ERROR(X509_V_ERR_CERT_CHAIN_TOO_LONG);
212#endif
213#ifdef X509_V_ERR_CERT_REVOKED
214 ERROR(X509_V_ERR_CERT_REVOKED);
215#endif
216#ifdef X509_V_ERR_INVALID_CA
217 ERROR(X509_V_ERR_INVALID_CA);
218#endif
219#ifdef X509_V_ERR_PATH_LENGTH_EXCEEDED
220 ERROR(X509_V_ERR_PATH_LENGTH_EXCEEDED);
221#endif
222#ifdef X509_V_ERR_INVALID_PURPOSE
223 ERROR(X509_V_ERR_INVALID_PURPOSE);
224#endif
225#ifdef X509_V_ERR_CERT_UNTRUSTED
226 ERROR(X509_V_ERR_CERT_UNTRUSTED);
227#endif
228#ifdef X509_V_ERR_CERT_REJECTED
229 ERROR(X509_V_ERR_CERT_REJECTED);
230#endif
231 /* These are 'informational' when looking for issuer cert */
232#ifdef X509_V_ERR_SUBJECT_ISSUER_MISMATCH
233 ERROR(X509_V_ERR_SUBJECT_ISSUER_MISMATCH);
234#endif
235#ifdef X509_V_ERR_AKID_SKID_MISMATCH
236 ERROR(X509_V_ERR_AKID_SKID_MISMATCH);
237#endif
238#ifdef X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
239 ERROR(X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH);
240#endif
241#ifdef X509_V_ERR_KEYUSAGE_NO_CERTSIGN
242 ERROR(X509_V_ERR_KEYUSAGE_NO_CERTSIGN);
243#endif
244
245#ifdef X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER
246 ERROR(X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER);
247#endif
248#ifdef X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION
249 ERROR(X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION);
250#endif
251#ifdef X509_V_ERR_KEYUSAGE_NO_CRL_SIGN
252 ERROR(X509_V_ERR_KEYUSAGE_NO_CRL_SIGN);
253#endif
254#ifdef X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION
255 ERROR(X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION);
256#endif
257#ifdef X509_V_ERR_INVALID_NON_CA
258 ERROR(X509_V_ERR_INVALID_NON_CA);
259#endif
260#ifdef X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED
261 ERROR(X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED);
262#endif
263#ifdef X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE
264 ERROR(X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE);
265#endif
266#ifdef X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED
267 ERROR(X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED);
268#endif
269
270#ifdef X509_V_ERR_INVALID_EXTENSION
271 ERROR(X509_V_ERR_INVALID_EXTENSION);
272#endif
273#ifdef X509_V_ERR_INVALID_POLICY_EXTENSION
274 ERROR(X509_V_ERR_INVALID_POLICY_EXTENSION);
275#endif
276#ifdef X509_V_ERR_NO_EXPLICIT_POLICY
277 ERROR(X509_V_ERR_NO_EXPLICIT_POLICY);
278#endif
279#ifdef X509_V_ERR_DIFFERENT_CRL_SCOPE
280 ERROR(X509_V_ERR_DIFFERENT_CRL_SCOPE);
281#endif
282#ifdef X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE
283 ERROR(X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE);
284#endif
285
286#ifdef X509_V_ERR_UNNESTED_RESOURCE
287 ERROR(X509_V_ERR_UNNESTED_RESOURCE);
288#endif
289
290#ifdef X509_V_ERR_PERMITTED_VIOLATION
291 ERROR(X509_V_ERR_PERMITTED_VIOLATION);
292#endif
293#ifdef X509_V_ERR_EXCLUDED_VIOLATION
294 ERROR(X509_V_ERR_EXCLUDED_VIOLATION);
295#endif
296#ifdef X509_V_ERR_SUBTREE_MINMAX
297 ERROR(X509_V_ERR_SUBTREE_MINMAX);
298#endif
299#ifdef X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
300 ERROR(X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE);
301#endif
302#ifdef X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX
303 ERROR(X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX);
304#endif
305#ifdef X509_V_ERR_UNSUPPORTED_NAME_SYNTAX
306 ERROR(X509_V_ERR_UNSUPPORTED_NAME_SYNTAX);
307#endif
308#ifdef X509_V_ERR_CRL_PATH_VALIDATION_ERROR
309 ERROR(X509_V_ERR_CRL_PATH_VALIDATION_ERROR);
310#endif
311
312 /* The application is not happy */
313#ifdef X509_V_ERR_APPLICATION_VERIFICATION
314 ERROR(X509_V_ERR_APPLICATION_VERIFICATION);
315#endif
316 }
317#undef ERROR
318}
319
320static void
321_openssl_print_errors(void *conn, int type)
322{
323 char buf[1024];
324 do
325 {
326 unsigned long err;
327
328 err = ERR_get_error();
329 if (!err) break;
330 snprintf(buf, sizeof(buf), "OpenSSL error: %s", ERR_reason_error_string(err));
331 if (type == ECORE_CON_EVENT_CLIENT_ERROR)
332 ecore_con_event_client_error(conn, buf);
333 else
334 ecore_con_event_server_error(conn, buf);
335
336 } while (1);
337}
338
339static Eina_Bool
340_openssl_name_verify(const char *name, const char *svrname)
341{
342 if (name[0] == '*')
343 {
344 /* we allow *.domain.TLD with a wildcard, but nothing else */
345 const char *p, *s;
346
347 EINA_SAFETY_ON_TRUE_RETURN_VAL((name[1] != '.') || (!name[2]), EINA_FALSE);
348 p = strchr(name + 1, '*');
349 EINA_SAFETY_ON_TRUE_RETURN_VAL(!!p, EINA_FALSE);
350 /* verify that we have a domain of at least *.X.TLD and not *.TLD */
351 p = strchr(name + 2, '.');
352 EINA_SAFETY_ON_TRUE_RETURN_VAL(!p, EINA_FALSE);
353 s = strchr(svrname, '.');
354 EINA_SAFETY_ON_TRUE_RETURN_VAL(!s, EINA_FALSE);
355 /* same as above for the stored name */
356 EINA_SAFETY_ON_TRUE_RETURN_VAL(!strchr(s + 1, '.'), EINA_FALSE);
357 if (strcasecmp(s, name + 1))
358 {
359 ERR("%s != %s", s, name + 1);
360 return EINA_FALSE;
361 }
362 }
363 else
364 if (strcasecmp(name, svrname))
365 {
366 ERR("%s != %s", name, svrname);
367 return EINA_FALSE;
368 }
369 return EINA_TRUE;
370}
371
372static void
373_openssl_print_session(SSL *ssl)
374{
375 /* print session info into DBG */
376 SSL_SESSION *s;
377 STACK_OF(X509) *sk;
378 BIO *b;
379 char log[4096], *p;
380 int x;
381
382 if (!eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) return;
383
384 memset(log, 0, sizeof(log));
385 b = BIO_new(BIO_s_mem());
386 sk = SSL_get_peer_cert_chain(ssl);
387 if (sk)
388 {
389 DBG("CERTIFICATES:");
390 for (x = 0; x < sk_X509_num(sk); x++)
391 {
392 p = X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, x)), log, sizeof(log));
393 DBG("%2d s:%s", x, p);
394 p = X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk, x)), log, sizeof(log));
395 DBG(" i:%s", p);
396 PEM_write_X509(stderr, sk_X509_value(sk, x));
397 }
398 }
399 s = SSL_get_session(ssl);
400 SSL_SESSION_print(b, s);
401 fprintf(stderr, "\n");
402 while (BIO_read(b, log, sizeof(log)) > 0)
403 fprintf(stderr, "%s", log);
404
405 BIO_free(b);
406}
407
408#endif
409
410#define SSL_ERROR_CHECK_GOTO_ERROR(X) \
411 do \
412 { \
413 if ((X)) \
414 { \
415 ERR("Error at %s:%s:%d!", __FILE__, __PRETTY_FUNCTION__, __LINE__); \
416 goto error; \
417 } \
418 } \
419 while (0)
420
421static Ecore_Con_Ssl_Error
422 SSL_SUFFIX(_ecore_con_ssl_init) (void);
423static Ecore_Con_Ssl_Error
424 SSL_SUFFIX(_ecore_con_ssl_shutdown) (void);
425
426static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_cafile_add) (Ecore_Con_Server * svr, const char *ca_file);
427static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_crl_add) (Ecore_Con_Server * svr, const char *crl_file);
428static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (Ecore_Con_Server * svr, const char *cert);
429static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_privkey_add) (Ecore_Con_Server * svr, const char *key_file);
430
431static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_server_prepare) (Ecore_Con_Server * svr, int ssl_type);
432static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_server_init) (Ecore_Con_Server * svr);
433static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_server_shutdown) (Ecore_Con_Server *svr);
434static int SSL_SUFFIX(_ecore_con_ssl_server_read) (Ecore_Con_Server *svr, unsigned char *buf, int size);
435static int SSL_SUFFIX(_ecore_con_ssl_server_write) (Ecore_Con_Server *svr, const unsigned char *buf, int size);
436
437static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_client_init) (Ecore_Con_Client * cl);
438static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_client_shutdown) (Ecore_Con_Client *cl);
439static int SSL_SUFFIX(_ecore_con_ssl_client_read) (Ecore_Con_Client * cl,
440 unsigned char *buf, int size);
441static int SSL_SUFFIX(_ecore_con_ssl_client_write) (Ecore_Con_Client * cl,
442 const unsigned char *buf, int size);
443
444/*
445 * General SSL API
446 */
447
448Ecore_Con_Ssl_Error
449ecore_con_ssl_init(void)
450{
451 if (!_init_con_ssl_init_count++)
452 {
453 SSL_SUFFIX(_ecore_con_ssl_init) ();
454#if _ECORE_CON_SSL_AVAILABLE != 0
455 ECORE_CON_EVENT_CLIENT_UPGRADE = ecore_event_type_new();
456 ECORE_CON_EVENT_SERVER_UPGRADE = ecore_event_type_new();
457#endif
458 }
459
460 return _init_con_ssl_init_count;
461}
462
463Ecore_Con_Ssl_Error
464ecore_con_ssl_shutdown(void)
465{
466 if (!--_init_con_ssl_init_count)
467 SSL_SUFFIX(_ecore_con_ssl_shutdown) ();
468
469 return _init_con_ssl_init_count;
470}
471
472Ecore_Con_Ssl_Error
473ecore_con_ssl_server_prepare(Ecore_Con_Server *svr,
474 int ssl_type)
475{
476 if (!ssl_type)
477 return ECORE_CON_SSL_ERROR_NONE;
478 return SSL_SUFFIX(_ecore_con_ssl_server_prepare) (svr, ssl_type);
479}
480
481Ecore_Con_Ssl_Error
482ecore_con_ssl_server_init(Ecore_Con_Server *svr)
483{
484 if (!(svr->type & ECORE_CON_SSL))
485 return ECORE_CON_SSL_ERROR_NONE;
486 return SSL_SUFFIX(_ecore_con_ssl_server_init) (svr);
487}
488
489Ecore_Con_Ssl_Error
490ecore_con_ssl_server_shutdown(Ecore_Con_Server *svr)
491{
492 if (!(svr->type & ECORE_CON_SSL))
493 return ECORE_CON_SSL_ERROR_NONE;
494 return SSL_SUFFIX(_ecore_con_ssl_server_shutdown) (svr);
495}
496
497int
498ecore_con_ssl_server_read(Ecore_Con_Server *svr,
499 unsigned char *buf,
500 int size)
501{
502 return SSL_SUFFIX(_ecore_con_ssl_server_read) (svr, buf, size);
503}
504
505int
506ecore_con_ssl_server_write(Ecore_Con_Server *svr,
507 const unsigned char *buf,
508 int size)
509{
510 return SSL_SUFFIX(_ecore_con_ssl_server_write) (svr, buf, size);
511}
512
513Ecore_Con_Ssl_Error
514ecore_con_ssl_client_init(Ecore_Con_Client *cl)
515{
516 if (!(cl->host_server->type & ECORE_CON_SSL))
517 return ECORE_CON_SSL_ERROR_NONE;
518 return SSL_SUFFIX(_ecore_con_ssl_client_init) (cl);
519}
520
521Ecore_Con_Ssl_Error
522ecore_con_ssl_client_shutdown(Ecore_Con_Client *cl)
523{
524 if (!(cl->host_server->type & ECORE_CON_SSL))
525 return ECORE_CON_SSL_ERROR_NONE;
526 return SSL_SUFFIX(_ecore_con_ssl_client_shutdown) (cl);
527}
528
529int
530ecore_con_ssl_client_read(Ecore_Con_Client *cl,
531 unsigned char *buf,
532 int size)
533{
534 return SSL_SUFFIX(_ecore_con_ssl_client_read) (cl, buf, size);
535}
536
537int
538ecore_con_ssl_client_write(Ecore_Con_Client *cl,
539 const unsigned char *buf,
540 int size)
541{
542 return SSL_SUFFIX(_ecore_con_ssl_client_write) (cl, buf, size);
543}
544
545/**
546 * Returns if SSL support is available
547 * @return 1 if SSL is available and provided by gnutls, 2 if provided by openssl,
548 * 0 if it is not available.
549 * @ingroup Ecore_Con_Client_Group
550 */
551EAPI int
552ecore_con_ssl_available_get(void)
553{
554 return _ECORE_CON_SSL_AVAILABLE;
555}
556
557/**
558 * @addtogroup Ecore_Con_SSL_Group Ecore Connection SSL Functions
559 *
560 * Functions that operate on Ecore connection objects pertaining to SSL.
561 *
562 * @{
563 */
564
565/**
566 * @brief Enable certificate verification on a server object
567 *
568 * Call this function on a server object before main loop has started
569 * to enable verification of certificates against loaded certificates.
570 * @param svr The server object
571 */
572EAPI void
573ecore_con_ssl_server_verify(Ecore_Con_Server *svr)
574{
575 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
576 {
577 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_verify");
578 return;
579 }
580 svr->verify = EINA_TRUE;
581}
582
583/**
584 * @brief Enable hostname-based certificate verification on a server object
585 *
586 * Call this function on a server object before main loop has started
587 * to enable verification of certificates using ONLY their hostnames.
588 * @param svr The server object
589 * @note This function has no effect when used on a listening server created by
590 * ecore_con_server_add
591 * @since 1.1
592 */
593EAPI void
594ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr)
595{
596 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
597 {
598 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
599 return;
600 }
601 svr->verify_basic = EINA_TRUE;
602}
603
604/**
605 * @brief Set the hostname to verify against in certificate verification
606 *
607 * Sometimes the certificate hostname will not match the hostname that you are
608 * connecting to, and will instead match a different name. An example of this is
609 * that if you connect to talk.google.com to use Google Talk, you receive Google's
610 * certificate for gmail.com. This certificate should be trusted, and so you must call
611 * this function with "gmail.com" as @p name.
612 * See RFC2818 for more details.
613 * @param svr The server object
614 * @param name The hostname to verify against
615 * @since 1.2
616 */
617EAPI void
618ecore_con_ssl_server_verify_name_set(Ecore_Con_Server *svr, const char *name)
619{
620 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
621 {
622 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
623 return;
624 }
625 eina_stringshare_replace(&svr->verify_name, name);
626}
627
628/**
629 * @brief Get the hostname to verify against in certificate verification
630 *
631 * This function returns the name which will be used to validate the SSL certificate
632 * common name (CN) or alt name (subjectAltName). It will default to the @p name
633 * param in ecore_con_server_connect(), but can be changed with ecore_con_ssl_server_verify_name_set().
634 * @param svr The server object
635 * @return The hostname which will be used
636 * @since 1.2
637 */
638EAPI const char *
639ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr)
640{
641 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
642 {
643 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
644 return NULL;
645 }
646 return svr->verify_name ?: svr->name;
647}
648
649/**
650 * @brief Add an ssl certificate for use in ecore_con functions.
651 *
652 * Use this function to add a SSL PEM certificate.
653 * Simply specify the cert here to use it in the server object for connecting or listening.
654 * If there is an error loading the certificate, an error will automatically be logged.
655 * @param svr The server object
656 * @param cert The path to the certificate.
657 * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE.
658 */
659
660EAPI Eina_Bool
661ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr,
662 const char *cert)
663{
664 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
665 {
666 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_cert_add");
667 return EINA_FALSE;
668 }
669
670 if (!svr->ssl_prepared)
671 {
672 svr->use_cert = EINA_TRUE;
673 svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
674 if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
675 return EINA_FALSE;
676 }
677
678 return SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (svr, cert);
679}
680
681/**
682 * @brief Add an ssl CA file for use in ecore_con functions.
683 *
684 * Use this function to add a SSL PEM CA file.
685 * Simply specify the file here to use it in the server object for connecting or listening.
686 * If there is an error loading the CAs, an error will automatically be logged.
687 * @param svr The server object
688 * @param ca_file The path to the CA file.
689 * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE.
690 * @note since 1.2, this function can load directores
691 */
692
693EAPI Eina_Bool
694ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr,
695 const char *ca_file)
696{
697 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
698 {
699 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_cafile_add");
700 return EINA_FALSE;
701 }
702
703 if (!svr->ssl_prepared)
704 {
705 svr->use_cert = EINA_TRUE;
706 svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
707 if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
708 return EINA_FALSE;
709 }
710
711 return SSL_SUFFIX(_ecore_con_ssl_server_cafile_add) (svr, ca_file);
712}
713
714/**
715 * @brief Add an ssl private key for use in ecore_con functions.
716 *
717 * Use this function to add a SSL PEM private key
718 * Simply specify the key file here to use it in the server object for connecting or listening.
719 * If there is an error loading the key, an error will automatically be logged.
720 * @param key_file The path to the key file.
721 * @return EINA_FALSE if the file cannot be loaded,
722 * otherwise EINA_TRUE.
723 */
724
725EAPI Eina_Bool
726ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr,
727 const char *key_file)
728{
729 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
730 {
731 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_privkey_add");
732 return EINA_FALSE;
733 }
734
735 if (!svr->ssl_prepared)
736 {
737 svr->use_cert = EINA_TRUE;
738 svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
739 if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
740 return EINA_FALSE;
741 }
742
743 return SSL_SUFFIX(_ecore_con_ssl_server_privkey_add) (svr, key_file);
744}
745
746/**
747 * @brief Add an ssl CRL for use in ecore_con functions.
748 *
749 * Use this function to add a SSL PEM CRL file
750 * Simply specify the CRL file here to use it in the server object for connecting or listening.
751 * If there is an error loading the CRL, an error will automatically be logged.
752 * @param svr The server object
753 * @param crl_file The path to the CRL file.
754 * @return EINA_FALSE if the file cannot be loaded,
755 * otherwise EINA_TRUE.
756 */
757
758EAPI Eina_Bool
759ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr,
760 const char *crl_file)
761{
762 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
763 {
764 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_crl_add");
765 return EINA_FALSE;
766 }
767
768 if (!svr->ssl_prepared)
769 {
770 svr->use_cert = EINA_TRUE;
771 svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
772 if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
773 return EINA_FALSE;
774 }
775
776 return SSL_SUFFIX(_ecore_con_ssl_server_crl_add) (svr, crl_file);
777}
778
779/**
780 * @brief Upgrade a connection to a specified level of encryption
781 *
782 * Use this function to begin an SSL handshake on a connection (STARTTLS or similar).
783 * Once the upgrade has been completed, an ECORE_CON_EVENT_SERVER_UPGRADE event will be emitted.
784 * The connection should be treated as disconnected until the next event.
785 * @param svr The server object
786 * @param ssl_type The SSL connection type (ONLY).
787 * @return EINA_FALSE if the connection cannot be upgraded, otherwise EINA_TRUE.
788 * @note This function is NEVER to be used on a server object created with ecore_con_server_add
789 * @warning Setting a wrong value for @p compl_type WILL mess up your program.
790 * @since 1.1
791 */
792
793EAPI Eina_Bool
794ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type ssl_type)
795{
796 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
797 {
798 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
799 return EINA_FALSE;
800 }
801#if _ECORE_CON_SSL_AVAILABLE == 0
802 return EINA_FALSE;
803#endif
804
805 if (!svr->ssl_prepared)
806 {
807 if (ecore_con_ssl_server_prepare(svr, ssl_type))
808 return EINA_FALSE;
809 }
810 if (!svr->use_cert)
811 svr->type |= ssl_type;
812 svr->upgrade = EINA_TRUE;
813 svr->handshaking = EINA_TRUE;
814 svr->ssl_state = ECORE_CON_SSL_STATE_INIT;
815 return !SSL_SUFFIX(_ecore_con_ssl_server_init) (svr);
816}
817
818/**
819 * @brief Upgrade a connection to a specified level of encryption
820 *
821 * Use this function to begin an SSL handshake on a connection (STARTTLS or similar).
822 * Once the upgrade has been completed, an ECORE_CON_EVENT_CLIENT_UPGRADE event will be emitted.
823 * The connection should be treated as disconnected until the next event.
824 * @param cl The client object
825 * @param ssl_type The SSL connection type (ONLY).
826 * @return EINA_FALSE if the connection cannot be upgraded, otherwise EINA_TRUE.
827 * @warning Setting a wrong value for @p compl_type WILL mess up your program.
828 * @since 1.1
829 */
830
831EAPI Eina_Bool
832ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type ssl_type)
833{
834 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
835 {
836 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, __func__);
837 return EINA_FALSE;
838 }
839#if _ECORE_CON_SSL_AVAILABLE == 0
840 return EINA_FALSE;
841#endif
842
843 if (!cl->host_server->ssl_prepared)
844 {
845 if (ecore_con_ssl_server_prepare(cl->host_server, ssl_type))
846 return EINA_FALSE;
847 }
848 if (!cl->host_server->use_cert)
849 cl->host_server->type |= ssl_type;
850 cl->upgrade = EINA_TRUE;
851 cl->host_server->upgrade = EINA_TRUE;
852 cl->handshaking = EINA_TRUE;
853 cl->ssl_state = ECORE_CON_SSL_STATE_INIT;
854 return SSL_SUFFIX(_ecore_con_ssl_client_init) (cl);
855}
856
857/**
858 * @}
859 */
860
861#if USE_GNUTLS
862
863/*
864 * GnuTLS
865 */
866
867static Ecore_Con_Ssl_Error
868_ecore_con_ssl_init_gnutls(void)
869{
870#ifdef EINA_HAVE_THREADS
871 if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
872 WRN("YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
873#endif
874 if (gnutls_global_init())
875 return ECORE_CON_SSL_ERROR_INIT_FAILED;
876
877#ifdef ISCOMFITOR
878 if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG))
879 {
880 gnutls_global_set_log_level(9);
881 gnutls_global_set_log_function(_gnutls_log_func);
882 }
883#endif
884 return ECORE_CON_SSL_ERROR_NONE;
885}
886
887static Ecore_Con_Ssl_Error
888_ecore_con_ssl_shutdown_gnutls(void)
889{
890 gnutls_global_deinit();
891
892 return ECORE_CON_SSL_ERROR_NONE;
893}
894
895static Ecore_Con_Ssl_Error
896_ecore_con_ssl_server_prepare_gnutls(Ecore_Con_Server *svr,
897 int ssl_type)
898{
899 int ret;
900
901 if (ssl_type & ECORE_CON_USE_SSL2)
902 return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
903
904 switch (ssl_type)
905 {
906 case ECORE_CON_USE_SSL3:
907 case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT:
908 case ECORE_CON_USE_TLS:
909 case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT:
910 case ECORE_CON_USE_MIXED:
911 case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT:
912 break;
913
914 default:
915 return ECORE_CON_SSL_ERROR_NONE;
916 }
917
918 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_allocate_credentials(&svr->cert));
919
920 if (svr->use_cert)
921 {
922 if (svr->created)
923 {
924 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_dh_params_init(&svr->dh_params));
925 INF("Generating DH params");
926 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_dh_params_generate2(svr->dh_params, 1024));
927
928 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_anon_allocate_server_credentials(&svr->anoncred_s));
929 /* TODO: implement PSK */
930 // SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_psk_allocate_server_credentials(&svr->pskcred_s));
931
932 gnutls_anon_set_server_dh_params(svr->anoncred_s, svr->dh_params);
933 gnutls_certificate_set_dh_params(svr->cert, svr->dh_params);
934 //gnutls_psk_set_server_dh_params(svr->pskcred_s, svr->dh_params);
935 INF("DH params successfully generated and applied!");
936 }
937 else
938 {
939 //SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_psk_allocate_client_credentials(&svr->pskcred_c));
940 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_anon_allocate_client_credentials(&svr->anoncred_c));
941 }
942 }
943
944 svr->ssl_prepared = EINA_TRUE;
945 return ECORE_CON_SSL_ERROR_NONE;
946
947error:
948 _gnutls_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR, ret);
949 _ecore_con_ssl_server_shutdown_gnutls(svr);
950 return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
951}
952
953
954static Ecore_Con_Ssl_Error
955_ecore_con_ssl_server_init_gnutls(Ecore_Con_Server *svr)
956{
957 const gnutls_datum_t *cert_list;
958 unsigned int iter, cert_list_size;
959 gnutls_x509_crt_t cert = NULL;
960 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";
961 int ret = 0;
962
963 switch (svr->ssl_state)
964 {
965 case ECORE_CON_SSL_STATE_DONE:
966 return ECORE_CON_SSL_ERROR_NONE;
967
968 case ECORE_CON_SSL_STATE_INIT:
969 if (svr->type & ECORE_CON_USE_SSL2) /* not supported because of security issues */
970 return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
971
972 switch (svr->type & ECORE_CON_SSL)
973 {
974 case ECORE_CON_USE_SSL3:
975 case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT:
976 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";
977 break;
978
979 case ECORE_CON_USE_TLS:
980 case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT:
981 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";
982 break;
983
984 case ECORE_CON_USE_MIXED:
985 case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT:
986 break;
987
988 default:
989 return ECORE_CON_SSL_ERROR_NONE;
990 }
991
992 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_init(&svr->session, GNUTLS_CLIENT));
993 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_session_ticket_enable_client(svr->session));
994 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_server_name_set(svr->session, GNUTLS_NAME_DNS, svr->name, strlen(svr->name)));
995 INF("Applying priority string: %s", priority);
996 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_priority_set_direct(svr->session, priority, NULL));
997 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(svr->session, GNUTLS_CRD_CERTIFICATE, svr->cert));
998 // SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(svr->session, GNUTLS_CRD_PSK, svr->pskcred_c));
999 if (!svr->use_cert)
1000 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(svr->session, GNUTLS_CRD_ANON, svr->anoncred_c));
1001
1002 gnutls_dh_set_prime_bits(svr->session, 512);
1003 gnutls_transport_set_ptr(svr->session, (gnutls_transport_ptr_t)((intptr_t)svr->fd));
1004 svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1005
1006 case ECORE_CON_SSL_STATE_HANDSHAKING:
1007 if (!svr->session)
1008 {
1009 DBG("Server was previously lost, going to error condition");
1010 goto error;
1011 }
1012 ret = gnutls_handshake(svr->session);
1013 DBG("calling gnutls_handshake(): returned with '%s'", gnutls_strerror_name(ret));
1014 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_error_is_fatal(ret));
1015 if (!ret)
1016 {
1017 svr->handshaking = EINA_FALSE;
1018 svr->ssl_state = ECORE_CON_SSL_STATE_DONE;
1019 }
1020 else
1021 {
1022 if (gnutls_record_get_direction(svr->session))
1023 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
1024 else
1025 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
1026 return ECORE_CON_SSL_ERROR_NONE;
1027 }
1028
1029 default:
1030 break;
1031 }
1032
1033 if ((!svr->verify) && (!svr->verify_basic))
1034 /* not verifying certificates, so we're done! */
1035 return ECORE_CON_SSL_ERROR_NONE;
1036 if (svr->verify)
1037 {
1038 /* use CRL/CA lists to verify */
1039 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_verify_peers2(svr->session, &iter));
1040 if (iter & GNUTLS_CERT_INVALID)
1041 ERR("The certificate is not trusted.");
1042 else if (iter & GNUTLS_CERT_SIGNER_NOT_FOUND)
1043 ERR("The certificate hasn't got a known issuer.");
1044 else if (iter & GNUTLS_CERT_REVOKED)
1045 ERR("The certificate has been revoked.");
1046 else if (iter & GNUTLS_CERT_EXPIRED)
1047 ERR("The certificate has expired");
1048 else if (iter & GNUTLS_CERT_NOT_ACTIVATED)
1049 ERR("The certificate is not yet activated");
1050
1051 if (iter)
1052 goto error;
1053 }
1054 if (gnutls_certificate_type_get(svr->session) != GNUTLS_CRT_X509)
1055 {
1056 ERR("Warning: PGP certificates are not yet supported!");
1057 goto error;
1058 }
1059
1060 SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(svr->session, &cert_list_size)));
1061 SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size);
1062
1063 _gnutls_print_session(cert_list, cert_list_size);
1064
1065 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert));
1066 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER));
1067
1068 SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, svr->verify_name ?: svr->name));
1069 gnutls_x509_crt_deinit(cert);
1070 DBG("SSL certificate verification succeeded!");
1071 return ECORE_CON_SSL_ERROR_NONE;
1072
1073error:
1074 _gnutls_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR, ret);
1075 if ((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) || (ret == GNUTLS_E_FATAL_ALERT_RECEIVED))
1076 ERR("Also received alert: %s", gnutls_alert_get_name(gnutls_alert_get(svr->session)));
1077 if (svr->session && (svr->ssl_state != ECORE_CON_SSL_STATE_DONE))
1078 {
1079 ERR("last out: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_out(svr->session)));
1080 ERR("last in: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_in(svr->session)));
1081 }
1082 if (cert)
1083 gnutls_x509_crt_deinit(cert);
1084 _ecore_con_ssl_server_shutdown_gnutls(svr);
1085 return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
1086}
1087
1088static Eina_Bool
1089_ecore_con_ssl_server_cafile_add_gnutls(Ecore_Con_Server *svr,
1090 const char *ca_file)
1091{
1092 struct stat st;
1093 Eina_Iterator *it;
1094 const char *file;
1095 Eina_Bool error = EINA_FALSE;
1096
1097 if (stat(ca_file, &st)) return EINA_FALSE;
1098 if (S_ISDIR(st.st_mode))
1099 {
1100 it = eina_file_ls(ca_file);
1101 SSL_ERROR_CHECK_GOTO_ERROR(!it);
1102 EINA_ITERATOR_FOREACH(it, file)
1103 {
1104 if (!error)
1105 {
1106 if (gnutls_certificate_set_x509_trust_file(svr->cert, file, GNUTLS_X509_FMT_PEM) < 1)
1107 error++;
1108 }
1109 eina_stringshare_del(file);
1110 }
1111 eina_iterator_free(it);
1112 }
1113 else
1114 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_trust_file(svr->cert, ca_file,
1115 GNUTLS_X509_FMT_PEM) < 1);
1116
1117 return !error;
1118error:
1119 ERR("Could not load CA file!");
1120 return EINA_FALSE;
1121}
1122
1123static Eina_Bool
1124_ecore_con_ssl_server_crl_add_gnutls(Ecore_Con_Server *svr,
1125 const char *crl_file)
1126{
1127 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_crl_file(svr->cert, crl_file,
1128 GNUTLS_X509_FMT_PEM) < 1);
1129
1130 return EINA_TRUE;
1131error:
1132 ERR("Could not load CRL file!");
1133 return EINA_FALSE;
1134}
1135
1136static Eina_Bool
1137_ecore_con_ssl_server_privkey_add_gnutls(Ecore_Con_Server *svr,
1138 const char *key_file)
1139{
1140 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_key_file(svr->cert, svr->cert_file, key_file,
1141 GNUTLS_X509_FMT_PEM));
1142
1143 return EINA_TRUE;
1144error:
1145 ERR("Could not load certificate/key file!");
1146 return EINA_FALSE;
1147}
1148
1149static Eina_Bool
1150_ecore_con_ssl_server_cert_add_gnutls(Ecore_Con_Server *svr,
1151 const char *cert_file)
1152{
1153 if (!(svr->cert_file = strdup(cert_file)))
1154 return EINA_FALSE;
1155
1156 return EINA_TRUE;
1157}
1158
1159static Ecore_Con_Ssl_Error
1160_ecore_con_ssl_server_shutdown_gnutls(Ecore_Con_Server *svr)
1161{
1162 if (svr->session)
1163 {
1164 gnutls_bye(svr->session, GNUTLS_SHUT_RDWR);
1165 gnutls_deinit(svr->session);
1166 }
1167
1168 free(svr->cert_file);
1169 svr->cert_file = NULL;
1170 if (svr->cert)
1171 gnutls_certificate_free_credentials(svr->cert);
1172 svr->cert = NULL;
1173
1174 if ((svr->type & ECORE_CON_SSL) && svr->created)
1175 {
1176 if (svr->dh_params)
1177 {
1178 gnutls_dh_params_deinit(svr->dh_params);
1179 svr->dh_params = NULL;
1180 }
1181 if (svr->anoncred_s)
1182 gnutls_anon_free_server_credentials(svr->anoncred_s);
1183 // if (svr->pskcred_s)
1184 // gnutls_psk_free_server_credentials(svr->pskcred_s);
1185
1186 svr->anoncred_s = NULL;
1187 svr->pskcred_s = NULL;
1188 }
1189 else if (svr->type & ECORE_CON_SSL)
1190 {
1191 if (svr->anoncred_c)
1192 gnutls_anon_free_client_credentials(svr->anoncred_c);
1193 // if (svr->pskcred_c)
1194 // gnutls_psk_free_client_credentials(svr->pskcred_c);
1195
1196 svr->anoncred_c = NULL;
1197 svr->pskcred_c = NULL;
1198 }
1199
1200 svr->session = NULL;
1201
1202 return ECORE_CON_SSL_ERROR_NONE;
1203}
1204
1205static int
1206_ecore_con_ssl_server_read_gnutls(Ecore_Con_Server *svr,
1207 unsigned char *buf,
1208 int size)
1209{
1210 int num;
1211
1212 if (svr->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING)
1213 {
1214 DBG("Continuing gnutls handshake");
1215 if (!_ecore_con_ssl_server_init_gnutls(svr))
1216 return 0;
1217 return -1;
1218 }
1219
1220 num = gnutls_record_recv(svr->session, buf, size);
1221 if (num > 0)
1222 return num;
1223
1224 if (num == GNUTLS_E_REHANDSHAKE)
1225 {
1226 WRN("Rehandshake request ignored");
1227 return 0;
1228
1229 svr->handshaking = EINA_TRUE;
1230 svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1231 if (!_ecore_con_ssl_server_init_gnutls(svr))
1232 return 0;
1233 }
1234 else if ((!gnutls_error_is_fatal(num)) && (num != GNUTLS_E_SUCCESS))
1235 return 0;
1236
1237 return -1;
1238}
1239
1240static int
1241_ecore_con_ssl_server_write_gnutls(Ecore_Con_Server *svr,
1242 const unsigned char *buf,
1243 int size)
1244{
1245 int num;
1246
1247 if (svr->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING)
1248 {
1249 DBG("Continuing gnutls handshake");
1250 if (!_ecore_con_ssl_server_init_gnutls(svr))
1251 return 0;
1252 return -1;
1253 }
1254
1255 num = gnutls_record_send(svr->session, buf, size);
1256 if (num > 0)
1257 return num;
1258
1259 if (num == GNUTLS_E_REHANDSHAKE)
1260 {
1261 WRN("Rehandshake request ignored");
1262 return 0;
1263/* this is only partly functional I think? */
1264 svr->handshaking = EINA_TRUE;
1265 svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1266 if (!_ecore_con_ssl_server_init_gnutls(svr))
1267 return 0;
1268 }
1269 else if (!gnutls_error_is_fatal(num))
1270 return 0;
1271
1272 return -1;
1273}
1274
1275static Ecore_Con_Ssl_Error
1276_ecore_con_ssl_client_init_gnutls(Ecore_Con_Client *cl)
1277{
1278 const gnutls_datum_t *cert_list;
1279 unsigned int iter, cert_list_size;
1280 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";
1281 int ret = 0;
1282
1283 switch (cl->ssl_state)
1284 {
1285 case ECORE_CON_SSL_STATE_DONE:
1286 return ECORE_CON_SSL_ERROR_NONE;
1287
1288 case ECORE_CON_SSL_STATE_INIT:
1289 if (cl->host_server->type & ECORE_CON_USE_SSL2) /* not supported because of security issues */
1290 return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
1291
1292 switch (cl->host_server->type & ECORE_CON_SSL)
1293 {
1294 case ECORE_CON_USE_SSL3:
1295 case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT:
1296 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";
1297 break;
1298
1299 case ECORE_CON_USE_TLS:
1300 case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT:
1301 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";
1302 break;
1303
1304 case ECORE_CON_USE_MIXED:
1305 case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT:
1306 break;
1307
1308 default:
1309 return ECORE_CON_SSL_ERROR_NONE;
1310 }
1311
1312 _client_connected++;
1313
1314 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_init(&cl->session, GNUTLS_SERVER));
1315 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_session_ticket_key_generate(&cl->session_ticket));
1316 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_session_ticket_enable_server(cl->session, &cl->session_ticket));
1317 INF("Applying priority string: %s", priority);
1318 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_priority_set_direct(cl->session, priority, NULL));
1319 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(cl->session, GNUTLS_CRD_CERTIFICATE, cl->host_server->cert));
1320 // SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(cl->session, GNUTLS_CRD_PSK, cl->host_server->pskcred_s));
1321 if (!cl->host_server->use_cert)
1322 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(cl->session, GNUTLS_CRD_ANON, cl->host_server->anoncred_s));
1323
1324 gnutls_certificate_server_set_request(cl->session, GNUTLS_CERT_REQUEST);
1325
1326 gnutls_dh_set_prime_bits(cl->session, 2048);
1327 gnutls_transport_set_ptr(cl->session, (gnutls_transport_ptr_t)((intptr_t)cl->fd));
1328 cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1329
1330 case ECORE_CON_SSL_STATE_HANDSHAKING:
1331 if (!cl->session)
1332 {
1333 DBG("Client was previously lost, going to error condition");
1334 goto error;
1335 }
1336 DBG("calling gnutls_handshake()");
1337 ret = gnutls_handshake(cl->session);
1338 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_error_is_fatal(ret));
1339
1340 if (!ret)
1341 {
1342 cl->handshaking = EINA_FALSE;
1343 cl->ssl_state = ECORE_CON_SSL_STATE_DONE;
1344 }
1345 else
1346 {
1347 if (gnutls_record_get_direction(cl->session))
1348 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
1349 else
1350 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
1351 return ECORE_CON_SSL_ERROR_NONE;
1352 }
1353
1354 default:
1355 break;
1356 }
1357
1358 if (!cl->host_server->verify)
1359 /* not verifying certificates, so we're done! */
1360 return ECORE_CON_SSL_ERROR_NONE;
1361 /* use CRL/CA lists to verify */
1362 SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_verify_peers2(cl->session, &iter));
1363 if (iter & GNUTLS_CERT_INVALID)
1364 ERR("The certificate is not trusted.");
1365 else if (iter & GNUTLS_CERT_SIGNER_NOT_FOUND)
1366 ERR("The certificate hasn't got a known issuer.");
1367 else if (iter & GNUTLS_CERT_REVOKED)
1368 ERR("The certificate has been revoked.");
1369 else if (iter & GNUTLS_CERT_EXPIRED)
1370 ERR("The certificate has expired");
1371 else if (iter & GNUTLS_CERT_NOT_ACTIVATED)
1372 ERR("The certificate is not yet activated");
1373
1374 if (iter)
1375 goto error;
1376 if (gnutls_certificate_type_get(cl->session) != GNUTLS_CRT_X509)
1377 {
1378 ERR("Warning: PGP certificates are not yet supported!");
1379 goto error;
1380 }
1381
1382 SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(cl->session, &cert_list_size)));
1383 SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size);
1384
1385 _gnutls_print_session(cert_list, cert_list_size);
1386/*
1387 gnutls_x509_crt_t cert = NULL;
1388 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert));
1389 SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER));
1390
1391 SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, cl->host_server->name));
1392 gnutls_x509_crt_deinit(cert);
1393*/
1394 DBG("SSL certificate verification succeeded!");
1395 return ECORE_CON_SSL_ERROR_NONE;
1396
1397error:
1398 _gnutls_print_errors(cl, ECORE_CON_EVENT_CLIENT_ERROR, ret);
1399 if ((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) || (ret == GNUTLS_E_FATAL_ALERT_RECEIVED))
1400 ERR("Also received alert: %s", gnutls_alert_get_name(gnutls_alert_get(cl->session)));
1401 if (cl->session && (cl->ssl_state != ECORE_CON_SSL_STATE_DONE))
1402 {
1403 ERR("last out: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_out(cl->session)));
1404 ERR("last in: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_in(cl->session)));
1405 }
1406/*
1407 if (cert)
1408 gnutls_x509_crt_deinit(cert);
1409*/
1410 _ecore_con_ssl_client_shutdown_gnutls(cl);
1411 return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
1412}
1413
1414static Ecore_Con_Ssl_Error
1415_ecore_con_ssl_client_shutdown_gnutls(Ecore_Con_Client *cl)
1416{
1417 if (cl->session)
1418 {
1419 gnutls_bye(cl->session, GNUTLS_SHUT_RDWR);
1420 gnutls_deinit(cl->session);
1421 gnutls_free(cl->session_ticket.data);
1422 cl->session_ticket.data = NULL;
1423 }
1424
1425 cl->session = NULL;
1426
1427 return ECORE_CON_SSL_ERROR_NONE;
1428}
1429
1430static int
1431_ecore_con_ssl_client_read_gnutls(Ecore_Con_Client *cl,
1432 unsigned char *buf,
1433 int size)
1434{
1435 int num;
1436
1437 if (cl->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING)
1438 {
1439 if (!_ecore_con_ssl_client_init_gnutls(cl))
1440 return 0;
1441 return -1;
1442 }
1443
1444 num = gnutls_record_recv(cl->session, buf, size);
1445 if (num > 0)
1446 return num;
1447
1448 if (num == GNUTLS_E_REHANDSHAKE)
1449 {
1450 WRN("Rehandshake request ignored");
1451 return 0;
1452 cl->handshaking = EINA_TRUE;
1453 cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1454 if (!_ecore_con_ssl_client_init_gnutls(cl))
1455 return 0;
1456 WRN("Rehandshake request ignored");
1457 return 0;
1458 }
1459 else if ((!gnutls_error_is_fatal(num)) && (num != GNUTLS_E_SUCCESS))
1460 return 0;
1461
1462 return -1;
1463}
1464
1465static int
1466_ecore_con_ssl_client_write_gnutls(Ecore_Con_Client *cl,
1467 const unsigned char *buf,
1468 int size)
1469{
1470 int num;
1471
1472 if (cl->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING)
1473 {
1474 if (!_ecore_con_ssl_client_init_gnutls(cl))
1475 return 0;
1476 return -1;
1477 }
1478
1479 num = gnutls_record_send(cl->session, buf, size);
1480 if (num > 0)
1481 return num;
1482
1483 if (num == GNUTLS_E_REHANDSHAKE)
1484 {
1485 WRN("Rehandshake request ignored");
1486 return 0;
1487 cl->handshaking = EINA_TRUE;
1488 cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1489 if (!_ecore_con_ssl_client_init_gnutls(cl))
1490 return 0;
1491 }
1492 else if (!gnutls_error_is_fatal(num))
1493 return 0;
1494
1495 return -1;
1496}
1497
1498#elif USE_OPENSSL && !USE_GNUTLS
1499
1500/*
1501 * OpenSSL
1502 */
1503
1504static Ecore_Con_Ssl_Error
1505_ecore_con_ssl_init_openssl(void)
1506{
1507 SSL_library_init();
1508 SSL_load_error_strings();
1509 OpenSSL_add_all_algorithms();
1510
1511 return ECORE_CON_SSL_ERROR_NONE;
1512}
1513
1514static Ecore_Con_Ssl_Error
1515_ecore_con_ssl_shutdown_openssl(void)
1516{
1517 ERR_free_strings();
1518 EVP_cleanup();
1519 return ECORE_CON_SSL_ERROR_NONE;
1520}
1521
1522static Ecore_Con_Ssl_Error
1523_ecore_con_ssl_server_prepare_openssl(Ecore_Con_Server *svr,
1524 int ssl_type)
1525{
1526 long options;
1527 int dh = 0;
1528
1529 if (ssl_type & ECORE_CON_USE_SSL2)
1530 return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
1531
1532 switch (ssl_type)
1533 {
1534 case ECORE_CON_USE_SSL3:
1535 case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT:
1536 if (!svr->created)
1537 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv3_client_method())));
1538 else
1539 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv3_server_method())));
1540 break;
1541
1542 case ECORE_CON_USE_TLS:
1543 case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT:
1544 if (!svr->created)
1545 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(TLSv1_client_method())));
1546 else
1547 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(TLSv1_server_method())));
1548 break;
1549
1550 case ECORE_CON_USE_MIXED:
1551 case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT:
1552 if (!svr->created)
1553 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv23_client_method())));
1554 else
1555 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv23_server_method())));
1556 options = SSL_CTX_get_options(svr->ssl_ctx);
1557 SSL_CTX_set_options(svr->ssl_ctx, options | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
1558 break;
1559
1560 default:
1561 return ECORE_CON_SSL_ERROR_NONE;
1562 }
1563
1564 if ((!svr->use_cert) && svr->created)
1565 {
1566 DH *dh_params;
1567 INF("Generating DH params");
1568 SSL_ERROR_CHECK_GOTO_ERROR(!(dh_params = DH_new()));
1569 SSL_ERROR_CHECK_GOTO_ERROR(!DH_generate_parameters_ex(dh_params, 1024, DH_GENERATOR_5, NULL));
1570 SSL_ERROR_CHECK_GOTO_ERROR(!DH_check(dh_params, &dh));
1571 SSL_ERROR_CHECK_GOTO_ERROR((dh & DH_CHECK_P_NOT_PRIME) || (dh & DH_CHECK_P_NOT_SAFE_PRIME));
1572 SSL_ERROR_CHECK_GOTO_ERROR(!DH_generate_key(dh_params));
1573 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_set_tmp_dh(svr->ssl_ctx, dh_params));
1574 DH_free(dh_params);
1575 INF("DH params successfully generated and applied!");
1576 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_set_cipher_list(svr->ssl_ctx, "aNULL:!eNULL:!LOW:!EXPORT:@STRENGTH"));
1577 }
1578 else if (!svr->use_cert)
1579 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_set_cipher_list(svr->ssl_ctx, "aNULL:!eNULL:!LOW:!EXPORT:!ECDH:RSA:AES:!PSK:@STRENGTH"));
1580
1581 return ECORE_CON_SSL_ERROR_NONE;
1582
1583error:
1584 if (dh)
1585 {
1586 if (dh & DH_CHECK_P_NOT_PRIME)
1587 ERR("openssl error: dh_params could not generate a prime!");
1588 else
1589 ERR("openssl error: dh_params could not generate a safe prime!");
1590 }
1591 else
1592 _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR);
1593 _ecore_con_ssl_server_shutdown_openssl(svr);
1594 return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
1595}
1596
1597static Ecore_Con_Ssl_Error
1598_ecore_con_ssl_server_init_openssl(Ecore_Con_Server *svr)
1599{
1600 int ret = -1;
1601
1602 switch (svr->ssl_state)
1603 {
1604 case ECORE_CON_SSL_STATE_DONE:
1605 return ECORE_CON_SSL_ERROR_NONE;
1606
1607 case ECORE_CON_SSL_STATE_INIT:
1608 SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl = SSL_new(svr->ssl_ctx)));
1609
1610 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_set_fd(svr->ssl, svr->fd));
1611 SSL_set_connect_state(svr->ssl);
1612 svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1613
1614 case ECORE_CON_SSL_STATE_HANDSHAKING:
1615 if (!svr->ssl)
1616 {
1617 DBG("Server was previously lost, going to error condition");
1618 goto error;
1619 }
1620 ret = SSL_do_handshake(svr->ssl);
1621 svr->ssl_err = SSL_get_error(svr->ssl, ret);
1622 SSL_ERROR_CHECK_GOTO_ERROR((svr->ssl_err == SSL_ERROR_SYSCALL) || (svr->ssl_err == SSL_ERROR_SSL));
1623
1624 if (ret == 1)
1625 {
1626 svr->handshaking = EINA_FALSE;
1627 svr->ssl_state = ECORE_CON_SSL_STATE_DONE;
1628 }
1629 else
1630 {
1631 if (svr->ssl_err == SSL_ERROR_WANT_READ)
1632 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
1633 else if (svr->ssl_err == SSL_ERROR_WANT_WRITE)
1634 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
1635 return ECORE_CON_SSL_ERROR_NONE;
1636 }
1637
1638 default:
1639 break;
1640 }
1641
1642 _openssl_print_session(svr->ssl);
1643 if ((!svr->verify) && (!svr->verify_basic))
1644 /* not verifying certificates, so we're done! */
1645 return ECORE_CON_SSL_ERROR_NONE;
1646
1647 {
1648 X509 *cert;
1649 SSL_set_verify(svr->ssl, SSL_VERIFY_PEER, NULL);
1650 /* use CRL/CA lists to verify */
1651 cert = SSL_get_peer_certificate(svr->ssl);
1652 if (cert)
1653 {
1654 char *c;
1655 int clen;
1656 int name = 0;
1657
1658 if (svr->verify)
1659 {
1660 int err;
1661
1662 err = SSL_get_verify_result(svr->ssl);
1663 _openssl_print_verify_error(err);
1664 SSL_ERROR_CHECK_GOTO_ERROR(err);
1665 }
1666 clen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_subject_alt_name, NULL, 0);
1667 if (clen > 0)
1668 name = NID_subject_alt_name;
1669 else
1670 clen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, NULL, 0);
1671 SSL_ERROR_CHECK_GOTO_ERROR(clen < 1);
1672 if (!name) name = NID_commonName;
1673 c = alloca(++clen);
1674 X509_NAME_get_text_by_NID(X509_get_subject_name(cert), name, c, clen);
1675 INF("CERT NAME: %s\n", c);
1676 SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(c, svr->verify_name ?: svr->name));
1677 }
1678 }
1679
1680 DBG("SSL certificate verification succeeded!");
1681
1682 return ECORE_CON_SSL_ERROR_NONE;
1683
1684error:
1685 _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR);
1686 _ecore_con_ssl_server_shutdown_openssl(svr);
1687 return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
1688}
1689
1690static Eina_Bool
1691_ecore_con_ssl_server_cafile_add_openssl(Ecore_Con_Server *svr,
1692 const char *ca_file)
1693{
1694 struct stat st;
1695
1696 if (stat(ca_file, &st)) return EINA_FALSE;
1697 if (S_ISDIR(st.st_mode))
1698 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, NULL, ca_file));
1699 else
1700 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, ca_file, NULL));
1701 return EINA_TRUE;
1702
1703error:
1704 _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR);
1705 return EINA_FALSE;
1706}
1707
1708static Eina_Bool
1709_ecore_con_ssl_server_crl_add_openssl(Ecore_Con_Server *svr,
1710 const char *crl_file)
1711{
1712 X509_STORE *st;
1713 X509_LOOKUP *lu;
1714 static Eina_Bool flag = EINA_FALSE;
1715
1716 SSL_ERROR_CHECK_GOTO_ERROR(!(st = SSL_CTX_get_cert_store(svr->ssl_ctx)));
1717 SSL_ERROR_CHECK_GOTO_ERROR(!(lu = X509_STORE_add_lookup(st, X509_LOOKUP_file())));
1718 SSL_ERROR_CHECK_GOTO_ERROR(X509_load_crl_file(lu, crl_file, X509_FILETYPE_PEM) < 1);
1719 if (!flag)
1720 {
1721 X509_STORE_set_flags(st, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
1722 flag = EINA_TRUE;
1723 }
1724
1725 return EINA_TRUE;
1726
1727error:
1728 _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR);
1729 return EINA_FALSE;
1730}
1731
1732static Eina_Bool
1733_ecore_con_ssl_server_privkey_add_openssl(Ecore_Con_Server *svr,
1734 const char *key_file)
1735{
1736 FILE *fp = NULL;
1737 EVP_PKEY *privkey = NULL;
1738
1739 if (!(fp = fopen(key_file, "r")))
1740 goto error;
1741
1742 SSL_ERROR_CHECK_GOTO_ERROR(!(privkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL)));
1743
1744 fclose(fp);
1745 SSL_ERROR_CHECK_GOTO_ERROR(SSL_CTX_use_PrivateKey(svr->ssl_ctx, privkey) < 1);
1746 SSL_ERROR_CHECK_GOTO_ERROR(SSL_CTX_check_private_key(svr->ssl_ctx) < 1);
1747
1748 return EINA_TRUE;
1749
1750error:
1751 if (fp)
1752 fclose(fp);
1753 _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR);
1754 return EINA_FALSE;
1755}
1756
1757static Eina_Bool
1758_ecore_con_ssl_server_cert_add_openssl(Ecore_Con_Server *svr,
1759 const char *cert_file)
1760{
1761 FILE *fp = NULL;
1762 X509 *cert = NULL;
1763
1764 if (!(fp = fopen(cert_file, "r")))
1765 goto error;
1766
1767 SSL_ERROR_CHECK_GOTO_ERROR(!(cert = PEM_read_X509(fp, NULL, NULL, NULL)));
1768
1769 fclose(fp);
1770
1771 SSL_ERROR_CHECK_GOTO_ERROR(SSL_CTX_use_certificate(svr->ssl_ctx, cert) < 1);
1772
1773 return EINA_TRUE;
1774
1775error:
1776 if (fp)
1777 fclose(fp);
1778 _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR);
1779 return EINA_FALSE;
1780}
1781
1782static Ecore_Con_Ssl_Error
1783_ecore_con_ssl_server_shutdown_openssl(Ecore_Con_Server *svr)
1784{
1785 if (svr->ssl)
1786 {
1787 if (!SSL_shutdown(svr->ssl))
1788 SSL_shutdown(svr->ssl);
1789
1790 SSL_free(svr->ssl);
1791 }
1792
1793 if (svr->ssl_ctx)
1794 SSL_CTX_free(svr->ssl_ctx);
1795
1796 svr->ssl = NULL;
1797 svr->ssl_ctx = NULL;
1798 svr->ssl_err = SSL_ERROR_NONE;
1799
1800 return ECORE_CON_SSL_ERROR_NONE;
1801}
1802
1803static int
1804_ecore_con_ssl_server_read_openssl(Ecore_Con_Server *svr,
1805 unsigned char *buf,
1806 int size)
1807{
1808 int num;
1809
1810 if (!svr->ssl) return -1;
1811 num = SSL_read(svr->ssl, buf, size);
1812 svr->ssl_err = SSL_get_error(svr->ssl, num);
1813
1814 if (svr->fd_handler)
1815 {
1816 if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_READ)
1817 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
1818 else if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_WRITE)
1819 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
1820 }
1821
1822 if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) ||
1823 (svr->ssl_err == SSL_ERROR_SYSCALL) ||
1824 (svr->ssl_err == SSL_ERROR_SSL))
1825 return -1;
1826
1827 if (num < 0)
1828 return 0;
1829
1830 return num;
1831}
1832
1833static int
1834_ecore_con_ssl_server_write_openssl(Ecore_Con_Server *svr,
1835 const unsigned char *buf,
1836 int size)
1837{
1838 int num;
1839
1840 num = SSL_write(svr->ssl, buf, size);
1841 svr->ssl_err = SSL_get_error(svr->ssl, num);
1842
1843 if (svr->fd_handler)
1844 {
1845 if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_READ)
1846 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
1847 else if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_WRITE)
1848 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
1849 }
1850
1851 if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) ||
1852 (svr->ssl_err == SSL_ERROR_SYSCALL) ||
1853 (svr->ssl_err == SSL_ERROR_SSL))
1854 return -1;
1855
1856 if (num < 0)
1857 return 0;
1858
1859 return num;
1860}
1861
1862static Ecore_Con_Ssl_Error
1863_ecore_con_ssl_client_init_openssl(Ecore_Con_Client *cl)
1864{
1865 int ret = -1;
1866 switch (cl->ssl_state)
1867 {
1868 case ECORE_CON_SSL_STATE_DONE:
1869 return ECORE_CON_SSL_ERROR_NONE;
1870
1871 case ECORE_CON_SSL_STATE_INIT:
1872 SSL_ERROR_CHECK_GOTO_ERROR(!(cl->ssl = SSL_new(cl->host_server->ssl_ctx)));
1873
1874 SSL_ERROR_CHECK_GOTO_ERROR(!SSL_set_fd(cl->ssl, cl->fd));
1875 SSL_set_accept_state(cl->ssl);
1876 cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING;
1877
1878 case ECORE_CON_SSL_STATE_HANDSHAKING:
1879 if (!cl->ssl)
1880 {
1881 DBG("Client was previously lost, going to error condition");
1882 goto error;
1883 }
1884 ret = SSL_do_handshake(cl->ssl);
1885 cl->ssl_err = SSL_get_error(cl->ssl, ret);
1886 SSL_ERROR_CHECK_GOTO_ERROR((cl->ssl_err == SSL_ERROR_SYSCALL) || (cl->ssl_err == SSL_ERROR_SSL));
1887 if (ret == 1)
1888 {
1889 cl->handshaking = EINA_FALSE;
1890 cl->ssl_state = ECORE_CON_SSL_STATE_DONE;
1891 }
1892 else
1893 {
1894 if (cl->ssl_err == SSL_ERROR_WANT_READ)
1895 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
1896 else if (cl->ssl_err == SSL_ERROR_WANT_WRITE)
1897 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
1898 return ECORE_CON_SSL_ERROR_NONE;
1899 }
1900
1901 default:
1902 break;
1903 }
1904
1905 _openssl_print_session(cl->ssl);
1906 if (!cl->host_server->verify)
1907 /* not verifying certificates, so we're done! */
1908 return ECORE_CON_SSL_ERROR_NONE;
1909 SSL_set_verify(cl->ssl, SSL_VERIFY_PEER, NULL);
1910 /* use CRL/CA lists to verify */
1911 if (SSL_get_peer_certificate(cl->ssl))
1912 {
1913 int err;
1914
1915 err = SSL_get_verify_result(cl->ssl);
1916 _openssl_print_verify_error(err);
1917 SSL_ERROR_CHECK_GOTO_ERROR(err);
1918 }
1919
1920 return ECORE_CON_SSL_ERROR_NONE;
1921
1922error:
1923 _openssl_print_errors(cl, ECORE_CON_EVENT_CLIENT_ERROR);
1924 _ecore_con_ssl_client_shutdown_openssl(cl);
1925 return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
1926}
1927
1928static Ecore_Con_Ssl_Error
1929_ecore_con_ssl_client_shutdown_openssl(Ecore_Con_Client *cl)
1930{
1931 if (cl->ssl)
1932 {
1933 if (!SSL_shutdown(cl->ssl))
1934 SSL_shutdown(cl->ssl);
1935
1936 SSL_free(cl->ssl);
1937 }
1938
1939 cl->ssl = NULL;
1940 cl->ssl_err = SSL_ERROR_NONE;
1941
1942 return ECORE_CON_SSL_ERROR_NONE;
1943}
1944
1945static int
1946_ecore_con_ssl_client_read_openssl(Ecore_Con_Client *cl,
1947 unsigned char *buf,
1948 int size)
1949{
1950 int num;
1951
1952 if (!cl->ssl) return -1;
1953 num = SSL_read(cl->ssl, buf, size);
1954 cl->ssl_err = SSL_get_error(cl->ssl, num);
1955
1956 if (cl->fd_handler)
1957 {
1958 if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_READ)
1959 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
1960 else if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_WRITE)
1961 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
1962 }
1963
1964 if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) ||
1965 (cl->ssl_err == SSL_ERROR_SYSCALL) ||
1966 (cl->ssl_err == SSL_ERROR_SSL))
1967 return -1;
1968
1969 if (num < 0)
1970 return 0;
1971
1972 return num;
1973}
1974
1975static int
1976_ecore_con_ssl_client_write_openssl(Ecore_Con_Client *cl,
1977 const unsigned char *buf,
1978 int size)
1979{
1980 int num;
1981
1982 num = SSL_write(cl->ssl, buf, size);
1983 cl->ssl_err = SSL_get_error(cl->ssl, num);
1984
1985 if (cl->fd_handler)
1986 {
1987 if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_READ)
1988 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
1989 else if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_WRITE)
1990 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
1991 }
1992
1993 if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) ||
1994 (cl->ssl_err == SSL_ERROR_SYSCALL) ||
1995 (cl->ssl_err == SSL_ERROR_SSL))
1996 return -1;
1997
1998 if (num < 0)
1999 return 0;
2000
2001 return num;
2002}
2003
2004#else
2005
2006/*
2007 * No Ssl
2008 */
2009
2010static Ecore_Con_Ssl_Error
2011_ecore_con_ssl_init_none(void)
2012{
2013 return ECORE_CON_SSL_ERROR_NONE;
2014}
2015
2016static Ecore_Con_Ssl_Error
2017_ecore_con_ssl_shutdown_none(void)
2018{
2019 return ECORE_CON_SSL_ERROR_NONE;
2020}
2021
2022static Ecore_Con_Ssl_Error
2023_ecore_con_ssl_server_prepare_none(Ecore_Con_Server *svr __UNUSED__,
2024 int ssl_type __UNUSED__)
2025{
2026 return ECORE_CON_SSL_ERROR_NONE;
2027}
2028
2029static Ecore_Con_Ssl_Error
2030_ecore_con_ssl_server_init_none(Ecore_Con_Server *svr __UNUSED__)
2031{
2032 return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
2033}
2034
2035static Eina_Bool
2036_ecore_con_ssl_server_cafile_add_none(Ecore_Con_Server *svr __UNUSED__,
2037 const char *ca_file __UNUSED__)
2038{
2039 return EINA_FALSE;
2040}
2041
2042static Eina_Bool
2043_ecore_con_ssl_server_cert_add_none(Ecore_Con_Server *svr __UNUSED__,
2044 const char *cert_file __UNUSED__)
2045{
2046 return EINA_FALSE;
2047}
2048
2049static Eina_Bool
2050_ecore_con_ssl_server_privkey_add_none(Ecore_Con_Server *svr __UNUSED__,
2051 const char *key_file __UNUSED__)
2052{
2053 return EINA_FALSE;
2054}
2055
2056static Eina_Bool
2057_ecore_con_ssl_server_crl_add_none(Ecore_Con_Server *svr __UNUSED__,
2058 const char *crl_file __UNUSED__)
2059{
2060 return EINA_FALSE;
2061}
2062
2063static Ecore_Con_Ssl_Error
2064_ecore_con_ssl_server_shutdown_none(Ecore_Con_Server *svr __UNUSED__)
2065{
2066 return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
2067}
2068
2069static int
2070_ecore_con_ssl_server_read_none(Ecore_Con_Server *svr __UNUSED__,
2071 unsigned char *buf __UNUSED__,
2072 int size __UNUSED__)
2073{
2074 return -1;
2075}
2076
2077static int
2078_ecore_con_ssl_server_write_none(Ecore_Con_Server *svr __UNUSED__,
2079 const unsigned char *buf __UNUSED__,
2080 int size __UNUSED__)
2081{
2082 return -1;
2083}
2084
2085static Ecore_Con_Ssl_Error
2086_ecore_con_ssl_client_init_none(Ecore_Con_Client *cl __UNUSED__)
2087{
2088 return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
2089}
2090
2091static Ecore_Con_Ssl_Error
2092_ecore_con_ssl_client_shutdown_none(Ecore_Con_Client *cl __UNUSED__)
2093{
2094 return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
2095}
2096
2097static int
2098_ecore_con_ssl_client_read_none(Ecore_Con_Client *cl __UNUSED__,
2099 unsigned char *buf __UNUSED__,
2100 int size __UNUSED__)
2101{
2102 return -1;
2103}
2104
2105static int
2106_ecore_con_ssl_client_write_none(Ecore_Con_Client *cl __UNUSED__,
2107 const unsigned char *buf __UNUSED__,
2108 int size __UNUSED__)
2109{
2110 return -1;
2111}
2112
2113#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
deleted file mode 100644
index 05f0678..0000000
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_url.c
+++ /dev/null
@@ -1,1635 +0,0 @@
1/*
2 * For info on how to use libcurl, see:
3 * http://curl.haxx.se/libcurl/c/libcurl-tutorial.html
4 */
5
6/*
7 * FIXME: Support more CURL features...
8 */
9
10#ifdef HAVE_CONFIG_H
11# include <config.h>
12#endif
13
14#include <string.h>
15#include <errno.h>
16#include <sys/stat.h>
17#include <sys/types.h>
18#include <unistd.h>
19
20#ifdef HAVE_WS2TCPIP_H
21# include <ws2tcpip.h>
22#endif
23
24#ifdef HAVE_ESCAPE
25# include <Escape.h>
26#endif
27
28#include "Ecore.h"
29#include "ecore_private.h"
30#include "Ecore_Con.h"
31#include "ecore_con_private.h"
32
33#define CURL_MIN_TIMEOUT 100
34
35int ECORE_CON_EVENT_URL_DATA = 0;
36int ECORE_CON_EVENT_URL_COMPLETE = 0;
37int ECORE_CON_EVENT_URL_PROGRESS = 0;
38
39#ifdef HAVE_CURL
40static void _ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg);
41static void _ecore_con_url_multi_remove(Ecore_Con_Url *url_con);
42static Eina_Bool _ecore_con_url_perform(Ecore_Con_Url *url_con);
43static size_t _ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream);
44static size_t _ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp);
45static int _ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
46static size_t _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream);
47static void _ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev);
48static Eina_Bool _ecore_con_url_timer(void *data);
49static Eina_Bool _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
50static Eina_Bool _ecore_con_url_timeout_cb(void *data);
51static void _ecore_con_url_status_get(Ecore_Con_Url *url_con);
52
53static Eina_List *_url_con_list = NULL;
54static Eina_List *_fd_hd_list = NULL;
55static CURLM *_curlm = NULL;
56static int _init_count = 0;
57static Ecore_Timer *_curl_timer = NULL;
58static Eina_Bool pipelining = EINA_FALSE;
59
60#endif
61
62/**
63 * @addtogroup Ecore_Con_Url_Group Ecore URL Connection Functions
64 *
65 * @{
66 */
67
68EAPI int
69ecore_con_url_init(void)
70{
71#ifdef HAVE_CURL
72 long ms;
73 if (++_init_count > 1) return _init_count;
74
75 ECORE_CON_EVENT_URL_DATA = ecore_event_type_new();
76 ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new();
77 ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new();
78
79 // curl_global_init() is not thread safe!
80 if (curl_global_init(CURL_GLOBAL_ALL)) return --_init_count;
81
82 _curlm = curl_multi_init();
83 if (!_curlm)
84 {
85 curl_global_cleanup();
86 return --_init_count;
87 }
88
89 curl_multi_timeout(_curlm, &ms);
90 if (ms >= CURL_MIN_TIMEOUT || ms <= 0) ms = CURL_MIN_TIMEOUT;
91
92 _curl_timer = ecore_timer_add((double)ms / 1000, _ecore_con_url_timer, NULL);
93 ecore_timer_freeze(_curl_timer);
94
95 return _init_count;
96#else
97 return 0;
98#endif
99}
100
101EAPI int
102ecore_con_url_shutdown(void)
103{
104#ifdef HAVE_CURL
105 Ecore_Con_Url *url_con;
106 Ecore_Fd_Handler *fd_handler;
107 if (_init_count == 0) return 0;
108 --_init_count;
109 if (_init_count) return _init_count;
110
111 if (_curl_timer)
112 {
113 ecore_timer_del(_curl_timer);
114 _curl_timer = NULL;
115 }
116
117 EINA_LIST_FREE(_url_con_list, url_con)
118 ecore_con_url_free(url_con);
119 EINA_LIST_FREE(_fd_hd_list, fd_handler)
120 ecore_main_fd_handler_del(fd_handler);
121
122 if (_curlm)
123 {
124 curl_multi_cleanup(_curlm);
125 _curlm = NULL;
126 }
127 curl_global_cleanup();
128 return 0;
129#endif
130 return 1;
131}
132
133EAPI void
134ecore_con_url_pipeline_set(Eina_Bool enable)
135{
136#ifdef HAVE_CURL
137 if (enable == pipelining) return;
138 curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, !!enable);
139 pipelining = enable;
140#else
141 return;
142 (void)enable;
143#endif
144}
145
146EAPI Eina_Bool
147ecore_con_url_pipeline_get(void)
148{
149#ifdef HAVE_CURL
150 return pipelining;
151#endif
152 return EINA_FALSE;
153}
154
155extern Ecore_Con_Socks *_ecore_con_proxy_global;
156
157EAPI Ecore_Con_Url *
158ecore_con_url_new(const char *url)
159{
160#ifdef HAVE_CURL
161 Ecore_Con_Url *url_con;
162 CURLcode ret;
163
164 if (!_init_count)
165 return NULL;
166
167 url_con = calloc(1, sizeof(Ecore_Con_Url));
168 if (!url_con)
169 return NULL;
170
171 url_con->write_fd = -1;
172
173 url_con->curl_easy = curl_easy_init();
174 if (!url_con->curl_easy)
175 {
176 free(url_con);
177 return NULL;
178 }
179
180 ECORE_MAGIC_SET(url_con, ECORE_MAGIC_CON_URL);
181
182 if (!ecore_con_url_url_set(url_con, url))
183 {
184 ecore_con_url_free(url_con);
185 return NULL;
186 }
187
188 // Read socks proxy
189 url_con->proxy_type = -1;
190 if (_ecore_con_proxy_global && _ecore_con_proxy_global->ip &&
191 (_ecore_con_proxy_global->version == 4 ||
192 _ecore_con_proxy_global->version == 5))
193 {
194 char proxy[256];
195 char host[256];
196
197 if (_ecore_con_proxy_global->version == 5)
198 {
199 if (_ecore_con_proxy_global->lookup)
200 snprintf(host, sizeof(host), "socks5h://%s",
201 _ecore_con_proxy_global->ip);
202 else snprintf(host, sizeof(host), "socks5://%s",
203 _ecore_con_proxy_global->ip);
204 }
205 else if (_ecore_con_proxy_global->version == 4)
206 {
207 if (_ecore_con_proxy_global->lookup)
208 snprintf(host, sizeof(host), "socks4a://%s",
209 _ecore_con_proxy_global->ip);
210 else snprintf(host, sizeof(host), "socks4://%s",
211 _ecore_con_proxy_global->ip);
212 }
213
214 if (_ecore_con_proxy_global->port > 0 &&
215 _ecore_con_proxy_global->port <= 65535)
216 snprintf(proxy, sizeof(proxy), "%s:%d", host,
217 _ecore_con_proxy_global->port);
218 else snprintf(proxy, sizeof(proxy), "%s", host);
219
220 ecore_con_url_proxy_set(url_con, proxy);
221 ecore_con_url_proxy_username_set(url_con,
222 _ecore_con_proxy_global->username);
223 }
224
225 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate");
226 if (ret != CURLE_OK)
227 {
228 ERR("Could not set CURLOPT_ENCODING to \"gzip,deflate\": %s",
229 curl_easy_strerror(ret));
230 ecore_con_url_free(url_con);
231 return NULL;
232 }
233
234 curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEFUNCTION,
235 _ecore_con_url_data_cb);
236 curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEDATA, url_con);
237
238 curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION,
239 _ecore_con_url_progress_cb);
240 curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSDATA, url_con);
241 curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_FALSE);
242
243 curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERFUNCTION,
244 _ecore_con_url_header_cb);
245 curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERDATA, url_con);
246
247 /*
248 * FIXME: Check that these timeouts are sensible defaults
249 * FIXME: Provide a means to change these timeouts
250 */
251 curl_easy_setopt(url_con->curl_easy, CURLOPT_CONNECTTIMEOUT, 30);
252 curl_easy_setopt(url_con->curl_easy, CURLOPT_FOLLOWLOCATION, 1);
253
254 return url_con;
255#else
256 return NULL;
257 url = NULL;
258#endif
259}
260
261EAPI Ecore_Con_Url *
262ecore_con_url_custom_new(const char *url,
263 const char *custom_request)
264{
265#ifdef HAVE_CURL
266 Ecore_Con_Url *url_con;
267 CURLcode ret;
268
269 if (!url)
270 return NULL;
271
272 if (!custom_request)
273 return NULL;
274
275 url_con = ecore_con_url_new(url);
276
277 if (!url_con)
278 return NULL;
279
280 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_CUSTOMREQUEST, custom_request);
281 if (ret != CURLE_OK)
282 {
283 ERR("Could not set a custom request string: %s",
284 curl_easy_strerror(ret));
285 ecore_con_url_free(url_con);
286 return NULL;
287 }
288
289 return url_con;
290#else
291 return NULL;
292 url = NULL;
293 custom_request = NULL;
294#endif
295}
296
297EAPI void
298ecore_con_url_free(Ecore_Con_Url *url_con)
299{
300#ifdef HAVE_CURL
301 char *s;
302
303 if (!url_con) return;
304
305 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
306 {
307 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_free");
308 return;
309 }
310
311 if (url_con->curl_easy)
312 {
313 // FIXME : How can we delete curl_easy's fds ?? (Curl do not give this info.)
314 // This cause "Failed to delete epoll fd xx!" error messages
315 curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL);
316 curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_TRUE);
317
318 if (url_con->multi)
319 {
320 _ecore_con_url_multi_remove(url_con);
321 _url_con_list = eina_list_remove(_url_con_list, url_con);
322 }
323
324 curl_easy_cleanup(url_con->curl_easy);
325 }
326 if (url_con->timer) ecore_timer_del(url_con->timer);
327
328 url_con->curl_easy = NULL;
329 url_con->timer = NULL;
330 url_con->dead = EINA_TRUE;
331 if (url_con->event_count) return;
332 ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
333
334 curl_slist_free_all(url_con->headers);
335 EINA_LIST_FREE(url_con->additional_headers, s)
336 free(s);
337 EINA_LIST_FREE(url_con->response_headers, s)
338 free(s);
339 eina_stringshare_del(url_con->url);
340 if (url_con->post_data) free(url_con->post_data);
341 free(url_con);
342#else
343 return;
344 (void)url_con;
345#endif
346}
347
348EAPI const char *
349ecore_con_url_url_get(Ecore_Con_Url *url_con)
350{
351#ifdef HAVE_CURL
352 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
353 {
354 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
355 return NULL;
356 }
357 return url_con->url;
358#else
359 return NULL;
360 (void)url_con;
361#endif
362}
363
364EAPI int
365ecore_con_url_status_code_get(Ecore_Con_Url *url_con)
366{
367#ifdef HAVE_CURL
368 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
369 {
370 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
371 return 0;
372 }
373
374 if (url_con->status) return url_con->status;
375 _ecore_con_url_status_get(url_con);
376 return url_con->status;
377#else
378 return -1;
379 (void)url_con;
380#endif
381}
382
383EAPI Eina_Bool
384ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
385{
386#ifdef HAVE_CURL
387 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
388 {
389 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_url_set");
390 return EINA_FALSE;
391 }
392
393 if (url_con->dead) return EINA_FALSE;
394 eina_stringshare_replace(&url_con->url, url);
395
396 if (url_con->url)
397 curl_easy_setopt(url_con->curl_easy, CURLOPT_URL,
398 url_con->url);
399 else
400 curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, "");
401
402 return EINA_TRUE;
403#else
404 return EINA_FALSE;
405 (void)url;
406 (void)url_con;
407#endif
408}
409
410EAPI void
411ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data)
412{
413#ifdef HAVE_CURL
414 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
415 {
416 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_set");
417 return;
418 }
419
420 url_con->data = data;
421#else
422 return;
423 url_con = NULL;
424 data = NULL;
425#endif
426}
427
428EAPI void
429ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key, const char *value)
430{
431#ifdef HAVE_CURL
432 char *tmp;
433
434 if (url_con->dead) return;
435 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
436 {
437 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
438 "ecore_con_url_additional_header_add");
439 return;
440 }
441
442 if (url_con->dead) return;
443 tmp = malloc(strlen(key) + strlen(value) + 3);
444 if (!tmp)
445 return;
446
447 sprintf(tmp, "%s: %s", key, value);
448 url_con->additional_headers = eina_list_append(url_con->additional_headers,
449 tmp);
450#else
451 return;
452 url_con = NULL;
453 key = NULL;
454 value = NULL;
455#endif
456}
457
458EAPI void
459ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con)
460{
461#ifdef HAVE_CURL
462 char *s;
463
464 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
465 {
466 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
467 "ecore_con_url_additional_headers_clear");
468 return;
469 }
470
471 EINA_LIST_FREE(url_con->additional_headers, s)
472 free(s);
473#else
474 return;
475 url_con = NULL;
476#endif
477}
478
479EAPI void *
480ecore_con_url_data_get(Ecore_Con_Url *url_con)
481{
482#ifdef HAVE_CURL
483 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
484 {
485 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_get");
486 return NULL;
487 }
488
489 return url_con->data;
490#else
491 return NULL;
492 url_con = NULL;
493#endif
494}
495
496EAPI void
497ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, double timestamp)
498{
499#ifdef HAVE_CURL
500 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
501 {
502 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_time");
503 return;
504 }
505
506 if (url_con->dead) return;
507 url_con->time_condition = condition;
508 url_con->timestamp = timestamp;
509#else
510 return;
511 (void)url_con;
512 (void)condition;
513 (void)timestamp;
514#endif
515}
516
517EAPI void
518ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd)
519{
520#ifdef HAVE_CURL
521 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
522 {
523 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_set");
524 return;
525 }
526
527 if (url_con->dead) return;
528 url_con->write_fd = fd;
529#else
530 return;
531 (void)url_con;
532 (void)fd;
533#endif
534}
535
536EAPI int
537ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con)
538{
539#ifdef HAVE_CURL
540 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
541 {
542 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
543 "ecore_con_url_received_bytes_get");
544 return -1;
545 }
546
547 return url_con->received;
548#else
549 return 0;
550 (void)url_con;
551#endif
552}
553
554EAPI const Eina_List *
555ecore_con_url_response_headers_get(Ecore_Con_Url *url_con)
556{
557#ifdef HAVE_CURL
558 return url_con->response_headers;
559#else
560 return NULL;
561 (void)url_con;
562#endif
563}
564
565EAPI Eina_Bool
566ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
567{
568#ifdef HAVE_CURL
569 CURLcode ret;
570
571 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
572 {
573 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
574 "ecore_con_url_httpauth_set");
575 return EINA_FALSE;
576 }
577
578 if (url_con->dead) return EINA_FALSE;
579# if LIBCURL_VERSION_NUM >= 0x071301
580 if ((username) && (password))
581 {
582 if (safe)
583 curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH,
584 CURLAUTH_ANYSAFE);
585 else
586 curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
587
588 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username);
589 if (ret != CURLE_OK)
590 {
591 ERR("Could not set username for HTTP authentication: %s",
592 curl_easy_strerror(ret));
593 return EINA_FALSE;
594 }
595
596 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
597 if (ret != CURLE_OK)
598 {
599 ERR("Could not set password for HTTP authentication: %s",
600 curl_easy_strerror(ret));
601 return EINA_FALSE;
602 }
603
604 return EINA_TRUE;
605 }
606# endif
607#else
608 return EINA_FALSE;
609 (void)url_con;
610 (void)username;
611 (void)password;
612 (void)safe;
613#endif
614
615 return EINA_FALSE;
616}
617
618#define MODE_AUTO 0
619#define MODE_GET 1
620#define MODE_POST 2
621
622static Eina_Bool
623_ecore_con_url_send(Ecore_Con_Url *url_con, int mode, const void *data, long length, const char *content_type)
624{
625#ifdef HAVE_CURL
626 Eina_List *l;
627 const char *s;
628 char tmp[512];
629
630 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
631 {
632 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_send");
633 return EINA_FALSE;
634 }
635
636 if (!url_con->url) return EINA_FALSE;
637 if (url_con->dead) return EINA_FALSE;
638
639 /* Free response headers from previous send() calls */
640 EINA_LIST_FREE(url_con->response_headers, s)
641 free((char *)s);
642 url_con->response_headers = NULL;
643 url_con->status = 0;
644
645 curl_slist_free_all(url_con->headers);
646 url_con->headers = NULL;
647
648 if ((mode == MODE_POST) || (mode == MODE_AUTO))
649 {
650 if (url_con->post_data) free(url_con->post_data);
651 url_con->post_data = NULL;
652 if ((data) && (length > 0))
653 {
654 url_con->post_data = malloc(length);
655 if (url_con->post_data)
656 {
657 memcpy(url_con->post_data, data, length);
658 if ((content_type) && (strlen(content_type) < 450))
659 {
660 snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type);
661 url_con->headers = curl_slist_append(url_con->headers, tmp);
662 }
663 curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, url_con->post_data);
664 curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
665 }
666 else
667 return EINA_FALSE;
668 }
669 else curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 0);
670 if (mode == MODE_POST)
671 curl_easy_setopt(url_con->curl_easy, CURLOPT_POST, 1);
672 }
673
674 switch (url_con->time_condition)
675 {
676 case ECORE_CON_URL_TIME_NONE:
677 curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
678 CURL_TIMECOND_NONE);
679 break;
680
681 case ECORE_CON_URL_TIME_IFMODSINCE:
682 curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
683 CURL_TIMECOND_IFMODSINCE);
684 curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE,
685 (long)url_con->timestamp);
686 break;
687
688 case ECORE_CON_URL_TIME_IFUNMODSINCE:
689 curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
690 CURL_TIMECOND_IFUNMODSINCE);
691 curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE,
692 (long)url_con->timestamp);
693 break;
694 }
695
696 /* Additional headers */
697 EINA_LIST_FOREACH(url_con->additional_headers, l, s)
698 url_con->headers = curl_slist_append(url_con->headers, s);
699
700 curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPHEADER, url_con->headers);
701
702 url_con->received = 0;
703
704 return _ecore_con_url_perform(url_con);
705#else
706 return EINA_FALSE;
707 (void)url_con;
708 (void)mode;
709 (void)data;
710 (void)length;
711 (void)content_type;
712#endif
713}
714
715EAPI Eina_Bool
716ecore_con_url_get(Ecore_Con_Url *url_con)
717{
718 return _ecore_con_url_send(url_con, MODE_GET, NULL, 0, NULL);
719}
720
721EAPI Eina_Bool
722ecore_con_url_post(Ecore_Con_Url *url_con, const void *data, long length, const char *content_type)
723{
724 return _ecore_con_url_send(url_con, MODE_POST, data, length, content_type);
725}
726
727EAPI Eina_Bool
728ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir)
729{
730#ifdef HAVE_CURL
731 char url[4096];
732 char userpwd[4096];
733 FILE *fd;
734 struct stat file_info;
735 CURLcode ret;
736
737 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
738 {
739 ECORE_MAGIC_FAIL(url_con,
740 ECORE_MAGIC_CON_URL,
741 "ecore_con_url_ftp_upload");
742 return EINA_FALSE;
743 }
744
745 if (url_con->dead) return EINA_FALSE;
746 if (!url_con->url) return EINA_FALSE;
747 if ((!filename) || (!filename[0])) return EINA_FALSE;
748
749 if (stat(filename, &file_info))
750 return EINA_FALSE;
751
752 snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass);
753 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd);
754 if (ret != CURLE_OK)
755 {
756 ERR("Could not set username and password for FTP upload: %s",
757 curl_easy_strerror(ret));
758 return EINA_FALSE;
759 }
760
761 char tmp[PATH_MAX];
762 snprintf(tmp, PATH_MAX, "%s", filename);
763
764 if (upload_dir)
765 snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url,
766 upload_dir, basename(tmp));
767 else
768 snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url,
769 basename(tmp));
770
771 if (!ecore_con_url_url_set(url_con, url))
772 return EINA_FALSE;
773
774 curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE,
775 (curl_off_t)file_info.st_size);
776 curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1);
777 curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION,
778 _ecore_con_url_read_cb);
779
780 fd = fopen(filename, "rb");
781 if (!fd)
782 {
783 ERR("Could not open \"%s\" for FTP upload", filename);
784 return EINA_FALSE;
785 }
786 curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
787
788 return _ecore_con_url_perform(url_con);
789#else
790 return EINA_FALSE;
791 (void)url_con;
792 (void)filename;
793 (void)user;
794 (void)pass;
795 (void)upload_dir;
796#endif
797}
798
799EAPI void
800ecore_con_url_cookies_init(Ecore_Con_Url *url_con)
801{
802#ifdef HAVE_CURL
803 if (!url_con)
804 return;
805
806 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
807 {
808 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
809 "ecore_con_url_cookies_init");
810 return;
811 }
812
813 if (url_con->dead) return;
814 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, "");
815#else
816 return;
817 (void)url_con;
818#endif
819}
820
821EAPI void
822ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con, Eina_Bool ignore)
823{
824#ifdef HAVE_CURL
825 if (!url_con)
826 return;
827
828 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
829 {
830 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
831 "ecore_con_url_cookies_ignore_old_session_set");
832 return;
833 }
834
835 if (url_con->dead) return;
836 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore);
837#else
838 return;
839 (void)url_con;
840 (void)ignore;
841#endif
842}
843
844EAPI void
845ecore_con_url_cookies_clear(Ecore_Con_Url *url_con)
846{
847#ifdef HAVE_CURL
848 if (!url_con)
849 return;
850
851 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
852 {
853 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
854 "ecore_con_url_cookies_clear");
855 return;
856 }
857
858 if (url_con->dead) return;
859 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL");
860#else
861 return;
862 (void)url_con;
863#endif
864}
865
866EAPI void
867ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con)
868{
869#ifdef HAVE_CURL
870 if (!url_con)
871 return;
872
873 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
874 {
875 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
876 "ecore_con_url_cookies_session_clear");
877 return;
878 }
879
880 if (url_con->dead) return;
881 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS");
882#else
883 return;
884 (void)url_con;
885#endif
886}
887
888EAPI void
889ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char *const file_name)
890{
891#ifdef HAVE_CURL
892 if (!url_con)
893 return;
894
895 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
896 {
897 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
898 "ecore_con_url_cookies_file_add");
899 return;
900 }
901
902 if (url_con->dead) return;
903 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name);
904#else
905 return;
906 (void)url_con;
907 (void)file_name;
908#endif
909}
910
911EAPI Eina_Bool
912ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char *const cookiejar_file)
913{
914#ifdef HAVE_CURL
915 CURLcode ret;
916
917 if (!url_con)
918 return EINA_FALSE;
919
920 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
921 {
922 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
923 "ecore_con_url_cookies_jar_file_set");
924 return EINA_FALSE;
925 }
926
927 if (url_con->dead) return EINA_FALSE;
928 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR,
929 cookiejar_file);
930 if (ret != CURLE_OK)
931 {
932 ERR("Setting the cookie-jar name failed: %s",
933 curl_easy_strerror(ret));
934 return EINA_FALSE;
935 }
936
937 return EINA_TRUE;
938#else
939 return EINA_FALSE;
940 (void)url_con;
941 (void)cookiejar_file;
942#endif
943}
944
945EAPI void
946ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con)
947{
948#ifdef HAVE_CURL
949 if (!url_con)
950 return;
951
952 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
953 {
954 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
955 "ecore_con_url_cookies_jar_write");
956 return;
957 }
958
959 if (url_con->dead) return;
960 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH");
961#else
962 return;
963 (void)url_con;
964#endif
965}
966
967EAPI void
968ecore_con_url_verbose_set(Ecore_Con_Url *url_con, Eina_Bool verbose)
969{
970#ifdef HAVE_CURL
971 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
972 {
973 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
974 "ecore_con_url_verbose_set");
975 return;
976 }
977
978 if (!url_con->url)
979 return;
980
981 if (url_con->dead) return;
982 curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose);
983#else
984 return;
985 (void)url_con;
986 (void)verbose;
987#endif
988}
989
990EAPI void
991ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, Eina_Bool use_epsv)
992{
993#ifdef HAVE_CURL
994 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
995 {
996 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
997 "ecore_con_url_ftp_use_epsv_set");
998 return;
999 }
1000
1001 if (!url_con->url)
1002 return;
1003
1004 if (url_con->dead) return;
1005 curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, (int)use_epsv);
1006#else
1007 return;
1008 (void)url_con;
1009 (void)use_epsv;
1010#endif
1011}
1012
1013/**
1014 * Toggle libcurl's verify peer's certificate option.
1015 *
1016 * If @p verify is @c EINA_TRUE, libcurl will verify
1017 * the authenticity of the peer's certificate, otherwise
1018 * it will not. Default behavior of libcurl is to check
1019 * peer's certificate.
1020 *
1021 * @param url_con Ecore_Con_Url instance which will be acted upon.
1022 * @param verify Whether or not libcurl will check peer's certificate.
1023 * @since 1.1.0
1024 */
1025EAPI void
1026ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, Eina_Bool verify)
1027{
1028#ifdef HAVE_CURL
1029 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1030 {
1031 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
1032 "ecore_con_url_ssl_verify_peer_set");
1033 return;
1034 }
1035
1036 if (!url_con->url)
1037 return;
1038
1039 if (url_con->dead) return;
1040 curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, (int)verify);
1041#else
1042 return;
1043 (void)url_con;
1044 (void)verify;
1045#endif
1046}
1047
1048/**
1049 * Set a custom CA to trust for SSL/TLS connections.
1050 *
1051 * Specify the path of a file (in PEM format) containing one or more
1052 * CA certificate(s) to use for the validation of the server certificate.
1053 *
1054 * This function can also disable CA validation if @p ca_path is @c NULL.
1055 * However, the server certificate still needs to be valid for the connection
1056 * to succeed (i.e., the certificate must concern the server the
1057 * connection is made to).
1058 *
1059 * @param url_con Connection object that will use the custom CA.
1060 * @param ca_path Path to a CA certificate(s) file or @c NULL to disable
1061 * CA validation.
1062 *
1063 * @return @c 0 on success. When cURL is used, non-zero return values
1064 * are equal to cURL error codes.
1065 */
1066EAPI int
1067ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path)
1068{
1069 int res = -1;
1070
1071#ifdef HAVE_CURL
1072 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1073 {
1074 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ssl_ca_set");
1075 return -1;
1076 }
1077
1078 if (!url_con->url) return -1;
1079 if (url_con->dead) return -1;
1080 if (ca_path == NULL)
1081 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 0);
1082 else
1083 {
1084 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 1);
1085 if (!res)
1086 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_CAINFO, ca_path);
1087 }
1088#else
1089 return -1;
1090 (void)url_con;
1091 (void)ca_path;
1092#endif
1093
1094 return res;
1095}
1096
1097EAPI Eina_Bool
1098ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version)
1099{
1100#ifdef HAVE_CURL
1101 int res = -1;
1102 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1103 {
1104 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_http_version_set");
1105 return EINA_FALSE;
1106 }
1107 if (url_con->dead) return EINA_FALSE;
1108 switch (version)
1109 {
1110 case ECORE_CON_URL_HTTP_VERSION_1_0:
1111 res = curl_easy_setopt(url_con->curl_easy,
1112 CURLOPT_HTTP_VERSION,
1113 CURL_HTTP_VERSION_1_0);
1114 break;
1115
1116 case ECORE_CON_URL_HTTP_VERSION_1_1:
1117 res = curl_easy_setopt(url_con->curl_easy,
1118 CURLOPT_HTTP_VERSION,
1119 CURL_HTTP_VERSION_1_1);
1120 break;
1121
1122 default:
1123 break;
1124 }
1125 if (res != CURLE_OK)
1126 {
1127 ERR("curl http version setting failed: %s", curl_easy_strerror(res));
1128 return EINA_FALSE;
1129 }
1130 return EINA_TRUE;
1131#else
1132 (void)url_con;
1133 (void)version;
1134 return EINA_FALSE;
1135#endif
1136}
1137
1138EAPI Eina_Bool
1139ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy)
1140{
1141#ifdef HAVE_CURL
1142 int res = -1;
1143 curl_version_info_data *vers = NULL;
1144
1145 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1146 {
1147 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_set");
1148 return EINA_FALSE;
1149 }
1150
1151 if (!url_con->url) return EINA_FALSE;
1152 if (url_con->dead) return EINA_FALSE;
1153
1154 if (!proxy) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, "");
1155 else
1156 {
1157 // before curl version 7.21.7, socks protocol:// prefix is not supported
1158 // (e.g. socks4://, socks4a://, socks5:// or socks5h://, etc.)
1159 vers = curl_version_info(CURLVERSION_NOW);
1160 if (vers->version_num < 0x71507)
1161 {
1162 url_con->proxy_type = CURLPROXY_HTTP;
1163 if (strstr(proxy, "socks4a"))
1164 url_con->proxy_type = CURLPROXY_SOCKS4A;
1165 else if (strstr(proxy, "socks4"))
1166 url_con->proxy_type = CURLPROXY_SOCKS4;
1167 else if (strstr(proxy, "socks5h"))
1168 url_con->proxy_type = CURLPROXY_SOCKS5_HOSTNAME;
1169 else if (strstr(proxy, "socks5"))
1170 url_con->proxy_type = CURLPROXY_SOCKS5;
1171 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXYTYPE,
1172 url_con->proxy_type);
1173 if (res != CURLE_OK)
1174 {
1175 ERR("curl proxy type setting failed: %s",
1176 curl_easy_strerror(res));
1177 url_con->proxy_type = -1;
1178 return EINA_FALSE;
1179 }
1180 }
1181 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, proxy);
1182 }
1183 if (res != CURLE_OK)
1184 {
1185 ERR("curl proxy setting failed: %s", curl_easy_strerror(res));
1186 url_con->proxy_type = -1;
1187 return EINA_FALSE;
1188 }
1189 return EINA_TRUE;
1190#else
1191 return EINA_FALSE;
1192 (void)url_con;
1193 (void)proxy;
1194#endif
1195}
1196
1197EAPI void
1198ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout)
1199{
1200#ifdef HAVE_CURL
1201 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1202 {
1203 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_timeout_set");
1204 return;
1205 }
1206
1207 if (url_con->dead) return;
1208 if (!url_con->url || timeout < 0) return;
1209 if (url_con->timer) ecore_timer_del(url_con->timer);
1210 url_con->timer = ecore_timer_add(timeout, _ecore_con_url_timeout_cb, url_con);
1211#else
1212 return;
1213 (void)url_con;
1214 (void)timeout;
1215#endif
1216}
1217
1218EAPI Eina_Bool
1219ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username)
1220{
1221#ifdef HAVE_CURL
1222 int res = -1;
1223 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1224 {
1225 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_username_set");
1226 return EINA_FALSE;
1227 }
1228
1229 if (url_con->dead) return EINA_FALSE;
1230 if (!url_con->url) return EINA_FALSE;
1231 if ((!username) || (!username[0])) return EINA_FALSE;
1232 if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
1233 {
1234 ERR("Proxy type should be socks5 and above");
1235 return EINA_FALSE;
1236 }
1237
1238 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username);
1239 if (res != CURLE_OK)
1240 {
1241 ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res));
1242 return EINA_FALSE;
1243 }
1244 return EINA_TRUE;
1245#else
1246 return EINA_FALSE;
1247 (void)url_con;
1248 (void)username;
1249#endif
1250}
1251
1252EAPI Eina_Bool
1253ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
1254{
1255#ifdef HAVE_CURL
1256 int res = -1;
1257 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1258 {
1259 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_password_set");
1260 return EINA_FALSE;
1261 }
1262 if (!url_con->url) return EINA_FALSE;
1263 if (url_con->dead) return EINA_FALSE;
1264 if (!password) return EINA_FALSE;
1265 if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
1266 {
1267 ERR("Proxy type should be socks5 and above");
1268 return EINA_FALSE;
1269 }
1270
1271 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
1272 if (res != CURLE_OK)
1273 {
1274 ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res));
1275 return EINA_FALSE;
1276 }
1277 return EINA_TRUE;
1278#else
1279 return EINA_FALSE;
1280 (void)url_con;
1281 (void)password;
1282#endif
1283}
1284
1285/**
1286 * @}
1287 */
1288
1289#ifdef HAVE_CURL
1290static void
1291_ecore_con_url_status_get(Ecore_Con_Url *url_con)
1292{
1293 long status = 0;
1294
1295 if (!url_con->curl_easy) return;
1296 if (!curl_easy_getinfo(url_con->curl_easy, CURLINFO_RESPONSE_CODE, &status))
1297 url_con->status = status;
1298 else
1299 url_con->status = 0;
1300}
1301
1302static void
1303_ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg)
1304{
1305 Ecore_Con_Event_Url_Complete *e;
1306
1307 e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
1308 if (!e) return;
1309
1310 if (curlmsg && (curlmsg->data.result == CURLE_OK))
1311 {
1312 if (!url_con->status)
1313 _ecore_con_url_status_get(url_con);
1314 }
1315 else if (curlmsg)
1316 ERR("Curl message have errors: %d", curlmsg->data.result);
1317 else
1318 CRIT("THIS IS BAD.");
1319
1320 e->status = url_con->status;
1321 e->url_con = url_con;
1322 url_con->event_count++;
1323 ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
1324}
1325
1326static void
1327_ecore_con_url_multi_remove(Ecore_Con_Url *url_con)
1328{
1329 CURLMcode ret;
1330
1331 ret = curl_multi_remove_handle(_curlm, url_con->curl_easy);
1332 url_con->multi = EINA_FALSE;
1333 if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
1334}
1335
1336static Eina_Bool
1337_ecore_con_url_timeout_cb(void *data)
1338{
1339 Ecore_Con_Url *url_con = data;
1340
1341 if (!url_con) return ECORE_CALLBACK_CANCEL;
1342 if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL;
1343
1344 _ecore_con_url_multi_remove(url_con);
1345 _url_con_list = eina_list_remove(_url_con_list, url_con);
1346
1347 curl_slist_free_all(url_con->headers);
1348 url_con->headers = NULL;
1349
1350 url_con->timer = NULL;
1351
1352 _ecore_con_url_event_url_complete(url_con, NULL);
1353 return ECORE_CALLBACK_CANCEL;
1354}
1355
1356static size_t
1357_ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp)
1358{
1359 Ecore_Con_Url *url_con;
1360 Ecore_Con_Event_Url_Data *e;
1361 size_t real_size = size * nitems;
1362
1363 url_con = (Ecore_Con_Url *)userp;
1364
1365 if (!url_con)
1366 return -1;
1367
1368 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1369 {
1370 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_cb");
1371 return -1;
1372 }
1373
1374 url_con->received += real_size;
1375
1376 INF("reading from %s", url_con->url);
1377 if (url_con->write_fd < 0)
1378 {
1379 e =
1380 malloc(sizeof(Ecore_Con_Event_Url_Data) + sizeof(unsigned char) *
1381 (real_size - 1));
1382 if (e)
1383 {
1384 e->url_con = url_con;
1385 e->size = real_size;
1386 memcpy(e->data, buffer, real_size);
1387 url_con->event_count++;
1388 ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
1389 }
1390 }
1391 else
1392 {
1393 ssize_t count = 0;
1394 size_t total_size = real_size;
1395 size_t offset = 0;
1396
1397 while (total_size > 0)
1398 {
1399 count = write(url_con->write_fd,
1400 (char *)buffer + offset,
1401 total_size);
1402 if (count < 0)
1403 {
1404 if (errno != EAGAIN && errno != EINTR)
1405 return -1;
1406 }
1407 else
1408 {
1409 total_size -= count;
1410 offset += count;
1411 }
1412 }
1413 }
1414
1415 return real_size;
1416}
1417
1418static size_t
1419_ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream)
1420{
1421 size_t real_size = size * nitems;
1422 Ecore_Con_Url *url_con = stream;
1423
1424 char *header = malloc(sizeof(char) * (real_size + 1));
1425 if (!header)
1426 return real_size;
1427
1428 memcpy(header, ptr, real_size);
1429 header[real_size] = '\0';
1430
1431 url_con->response_headers = eina_list_append(url_con->response_headers,
1432 header);
1433
1434 return real_size;
1435}
1436
1437static int
1438_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
1439{
1440 Ecore_Con_Event_Url_Progress *e;
1441 Ecore_Con_Url *url_con;
1442
1443 url_con = clientp;
1444
1445 e = malloc(sizeof(Ecore_Con_Event_Url_Progress));
1446 if (e)
1447 {
1448 e->url_con = url_con;
1449 e->down.total = dltotal;
1450 e->down.now = dlnow;
1451 e->up.total = ultotal;
1452 e->up.now = ulnow;
1453 url_con->event_count++;
1454 ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
1455 }
1456
1457 return 0;
1458}
1459
1460static size_t
1461_ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream)
1462{
1463 size_t retcode = fread(ptr, size, nitems, stream);
1464
1465 if (ferror((FILE *)stream))
1466 {
1467 fclose(stream);
1468 return CURL_READFUNC_ABORT;
1469 }
1470 else if (retcode == 0)
1471 {
1472 fclose((FILE *)stream);
1473 return 0;
1474 }
1475
1476#ifdef _WIN32
1477 INF("*** We read %Iu bytes from file", retcode);
1478#else
1479 INF("*** We read %zu bytes from file", retcode);
1480#endif
1481 return retcode;
1482}
1483
1484static void
1485_ecore_con_url_info_read(void)
1486{
1487 CURLMsg *curlmsg;
1488 int n_remaining;
1489
1490 while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining)))
1491 {
1492 Eina_List *l, *ll;
1493 Ecore_Con_Url *url_con = NULL;
1494 DBG("Curl message: %d", curlmsg->msg);
1495
1496 if (curlmsg->msg == CURLMSG_DONE)
1497 {
1498 EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_con)
1499 {
1500 if (curlmsg->easy_handle == url_con->curl_easy)
1501 _ecore_con_url_event_url_complete(url_con, curlmsg);
1502 }
1503 }
1504 }
1505}
1506
1507static void
1508_ecore_con_url_curl_clear(void)
1509{
1510 Ecore_Fd_Handler *fdh;
1511 Ecore_Con_Url *url_con;
1512
1513 EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh);
1514 EINA_LIST_FREE(_url_con_list, url_con) _ecore_con_url_multi_remove(url_con);
1515}
1516
1517static Eina_Bool
1518_ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
1519{
1520 Ecore_Fd_Handler *fdh;
1521 EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh);
1522 ecore_timer_interval_set(_curl_timer, 0.1);
1523 return ECORE_CALLBACK_CANCEL;
1524}
1525
1526static void
1527_ecore_con_url_fdset(void)
1528{
1529 CURLMcode ret;
1530 fd_set read_set, write_set, exc_set;
1531 int fd, fd_max;
1532
1533 FD_ZERO(&read_set);
1534 FD_ZERO(&write_set);
1535 FD_ZERO(&exc_set);
1536
1537 ret = curl_multi_fdset(_curlm, &read_set, &write_set, &exc_set, &fd_max);
1538 if (ret != CURLM_OK)
1539 {
1540 ERR("curl_multi_fdset failed: %s", curl_multi_strerror(ret));
1541 return;
1542 }
1543
1544 for (fd = 0; fd <= fd_max; fd++)
1545 {
1546 int flags = 0;
1547 if (FD_ISSET(fd, &read_set)) flags |= ECORE_FD_READ;
1548 if (FD_ISSET(fd, &write_set)) flags |= ECORE_FD_WRITE;
1549 if (FD_ISSET(fd, &exc_set)) flags |= ECORE_FD_ERROR;
1550 if (flags)
1551 {
1552 // FIXME: Who is owner (easy_handle) of this fd?? (Curl do not give this info.)
1553 // This cause "Failed to delete epoll fd xx!" error messages
1554 Ecore_Fd_Handler *fd_handler;
1555 fd_handler = ecore_main_fd_handler_add(fd, flags,
1556 _ecore_con_url_fd_handler,
1557 NULL, NULL, NULL);
1558 if (fd_handler)
1559 _fd_hd_list = eina_list_append(_fd_hd_list, fd_handler);
1560 }
1561 }
1562}
1563
1564static Eina_Bool
1565_ecore_con_url_timer(void *data __UNUSED__)
1566{
1567 Ecore_Fd_Handler *fdh;
1568 int still_running;
1569 CURLMcode ret;
1570
1571 EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh);
1572 _ecore_con_url_info_read();
1573
1574 ret = curl_multi_perform(_curlm, &still_running);
1575 if (ret == CURLM_CALL_MULTI_PERFORM)
1576 {
1577 DBG("curl_multi_perform() again immediately");
1578 return ECORE_CALLBACK_RENEW;
1579 }
1580 else if (ret != CURLM_OK)
1581 {
1582 ERR("curl_multi_perform() failed: %s", curl_multi_strerror(ret));
1583 _ecore_con_url_curl_clear();
1584 ecore_timer_freeze(_curl_timer);
1585 }
1586
1587 if (still_running)
1588 {
1589 long ms;
1590 _ecore_con_url_fdset();
1591 curl_multi_timeout(_curlm, &ms);
1592 DBG("multiperform is still running: %d, timeout: %ld", still_running, ms);
1593 if (ms >= CURL_MIN_TIMEOUT || ms <= 0) ms = CURL_MIN_TIMEOUT;
1594 ecore_timer_interval_set(_curl_timer, (double)ms / 1000);
1595 }
1596 else
1597 {
1598 DBG("multiperform ended");
1599 _ecore_con_url_info_read();
1600 _ecore_con_url_curl_clear();
1601 ecore_timer_freeze(_curl_timer);
1602 }
1603
1604 return ECORE_CALLBACK_RENEW;
1605}
1606
1607static Eina_Bool
1608_ecore_con_url_perform(Ecore_Con_Url *url_con)
1609{
1610 CURLMcode ret;
1611
1612 ret = curl_multi_add_handle(_curlm, url_con->curl_easy);
1613 if (ret != CURLM_OK)
1614 {
1615 ERR("curl_multi_add_handle() failed: %s", curl_multi_strerror(ret));
1616 return EINA_FALSE;
1617 }
1618
1619 url_con->multi = EINA_TRUE;
1620 _url_con_list = eina_list_append(_url_con_list, url_con);
1621 ecore_timer_thaw(_curl_timer);
1622
1623 return EINA_TRUE;
1624}
1625
1626static void
1627_ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev)
1628{
1629 free(ev);
1630 url_con->event_count--;
1631 if (url_con->dead && (!url_con->event_count))
1632 ecore_con_url_free(url_con);
1633}
1634
1635#endif
diff --git a/libraries/ecore/src/lib/ecore_config/Ecore_Config.h b/libraries/ecore/src/lib/ecore_config/Ecore_Config.h
deleted file mode 100644
index 6733d7b..0000000
--- a/libraries/ecore/src/lib/ecore_config/Ecore_Config.h
+++ /dev/null
@@ -1,312 +0,0 @@
1#ifndef _ECORE_CONFIG_H
2# define _ECORE_CONFIG_H
3
4#ifdef EAPI
5#undef EAPI
6#endif
7#ifdef _MSC_VER
8# ifdef BUILDING_DLL
9# define EAPI __declspec(dllexport)
10# else
11# define EAPI __declspec(dllimport)
12# endif
13#else
14# ifdef __GNUC__
15# if __GNUC__ >= 4
16# define EAPI __attribute__ ((visibility("default")))
17# else
18# define EAPI
19# endif
20# else
21# define EAPI
22# endif
23#endif
24
25/**
26 * @file
27 * @brief Provides the Enlightened Property Library.
28 *
29 * This file provies all headers and structs for use with Ecore_Config.
30 * Using individual header files should not be necessary.
31 */
32
33# define DIR_DELIMITER '/'
34# define ECORE_CONFIG_FLOAT_PRECISION 1000
35
36/* FIXME: this should only be included if evas is present */
37# include <Evas.h>
38
39# define ECORE_CONFIG_GLOBAL_ID "_system"
40
41/* structures */
42
43/**
44 * Valid configuration property types.
45 */
46typedef enum Ecore_Config_Type
47{
48 ECORE_CONFIG_NIL = 0, /**< Property with no value. */
49 ECORE_CONFIG_INT = 1, /**< Integer property type. */
50 ECORE_CONFIG_FLT = 2, /**< Float property type. */
51 ECORE_CONFIG_STR = 3, /**< String property type. */
52 ECORE_CONFIG_RGB = 4, /**< Colour property type. */
53 ECORE_CONFIG_THM = 5, /**< Theme property type. */
54 ECORE_CONFIG_BLN = 6, /**< Boolean property type. */
55 ECORE_CONFIG_SCT = 7, /**< Structure property type */
56} Ecore_Config_Type;
57
58typedef enum Ecore_Config_Flag
59{
60 ECORE_CONFIG_FLAG_NONE = 0,
61 ECORE_CONFIG_FLAG_BOUNDS = 1,
62 ECORE_CONFIG_FLAG_MODIFIED = 2,
63 ECORE_CONFIG_FLAG_SYSTEM = 4,
64 ECORE_CONFIG_FLAG_CMDLN = 8
65} Ecore_Config_Flag;
66
67/**
68 * Property change callback function prototype.
69 */
70typedef int (*Ecore_Config_Listener) (const char *key,
71 const Ecore_Config_Type type,
72 const int tag, void *data);
73
74typedef struct Ecore_Config_Listener_List
75{
76 Ecore_Config_Listener listener;
77 const char *name;
78 void *data;
79 int tag;
80 struct Ecore_Config_Listener_List *next;
81} Ecore_Config_Listener_List;
82
83/**
84 * The actual property for storing a key-value pair.
85 */
86typedef struct Ecore_Config_Prop
87{
88 char *key; /* Property key. */
89 char *description; /* Description set by ecore_config_descibe. */
90 char short_opt; /* short identifier on command line (-f) */
91 char *long_opt; /* long identifier on command line (--foo) */
92 char *ptr; /* Used as the value when the property is a string or theme. */
93 Ecore_Config_Type type; /* Property type. */
94 long val; /* Used as the value when the property is an integer, float or colour. */
95 long lo; /* Lower bound for the value when the property is an integer or float. */
96 long hi; /* Higher bound for the value when the property is an integer or float. */
97 long step; /* Increment for the value when the property is an integer or float. */
98 Ecore_Config_Flag flags; /// < Configuration flags.
99 Ecore_Config_Listener_List *listeners; /* List of change listeners. */
100 void *data; /// < Stores extra data for the property.
101 struct Ecore_Config_Prop *parent; /* if we are in a struct we have a parent to notify of changes etc */
102 struct Ecore_Config_Prop *next; /* Pointer to the next property in the list. */
103} Ecore_Config_Prop;
104
105/*
106 * A container for a list of properties. Provided so that an
107 * application can use different set of properties at any time. This
108 * is useful for multiple window support.
109 */
110typedef struct Ecore_Config_Bundle
111{
112 char *identifier; /* Identifier for this set of properties (window ID for example) */
113 char *owner; /* This is used to store the application name related to the bundle */
114 long serial; /* Unique identifier to identify bundle */
115 Ecore_Config_Prop *data; /* Pointer to root of property list */
116 void *user_data; /* App specific pointer to "other data" */
117 struct Ecore_Config_Bundle *next; /* Pointer to next bundle in this application */
118} Ecore_Config_Bundle;
119
120typedef struct Ecore_Config_Server
121{
122 void *server;
123 char *name;
124 Ecore_Config_Bundle *bundles; /* data anchor */
125 struct Ecore_Config_Server *next;
126} Ecore_Config_Server;
127
128# ifdef __cplusplus
129extern "C"
130{
131# endif
132
133/* global ptrs to save passing them through the API */
134 EAPI extern Ecore_Config_Server *__ecore_config_server_global;
135 EAPI extern Ecore_Config_Server *__ecore_config_server_local;
136 EAPI extern Ecore_Config_Bundle *__ecore_config_bundle_local;
137 EAPI extern char *__ecore_config_app_name;
138
139 EAPI Ecore_Config_Prop *ecore_config_get(const char *key);
140 EAPI const char *ecore_config_type_get(const Ecore_Config_Prop *e);
141 EAPI int ecore_config_boolean_get(const char *key);
142 EAPI char *ecore_config_string_get(const char *key);
143 EAPI long ecore_config_int_get(const char *key);
144 EAPI int ecore_config_argb_get(const char *key, int *a, int *r,
145 int *g, int *b);
146 EAPI long ecore_config_argbint_get(const char *key);
147 EAPI char *ecore_config_argbstr_get(const char *key);
148 EAPI float ecore_config_float_get(const char *key);
149 EAPI char *ecore_config_theme_get(const char *key);
150 EAPI char *ecore_config_as_string_get(const char *key);
151 EAPI int ecore_config_bound(Ecore_Config_Prop *e);
152 EAPI int ecore_config_describe(const char *key, const char *desc);
153 EAPI int ecore_config_short_opt_set(const char *key,
154 char short_opt);
155 EAPI int ecore_config_long_opt_set(const char *key,
156 const char *long_opt);
157 EAPI int ecore_config_set(const char *key, const char *val);
158 EAPI int ecore_config_typed_set(const char *key, const void *val,
159 int type);
160 EAPI int ecore_config_boolean_set(const char *key, int val);
161 EAPI int ecore_config_string_set(const char *key, const char *val);
162 EAPI int ecore_config_int_set(const char *key, int val);
163 EAPI int ecore_config_argb_set(const char *key, int a, int r, int g, int b);
164 EAPI int ecore_config_argbint_set(const char *key, long argb);
165 EAPI int ecore_config_argbstr_set(const char *key, const char *val);
166 EAPI int ecore_config_float_set(const char *key, float val);
167 EAPI int ecore_config_theme_set(const char *key, const char *val);
168 EAPI int ecore_config_theme_preview_group_set(const char *key,
169 const char *group);
170 EAPI int ecore_config_as_string_set(const char *key, const char *val);
171
172 EAPI int ecore_config_default(const char *key, const char *val,
173 float lo, float hi, float step);
174 EAPI int ecore_config_typed_default(const char *key, const void *val,
175 int type);
176 EAPI int ecore_config_boolean_default(const char *key, int val);
177 EAPI int ecore_config_int_default(const char *key, int val);
178 EAPI int ecore_config_int_default_bound(const char *key, int val,
179 int lo, int hi, int step);
180 EAPI int ecore_config_string_default(const char *key, const char *val);
181 EAPI int ecore_config_float_default(const char *key, float val);
182 EAPI int ecore_config_float_default_bound(const char *key,
183 float val, float lo,
184 float hi, float step);
185 EAPI int ecore_config_argb_default(const char *key, int a, int r, int g, int b);
186 EAPI int ecore_config_argbint_default(const char *key, long argb);
187 EAPI int ecore_config_argbstr_default(const char *key, const char *val);
188 EAPI int ecore_config_theme_default(const char *key, const char *val);
189 EAPI int ecore_config_struct_default(const char *key);
190 EAPI int ecore_config_struct_int_add(const char *key, const char *name, int val);
191 EAPI int ecore_config_struct_float_add(const char *key, const char *name, float val);
192 EAPI int ecore_config_struct_create(const char *key);
193 EAPI int ecore_config_struct_string_add(const char *key, const char *name, const char* val);
194 EAPI int ecore_config_struct_theme_add(const char *key, const char *name, const char* val);
195 EAPI int ecore_config_struct_argb_add(const char *key, const char *name, int a, int r, int g, int b);
196 EAPI int ecore_config_struct_boolean_add(const char *key, const char *name, int val);
197 EAPI int ecore_config_struct_get(const char *key, void *data);
198
199 EAPI int ecore_config_listen(const char *name, const char *key,
200 Ecore_Config_Listener listener,
201 int tag, void *data);
202 EAPI int ecore_config_deaf(const char *name, const char *key,
203 Ecore_Config_Listener listener);
204 EAPI Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e);
205 EAPI int ecore_config_type_guess(const char *key, const char *val);
206
207 EAPI Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server *srv,
208 const char *id);
209 EAPI Ecore_Config_Bundle *ecore_config_bundle_1st_get(Ecore_Config_Server *srv);
210 EAPI Ecore_Config_Bundle *ecore_config_bundle_next_get(Ecore_Config_Bundle *ns);
211 EAPI Ecore_Config_Bundle *ecore_config_bundle_by_serial_get(Ecore_Config_Server *srv,
212 long serial);
213 EAPI Ecore_Config_Bundle *ecore_config_bundle_by_label_get(Ecore_Config_Server *srv,
214 const char *label);
215 EAPI long ecore_config_bundle_serial_get(Ecore_Config_Bundle *ns);
216 EAPI char *ecore_config_bundle_label_get(Ecore_Config_Bundle *ns);
217
218 EAPI int ecore_config_init(const char *name);
219 EAPI int ecore_config_shutdown(void);
220
221 EAPI int ecore_config_system_init(void);
222 EAPI int ecore_config_system_shutdown(void);
223
224 EAPI int ecore_config_load(void);
225 EAPI int ecore_config_file_load(const char *file);
226 EAPI int ecore_config_save(void);
227 EAPI int ecore_config_file_save(const char *file);
228
229/* error codes */
230# define ECORE_CONFIG_ERR_NOTSUPP (-16)
231# define ECORE_CONFIG_ERR_NOFILE (-15)
232# define ECORE_CONFIG_ERR_META_DLFAIL (-14)
233# define ECORE_CONFIG_ERR_META_FILE (-13)
234# define ECORE_CONFIG_ERR_META_FORMAT (-12)
235# define ECORE_CONFIG_ERR_MONMIS (-11)
236# define ECORE_CONFIG_ERR_NOEXEC (-10)
237# define ECORE_CONFIG_ERR_PARTIAL (-9)
238# define ECORE_CONFIG_ERR_PATHEX (-8)
239# define ECORE_CONFIG_ERR_TYPEMISMATCH (-7)
240# define ECORE_CONFIG_ERR_MUTEX (-6)
241# define ECORE_CONFIG_ERR_NOTFOUND (-5) /* Error indicating that the item searched for could not be found. */
242# define ECORE_CONFIG_ERR_OOM (-4) /* Error given when the program runs out of memory. */
243# define ECORE_CONFIG_ERR_IGNORED (-3) /* Error occurred, but was ignored. */
244# define ECORE_CONFIG_ERR_NODATA (-2) /* Error given when necessary data is not provided. */
245# define ECORE_CONFIG_ERR_FAIL (-1) /* Failure result. */
246# define ECORE_CONFIG_ERR_SUCC (0) /* Success result. */
247
248# define ECORE_CONFIG_PARSE_HELP (-2) /* Help was displayed */
249# define ECORE_CONFIG_PARSE_EXIT (-1) /* An error occurred */
250# define ECORE_CONFIG_PARSE_CONTINUE (0) /* Arguments parsed successfully */
251
252/* convenience mathods in convenience.c */
253 /* FIXME: this should only be included if evas is present */
254 EAPI int ecore_config_evas_font_path_apply(Evas *evas);
255 EAPI char *ecore_config_theme_search_path_get(void);
256 EAPI int ecore_config_theme_search_path_append(const char *append);
257
258 EAPI char *ecore_config_theme_default_path_get(void);
259 EAPI char *ecore_config_theme_with_path_from_name_get(char *name);
260 EAPI char *ecore_config_theme_with_path_get(const char *key);
261 EAPI void ecore_config_args_display(void);
262 EAPI int ecore_config_args_parse(void);
263 EAPI void ecore_config_args_callback_str_add(char short_opt,
264 char *long_opt, char *desc,
265 void (*func)(char *val, void *data),
266 void *data);
267 EAPI void ecore_config_args_callback_noarg_add(char short_opt,
268 char *long_opt, char *desc,
269 void (*func)(char *val, void *data),
270 void *data);
271 EAPI void ecore_config_app_describe(char *description);
272
273 EAPI int ecore_config_create(const char *key, void *val,
274 char short_opt, char *long_opt,
275 char *desc);
276 EAPI int ecore_config_typed_create(const char *key, void *val,
277 int type, char short_opt,
278 char *long_opt, char *desc);
279 EAPI int ecore_config_boolean_create(const char *key, int val,
280 char short_opt, char *long_opt,
281 char *desc);
282 EAPI int ecore_config_int_create(const char *key, int val,
283 char short_opt, char *long_opt,
284 char *desc);
285 EAPI int ecore_config_int_create_bound(const char *key, int val,
286 int low, int high,
287 int step, char short_opt,
288 char *long_opt,
289 char *desc);
290 EAPI int ecore_config_string_create(const char *key, char *val,
291 char short_opt,
292 char *long_opt, char *desc);
293 EAPI int ecore_config_float_create(const char *key, float val,
294 char short_opt, char *long_opt,
295 char *desc);
296 EAPI int ecore_config_float_create_bound(const char *key,
297 float val, float low,
298 float high, float step,
299 char short_opt,
300 char *long_opt,
301 char *desc);
302 EAPI int ecore_config_argb_create(const char *key, char *val,
303 char short_opt, char *long_opt,
304 char *desc);
305 EAPI int ecore_config_theme_create(const char *key, char *val,
306 char short_opt, char *long_opt,
307 char *desc);
308
309# ifdef __cplusplus
310}
311# endif
312#endif
diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.am b/libraries/ecore/src/lib/ecore_config/Makefile.am
deleted file mode 100644
index c459351..0000000
--- a/libraries/ecore/src/lib/ecore_config/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_ipc \
6-I$(top_srcdir)/ \
7-I$(top_builddir)/src/lib/ecore \
8-I$(top_builddir)/src/lib/ecore_ipc \
9-I$(top_builddir)/ \
10-DPACKAGE_BIN_DIR=\"$(bindir)\" \
11-DPACKAGE_LIB_DIR=\"$(libdir)\" \
12-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
13@EVAS_CFLAGS@ \
14@EET_CFLAGS@ \
15@EINA_CFLAGS@
16
17CLEANFILES = $(DB)
18
19#DB = system.db
20#$(DB): Makefile
21# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/theme/name str "winter"
22# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/font/path str "$(pkgdatadir)/data/fonts"
23# 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`
24# 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`
25
26lib_LTLIBRARIES = libecore_config.la
27
28includes_HEADERS = Ecore_Config.h
29includesdir = $(includedir)/ecore-@VMAJ@
30
31libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
32
33#config_DATA = $(DB)
34#configdir = $(pkgdatadir)
35
36libecore_config_la_SOURCES = \
37ecore_config.c \
38ecore_config_util.c \
39ecore_config_storage.c \
40ecore_config_extra.c \
41ecore_config_db.c
42
43libecore_config_la_LIBADD = \
44$(top_builddir)/src/lib/ecore/libecore.la \
45@EET_LIBS@ \
46@EINA_LIBS@ \
47@EVAS_LIBS@
48
49if BUILD_ECORE_IPC
50
51libecore_config_la_SOURCES += \
52ecore_config_ipc_main.c \
53ecore_config_ipc_ecore.c
54
55libecore_config_la_LIBADD += $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la
56
57endif
58
59EXTRA_DIST = \
60ecore_config_ipc.h \
61ecore_config_private.h \
62ecore_config_util.h
diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.in b/libraries/ecore/src/lib/ecore_config/Makefile.in
deleted file mode 100644
index 4b908cd..0000000
--- a/libraries/ecore/src/lib/ecore_config/Makefile.in
+++ /dev/null
@@ -1,869 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38@BUILD_ECORE_IPC_TRUE@am__append_1 = \
39@BUILD_ECORE_IPC_TRUE@ecore_config_ipc_main.c \
40@BUILD_ECORE_IPC_TRUE@ecore_config_ipc_ecore.c
41
42@BUILD_ECORE_IPC_TRUE@am__append_2 = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la
43subdir = src/lib/ecore_config
44DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
45 $(srcdir)/Makefile.in
46ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
47am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/ac_path_generic.m4 \
49 $(top_srcdir)/m4/check_x_extension.m4 \
50 $(top_srcdir)/m4/ecore_check_module.m4 \
51 $(top_srcdir)/m4/ecore_check_options.m4 \
52 $(top_srcdir)/m4/efl_compiler_flag.m4 \
53 $(top_srcdir)/m4/efl_doxygen.m4 \
54 $(top_srcdir)/m4/efl_examples.m4 \
55 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
56 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
57 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
58 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
59 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
60 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
61 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
62 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
63 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
64am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
65 $(ACLOCAL_M4)
66mkinstalldirs = $(install_sh) -d
67CONFIG_HEADER = $(top_builddir)/config.h
68CONFIG_CLEAN_FILES =
69CONFIG_CLEAN_VPATH_FILES =
70am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
71am__vpath_adj = case $$p in \
72 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
73 *) f=$$p;; \
74 esac;
75am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
76am__install_max = 40
77am__nobase_strip_setup = \
78 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
79am__nobase_strip = \
80 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
81am__nobase_list = $(am__nobase_strip_setup); \
82 for p in $$list; do echo "$$p $$p"; done | \
83 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
84 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
85 if (++n[$$2] == $(am__install_max)) \
86 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
87 END { for (dir in files) print dir, files[dir] }'
88am__base_list = \
89 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
90 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
91am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
92LTLIBRARIES = $(lib_LTLIBRARIES)
93libecore_config_la_DEPENDENCIES = \
94 $(top_builddir)/src/lib/ecore/libecore.la $(am__append_2)
95am__libecore_config_la_SOURCES_DIST = ecore_config.c \
96 ecore_config_util.c ecore_config_storage.c \
97 ecore_config_extra.c ecore_config_db.c ecore_config_ipc_main.c \
98 ecore_config_ipc_ecore.c
99@BUILD_ECORE_IPC_TRUE@am__objects_1 = ecore_config_ipc_main.lo \
100@BUILD_ECORE_IPC_TRUE@ ecore_config_ipc_ecore.lo
101am_libecore_config_la_OBJECTS = ecore_config.lo ecore_config_util.lo \
102 ecore_config_storage.lo ecore_config_extra.lo \
103 ecore_config_db.lo $(am__objects_1)
104libecore_config_la_OBJECTS = $(am_libecore_config_la_OBJECTS)
105AM_V_lt = $(am__v_lt_$(V))
106am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
107am__v_lt_0 = --silent
108libecore_config_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
109 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
110 $(AM_CFLAGS) $(CFLAGS) $(libecore_config_la_LDFLAGS) \
111 $(LDFLAGS) -o $@
112DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
113depcomp = $(SHELL) $(top_srcdir)/depcomp
114am__depfiles_maybe = depfiles
115am__mv = mv -f
116COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
117 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
118LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
119 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
120 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
121 $(AM_CFLAGS) $(CFLAGS)
122AM_V_CC = $(am__v_CC_$(V))
123am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
124am__v_CC_0 = @echo " CC " $@;
125AM_V_at = $(am__v_at_$(V))
126am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
127am__v_at_0 = @
128CCLD = $(CC)
129LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
130 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
131 $(AM_LDFLAGS) $(LDFLAGS) -o $@
132AM_V_CCLD = $(am__v_CCLD_$(V))
133am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
134am__v_CCLD_0 = @echo " CCLD " $@;
135AM_V_GEN = $(am__v_GEN_$(V))
136am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
137am__v_GEN_0 = @echo " GEN " $@;
138SOURCES = $(libecore_config_la_SOURCES)
139DIST_SOURCES = $(am__libecore_config_la_SOURCES_DIST)
140HEADERS = $(includes_HEADERS)
141ETAGS = etags
142CTAGS = ctags
143DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
144ACLOCAL = @ACLOCAL@
145ALLOCA = @ALLOCA@
146AMTAR = @AMTAR@
147AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
148AR = @AR@
149AS = @AS@
150AUTOCONF = @AUTOCONF@
151AUTOHEADER = @AUTOHEADER@
152AUTOMAKE = @AUTOMAKE@
153AWK = @AWK@
154CARES_CFLAGS = @CARES_CFLAGS@
155CARES_LIBS = @CARES_LIBS@
156CC = @CC@
157CCDEPMODE = @CCDEPMODE@
158CFLAGS = @CFLAGS@
159CHECK_CFLAGS = @CHECK_CFLAGS@
160CHECK_LIBS = @CHECK_LIBS@
161CPP = @CPP@
162CPPFLAGS = @CPPFLAGS@
163CURL_CFLAGS = @CURL_CFLAGS@
164CURL_LIBS = @CURL_LIBS@
165CXX = @CXX@
166CXXCPP = @CXXCPP@
167CXXDEPMODE = @CXXDEPMODE@
168CXXFLAGS = @CXXFLAGS@
169CYGPATH_W = @CYGPATH_W@
170DEFS = @DEFS@
171DEPDIR = @DEPDIR@
172DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
173DIRECTFB_LIBS = @DIRECTFB_LIBS@
174DLLTOOL = @DLLTOOL@
175DSYMUTIL = @DSYMUTIL@
176DUMPBIN = @DUMPBIN@
177ECHO_C = @ECHO_C@
178ECHO_N = @ECHO_N@
179ECHO_T = @ECHO_T@
180ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
181ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
182EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
183EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
184EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
185EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
186EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
187EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
188EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
189EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
190EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
191EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
192EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
193EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
194EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
195EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
196EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
197EGREP = @EGREP@
198EINA_CFLAGS = @EINA_CFLAGS@
199EINA_LIBS = @EINA_LIBS@
200ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
201ESCAPE_LIBS = @ESCAPE_LIBS@
202EVAS_CFLAGS = @EVAS_CFLAGS@
203EVAS_LIBS = @EVAS_LIBS@
204EVIL_CFLAGS = @EVIL_CFLAGS@
205EVIL_LIBS = @EVIL_LIBS@
206EXEEXT = @EXEEXT@
207EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
208EXOTIC_LIBS = @EXOTIC_LIBS@
209FGREP = @FGREP@
210GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
211GLIB_CFLAGS = @GLIB_CFLAGS@
212GLIB_LIBS = @GLIB_LIBS@
213GMSGFMT = @GMSGFMT@
214GMSGFMT_015 = @GMSGFMT_015@
215GREP = @GREP@
216INSTALL = @INSTALL@
217INSTALL_DATA = @INSTALL_DATA@
218INSTALL_PROGRAM = @INSTALL_PROGRAM@
219INSTALL_SCRIPT = @INSTALL_SCRIPT@
220INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
221INTLLIBS = @INTLLIBS@
222INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
223KEYSYMDEFS = @KEYSYMDEFS@
224LD = @LD@
225LDFLAGS = @LDFLAGS@
226LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
227LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
228LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
229LIBICONV = @LIBICONV@
230LIBINTL = @LIBINTL@
231LIBOBJS = @LIBOBJS@
232LIBS = @LIBS@
233LIBTOOL = @LIBTOOL@
234LIPO = @LIPO@
235LN_S = @LN_S@
236LTLIBICONV = @LTLIBICONV@
237LTLIBINTL = @LTLIBINTL@
238LTLIBOBJS = @LTLIBOBJS@
239MAKEINFO = @MAKEINFO@
240MKDIR_P = @MKDIR_P@
241MSGFMT = @MSGFMT@
242MSGFMT_015 = @MSGFMT_015@
243MSGMERGE = @MSGMERGE@
244NM = @NM@
245NMEDIT = @NMEDIT@
246OBJC = @OBJC@
247OBJCDEPMODE = @OBJCDEPMODE@
248OBJCFLAGS = @OBJCFLAGS@
249OBJDUMP = @OBJDUMP@
250OBJEXT = @OBJEXT@
251OTOOL = @OTOOL@
252OTOOL64 = @OTOOL64@
253PACKAGE = @PACKAGE@
254PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
255PACKAGE_NAME = @PACKAGE_NAME@
256PACKAGE_STRING = @PACKAGE_STRING@
257PACKAGE_TARNAME = @PACKAGE_TARNAME@
258PACKAGE_URL = @PACKAGE_URL@
259PACKAGE_VERSION = @PACKAGE_VERSION@
260PATH_SEPARATOR = @PATH_SEPARATOR@
261PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
262PIXMAN_LIBS = @PIXMAN_LIBS@
263PKG_CONFIG = @PKG_CONFIG@
264PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
265PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
266POSUB = @POSUB@
267RANLIB = @RANLIB@
268SCIM_CFLAGS = @SCIM_CFLAGS@
269SCIM_LIBS = @SCIM_LIBS@
270SDL_CFLAGS = @SDL_CFLAGS@
271SDL_CONFIG = @SDL_CONFIG@
272SDL_LIBS = @SDL_LIBS@
273SED = @SED@
274SET_MAKE = @SET_MAKE@
275SHELL = @SHELL@
276SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
277SSL_CFLAGS = @SSL_CFLAGS@
278SSL_LIBS = @SSL_LIBS@
279STRIP = @STRIP@
280TLS2_CFLAGS = @TLS2_CFLAGS@
281TLS2_LIBS = @TLS2_LIBS@
282TLS_CFLAGS = @TLS_CFLAGS@
283TLS_LIBS = @TLS_LIBS@
284TSLIB_CFLAGS = @TSLIB_CFLAGS@
285TSLIB_LIBS = @TSLIB_LIBS@
286USE_NLS = @USE_NLS@
287VERSION = @VERSION@
288VMAJ = @VMAJ@
289WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
290WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
291WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
292WAYLAND_LIBS = @WAYLAND_LIBS@
293WIN32_CFLAGS = @WIN32_CFLAGS@
294WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
295WIN32_LIBS = @WIN32_LIBS@
296XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
297XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
298XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
299XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
300XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
301XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
302XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
303XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
304XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
305XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
306XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
307XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
308XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
309XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
310XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
311XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
312XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
313XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
314XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
315XCB_X11_LIBS = @XCB_X11_LIBS@
316XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
317XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
318XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
319XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
320XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
321XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
322XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
323XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
324XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
325XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
326XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
327XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
328XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
329XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
330XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
331XDAMAGE_LIBS = @XDAMAGE_LIBS@
332XDPMS_CFLAGS = @XDPMS_CFLAGS@
333XDPMS_LIBS = @XDPMS_LIBS@
334XFIXES_CFLAGS = @XFIXES_CFLAGS@
335XFIXES_LIBS = @XFIXES_LIBS@
336XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
337XGESTURE_LIBS = @XGESTURE_LIBS@
338XGETTEXT = @XGETTEXT@
339XGETTEXT_015 = @XGETTEXT_015@
340XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
341XI2_CFLAGS = @XI2_CFLAGS@
342XI2_LIBS = @XI2_LIBS@
343XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
344XINERAMA_LIBS = @XINERAMA_LIBS@
345XKB_CFLAGS = @XKB_CFLAGS@
346XKB_LIBS = @XKB_LIBS@
347XMKMF = @XMKMF@
348XPRINT_CFLAGS = @XPRINT_CFLAGS@
349XPRINT_LIBS = @XPRINT_LIBS@
350XRANDR_CFLAGS = @XRANDR_CFLAGS@
351XRANDR_LIBS = @XRANDR_LIBS@
352XRENDER_CFLAGS = @XRENDER_CFLAGS@
353XRENDER_LIBS = @XRENDER_LIBS@
354XSS_CFLAGS = @XSS_CFLAGS@
355XSS_LIBS = @XSS_LIBS@
356XTEST_CFLAGS = @XTEST_CFLAGS@
357XTEST_LIBS = @XTEST_LIBS@
358X_CFLAGS = @X_CFLAGS@
359X_EXTRA_LIBS = @X_EXTRA_LIBS@
360X_LIBS = @X_LIBS@
361X_PRE_LIBS = @X_PRE_LIBS@
362Xcursor_cflags = @Xcursor_cflags@
363Xcursor_libs = @Xcursor_libs@
364abs_builddir = @abs_builddir@
365abs_srcdir = @abs_srcdir@
366abs_top_builddir = @abs_top_builddir@
367abs_top_srcdir = @abs_top_srcdir@
368ac_ct_CC = @ac_ct_CC@
369ac_ct_CXX = @ac_ct_CXX@
370ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
371ac_ct_OBJC = @ac_ct_OBJC@
372am__include = @am__include@
373am__leading_dot = @am__leading_dot@
374am__quote = @am__quote@
375am__tar = @am__tar@
376am__untar = @am__untar@
377bindir = @bindir@
378build = @build@
379build_alias = @build_alias@
380build_cpu = @build_cpu@
381build_os = @build_os@
382build_vendor = @build_vendor@
383builddir = @builddir@
384cocoa_ldflags = @cocoa_ldflags@
385datadir = @datadir@
386datarootdir = @datarootdir@
387dlopen_libs = @dlopen_libs@
388docdir = @docdir@
389dvidir = @dvidir@
390ecore_cocoa_cflags = @ecore_cocoa_cflags@
391ecore_cocoa_libs = @ecore_cocoa_libs@
392ecore_con_cflags = @ecore_con_cflags@
393ecore_con_libs = @ecore_con_libs@
394ecore_directfb_cflags = @ecore_directfb_cflags@
395ecore_directfb_libs = @ecore_directfb_libs@
396ecore_evas_cflags = @ecore_evas_cflags@
397ecore_evas_libs = @ecore_evas_libs@
398ecore_fb_cflags = @ecore_fb_cflags@
399ecore_fb_libs = @ecore_fb_libs@
400ecore_file_cflags = @ecore_file_cflags@
401ecore_file_libs = @ecore_file_libs@
402ecore_imf_cflags = @ecore_imf_cflags@
403ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
404ecore_imf_evas_libs = @ecore_imf_evas_libs@
405ecore_imf_libs = @ecore_imf_libs@
406ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
407ecore_imf_scim_libs = @ecore_imf_scim_libs@
408ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
409ecore_imf_xim_libs = @ecore_imf_xim_libs@
410ecore_input_cflags = @ecore_input_cflags@
411ecore_input_evas_cflags = @ecore_input_evas_cflags@
412ecore_input_evas_libs = @ecore_input_evas_libs@
413ecore_input_libs = @ecore_input_libs@
414ecore_ipc_cflags = @ecore_ipc_cflags@
415ecore_ipc_libs = @ecore_ipc_libs@
416ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
417ecore_psl1ght_libs = @ecore_psl1ght_libs@
418ecore_sdl_cflags = @ecore_sdl_cflags@
419ecore_sdl_libs = @ecore_sdl_libs@
420ecore_wayland_cflags = @ecore_wayland_cflags@
421ecore_wayland_libs = @ecore_wayland_libs@
422ecore_win32_cflags = @ecore_win32_cflags@
423ecore_win32_libs = @ecore_win32_libs@
424ecore_wince_cflags = @ecore_wince_cflags@
425ecore_wince_libs = @ecore_wince_libs@
426ecore_x_cflags = @ecore_x_cflags@
427ecore_x_libs = @ecore_x_libs@
428ecore_x_libs_private = @ecore_x_libs_private@
429efl_doxygen = @efl_doxygen@
430efl_have_doxygen = @efl_have_doxygen@
431exec_prefix = @exec_prefix@
432have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
433host = @host@
434host_alias = @host_alias@
435host_cpu = @host_cpu@
436host_os = @host_os@
437host_vendor = @host_vendor@
438htmldir = @htmldir@
439includedir = @includedir@
440infodir = @infodir@
441install_sh = @install_sh@
442libdir = @libdir@
443libexecdir = @libexecdir@
444localedir = @localedir@
445localstatedir = @localstatedir@
446lt_ECHO = @lt_ECHO@
447lt_enable_auto_import = @lt_enable_auto_import@
448mandir = @mandir@
449mkdir_p = @mkdir_p@
450oldincludedir = @oldincludedir@
451pdfdir = @pdfdir@
452pkgconfig_requires_private = @pkgconfig_requires_private@
453prefix = @prefix@
454program_transform_name = @program_transform_name@
455psdir = @psdir@
456release_info = @release_info@
457requirements_ecore = @requirements_ecore@
458requirements_ecore_cocoa = @requirements_ecore_cocoa@
459requirements_ecore_con = @requirements_ecore_con@
460requirements_ecore_directfb = @requirements_ecore_directfb@
461requirements_ecore_evas = @requirements_ecore_evas@
462requirements_ecore_fb = @requirements_ecore_fb@
463requirements_ecore_file = @requirements_ecore_file@
464requirements_ecore_imf = @requirements_ecore_imf@
465requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
466requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
467requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
468requirements_ecore_input = @requirements_ecore_input@
469requirements_ecore_input_evas = @requirements_ecore_input_evas@
470requirements_ecore_ipc = @requirements_ecore_ipc@
471requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
472requirements_ecore_sdl = @requirements_ecore_sdl@
473requirements_ecore_wayland = @requirements_ecore_wayland@
474requirements_ecore_win32 = @requirements_ecore_win32@
475requirements_ecore_wince = @requirements_ecore_wince@
476requirements_ecore_x = @requirements_ecore_x@
477rt_libs = @rt_libs@
478sbindir = @sbindir@
479sharedstatedir = @sharedstatedir@
480srcdir = @srcdir@
481sysconfdir = @sysconfdir@
482target_alias = @target_alias@
483top_build_prefix = @top_build_prefix@
484top_builddir = @top_builddir@
485top_srcdir = @top_srcdir@
486version_info = @version_info@
487x_cflags = @x_cflags@
488x_includes = @x_includes@
489x_libs = @x_libs@
490MAINTAINERCLEANFILES = Makefile.in
491AM_CPPFLAGS = \
492-I$(top_srcdir)/src/lib/ecore \
493-I$(top_srcdir)/src/lib/ecore_ipc \
494-I$(top_srcdir)/ \
495-I$(top_builddir)/src/lib/ecore \
496-I$(top_builddir)/src/lib/ecore_ipc \
497-I$(top_builddir)/ \
498-DPACKAGE_BIN_DIR=\"$(bindir)\" \
499-DPACKAGE_LIB_DIR=\"$(libdir)\" \
500-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
501@EVAS_CFLAGS@ \
502@EET_CFLAGS@ \
503@EINA_CFLAGS@
504
505CLEANFILES = $(DB)
506
507#DB = system.db
508#$(DB): Makefile
509# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/theme/name str "winter"
510# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/font/path str "$(pkgdatadir)/data/fonts"
511# 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`
512# 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`
513lib_LTLIBRARIES = libecore_config.la
514includes_HEADERS = Ecore_Config.h
515includesdir = $(includedir)/ecore-@VMAJ@
516libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
517
518#config_DATA = $(DB)
519#configdir = $(pkgdatadir)
520libecore_config_la_SOURCES = ecore_config.c ecore_config_util.c \
521 ecore_config_storage.c ecore_config_extra.c ecore_config_db.c \
522 $(am__append_1)
523libecore_config_la_LIBADD = $(top_builddir)/src/lib/ecore/libecore.la \
524 @EET_LIBS@ @EINA_LIBS@ @EVAS_LIBS@ $(am__append_2)
525EXTRA_DIST = \
526ecore_config_ipc.h \
527ecore_config_private.h \
528ecore_config_util.h
529
530all: all-am
531
532.SUFFIXES:
533.SUFFIXES: .c .lo .o .obj
534$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
535 @for dep in $?; do \
536 case '$(am__configure_deps)' in \
537 *$$dep*) \
538 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
539 && { if test -f $@; then exit 0; else break; fi; }; \
540 exit 1;; \
541 esac; \
542 done; \
543 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_config/Makefile'; \
544 $(am__cd) $(top_srcdir) && \
545 $(AUTOMAKE) --gnu src/lib/ecore_config/Makefile
546.PRECIOUS: Makefile
547Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
548 @case '$?' in \
549 *config.status*) \
550 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
551 *) \
552 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
553 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
554 esac;
555
556$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
557 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
558
559$(top_srcdir)/configure: $(am__configure_deps)
560 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
561$(ACLOCAL_M4): $(am__aclocal_m4_deps)
562 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
563$(am__aclocal_m4_deps):
564install-libLTLIBRARIES: $(lib_LTLIBRARIES)
565 @$(NORMAL_INSTALL)
566 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
567 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
568 list2=; for p in $$list; do \
569 if test -f $$p; then \
570 list2="$$list2 $$p"; \
571 else :; fi; \
572 done; \
573 test -z "$$list2" || { \
574 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
575 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
576 }
577
578uninstall-libLTLIBRARIES:
579 @$(NORMAL_UNINSTALL)
580 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
581 for p in $$list; do \
582 $(am__strip_dir) \
583 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
584 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
585 done
586
587clean-libLTLIBRARIES:
588 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
589 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
590 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
591 test "$$dir" != "$$p" || dir=.; \
592 echo "rm -f \"$${dir}/so_locations\""; \
593 rm -f "$${dir}/so_locations"; \
594 done
595libecore_config.la: $(libecore_config_la_OBJECTS) $(libecore_config_la_DEPENDENCIES)
596 $(AM_V_CCLD)$(libecore_config_la_LINK) -rpath $(libdir) $(libecore_config_la_OBJECTS) $(libecore_config_la_LIBADD) $(LIBS)
597
598mostlyclean-compile:
599 -rm -f *.$(OBJEXT)
600
601distclean-compile:
602 -rm -f *.tab.c
603
604@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config.Plo@am__quote@
605@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_db.Plo@am__quote@
606@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_extra.Plo@am__quote@
607@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_ipc_ecore.Plo@am__quote@
608@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_ipc_main.Plo@am__quote@
609@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_storage.Plo@am__quote@
610@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_util.Plo@am__quote@
611
612.c.o:
613@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
614@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
615@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
616@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
617@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
618@am__fastdepCC_FALSE@ $(COMPILE) -c $<
619
620.c.obj:
621@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
622@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
623@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
624@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
625@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
626@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
627
628.c.lo:
629@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
630@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
631@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
632@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
633@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
634@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
635
636mostlyclean-libtool:
637 -rm -f *.lo
638
639clean-libtool:
640 -rm -rf .libs _libs
641install-includesHEADERS: $(includes_HEADERS)
642 @$(NORMAL_INSTALL)
643 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
644 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
645 for p in $$list; do \
646 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
647 echo "$$d$$p"; \
648 done | $(am__base_list) | \
649 while read files; do \
650 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
651 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
652 done
653
654uninstall-includesHEADERS:
655 @$(NORMAL_UNINSTALL)
656 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
657 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
658 test -n "$$files" || exit 0; \
659 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
660 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
661
662ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
663 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
664 unique=`for i in $$list; do \
665 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
666 done | \
667 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
668 END { if (nonempty) { for (i in files) print i; }; }'`; \
669 mkid -fID $$unique
670tags: TAGS
671
672TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
673 $(TAGS_FILES) $(LISP)
674 set x; \
675 here=`pwd`; \
676 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
677 unique=`for i in $$list; do \
678 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
679 done | \
680 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
681 END { if (nonempty) { for (i in files) print i; }; }'`; \
682 shift; \
683 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
684 test -n "$$unique" || unique=$$empty_fix; \
685 if test $$# -gt 0; then \
686 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
687 "$$@" $$unique; \
688 else \
689 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
690 $$unique; \
691 fi; \
692 fi
693ctags: CTAGS
694CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
695 $(TAGS_FILES) $(LISP)
696 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
697 unique=`for i in $$list; do \
698 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
699 done | \
700 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
701 END { if (nonempty) { for (i in files) print i; }; }'`; \
702 test -z "$(CTAGS_ARGS)$$unique" \
703 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
704 $$unique
705
706GTAGS:
707 here=`$(am__cd) $(top_builddir) && pwd` \
708 && $(am__cd) $(top_srcdir) \
709 && gtags -i $(GTAGS_ARGS) "$$here"
710
711distclean-tags:
712 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
713
714distdir: $(DISTFILES)
715 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
716 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
717 list='$(DISTFILES)'; \
718 dist_files=`for file in $$list; do echo $$file; done | \
719 sed -e "s|^$$srcdirstrip/||;t" \
720 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
721 case $$dist_files in \
722 */*) $(MKDIR_P) `echo "$$dist_files" | \
723 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
724 sort -u` ;; \
725 esac; \
726 for file in $$dist_files; do \
727 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
728 if test -d $$d/$$file; then \
729 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
730 if test -d "$(distdir)/$$file"; then \
731 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
732 fi; \
733 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
734 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
735 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
736 fi; \
737 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
738 else \
739 test -f "$(distdir)/$$file" \
740 || cp -p $$d/$$file "$(distdir)/$$file" \
741 || exit 1; \
742 fi; \
743 done
744check-am: all-am
745check: check-am
746all-am: Makefile $(LTLIBRARIES) $(HEADERS)
747installdirs:
748 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
749 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
750 done
751install: install-am
752install-exec: install-exec-am
753install-data: install-data-am
754uninstall: uninstall-am
755
756install-am: all-am
757 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
758
759installcheck: installcheck-am
760install-strip:
761 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
762 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
763 `test -z '$(STRIP)' || \
764 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
765mostlyclean-generic:
766
767clean-generic:
768 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
769
770distclean-generic:
771 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
772 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
773
774maintainer-clean-generic:
775 @echo "This command is intended for maintainers to use"
776 @echo "it deletes files that may require special tools to rebuild."
777 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
778clean: clean-am
779
780clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
781 mostlyclean-am
782
783distclean: distclean-am
784 -rm -rf ./$(DEPDIR)
785 -rm -f Makefile
786distclean-am: clean-am distclean-compile distclean-generic \
787 distclean-tags
788
789dvi: dvi-am
790
791dvi-am:
792
793html: html-am
794
795html-am:
796
797info: info-am
798
799info-am:
800
801install-data-am: install-includesHEADERS
802
803install-dvi: install-dvi-am
804
805install-dvi-am:
806
807install-exec-am: install-libLTLIBRARIES
808
809install-html: install-html-am
810
811install-html-am:
812
813install-info: install-info-am
814
815install-info-am:
816
817install-man:
818
819install-pdf: install-pdf-am
820
821install-pdf-am:
822
823install-ps: install-ps-am
824
825install-ps-am:
826
827installcheck-am:
828
829maintainer-clean: maintainer-clean-am
830 -rm -rf ./$(DEPDIR)
831 -rm -f Makefile
832maintainer-clean-am: distclean-am maintainer-clean-generic
833
834mostlyclean: mostlyclean-am
835
836mostlyclean-am: mostlyclean-compile mostlyclean-generic \
837 mostlyclean-libtool
838
839pdf: pdf-am
840
841pdf-am:
842
843ps: ps-am
844
845ps-am:
846
847uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
848
849.MAKE: install-am install-strip
850
851.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
852 clean-libLTLIBRARIES clean-libtool ctags distclean \
853 distclean-compile distclean-generic distclean-libtool \
854 distclean-tags distdir dvi dvi-am html html-am info info-am \
855 install install-am install-data install-data-am install-dvi \
856 install-dvi-am install-exec install-exec-am install-html \
857 install-html-am install-includesHEADERS install-info \
858 install-info-am install-libLTLIBRARIES install-man install-pdf \
859 install-pdf-am install-ps install-ps-am install-strip \
860 installcheck installcheck-am installdirs maintainer-clean \
861 maintainer-clean-generic mostlyclean mostlyclean-compile \
862 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
863 tags uninstall uninstall-am uninstall-includesHEADERS \
864 uninstall-libLTLIBRARIES
865
866
867# Tell versions [3.59,3.63) of GNU make to not export all variables.
868# Otherwise a system limit (for SysV at least) may be exceeded.
869.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config.c b/libraries/ecore/src/lib/ecore_config/ecore_config.c
deleted file mode 100644
index e81538e..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config.c
+++ /dev/null
@@ -1,1870 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <string.h>
6#include <ctype.h>
7#include <stdio.h>
8#include <stdlib.h>
9
10#include <sys/param.h>
11#include <sys/types.h>
12#include <sys/stat.h>
13#include <fcntl.h>
14#include <limits.h>
15#include <unistd.h>
16
17#include "Ecore_Config.h"
18#include "ecore_config_private.h"
19#include "ecore_config_ipc.h"
20
21#include "ecore_config_util.h"
22int _ecore_config_log_dom = -1;
23int DEBUG = 0;
24EAPI Ecore_Config_Server *__ecore_config_server_global = NULL;
25EAPI Ecore_Config_Server *__ecore_config_server_local = NULL;
26EAPI Ecore_Config_Bundle *__ecore_config_bundle_local = NULL;
27EAPI char *__ecore_config_app_name = NULL;
28int __ecore_config_system_init = 0;
29
30static int _ecore_config_system_init_no_load(void);
31static int _ecore_config_system_load(void);
32
33static inline void *__ecore_argb_to_long(int a, int r, int g, int b, long *v);
34static inline void *__ecore_argbstr_to_long(const char *argb, long *v);
35
36static const char *_ecore_config_type[] =
37 { "undefined", "integer", "float", "string", "colour", "theme", "boolean", "structure" };
38
39/**
40 * @defgroup Ecore_Config_Property_Group Ecore Config Property Functions
41 *
42 * Functions that retrieve or set the attributes relating to a property.
43 */
44
45/**
46 * Removes the given property from the local configuration and destroys it.
47 * @param e Property to destroy.
48 * @return @c NULL
49 * @ingroup Ecore_Config_Property_Group
50 */
51EAPI Ecore_Config_Prop *
52ecore_config_dst(Ecore_Config_Prop * e)
53{
54 Ecore_Config_Bundle *t;
55 Ecore_Config_Prop *p, *c;
56 Ecore_Config_Listener_List *l;
57
58 p = NULL;
59 t = __ecore_config_bundle_local;
60 c = t->data;
61
62 if (!e || !e->key)
63 return NULL;
64 if (t)
65 {
66 if (t->data == e)
67 t->data = e->next;
68 else
69 {
70 do
71 {
72 p = c;
73 c = c->next;
74 }
75 while (c && (c != e));
76 if (c) /* remove from list if even in there */
77 p->next = c->next;
78 }
79 }
80
81 while (e->listeners)
82 {
83 l = e->listeners;
84 e->listeners = e->listeners->next;
85 free(l);
86 }
87
88 if (e->key)
89 free(e->key);
90 if (e->ptr && ((e->type == ECORE_CONFIG_STR) || (e->type == ECORE_CONFIG_THM)))
91 free(e->ptr);
92
93 memset(e, 0, sizeof(Ecore_Config_Prop));
94 free(e);
95
96 return NULL;
97}
98
99/**
100 * @defgroup Ecore_Config_Get_Group Configuration Retrieve Functions
101 *
102 * Functions that retrieve configuration values, based on type.
103 */
104
105/**
106 * Returns the property with the given key.
107 * @param key The unique name of the wanted property.
108 * @return The property that corresponds to the given key. @c NULL if the
109 * key could not be found.
110 * @ingroup Ecore_Config_Get_Group
111 */
112EAPI Ecore_Config_Prop *
113ecore_config_get(const char *key)
114{
115 Ecore_Config_Bundle *t;
116 Ecore_Config_Prop *e;
117
118 t = __ecore_config_bundle_local;
119 if (!t || !key)
120 return NULL;
121 e = t->data;
122 while (e)
123 {
124 if (!strcmp(key, e->key))
125 return e;
126 e = e->next;
127 }
128 return NULL;
129}
130
131/**
132 * Returns the type of the property.
133 * @param e Property to get the type of.
134 * @returns The type of the property. If the property is invalid, then the
135 * string "not found" is returned.
136 * @ingroup Ecore_Config_Property_Group
137 */
138EAPI const char *
139ecore_config_type_get(const Ecore_Config_Prop * e)
140{
141 if (e)
142 {
143 return _ecore_config_type[e->type];
144 }
145 return "not found";
146}
147
148/**
149 * Returns the specified property as a string.
150 * @param key The property key.
151 * @return The string value of the property. The function returns @c NULL if
152 * the property is not a string or is not set.
153 * @ingroup Ecore_Config_Get_Group
154 */
155EAPI char *
156ecore_config_string_get(const char *key)
157{
158 return _ecore_config_string_get( ecore_config_get(key) );
159}
160
161char *
162_ecore_config_string_get(Ecore_Config_Prop *e)
163{
164 return (e && (e->type == ECORE_CONFIG_STR) && e->ptr) ? strdup(e->ptr) : NULL;
165}
166
167/**
168 * Returns the specified property as an integer.
169 * @param key The property key.
170 * @return The value of the property. The function returns -1 if the
171 * property is not an integer or is not set.
172 * @ingroup Ecore_Config_Get_Group
173 */
174EAPI int
175ecore_config_boolean_get(const char *key)
176{
177 return _ecore_config_boolean_get( ecore_config_get(key) );
178}
179
180int
181_ecore_config_boolean_get(Ecore_Config_Prop *e)
182{
183 return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_BLN))) ? (e->val != 0) : -1;
184}
185
186/**
187 * Returns the specified property as a long integer.
188 * @param key The property key.
189 * @return The integer value of the property. The function returns 0 if the
190 * property is not an integer or is not set.
191 * @ingroup Ecore_Config_Get_Group
192 */
193EAPI long
194ecore_config_int_get(const char *key)
195{
196 return _ecore_config_int_get( ecore_config_get(key) );
197}
198
199long
200_ecore_config_int_get(Ecore_Config_Prop *e)
201{
202 return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_RGB))) ? e->val : 0L;
203}
204
205/**
206 * Returns the specified property as a float.
207 * @param key The property key.
208 * @return The float value of the property. The function returns 0.0 if the
209 * property is not a float or is not set.
210 * @ingroup Ecore_Config_Get_Group
211 */
212EAPI float
213ecore_config_float_get(const char *key)
214{
215 return _ecore_config_float_get( ecore_config_get(key) );
216}
217
218float
219_ecore_config_float_get(Ecore_Config_Prop *e)
220{
221 return (e && (e->type == ECORE_CONFIG_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0;
222}
223
224/**
225 * Finds the alpha, red, green and blue values of a color property.
226 * @param key The property key.
227 * @param a A pointer to an integer to store the alpha value into.
228 * @param r A pointer to an integer to store the red value into.
229 * @param g A pointer to an integer to store the green value into.
230 * @param b A pointer to an integer to store the blue value into.
231 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL
232 * otherwise.
233 * @ingroup Ecore_Config_Get_Group
234 */
235EAPI int
236ecore_config_argb_get(const char *key, int *a, int *r, int *g, int *b)
237{
238 return _ecore_config_argb_get( ecore_config_get(key), a, r, g, b);
239}
240
241int
242_ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, int *g, int *b)
243{
244 if (e && ((e->type == ECORE_CONFIG_RGB)))
245 {
246 if(a) *a = (e->val >> 24) & 0xff;
247 if(r) *r = (e->val >> 16) & 0xff;
248 if(g) *g = (e->val >> 8) & 0xff;
249 if(b) *b = e->val & 0xff;
250 return ECORE_CONFIG_ERR_SUCC;
251 }
252 return ECORE_CONFIG_ERR_FAIL;
253}
254
255/**
256 * Returns a color property as a long
257 * @param key The property key.
258 * @return ARGB data as long
259 * @ingroup Ecore_Config_Get_Group
260 */
261EAPI long
262ecore_config_argbint_get(const char *key)
263{
264 return _ecore_config_argbint_get( ecore_config_get(key) );
265}
266
267long
268_ecore_config_argbint_get(Ecore_Config_Prop *e)
269{
270 if (e && ((e->type == ECORE_CONFIG_RGB)))
271 {
272 return e->val;
273 }
274 return 0L;
275}
276
277/**
278 * Returns a color property as a string of hexadecimal characters.
279 * @param key The property key.
280 * @return A string of hexadecimal characters in the format #aarrggbb.
281 * @ingroup Ecore_Config_Get_Group
282 */
283EAPI char *
284ecore_config_argbstr_get(const char *key)
285{
286 return _ecore_config_argbstr_get( ecore_config_get(key) );
287}
288
289char *
290_ecore_config_argbstr_get(Ecore_Config_Prop *e)
291{
292 char *r;
293
294 r = NULL;
295 esprintf(&r, "#%08x", _ecore_config_int_get(e));
296 return r;
297}
298
299/**
300 * Returns a theme property.
301 * @param key The property key.
302 * @return The name of the theme the property refers to. The function returns
303 * @c NULL if the property is not a theme or is not set.
304 * @ingroup Ecore_Config_Get_Group
305 */
306EAPI char *
307ecore_config_theme_get(const char *key)
308{
309 return _ecore_config_theme_get( ecore_config_get(key) );
310}
311
312char *
313_ecore_config_theme_get(Ecore_Config_Prop *e)
314{
315 return (e && (e->type == ECORE_CONFIG_THM)) ? strdup(e->ptr) : NULL;
316}
317
318/**
319 * Retrieves the key as a string.
320 * @param key The property key.
321 * @return Returns a character array in the form of 'key:type=value'. @c NULL
322 * is returned if the property does not exist.
323 * @ingroup Ecore_Config_Get_Group
324 */
325EAPI char *
326ecore_config_as_string_get(const char *key)
327{
328 Ecore_Config_Prop *e;
329 char *val;
330 char *r;
331
332 val = NULL;
333 r = NULL;
334 if (!(e = ecore_config_get(key)))
335 ERR("no such property, \"%s\"...", key);
336 else
337 {
338 switch (e->type)
339 {
340 case ECORE_CONFIG_NIL:
341 val = strdup("<nil>");
342 break;
343 case ECORE_CONFIG_INT:
344 esprintf(&val, "%ld", _ecore_config_int_get(e));
345 break;
346 case ECORE_CONFIG_BLN:
347 esprintf(&val, "%ld", _ecore_config_boolean_get(e));
348 break;
349 case ECORE_CONFIG_FLT:
350 esprintf(&val, "%lf", _ecore_config_float_get(e));
351 break;
352 case ECORE_CONFIG_STR:
353 esprintf(&val, "\"%s\"", _ecore_config_string_get(e));
354 break;
355 case ECORE_CONFIG_RGB:
356 esprintf(&val, "#%08x", _ecore_config_int_get(e));
357 break;
358 case ECORE_CONFIG_THM:
359 esprintf(&val, "\"%s\"", _ecore_config_theme_get(e));
360 break;
361 case ECORE_CONFIG_SCT:
362 break;
363 default:
364 esprintf(&r, "%s:unknown_type", key);
365 break;
366 }
367 if (val)
368 {
369 esprintf(&r, "%s:%s=%s", key, _ecore_config_type[e->type], val);
370 free(val);
371 }
372 }
373 return r;
374}
375
376EAPI int
377ecore_config_bound(Ecore_Config_Prop * e)
378{
379 int ret;
380 long v;
381
382 ret = ECORE_CONFIG_ERR_SUCC;
383
384 if (!e)
385 return ECORE_CONFIG_ERR_FAIL;
386 if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
387 {
388 if ((e->val < e->lo))
389 {
390 WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
391 e->key, e->val, e->lo);
392 e->val = e->lo;
393 }
394 else if ((e->val > e->hi))
395 {
396 WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...",
397 e->key, e->val, e->hi);
398 e->val = e->hi;
399 }
400 else
401 ret = ECORE_CONFIG_ERR_IGNORED;
402 }
403 else
404 ret = ECORE_CONFIG_ERR_IGNORED;
405
406 if (e->step)
407 {
408 v = ((int)(e->val / e->step)) * e->step;
409 if (v != e->val)
410 {
411 if (e->type == ECORE_CONFIG_FLT)
412 WRN("ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...",
413 e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION,
414 ((double)e->step) / ECORE_CONFIG_FLOAT_PRECISION,
415 ((double)v) / ECORE_CONFIG_FLOAT_PRECISION);
416 else
417 WRN("ecore_config_bound(\"%s\"): integer value %ld not a multiple of %ld, adjusted to %ld...",
418 e->key, e->val, e->step, v);
419 ret = ECORE_CONFIG_ERR_SUCC;
420 e->val = v;
421 }
422 }
423
424 return ret;
425}
426
427/**
428 * Tries to guess the type of a property.
429 *
430 * This function first checks to see if the property exists. If it does, then
431 * the type of the stored property is returned. Otherwise, the function tries
432 * to guess the type of the property based on @p val.
433 *
434 * @param key The property key.
435 * @param val The value in string form.
436 * @return The type of the property determined by the function. Note that if
437 * val is @c NULL, @c ECORE_CONFIG_NIL will be returned.
438 */
439EAPI int
440ecore_config_type_guess(const char *key, const char *val)
441{
442 Ecore_Config_Prop *p;
443 char *l;
444
445 l = NULL;
446
447 if (key && (p = ecore_config_get(key)) && p->type != ECORE_CONFIG_NIL)
448 return p->type;
449
450 if (!val)
451 return ECORE_CONFIG_NIL;
452 if (val[0] == '#')
453 return ECORE_CONFIG_RGB;
454 strtol(val, &l, 10);
455 if (*l)
456 {
457 float f;
458
459 if (sscanf(val, "%f%*s", &f) != 1)
460 return ECORE_CONFIG_STR;
461 return ECORE_CONFIG_FLT;
462 }
463 return ECORE_CONFIG_INT;
464}
465
466static int
467ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type)
468{
469
470 if (!e)
471 return ECORE_CONFIG_ERR_NODATA;
472
473 if (!(val) && (type != ECORE_CONFIG_NIL && type != ECORE_CONFIG_SCT))
474 e->ptr = NULL;
475 else
476 {
477 if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
478 {
479 e->val = (long) *((int *)val);
480 e->type = type;
481 }
482 else if (type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM)
483 {
484 if (!(e->ptr = strdup(val)))
485 return ECORE_CONFIG_ERR_OOM;
486 if (e->type == ECORE_CONFIG_NIL)
487 e->type = type;
488 }
489 else if (type == ECORE_CONFIG_RGB)
490 {
491 __ecore_argbstr_to_long((char *)val, &e->val);
492 e->type = ECORE_CONFIG_RGB;
493 }
494 else if (type == ECORE_CONFIG_FLT)
495 {
496 e->val = (long) ((*((float *)val)) * ECORE_CONFIG_FLOAT_PRECISION);
497 e->type = ECORE_CONFIG_FLT;
498 }
499 else if (type == ECORE_CONFIG_SCT)
500 {
501 e->type = ECORE_CONFIG_SCT;
502 }
503 else
504 {
505 e->type = ECORE_CONFIG_NIL;
506 }
507
508 ecore_config_bound(e);
509 e->flags |= ECORE_CONFIG_FLAG_MODIFIED;
510 e->flags &= ~ECORE_CONFIG_FLAG_CMDLN;
511 return ECORE_CONFIG_ERR_SUCC;
512 }
513 return ECORE_CONFIG_ERR_IGNORED;
514}
515
516static int
517ecore_config_typed_add(const char *key, const void *val, int type)
518{
519 int error = ECORE_CONFIG_ERR_SUCC;
520 Ecore_Config_Prop *e = NULL;
521 Ecore_Config_Bundle *t;
522
523 t = __ecore_config_bundle_local;
524 if (!key)
525 return ECORE_CONFIG_ERR_NODATA;
526
527 if (!(e = calloc(1, sizeof(Ecore_Config_Prop))))
528 {
529 return ECORE_CONFIG_ERR_OOM;
530 }
531 else if (!(e->key = strdup(key)))
532 {
533 error = ECORE_CONFIG_ERR_OOM;
534 }
535 else if ((error = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
536 {
537 if (t)
538 {
539 e->next = t->data;
540 t->data = e;
541 }
542 return ECORE_CONFIG_ERR_SUCC;
543 }
544
545 if(e->key)
546 free(e->key);
547 if(e)
548 free(e);
549
550 if (error == ECORE_CONFIG_ERR_SUCC)
551 error = ECORE_CONFIG_ERR_FAIL;
552
553 return error;
554}
555
556static int
557ecore_config_add(const char *key, const char *val)
558{
559 int type;
560
561 type = ecore_config_type_guess(key, val);
562 return ecore_config_typed_add(key, val, type);
563}
564
565/**
566 * Sets the description field of the indicated property.
567 * @param key The property key.
568 * @param desc Description string.
569 * @note The description string is copied for the property's use. You can
570 * free @p desc once this function is called.
571 * @ingroup Ecore_Config_Property_Group
572 */
573EAPI int
574ecore_config_describe(const char *key, const char *desc)
575{
576 Ecore_Config_Prop *e;
577
578 if (!(e = ecore_config_get(key)))
579 return ECORE_CONFIG_ERR_NODATA;
580 e->description = strdup(desc);
581 return ECORE_CONFIG_ERR_SUCC;
582}
583
584/**
585 * Set the short option character of a property.
586 * @param key The property key.
587 * @param short_opt Character used to indicate the value of a property
588 * given on the command line.
589 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
590 * is returned if the property does not exist.
591 * @ingroup Ecore_Config_Property_Group
592 */
593EAPI int
594ecore_config_short_opt_set(const char *key, char short_opt)
595{
596 Ecore_Config_Prop *e;
597
598 if (!(e = ecore_config_get(key)))
599 return ECORE_CONFIG_ERR_NODATA;
600 e->short_opt = short_opt;
601 return ECORE_CONFIG_ERR_SUCC;
602}
603
604/**
605 * Set the long option string of the property.
606 * @param key The property key.
607 * @param long_opt String used to indicate the value of a property given
608 * on the command line.
609 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
610 * is returned if the property does not exist.
611 * @ingroup Ecore_Config_Property_Group
612 */
613EAPI int
614ecore_config_long_opt_set(const char *key, const char *long_opt)
615{
616 Ecore_Config_Prop *e;
617
618 if (!(e = ecore_config_get(key)))
619 return ECORE_CONFIG_ERR_NODATA;
620 if (e->long_opt)
621 free(e->long_opt);
622 if (long_opt)
623 e->long_opt = strdup(long_opt);
624 return ECORE_CONFIG_ERR_SUCC;
625}
626
627static void
628_ecore_config_listener_fire(Ecore_Config_Prop *prop)
629{
630 Ecore_Config_Listener_List *l;
631 for (l = prop->listeners; l; l = l->next)
632 l->listener(prop->key, prop->type, l->tag, l->data);
633
634 /* fire change listeners for the generic struct container etc */
635 if (prop->parent)
636 _ecore_config_listener_fire(prop->parent);
637}
638
639/**
640 * Sets the indicated property to the given value and type.
641 * @param key The property key.
642 * @param val A pointer to the value to set the property to.
643 * @param type The type of the property.
644 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
645 * @ingroup Ecore_Config_Property_Group
646 */
647EAPI int
648ecore_config_typed_set(const char *key, const void *val, int type)
649{
650 Ecore_Config_Prop *e;
651 int ret;
652
653 if (!key)
654 return ECORE_CONFIG_ERR_NODATA;
655/* if (!t) { * global prop *
656 e=ecore_config_get(key);
657 if (e)
658 for(l=e->listeners;l;l=l->next)
659 l->listener(e->key,e->type,l->tag,l->data,t);
660 return ECORE_CONFIG_ERR_SUCC;
661 }
662*/
663 if (!(e = ecore_config_get(key)))
664 return ecore_config_typed_add(key, val, type);
665
666 if ((ret = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC)
667 {
668 _ecore_config_listener_fire(e);
669 }
670 else
671 {
672 ERR("ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d",
673 key, ret);
674 }
675
676 return ret;
677}
678
679/**
680 * @defgroup Ecore_Config_Set_Group Ecore Config Setters
681 *
682 * Functions that set the value of a property.
683 */
684
685/**
686 * Sets the indicated property to the value indicated by @a val.
687 * @param key The property key.
688 * @param val String representation of value to set.
689 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
690 * @ingroup Ecore_Config_Set_Group
691 */
692EAPI int
693ecore_config_set(const char *key, const char *val)
694{
695 int type;
696 int tmpi;
697 float tmpf;
698 long tmpl;
699
700 type = ecore_config_type_guess(key, val);
701 if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN)
702 {
703 tmpi = atoi(val);
704 return ecore_config_typed_set(key, &tmpi, type);
705 }
706 else if (type == ECORE_CONFIG_FLT)
707 {
708 tmpf = atof(val);
709 return ecore_config_typed_set(key, &tmpf, type);
710 }
711 else if (type == ECORE_CONFIG_RGB)
712 {
713 __ecore_argbstr_to_long(val, &tmpl);
714 return ecore_config_typed_set(key, &tmpl, type);
715 }
716 else
717 return ecore_config_typed_set(key, val, type);
718}
719
720/**
721 * Sets the indicated property to the value given in the string.
722 * @param key The property key.
723 * @param val String representation of the value.
724 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
725 * @ingroup Ecore_Config_Set_Group
726 */
727EAPI int
728ecore_config_as_string_set(const char *key, const char *val)
729{
730 return ecore_config_set(key, val);
731}
732
733/**
734 * Sets the indicated property to the given boolean.
735 * @param key The property key.
736 * @param val Boolean integer to set the property to.
737 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
738 * @ingroup Ecore_Config_Set_Group
739 */
740EAPI int
741ecore_config_boolean_set(const char *key, int val)
742{
743 val = val ? 1 : 0;
744 return ecore_config_typed_set(key, &val, ECORE_CONFIG_BLN);
745}
746
747/**
748 * Sets the indicated property to the given integer.
749 * @param key The property key.
750 * @param val Integer to set the property to.
751 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
752 * @ingroup Ecore_Config_Set_Group
753 */
754EAPI int
755ecore_config_int_set(const char *key, int val)
756{
757 return ecore_config_typed_set(key, &val, ECORE_CONFIG_INT);
758}
759
760/**
761 * Sets the indicated property to the given string.
762 * @param key The property key.
763 * @param val String to set the property to.
764 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
765 * @ingroup Ecore_Config_Set_Group
766 */
767EAPI int
768ecore_config_string_set(const char *key, const char *val)
769{
770 return ecore_config_typed_set(key, val, ECORE_CONFIG_STR);
771}
772
773/**
774 * Sets the indicated property to the given float value.
775 * @param key The property key.
776 * @param val Float to set the property to.
777 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
778 * @ingroup Ecore_Config_Set_Group
779 */
780EAPI int
781ecore_config_float_set(const char *key, float val)
782{
783 return ecore_config_typed_set(key, &val, ECORE_CONFIG_FLT);
784}
785
786/**
787 * Sets the indicated property to a color value.
788 * @param key The property key
789 * @param a integer 0..255
790 * @param r integer 0..255
791 * @param g integer 0..255
792 * @param b integer 0..255
793 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
794 * @ingroup Ecore_Config_Set_Group
795 */
796EAPI int
797ecore_config_argb_set(const char *key, int a, int r, int g, int b)
798{
799 long v = 0;
800 return ecore_config_typed_set(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB);
801}
802
803/**
804 * Sets the indicated property to a color value.
805 * @param key The property key
806 * @param argb ARGB data as long
807 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
808 * @ingroup Ecore_Config_Set_Group
809 */
810EAPI int
811ecore_config_argbint_set(const char *key, long argb)
812{
813 return ecore_config_typed_set(key, &argb, ECORE_CONFIG_RGB);
814}
815
816/**
817 * Sets the indicated property to a color value.
818 * @param key The property key
819 * @param val Color value in ARGB format.
820 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
821 * @ingroup Ecore_Config_Set_Group
822 */
823EAPI int
824ecore_config_argbstr_set(const char *key, const char *val)
825{
826 long v = 0;
827 return ecore_config_typed_set(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB);
828}
829
830/**
831 * Sets the indicated property to a theme name.
832 * @param key The property key.
833 * @param val String giving the name of the theme.
834 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
835 * @ingroup Ecore_Config_Set_Group
836 */
837EAPI int
838ecore_config_theme_set(const char *key, const char *val)
839{
840 return ecore_config_typed_set(key, val, ECORE_CONFIG_THM);
841}
842
843/**
844 * Sets the theme preview group of an indicated property.
845 * @param key The property key.
846 * @param group The group name.
847 * @return @c ECORE_CONFIG_ERR_SUCC on success.
848 * @ingroup Ecore_Config_Set_Group
849 */
850EAPI int
851ecore_config_theme_preview_group_set(const char *key, const char *group)
852{
853 int ret;
854 Ecore_Config_Prop *e;
855
856 ret = ECORE_CONFIG_ERR_SUCC;
857 if (!(e = ecore_config_get(key)))
858 { /* prop doesn't exist yet */
859 if ((ret = ecore_config_typed_add(key, "", ECORE_CONFIG_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
860 return ret; /* ...failed */
861 if (!(e = ecore_config_get(key))) /* get handle */
862 return ECORE_CONFIG_ERR_FAIL;
863 }
864 if (e->data)
865 free(e->data);
866 e->data = strdup(group);
867
868 return ret;
869}
870
871EAPI int
872ecore_config_typed_default(const char *key, const void *val, int type)
873{
874 int ret;
875 Ecore_Config_Prop *e;
876
877 ret = ECORE_CONFIG_ERR_SUCC;
878
879 if (!(e = ecore_config_get(key)))
880 { /* prop doesn't exist yet */
881 if ((ret = ecore_config_typed_add(key, val, type)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */
882 return ret; /* ...failed */
883 if (!(e = ecore_config_get(key))) /* get handle */
884 return ECORE_CONFIG_ERR_FAIL;
885 e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED;
886 }
887 else if (!(e->flags & ECORE_CONFIG_FLAG_MODIFIED) && !(e->flags & ECORE_CONFIG_FLAG_SYSTEM))
888 {
889 ecore_config_typed_set(key, val, type);
890 if (!(e = ecore_config_get(key))) /* get handle */
891 return ECORE_CONFIG_ERR_FAIL;
892 e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED;
893 }
894 return ret;
895}
896
897/**
898 * @defgroup Ecore_Config_Default_Group Ecore Config Defaults
899 *
900 * Functions that are used to set the default values of properties.
901 */
902
903/**
904 * Sets the indicated property if it has not already been set or loaded.
905 * @param key The property key.
906 * @param val Default value of the key.
907 * @param lo Lowest valid value for the key.
908 * @param hi Highest valid value for the key.
909 * @param step Used by integer and float values.
910 * @return @c ECORE_CONFIG_ERR_SUCC if there are no errors.
911 * @note The @p lo, @p hi and @p step parameters are only used when storing
912 * integer and float properties.
913 * @ingroup Ecore_Config_Default_Group
914 */
915EAPI int
916ecore_config_default(const char *key, const char *val, float lo, float hi, float step)
917{
918 int ret, type;
919 Ecore_Config_Prop *e;
920
921 type = ecore_config_type_guess(key, val);
922 ret = ecore_config_typed_default(key, val, type);
923 e = ecore_config_get(key);
924 if (e)
925 {
926 if (type == ECORE_CONFIG_INT)
927 {
928 e->step = step;
929 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
930 e->lo = lo;
931 e->hi = hi;
932 ecore_config_bound(e);
933 }
934 else if (type == ECORE_CONFIG_FLT)
935 {
936 e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
937 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
938 e->lo = (int)(lo * ECORE_CONFIG_FLOAT_PRECISION);
939 e->hi = (int)(hi * ECORE_CONFIG_FLOAT_PRECISION);
940 ecore_config_bound(e);
941 }
942 }
943
944 return ret;
945}
946
947/**
948 * Sets the indicated property to the given boolean if the property has not yet
949 * been set.
950 * @param key The property key.
951 * @param val Boolean Integer to set the value to.
952 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
953 * @ingroup Ecore_Config_Default_Group
954 */
955EAPI int
956ecore_config_boolean_default(const char *key, int val)
957{
958 val = val ? 1 : 0;
959 return ecore_config_typed_default(key, &val, ECORE_CONFIG_BLN);
960}
961
962/**
963 * Sets the indicated property to the given integer if the property has not yet
964 * been set.
965 * @param key The property key.
966 * @param val Integer to set the value to.
967 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
968 * @ingroup Ecore_Config_Default_Group
969 */
970EAPI int
971ecore_config_int_default(const char *key, int val)
972{
973 return ecore_config_typed_default(key, &val, ECORE_CONFIG_INT);
974}
975
976/**
977 * Sets the indicated property to the given integer if the property has not yet
978 * been set.
979 *
980 * The bounds and step values are set regardless.
981 *
982 * @param key The property key.
983 * @param val Integer to set the property to.
984 * @param low Lowest valid integer value for the property.
985 * @param high Highest valid integer value for the property.
986 * @param step Increment value for the property.
987 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
988 * @ingroup Ecore_Config_Default_Group
989 */
990EAPI int
991ecore_config_int_default_bound(const char *key, int val, int low, int high,
992 int step)
993{
994 Ecore_Config_Prop *e;
995 int ret;
996
997 ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_INT);
998 e = ecore_config_get(key);
999 if (e)
1000 {
1001 e->step = step;
1002 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
1003 e->lo = low;
1004 e->hi = high;
1005 ecore_config_bound(e);
1006 }
1007
1008 return ret;
1009}
1010
1011/**
1012 * Sets the indicated property to the given string if the property has not yet
1013 * been set.
1014 * @param key The property key.
1015 * @param val String to set the property to.
1016 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
1017 * @ingroup Ecore_Config_Default_Group
1018 */
1019EAPI int
1020ecore_config_string_default(const char *key, const char *val)
1021{
1022 return ecore_config_typed_default(key, val, ECORE_CONFIG_STR);
1023}
1024
1025/**
1026 * Sets the indicated property to the given float if the property has not yet
1027 * been set.
1028 * @param key The property key.
1029 * @param val Float to set the property to.
1030 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
1031 * @ingroup Ecore_Config_Default_Group
1032 */
1033EAPI int
1034ecore_config_float_default(const char *key, float val)
1035{
1036 return ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT);
1037}
1038
1039/**
1040 * Sets the indicated property to the given float if the property has not yet
1041 * been set.
1042 *
1043 * The bounds and step values are set regardless.
1044 *
1045 * @param key The property key.
1046 * @param val Float to set the property to.
1047 * @param low Lowest valid integer value for the property.
1048 * @param high Highest valid float value for the property.
1049 * @param step Increment value for the property.
1050 * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems.
1051 * @ingroup Ecore_Config_Default_Group
1052 */
1053EAPI int
1054ecore_config_float_default_bound(const char *key, float val, float low,
1055 float high, float step)
1056{
1057 Ecore_Config_Prop *e;
1058 int ret;
1059
1060 ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT);
1061 e = ecore_config_get(key);
1062 if (e)
1063 {
1064 e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
1065 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
1066 e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION);
1067 e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION);
1068 ecore_config_bound(e);
1069 }
1070
1071 return ret;
1072}
1073
1074/**
1075 * Sets the indicated property to a color value if the property has not yet
1076 * been set.
1077 * @param key The property key.
1078 * @param a integer 0..255
1079 * @param r integer 0..255
1080 * @param g integer 0..255
1081 * @param b integer 0..255
1082 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
1083 * @ingroup Ecore_Config_Default_Group
1084 */
1085EAPI int
1086ecore_config_argb_default(const char *key, int a, int r, int g, int b)
1087{
1088 long v = 0;
1089 return ecore_config_typed_default(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB);
1090}
1091
1092/**
1093 * Sets the indicated property to a color value if the property has not yet
1094 * been set.
1095 * @param key The property key.
1096 * @param argb ARGB data as long
1097 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
1098 * @ingroup Ecore_Config_Default_Group
1099 */
1100EAPI int
1101ecore_config_argbint_default(const char *key, long argb)
1102{
1103 return ecore_config_typed_default(key, &argb, ECORE_CONFIG_RGB);
1104}
1105
1106/**
1107 * Sets the indicated property to a color value if the property has not yet
1108 * been set.
1109 * @param key The property key.
1110 * @param val Color value in ARGB format.
1111 * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems.
1112 * @ingroup Ecore_Config_Default_Group
1113 */
1114EAPI int
1115ecore_config_argbstr_default(const char *key, const char *val)
1116{
1117 long v = 0;
1118 return ecore_config_typed_default(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB);
1119}
1120
1121/**
1122 * Sets the indicated property to a theme name if the property has not yet
1123 * been set.
1124 * @param key The property key.
1125 * @param val String giving the name of the theme.
1126 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1127 * @ingroup Ecore_Config_Default_Group
1128 */
1129EAPI int
1130ecore_config_theme_default(const char *key, const char *val)
1131{
1132 return ecore_config_typed_default(key, val, ECORE_CONFIG_THM);
1133}
1134
1135/**
1136 * @defgroup Ecore_Config_Struct_Group Ecore Config Structures
1137 *
1138 * Functions that are used to create structures of properties.
1139 */
1140
1141/**
1142 * Sets the indicated property to a structure if the property has not yet
1143 * been set.
1144 * @param key The property key.
1145 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1146 * @ingroup Ecore_Config_Struct_Group
1147 */
1148EAPI int
1149ecore_config_struct_create(const char *key)
1150{
1151 WRN("you are using ecore_config structures. These are very young");
1152 WRN(" and not complete - you have been warned");
1153
1154 return ecore_config_typed_default(key, NULL, ECORE_CONFIG_SCT);
1155}
1156
1157static int
1158_ecore_config_struct_append(Ecore_Config_Prop *sct, Ecore_Config_Prop *add)
1159{
1160 Eina_List *l;
1161
1162 if (!sct || !add || sct->type != ECORE_CONFIG_SCT)
1163 return ECORE_CONFIG_ERR_IGNORED;
1164
1165 l = sct->data;
1166 sct->data = eina_list_append(l, add);
1167 add->parent = sct;
1168
1169 return ECORE_CONFIG_ERR_SUCC;
1170}
1171
1172static int
1173_ecore_config_struct_typed_add(const char *key, const char *name, const void *val,
1174 int type)
1175{
1176 char *subkey;
1177 int ret;
1178
1179 subkey = malloc((strlen(key) + strlen(name) + 2) * sizeof(char));
1180 strcpy(subkey, key);
1181 strcat(subkey, ".");
1182 strcat(subkey, name);
1183
1184 ecore_config_typed_default(subkey, val, type);
1185 ret = _ecore_config_struct_append(ecore_config_get(key),
1186 ecore_config_get(subkey));
1187 free(subkey);
1188 return ret;
1189}
1190
1191/**
1192 * Add an int property to the named structure. The property is set if it has not
1193 * yet been set.
1194 * @param key The key of the structure to add to.
1195 * @param name The name of the item to add - this will be appended to the key
1196 * @param val the int to default to
1197 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1198 * @ingroup Ecore_Config_Struct_Group
1199 */
1200EAPI int
1201ecore_config_struct_int_add(const char *key, const char *name, int val)
1202{
1203 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_INT);
1204}
1205
1206/**
1207 * Add a float property to the named structure. The property is set if it has
1208 * not yet been set.
1209 * @param key The key of the structure to add to.
1210 * @param name The name of the item to add - this will be appended to the key
1211 * @param val The float to default to
1212 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1213 * @ingroup Ecore_Config_Struct_Group
1214 */
1215EAPI int
1216ecore_config_struct_float_add(const char *key, const char *name, float val)
1217{
1218 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_FLT);
1219}
1220
1221/**
1222 * Add a string property to the named structure. The property is set if it has
1223 * not yet been set.
1224 * @param key The key of the structure to add to.
1225 * @param name The name of the item to add - this will be appended to the key
1226 * @param val The string to default to
1227 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1228 * @ingroup Ecore_Config_Struct_Group
1229 */
1230EAPI int
1231ecore_config_struct_string_add(const char *key, const char *name, const char* val)
1232{
1233 return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_STR);
1234}
1235
1236/**
1237 * Add an argb property to the named structure. The property is set if it has
1238 * not yet been set.
1239 * @param key The key of the structure to add to.
1240 * @param name The name of the item to add - this will be appended to the key
1241 * @param a The alpha to default to
1242 * @param r The red to default to
1243 * @param g The green to default to
1244 * @param b The blue to default to
1245 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1246 * @ingroup Ecore_Config_Struct_Group
1247 */
1248EAPI int
1249ecore_config_struct_argb_add(const char *key, const char *name, int a, int r,
1250 int g, int b)
1251{
1252 long argb;
1253
1254 __ecore_argb_to_long(a, r, g, b, &argb);
1255 return _ecore_config_struct_typed_add(key, name, &argb, ECORE_CONFIG_RGB);
1256}
1257
1258/**
1259 * Add a theme property to the named structure. The property is set if it has
1260 * not yet been set.
1261 * @param key The key of the structure to add to.
1262 * @param name The name of the item to add - this will be appended to the key
1263 * @param val The theme name to default to
1264 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1265 * @ingroup Ecore_Config_Struct_Group
1266 */
1267EAPI int
1268ecore_config_struct_theme_add(const char *key, const char *name, const char* val)
1269{
1270 return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_THM);
1271}
1272
1273/**
1274 * Add a boolean property to the named structure. The property is set if it has
1275 * not yet been set.
1276 * @param key The key of the structure to add to.
1277 * @param name The name of the item to add - this will be appended to the key
1278 * @param val The boolean to default to
1279 * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully.
1280 * @ingroup Ecore_Config_Struct_Group
1281 */
1282EAPI int
1283ecore_config_struct_boolean_add(const char *key, const char *name, int val)
1284{
1285 val = val ? 1 : 0;
1286 return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_BLN);
1287}
1288
1289/**
1290 * Get the contents of a defined structure property and load it into the passed
1291 * C struct
1292 * @param key The name of the structure property to look up.
1293 * @param data The struct to write into.
1294 * @return @c ECORE_CONFIG_ERR_SUCC if the structure is written successfully.
1295 * @ingroup Ecore_Config_Struct_Group
1296 */
1297EAPI int
1298ecore_config_struct_get(const char *key, void *data)
1299{
1300 Ecore_Config_Prop *e, *f;
1301 Eina_List *l;
1302 unsigned char *ptr;
1303 long argb;
1304
1305 e = ecore_config_get(key);
1306 if (!e)
1307 return ECORE_CONFIG_ERR_NODATA;
1308
1309 l = e->data;
1310 ptr = data;
1311 while (l)
1312 {
1313 f = (Ecore_Config_Prop *) l->data;
1314 switch (f->type)
1315 {
1316 case ECORE_CONFIG_INT:
1317 *((int *) ptr) = _ecore_config_int_get(f);
1318 ptr += sizeof(int);
1319 break;
1320 case ECORE_CONFIG_BLN:
1321 *((int *) ptr) = _ecore_config_boolean_get(f);
1322 ptr += sizeof(int);
1323 break;
1324 case ECORE_CONFIG_FLT:
1325 *((float *) ptr) = _ecore_config_float_get(f);
1326 ptr += sizeof(float);
1327 break;
1328 case ECORE_CONFIG_STR:
1329 case ECORE_CONFIG_THM:
1330 *((char **) ptr) = _ecore_config_string_get(f);
1331 ptr += sizeof(char *);
1332 break;
1333 case ECORE_CONFIG_RGB:
1334 argb = _ecore_config_argbint_get(f);
1335 *((int *) ptr) = (argb >> 24) & 0xff;
1336 ptr += sizeof(int);
1337 *((int *) ptr) = (argb >> 16) & 0xff;
1338 ptr += sizeof(int);
1339 *((int *) ptr) = (argb >> 8) & 0xff;
1340 ptr += sizeof(int);
1341 *((int *) ptr) = argb & 0xff;
1342 ptr += sizeof(int);
1343 break;
1344 default:
1345 WRN("ARGH - STRUCT coding not implemented yet");
1346 }
1347 l = eina_list_next(l);
1348 }
1349 return ECORE_CONFIG_ERR_SUCC;
1350}
1351
1352/**
1353 * @defgroup Ecore_Config_Listeners_Group Ecore Config Listeners
1354 *
1355 * Functions that set and unset property listener callbacks.
1356 */
1357
1358/**
1359 * Adds a callback function to the list of functions called when a property
1360 * changes.
1361 * @param name Name of the callback.
1362 * @param key The key of the property to listen to.
1363 * @param listener Listener callback function.
1364 * @param tag Tag to pass to @p listener when it is called.
1365 * @param data Data to pass to @p listener when it is called.
1366 * @return @c ECORE_CONFIG_ERR_SUCC if successful in setting up the callback.
1367 * @ingroup Ecore_Config_Listeners_Group
1368 */
1369EAPI int
1370ecore_config_listen(const char *name, const char *key,
1371 Ecore_Config_Listener listener, int tag, void *data)
1372{
1373 Ecore_Config_Prop *e;
1374 Ecore_Config_Listener_List *l;
1375
1376 if (!key)
1377 return ECORE_CONFIG_ERR_NODATA;
1378
1379 if (!(e = ecore_config_get(key)))
1380 {
1381 int ret = ecore_config_add(key, "");
1382
1383 if (ret != ECORE_CONFIG_ERR_SUCC)
1384 {
1385 ERR("ecore_config_listen: ecore_config_add(\"%s\") failed: %d",
1386 key, ret);
1387 return ret;
1388 }
1389 if (!(e = ecore_config_get(key)))
1390 {
1391 ERR("ecore_config_listen: list of properties corrupted!?");
1392 return ECORE_CONFIG_ERR_FAIL;
1393 }
1394 }
1395
1396 for (l = e->listeners; l; l = l->next)
1397 if (!strcmp(l->name, name) || (l->listener == listener))
1398 {
1399 ERR("ecore_config_listen: %s is already listening for changes of %s...",
1400 name, key);
1401 return ECORE_CONFIG_ERR_IGNORED;
1402 }
1403
1404 if (!(l = malloc(sizeof(Ecore_Config_Listener_List))))
1405 return ECORE_CONFIG_ERR_OOM;
1406
1407 ERR("registering listener \"%s\" for \"%s\" (%d)...", name, key, e->type);
1408
1409 memset(l, 0, sizeof(Ecore_Config_Listener_List));
1410
1411 l->listener = listener;
1412 l->name = name;
1413 l->data = data;
1414 l->tag = tag;
1415 l->next = e->listeners;
1416 e->listeners = l;
1417
1418 if (e->type != ECORE_CONFIG_NIL) /* call right on creation if prop exists and has val */
1419 listener(key, e->type, tag, data);
1420
1421 return ECORE_CONFIG_ERR_SUCC;
1422}
1423
1424/**
1425 * Removes a listener callback.
1426 * @param name Name of the callback to remove.
1427 * @param key The property key the callback is listening to.
1428 * @param listener The callback function to remove.
1429 * @return @c ECORE_CONFIG_ERR_SUCC if successful in removing the callback.
1430 * If no callback matches the given parameters, then
1431 * @c ECORE_CONFIG_ERR_NOTFOUND is returned. If @c NULL is passed
1432 * for the key pointer, @c ECORE_CONFIG_ERR_NODATA is returned.
1433 * @ingroup Ecore_Config_Listeners_Group
1434 */
1435EAPI int
1436ecore_config_deaf(const char *name, const char *key,
1437 Ecore_Config_Listener listener)
1438{
1439 Ecore_Config_Prop *e;
1440 Ecore_Config_Listener_List *l, *p;
1441 int ret;
1442
1443 ret = ECORE_CONFIG_ERR_NOTFOUND;
1444
1445 if (!key)
1446 return ECORE_CONFIG_ERR_NODATA;
1447
1448 if (!(e = ecore_config_get(key)))
1449 return ECORE_CONFIG_ERR_NOTFOUND;
1450
1451 for (p = NULL, l = e->listeners; l; p = l)
1452 {
1453 Ecore_Config_Listener_List *nl;
1454
1455 nl = l->next;
1456 if ((name && !strcmp(l->name, name)) || (l->listener == listener))
1457 {
1458 ret = ECORE_CONFIG_ERR_SUCC;
1459 if (!p)
1460 e->listeners = e->listeners->next;
1461 else
1462 p->next = l->next;
1463 memset(l, 0, sizeof(Ecore_Config_Listener));
1464 free(l);
1465 }
1466 l = nl;
1467 }
1468
1469 return ret;
1470}
1471
1472/**
1473 * Locates the first configuration bundle on the given server.
1474 * @param srv The configuration server.
1475 * @return Pointer to the first configuration bundle.
1476 */
1477EAPI Ecore_Config_Bundle *
1478ecore_config_bundle_1st_get(Ecore_Config_Server * srv)
1479{ /* anchor: global, but read-only */
1480 return srv->bundles;
1481}
1482
1483/**
1484 * Locates the configuration bundle after the given one.
1485 * @param ns The configuration bundle.
1486 * @return The next configuration bundle.
1487 */
1488EAPI Ecore_Config_Bundle *
1489ecore_config_bundle_next_get(Ecore_Config_Bundle * ns)
1490{
1491 return ns ? ns->next : NULL;
1492}
1493
1494/**
1495 * Locates a configuration bundle on a configuration server based on its serial
1496 * number.
1497 * @param srv The configuration server.
1498 * @param serial Serial number.
1499 * @return The configuration bundle with the given serial number.
1500 */
1501EAPI Ecore_Config_Bundle *
1502ecore_config_bundle_by_serial_get(Ecore_Config_Server * srv, long serial)
1503{
1504 Ecore_Config_Bundle *eb;
1505
1506 eb = srv->bundles;
1507
1508 if (serial < 0)
1509 return NULL;
1510 else if (serial == 0)
1511 {
1512 Ecore_Config_Bundle *r = eb;
1513
1514 return r;
1515 }
1516
1517 while (eb)
1518 {
1519 if (eb->serial == serial)
1520 return eb;
1521 eb = eb->next;
1522 }
1523 return NULL;
1524}
1525
1526/**
1527 * Gets the Ecore_Config_Bundle with the given identifier from the given
1528 * server.
1529 * @param srv The configuration server.
1530 * @param label The bundle's identifier string.
1531 * @return The bundle with the given identifier string, or @c NULL if it
1532 * could not be found.
1533 */
1534EAPI Ecore_Config_Bundle *
1535ecore_config_bundle_by_label_get(Ecore_Config_Server * srv, const char *label)
1536{
1537 Ecore_Config_Bundle *ns;
1538
1539 ns = srv->bundles;
1540
1541 while (ns)
1542 {
1543 if (ns->identifier && !strcmp(ns->identifier, label))
1544 return ns;
1545 ns = ns->next;
1546 }
1547 return NULL;
1548}
1549
1550/**
1551 * Retrieves the bundle's serial number.
1552 * @param ns The configuration bundle.
1553 * @return The bundle's identifier string, or -1 if ns is @c NULL.
1554 */
1555EAPI long
1556ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns)
1557{
1558 return ns ? ns->serial : -1;
1559}
1560
1561/**
1562 * Retrieves the bundle's identifier.
1563 * @param ns The configuration bundle.
1564 * @return The bundle's identifer string.
1565 */
1566EAPI char *
1567ecore_config_bundle_label_get(Ecore_Config_Bundle * ns)
1568{
1569 return ns ? ns->identifier : NULL;
1570}
1571
1572/**
1573 * Creates a new Ecore_Config_Bundle.
1574 * @param srv Config server.
1575 * @param identifier Identifier string for the new bundle.
1576 * @return A pointer to a new Ecore_Config_Bundle. @c NULL is returned if the
1577 * structure couldn't be allocated.
1578 */
1579EAPI Ecore_Config_Bundle *
1580ecore_config_bundle_new(Ecore_Config_Server * srv, const char *identifier)
1581{
1582 Ecore_Config_Bundle *t;
1583 static long ss;
1584
1585 ss = 0; /* bundle unique serial */
1586
1587 if ((t = malloc(sizeof(Ecore_Config_Bundle))))
1588 {
1589 memset(t, 0, sizeof(Ecore_Config_Bundle));
1590
1591 t->identifier = (char *)identifier;
1592 t->serial = ++ss;
1593 t->owner = srv->name;
1594 t->next = srv->bundles;
1595 srv->bundles = t;
1596 }
1597 return t;
1598}
1599
1600static Ecore_Config_Server *
1601do_init(const char *name)
1602{
1603 return _ecore_config_ipc_init(name);
1604}
1605
1606static Ecore_Config_Server *
1607ecore_config_init_local(const char *name)
1608{
1609 char *p;
1610 char *buf;
1611
1612 if ((p = getenv("HOME")))
1613 { /* debug-only ### FIXME */
1614 if (!(buf = malloc(PATH_MAX * sizeof(char))))
1615 return NULL;
1616 snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name);
1617 unlink(buf);
1618
1619 free(buf);
1620 }
1621
1622 return do_init(name);
1623}
1624
1625static Ecore_Config_Server *
1626ecore_config_init_global(const char *name)
1627{
1628 char *p;
1629 int global;
1630 char *buf;
1631
1632 if ((p = getenv("HOME")))
1633 { /* debug-only ### FIXME */
1634 if (!(buf = malloc(PATH_MAX * sizeof(char))))
1635 return NULL;
1636 snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name);
1637 global = creat(buf, S_IRWXU);
1638
1639 if (global >= 0)
1640 close(global);
1641
1642 free(buf);
1643 }
1644
1645 return do_init(name);
1646}
1647
1648/**
1649 * @defgroup Ecore_Config_App_Lib_Group Ecore Config App Library Functions
1650 *
1651 * Functions that are used to start up and shutdown the Enlightened
1652 * Property Library when used directly by an application.
1653 */
1654
1655/**
1656 * Initializes the Enlightened Property Library.
1657 *
1658 * Either this function or @ref ecore_config_system_init must be run
1659 * before any other function in the Enlightened Property Library, even
1660 * if you have run @ref ecore_init . The name given is used to
1661 * determine the default configuration to load.
1662 *
1663 * @param name Application name
1664 * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up.
1665 * @c ECORE_CONFIG_ERR_FAIL otherwise.
1666 * @ingroup Ecore_Config_App_Lib_Group
1667 */
1668EAPI int
1669ecore_config_init(const char *name)
1670{
1671 char *path;
1672 Ecore_Config_Prop *list;
1673 _ecore_config_log_dom = eina_log_domain_register
1674 ("ecore_config", ECORE_CONFIG_DEFAULT_LOG_COLOR);
1675 if(_ecore_config_log_dom < 0)
1676 {
1677 EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module.");
1678 return -1;
1679 }
1680 _ecore_config_system_init_no_load();
1681
1682 __ecore_config_app_name = strdup(name);
1683 __ecore_config_server_local = ecore_config_init_local(name);
1684 if (!__ecore_config_server_local)
1685 return ECORE_CONFIG_ERR_FAIL;
1686
1687 list = __ecore_config_bundle_local->data;
1688 free( __ecore_config_bundle_local );
1689 __ecore_config_bundle_local =
1690 ecore_config_bundle_new(__ecore_config_server_local, "config");
1691 __ecore_config_bundle_local->data = list;
1692
1693 path = ecore_config_theme_default_path_get();
1694 ecore_config_string_default("/e/themes/search_path", path);
1695 if (path)
1696 free(path);
1697
1698 list = ecore_config_get("/e/themes/search_path");
1699 if (list)
1700 {
1701 list->flags |= ECORE_CONFIG_FLAG_SYSTEM;
1702 list->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
1703 }
1704
1705 return _ecore_config_system_load();
1706}
1707
1708/**
1709 * Frees memory and shuts down the library for an application.
1710 * @return @c ECORE_CONFIG_ERR_IGNORED .
1711 * @ingroup Ecore_Config_App_Lib_Group
1712 */
1713EAPI int
1714ecore_config_shutdown(void)
1715{
1716 return ecore_config_system_shutdown();
1717}
1718
1719/**
1720 * @defgroup Ecore_Config_Lib_Lib_Group Ecore Config Library Functions
1721 *
1722 * Functions that are used to start up and shutdown the Enlightened
1723 * Property Library when used directly by an application.
1724 */
1725
1726/**
1727 * Initializes the Enlightened Property Library.
1728 *
1729 * This function is meant to be run from other programming libraries.
1730 * It should not be called from applications.
1731 *
1732 * This function (or @ref ecore_config_init )
1733 * must be run before any other function in the
1734 * Enlightened Property Library, even if you have run @ref ecore_init .
1735 *
1736 * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up.
1737 * @c ECORE_CONFIG_ERR_FAIL otherwise.
1738 * @ingroup Ecore_Config_Lib_Lib_Group
1739 */
1740EAPI int
1741ecore_config_system_init(void)
1742{
1743 _ecore_config_system_init_no_load();
1744 return _ecore_config_system_load();
1745}
1746
1747static int
1748_ecore_config_system_init_no_load(void)
1749{
1750 char *p;
1751
1752 __ecore_config_system_init++;
1753 if (__ecore_config_system_init > 1)
1754 return ECORE_CONFIG_ERR_IGNORED;
1755
1756 DEBUG = -1;
1757 if ((p = getenv("ECORE_CONFIG_DEBUG")) && p[0] != 0)
1758 {
1759 DEBUG = atoi(p);
1760 }
1761
1762 __ecore_config_server_global =
1763 ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID);
1764 if (!__ecore_config_server_global)
1765 return ECORE_CONFIG_ERR_FAIL;
1766
1767 __ecore_config_bundle_local =
1768 ecore_config_bundle_new(__ecore_config_server_global, "system");
1769
1770 /* set up a simple default path */
1771 ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes");
1772
1773 return ECORE_CONFIG_ERR_SUCC;
1774}
1775
1776
1777static int
1778_ecore_config_system_load(void)
1779{
1780 char *buf, *p;
1781 Ecore_Config_Prop *sys;
1782
1783 if (__ecore_config_system_init != 1)
1784 return ECORE_CONFIG_ERR_FAIL;
1785
1786 if ((p = getenv("HOME")))
1787 { /* debug-only ### FIXME */
1788 if ((buf = malloc(PATH_MAX * sizeof(char))))
1789 {
1790 snprintf(buf, PATH_MAX, "%s/.e/config.eet", p);
1791 if (ecore_config_file_load(buf) != 0) {
1792 /* even if this file (system.eet) doesn't exist we can
1793 * continue without it as it isn't striclty necessary.
1794 */
1795 ecore_config_file_load(PACKAGE_DATA_DIR "/system.eet");
1796 }
1797 sys = __ecore_config_bundle_local->data;
1798 while (sys)
1799 {
1800 /* unmark it modified - modification will mean it has been overridden */
1801 sys->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
1802 /* mark as system so that examine can hide them */
1803 sys->flags |= ECORE_CONFIG_FLAG_SYSTEM;
1804 sys = sys->next;
1805 }
1806 }
1807 free(buf);
1808 }
1809
1810 return ECORE_CONFIG_ERR_SUCC;
1811}
1812
1813
1814/**
1815 * Frees memory and shuts down the library for other programming libraries.
1816 * @return @c ECORE_CONFIG_ERR_IGNORED
1817 * @ingroup Ecore_Config_Lib_Lib_Group
1818 */
1819EAPI int
1820ecore_config_system_shutdown(void)
1821{
1822 int ret;
1823
1824 __ecore_config_system_init--;
1825 if (__ecore_config_system_init > 0)
1826 return ECORE_CONFIG_ERR_IGNORED;
1827
1828 ret = _ecore_config_ipc_exit();
1829 if (__ecore_config_app_name)
1830 free(__ecore_config_app_name);
1831 while(__ecore_config_bundle_local->data)
1832 ecore_config_dst(__ecore_config_bundle_local->data);
1833 free(__ecore_config_bundle_local);
1834 free(__ecore_config_server_local);
1835 free(__ecore_config_server_global);
1836 eina_log_domain_unregister(_ecore_config_log_dom);
1837 _ecore_config_log_dom = -1;
1838 return ret;
1839}
1840
1841static inline void *
1842__ecore_argb_to_long(int a, int r, int g, int b, long *v)
1843{
1844 *v = ((a << 24) & 0xff000000 )
1845 | ((r << 16) & 0xff0000 )
1846 | ((g << 8) & 0xff00 )
1847 | ( b & 0xff );
1848
1849 return v;
1850}
1851
1852static inline void *
1853__ecore_argbstr_to_long(const char *argb, long *v)
1854{
1855 char *l = NULL;
1856
1857 // convert hexadecimal string #..., #0x..., 0x..., ... to long
1858 if(*argb == '#')
1859 argb++;
1860 *v = (long)strtoul( argb, &l, 16);
1861
1862 if(*l)
1863 {
1864 ERR("ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?", argb);
1865 return NULL;
1866 }
1867
1868 return v;
1869}
1870
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_db.c b/libraries/ecore/src/lib/ecore_config/ecore_config_db.c
deleted file mode 100644
index 6238958..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_db.c
+++ /dev/null
@@ -1,296 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8#include <limits.h>
9
10#include <sys/param.h>
11#include <sys/types.h>
12#include <sys/stat.h>
13#include <unistd.h>
14#include <locale.h>
15
16#include <Eet.h>
17
18#include "Ecore_Config.h"
19#include "ecore_config_private.h"
20#include "ecore_config_util.h"
21
22struct _Ecore_Config_DB_File
23{
24 Eet_File *ef;
25};
26
27Ecore_Config_DB_File *
28_ecore_config_db_open_read(const char *file)
29{
30 Eet_File *ef;
31 Ecore_Config_DB_File *db;
32
33 eet_init();
34 db = malloc(sizeof(Ecore_Config_DB_File));
35 if (!db) return NULL;
36 ef = eet_open((char*)file, EET_FILE_MODE_READ);
37 if (!ef)
38 {
39 free(db);
40 return NULL;
41 }
42 db->ef = ef;
43 return db;
44}
45
46Ecore_Config_DB_File *
47_ecore_config_db_open_write(const char *file)
48{
49 Eet_File *ef;
50 Ecore_Config_DB_File *db;
51
52 eet_init();
53 db = malloc(sizeof(Ecore_Config_DB_File));
54 if (!db) return NULL;
55 ef = eet_open((char*)file, EET_FILE_MODE_WRITE);
56 if (!ef)
57 {
58 free(db);
59 return NULL;
60 }
61 db->ef = ef;
62 return db;
63}
64
65void
66_ecore_config_db_close(Ecore_Config_DB_File *db)
67{
68 eet_close(db->ef);
69 free(db);
70 eet_shutdown();
71}
72
73char **
74_ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret)
75{
76 char **keys;
77 int key_count;
78 int i;
79
80 keys = eet_list(db->ef, (char*)"*", &key_count);
81 if (!keys)
82 {
83 *num_ret = 0;
84 return NULL;
85 }
86 /* make keys freeable - this is safe to do */
87 for (i = 0; i < key_count; i++) keys[i] = strdup(keys[i]);
88 *num_ret = key_count;
89 return keys;
90}
91
92Ecore_Config_Type
93_ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key)
94{
95 char *data;
96 int size;
97
98 data = eet_read(db->ef, (char*)key, &size);
99 if (data)
100 {
101 if (size <= 2)
102 {
103 free(data);
104 return ECORE_CONFIG_NIL;
105 }
106 if (data[size - 1] != 0)
107 {
108 free(data);
109 return ECORE_CONFIG_NIL;
110 }
111 return (Ecore_Config_Type) data[0];
112 }
113 return ECORE_CONFIG_NIL;
114}
115
116int
117_ecore_config_db_read(Ecore_Config_DB_File *db, const char *key)
118{
119 char *data, *value;
120 int size;
121 Ecore_Config_Type type;
122
123 data = eet_read(db->ef, (char*)key, &size);
124 if (data)
125 {
126 int l;
127 char *prev_locale;
128
129 if (size <= 2)
130 {
131 free(data);
132 return 0;
133 }
134 if (data[size - 1] != 0)
135 {
136 free(data);
137 return 0;
138 }
139 /* "type" NIL 1242 NIL */
140 l = strlen(data);
141 if (l >= (size - 1))
142 {
143 free(data);
144 return 0;
145 }
146
147 type = data[0];
148 value = data + l + 1;
149
150 switch (type)
151 {
152 case ECORE_CONFIG_INT:
153 case ECORE_CONFIG_BLN:
154 {
155 int tmp;
156 prev_locale = setlocale(LC_NUMERIC, "C");
157 tmp = atoi(value);
158 if (prev_locale) setlocale(LC_NUMERIC, prev_locale);
159
160 ecore_config_typed_set(key, (void *)&tmp, type);
161 break;
162 }
163 case ECORE_CONFIG_FLT:
164 {
165 float tmp;
166 prev_locale = setlocale(LC_NUMERIC, "C");
167 tmp = atof(value);
168 if (prev_locale) setlocale(LC_NUMERIC, prev_locale);
169
170 ecore_config_typed_set(key, (void *)&tmp, type);
171 break;
172 }
173 case ECORE_CONFIG_RGB:
174 ecore_config_argbstr_set(key, value);
175 break;
176 case ECORE_CONFIG_STR:
177 case ECORE_CONFIG_THM:
178 ecore_config_typed_set(key, (void *)value, type);
179 break;
180 case ECORE_CONFIG_SCT:
181 INF("loading struct %s", key);
182 break;
183 default:
184 WRN("Type %d not handled", type);
185 }
186 free(data);
187 return 1;
188 }
189 return 0;
190}
191
192/*
193void *
194_ecore_config_db_key_data_get(Ecore_Config_DB_File *db, const char *key, int *size_ret)
195{
196 char *data;
197 int size;
198
199 data = eet_read(db->ef, (char*)key, &size);
200 if (data)
201 {
202 int l;
203 char *dat;
204
205 if (size <= 2)
206 {
207 free(data);
208 return NULL;
209 }
210 if (data[size - 1] != 0)
211 {
212 free(data);
213 return NULL;
214 }
215 * "type" NIL data_goes_here NIL *
216 l = strlen(data);
217 if (l >= (size - 1))
218 {
219 free(data);
220 return NULL;
221 }
222 dat = malloc(size - (l + 2));
223 memcpy(dat, data + l + 1, size - (l + 2));
224 free(data);
225 *size_ret = size - (l + 2);
226 return dat;
227 }
228 return NULL;
229}*/
230
231void
232_ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e)
233{
234 char *prev_locale= NULL;
235 char *val = NULL;
236 char *r = NULL;
237 int num;
238
239 prev_locale = setlocale(LC_NUMERIC, "C");
240
241 switch (e->type)
242 {
243 case ECORE_CONFIG_INT:
244 esprintf(&val, "%i", _ecore_config_int_get(e));
245 break;
246 case ECORE_CONFIG_BLN:
247 esprintf(&val, "%i", _ecore_config_boolean_get(e));
248 break;
249 case ECORE_CONFIG_FLT:
250 esprintf(&val, "%16.16f", _ecore_config_float_get(e));
251 break;
252 case ECORE_CONFIG_STR:
253 val = _ecore_config_string_get(e);
254 break;
255 case ECORE_CONFIG_THM:
256 val = _ecore_config_theme_get(e);
257 break;
258 case ECORE_CONFIG_RGB:
259 val = _ecore_config_argbstr_get(e);
260 break;
261 default:
262 WRN("Type %d not handled", e->type);
263 }
264
265 if (prev_locale)
266 {
267 setlocale(LC_NUMERIC, prev_locale);
268 }
269
270 if(val)
271 {
272 num = esprintf(&r, "%c%c%s%c", (char) e->type, 0, val, 0);
273 if(num)
274 eet_write(db->ef, e->key, r, num, 1);
275 free(r);
276 }
277
278 free(val);
279}
280/*
281void
282_ecore_config_db_key_data_set(Ecore_Config_DB_File *db, const char *key, void *data, int data_size)
283{
284 char *buf;
285 int num;
286
287 num = 1 + 1 + data_size + 1;
288 buf = malloc(num);
289 if (!buf) return;
290 buf[0] = (char) ECORE_CONFIG_BIN;
291 buf[1] = 0;
292 memcpy(buf + 2, data, data_size);
293 buf[num - 1] = 0;
294 eet_write(db->ef, (char*)key, buf, num, 1);
295 free(buf);
296}*/
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c b/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c
deleted file mode 100644
index a134952..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c
+++ /dev/null
@@ -1,803 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <string.h>
6#include <stdio.h>
7#include <stdlib.h>
8
9#include <sys/types.h>
10#include <sys/stat.h>
11
12#include "Ecore_Config.h"
13#include "Ecore.h"
14#include "ecore_config_private.h"
15typedef struct __Ecore_Config_Arg_Callback _Ecore_Config_Arg_Callback;
16struct __Ecore_Config_Arg_Callback
17{
18 char short_opt;
19 char *long_opt;
20 char *description;
21 void *data;
22 void (*func)(char *val, void *data);
23 Ecore_Config_Type type;
24 _Ecore_Config_Arg_Callback *next;
25};
26
27char *__ecore_config_app_description;
28_Ecore_Config_Arg_Callback *_ecore_config_arg_callbacks;
29
30/* shorthand prop setup code to make client apps a little smaller ;) */
31
32/**
33 * Creates a new property, if it does not already exist, and sets its
34 * attributes to those given.
35 *
36 * The type of the property is guessed from the key and the value
37 * given.
38 *
39 * @param key The property key.
40 * @param val Pointer to default value of key.
41 * @param short_opt Short option used to set the property from command
42 * line.
43 * @param long_opt Long option used to set the property from command line.
44 * @param desc String description of property.
45 * @return @c ECORE_CONFIG_ERR_SUCC on success.
46 * @ingroup Ecore_Config_Create_Group
47 */
48int
49ecore_config_create(const char *key, void *val, char short_opt, char *long_opt,
50 char *desc)
51{
52 int type = ecore_config_type_guess(key, val);
53
54 return ecore_config_typed_create(key, val, type, short_opt, long_opt, desc);
55}
56
57/**
58 * Creates a new property, if it does not already exist, and sets its
59 * attributes to those given.
60 * @param key The property key.
61 * @param val Pointer to default value of key.
62 * @param type Type of the property.
63 * @param short_opt Short option used to set the property from
64 * command line.
65 * @param long_opt Long option used to set the property from command line.
66 * @param desc String description of property.
67 * @return @c ECORE_CONFIG_ERR_SUCC on success.
68 * @ingroup Ecore_Config_Create_Group
69 */
70int
71ecore_config_typed_create(const char *key, void *val, int type, char short_opt,
72 char *long_opt, char *desc)
73{
74 int ret;
75
76 if ((ret =
77 ecore_config_typed_default(key, val, type)) != ECORE_CONFIG_ERR_SUCC)
78 return ret;
79 if ((ret =
80 ecore_config_short_opt_set(key, short_opt)) != ECORE_CONFIG_ERR_SUCC)
81 return ret;
82 if ((ret =
83 ecore_config_long_opt_set(key, long_opt)) != ECORE_CONFIG_ERR_SUCC)
84 return ret;
85 ret = ecore_config_describe(key, desc);
86 return ret;
87}
88
89/**
90 * Creates a new boolean property, if it does not already exist, and sets its
91 * attributes to those given.
92 * @param key The property key.
93 * @param val Default boolean value of key.
94 * @param short_opt Short option used to set the property from command
95 * line.
96 * @param long_opt Long option used to set the property from command line.
97 * @param desc String description of property.
98 * @return @c ECORE_CONFIG_ERR_SUCC on success.
99 * @ingroup Ecore_Config_Create_Group
100 */
101int
102ecore_config_boolean_create(const char *key, int val, char short_opt,
103 char *long_opt, char *desc)
104{
105 return
106 ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_BLN, short_opt, long_opt,
107 desc);
108}
109
110/**
111 * Creates a new integer property, if it does not already exist, and sets its
112 * attributes to those given.
113 * @param key The property key.
114 * @param val Default integer value of key.
115 * @param short_opt Short option used to set the property from command
116 * line.
117 * @param long_opt Long option used to set the property from command line.
118 * @param desc String description of property.
119 * @return @c ECORE_CONFIG_ERR_SUCC on success.
120 * @ingroup Ecore_Config_Create_Group
121 */
122int
123ecore_config_int_create(const char *key, int val, char short_opt,
124 char *long_opt, char *desc)
125{
126 return
127 ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt,
128 desc);
129}
130
131/**
132 * Creates a new integer property, if it does not already exist, and sets its
133 * attributes to those given.
134 * @param key The property key.
135 * @param val Default integer value of key.
136 * @param low Lowest valid integer value for the property.
137 * @param high Highest valid integer value for the property.
138 * @param step Increment value for the property.
139 * @param short_opt Short option used to set the property from command
140 * line.
141 * @param long_opt Long option used to set the property from command line.
142 * @param desc String description of property.
143 * @return @c ECORE_CONFIG_ERR_SUCC on success.
144 * @ingroup Ecore_Config_Create_Group
145 */
146int
147ecore_config_int_create_bound(const char *key, int val, int low, int high,
148 int step, char short_opt, char *long_opt,
149 char *desc)
150{
151 Ecore_Config_Prop *e;
152 int ret;
153
154 ret =
155 ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt,
156 desc);
157 if (ret != ECORE_CONFIG_ERR_SUCC)
158 return ret;
159 e = ecore_config_get(key);
160 if (e)
161 {
162 e->step = step;
163 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
164 e->lo = low;
165 e->hi = high;
166 ecore_config_bound(e);
167 }
168 return ret;
169}
170
171/**
172 * Creates a new string property, if it does not already exist, and sets its
173 * attributes to those given.
174 * @param key The property key.
175 * @param val Default value of key.
176 * @param short_opt Short option used to set the property from command
177 * line.
178 * @param long_opt Long option used to set the property from command line.
179 * @param desc String description of property.
180 * @return @c ECORE_CONFIG_ERR_SUCC on success.
181 * @ingroup Ecore_Config_Create_Group
182 */
183int
184ecore_config_string_create(const char *key, char *val, char short_opt,
185 char *long_opt, char *desc)
186{
187 return
188 ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_STR, short_opt, long_opt,
189 desc);
190}
191
192/**
193 * Creates a new float property, if it does not already exist, and sets its
194 * attributes to those given.
195 * @param key The property key.
196 * @param val Default float value of key.
197 * @param short_opt Short option used to set the property from command
198 * line.
199 * @param long_opt Long option used to set the property from command line.
200 * @param desc String description of property.
201 * @return @c ECORE_CONFIG_ERR_SUCC on success.
202 * @ingroup Ecore_Config_Create_Group
203 */
204int
205ecore_config_float_create(const char *key, float val, char short_opt,
206 char *long_opt, char *desc)
207{
208 return
209 ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt,
210 desc);
211}
212
213/**
214 * Creates a new float property, if it does not already exist, and sets its
215 * attributes to those given.
216 * @param key The property key.
217 * @param val Default float value of key.
218 * @param low Lowest valid float value for the property.
219 * @param high Highest valid float value for the property.
220 * @param step Increment value for the property.
221 * @param short_opt Short option used to set the property from command
222 * line.
223 * @param long_opt Long option used to set the property from command line.
224 * @param desc String description of property.
225 * @return @c ECORE_CONFIG_ERR_SUCC on success.
226 * @ingroup Ecore_Config_Create_Group
227 */
228int
229ecore_config_float_create_bound(const char *key, float val, float low,
230 float high, float step, char short_opt,
231 char *long_opt, char *desc)
232{
233 Ecore_Config_Prop *e;
234 int ret;
235
236 ret =
237 ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt,
238 desc);
239 e = ecore_config_get(key);
240 if (e)
241 {
242 e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION);
243 e->flags |= ECORE_CONFIG_FLAG_BOUNDS;
244 e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION);
245 e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION);
246 ecore_config_bound(e);
247 }
248 return ret;
249}
250
251/**
252 * Creates a new color property, if it does not already exist, and sets its
253 * attributes to those given.
254 * @param key The property key.
255 * @param val Default color value of key, as a hexadecimal string.
256 * @param short_opt Short option used to set the property from command
257 * line.
258 * @param long_opt Long option used to set the property from command line.
259 * @param desc String description of property.
260 * @return @c ECORE_CONFIG_ERR_SUCC on success.
261 * @ingroup Ecore_Config_Create_Group
262 */
263int
264ecore_config_argb_create(const char *key, char *val, char short_opt,
265 char *long_opt, char *desc)
266{
267 return
268 ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_RGB, short_opt, long_opt,
269 desc);
270}
271
272/**
273 * Creates a new theme property, if it does not already exist, and sets its
274 * attributes to those given.
275 * @param key The property key.
276 * @param val Default theme name for the property.
277 * @param short_opt Short option used to set the property from command
278 * line.
279 * @param long_opt Long option used to set the property from command line.
280 * @param desc String description of property.
281 * @return @c ECORE_CONFIG_ERR_SUCC on success.
282 * @ingroup Ecore_Config_Create_Group
283 */
284int
285ecore_config_theme_create(const char *key, char *val, char short_opt,
286 char *long_opt, char *desc)
287{
288 return
289 ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_THM, short_opt, long_opt,
290 desc);
291}
292
293/* this should only be built if evas is present */
294
295/**
296 * Calls evas_font_path_append on @p evas for each of the font names stored
297 * in the property "/e/font/path".
298 * @param evas Evas object to append the font names to.
299 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
300 * is returned if the property has not been set.
301 */
302int
303ecore_config_evas_font_path_apply(Evas * evas)
304{
305 char *font_path, *font_path_tmp, *ptr, *end;
306
307 font_path = ecore_config_string_get("/e/font/path");
308
309 if (!font_path)
310 return ECORE_CONFIG_ERR_NODATA;
311 ptr = font_path;
312 end = font_path + strlen(font_path);
313 font_path_tmp = font_path;
314 while (ptr && ptr < end)
315 {
316 while (*ptr != '|' && ptr < end)
317 ptr++;
318 if (ptr < end)
319 *ptr = '\0';
320
321 evas_font_path_append(evas, font_path_tmp);
322 ptr++;
323 font_path_tmp = ptr;
324 }
325
326 free(font_path);
327
328 return ECORE_CONFIG_ERR_SUCC;
329}
330
331/**
332 * Retrieves the default theme search path.
333 *
334 * @return The default theme search path.
335 */
336char *
337ecore_config_theme_default_path_get(void)
338{
339 char *path, *home;
340 int len;
341
342 home = getenv("HOME");
343 len = strlen(PACKAGE_DATA_DIR "/../") + strlen(__ecore_config_app_name) +
344 strlen("/themes/") + 1;
345 if (home)
346 len += strlen(home) + strlen("/.e/apps/") +
347 strlen(__ecore_config_app_name) +
348 strlen("/themes/|"); /* no \0, as that is above */
349
350 if (!(path = malloc(len)))
351 return NULL;
352
353 *path = '\0';
354 if (home)
355 {
356 strcat(path, home);
357 strcat(path, "/.e/apps/");
358 strcat(path, __ecore_config_app_name);
359 strcat(path, "/themes/|");
360 }
361 strcat(path, PACKAGE_DATA_DIR "/../");
362 strcat(path, __ecore_config_app_name);
363 strcat(path, "/themes/");
364
365 return path;
366}
367
368/**
369 * Retrieves the search path used to find themes.
370 *
371 * The search path is stored in the property "/e/themes/search_path". If
372 * the property has not been set, the default path used is
373 * "/usr/local/share/<app_name>/themes|~/.e/apps/<app_name>/themes".
374 * See @ref ecore_config_theme_default_path_get for more information about
375 * the default path.
376 *
377 * @return The search path. @c NULL is returned if there is no memory left.
378 */
379char *
380ecore_config_theme_search_path_get(void)
381{
382 char *search_path;
383 search_path = ecore_config_string_get("/e/themes/search_path");
384
385 /* this should no longer be the case, as it is defaulted in init */
386 if (!search_path)
387 {
388 search_path = ecore_config_theme_default_path_get();
389 if (search_path)
390 {
391 ecore_config_string_default("/e/themes/search_path", search_path);
392 free(search_path);
393 }
394 }
395 return search_path;
396}
397
398/**
399 * Adds the given path to the search path used to find themes.
400 *
401 * If the search path is successfully, the new search path will be saved
402 * into the property "/e/themes/search_path". Therefore, this function
403 * should be called @b after @ref ecore_config_load to allow a user to
404 * override the default search path.
405 *
406 * @param path The given
407 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL
408 * will be returned if @p path already exists in the search path.
409 * @c ECORE_CONFIG_ERR_FAIL is returned if @p path is @c NULL.
410 */
411int
412ecore_config_theme_search_path_append(const char *path)
413{
414 char *search_path, *loc, *new_search_path;
415 int len, search_len;
416 Ecore_Config_Prop *prop;
417
418 if (!path)
419 return ECORE_CONFIG_ERR_NODATA;
420 search_path = ecore_config_theme_search_path_get();
421
422 loc = strstr(search_path, path);
423 len = strlen(path);
424 search_len = strlen(search_path);
425
426 if (!loc || (loc != search_path && *(loc - 1) != '|') ||
427 (loc != (search_path + search_len - len) && *(loc + len - 1) != '|'))
428 {
429 new_search_path = malloc(search_len + len + 2); /* 2 = \0 + | */
430 strcpy(new_search_path, search_path);
431 strncat(new_search_path, "|", 1);
432 strncat(new_search_path, path, len);
433
434 ecore_config_string_set("/e/themes/search_path", new_search_path);
435 prop = ecore_config_get("/e/themes/search_path");
436 if (prop)
437 prop->flags &= ~ECORE_CONFIG_FLAG_MODIFIED;
438
439 free(new_search_path);
440
441 return ECORE_CONFIG_ERR_SUCC;
442 }
443 return ECORE_CONFIG_ERR_FAIL;
444}
445
446/**
447 * Retrieve a theme file's full path.
448 *
449 * The search path for theme files is given by @ref
450 * ecore_config_theme_search_path_get .
451 *
452 * @param name The name of the theme.
453 * @return A full path to the theme on success. @c NULL will be returned
454 * if @p name is @c NULL or no theme matching the given name could
455 * be found.
456 */
457char *
458ecore_config_theme_with_path_from_name_get(char *name)
459{
460 char *search_path, *search_path_tmp, *ptr, *end, *file;
461 struct stat st;
462
463 if (!name)
464 return NULL; /* no theme specified (nor a default) */
465
466 search_path = ecore_config_theme_search_path_get();
467 ptr = search_path;
468 end = search_path + strlen(search_path);
469 search_path_tmp = search_path;
470 while (ptr && ptr < end)
471 {
472 while (*ptr != '|' && ptr < end)
473 ptr++;
474 if (ptr < end)
475 *ptr = '\0';
476
477 file = malloc(strlen(search_path_tmp) + strlen(name) + 6);
478 /* 6 = / + .edj + \0 */
479
480 snprintf(file, strlen(search_path_tmp) + strlen(name) + 6,
481 "%s/%s.edj", search_path_tmp, name);
482
483 if (stat(file, &st) == 0)
484 {
485 free(search_path);
486 return file;
487 }
488 free(file);
489 ptr++;
490 search_path_tmp = ptr;
491 }
492
493 free(search_path);
494
495 return NULL; /* we could not find the theme with that name in search path */
496}
497
498/**
499 * Retrieves the full path to the theme file of the theme stored in the
500 * given property.
501 *
502 * The search path for themes is given by @ref
503 * ecore_config_theme_search_path_get .
504 *
505 * @param key The given property.
506 * @return A full path to the theme on success, or @c NULL on failure.
507 * This function will fail if no key is specified or not theme
508 * matching that given by the property @p key could be found.
509 */
510char *
511ecore_config_theme_with_path_get(const char *key)
512{
513 return
514 ecore_config_theme_with_path_from_name_get(ecore_config_theme_get(key));
515}
516
517static const char *_ecore_config_short_types[] =
518 { " ", "<int> ", "<flt> ", "<str> ", "<rgb> ", "<str> ", "<bool>" };
519
520/**
521 * Prints the property list of the local configuration bundle to output.
522 */
523void
524ecore_config_args_display(void)
525{
526 Ecore_Config_Prop *props;
527 _Ecore_Config_Arg_Callback *callbacks;
528
529 if (__ecore_config_app_description)
530 ERR("%s\n\n", __ecore_config_app_description);
531 ERR("Supported Options:");
532 ERR(" -h, --help\t Print this text");
533 if (!__ecore_config_bundle_local)
534 return;
535 props = __ecore_config_bundle_local->data;
536 while (props)
537 {
538 /* if it is a system prop, or cannot be set on command line hide it */
539 if (props->flags & ECORE_CONFIG_FLAG_SYSTEM || (!props->short_opt && !props->long_opt))
540 {
541 props = props->next;
542 continue;
543 }
544 INF(" %c%c%c --%s\t%s %s", props->short_opt ? '-' : ' ',
545 props->short_opt ? props->short_opt : ' ',
546 props->short_opt ? ',' : ' ',
547 props->long_opt ? props->long_opt : props->key,
548 _ecore_config_short_types[props->type],
549 props->description ? props->description :
550 "(no description available)");
551
552 props = props->next;
553 }
554 callbacks = _ecore_config_arg_callbacks;
555 while (callbacks)
556 {
557 INF(" %c%c%c --%s\t%s %s", callbacks->short_opt ? '-' : ' ',
558 callbacks->short_opt ? callbacks->short_opt : ' ',
559 callbacks->short_opt ? ',' : ' ',
560 callbacks->long_opt ? callbacks->long_opt : "",
561 _ecore_config_short_types[callbacks->type],
562 callbacks->description ? callbacks->description :
563 "(no description available)");
564
565 callbacks = callbacks->next;
566 }
567}
568
569static int
570ecore_config_parse_set(Ecore_Config_Prop * prop, char *arg, char *opt,
571 char opt2)
572{
573 if (!arg)
574 {
575 if (opt)
576 ERR("Missing expected argument for option --%s", opt);
577 else
578 ERR("Missing expected argument for option -%c", opt2);
579 return ECORE_CONFIG_PARSE_EXIT;
580 }
581 else
582 {
583 ecore_config_set(prop->key, arg);
584 prop->flags |= ECORE_CONFIG_FLAG_CMDLN;
585 }
586 return ECORE_CONFIG_PARSE_CONTINUE;
587}
588
589static void
590ecore_config_args_callback_add(char short_opt, char *long_opt, char *desc,
591 void (*func)(char *val, void *data),
592 void *data, Ecore_Config_Type type) {
593 _Ecore_Config_Arg_Callback *new_cb;
594
595 new_cb = malloc(sizeof(_Ecore_Config_Arg_Callback));
596 new_cb->short_opt = short_opt;
597 if (long_opt)
598 new_cb->long_opt = strdup(long_opt);
599 if (desc)
600 new_cb->description = strdup(desc);
601 new_cb->data = data;
602 new_cb->func = func;
603 new_cb->type = type;
604
605 new_cb->next = _ecore_config_arg_callbacks;
606 _ecore_config_arg_callbacks = new_cb;
607}
608
609void
610ecore_config_args_callback_str_add(char short_opt, char *long_opt, char *desc,
611 void (*func)(char *val, void *data),
612 void *data) {
613 ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_STR);
614}
615
616void
617ecore_config_args_callback_noarg_add(char short_opt, char *long_opt, char *desc,
618 void (*func)(char *val, void *data),
619 void *data) {
620 ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_NIL);
621}
622
623/**
624 * Parse the arguments set by @ref ecore_app_args_set and set properties
625 * accordingly.
626 *
627 * @return @c ECORE_CONFIG_PARSE_CONTINUE if successful.
628 * @c ECORE_CONFIG_PARSE_EXIT is returned if an unrecognised option
629 * is found. @c ECORE_CONFIG_PARSE_HELP is returned if help was
630 * displayed.
631 */
632int
633ecore_config_args_parse(void)
634{
635 int argc;
636 char **argv;
637 int nextarg, next_short_opt, found, ret;
638 char *arg;
639 char *long_opt, short_opt;
640 Ecore_Config_Prop *prop;
641 _Ecore_Config_Arg_Callback *callback;
642
643 ecore_app_args_get(&argc, &argv);
644 nextarg = 1;
645 while (nextarg < argc)
646 {
647 arg = argv[nextarg];
648
649 if (*arg != '-')
650 {
651 ERR("Unexpected attribute \"%s\"", arg);
652 nextarg++;
653 continue;
654 }
655
656 next_short_opt = 1;
657 short_opt = *(arg + next_short_opt);
658
659 if (short_opt == '-')
660 {
661 long_opt = arg + 2;
662
663 if (!strcmp(long_opt, "help"))
664 {
665 ecore_config_args_display();
666 return ECORE_CONFIG_PARSE_HELP;
667 }
668
669 found = 0;
670 prop = __ecore_config_bundle_local->data;
671 while (prop)
672 {
673 if ((prop->long_opt && !strcmp(long_opt, prop->long_opt))
674 || !strcmp(long_opt, prop->key))
675 {
676 found = 1;
677 if ((ret =
678 ecore_config_parse_set(prop, argv[++nextarg],
679 long_opt,
680 '\0')) !=
681 ECORE_CONFIG_PARSE_CONTINUE)
682 return ret;
683 break;
684 }
685 prop = prop->next;
686 }
687 if (!found)
688 {
689 callback = _ecore_config_arg_callbacks;
690 while (callback)
691 {
692 if ((callback->long_opt &&
693 !strcmp(long_opt, callback->long_opt)))
694 {
695 found = 1;
696 if (callback->type == ECORE_CONFIG_NIL)
697 {
698 callback->func(NULL, callback->data);
699 }
700 else
701 {
702 if (!argv[++nextarg])
703 {
704 ERR("Missing expected argument for option --%s", long_opt);
705 return ECORE_CONFIG_PARSE_EXIT;
706 }
707 callback->func(argv[nextarg], callback->data);
708 }
709 break;
710 }
711 callback = callback->next;
712 }
713 }
714 if (!found)
715 {
716 ERR("Unrecognised option \"%s\"", long_opt);
717 ERR("Try using -h or --help for more information.\n");
718 return ECORE_CONFIG_PARSE_EXIT;
719 }
720 }
721 else
722 {
723 while (short_opt)
724 {
725 if (short_opt == 'h')
726 {
727 ecore_config_args_display();
728 return ECORE_CONFIG_PARSE_HELP;
729 }
730 else
731 {
732 found = 0;
733 prop = __ecore_config_bundle_local->data;
734 while (prop)
735 {
736 if (short_opt == prop->short_opt)
737 {
738 found = 1;
739 if ((ret =
740 ecore_config_parse_set(prop,
741 argv[++nextarg],
742 NULL,
743 short_opt)) !=
744 ECORE_CONFIG_PARSE_CONTINUE)
745 return ret;
746 break;
747 }
748 prop = prop->next;
749 }
750
751 if (!found)
752 {
753 callback = _ecore_config_arg_callbacks;
754 while (callback)
755 {
756 if (short_opt == callback->short_opt)
757 {
758 found = 1;
759 if (callback->type == ECORE_CONFIG_NIL)
760 {
761 callback->func(NULL, callback->data);
762 }
763 else
764 {
765 if (!argv[++nextarg])
766 {
767 ERR("Missing expected argument for option -%c", short_opt);
768 return ECORE_CONFIG_PARSE_EXIT;
769 }
770 callback->func(argv[nextarg], callback->data);
771 }
772 break;
773 }
774 callback = callback->next;
775 }
776 }
777 if (!found)
778 {
779 ERR("Unrecognised option '%c'", short_opt);
780 ERR("Try using -h or --help for more information.\n");
781 return ECORE_CONFIG_PARSE_EXIT;
782 }
783 }
784 short_opt = *(arg + ++next_short_opt);
785 }
786 }
787 nextarg++;
788 }
789
790 return ECORE_CONFIG_PARSE_CONTINUE;
791}
792
793/**
794 * Sets the description string used by @ref ecore_config_args_display .
795 * @param description Description of application.
796 */
797void
798ecore_config_app_describe(char *description)
799{
800 if (__ecore_config_app_description)
801 free(__ecore_config_app_description);
802 __ecore_config_app_description = strdup(description);
803}
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h
deleted file mode 100644
index 7b3dea1..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#include <Ecore_Ipc.h>
2#include "Ecore_Config.h"
3
4typedef enum
5{
6 IPC_NONE,
7 IPC_PROP_LIST,
8 IPC_PROP_DESC,
9 IPC_PROP_GET,
10 IPC_PROP_SET, /* end of the codes shared by evidence and econf */
11
12 IPC_GLOBAL_PROP_LIST,
13
14 IPC_BUNDLE_LIST,
15 IPC_BUNDLE_NEW,
16 IPC_BUNDLE_LABEL_GET,
17 IPC_BUNDLE_LABEL_SET,
18 IPC_BUNDLE_LABEL_FIND,
19
20 IPC_LAST
21} Ecore_Config_Ipc_Call;
22
23Ecore_Config_Server *_ecore_config_ipc_init(const char *pipe_name);
24int _ecore_config_ipc_exit(void);
25
26Ecore_Config_Server *_ecore_config_server_convert(void *srv);
27
28char *_ecore_config_ipc_prop_list(Ecore_Config_Server * srv,
29 const long serial);
30char *_ecore_config_ipc_prop_desc(Ecore_Config_Server * srv,
31 const long serial,
32 const char *key);
33char *_ecore_config_ipc_prop_get(Ecore_Config_Server * srv,
34 const long serial,
35 const char *key);
36int _ecore_config_ipc_prop_set(Ecore_Config_Server * srv,
37 const long serial,
38 const char *key,
39 const char *val);
40
41char *_ecore_config_ipc_bundle_list(Ecore_Config_Server * srv);
42int _ecore_config_ipc_bundle_new(Ecore_Config_Server * srv,
43 const char *);
44char *_ecore_config_ipc_bundle_label_get(Ecore_Config_Server *
45 srv, const long);
46int _ecore_config_ipc_bundle_label_set(Ecore_Config_Server *
47 srv, const long,
48 const char *);
49long _ecore_config_ipc_bundle_label_find(Ecore_Config_Server *
50 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
deleted file mode 100644
index b1622f3..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c
+++ /dev/null
@@ -1,384 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5/* by Azundris, with thanks to Corey Donohoe <atmos@atmos.org> */
6#include <stdio.h>
7#include <stdlib.h>
8#include <string.h>
9#include <errno.h>
10#include <limits.h>
11#include <sys/types.h>
12#include <sys/stat.h>
13#include <unistd.h>
14#include <ctype.h>
15
16#include <Ecore.h>
17#include "ecore_private.h"
18#include <Ecore_Ipc.h>
19
20#include "ecore_config_ipc.h"
21#include "ecore_config_util.h"
22#include "ecore_config_private.h"
23
24#include "Ecore_Config.h"
25
26
27/*****************************************************************************/
28
29static int
30_ecore_config_ipc_ecore_string_get(char **m, char **r)
31{
32 char *q;
33 int l = 0;
34
35 if (!m || !*m)
36 return ECORE_CONFIG_ERR_NODATA;
37 if (!r)
38 return ECORE_CONFIG_ERR_FAIL;
39 q = *m;
40 if (*q != 's')
41 return ECORE_CONFIG_ERR_TYPEMISMATCH;
42 q++;
43 l = (*(q++)) << 8;
44 l += *(q++);
45 *r = q;
46 q += l;
47 *m = q;
48 WRN("IPC/eCore: got string-%d \"%s\"", l, *r);
49 return ECORE_CONFIG_ERR_SUCC;
50}
51
52static char *
53_ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv __UNUSED__, long serial __UNUSED__)
54{
55 Ecore_Config_DB_File *db;
56 char **keys;
57 int key_count, x;
58 estring *s;
59 int f;
60 char buf[PATH_MAX], *p;
61 // char *data; UNUSED
62 Ecore_Config_Type type;
63
64 db = NULL;
65 s = estring_new(8192);
66 f = 0;
67 if ((p = getenv("HOME")))
68 {
69 snprintf(buf, sizeof(buf), "%s/.e/config.eet", p);
70 if (!(db = _ecore_config_db_open_read(buf)))
71 {
72 strcpy(buf, PACKAGE_DATA_DIR"/system.eet");
73 if (!(db = _ecore_config_db_open_read(buf)))
74 return NULL;
75 }
76 }
77 if (!db) return NULL;
78 key_count = 0;
79 keys = _ecore_config_db_keys_get(db, &key_count);
80 if (keys)
81 {
82 for (x = 0; x < key_count; x++)
83 {
84 type = _ecore_config_db_key_type_get(db, keys[x]);
85 switch (type)
86 {
87 case ECORE_CONFIG_INT:
88 estring_appendf(s, "%s%s: integer", f ? "\n" : "", keys[x]);
89 break;
90 case ECORE_CONFIG_BLN:
91 estring_appendf(s, "%s%s: boolean", f ? "\n" : "", keys[x]);
92 break;
93 case ECORE_CONFIG_FLT:
94 estring_appendf(s, "%s%s: float", f ? "\n" : "", keys[x]);
95 break;
96 case ECORE_CONFIG_STR:
97 estring_appendf(s, "%s%s: string", f ? "\n" : "", keys[x]);
98 break;
99 case ECORE_CONFIG_RGB:
100 estring_appendf(s, "%s%s: colour", f ? "\n" : "", keys[x]);
101 break;
102 case ECORE_CONFIG_THM:
103 estring_appendf(s, "%s%s: theme", f ? "\n" : "", keys[x]);
104 break;
105 case ECORE_CONFIG_SCT:
106 estring_appendf(s, "%s%s: structure", f ? "\n" : "", keys[x]);
107 break;
108 default:
109 estring_appendf(s, "%s%s: unknown", f ? "\n" : "", keys[x]);
110 continue;
111 }
112 f = 1;
113 }
114 }
115 _ecore_config_db_close(db);
116 if (keys)
117 {
118 for (x = 0; x < key_count; x++)
119 {
120 free(keys[x]);
121 }
122 free(keys);
123 }
124
125 return estring_disown(s);
126}
127
128/*****************************************************************************/
129
130static int
131_ecore_config_ipc_ecore_send(Ecore_Ipc_Event_Client_Data * e, int code,
132 char *reply)
133{
134 static int our_ref = 0;
135 int len = reply ? strlen(reply) + 1 : 0;
136
137 our_ref++;
138 WRN("IPC/eCore: replying [0,0] %d IRT %d => %d {\"%s\":%d}", our_ref,
139 e->ref, code, reply ? reply : "", len);
140 return ecore_ipc_client_send(e->client, 0, 0, our_ref, e->ref, code, reply,
141 len);
142}
143
144/*****************************************************************************/
145
146static int
147_ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server,
148 Ecore_Ipc_Event_Client_Data * e)
149{
150 Ecore_Config_Server *srv;
151 long serial;
152 int ret;
153 char *r, *k, *v, *m;
154
155 srv = _ecore_config_server_convert(server);
156 serial = e->minor;
157 r = NULL;
158 m = (char *)e->data;
159 INF("IPC/eCore: client sent: [%d,%d] #%d (%d) @ %p", e->major, e->minor,
160 e->ref, e->size, server);
161
162 switch (e->major)
163 {
164 case IPC_PROP_LIST:
165 if (srv == __ecore_config_server_global)
166 r = _ecore_config_ipc_global_prop_list(srv, serial);
167 else
168 r = _ecore_config_ipc_prop_list(srv, serial);
169 break;
170 case IPC_PROP_DESC:
171 if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
172 r = _ecore_config_ipc_prop_desc(srv, serial, k);
173 break;
174 case IPC_PROP_GET:
175 if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
176 r = _ecore_config_ipc_prop_get(srv, serial, k);
177 break;
178 case IPC_PROP_SET:
179 if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
180 {
181 if (_ecore_config_ipc_ecore_string_get(&m, &v) ==
182 ECORE_CONFIG_ERR_SUCC)
183 return _ecore_config_ipc_ecore_send(e,
184 _ecore_config_ipc_prop_set
185 (srv, serial, k, v), NULL);
186 }
187 break;
188
189 case IPC_BUNDLE_LIST:
190 r = _ecore_config_ipc_bundle_list(srv);
191 break;
192 case IPC_BUNDLE_NEW:
193 if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
194 return _ecore_config_ipc_ecore_send(e,
195 k ?
196 _ecore_config_ipc_bundle_new(srv,
197 k) :
198 ECORE_CONFIG_ERR_FAIL, NULL);
199 break;
200 case IPC_BUNDLE_LABEL_SET:
201 if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
202 return _ecore_config_ipc_ecore_send(e,
203 k ?
204 _ecore_config_ipc_bundle_label_set
205 (srv, serial,
206 k) : ECORE_CONFIG_ERR_FAIL,
207 NULL);
208 break;
209 case IPC_BUNDLE_LABEL_FIND:
210 if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC)
211 return _ecore_config_ipc_ecore_send(e,
212 _ecore_config_ipc_bundle_label_find
213 (srv, k), NULL);
214 break;
215 case IPC_BUNDLE_LABEL_GET:
216 r = _ecore_config_ipc_bundle_label_get(srv, serial);
217 break;
218 }
219
220 ret =
221 _ecore_config_ipc_ecore_send(e,
222 r ? ECORE_CONFIG_ERR_SUCC :
223 ECORE_CONFIG_ERR_FAIL, r);
224 if (r)
225 {
226 free(r);
227 return ret;
228 }
229 return ECORE_CONFIG_ERR_NOTFOUND;
230}
231
232/*****************************************************************************/
233
234static Eina_Bool
235_ecore_config_ipc_client_add(void *data, int type __UNUSED__, void *event)
236{
237 Ecore_Ipc_Server **server;
238 Ecore_Ipc_Event_Client_Data *e;
239
240 server = (Ecore_Ipc_Server **) data;
241 e = (Ecore_Ipc_Event_Client_Data *) event;
242
243 if (*server != ecore_ipc_client_server_get(e->client))
244 return EINA_TRUE;
245
246 INF("IPC/eCore: Client connected. @ %p", server);
247 return EINA_TRUE;
248}
249
250static Eina_Bool
251_ecore_config_ipc_client_del(void *data, int type __UNUSED__, void *event)
252{
253 Ecore_Ipc_Server **server;
254 Ecore_Ipc_Event_Client_Data *e;
255
256 server = (Ecore_Ipc_Server **) data;
257 e = (Ecore_Ipc_Event_Client_Data *) event;
258
259 if (*server != ecore_ipc_client_server_get(e->client))
260 return EINA_TRUE;
261
262 INF("IPC/eCore: Client disconnected. @ %p", server);
263 return EINA_TRUE;
264}
265
266static Eina_Bool
267_ecore_config_ipc_client_sent(void *data, int type __UNUSED__, void *event)
268{
269 Ecore_Ipc_Server **server;
270 Ecore_Ipc_Event_Client_Data *e;
271
272 server = (Ecore_Ipc_Server **) data;
273 e = (Ecore_Ipc_Event_Client_Data *) event;
274
275 if (*server != ecore_ipc_client_server_get(e->client))
276 return EINA_TRUE;
277
278 _ecore_config_ipc_ecore_handle_request(*server, e);
279 return EINA_TRUE;
280}
281
282/*****************************************************************************/
283
284int
285_ecore_config_ipc_ecore_init(const char *pipe_name, void **data)
286{
287 Ecore_Ipc_Server **server;
288 struct stat st;
289 char *p;
290 int port;
291 char socket[PATH_MAX];
292
293 server = (Ecore_Ipc_Server **) data;
294 port = 0;
295 if (!server)
296 return ECORE_CONFIG_ERR_FAIL;
297
298/* if(*server)
299 return ECORE_CONFIG_ERR_IGNORED; */
300
301 ecore_init();
302 if (ecore_ipc_init() < 1)
303 return ECORE_CONFIG_ERR_FAIL;
304
305 if ((p = getenv("HOME")))
306 { /* debug-only ### FIXME */
307 int stale;
308
309 stale = 1;
310 while (stale)
311 {
312 snprintf(socket, PATH_MAX, "%s/.ecore/%s/%d", p, pipe_name, port);
313
314 if (!stat(socket, &st))
315 {
316 INF("IPC/eCore: pipe \"%s\" already exists!?", socket);
317/* if(unlink(buf))
318 E(0,"IPC/eCore: could not remove pipe \"%s\": %d\n",buf,errno); }}*/
319 port++;
320 }
321 else
322 {
323 stale = 0;
324 }
325 }
326 }
327 *server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, pipe_name, port, NULL);
328 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
329 _ecore_config_ipc_client_add, server);
330 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
331 _ecore_config_ipc_client_del, server);
332 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
333 _ecore_config_ipc_client_sent, server);
334
335 if (*server)
336 {
337 INF("IPC/eCore: Server is listening on %s.", pipe_name);
338 }
339
340 return ECORE_CONFIG_ERR_SUCC;
341}
342
343int
344_ecore_config_ipc_ecore_exit(void **data)
345{
346 int ret;
347 Ecore_Ipc_Server **server;
348
349 ret = ECORE_CONFIG_ERR_SUCC;
350 server = (Ecore_Ipc_Server **) data;
351
352 if (!server)
353 return ECORE_CONFIG_ERR_FAIL;
354
355 if (*server)
356 {
357 ecore_ipc_server_del(*server);
358 *server = NULL;
359 }
360
361 ecore_ipc_shutdown();
362 ecore_shutdown();
363
364 return ret;
365}
366
367/*****************************************************************************/
368
369int
370_ecore_config_ipc_ecore_poll(void **data)
371{
372 Ecore_Ipc_Server **server;
373
374 server = (Ecore_Ipc_Server **) data;
375
376 if (!server)
377 return ECORE_CONFIG_ERR_FAIL;
378
379 ecore_main_loop_iterate();
380
381 return ECORE_CONFIG_ERR_SUCC;
382}
383
384/*****************************************************************************/
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
deleted file mode 100644
index 35bd783..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c
+++ /dev/null
@@ -1,275 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5/* ############## bad */
6#define HAVE_EVAS2
7
8#include <signal.h>
9#include <dlfcn.h>
10#include <stdio.h>
11#include <glob.h>
12#include <sys/param.h>
13#include <limits.h>
14#include <string.h>
15#include <stdlib.h> /* malloc(), free() */
16
17#include "Ecore.h"
18#include "Ecore_Config.h"
19#include "ecore_config_util.h"
20#include "ecore_config_ipc.h"
21
22#include "ecore_config_private.h"
23
24static Ecore_Config_Server *__ecore_config_servers;
25Ecore_Timer *ipc_timer = NULL;
26
27Ecore_Config_Server *
28_ecore_config_server_convert(void *srv)
29{
30 Ecore_Config_Server *srv_tmp;
31
32 srv_tmp = __ecore_config_servers;
33 while (srv_tmp)
34 {
35 if (srv_tmp->server == srv)
36 return srv_tmp;
37 srv_tmp = srv_tmp->next;
38 }
39
40 return __ecore_config_server_global;
41}
42
43/*****************************************************************************/
44/* INTERFACE FOR IPC MODULES */
45/*****************************/
46
47char *
48_ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial)
49{
50 Ecore_Config_Bundle *theme;
51 Ecore_Config_Prop *e;
52 estring *s;
53 int f;
54
55 theme = ecore_config_bundle_by_serial_get(srv, serial);
56 e = theme ? theme->data : NULL;
57 s = estring_new(8192);
58 f = 0;
59 while (e)
60 {
61 /* ignore system properties in listings, unless they have been overridden */
62 if (e->flags & ECORE_CONFIG_FLAG_SYSTEM && !(e->flags & ECORE_CONFIG_FLAG_MODIFIED))
63 {
64 e = e->next;
65 continue;
66 }
67 estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key,
68 ecore_config_type_get(e));
69 if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
70 {
71 if (e->type == ECORE_CONFIG_FLT)
72 estring_appendf(s, ", range %le..%le",
73 (float)e->lo / ECORE_CONFIG_FLOAT_PRECISION,
74 (float)e->hi / ECORE_CONFIG_FLOAT_PRECISION);
75 else
76 estring_appendf(s, ", range %d..%d", e->lo, e->hi);
77 }
78 if (e->type == ECORE_CONFIG_THM)
79 estring_appendf(s, ", group %s", e->data ? e->data : "Main");
80 f = 1;
81 e = e->next;
82 }
83
84 return estring_disown(s);
85}
86
87char *
88_ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, const long serial,
89 const char *key)
90{
91#ifdef HAVE_EVAS2
92 Ecore_Config_Prop *e;
93
94 e = ecore_config_get(key);
95 if (e)
96 {
97 estring *s = estring_new(512);
98
99 estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e));
100 if (e->flags & ECORE_CONFIG_FLAG_BOUNDS)
101 estring_appendf(s, ", range %d..%d", e->lo, e->hi);
102 return estring_disown(s);
103 }
104#endif
105 return strdup("<undefined>");
106}
107
108char *
109_ecore_config_ipc_prop_get(Ecore_Config_Server * srv, const long serial,
110 const char *key)
111{
112#ifdef HAVE_EVAS2
113 char *ret;
114
115 if ((ret = ecore_config_as_string_get(key)))
116 return ret;
117#endif
118 return strdup("<undefined>");
119}
120
121int
122_ecore_config_ipc_prop_set(Ecore_Config_Server * srv, const long serial,
123 const char *key, const char *val)
124{
125#ifdef HAVE_EVAS2
126 int ret;
127 Ecore_Config_Bundle *theme;
128
129 theme = ecore_config_bundle_by_serial_get(srv, serial);
130 ret = ecore_config_set(key, (char *)val);
131 ERR("ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "",
132 key, val, ret);
133 return ret;
134#else
135 return ECORE_CONFIG_ERR_NOTSUPP;
136#endif
137}
138
139/*****************************************************************************/
140
141char *
142_ecore_config_ipc_bundle_list(Ecore_Config_Server * srv)
143{
144 Ecore_Config_Bundle *ns;
145 estring *s;
146 int f;
147
148 ns = ecore_config_bundle_1st_get(srv);
149 s = estring_new(8192);
150 f = 0;
151 if (!ns)
152 return strdup("<no_bundles_created>");
153
154 while (ns)
155 {
156 estring_appendf(s, "%s%d: %s", f ? "\n" : "",
157 ecore_config_bundle_serial_get(ns),
158 ecore_config_bundle_label_get(ns));
159 f = 1;
160 ns = ecore_config_bundle_next_get(ns);
161 }
162
163 return estring_disown(s);
164}
165
166int
167_ecore_config_ipc_bundle_new(Ecore_Config_Server * srv, const char *label)
168{
169 if (ecore_config_bundle_new(srv, label))
170 return ECORE_CONFIG_ERR_SUCC;
171 return ECORE_CONFIG_ERR_FAIL;
172}
173
174char *
175_ecore_config_ipc_bundle_label_get(Ecore_Config_Server * srv, const long serial)
176{
177 Ecore_Config_Bundle *ns;
178 char *label;
179
180 ns = ecore_config_bundle_by_serial_get(srv, serial);
181 label = ecore_config_bundle_label_get(ns);
182 return strdup(label ? label : "<no such bundle>");
183}
184
185int
186_ecore_config_ipc_bundle_label_set(Ecore_Config_Server * srv, const long serial,
187 const char *label)
188{
189 Ecore_Config_Bundle *ns;
190
191 ns = ecore_config_bundle_by_serial_get(srv, serial);
192 if (!(ns->identifier = malloc(sizeof(label))))
193 return ECORE_CONFIG_ERR_OOM;
194 memcpy(ns->identifier, label, sizeof(label));
195 return ECORE_CONFIG_ERR_SUCC;
196}
197
198long
199_ecore_config_ipc_bundle_label_find(Ecore_Config_Server * srv,
200 const char *label)
201{
202 Ecore_Config_Bundle *ns;
203
204 ns = ecore_config_bundle_by_label_get(srv, label);
205 return ns ? ecore_config_bundle_serial_get(ns) : -1;
206}
207
208static Eina_Bool
209_ecore_config_ipc_poll(void *data __UNUSED__)
210{
211 Ecore_Config_Server *s;
212
213 s = __ecore_config_servers;
214 while (s)
215 {
216 _ecore_config_ipc_ecore_poll(&s->server);
217 s = s->next;
218 }
219
220 return EINA_TRUE;
221}
222
223int
224_ecore_config_ipc_exit(void)
225{
226 Ecore_Config_Server *l;
227
228 if (ipc_timer)
229 ecore_timer_del(ipc_timer);
230
231 l = __ecore_config_servers;
232 while (l)
233 {
234 _ecore_config_ipc_ecore_exit(&l->server);
235 if (l->name)
236 free(l->name);
237 l = l->next;
238 }
239
240 return ECORE_CONFIG_ERR_SUCC;
241}
242
243Ecore_Config_Server *
244_ecore_config_ipc_init(const char *pipe_name)
245{
246 int ret;
247 Ecore_Config_Server *list;
248 Ecore_Config_Server *ret_srv;
249
250 list = NULL;
251 ret_srv = NULL;
252 list = NULL;
253
254 list = calloc(1, sizeof(Ecore_Config_Server));
255 if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC)
256 {
257 ERR("_ecore_config_ipc_init: failed to register %s, code %d",
258 pipe_name, ret);
259 }
260
261 ERR("_ecore_config_ipc_init: registered \"%s\"...", pipe_name);
262
263 list->name = strdup(pipe_name);
264 list->next = __ecore_config_servers;
265
266 __ecore_config_servers = list;
267 if (!ret_srv)
268 ret_srv = list;
269
270 if (!ipc_timer)
271 ipc_timer = ecore_timer_add(100, _ecore_config_ipc_poll, NULL);
272
273 return ret_srv;
274}
275/*****************************************************************************/
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_private.h b/libraries/ecore/src/lib/ecore_config/ecore_config_private.h
deleted file mode 100644
index b97f695..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_private.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef _ECORE_CONFIG_PRIVATE_H
2# define _ECORE_CONFIG_PRIVATE_H
3#ifdef ECORE_CONFIG_DEFAULT_LOG_COLOR
4# undef ECORE_CONFIG_DEFAULT_LOG_COLOR
5#endif
6#define ECORE_CONFIG_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
7 /* eina_log related things */
8
9extern int _ecore_config_log_dom;
10#ifdef ERR
11# undef ERR
12#endif
13#define ERR(...) EINA_LOG_DOM_ERR(_ecore_config_log_dom, __VA_ARGS__)
14
15#ifdef DBG
16# undef DBG
17#endif
18#define DBG(...) EINA_LOG_DOM_DBG(_ecore_config_log_dom, __VA_ARGS__)
19
20#ifdef INF
21# undef INF
22#endif
23#define INF(...) EINA_LOG_DOM_INFO(_ecore_config_log_dom, __VA_ARGS__)
24
25#ifdef WRN
26# undef WRN
27#endif
28#define WRN(...) EINA_LOG_DOM_WARN(_ecore_config_log_dom, __VA_ARGS__)
29
30#ifdef CRIT
31# undef CRIT
32#endif
33#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_config_log_dom, __VA_ARGS__)
34
35/* debug */
36extern int DEBUG;
37
38
39typedef struct _Ecore_Config_DB_File Ecore_Config_DB_File;
40
41int _ecore_config_mod_init(const char *pipe_name, void **data);
42int _ecore_config_mod_exit(void **data);
43int _ecore_config_mod_poll(void **data);
44
45Ecore_Config_DB_File *_ecore_config_db_open_read(const char *file);
46Ecore_Config_DB_File *_ecore_config_db_open_write(const char *file);
47void _ecore_config_db_close(Ecore_Config_DB_File *db);
48char **_ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret);
49Ecore_Config_Type _ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key);
50int _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key);
51void _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e);
52
53int _ecore_config_boolean_get(Ecore_Config_Prop *e);
54char *_ecore_config_string_get(Ecore_Config_Prop *e);
55long _ecore_config_int_get(Ecore_Config_Prop *e);
56int _ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r,
57 int *g, int *b);
58char *_ecore_config_argbstr_get(Ecore_Config_Prop *e);
59long _ecore_config_argbint_get(Ecore_Config_Prop *e);
60float _ecore_config_float_get(Ecore_Config_Prop *e);
61char *_ecore_config_theme_get(Ecore_Config_Prop *e);
62
63int _ecore_config_ipc_ecore_init(const char *pipe_name, void **data);
64int _ecore_config_ipc_ecore_exit(void **data);
65int _ecore_config_ipc_ecore_poll(void **data);
66
67#include "Ecore.h"
68#include "ecore_private.h"
69
70#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
deleted file mode 100644
index d059645..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c
+++ /dev/null
@@ -1,176 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8#include <limits.h>
9
10#include <sys/param.h>
11#include <sys/types.h>
12#include <sys/stat.h>
13#include <unistd.h>
14
15#include "Ecore_Config.h"
16#include "ecore_config_private.h"
17
18/**
19 * Loads the default configuration.
20 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
21 * is returned if the file cannot be loaded.
22 * @ingroup Ecore_Config_File_Group
23 */
24EAPI int
25ecore_config_load(void)
26{
27 char file[PATH_MAX];
28
29 if (!__ecore_config_app_name)
30 return ECORE_CONFIG_ERR_FAIL;
31
32 snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.eet", getenv("HOME"),
33 __ecore_config_app_name);
34 return ecore_config_file_load(file);
35}
36
37/**
38 * Saves the current configuration to the default file.
39 * @return @c ECORE_CONFIG_ERR_SUCC is returned on success.
40 * @c ECORE_CONFIG_ERR_FAIL is returned if the data cannot be
41 * saved.
42 * @ingroup Ecore_Config_File_Group
43 */
44EAPI int
45ecore_config_save(void)
46{
47 char file[PATH_MAX];
48
49 if (!__ecore_config_app_name)
50 return ECORE_CONFIG_ERR_FAIL;
51
52 snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.eet", getenv("HOME"),
53 __ecore_config_app_name);
54 return ecore_config_file_save(file);
55}
56
57/**
58 * Load the given configuration file to the local configuration.
59 * @param file Name of the file to load.
60 * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA
61 * is returned if the file cannot be loaded.
62 * @ingroup Ecore_Config_File_Group
63 */
64EAPI int
65ecore_config_file_load(const char *file)
66{
67 Ecore_Config_DB_File *db;
68 char **keys;
69 int key_count;
70 int x;
71 // double ftmp; UNUSED
72 // int pt; UNUSED
73 // int itmp; UNUSED
74 // Ecore_Config_Type type; UNUSED
75 char *data;
76
77 db = NULL;
78 data = NULL;
79
80 db = _ecore_config_db_open_read(file);
81 if (!db)
82 {
83 ERR("Cannot open database from file %s!", file);
84 return ECORE_CONFIG_ERR_NODATA;
85 }
86 key_count = 0;
87 keys = _ecore_config_db_keys_get(db, &key_count);
88 if (keys)
89 {
90 for (x = 0; x < key_count; x++)
91 {
92 _ecore_config_db_read(db, keys[x]);
93 }
94 }
95 _ecore_config_db_close(db);
96 if (keys)
97 {
98 for (x = 0; x < key_count; x++)
99 {
100 free(keys[x]);
101 }
102 free(keys);
103 }
104 return ECORE_CONFIG_ERR_SUCC;
105}
106
107static void
108_ecore_config_recurse_mkdir(const char *file)
109{
110 char *file_ptr;
111 char *file_tmp;
112 struct stat status;
113
114 file_tmp = strdup(file);
115 file_ptr = file_tmp + strlen(file_tmp);
116 while (*file_ptr != '/' && file_ptr > file_tmp)
117 file_ptr--;
118 *file_ptr = '\0';
119
120 if ((file_tmp[0] != 0) && stat(file_tmp, &status))
121 {
122 _ecore_config_recurse_mkdir(file_tmp);
123 mkdir(file_tmp, S_IRUSR | S_IWUSR | S_IXUSR);
124 }
125 free(file_tmp);
126}
127
128/**
129 * Saves the local configuration to the given file.
130 * @param file Name of the file to save to.
131 * @return @c ECORE_CONFIG_ERR_SUCC is returned on success.
132 * @c ECORE_CONFIG_ERR_FAIL is returned if the data cannot be
133 * saved.
134 * @ingroup Ecore_Config_File_Group
135 */
136EAPI int
137ecore_config_file_save(const char *file)
138{
139 Ecore_Config_Prop *next;
140 Ecore_Config_DB_File *db;
141 struct stat status;
142
143 next = __ecore_config_bundle_local->data;
144 db = NULL;
145
146 /* if file does not exist check to see if the dirs exist, creating if not */
147 if (stat(file, &status))
148 _ecore_config_recurse_mkdir(file);
149
150 db = _ecore_config_db_open_write(file);
151 if (!db)
152 {
153 ERR("Cannot open database from file %s!", file);
154 return ECORE_CONFIG_ERR_FAIL;
155 }
156
157 while (next)
158 {
159 /* let the config_db deal with this
160 * handyande: hmm, not sure that it ever does - reinstating until
161 * further discussions satisfy me!
162 */
163 if (!(next->flags & ECORE_CONFIG_FLAG_MODIFIED) || next->flags & ECORE_CONFIG_FLAG_CMDLN)
164 {
165 next = next->next;
166 continue;
167 }
168
169 _ecore_config_db_write(db, next);
170
171 next = next->next;
172 }
173
174 _ecore_config_db_close(db);
175 return ECORE_CONFIG_ERR_SUCC;
176}
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_util.c b/libraries/ecore/src/lib/ecore_config/ecore_config_util.c
deleted file mode 100644
index 6156936..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_util.c
+++ /dev/null
@@ -1,129 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5/* azundris */
6
7#include <sys/types.h>
8#include <stdlib.h> /* malloc(), free() */
9#include <stdio.h>
10#include <string.h> /* str...() */
11
12#include <stdarg.h> /* varargs in sprintf/appendf */
13
14#include "Ecore.h"
15#include "ecore_private.h"
16
17#include "Ecore_Config.h"
18#include "ecore_config_util.h"
19
20#include "ecore_config_private.h"
21
22#define CHUNKLEN 4096
23
24/*****************************************************************************/
25/* STRINGS */
26/***********/
27
28estring *
29estring_new(int size)
30{
31 estring *e = malloc(sizeof(estring));
32
33 if (e)
34 {
35 memset(e, 0, sizeof(estring));
36 if ((size > 0) && (e->str = malloc(size)))
37 e->alloc = size;
38 }
39 return e;
40}
41
42char *
43estring_disown(estring * e)
44{
45 if (e)
46 {
47 char *r = e->str;
48
49 free(e);
50 return r;
51 }
52 return NULL;
53}
54
55int
56estring_appendf(estring * e, const char *fmt, ...)
57{
58 int need;
59 va_list ap;
60 char *p;
61
62 if (!e)
63 return ECORE_CONFIG_ERR_FAIL;
64
65 if (!e->str)
66 {
67 e->used = e->alloc = 0;
68 if (!(e->str = (char *)malloc(e->alloc = CHUNKLEN)))
69 return ECORE_CONFIG_ERR_OOM;
70 }
71
72 va_start(ap, fmt);
73 need = vsnprintf(NULL, 0, fmt, ap);
74 va_end(ap);
75
76 if (need >= (e->alloc - e->used))
77 {
78 e->alloc = e->used + need + (CHUNKLEN - (need % CHUNKLEN));
79
80 if (!(p = (char *)realloc(e->str, e->alloc)))
81 {
82 free(e->str);
83 e->alloc = e->used = 0;
84 return ECORE_CONFIG_ERR_OOM;
85 }
86 e->str = p;
87 }
88
89 va_start(ap, fmt);
90 need = vsnprintf(e->str + e->used, e->alloc - e->used, fmt, ap);
91 va_end(ap);
92
93 return e->used += need;
94}
95
96int
97esprintf(char **result, const char *fmt, ...)
98{
99 va_list ap;
100 size_t need;
101 char *n;
102
103 if (!result)
104 return ECORE_CONFIG_ERR_FAIL;
105
106 va_start(ap, fmt);
107 need = vsnprintf(NULL, 0, fmt, ap) + 1;
108 va_end(ap);
109 n = malloc(need + 1);
110
111 if (n)
112 {
113 va_start(ap, fmt);
114 need = vsnprintf(n, need, fmt, ap);
115 va_end(ap);
116
117 n[need] = 0;
118
119 if(*result)
120 free(result);
121 *result = n;
122
123 return need;
124 }
125
126 return ECORE_CONFIG_ERR_OOM;
127}
128
129/*****************************************************************************/
diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_util.h b/libraries/ecore/src/lib/ecore_config/ecore_config_util.h
deleted file mode 100644
index 5bee9d6..0000000
--- a/libraries/ecore/src/lib/ecore_config/ecore_config_util.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#define TIMER_STOP 0
2#define TIMER_CONT 1
3
4typedef struct _estring
5{
6 char *str;
7 int alloc, used;
8} estring;
9
10estring *estring_new(int size);
11char *estring_disown(estring * e);
12int estring_appendf(estring * e, const char *fmt, ...);
13
14int 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
deleted file mode 100644
index 1f6fc63..0000000
--- a/libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h
+++ /dev/null
@@ -1,181 +0,0 @@
1#ifndef _ECORE_DIRECTFB_H
2#define _ECORE_DIRECTFB_H
3
4#include <directfb.h>
5
6#include <Eina.h>
7
8#ifdef EAPI
9# undef EAPI
10#endif /* ifdef EAPI */
11
12#ifdef __GNUC__
13# if __GNUC__ >= 4
14# define EAPI __attribute__ ((visibility("default")))
15# else /* if __GNUC__ >= 4 */
16# define EAPI
17# endif /* if __GNUC__ >= 4 */
18#else /* ifdef __GNUC__ */
19# define EAPI
20#endif /* ifdef __GNUC__ */
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* ifdef __cplusplus */
25
26EAPI extern int ECORE_DIRECTFB_EVENT_POSITION;
27EAPI extern int ECORE_DIRECTFB_EVENT_SIZE;
28EAPI extern int ECORE_DIRECTFB_EVENT_CLOSE;
29EAPI extern int ECORE_DIRECTFB_EVENT_DESTROYED;
30EAPI extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS;
31EAPI extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS;
32EAPI extern int ECORE_DIRECTFB_EVENT_KEY_DOWN;
33EAPI extern int ECORE_DIRECTFB_EVENT_KEY_UP;
34EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN;
35EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_UP;
36EAPI extern int ECORE_DIRECTFB_EVENT_MOTION;
37EAPI extern int ECORE_DIRECTFB_EVENT_ENTER;
38EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE;
39EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL;
40
41#ifndef _ECORE_DIRECTFB_WINDOW_PREDEF
42typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
43#endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */
44typedef struct _Ecore_DirectFB_Cursor Ecore_DirectFB_Cursor;
45
46typedef struct _Ecore_DirectFB_Event_Key_Down Ecore_DirectFB_Event_Key_Down;
47typedef struct _Ecore_DirectFB_Event_Key_Up Ecore_DirectFB_Event_Key_Up;
48typedef struct _Ecore_DirectFB_Event_Button_Down Ecore_DirectFB_Event_Button_Down;
49typedef struct _Ecore_DirectFB_Event_Button_Up Ecore_DirectFB_Event_Button_Up;
50typedef struct _Ecore_DirectFB_Event_Motion Ecore_DirectFB_Event_Motion;
51typedef struct _Ecore_DirectFB_Event_Enter Ecore_DirectFB_Event_Enter;
52typedef struct _Ecore_DirectFB_Event_Leave Ecore_DirectFB_Event_Leave;
53typedef struct _Ecore_DirectFB_Event_Wheel Ecore_DirectFB_Event_Wheel;
54typedef struct _Ecore_DirectFB_Event_Got_Focus Ecore_DirectFB_Event_Got_Focus;
55typedef struct _Ecore_DirectFB_Event_Lost_Focus Ecore_DirectFB_Event_Lost_Focus;
56
57/* this struct is to keep windows data (id, window itself and surface) in memory as every call
58 * to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the
59 * reference count, then we will have to release N times the data, so better we just ask for
60 them once */
61struct _Ecore_DirectFB_Window
62{
63 DFBWindowID id;
64 IDirectFBWindow *window;
65 IDirectFBSurface *surface;
66 Ecore_DirectFB_Cursor *cursor;
67};
68
69struct _Ecore_DirectFB_Cursor
70{
71 IDirectFBSurface *surface;
72 int hot_x;
73 int hot_y;
74};
75
76struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */
77{
78 char *name; /**< The name of the key that was released */
79 char *string; /**< The logical symbol of the key that was pressed */
80 char *key_compose; /**< The UTF-8 string conversion if any */
81 unsigned int time;
82 DFBWindowID win;
83};
84
85struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */
86{
87 char *name; /**< The name of the key that was released */
88 char *string; /**< The logical symbol of the key that was pressed */
89 char *key_compose; /**< The UTF-8 string conversion if any */
90 unsigned int time;
91 DFBWindowID win;
92};
93
94struct _Ecore_DirectFB_Event_Button_Down
95{
96 int button;
97 int modifiers;
98 int x, y;
99 unsigned int time;
100 int double_click : 1;
101 int triple_click : 1;
102 DFBWindowID win;
103};
104struct _Ecore_DirectFB_Event_Button_Up
105{
106 int button;
107 int modifiers;
108 int x, y;
109 unsigned int time;
110 DFBWindowID win;
111 int double_click : 1;
112 int triple_click : 1;
113};
114struct _Ecore_DirectFB_Event_Motion
115{
116 int modifiers;
117 int x, y;
118 unsigned int time;
119 DFBWindowID win;
120};
121
122struct _Ecore_DirectFB_Event_Enter
123{
124 int modifiers;
125 int x, y;
126 unsigned int time;
127 DFBWindowID win;
128};
129
130struct _Ecore_DirectFB_Event_Leave
131{
132 int modifiers;
133 int x, y;
134 unsigned int time;
135 DFBWindowID win;
136};
137
138struct _Ecore_DirectFB_Event_Wheel
139{
140 int direction;
141 int z;
142 int modifiers;
143 unsigned int time;
144 DFBWindowID win;
145};
146
147struct _Ecore_DirectFB_Event_Got_Focus
148{
149 unsigned int time;
150 DFBWindowID win;
151};
152
153struct _Ecore_DirectFB_Event_Lost_Focus
154{
155 unsigned int time;
156 DFBWindowID win;
157};
158
159/* main functions */
160EAPI int ecore_directfb_init(const char *name);
161EAPI int ecore_directfb_shutdown(void);
162EAPI IDirectFB * ecore_directfb_interface_get(void);
163
164/* window operations */
165EAPI Ecore_DirectFB_Window *ecore_directfb_window_new(int x, int y, int w, int h);
166EAPI void ecore_directfb_window_free(Ecore_DirectFB_Window *window);
167EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y);
168EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h);
169EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *window);
170EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *window);
171EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *window);
172EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, Eina_Bool set);
173EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, Eina_Bool set);
174EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h);
175EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, Eina_Bool show);
176
177#ifdef __cplusplus
178}
179#endif /* ifdef __cplusplus */
180
181#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
deleted file mode 100644
index 8142d33..0000000
--- a/libraries/ecore/src/lib/ecore_directfb/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_builddir)/src/lib/ecore \
6@DIRECTFB_CFLAGS@ @EINA_CFLAGS@
7
8lib_LTLIBRARIES = libecore_directfb.la
9includes_HEADERS = Ecore_DirectFB.h
10includesdir = $(includedir)/ecore-@VMAJ@
11
12libecore_directfb_la_SOURCES = \
13ecore_directfb.c \
14ecore_directfb_keys.h \
15ecore_directfb_private.h
16
17libecore_directfb_la_LIBADD = \
18$(top_builddir)/src/lib/ecore/libecore.la \
19@DIRECTFB_LIBS@ \
20@EINA_LIBS@
21
22libecore_directfb_la_LDFLAGS = -version-info @version_info@ @release_info@
23
24libecore_directfb_la_DEPENDENCIES = \
25$(top_builddir)/src/lib/ecore/libecore.la
26
27EXTRA_DIST = \
28Ecore_DirectFB.h \
29ecore_directfb.c \
30ecore_directfb_keys.h \
31ecore_directfb_private.h
diff --git a/libraries/ecore/src/lib/ecore_directfb/Makefile.in b/libraries/ecore/src/lib/ecore_directfb/Makefile.in
deleted file mode 100644
index f1b270a..0000000
--- a/libraries/ecore/src/lib/ecore_directfb/Makefile.in
+++ /dev/null
@@ -1,836 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_directfb
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88am_libecore_directfb_la_OBJECTS = ecore_directfb.lo
89libecore_directfb_la_OBJECTS = $(am_libecore_directfb_la_OBJECTS)
90AM_V_lt = $(am__v_lt_$(V))
91am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
92am__v_lt_0 = --silent
93libecore_directfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
94 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
95 $(AM_CFLAGS) $(CFLAGS) $(libecore_directfb_la_LDFLAGS) \
96 $(LDFLAGS) -o $@
97DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
98depcomp = $(SHELL) $(top_srcdir)/depcomp
99am__depfiles_maybe = depfiles
100am__mv = mv -f
101COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
102 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
103LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
104 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
105 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
106 $(AM_CFLAGS) $(CFLAGS)
107AM_V_CC = $(am__v_CC_$(V))
108am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
109am__v_CC_0 = @echo " CC " $@;
110AM_V_at = $(am__v_at_$(V))
111am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
112am__v_at_0 = @
113CCLD = $(CC)
114LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
115 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
116 $(AM_LDFLAGS) $(LDFLAGS) -o $@
117AM_V_CCLD = $(am__v_CCLD_$(V))
118am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
119am__v_CCLD_0 = @echo " CCLD " $@;
120AM_V_GEN = $(am__v_GEN_$(V))
121am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
122am__v_GEN_0 = @echo " GEN " $@;
123SOURCES = $(libecore_directfb_la_SOURCES)
124DIST_SOURCES = $(libecore_directfb_la_SOURCES)
125HEADERS = $(includes_HEADERS)
126ETAGS = etags
127CTAGS = ctags
128DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
129ACLOCAL = @ACLOCAL@
130ALLOCA = @ALLOCA@
131AMTAR = @AMTAR@
132AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
133AR = @AR@
134AS = @AS@
135AUTOCONF = @AUTOCONF@
136AUTOHEADER = @AUTOHEADER@
137AUTOMAKE = @AUTOMAKE@
138AWK = @AWK@
139CARES_CFLAGS = @CARES_CFLAGS@
140CARES_LIBS = @CARES_LIBS@
141CC = @CC@
142CCDEPMODE = @CCDEPMODE@
143CFLAGS = @CFLAGS@
144CHECK_CFLAGS = @CHECK_CFLAGS@
145CHECK_LIBS = @CHECK_LIBS@
146CPP = @CPP@
147CPPFLAGS = @CPPFLAGS@
148CURL_CFLAGS = @CURL_CFLAGS@
149CURL_LIBS = @CURL_LIBS@
150CXX = @CXX@
151CXXCPP = @CXXCPP@
152CXXDEPMODE = @CXXDEPMODE@
153CXXFLAGS = @CXXFLAGS@
154CYGPATH_W = @CYGPATH_W@
155DEFS = @DEFS@
156DEPDIR = @DEPDIR@
157DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
158DIRECTFB_LIBS = @DIRECTFB_LIBS@
159DLLTOOL = @DLLTOOL@
160DSYMUTIL = @DSYMUTIL@
161DUMPBIN = @DUMPBIN@
162ECHO_C = @ECHO_C@
163ECHO_N = @ECHO_N@
164ECHO_T = @ECHO_T@
165ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
166ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
167EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
168EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
169EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
170EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
171EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
172EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
173EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
174EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
175EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
176EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
177EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
178EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
179EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
180EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
181EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
182EGREP = @EGREP@
183EINA_CFLAGS = @EINA_CFLAGS@
184EINA_LIBS = @EINA_LIBS@
185ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
186ESCAPE_LIBS = @ESCAPE_LIBS@
187EVAS_CFLAGS = @EVAS_CFLAGS@
188EVAS_LIBS = @EVAS_LIBS@
189EVIL_CFLAGS = @EVIL_CFLAGS@
190EVIL_LIBS = @EVIL_LIBS@
191EXEEXT = @EXEEXT@
192EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
193EXOTIC_LIBS = @EXOTIC_LIBS@
194FGREP = @FGREP@
195GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
196GLIB_CFLAGS = @GLIB_CFLAGS@
197GLIB_LIBS = @GLIB_LIBS@
198GMSGFMT = @GMSGFMT@
199GMSGFMT_015 = @GMSGFMT_015@
200GREP = @GREP@
201INSTALL = @INSTALL@
202INSTALL_DATA = @INSTALL_DATA@
203INSTALL_PROGRAM = @INSTALL_PROGRAM@
204INSTALL_SCRIPT = @INSTALL_SCRIPT@
205INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
206INTLLIBS = @INTLLIBS@
207INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
208KEYSYMDEFS = @KEYSYMDEFS@
209LD = @LD@
210LDFLAGS = @LDFLAGS@
211LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
212LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
213LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
214LIBICONV = @LIBICONV@
215LIBINTL = @LIBINTL@
216LIBOBJS = @LIBOBJS@
217LIBS = @LIBS@
218LIBTOOL = @LIBTOOL@
219LIPO = @LIPO@
220LN_S = @LN_S@
221LTLIBICONV = @LTLIBICONV@
222LTLIBINTL = @LTLIBINTL@
223LTLIBOBJS = @LTLIBOBJS@
224MAKEINFO = @MAKEINFO@
225MKDIR_P = @MKDIR_P@
226MSGFMT = @MSGFMT@
227MSGFMT_015 = @MSGFMT_015@
228MSGMERGE = @MSGMERGE@
229NM = @NM@
230NMEDIT = @NMEDIT@
231OBJC = @OBJC@
232OBJCDEPMODE = @OBJCDEPMODE@
233OBJCFLAGS = @OBJCFLAGS@
234OBJDUMP = @OBJDUMP@
235OBJEXT = @OBJEXT@
236OTOOL = @OTOOL@
237OTOOL64 = @OTOOL64@
238PACKAGE = @PACKAGE@
239PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
240PACKAGE_NAME = @PACKAGE_NAME@
241PACKAGE_STRING = @PACKAGE_STRING@
242PACKAGE_TARNAME = @PACKAGE_TARNAME@
243PACKAGE_URL = @PACKAGE_URL@
244PACKAGE_VERSION = @PACKAGE_VERSION@
245PATH_SEPARATOR = @PATH_SEPARATOR@
246PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
247PIXMAN_LIBS = @PIXMAN_LIBS@
248PKG_CONFIG = @PKG_CONFIG@
249PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
250PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
251POSUB = @POSUB@
252RANLIB = @RANLIB@
253SCIM_CFLAGS = @SCIM_CFLAGS@
254SCIM_LIBS = @SCIM_LIBS@
255SDL_CFLAGS = @SDL_CFLAGS@
256SDL_CONFIG = @SDL_CONFIG@
257SDL_LIBS = @SDL_LIBS@
258SED = @SED@
259SET_MAKE = @SET_MAKE@
260SHELL = @SHELL@
261SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
262SSL_CFLAGS = @SSL_CFLAGS@
263SSL_LIBS = @SSL_LIBS@
264STRIP = @STRIP@
265TLS2_CFLAGS = @TLS2_CFLAGS@
266TLS2_LIBS = @TLS2_LIBS@
267TLS_CFLAGS = @TLS_CFLAGS@
268TLS_LIBS = @TLS_LIBS@
269TSLIB_CFLAGS = @TSLIB_CFLAGS@
270TSLIB_LIBS = @TSLIB_LIBS@
271USE_NLS = @USE_NLS@
272VERSION = @VERSION@
273VMAJ = @VMAJ@
274WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
275WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
276WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
277WAYLAND_LIBS = @WAYLAND_LIBS@
278WIN32_CFLAGS = @WIN32_CFLAGS@
279WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
280WIN32_LIBS = @WIN32_LIBS@
281XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
282XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
283XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
284XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
285XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
286XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
287XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
288XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
289XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
290XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
291XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
292XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
293XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
294XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
295XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
296XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
297XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
298XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
299XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
300XCB_X11_LIBS = @XCB_X11_LIBS@
301XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
302XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
303XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
304XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
305XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
306XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
307XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
308XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
309XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
310XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
311XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
312XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
313XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
314XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
315XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
316XDAMAGE_LIBS = @XDAMAGE_LIBS@
317XDPMS_CFLAGS = @XDPMS_CFLAGS@
318XDPMS_LIBS = @XDPMS_LIBS@
319XFIXES_CFLAGS = @XFIXES_CFLAGS@
320XFIXES_LIBS = @XFIXES_LIBS@
321XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
322XGESTURE_LIBS = @XGESTURE_LIBS@
323XGETTEXT = @XGETTEXT@
324XGETTEXT_015 = @XGETTEXT_015@
325XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
326XI2_CFLAGS = @XI2_CFLAGS@
327XI2_LIBS = @XI2_LIBS@
328XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
329XINERAMA_LIBS = @XINERAMA_LIBS@
330XKB_CFLAGS = @XKB_CFLAGS@
331XKB_LIBS = @XKB_LIBS@
332XMKMF = @XMKMF@
333XPRINT_CFLAGS = @XPRINT_CFLAGS@
334XPRINT_LIBS = @XPRINT_LIBS@
335XRANDR_CFLAGS = @XRANDR_CFLAGS@
336XRANDR_LIBS = @XRANDR_LIBS@
337XRENDER_CFLAGS = @XRENDER_CFLAGS@
338XRENDER_LIBS = @XRENDER_LIBS@
339XSS_CFLAGS = @XSS_CFLAGS@
340XSS_LIBS = @XSS_LIBS@
341XTEST_CFLAGS = @XTEST_CFLAGS@
342XTEST_LIBS = @XTEST_LIBS@
343X_CFLAGS = @X_CFLAGS@
344X_EXTRA_LIBS = @X_EXTRA_LIBS@
345X_LIBS = @X_LIBS@
346X_PRE_LIBS = @X_PRE_LIBS@
347Xcursor_cflags = @Xcursor_cflags@
348Xcursor_libs = @Xcursor_libs@
349abs_builddir = @abs_builddir@
350abs_srcdir = @abs_srcdir@
351abs_top_builddir = @abs_top_builddir@
352abs_top_srcdir = @abs_top_srcdir@
353ac_ct_CC = @ac_ct_CC@
354ac_ct_CXX = @ac_ct_CXX@
355ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
356ac_ct_OBJC = @ac_ct_OBJC@
357am__include = @am__include@
358am__leading_dot = @am__leading_dot@
359am__quote = @am__quote@
360am__tar = @am__tar@
361am__untar = @am__untar@
362bindir = @bindir@
363build = @build@
364build_alias = @build_alias@
365build_cpu = @build_cpu@
366build_os = @build_os@
367build_vendor = @build_vendor@
368builddir = @builddir@
369cocoa_ldflags = @cocoa_ldflags@
370datadir = @datadir@
371datarootdir = @datarootdir@
372dlopen_libs = @dlopen_libs@
373docdir = @docdir@
374dvidir = @dvidir@
375ecore_cocoa_cflags = @ecore_cocoa_cflags@
376ecore_cocoa_libs = @ecore_cocoa_libs@
377ecore_con_cflags = @ecore_con_cflags@
378ecore_con_libs = @ecore_con_libs@
379ecore_directfb_cflags = @ecore_directfb_cflags@
380ecore_directfb_libs = @ecore_directfb_libs@
381ecore_evas_cflags = @ecore_evas_cflags@
382ecore_evas_libs = @ecore_evas_libs@
383ecore_fb_cflags = @ecore_fb_cflags@
384ecore_fb_libs = @ecore_fb_libs@
385ecore_file_cflags = @ecore_file_cflags@
386ecore_file_libs = @ecore_file_libs@
387ecore_imf_cflags = @ecore_imf_cflags@
388ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
389ecore_imf_evas_libs = @ecore_imf_evas_libs@
390ecore_imf_libs = @ecore_imf_libs@
391ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
392ecore_imf_scim_libs = @ecore_imf_scim_libs@
393ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
394ecore_imf_xim_libs = @ecore_imf_xim_libs@
395ecore_input_cflags = @ecore_input_cflags@
396ecore_input_evas_cflags = @ecore_input_evas_cflags@
397ecore_input_evas_libs = @ecore_input_evas_libs@
398ecore_input_libs = @ecore_input_libs@
399ecore_ipc_cflags = @ecore_ipc_cflags@
400ecore_ipc_libs = @ecore_ipc_libs@
401ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
402ecore_psl1ght_libs = @ecore_psl1ght_libs@
403ecore_sdl_cflags = @ecore_sdl_cflags@
404ecore_sdl_libs = @ecore_sdl_libs@
405ecore_wayland_cflags = @ecore_wayland_cflags@
406ecore_wayland_libs = @ecore_wayland_libs@
407ecore_win32_cflags = @ecore_win32_cflags@
408ecore_win32_libs = @ecore_win32_libs@
409ecore_wince_cflags = @ecore_wince_cflags@
410ecore_wince_libs = @ecore_wince_libs@
411ecore_x_cflags = @ecore_x_cflags@
412ecore_x_libs = @ecore_x_libs@
413ecore_x_libs_private = @ecore_x_libs_private@
414efl_doxygen = @efl_doxygen@
415efl_have_doxygen = @efl_have_doxygen@
416exec_prefix = @exec_prefix@
417have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
418host = @host@
419host_alias = @host_alias@
420host_cpu = @host_cpu@
421host_os = @host_os@
422host_vendor = @host_vendor@
423htmldir = @htmldir@
424includedir = @includedir@
425infodir = @infodir@
426install_sh = @install_sh@
427libdir = @libdir@
428libexecdir = @libexecdir@
429localedir = @localedir@
430localstatedir = @localstatedir@
431lt_ECHO = @lt_ECHO@
432lt_enable_auto_import = @lt_enable_auto_import@
433mandir = @mandir@
434mkdir_p = @mkdir_p@
435oldincludedir = @oldincludedir@
436pdfdir = @pdfdir@
437pkgconfig_requires_private = @pkgconfig_requires_private@
438prefix = @prefix@
439program_transform_name = @program_transform_name@
440psdir = @psdir@
441release_info = @release_info@
442requirements_ecore = @requirements_ecore@
443requirements_ecore_cocoa = @requirements_ecore_cocoa@
444requirements_ecore_con = @requirements_ecore_con@
445requirements_ecore_directfb = @requirements_ecore_directfb@
446requirements_ecore_evas = @requirements_ecore_evas@
447requirements_ecore_fb = @requirements_ecore_fb@
448requirements_ecore_file = @requirements_ecore_file@
449requirements_ecore_imf = @requirements_ecore_imf@
450requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
451requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
452requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
453requirements_ecore_input = @requirements_ecore_input@
454requirements_ecore_input_evas = @requirements_ecore_input_evas@
455requirements_ecore_ipc = @requirements_ecore_ipc@
456requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
457requirements_ecore_sdl = @requirements_ecore_sdl@
458requirements_ecore_wayland = @requirements_ecore_wayland@
459requirements_ecore_win32 = @requirements_ecore_win32@
460requirements_ecore_wince = @requirements_ecore_wince@
461requirements_ecore_x = @requirements_ecore_x@
462rt_libs = @rt_libs@
463sbindir = @sbindir@
464sharedstatedir = @sharedstatedir@
465srcdir = @srcdir@
466sysconfdir = @sysconfdir@
467target_alias = @target_alias@
468top_build_prefix = @top_build_prefix@
469top_builddir = @top_builddir@
470top_srcdir = @top_srcdir@
471version_info = @version_info@
472x_cflags = @x_cflags@
473x_includes = @x_includes@
474x_libs = @x_libs@
475MAINTAINERCLEANFILES = Makefile.in
476AM_CPPFLAGS = \
477-I$(top_srcdir)/src/lib/ecore \
478-I$(top_builddir)/src/lib/ecore \
479@DIRECTFB_CFLAGS@ @EINA_CFLAGS@
480
481lib_LTLIBRARIES = libecore_directfb.la
482includes_HEADERS = Ecore_DirectFB.h
483includesdir = $(includedir)/ecore-@VMAJ@
484libecore_directfb_la_SOURCES = \
485ecore_directfb.c \
486ecore_directfb_keys.h \
487ecore_directfb_private.h
488
489libecore_directfb_la_LIBADD = \
490$(top_builddir)/src/lib/ecore/libecore.la \
491@DIRECTFB_LIBS@ \
492@EINA_LIBS@
493
494libecore_directfb_la_LDFLAGS = -version-info @version_info@ @release_info@
495libecore_directfb_la_DEPENDENCIES = \
496$(top_builddir)/src/lib/ecore/libecore.la
497
498EXTRA_DIST = \
499Ecore_DirectFB.h \
500ecore_directfb.c \
501ecore_directfb_keys.h \
502ecore_directfb_private.h
503
504all: all-am
505
506.SUFFIXES:
507.SUFFIXES: .c .lo .o .obj
508$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
509 @for dep in $?; do \
510 case '$(am__configure_deps)' in \
511 *$$dep*) \
512 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
513 && { if test -f $@; then exit 0; else break; fi; }; \
514 exit 1;; \
515 esac; \
516 done; \
517 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_directfb/Makefile'; \
518 $(am__cd) $(top_srcdir) && \
519 $(AUTOMAKE) --gnu src/lib/ecore_directfb/Makefile
520.PRECIOUS: Makefile
521Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
522 @case '$?' in \
523 *config.status*) \
524 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
525 *) \
526 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
527 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
528 esac;
529
530$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
531 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
532
533$(top_srcdir)/configure: $(am__configure_deps)
534 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
535$(ACLOCAL_M4): $(am__aclocal_m4_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(am__aclocal_m4_deps):
538install-libLTLIBRARIES: $(lib_LTLIBRARIES)
539 @$(NORMAL_INSTALL)
540 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
541 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
542 list2=; for p in $$list; do \
543 if test -f $$p; then \
544 list2="$$list2 $$p"; \
545 else :; fi; \
546 done; \
547 test -z "$$list2" || { \
548 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
549 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
550 }
551
552uninstall-libLTLIBRARIES:
553 @$(NORMAL_UNINSTALL)
554 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
555 for p in $$list; do \
556 $(am__strip_dir) \
557 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
558 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
559 done
560
561clean-libLTLIBRARIES:
562 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
563 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
564 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
565 test "$$dir" != "$$p" || dir=.; \
566 echo "rm -f \"$${dir}/so_locations\""; \
567 rm -f "$${dir}/so_locations"; \
568 done
569libecore_directfb.la: $(libecore_directfb_la_OBJECTS) $(libecore_directfb_la_DEPENDENCIES)
570 $(AM_V_CCLD)$(libecore_directfb_la_LINK) -rpath $(libdir) $(libecore_directfb_la_OBJECTS) $(libecore_directfb_la_LIBADD) $(LIBS)
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_directfb.Plo@am__quote@
579
580.c.o:
581@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
582@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
583@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
584@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
585@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
586@am__fastdepCC_FALSE@ $(COMPILE) -c $<
587
588.c.obj:
589@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
590@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
591@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
592@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
594@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
595
596.c.lo:
597@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
598@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
599@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
601@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
602@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
603
604mostlyclean-libtool:
605 -rm -f *.lo
606
607clean-libtool:
608 -rm -rf .libs _libs
609install-includesHEADERS: $(includes_HEADERS)
610 @$(NORMAL_INSTALL)
611 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
612 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
613 for p in $$list; do \
614 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
615 echo "$$d$$p"; \
616 done | $(am__base_list) | \
617 while read files; do \
618 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
619 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
620 done
621
622uninstall-includesHEADERS:
623 @$(NORMAL_UNINSTALL)
624 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
625 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
626 test -n "$$files" || exit 0; \
627 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
628 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
629
630ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
631 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
632 unique=`for i in $$list; do \
633 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
634 done | \
635 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
636 END { if (nonempty) { for (i in files) print i; }; }'`; \
637 mkid -fID $$unique
638tags: TAGS
639
640TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
641 $(TAGS_FILES) $(LISP)
642 set x; \
643 here=`pwd`; \
644 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
645 unique=`for i in $$list; do \
646 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
647 done | \
648 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
649 END { if (nonempty) { for (i in files) print i; }; }'`; \
650 shift; \
651 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
652 test -n "$$unique" || unique=$$empty_fix; \
653 if test $$# -gt 0; then \
654 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
655 "$$@" $$unique; \
656 else \
657 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
658 $$unique; \
659 fi; \
660 fi
661ctags: CTAGS
662CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
663 $(TAGS_FILES) $(LISP)
664 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
665 unique=`for i in $$list; do \
666 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
667 done | \
668 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
669 END { if (nonempty) { for (i in files) print i; }; }'`; \
670 test -z "$(CTAGS_ARGS)$$unique" \
671 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
672 $$unique
673
674GTAGS:
675 here=`$(am__cd) $(top_builddir) && pwd` \
676 && $(am__cd) $(top_srcdir) \
677 && gtags -i $(GTAGS_ARGS) "$$here"
678
679distclean-tags:
680 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
681
682distdir: $(DISTFILES)
683 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
684 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
685 list='$(DISTFILES)'; \
686 dist_files=`for file in $$list; do echo $$file; done | \
687 sed -e "s|^$$srcdirstrip/||;t" \
688 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
689 case $$dist_files in \
690 */*) $(MKDIR_P) `echo "$$dist_files" | \
691 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
692 sort -u` ;; \
693 esac; \
694 for file in $$dist_files; do \
695 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
696 if test -d $$d/$$file; then \
697 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
698 if test -d "$(distdir)/$$file"; then \
699 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
700 fi; \
701 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
702 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
703 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
704 fi; \
705 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
706 else \
707 test -f "$(distdir)/$$file" \
708 || cp -p $$d/$$file "$(distdir)/$$file" \
709 || exit 1; \
710 fi; \
711 done
712check-am: all-am
713check: check-am
714all-am: Makefile $(LTLIBRARIES) $(HEADERS)
715installdirs:
716 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
717 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
718 done
719install: install-am
720install-exec: install-exec-am
721install-data: install-data-am
722uninstall: uninstall-am
723
724install-am: all-am
725 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
726
727installcheck: installcheck-am
728install-strip:
729 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
730 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
731 `test -z '$(STRIP)' || \
732 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
733mostlyclean-generic:
734
735clean-generic:
736
737distclean-generic:
738 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
739 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
740
741maintainer-clean-generic:
742 @echo "This command is intended for maintainers to use"
743 @echo "it deletes files that may require special tools to rebuild."
744 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
745clean: clean-am
746
747clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
748 mostlyclean-am
749
750distclean: distclean-am
751 -rm -rf ./$(DEPDIR)
752 -rm -f Makefile
753distclean-am: clean-am distclean-compile distclean-generic \
754 distclean-tags
755
756dvi: dvi-am
757
758dvi-am:
759
760html: html-am
761
762html-am:
763
764info: info-am
765
766info-am:
767
768install-data-am: install-includesHEADERS
769
770install-dvi: install-dvi-am
771
772install-dvi-am:
773
774install-exec-am: install-libLTLIBRARIES
775
776install-html: install-html-am
777
778install-html-am:
779
780install-info: install-info-am
781
782install-info-am:
783
784install-man:
785
786install-pdf: install-pdf-am
787
788install-pdf-am:
789
790install-ps: install-ps-am
791
792install-ps-am:
793
794installcheck-am:
795
796maintainer-clean: maintainer-clean-am
797 -rm -rf ./$(DEPDIR)
798 -rm -f Makefile
799maintainer-clean-am: distclean-am maintainer-clean-generic
800
801mostlyclean: mostlyclean-am
802
803mostlyclean-am: mostlyclean-compile mostlyclean-generic \
804 mostlyclean-libtool
805
806pdf: pdf-am
807
808pdf-am:
809
810ps: ps-am
811
812ps-am:
813
814uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
815
816.MAKE: install-am install-strip
817
818.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
819 clean-libLTLIBRARIES clean-libtool ctags distclean \
820 distclean-compile distclean-generic distclean-libtool \
821 distclean-tags distdir dvi dvi-am html html-am info info-am \
822 install install-am install-data install-data-am install-dvi \
823 install-dvi-am install-exec install-exec-am install-html \
824 install-html-am install-includesHEADERS install-info \
825 install-info-am install-libLTLIBRARIES install-man install-pdf \
826 install-pdf-am install-ps install-ps-am install-strip \
827 installcheck installcheck-am installdirs maintainer-clean \
828 maintainer-clean-generic mostlyclean mostlyclean-compile \
829 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
830 tags uninstall uninstall-am uninstall-includesHEADERS \
831 uninstall-libLTLIBRARIES
832
833
834# Tell versions [3.59,3.63) of GNU make to not export all variables.
835# Otherwise a system limit (for SysV at least) may be exceeded.
836.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c
deleted file mode 100644
index 7c56b5d..0000000
--- a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c
+++ /dev/null
@@ -1,757 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdio.h>
6#include <string.h>
7
8#include "Ecore_DirectFB.h"
9#include "ecore_directfb_private.h"
10#include "ecore_directfb_keys.h"
11#include "Ecore.h"
12#include "ecore_private.h"
13
14/* ecore_directfb */
15/******************/
16/* About */
17/* with this you can create windows of directfb and handle events through ecore
18 * TODO:
19 * - handle all event types
20 * -
21 * */
22int _ecore_directfb_log_dom = -1;
23
24static int _ecore_directfb_init_count = 0;
25
26static int _window_event_fd = 0;
27static int _input_event_fd = 0;
28
29static int _ecore_directfb_fullscreen_window_id = 0;
30static int _cursor_x = 0;
31static int _cursor_y = 0;
32
33EAPI int ECORE_DIRECTFB_EVENT_POSITION = 0;
34EAPI int ECORE_DIRECTFB_EVENT_SIZE = 0;
35EAPI int ECORE_DIRECTFB_EVENT_CLOSE = 0;
36EAPI int ECORE_DIRECTFB_EVENT_DESTROYED = 0;
37EAPI int ECORE_DIRECTFB_EVENT_GOT_FOCUS = 0;
38EAPI int ECORE_DIRECTFB_EVENT_LOST_FOCUS = 0;
39EAPI int ECORE_DIRECTFB_EVENT_KEY_DOWN = 0;
40EAPI int ECORE_DIRECTFB_EVENT_KEY_UP = 0;
41EAPI int ECORE_DIRECTFB_EVENT_BUTTON_DOWN = 0;
42EAPI int ECORE_DIRECTFB_EVENT_BUTTON_UP = 0;
43EAPI int ECORE_DIRECTFB_EVENT_MOTION = 0;
44EAPI int ECORE_DIRECTFB_EVENT_ENTER = 0;
45EAPI int ECORE_DIRECTFB_EVENT_LEAVE = 0;
46EAPI int ECORE_DIRECTFB_EVENT_WHEEL = 0;
47
48static Ecore_Fd_Handler *_window_event_fd_handler_handle = NULL;
49static Ecore_Fd_Handler *_input_event_fd_handler_handle = NULL;
50
51/* this hash is to store all the possible key names for fast lookup */
52static Eina_Hash *_ecore_directfb_key_symbols_hash = NULL;
53
54static IDirectFB *_dfb = NULL; // the main interface
55static IDirectFBEventBuffer *_window_event; // the main event buffer (all windows are attached to this)
56static IDirectFBEventBuffer *_input_event; // the main event buffer (all windows are attached to this)
57static IDirectFBDisplayLayer *_layer; // the main layer
58static DFBResult _err; // useful for DFBCHECK
59
60/*******************/
61/* local functions */
62/*******************/
63
64/* free ecore directfb events functions */
65/****************************************/
66
67static void
68_ecore_directfb_event_free_key_down(void *data __UNUSED__, void *ev)
69{
70 Ecore_DirectFB_Event_Key_Up *e;
71
72 e = ev;
73 if(e->name)
74 free(e->name);
75
76 if (e->string)
77 free(e->string);
78
79 if (e->key_compose)
80 free(e->key_compose);
81
82 free(e);
83}
84
85static void
86_ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev)
87{
88 Ecore_DirectFB_Event_Key_Up *e;
89
90 e = ev;
91 if(e->name)
92 free(e->name);
93
94 if (e->string)
95 free(e->string);
96
97 if (e->key_compose)
98 free(e->key_compose);
99
100 free(e);
101}
102
103/* directfb window input events handler */
104/****************************************/
105
106static void
107_ecore_directfb_event_handle_motion(DFBEvent *evt)
108{
109 Ecore_DirectFB_Event_Motion *e;
110 e = calloc(1, sizeof(Ecore_DirectFB_Event_Motion));
111
112 switch(evt->clazz)
113 {
114 case DFEC_INPUT:
115 e->modifiers = 0;
116 switch(evt->input.axis)
117 {
118 case DIAI_X:
119 e->x = _cursor_x = evt->input.axisabs;
120 e->y = _cursor_y;
121 break;
122
123 case DIAI_Y:
124 e->y = _cursor_y = evt->input.axisabs;
125 e->x = _cursor_x;
126 break;
127
128 case DIAI_Z:
129 //_ecore_directfb_event_handle_wheel(evt);
130 return;
131
132 default:
133 return;
134 }
135 e->win = _ecore_directfb_fullscreen_window_id;
136 e->time = 0;
137 break;
138
139 case DFEC_WINDOW:
140 e->modifiers = 0;
141 e->x = evt->window.x;
142 e->y = evt->window.y;
143 e->win = evt->window.window_id;
144 e->time = 0;
145 break;
146
147 default:
148 break;
149 }
150 ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL);
151}
152
153static void
154_ecore_directfb_event_handle_key_down(DFBEvent *evt)
155{
156 Ecore_DirectFB_Event_Key_Down *e;
157 unsigned int key_symbol;
158 struct keymap *k;
159
160 e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down));
161
162 switch(evt->clazz)
163 {
164 case DFEC_INPUT:
165 key_symbol = evt->input.key_symbol;
166 k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
167
168 if(!k)
169 {
170 ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol);
171 return;
172 }
173
174 e->name = strdup(k->name);
175 e->string = strdup(k->string);
176 e->key_compose = NULL;
177 e->win = _ecore_directfb_fullscreen_window_id;
178 e->time = 0;
179 break;
180
181 case DFEC_WINDOW:
182 key_symbol = evt->window.key_symbol;
183 k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
184
185 if(!k)
186 {
187 ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol);
188 return;
189 }
190
191 e->name = strdup(k->name);
192 e->string = strdup(k->string);
193 e->key_compose = NULL;
194 e->win = evt->window.window_id;
195 e->time = 0;
196 break;
197
198 default:
199 break;
200 }
201
202 ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL);
203}
204
205static void
206_ecore_directfb_event_handle_key_up(DFBEvent *evt)
207{
208 Ecore_DirectFB_Event_Key_Up *e;
209 unsigned int key_symbol;
210 struct keymap *k;
211
212 e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up));
213
214 switch(evt->clazz)
215 {
216 case DFEC_INPUT:
217 key_symbol = evt->input.key_symbol;
218 k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
219
220 if(!k)
221 {
222 ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol);
223 return;
224 }
225
226 e->name = strdup(k->name);
227 e->string = strdup(k->string);
228 e->key_compose = NULL;
229 e->win = _ecore_directfb_fullscreen_window_id;
230 e->time = 0;
231 break;
232
233 case DFEC_WINDOW:
234 key_symbol = evt->window.key_symbol;
235 k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
236
237 if(!k)
238 {
239 ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol);
240 return;
241 }
242
243 e->name = strdup(k->name);
244 e->string = strdup(k->string);
245 e->key_compose = NULL;
246 e->win = evt->window.window_id;
247 e->time = 0;
248 break;
249
250 default:
251 break;
252 }
253 ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL);
254}
255
256static void
257_ecore_directfb_event_handle_button_down(DFBEvent *evt)
258{
259 Ecore_DirectFB_Event_Button_Down *e;
260 e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Down));
261
262 switch(evt->clazz)
263 {
264 case DFEC_INPUT:
265 e->button = evt->input.button + 1;
266 e->modifiers = 0;
267 DFBCHECK(_layer->GetCursorPosition(_layer,&e->x,&e->y));
268 e->x = _cursor_x;
269 e->y = _cursor_y;
270 e->win = _ecore_directfb_fullscreen_window_id;
271 e->time = 0;
272
273 break;
274
275 case DFEC_WINDOW:
276 e->button = evt->window.button + 1;
277 e->modifiers = 0;
278 e->x = evt->window.x;
279 e->y = evt->window.y;
280 e->win = evt->window.window_id;
281 e->time = 0;
282 break;
283
284 default:
285 break;
286 }
287
288 ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL);
289}
290
291static void
292_ecore_directfb_event_handle_button_up(DFBEvent *evt)
293{
294 Ecore_DirectFB_Event_Button_Up *e;
295 e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Up));
296
297 switch(evt->clazz)
298 {
299 case DFEC_INPUT:
300 e->button = evt->input.button + 1;
301 e->modifiers = 0;
302 e->x = _cursor_x;
303 e->y = _cursor_y;
304 e->win = _ecore_directfb_fullscreen_window_id;
305 e->time = 0;
306
307 break;
308
309 case DFEC_WINDOW:
310 e->button = evt->window.button + 1;
311 e->modifiers = 0;
312 e->x = evt->window.x;
313 e->y = evt->window.y;
314 e->win = evt->window.window_id;
315 e->time = 0;
316 break;
317
318 default:
319 break;
320 }
321 ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL);
322}
323
324static void
325_ecore_directfb_event_handle_enter(DFBWindowEvent *evt)
326{
327 Ecore_DirectFB_Event_Enter *e;
328 e = calloc(1, sizeof(Ecore_DirectFB_Event_Enter));
329
330 e->modifiers = 0;
331 e->x = evt->x;
332 e->y = evt->y;
333 e->win = evt->window_id;
334 e->time = 0;
335
336 ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL);
337}
338
339static void
340_ecore_directfb_event_handle_leave(DFBWindowEvent *evt)
341{
342 Ecore_DirectFB_Event_Leave *e;
343 e = calloc(1, sizeof(Ecore_DirectFB_Event_Leave));
344
345 e->modifiers = 0;
346 e->x = evt->x;
347 e->y = evt->y;
348 e->win = evt->window_id;
349 e->time = 0;
350
351 ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL);
352}
353
354static void
355_ecore_directfb_event_handle_wheel(DFBWindowEvent *evt)
356{
357 Ecore_DirectFB_Event_Wheel *e;
358 e = calloc(1, sizeof(Ecore_DirectFB_Event_Wheel));
359
360 // currently there's no direction (only up/down);
361 e->direction = 0;
362 e->z = evt->step;
363 e->modifiers = 0;
364 e->win = evt->window_id;
365 e->time = 0;
366
367 ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL);
368}
369
370static void
371_ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt)
372{
373 Ecore_DirectFB_Event_Got_Focus *e;
374 e = calloc(1, sizeof(Ecore_DirectFB_Event_Got_Focus));
375
376 e->win = evt->window_id;
377 e->time = 0;
378
379 ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL);
380}
381
382static void
383_ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt)
384{
385 Ecore_DirectFB_Event_Lost_Focus *e;
386 e = calloc(1, sizeof(Ecore_DirectFB_Event_Lost_Focus));
387
388 e->win = evt->window_id;
389 e->time = 0;
390
391 ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL);
392}
393
394/* inputs and windows fds handlers */
395/***********************************/
396/* TODO fix this to handle windows and input events (fullscreen/window mode)
397 * in fullscreen theres no window_id so get the id from a global var (only one fullscreen
398 * window at a time */
399
400static Eina_Bool
401_ecore_directfb_input_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
402{
403 DFBEvent evt;
404 int v = 0;
405
406 v = read(_input_event_fd, &evt, sizeof(DFBEvent));
407 if (v < 0)
408 return EINA_TRUE;
409
410 if (v < 1)
411 return EINA_TRUE;
412
413 /* we are getting duplicate events, only parse if we are in fullscreen */
414 //if(_ecore_directfb_fullscreen_window_id == 0) break;
415 if(evt.input.type == DIET_KEYPRESS)
416 _ecore_directfb_event_handle_key_down(&evt);
417
418 if(evt.input.type == DIET_KEYRELEASE)
419 _ecore_directfb_event_handle_key_up(&evt);
420
421 if(evt.input.type == DIET_BUTTONPRESS)
422 _ecore_directfb_event_handle_button_down(&evt);
423
424 if(evt.input.type == DIET_BUTTONRELEASE)
425 _ecore_directfb_event_handle_button_up(&evt);
426
427 if(evt.input.type == DIET_AXISMOTION)
428 _ecore_directfb_event_handle_motion(&evt);
429
430 return EINA_TRUE;
431}
432
433static Eina_Bool
434_ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
435{
436 DFBEvent evt;
437 int v = 0;
438
439 v = read(_window_event_fd, &evt, sizeof(DFBEvent));
440 if (v < 0)
441 return EINA_TRUE;
442
443 if (v < 1)
444 return EINA_TRUE;
445
446 if(evt.window.type & DWET_POSITION)
447 INF("position");
448
449 if(evt.window.type & DWET_SIZE)
450 INF("size");
451
452 if(evt.window.type & DWET_CLOSE)
453 INF("close");
454
455 if(evt.window.type & DWET_DESTROYED)
456 INF("destroyed");
457
458 if(evt.window.type & DWET_GOTFOCUS)
459 _ecore_directfb_event_handle_got_focus(&evt.window);
460
461 if(evt.window.type & DWET_LOSTFOCUS)
462 _ecore_directfb_event_handle_lost_focus(&evt.window);
463
464 if(evt.window.type & DWET_KEYDOWN)
465 _ecore_directfb_event_handle_key_down(&evt);
466
467 if(evt.window.type & DWET_KEYUP)
468 _ecore_directfb_event_handle_key_up(&evt);
469
470 if(evt.window.type & DWET_BUTTONDOWN)
471 _ecore_directfb_event_handle_button_down(&evt);
472
473 if(evt.window.type & DWET_BUTTONUP)
474 _ecore_directfb_event_handle_button_up(&evt);
475
476 if(evt.window.type & DWET_MOTION)
477 _ecore_directfb_event_handle_motion(&evt);
478
479 if(evt.window.type & DWET_ENTER)
480 _ecore_directfb_event_handle_enter(&evt.window);
481
482 if(evt.window.type & DWET_LEAVE)
483 _ecore_directfb_event_handle_leave(&evt.window);
484
485 if(evt.window.type & DWET_WHEEL)
486 _ecore_directfb_event_handle_wheel(&evt.window);
487
488 return EINA_TRUE;
489}
490
491/* api functions */
492/*****************/
493
494EAPI IDirectFB *
495ecore_directfb_interface_get(void)
496{
497 return _dfb;
498}
499
500EAPI Ecore_DirectFB_Window *
501ecore_directfb_window_new(int x, int y, int w, int h)
502{
503 Ecore_DirectFB_Window *window;
504 IDirectFBWindow *dfb_window;
505 IDirectFBSurface *dfb_surface = NULL;
506 DFBWindowDescription desc;
507 DFBWindowID id;
508
509 memset(&desc, 0, sizeof(DFBWindowDescription));
510 desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS);
511 desc.posx = x;
512 desc.posy = y;
513 desc.width = w;
514 desc.height = h;
515 desc.caps = DWCAPS_ALPHACHANNEL;
516
517 DFBCHECK(_layer->CreateWindow(_layer, &desc, &dfb_window));
518
519 dfb_window->AttachEventBuffer(dfb_window, _window_event);
520 dfb_window->SetOptions(dfb_window,DWOP_NONE);
521 dfb_window->SetOpacity(dfb_window, 0xFF);
522
523 DFBCHECK(dfb_window->GetID(dfb_window, &id));
524 DFBCHECK(dfb_window->GetSurface(dfb_window,&dfb_surface));
525
526 window = malloc(sizeof(Ecore_DirectFB_Window));
527 window->id = id;
528 window->window = dfb_window;
529 window->surface = dfb_surface;
530 window->cursor = NULL;
531
532 return window;
533}
534
535EAPI void
536ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window)
537{
538 DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
539 DFBCHECK(ecore_window->window->Release(ecore_window->window));
540 free(ecore_window);
541}
542
543EAPI void
544ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y)
545{
546 DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y));
547}
548
549EAPI void
550ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h)
551{
552 DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h));
553}
554
555EAPI void
556ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window)
557{
558 DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window));
559}
560
561EAPI void
562ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window)
563{
564 DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0));
565}
566
567EAPI void
568ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window)
569{
570 DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF));
571}
572
573EAPI void
574ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool set)
575{
576 DFBWindowOptions opts;
577
578 DFBCHECK(ecore_window->window->GetOptions(ecore_window->window, &opts));
579 if(set)
580 {
581 opts |= DWOP_SHAPED;
582 opts |= DWOP_ALPHACHANNEL;
583 DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
584 }
585 else
586 {
587 opts &= ~DWOP_SHAPED;
588 opts &= ~DWOP_ALPHACHANNEL;
589 DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
590 }
591}
592
593EAPI void
594ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool show)
595{
596 if(!show)
597 {
598 /* create an empty cursor and set it */
599 IDirectFBSurface *cursor;
600 DFBSurfaceDescription desc;
601
602 memset(&desc, 0, sizeof(DFBSurfaceDescription));
603 desc.flags = (DSDESC_HEIGHT | DSDESC_WIDTH | DSDESC_PIXELFORMAT);
604 desc.width = 1;
605 desc.height = 1;
606 desc.pixelformat = DSPF_A1;
607
608 DFBCHECK(_dfb->CreateSurface(_dfb,&desc,&cursor));
609 DFBCHECK(cursor->Clear(cursor,0,0,0,0));
610 DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor, 0, 0));
611 }
612 else
613 {
614 /* we already have a cursor surface so set it*/
615 if(ecore_window->cursor)
616 {
617 DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, ecore_window->cursor->surface, ecore_window->cursor->hot_x, ecore_window->cursor->hot_y));
618 }
619 /* or just set the default directfb cursor */
620 else
621 {
622 DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
623 }
624 }
625}
626
627EAPI void
628ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor)
629{
630 if((!cursor) && (ecore_window->cursor))
631 {
632 ecore_window->cursor = NULL;
633 DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
634 return;
635 }
636
637 if(cursor)
638 {
639 ecore_window->cursor = cursor;
640 DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y));
641 }
642}
643
644EAPI void
645ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool on)
646{
647 // always release the surface (we are going to get a new one in both cases)
648 DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
649 if(on)
650 {
651 DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_EXCLUSIVE));
652 DFBCHECK(_layer->GetSurface(_layer,&ecore_window->surface));
653 DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event));
654 DFBCHECK(_input_event->CreateFileDescriptor(_input_event,&_input_event_fd));
655 /* the event of axismove sends one axis at a time, so we must store both */
656 DFBCHECK(_layer->GetCursorPosition(_layer,&_cursor_x,&_cursor_y));
657
658 _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);
659 _ecore_directfb_fullscreen_window_id = ecore_window->id;
660 }
661 else
662 {
663 ecore_main_fd_handler_del(_input_event_fd_handler_handle);
664 DFBCHECK(_input_event->Release(_input_event));
665 DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED));
666 DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface));
667 _ecore_directfb_fullscreen_window_id = 0;
668 }
669}
670
671EAPI void
672ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h)
673{
674 DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h));
675 return;
676}
677
678EAPI int
679ecore_directfb_init(const char *name __UNUSED__)
680{
681 int i = 0;
682
683 if (++_ecore_directfb_init_count != 1)
684 return _ecore_directfb_init_count;
685
686 _ecore_directfb_log_dom = eina_log_domain_register
687 ("ecore_directfb", ECORE_DIRECTFB_DEFAULT_LOG_COLOR);
688 if(_ecore_directfb_log_dom < 0)
689 {
690 EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module.");
691 return _ecore_directfb_init_count--;
692 }
693
694 DFBCHECK(DirectFBInit(NULL,NULL));
695 DFBCHECK(DirectFBCreate(&_dfb));
696
697 DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer));
698 DFBCHECK(_layer->SetCooperativeLevel(_layer, DLSCL_SHARED));
699
700 /* window events and fd */
701 DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event));
702 DFBCHECK(_window_event->CreateFileDescriptor(_window_event,&_window_event_fd));
703 _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);
704
705 /* register ecore directfb events */
706 ECORE_DIRECTFB_EVENT_POSITION = ecore_event_type_new();
707 ECORE_DIRECTFB_EVENT_SIZE = ecore_event_type_new();
708 ECORE_DIRECTFB_EVENT_CLOSE = ecore_event_type_new();
709 ECORE_DIRECTFB_EVENT_DESTROYED = ecore_event_type_new();
710 ECORE_DIRECTFB_EVENT_GOT_FOCUS = ecore_event_type_new();
711 ECORE_DIRECTFB_EVENT_LOST_FOCUS = ecore_event_type_new();
712 ECORE_DIRECTFB_EVENT_KEY_DOWN = ecore_event_type_new();
713 ECORE_DIRECTFB_EVENT_KEY_UP = ecore_event_type_new();
714 ECORE_DIRECTFB_EVENT_BUTTON_DOWN = ecore_event_type_new();
715 ECORE_DIRECTFB_EVENT_BUTTON_UP = ecore_event_type_new();
716 ECORE_DIRECTFB_EVENT_MOTION = ecore_event_type_new();
717 ECORE_DIRECTFB_EVENT_ENTER = ecore_event_type_new();
718 ECORE_DIRECTFB_EVENT_LEAVE = ecore_event_type_new();
719 ECORE_DIRECTFB_EVENT_WHEEL = ecore_event_type_new();
720
721 /* create the hash table for the keynames */
722 _ecore_directfb_key_symbols_hash = eina_hash_int32_new(free);
723 for(i = 0; i < _ecore_directfb_key_symbols_count; i++)
724 {
725 struct keymap *k;
726 k = malloc(sizeof(struct keymap));
727 k->name = _ecore_directfb_key_symbols[i].name;
728 k->string = _ecore_directfb_key_symbols[i].string;
729 eina_hash_add(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].id, k);
730 }
731 /* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */
732 return _ecore_directfb_init_count;
733}
734
735EAPI int
736ecore_directfb_shutdown(void)
737{
738 if (--_ecore_directfb_init_count != 0)
739 return _ecore_directfb_init_count;
740
741 ecore_main_fd_handler_del(_window_event_fd_handler_handle);
742 eina_hash_free(_ecore_directfb_key_symbols_hash);
743
744 if(_ecore_directfb_fullscreen_window_id)
745 {
746 DFBCHECK(_input_event->Release(_input_event));
747 ecore_main_fd_handler_del(_input_event_fd_handler_handle);
748 }
749
750 DFBCHECK(_window_event->Release(_window_event));
751 DFBCHECK(_layer->Release(_layer));
752 DFBCHECK(_dfb->Release(_dfb));
753 eina_log_domain_unregister(_ecore_directfb_log_dom);
754 _ecore_directfb_log_dom = -1;
755 return _ecore_directfb_init_count;
756}
757
diff --git a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h
deleted file mode 100644
index 19cca46..0000000
--- a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h
+++ /dev/null
@@ -1,184 +0,0 @@
1typedef struct _Ecore_DirectFB_Key_Symbols Ecore_DirectFB_Key_Symbols;
2struct _Ecore_DirectFB_Key_Symbols
3{
4 char *string;
5 char *name;
6 unsigned int id;
7};
8
9static const Ecore_DirectFB_Key_Symbols _ecore_directfb_key_symbols[] = {
10 {"\010", "BackSpace",DIKS_BACKSPACE},
11 {"\011", "Tab", DIKS_TAB},
12 {"\015", "Return", DIKS_RETURN},
13 {"", "Cancel", DIKS_CANCEL},
14 {"", "Escape", DIKS_ESCAPE},
15 {" ", "space", DIKS_SPACE},
16 {"!", "exclam", DIKS_EXCLAMATION_MARK},
17 {"\"", "quotedbl", DIKS_QUOTATION},
18 {"#", "numbersign", DIKS_NUMBER_SIGN},
19 {"$", "dollar", DIKS_DOLLAR_SIGN},
20 {"%", "percent", DIKS_PERCENT_SIGN},
21 {"&", "ampersand", DIKS_AMPERSAND},
22 {"'", "apostrophe", DIKS_APOSTROPHE},
23 {"(", "parenleft", DIKS_PARENTHESIS_LEFT},
24 {")", "parenright", DIKS_PARENTHESIS_RIGHT},
25 {"*", "asterisk", DIKS_ASTERISK},
26 {"+", "plus", DIKS_PLUS_SIGN},
27 {",", "comma", DIKS_COMMA},
28 {"-", "minus", DIKS_MINUS_SIGN},
29 {".", "period", DIKS_PERIOD},
30 {"/", "slash", DIKS_SLASH},
31 {"0", "0", DIKS_0},
32 {"1", "1", DIKS_1},
33 {"2", "2", DIKS_2},
34 {"3", "3", DIKS_3},
35 {"4", "4", DIKS_4},
36 {"5", "5", DIKS_5},
37 {"6", "6", DIKS_6},
38 {"7", "7", DIKS_7},
39 {"8", "8", DIKS_8},
40 {"9", "9", DIKS_9},
41 {":", "colon", DIKS_COLON},
42 {";", "semicolon", DIKS_SEMICOLON},
43 {"<", "less", DIKS_LESS_THAN_SIGN},
44 {"=", "equal", DIKS_EQUALS_SIGN},
45 {">", "greater", DIKS_GREATER_THAN_SIGN},
46 {"?", "question", DIKS_QUESTION_MARK},
47 {"@", "at", DIKS_AT},
48 {"A", "A", DIKS_CAPITAL_A },
49 {"B", "B", DIKS_CAPITAL_B },
50 {"C", "C", DIKS_CAPITAL_C },
51 {"D", "D", DIKS_CAPITAL_D },
52 {"E", "E", DIKS_CAPITAL_E },
53 {"F", "F", DIKS_CAPITAL_F },
54 {"G", "G", DIKS_CAPITAL_G },
55 {"H", "H", DIKS_CAPITAL_H },
56 {"I", "I", DIKS_CAPITAL_I },
57 {"J", "J", DIKS_CAPITAL_J },
58 {"K", "K", DIKS_CAPITAL_K },
59 {"L", "L", DIKS_CAPITAL_L },
60 {"M", "M", DIKS_CAPITAL_M },
61 {"N", "N", DIKS_CAPITAL_N },
62 {"O", "O", DIKS_CAPITAL_O },
63 {"P", "P", DIKS_CAPITAL_P },
64 {"Q", "Q", DIKS_CAPITAL_Q },
65 {"R", "R", DIKS_CAPITAL_R },
66 {"S", "S", DIKS_CAPITAL_S },
67 {"T", "T", DIKS_CAPITAL_T },
68 {"U", "U", DIKS_CAPITAL_U },
69 {"V", "V", DIKS_CAPITAL_V },
70 {"W", "W", DIKS_CAPITAL_W },
71 {"X", "X", DIKS_CAPITAL_X },
72 {"Y", "Y", DIKS_CAPITAL_Y },
73 {"Z", "Z", DIKS_CAPITAL_Z },
74 {"[", "bracketleft", DIKS_SQUARE_BRACKET_LEFT },
75 {"\\", "backslash", DIKS_BACKSLASH },
76 {"]", "bracketright", DIKS_SQUARE_BRACKET_RIGHT },
77 {"^", "asciicircum", DIKS_CIRCUMFLEX_ACCENT },
78 {"_", "underscore", DIKS_UNDERSCORE },
79 {"`", "grave", DIKS_GRAVE_ACCENT},
80 {"a", "a", DIKS_SMALL_A },
81 {"b","b", DIKS_SMALL_B },
82 {"c","c", DIKS_SMALL_C },
83 {"d","d", DIKS_SMALL_D },
84 {"e","e", DIKS_SMALL_E },
85 {"f","f", DIKS_SMALL_F },
86 {"g","g", DIKS_SMALL_G },
87 {"h","h", DIKS_SMALL_H },
88 {"i","i", DIKS_SMALL_I },
89 {"j","j", DIKS_SMALL_J },
90 {"k","k", DIKS_SMALL_K },
91 {"l","l", DIKS_SMALL_L },
92 {"m","m", DIKS_SMALL_M },
93 {"n","n", DIKS_SMALL_N },
94 {"o", "o", DIKS_SMALL_O },
95 {"p", "p", DIKS_SMALL_P },
96 {"q", "q", DIKS_SMALL_Q },
97 {"r", "r", DIKS_SMALL_R },
98 {"s", "s", DIKS_SMALL_S },
99 {"t", "t", DIKS_SMALL_T },
100 {"u", "u", DIKS_SMALL_U },
101 {"v", "v", DIKS_SMALL_V },
102 {"w", "w", DIKS_SMALL_W },
103 {"x", "x", DIKS_SMALL_X },
104 {"y", "y", DIKS_SMALL_Y },
105 {"z", "z", DIKS_SMALL_Z },
106 {"{", "braceleft",DIKS_CURLY_BRACKET_LEFT },
107 {"|", "bar", DIKS_VERTICAL_BAR },
108 {"}", "braceright", DIKS_CURLY_BRACKET_RIGHT },
109 {"~", "asciitilde", DIKS_TILDE },
110 {"\177", "Delete", DIKS_DELETE },
111 {"", "Left", DIKS_CURSOR_LEFT },
112 {"", "Right", DIKS_CURSOR_RIGHT},
113 {"", "Up", DIKS_CURSOR_UP},
114 {"", "Down", DIKS_CURSOR_DOWN},
115 {"", "Insert", DIKS_INSERT},
116 {"", "Home", DIKS_HOME},
117 {"", "End", DIKS_END},
118 {"", "Page_Up", DIKS_PAGE_UP},
119 {"", "Page_Down", DIKS_PAGE_DOWN},
120 {"", "Print", DIKS_PRINT},
121 {"", "Pause", DIKS_PAUSE},
122 /* ok */
123 {"", "Select",DIKS_SELECT},
124 /* goto */
125 {"", "Clear", DIKS_CLEAR},
126 /* power */
127 /* power 2 */
128 /* option */
129 {"", "Menu",DIKS_MENU},
130 {"", "Help",DIKS_HELP},
131 /* info */
132 /* time */
133 /* vendor */
134 /* archive */
135 /* program */
136 /* channel */
137 /* favorites */
138 /* hasta next */
139 {"", "Next",DIKS_NEXT},
140 {"", "Begin",DIKS_BEGIN},
141 /* digits */
142 /* teen */
143 /* twen */
144 {"", "Break", DIKS_BREAK},
145 /* exit */
146 /* setup */
147 {"", "upleftcorner", DIKS_CURSOR_LEFT_UP },
148 {"", "lowleftcorner", DIKS_CURSOR_LEFT_DOWN },
149 {"", "uprightcorner", DIKS_CURSOR_UP_RIGHT },
150 {"", "lowrightcorner",DIKS_CURSOR_DOWN_RIGHT },
151 {"", "F1",DIKS_F1},
152 {"", "F2",DIKS_F2},
153 {"", "F3",DIKS_F3},
154 {"", "F4",DIKS_F4},
155 {"", "F5",DIKS_F5},
156 {"", "F6",DIKS_F6},
157 {"", "F7",DIKS_F7},
158 {"", "F8",DIKS_F8},
159 {"", "F9",DIKS_F9},
160 {"", "F10",DIKS_F10},
161 {"", "F11",DIKS_F11},
162 {"", "F12",DIKS_F12},
163 /* this are only mapped to one, not left right */
164 {"", "Shift_L", DIKS_SHIFT},
165 /*{"Shift_R",0xFFE2},*/
166 {"", "Control_L", DIKS_CONTROL},
167 /*{"Control_R",0xFFE4},*/
168 {"", "Meta_L", DIKS_META},
169 /* {"Meta_R",0xFFE8},*/
170 {"", "Alt_L", DIKS_ALT},
171 {"", "Alt_R", DIKS_ALTGR},
172 {"", "Super_L", DIKS_SUPER},
173 /*{"Super_R",0xFFEC},*/
174 {"", "Hyper_L", DIKS_HYPER},
175 /*{"Hyper_R",0xFFEE},*/
176
177 {"", "Caps_Lock", DIKS_CAPS_LOCK},
178 {"", "Num_Lock", DIKS_NUM_LOCK},
179 {"", "Scroll_Lock", DIKS_SCROLL_LOCK},
180 /* not included the dead keys */
181 /* not included the custom keys */
182 {"", "VoidSymbol", DIKS_NULL}
183};
184static 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
deleted file mode 100644
index ed34587..0000000
--- a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_private.h
+++ /dev/null
@@ -1,52 +0,0 @@
1#ifndef _ECORE_DIRECTFB_PRIVATE_H
2#define _ECORE_DIRECTFB_PRIVATE_H
3/* eina_log related things */
4
5extern int _ecore_directfb_log_dom;
6
7#ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR
8#undef ECORE_DIRECTFB_DEFAULT_LOG_COLOR
9#endif /* ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR */
10#define ECORE_DIRECTFB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
11
12#ifdef ERR
13# undef ERR
14#endif /* ifdef ERR */
15#define ERR(...) EINA_LOG_DOM_ERR(_ecore_directfb_log_dom, __VA_ARGS__)
16
17#ifdef DBG
18# undef DBG
19#endif /* ifdef DBG */
20#define DBG(...) EINA_LOG_DOM_DBG(_ecore_directfb_log_dom, __VA_ARGS__)
21
22#ifdef INF
23# undef INF
24#endif /* ifdef INF */
25#define INF(...) EINA_LOG_DOM_INFO(_ecore_directfb_log_dom, __VA_ARGS__)
26
27#ifdef WRN
28# undef WRN
29#endif /* ifdef WRN */
30#define WRN(...) EINA_LOG_DOM_WARN(_ecore_directfb_log_dom, __VA_ARGS__)
31
32#ifdef CRIT
33# undef CRIT
34#endif /* ifdef CRIT */
35#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_directfb_log_dom, __VA_ARGS__)
36
37/* macro for a safe call to DirectFB functions */
38#define DFBCHECK(x ...)\
39 {\
40 _err = x;\
41 if (_err != DFB_OK) {\
42 CRIT("%s <%d>:\n\t", __FILE__, __LINE__ );\
43 DirectFBErrorFatal( # x, _err );\
44 }\
45 }
46
47struct keymap
48{
49 char *name;
50 char *string;
51};
52#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
deleted file mode 100644
index a78824e..0000000
--- a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h
+++ /dev/null
@@ -1,2079 +0,0 @@
1#ifndef _ECORE_EVAS_H
2#define _ECORE_EVAS_H
3
4#include <Evas.h>
5#include <Ecore_Getopt.h>
6#include <Ecore_Input.h>
7
8#ifdef EAPI
9# undef EAPI
10#endif
11
12#ifdef _WIN32
13# ifdef EFL_ECORE_EVAS_BUILD
14# ifdef DLL_EXPORT
15# define EAPI __declspec(dllexport)
16# else
17# define EAPI
18# endif /* ! DLL_EXPORT */
19# else
20# define EAPI __declspec(dllimport)
21# endif /* ! EFL_ECORE_EVAS_BUILD */
22#else
23# ifdef __GNUC__
24# if __GNUC__ >= 4
25# define EAPI __attribute__ ((visibility("default")))
26# else
27# define EAPI
28# endif
29# else
30# define EAPI
31# endif
32#endif /* ! _WIN32 */
33
34/**
35 * @file Ecore_Evas.h
36 * @brief Evas wrapper functions
37 *
38 * The following is a list of example that partially exemplify Ecore_Evas's API:
39 * @li @ref ecore_evas_callbacks_example_c
40 * @li @ref ecore_evas_object_example_c
41 * @li @ref ecore_evas_basics_example_c
42 * @li @ref Ecore_Evas_Window_Sizes_Example_c
43 * @li @ref Ecore_Evas_Buffer_Example_01_c
44 * @li @ref Ecore_Evas_Buffer_Example_02_c
45 */
46
47/* FIXME:
48 * to do soon:
49 * - iconfication api needs to work
50 * - maximization api needs to work
51 * - document all calls
52 *
53 * later:
54 * - buffer back-end that renders to an evas_image_object ???
55 * - qt back-end ???
56 * - dfb back-end ??? (dfb's threads make this REALLY HARD)
57 */
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63/**
64 * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions
65 *
66 * Ecore evas is a set of functions that makes it easy to tie together ecore's
67 * main loop and input handling to evas. As such it's a natural base for EFL
68 * applications. While this combination makes it easy to create the basic
69 * aspects all applications need, for normal applications(ones with buttons,
70 * checkboxes and layouts) one should consider using Elementary.
71 *
72 * Ecore evas is extremely well suited for applications that are not based on
73 * widgets. It has a main loop that delivers events, does basic window handling
74 * and leaves all of the drawing up to the user. This works very well if used
75 * in conjunction with Edje or if doing custom drawing as, for example, is done
76 * in games.
77 *
78 * This is a list of examples of these functions:
79 * @li @ref ecore_evas_basics_example_c
80 * @li @ref ecore_evas_object_example_c
81 * @li @ref ecore_evas_callbacks_example_c
82 * @li @ref Ecore_Evas_Window_Sizes_Example_c
83 * @li @ref Ecore_Evas_Buffer_Example_01_c
84 * @li @ref Ecore_Evas_Buffer_Example_02_c
85 *
86 * @{
87 */
88
89/* these are dummy and just tell u what API levels ecore_evas supports - not if
90 * the actual support is compiled in. you need to query for that separately.
91 */
92#define HAVE_ECORE_EVAS_X 1
93#define HAVE_ECORE_EVAS_FB 1
94#define HAVE_ECORE_EVAS_X11_GL 1
95#define HAVE_ECORE_EVAS_X11_16 1
96#define HAVE_ECORE_EVAS_DIRECTFB 1
97#define HAVE_ECORE_EVAS_WIN32 1
98#define HAVE_ECORE_EVAS_COCOA 1
99#define HAVE_ECORE_EVAS_SDL 1
100#define HAVE_ECORE_EVAS_WINCE 1
101#define HAVE_ECORE_EVAS_EWS 1
102#define HAVE_ECORE_EVAS_PSL1GHT 1
103#define HAVE_ECORE_EVAS_WAYLAND_SHM 1
104#define HAVE_ECORE_EVAS_WAYLAND_EGL 1
105
106typedef enum _Ecore_Evas_Engine_Type
107{
108 ECORE_EVAS_ENGINE_SOFTWARE_BUFFER,
109 ECORE_EVAS_ENGINE_SOFTWARE_XLIB,
110 ECORE_EVAS_ENGINE_XRENDER_X11,
111 ECORE_EVAS_ENGINE_OPENGL_X11,
112 ECORE_EVAS_ENGINE_SOFTWARE_XCB,
113 ECORE_EVAS_ENGINE_XRENDER_XCB,
114 ECORE_EVAS_ENGINE_SOFTWARE_GDI,
115 ECORE_EVAS_ENGINE_SOFTWARE_DDRAW,
116 ECORE_EVAS_ENGINE_DIRECT3D,
117 ECORE_EVAS_ENGINE_OPENGL_GLEW,
118 ECORE_EVAS_ENGINE_OPENGL_COCOA,
119 ECORE_EVAS_ENGINE_SOFTWARE_SDL,
120 ECORE_EVAS_ENGINE_DIRECTFB,
121 ECORE_EVAS_ENGINE_SOFTWARE_FB,
122 ECORE_EVAS_ENGINE_SOFTWARE_8_X11,
123 ECORE_EVAS_ENGINE_SOFTWARE_16_X11,
124 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
125 ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
126 ECORE_EVAS_ENGINE_OPENGL_SDL,
127 ECORE_EVAS_ENGINE_EWS,
128 ECORE_EVAS_ENGINE_PSL1GHT,
129 ECORE_EVAS_ENGINE_WAYLAND_SHM,
130 ECORE_EVAS_ENGINE_WAYLAND_EGL
131} Ecore_Evas_Engine_Type;
132
133typedef enum _Ecore_Evas_Avoid_Damage_Type
134{
135 ECORE_EVAS_AVOID_DAMAGE_NONE = 0,
136 ECORE_EVAS_AVOID_DAMAGE_EXPOSE = 1,
137 ECORE_EVAS_AVOID_DAMAGE_BUILT_IN = 2
138} Ecore_Evas_Avoid_Damage_Type;
139
140typedef enum _Ecore_Evas_Object_Associate_Flags
141{
142 ECORE_EVAS_OBJECT_ASSOCIATE_BASE = 0,
143 ECORE_EVAS_OBJECT_ASSOCIATE_STACK = 1 << 0,
144 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER = 1 << 1,
145 ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2
146} Ecore_Evas_Object_Associate_Flags;
147
148#ifndef _ECORE_X_H
149#define _ECORE_X_WINDOW_PREDEF
150typedef unsigned int Ecore_X_Window;
151#endif
152
153#ifndef _ECORE_DIRECTFB_H
154#define _ECORE_DIRECTFB_WINDOW_PREDEF
155typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
156#endif
157
158#ifndef __ECORE_WIN32_H__
159typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
160#endif
161
162#ifndef __ECORE_WINCE_H__
163typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
164#endif
165
166#ifndef __ECORE_COCOA_H__
167typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
168#endif
169
170#ifndef _ECORE_EVAS_PRIVATE_H
171/* basic data types */
172typedef struct _Ecore_Evas Ecore_Evas;
173typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
174#endif
175
176#ifndef _ECORE_WAYLAND_H_
177#define _ECORE_WAYLAND_WINDOW_PREDEF
178typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
179#endif
180
181/* module setup/shutdown calls */
182
183EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);
184
185/**
186 * @brief Init the Ecore_Evas system.
187 *
188 * @return How many times the lib has been initialized, 0 indicates failure.
189 *
190 * Set up the Evas wrapper system. Init Evas and Ecore libraries.
191 *
192 * @see ecore_evas_shutdown()
193 */
194EAPI int ecore_evas_init(void);
195/**
196 * @brief Shut down the Ecore_Evas system.
197 *
198 * @return 0 if ecore evas is fully shut down, or > 0 if it still being used.
199 *
200 * This closes the Evas wrapper system down. Shut down Evas and Ecore libraries.
201 *
202 * @see ecore_evas_init()
203 */
204EAPI int ecore_evas_shutdown(void);
205
206EAPI void ecore_evas_app_comp_sync_set(Eina_Bool do_sync);
207EAPI Eina_Bool ecore_evas_app_comp_sync_get(void);
208
209/**
210 * @brief Returns a list of supported engines names.
211 *
212 * @return Newly allocated list with engines names. Engines names
213 * strings are internal and should be considered constants, do not
214 * free or modify them, to free the list use ecore_evas_engines_free().
215 */
216EAPI Eina_List *ecore_evas_engines_get(void);
217/**
218 * @brief Free list returned by ecore_evas_engines_get()
219 */
220EAPI void ecore_evas_engines_free(Eina_List *engines);
221/**
222 * @brief Creates a new Ecore_Evas based on engine name and common parameters.
223 *
224 * @param engine_name engine name as returned by
225 * ecore_evas_engines_get() or NULL to use environment variable
226 * ECORE_EVAS_ENGINE, that can be undefined and in this case
227 * this call will try to find the first working engine.
228 * @param x horizontal position of window (not supported in all engines)
229 * @param y vertical position of window (not supported in all engines)
230 * @param w width of window
231 * @param h height of window
232 * @param extra_options string with extra parameter, dependent on engines
233 * or NULL. String is usually in the form: 'key1=value1;key2=value2'.
234 * Pay attention that when getting that from shell commands, most
235 * consider ';' as the command terminator, so you need to escape
236 * it or use quotes.
237 *
238 * @return Ecore_Evas instance or NULL if creation failed.
239 */
240EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options);
241/**
242 * @brief Set whether an Ecore_Evas has an alpha channel or not.
243 *
244 * @param ee The Ecore_Evas to shape
245 * @param alpha EINA_TRUE to enable the alpha channel, EINA_FALSE to disable it
246 *
247 * This function allows you to make an Ecore_Evas translucent using an
248 * alpha channel. See ecore_evas_shaped_set() for details. The difference
249 * between a shaped window and a window with an alpha channel is that an
250 * alpha channel supports multiple levels of transparency, as opposed to
251 * the 1 bit transparency of a shaped window (a pixel is either opaque, or
252 * it's transparent).
253 *
254 * @warning Support for this depends on the underlying windowing system.
255 */
256EAPI void ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha);
257/**
258 * @brief Query whether an Ecore_Evas has an alpha channel.
259 * @param ee The Ecore_Evas to query.
260 * @return EINA_TRUE if ee has an alpha channel, EINA_FALSE if it does not.
261 *
262 * This function returns EINA_TRUE if @p ee has an alpha channel, and EINA_FALSE
263 * if it does not.
264 *
265 * @see ecore_evas_alpha_set()
266 */
267EAPI Eina_Bool ecore_evas_alpha_get(const Ecore_Evas *ee);
268/**
269 * @brief Set whether an Ecore_Evas has an transparent window or not.
270 *
271 * @param ee The Ecore_Evas to shape
272 * @param transparent EINA_TRUE to enable the transparent window, EINA_FALSE to
273 * disable it
274 *
275 * This function sets some translucency options, for more complete support see
276 * ecore_evas_alpha_set().
277 *
278 * @warning Support for this depends on the underlying windowing system.
279 *
280 * @see ecore_evas_alpha_set()
281 */
282EAPI void ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent);
283/**
284 * @brief Query whether an Ecore_Evas is transparent.
285 *
286 * @param ee The Ecore_Evas to query.
287 * @return EINA_TRUE if ee is transparent, EINA_FALSE if it isn't.
288 *
289 * @see ecore_evas_transparent_set()
290 */
291EAPI Eina_Bool ecore_evas_transparent_get(const Ecore_Evas *ee);
292/**
293 * @brief Get the geometry of an Ecore_Evas.
294 *
295 * @param ee The Ecore_Evas whose geometry y
296 * @param x A pointer to an int to place the x coordinate in
297 * @param y A pointer to an int to place the y coordinate in
298 * @param w A pointer to an int to place the w size in
299 * @param h A pointer to an int to place the h size in
300 *
301 * This function takes four pointers to (already allocated) ints, and places
302 * the geometry of @p ee in them. If any of the parameters is not desired you
303 * may pass NULL on them.
304 *
305 * @code
306 * int x, y, w, h;
307 * ecore_evas_geometry_get(ee, &x, &y, &w, &h);
308 * @endcode
309 *
310 * @see ecore_evas_new()
311 * @see ecore_evas_resize()
312 * @see ecore_evas_move()
313 * @see ecore_evas_move_resize()
314 */
315EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
316/**
317 * @brief Get the geometry which an Ecore_Evas was latest recently requested.
318 *
319 * @param ee The Ecore_Evas whose geometry y
320 * @param x A pointer to an int to place the x coordinate in
321 * @param y A pointer to an int to place the y coordinate in
322 * @param w A pointer to an int to place the w size in
323 * @param h A pointer to an int to place the h size in
324 *
325 * This function takes four pointers to (already allocated) ints, and places
326 * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you
327 * may pass NULL on them.
328 * This function can represent recently requested geometry.
329 * ecore_evas_geometry_get function returns the value is updated after engine finished request.
330 * By comparison, ecore_evas_request_geometry_get returns recently requested value.
331 *
332 * @code
333 * int x, y, w, h;
334 * ecore_evas_request_geometry_get(ee, &x, &y, &w, &h);
335 * @endcode
336 *
337 * @since 1.1
338 */
339EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
340/**
341 * @brief Set the focus of an Ecore_Evas' window.
342 *
343 * @param ee The Ecore_Evas
344 * @param on EINA_TRUE for focus, EINA_FALSE to defocus.
345 *
346 * This function focuses @p ee if @p on is EINA_TRUE, or unfocuses @p ee if @p
347 * on is EINA_FALSE.
348 *
349 * @warning Support for this depends on the underlying windowing system.
350 */
351EAPI void ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on);
352/**
353 * @brief Query whether an Ecore_Evas' window is focused or not.
354 *
355 * @param ee The Ecore_Evas to set
356 * @return EINA_TRUE if @p ee if focused, EINA_FALSE if not.
357 *
358 * @see ecore_evas_focus_set()
359 */
360EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee);
361/**
362 * @brief Iconify or uniconify an Ecore_Evas' window.
363 *
364 * @param ee The Ecore_Evas
365 * @param on EINA_TRUE to iconify, EINA_FALSE to uniconify.
366 *
367 * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if
368 * @p on is EINA_FALSE.
369 *
370 * @note Iconify and minimize are synonyms.
371 *
372 * @warning Support for this depends on the underlying windowing system.
373 */
374EAPI void ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on);
375/**
376 * @brief Query whether an Ecore_Evas' window is iconified or not.
377 *
378 * @param ee The Ecore_Evas to set
379 * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not.
380 *
381 * @note Iconify and minimize are synonyms.
382 *
383 * @see ecore_evas_iconified_set()
384 */
385EAPI Eina_Bool ecore_evas_iconified_get(const Ecore_Evas *ee);
386/**
387 * @brief Set whether an Ecore_Evas' window is borderless or not.
388 *
389 * @param ee The Ecore_Evas
390 * @param on EINA_TRUE for borderless, EINA_FALSE for bordered.
391 *
392 * This function makes @p ee borderless if @p on is EINA_TRUE, or bordered if @p
393 * on is EINA_FALSE.
394 *
395 * @warning Support for this depends on the underlying windowing system.
396 */
397EAPI void ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on);
398/**
399 * @brief Query whether an Ecore_Evas' window is borderless or not.
400 *
401 * @param ee The Ecore_Evas to set
402 * @return EINA_TRUE if @p ee is borderless, EINA_FALSE if not.
403 *
404 * @see ecore_evas_borderless_set()
405 */
406EAPI Eina_Bool ecore_evas_borderless_get(const Ecore_Evas *ee);
407/**
408 * @brief Set whether or not an Ecore_Evas' window is fullscreen.
409 *
410 * @param ee The Ecore_Evas
411 * @param on EINA_TRUE fullscreen, EINA_FALSE not.
412 *
413 * This function causes @p ee to be fullscreen if @p on is EINA_TRUE,
414 * or not if @p on is EINA_FALSE.
415 *
416 * @warning Support for this depends on the underlying windowing system.
417 */
418EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on);
419/**
420 * @brief Query whether an Ecore_Evas' window is fullscreen or not.
421 *
422 * @param ee The Ecore_Evas to set
423 * @return EINA_TRUE if @p ee is fullscreen, EINA_FALSE if not.
424 *
425 * @see ecore_evas_fullscreen_set()
426 */
427EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee);
428/**
429 * @brief Set another window that this window is a group member of
430 *
431 * @param ee The Ecore_Evas
432 * @param ee_group The other group member
433 *
434 * If @p ee_group is NULL, @p ee is removed from the group, otherwise it is
435 * added. Note that if you free the @p ee_group canvas before @p ee, then
436 * getting the group canvas with ecore_evas_window_group_get() will return
437 * an invalid handle.
438 *
439 * @warning Support for this depends on the underlying windowing system.
440 * @since 1.2
441 */
442EAPI void ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group);
443/**
444 * @brief Get the canvas group set.
445 *
446 * This returns the handle set by ecore_evas_window_group_set().
447 *
448 * @param ee The Ecore_Evas to set
449 * @return The Canvas group handle
450 *
451 * @see ecore_evas_window_group_set()
452 * @since 1.2
453 */
454EAPI const Ecore_Evas *ecore_evas_window_group_get(const Ecore_Evas *ee);
455/**
456 * @brief Set the aspect ratio of a canvas window
457 *
458 * @param ee The Ecore_Evas
459 * @param aspect The aspect ratio (width divided by height), or 0 to disable
460 *
461 * This sets the desired aspect ratio of a canvas window
462 *
463 * @warning Support for this depends on the underlying windowing system.
464 * @since 1.2
465 */
466EAPI void ecore_evas_aspect_set(Ecore_Evas *ee, double aspect);
467/**
468 * @brief Get the aspect ratio of a canvas window
469 *
470 * This returns the value set by ecore_evas_aspect_set().
471 *
472 * @param ee The Ecore_Evas to set
473 * @return The aspect ratio
474 *
475 * @see ecore_evas_aspect_set()
476 * @since 1.2
477 */
478EAPI double ecore_evas_aspect_get(const Ecore_Evas *ee);
479/**
480 * @brief Set The urgent hint flag
481 *
482 * @param ee The Ecore_Evas
483 * @param urgent The urgent state flag
484 *
485 * This sets the "urgent" state hint on a window so the desktop environment
486 * can highlight it somehow.
487 *
488 * @warning Support for this depends on the underlying windowing system.
489 * @since 1.2
490 */
491EAPI void ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent);
492/**
493 * @brief Get the urgent state on the cavas window
494 *
495 * This returns the value set by ecore_evas_urgent_set()
496 *
497 * @param ee The Ecore_Evas to set
498 * @return The urgent state set
499 *
500 * @see ecore_evas_urgent_set()
501 * @since 1.2
502 */
503EAPI Eina_Bool ecore_evas_urgent_get(const Ecore_Evas *ee);
504/**
505 * @brief Set the modal state flag on the canvas window
506 *
507 * @param ee The Ecore_Evas
508 * @param modal The modal hint flag
509 *
510 * This hints if the window should be modal (eg if it is also transient
511 * for another window, the other window will maybe be denied focus by
512 * the desktop window manager).
513 *
514 * @warning Support for this depends on the underlying windowing system.
515 * @since 1.2
516 */
517EAPI void ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal);
518/**
519 * @brief Get The modal flag
520 *
521 * This returns the value set by ecore_evas_modal_set().
522 *
523 * @param ee The Ecore_Evas to set
524 * @return The modal flag
525 *
526 * @see ecore_evas_modal_set()
527 * @since 1.2
528 */
529EAPI Eina_Bool ecore_evas_modal_get(const Ecore_Evas *ee);
530/**
531 * @brief Set the "i demand attention" flag on a canvas window
532 *
533 * @param ee The Ecore_Evas
534 * @param demand_attention The flag state to set
535 *
536 * A window may demand attention now (eg you must enter a password before
537 * continuing), and so it may flag a window with this.
538 *
539 * @warning Support for this depends on the underlying windowing system.
540 * @since 1.2
541 */
542EAPI void ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand);
543/**
544 * @brief Get the "i demand attention" flag
545 *
546 * This returns the value set by ecore_evas_demand_attention_set().
547 *
548 * @param ee The Ecore_Evas to set
549 * @return The "i demand attention" flag.
550 *
551 * @see ecore_evas_demand_attention_set()
552 * @since 1.2
553 */
554EAPI Eina_Bool ecore_evas_demand_attention_get(const Ecore_Evas *ee);
555/**
556 * @brief Set the "focus skip" flag
557 *
558 * @param ee The Ecore_Evas
559 * @param skip The "focus skip" state to set.
560 *
561 * A window may not want to accept focus, be in the taskbar, pager etc.
562 * sometimes (example for a small notification window that hovers around
563 * a taskbar or panel, or hovers around a window until some activity
564 * dismisses it).
565 *
566 * @warning Support for this depends on the underlying windowing system.
567 * @since 1.2
568 */
569EAPI void ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip);
570/**
571 * @brief Get the "focus skip" flag
572 *
573 * This returns the value set by ecore_evas_focus_skip_set().
574 *
575 * @param ee The Ecore_Evas to set
576 * @return The "focus skip" flag.
577 *
578 * @see ecore_evas_focus_skip_set()
579 * @since 1.2
580 */
581EAPI Eina_Bool ecore_evas_focus_skip_get(const Ecore_Evas *ee);
582
583/**
584 * @brief Set if this evas should ignore @b all events.
585 *
586 * @param ee The Ecore_Evas whose window's to ignore events.
587 * @param ignore The Ecore_Evas new ignore state.
588 *
589 * @warning Support for this depends on the underlying windowing system.
590 */
591EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore);
592/**
593 * @brief Returns the ignore state of an Ecore_Evas' window.
594 *
595 * @param ee The Ecore_Evas whose window's ignore events state is returned.
596 * @return The Ecore_Evas window's ignore state.
597 *
598 * @see ecore_evas_ignore_events_set()
599 */
600EAPI Eina_Bool ecore_evas_ignore_events_get(const Ecore_Evas *ee);
601/**
602 * @brief Query whether an Ecore_Evas' window is visible or not.
603 *
604 * @param ee The Ecore_Evas to query.
605 * @return 1 if visible, 0 if not.
606 *
607 * This function queries @p ee and returns 1 if it is visible, and 0 if not.
608 *
609 * @see ecore_evas_show()
610 * @see ecore_evas_hide()
611 */
612EAPI int ecore_evas_visibility_get(const Ecore_Evas *ee);
613/**
614 * @brief Set the layer of an Ecore_Evas' window.
615 *
616 * @param ee The Ecore_Evas
617 * @param layer The layer to put @p ee on.
618 *
619 * This function moves @p ee to the layer @p layer.
620 *
621 * @warning Support for this depends on the underlying windowing system.
622 *
623 * @see ecore_evas_lower()
624 * @see ecore_evas_raise()
625 */
626EAPI void ecore_evas_layer_set(Ecore_Evas *ee, int layer);
627/**
628 * @brief Get the layer of an Ecore_Evas' window.
629 *
630 * @param ee The Ecore_Evas to set
631 * @return the layer @p ee's window is on.
632 *
633 * @see ecore_evas_layer_set()
634 * @see ecore_evas_lower()
635 * @see ecore_evas_raise()
636 */
637EAPI int ecore_evas_layer_get(const Ecore_Evas *ee);
638/**
639 * @brief Maximize (or unmaximize) an Ecore_Evas' window.
640 *
641 * @param ee The Ecore_Evas
642 * @param on EINA_TRUE to maximize, EINA_FALSE to unmaximize.
643 *
644 * This function maximizes @p ee if @p on is EINA_TRUE, or unmaximizes @p ee
645 * if @p on is EINA_FALSE.
646 *
647 * @warning Support for this depends on the underlying windowing system.
648 */
649EAPI void ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on);
650/**
651 * @brief Query whether an Ecore_Evas' window is maximized or not.
652 *
653 * @param ee The Ecore_Evas to set
654 * @return EINA_TRUE if @p ee is maximized, EINA_FALSE if not.
655 *
656 * @see ecore_evas_maximized_set()
657 */
658EAPI Eina_Bool ecore_evas_maximized_get(const Ecore_Evas *ee);
659/**
660 * @brief Move an Ecore_Evas.
661 *
662 * @param ee The Ecore_Evas to move
663 * @param x The x coordinate to move to
664 * @param y The y coordinate to move to
665 *
666 * This moves @p ee to the screen coordinates (@p x, @p y)
667 *
668 * @warning Support for this depends on the underlying windowing system.
669 *
670 * @see ecore_evas_new()
671 * @see ecore_evas_resize()
672 * @see ecore_evas_move_resize()
673 */
674EAPI void ecore_evas_move(Ecore_Evas *ee, int x, int y);
675/**
676 * @brief Resize an Ecore_Evas.
677 *
678 * @param ee The Ecore_Evas to move
679 * @param w The w coordinate to resize to
680 * @param h The h coordinate to resize to
681 *
682 * This resizes @p ee to @p w x @p h.
683 *
684 * @warning Support for this depends on the underlying windowing system.
685 *
686 * @see ecore_evas_new()
687 * @see ecore_evas_move()
688 * @see ecore_evas_move_resize()
689 */
690EAPI void ecore_evas_resize(Ecore_Evas *ee, int w, int h);
691/**
692 * @brief Move and resize an Ecore_Evas
693 *
694 * @param ee The Ecore_Evas to move and resize
695 * @param x The x coordinate to move to
696 * @param y The y coordinate to move to
697 * @param w The w coordinate to resize to
698 * @param h The h coordinate to resize to
699 *
700 * This moves @p ee to the screen coordinates (@p x, @p y) and resizes
701 * it to @p w x @p h.
702 *
703 * @warning Support for this depends on the underlying windowing system.
704 *
705 * @see ecore_evas_new()
706 * @see ecore_evas_move()
707 * @see ecore_evas_resize()
708 */
709EAPI void ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
710/**
711 * @brief Set the rotation of an Ecore_Evas' window.
712 *
713 * @param ee The Ecore_Evas
714 * @param rot the angle (in degrees) of rotation.
715 *
716 * The allowed values of @p rot depend on the engine being used. Most only
717 * allow multiples of 90.
718 *
719 * @warning Support for this depends on the underlying windowing system.
720 *
721 * @see ecore_evas_rotation_with_resize_set()
722 */
723EAPI void ecore_evas_rotation_set(Ecore_Evas *ee, int rot);
724/**
725 * @brief Set the rotation of an Ecore_Evas' window
726 *
727 * @param ee The Ecore_Evas
728 * @param rot the angle (in degrees) of rotation.
729 *
730 * Like ecore_evas_rotation_set(), but it also resizes the window's contents so
731 * that they fit inside the current window geometry.
732 *
733 * @warning Support for this depends on the underlying windowing system.
734 *
735 * @see ecore_evas_rotation_set()
736 */
737EAPI void ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot);
738/**
739 * @brief Get the rotation of an Ecore_Evas' window
740 *
741 * @param ee The Ecore_Evas
742 * @return the angle (in degrees) of rotation.
743 *
744 * @see ecore_evas_rotation_set()
745 * @see ecore_evas_rotation_with_resize_set()
746 */
747EAPI int ecore_evas_rotation_get(const Ecore_Evas *ee);
748/**
749 * @brief Raise an Ecore_Evas' window.
750 *
751 * @param ee The Ecore_Evas to raise.
752 *
753 * This functions raises the Ecore_Evas to the front.
754 *
755 * @warning Support for this depends on the underlying windowing system.
756 *
757 * @see ecore_evas_lower()
758 * @see ecore_evas_layer_set()
759 */
760EAPI void ecore_evas_raise(Ecore_Evas *ee);
761/**
762 * @brief Lower an Ecore_Evas' window.
763 *
764 * @param ee The Ecore_Evas to raise.
765 *
766 * This functions lowers the Ecore_Evas to the back.
767 *
768 * @warning Support for this depends on the underlying windowing system.
769 *
770 * @see ecore_evas_raise()
771 * @see ecore_evas_layer_set()
772 */
773EAPI void ecore_evas_lower(Ecore_Evas *ee);
774/**
775 * @brief Set the title of an Ecore_Evas' window.
776 *
777 * @param ee The Ecore_Evas whose title you wish to set.
778 * @param t The title
779 *
780 * This function sets the title of @p ee to @p t.
781 *
782 * @warning Support for this depends on the underlying windowing system.
783 */
784EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t);
785/**
786 * @brief Get the title of an Ecore_Evas' window.
787 *
788 * @param ee The Ecore_Evas whose title you wish to get.
789 * @return The title of @p ee.
790 *
791 * This function returns the title of @p ee.
792 *
793 * @see ecore_evas_title_set()
794 */
795EAPI const char *ecore_evas_title_get(const Ecore_Evas *ee);
796/**
797 * @brief Set the name and class of an Ecore_Evas' window.
798 *
799 * @param ee the Ecore_Evas
800 * @param n the name
801 * @param c the class
802 *
803 * This function sets the name of @p ee to @p n, and its class to @p c. The
804 * meaning of @p name and @p class depends on the underlying windowing system.
805 *
806 * @warning Support for this depends on the underlying windowing system.
807 */
808EAPI void ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
809/**
810 * @brief Get the name and class of an Ecore_Evas' window
811 *
812 * @p ee The Ecore_Evas to query
813 * @p n A pointer to a string to place the name in.
814 * @p c A pointer to a string to place the class in.
815 *
816 * This function gets the name of @p ee into @p n, and its class into
817 * @p c.
818 *
819 * @see ecore_evas_name_class_set()
820 */
821EAPI void ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c);
822/**
823 * @brief Returns a pointer to the underlying window.
824 *
825 * @param ee The Ecore_Evas whose window is desired.
826 *
827 * @warning Support for this depends on the underlying windowing system.
828 */
829EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee);
830
831
832/* engine/target specific init calls */
833EAPI Ecore_Evas *ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
834EAPI Ecore_X_Window ecore_evas_software_x11_window_get(const Ecore_Evas *ee);
835EAPI void ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on);
836EAPI Eina_Bool ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee);
837EAPI void ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
838
839#define ECORE_EVAS_GL_X11_OPT_NONE 0
840#define ECORE_EVAS_GL_X11_OPT_INDIRECT 1
841#define ECORE_EVAS_GL_X11_OPT_VSYNC 2
842#define ECORE_EVAS_GL_X11_OPT_LAST 3
843
844EAPI Ecore_Evas *ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
845EAPI 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);
846EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(const Ecore_Evas *ee);
847EAPI void ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on);
848EAPI Eina_Bool ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee);
849EAPI void ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
850EAPI 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));
851
852EAPI Ecore_Evas *ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
853EAPI Ecore_X_Window ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee);
854EAPI void ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on);
855EAPI Eina_Bool ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee);
856EAPI void ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
857
858EAPI Ecore_Evas *ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
859EAPI Ecore_X_Window ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee);
860EAPI Ecore_X_Window ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee);
861EAPI void ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on);
862EAPI Eina_Bool ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee);
863EAPI void ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
864
865EAPI Ecore_Evas *ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
866EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee);
867EAPI void ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on);
868EAPI Eina_Bool ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee);
869EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
870
871EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h);
872
873EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h);
874EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee);
875
876
877EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame);
878EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame);
879EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
880/* EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); */
881/* EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); */
882/* EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); */
883
884/**
885 * @brief Create a new @c Ecore_Evas canvas bound to the Evas
886 * @b buffer engine
887 *
888 * @param w The width of the canvas, in pixels
889 * @param h The height of the canvas, in pixels
890 * @return A new @c Ecore_Evas instance or @c NULL, on failure
891 *
892 * This creates a new buffer canvas wrapper, with image data array
893 * @b bound to the ARGB format, 8 bits per pixel.
894 *
895 * This function will allocate the needed pixels array with canonical
896 * @c malloc(). If you wish a custom function to allocate it, consider
897 * using ecore_evas_buffer_allocfunc_new(), instead.
898 *
899 * @note This function actually is a wrapper on
900 * ecore_evas_buffer_allocfunc_new(), using the same @a w and @a h
901 * arguments and canonical @c malloc() and @c free() to the memory
902 * allocation and freeing functions. See that function's documentation
903 * for more details.
904 */
905EAPI Ecore_Evas *ecore_evas_buffer_new(int w, int h);
906
907/**
908 * @brief Create a new @c Ecore_Evas canvas bound to the Evas
909 * @b buffer engine, giving custom allocation and freeing functions for
910 * the canvas memory region
911 *
912 * @param w The width of the canvas, in canvas units
913 * @param h The height of the canvas, in canvas units
914 * @param alloc_func Function to be called to allocate the memory
915 * needed for the new buffer canvas. @a data will be passed the same
916 * value as the @p data of this function, while @a size will be passed
917 * @p w times @p h times @c sizeof(int).
918 * @param free_func Function to be called to free the memory used by
919 * the new buffer canvas. @a data will be passed the same value as the
920 * @p data of this function, while @a pix will be passed the canvas
921 * memory pointer.
922 * @param data Custom data to be passed to the allocation and freeing
923 * functions
924 * @return A new @c Ecore_Evas instance or @c NULL, on failure
925 *
926 * This creates a new buffer canvas wrapper, with image data array
927 * @b bound to the ARGB format, 8 bits per pixel.
928 *
929 * This function is useful when one wants an @c Ecore_Evas buffer
930 * canvas with a custom allocation function, like one getting memory
931 * chunks from a memory pool, for example.
932 *
933 * On any resizing of this @c Ecore_Evas buffer canvas, its image data
934 * will be @b freed, to be allocated again with the new size.
935 *
936 * @note @p w and @p h sizes have to greater or equal to 1. Otherwise,
937 * they'll be interpreted as 1, exactly.
938 *
939 * @see ecore_evas_buffer_new()
940 */
941EAPI 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);
942
943/**
944 * @brief Grab a pointer to the actual pixels array of a given
945 * @c Ecore_Evas @b buffer canvas/window.
946 *
947 * @param ee An @c Ecore_Evas handle
948 * @return A pointer to the internal pixels array of @p ee
949 *
950 * Besides returning a pointer to the actual pixel array of the given
951 * canvas, this call will force a <b>rendering update on @p ee</b>,
952 * first.
953 *
954 * A common use case for this call is to create an image object, from
955 * @b another canvas, to have as data @p ee's contents, thus
956 * snapshoting the canvas. For that case, one can also use the
957 * ecore_evas_object_image_new() helper function.
958 */
959EAPI const void *ecore_evas_buffer_pixels_get(Ecore_Evas *ee);
960
961/**
962 * @brief Create a new @c Ecore_Evas canvas bound to the Evas
963 * @b ews (Ecore + Evas Single Process Windowing System) engine
964 *
965 * EWS is a simple single process windowing system. The backing store
966 * is also an @c Ecore_Evas that can be setup with
967 * ecore_evas_ews_setup() and retrieved with
968 * ecore_evas_ews_ecore_evas_get(). It will allow window management
969 * using events prefixed with @c ECORE_EVAS_EVENT_EWS_.
970 *
971 * The EWS windows (returned by this function or
972 * ecore_evas_new("ews"...)) will all be software buffer windows
973 * automatic rendered to the backing store.
974 *
975 * @param x horizontal position of window, in pixels
976 * @param y vertical position of window, in pixels
977 * @param w The width of the canvas, in pixels
978 * @param h The height of the canvas, in pixels
979 * @return A new @c Ecore_Evas instance or @c NULL, on failure
980 *
981 * @see ecore_evas_ews_setup()
982 * @see ecore_evas_ews_ecore_evas_get()
983 *
984 * @since 1.1
985 */
986EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
987
988
989/**
990 * Returns the backing store image object that represents the given
991 * window in EWS.
992 *
993 * @note This should not be modified anyhow, but may be helpful to
994 * determine stacking and geometry of it for window managers
995 * that decorate windows.
996 *
997 * @see ecore_evas_ews_manager_set()
998 * @see ecore_evas_ews_evas_get()
999 * @since 1.1
1000 */
1001EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
1002
1003/**
1004 * Calls the window to be deleted (freed), but can let user decide to
1005 * forbid it by using ecore_evas_callback_delete_request_set()
1006 *
1007 * @since 1.1
1008 */
1009EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee);
1010
1011/**
1012 * @brief Create an Evas image object with image data <b>bound to an
1013 * own, internal @c Ecore_Evas canvas wrapper</b>
1014 *
1015 * @param ee_target @c Ecore_Evas to have the canvas receiving the new
1016 * image object
1017 * @return A handle to the new image object
1018 *
1019 * This will create a @b special Evas image object. The image's pixel
1020 * array will get bound to the same image data array of an @b internal
1021 * @b buffer @c Ecore_Evas canvas. The user of this function is, then,
1022 * supposed to grab that @c Ecore_Evas handle, with
1023 * ecore_evas_object_ecore_evas_get(), and use its canvas to render
1024 * whichever contents he/she wants, @b independently of the contents
1025 * of the canvas owned by @p ee_target. Those contents will reflect on
1026 * the canvas of @p ee, though, being exactly the image data of the
1027 * object returned by this function.
1028 *
1029 * This is a helper function for the scenario of one wanting to grab a
1030 * buffer canvas' contents (with ecore_evas_buffer_pixels_get()) to be
1031 * used on another canvas, for whichever reason. The most common goal
1032 * of this setup is to @b save an image file with a whole canvas as
1033 * contents, which could not be achieved by using an image file within
1034 * the target canvas.
1035 *
1036 * @warning Always resize the returned image and its underlying
1037 * @c Ecore_Evas handle accordingly. They must be kept with same sizes
1038 * for things to work as expected. Also, you @b must issue
1039 * @c evas_object_image_size_set() on the image with that same size. If
1040 * the image is to be shown in a canvas bound to an engine different
1041 * than the buffer one, then you must also set this image's @b fill
1042 * properties accordingly.
1043 *
1044 * @note The image returned will always be bound to the
1045 * @c EVAS_COLORSPACE_ARGB8888 colorspace, always.
1046 *
1047 * @note Use ecore_evas_object_evas_get() to grab the image's internal
1048 * own canvas directly.
1049 *
1050 * @note If snapshoting this image's internal canvas, remember to
1051 * flush its internal @c Ecore_Evas firstly, with
1052 * ecore_evas_manual_render().
1053 */
1054EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target);
1055
1056/**
1057 * @brief Retrieve the internal @c Ecore_Evas handle of an image
1058 * object created via ecore_evas_object_image_new()
1059 *
1060 * @param obj A handle to an image object created via
1061 * ecore_evas_object_image_new()
1062 * @return The underlying @c Ecore_Evas handle in @p obj
1063 */
1064EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj);
1065
1066/**
1067 * @brief Retrieve the canvas bound to the internal @c Ecore_Evas
1068 * handle of an image object created via ecore_evas_object_image_new()
1069 *
1070 * @param obj A handle to an image object created via
1071 * ecore_evas_object_image_new()
1072 * @return A handle to @p obj's underlying @c Ecore_Evas's canvas
1073 */
1074EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj);
1075
1076EAPI Ecore_Evas *ecore_evas_software_gdi_new(Ecore_Win32_Window *parent,
1077 int x,
1078 int y,
1079 int width,
1080 int height);
1081
1082EAPI Ecore_Evas *ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent,
1083 int x,
1084 int y,
1085 int width,
1086 int height);
1087
1088EAPI Ecore_Evas *ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent,
1089 int x,
1090 int y,
1091 int width,
1092 int height);
1093
1094EAPI Ecore_Evas *ecore_evas_direct3d_new(Ecore_Win32_Window *parent,
1095 int x,
1096 int y,
1097 int width,
1098 int height);
1099
1100EAPI Ecore_Evas *ecore_evas_gl_glew_new(Ecore_Win32_Window *parent,
1101 int x,
1102 int y,
1103 int width,
1104 int height);
1105
1106EAPI Ecore_Win32_Window *ecore_evas_win32_window_get(const Ecore_Evas *ee);
1107
1108EAPI Ecore_Evas *ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha);
1109EAPI Ecore_Evas *ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha);
1110EAPI Ecore_Evas *ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe);
1111
1112EAPI Ecore_Evas *ecore_evas_software_wince_new(Ecore_WinCE_Window *parent,
1113 int x,
1114 int y,
1115 int width,
1116 int height);
1117
1118EAPI Ecore_Evas *ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent,
1119 int x,
1120 int y,
1121 int width,
1122 int height);
1123
1124EAPI Ecore_Evas *ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent,
1125 int x,
1126 int y,
1127 int width,
1128 int height);
1129
1130EAPI Ecore_Evas *ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent,
1131 int x,
1132 int y,
1133 int width,
1134 int height);
1135
1136EAPI Ecore_Evas *ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent,
1137 int x,
1138 int y,
1139 int width,
1140 int height);
1141
1142EAPI Ecore_WinCE_Window *ecore_evas_software_wince_window_get(const Ecore_Evas *ee);
1143
1144EAPI Ecore_Evas *ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent,
1145 int x,
1146 int y,
1147 int w,
1148 int h);
1149
1150EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h);
1151
1152
1153/* generic manipulation calls */
1154/**
1155 * @brief Get the engine name used by this Ecore_Evas(window).
1156 *
1157 * @param ee Ecore_Evas whose engine's name is desired.
1158 * @return A string that can(usually) be used in ecore_evas_new()
1159 *
1160 * @see ecore_evas_free()
1161 */
1162EAPI const char *ecore_evas_engine_name_get(const Ecore_Evas *ee);
1163/**
1164 * @brief Return the Ecore_Evas for this Evas
1165 *
1166 * @param e The Evas to get the Ecore_Evas from
1167 * @return The Ecore_Evas that holds this Evas, or NULL if not held by one.
1168 *
1169 * @warning Only use on Evas' created with ecore evas!
1170 */
1171EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e);
1172/**
1173 * @brief Free an Ecore_Evas
1174 *
1175 * @param ee The Ecore_Evas to free
1176 *
1177 * This frees up any memory used by the Ecore_Evas.
1178 */
1179EAPI void ecore_evas_free(Ecore_Evas *ee);
1180/**
1181 * @brief Retrieve user data associated with an Ecore_Evas.
1182 *
1183 * @param ee The Ecore_Evas to retrieve the user data from.
1184 * @param key The key which the user data to be retrieved is associated with.
1185 *
1186 * This function retrieves user specific data that has been stored within an
1187 * Ecore_Evas structure with ecore_evas_data_set().
1188 *
1189 * @returns NULL on error or no data found, A pointer to the user data on
1190 * success.
1191 *
1192 * @see ecore_evas_data_set()
1193 */
1194EAPI void *ecore_evas_data_get(const Ecore_Evas *ee, const char *key);
1195/**
1196 * @brief Store user data in an Ecore_Evas structure.
1197 *
1198 * @param ee The Ecore_Evas to store the user data in.
1199 * @param key A unique string to associate the user data against. Cannot
1200 * be NULL.
1201 * @param data A pointer to the user data to store.
1202 *
1203 * This function associates the @p data with a @p key which is stored by
1204 * the Ecore_Evas @p ee. Be aware that a call to ecore_evas_free() will
1205 * not free any memory for the associated user data, this is the responsibility
1206 * of the caller.
1207 *
1208 * @see ecore_evas_callback_pre_free_set()
1209 * @see ecore_evas_free()
1210 * @see ecore_evas_data_get()
1211 */
1212EAPI void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data);
1213/**
1214 * Set a callback for Ecore_Evas resize events.
1215 * @param ee The Ecore_Evas to set callbacks on
1216 * @param func The function to call
1217
1218 * A call to this function will set a callback on an Ecore_Evas, causing
1219 * @p func to be called whenever @p ee is resized.
1220 *
1221 * @warning If and when this function is called depends on the underlying
1222 * windowing system.
1223 */
1224EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1225/**
1226 * Set a callback for Ecore_Evas move events.
1227 * @param ee The Ecore_Evas to set callbacks on
1228 * @param func The function to call
1229
1230 * A call to this function will set a callback on an Ecore_Evas, causing
1231 * @p func to be called whenever @p ee is moved.
1232 *
1233 * @warning If and when this function is called depends on the underlying
1234 * windowing system.
1235 */
1236EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1237/**
1238 * Set a callback for Ecore_Evas show events.
1239 * @param ee The Ecore_Evas to set callbacks on
1240 * @param func The function to call
1241
1242 * A call to this function will set a callback on an Ecore_Evas, causing
1243 * @p func to be called whenever @p ee is shown.
1244 *
1245 * @warning If and when this function is called depends on the underlying
1246 * windowing system.
1247 */
1248EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1249/**
1250 * Set a callback for Ecore_Evas hide events.
1251 * @param ee The Ecore_Evas to set callbacks on
1252 * @param func The function to call
1253
1254 * A call to this function will set a callback on an Ecore_Evas, causing
1255 * @p func to be called whenever @p ee is hidden.
1256 *
1257 * @warning If and when this function is called depends on the underlying
1258 * windowing system.
1259 */
1260EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1261/**
1262 * Set a callback for Ecore_Evas delete request events.
1263 * @param ee The Ecore_Evas to set callbacks on
1264 * @param func The function to call
1265
1266 * A call to this function will set a callback on an Ecore_Evas, causing
1267 * @p func to be called whenever @p ee gets a delete request.
1268 *
1269 * @warning If and when this function is called depends on the underlying
1270 * windowing system.
1271 */
1272EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1273/**
1274 * Set a callback for Ecore_Evas destroy events.
1275 * @param ee The Ecore_Evas to set callbacks on
1276 * @param func The function to call
1277
1278 * A call to this function will set a callback on an Ecore_Evas, causing
1279 * @p func to be called whenever @p ee is destroyed.
1280 *
1281 * @warning If and when this function is called depends on the underlying
1282 * windowing system.
1283 */
1284EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1285/**
1286 * Set a callback for Ecore_Evas focus in events.
1287 * @param ee The Ecore_Evas to set callbacks on
1288 * @param func The function to call
1289
1290 * A call to this function will set a callback on an Ecore_Evas, causing
1291 * @p func to be called whenever @p ee gets focus.
1292 *
1293 * @warning If and when this function is called depends on the underlying
1294 * windowing system.
1295 */
1296EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1297/**
1298 * Set a callback for Ecore_Evas focus out events.
1299 * @param ee The Ecore_Evas to set callbacks on
1300 * @param func The function to call
1301
1302 * A call to this function will set a callback on an Ecore_Evas, causing
1303 * @p func to be called whenever @p ee loses focus.
1304 *
1305 * @warning If and when this function is called depends on the underlying
1306 * windowing system.
1307 */
1308EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1309/**
1310 * Set a callback for Ecore_Evas sticky events.
1311 * @param ee The Ecore_Evas to set callbacks on
1312 * @param func The function to call
1313
1314 * A call to this function will set a callback on an Ecore_Evas, causing
1315 * @p func to be called whenever @p ee becomes sticky.
1316 *
1317 * @warning If and when this function is called depends on the underlying
1318 * windowing system.
1319 */
1320EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1321/**
1322 * Set a callback for Ecore_Evas un-sticky events.
1323 * @param ee The Ecore_Evas to set callbacks on
1324 * @param func The function to call
1325
1326 * A call to this function will set a callback on an Ecore_Evas, causing
1327 * @p func to be called whenever @p ee becomes un-sticky.
1328 *
1329 * @warning If and when this function is called depends on the underlying
1330 * windowing system.
1331 */
1332EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1333/**
1334 * Set a callback for Ecore_Evas mouse in events.
1335 * @param ee The Ecore_Evas to set callbacks on
1336 * @param func The function to call
1337
1338 * A call to this function will set a callback on an Ecore_Evas, causing
1339 * @p func to be called whenever the mouse enters @p ee.
1340 *
1341 * @warning If and when this function is called depends on the underlying
1342 * windowing system.
1343 */
1344EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1345/**
1346 * Set a callback for Ecore_Evas mouse out events.
1347 * @param ee The Ecore_Evas to set callbacks on
1348 * @param func The function to call
1349
1350 * A call to this function will set a callback on an Ecore_Evas, causing
1351 * @p func to be called whenever the mouse leaves @p ee.
1352 *
1353 * @warning If and when this function is called depends on the underlying
1354 * windowing system.
1355 */
1356EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1357/**
1358 * Set a callback for Ecore_Evas pre render events.
1359 * @param ee The Ecore_Evas to set callbacks on
1360 * @param func The function to call
1361
1362 * A call to this function will set a callback on an Ecore_Evas, causing
1363 * @p func to be called just before the evas in @p ee is rendered.
1364 *
1365 * @warning If and when this function is called depends on the underlying
1366 * windowing system.
1367 */
1368EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1369/**
1370 * Set a callback for Ecore_Evas mouse post render events.
1371 * @param ee The Ecore_Evas to set callbacks on
1372 * @param func The function to call
1373
1374 * A call to this function will set a callback on an Ecore_Evas, causing
1375 * @p func to be called just after the evas in @p ee is rendered.
1376 *
1377 * @warning If and when this function is called depends on the underlying
1378 * windowing system.
1379 */
1380EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1381/**
1382 * Set a callback for Ecore_Evas pre-free event.
1383 * @param ee The Ecore_Evas to set callbacks on
1384 * @param func The function to call
1385 *
1386 * A call to this function will set a callback on an Ecore_Evas, causing
1387 * @p func to be called just before the instance @p ee is freed.
1388 *
1389 * @warning If and when this function is called depends on the underlying
1390 * windowing system.
1391 */
1392EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1393/**
1394 * Set a callback for Ecore_Evas state changes.
1395 * @param ee The Ecore_Evas to set callbacks on
1396 * @param func The function to call
1397
1398 * A call to this function will set a callback on an Ecore_Evas, causing
1399 * @p func to be called whenever @p ee changes state.
1400 *
1401 * @since 1.2
1402 * @warning If and when this function is called depends on the underlying
1403 * windowing system.
1404 */
1405EAPI void ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1406
1407EAPI Evas *ecore_evas_get(const Ecore_Evas *ee);
1408EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y);
1409EAPI void ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped);
1410EAPI Eina_Bool ecore_evas_shaped_get(const Ecore_Evas *ee);
1411/**
1412 * @brief Show an Ecore_Evas' window
1413 *
1414 * @param ee The Ecore_Evas to show.
1415 *
1416 * This function makes @p ee visible.
1417 */
1418EAPI void ecore_evas_show(Ecore_Evas *ee);
1419/**
1420 * @brief Hide an Ecore_Evas' window
1421 *
1422 * @param ee The Ecore_Evas to hide.
1423 *
1424 * This function makes @p ee hidden(not visible).
1425 */
1426EAPI void ecore_evas_hide(Ecore_Evas *ee);
1427EAPI void ecore_evas_activate(Ecore_Evas *ee);
1428
1429
1430/**
1431 * Set the minimum size of a given @c Ecore_Evas window
1432 *
1433 * @param ee An @c Ecore_Evas window's handle
1434 * @param w The minimum width
1435 * @param h The minimum height
1436 *
1437 * This function sets the minimum size of @p ee to be @p w x @p h.
1438 * One won't be able to resize that window to dimensions smaller than
1439 * the ones set.
1440 *
1441 * @note When base sizes are set, via ecore_evas_size_base_set(),
1442 * they'll be used to calculate a window's minimum size, instead of
1443 * those set by this function.
1444 *
1445 * @see ecore_evas_size_min_get()
1446 */
1447EAPI void ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h);
1448
1449/**
1450 * Get the minimum size set for a given @c Ecore_Evas window
1451 *
1452 * @param ee An @c Ecore_Evas window's handle
1453 * @param w A pointer to an int to place the minimum width in.
1454 * @param h A pointer to an int to place the minimum height in.
1455 *
1456 * @note Use @c NULL pointers on the size components you're not
1457 * interested in: they'll be ignored by the function.
1458 *
1459 * @see ecore_evas_size_min_set() for more details
1460 */
1461EAPI void ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h);
1462
1463/**
1464 * Set the maximum size of a given @c Ecore_Evas window
1465 *
1466 * @param ee An @c Ecore_Evas window's handle
1467 * @param w The maximum width
1468 * @param h The maximum height
1469 *
1470 * This function sets the maximum size of @p ee to be @p w x @p h.
1471 * One won't be able to resize that window to dimensions bigger than
1472 * the ones set.
1473 *
1474 * @see ecore_evas_size_max_get()
1475 */
1476EAPI void ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h);
1477
1478/**
1479 * Get the maximum size set for a given @c Ecore_Evas window
1480 *
1481 * @param ee An @c Ecore_Evas window's handle
1482 * @param w A pointer to an int to place the maximum width in.
1483 * @param h A pointer to an int to place the maximum height in.
1484 *
1485 * @note Use @c NULL pointers on the size components you're not
1486 * interested in: they'll be ignored by the function.
1487 *
1488 * @see ecore_evas_size_max_set() for more details
1489 */
1490EAPI void ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h);
1491
1492/**
1493 * Set the base size for a given @c Ecore_Evas window
1494 *
1495 * @param ee An @c Ecore_Evas window's handle
1496 * @param w The base width
1497 * @param h The base height
1498 *
1499 * This function sets the @b base size of @p ee to be @p w x @p h.
1500 * When base sizes are set, they'll be used to calculate a window's
1501 * @b minimum size, instead of those set by ecore_evas_size_min_get().
1502 *
1503 * @see ecore_evas_size_base_get()
1504 */
1505EAPI void ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h);
1506
1507/**
1508 * Get the base size set for a given @c Ecore_Evas window
1509 *
1510 * @param ee An @c Ecore_Evas window's handle
1511 * @param w A pointer to an int to place the base width in.
1512 * @param h A pointer to an int to place the base height in.
1513 *
1514 * @note Use @c NULL pointers on the size components you're not
1515 * interested in: they'll be ignored by the function.
1516 *
1517 * @see ecore_evas_size_base_set() for more details
1518 */
1519EAPI void ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h);
1520
1521/**
1522 * Set the "size step" for a given @c Ecore_Evas window
1523 *
1524 * @param ee An @c Ecore_Evas window's handle
1525 * @param w The step width
1526 * @param h The step height
1527 *
1528 * This function sets the size steps of @p ee to be @p w x @p h. This
1529 * limits the size of this @c Ecore_Evas window to be @b always an
1530 * integer multiple of the step size, for each axis.
1531 */
1532EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h);
1533
1534/**
1535 * Get the "size step" set for a given @c Ecore_Evas window
1536 *
1537 * @param ee An @c Ecore_Evas window's handle
1538 * @param w A pointer to an int to place the step width in.
1539 * @param h A pointer to an int to place the step height in.
1540 *
1541 * @note Use @c NULL pointers on the size components you're not
1542 * interested in: they'll be ignored by the function.
1543 *
1544 * @see ecore_evas_size_base_set() for more details
1545 */
1546EAPI void ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h);
1547
1548/**
1549 * @brief Set the cursor of an Ecore_Evas.
1550 *
1551 * @param ee The Ecore_Evas
1552 * @param file The path to an image file for the cursor.
1553 * @param layer The layer in which the cursor will appear.
1554 * @param hot_x The x coordinate of the cursor's hot spot.
1555 * @param hot_y The y coordinate of the cursor's hot spot.
1556 *
1557 * This function makes the mouse cursor over @p ee be the image specified by
1558 * @p file. The actual point within the image that the mouse is at is specified
1559 * by @p hot_x and @p hot_y, which are coordinates with respect to the top left
1560 * corner of the cursor image.
1561 *
1562 * @note This function creates an object from the image and uses
1563 * ecore_evas_object_cursor_set().
1564 *
1565 * @see ecore_evas_object_cursor_set()
1566 */
1567EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y);
1568/**
1569 * @brief Get information about an Ecore_Evas' cursor
1570 *
1571 * @param ee The Ecore_Evas to set
1572 * @param obj A pointer to an Evas_Object to place the cursor Evas_Object.
1573 * @param layer A pointer to an int to place the cursor's layer in.
1574 * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in.
1575 * @param hot_y A pointer to an int to place the cursor's hot_y coordinate in.
1576 *
1577 * This function queries information about an Ecore_Evas' cursor.
1578 *
1579 * @see ecore_evas_cursor_set()
1580 * @see ecore_evas_object_cursor_set()
1581 */
1582EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y);
1583/**
1584 * @brief Set the cursor of an Ecore_Evas
1585 *
1586 * @param ee The Ecore_Evas
1587 *
1588 * @param obj The Evas_Object which will be the cursor.
1589 * @param layer The layer in which the cursor will appear.
1590 * @param hot_x The x coordinate of the cursor's hot spot.
1591 * @param hot_y The y coordinate of the cursor's hot spot.
1592 *
1593 * This function makes the mouse cursor over @p ee be the object specified by
1594 * @p obj. The actual point within the object that the mouse is at is specified
1595 * by @p hot_x and @p hot_y, which are coordinates with respect to the top left
1596 * corner of the cursor object.
1597 *
1598 * @see ecore_evas_cursor_set()
1599 */
1600EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
1601EAPI void ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on);
1602EAPI Eina_Bool ecore_evas_override_get(const Ecore_Evas *ee);
1603EAPI void ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on);
1604EAPI Ecore_Evas_Avoid_Damage_Type ecore_evas_avoid_damage_get(const Ecore_Evas *ee);
1605EAPI void ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn);
1606EAPI Eina_Bool ecore_evas_withdrawn_get(const Ecore_Evas *ee);
1607EAPI void ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky);
1608EAPI Eina_Bool ecore_evas_sticky_get(const Ecore_Evas *ee);
1609EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render);
1610EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee);
1611
1612/**
1613 * @brief Registers an @c Ecore_Evas to receive events through ecore_input_evas.
1614 *
1615 * @param ee The @c Ecore_Evas handle.
1616 *
1617 * This function calls ecore_event_window_register() with the @p ee as its @c
1618 * id argument, @c window argument, and uses its @c Evas too. It is useful when
1619 * no @c window information is available on a given @c Ecore_Evas backend.
1620 *
1621 * @see ecore_evas_input_event_unregister()
1622 * @since 1.1
1623 */
1624EAPI void ecore_evas_input_event_register(Ecore_Evas *ee);
1625/**
1626 * @brief Unregisters an @c Ecore_Evas receiving events through ecore_input_evas.
1627 *
1628 * @param ee The @c Ecore_Evas handle.
1629 *
1630 * @see ecore_evas_input_event_register()
1631 * @since 1.1
1632 */
1633EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee);
1634
1635/**
1636 * @brief Force immediate rendering on a given @c Ecore_Evas window
1637 *
1638 * @param ee An @c Ecore_Evas handle
1639 *
1640 * Use this call to forcefully flush the @p ee's canvas rendering
1641 * pipeline, thus bring its window to an up to date state.
1642 */
1643EAPI void ecore_evas_manual_render(Ecore_Evas *ee);
1644EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync);
1645EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee);
1646/**
1647 * @brief Get geometry of screen associated with this Ecore_Evas.
1648 *
1649 * @param ee The Ecore_Evas whose window's to query container screen geometry.
1650 * @param x where to return the horizontal offset value. May be NULL.
1651 * @param y where to return the vertical offset value. May be NULL.
1652 * @param w where to return the width value. May be NULL.
1653 * @param h where to return the height value. May be NULL.
1654 *
1655 * @since 1.1
1656 */
1657EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
1658
1659EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame);
1660EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee);
1661
1662/**
1663 * @brief Associate the given object to this ecore evas.
1664 *
1665 * @param ee The Ecore_Evas to associate to @a obj
1666 * @param obj The object to associate to @a ee
1667 * @param flags The association flags.
1668 * @return EINA_TRUE on success, EINA_FALSE otherwise.
1669 *
1670 * Association means that operations on one will affect the other, for
1671 * example moving the object will move the window, resize the object will
1672 * also affect the ecore evas window, hide and show applies as well.
1673 *
1674 * This is meant to simplify development, since you often need to associate
1675 * these events with your "base" objects, background or bottom-most object.
1676 *
1677 * Be aware that some methods might not be what you would like, deleting
1678 * either the window or the object will delete the other. If you want to
1679 * change that behavior, let's say to hide window when it's closed, you
1680 * must use ecore_evas_callback_delete_request_set() and set your own code,
1681 * like ecore_evas_hide(). Just remember that if you override delete_request
1682 * and still want to delete the window/object, you must do that yourself.
1683 *
1684 * Since we now define delete_request, deleting windows will not quit
1685 * main loop, if you wish to do so, you should listen for EVAS_CALLBACK_FREE
1686 * on the object, that way you get notified and you can call
1687 * ecore_main_loop_quit().
1688 *
1689 * Flags can be OR'ed of:
1690 * @li ECORE_EVAS_OBJECT_ASSOCIATE_BASE (or 0): to listen to basic events
1691 * like delete, resize and move, but no stacking or layer are used.
1692 * @li ECORE_EVAS_OBJECT_ASSOCIATE_STACK: stacking operations will act
1693 * on the Ecore_Evas, not the object. So evas_object_raise() will
1694 * call ecore_evas_raise(). Relative operations (stack_above, stack_below)
1695 * are still not implemented.
1696 * @li ECORE_EVAS_OBJECT_ASSOCIATE_LAYER: stacking operations will act
1697 * on the Ecore_Evas, not the object. So evas_object_layer_set() will
1698 * call ecore_evas_layer_set().
1699 * @li ECORE_EVAS_OBJECT_ASSOCIATE_DEL: the object delete will delete the
1700 * ecore_evas as well as delete_requests on the ecore_evas will delete
1701 * etc.
1702 */
1703EAPI Eina_Bool ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags);
1704/**
1705 * @brief Cancel the association set with ecore_evas_object_associate().
1706 *
1707 * @param ee The Ecore_Evas to dissociate from @a obj
1708 * @param obj The object to dissociate from @a ee
1709 * @return EINA_TRUE on success, EINA_FALSE otherwise.
1710 */
1711EAPI Eina_Bool ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj);
1712/**
1713 * @brief Get the object associated with @p ee
1714 *
1715 * @param ee The Ecore_Evas to get the object from.
1716 * @return The associated object, or NULL if there is no associated object.
1717 */
1718EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee);
1719
1720/* helper function to be used with ECORE_GETOPT_CALLBACK_*() */
1721EAPI 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);
1722
1723/**
1724 * @brief Get a list of all the ecore_evases.
1725 *
1726 * @return A list of ecore_evases.
1727 *
1728 * The returned list of ecore evases is only valid until the canvases are
1729 * destroyed (and should not be cached for instance). The list can be freed by
1730 * just deleting the list.
1731 */
1732EAPI Eina_List *ecore_evas_ecore_evas_list_get(void);
1733
1734/* specific calls to an x11 environment ecore_evas */
1735EAPI void ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win);
1736EAPI Ecore_X_Window ecore_evas_x11_leader_get(Ecore_Evas *ee);
1737EAPI void ecore_evas_x11_leader_default_set(Ecore_Evas *ee);
1738EAPI void ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h);
1739EAPI void ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h);
1740EAPI void ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h);
1741EAPI void ecore_evas_x11_shape_input_empty(Ecore_Evas *ee);
1742EAPI void ecore_evas_x11_shape_input_reset(Ecore_Evas *ee);
1743EAPI void ecore_evas_x11_shape_input_apply(Ecore_Evas *ee);
1744
1745/**
1746 * @defgroup Ecore_Evas_Ews Ecore_Evas Single Process Windowing System.
1747 *
1748 * These are global scope functions to manage the EWS to be used by
1749 * ecore_evas_ews_new().
1750 *
1751 * @since 1.1
1752 * @{
1753 */
1754
1755/**
1756 * Sets the engine to be used by the backing store engine.
1757 *
1758 * @return EINA_TRUE on success, EINA_FALSE if ews is already in use.
1759 * @since 1.1
1760 */
1761EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options);
1762
1763/**
1764 * Reconfigure the backing store used.
1765 * @since 1.1
1766 */
1767EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
1768
1769/**
1770 * Return the internal backing store in use.
1771 *
1772 * @note this will forced it to be created, making future calls to
1773 * ecore_evas_ews_engine_set() void.
1774 *
1775 * @see ecore_evas_ews_evas_get()
1776 * @since 1.1
1777 */
1778EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
1779
1780/**
1781 * Return the internal backing store in use.
1782 *
1783 * @note this will forced it to be created, making future calls to
1784 * ecore_evas_ews_engine_set() void.
1785 *
1786 * @see ecore_evas_ews_ecore_evas_get()
1787 * @since 1.1
1788 */
1789EAPI Evas *ecore_evas_ews_evas_get(void);
1790
1791/**
1792 * Get the current background.
1793 */
1794EAPI Evas_Object *ecore_evas_ews_background_get(void);
1795
1796/**
1797 * Set the current background, must be created at evas ecore_evas_ews_evas_get()
1798 *
1799 * It will be kept at lowest layer (EVAS_LAYER_MIN) and below
1800 * everything else. You can set any object, default is a black
1801 * rectangle.
1802 *
1803 * @note previous object will be deleted!
1804 */
1805EAPI void ecore_evas_ews_background_set(Evas_Object *o);
1806
1807/**
1808 * Return all Ecore_Evas* created by EWS.
1809 *
1810 * @note do not change the returned list or its contents.
1811 * @since 1.1
1812 */
1813EAPI const Eina_List *ecore_evas_ews_children_get(void);
1814
1815/**
1816 * Set the identifier of the manager taking care of internal windows.
1817 *
1818 * The ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE event is issued. Consider
1819 * handling it to know if you should stop handling events yourself
1820 * (ie: another manager took over)
1821 *
1822 * @param manager any unique identifier address.
1823 *
1824 * @see ecore_evas_ews_manager_get()
1825 * @since 1.1
1826 */
1827EAPI void ecore_evas_ews_manager_set(const void *manager);
1828
1829/**
1830 * Get the identifier of the manager taking care of internal windows.
1831 *
1832 * @return the value set by ecore_evas_ews_manager_set()
1833 * @since 1.1
1834 */
1835EAPI const void *ecore_evas_ews_manager_get(void);
1836
1837EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed @since 1.1 */
1838EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created @since 1.1 */
1839EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. @since 1.1 */
1840EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized @since 1.1 */
1841EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved @since 1.1 */
1842EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible @since 1.1 */
1843EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden @since 1.1 */
1844EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused @since 1.1 */
1845EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus @since 1.1 */
1846EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised @since 1.1 */
1847EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered @since 1.1 */
1848EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated @since 1.1 */
1849
1850EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed @since 1.1 */
1851EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed @since 1.1 */
1852EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed @since 1.1 */
1853EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed @since 1.1 */
1854EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) @since 1.1 */
1855
1856/**
1857 * @}
1858 */
1859
1860/**
1861 * @defgroup Ecore_Evas_Extn External plug/socket infrastructure to remote canvases
1862 *
1863 * These functions allow 1 process to create a "socket" was pluged into which another
1864 * process can create a "plug" remotely to plug into.
1865 * Socket can provides content for several plugs.
1866 * This is best for small sized objects (about the size range
1867 * of a small icon up to a few large icons). Sine the plug is actually an
1868 * image object, you can fetch the pixel data
1869 *
1870 * @since 1.2
1871 * @{
1872 */
1873
1874EAPI extern int ECORE_EVAS_EXTN_CLIENT_ADD; /**< this event is received when a plug has connected to an extn socket @since 1.2 */
1875EAPI extern int ECORE_EVAS_EXTN_CLIENT_DEL; /**< this event is received when a plug has disconnected from an extn socket @since 1.2 */
1876
1877/**
1878 * @brief Create a new Ecore_Evas canvas for the new external ecore evas socket
1879 *
1880 * @param w The width of the canvas, in pixels
1881 * @param h The height of the canvas, in pixels
1882 * @return A new @c Ecore_Evas instance or @c NULL, on failure
1883 *
1884 * This creates a new extn_socket canvas wrapper, with image data array
1885 * @b bound to the ARGB format, 8 bits per pixel.
1886 *
1887 * If creation is successful, an Ecore_Evas handle is returned or NULL if creation
1888 * fails. Also focus, show, hide etc. callbacks
1889 * will also be called if the plug object is shown, or already visible on
1890 * connect, or if it is hidden later, focused or unfocused.
1891 *
1892 * This function has to be flowed by ecore_evas_extn_socket_listen(),
1893 * for starting ecore ipc service.
1894 *
1895 * @code
1896 * Eina_Bool res = EINA_FALSE;
1897 * Ecore_Evas *ee = ecore_evas_extn_socket_new(1, 1);
1898 *
1899 * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE);
1900 * if (!res) return;
1901 * ecore_evas_resize(ee, 240, 400);
1902 * @endcode
1903 *
1904 * or
1905 *
1906 * @code
1907 * Eina_Bool res = EINA_FALSE;
1908 * Ecore_Evas *ee = ecore_evas_extn_socket_new(240, 400);
1909 *
1910 * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE);
1911 * if (!res) return;
1912 * @endcode
1913 *
1914 * When a client(plug) connects, you will get the ECORE_EVAS_EXTN_CLIENT_ADD event
1915 * in the ecore event queue, with event_info being the image object pointer
1916 * passed as a void pointer. When a client disconnects you will get the
1917 * ECORE_EVAS_EXTN_CLIENT_DEL event.
1918 *
1919 * You can set up event handles for these events as follows:
1920 *
1921 * @code
1922 * static void client_add_cb(void *data, int event, void *event_info)
1923 * {
1924 * Evas_Object *obj = event_info;
1925 * printf("client added to image object %p\n", obj);
1926 * evas_object_show(obj);
1927 * }
1928 *
1929 * static void client_del_cb(void *data, int event, void *event_info)
1930 * {
1931 * Evas_Object *obj = event_info;
1932 * printf("client deleted from image object %p\n", obj);
1933 * evas_object_hide(obj);
1934 * }
1935 *
1936 * void setup(void)
1937 * {
1938 * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_ADD,
1939 * client_add_cb, NULL);
1940 * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_DEL,
1941 * client_del_cb, NULL);
1942 * }
1943 * @endcode
1944 *
1945 * Note that events come in later after the event happened. You may want to be
1946 * careful as data structures you had associated with the image object
1947 * may have been freed after deleting, but the object may still be around
1948 * awating cleanup and thus still be valid.You can change the size with something like:
1949 *
1950 * @see ecore_evas_extn_socket_listen()
1951 * @see ecore_evas_extn_plug_new()
1952 * @see ecore_evas_extn_plug_object_data_lock()
1953 * @see ecore_evas_extn_plug_object_data_unlock()
1954 *
1955 * @since 1.2
1956 */
1957EAPI Ecore_Evas *ecore_evas_extn_socket_new(int w, int h);
1958
1959/**
1960 * @brief Create a socket to provide the service for external ecore evas socket.
1961 *
1962 * @param ee The Ecore_Evas
1963 * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail.
1964 * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name.
1965 * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service.
1966 * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not.
1967 *
1968 * This creates socket specified by @p svcname, @p svcnum and @p svcsys. If creation
1969 * is successful, EINA_TRUE is returned or EINA_FALSE if creation
1970 * fails.
1971 *
1972 * @see ecore_evas_extn_socket_new()
1973 * @see ecore_evas_extn_plug_new()
1974 * @see ecore_evas_extn_plug_object_data_lock()
1975 * @see ecore_evas_extn_plug_object_data_unlock()
1976 *
1977 * @since 1.2
1978 */
1979EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys);
1980
1981/**
1982 * @brief Lock the pixel data so the socket cannot change it
1983 *
1984 * @param obj The image object returned by ecore_evas_extn_plug_new() to lock
1985 *
1986 * You may need to get the image pixel data with evas_object_image_data_get()
1987 * from the image object, but need to ensure that it does not change while
1988 * you are using the data. This function lets you set an advisory lock on the
1989 * image data so the external plug process will not render to it or alter it.
1990 *
1991 * You should only hold the lock for just as long as you need to read out the
1992 * image data or otherwise deal with it, and then unlock it with
1993 * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than
1994 * 1 iteration of the main ecore loop will be problematic, so avoid it. Also
1995 * forgetting to unlock may cause the socket process to freeze and thus create
1996 * odd behavior.
1997 *
1998 * @see ecore_evas_extn_plug_new()
1999 * @see ecore_evas_extn_plug_object_data_unlock()
2000 *
2001 * @since 1.2
2002 */
2003EAPI void ecore_evas_extn_plug_object_data_lock(Evas_Object *obj);
2004
2005/**
2006 * @brief Unlock the pixel data so the socket can change it again.
2007 *
2008 * @param obj The image object returned by ecore_evas_extn_plug_new() to unlock
2009 *
2010 * This unlocks after an advisor lock has been taken by
2011 * ecore_evas_extn_plug_object_data_lock().
2012 *
2013 * @see ecore_evas_extn_plug_new()
2014 * @see ecore_evas_extn_plug_object_data_lock()
2015 *
2016 * @since 1.2
2017 */
2018EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj);
2019
2020/**
2021 * @brief Create a new external ecore evas plug
2022 *
2023 * @param ee_target The Ecore_Evas containing the canvas in which the new image object will live.
2024 * @return An evas image object that will contain the image output of a socket.
2025 *
2026 * This creates an image object that will contain the output of another
2027 * processes socket canvas when it connects. All input will be sent back to
2028 * this process as well, effectively swallowing or placing the socket process
2029 * in the canvas of the plug process in place of the image object. The image
2030 * object by default is created to be filled (equivalent of
2031 * evas_object_image_filled_add() on creation) so image content will scale
2032 * to fill the image unless otherwise reconfigured. The Ecore_Evas size
2033 * of the plug is the master size and determines size in pixels of the
2034 * plug canvas. You can change the size with something like:
2035 *
2036 * @code
2037 * Eina_Bool res = EINA_FALSE;
2038 * Evas_Object *obj = ecore_evas_extn_plug_new(ee);
2039 *
2040 * res = ecore_evas_extn_plug_connect("svcname", 1, EINA_FALSE);
2041 * if (!res) return;
2042 * ecore_evas_resize(ee, 240, 400);
2043 * @endcode
2044 *
2045 * @see ecore_evas_extn_socket_new()
2046 * @see ecore_evas_extn_plug_connect()
2047 * @since 1.2
2048 */
2049EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target);
2050
2051/**
2052 * @brief Connect a external ecore evas plug to service provided by external ecore evas socket
2053 *
2054 * @param obj The Ecore_Evas containing the canvas in which the new image object will live.
2055 * @param svcname The service name to connect to set up by the socket.
2056 * @param svcnum The service number to connect to (set up by socket).
2057 * @param svcsys Booleain to set if the service is a system one or not (set up by socket).
2058 * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not.
2059 *
2060 *
2061 * @see ecore_evas_extn_plug_new()
2062 *
2063 * @since 1.2
2064 */
2065EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
2066
2067/**
2068 * @}
2069 */
2070
2071/**
2072 * @}
2073 */
2074
2075#ifdef __cplusplus
2076}
2077#endif
2078
2079#endif
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am
deleted file mode 100644
index c85af09..0000000
--- a/libraries/ecore/src/lib/ecore_evas/Makefile.am
+++ /dev/null
@@ -1,160 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3if BUILD_ECORE_X
4ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@
5ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@
6else
7ECORE_X_INC =
8ECORE_X_LIB =
9endif
10
11if BUILD_ECORE_FB
12ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb
13ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la
14else
15ECORE_FB_INC =
16ECORE_FB_LIB =
17endif
18
19if BUILD_ECORE_DIRECTFB
20ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@
21ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la
22else
23ECORE_DIRECTFB_INC =
24ECORE_DIRECTFB_LIB =
25endif
26
27if BUILD_ECORE_WIN32
28ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32
29ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la
30else
31ECORE_WIN32_INC =
32ECORE_WIN32_LIB =
33endif
34
35if BUILD_ECORE_SDL
36ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@
37ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la
38ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB)
39else
40ECORE_SDL_INC =
41ECORE_SDL_LIB =
42ECORE_SDL_LIBADD =
43endif
44
45if BUILD_ECORE_COCOA
46ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa
47ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la
48else
49ECORE_COCOA_INC =
50ECORE_COCOA_LIB =
51endif
52
53if BUILD_ECORE_WINCE
54ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince
55ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la
56else
57ECORE_WINCE_INC =
58ECORE_WINCE_LIB =
59endif
60
61if BUILD_ECORE_PSL1GHT
62ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght
63ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la
64else
65ECORE_PSL1GHT_INC =
66ECORE_PSL1GHT_LIB =
67endif
68
69if BUILD_ECORE_WAYLAND
70ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@
71ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la
72ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB)
73else
74ECORE_WAYLAND_INC =
75ECORE_WAYLAND_LIB =
76ECORE_WAYLAND_LIBADD =
77endif
78
79if BUILD_ECORE_IPC
80ECORE_IPC_INC= \
81-I$(top_srcdir)/src/lib/ecore_ipc \
82-I$(top_builddir)/src/lib/ecore_ipc
83
84ECORE_IPC_LIB=$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la
85endif
86
87AM_CPPFLAGS = \
88-I$(top_srcdir)/src/lib/ecore \
89-I$(top_srcdir)/src/lib/ecore_evas \
90-I$(top_srcdir)/src/lib/ecore_input \
91-I$(top_srcdir)/src/lib/ecore_input_evas \
92-I$(top_builddir)/src/lib/ecore \
93-I$(top_builddir)/src/lib/ecore_evas \
94-I$(top_builddir)/src/lib/ecore_input \
95-I$(top_builddir)/src/lib/ecore_input_evas \
96@EFL_ECORE_EVAS_BUILD@ \
97$(ECORE_X_INC) \
98$(ECORE_FB_INC) \
99$(ECORE_DIRECTFB_INC) \
100$(ECORE_WIN32_INC) \
101$(ECORE_SDL_INC) \
102$(ECORE_COCOA_INC) \
103$(ECORE_WINCE_INC) \
104$(ECORE_PSL1GHT_INC) \
105$(ECORE_WAYLAND_INC) \
106$(ECORE_IPC_INC) \
107@EVAS_CFLAGS@ \
108@EINA_CFLAGS@ \
109@EVIL_CFLAGS@ \
110@WAYLAND_EGL_CFLAGS@
111
112AM_CFLAGS = @WIN32_CFLAGS@
113
114lib_LTLIBRARIES = libecore_evas.la
115includes_HEADERS = Ecore_Evas.h
116includesdir = $(includedir)/ecore-@VMAJ@
117
118libecore_evas_la_SOURCES = \
119ecore_evas.c \
120ecore_evas_util.c \
121ecore_evas_x.c \
122ecore_evas_fb.c \
123ecore_evas_buffer.c \
124ecore_evas_directfb.c \
125ecore_evas_win32.c \
126ecore_evas_sdl.c \
127ecore_evas_cocoa.c \
128ecore_evas_wince.c \
129ecore_evas_ews.c \
130ecore_evas_psl1ght.c \
131ecore_evas_wayland_shm.c \
132ecore_evas_wayland_egl.c \
133ecore_evas_extn.c
134
135libecore_evas_la_LIBADD = \
136$(ECORE_X_LIB) \
137$(ECORE_FB_LIB) \
138$(ECORE_DIRECTFB_LIB) \
139$(ECORE_WIN32_LIB) \
140$(ECORE_SDL_LIB) \
141$(ECORE_SDL_LIBADD) \
142$(ECORE_COCOA_LIB) \
143$(ECORE_WINCE_LIB) \
144$(ECORE_IPC_LIB) \
145$(ECORE_PSL1GHT_LIB) \
146$(ECORE_WAYLAND_LIB) \
147$(ECORE_WAYLAND_LIBADD) \
148$(top_builddir)/src/lib/ecore_input/libecore_input.la \
149$(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \
150$(top_builddir)/src/lib/ecore/libecore.la \
151@EVAS_LIBS@ \
152@EINA_LIBS@ \
153@EVIL_LIBS@ \
154@SHM_OPEN_LIBS@ \
155@WAYLAND_EGL_LIBS@
156
157libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
158
159EXTRA_DIST = \
160ecore_evas_private.h
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.in b/libraries/ecore/src/lib/ecore_evas/Makefile.in
deleted file mode 100644
index b48f26f..0000000
--- a/libraries/ecore/src/lib/ecore_evas/Makefile.in
+++ /dev/null
@@ -1,965 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_evas
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88@BUILD_ECORE_X_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/lib/ecore_x/libecore_x.la
89@BUILD_ECORE_FB_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la
90@BUILD_ECORE_DIRECTFB_TRUE@am__DEPENDENCIES_3 = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la
91@BUILD_ECORE_WIN32_TRUE@am__DEPENDENCIES_4 = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la
92@BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_5 = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la
93@BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_5)
94@BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la
95@BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la
96@BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la
97@BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_10 = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la
98@BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_11 = \
99@BUILD_ECORE_WAYLAND_TRUE@ $(am__DEPENDENCIES_10)
100libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
101 $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
102 $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \
103 $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \
104 $(am__DEPENDENCIES_8) $(ECORE_IPC_LIB) $(am__DEPENDENCIES_9) \
105 $(am__DEPENDENCIES_10) $(am__DEPENDENCIES_11) \
106 $(top_builddir)/src/lib/ecore_input/libecore_input.la \
107 $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \
108 $(top_builddir)/src/lib/ecore/libecore.la
109am_libecore_evas_la_OBJECTS = ecore_evas.lo ecore_evas_util.lo \
110 ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \
111 ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \
112 ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \
113 ecore_evas_psl1ght.lo ecore_evas_wayland_shm.lo \
114 ecore_evas_wayland_egl.lo ecore_evas_extn.lo
115libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS)
116AM_V_lt = $(am__v_lt_$(V))
117am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
118am__v_lt_0 = --silent
119libecore_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
120 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
121 $(AM_CFLAGS) $(CFLAGS) $(libecore_evas_la_LDFLAGS) $(LDFLAGS) \
122 -o $@
123DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
124depcomp = $(SHELL) $(top_srcdir)/depcomp
125am__depfiles_maybe = depfiles
126am__mv = mv -f
127COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
128 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
129LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
130 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
131 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
132 $(AM_CFLAGS) $(CFLAGS)
133AM_V_CC = $(am__v_CC_$(V))
134am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
135am__v_CC_0 = @echo " CC " $@;
136AM_V_at = $(am__v_at_$(V))
137am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
138am__v_at_0 = @
139CCLD = $(CC)
140LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
141 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
142 $(AM_LDFLAGS) $(LDFLAGS) -o $@
143AM_V_CCLD = $(am__v_CCLD_$(V))
144am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
145am__v_CCLD_0 = @echo " CCLD " $@;
146AM_V_GEN = $(am__v_GEN_$(V))
147am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
148am__v_GEN_0 = @echo " GEN " $@;
149SOURCES = $(libecore_evas_la_SOURCES)
150DIST_SOURCES = $(libecore_evas_la_SOURCES)
151HEADERS = $(includes_HEADERS)
152ETAGS = etags
153CTAGS = ctags
154DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
155ACLOCAL = @ACLOCAL@
156ALLOCA = @ALLOCA@
157AMTAR = @AMTAR@
158AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
159AR = @AR@
160AS = @AS@
161AUTOCONF = @AUTOCONF@
162AUTOHEADER = @AUTOHEADER@
163AUTOMAKE = @AUTOMAKE@
164AWK = @AWK@
165CARES_CFLAGS = @CARES_CFLAGS@
166CARES_LIBS = @CARES_LIBS@
167CC = @CC@
168CCDEPMODE = @CCDEPMODE@
169CFLAGS = @CFLAGS@
170CHECK_CFLAGS = @CHECK_CFLAGS@
171CHECK_LIBS = @CHECK_LIBS@
172CPP = @CPP@
173CPPFLAGS = @CPPFLAGS@
174CURL_CFLAGS = @CURL_CFLAGS@
175CURL_LIBS = @CURL_LIBS@
176CXX = @CXX@
177CXXCPP = @CXXCPP@
178CXXDEPMODE = @CXXDEPMODE@
179CXXFLAGS = @CXXFLAGS@
180CYGPATH_W = @CYGPATH_W@
181DEFS = @DEFS@
182DEPDIR = @DEPDIR@
183DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
184DIRECTFB_LIBS = @DIRECTFB_LIBS@
185DLLTOOL = @DLLTOOL@
186DSYMUTIL = @DSYMUTIL@
187DUMPBIN = @DUMPBIN@
188ECHO_C = @ECHO_C@
189ECHO_N = @ECHO_N@
190ECHO_T = @ECHO_T@
191ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
192ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
193EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
194EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
195EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
196EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
197EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
198EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
199EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
200EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
201EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
202EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
203EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
204EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
205EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
206EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
207EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
208EGREP = @EGREP@
209EINA_CFLAGS = @EINA_CFLAGS@
210EINA_LIBS = @EINA_LIBS@
211ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
212ESCAPE_LIBS = @ESCAPE_LIBS@
213EVAS_CFLAGS = @EVAS_CFLAGS@
214EVAS_LIBS = @EVAS_LIBS@
215EVIL_CFLAGS = @EVIL_CFLAGS@
216EVIL_LIBS = @EVIL_LIBS@
217EXEEXT = @EXEEXT@
218EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
219EXOTIC_LIBS = @EXOTIC_LIBS@
220FGREP = @FGREP@
221GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
222GLIB_CFLAGS = @GLIB_CFLAGS@
223GLIB_LIBS = @GLIB_LIBS@
224GMSGFMT = @GMSGFMT@
225GMSGFMT_015 = @GMSGFMT_015@
226GREP = @GREP@
227INSTALL = @INSTALL@
228INSTALL_DATA = @INSTALL_DATA@
229INSTALL_PROGRAM = @INSTALL_PROGRAM@
230INSTALL_SCRIPT = @INSTALL_SCRIPT@
231INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
232INTLLIBS = @INTLLIBS@
233INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
234KEYSYMDEFS = @KEYSYMDEFS@
235LD = @LD@
236LDFLAGS = @LDFLAGS@
237LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
238LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
239LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
240LIBICONV = @LIBICONV@
241LIBINTL = @LIBINTL@
242LIBOBJS = @LIBOBJS@
243LIBS = @LIBS@
244LIBTOOL = @LIBTOOL@
245LIPO = @LIPO@
246LN_S = @LN_S@
247LTLIBICONV = @LTLIBICONV@
248LTLIBINTL = @LTLIBINTL@
249LTLIBOBJS = @LTLIBOBJS@
250MAKEINFO = @MAKEINFO@
251MKDIR_P = @MKDIR_P@
252MSGFMT = @MSGFMT@
253MSGFMT_015 = @MSGFMT_015@
254MSGMERGE = @MSGMERGE@
255NM = @NM@
256NMEDIT = @NMEDIT@
257OBJC = @OBJC@
258OBJCDEPMODE = @OBJCDEPMODE@
259OBJCFLAGS = @OBJCFLAGS@
260OBJDUMP = @OBJDUMP@
261OBJEXT = @OBJEXT@
262OTOOL = @OTOOL@
263OTOOL64 = @OTOOL64@
264PACKAGE = @PACKAGE@
265PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
266PACKAGE_NAME = @PACKAGE_NAME@
267PACKAGE_STRING = @PACKAGE_STRING@
268PACKAGE_TARNAME = @PACKAGE_TARNAME@
269PACKAGE_URL = @PACKAGE_URL@
270PACKAGE_VERSION = @PACKAGE_VERSION@
271PATH_SEPARATOR = @PATH_SEPARATOR@
272PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
273PIXMAN_LIBS = @PIXMAN_LIBS@
274PKG_CONFIG = @PKG_CONFIG@
275PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
276PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
277POSUB = @POSUB@
278RANLIB = @RANLIB@
279SCIM_CFLAGS = @SCIM_CFLAGS@
280SCIM_LIBS = @SCIM_LIBS@
281SDL_CFLAGS = @SDL_CFLAGS@
282SDL_CONFIG = @SDL_CONFIG@
283SDL_LIBS = @SDL_LIBS@
284SED = @SED@
285SET_MAKE = @SET_MAKE@
286SHELL = @SHELL@
287SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
288SSL_CFLAGS = @SSL_CFLAGS@
289SSL_LIBS = @SSL_LIBS@
290STRIP = @STRIP@
291TLS2_CFLAGS = @TLS2_CFLAGS@
292TLS2_LIBS = @TLS2_LIBS@
293TLS_CFLAGS = @TLS_CFLAGS@
294TLS_LIBS = @TLS_LIBS@
295TSLIB_CFLAGS = @TSLIB_CFLAGS@
296TSLIB_LIBS = @TSLIB_LIBS@
297USE_NLS = @USE_NLS@
298VERSION = @VERSION@
299VMAJ = @VMAJ@
300WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
301WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
302WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
303WAYLAND_LIBS = @WAYLAND_LIBS@
304WIN32_CFLAGS = @WIN32_CFLAGS@
305WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
306WIN32_LIBS = @WIN32_LIBS@
307XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
308XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
309XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
310XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
311XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
312XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
313XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
314XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
315XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
316XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
317XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
318XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
319XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
320XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
321XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
322XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
323XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
324XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
325XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
326XCB_X11_LIBS = @XCB_X11_LIBS@
327XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
328XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
329XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
330XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
331XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
332XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
333XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
334XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
335XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
336XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
337XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
338XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
339XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
340XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
341XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
342XDAMAGE_LIBS = @XDAMAGE_LIBS@
343XDPMS_CFLAGS = @XDPMS_CFLAGS@
344XDPMS_LIBS = @XDPMS_LIBS@
345XFIXES_CFLAGS = @XFIXES_CFLAGS@
346XFIXES_LIBS = @XFIXES_LIBS@
347XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
348XGESTURE_LIBS = @XGESTURE_LIBS@
349XGETTEXT = @XGETTEXT@
350XGETTEXT_015 = @XGETTEXT_015@
351XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
352XI2_CFLAGS = @XI2_CFLAGS@
353XI2_LIBS = @XI2_LIBS@
354XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
355XINERAMA_LIBS = @XINERAMA_LIBS@
356XKB_CFLAGS = @XKB_CFLAGS@
357XKB_LIBS = @XKB_LIBS@
358XMKMF = @XMKMF@
359XPRINT_CFLAGS = @XPRINT_CFLAGS@
360XPRINT_LIBS = @XPRINT_LIBS@
361XRANDR_CFLAGS = @XRANDR_CFLAGS@
362XRANDR_LIBS = @XRANDR_LIBS@
363XRENDER_CFLAGS = @XRENDER_CFLAGS@
364XRENDER_LIBS = @XRENDER_LIBS@
365XSS_CFLAGS = @XSS_CFLAGS@
366XSS_LIBS = @XSS_LIBS@
367XTEST_CFLAGS = @XTEST_CFLAGS@
368XTEST_LIBS = @XTEST_LIBS@
369X_CFLAGS = @X_CFLAGS@
370X_EXTRA_LIBS = @X_EXTRA_LIBS@
371X_LIBS = @X_LIBS@
372X_PRE_LIBS = @X_PRE_LIBS@
373Xcursor_cflags = @Xcursor_cflags@
374Xcursor_libs = @Xcursor_libs@
375abs_builddir = @abs_builddir@
376abs_srcdir = @abs_srcdir@
377abs_top_builddir = @abs_top_builddir@
378abs_top_srcdir = @abs_top_srcdir@
379ac_ct_CC = @ac_ct_CC@
380ac_ct_CXX = @ac_ct_CXX@
381ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
382ac_ct_OBJC = @ac_ct_OBJC@
383am__include = @am__include@
384am__leading_dot = @am__leading_dot@
385am__quote = @am__quote@
386am__tar = @am__tar@
387am__untar = @am__untar@
388bindir = @bindir@
389build = @build@
390build_alias = @build_alias@
391build_cpu = @build_cpu@
392build_os = @build_os@
393build_vendor = @build_vendor@
394builddir = @builddir@
395cocoa_ldflags = @cocoa_ldflags@
396datadir = @datadir@
397datarootdir = @datarootdir@
398dlopen_libs = @dlopen_libs@
399docdir = @docdir@
400dvidir = @dvidir@
401ecore_cocoa_cflags = @ecore_cocoa_cflags@
402ecore_cocoa_libs = @ecore_cocoa_libs@
403ecore_con_cflags = @ecore_con_cflags@
404ecore_con_libs = @ecore_con_libs@
405ecore_directfb_cflags = @ecore_directfb_cflags@
406ecore_directfb_libs = @ecore_directfb_libs@
407ecore_evas_cflags = @ecore_evas_cflags@
408ecore_evas_libs = @ecore_evas_libs@
409ecore_fb_cflags = @ecore_fb_cflags@
410ecore_fb_libs = @ecore_fb_libs@
411ecore_file_cflags = @ecore_file_cflags@
412ecore_file_libs = @ecore_file_libs@
413ecore_imf_cflags = @ecore_imf_cflags@
414ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
415ecore_imf_evas_libs = @ecore_imf_evas_libs@
416ecore_imf_libs = @ecore_imf_libs@
417ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
418ecore_imf_scim_libs = @ecore_imf_scim_libs@
419ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
420ecore_imf_xim_libs = @ecore_imf_xim_libs@
421ecore_input_cflags = @ecore_input_cflags@
422ecore_input_evas_cflags = @ecore_input_evas_cflags@
423ecore_input_evas_libs = @ecore_input_evas_libs@
424ecore_input_libs = @ecore_input_libs@
425ecore_ipc_cflags = @ecore_ipc_cflags@
426ecore_ipc_libs = @ecore_ipc_libs@
427ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
428ecore_psl1ght_libs = @ecore_psl1ght_libs@
429ecore_sdl_cflags = @ecore_sdl_cflags@
430ecore_sdl_libs = @ecore_sdl_libs@
431ecore_wayland_cflags = @ecore_wayland_cflags@
432ecore_wayland_libs = @ecore_wayland_libs@
433ecore_win32_cflags = @ecore_win32_cflags@
434ecore_win32_libs = @ecore_win32_libs@
435ecore_wince_cflags = @ecore_wince_cflags@
436ecore_wince_libs = @ecore_wince_libs@
437ecore_x_cflags = @ecore_x_cflags@
438ecore_x_libs = @ecore_x_libs@
439ecore_x_libs_private = @ecore_x_libs_private@
440efl_doxygen = @efl_doxygen@
441efl_have_doxygen = @efl_have_doxygen@
442exec_prefix = @exec_prefix@
443have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
444host = @host@
445host_alias = @host_alias@
446host_cpu = @host_cpu@
447host_os = @host_os@
448host_vendor = @host_vendor@
449htmldir = @htmldir@
450includedir = @includedir@
451infodir = @infodir@
452install_sh = @install_sh@
453libdir = @libdir@
454libexecdir = @libexecdir@
455localedir = @localedir@
456localstatedir = @localstatedir@
457lt_ECHO = @lt_ECHO@
458lt_enable_auto_import = @lt_enable_auto_import@
459mandir = @mandir@
460mkdir_p = @mkdir_p@
461oldincludedir = @oldincludedir@
462pdfdir = @pdfdir@
463pkgconfig_requires_private = @pkgconfig_requires_private@
464prefix = @prefix@
465program_transform_name = @program_transform_name@
466psdir = @psdir@
467release_info = @release_info@
468requirements_ecore = @requirements_ecore@
469requirements_ecore_cocoa = @requirements_ecore_cocoa@
470requirements_ecore_con = @requirements_ecore_con@
471requirements_ecore_directfb = @requirements_ecore_directfb@
472requirements_ecore_evas = @requirements_ecore_evas@
473requirements_ecore_fb = @requirements_ecore_fb@
474requirements_ecore_file = @requirements_ecore_file@
475requirements_ecore_imf = @requirements_ecore_imf@
476requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
477requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
478requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
479requirements_ecore_input = @requirements_ecore_input@
480requirements_ecore_input_evas = @requirements_ecore_input_evas@
481requirements_ecore_ipc = @requirements_ecore_ipc@
482requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
483requirements_ecore_sdl = @requirements_ecore_sdl@
484requirements_ecore_wayland = @requirements_ecore_wayland@
485requirements_ecore_win32 = @requirements_ecore_win32@
486requirements_ecore_wince = @requirements_ecore_wince@
487requirements_ecore_x = @requirements_ecore_x@
488rt_libs = @rt_libs@
489sbindir = @sbindir@
490sharedstatedir = @sharedstatedir@
491srcdir = @srcdir@
492sysconfdir = @sysconfdir@
493target_alias = @target_alias@
494top_build_prefix = @top_build_prefix@
495top_builddir = @top_builddir@
496top_srcdir = @top_srcdir@
497version_info = @version_info@
498x_cflags = @x_cflags@
499x_includes = @x_includes@
500x_libs = @x_libs@
501MAINTAINERCLEANFILES = Makefile.in
502@BUILD_ECORE_X_FALSE@ECORE_X_INC =
503@BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@
504@BUILD_ECORE_X_FALSE@ECORE_X_LIB =
505@BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@
506@BUILD_ECORE_FB_FALSE@ECORE_FB_INC =
507@BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb
508@BUILD_ECORE_FB_FALSE@ECORE_FB_LIB =
509@BUILD_ECORE_FB_TRUE@ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la
510@BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_INC =
511@BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@
512@BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_LIB =
513@BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la
514@BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_INC =
515@BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32
516@BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_LIB =
517@BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la
518@BUILD_ECORE_SDL_FALSE@ECORE_SDL_INC =
519@BUILD_ECORE_SDL_TRUE@ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@
520@BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIB =
521@BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la
522@BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIBADD =
523@BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB)
524@BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_INC =
525@BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa
526@BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_LIB =
527@BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la
528@BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_INC =
529@BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince
530@BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_LIB =
531@BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la
532@BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_INC =
533@BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght
534@BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB =
535@BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la
536@BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_INC =
537@BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@
538@BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIB =
539@BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la
540@BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIBADD =
541@BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB)
542@BUILD_ECORE_IPC_TRUE@ECORE_IPC_INC = \
543@BUILD_ECORE_IPC_TRUE@-I$(top_srcdir)/src/lib/ecore_ipc \
544@BUILD_ECORE_IPC_TRUE@-I$(top_builddir)/src/lib/ecore_ipc
545
546@BUILD_ECORE_IPC_TRUE@ECORE_IPC_LIB = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la
547AM_CPPFLAGS = \
548-I$(top_srcdir)/src/lib/ecore \
549-I$(top_srcdir)/src/lib/ecore_evas \
550-I$(top_srcdir)/src/lib/ecore_input \
551-I$(top_srcdir)/src/lib/ecore_input_evas \
552-I$(top_builddir)/src/lib/ecore \
553-I$(top_builddir)/src/lib/ecore_evas \
554-I$(top_builddir)/src/lib/ecore_input \
555-I$(top_builddir)/src/lib/ecore_input_evas \
556@EFL_ECORE_EVAS_BUILD@ \
557$(ECORE_X_INC) \
558$(ECORE_FB_INC) \
559$(ECORE_DIRECTFB_INC) \
560$(ECORE_WIN32_INC) \
561$(ECORE_SDL_INC) \
562$(ECORE_COCOA_INC) \
563$(ECORE_WINCE_INC) \
564$(ECORE_PSL1GHT_INC) \
565$(ECORE_WAYLAND_INC) \
566$(ECORE_IPC_INC) \
567@EVAS_CFLAGS@ \
568@EINA_CFLAGS@ \
569@EVIL_CFLAGS@ \
570@WAYLAND_EGL_CFLAGS@
571
572AM_CFLAGS = @WIN32_CFLAGS@
573lib_LTLIBRARIES = libecore_evas.la
574includes_HEADERS = Ecore_Evas.h
575includesdir = $(includedir)/ecore-@VMAJ@
576libecore_evas_la_SOURCES = \
577ecore_evas.c \
578ecore_evas_util.c \
579ecore_evas_x.c \
580ecore_evas_fb.c \
581ecore_evas_buffer.c \
582ecore_evas_directfb.c \
583ecore_evas_win32.c \
584ecore_evas_sdl.c \
585ecore_evas_cocoa.c \
586ecore_evas_wince.c \
587ecore_evas_ews.c \
588ecore_evas_psl1ght.c \
589ecore_evas_wayland_shm.c \
590ecore_evas_wayland_egl.c \
591ecore_evas_extn.c
592
593libecore_evas_la_LIBADD = \
594$(ECORE_X_LIB) \
595$(ECORE_FB_LIB) \
596$(ECORE_DIRECTFB_LIB) \
597$(ECORE_WIN32_LIB) \
598$(ECORE_SDL_LIB) \
599$(ECORE_SDL_LIBADD) \
600$(ECORE_COCOA_LIB) \
601$(ECORE_WINCE_LIB) \
602$(ECORE_IPC_LIB) \
603$(ECORE_PSL1GHT_LIB) \
604$(ECORE_WAYLAND_LIB) \
605$(ECORE_WAYLAND_LIBADD) \
606$(top_builddir)/src/lib/ecore_input/libecore_input.la \
607$(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \
608$(top_builddir)/src/lib/ecore/libecore.la \
609@EVAS_LIBS@ \
610@EINA_LIBS@ \
611@EVIL_LIBS@ \
612@SHM_OPEN_LIBS@ \
613@WAYLAND_EGL_LIBS@
614
615libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
616EXTRA_DIST = \
617ecore_evas_private.h
618
619all: all-am
620
621.SUFFIXES:
622.SUFFIXES: .c .lo .o .obj
623$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
624 @for dep in $?; do \
625 case '$(am__configure_deps)' in \
626 *$$dep*) \
627 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
628 && { if test -f $@; then exit 0; else break; fi; }; \
629 exit 1;; \
630 esac; \
631 done; \
632 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile'; \
633 $(am__cd) $(top_srcdir) && \
634 $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile
635.PRECIOUS: Makefile
636Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
637 @case '$?' in \
638 *config.status*) \
639 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
640 *) \
641 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
642 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
643 esac;
644
645$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
646 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
647
648$(top_srcdir)/configure: $(am__configure_deps)
649 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
650$(ACLOCAL_M4): $(am__aclocal_m4_deps)
651 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
652$(am__aclocal_m4_deps):
653install-libLTLIBRARIES: $(lib_LTLIBRARIES)
654 @$(NORMAL_INSTALL)
655 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
656 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
657 list2=; for p in $$list; do \
658 if test -f $$p; then \
659 list2="$$list2 $$p"; \
660 else :; fi; \
661 done; \
662 test -z "$$list2" || { \
663 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
664 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
665 }
666
667uninstall-libLTLIBRARIES:
668 @$(NORMAL_UNINSTALL)
669 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
670 for p in $$list; do \
671 $(am__strip_dir) \
672 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
673 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
674 done
675
676clean-libLTLIBRARIES:
677 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
678 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
679 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
680 test "$$dir" != "$$p" || dir=.; \
681 echo "rm -f \"$${dir}/so_locations\""; \
682 rm -f "$${dir}/so_locations"; \
683 done
684libecore_evas.la: $(libecore_evas_la_OBJECTS) $(libecore_evas_la_DEPENDENCIES)
685 $(AM_V_CCLD)$(libecore_evas_la_LINK) -rpath $(libdir) $(libecore_evas_la_OBJECTS) $(libecore_evas_la_LIBADD) $(LIBS)
686
687mostlyclean-compile:
688 -rm -f *.$(OBJEXT)
689
690distclean-compile:
691 -rm -f *.tab.c
692
693@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas.Plo@am__quote@
694@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_buffer.Plo@am__quote@
695@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@
696@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@
697@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@
698@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_extn.Plo@am__quote@
699@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@
700@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@
701@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@
702@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@
703@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_egl.Plo@am__quote@
704@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_shm.Plo@am__quote@
705@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@
706@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@
707@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@
708
709.c.o:
710@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
711@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
712@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
713@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
714@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
715@am__fastdepCC_FALSE@ $(COMPILE) -c $<
716
717.c.obj:
718@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
719@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
720@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
721@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
722@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
723@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
724
725.c.lo:
726@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
727@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
728@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
729@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
730@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
731@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
732
733mostlyclean-libtool:
734 -rm -f *.lo
735
736clean-libtool:
737 -rm -rf .libs _libs
738install-includesHEADERS: $(includes_HEADERS)
739 @$(NORMAL_INSTALL)
740 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
741 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
742 for p in $$list; do \
743 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
744 echo "$$d$$p"; \
745 done | $(am__base_list) | \
746 while read files; do \
747 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
748 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
749 done
750
751uninstall-includesHEADERS:
752 @$(NORMAL_UNINSTALL)
753 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
754 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
755 test -n "$$files" || exit 0; \
756 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
757 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
758
759ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
760 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
761 unique=`for i in $$list; do \
762 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
763 done | \
764 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
765 END { if (nonempty) { for (i in files) print i; }; }'`; \
766 mkid -fID $$unique
767tags: TAGS
768
769TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
770 $(TAGS_FILES) $(LISP)
771 set x; \
772 here=`pwd`; \
773 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
774 unique=`for i in $$list; do \
775 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
776 done | \
777 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
778 END { if (nonempty) { for (i in files) print i; }; }'`; \
779 shift; \
780 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
781 test -n "$$unique" || unique=$$empty_fix; \
782 if test $$# -gt 0; then \
783 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
784 "$$@" $$unique; \
785 else \
786 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
787 $$unique; \
788 fi; \
789 fi
790ctags: CTAGS
791CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
792 $(TAGS_FILES) $(LISP)
793 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
794 unique=`for i in $$list; do \
795 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
796 done | \
797 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
798 END { if (nonempty) { for (i in files) print i; }; }'`; \
799 test -z "$(CTAGS_ARGS)$$unique" \
800 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
801 $$unique
802
803GTAGS:
804 here=`$(am__cd) $(top_builddir) && pwd` \
805 && $(am__cd) $(top_srcdir) \
806 && gtags -i $(GTAGS_ARGS) "$$here"
807
808distclean-tags:
809 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
810
811distdir: $(DISTFILES)
812 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
813 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
814 list='$(DISTFILES)'; \
815 dist_files=`for file in $$list; do echo $$file; done | \
816 sed -e "s|^$$srcdirstrip/||;t" \
817 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
818 case $$dist_files in \
819 */*) $(MKDIR_P) `echo "$$dist_files" | \
820 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
821 sort -u` ;; \
822 esac; \
823 for file in $$dist_files; do \
824 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
825 if test -d $$d/$$file; then \
826 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
827 if test -d "$(distdir)/$$file"; then \
828 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
829 fi; \
830 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
831 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
832 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
833 fi; \
834 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
835 else \
836 test -f "$(distdir)/$$file" \
837 || cp -p $$d/$$file "$(distdir)/$$file" \
838 || exit 1; \
839 fi; \
840 done
841check-am: all-am
842check: check-am
843all-am: Makefile $(LTLIBRARIES) $(HEADERS)
844installdirs:
845 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
846 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
847 done
848install: install-am
849install-exec: install-exec-am
850install-data: install-data-am
851uninstall: uninstall-am
852
853install-am: all-am
854 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
855
856installcheck: installcheck-am
857install-strip:
858 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
859 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
860 `test -z '$(STRIP)' || \
861 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
862mostlyclean-generic:
863
864clean-generic:
865
866distclean-generic:
867 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
868 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
869
870maintainer-clean-generic:
871 @echo "This command is intended for maintainers to use"
872 @echo "it deletes files that may require special tools to rebuild."
873 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
874clean: clean-am
875
876clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
877 mostlyclean-am
878
879distclean: distclean-am
880 -rm -rf ./$(DEPDIR)
881 -rm -f Makefile
882distclean-am: clean-am distclean-compile distclean-generic \
883 distclean-tags
884
885dvi: dvi-am
886
887dvi-am:
888
889html: html-am
890
891html-am:
892
893info: info-am
894
895info-am:
896
897install-data-am: install-includesHEADERS
898
899install-dvi: install-dvi-am
900
901install-dvi-am:
902
903install-exec-am: install-libLTLIBRARIES
904
905install-html: install-html-am
906
907install-html-am:
908
909install-info: install-info-am
910
911install-info-am:
912
913install-man:
914
915install-pdf: install-pdf-am
916
917install-pdf-am:
918
919install-ps: install-ps-am
920
921install-ps-am:
922
923installcheck-am:
924
925maintainer-clean: maintainer-clean-am
926 -rm -rf ./$(DEPDIR)
927 -rm -f Makefile
928maintainer-clean-am: distclean-am maintainer-clean-generic
929
930mostlyclean: mostlyclean-am
931
932mostlyclean-am: mostlyclean-compile mostlyclean-generic \
933 mostlyclean-libtool
934
935pdf: pdf-am
936
937pdf-am:
938
939ps: ps-am
940
941ps-am:
942
943uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
944
945.MAKE: install-am install-strip
946
947.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
948 clean-libLTLIBRARIES clean-libtool ctags distclean \
949 distclean-compile distclean-generic distclean-libtool \
950 distclean-tags distdir dvi dvi-am html html-am info info-am \
951 install install-am install-data install-data-am install-dvi \
952 install-dvi-am install-exec install-exec-am install-html \
953 install-html-am install-includesHEADERS install-info \
954 install-info-am install-libLTLIBRARIES install-man install-pdf \
955 install-pdf-am install-ps install-ps-am install-strip \
956 installcheck installcheck-am installdirs maintainer-clean \
957 maintainer-clean-generic mostlyclean mostlyclean-compile \
958 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
959 tags uninstall uninstall-am uninstall-includesHEADERS \
960 uninstall-libLTLIBRARIES
961
962
963# Tell versions [3.59,3.63) of GNU make to not export all variables.
964# Otherwise a system limit (for SysV at least) may be exceeded.
965.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c
deleted file mode 100644
index 6ecd609..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c
+++ /dev/null
@@ -1,2855 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <string.h>
7#include <sys/types.h>
8#include <errno.h>
9#include <sys/stat.h>
10#include <fcntl.h>
11
12#ifndef _MSC_VER
13# include <unistd.h>
14#endif
15
16#ifdef HAVE_SYS_MMAN_H
17# include <sys/mman.h>
18#endif
19
20#ifdef HAVE_EVIL
21# include <Evil.h>
22#endif
23
24#include "Ecore.h"
25#include "ecore_private.h"
26#include "Ecore_Input.h"
27
28#include "ecore_evas_private.h"
29#include "Ecore_Evas.h"
30
31Eina_Bool _ecore_evas_app_comp_sync = 1;
32int _ecore_evas_log_dom = -1;
33static int _ecore_evas_init_count = 0;
34static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL;
35static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
36
37static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
38static Ecore_Evas *ecore_evases = NULL;
39static int _ecore_evas_fps_debug = 0;
40
41static Eina_Bool
42_ecore_evas_idle_enter(void *data __UNUSED__)
43{
44 Ecore_Evas *ee;
45 double t1 = 0.0;
46 double t2 = 0.0;
47 int rend = 0;
48
49 if (!ecore_evases) return ECORE_CALLBACK_RENEW;
50 if (_ecore_evas_fps_debug)
51 {
52 t1 = ecore_time_get();
53 }
54 EINA_INLIST_FOREACH(ecore_evases, ee)
55 {
56 if (!ee->manual_render)
57 {
58 if (ee->engine.func->fn_render)
59 rend |= ee->engine.func->fn_render(ee);
60 }
61 }
62 if (_ecore_evas_fps_debug)
63 {
64 t2 = ecore_time_get();
65 if (rend)
66 _ecore_evas_fps_debug_rendertime_add(t2 - t1);
67 }
68 return ECORE_CALLBACK_RENEW;
69}
70
71/**
72 * Query if a particular renginering engine target has support
73 * @param engine The engine to check support for
74 * @return 1 if the particular engine is supported, 0 if it is not
75 *
76 * Query if engine @param engine is supported by ecore_evas. 1 is returned if
77 * it is, and 0 is returned if it is not supported.
78 */
79EAPI int
80ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
81{
82 switch (engine)
83 {
84 case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
85#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
86 return EINA_TRUE;
87#else
88 return EINA_FALSE;
89#endif
90 case ECORE_EVAS_ENGINE_SOFTWARE_XLIB:
91#ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB
92 return EINA_TRUE;
93#else
94 return EINA_FALSE;
95#endif
96 case ECORE_EVAS_ENGINE_XRENDER_X11:
97 return EINA_FALSE;
98 case ECORE_EVAS_ENGINE_OPENGL_X11:
99#ifdef BUILD_ECORE_EVAS_OPENGL_X11
100 return EINA_TRUE;
101#else
102 return EINA_FALSE;
103#endif
104 case ECORE_EVAS_ENGINE_SOFTWARE_XCB:
105#ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
106 return EINA_TRUE;
107#else
108 return EINA_FALSE;
109#endif
110 case ECORE_EVAS_ENGINE_XRENDER_XCB:
111 return EINA_FALSE;
112 case ECORE_EVAS_ENGINE_SOFTWARE_GDI:
113#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
114 return EINA_TRUE;
115#else
116 return EINA_FALSE;
117#endif
118 case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW:
119#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
120 return EINA_TRUE;
121#else
122 return EINA_FALSE;
123#endif
124 case ECORE_EVAS_ENGINE_DIRECT3D:
125#ifdef BUILD_ECORE_EVAS_DIRECT3D
126 return EINA_TRUE;
127#else
128 return EINA_FALSE;
129#endif
130 case ECORE_EVAS_ENGINE_OPENGL_GLEW:
131#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
132 return EINA_TRUE;
133#else
134 return EINA_FALSE;
135#endif
136 case ECORE_EVAS_ENGINE_SOFTWARE_SDL:
137#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
138 return EINA_TRUE;
139#else
140 return EINA_FALSE;
141#endif
142 case ECORE_EVAS_ENGINE_OPENGL_SDL:
143#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
144 return EINA_TRUE;
145#else
146 return EINA_FALSE;
147#endif
148 case ECORE_EVAS_ENGINE_DIRECTFB:
149#ifdef BUILD_ECORE_EVAS_DIRECTFB
150 return EINA_TRUE;
151#else
152 return EINA_FALSE;
153#endif
154 case ECORE_EVAS_ENGINE_SOFTWARE_FB:
155#ifdef BUILD_ECORE_EVAS_FB
156 return EINA_TRUE;
157#else
158 return EINA_FALSE;
159#endif
160
161 case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
162#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
163 return EINA_TRUE;
164#else
165 return EINA_FALSE;
166#endif
167
168 case ECORE_EVAS_ENGINE_SOFTWARE_16_X11:
169#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
170 return EINA_TRUE;
171#else
172 return EINA_FALSE;
173#endif
174 case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW:
175#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
176 return EINA_TRUE;
177#else
178 return EINA_FALSE;
179#endif
180 case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE:
181#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
182 return EINA_TRUE;
183#else
184 return EINA_FALSE;
185#endif
186 case ECORE_EVAS_ENGINE_OPENGL_COCOA:
187#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
188 return EINA_TRUE;
189#else
190 return EINA_FALSE;
191#endif
192 case ECORE_EVAS_ENGINE_EWS:
193#ifdef BUILD_ECORE_EVAS_EWS
194 return EINA_TRUE;
195#else
196 return EINA_FALSE;
197#endif
198 case ECORE_EVAS_ENGINE_PSL1GHT:
199#ifdef BUILD_ECORE_EVAS_PSL1GHT
200 return EINA_TRUE;
201#else
202 return EINA_FALSE;
203#endif
204 case ECORE_EVAS_ENGINE_WAYLAND_SHM:
205#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
206 return EINA_TRUE;
207#else
208 return EINA_FALSE;
209#endif
210 case ECORE_EVAS_ENGINE_WAYLAND_EGL:
211#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
212 return EINA_TRUE;
213#else
214 return EINA_FALSE;
215#endif
216 default:
217 return EINA_FALSE;
218 };
219}
220
221EAPI int
222ecore_evas_init(void)
223{
224 int fd;
225
226 if (++_ecore_evas_init_count != 1)
227 return _ecore_evas_init_count;
228
229 if (!evas_init())
230 return --_ecore_evas_init_count;
231
232 if (!ecore_init())
233 goto shutdown_evas;
234
235 _ecore_evas_log_dom = eina_log_domain_register
236 ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR);
237 if(_ecore_evas_log_dom < 0)
238 {
239 EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.");
240 goto shutdown_ecore;
241 }
242
243 fd = evas_async_events_fd_get();
244 if (fd > 0)
245 _ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd,
246 ECORE_FD_READ,
247 _ecore_evas_async_events_fd_handler, NULL,
248 NULL, NULL);
249
250 ecore_evas_idle_enterer =
251 ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL);
252 if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
253 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
254
255#ifdef BUILD_ECORE_EVAS_EWS
256 _ecore_evas_ews_events_init();
257#endif
258
259 _ecore_evas_extn_init();
260
261 if (getenv("ECORE_EVAS_COMP_NOSYNC"))
262 _ecore_evas_app_comp_sync = 0;
263 return _ecore_evas_init_count;
264
265 shutdown_ecore:
266 ecore_shutdown();
267 shutdown_evas:
268 evas_shutdown();
269
270 return --_ecore_evas_init_count;
271}
272
273EAPI int
274ecore_evas_shutdown(void)
275{
276 if (--_ecore_evas_init_count != 0)
277 return _ecore_evas_init_count;
278
279 while (ecore_evases) _ecore_evas_free(ecore_evases);
280
281 _ecore_evas_extn_shutdown();
282
283 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
284 ecore_idle_enterer_del(ecore_evas_idle_enterer);
285 ecore_evas_idle_enterer = NULL;
286
287#ifdef BUILD_ECORE_EVAS_X11
288 while (_ecore_evas_x_shutdown());
289#endif
290#ifdef BUILD_ECORE_EVAS_WIN32
291 while (_ecore_evas_win32_shutdown());
292#endif
293#ifdef BUILD_ECORE_EVAS_FB
294 while (_ecore_evas_fb_shutdown());
295#endif
296#ifdef BUILD_ECORE_EVAS_EWS
297 while (_ecore_evas_ews_shutdown());
298#endif
299#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
300 while (_ecore_evas_buffer_shutdown());
301#endif
302#ifdef BUILD_ECORE_EVAS_DIRECTFB
303 while (_ecore_evas_directfb_shutdown());
304#endif
305#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
306 while (_ecore_evas_wince_shutdown());
307#endif
308
309 if (_ecore_evas_async_events_fd)
310 ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
311
312 eina_log_domain_unregister(_ecore_evas_log_dom);
313 _ecore_evas_log_dom = -1;
314 ecore_shutdown();
315 evas_shutdown();
316
317 return _ecore_evas_init_count;
318}
319
320EAPI void
321ecore_evas_app_comp_sync_set(Eina_Bool do_sync)
322{
323 _ecore_evas_app_comp_sync = do_sync;
324}
325
326EAPI Eina_Bool
327ecore_evas_app_comp_sync_get(void)
328{
329 return _ecore_evas_app_comp_sync;
330}
331
332struct ecore_evas_engine {
333 const char *name;
334 Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options);
335};
336
337/* inline is just to avoid need to ifdef around it */
338static inline const char *
339_ecore_evas_parse_extra_options_str(const char *extra_options, const char *key, char **value)
340{
341 int len = strlen(key);
342
343 while (extra_options)
344 {
345 const char *p;
346
347 if (strncmp(extra_options, key, len) != 0)
348 {
349 extra_options = strchr(extra_options, ';');
350 if (extra_options)
351 extra_options++;
352 continue;
353 }
354
355 extra_options += len;
356 p = strchr(extra_options, ';');
357 if (p)
358 {
359 len = p - extra_options;
360 *value = malloc(len + 1);
361 memcpy(*value, extra_options, len);
362 (*value)[len] = '\0';
363 extra_options = p + 1;
364 }
365 else
366 {
367 *value = strdup(extra_options);
368 extra_options = NULL;
369 }
370 }
371 return extra_options;
372}
373
374/* inline is just to avoid need to ifdef around it */
375static inline const char *
376_ecore_evas_parse_extra_options_uint(const char *extra_options, const char *key, unsigned int *value)
377{
378 int len = strlen(key);
379
380 while (extra_options)
381 {
382 const char *p;
383
384 if (strncmp(extra_options, key, len) != 0)
385 {
386 extra_options = strchr(extra_options, ';');
387 if (extra_options)
388 extra_options++;
389 continue;
390 }
391
392 extra_options += len;
393 *value = strtol(extra_options, NULL, 0);
394
395 p = strchr(extra_options, ';');
396 if (p)
397 extra_options = p + 1;
398 else
399 extra_options = NULL;
400 }
401 return extra_options;
402}
403
404/* inline is just to avoid need to ifdef around it */
405static inline const char *
406_ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, unsigned int *parent)
407{
408 _ecore_evas_parse_extra_options_str(extra_options, "display=", disp_name);
409 _ecore_evas_parse_extra_options_uint(extra_options, "parent=", parent);
410 return extra_options;
411}
412
413#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
414static Ecore_Evas *
415_ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options)
416{
417 unsigned int parent = 0;
418 char *disp_name = NULL;
419 Ecore_Evas *ee;
420
421 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
422 ee = ecore_evas_software_x11_new(disp_name, parent, x, y, w, h);
423 free(disp_name);
424
425 return ee;
426}
427#endif
428
429#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
430static Ecore_Evas *
431_ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options)
432{
433 char *name = NULL;
434 Ecore_Evas *ee;
435
436 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
437 ee = ecore_evas_cocoa_new(NULL, x, y, w, h);
438 free(name);
439
440 if (ee) ecore_evas_move(ee, x, y);
441 return ee;
442}
443#endif
444
445#ifdef BUILD_ECORE_EVAS_OPENGL_X11
446static Ecore_Evas *
447_ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options)
448{
449 Ecore_X_Window parent = 0;
450 char *disp_name = NULL;
451 Ecore_Evas *ee;
452
453 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
454 ee = ecore_evas_gl_x11_new(disp_name, parent, x, y, w, h);
455 free(disp_name);
456
457 return ee;
458}
459#endif
460
461#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
462static Ecore_Evas *
463_ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options)
464{
465 Ecore_X_Window parent = 0;
466 char *disp_name = NULL;
467 Ecore_Evas *ee;
468
469 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
470 ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h);
471 free(disp_name);
472
473 return ee;
474}
475#endif
476
477#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
478static Ecore_Evas *
479_ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options)
480{
481 Ecore_X_Window parent = 0;
482 char *disp_name = NULL;
483 Ecore_Evas *ee;
484
485 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
486 ee = ecore_evas_software_x11_16_new(disp_name, parent, x, y, w, h);
487 free(disp_name);
488
489 return ee;
490}
491#endif
492
493#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
494static Ecore_Evas *
495_ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
496{
497 Ecore_Evas *ee;
498 unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0;
499 char *name = NULL;
500
501 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
502 _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
503 _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface);
504 _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe);
505 _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha);
506
507 ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha);
508 free(name);
509
510 return ee;
511}
512#endif
513
514#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
515static Ecore_Evas *
516_ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
517{
518 Ecore_Evas *ee;
519 unsigned int fullscreen = 0, noframe = 0;
520 char *name = NULL;
521
522 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
523 _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
524 _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe);
525
526 ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe);
527 free(name);
528
529 return ee;
530}
531#endif
532
533#ifdef BUILD_ECORE_EVAS_DIRECTFB
534static Ecore_Evas *
535_ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options)
536{
537 Ecore_Evas *ee;
538 char *disp_name = NULL;
539 unsigned int windowed = 1;
540
541 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
542 _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed);
543
544 ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h);
545 free(disp_name);
546
547 return ee;
548}
549#endif
550
551#ifdef BUILD_ECORE_EVAS_FB
552static Ecore_Evas *
553_ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
554{
555 Ecore_Evas *ee;
556 char *disp_name = NULL;
557 unsigned int rotation = 0;
558
559 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
560 _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
561
562 ee = ecore_evas_fb_new(disp_name, rotation, w, h);
563 free(disp_name);
564
565 return ee;
566}
567#endif
568
569
570#ifdef BUILD_ECORE_EVAS_PSL1GHT
571static Ecore_Evas *
572_ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
573{
574 Ecore_Evas *ee;
575 char *name = NULL;
576
577 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
578 ee = ecore_evas_psl1ght_new(name, w, h);
579 free(name);
580
581 if (ee) ecore_evas_move(ee, x, y);
582 return ee;
583}
584#endif
585
586#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
587static Ecore_Evas *
588_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
589{
590 char *disp_name = NULL;
591 unsigned int frame = 0, parent = 0;
592 Ecore_Evas *ee;
593
594 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
595 _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
596 _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
597 ee = ecore_evas_wayland_shm_new(disp_name, parent, x, y, w, h, frame);
598 free(disp_name);
599
600 return ee;
601}
602#endif
603
604#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
605static Ecore_Evas *
606_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
607{
608 char *disp_name = NULL;
609 unsigned int frame = 0, parent = 0;
610 Ecore_Evas *ee;
611
612 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
613 _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
614 _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
615 ee = ecore_evas_wayland_egl_new(disp_name, parent, x, y, w, h, frame);
616 free(disp_name);
617
618 return ee;
619}
620#endif
621
622#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
623static Ecore_Evas *
624_ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options)
625{
626 return ecore_evas_software_gdi_new(NULL, x, y, w, h);
627}
628#endif
629
630#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
631static Ecore_Evas *
632_ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options)
633{
634 return ecore_evas_software_ddraw_new(NULL, x, y, w, h);
635}
636#endif
637
638#ifdef BUILD_ECORE_EVAS_DIRECT3D
639static Ecore_Evas *
640_ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options)
641{
642 return ecore_evas_direct3d_new(NULL, x, y, w, h);
643}
644#endif
645
646#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
647static Ecore_Evas *
648_ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options)
649{
650 return ecore_evas_gl_glew_new(NULL, x, y, w, h);
651}
652#endif
653
654#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
655static Ecore_Evas *
656_ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options)
657{
658 return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h);
659}
660#endif
661
662#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
663static Ecore_Evas *
664_ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__)
665{
666 return ecore_evas_software_wince_new(NULL, x, y, w, h);
667}
668
669static Ecore_Evas *
670_ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__)
671{
672 return ecore_evas_software_wince_fb_new(NULL, x, y, w, h);
673}
674
675static Ecore_Evas *
676_ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
677{
678 return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h);
679}
680
681static Ecore_Evas *
682_ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
683{
684 return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h);
685}
686#endif
687
688#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
689static Ecore_Evas *
690_ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__)
691{
692 return ecore_evas_buffer_new(w, h);
693}
694#endif
695
696#ifdef BUILD_ECORE_EVAS_EWS
697static Ecore_Evas *
698_ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__)
699{
700 return ecore_evas_ews_new(x, y, w, h);
701}
702#endif
703
704/* note: keep sorted by priority, highest first */
705static const struct ecore_evas_engine _engines[] = {
706 /* unix */
707#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
708 {"software_x11", _ecore_evas_constructor_software_x11},
709#endif
710#ifdef BUILD_ECORE_EVAS_OPENGL_X11
711 {"opengl_x11", _ecore_evas_constructor_opengl_x11},
712#endif
713#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
714 {"software_8_x11", _ecore_evas_constructor_software_8_x11},
715#endif
716#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
717 {"software_16_x11", _ecore_evas_constructor_software_16_x11},
718#endif
719#ifdef BUILD_ECORE_EVAS_DIRECTFB
720 {"directfb", _ecore_evas_constructor_directfb},
721#endif
722#ifdef BUILD_ECORE_EVAS_FB
723 {"fb", _ecore_evas_constructor_fb},
724#endif
725
726 /* windows */
727#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
728 {"software_gdi", _ecore_evas_constructor_software_gdi},
729#endif
730#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
731 {"software_ddraw", _ecore_evas_constructor_software_ddraw},
732#endif
733#ifdef BUILD_ECORE_EVAS_DIRECT3D
734 {"direct3d", _ecore_evas_constructor_direct3d},
735#endif
736#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
737 {"opengl_glew", _ecore_evas_constructor_opengl_glew},
738#endif
739#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
740 {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw},
741#endif
742#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
743 {"software_16_wince", _ecore_evas_constructor_software_16_wince},
744 {"software_16_wince_fb", _ecore_evas_constructor_software_16_wince_fb},
745 {"software_16_wince_gapi", _ecore_evas_constructor_software_16_wince_gapi},
746 {"software_16_wince_gdi", _ecore_evas_constructor_software_16_wince_gdi},
747#endif
748
749 /* Apple */
750#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
751 {"opengl_cocoa", _ecore_evas_constructor_cocoa},
752#endif
753
754 /* PS3 support */
755#ifdef BUILD_ECORE_EVAS_PSL1GHT
756 {"psl1ght", _ecore_evas_constructor_psl1ght},
757#endif
758
759 /* Wayland */
760#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
761 {"wayland_shm", _ecore_evas_constructor_wayland_shm},
762#endif
763
764#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
765 {"wayland_egl", _ecore_evas_constructor_wayland_egl},
766#endif
767
768 /* Last chance to have a window */
769#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
770 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
771#endif
772
773#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
774 {"sdl", _ecore_evas_constructor_sdl},
775#endif
776
777 /* independent */
778#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
779 {"buffer", _ecore_evas_constructor_buffer},
780#endif
781
782#ifdef BUILD_ECORE_EVAS_EWS
783 {"ews", _ecore_evas_constructor_ews},
784#endif
785 {NULL, NULL}
786};
787
788EAPI Eina_List *
789ecore_evas_engines_get(void)
790{
791 const struct ecore_evas_engine *itr;
792 Eina_List *lst = NULL;
793
794 for (itr = _engines; itr->name; itr++)
795 lst = eina_list_append(lst, itr->name);
796
797 return lst;
798}
799
800EAPI void
801ecore_evas_engines_free(Eina_List *engines)
802{
803 eina_list_free(engines);
804}
805
806static Ecore_Evas *
807_ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options)
808{
809 const struct ecore_evas_engine *itr;
810
811 DBG("auto discover engine");
812
813 for (itr = _engines; itr->constructor; itr++)
814 {
815 Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options);
816 if (ee)
817 {
818 INF("auto discovered '%s'", itr->name);
819 return ee;
820 }
821 }
822
823 WRN("could not auto discover.");
824 return NULL;
825}
826
827EAPI Ecore_Evas *
828ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
829{
830 const struct ecore_evas_engine *itr;
831
832 if (!engine_name)
833 {
834 engine_name = getenv("ECORE_EVAS_ENGINE");
835 if (engine_name)
836 DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'",
837 engine_name);
838 }
839 if (!engine_name)
840 return _ecore_evas_new_auto_discover(x, y, w, h, extra_options);
841
842 for (itr = _engines; itr->name; itr++)
843 if (strcmp(itr->name, engine_name) == 0)
844 {
845 INF("using engine '%s', extra_options=%s",
846 engine_name, extra_options ? extra_options : "(null)");
847 return itr->constructor(x, y, w, h, extra_options);
848 }
849
850 WRN("unknown engine '%s'", engine_name);
851 return NULL;
852}
853
854EAPI const char *
855ecore_evas_engine_name_get(const Ecore_Evas *ee)
856{
857 if (!ee)
858 return NULL;
859 return ee->driver;
860}
861
862EAPI Ecore_Evas *
863ecore_evas_ecore_evas_get(const Evas *e)
864{
865 Ecore_Evas *ee = evas_data_attach_get(e);
866 if (!ee) return NULL;
867 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
868 {
869 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get");
870 return NULL;
871 }
872 return ee;
873}
874
875EAPI void
876ecore_evas_free(Ecore_Evas *ee)
877{
878 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
879 {
880 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
881 "ecore_evas_free");
882 return;
883 }
884 _ecore_evas_free(ee);
885 return;
886}
887
888EAPI void *
889ecore_evas_data_get(const Ecore_Evas *ee, const char *key)
890{
891 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
892 {
893 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
894 "ecore_evas_data_get");
895 return NULL;
896 }
897
898 if (!key) return NULL;
899 if (!ee->data) return NULL;
900
901 return eina_hash_find(ee->data, key);
902}
903
904EAPI void
905ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
906{
907 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
908 {
909 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
910 "ecore_evas_data_set");
911 return;
912 }
913
914 if (!key) return;
915
916 if (ee->data)
917 eina_hash_del(ee->data, key, NULL);
918 if (data)
919 {
920 if (!ee->data)
921 ee->data = eina_hash_string_superfast_new(NULL);
922 eina_hash_add(ee->data, key, data);
923 }
924}
925
926#define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn
927#define IFE return;}
928
929EAPI void
930ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
931{
932 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
933 {
934 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
935 "ecore_evas_callback_resize_set");
936 return;
937 }
938 IFC(ee, fn_callback_resize_set) (ee, func);
939 IFE;
940 ee->func.fn_resize = func;
941}
942
943EAPI void
944ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
945{
946 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
947 {
948 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
949 "ecore_evas_callback_move_set");
950 return;
951 }
952 IFC(ee, fn_callback_move_set) (ee, func);
953 IFE;
954 ee->func.fn_move = func;
955}
956
957EAPI void
958ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
959{
960 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
961 {
962 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
963 "ecore_evas_callback_show_set");
964 return;
965 }
966 IFC(ee, fn_callback_show_set) (ee, func);
967 IFE;
968 ee->func.fn_show = func;
969}
970
971EAPI void
972ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
973{
974 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
975 {
976 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
977 "ecore_evas_callback_hide_set");
978 return;
979 }
980 IFC(ee, fn_callback_hide_set) (ee, func);
981 IFE;
982 ee->func.fn_hide = func;
983}
984
985EAPI void
986ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
987{
988 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
989 {
990 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
991 "ecore_evas_callback_delete_request_set");
992 return;
993 }
994 IFC(ee, fn_callback_delete_request_set) (ee, func);
995 IFE;
996 ee->func.fn_delete_request = func;
997}
998
999EAPI void
1000ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1001{
1002 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1003 {
1004 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1005 "ecore_evas_callback_destroy_set");
1006 return;
1007 }
1008 IFC(ee, fn_callback_destroy_set) (ee, func);
1009 IFE;
1010 ee->func.fn_destroy = func;
1011}
1012
1013EAPI void
1014ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1015{
1016 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1017 {
1018 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1019 "ecore_evas_callback_focus_in_set");
1020 return;
1021 }
1022 IFC(ee, fn_callback_focus_in_set) (ee, func);
1023 IFE;
1024 ee->func.fn_focus_in = func;
1025}
1026
1027EAPI void
1028ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1029{
1030 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1031 {
1032 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1033 "ecore_evas_callback_focus_out_set");
1034 return;
1035 }
1036 IFC(ee, fn_callback_focus_out_set) (ee, func);
1037 IFE;
1038 ee->func.fn_focus_out = func;
1039}
1040
1041EAPI void
1042ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1043{
1044 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1045 {
1046 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1047 "ecore_evas_callback_sticky_set");
1048 return;
1049 }
1050 IFC(ee, fn_callback_sticky_set) (ee, func);
1051 IFE;
1052 ee->func.fn_sticky = func;
1053}
1054
1055EAPI void
1056ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1057{
1058 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1059 {
1060 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1061 "ecore_evas_callback_unsticky_set");
1062 return;
1063 }
1064 IFC(ee, fn_callback_unsticky_set) (ee, func);
1065 IFE;
1066 ee->func.fn_unsticky = func;
1067}
1068
1069EAPI void
1070ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1071{
1072 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1073 {
1074 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1075 "ecore_evas_callback_mouse_in_set");
1076 return;
1077 }
1078 IFC(ee, fn_callback_mouse_in_set) (ee, func);
1079 IFE;
1080 ee->func.fn_mouse_in = func;
1081}
1082
1083EAPI void
1084ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1085{
1086 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1087 {
1088 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1089 "ecore_evas_callback_mouse_out_set");
1090 return;
1091 }
1092 IFC(ee, fn_callback_mouse_out_set) (ee, func);
1093 IFE;
1094 ee->func.fn_mouse_out = func;
1095}
1096
1097EAPI void
1098ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1099{
1100 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1101 {
1102 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1103 "ecore_evas_callback_pre_render_set");
1104 return;
1105 }
1106 IFC(ee, fn_callback_pre_render_set) (ee, func);
1107 IFE;
1108 ee->func.fn_pre_render = func;
1109}
1110
1111EAPI void
1112ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1113{
1114 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1115 {
1116 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1117 "ecore_evas_callback_post_render_set");
1118 return;
1119 }
1120 IFC(ee, fn_callback_post_render_set) (ee, func);
1121 IFE;
1122 ee->func.fn_post_render = func;
1123}
1124
1125EAPI void
1126ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1127{
1128 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1129 {
1130 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1131 "ecore_evas_callback_pre_free_set");
1132 return;
1133 }
1134 ee->func.fn_pre_free = func;
1135}
1136
1137EAPI void
1138ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1139{
1140 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1141 {
1142 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1143 "ecore_evas_callback_state_change_set");
1144 return;
1145 }
1146 ee->func.fn_state_change = func;
1147}
1148
1149/**
1150 * Get an Ecore_Evas's Evas
1151 * @param ee The Ecore_Evas whose Evas you wish to get
1152 * @return The Evas wrapped by @p ee
1153 *
1154 * This function returns the Evas contained within @p ee.
1155 */
1156EAPI Evas *
1157ecore_evas_get(const Ecore_Evas *ee)
1158{
1159 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1160 {
1161 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1162 "ecore_evas_get");
1163 return NULL;
1164 }
1165 return ee->evas;
1166}
1167
1168EAPI void
1169ecore_evas_move(Ecore_Evas *ee, int x, int y)
1170{
1171 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1172 {
1173 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1174 "ecore_evas_move");
1175 return;
1176 }
1177 if (ee->prop.fullscreen) return;
1178 IFC(ee, fn_move) (ee, x, y);
1179 IFE;
1180}
1181
1182/**
1183 * Provide Managed move co-ordinates for an Ecore_Evas
1184 * @param ee The Ecore_Evas to move
1185 * @param x The x coordinate to set as the managed location
1186 * @param y The y coordinate to set as the managed location
1187 *
1188 * This sets the managed geometry position of the @p ee to (@p x, @p y)
1189 */
1190EAPI void
1191ecore_evas_managed_move(Ecore_Evas *ee, int x, int y)
1192{
1193 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1194 {
1195 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1196 "ecore_evas_move");
1197 return;
1198 }
1199 IFC(ee, fn_managed_move) (ee, x, y);
1200 IFE;
1201}
1202
1203EAPI void
1204ecore_evas_resize(Ecore_Evas *ee, int w, int h)
1205{
1206 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1207 {
1208 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1209 "ecore_evas_resize");
1210 return;
1211 }
1212 if (ee->prop.fullscreen) return;
1213 if (w < 1) w = 1;
1214 if (h < 1) h = 1;
1215 if ((ee->rotation == 90) || (ee->rotation == 270))
1216 {
1217 IFC(ee, fn_resize) (ee, h, w);
1218 IFE;
1219 }
1220 else
1221 {
1222 IFC(ee, fn_resize) (ee, w, h);
1223 IFE;
1224 }
1225}
1226
1227EAPI void
1228ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1229{
1230 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1231 {
1232 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1233 "ecore_evas_move_resize");
1234 return;
1235 }
1236 if (ee->prop.fullscreen) return;
1237 if (w < 1) w = 1;
1238 if (h < 1) h = 1;
1239 if ((ee->rotation == 90) || (ee->rotation == 270))
1240 {
1241 IFC(ee, fn_move_resize) (ee, x, y, h, w);
1242 IFE;
1243 }
1244 else
1245 {
1246 IFC(ee, fn_move_resize) (ee, x, y, w, h);
1247 IFE;
1248 }
1249}
1250
1251EAPI void
1252ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1253{
1254 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1255 {
1256 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1257 "ecore_evas_geometry_get");
1258 return;
1259 }
1260 if ((ee->rotation == 90) || (ee->rotation == 270))
1261 {
1262 if (x) *x = ee->x;
1263 if (y) *y = ee->y;
1264 if (w) *w = ee->h;
1265 if (h) *h = ee->w;
1266 }
1267 else
1268 {
1269 if (x) *x = ee->x;
1270 if (y) *y = ee->y;
1271 if (w) *w = ee->w;
1272 if (h) *h = ee->h;
1273 }
1274}
1275
1276EAPI void
1277ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1278{
1279 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1280 {
1281 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1282 "ecore_evas_request_geometry_get");
1283 return;
1284 }
1285 if ((ee->rotation == 90) || (ee->rotation == 270))
1286 {
1287 if (x) *x = ee->req.x;
1288 if (y) *y = ee->req.y;
1289 if (w) *w = ee->req.h;
1290 if (h) *h = ee->req.w;
1291 }
1292 else
1293 {
1294 if (x) *x = ee->req.x;
1295 if (y) *y = ee->req.y;
1296 if (w) *w = ee->req.w;
1297 if (h) *h = ee->req.h;
1298 }
1299}
1300
1301EAPI void
1302ecore_evas_rotation_set(Ecore_Evas *ee, int rot)
1303{
1304 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1305 {
1306 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1307 "ecore_evas_rotation_set");
1308 return;
1309 }
1310 rot = rot % 360;
1311 while (rot < 0) rot += 360;
1312 while (rot >= 360) rot -= 360;
1313 IFC(ee, fn_rotation_set) (ee, rot, 0);
1314 /* make sure everything gets redrawn */
1315 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1316 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1317 IFE;
1318}
1319
1320EAPI void
1321ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot)
1322{
1323 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1324 {
1325 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1326 "ecore_evas_rotation_set");
1327 return;
1328 }
1329 rot = rot % 360;
1330 while (rot < 0) rot += 360;
1331 while (rot >= 360) rot -= 360;
1332 IFC(ee, fn_rotation_set) (ee, rot, 1);
1333 /* make sure everything gets redrawn */
1334 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1335 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1336 IFE;
1337}
1338
1339EAPI int
1340ecore_evas_rotation_get(const Ecore_Evas *ee)
1341{
1342 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1343 {
1344 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1345 "ecore_evas_rotation_get");
1346 return 0;
1347 }
1348 return ee->rotation;
1349}
1350
1351/**
1352 * Set whether an Ecore_Evas is shaped or not.
1353 * @param ee The Ecore_Evas to shape
1354 * @param shaped EINA_TRUE to shape, EINA_FALSE to not
1355 *
1356 * This function allows one to make an Ecore_Evas shaped to the contents of the
1357 * evas. If @p shaped is EINA_TRUE, @p ee will be transparent in parts of the evas that
1358 * contain no objects. If @p shaped is EINA_FALSE, then @p ee will be rectangular, and
1359 * and parts with no data will show random framebuffer artifacting. For
1360 * non-shaped Ecore_Evases, it is recommend to cover the entire evas with a
1361 * background object.
1362 */
1363EAPI void
1364ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped)
1365{
1366 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1367 {
1368 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1369 "ecore_evas_shaped_set");
1370 return;
1371 }
1372 IFC(ee, fn_shaped_set) (ee, shaped);
1373 IFE;
1374}
1375
1376/**
1377 * Query whether an Ecore_Evas is shaped or not.
1378 * @param ee The Ecore_Evas to query.
1379 * @return EINA_TRUE if shaped, EINA_FALSE if not.
1380 *
1381 * This function returns EINA_TRUE if @p ee is shaped, and EINA_FALSE if not.
1382 */
1383EAPI Eina_Bool
1384ecore_evas_shaped_get(const Ecore_Evas *ee)
1385{
1386 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1387 {
1388 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1389 "ecore_evas_shaped_get");
1390 return EINA_FALSE;
1391 }
1392 return ee->shaped ? EINA_TRUE : EINA_FALSE;
1393}
1394
1395EAPI void
1396ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha)
1397{
1398 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1399 {
1400 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1401 "ecore_evas_alpha_set");
1402 return;
1403 }
1404 IFC(ee, fn_alpha_set) (ee, alpha);
1405 IFE;
1406}
1407
1408EAPI Eina_Bool
1409ecore_evas_alpha_get(const Ecore_Evas *ee)
1410{
1411 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1412 {
1413 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1414 "ecore_evas_alpha_get");
1415 return EINA_FALSE;
1416 }
1417 return ee->alpha ? EINA_TRUE : EINA_FALSE;
1418}
1419
1420EAPI void
1421ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent)
1422{
1423 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1424 {
1425 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1426 "ecore_evas_transparent_set");
1427 return;
1428 }
1429 IFC(ee, fn_transparent_set) (ee, transparent);
1430 IFE;
1431}
1432
1433EAPI Eina_Bool
1434ecore_evas_transparent_get(const Ecore_Evas *ee)
1435{
1436 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1437 {
1438 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1439 "ecore_evas_transparent_get");
1440 return EINA_FALSE;
1441 }
1442 return ee->transparent ? EINA_TRUE : 0;
1443}
1444
1445EAPI void
1446ecore_evas_show(Ecore_Evas *ee)
1447{
1448 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1449 {
1450 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1451 "ecore_evas_show");
1452 return;
1453 }
1454 IFC(ee, fn_show) (ee);
1455 IFE;
1456}
1457
1458EAPI void
1459ecore_evas_hide(Ecore_Evas *ee)
1460{
1461 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1462 {
1463 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1464 "ecore_evas_hide");
1465 return;
1466 }
1467 IFC(ee, fn_hide) (ee);
1468 IFE;
1469}
1470
1471 EAPI int
1472ecore_evas_visibility_get(const Ecore_Evas *ee)
1473{
1474 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1475 {
1476 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1477 "ecore_evas_visibility_get");
1478 return 0;
1479 }
1480 return ee->visible ? 1:0;
1481}
1482
1483EAPI void
1484ecore_evas_raise(Ecore_Evas *ee)
1485{
1486 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1487 {
1488 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1489 "ecore_evas_raise");
1490 return;
1491 }
1492 IFC(ee, fn_raise) (ee);
1493 IFE;
1494}
1495
1496EAPI void
1497ecore_evas_lower(Ecore_Evas *ee)
1498{
1499 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1500 {
1501 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1502 "ecore_evas_lower");
1503 return;
1504 }
1505 IFC(ee, fn_lower) (ee);
1506 IFE;
1507}
1508
1509/**
1510 * Activate (set focus to, via the window manager) an Ecore_Evas' window.
1511 * @param ee The Ecore_Evas to activate.
1512 *
1513 * This functions activates the Ecore_Evas.
1514 */
1515EAPI void
1516ecore_evas_activate(Ecore_Evas *ee)
1517{
1518 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1519 {
1520 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1521 "ecore_evas_activate");
1522 return;
1523 }
1524 IFC(ee, fn_activate) (ee);
1525 IFE;
1526}
1527
1528EAPI void
1529ecore_evas_title_set(Ecore_Evas *ee, const char *t)
1530{
1531 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1532 {
1533 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1534 "ecore_evas_title_set");
1535 return;
1536 }
1537 IFC(ee, fn_title_set) (ee, t);
1538 IFE;
1539}
1540
1541EAPI const char *
1542ecore_evas_title_get(const Ecore_Evas *ee)
1543{
1544 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1545 {
1546 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1547 "ecore_evas_title_get");
1548 return NULL;
1549 }
1550 return ee->prop.title;
1551}
1552
1553EAPI void
1554ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
1555{
1556 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1557 {
1558 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1559 "ecore_evas_name_class_set");
1560 return;
1561 }
1562 IFC(ee, fn_name_class_set) (ee, n, c);
1563 IFE;
1564}
1565
1566EAPI void
1567ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c)
1568{
1569 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1570 {
1571 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1572 "ecore_evas_name_class_get");
1573 return;
1574 }
1575 if (n) *n = ee->prop.name;
1576 if (c) *c = ee->prop.clas;
1577}
1578
1579EAPI void
1580ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h)
1581{
1582 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1583 {
1584 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1585 "ecore_evas_size_min_set");
1586 return;
1587 }
1588 if (w < 0) w = 0;
1589 if (h < 0) h = 0;
1590 if ((ee->rotation == 90) || (ee->rotation == 270))
1591 {
1592 IFC(ee, fn_size_min_set) (ee, h, w);
1593 IFE;
1594 }
1595 else
1596 {
1597 IFC(ee, fn_size_min_set) (ee, w, h);
1598 IFE;
1599 }
1600}
1601
1602EAPI void
1603ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h)
1604{
1605 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1606 {
1607 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1608 "ecore_evas_size_min_get");
1609 return;
1610 }
1611 if ((ee->rotation == 90) || (ee->rotation == 270))
1612 {
1613 if (w) *w = ee->prop.min.h;
1614 if (h) *h = ee->prop.min.w;
1615 }
1616 else
1617 {
1618 if (w) *w = ee->prop.min.w;
1619 if (h) *h = ee->prop.min.h;
1620 }
1621}
1622
1623EAPI void
1624ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h)
1625{
1626 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1627 {
1628 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1629 "ecore_evas_size_max_set");
1630 return;
1631 }
1632 if (w < 0) w = 0;
1633 if (h < 0) h = 0;
1634 if ((ee->rotation == 90) || (ee->rotation == 270))
1635 {
1636 IFC(ee, fn_size_max_set) (ee, h, w);
1637 IFE;
1638 }
1639 else
1640 {
1641 IFC(ee, fn_size_max_set) (ee, w, h);
1642 IFE;
1643 }
1644}
1645
1646EAPI void
1647ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h)
1648{
1649 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1650 {
1651 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1652 "ecore_evas_size_max_get");
1653 return;
1654 }
1655 if ((ee->rotation == 90) || (ee->rotation == 270))
1656 {
1657 if (w) *w = ee->prop.max.h;
1658 if (h) *h = ee->prop.max.w;
1659 }
1660 else
1661 {
1662 if (w) *w = ee->prop.max.w;
1663 if (h) *h = ee->prop.max.h;
1664 }
1665}
1666
1667EAPI void
1668ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h)
1669{
1670 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1671 {
1672 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1673 "ecore_evas_size_base_set");
1674 return;
1675 }
1676 if (w < 0) w = 0;
1677 if (h < 0) h = 0;
1678 if ((ee->rotation == 90) || (ee->rotation == 270))
1679 {
1680 IFC(ee, fn_size_base_set) (ee, h, w);
1681 IFE;
1682 }
1683 else
1684 {
1685 IFC(ee, fn_size_base_set) (ee, w, h);
1686 IFE;
1687 }
1688}
1689
1690EAPI void
1691ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h)
1692{
1693 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1694 {
1695 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1696 "ecore_evas_size_base_get");
1697 return;
1698 }
1699 if ((ee->rotation == 90) || (ee->rotation == 270))
1700 {
1701 if (w) *w = ee->prop.base.h;
1702 if (h) *h = ee->prop.base.w;
1703 }
1704 else
1705 {
1706 if (w) *w = ee->prop.base.w;
1707 if (h) *h = ee->prop.base.h;
1708 }
1709}
1710
1711EAPI void
1712ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h)
1713{
1714 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1715 {
1716 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1717 "ecore_evas_size_step_set");
1718 return;
1719 }
1720 if (w < 0) w = 0;
1721 if (h < 0) h = 0;
1722 if ((ee->rotation == 90) || (ee->rotation == 270))
1723 {
1724 IFC(ee, fn_size_step_set) (ee, h, w);
1725 IFE;
1726 }
1727 else
1728 {
1729 IFC(ee, fn_size_step_set) (ee, w, h);
1730 IFE;
1731 }
1732}
1733
1734EAPI void
1735ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h)
1736{
1737 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1738 {
1739 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1740 "ecore_evas_size_step_get");
1741 return;
1742 }
1743 if ((ee->rotation == 90) || (ee->rotation == 270))
1744 {
1745 if (w) *w = ee->prop.step.h;
1746 if (h) *h = ee->prop.step.w;
1747 }
1748 else
1749 {
1750 if (w) *w = ee->prop.step.w;
1751 if (h) *h = ee->prop.step.h;
1752 }
1753}
1754
1755EAPI void
1756ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y)
1757{
1758 Evas_Object *obj = NULL;
1759
1760 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1761 {
1762 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1763 "ecore_evas_cursor_set");
1764 return;
1765 }
1766
1767 if (file)
1768 {
1769 int x, y;
1770
1771 obj = evas_object_image_add(ee->evas);
1772 evas_object_image_file_set(obj, file, NULL);
1773 evas_object_image_size_get(obj, &x, &y);
1774 evas_object_resize(obj, x, y);
1775 evas_object_image_fill_set(obj, 0, 0, x, y);
1776 }
1777
1778 IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1779 IFE;
1780}
1781
1782EAPI void
1783ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
1784{
1785 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1786 {
1787 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1788 "ecore_evas_cursor_set");
1789 return;
1790 }
1791 IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1792 IFE;
1793}
1794
1795EAPI void
1796ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y)
1797{
1798 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1799 {
1800 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1801 "ecore_evas_cursor_get");
1802 return;
1803 }
1804 if (obj) *obj = ee->prop.cursor.object;
1805 if (layer) *layer = ee->prop.cursor.layer;
1806 if (hot_x) *hot_x = ee->prop.cursor.hot.x;
1807 if (hot_y) *hot_y = ee->prop.cursor.hot.y;
1808}
1809
1810EAPI void
1811ecore_evas_layer_set(Ecore_Evas *ee, int layer)
1812{
1813 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1814 {
1815 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1816 "ecore_evas_layer_set");
1817 return;
1818 }
1819 IFC(ee, fn_layer_set) (ee, layer);
1820 IFE;
1821}
1822
1823EAPI int
1824ecore_evas_layer_get(const Ecore_Evas *ee)
1825{
1826 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1827 {
1828 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1829 "ecore_evas_layer_get");
1830 return 0;
1831 }
1832 return ee->prop.layer;
1833}
1834
1835EAPI void
1836ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on)
1837{
1838 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1839 {
1840 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1841 "ecore_evas_focus_set");
1842 return;
1843 }
1844 IFC(ee, fn_focus_set) (ee, on);
1845 IFE;
1846}
1847
1848EAPI Eina_Bool
1849ecore_evas_focus_get(const Ecore_Evas *ee)
1850{
1851 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1852 {
1853 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1854 "ecore_evas_focus_get");
1855 return EINA_FALSE;
1856 }
1857 return ee->prop.focused ? EINA_TRUE : EINA_FALSE;
1858}
1859
1860EAPI void
1861ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on)
1862{
1863 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1864 {
1865 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1866 "ecore_evas_iconified_set");
1867 return;
1868 }
1869 IFC(ee, fn_iconified_set) (ee, on);
1870 IFE;
1871}
1872
1873EAPI Eina_Bool
1874ecore_evas_iconified_get(const Ecore_Evas *ee)
1875{
1876 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1877 {
1878 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1879 "ecore_evas_iconified_get");
1880 return EINA_FALSE;
1881 }
1882 return ee->prop.iconified ? EINA_TRUE : EINA_FALSE;
1883}
1884
1885EAPI void
1886ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on)
1887{
1888 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1889 {
1890 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1891 "ecore_evas_borderless_set");
1892 return;
1893 }
1894 IFC(ee, fn_borderless_set) (ee, on);
1895 IFE;
1896}
1897
1898EAPI Eina_Bool
1899ecore_evas_borderless_get(const Ecore_Evas *ee)
1900{
1901 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1902 {
1903 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1904 "ecore_evas_borderless_get");
1905 return EINA_FALSE;
1906 }
1907 return ee->prop.borderless ? EINA_TRUE : EINA_FALSE;
1908}
1909
1910/**
1911 * Tell the WM whether or not to ignore an Ecore_Evas' window
1912 * @param ee The Ecore_Evas
1913 * @param on EINA_TRUE to ignore, EINA_FALSE to not.
1914 *
1915 * This function causes the window manager to ignore @p ee if @p on is EINA_TRUE,
1916 * or not ignore @p ee if @p on is EINA_FALSE.
1917 */
1918EAPI void
1919ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on)
1920{
1921 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1922 {
1923 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1924 "ecore_evas_override_set");
1925 return;
1926 }
1927 IFC(ee, fn_override_set) (ee, on);
1928 IFE;
1929}
1930
1931/**
1932 * Query whether an Ecore_Evas' window is overridden or not
1933 * @param ee The Ecore_Evas to set
1934 * @return EINA_TRUE if @p ee is overridden, EINA_FALSE if not.
1935 *
1936 */
1937EAPI Eina_Bool
1938ecore_evas_override_get(const Ecore_Evas *ee)
1939{
1940 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1941 {
1942 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1943 "ecore_evas_override_get");
1944 return EINA_FALSE;
1945 }
1946 return ee->prop.override ? EINA_TRUE : EINA_FALSE;
1947}
1948
1949EAPI void
1950ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on)
1951{
1952 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1953 {
1954 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1955 "ecore_evas_maximized_set");
1956 return;
1957 }
1958 IFC(ee, fn_maximized_set) (ee, on);
1959 IFE;
1960}
1961
1962EAPI Eina_Bool
1963ecore_evas_maximized_get(const Ecore_Evas *ee)
1964{
1965 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1966 {
1967 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1968 "ecore_evas_maximized_get");
1969 return EINA_FALSE;
1970 }
1971 return ee->prop.maximized ? EINA_TRUE : EINA_FALSE;
1972}
1973
1974EAPI void
1975ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
1976{
1977 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1978 {
1979 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1980 "ecore_evas_fullscreen_set");
1981 return;
1982 }
1983 IFC(ee, fn_fullscreen_set) (ee, on);
1984 IFE;
1985}
1986
1987EAPI Eina_Bool
1988ecore_evas_fullscreen_get(const Ecore_Evas *ee)
1989{
1990 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1991 {
1992 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1993 "ecore_evas_fullscreen_get");
1994 return EINA_FALSE;
1995 }
1996 return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE;
1997}
1998
1999/**
2000 * Set whether or not an Ecore_Evas' window should avoid damage
2001 *
2002 * @param ee The Ecore_Evas
2003 * @param on The type of the damage management
2004 *
2005 * This function causes @p ee to be drawn to a pixmap to avoid recalculations.
2006 * On expose events it will copy from the pixmap to the window.
2007 */
2008EAPI void
2009ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on)
2010{
2011 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2012 {
2013 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2014 "ecore_evas_avoid_damage_set");
2015 return;
2016 }
2017 IFC(ee, fn_avoid_damage_set) (ee, on);
2018 IFE;
2019}
2020
2021/**
2022 * Query whether an Ecore_Evas' window avoids damage or not
2023 * @param ee The Ecore_Evas to set
2024 * @return The type of the damage management
2025 *
2026 */
2027EAPI Ecore_Evas_Avoid_Damage_Type
2028ecore_evas_avoid_damage_get(const Ecore_Evas *ee)
2029{
2030 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2031 {
2032 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2033 "ecore_evas_avoid_damage_get");
2034 return ECORE_EVAS_AVOID_DAMAGE_NONE;
2035 }
2036 return ee->prop.avoid_damage;
2037}
2038
2039/**
2040 * Set the withdrawn state of an Ecore_Evas' window.
2041 * @param ee The Ecore_Evas whose window's withdrawn state is set.
2042 * @param withdrawn The Ecore_Evas window's new withdrawn state.
2043 *
2044 */
2045EAPI void
2046ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn)
2047{
2048 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2049 {
2050 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2051 "ecore_evas_withdrawn_set");
2052 return;
2053 }
2054
2055 IFC(ee, fn_withdrawn_set) (ee, withdrawn);
2056 IFE;
2057}
2058
2059/**
2060 * Returns the withdrawn state of an Ecore_Evas' window.
2061 * @param ee The Ecore_Evas whose window's withdrawn state is returned.
2062 * @return The Ecore_Evas window's withdrawn state.
2063 *
2064 */
2065EAPI Eina_Bool
2066ecore_evas_withdrawn_get(const Ecore_Evas *ee)
2067{
2068 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2069 {
2070 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2071 "ecore_evas_withdrawn_get");
2072 return EINA_FALSE;
2073 }
2074 return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
2075}
2076
2077/**
2078 * Set the sticky state of an Ecore_Evas window.
2079 *
2080 * @param ee The Ecore_Evas whose window's sticky state is set.
2081 * @param sticky The Ecore_Evas window's new sticky state.
2082 *
2083 */
2084EAPI void
2085ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky)
2086{
2087 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2088 {
2089 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2090 "ecore_evas_sticky_set");
2091 return;
2092 }
2093
2094 IFC(ee, fn_sticky_set) (ee, sticky);
2095 IFE;
2096}
2097
2098/**
2099 * Returns the sticky state of an Ecore_Evas' window.
2100 *
2101 * @param ee The Ecore_Evas whose window's sticky state is returned.
2102 * @return The Ecore_Evas window's sticky state.
2103 *
2104 */
2105EAPI Eina_Bool
2106ecore_evas_sticky_get(const Ecore_Evas *ee)
2107{
2108 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2109 {
2110 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2111 "ecore_evas_sticky_get");
2112 return EINA_FALSE;
2113 }
2114 return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
2115}
2116
2117EAPI void
2118ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group)
2119{
2120 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2121 {
2122 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2123 "XXX");
2124 return;
2125 }
2126
2127 IFC(ee, fn_window_group_set) (ee, ee_group);
2128 IFE;
2129}
2130
2131EAPI const Ecore_Evas *
2132ecore_evas_window_group_get(const Ecore_Evas *ee)
2133{
2134 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2135 {
2136 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2137 "XXX");
2138 return EINA_FALSE;
2139 }
2140 return ee->prop.group_ee;
2141}
2142
2143EAPI void
2144ecore_evas_aspect_set(Ecore_Evas *ee, double aspect)
2145{
2146 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2147 {
2148 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2149 "XXX");
2150 return;
2151 }
2152
2153 IFC(ee, fn_aspect_set) (ee, aspect);
2154 IFE;
2155}
2156
2157EAPI double
2158ecore_evas_aspect_get(const Ecore_Evas *ee)
2159{
2160 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2161 {
2162 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2163 "XXX");
2164 return EINA_FALSE;
2165 }
2166 return ee->prop.aspect;
2167}
2168
2169EAPI void
2170ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent)
2171{
2172 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2173 {
2174 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2175 "XXX");
2176 return;
2177 }
2178
2179 IFC(ee, fn_urgent_set) (ee, urgent);
2180 IFE;
2181}
2182
2183EAPI Eina_Bool
2184ecore_evas_urgent_get(const Ecore_Evas *ee)
2185{
2186 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2187 {
2188 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2189 "XXX");
2190 return EINA_FALSE;
2191 }
2192 return ee->prop.urgent ? EINA_TRUE : EINA_FALSE;
2193}
2194
2195EAPI void
2196ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal)
2197{
2198 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2199 {
2200 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2201 "XXX");
2202 return;
2203 }
2204
2205 IFC(ee, fn_modal_set) (ee, modal);
2206 IFE;
2207}
2208
2209EAPI Eina_Bool
2210ecore_evas_modal_get(const Ecore_Evas *ee)
2211{
2212 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2213 {
2214 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2215 "XXX");
2216 return EINA_FALSE;
2217 }
2218 return ee->prop.modal ? EINA_TRUE : EINA_FALSE;
2219}
2220
2221EAPI void
2222ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand)
2223{
2224 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2225 {
2226 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2227 "XXX");
2228 return;
2229 }
2230
2231 IFC(ee, fn_demands_attention_set) (ee, demand);
2232 IFE;
2233}
2234
2235EAPI Eina_Bool
2236ecore_evas_demand_attention_get(const Ecore_Evas *ee)
2237{
2238 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2239 {
2240 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2241 "XXX");
2242 return EINA_FALSE;
2243 }
2244 return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE;
2245}
2246
2247EAPI void
2248ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip)
2249{
2250 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2251 {
2252 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2253 "XXX");
2254 return;
2255 }
2256
2257 IFC(ee, fn_focus_skip_set) (ee, skip);
2258 IFE;
2259}
2260
2261EAPI Eina_Bool
2262ecore_evas_focus_skip_get(const Ecore_Evas *ee)
2263{
2264 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2265 {
2266 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2267 "XXX");
2268 return EINA_FALSE;
2269 }
2270 return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE;
2271}
2272
2273EAPI void
2274ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore)
2275{
2276 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2277 {
2278 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2279 "ecore_evas_ignore_events_set");
2280 return;
2281 }
2282
2283 IFC(ee, fn_ignore_events_set) (ee, ignore);
2284 IFE;
2285}
2286
2287EAPI Eina_Bool
2288ecore_evas_ignore_events_get(const Ecore_Evas *ee)
2289{
2290 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2291 {
2292 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2293 "ecore_evas_ignore_events_get");
2294 return EINA_FALSE;
2295 }
2296 return ee->ignore_events ? EINA_TRUE : EINA_FALSE;
2297}
2298
2299EAPI void
2300ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render)
2301{
2302 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2303 {
2304 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2305 "ecore_evas_manual_render_set");
2306 return;
2307 }
2308 ee->manual_render = manual_render;
2309}
2310
2311EAPI Eina_Bool
2312ecore_evas_manual_render_get(const Ecore_Evas *ee)
2313{
2314 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2315 {
2316 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2317 "ecore_evas_manual_render_get");
2318 return EINA_FALSE;
2319 }
2320 return ee->manual_render ? EINA_TRUE : EINA_FALSE;
2321}
2322
2323EAPI void
2324ecore_evas_manual_render(Ecore_Evas *ee)
2325{
2326 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2327 {
2328 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2329 "ecore_evas_manual_render");
2330 return;
2331 }
2332 if (ee->engine.func->fn_render)
2333 ee->engine.func->fn_render(ee);
2334}
2335
2336EAPI void
2337ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync)
2338{
2339 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2340 {
2341 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2342 "ecore_evas_comp_sync_set");
2343 return;
2344 }
2345 ee->no_comp_sync = !do_sync;
2346}
2347
2348EAPI Eina_Bool
2349ecore_evas_comp_sync_get(const Ecore_Evas *ee)
2350{
2351 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2352 {
2353 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2354 "ecore_evas_comp_sync_get");
2355 return EINA_FALSE;
2356 }
2357 return !ee->no_comp_sync;
2358}
2359
2360EAPI Ecore_Window
2361ecore_evas_window_get(const Ecore_Evas *ee)
2362{
2363 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2364 {
2365 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2366 "ecore_evas_window_get");
2367 return 0;
2368 }
2369
2370 return ee->prop.window;
2371}
2372
2373EAPI void
2374ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
2375{
2376 if (x) *x = 0;
2377 if (y) *y = 0;
2378 if (w) *w = 0;
2379 if (h) *h = 0;
2380 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2381 {
2382 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2383 "ecore_evas_screen_geometry_get");
2384 return;
2385 }
2386
2387 IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h);
2388 IFE;
2389}
2390
2391EAPI void
2392ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
2393{
2394 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2395 {
2396 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set");
2397 return;
2398 }
2399 ee->prop.draw_frame = draw_frame;
2400}
2401
2402EAPI Eina_Bool
2403ecore_evas_draw_frame_get(const Ecore_Evas *ee)
2404{
2405 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2406 {
2407 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get");
2408 return EINA_FALSE;
2409 }
2410 return ee->prop.draw_frame;
2411}
2412
2413/* fps debug calls - for debugging how much time your app actually spends */
2414/* rendering graphics... :) */
2415
2416static int _ecore_evas_fps_debug_init_count = 0;
2417static int _ecore_evas_fps_debug_fd = -1;
2418unsigned int *_ecore_evas_fps_rendertime_mmap = NULL;
2419
2420void
2421_ecore_evas_fps_debug_init(void)
2422{
2423 char buf[4096];
2424 const char *tmp;
2425
2426 _ecore_evas_fps_debug_init_count++;
2427 if (_ecore_evas_fps_debug_init_count > 1) return;
2428
2429#ifndef HAVE_EVIL
2430 tmp = "/tmp";
2431#else
2432 tmp = evil_tmpdir_get ();
2433#endif /* HAVE_EVIL */
2434 snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid());
2435 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2436 if (_ecore_evas_fps_debug_fd < 0)
2437 {
2438 unlink(buf);
2439 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2440 }
2441 if (_ecore_evas_fps_debug_fd >= 0)
2442 {
2443 unsigned int zero = 0;
2444 char *buf2 = (char *)&zero;
2445 ssize_t todo = sizeof(unsigned int);
2446
2447 while (todo > 0)
2448 {
2449 ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo);
2450 if (r > 0)
2451 {
2452 todo -= r;
2453 buf2 += r;
2454 }
2455 else if ((r < 0) && (errno == EINTR))
2456 continue;
2457 else
2458 {
2459 ERR("could not write to file '%s' fd %d: %s",
2460 buf, _ecore_evas_fps_debug_fd, strerror(errno));
2461 close(_ecore_evas_fps_debug_fd);
2462 _ecore_evas_fps_debug_fd = -1;
2463 return;
2464 }
2465 }
2466 _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
2467 PROT_READ | PROT_WRITE,
2468 MAP_SHARED,
2469 _ecore_evas_fps_debug_fd, 0);
2470 if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED)
2471 _ecore_evas_fps_rendertime_mmap = NULL;
2472 }
2473}
2474
2475void
2476_ecore_evas_fps_debug_shutdown(void)
2477{
2478 _ecore_evas_fps_debug_init_count--;
2479 if (_ecore_evas_fps_debug_init_count > 0) return;
2480 if (_ecore_evas_fps_debug_fd >= 0)
2481 {
2482 char buf[4096];
2483
2484 snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
2485 unlink(buf);
2486 if (_ecore_evas_fps_rendertime_mmap)
2487 {
2488 munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int));
2489 _ecore_evas_fps_rendertime_mmap = NULL;
2490 }
2491 close(_ecore_evas_fps_debug_fd);
2492 _ecore_evas_fps_debug_fd = -1;
2493 }
2494}
2495
2496void
2497_ecore_evas_fps_debug_rendertime_add(double t)
2498{
2499 static double rtime = 0.0;
2500 static double rlapse = 0.0;
2501 static int frames = 0;
2502 static int flapse = 0;
2503 double tim;
2504
2505 tim = ecore_time_get();
2506 rtime += t;
2507 frames++;
2508 if (rlapse == 0.0)
2509 {
2510 rlapse = tim;
2511 flapse = frames;
2512 }
2513 else if ((tim - rlapse) >= 0.5)
2514 {
2515 printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n",
2516 frames,
2517 (frames - flapse) / (tim - rlapse),
2518 (100.0 * rtime) / (tim - rlapse)
2519 );
2520 rlapse = tim;
2521 flapse = frames;
2522 rtime = 0.0;
2523 }
2524}
2525
2526void
2527_ecore_evas_register(Ecore_Evas *ee)
2528{
2529 ee->registered = 1;
2530 ecore_evases = (Ecore_Evas *)eina_inlist_prepend
2531 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2532}
2533
2534void
2535_ecore_evas_ref(Ecore_Evas *ee)
2536{
2537 ee->refcount++;
2538}
2539
2540void
2541_ecore_evas_unref(Ecore_Evas *ee)
2542{
2543 ee->refcount--;
2544 if (ee->refcount == 0)
2545 {
2546 if (ee->deleted) _ecore_evas_free(ee);
2547 }
2548 else if (ee->refcount < -1)
2549 ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount);
2550}
2551
2552void
2553_ecore_evas_free(Ecore_Evas *ee)
2554{
2555 ee->deleted = EINA_TRUE;
2556 if (ee->refcount > 0) return;
2557
2558 if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee);
2559 while (ee->sub_ecore_evas)
2560 {
2561 _ecore_evas_free(ee->sub_ecore_evas->data);
2562 }
2563 if (ee->data) eina_hash_free(ee->data);
2564 ee->data = NULL;
2565 if (ee->name) free(ee->name);
2566 ee->name = NULL;
2567 if (ee->prop.title) free(ee->prop.title);
2568 ee->prop.title = NULL;
2569 if (ee->prop.name) free(ee->prop.name);
2570 ee->prop.name = NULL;
2571 if (ee->prop.clas) free(ee->prop.clas);
2572 ee->prop.clas = NULL;
2573 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2574 ee->prop.cursor.object = NULL;
2575 if (ee->evas) evas_free(ee->evas);
2576 ee->evas = NULL;
2577 ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
2578 ee->driver = NULL;
2579 if (ee->engine.idle_flush_timer)
2580 ecore_timer_del(ee->engine.idle_flush_timer);
2581 if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee);
2582 if (ee->registered)
2583 {
2584 ecore_evases = (Ecore_Evas *)eina_inlist_remove
2585 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2586 }
2587 free(ee);
2588}
2589
2590static Eina_Bool
2591_ecore_evas_cb_idle_flush(void *data)
2592{
2593 Ecore_Evas *ee;
2594
2595 ee = (Ecore_Evas *)data;
2596 evas_render_idle_flush(ee->evas);
2597 ee->engine.idle_flush_timer = NULL;
2598 return ECORE_CALLBACK_CANCEL;
2599}
2600
2601static Eina_Bool
2602_ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
2603{
2604 evas_async_events_process();
2605
2606 return ECORE_CALLBACK_RENEW;
2607}
2608
2609void
2610_ecore_evas_idle_timeout_update(Ecore_Evas *ee)
2611{
2612 if (ee->engine.idle_flush_timer)
2613 ecore_timer_del(ee->engine.idle_flush_timer);
2614 ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME,
2615 _ecore_evas_cb_idle_flush,
2616 ee);
2617}
2618
2619void
2620_ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
2621{
2622 ee->mouse.x = x;
2623 ee->mouse.y = y;
2624 if (ee->prop.cursor.object)
2625 {
2626 evas_object_show(ee->prop.cursor.object);
2627 if (ee->rotation == 0)
2628 evas_object_move(ee->prop.cursor.object,
2629 x - ee->prop.cursor.hot.x,
2630 y - ee->prop.cursor.hot.y);
2631 else if (ee->rotation == 90)
2632 evas_object_move(ee->prop.cursor.object,
2633 ee->h - y - 1 - ee->prop.cursor.hot.x,
2634 x - ee->prop.cursor.hot.y);
2635 else if (ee->rotation == 180)
2636 evas_object_move(ee->prop.cursor.object,
2637 ee->w - x - 1 - ee->prop.cursor.hot.x,
2638 ee->h - y - 1 - ee->prop.cursor.hot.y);
2639 else if (ee->rotation == 270)
2640 evas_object_move(ee->prop.cursor.object,
2641 y - ee->prop.cursor.hot.x,
2642 ee->w - x - 1 - ee->prop.cursor.hot.y);
2643 }
2644 if (ee->rotation == 0)
2645 evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
2646 else if (ee->rotation == 90)
2647 evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
2648 else if (ee->rotation == 180)
2649 evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
2650 else if (ee->rotation == 270)
2651 evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
2652}
2653
2654void
2655_ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device,
2656 int x, int y,
2657 double radius,
2658 double radius_x, double radius_y,
2659 double pressure,
2660 double angle,
2661 double mx, double my,
2662 unsigned int timestamp)
2663{
2664 if (ee->rotation == 0)
2665 evas_event_feed_multi_move(ee->evas, device,
2666 x, y,
2667 radius,
2668 radius_x, radius_y,
2669 pressure,
2670 angle - ee->rotation,
2671 mx, my,
2672 timestamp, NULL);
2673 else if (ee->rotation == 90)
2674 evas_event_feed_multi_move(ee->evas, device,
2675 ee->h - y - 1, x,
2676 radius,
2677 radius_y, radius_x,
2678 pressure,
2679 angle - ee->rotation,
2680 ee->h - my - 1, mx,
2681 timestamp, NULL);
2682 else if (ee->rotation == 180)
2683 evas_event_feed_multi_move(ee->evas, device,
2684 ee->w - x - 1, ee->h - y - 1,
2685 radius,
2686 radius_x, radius_y,
2687 pressure,
2688 angle - ee->rotation,
2689 ee->w - mx - 1, ee->h - my - 1,
2690 timestamp, NULL);
2691 else if (ee->rotation == 270)
2692 evas_event_feed_multi_move(ee->evas, device,
2693 y, ee->w - x - 1,
2694 radius,
2695 radius_y, radius_x,
2696 pressure,
2697 angle - ee->rotation,
2698 my, ee->w - mx - 1,
2699 timestamp, NULL);
2700}
2701
2702void
2703_ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device,
2704 int x, int y,
2705 double radius,
2706 double radius_x, double radius_y,
2707 double pressure,
2708 double angle,
2709 double mx, double my,
2710 Evas_Button_Flags flags,
2711 unsigned int timestamp)
2712{
2713 if (ee->rotation == 0)
2714 evas_event_feed_multi_down(ee->evas, device,
2715 x, y,
2716 radius,
2717 radius_x, radius_y,
2718 pressure,
2719 angle - ee->rotation,
2720 mx, my,
2721 flags, timestamp, NULL);
2722 else if (ee->rotation == 90)
2723 evas_event_feed_multi_down(ee->evas, device,
2724 ee->h - y - 1, x,
2725 radius,
2726 radius_y, radius_x,
2727 pressure,
2728 angle - ee->rotation,
2729 ee->h - my - 1, mx,
2730 flags, timestamp, NULL);
2731 else if (ee->rotation == 180)
2732 evas_event_feed_multi_down(ee->evas, device,
2733 ee->w - x - 1, ee->h - y - 1,
2734 radius,
2735 radius_x, radius_y,
2736 pressure,
2737 angle - ee->rotation,
2738 ee->w - mx - 1, ee->h - my - 1,
2739 flags, timestamp, NULL);
2740 else if (ee->rotation == 270)
2741 evas_event_feed_multi_down(ee->evas, device,
2742 y, ee->w - x - 1,
2743 radius,
2744 radius_y, radius_x,
2745 pressure,
2746 angle - ee->rotation,
2747 my, ee->w - mx - 1,
2748 flags, timestamp, NULL);
2749}
2750
2751void
2752_ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
2753 int x, int y,
2754 double radius,
2755 double radius_x, double radius_y,
2756 double pressure,
2757 double angle,
2758 double mx, double my,
2759 Evas_Button_Flags flags,
2760 unsigned int timestamp)
2761{
2762 if (ee->rotation == 0)
2763 evas_event_feed_multi_up(ee->evas, device,
2764 x, y,
2765 radius,
2766 radius_x, radius_y,
2767 pressure,
2768 angle - ee->rotation,
2769 mx, my,
2770 flags, timestamp, NULL);
2771 else if (ee->rotation == 90)
2772 evas_event_feed_multi_up(ee->evas, device,
2773 ee->h - y - 1, x,
2774 radius,
2775 radius_y, radius_x,
2776 pressure,
2777 angle - ee->rotation,
2778 ee->h - my - 1, mx,
2779 flags, timestamp, NULL);
2780 else if (ee->rotation == 180)
2781 evas_event_feed_multi_up(ee->evas, device,
2782 ee->w - x - 1, ee->h - y - 1,
2783 radius,
2784 radius_x, radius_y,
2785 pressure,
2786 angle - ee->rotation,
2787 ee->w - mx - 1, ee->h - my - 1,
2788 flags, timestamp, NULL);
2789 else if (ee->rotation == 270)
2790 evas_event_feed_multi_up(ee->evas, device,
2791 y, ee->w - x - 1,
2792 radius,
2793 radius_y, radius_x,
2794 pressure,
2795 angle - ee->rotation,
2796 my, ee->w - mx - 1,
2797 flags, timestamp, NULL);
2798}
2799
2800EAPI Eina_List *
2801ecore_evas_ecore_evas_list_get(void)
2802{
2803 Ecore_Evas *ee;
2804 Eina_List *l = NULL;
2805
2806 EINA_INLIST_FOREACH(ecore_evases, ee)
2807 {
2808 l = eina_list_append(l, ee);
2809 }
2810
2811 return l;
2812}
2813
2814EAPI void
2815ecore_evas_input_event_register(Ecore_Evas *ee)
2816{
2817 ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
2818 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2819 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2820 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2821 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2822}
2823
2824EAPI void
2825ecore_evas_input_event_unregister(Ecore_Evas *ee)
2826{
2827 ecore_event_window_unregister((Ecore_Window)ee);
2828}
2829
2830#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL)
2831EAPI void
2832ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
2833{
2834 if (!ee) return;
2835 if (!strcmp(ee->driver, "wayland_shm"))
2836 {
2837#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2838 _ecore_evas_wayland_shm_resize(ee, location);
2839#endif
2840 }
2841 else if (!strcmp(ee->driver, "wayland_egl"))
2842 {
2843#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2844 _ecore_evas_wayland_egl_resize(ee, location);
2845#endif
2846 }
2847}
2848
2849#else
2850EAPI void
2851ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
2852{
2853
2854}
2855#endif
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c
deleted file mode 100644
index 4c81db7..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c
+++ /dev/null
@@ -1,824 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
6#include <stdlib.h>
7
8#include <Ecore.h>
9#include "ecore_private.h"
10#include <Ecore_Input.h>
11
12#include "ecore_evas_private.h"
13#include "Ecore_Evas.h"
14
15#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
16static int _ecore_evas_init_count = 0;
17
18static int
19_ecore_evas_buffer_init(void)
20{
21 _ecore_evas_init_count++;
22 return _ecore_evas_init_count;
23}
24
25static void
26_ecore_evas_buffer_free(Ecore_Evas *ee)
27{
28 if (ee->engine.buffer.image)
29 {
30 Ecore_Evas *ee2;
31
32 ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent");
33 evas_object_del(ee->engine.buffer.image);
34 ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee);
35 }
36 else
37 {
38 ee->engine.buffer.free_func(ee->engine.buffer.data,
39 ee->engine.buffer.pixels);
40 }
41 _ecore_evas_buffer_shutdown();
42}
43
44static void
45_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
46{
47 Evas_Engine_Info_Buffer *einfo;
48 int stride = 0;
49
50 if (w < 1) w = 1;
51 if (h < 1) h = 1;
52 ee->req.w = w;
53 ee->req.h = h;
54 if ((w == ee->w) && (h == ee->h)) return;
55 ee->w = w;
56 ee->h = h;
57 evas_output_size_set(ee->evas, ee->w, ee->h);
58 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
59 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
60
61 if (ee->engine.buffer.image)
62 {
63 ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1);
64 stride = evas_object_image_stride_get(ee->engine.buffer.image);
65 }
66 else
67 {
68 if (ee->engine.buffer.pixels)
69 ee->engine.buffer.free_func(ee->engine.buffer.data,
70 ee->engine.buffer.pixels);
71 ee->engine.buffer.pixels =
72 ee->engine.buffer.alloc_func(ee->engine.buffer.data,
73 ee->w * ee->h * sizeof(int));
74 stride = ee->w * sizeof(int);
75 }
76
77 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
78 if (einfo)
79 {
80 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
81 einfo->info.dest_buffer = ee->engine.buffer.pixels;
82 einfo->info.dest_buffer_row_bytes = stride;
83 einfo->info.use_color_key = 0;
84 einfo->info.alpha_threshold = 0;
85 einfo->info.func.new_update_region = NULL;
86 einfo->info.func.free_update_region = NULL;
87 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
88 {
89 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
90 }
91 }
92 if (ee->engine.buffer.image)
93 evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels);
94 if (ee->func.fn_resize) ee->func.fn_resize(ee);
95}
96
97static void
98_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
99{
100 _ecore_evas_resize(ee, w, h);
101}
102
103int
104_ecore_evas_buffer_shutdown(void)
105{
106 _ecore_evas_init_count--;
107 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
108 return _ecore_evas_init_count;
109}
110
111static void
112_ecore_evas_show(Ecore_Evas *ee)
113{
114 if (ee->engine.buffer.image) return;
115 if (ee->prop.focused) return;
116 ee->prop.focused = 1;
117 evas_focus_in(ee->evas);
118 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
119}
120
121int
122_ecore_evas_buffer_render(Ecore_Evas *ee)
123{
124 Eina_List *updates = NULL, *l, *ll;
125 Ecore_Evas *ee2;
126 int rend = 0;
127
128 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
129 {
130 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
131 if (ee2->engine.func->fn_render)
132 rend |= ee2->engine.func->fn_render(ee2);
133 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
134 }
135 if (ee->engine.buffer.image)
136 {
137 int w, h;
138
139 evas_object_image_size_get(ee->engine.buffer.image, &w, &h);
140 if ((w != ee->w) || (h != ee->h))
141 _ecore_evas_resize(ee, w, h);
142 ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1);
143 }
144 if (ee->engine.buffer.pixels)
145 {
146 updates = evas_render_updates(ee->evas);
147 }
148 if (ee->engine.buffer.image)
149 {
150 Eina_Rectangle *r;
151
152 evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels);
153 EINA_LIST_FOREACH(updates, l, r)
154 evas_object_image_data_update_add(ee->engine.buffer.image,
155 r->x, r->y, r->w, r->h);
156 }
157 if (updates)
158 {
159 evas_render_updates_free(updates);
160 _ecore_evas_idle_timeout_update(ee);
161 }
162
163 return updates ? 1 : rend;
164}
165
166// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
167static void
168_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
169{
170 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
171
172 evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh);
173 evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh);
174
175 if (fw < 1) fw = 1;
176 if (fh < 1) fh = 1;
177
178 if (evas_object_map_get(ee->engine.buffer.image) &&
179 evas_object_map_enable_get(ee->engine.buffer.image))
180 {
181 fx = 0; fy = 0;
182 fw = ee->w; fh = ee->h;
183 ww = ee->w; hh = ee->h;
184 }
185
186 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
187 {
188 *x = (ee->w * (*x - xx)) / fw;
189 *y = (ee->h * (*y - yy)) / fh;
190 }
191 else
192 {
193 xx = (*x - xx) - fx;
194 while (xx < 0) xx += fw;
195 while (xx > fw) xx -= fw;
196 *x = (ee->w * xx) / fw;
197
198 yy = (*y - yy) - fy;
199 while (yy < 0) yy += fh;
200 while (yy > fh) yy -= fh;
201 *y = (ee->h * yy) / fh;
202 }
203}
204
205static void
206_ecore_evas_buffer_transfer_modifiers_locks(Evas *e, Evas *e2)
207{
208 const char *mods[] =
209 { "Shift", "Control", "Alt", "Meta", "Hyper", "Super", NULL };
210 const char *locks[] =
211 { "Scroll_Lock", "Num_Lock", "Caps_Lock", NULL };
212 int i;
213
214 for (i = 0; mods[i]; i++)
215 {
216 if (evas_key_modifier_is_set(evas_key_modifier_get(e), mods[i]))
217 evas_key_modifier_on(e2, mods[i]);
218 else
219 evas_key_modifier_off(e2, mods[i]);
220 }
221 for (i = 0; locks[i]; i++)
222 {
223 if (evas_key_lock_is_set(evas_key_lock_get(e), locks[i]))
224 evas_key_lock_on(e2, locks[i]);
225 else
226 evas_key_lock_off(e2, locks[i]);
227 }
228}
229
230static void
231_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
232{
233 Ecore_Evas *ee;
234 Evas_Event_Mouse_In *ev;
235
236 ee = data;
237 ev = event_info;
238 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
239 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
240}
241
242static void
243_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
244{
245 Ecore_Evas *ee;
246 Evas_Event_Mouse_Out *ev;
247
248 ee = data;
249 ev = event_info;
250 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
251 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
252}
253
254static void
255_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
256{
257 Ecore_Evas *ee;
258 Evas_Event_Mouse_Down *ev;
259
260 ee = data;
261 ev = event_info;
262 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
263 evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
264}
265
266static void
267_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
268{
269 Ecore_Evas *ee;
270 Evas_Event_Mouse_Up *ev;
271
272 ee = data;
273 ev = event_info;
274 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
275 evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
276}
277
278static void
279_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
280{
281 Ecore_Evas *ee;
282 Evas_Event_Mouse_Move *ev;
283 Evas_Coord x, y;
284
285 ee = data;
286 ev = event_info;
287 x = ev->cur.canvas.x;
288 y = ev->cur.canvas.y;
289 _ecore_evas_buffer_coord_translate(ee, &x, &y);
290 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
291 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
292}
293
294static void
295_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
296{
297 Ecore_Evas *ee;
298 Evas_Event_Mouse_Wheel *ev;
299
300 ee = data;
301 ev = event_info;
302 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
303 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
304}
305
306static void
307_ecore_evas_buffer_cb_multi_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
308{
309 Ecore_Evas *ee;
310 Evas_Event_Multi_Down *ev;
311 Evas_Coord x, y, xx, yy;
312 double xf, yf;
313
314 ee = data;
315 ev = event_info;
316 x = ev->canvas.x;
317 y = ev->canvas.y;
318 xx = x;
319 yy = y;
320 _ecore_evas_buffer_coord_translate(ee, &x, &y);
321 xf = (ev->canvas.xsub - (double)xx) + (double)x;
322 yf = (ev->canvas.ysub - (double)yy) + (double)y;
323 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
324 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);
325}
326
327static void
328_ecore_evas_buffer_cb_multi_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
329{
330 Ecore_Evas *ee;
331 Evas_Event_Multi_Up *ev;
332 Evas_Coord x, y, xx, yy;
333 double xf, yf;
334
335 ee = data;
336 ev = event_info;
337 x = ev->canvas.x;
338 y = ev->canvas.y;
339 xx = x;
340 yy = y;
341 _ecore_evas_buffer_coord_translate(ee, &x, &y);
342 xf = (ev->canvas.xsub - (double)xx) + (double)x;
343 yf = (ev->canvas.ysub - (double)yy) + (double)y;
344 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
345 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);
346}
347
348static void
349_ecore_evas_buffer_cb_multi_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
350{
351 Ecore_Evas *ee;
352 Evas_Event_Multi_Move *ev;
353 Evas_Coord x, y, xx, yy;
354 double xf, yf;
355
356 ee = data;
357 ev = event_info;
358 x = ev->cur.canvas.x;
359 y = ev->cur.canvas.y;
360 xx = x;
361 yy = y;
362 _ecore_evas_buffer_coord_translate(ee, &x, &y);
363 xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
364 yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
365 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
366 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);
367}
368
369static void
370_ecore_evas_buffer_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
371{
372 Ecore_Evas *ee;
373
374 ee = data;
375 if (ee->driver) _ecore_evas_free(ee);
376}
377
378static void
379_ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
380{
381 Ecore_Evas *ee;
382 Evas_Event_Key_Down *ev;
383
384 ee = data;
385 ev = event_info;
386 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
387 evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
388}
389
390static void
391_ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
392{
393 Ecore_Evas *ee;
394 Evas_Event_Key_Up *ev;
395
396 ee = data;
397 ev = event_info;
398 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
399 evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
400}
401
402static void
403_ecore_evas_buffer_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
404{
405 Ecore_Evas *ee;
406
407 ee = data;
408 ee->prop.focused = 1;
409 evas_focus_in(ee->evas);
410 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
411}
412
413static void
414_ecore_evas_buffer_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
415{
416 Ecore_Evas *ee;
417
418 ee = data;
419 ee->prop.focused = 0;
420 evas_focus_out(ee->evas);
421 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
422}
423
424static void
425_ecore_evas_buffer_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
426{
427 Ecore_Evas *ee;
428
429 ee = data;
430 ee->visible = 1;
431 if (ee->func.fn_show) ee->func.fn_show(ee);
432}
433
434static void
435_ecore_evas_buffer_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
436{
437 Ecore_Evas *ee;
438
439 ee = data;
440 ee->visible = 0;
441 if (ee->func.fn_hide) ee->func.fn_hide(ee);
442}
443
444static void
445_ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha)
446{
447 if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return;
448 ee->alpha = alpha;
449 if (ee->engine.buffer.image)
450 evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha);
451 else
452 {
453 Evas_Engine_Info_Buffer *einfo;
454
455 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
456 if (einfo)
457 {
458 if (ee->alpha)
459 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
460 else
461 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
462 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
463 }
464 }
465}
466
467static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
468{
469 _ecore_evas_buffer_free,
470 NULL,
471 NULL,
472 NULL,
473 NULL,
474 NULL,
475 NULL,
476 NULL,
477 NULL,
478 NULL,
479 NULL,
480 NULL,
481 NULL,
482 NULL,
483 NULL,
484 NULL,
485 NULL,
486 _ecore_evas_resize,
487 _ecore_evas_move_resize,
488 NULL,
489 NULL,
490 _ecore_evas_show,
491 NULL,
492 NULL,
493 NULL,
494 NULL,
495 NULL,
496 NULL,
497 NULL,
498 NULL,
499 NULL,
500 NULL,
501 NULL,
502 NULL,
503 NULL,
504 NULL,
505 NULL,
506 NULL,
507 NULL,
508 NULL,
509 NULL,
510 NULL,
511 NULL,
512 NULL,
513 _ecore_evas_buffer_alpha_set,
514 NULL, //transparent
515
516 NULL,
517 NULL,
518 NULL,
519 NULL,
520 NULL,
521 NULL,
522
523 _ecore_evas_buffer_render,
524 NULL // screen_geometry_get
525};
526#endif
527
528static void *
529_ecore_evas_buffer_pix_alloc(void *data __UNUSED__, int size)
530{
531 return malloc(size);
532}
533
534static void
535_ecore_evas_buffer_pix_free(void *data __UNUSED__, void *pix)
536{
537 free(pix);
538}
539
540EAPI Ecore_Evas *
541ecore_evas_buffer_new(int w, int h)
542{
543 return ecore_evas_buffer_allocfunc_new
544 (w, h, _ecore_evas_buffer_pix_alloc, _ecore_evas_buffer_pix_free, NULL);
545}
546
547EAPI Ecore_Evas *
548ecore_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)
549{
550// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
551#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
552 Evas_Engine_Info_Buffer *einfo;
553 Ecore_Evas *ee;
554 int rmethod;
555
556 if ((!alloc_func) || (!free_func)) return NULL;
557 rmethod = evas_render_method_lookup("buffer");
558 if (!rmethod) return NULL;
559 ee = calloc(1, sizeof(Ecore_Evas));
560 if (!ee) return NULL;
561
562 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
563
564 _ecore_evas_buffer_init();
565
566 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
567 ee->engine.buffer.alloc_func = alloc_func;
568 ee->engine.buffer.free_func = free_func;
569 ee->engine.buffer.data = (void *)data;
570
571 ee->driver = "buffer";
572
573 if (w < 1) w = 1;
574 if (h < 1) h = 1;
575 ee->rotation = 0;
576 ee->visible = 1;
577 ee->w = w;
578 ee->h = h;
579 ee->req.w = ee->w;
580 ee->req.h = ee->h;
581
582 ee->prop.max.w = 0;
583 ee->prop.max.h = 0;
584 ee->prop.layer = 0;
585 ee->prop.focused = 1;
586 ee->prop.borderless = 1;
587 ee->prop.override = 1;
588 ee->prop.maximized = 1;
589 ee->prop.fullscreen = 0;
590 ee->prop.withdrawn = 0;
591 ee->prop.sticky = 0;
592
593 /* init evas here */
594 ee->evas = evas_new();
595 evas_data_attach_set(ee->evas, ee);
596 evas_output_method_set(ee->evas, rmethod);
597 evas_output_size_set(ee->evas, w, h);
598 evas_output_viewport_set(ee->evas, 0, 0, w, h);
599
600 ee->engine.buffer.pixels =
601 ee->engine.buffer.alloc_func
602 (ee->engine.buffer.data, w * h * sizeof(int));
603
604 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
605 if (einfo)
606 {
607 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
608 einfo->info.dest_buffer = ee->engine.buffer.pixels;
609 einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int);
610 einfo->info.use_color_key = 0;
611 einfo->info.alpha_threshold = 0;
612 einfo->info.func.new_update_region = NULL;
613 einfo->info.func.free_update_region = NULL;
614 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
615 {
616 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
617 ecore_evas_free(ee);
618 return NULL;
619 }
620 }
621 else
622 {
623 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
624 ecore_evas_free(ee);
625 return NULL;
626 }
627 evas_key_modifier_add(ee->evas, "Shift");
628 evas_key_modifier_add(ee->evas, "Control");
629 evas_key_modifier_add(ee->evas, "Alt");
630 evas_key_modifier_add(ee->evas, "Meta");
631 evas_key_modifier_add(ee->evas, "Hyper");
632 evas_key_modifier_add(ee->evas, "Super");
633 evas_key_lock_add(ee->evas, "Caps_Lock");
634 evas_key_lock_add(ee->evas, "Num_Lock");
635 evas_key_lock_add(ee->evas, "Scroll_Lock");
636
637 evas_event_feed_mouse_in(ee->evas, 0, NULL);
638
639 _ecore_evas_register(ee);
640
641 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
642
643 return ee;
644#else
645 return NULL;
646#endif
647}
648
649EAPI const void *
650ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
651{
652#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
653 _ecore_evas_buffer_render(ee);
654 return ee->engine.buffer.pixels;
655#else
656 return NULL;
657#endif
658}
659
660EAPI Evas *
661ecore_evas_object_evas_get(Evas_Object *obj)
662{
663 Ecore_Evas *ee;
664
665 ee = evas_object_data_get(obj, "Ecore_Evas");
666 if (!ee) return NULL;
667
668 return ecore_evas_get(ee);
669}
670
671EAPI Ecore_Evas *
672ecore_evas_object_ecore_evas_get(Evas_Object *obj)
673{
674 return evas_object_data_get(obj, "Ecore_Evas");
675}
676
677EAPI Evas_Object *
678ecore_evas_object_image_new(Ecore_Evas *ee_target)
679{
680// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
681#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
682 Evas_Object *o;
683 Evas_Engine_Info_Buffer *einfo;
684 Ecore_Evas *ee;
685 int rmethod;
686 int w = 1, h = 1;
687
688 rmethod = evas_render_method_lookup("buffer");
689 if (!rmethod) return NULL;
690 ee = calloc(1, sizeof(Ecore_Evas));
691 if (!ee) return NULL;
692
693 o = evas_object_image_add(ee_target->evas);
694 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
695 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
696 evas_object_image_alpha_set(o, 0);
697 evas_object_image_size_set(o, w, h);
698
699 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
700
701 _ecore_evas_buffer_init();
702
703 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
704
705 ee->driver = "buffer";
706
707 ee->rotation = 0;
708 ee->visible = 0;
709 ee->w = w;
710 ee->h = h;
711 ee->req.w = ee->w;
712 ee->req.h = ee->h;
713
714 ee->prop.max.w = 0;
715 ee->prop.max.h = 0;
716 ee->prop.layer = 0;
717 ee->prop.focused = 0;
718 ee->prop.borderless = 1;
719 ee->prop.override = 1;
720 ee->prop.maximized = 0;
721 ee->prop.fullscreen = 0;
722 ee->prop.withdrawn = 0;
723 ee->prop.sticky = 0;
724
725 /* init evas here */
726 ee->evas = evas_new();
727 evas_data_attach_set(ee->evas, ee);
728 evas_output_method_set(ee->evas, rmethod);
729 evas_output_size_set(ee->evas, w, h);
730 evas_output_viewport_set(ee->evas, 0, 0, w, h);
731
732 ee->engine.buffer.image = o;
733 evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee);
734 evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target);
735 evas_object_event_callback_add(ee->engine.buffer.image,
736 EVAS_CALLBACK_MOUSE_IN,
737 _ecore_evas_buffer_cb_mouse_in, ee);
738 evas_object_event_callback_add(ee->engine.buffer.image,
739 EVAS_CALLBACK_MOUSE_OUT,
740 _ecore_evas_buffer_cb_mouse_out, ee);
741 evas_object_event_callback_add(ee->engine.buffer.image,
742 EVAS_CALLBACK_MOUSE_DOWN,
743 _ecore_evas_buffer_cb_mouse_down, ee);
744 evas_object_event_callback_add(ee->engine.buffer.image,
745 EVAS_CALLBACK_MOUSE_UP,
746 _ecore_evas_buffer_cb_mouse_up, ee);
747 evas_object_event_callback_add(ee->engine.buffer.image,
748 EVAS_CALLBACK_MOUSE_MOVE,
749 _ecore_evas_buffer_cb_mouse_move, ee);
750 evas_object_event_callback_add(ee->engine.buffer.image,
751 EVAS_CALLBACK_MOUSE_WHEEL,
752 _ecore_evas_buffer_cb_mouse_wheel, ee);
753 evas_object_event_callback_add(ee->engine.buffer.image,
754 EVAS_CALLBACK_MULTI_DOWN,
755 _ecore_evas_buffer_cb_multi_down, ee);
756 evas_object_event_callback_add(ee->engine.buffer.image,
757 EVAS_CALLBACK_MULTI_UP,
758 _ecore_evas_buffer_cb_multi_up, ee);
759 evas_object_event_callback_add(ee->engine.buffer.image,
760 EVAS_CALLBACK_MULTI_MOVE,
761 _ecore_evas_buffer_cb_multi_move, ee);
762 evas_object_event_callback_add(ee->engine.buffer.image,
763 EVAS_CALLBACK_FREE,
764 _ecore_evas_buffer_cb_free, ee);
765 evas_object_event_callback_add(ee->engine.buffer.image,
766 EVAS_CALLBACK_KEY_DOWN,
767 _ecore_evas_buffer_cb_key_down, ee);
768 evas_object_event_callback_add(ee->engine.buffer.image,
769 EVAS_CALLBACK_KEY_UP,
770 _ecore_evas_buffer_cb_key_up, ee);
771 evas_object_event_callback_add(ee->engine.buffer.image,
772 EVAS_CALLBACK_FOCUS_IN,
773 _ecore_evas_buffer_cb_focus_in, ee);
774 evas_object_event_callback_add(ee->engine.buffer.image,
775 EVAS_CALLBACK_FOCUS_OUT,
776 _ecore_evas_buffer_cb_focus_out, ee);
777 evas_object_event_callback_add(ee->engine.buffer.image,
778 EVAS_CALLBACK_SHOW,
779 _ecore_evas_buffer_cb_show, ee);
780 evas_object_event_callback_add(ee->engine.buffer.image,
781 EVAS_CALLBACK_HIDE,
782 _ecore_evas_buffer_cb_hide, ee);
783 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
784 if (einfo)
785 {
786 ee->engine.buffer.pixels = evas_object_image_data_get(o, 1);
787 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
788 einfo->info.dest_buffer = ee->engine.buffer.pixels;
789 einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o);
790 einfo->info.use_color_key = 0;
791 einfo->info.alpha_threshold = 0;
792 einfo->info.func.new_update_region = NULL;
793 einfo->info.func.free_update_region = NULL;
794 evas_object_image_data_set(o, ee->engine.buffer.pixels);
795 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
796 {
797 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
798 ecore_evas_free(ee);
799 return NULL;
800 }
801 }
802 else
803 {
804 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
805 ecore_evas_free(ee);
806 return NULL;
807 }
808 evas_key_modifier_add(ee->evas, "Shift");
809 evas_key_modifier_add(ee->evas, "Control");
810 evas_key_modifier_add(ee->evas, "Alt");
811 evas_key_modifier_add(ee->evas, "Meta");
812 evas_key_modifier_add(ee->evas, "Hyper");
813 evas_key_modifier_add(ee->evas, "Super");
814 evas_key_lock_add(ee->evas, "Caps_Lock");
815 evas_key_lock_add(ee->evas, "Num_Lock");
816 evas_key_lock_add(ee->evas, "Scroll_Lock");
817
818 ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee);
819
820 return o;
821#else
822 return NULL;
823#endif
824}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c
deleted file mode 100644
index 0947b11..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c
+++ /dev/null
@@ -1,582 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "Ecore_Input.h"
8#include "Ecore_Input_Evas.h"
9
10#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
11#include <Ecore_Cocoa.h>
12#include <Evas_Engine_GL_Cocoa.h>
13#endif
14
15#include "ecore_evas_private.h"
16#include "Ecore_Evas.h"
17
18
19#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
20
21// FIXME: this engine has lots of problems. only 1 window at a time, drawRect looks wrong, doesnt handle resizes and more
22
23static int _ecore_evas_init_count = 0;
24static Ecore_Evas *ecore_evases = NULL;
25static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {
26 NULL, NULL, NULL, NULL
27};
28static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
29static Ecore_Poller *ecore_evas_event = NULL;
30
31static const char *ecore_evas_cocoa_default = "EFL Cocoa";
32
33
34static int
35_ecore_evas_cocoa_render(Ecore_Evas *ee)
36{
37 int rend = 0;
38 Eina_List *updates = NULL;
39 Eina_List *ll;
40 Ecore_Evas *ee2;
41
42 DBG("Render");
43
44 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
45 {
46 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
47 if (ee2->engine.func->fn_render)
48 rend |= ee2->engine.func->fn_render(ee2);
49 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
50 }
51
52 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
53 updates = evas_render_updates(ee->evas);
54 if (ee->prop.avoid_damage)
55 {
56 updates = evas_render_updates(ee->evas);
57 if (updates) evas_render_updates_free(updates);
58 }
59 else if ((ee->visible) ||
60 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
61 ((ee->should_be_visible) && (ee->prop.override)))
62 {
63 if (ee->shaped)
64 {
65 updates = evas_render_updates(ee->evas);
66 if (updates) evas_render_updates_free(updates);
67 }
68 else
69 {
70 updates = evas_render_updates(ee->evas);
71 if (updates) evas_render_updates_free(updates);
72 }
73 }
74 else
75 evas_norender(ee->evas);
76 if (updates) rend = 1;
77 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
78
79 if (rend)
80 {
81 static int frames = 0;
82 static double t0 = 0.0;
83 double t, td;
84
85 t = ecore_time_get();
86 frames++;
87 if ((t - t0) > 1.0)
88 {
89 td = t - t0;
90 printf("FPS: %3.3f\n", (double)frames / td);
91 frames = 0;
92 t0 = t;
93 }
94 }
95
96 return rend;
97}
98
99
100static Ecore_Evas *
101_ecore_evas_cocoa_match(void)
102{
103 DBG("Match");
104 return ecore_evases;
105}
106
107static int
108_ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
109{
110 Ecore_Evas *ee;
111
112 DBG("Got Focus");
113
114 ee = _ecore_evas_cocoa_match();
115
116 if (!ee) return ECORE_CALLBACK_PASS_ON;
117 ee->prop.focused = 1;
118 evas_focus_in(ee->evas);
119 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
120
121 return ECORE_CALLBACK_PASS_ON;
122}
123
124static int
125_ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
126{
127 Ecore_Evas *ee;
128
129 DBG("Lost Focus");
130
131 ee = _ecore_evas_cocoa_match();
132
133 if (!ee) return ECORE_CALLBACK_PASS_ON;
134 evas_focus_out(ee->evas);
135 ee->prop.focused = 0;
136 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
137
138 return ECORE_CALLBACK_PASS_ON;
139}
140
141static int
142_ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event)
143{
144 /*Ecore_Cocoa_Event_Video_Resize *e;
145 Ecore_Evas *ee;
146
147 e = event;
148 ee = _ecore_evas_cocoa_match();
149
150 if (!ee) return 1; // pass on event
151 evas_output_size_set(ee->evas, e->w, e->h);
152
153 return 0;*/
154
155 DBG("Video Resize");
156 return ECORE_CALLBACK_PASS_ON;
157}
158
159static int
160_ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
161{
162 Ecore_Evas *ee;
163 int w;
164 int h;
165
166 DBG("Video Expose");
167
168 ee = _ecore_evas_cocoa_match();
169
170 if (!ee) return ECORE_CALLBACK_PASS_ON;
171 evas_output_size_get(ee->evas, &w, &h);
172 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
173
174 return ECORE_CALLBACK_PASS_ON;
175}
176
177static int
178_ecore_evas_idle_enter(void *data __UNUSED__)
179{
180 Ecore_Evas *ee;
181 double t1 = 0.;
182 double t2 = 0.;
183
184 DBG("Idle enter");
185
186 EINA_INLIST_FOREACH(ecore_evases, ee)
187 {
188 if (ee->visible)
189 evas_render(ee->evas);
190 else
191 evas_norender(ee->evas);
192 }
193
194 return EINA_TRUE;
195}
196
197static int
198_ecore_evas_cocoa_event(void *data)
199{
200 // ecore_cocoa_feed_events();
201
202 DBG("Cocoa Event");
203
204 return 1;
205}
206
207static int
208_ecore_evas_cocoa_init(void)
209{
210 DBG("Cocoa Init");
211 _ecore_evas_init_count++;
212 if (_ecore_evas_init_count > 1)
213 return _ecore_evas_init_count;
214
215 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL);
216 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL);
217 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL);
218 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL);
219
220 ecore_event_evas_init();
221 return _ecore_evas_init_count;
222}
223
224static int
225_ecore_evas_cocoa_shutdown(void)
226{
227 DBG("Cocoa SHutodwn");
228 _ecore_evas_init_count--;
229 if (_ecore_evas_init_count == 0)
230 {
231 int i;
232
233 while (ecore_evases) _ecore_evas_free(ecore_evases);
234
235 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
236 ecore_event_handler_del(ecore_evas_event_handlers[i]);
237 ecore_event_evas_shutdown();
238 ecore_idle_enterer_del(ecore_evas_idle_enterer);
239 ecore_evas_idle_enterer = NULL;
240 ecore_poller_del(ecore_evas_event);
241 ecore_evas_event = NULL;
242
243 ecore_event_evas_shutdown();
244 }
245 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
246 return _ecore_evas_init_count;
247}
248
249static void
250_ecore_evas_cocoa_free(Ecore_Evas *ee)
251{
252 DBG("Cocoa Free");
253 ecore_evases = (Ecore_Evas *) eina_inlist_remove(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
254 ecore_event_window_unregister(0);
255 _ecore_evas_cocoa_shutdown();
256 ecore_cocoa_shutdown();
257}
258
259static void
260_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
261{
262 DBG("Resize");
263 if ((w == ee->w) && (h == ee->h)) return;
264 ee->w = w;
265 ee->h = h;
266
267 printf("Ecore_Evas Resize %d %d\n", w, h);
268
269 ecore_cocoa_window_resize(ee->prop.window, w, h);
270
271 evas_output_size_set(ee->evas, ee->w, ee->h);
272 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
273 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
274
275 if (ee->func.fn_resize) ee->func.fn_resize(ee);
276}
277
278static void
279_ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
280{
281 DBG("Move Resize");
282 if ((w == ee->w) && (h == ee->h)) return;
283 ee->w = w;
284 ee->h = h;
285
286 ecore_cocoa_window_move_resize(ee->prop.window, x, y, w, h);
287
288 evas_output_size_set(ee->evas, ee->w, ee->h);
289 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
290 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
291
292 if (ee->func.fn_resize) ee->func.fn_resize(ee);
293}
294
295
296static void
297_ecore_evas_show(Ecore_Evas *ee, int x, int y, int w, int h)
298{
299 DBG("Show");
300 ee->should_be_visible = 1;
301 if (ee->prop.avoid_damage)
302 _ecore_evas_cocoa_render(ee);
303
304 ecore_cocoa_window_show(ee->prop.window);
305 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
306}
307
308
309static void
310_ecore_evas_hide(Ecore_Evas *ee, int x, int y, int w, int h)
311{
312 DBG("Hide");
313
314 ecore_cocoa_window_hide(ee->prop.window);
315 ee->should_be_visible = 0;
316}
317
318static void
319_ecore_evas_title_set(Ecore_Evas *ee, const char *title)
320{
321 INF("ecore evas title set");
322
323 if (ee->prop.title) free(ee->prop.title);
324 ee->prop.title = NULL;
325 if (title) ee->prop.title = strdup(title);
326 ecore_cocoa_window_title_set(ee->prop.window,
327 ee->prop.title);
328}
329
330static void
331_ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
332{
333 Ecore_Evas *ee;
334
335 DBG("Cursor DEL");
336
337 ee = data;
338 if (ee)
339 ee->prop.cursor.object = NULL;
340}
341
342static void
343_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
344{
345 int x, y;
346 DBG("Cursor Set");
347 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
348
349 if (obj == NULL)
350 {
351 ee->prop.cursor.object = NULL;
352 ee->prop.cursor.layer = 0;
353 ee->prop.cursor.hot.x = 0;
354 ee->prop.cursor.hot.y = 0;
355 return;
356 }
357
358 ee->prop.cursor.object = obj;
359 ee->prop.cursor.layer = layer;
360 ee->prop.cursor.hot.x = hot_x;
361 ee->prop.cursor.hot.y = hot_y;
362
363 evas_pointer_output_xy_get(ee->evas, &x, &y);
364 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
365 evas_object_move(ee->prop.cursor.object,
366 x - ee->prop.cursor.hot.x,
367 y - ee->prop.cursor.hot.y);
368
369 evas_object_pass_events_set(ee->prop.cursor.object, 1);
370
371 if (evas_pointer_inside_get(ee->evas))
372 evas_object_show(ee->prop.cursor.object);
373
374 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
375}
376
377static int
378_ecore_evas_engine_cocoa_init(Ecore_Evas *ee)
379{
380 Evas_Engine_Info_GL_Cocoa *einfo;
381 const char *driver;
382 int rmethod;
383
384 DBG("Cocoa Init");
385
386 driver = "gl_cocoa";
387
388 rmethod = evas_render_method_lookup(driver);
389 if (!rmethod)
390 return 0;
391
392 ee->driver = driver;
393 evas_output_method_set(ee->evas, rmethod);
394
395 einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas);
396 if (einfo)
397 {
398 /* FIXME: REDRAW_DEBUG missing for now */
399 einfo->window = ee->prop.window;
400 //einfo->info.depth = ecore_win32_screen_depth_get();
401 //einfo->info.rotation = 0;
402 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
403 {
404 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
405 return 0;
406 }
407 ecore_cocoa_window_view_set(einfo->window, einfo->view);
408 }
409 else
410 {
411 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
412 return 0;
413 }
414
415 return 1;
416}
417
418static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
419 {
420 _ecore_evas_cocoa_free,
421 NULL,
422 NULL,
423 NULL,
424 NULL,
425 NULL,
426 NULL,
427 NULL,
428 NULL,
429 NULL,
430 NULL,
431 NULL,
432 NULL,
433 NULL,
434 NULL,
435 NULL, //move
436 NULL,
437 _ecore_evas_resize,
438 _ecore_evas_move_resize,
439 NULL, //rotation
440 NULL, //shaped
441 _ecore_evas_show,
442 _ecore_evas_hide,
443 NULL, //raise
444 NULL, //lower
445 NULL, //activate
446 _ecore_evas_title_set,
447 NULL,
448 NULL,
449 NULL,
450 NULL,
451 NULL,
452 _ecore_evas_object_cursor_set,
453 NULL,
454 NULL,
455 NULL,
456 NULL,
457 NULL,
458 NULL,
459 NULL,
460 NULL,
461 NULL,
462 NULL,
463 NULL,
464 NULL,
465 NULL, //transparent
466
467 NULL,
468 NULL,
469 NULL,
470 NULL,
471 NULL,
472 NULL,
473
474 NULL, // render
475 NULL
476 };
477#endif
478
479EAPI Ecore_Evas *
480ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h)
481{
482#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
483 Evas_Engine_Info_GL_Cocoa *einfo;
484 Ecore_Evas *ee;
485 int rmethod;
486
487 DBG("Cocoa new");
488
489 if (!ecore_cocoa_init())
490 return NULL;
491
492 ee = calloc(1, sizeof(Ecore_Evas));
493 if (!ee)
494 goto shutdown_ecore_cocoa;
495
496 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
497
498 _ecore_evas_cocoa_init();
499
500 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func;
501
502 if (w < 1) w = 1;
503 if (h < 1) h = 1;
504 ee->visible = 1;
505 ee->x = x;
506 ee->y = y;
507 ee->w = w;
508 ee->h = h;
509 ee->req.x = ee->x;
510 ee->req.y = ee->y;
511 ee->req.w = ee->w;
512 ee->req.h = ee->h;
513
514 ee->semi_sync = 1;
515
516
517 ee->prop.max.w = 32767;
518 ee->prop.max.h = 32767;
519 ee->prop.layer = 4;
520 ee->prop.request_pos = 0;
521 ee->prop.sticky = 0;
522 ee->prop.window = 0;
523
524 printf("Create New Evas\n");
525
526 ee->evas = evas_new();
527
528 if (!ee->evas)
529 goto free_name;
530
531 evas_data_attach_set(ee->evas, ee);
532 evas_output_method_set(ee->evas, rmethod);
533 evas_output_size_set(ee->evas, w, h);
534 evas_output_viewport_set(ee->evas, 0, 0, w, h);
535
536 printf("Create New Cocoa Window\n");
537 ee->prop.window = (Ecore_Cocoa_Window*)ecore_cocoa_window_new(x, y, w, h);
538 printf("Window Created %p\n", ee->prop.window);
539 if (!ee->prop.window)
540 {
541 _ecore_evas_cocoa_shutdown();
542 free(ee);
543 return NULL;
544 }
545
546 printf("Init Evas engine cocoa\n");
547 if (!_ecore_evas_engine_cocoa_init(ee))
548 {
549 _ecore_evas_cocoa_shutdown();
550 free(ee);
551 return NULL;
552 }
553
554
555 ee->engine.func->fn_render = _ecore_evas_cocoa_render;
556 _ecore_evas_register(ee);
557 ecore_event_window_register(0, ee, ee->evas, NULL, NULL, NULL, NULL);
558
559 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
560 printf("Ecore Evas returned : %p\n", ee);
561 return ee;
562
563 free_window:
564 /* FIXME: free window here */
565 free_evas:
566 free(ee->evas);
567 free_name:
568 free(ee->name);
569 free_ee:
570 _ecore_evas_cocoa_shutdown();
571 free(ee);
572 shutdown_ecore_cocoa:
573 ecore_cocoa_shutdown();
574
575 return NULL;
576#else
577 ERR("Cocoa support in ecore-evas not enabled");
578 return NULL;
579 (void) parent;
580 (void) x; (void) y; (void) w; (void) h;
581#endif
582}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c
deleted file mode 100644
index ed24355..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c
+++ /dev/null
@@ -1,603 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <string.h>
6
7#include <Ecore.h>
8#include "ecore_private.h"
9#ifdef BUILD_ECORE_EVAS_DIRECTFB
10#include <Ecore_DirectFB.h>
11#endif
12
13#include "ecore_evas_private.h"
14#include "Ecore_Evas.h"
15
16#ifdef BUILD_ECORE_EVAS_DIRECTFB
17static int _ecore_evas_init_count = 0;
18static Ecore_Event_Handler *ecore_evas_event_handlers[13];
19
20static Eina_Hash *ecore_evases_hash = NULL;
21
22static int
23_ecore_evas_directfb_render(Ecore_Evas *ee)
24{
25 Eina_List *updates, *ll;
26 Ecore_Evas *ee2;
27 int rend = 0;
28
29 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
30 {
31 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
32 if (ee2->engine.func->fn_render)
33 rend |= ee2->engine.func->fn_render(ee2);
34 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
35 }
36
37 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
38 updates = evas_render_updates(ee->evas);
39 if (updates)
40 {
41 evas_render_updates_free(updates);
42 _ecore_evas_idle_timeout_update(ee);
43 }
44 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
45
46 return updates ? 1 : rend;
47}
48
49static char *
50_ecore_evas_directfb_winid_str_get(Ecore_X_Window win)
51{
52 const char *vals = "qWeRtYuIoP5$&<~";
53 static char id[9];
54 unsigned int val;
55 val = (unsigned int)win;
56 id[0] = vals[(val >> 28) & 0xf];
57 id[1] = vals[(val >> 24) & 0xf];
58 id[2] = vals[(val >> 20) & 0xf];
59 id[3] = vals[(val >> 16) & 0xf];
60 id[4] = vals[(val >> 12) & 0xf];
61 id[5] = vals[(val >> 8) & 0xf];
62 id[6] = vals[(val >> 4) & 0xf];
63 id[7] = vals[(val ) & 0xf];
64 id[8] = 0;
65 return id;
66}
67
68static Ecore_Evas *
69_ecore_evas_directfb_match(DFBWindowID win)
70{
71 Ecore_Evas *ee;
72
73 ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win));
74 return ee;
75}
76
77static Eina_Bool
78_ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
79{
80 Ecore_Evas *ee;
81 Ecore_DirectFB_Event_Key_Down *e;
82
83 e = event;
84 ee = _ecore_evas_directfb_match(e->win);
85
86 if (!ee) return EINA_TRUE; /* pass on event */
87 evas_event_feed_key_down(ee->evas, e->name, e->name, e->string,
88 e->key_compose, e->time, NULL);
89 return EINA_TRUE;
90}
91
92static Eina_Bool
93_ecore_evas_directfb_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
94{
95 Ecore_Evas *ee;
96 Ecore_DirectFB_Event_Key_Up *e;
97
98 e = event;
99 ee = _ecore_evas_directfb_match(e->win);
100
101 if (!ee) return EINA_TRUE; /* pass on event */
102 evas_event_feed_key_up(ee->evas, e->name, e->name, e->string,
103 e->key_compose, e->time, NULL);
104 return EINA_TRUE;
105}
106
107static Eina_Bool
108_ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, void *event)
109{
110 Ecore_Evas *ee;
111 Ecore_DirectFB_Event_Motion *e;
112
113 e = event;
114 ee = _ecore_evas_directfb_match(e->win);
115
116 if (!ee) return EINA_TRUE; /* pass on event */
117 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
118 return EINA_TRUE;
119}
120
121static Eina_Bool
122_ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
123{
124 Ecore_Evas *ee;
125 Ecore_DirectFB_Event_Button_Down *e;
126
127 e = event;
128 ee = _ecore_evas_directfb_match(e->win);
129
130 if (!ee) return EINA_TRUE; /* pass on event */
131 // _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
132 evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL);
133 return EINA_TRUE;
134}
135
136static Eina_Bool
137_ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
138{
139 Ecore_Evas *ee;
140 Ecore_DirectFB_Event_Button_Up *e;
141 Evas_Button_Flags flags = EVAS_BUTTON_NONE;
142
143 e = event;
144 ee = _ecore_evas_directfb_match(e->win);
145
146 if (!ee) return EINA_TRUE; /* pass on event */
147 //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
148 evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL);
149 return EINA_TRUE;
150}
151
152static Eina_Bool
153_ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, void *event)
154{
155 Ecore_Evas *ee;
156 Ecore_DirectFB_Event_Enter *e;
157
158 e = event;
159 ee = _ecore_evas_directfb_match(e->win);
160
161 if (!ee) return EINA_TRUE; /* pass on event */
162 evas_event_feed_mouse_in(ee->evas, e->time, NULL);
163 //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
164 return EINA_TRUE;
165}
166
167static Eina_Bool
168_ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, void *event)
169{
170 Ecore_Evas *ee;
171 Ecore_DirectFB_Event_Leave *e;
172
173 e = event;
174 ee = _ecore_evas_directfb_match(e->win);
175
176 if (!ee) return EINA_TRUE; /* pass on event */
177 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
178 //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
179 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
180 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
181 return EINA_TRUE;
182}
183
184static Eina_Bool
185_ecore_evas_directfb_event_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
186{
187 Ecore_Evas *ee;
188 Ecore_DirectFB_Event_Wheel *e;
189
190 e = event;
191 ee = _ecore_evas_directfb_match(e->win);
192
193 if (!ee) return EINA_TRUE; /* pass on event */
194 evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL);
195 return EINA_TRUE;
196}
197
198static Eina_Bool
199_ecore_evas_directfb_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
200{
201 Ecore_Evas *ee;
202 Ecore_DirectFB_Event_Got_Focus *e;
203
204 e = event;
205 ee = _ecore_evas_directfb_match(e->win);
206
207 if (!ee) return EINA_TRUE; /* pass on event */
208 ee->prop.focused = 1;
209 return EINA_TRUE;
210}
211
212static Eina_Bool
213_ecore_evas_directfb_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
214{
215 Ecore_Evas *ee;
216 Ecore_DirectFB_Event_Lost_Focus *e;
217
218 e = event;
219 ee = _ecore_evas_directfb_match(e->win);
220
221 if (!ee) return EINA_TRUE; /* pass on event */
222 ee->prop.focused = 0;
223 return EINA_TRUE;
224}
225
226int
227_ecore_evas_directfb_shutdown(void)
228{
229 _ecore_evas_init_count--;
230 if (_ecore_evas_init_count == 0)
231 {
232 int i;
233
234 for (i = 0; i < 8; i++)
235 ecore_event_handler_del(ecore_evas_event_handlers[i]);
236 }
237 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
238 return _ecore_evas_init_count;
239}
240
241
242
243
244
245int
246_ecore_evas_directfb_init(void)
247{
248 _ecore_evas_init_count++;
249 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
250
251 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, _ecore_evas_directfb_event_key_down, NULL);
252 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_UP, _ecore_evas_directfb_event_key_up, NULL);
253 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, _ecore_evas_directfb_event_button_down, NULL);
254 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, _ecore_evas_directfb_event_button_up, NULL);
255 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_MOTION, _ecore_evas_directfb_event_motion, NULL);
256 ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_ENTER, _ecore_evas_directfb_event_enter, NULL);
257 ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LEAVE, _ecore_evas_directfb_event_leave, NULL);
258 ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_WHEEL, _ecore_evas_directfb_event_wheel, NULL);
259 ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, _ecore_evas_directfb_event_got_focus, NULL);
260 ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, _ecore_evas_directfb_event_lost_focus, NULL);
261 ecore_evas_event_handlers[10] = NULL;
262 ecore_evas_event_handlers[11] = NULL;
263 ecore_evas_event_handlers[12] = NULL;
264
265 return _ecore_evas_init_count;
266}
267
268/* engine functions */
269/********************/
270
271static void
272_ecore_evas_directfb_free(Ecore_Evas *ee)
273{
274 eina_hash_del(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee);
275 ecore_directfb_window_free(ee->engine.directfb.window);
276 _ecore_evas_directfb_shutdown();
277 ecore_directfb_shutdown();
278}
279
280static void
281_ecore_evas_directfb_move(Ecore_Evas *ee, int x, int y)
282{
283 ecore_directfb_window_move(ee->engine.directfb.window, x, y);
284}
285
286static void
287_ecore_evas_directfb_resize(Ecore_Evas *ee, int w, int h)
288{
289 ee->req.w = w;
290 ee->req.h = h;
291 if ((w == ee->w) && (h == ee->h)) return;
292 ecore_directfb_window_resize(ee->engine.directfb.window, w, h);
293 ee->w = w;
294 ee->h = h;
295 if ((ee->rotation == 90) || (ee->rotation == 270))
296 {
297 evas_output_size_set(ee->evas, ee->h, ee->w);
298 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
299 }
300 else
301 {
302 evas_output_size_set(ee->evas, ee->w, ee->h);
303 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
304 }
305}
306
307static void
308_ecore_evas_directfb_focus_set(Ecore_Evas *ee, int on __UNUSED__)
309{
310 ecore_directfb_window_focus(ee->engine.directfb.window);
311}
312
313static void
314_ecore_evas_directfb_hide(Ecore_Evas *ee)
315{
316 ecore_directfb_window_hide(ee->engine.directfb.window);
317 ee->should_be_visible = 0;
318}
319
320static void
321_ecore_evas_directfb_show(Ecore_Evas *ee)
322{
323 ecore_directfb_window_show(ee->engine.directfb.window);
324 ee->should_be_visible = 1;
325}
326
327static void
328_ecore_evas_directfb_shaped_set(Ecore_Evas *ee, int shaped)
329{
330 if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped)))
331 return;
332 ee->shaped = shaped;
333 if(ee->shaped)
334 ecore_directfb_window_shaped_set(ee->engine.directfb.window, 1);
335 else
336 ecore_directfb_window_shaped_set(ee->engine.directfb.window, 0);
337
338}
339
340static void
341_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
342{
343 Ecore_Evas *ee;
344
345 ee = data;
346 if (ee)
347 ee->prop.cursor.object = NULL;
348}
349
350static void
351_ecore_evas_directfb_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
352{
353 int x, y;
354
355 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
356
357 if (!obj)
358 {
359 ee->prop.cursor.object = NULL;
360 ee->prop.cursor.layer = 0;
361 ee->prop.cursor.hot.x = 0;
362 ee->prop.cursor.hot.y = 0;
363 ecore_directfb_window_cursor_show(ee->engine.directfb.window, 1);
364 return;
365
366 }
367
368 ee->prop.cursor.object = obj;
369 ee->prop.cursor.layer = layer;
370 ee->prop.cursor.hot.x = hot_x;
371 ee->prop.cursor.hot.y = hot_y;
372
373 ecore_directfb_window_cursor_show(ee->engine.directfb.window, 0);
374
375 evas_pointer_output_xy_get(ee->evas, &x, &y);
376 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
377 evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y);
378 evas_object_pass_events_set(ee->prop.cursor.object, 1);
379 if (evas_pointer_inside_get(ee->evas))
380 evas_object_show(ee->prop.cursor.object);
381
382 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
383}
384
385static void
386_ecore_evas_directfb_fullscreen_set(Ecore_Evas *ee, int on)
387{
388 Evas_Engine_Info_DirectFB *einfo;
389 int w;
390 int h;
391 int resized = 0;
392
393 if (((ee->prop.fullscreen) && (on)) || ((!ee->prop.fullscreen) && (!on)))
394 return;
395
396 if (on)
397 ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 1);
398 else
399 ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 0);
400 /* set the new size of the evas */
401 ecore_directfb_window_size_get(ee->engine.directfb.window, &w, &h);
402 if( (ee->w != w) || (ee->h != h))
403 {
404 resized = 1;
405 ee->w = w;
406 ee->h = h;
407 ee->req.w = ee->w;
408 ee->req.h = ee->h;
409 if ((ee->rotation == 90) || (ee->rotation == 270))
410 {
411 evas_output_size_set(ee->evas, ee->h, ee->w);
412 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
413 }
414 else
415 {
416 evas_output_size_set(ee->evas, ee->w, ee->h);
417 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
418 }
419 }
420 einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas);
421 if (einfo)
422 {
423 einfo->info.surface = ee->engine.directfb.window->surface;
424 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
425 {
426 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
427 }
428 }
429 ee->prop.fullscreen = on;
430 if (resized)
431 {
432 if(ee->func.fn_resize) ee->func.fn_resize(ee);
433 }
434}
435
436static void *
437_ecore_evas_directfb_window_get(const Ecore_Evas *ee)
438{
439 return ee->engine.directfb.window;
440}
441#endif
442
443#ifdef BUILD_ECORE_EVAS_DIRECTFB
444static Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
445{
446 _ecore_evas_directfb_free, /* free an ecore_evas */
447 NULL, /* cb resize */
448 NULL, /* cb move */
449 NULL, /* cb show */
450 NULL, /* cb hide */
451 NULL, /* cb delete request */
452 NULL, /* cb destroy */
453 NULL, /* cb focus in */
454 NULL, /* cb focus out */
455 NULL, /* cb sticky */
456 NULL, /* cb unsticky */
457 NULL, /* cb mouse in */
458 NULL, /* cb mouse out */
459 NULL, /* cb pre render */
460 NULL, /* cb post render */
461 _ecore_evas_directfb_move, /* move */
462 NULL, /* managed move */
463 _ecore_evas_directfb_resize, /* resize */
464 NULL, /* move resize */
465 NULL,//_ecore_evas_directfb_rotation_set,/* rotation */
466 _ecore_evas_directfb_shaped_set, /* shaped */
467 _ecore_evas_directfb_show, /* show */
468 _ecore_evas_directfb_hide, /* hide */
469 NULL, /* raise */
470 NULL, /* lower */
471 NULL, /* activate */
472 NULL, /* title set */
473 NULL, /* name class set */
474 NULL, /* size min */
475 NULL, /* size max */
476 NULL, /* size base */
477 NULL, /* size step */
478 _ecore_evas_directfb_object_cursor_set, /* set cursor to an evas object */
479 NULL, /* layer set */
480 _ecore_evas_directfb_focus_set, /* focus */
481 NULL, /* iconified */
482 NULL, /* borderless */
483 NULL, /* override */
484 NULL, /* maximized */
485 _ecore_evas_directfb_fullscreen_set,/* fullscreen */
486 NULL, /* avoid damage */
487 NULL, /* withdrawn */
488 NULL, /* sticky */
489 NULL, /* ignore events */
490 NULL, /* alpha */
491 NULL, //transparent
492
493 NULL,
494 NULL,
495 NULL,
496 NULL,
497 NULL,
498 NULL,
499
500 NULL, // render
501 NULL // screen_geometry_get
502};
503#endif
504
505/* api */
506/*******/
507
508#ifdef BUILD_ECORE_EVAS_DIRECTFB
509EAPI Ecore_Evas *
510ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h)
511{
512 Evas_Engine_Info_DirectFB *einfo;
513 Ecore_Evas *ee;
514 Ecore_DirectFB_Window *window;
515 int rmethod;
516
517 rmethod = evas_render_method_lookup("directfb");
518 if (!rmethod) return NULL;
519 if (!ecore_directfb_init(disp_name)) return NULL;
520 ee = calloc(1, sizeof(Ecore_Evas));
521 if (!ee) return NULL;
522
523 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
524 _ecore_evas_directfb_init();
525 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func;
526
527 ee->driver = "directfb";
528 if (disp_name) ee->name = strdup(disp_name);
529
530 if (w < 1) w = 1;
531 if (h < 1) h = 1;
532
533 ee->rotation = 0;
534 ee->visible = 1;
535 ee->x = x;
536 ee->y = y;
537 ee->w = w;
538 ee->h = h;
539 ee->req.x = ee->x;
540 ee->req.y = ee->y;
541 ee->req.w = ee->w;
542 ee->req.h = ee->h;
543 ee->prop.layer = 1;
544 ee->prop.fullscreen = 0;
545
546 /* init evas here */
547 ee->evas = evas_new();
548 evas_data_attach_set(ee->evas, ee);
549 evas_output_method_set(ee->evas, rmethod);
550 evas_output_size_set(ee->evas, w, h);
551 evas_output_viewport_set(ee->evas, 0, 0, w, h);
552 einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas);
553
554 window = ecore_directfb_window_new(x,y,w,h);
555 ee->engine.directfb.window = window;
556 if (einfo)
557 {
558 einfo->info.dfb = ecore_directfb_interface_get();
559 einfo->info.surface = window->surface;
560 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
561 {
562 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
563 ecore_evas_free(ee);
564 return NULL;
565 }
566 }
567 else
568 {
569 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
570 ecore_evas_free(ee);
571 return NULL;
572 }
573
574 ee->engine.func->fn_render = _ecore_evas_directfb_render;
575 _ecore_evas_register(ee);
576
577 if (!ecore_evases_hash)
578 ecore_evases_hash = eina_hash_string_superfast_new(NULL);
579 eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee);
580
581 return ee;
582}
583#else
584EAPI Ecore_Evas *
585ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
586{
587 return NULL;
588}
589#endif
590
591#ifdef BUILD_ECORE_EVAS_DIRECTFB
592EAPI Ecore_DirectFB_Window *
593ecore_evas_directfb_window_get(const Ecore_Evas *ee)
594{
595 return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee);
596}
597#else
598EAPI Ecore_DirectFB_Window *
599ecore_evas_directfb_window_get(const Ecore_Evas *ee __UNUSED__)
600{
601 return NULL;
602}
603#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
deleted file mode 100644
index ec02472..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c
+++ /dev/null
@@ -1,1467 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <string.h>
7#include <sys/types.h>
8
9#include <Eina.h>
10#include <Ecore.h>
11#include "ecore_private.h"
12#include <Ecore_Input.h>
13
14#include "ecore_evas_private.h"
15#include "Ecore_Evas.h"
16
17EAPI int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = 0;
18EAPI int ECORE_EVAS_EWS_EVENT_ADD = 0;
19EAPI int ECORE_EVAS_EWS_EVENT_DEL = 0;
20EAPI int ECORE_EVAS_EWS_EVENT_RESIZE = 0;
21EAPI int ECORE_EVAS_EWS_EVENT_MOVE = 0;
22EAPI int ECORE_EVAS_EWS_EVENT_SHOW = 0;
23EAPI int ECORE_EVAS_EWS_EVENT_HIDE = 0;
24EAPI int ECORE_EVAS_EWS_EVENT_FOCUS = 0;
25EAPI int ECORE_EVAS_EWS_EVENT_UNFOCUS = 0;
26EAPI int ECORE_EVAS_EWS_EVENT_RAISE = 0;
27EAPI int ECORE_EVAS_EWS_EVENT_LOWER = 0;
28EAPI int ECORE_EVAS_EWS_EVENT_ACTIVATE = 0;
29
30EAPI int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = 0;
31EAPI int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = 0;
32EAPI int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = 0;
33EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0;
34EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0;
35
36#ifdef BUILD_ECORE_EVAS_EWS
37static int _ecore_evas_init_count = 0;
38
39static Ecore_Evas *_ews_ee = NULL;
40static Evas_Object *_ews_bg = NULL;
41static Eina_List *_ews_children = NULL;
42static const void *_ews_manager = NULL;
43static char *_ews_engine = NULL;
44static char *_ews_options = NULL;
45static int _ews_x = 0;
46static int _ews_y = 0;
47static int _ews_w = 1024;
48static int _ews_h = 768;
49static Eina_Bool _ews_defaults_engine = EINA_TRUE;
50static Eina_Bool _ews_defaults_geo = EINA_TRUE;
51
52static const char EWS_ENGINE_NAME[] = "ews";
53
54static void
55_ecore_evas_ews_pre_free(Ecore_Evas *ee __UNUSED__)
56{
57 DBG("EWS backing store free'd");
58 _ews_children = eina_list_free(_ews_children);
59 _ews_ee = NULL;
60 _ews_bg = NULL;
61}
62
63static void
64_ecore_evas_ews_del_request(Ecore_Evas *ee __UNUSED__)
65{
66 INF("EWS backing store deletion is forbidden!");
67}
68
69static Ecore_Evas *
70_ecore_evas_ews_ee_new(void)
71{
72 Ecore_Evas *ee = ecore_evas_new(_ews_engine, _ews_x, _ews_y, _ews_w, _ews_h,
73 _ews_options);
74 if (!ee)
75 ERR("Failed: ecore_evas_new(%s, %d, %d, %d, %d, %s)",
76 _ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, _ews_options);
77 else
78 {
79 ecore_evas_size_min_set(ee, _ews_w, _ews_h);
80 ecore_evas_size_max_set(ee, _ews_w, _ews_h);
81 ecore_evas_callback_pre_free_set(ee, _ecore_evas_ews_pre_free);
82 ecore_evas_callback_delete_request_set(ee, _ecore_evas_ews_del_request);
83 ecore_evas_name_class_set(ee, "ecore_evas_ews", "ews");
84 ecore_evas_title_set
85 (ee, "EWS: Ecore + Evas Single Process Windowing System");
86 ecore_evas_show(ee);
87 }
88
89 return ee;
90}
91
92static void
93_ecore_evas_ews_env_setup(void)
94{
95 const char *env = getenv("ECORE_EVAS_EWS");
96 char *p, *n, *tmp;
97
98 if (_ews_defaults_engine)
99 {
100 free(_ews_engine);
101 _ews_engine = NULL;
102 free(_ews_options);
103 _ews_options = NULL;
104 }
105 if (_ews_defaults_geo)
106 {
107 _ews_x = 0;
108 _ews_y = 0;
109 _ews_w = 1024;
110 _ews_h = 768;
111 }
112
113 if ((!env) || (!*env)) return;
114
115 p = tmp = strdup(env);
116 if (!tmp) return;
117
118 n = strchr(p, ':');
119 if (n) *n = '\0';
120 if (_ews_defaults_engine) _ews_engine = strdup(p);
121 if (!n) goto end;
122
123 p = n + 1;
124 n = strchr(p, ':');
125 if (!n) goto end;
126 *n = '\0';
127 if (_ews_defaults_geo) _ews_x = atoi(p);
128
129 p = n + 1;
130 n = strchr(p, ':');
131 if (!n) goto end;
132 *n = '\0';
133 if (_ews_defaults_geo) _ews_y = atoi(p);
134
135 p = n + 1;
136 n = strchr(p, ':');
137 if (!n) goto end;
138 *n = '\0';
139 if (_ews_defaults_geo) _ews_w = atoi(p);
140
141 p = n + 1;
142 n = strchr(p, ':');
143 if (n) *n = '\0';
144 if (_ews_defaults_geo) _ews_h = atoi(p);
145 if (!n) goto end;
146
147 p = n + 1;
148 if (_ews_defaults_engine) _ews_options = strdup(p);
149
150 end:
151 free(tmp);
152}
153
154static void
155_ecore_evas_ews_event_free(void *data __UNUSED__, void *ev)
156{
157 Ecore_Evas *ee = ev;
158 _ecore_evas_unref(ee);
159}
160
161static void
162_ecore_evas_ews_event(Ecore_Evas *ee, int event)
163{
164 _ecore_evas_ref(ee);
165 ecore_event_add(event, ee, _ecore_evas_ews_event_free, NULL);
166}
167
168static void
169_ecore_evas_ews_event_free_del(void *data __UNUSED__, void *ev __UNUSED__)
170{
171 _ecore_evas_ews_shutdown();
172}
173
174static void
175_ecore_evas_ews_free(Ecore_Evas *ee)
176{
177 evas_object_del(ee->engine.ews.image);
178 _ews_ee->sub_ecore_evas = eina_list_remove(_ews_ee->sub_ecore_evas, ee);
179
180 ecore_event_add(ECORE_EVAS_EWS_EVENT_DEL, ee, _ecore_evas_ews_event_free_del, NULL);
181}
182
183static void
184_ecore_evas_ews_move(Ecore_Evas *ee, int x, int y)
185{
186 ee->req.x = x;
187 ee->req.y = y;
188
189 if ((x == ee->x) && (y == ee->y)) return;
190 ee->x = x;
191 ee->y = y;
192 evas_object_move(ee->engine.ews.image, x, y);
193 if (ee->func.fn_move) ee->func.fn_move(ee);
194
195 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE);
196}
197
198static void
199_ecore_evas_ews_managed_move(Ecore_Evas *ee, int x, int y)
200{
201 ee->req.x = x;
202 ee->req.y = y;
203
204 if ((x == ee->x) && (y == ee->y)) return;
205 ee->x = x;
206 ee->y = y;
207 if (ee->func.fn_move) ee->func.fn_move(ee);
208 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE);
209}
210
211static void
212_ecore_evas_ews_resize_internal(Ecore_Evas *ee, int w, int h)
213{
214 Evas_Engine_Info_Buffer *einfo;
215 void *pixels;
216 int stride;
217
218 evas_output_size_set(ee->evas, w, h);
219 evas_output_viewport_set(ee->evas, 0, 0, w, h);
220 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
221
222 evas_object_image_size_set(ee->engine.ews.image, w, h);
223 evas_object_image_fill_set(ee->engine.ews.image, 0, 0, w, h);
224 evas_object_resize(ee->engine.ews.image, w, h);
225
226 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
227 evas_object_image_data_set(ee->engine.ews.image, pixels); // refcount
228 stride = evas_object_image_stride_get(ee->engine.ews.image);
229
230 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
231 EINA_SAFETY_ON_NULL_RETURN(einfo);
232
233 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
234 einfo->info.dest_buffer = pixels;
235 einfo->info.dest_buffer_row_bytes = stride;
236 einfo->info.use_color_key = 0;
237 einfo->info.alpha_threshold = 0;
238 einfo->info.func.new_update_region = NULL;
239 einfo->info.func.free_update_region = NULL;
240 evas_object_image_data_set(ee->engine.ews.image, pixels);
241 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
242 {
243 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
244 }
245}
246
247static void
248_ecore_evas_ews_resize(Ecore_Evas *ee, int w, int h)
249{
250 if (w < 1) w = 1;
251 if (h < 1) h = 1;
252
253 ee->req.w = w;
254 ee->req.h = h;
255
256 if ((w == ee->w) && (h == ee->h)) return;
257 ee->w = w;
258 ee->h = h;
259 _ecore_evas_ews_resize_internal(ee, w, h);
260 if (ee->func.fn_resize) ee->func.fn_resize(ee);
261 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RESIZE);
262}
263
264static void
265_ecore_evas_ews_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
266{
267 _ecore_evas_ews_move(ee, x, y);
268 _ecore_evas_ews_resize(ee, w, h);
269}
270
271static void
272_ecore_evas_ews_rotation_set(Ecore_Evas *ee, int rot, int resize)
273{
274 if (ee->rotation == rot) return;
275 ee->rotation = rot;
276
277 ERR("TODO: rot=%d, resize=%d", rot, resize);
278
279 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
280}
281
282static void
283_ecore_evas_ews_shaped_set(Ecore_Evas *ee, int val)
284{
285 if (ee->shaped == val) return;
286 ee->shaped = val;
287 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
288}
289
290static void
291_ecore_evas_ews_show(Ecore_Evas *ee)
292{
293 ee->should_be_visible = EINA_TRUE;
294 evas_object_show(ee->engine.ews.image);
295 if (ee->prop.fullscreen)
296 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
297
298 if (ee->func.fn_show) ee->func.fn_show(ee);
299 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_SHOW);
300}
301
302static void
303_ecore_evas_ews_hide(Ecore_Evas *ee)
304{
305 ee->should_be_visible = EINA_FALSE;
306 evas_object_hide(ee->engine.ews.image);
307
308 if (ee->func.fn_hide) ee->func.fn_hide(ee);
309 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_HIDE);
310}
311
312static void
313_ecore_evas_ews_raise(Ecore_Evas *ee)
314{
315 evas_object_raise(ee->engine.ews.image);
316 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RAISE);
317}
318
319static void
320_ecore_evas_ews_lower(Ecore_Evas *ee)
321{
322 evas_object_lower(ee->engine.ews.image);
323 evas_object_lower(_ews_bg);
324 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LOWER);
325}
326
327static void
328_ecore_evas_ews_activate(Ecore_Evas *ee)
329{
330 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ACTIVATE);
331}
332
333static void
334_ecore_evas_ews_title_set(Ecore_Evas *ee, const char *t)
335{
336 if (ee->prop.title) free(ee->prop.title);
337 ee->prop.title = NULL;
338 if (t) ee->prop.title = strdup(t);
339 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
340}
341
342static void
343_ecore_evas_ews_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
344{
345 if (ee->prop.name) free(ee->prop.name);
346 if (ee->prop.clas) free(ee->prop.clas);
347 ee->prop.name = NULL;
348 ee->prop.clas = NULL;
349 if (n) ee->prop.name = strdup(n);
350 if (c) ee->prop.clas = strdup(c);
351 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
352}
353
354static void
355_ecore_evas_ews_size_min_set(Ecore_Evas *ee, int w, int h)
356{
357 if (w < 0) w = 0;
358 if (h < 0) h = 0;
359 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
360 ee->prop.min.w = w;
361 ee->prop.min.h = h;
362 evas_object_size_hint_min_set(ee->engine.ews.image, w, h);
363 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
364}
365
366static void
367_ecore_evas_ews_size_max_set(Ecore_Evas *ee, int w, int h)
368{
369 if (w < 0) w = 0;
370 if (h < 0) h = 0;
371 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
372 ee->prop.max.w = w;
373 ee->prop.max.h = h;
374 evas_object_size_hint_max_set(ee->engine.ews.image, w, h);
375 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
376}
377
378static void
379_ecore_evas_ews_size_base_set(Ecore_Evas *ee, int w, int h)
380{
381 if (w < 0) w = 0;
382 if (h < 0) h = 0;
383 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
384 ee->prop.base.w = w;
385 ee->prop.base.h = h;
386 evas_object_size_hint_request_set(ee->engine.ews.image, w, h);
387 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
388}
389
390static void
391_ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h)
392{
393 if (w < 1) w = 1;
394 if (h < 1) h = 1;
395 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
396 ee->prop.step.w = w;
397 ee->prop.step.h = h;
398 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
399}
400
401static void
402_ecore_evas_ews_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
403{
404 Ecore_Evas *ee = data;
405 ee->prop.cursor.object = NULL;
406}
407
408static void
409_ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
410{
411 int x, y;
412
413 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
414
415 if (!obj)
416 {
417 ee->prop.cursor.object = NULL;
418 ee->prop.cursor.layer = 0;
419 ee->prop.cursor.hot.x = 0;
420 ee->prop.cursor.hot.y = 0;
421 return;
422 }
423
424 ee->prop.cursor.object = obj;
425 ee->prop.cursor.layer = layer;
426 ee->prop.cursor.hot.x = hot_x;
427 ee->prop.cursor.hot.y = hot_y;
428 evas_pointer_output_xy_get(ee->evas, &x, &y);
429 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
430 evas_object_move(ee->prop.cursor.object,
431 x - ee->prop.cursor.hot.x,
432 y - ee->prop.cursor.hot.y);
433 evas_object_pass_events_set(ee->prop.cursor.object, 1);
434 if (evas_pointer_inside_get(ee->evas))
435 evas_object_show(ee->prop.cursor.object);
436
437 evas_object_event_callback_add
438 (obj, EVAS_CALLBACK_DEL, _ecore_evas_ews_object_cursor_del, ee);
439
440 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
441}
442
443static void
444_ecore_evas_ews_layer_set(Ecore_Evas *ee, int layer)
445{
446 if (layer < EVAS_LAYER_MIN + 1)
447 layer = EVAS_LAYER_MIN + 1;
448 else if (layer > EVAS_LAYER_MAX)
449 layer = EVAS_LAYER_MAX;
450
451 if (ee->prop.layer == layer) return;
452 ee->prop.layer = layer;
453 evas_object_layer_set(ee->engine.ews.image, layer);
454 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LAYER_CHANGE);
455}
456
457static void
458_ecore_evas_ews_focus_set(Ecore_Evas *ee, int val)
459{
460 evas_object_focus_set(ee->engine.ews.image, val);
461 ee->prop.focused = val;
462 if (val)
463 {
464 evas_focus_in(ee->evas);
465 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
466 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS);
467 }
468 else
469 {
470 evas_focus_out(ee->evas);
471 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
472 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS);
473 }
474}
475
476static void
477_ecore_evas_ews_iconified_set(Ecore_Evas *ee, int val)
478{
479 if (ee->prop.iconified == val) return;
480 ee->prop.iconified = val;
481 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE);
482}
483
484static void
485_ecore_evas_ews_borderless_set(Ecore_Evas *ee, int val)
486{
487 if (ee->prop.borderless == val) return;
488 ee->prop.borderless = val;
489 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
490}
491
492static void
493_ecore_evas_ews_override_set(Ecore_Evas *ee, int val)
494{
495 if (ee->prop.override == val) return;
496 if (ee->visible) evas_object_show(ee->engine.ews.image);
497 if (ee->prop.focused) evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
498 ee->prop.override = val;
499 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
500}
501
502static void
503_ecore_evas_ews_maximized_set(Ecore_Evas *ee, int val)
504{
505 if (ee->prop.maximized == val) return;
506 ee->prop.maximized = val;
507 if (val) evas_object_show(ee->engine.ews.image);
508 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE);
509}
510
511static void
512_ecore_evas_ews_fullscreen_set(Ecore_Evas *ee, int val)
513{
514 if (ee->prop.fullscreen == val) return;
515 ee->prop.fullscreen = val;
516
517 if (!val)
518 {
519 evas_object_move(ee->engine.ews.image, ee->x, ee->y);
520 evas_object_resize(ee->engine.ews.image, ee->w, ee->h);
521 }
522 else
523 {
524 Evas_Coord w, h;
525 ecore_evas_geometry_get(_ews_ee, NULL, NULL, &w, &h);
526 evas_object_move(ee->engine.ews.image, 0, 0);
527 evas_object_resize(ee->engine.ews.image, w, h);
528 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
529 }
530
531 if (ee->should_be_visible)
532 evas_object_show(ee->engine.ews.image);
533 else
534 evas_object_hide(ee->engine.ews.image);
535
536 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE);
537}
538
539static void
540_ecore_evas_ews_avoid_damage_set(Ecore_Evas *ee, int val)
541{
542 if (ee->prop.avoid_damage == val) return;
543 ee->prop.avoid_damage = val;
544 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
545}
546
547static void
548_ecore_evas_ews_withdrawn_set(Ecore_Evas *ee, int val)
549{
550 if (ee->prop.withdrawn == val) return;
551 ee->prop.withdrawn = val;
552 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
553}
554
555static void
556_ecore_evas_ews_sticky_set(Ecore_Evas *ee, int val)
557{
558 if (ee->prop.sticky == val) return;
559 ee->prop.sticky = val;
560 if ((val) && (ee->func.fn_sticky)) ee->func.fn_sticky(ee);
561 else if ((!val) && (ee->func.fn_unsticky)) ee->func.fn_unsticky(ee);
562 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
563}
564
565static void
566_ecore_evas_ews_ignore_events_set(Ecore_Evas *ee, int val)
567{
568 if (ee->ignore_events == val) return;
569 ee->ignore_events = val;
570 evas_object_pass_events_set(ee->engine.ews.image, val);
571 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
572}
573
574static void
575_ecore_evas_ews_alpha_set(Ecore_Evas *ee, int val)
576{
577 if (ee->alpha == val) return;
578 ee->alpha = val;
579 evas_object_image_alpha_set(ee->engine.ews.image, val);
580 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
581}
582
583static void
584_ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val)
585{
586 if (ee->transparent == val) return;
587 ee->transparent = val;
588 evas_object_image_alpha_set(ee->engine.ews.image, val);
589 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
590}
591
592static int
593_ecore_evas_ews_render(Ecore_Evas *ee)
594{
595 Eina_List *updates = NULL, *l, *ll;
596 Ecore_Evas *ee2;
597 Eina_Rectangle *r;
598 int w, h, rend = 0;
599 void *pixels;
600
601 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
602 {
603 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
604 rend |= _ecore_evas_ews_render(ee2);
605 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
606 }
607
608 evas_object_image_size_get(ee->engine.ews.image, &w, &h);
609 if ((w != ee->w) || (h != ee->h))
610 ecore_evas_resize(ee, w, h);
611
612 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
613 if (pixels)
614 {
615 updates = evas_render_updates(ee->evas);
616 }
617 evas_object_image_data_set(ee->engine.ews.image, pixels);
618
619 EINA_LIST_FOREACH(updates, l, r)
620 evas_object_image_data_update_add(ee->engine.ews.image,
621 r->x, r->y, r->w, r->h);
622
623 if (updates)
624 {
625 evas_render_updates_free(updates);
626 _ecore_evas_idle_timeout_update(ee);
627 }
628
629 return updates ? 1 : rend;
630}
631
632static void
633_ecore_evas_ews_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
634{
635 ecore_evas_geometry_get(_ews_ee, x, y, w, h);
636}
637
638static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
639{
640 _ecore_evas_ews_free,
641 NULL,
642 NULL,
643 NULL,
644 NULL,
645 NULL,
646 NULL,
647 NULL,
648 NULL,
649 NULL,
650 NULL,
651 NULL,
652 NULL,
653 NULL,
654 NULL,
655 _ecore_evas_ews_move,
656 _ecore_evas_ews_managed_move,
657 _ecore_evas_ews_resize,
658 _ecore_evas_ews_move_resize,
659 _ecore_evas_ews_rotation_set,
660 _ecore_evas_ews_shaped_set,
661 _ecore_evas_ews_show,
662 _ecore_evas_ews_hide,
663 _ecore_evas_ews_raise,
664 _ecore_evas_ews_lower,
665 _ecore_evas_ews_activate,
666 _ecore_evas_ews_title_set,
667 _ecore_evas_ews_name_class_set,
668 _ecore_evas_ews_size_min_set,
669 _ecore_evas_ews_size_max_set,
670 _ecore_evas_ews_size_base_set,
671 _ecore_evas_ews_size_step_set,
672 _ecore_evas_ews_object_cursor_set,
673 _ecore_evas_ews_layer_set,
674 _ecore_evas_ews_focus_set,
675 _ecore_evas_ews_iconified_set,
676 _ecore_evas_ews_borderless_set,
677 _ecore_evas_ews_override_set,
678 _ecore_evas_ews_maximized_set,
679 _ecore_evas_ews_fullscreen_set,
680 _ecore_evas_ews_avoid_damage_set,
681 _ecore_evas_ews_withdrawn_set,
682 _ecore_evas_ews_sticky_set,
683 _ecore_evas_ews_ignore_events_set,
684 _ecore_evas_ews_alpha_set,
685 _ecore_evas_ews_transparent_set,
686
687 NULL,
688 NULL,
689 NULL,
690 NULL,
691 NULL,
692 NULL,
693
694 _ecore_evas_ews_render,
695 _ecore_evas_ews_screen_geometry_get
696};
697
698void
699_ecore_evas_ews_events_init(void)
700{
701 if (ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE != 0) return;
702 ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = ecore_event_type_new();
703 ECORE_EVAS_EWS_EVENT_ADD = ecore_event_type_new();
704 ECORE_EVAS_EWS_EVENT_DEL = ecore_event_type_new();
705 ECORE_EVAS_EWS_EVENT_RESIZE = ecore_event_type_new();
706 ECORE_EVAS_EWS_EVENT_MOVE = ecore_event_type_new();
707 ECORE_EVAS_EWS_EVENT_SHOW = ecore_event_type_new();
708 ECORE_EVAS_EWS_EVENT_HIDE = ecore_event_type_new();
709 ECORE_EVAS_EWS_EVENT_FOCUS = ecore_event_type_new();
710 ECORE_EVAS_EWS_EVENT_UNFOCUS = ecore_event_type_new();
711 ECORE_EVAS_EWS_EVENT_RAISE = ecore_event_type_new();
712 ECORE_EVAS_EWS_EVENT_LOWER = ecore_event_type_new();
713 ECORE_EVAS_EWS_EVENT_ACTIVATE = ecore_event_type_new();
714 ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = ecore_event_type_new();
715 ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = ecore_event_type_new();
716 ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = ecore_event_type_new();
717 ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = ecore_event_type_new();
718 ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = ecore_event_type_new();
719}
720
721static int
722_ecore_evas_ews_init(void)
723{
724 _ecore_evas_init_count++;
725 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
726
727 _ecore_evas_ews_env_setup();
728
729 return _ecore_evas_init_count;
730}
731
732int
733_ecore_evas_ews_shutdown(void)
734{
735 _ecore_evas_init_count--;
736 if (_ecore_evas_init_count == 0)
737 {
738 if (_ews_ee)
739 {
740 ecore_evas_free(_ews_ee);
741 _ews_ee = NULL;
742 }
743 if (_ews_children)
744 {
745 eina_list_free(_ews_children);
746 _ews_children = NULL;
747 }
748
749 free(_ews_engine);
750 _ews_engine = NULL;
751 free(_ews_options);
752 _ews_options = NULL;
753 _ews_defaults_engine = EINA_TRUE;
754 _ews_defaults_geo = EINA_TRUE;
755
756 }
757 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
758 return _ecore_evas_init_count;
759}
760
761static void
762_ecore_evas_ews_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
763{
764 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
765
766 evas_object_geometry_get(ee->engine.ews.image, &xx, &yy, &ww, &hh);
767 evas_object_image_fill_get(ee->engine.ews.image, &fx, &fy, &fw, &fh);
768
769 if (fw < 1) fw = 1;
770 if (fh < 1) fh = 1;
771
772 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
773 {
774 *x = (ee->w * (*x - xx)) / fw;
775 *y = (ee->h * (*y - yy)) / fh;
776 }
777 else
778 {
779 xx = (*x - xx) - fx;
780 while (xx < 0) xx += fw;
781 while (xx > fw) xx -= fw;
782 *x = (ee->w * xx) / fw;
783
784 yy = (*y - yy) - fy;
785 while (yy < 0) yy += fh;
786 while (yy > fh) yy -= fh;
787 *y = (ee->h * yy) / fh;
788 }
789}
790
791static void
792_ecore_evas_ews_modifiers_apply(Ecore_Evas *ee, const Evas_Modifier *modifier)
793{
794 Evas *e = ee->evas;
795
796 if (evas_key_modifier_is_set(modifier, "Shift"))
797 evas_key_modifier_on(e, "Shift");
798 else evas_key_modifier_off(e, "Shift");
799
800 if (evas_key_modifier_is_set(modifier, "Control"))
801 evas_key_modifier_on(e, "Control");
802 else evas_key_modifier_off(e, "Control");
803
804 if (evas_key_modifier_is_set(modifier, "Alt"))
805 evas_key_modifier_on(e, "Alt");
806 else evas_key_modifier_off(e, "Alt");
807
808 if (evas_key_modifier_is_set(modifier, "Super"))
809 evas_key_modifier_on(e, "Super");
810 else evas_key_modifier_off(e, "Super");
811
812 if (evas_key_modifier_is_set(modifier, "Hyper"))
813 evas_key_modifier_on(e, "Hyper");
814 else evas_key_modifier_off(e, "Hyper");
815
816 if (evas_key_modifier_is_set(modifier, "Scroll_Lock"))
817 evas_key_lock_on(e, "Scroll_Lock");
818 else evas_key_lock_off(e, "Scroll_Lock");
819
820 if (evas_key_modifier_is_set(modifier, "Num_Lock"))
821 evas_key_lock_on(e, "Num_Lock");
822 else evas_key_lock_off(e, "Num_Lock");
823
824 if (evas_key_modifier_is_set(modifier, "Caps_Lock"))
825 evas_key_lock_on(e, "Caps_Lock");
826 else evas_key_lock_off(e, "Caps_Lock");
827
828 if (evas_key_modifier_is_set(modifier, "Shift_Lock"))
829 evas_key_lock_on(e, "Shift_Lock");
830 else evas_key_lock_off(e, "Shift_Lock");
831}
832
833static void
834_ecore_evas_ews_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
835{
836 Ecore_Evas *ee = data;
837 Evas_Event_Mouse_In *ev = event_info;
838 Evas_Coord x = ev->canvas.x;
839 Evas_Coord y = ev->canvas.y;
840 _ecore_evas_ews_coord_translate(ee, &x, &y);
841 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
842 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
843 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
844 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
845}
846
847static void
848_ecore_evas_ews_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
849{
850 Ecore_Evas *ee = data;
851 Evas_Event_Mouse_Out *ev = event_info;
852 Evas_Coord x = ev->canvas.x;
853 Evas_Coord y = ev->canvas.y;
854 // TODO: consider grab mode in EWS
855 _ecore_evas_ews_coord_translate(ee, &x, &y);
856 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
857 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
858 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
859 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
860 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
861}
862
863static void
864_ecore_evas_ews_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
865{
866 Ecore_Evas *ee = data;
867 Evas_Event_Mouse_Down *ev = event_info;
868 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
869 evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
870}
871
872static void
873_ecore_evas_ews_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
874{
875 Ecore_Evas *ee = data;
876 Evas_Event_Mouse_Up *ev = event_info;
877 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
878 evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
879}
880
881static void
882_ecore_evas_ews_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
883{
884 Ecore_Evas *ee = data;
885 Evas_Event_Mouse_Move *ev = event_info;
886 Evas_Coord x = ev->cur.canvas.x;
887 Evas_Coord y = ev->cur.canvas.y;
888 _ecore_evas_ews_coord_translate(ee, &x, &y);
889 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
890 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
891}
892
893static void
894_ecore_evas_ews_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
895{
896 Ecore_Evas *ee = data;
897 Evas_Event_Mouse_Wheel *ev = event_info;
898 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
899 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
900}
901
902static void
903_ecore_evas_ews_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
904{
905 Ecore_Evas *ee = data;
906 Evas_Event_Multi_Down *ev = event_info;
907 Evas_Coord x, y, xx, yy;
908 double xf, yf;
909
910 x = ev->canvas.x;
911 y = ev->canvas.y;
912 xx = x;
913 yy = y;
914 _ecore_evas_ews_coord_translate(ee, &x, &y);
915 xf = (ev->canvas.xsub - (double)xx) + (double)x;
916 yf = (ev->canvas.ysub - (double)yy) + (double)y;
917 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
918 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);
919}
920
921static void
922_ecore_evas_ews_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
923{
924 Ecore_Evas *ee = data;
925 Evas_Event_Multi_Up *ev = event_info;
926 Evas_Coord x, y, xx, yy;
927 double xf, yf;
928
929 x = ev->canvas.x;
930 y = ev->canvas.y;
931 xx = x;
932 yy = y;
933 _ecore_evas_ews_coord_translate(ee, &x, &y);
934 xf = (ev->canvas.xsub - (double)xx) + (double)x;
935 yf = (ev->canvas.ysub - (double)yy) + (double)y;
936 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
937 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);
938}
939
940static void
941_ecore_evas_ews_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
942{
943 Ecore_Evas *ee = data;
944 Evas_Event_Multi_Move *ev = event_info;
945 Evas_Coord x, y, xx, yy;
946 double xf, yf;
947
948 x = ev->cur.canvas.x;
949 y = ev->cur.canvas.y;
950 xx = x;
951 yy = y;
952 _ecore_evas_ews_coord_translate(ee, &x, &y);
953 xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
954 yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
955 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
956 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);
957}
958
959static void
960_ecore_evas_ews_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
961{
962 Ecore_Evas *ee = data;
963 if (ee->driver) _ecore_evas_free(ee);
964}
965
966static void
967_ecore_evas_ews_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
968{
969 Ecore_Evas *ee = data;
970 Evas_Event_Key_Down *ev = event_info;
971
972 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
973 evas_key_modifier_on(ee->evas, "Shift");
974 else
975 evas_key_modifier_off(ee->evas, "Shift");
976 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
977 evas_key_modifier_on(ee->evas, "Control");
978 else
979 evas_key_modifier_off(ee->evas, "Control");
980 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
981 evas_key_modifier_on(ee->evas, "Alt");
982 else
983 evas_key_modifier_off(ee->evas, "Alt");
984 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
985 evas_key_modifier_on(ee->evas, "Meta");
986 else
987 evas_key_modifier_off(ee->evas, "Meta");
988 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
989 evas_key_modifier_on(ee->evas, "Hyper");
990 else
991 evas_key_modifier_off(ee->evas, "Hyper");
992 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
993 evas_key_modifier_on(ee->evas, "Super");
994 else
995 evas_key_modifier_off(ee->evas, "Super");
996 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
997 evas_key_lock_on(ee->evas, "Scroll_Lock");
998 else
999 evas_key_lock_off(ee->evas, "Scroll_Lock");
1000 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
1001 evas_key_lock_on(ee->evas, "Num_Lock");
1002 else
1003 evas_key_lock_off(ee->evas, "Num_Lock");
1004 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
1005 evas_key_lock_on(ee->evas, "Caps_Lock");
1006 else
1007 evas_key_lock_off(ee->evas, "Caps_Lock");
1008 evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
1009}
1010
1011static void
1012_ecore_evas_ews_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
1013{
1014 Ecore_Evas *ee = data;
1015 Evas_Event_Key_Up *ev = event_info;
1016
1017 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
1018 evas_key_modifier_on(ee->evas, "Shift");
1019 else
1020 evas_key_modifier_off(ee->evas, "Shift");
1021 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
1022 evas_key_modifier_on(ee->evas, "Control");
1023 else
1024 evas_key_modifier_off(ee->evas, "Control");
1025 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
1026 evas_key_modifier_on(ee->evas, "Alt");
1027 else
1028 evas_key_modifier_off(ee->evas, "Alt");
1029 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
1030 evas_key_modifier_on(ee->evas, "Meta");
1031 else
1032 evas_key_modifier_off(ee->evas, "Meta");
1033 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
1034 evas_key_modifier_on(ee->evas, "Hyper");
1035 else
1036 evas_key_modifier_off(ee->evas, "Hyper");
1037 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
1038 evas_key_modifier_on(ee->evas, "Super");
1039 else
1040 evas_key_modifier_off(ee->evas, "Super");
1041 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
1042 evas_key_lock_on(ee->evas, "Scroll_Lock");
1043 else
1044 evas_key_lock_off(ee->evas, "Scroll_Lock");
1045 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
1046 evas_key_lock_on(ee->evas, "Num_Lock");
1047 else
1048 evas_key_lock_off(ee->evas, "Num_Lock");
1049 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
1050 evas_key_lock_on(ee->evas, "Caps_Lock");
1051 else
1052 evas_key_lock_off(ee->evas, "Caps_Lock");
1053 evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
1054}
1055
1056static void
1057_ecore_evas_ews_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1058{
1059 Ecore_Evas *ee = data;
1060 ecore_evas_focus_set(ee, EINA_TRUE);
1061}
1062
1063static void
1064_ecore_evas_ews_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1065{
1066 Ecore_Evas *ee = data;
1067 if (ee->deleted) return;
1068 ecore_evas_focus_set(ee, EINA_FALSE);
1069}
1070
1071static void
1072_ecore_evas_ews_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1073{
1074 Ecore_Evas *ee = data;
1075 ecore_evas_show(ee);
1076}
1077
1078static void
1079_ecore_evas_ews_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1080{
1081 Ecore_Evas *ee = data;
1082 if (ee->deleted) return;
1083 ecore_evas_hide(ee);
1084}
1085#endif
1086
1087EAPI Ecore_Evas *
1088ecore_evas_ews_new(int x, int y, int w, int h)
1089{
1090// basically a copy of ecore_evas_buffer_new() keep in sync...
1091#ifdef BUILD_ECORE_EVAS_EWS
1092 Evas_Object *o;
1093 Evas_Engine_Info_Buffer *einfo;
1094 Ecore_Evas *ee;
1095 int rmethod;
1096
1097 if (_ecore_evas_ews_init() < 1) return NULL;
1098
1099 if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new();
1100 if (!_ews_ee)
1101 {
1102 ERR("Could not create EWS backing store");
1103 _ecore_evas_ews_shutdown();
1104 return NULL;
1105 }
1106
1107 rmethod = evas_render_method_lookup("buffer");
1108 if (!rmethod) return NULL;
1109 ee = calloc(1, sizeof(Ecore_Evas));
1110 if (!ee) return NULL;
1111
1112 if (w < 1) w = 1;
1113 if (h < 1) h = 1;
1114
1115 o = evas_object_image_add(_ews_ee->evas);
1116 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
1117 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
1118 evas_object_image_size_set(o, w, h);
1119 evas_object_image_alpha_set(o, 1);
1120
1121 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
1122
1123 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_ews_engine_func;
1124
1125 ee->driver = EWS_ENGINE_NAME;
1126
1127 ee->x = 0;
1128 ee->y = 0;
1129 ee->w = w;
1130 ee->h = h;
1131 ee->req.x = ee->x;
1132 ee->req.y = ee->y;
1133 ee->req.w = ee->w;
1134 ee->req.h = ee->h;
1135
1136 /* init evas here */
1137 ee->evas = evas_new();
1138 evas_data_attach_set(ee->evas, ee);
1139 evas_output_method_set(ee->evas, rmethod);
1140 evas_output_size_set(ee->evas, w, h);
1141 evas_output_viewport_set(ee->evas, 0, 0, w, h);
1142
1143 evas_object_move(o, x, y);
1144 evas_object_resize(o, w, h);
1145 evas_object_image_fill_set(o, 0, 0, w, h);
1146
1147 ee->engine.ews.image = o;
1148 evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee);
1149 evas_object_event_callback_add(ee->engine.ews.image,
1150 EVAS_CALLBACK_MOUSE_IN,
1151 _ecore_evas_ews_cb_mouse_in, ee);
1152 evas_object_event_callback_add(ee->engine.ews.image,
1153 EVAS_CALLBACK_MOUSE_OUT,
1154 _ecore_evas_ews_cb_mouse_out, ee);
1155 evas_object_event_callback_add(ee->engine.ews.image,
1156 EVAS_CALLBACK_MOUSE_DOWN,
1157 _ecore_evas_ews_cb_mouse_down, ee);
1158 evas_object_event_callback_add(ee->engine.ews.image,
1159 EVAS_CALLBACK_MOUSE_UP,
1160 _ecore_evas_ews_cb_mouse_up, ee);
1161 evas_object_event_callback_add(ee->engine.ews.image,
1162 EVAS_CALLBACK_MOUSE_MOVE,
1163 _ecore_evas_ews_cb_mouse_move, ee);
1164 evas_object_event_callback_add(ee->engine.ews.image,
1165 EVAS_CALLBACK_MOUSE_WHEEL,
1166 _ecore_evas_ews_cb_mouse_wheel, ee);
1167 evas_object_event_callback_add(ee->engine.ews.image,
1168 EVAS_CALLBACK_MULTI_DOWN,
1169 _ecore_evas_ews_cb_multi_down, ee);
1170 evas_object_event_callback_add(ee->engine.ews.image,
1171 EVAS_CALLBACK_MULTI_UP,
1172 _ecore_evas_ews_cb_multi_up, ee);
1173 evas_object_event_callback_add(ee->engine.ews.image,
1174 EVAS_CALLBACK_MULTI_MOVE,
1175 _ecore_evas_ews_cb_multi_move, ee);
1176 evas_object_event_callback_add(ee->engine.ews.image,
1177 EVAS_CALLBACK_FREE,
1178 _ecore_evas_ews_cb_free, ee);
1179 evas_object_event_callback_add(ee->engine.ews.image,
1180 EVAS_CALLBACK_KEY_DOWN,
1181 _ecore_evas_ews_cb_key_down, ee);
1182 evas_object_event_callback_add(ee->engine.ews.image,
1183 EVAS_CALLBACK_KEY_UP,
1184 _ecore_evas_ews_cb_key_up, ee);
1185 evas_object_event_callback_add(ee->engine.ews.image,
1186 EVAS_CALLBACK_FOCUS_IN,
1187 _ecore_evas_ews_cb_focus_in, ee);
1188 evas_object_event_callback_add(ee->engine.ews.image,
1189 EVAS_CALLBACK_FOCUS_OUT,
1190 _ecore_evas_ews_cb_focus_out, ee);
1191 evas_object_event_callback_add(ee->engine.ews.image,
1192 EVAS_CALLBACK_SHOW,
1193 _ecore_evas_ews_cb_show, ee);
1194 evas_object_event_callback_add(ee->engine.ews.image,
1195 EVAS_CALLBACK_HIDE,
1196 _ecore_evas_ews_cb_hide, ee);
1197 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
1198 if (einfo)
1199 {
1200 void *pixels = evas_object_image_data_get(o, 1);
1201 evas_object_image_data_set(o, pixels); // refcount
1202 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
1203 einfo->info.dest_buffer = pixels;
1204 einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o);
1205 einfo->info.use_color_key = 0;
1206 einfo->info.alpha_threshold = 0;
1207 einfo->info.func.new_update_region = NULL;
1208 einfo->info.func.free_update_region = NULL;
1209 evas_object_image_data_set(o, pixels);
1210 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1211 {
1212 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1213 ecore_evas_free(ee);
1214 return NULL;
1215 }
1216 }
1217 else
1218 {
1219 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1220 ecore_evas_free(ee);
1221 return NULL;
1222 }
1223 evas_key_modifier_add(ee->evas, "Shift");
1224 evas_key_modifier_add(ee->evas, "Control");
1225 evas_key_modifier_add(ee->evas, "Alt");
1226 evas_key_modifier_add(ee->evas, "Meta");
1227 evas_key_modifier_add(ee->evas, "Hyper");
1228 evas_key_modifier_add(ee->evas, "Super");
1229 evas_key_lock_add(ee->evas, "Caps_Lock");
1230 evas_key_lock_add(ee->evas, "Num_Lock");
1231 evas_key_lock_add(ee->evas, "Scroll_Lock");
1232
1233 _ews_ee->sub_ecore_evas = eina_list_append(_ews_ee->sub_ecore_evas, ee);
1234 _ews_children = eina_list_append(_ews_children, ee);
1235
1236 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD);
1237
1238 return ee;
1239#else
1240 return NULL;
1241 (void)x;
1242 (void)y;
1243 (void)w;
1244 (void)h;
1245#endif
1246}
1247
1248EAPI Evas_Object *
1249ecore_evas_ews_backing_store_get(const Ecore_Evas *ee)
1250{
1251#ifdef BUILD_ECORE_EVAS_EWS
1252 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1253 {
1254 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1255 "ecore_evas_ews_backing_store_get");
1256 return NULL;
1257 }
1258 return ee->engine.ews.image;
1259#else
1260 return NULL;
1261 (void)ee;
1262#endif
1263}
1264
1265EAPI void
1266ecore_evas_ews_delete_request(Ecore_Evas *ee)
1267{
1268#ifdef BUILD_ECORE_EVAS_EWS
1269 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1270 {
1271 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1272 "ecore_evas_ews_delete_request");
1273 return;
1274 }
1275 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
1276 else ecore_evas_free(ee);
1277#else
1278 (void)ee;
1279#endif
1280}
1281
1282
1283EAPI Eina_Bool
1284ecore_evas_ews_engine_set(const char *engine, const char *options)
1285{
1286#ifdef BUILD_ECORE_EVAS_EWS
1287 if (_ews_ee) return EINA_FALSE;
1288
1289 free(_ews_engine);
1290 free(_ews_options);
1291
1292 _ews_engine = engine ? strdup(engine) : NULL;
1293 _ews_options = options ? strdup(options) : NULL;
1294
1295 if ((engine) && (!_ews_engine)) return EINA_FALSE;
1296 if ((options) && (!_ews_options)) return EINA_FALSE;
1297
1298 _ews_defaults_engine = EINA_FALSE;
1299 return EINA_TRUE;
1300#else
1301 return EINA_FALSE;
1302 (void)engine;
1303 (void)options;
1304#endif
1305}
1306
1307EAPI Eina_Bool
1308ecore_evas_ews_setup(int x, int y, int w, int h)
1309{
1310#ifdef BUILD_ECORE_EVAS_EWS
1311 Eina_Bool ret = EINA_TRUE;
1312
1313 _ews_defaults_geo = EINA_FALSE;
1314 _ews_x = x;
1315 _ews_y = y;
1316 _ews_w = w;
1317 _ews_h = h;
1318
1319 if (!_ews_ee) return EINA_TRUE;
1320
1321 /* move-resize is not as implemented as move + resize */
1322 ecore_evas_move(_ews_ee, x, y);
1323 ecore_evas_size_min_set(_ews_ee, w, h);
1324 ecore_evas_size_max_set(_ews_ee, w, h);
1325 ecore_evas_resize(_ews_ee, w, h);
1326
1327 ecore_evas_geometry_get(_ews_ee, &x, &y, &w, &h);
1328
1329#define TST(n) if ((n != _ews_##n)) \
1330 { \
1331 WRN("Asked %d, got %d for "#n, _ews_##n, n); \
1332 ret = EINA_FALSE; \
1333 }
1334 TST(x);
1335 TST(y);
1336 TST(w);
1337 TST(h);
1338#undef TST
1339 return ret;
1340#else
1341 return EINA_FALSE;
1342 (void)x;
1343 (void)y;
1344 (void)w;
1345 (void)h;
1346#endif
1347}
1348
1349EAPI Ecore_Evas *
1350ecore_evas_ews_ecore_evas_get(void)
1351{
1352#ifdef BUILD_ECORE_EVAS_EWS
1353 if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new();
1354 return _ews_ee;
1355#else
1356 return NULL;
1357#endif
1358}
1359
1360EAPI Evas *
1361ecore_evas_ews_evas_get(void)
1362{
1363#ifdef BUILD_ECORE_EVAS_EWS
1364 return ecore_evas_get(ecore_evas_ews_ecore_evas_get());
1365#else
1366 return NULL;
1367#endif
1368}
1369
1370EAPI Evas_Object *
1371ecore_evas_ews_background_get(void)
1372{
1373#ifdef BUILD_ECORE_EVAS_EWS
1374 return _ews_bg;
1375#else
1376 return NULL;
1377#endif
1378}
1379
1380#ifdef BUILD_ECORE_EVAS_EWS
1381static void
1382_ecore_evas_ews_background_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
1383{
1384 _ews_bg = NULL;
1385 ecore_evas_ews_background_set(NULL);
1386}
1387#endif
1388
1389EAPI void
1390ecore_evas_ews_background_set(Evas_Object *o)
1391{
1392#ifdef BUILD_ECORE_EVAS_EWS
1393 if ((o) && (o == _ews_bg)) return;
1394
1395 if (_ews_bg)
1396 {
1397 evas_object_del(_ews_bg);
1398 _ews_bg = NULL;
1399 }
1400
1401 if ((!o) && (_ews_ee))
1402 {
1403 o = evas_object_rectangle_add(ecore_evas_get(_ews_ee));
1404 evas_object_color_set(o, 0, 0, 0, 255);
1405 }
1406
1407 if (_ews_ee)
1408 {
1409 Evas_Coord w, h;
1410 Evas *e = ecore_evas_get(_ews_ee);
1411
1412 if (e != evas_object_evas_get(o))
1413 {
1414 ERR("background not in ecore_evas_ews_evas_get() canvas!");
1415 return;
1416 }
1417
1418 evas_output_viewport_get(e, NULL, NULL, &w, &h);
1419 evas_object_move(o, 0, 0);
1420 evas_object_resize(o, w, h);
1421 evas_object_layer_set(o, EVAS_LAYER_MIN);
1422 evas_object_lower(o);
1423 evas_object_show(o);
1424
1425 evas_object_event_callback_add
1426 (o, EVAS_CALLBACK_FREE, _ecore_evas_ews_background_free, NULL);
1427 }
1428
1429 _ews_bg = o;
1430#else
1431 return;
1432 (void)o;
1433#endif
1434}
1435
1436
1437EAPI const Eina_List *
1438ecore_evas_ews_children_get(void)
1439{
1440#ifdef BUILD_ECORE_EVAS_EWS
1441 return _ews_children;
1442#else
1443 return NULL;
1444#endif
1445}
1446
1447EAPI void
1448ecore_evas_ews_manager_set(const void *manager)
1449{
1450#ifdef BUILD_ECORE_EVAS_EWS
1451 if (_ews_manager == manager) return;
1452 _ews_manager = manager;
1453 ecore_event_add(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE, NULL, NULL, NULL);
1454#else
1455 (void)manager;
1456#endif
1457}
1458
1459EAPI const void *
1460ecore_evas_ews_manager_get(void)
1461{
1462#ifdef BUILD_ECORE_EVAS_EWS
1463 return _ews_manager;
1464#else
1465 return NULL;
1466#endif
1467}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c
deleted file mode 100644
index a7ea4c3..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c
+++ /dev/null
@@ -1,2169 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <sys/types.h>
8#include <unistd.h>
9#include <math.h>
10#include <time.h>
11#ifdef HAVE_SYS_MMAN_H
12# include <sys/mman.h>
13#endif
14#include <sys/stat.h>
15#include <fcntl.h>
16#include <string.h>
17#include <sys/file.h>
18#include <unistd.h>
19
20#include <Ecore.h>
21#include "ecore_private.h"
22#include <Ecore_Input.h>
23
24#ifdef BUILD_ECORE_EVAS_EXTN
25
26#include <Ecore_Ipc.h>
27
28#endif
29
30#include "ecore_evas_private.h"
31#include "Ecore_Evas.h"
32
33
34#ifdef BUILD_ECORE_EVAS_EXTN
35
36
37typedef struct _Shmfile Shmfile;
38
39struct _Shmfile
40{
41 int fd;
42 int size;
43 void *addr;
44 const char *file;
45};
46
47static int blank = 0x00000000;
48
49static Shmfile *
50shmfile_new(const char *base, int id, int size, Eina_Bool sys)
51{
52 Shmfile *sf;
53 char file[PATH_MAX];
54
55 sf = calloc(1, sizeof(Shmfile));
56 do
57 {
58 mode_t mode;
59
60 snprintf(file, sizeof(file), "/%s-%i-%i.%i.%i",
61 base, id, (int)time(NULL), (int)getpid(), (int)rand());
62 mode = S_IRUSR | S_IWUSR;
63 if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
64 sf->fd = shm_open(file, O_RDWR | O_CREAT | O_EXCL, mode);
65 }
66 while (sf->fd < 0);
67
68 sf->file = eina_stringshare_add(file);
69 if (!sf->file)
70 {
71 close(sf->fd);
72 shm_unlink(sf->file);
73 eina_stringshare_del(sf->file);
74 free(sf);
75 return NULL;
76 }
77 sf->size = size;
78 if (ftruncate(sf->fd, size) < 0)
79 {
80 close(sf->fd);
81 shm_unlink(sf->file);
82 eina_stringshare_del(sf->file);
83 free(sf);
84 return NULL;
85 }
86 sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0);
87 if (sf->addr == MAP_FAILED)
88 {
89 close(sf->fd);
90 shm_unlink(sf->file);
91 eina_stringshare_del(sf->file);
92 free(sf);
93 return NULL;
94 }
95 return sf;
96}
97
98void
99shmfile_free(Shmfile *sf)
100{
101 munmap(sf->addr, sf->size);
102 close(sf->fd);
103 shm_unlink(sf->file);
104 eina_stringshare_del(sf->file);
105 free(sf);
106}
107
108static Shmfile *
109shmfile_open(const char *ref, int size, Eina_Bool sys)
110{
111 Shmfile *sf;
112 mode_t mode;
113
114 sf = calloc(1, sizeof(Shmfile));
115 mode = S_IRUSR | S_IWUSR;
116 if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
117 sf->fd = shm_open(ref, O_RDWR, mode);
118 if (sf->fd < 0)
119 {
120 free(sf);
121 return NULL;
122 }
123 sf->file = eina_stringshare_add(ref);
124 if (!sf->file)
125 {
126 close(sf->fd);
127 eina_stringshare_del(sf->file);
128 free(sf);
129 return NULL;
130 }
131 sf->size = size;
132 sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0);
133 if (sf->addr == MAP_FAILED)
134 {
135 close(sf->fd);
136 eina_stringshare_del(sf->file);
137 free(sf);
138 return NULL;
139 }
140 return sf;
141}
142
143void
144shmfile_close(Shmfile *sf)
145{
146 munmap(sf->addr, sf->size);
147 close(sf->fd);
148 eina_stringshare_del(sf->file);
149 free(sf);
150}
151
152// procotol version - change this as needed
153#define MAJOR 0x1011
154
155enum // opcodes
156{
157 OP_RESIZE,
158 OP_SHOW,
159 OP_HIDE,
160 OP_FOCUS,
161 OP_UNFOCUS,
162 OP_UPDATE,
163 OP_UPDATE_DONE,
164 OP_LOCK_FILE,
165 OP_SHM_REF,
166 OP_EV_MOUSE_IN,
167 OP_EV_MOUSE_OUT,
168 OP_EV_MOUSE_UP,
169 OP_EV_MOUSE_DOWN,
170 OP_EV_MOUSE_MOVE,
171 OP_EV_MOUSE_WHEEL,
172 OP_EV_MULTI_UP,
173 OP_EV_MULTI_DOWN,
174 OP_EV_MULTI_MOVE,
175 OP_EV_KEY_UP,
176 OP_EV_KEY_DOWN,
177 OP_EV_HOLD
178};
179
180enum
181{
182 MOD_SHIFT = (1 << 0),
183 MOD_CTRL = (1 << 1),
184 MOD_ALT = (1 << 2),
185 MOD_META = (1 << 3),
186 MOD_HYPER = (1 << 4),
187 MOD_SUPER = (1 << 5),
188 MOD_CAPS = (1 << 6),
189 MOD_NUM = (1 << 7),
190 MOD_SCROLL = (1 << 8),
191};
192
193typedef struct _Ipc_Data_Resize Ipc_Data_Resize;
194typedef struct _Ipc_Data_Update Ipc_Data_Update;
195typedef struct _Ipc_Data_Ev_Mouse_In Ipc_Data_Ev_Mouse_In;
196typedef struct _Ipc_Data_Ev_Mouse_Out Ipc_Data_Ev_Mouse_Out;
197typedef struct _Ipc_Data_Ev_Mouse_Up Ipc_Data_Ev_Mouse_Up;
198typedef struct _Ipc_Data_Ev_Mouse_Down Ipc_Data_Ev_Mouse_Down;
199typedef struct _Ipc_Data_Ev_Mouse_Move Ipc_Data_Ev_Mouse_Move;
200typedef struct _Ipc_Data_Ev_Mouse_Wheel Ipc_Data_Ev_Mouse_Wheel;
201typedef struct _Ipc_Data_Ev_Hold Ipc_Data_Ev_Hold;
202typedef struct _Ipc_Data_Ev_Multi_Up Ipc_Data_Ev_Multi_Up;
203typedef struct _Ipc_Data_Ev_Multi_Down Ipc_Data_Ev_Multi_Down;
204typedef struct _Ipc_Data_Ev_Multi_Move Ipc_Data_Ev_Multi_Move;
205typedef struct _Ipc_Data_Ev_Key_Up Ipc_Data_Ev_Key_Up;
206typedef struct _Ipc_Data_Ev_Key_Down Ipc_Data_Ev_Key_Down;
207
208struct _Ipc_Data_Resize
209{
210 int w, h;
211};
212
213struct _Ipc_Data_Update
214{
215 int x, w, y, h;
216};
217
218struct _Ipc_Data_Ev_Mouse_In
219{
220 unsigned int timestamp;
221 int mask;
222 Evas_Event_Flags event_flags;
223};
224
225struct _Ipc_Data_Ev_Mouse_Out
226{
227 unsigned int timestamp;
228 int mask;
229 Evas_Event_Flags event_flags;
230};
231
232struct _Ipc_Data_Ev_Mouse_Up
233{
234 int b;
235 Evas_Button_Flags flags;
236 int mask;
237 unsigned int timestamp;
238 Evas_Event_Flags event_flags;
239};
240
241struct _Ipc_Data_Ev_Mouse_Down
242{
243 int b;
244 Evas_Button_Flags flags;
245 int mask;
246 unsigned int timestamp;
247 Evas_Event_Flags event_flags;
248};
249
250struct _Ipc_Data_Ev_Mouse_Move
251{
252 int x, y;
253 Evas_Button_Flags flags;
254 int mask;
255 unsigned int timestamp;
256 Evas_Event_Flags event_flags;
257};
258
259struct _Ipc_Data_Ev_Mouse_Wheel
260{
261 int direction, z;
262 Evas_Button_Flags flags;
263 int mask;
264 unsigned int timestamp;
265 Evas_Event_Flags event_flags;
266};
267
268struct _Ipc_Data_Ev_Hold
269{
270 int hold;
271 unsigned int timestamp;
272 Evas_Event_Flags event_flags;
273};
274
275struct _Ipc_Data_Ev_Multi_Up
276{
277 Evas_Button_Flags flags;
278 int d, x, y;
279 double rad, radx, rady, pres, ang, fx, fy;
280 int mask;
281 unsigned int timestamp;
282 Evas_Event_Flags event_flags;
283};
284
285struct _Ipc_Data_Ev_Multi_Down
286{
287 Evas_Button_Flags flags;
288 int d, x, y;
289 double rad, radx, rady, pres, ang, fx, fy;
290 int mask;
291 unsigned int timestamp;
292 Evas_Event_Flags event_flags;
293};
294
295struct _Ipc_Data_Ev_Multi_Move
296{
297 int d, x, y;
298 double rad, radx, rady, pres, ang, fx, fy;
299 int mask;
300 unsigned int timestamp;
301 Evas_Event_Flags event_flags;
302};
303
304struct _Ipc_Data_Ev_Key_Up
305{
306 const char *keyname, *key, *string, *compose;
307 int mask;
308 unsigned int timestamp;
309 Evas_Event_Flags event_flags;
310};
311
312struct _Ipc_Data_Ev_Key_Down
313{
314 const char *keyname, *key, *string, *compose;
315 int mask;
316 unsigned int timestamp;
317 Evas_Event_Flags event_flags;
318};
319
320typedef struct _Extn Extn;
321
322struct _Extn
323{
324 struct {
325 Ecore_Ipc_Server *server;
326 Eina_List *clients;
327 Eina_List *handlers;
328 Eina_Bool am_server : 1;
329 } ipc;
330 struct {
331 const char *name;
332 int num;
333 Eina_Bool sys : 1;
334 } svc;
335 struct {
336 const char *lock;
337 int lockfd;
338 const char *shm;
339 int w, h;
340 Shmfile *shmfile;
341 Eina_List *updates;
342 Eina_Bool have_lock : 1;
343 } file;
344};
345
346static Eina_List *extn_ee_list = NULL;
347
348EAPI int ECORE_EVAS_EXTN_CLIENT_ADD = 0;
349EAPI int ECORE_EVAS_EXTN_CLIENT_DEL = 0;
350
351void
352_ecore_evas_extn_init(void)
353{
354 if (ECORE_EVAS_EXTN_CLIENT_ADD) return;
355 ECORE_EVAS_EXTN_CLIENT_ADD = ecore_event_type_new();
356 ECORE_EVAS_EXTN_CLIENT_DEL = ecore_event_type_new();
357}
358
359void
360_ecore_evas_extn_shutdown(void)
361{
362}
363
364static void
365_ecore_evas_extn_event_free(void *data, void *ev __UNUSED__)
366{
367 Ecore_Evas *ee = data;
368 if (ee->engine.buffer.image)
369 evas_object_unref(ee->engine.buffer.image);
370 _ecore_evas_unref(ee);
371}
372
373static void
374_ecore_evas_extn_event(Ecore_Evas *ee, int event)
375{
376 _ecore_evas_ref(ee);
377 if (ee->engine.buffer.image)
378 evas_object_ref(ee->engine.buffer.image);
379 ecore_event_add(event, ee->engine.buffer.image,
380 _ecore_evas_extn_event_free, ee);
381}
382
383static void
384_ecore_evas_socket_lock(Ecore_Evas *ee)
385{
386 Extn *extn;
387
388 extn = ee->engine.buffer.data;
389 if (!extn) return;
390 if (extn->file.lockfd < 0) return;
391 if (extn->file.have_lock) return;
392 flock(extn->file.lockfd, LOCK_EX);
393 extn->file.have_lock = EINA_TRUE;
394}
395
396static void
397_ecore_evas_socket_unlock(Ecore_Evas *ee)
398{
399 Extn *extn;
400
401 extn = ee->engine.buffer.data;
402 if (!extn) return;
403 if (extn->file.lockfd < 0) return;
404 if (!extn->file.have_lock) return;
405 flock(extn->file.lockfd, LOCK_UN);
406 extn->file.have_lock = EINA_FALSE;
407}
408
409static void
410_ecore_evas_extn_plug_targer_render_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
411{
412 Ecore_Evas *ee = data;
413 if (ee) _ecore_evas_socket_lock(ee);
414}
415
416static void
417_ecore_evas_extn_plug_targer_render_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
418{
419 Ecore_Evas *ee = data;
420 if (ee) _ecore_evas_socket_unlock(ee);
421}
422
423static void
424_ecore_evas_extn_plug_image_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
425{
426 Ecore_Evas *ee = data;
427 if (ee) ecore_evas_free(ee);
428}
429
430static void
431_ecore_evas_extn_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
432{
433 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
434
435 evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh);
436 evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh);
437
438 if (fw < 1) fw = 1;
439 if (fh < 1) fh = 1;
440
441 if (evas_object_map_get(ee->engine.buffer.image) &&
442 evas_object_map_enable_get(ee->engine.buffer.image))
443 {
444 fx = 0; fy = 0;
445 fw = ee->w; fh = ee->h;
446 ww = ee->w; hh = ee->h;
447 }
448
449 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
450 {
451 *x = (ee->w * (*x - xx)) / fw;
452 *y = (ee->h * (*y - yy)) / fh;
453 }
454 else
455 {
456 xx = (*x - xx) - fx;
457 while (xx < 0) xx += fw;
458 while (xx > fw) xx -= fw;
459 *x = (ee->w * xx) / fw;
460
461 yy = (*y - yy) - fy;
462 while (yy < 0) yy += fh;
463 while (yy > fh) yy -= fh;
464 *y = (ee->h * yy) / fh;
465 }
466}
467
468static void
469_ecore_evas_extn_free(Ecore_Evas *ee)
470{
471 Extn *extn;
472 Ecore_Ipc_Client *client;
473
474 extn = ee->engine.buffer.data;
475 if (extn)
476 {
477 Ecore_Event_Handler *hdl;
478
479 if (extn->file.have_lock)
480 _ecore_evas_socket_unlock(ee);
481 if (extn->file.lockfd)
482 {
483 close(extn->file.lockfd);
484 if (extn->ipc.am_server)
485 {
486 if (extn->file.lock) unlink(extn->file.lock);
487 }
488 }
489 if (extn->svc.name) eina_stringshare_del(extn->svc.name);
490 if (extn->ipc.clients)
491 {
492 EINA_LIST_FREE(extn->ipc.clients, client)
493 ecore_ipc_client_del(client);
494 }
495 if (extn->ipc.server) ecore_ipc_server_del(extn->ipc.server);
496 if (extn->file.lock) eina_stringshare_del(extn->file.lock);
497 if (extn->file.shm) eina_stringshare_del(extn->file.shm);
498 if (extn->file.shmfile)
499 {
500 if (extn->ipc.am_server)
501 shmfile_free(extn->file.shmfile);
502 else
503 shmfile_close(extn->file.shmfile);
504 }
505
506 EINA_LIST_FREE(extn->ipc.handlers, hdl)
507 ecore_event_handler_del(hdl);
508 free(extn);
509 ecore_ipc_shutdown();
510 ee->engine.buffer.data = NULL;
511 }
512 if (ee->engine.buffer.image)
513 {
514 Ecore_Evas *ee2;
515
516 evas_object_event_callback_del_full(ee->engine.buffer.image,
517 EVAS_CALLBACK_DEL,
518 _ecore_evas_extn_plug_image_obj_del,
519 ee);
520 evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image),
521 EVAS_CALLBACK_RENDER_PRE,
522 _ecore_evas_extn_plug_targer_render_pre,
523 ee);
524 evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image),
525 EVAS_CALLBACK_RENDER_POST,
526 _ecore_evas_extn_plug_targer_render_post,
527 ee);
528 evas_object_del(ee->engine.buffer.image);
529 ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent");
530 if (ee2)
531 {
532 ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee);
533 }
534 }
535 extn_ee_list = eina_list_remove(extn_ee_list, ee);
536}
537
538static void
539_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
540{
541 if (w < 1) w = 1;
542 if (h < 1) h = 1;
543 ee->req.w = w;
544 ee->req.h = h;
545 if ((w == ee->w) && (h == ee->h)) return;
546 ee->w = w;
547 ee->h = h;
548
549 /*
550 * No need for it if not used later.
551 Extn *extn;
552
553 extn = ee->engine.buffer.data;
554 */
555 if (ee->engine.buffer.image)
556 evas_object_image_size_set(ee->engine.buffer.image, ee->w, ee->h);
557 /* Server can have many plugs, so I block resize comand from client to server *
558 if ((extn) && (extn->ipc.server))
559 {
560 Ipc_Data_Resize ipc;
561
562 ipc.w = ee->w;
563 ipc.h = ee->h;
564 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_RESIZE, 0, 0, 0, &ipc, sizeof(ipc));
565 }*/
566 if (ee->func.fn_resize) ee->func.fn_resize(ee);
567}
568
569static void
570_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
571{
572 _ecore_evas_resize(ee, w, h);
573}
574
575static int
576_ecore_evas_modifiers_locks_mask_get(Evas *e)
577{
578 int mask = 0;
579
580 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
581 mask |= MOD_SHIFT;
582 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
583 mask |= MOD_CTRL;
584 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
585 mask |= MOD_ALT;
586 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
587 mask |= MOD_META;
588 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
589 mask |= MOD_HYPER;
590 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
591 mask |= MOD_SUPER;
592 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
593 mask |= MOD_SCROLL;
594 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
595 mask |= MOD_NUM;
596 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
597 mask |= MOD_CAPS;
598 return mask;
599}
600
601static void
602_ecore_evas_modifiers_locks_mask_set(Evas *e, int mask)
603{
604 if (mask & MOD_SHIFT) evas_key_modifier_on (e, "Shift");
605 else evas_key_modifier_off(e, "Shift");
606 if (mask & MOD_CTRL) evas_key_modifier_on (e, "Control");
607 else evas_key_modifier_off(e, "Control");
608 if (mask & MOD_ALT) evas_key_modifier_on (e, "Alt");
609 else evas_key_modifier_off(e, "Alt");
610 if (mask & MOD_META) evas_key_modifier_on (e, "Meta");
611 else evas_key_modifier_off(e, "Meta");
612 if (mask & MOD_HYPER) evas_key_modifier_on (e, "Hyper");
613 else evas_key_modifier_off(e, "Hyper");
614 if (mask & MOD_SUPER) evas_key_modifier_on (e, "Super");
615 else evas_key_modifier_off(e, "Super");
616 if (mask & MOD_SCROLL) evas_key_lock_on (e, "Scroll_Lock");
617 else evas_key_lock_off(e, "Scroll_Lock");
618 if (mask & MOD_NUM) evas_key_lock_on (e, "Num_Lock");
619 else evas_key_lock_off(e, "Num_Lock");
620 if (mask & MOD_CAPS) evas_key_lock_on (e, "Caps_Lock");
621 else evas_key_lock_off(e, "Caps_Lock");
622}
623
624static void
625_ecore_evas_extn_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
626{
627 Ecore_Evas *ee = data;
628 Evas_Event_Mouse_In *ev = event_info;
629 Extn *extn;
630
631 extn = ee->engine.buffer.data;
632 if (!extn) return;
633 if (extn->ipc.server)
634 {
635 Ipc_Data_Ev_Mouse_In ipc;
636
637 ipc.timestamp = ev->timestamp;
638 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
639 ipc.event_flags = ev->event_flags;
640 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_IN, 0, 0, 0, &ipc, sizeof(ipc));
641 }
642}
643
644static void
645_ecore_evas_extn_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
646{
647 Ecore_Evas *ee = data;
648 Evas_Event_Mouse_Out *ev = event_info;
649 Extn *extn;
650
651 extn = ee->engine.buffer.data;
652 if (!extn) return;
653 if (extn->ipc.server)
654 {
655 Ipc_Data_Ev_Mouse_Out ipc;
656
657 ipc.timestamp = ev->timestamp;
658 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
659 ipc.event_flags = ev->event_flags;
660 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_OUT, 0, 0, 0, &ipc, sizeof(ipc));
661 }
662}
663
664static void
665_ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
666{
667 Ecore_Evas *ee = data;
668 Evas_Event_Mouse_Down *ev = event_info;
669 Extn *extn;
670
671 extn = ee->engine.buffer.data;
672 if (!extn) return;
673 if (extn->ipc.server)
674 {
675 Ipc_Data_Ev_Mouse_Down ipc;
676
677 ipc.b = ev->button;
678 ipc.flags = ev->flags;
679 ipc.timestamp = ev->timestamp;
680 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
681 ipc.event_flags = ev->event_flags;
682 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_DOWN, 0, 0, 0, &ipc, sizeof(ipc));
683 }
684}
685
686static void
687_ecore_evas_extn_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
688{
689 Ecore_Evas *ee = data;
690 Evas_Event_Mouse_Up *ev = event_info;
691 Extn *extn;
692
693 extn = ee->engine.buffer.data;
694 if (!extn) return;
695 if (extn->ipc.server)
696 {
697 Ipc_Data_Ev_Mouse_Up ipc;
698
699 ipc.b = ev->button;
700 ipc.flags = ev->flags;
701 ipc.timestamp = ev->timestamp;
702 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
703 ipc.event_flags = ev->event_flags;
704 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_UP, 0, 0, 0, &ipc, sizeof(ipc));
705 }
706}
707
708static void
709_ecore_evas_extn_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
710{
711 Ecore_Evas *ee = data;
712 Evas_Event_Mouse_Move *ev = event_info;
713 Extn *extn;
714
715 extn = ee->engine.buffer.data;
716 if (!extn) return;
717 if (extn->ipc.server)
718 {
719 Ipc_Data_Ev_Mouse_Move ipc;
720 Evas_Coord x, y;
721
722 x = ev->cur.canvas.x;
723 y = ev->cur.canvas.y;
724 _ecore_evas_extn_coord_translate(ee, &x, &y);
725 ipc.x = x;
726 ipc.y = y;
727 ipc.timestamp = ev->timestamp;
728 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
729 ipc.event_flags = ev->event_flags;
730 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc, sizeof(ipc));
731 }
732}
733
734static void
735_ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
736{
737 Ecore_Evas *ee = data;
738 Evas_Event_Mouse_Wheel *ev = event_info;
739 Extn *extn;
740
741 extn = ee->engine.buffer.data;
742 if (!extn) return;
743 if (extn->ipc.server)
744 {
745 Ipc_Data_Ev_Mouse_Wheel ipc;
746
747 ipc.direction = ev->direction;
748 ipc.z = ev->z;
749 ipc.timestamp = ev->timestamp;
750 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
751 ipc.event_flags = ev->event_flags;
752 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_WHEEL, 0, 0, 0, &ipc, sizeof(ipc));
753 }
754}
755
756static void
757_ecore_evas_extn_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
758{
759 Ecore_Evas *ee = data;
760 Evas_Event_Multi_Down *ev = event_info;
761 Extn *extn;
762
763 extn = ee->engine.buffer.data;
764 if (!extn) return;
765 if (extn->ipc.server)
766 {
767 Ipc_Data_Ev_Multi_Down ipc;
768 Evas_Coord x, y;
769
770 ipc.d = ev->device;
771 x = ev->canvas.x;
772 y = ev->canvas.y;
773 _ecore_evas_extn_coord_translate(ee, &x, &y);
774 ipc.x = x;
775 ipc.y = y;
776 ipc.rad = ev->radius;
777 ipc.radx = ev->radius_x;
778 ipc.rady = ev->radius_y;
779 ipc.pres = ev->pressure;
780 ipc.ang = ev->angle;
781 ipc.fx = ev->canvas.xsub;
782 ipc.fy = ev->canvas.ysub;
783 ipc.flags = ev->flags;
784 ipc.timestamp = ev->timestamp;
785 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
786 ipc.event_flags = ev->event_flags;
787 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_DOWN, 0, 0, 0, &ipc, sizeof(ipc));
788 }
789}
790
791
792static void
793_ecore_evas_extn_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
794{
795 Ecore_Evas *ee = data;
796 Evas_Event_Multi_Up *ev = event_info;
797 Extn *extn;
798
799 extn = ee->engine.buffer.data;
800 if (!extn) return;
801 if (extn->ipc.server)
802 {
803 Ipc_Data_Ev_Multi_Up ipc;
804 Evas_Coord x, y;
805
806 ipc.d = ev->device;
807 x = ev->canvas.x;
808 y = ev->canvas.y;
809 _ecore_evas_extn_coord_translate(ee, &x, &y);
810 ipc.x = x;
811 ipc.y = y;
812 ipc.rad = ev->radius;
813 ipc.radx = ev->radius_x;
814 ipc.rady = ev->radius_y;
815 ipc.pres = ev->pressure;
816 ipc.ang = ev->angle;
817 ipc.fx = ev->canvas.xsub;
818 ipc.fy = ev->canvas.ysub;
819 ipc.flags = ev->flags;
820 ipc.timestamp = ev->timestamp;
821 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
822 ipc.event_flags = ev->event_flags;
823 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_UP, 0, 0, 0, &ipc, sizeof(ipc));
824 }
825}
826
827static void
828_ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
829{
830 Ecore_Evas *ee = data;
831 Evas_Event_Multi_Move *ev = event_info;
832 Extn *extn;
833
834 extn = ee->engine.buffer.data;
835 if (!extn) return;
836 if (extn->ipc.server)
837 {
838 Ipc_Data_Ev_Multi_Move ipc;
839 Evas_Coord x, y;
840
841 ipc.d = ev->device;
842 x = ev->cur.canvas.x;
843 y = ev->cur.canvas.y;
844 _ecore_evas_extn_coord_translate(ee, &x, &y);
845 ipc.x = x;
846 ipc.y = y;
847 ipc.rad = ev->radius;
848 ipc.radx = ev->radius_x;
849 ipc.rady = ev->radius_y;
850 ipc.pres = ev->pressure;
851 ipc.ang = ev->angle;
852 ipc.fx = ev->cur.canvas.xsub;
853 ipc.fy = ev->cur.canvas.ysub;
854 ipc.timestamp = ev->timestamp;
855 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
856 ipc.event_flags = ev->event_flags;
857 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_MOVE, 0, 0, 0, &ipc, sizeof(ipc));
858 }
859}
860
861static void
862_ecore_evas_extn_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
863{
864 Ecore_Evas *ee;
865
866 ee = data;
867 if (ee->driver) _ecore_evas_free(ee);
868}
869
870static void
871_ecore_evas_extn_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
872{
873 Ecore_Evas *ee = data;
874 Evas_Event_Key_Down *ev = event_info;
875 Extn *extn;
876
877 extn = ee->engine.buffer.data;
878 if (!extn) return;
879 if (extn->ipc.server)
880 {
881 Ipc_Data_Ev_Key_Down *ipc;
882 char *st, *p;
883 int len = 0;
884
885 len = sizeof(Ipc_Data_Ev_Key_Down);
886 if (ev->key) len += strlen(ev->key) + 1;
887 if (ev->keyname) len += strlen(ev->keyname) + 1;
888 if (ev->string) len += strlen(ev->string) + 1;
889 if (ev->compose) len += strlen(ev->compose) + 1;
890 len += 1;
891 st = alloca(len);
892 ipc = (Ipc_Data_Ev_Key_Down *)st;
893 memset(st, 0, len);
894 p = st + sizeof(Ipc_Data_Ev_Key_Down);
895 if (ev->key)
896 {
897 strcpy(p, ev->key);
898 ipc->key = p - (long)st;
899 p += strlen(p) + 1;
900 }
901 if (ev->keyname)
902 {
903 strcpy(p, ev->keyname);
904 ipc->keyname = p - (long)st;
905 p += strlen(p) + 1;
906 }
907 if (ev->string)
908 {
909 strcpy(p, ev->string);
910 ipc->string = p - (long)st;
911 p += strlen(p) + 1;
912 }
913 if (ev->compose)
914 {
915 strcpy(p, ev->compose);
916 ipc->compose = p - (long)st;
917 p += strlen(p) + 1;
918 }
919 ipc->timestamp = ev->timestamp;
920 ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
921 ipc->event_flags = ev->event_flags;
922 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_DOWN, 0, 0, 0, ipc, len);
923 }
924}
925
926static void
927_ecore_evas_extn_cb_key_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
928{
929 Ecore_Evas *ee = data;
930 Evas_Event_Key_Up *ev = event_info;
931 Extn *extn;
932
933 extn = ee->engine.buffer.data;
934 if (!extn) return;
935 if (extn->ipc.server)
936 {
937 Ipc_Data_Ev_Key_Up *ipc;
938 char *st, *p;
939 int len = 0;
940
941 len = sizeof(Ipc_Data_Ev_Key_Up);
942 if (ev->key) len += strlen(ev->key) + 1;
943 if (ev->keyname) len += strlen(ev->keyname) + 1;
944 if (ev->string) len += strlen(ev->string) + 1;
945 if (ev->compose) len += strlen(ev->compose) + 1;
946 len += 1;
947 st = alloca(len);
948 ipc = (Ipc_Data_Ev_Key_Up *)st;
949 memset(st, 0, len);
950 p = st + sizeof(Ipc_Data_Ev_Key_Down);
951 if (ev->key)
952 {
953 strcpy(p, ev->key);
954 ipc->key = p - (long)st;
955 p += strlen(p) + 1;
956 }
957 if (ev->keyname)
958 {
959 strcpy(p, ev->keyname);
960 ipc->keyname = p - (long)st;
961 p += strlen(p) + 1;
962 }
963 if (ev->string)
964 {
965 strcpy(p, ev->string);
966 ipc->string = p - (long)st;
967 p += strlen(p) + 1;
968 }
969 if (ev->compose)
970 {
971 strcpy(p, ev->compose);
972 ipc->compose = p - (long)st;
973 p += strlen(p) + 1;
974 }
975 ipc->timestamp = ev->timestamp;
976 ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
977 ipc->event_flags = ev->event_flags;
978 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_UP, 0, 0, 0, ipc, len);
979 }
980}
981
982static void
983_ecore_evas_extn_cb_hold(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
984{
985 Ecore_Evas *ee = data;
986 Evas_Event_Hold *ev = event_info;
987 Extn *extn;
988
989 extn = ee->engine.buffer.data;
990 if (!extn) return;
991 if (extn->ipc.server)
992 {
993 Ipc_Data_Ev_Hold ipc;
994
995 ipc.hold = ev->hold;
996 ipc.timestamp = ev->timestamp;
997 ipc.event_flags = ev->event_flags;
998 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_HOLD, 0, 0, 0, &ipc, sizeof(ipc));
999 }
1000}
1001
1002static void
1003_ecore_evas_extn_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1004{
1005 Ecore_Evas *ee;
1006 Extn *extn;
1007
1008 ee = data;
1009 ee->prop.focused = 1;
1010 extn = ee->engine.buffer.data;
1011 if (!extn) return;
1012 if (!extn->ipc.server) return;
1013 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_FOCUS, 0, 0, 0, NULL, 0);
1014}
1015
1016static void
1017_ecore_evas_extn_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1018{
1019 Ecore_Evas *ee;
1020 Extn *extn;
1021
1022 ee = data;
1023 ee->prop.focused = 0;
1024 extn = ee->engine.buffer.data;
1025 if (!extn) return;
1026 if (!extn->ipc.server) return;
1027 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_UNFOCUS, 0, 0, 0, NULL, 0);
1028}
1029
1030static void
1031_ecore_evas_extn_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1032{
1033 Ecore_Evas *ee;
1034 Extn *extn;
1035
1036 ee = data;
1037 ee->visible = 1;
1038 extn = ee->engine.buffer.data;
1039 if (!extn) return;
1040 if (!extn->ipc.server) return;
1041 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_SHOW, 0, 0, 0, NULL, 0);
1042}
1043
1044static void
1045_ecore_evas_extn_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1046{
1047 Ecore_Evas *ee;
1048 Extn *extn;
1049
1050 ee = data;
1051 ee->visible = 0;
1052 extn = ee->engine.buffer.data;
1053 if (!extn) return;
1054 if (!extn->ipc.server) return;
1055 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0);
1056}
1057
1058static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
1059{
1060 _ecore_evas_extn_free,
1061 NULL,
1062 NULL,
1063 NULL,
1064 NULL,
1065 NULL,
1066 NULL,
1067 NULL,
1068 NULL,
1069 NULL,
1070 NULL,
1071 NULL,
1072 NULL,
1073 NULL,
1074 NULL,
1075 NULL,
1076 NULL,
1077 _ecore_evas_resize,
1078 _ecore_evas_move_resize,
1079 NULL,
1080 NULL,
1081 NULL,
1082 NULL,
1083 NULL,
1084 NULL,
1085 NULL,
1086 NULL,
1087 NULL,
1088 NULL,
1089 NULL,
1090 NULL,
1091 NULL,
1092 NULL,
1093 NULL,
1094 NULL,
1095 NULL,
1096 NULL,
1097 NULL,
1098 NULL,
1099 NULL,
1100 NULL,
1101 NULL,
1102 NULL,
1103 NULL,
1104 NULL,
1105 NULL, //transparent
1106
1107 NULL,
1108 NULL,
1109 NULL,
1110 NULL,
1111 NULL,
1112 NULL,
1113
1114 NULL, // render
1115 NULL // screen_geometry_get
1116};
1117
1118static Eina_Bool
1119_ipc_server_add(void *data, int type __UNUSED__, void *event)
1120{
1121 Ecore_Ipc_Event_Server_Add *e = event;
1122 Ecore_Evas *ee = data;
1123 Extn *extn;
1124
1125 if (ee != ecore_ipc_server_data_get(e->server))
1126 return ECORE_CALLBACK_PASS_ON;
1127 if (!eina_list_data_find(extn_ee_list, ee))
1128 return ECORE_CALLBACK_PASS_ON;
1129 extn = ee->engine.buffer.data;
1130 if (!extn) return ECORE_CALLBACK_PASS_ON;
1131 //FIXME: find a way to let app know server there
1132 return ECORE_CALLBACK_PASS_ON;
1133}
1134
1135static Eina_Bool
1136_ipc_server_del(void *data, int type __UNUSED__, void *event)
1137{
1138 Ecore_Ipc_Event_Server_Del *e = event;
1139 Ecore_Evas *ee = data;
1140 Extn *extn;
1141
1142 extn = ee->engine.buffer.data;
1143 if (!extn) return ECORE_CALLBACK_PASS_ON;
1144 if (extn->ipc.server != e->server) return ECORE_CALLBACK_PASS_ON;
1145 evas_object_image_data_set(ee->engine.buffer.image, NULL);
1146 ee->engine.buffer.pixels = NULL;
1147 if (extn->file.shmfile)
1148 {
1149 shmfile_close(extn->file.shmfile);
1150 extn->file.shmfile = NULL;
1151 }
1152 if (extn->file.shm)
1153 {
1154 eina_stringshare_del(extn->file.shm);
1155 extn->file.shm = NULL;
1156 }
1157 extn->ipc.server = NULL;
1158 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
1159 return ECORE_CALLBACK_PASS_ON;
1160}
1161
1162static Eina_Bool
1163_ipc_server_data(void *data, int type __UNUSED__, void *event)
1164{
1165 Ecore_Ipc_Event_Server_Data *e = event;
1166 Ecore_Evas *ee = data;
1167 Extn *extn;
1168
1169 if (ee != ecore_ipc_server_data_get(e->server))
1170 return ECORE_CALLBACK_PASS_ON;
1171 if (!eina_list_data_find(extn_ee_list, ee))
1172 return ECORE_CALLBACK_PASS_ON;
1173 extn = ee->engine.buffer.data;
1174 if (!extn) return ECORE_CALLBACK_PASS_ON;
1175 if (e->major != MAJOR)
1176 return ECORE_CALLBACK_PASS_ON;
1177 switch (e->minor)
1178 {
1179 case OP_UPDATE:
1180 // add rect to update list
1181 if (e->size >= (int)sizeof(Ipc_Data_Update))
1182 {
1183 Ipc_Data_Update *ipc = malloc(sizeof(Ipc_Data_Update));
1184 if (ipc)
1185 {
1186 memcpy(ipc, e->data, sizeof(Ipc_Data_Update));
1187 extn->file.updates = eina_list_append(extn->file.updates, ipc);
1188 }
1189 }
1190 break;
1191 case OP_UPDATE_DONE:
1192 // updates finished being sent - done now. frame ready
1193 {
1194 Ipc_Data_Update *ipc;
1195
1196 EINA_LIST_FREE(extn->file.updates, ipc)
1197 {
1198 if (ee->engine.buffer.image)
1199 evas_object_image_data_update_add(ee->engine.buffer.image,
1200 ipc->x, ipc->y,
1201 ipc->w, ipc->h);
1202 }
1203 }
1204 break;
1205 case OP_LOCK_FILE:
1206 if ((e->data) && (e->size > 0) &&
1207 (((unsigned char *)e->data)[e->size - 1] == 0))
1208 {
1209 if (extn->file.lockfd) close(extn->file.lockfd);
1210 if (extn->file.lock) eina_stringshare_del(extn->file.lock);
1211 extn->file.lock = eina_stringshare_add(e->data);
1212 extn->file.lockfd = open(extn->file.lock, O_RDONLY);
1213 }
1214 break;
1215 case OP_SHM_REF:
1216 // e->ref == w
1217 // e->ref_to == h
1218 // e->response == alpha
1219 // e->data = shm ref string + nul byte
1220 if ((e->data) && ((unsigned char *)e->data)[e->size - 1] == 0)
1221 {
1222 ee->engine.buffer.pixels = NULL;
1223 if (extn->file.shmfile)
1224 {
1225 shmfile_close(extn->file.shmfile);
1226 extn->file.shmfile = NULL;
1227 }
1228 if (extn->file.shm)
1229 {
1230 eina_stringshare_del(extn->file.shm);
1231 extn->file.shm = NULL;
1232 }
1233 if ((e->ref > 0) && (e->ref_to > 0))
1234 {
1235 extn->file.w = e->ref;
1236 extn->file.h = e->ref_to;
1237 extn->file.shm = eina_stringshare_add(e->data);
1238 extn->file.shmfile = shmfile_open(extn->file.shm,
1239 extn->file.w *
1240 extn->file.h * 4,
1241 EINA_TRUE);
1242 if (extn->file.shmfile)
1243 {
1244 ee->engine.buffer.pixels = extn->file.shmfile->addr;
1245 if (ee->engine.buffer.image)
1246 {
1247 if (e->response)
1248 evas_object_image_alpha_set(ee->engine.buffer.image,
1249 EINA_TRUE);
1250 else
1251 evas_object_image_alpha_set(ee->engine.buffer.image,
1252 EINA_FALSE);
1253 evas_object_image_size_set(ee->engine.buffer.image,
1254 extn->file.w,
1255 extn->file.h);
1256 evas_object_image_data_set(ee->engine.buffer.image,
1257 ee->engine.buffer.pixels);
1258 evas_object_image_data_update_add(ee->engine.buffer.image,
1259 0, 0,
1260 extn->file.w,
1261 extn->file.h);
1262 _ecore_evas_resize(ee,
1263 extn->file.w,
1264 extn->file.h);
1265 }
1266 else
1267 evas_object_image_data_set(ee->engine.buffer.image, NULL);
1268 }
1269 else
1270 evas_object_image_data_set(ee->engine.buffer.image, NULL);
1271 }
1272 else
1273 evas_object_image_data_set(ee->engine.buffer.image, NULL);
1274 }
1275 break;
1276 case OP_RESIZE:
1277 if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize)))
1278 {
1279 Ipc_Data_Resize *ipc = e->data;
1280 _ecore_evas_resize(ee, ipc->w, ipc->h);
1281 }
1282 break;
1283 default:
1284 break;
1285 }
1286 return ECORE_CALLBACK_PASS_ON;
1287}
1288#else
1289void
1290_ecore_evas_extn_init(void)
1291{
1292}
1293
1294void
1295_ecore_evas_extn_shutdown(void)
1296{
1297}
1298
1299#endif /* BUILD_ECORE_EVAS_EXTN */
1300
1301EAPI Evas_Object *
1302ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
1303{
1304#ifdef BUILD_ECORE_EVAS_EXTN
1305 Evas_Object *o;
1306 Ecore_Evas *ee;
1307 int w = 1, h = 1;
1308
1309 if (!ee_target) return NULL;
1310
1311 ee = calloc(1, sizeof(Ecore_Evas));
1312 if (!ee) return NULL;
1313
1314 o = evas_object_image_filled_add(ee_target->evas);
1315 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
1316 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
1317 evas_object_image_alpha_set(o, 1);
1318 evas_object_image_size_set(o, 1, 1);
1319 evas_object_image_data_set(o, &blank);
1320
1321 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
1322
1323 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_plug_engine_func;
1324
1325 ee->driver = "extn_plug";
1326
1327 ee->rotation = 0;
1328 ee->visible = 0;
1329 ee->w = w;
1330 ee->h = h;
1331 ee->req.w = ee->w;
1332 ee->req.h = ee->h;
1333
1334 ee->prop.max.w = 0;
1335 ee->prop.max.h = 0;
1336 ee->prop.layer = 0;
1337 ee->prop.focused = 0;
1338 ee->prop.borderless = 1;
1339 ee->prop.override = 1;
1340 ee->prop.maximized = 0;
1341 ee->prop.fullscreen = 0;
1342 ee->prop.withdrawn = 0;
1343 ee->prop.sticky = 0;
1344
1345 ee->engine.buffer.image = o;
1346 evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee);
1347 evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target);
1348 evas_object_event_callback_add(ee->engine.buffer.image,
1349 EVAS_CALLBACK_MOUSE_IN,
1350 _ecore_evas_extn_cb_mouse_in, ee);
1351 evas_object_event_callback_add(ee->engine.buffer.image,
1352 EVAS_CALLBACK_MOUSE_OUT,
1353 _ecore_evas_extn_cb_mouse_out, ee);
1354 evas_object_event_callback_add(ee->engine.buffer.image,
1355 EVAS_CALLBACK_MOUSE_DOWN,
1356 _ecore_evas_extn_cb_mouse_down, ee);
1357 evas_object_event_callback_add(ee->engine.buffer.image,
1358 EVAS_CALLBACK_MOUSE_UP,
1359 _ecore_evas_extn_cb_mouse_up, ee);
1360 evas_object_event_callback_add(ee->engine.buffer.image,
1361 EVAS_CALLBACK_MOUSE_MOVE,
1362 _ecore_evas_extn_cb_mouse_move, ee);
1363 evas_object_event_callback_add(ee->engine.buffer.image,
1364 EVAS_CALLBACK_MOUSE_WHEEL,
1365 _ecore_evas_extn_cb_mouse_wheel, ee);
1366 evas_object_event_callback_add(ee->engine.buffer.image,
1367 EVAS_CALLBACK_MULTI_DOWN,
1368 _ecore_evas_extn_cb_multi_down, ee);
1369 evas_object_event_callback_add(ee->engine.buffer.image,
1370 EVAS_CALLBACK_MULTI_UP,
1371 _ecore_evas_extn_cb_multi_up, ee);
1372 evas_object_event_callback_add(ee->engine.buffer.image,
1373 EVAS_CALLBACK_MULTI_MOVE,
1374 _ecore_evas_extn_cb_multi_move, ee);
1375 evas_object_event_callback_add(ee->engine.buffer.image,
1376 EVAS_CALLBACK_FREE,
1377 _ecore_evas_extn_cb_free, ee);
1378 evas_object_event_callback_add(ee->engine.buffer.image,
1379 EVAS_CALLBACK_KEY_DOWN,
1380 _ecore_evas_extn_cb_key_down, ee);
1381 evas_object_event_callback_add(ee->engine.buffer.image,
1382 EVAS_CALLBACK_KEY_UP,
1383 _ecore_evas_extn_cb_key_up, ee);
1384 evas_object_event_callback_add(ee->engine.buffer.image,
1385 EVAS_CALLBACK_HOLD,
1386 _ecore_evas_extn_cb_hold, ee);
1387 evas_object_event_callback_add(ee->engine.buffer.image,
1388 EVAS_CALLBACK_FOCUS_IN,
1389 _ecore_evas_extn_cb_focus_in, ee);
1390 evas_object_event_callback_add(ee->engine.buffer.image,
1391 EVAS_CALLBACK_FOCUS_OUT,
1392 _ecore_evas_extn_cb_focus_out, ee);
1393 evas_object_event_callback_add(ee->engine.buffer.image,
1394 EVAS_CALLBACK_SHOW,
1395 _ecore_evas_extn_cb_show, ee);
1396 evas_object_event_callback_add(ee->engine.buffer.image,
1397 EVAS_CALLBACK_HIDE,
1398 _ecore_evas_extn_cb_hide, ee);
1399
1400 evas_object_event_callback_add(ee->engine.buffer.image,
1401 EVAS_CALLBACK_DEL,
1402 _ecore_evas_extn_plug_image_obj_del, ee);
1403
1404
1405 extn_ee_list = eina_list_append(extn_ee_list, ee);
1406 ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee);
1407
1408 evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_PRE,
1409 _ecore_evas_extn_plug_targer_render_pre, ee);
1410 evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_POST,
1411 _ecore_evas_extn_plug_targer_render_post, ee);
1412 return o;
1413#else
1414 return NULL;
1415#endif
1416}
1417
1418EAPI Eina_Bool
1419ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
1420{
1421#ifdef BUILD_ECORE_EVAS_EXTN
1422 Extn *extn;
1423 Ecore_Evas *ee = NULL;
1424
1425 if (!obj) return EINA_FALSE;
1426
1427 ee = evas_object_data_get(obj, "Ecore_Evas");
1428 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) return EINA_FALSE;
1429
1430 extn = calloc(1, sizeof(Extn));
1431 if (!extn) return EINA_FALSE;
1432
1433 Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER;
1434
1435 ecore_ipc_init();
1436 extn->svc.name = eina_stringshare_add(svcname);
1437 extn->svc.num = svcnum;
1438 extn->svc.sys = svcsys;
1439
1440 if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM;
1441 extn->ipc.server = ecore_ipc_server_connect(ipctype, (char *)extn->svc.name,
1442 extn->svc.num, ee);
1443 if (!extn->ipc.server)
1444 {
1445 eina_stringshare_del(extn->svc.name);
1446 free(extn);
1447 ecore_ipc_shutdown();
1448 return EINA_FALSE;
1449 }
1450 ee->engine.buffer.data = extn;
1451 extn->ipc.handlers = eina_list_append
1452 (extn->ipc.handlers,
1453 ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD,
1454 _ipc_server_add, ee));
1455 extn->ipc.handlers = eina_list_append
1456 (extn->ipc.handlers,
1457 ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL,
1458 _ipc_server_del, ee));
1459 extn->ipc.handlers = eina_list_append
1460 (extn->ipc.handlers,
1461 ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,
1462 _ipc_server_data, ee));
1463 return EINA_TRUE;
1464#else
1465 return EINA_FALSE;
1466#endif
1467}
1468
1469EAPI void
1470ecore_evas_extn_plug_object_data_lock(Evas_Object *obj)
1471{
1472#ifdef BUILD_ECORE_EVAS_EXTN
1473 Ecore_Evas *ee;
1474
1475 ee = ecore_evas_object_ecore_evas_get(obj);
1476 if (!ee) return;
1477 _ecore_evas_socket_lock(ee);
1478#endif
1479}
1480
1481EAPI void
1482ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj)
1483{
1484#ifdef BUILD_ECORE_EVAS_EXTN
1485 Ecore_Evas *ee;
1486
1487 ee = ecore_evas_object_ecore_evas_get(obj);
1488 if (!ee) return;
1489 _ecore_evas_socket_unlock(ee);
1490#endif
1491}
1492
1493#ifdef BUILD_ECORE_EVAS_EXTN
1494static void
1495_ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h)
1496{
1497 Extn *extn;
1498 Evas_Engine_Info_Buffer *einfo;
1499 int stride = 0;
1500
1501 if (w < 1) w = 1;
1502 if (h < 1) h = 1;
1503 ee->req.w = w;
1504 ee->req.h = h;
1505 if ((w == ee->w) && (h == ee->h)) return;
1506 ee->w = w;
1507 ee->h = h;
1508 evas_output_size_set(ee->evas, ee->w, ee->h);
1509 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1510 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1511 extn = ee->engine.buffer.data;
1512 if (extn)
1513 {
1514 if (extn->file.shmfile)
1515 shmfile_free(extn->file.shmfile);
1516 ee->engine.buffer.pixels = NULL;
1517 extn->file.shmfile = shmfile_new(extn->svc.name, extn->svc.num,
1518 ee->w * ee->h * 4, extn->svc.sys);
1519 if (extn->file.shmfile)
1520 ee->engine.buffer.pixels = extn->file.shmfile->addr;
1521
1522 stride = ee->w * 4;
1523 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
1524 if (einfo)
1525 {
1526 if (ee->alpha)
1527 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
1528 else
1529 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
1530 einfo->info.dest_buffer = ee->engine.buffer.pixels;
1531 einfo->info.dest_buffer_row_bytes = stride;
1532 einfo->info.use_color_key = 0;
1533 einfo->info.alpha_threshold = 0;
1534 einfo->info.func.new_update_region = NULL;
1535 einfo->info.func.free_update_region = NULL;
1536 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1537 {
1538 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1539 }
1540 }
1541
1542 if (extn->ipc.clients && extn->file.shmfile)
1543 {
1544 Ipc_Data_Resize ipc;
1545 Eina_List *l;
1546 Ecore_Ipc_Client *client;
1547
1548 EINA_LIST_FOREACH(extn->ipc.clients, l, client)
1549 ecore_ipc_client_send(client, MAJOR, OP_SHM_REF,
1550 ee->w, ee->h, ee->alpha,
1551 extn->file.shmfile->file,
1552 strlen(extn->file.shmfile->file) + 1);
1553 ipc.w = ee->w;
1554 ipc.h = ee->h;
1555 EINA_LIST_FOREACH(extn->ipc.clients, l, client)
1556 ecore_ipc_client_send(client, MAJOR, OP_RESIZE,
1557 0, 0, 0, &ipc, sizeof(ipc));
1558 }
1559 }
1560 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1561}
1562
1563static void
1564_ecore_evas_socket_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
1565{
1566 _ecore_evas_socket_resize(ee, w, h);
1567}
1568
1569int
1570_ecore_evas_extn_socket_render(Ecore_Evas *ee)
1571{
1572 Eina_List *updates = NULL, *l, *ll;
1573 Ecore_Evas *ee2;
1574 int rend = 0;
1575 Eina_Rectangle *r;
1576 Extn *extn;
1577 Ecore_Ipc_Client *client;
1578
1579 extn = ee->engine.buffer.data;
1580 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
1581 {
1582 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
1583 if (ee2->engine.func->fn_render)
1584 rend |= ee2->engine.func->fn_render(ee2);
1585 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
1586 }
1587 if (ee->engine.buffer.pixels)
1588 {
1589 _ecore_evas_socket_lock(ee);
1590 updates = evas_render_updates(ee->evas);
1591 _ecore_evas_socket_unlock(ee);
1592 }
1593 EINA_LIST_FOREACH(updates, l, r)
1594 {
1595 Ipc_Data_Update ipc;
1596
1597
1598 ipc.x = r->x;
1599 ipc.y = r->y;
1600 ipc.w = r->w;
1601 ipc.h = r->h;
1602 EINA_LIST_FOREACH(extn->ipc.clients, ll, client)
1603 ecore_ipc_client_send(client, MAJOR, OP_UPDATE, 0, 0, 0, &ipc, sizeof(ipc));
1604 }
1605 if (updates)
1606 {
1607 evas_render_updates_free(updates);
1608 _ecore_evas_idle_timeout_update(ee);
1609 EINA_LIST_FOREACH(extn->ipc.clients, ll, client)
1610 ecore_ipc_client_send(client, MAJOR, OP_UPDATE_DONE, 0, 0, 0, NULL, 0);
1611 }
1612
1613 return updates ? 1 : rend;
1614}
1615
1616static Eina_Bool
1617_ipc_client_add(void *data, int type __UNUSED__, void *event)
1618{
1619 Ecore_Ipc_Event_Client_Add *e = event;
1620 Ecore_Evas *ee = data;
1621 Extn *extn;
1622
1623 if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client)))
1624 return ECORE_CALLBACK_PASS_ON;
1625 if (!eina_list_data_find(extn_ee_list, ee))
1626 return ECORE_CALLBACK_PASS_ON;
1627 extn = ee->engine.buffer.data;
1628 if (!extn) return ECORE_CALLBACK_PASS_ON;
1629
1630 extn->ipc.clients = eina_list_append(extn->ipc.clients, e->client);
1631 ecore_ipc_client_send(e->client, MAJOR, OP_LOCK_FILE, 0, 0, 0, extn->file.lock, strlen(extn->file.lock) + 1);
1632
1633 if (extn->file.shmfile)
1634 {
1635 Ipc_Data_Resize ipc;
1636
1637 ecore_ipc_client_send(e->client, MAJOR, OP_SHM_REF,
1638 ee->w, ee->h, ee->alpha,
1639 extn->file.shmfile->file,
1640 strlen(extn->file.shmfile->file) + 1);
1641 ipc.w = ee->w;
1642 ipc.h = ee->h;
1643
1644 ecore_ipc_client_send(e->client, MAJOR, OP_RESIZE,
1645 0, 0, 0, &ipc, sizeof(ipc));
1646 }
1647 _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_ADD);
1648 return ECORE_CALLBACK_PASS_ON;
1649}
1650
1651static Eina_Bool
1652_ipc_client_del(void *data, int type __UNUSED__, void *event)
1653{
1654 Ecore_Ipc_Event_Client_Del *e = event;
1655 Ecore_Evas *ee = data;
1656 Extn *extn;
1657 extn = ee->engine.buffer.data;
1658 if (!extn) return ECORE_CALLBACK_PASS_ON;
1659 if (!eina_list_data_find(extn->ipc.clients, e->client)) return ECORE_CALLBACK_PASS_ON;
1660
1661 extn->ipc.clients = eina_list_remove(extn->ipc.clients, e->client);
1662
1663 _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_DEL);
1664 return ECORE_CALLBACK_PASS_ON;
1665}
1666
1667static Eina_Bool
1668_ipc_client_data(void *data, int type __UNUSED__, void *event)
1669{
1670 Ecore_Ipc_Event_Client_Data *e = event;
1671 Ecore_Evas *ee = data;
1672 Extn *extn;
1673
1674 if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client)))
1675 return ECORE_CALLBACK_PASS_ON;
1676 if (!eina_list_data_find(extn_ee_list, ee))
1677 return ECORE_CALLBACK_PASS_ON;
1678 extn = ee->engine.buffer.data;
1679 if (!extn) return ECORE_CALLBACK_PASS_ON;
1680 if (e->major != MAJOR)
1681 return ECORE_CALLBACK_PASS_ON;
1682 switch (e->minor)
1683 {
1684 case OP_RESIZE:
1685 if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize)))
1686 {
1687
1688 Ipc_Data_Resize *ipc = e->data;
1689 /* create callbacke data size changed */
1690 _ecore_evas_socket_resize(ee, ipc->w, ipc->h);
1691 }
1692 break;
1693 case OP_SHOW:
1694 if (!ee->visible)
1695 {
1696 ee->visible = 1;
1697 if (ee->func.fn_show) ee->func.fn_show(ee);
1698 }
1699 break;
1700 case OP_HIDE:
1701 if (ee->visible)
1702 {
1703 ee->visible = 0;
1704 if (ee->func.fn_hide) ee->func.fn_hide(ee);
1705 }
1706 break;
1707 case OP_FOCUS:
1708 if (!ee->prop.focused)
1709 {
1710 ee->prop.focused = 1;
1711 evas_focus_in(ee->evas);
1712 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
1713 }
1714 break;
1715 case OP_UNFOCUS:
1716 if (ee->prop.focused)
1717 {
1718 ee->prop.focused = 0;
1719 evas_focus_out(ee->evas);
1720 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
1721 }
1722 break;
1723 case OP_EV_MOUSE_IN:
1724 if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_In))
1725 {
1726 Ipc_Data_Ev_Mouse_In *ipc = e->data;
1727 Evas_Event_Flags flags;
1728
1729 flags = evas_event_default_flags_get(ee->evas);
1730 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1731 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1732 evas_event_feed_mouse_in(ee->evas, ipc->timestamp, NULL);
1733 evas_event_default_flags_set(ee->evas, flags);
1734 }
1735 break;
1736 case OP_EV_MOUSE_OUT:
1737 if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Out))
1738 {
1739 Ipc_Data_Ev_Mouse_Out *ipc = e->data;
1740 Evas_Event_Flags flags;
1741
1742 flags = evas_event_default_flags_get(ee->evas);
1743 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1744 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1745 evas_event_feed_mouse_out(ee->evas, ipc->timestamp, NULL);
1746 evas_event_default_flags_set(ee->evas, flags);
1747 }
1748 break;
1749 case OP_EV_MOUSE_UP:
1750 if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Up))
1751 {
1752 Ipc_Data_Ev_Mouse_Up *ipc = e->data;
1753 Evas_Event_Flags flags;
1754
1755 flags = evas_event_default_flags_get(ee->evas);
1756 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1757 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1758 evas_event_feed_mouse_up(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL);
1759 evas_event_default_flags_set(ee->evas, flags);
1760 }
1761 break;
1762 case OP_EV_MOUSE_DOWN:
1763 if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Down))
1764 {
1765 Ipc_Data_Ev_Mouse_Up *ipc = e->data;
1766 Evas_Event_Flags flags;
1767
1768 flags = evas_event_default_flags_get(ee->evas);
1769 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1770 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1771 evas_event_feed_mouse_down(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL);
1772 evas_event_default_flags_set(ee->evas, flags);
1773 }
1774 break;
1775 case OP_EV_MOUSE_MOVE:
1776 if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Move))
1777 {
1778 Ipc_Data_Ev_Mouse_Move *ipc = e->data;
1779 Evas_Event_Flags flags;
1780
1781 flags = evas_event_default_flags_get(ee->evas);
1782 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1783 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1784 evas_event_feed_mouse_move(ee->evas, ipc->x, ipc->y, ipc->timestamp, NULL);
1785 evas_event_default_flags_set(ee->evas, flags);
1786 }
1787 break;
1788 case OP_EV_MOUSE_WHEEL:
1789 if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Wheel))
1790 {
1791 Ipc_Data_Ev_Mouse_Wheel *ipc = e->data;
1792 Evas_Event_Flags flags;
1793
1794 flags = evas_event_default_flags_get(ee->evas);
1795 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1796 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1797 evas_event_feed_mouse_wheel(ee->evas, ipc->direction, ipc->z, ipc->timestamp, NULL);
1798 evas_event_default_flags_set(ee->evas, flags);
1799 }
1800 break;
1801 case OP_EV_MULTI_UP:
1802 if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Up))
1803 {
1804 Ipc_Data_Ev_Multi_Up *ipc = e->data;
1805 Evas_Event_Flags flags;
1806
1807 flags = evas_event_default_flags_get(ee->evas);
1808 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1809 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1810 evas_event_feed_multi_up(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL);
1811 evas_event_default_flags_set(ee->evas, flags);
1812 }
1813 break;
1814 case OP_EV_MULTI_DOWN:
1815 if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Down))
1816 {
1817 Ipc_Data_Ev_Multi_Down *ipc = e->data;
1818 Evas_Event_Flags flags;
1819
1820 flags = evas_event_default_flags_get(ee->evas);
1821 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1822 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1823 evas_event_feed_multi_down(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL);
1824 evas_event_default_flags_set(ee->evas, flags);
1825 }
1826 break;
1827 case OP_EV_MULTI_MOVE:
1828 if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Move))
1829 {
1830 Ipc_Data_Ev_Multi_Move *ipc = e->data;
1831 Evas_Event_Flags flags;
1832
1833 flags = evas_event_default_flags_get(ee->evas);
1834 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1835 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1836 evas_event_feed_multi_move(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->timestamp, NULL);
1837 evas_event_default_flags_set(ee->evas, flags);
1838 }
1839 break;
1840
1841#define STRGET(val) \
1842 do { \
1843 if ((ipc->val) && (ipc->val < (char *)(long)(e->size - 1))) \
1844 ipc->val = ((char *)ipc) + (long)ipc->val; \
1845 else \
1846 ipc->val = NULL; \
1847 } while (0)
1848
1849 case OP_EV_KEY_UP:
1850 if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Up))
1851 {
1852 if ((e->data) && (e->size > 0) &&
1853 (((unsigned char *)e->data)[e->size - 1] == 0))
1854 {
1855 Ipc_Data_Ev_Key_Up *ipc = e->data;
1856 Evas_Event_Flags flags;
1857
1858 STRGET(keyname);
1859 STRGET(key);
1860 STRGET(string);
1861 STRGET(compose);
1862 flags = evas_event_default_flags_get(ee->evas);
1863 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1864 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1865 evas_event_feed_key_up(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL);
1866 evas_event_default_flags_set(ee->evas, flags);
1867 }
1868 }
1869 break;
1870 case OP_EV_KEY_DOWN:
1871 if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Down))
1872 {
1873 if ((e->data) && (e->size > 0) &&
1874 (((unsigned char *)e->data)[e->size - 1] == 0))
1875 {
1876 Ipc_Data_Ev_Key_Down *ipc = e->data;
1877 Evas_Event_Flags flags;
1878
1879 STRGET(keyname);
1880 STRGET(key);
1881 STRGET(string);
1882 STRGET(compose);
1883 flags = evas_event_default_flags_get(ee->evas);
1884 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1885 _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
1886 evas_event_feed_key_down(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL);
1887 evas_event_default_flags_set(ee->evas, flags);
1888 }
1889 }
1890 break;
1891 case OP_EV_HOLD:
1892 if (e->size >= (int)sizeof(Ipc_Data_Ev_Hold))
1893 {
1894 Ipc_Data_Ev_Hold *ipc = e->data;
1895 Evas_Event_Flags flags;
1896
1897 flags = evas_event_default_flags_get(ee->evas);
1898 evas_event_default_flags_set(ee->evas, ipc->event_flags);
1899 evas_event_feed_hold(ee->evas, ipc->hold, ipc->timestamp, NULL);
1900 evas_event_default_flags_set(ee->evas, flags);
1901 }
1902 break;
1903 default:
1904 break;
1905 }
1906 return ECORE_CALLBACK_PASS_ON;
1907}
1908
1909static void
1910_ecore_evas_extn_socket_alpha_set(Ecore_Evas *ee, int alpha)
1911{
1912 Extn *extn;
1913 Eina_List *l;
1914 Ecore_Ipc_Client *client;
1915
1916 if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return;
1917 ee->alpha = alpha;
1918
1919 extn = ee->engine.buffer.data;
1920 if (extn)
1921 {
1922 Evas_Engine_Info_Buffer *einfo;
1923
1924 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
1925 if (einfo)
1926 {
1927 if (ee->alpha)
1928 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
1929 else
1930 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
1931 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
1932 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1933 }
1934 EINA_LIST_FOREACH(extn->ipc.clients, l, client)
1935 ecore_ipc_client_send(client, MAJOR, OP_SHM_REF,
1936 ee->w, ee->h, ee->alpha,
1937 extn->file.shmfile->file,
1938 strlen(extn->file.shmfile->file) + 1);
1939 }
1940}
1941
1942static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func =
1943{
1944 _ecore_evas_extn_free,
1945 NULL,
1946 NULL,
1947 NULL,
1948 NULL,
1949 NULL,
1950 NULL,
1951 NULL,
1952 NULL,
1953 NULL,
1954 NULL,
1955 NULL,
1956 NULL,
1957 NULL,
1958 NULL,
1959 NULL,
1960 NULL,
1961 _ecore_evas_socket_resize,
1962 _ecore_evas_socket_move_resize,
1963 NULL,
1964 NULL,
1965 NULL,
1966 NULL,
1967 NULL,
1968 NULL,
1969 NULL,
1970 NULL,
1971 NULL,
1972 NULL,
1973 NULL,
1974 NULL,
1975 NULL,
1976 NULL,
1977 NULL,
1978 NULL,
1979 NULL,
1980 NULL,
1981 NULL,
1982 NULL,
1983 NULL,
1984 NULL,
1985 NULL,
1986 NULL,
1987 NULL,
1988 _ecore_evas_extn_socket_alpha_set,
1989 NULL, //transparent
1990
1991 NULL,
1992 NULL,
1993 NULL,
1994 NULL,
1995 NULL,
1996 NULL,
1997
1998 _ecore_evas_extn_socket_render, // render
1999 NULL // screen_geometry_get
2000};
2001
2002#endif
2003
2004EAPI Ecore_Evas *
2005ecore_evas_extn_socket_new(int w, int h)
2006{
2007#ifdef BUILD_ECORE_EVAS_EXTN
2008 Evas_Engine_Info_Buffer *einfo;
2009 Ecore_Evas *ee;
2010 int rmethod;
2011
2012 rmethod = evas_render_method_lookup("buffer");
2013 if (!rmethod) return NULL;
2014 ee = calloc(1, sizeof(Ecore_Evas));
2015 if (!ee) return NULL;
2016
2017 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
2018
2019 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_socket_engine_func;
2020
2021 ee->driver = "extn_socket";
2022
2023 ee->rotation = 0;
2024 ee->visible = 0;
2025 ee->w = w;
2026 ee->h = h;
2027 ee->req.w = ee->w;
2028 ee->req.h = ee->h;
2029
2030 ee->prop.max.w = 0;
2031 ee->prop.max.h = 0;
2032 ee->prop.layer = 0;
2033 ee->prop.focused = 0;
2034 ee->prop.borderless = 1;
2035 ee->prop.override = 1;
2036 ee->prop.maximized = 0;
2037 ee->prop.fullscreen = 0;
2038 ee->prop.withdrawn = 0;
2039 ee->prop.sticky = 0;
2040
2041 /* init evas here */
2042 ee->evas = evas_new();
2043 evas_data_attach_set(ee->evas, ee);
2044 evas_output_method_set(ee->evas, rmethod);
2045 evas_output_size_set(ee->evas, w, h);
2046 evas_output_viewport_set(ee->evas, 0, 0, w, h);
2047
2048 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
2049 if (einfo)
2050 {
2051 if (ee->alpha)
2052 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
2053 else
2054 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
2055 einfo->info.dest_buffer = NULL;
2056 einfo->info.dest_buffer_row_bytes = 0;
2057 einfo->info.use_color_key = 0;
2058 einfo->info.alpha_threshold = 0;
2059 einfo->info.func.new_update_region = NULL;
2060 einfo->info.func.free_update_region = NULL;
2061 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2062 {
2063 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2064 ecore_evas_free(ee);
2065 return NULL;
2066 }
2067 }
2068 else
2069 {
2070 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
2071 ecore_evas_free(ee);
2072 return NULL;
2073 }
2074 evas_key_modifier_add(ee->evas, "Shift");
2075 evas_key_modifier_add(ee->evas, "Control");
2076 evas_key_modifier_add(ee->evas, "Alt");
2077 evas_key_modifier_add(ee->evas, "Meta");
2078 evas_key_modifier_add(ee->evas, "Hyper");
2079 evas_key_modifier_add(ee->evas, "Super");
2080 evas_key_lock_add(ee->evas, "Caps_Lock");
2081 evas_key_lock_add(ee->evas, "Num_Lock");
2082 evas_key_lock_add(ee->evas, "Scroll_Lock");
2083
2084 extn_ee_list = eina_list_append(extn_ee_list, ee);
2085
2086 _ecore_evas_register(ee);
2087
2088 return ee;
2089#else
2090 return NULL;
2091#endif
2092}
2093
2094EAPI Eina_Bool
2095ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys)
2096{
2097#ifdef BUILD_ECORE_EVAS_EXTN
2098 Extn *extn;
2099
2100 extn = calloc(1, sizeof(Extn));
2101 if (!extn)
2102 {
2103 return EINA_FALSE;
2104 }
2105 else
2106 {
2107 Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER;
2108 char buf[PATH_MAX];
2109
2110 ecore_ipc_init();
2111 extn->svc.name = eina_stringshare_add(svcname);
2112 extn->svc.num = svcnum;
2113 extn->svc.sys = svcsys;
2114
2115 snprintf(buf, sizeof(buf), "/tmp/ee-lock-XXXXXX");
2116 extn->file.lockfd = mkstemp(buf);
2117 if (extn->file.lockfd >= 0)
2118 extn->file.lock = eina_stringshare_add(buf);
2119 if ((extn->file.lockfd < 0) || (!extn->file.lock))
2120 {
2121 if (extn->file.lockfd)
2122 {
2123 close(extn->file.lockfd);
2124 unlink(buf);
2125 }
2126 eina_stringshare_del(extn->svc.name);
2127 if (extn->file.lock) eina_stringshare_del(extn->file.lock);
2128 free(extn);
2129 ecore_ipc_shutdown();
2130 return EINA_FALSE;
2131 }
2132
2133 if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM;
2134 extn->ipc.am_server = EINA_TRUE;
2135 extn->ipc.server = ecore_ipc_server_add(ipctype,
2136 (char *)extn->svc.name,
2137 extn->svc.num, ee);
2138 if (!extn->ipc.server)
2139 {
2140 if (extn->file.lockfd)
2141 {
2142 close(extn->file.lockfd);
2143 if (extn->file.lock) unlink(extn->file.lock);
2144 }
2145 eina_stringshare_del(extn->svc.name);
2146 eina_stringshare_del(extn->file.lock);
2147 free(extn);
2148 ecore_ipc_shutdown();
2149 return EINA_FALSE;
2150 }
2151 ee->engine.buffer.data = extn;
2152 extn->ipc.handlers = eina_list_append
2153 (extn->ipc.handlers,
2154 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
2155 _ipc_client_add, ee));
2156 extn->ipc.handlers = eina_list_append
2157 (extn->ipc.handlers,
2158 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
2159 _ipc_client_del, ee));
2160 extn->ipc.handlers = eina_list_append
2161 (extn->ipc.handlers,
2162 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
2163 _ipc_client_data, ee));
2164 }
2165 return EINA_TRUE;
2166#else
2167 return EINA_FALSE;
2168#endif
2169}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c
deleted file mode 100644
index 11e2ffd..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c
+++ /dev/null
@@ -1,662 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <sys/types.h>
7#include <dirent.h>
8
9#include <Ecore.h>
10#include "ecore_private.h"
11#ifdef BUILD_ECORE_EVAS_FB
12#include <Ecore_Fb.h>
13#include <ecore_fb_private.h>
14#endif
15
16#include "ecore_evas_private.h"
17#include "Ecore_Evas.h"
18
19#ifdef BUILD_ECORE_EVAS_FB
20static int _ecore_evas_init_count = 0;
21
22static char *ecore_evas_default_display = "0";
23static Eina_List *ecore_evas_input_devices = NULL;
24static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {NULL, NULL, NULL, NULL};
25
26static void
27_ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y)
28{
29 int fbw, fbh;
30
31 ee->mouse.x = x;
32 ee->mouse.y = y;
33 ecore_fb_size_get(&fbw, &fbh);
34 if (ee->prop.cursor.object)
35 {
36 evas_object_show(ee->prop.cursor.object);
37 if (ee->rotation == 0)
38 evas_object_move(ee->prop.cursor.object,
39 x - ee->prop.cursor.hot.x,
40 y - ee->prop.cursor.hot.y);
41 else if (ee->rotation == 90)
42 evas_object_move(ee->prop.cursor.object,
43 (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.x,
44 x - ee->prop.cursor.hot.y);
45 else if (ee->rotation == 180)
46 evas_object_move(ee->prop.cursor.object,
47 (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.x,
48 (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.y);
49 else if (ee->rotation == 270)
50 evas_object_move(ee->prop.cursor.object,
51 y - ee->prop.cursor.hot.x,
52 (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y);
53 }
54}
55
56static Ecore_Evas *fb_ee = NULL;
57
58static Ecore_Evas *
59_ecore_evas_fb_match(void)
60{
61 return fb_ee;
62}
63
64static void
65_ecore_evas_fb_lose(void *data __UNUSED__)
66{
67 Eina_List *ll;
68 Ecore_Fb_Input_Device *dev;
69
70 if (fb_ee) fb_ee->visible = 0;
71
72 EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev)
73 ecore_fb_input_device_listen(dev, 0);
74}
75
76static void
77_ecore_evas_fb_gain(void *data __UNUSED__)
78{
79 Ecore_Evas *ee;
80 Eina_List *ll;
81 Ecore_Fb_Input_Device *dev;
82
83 if (fb_ee)
84 {
85 ee = fb_ee;
86
87 ee->visible = 1;
88 if ((ee->rotation == 90) || (ee->rotation == 270))
89 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
90 else
91 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
92 }
93
94 EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev)
95 ecore_fb_input_device_listen(dev, 1);
96}
97
98static Eina_Bool
99_ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
100{
101 Ecore_Evas *ee;
102 Ecore_Event_Mouse_Button *e;
103
104 e = event;
105 ee = _ecore_evas_fb_match();
106 if (!ee) return ECORE_CALLBACK_PASS_ON;
107 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
108 return ECORE_CALLBACK_PASS_ON;
109}
110
111static Eina_Bool
112_ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
113{
114 Ecore_Evas *ee;
115 Ecore_Event_Mouse_Button *e;
116
117 e = event;
118 ee = _ecore_evas_fb_match();
119 if (!ee) return ECORE_CALLBACK_PASS_ON;
120 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
121 return ECORE_CALLBACK_PASS_ON;
122}
123
124static Eina_Bool
125_ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
126{
127 Ecore_Evas *ee;
128 Ecore_Event_Mouse_Move *e;
129
130 e = event;
131 ee = _ecore_evas_fb_match();
132 if (!ee) return ECORE_CALLBACK_PASS_ON;
133 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
134 return ECORE_CALLBACK_PASS_ON;
135}
136
137static Eina_Bool
138_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
139{
140 Ecore_Evas *ee;
141 Ecore_Event_Mouse_Wheel *e;
142
143 e = event;
144 ee = _ecore_evas_fb_match();
145 if (!ee) return ECORE_CALLBACK_PASS_ON;
146 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
147 return ECORE_CALLBACK_PASS_ON;
148}
149
150static int
151_ecore_evas_fb_render(Ecore_Evas *ee)
152{
153 int rend = 0;
154
155 if (ee->visible)
156 {
157 Eina_List *updates;
158 Eina_List *ll;
159 Ecore_Evas *ee2;
160
161 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
162
163 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
164 {
165 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
166 if (ee2->engine.func->fn_render)
167 rend |= ee2->engine.func->fn_render(ee2);
168 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
169 }
170
171 updates = evas_render_updates(ee->evas);
172 if (updates)
173 {
174 evas_render_updates_free(updates);
175 _ecore_evas_idle_timeout_update(ee);
176 rend = 1;
177 }
178 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
179 }
180 else
181 evas_norender(ee->evas);
182 return rend;
183}
184
185static int
186_ecore_evas_fb_init(Ecore_Evas *ee, int w, int h)
187{
188 Eina_File_Direct_Info *info;
189 Eina_Iterator *ls;
190 Ecore_Fb_Input_Device *device;
191 Ecore_Fb_Input_Device_Cap caps;
192 int mouse_handled = 0;
193
194 _ecore_evas_init_count++;
195 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
196
197 ecore_event_evas_init();
198
199 /* register all input devices */
200 ls = eina_file_direct_ls("/dev/input/");
201
202 EINA_ITERATOR_FOREACH(ls, info)
203 {
204 if (strncmp(info->path + info->name_start, "event", 5) != 0)
205 continue;
206
207 if (!(device = ecore_fb_input_device_open(info->path)))
208 continue;
209 ecore_fb_input_device_window_set(device, ee);
210
211 caps = ecore_fb_input_device_cap_get(device);
212
213 /* Mouse */
214#ifdef HAVE_TSLIB
215 if (caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE)
216#else
217 if ((caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) || (caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE))
218#endif
219 {
220 ecore_fb_input_device_axis_size_set(device, w, h);
221 ecore_fb_input_device_listen(device,1);
222 ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
223 if (!mouse_handled)
224 {
225 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
226 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
227 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
228 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL);
229 mouse_handled = 1;
230 }
231 }
232 /* Keyboard */
233 else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE))
234 {
235 ecore_fb_input_device_listen(device,1);
236 ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
237 }
238 }
239 eina_iterator_free(ls);
240
241 if (!mouse_handled)
242 {
243 if (ecore_fb_ts_init())
244 {
245 ecore_fb_ts_event_window_set(ee);
246 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
247 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
248 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
249 mouse_handled = 1;
250 }
251 }
252 return _ecore_evas_init_count;
253}
254
255static void
256_ecore_evas_fb_free(Ecore_Evas *ee)
257{
258 ecore_evas_input_event_unregister(ee);
259 if (fb_ee == ee) fb_ee = NULL;
260 _ecore_evas_fb_shutdown();
261 ecore_fb_shutdown();
262}
263
264static void
265_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
266{
267 ee->req.w = w;
268 ee->req.h = h;
269 if ((w == ee->w) && (h == ee->h)) return;
270 ee->w = w;
271 ee->h = h;
272 if ((ee->rotation == 90) || (ee->rotation == 270))
273 {
274 evas_output_size_set(ee->evas, ee->h, ee->w);
275 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
276 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
277 }
278 else
279 {
280 evas_output_size_set(ee->evas, ee->w, ee->h);
281 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
282 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
283 }
284 if (ee->func.fn_resize) ee->func.fn_resize(ee);
285}
286
287static void
288_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
289{
290 ee->req.w = w;
291 ee->req.h = h;
292 if ((w == ee->w) && (h == ee->h)) return;
293 ee->w = w;
294 ee->h = h;
295 if ((ee->rotation == 90) || (ee->rotation == 270))
296 {
297 evas_output_size_set(ee->evas, ee->h, ee->w);
298 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
299 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
300 }
301 else
302 {
303 evas_output_size_set(ee->evas, ee->w, ee->h);
304 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
305 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
306 }
307 if (ee->func.fn_resize) ee->func.fn_resize(ee);
308}
309
310static void
311_ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__)
312{
313 Evas_Engine_Info_FB *einfo;
314 int rot_dif;
315
316 if (ee->rotation == rotation) return;
317 einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
318 if (!einfo) return;
319 rot_dif = ee->rotation - rotation;
320 if (rot_dif < 0) rot_dif = -rot_dif;
321 if (rot_dif != 180)
322 {
323
324 einfo->info.rotation = rotation;
325 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
326 {
327 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
328 }
329 if (!ee->prop.fullscreen)
330 {
331 int tmp;
332
333 tmp = ee->w;
334 ee->w = ee->h;
335 ee->h = tmp;
336 ee->req.w = ee->w;
337 ee->req.h = ee->h;
338 }
339 else
340 {
341 if ((rotation == 0) || (rotation == 180))
342 {
343 evas_output_size_set(ee->evas, ee->w, ee->h);
344 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
345 }
346 else
347 {
348 evas_output_size_set(ee->evas, ee->h, ee->w);
349 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
350 }
351 }
352 ee->rotation = rotation;
353 }
354 else
355 {
356 einfo->info.rotation = rotation;
357 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
358 {
359 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
360 }
361 ee->rotation = rotation;
362 }
363 if ((ee->rotation == 90) || (ee->rotation == 270))
364 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
365 else
366 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
367 _ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y);
368 if (ee->func.fn_resize) ee->func.fn_resize(ee);
369}
370
371static void
372_ecore_evas_show(Ecore_Evas *ee)
373{
374 if (ee->prop.focused) return;
375 ee->prop.focused = 1;
376 evas_focus_in(ee->evas);
377 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
378}
379
380static void
381_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
382{
383 Ecore_Evas *ee;
384
385 ee = data;
386 if (ee)
387 ee->prop.cursor.object = NULL;
388}
389
390static void
391_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
392{
393 int x, y;
394
395 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
396
397 if (!obj)
398 {
399 ee->prop.cursor.object = NULL;
400 ee->prop.cursor.layer = 0;
401 ee->prop.cursor.hot.x = 0;
402 ee->prop.cursor.hot.y = 0;
403 return;
404 }
405
406 ee->prop.cursor.object = obj;
407 ee->prop.cursor.layer = layer;
408 ee->prop.cursor.hot.x = hot_x;
409 ee->prop.cursor.hot.y = hot_y;
410 evas_pointer_output_xy_get(ee->evas, &x, &y);
411 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
412 evas_object_move(ee->prop.cursor.object,
413 x - ee->prop.cursor.hot.x,
414 y - ee->prop.cursor.hot.y);
415 evas_object_pass_events_set(ee->prop.cursor.object, 1);
416 if (evas_pointer_inside_get(ee->evas))
417 evas_object_show(ee->prop.cursor.object);
418
419 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
420}
421
422static void
423_ecore_evas_fullscreen_set(Ecore_Evas *ee, int on)
424{
425 Eina_List *l;
426 Ecore_Fb_Input_Device *dev;
427 int resized = 0;
428
429 if (((ee->prop.fullscreen) && (on)) ||
430 ((!ee->prop.fullscreen) && (!on))) return;
431 if (on)
432 {
433 int w, h;
434
435 ee->engine.fb.real_w = ee->w;
436 ee->engine.fb.real_h = ee->h;
437 w = ee->w;
438 h = ee->h;
439 ecore_fb_size_get(&w, &h);
440 if ((w == 0) && (h == 0))
441 {
442 w = ee->w;
443 h = ee->h;
444 }
445 if ((w != ee->w) || (h != ee->h)) resized = 1;
446 ee->w = w;
447 ee->h = h;
448 ee->req.w = ee->w;
449 ee->req.h = ee->h;
450 evas_output_size_set(ee->evas, ee->w, ee->h);
451 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
452 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
453 }
454 else
455 {
456 if ((ee->engine.fb.real_w != ee->w) || (ee->engine.fb.real_h != ee->h)) resized = 1;
457 ee->w = ee->engine.fb.real_w;
458 ee->h = ee->engine.fb.real_h;
459 ee->req.w = ee->w;
460 ee->req.h = ee->h;
461 evas_output_size_set(ee->evas, ee->w, ee->h);
462 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
463 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
464 }
465 ee->prop.fullscreen = on;
466 EINA_LIST_FOREACH(ecore_evas_input_devices, l, dev)
467 ecore_fb_input_device_axis_size_set(dev, ee->w, ee->h);
468 /* rescale the input device area */
469 if (resized)
470 {
471 if (ee->func.fn_resize) ee->func.fn_resize(ee);
472 }
473}
474
475int
476_ecore_evas_fb_shutdown(void)
477{
478 _ecore_evas_init_count--;
479 if (_ecore_evas_init_count == 0)
480 {
481 int i;
482
483 for (i = 0; i < 4; i++)
484 {
485 if (ecore_evas_event_handlers[i])
486 ecore_event_handler_del(ecore_evas_event_handlers[i]);
487 }
488 ecore_fb_ts_shutdown();
489 ecore_event_evas_shutdown();
490 }
491 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
492 return _ecore_evas_init_count;
493}
494
495static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
496{
497 _ecore_evas_fb_free,
498 NULL,
499 NULL,
500 NULL,
501 NULL,
502 NULL,
503 NULL,
504 NULL,
505 NULL,
506 NULL,
507 NULL,
508 NULL,
509 NULL,
510 NULL,
511 NULL,
512 NULL,
513 NULL,
514 _ecore_evas_resize,
515 _ecore_evas_move_resize,
516 _ecore_evas_rotation_set,
517 NULL,
518 _ecore_evas_show,
519 NULL,
520 NULL,
521 NULL,
522 NULL,
523 NULL,
524 NULL,
525 NULL,
526 NULL,
527 NULL,
528 NULL,
529 _ecore_evas_object_cursor_set,
530 NULL,
531 NULL,
532 NULL,
533 NULL,
534 NULL,
535 NULL,
536 _ecore_evas_fullscreen_set,
537 NULL,
538 NULL,
539 NULL,
540 NULL,
541 NULL,
542 NULL, //transparent
543
544 NULL,
545 NULL,
546 NULL,
547 NULL,
548 NULL,
549 NULL,
550
551 NULL, // render
552 NULL // screen_geometry_get
553};
554#endif
555
556/**
557 * To be documented.
558 *
559 * FIXME: To be fixed.
560 */
561#ifdef BUILD_ECORE_EVAS_FB
562EAPI Ecore_Evas *
563ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
564{
565 Evas_Engine_Info_FB *einfo;
566 Ecore_Evas *ee;
567
568 int rmethod;
569
570 if (!disp_name)
571 disp_name = ecore_evas_default_display;
572
573 rmethod = evas_render_method_lookup("fb");
574 if (!rmethod) return NULL;
575
576 if (!ecore_fb_init(disp_name)) return NULL;
577 ecore_fb_callback_gain_set(_ecore_evas_fb_gain, NULL);
578 ecore_fb_callback_lose_set(_ecore_evas_fb_lose, NULL);
579 ee = calloc(1, sizeof(Ecore_Evas));
580 if (!ee) return NULL;
581
582 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
583
584 _ecore_evas_fb_init(ee, w, h);
585
586 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func;
587
588 ee->driver = "fb";
589 if (disp_name) ee->name = strdup(disp_name);
590
591 if (w < 1) w = 1;
592 if (h < 1) h = 1;
593 ee->rotation = rotation;
594 ee->visible = 1;
595 ee->w = w;
596 ee->h = h;
597 ee->req.w = ee->w;
598 ee->req.h = ee->h;
599
600 ee->prop.max.w = 0;
601 ee->prop.max.h = 0;
602 ee->prop.layer = 0;
603 ee->prop.focused = 1;
604 ee->prop.borderless = 1;
605 ee->prop.override = 1;
606 ee->prop.maximized = 1;
607 ee->prop.fullscreen = 0;
608 ee->prop.withdrawn = 0;
609 ee->prop.sticky = 0;
610
611 /* init evas here */
612 ee->evas = evas_new();
613 evas_data_attach_set(ee->evas, ee);
614 evas_output_method_set(ee->evas, rmethod);
615
616 if ((rotation == 90) || (rotation == 270))
617 {
618 evas_output_size_set(ee->evas, h, w);
619 evas_output_viewport_set(ee->evas, 0, 0, h, w);
620 }
621 else
622 {
623 evas_output_size_set(ee->evas, w, h);
624 evas_output_viewport_set(ee->evas, 0, 0, w, h);
625 }
626
627 einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
628 if (einfo)
629 {
630 einfo->info.virtual_terminal = 0;
631 einfo->info.device_number = strtol(disp_name, NULL, 10);
632 einfo->info.refresh = 0;
633 einfo->info.rotation = ee->rotation;
634 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
635 {
636 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
637 ecore_evas_free(ee);
638 return NULL;
639 }
640 }
641 else
642 {
643 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
644 ecore_evas_free(ee);
645 return NULL;
646 }
647
648 ecore_evas_input_event_register(ee);
649
650 ee->engine.func->fn_render = _ecore_evas_fb_render;
651 _ecore_evas_register(ee);
652 fb_ee = ee;
653 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
654 return ee;
655}
656#else
657EAPI Ecore_Evas *
658ecore_evas_fb_new(const char *disp_name __UNUSED__, int rotation __UNUSED__, int w __UNUSED__, int h __UNUSED__)
659{
660 return NULL;
661}
662#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
deleted file mode 100644
index e31653a..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h
+++ /dev/null
@@ -1,478 +0,0 @@
1#ifndef _ECORE_EVAS_PRIVATE_H
2#define _ECORE_EVAS_PRIVATE_H
3
4#include <Evas.h>
5#include <Ecore.h>
6#include <ecore_private.h>
7#include <Ecore_Input.h>
8#include <Ecore_Input_Evas.h>
9
10#define ECORE_MAGIC_EVAS 0x76543211
11
12#ifdef BUILD_ECORE_EVAS_X11
13# include <Ecore_X.h>
14# include <Ecore_X_Atoms.h>
15# ifdef HAVE_ECORE_X_XCB
16# include <xcb/xcb.h>
17# endif
18# ifdef HAVE_ECORE_X_XLIB
19# include <X11/Xlib.h>
20# include <X11/Xutil.h>
21# endif
22#endif
23
24#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
25# include <Evas_Engine_Software_X11.h>
26#endif
27
28#ifdef BUILD_ECORE_EVAS_OPENGL_X11
29# include <Evas_Engine_GL_X11.h>
30#endif
31
32#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
33# include <Evas_Engine_Software_8_X11.h>
34#endif
35
36#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
37# include <Evas_Engine_Software_16_X11.h>
38#endif
39
40#ifdef BUILD_ECORE_EVAS_FB
41# include <Evas_Engine_FB.h>
42#endif
43
44#ifdef BUILD_ECORE_EVAS_DIRECTFB
45# include <Evas_Engine_DirectFB.h>
46# include "Ecore_DirectFB.h"
47#endif
48
49#if defined(BUILD_ECORE_EVAS_SOFTWARE_BUFFER) || defined(BUILD_ECORE_EVAS_EWS)
50# include <Evas_Engine_Buffer.h>
51#endif
52
53#ifdef BUILD_ECORE_EVAS_WIN32
54# include "Ecore_Win32.h"
55# ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
56# include <Evas_Engine_Software_Gdi.h>
57# endif
58# ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
59# include <Evas_Engine_Software_DDraw.h>
60# endif
61# ifdef BUILD_ECORE_EVAS_DIRECT3D
62# include <Evas_Engine_Direct3D.h>
63# endif
64# ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
65# include <Evas_Engine_GL_Glew.h>
66# endif
67# ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
68# include <Evas_Engine_Software_16_DDraw.h>
69# endif
70#endif
71
72#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
73# include "Ecore_WinCE.h"
74# include <Evas_Engine_Software_16_WinCE.h>
75#endif
76
77#ifdef BUILD_ECORE_EVAS_GL_COCOA
78# include "Ecore_Cocoa.h"
79# include <Evas_Engine_Gl_Cocoa.h>
80#endif
81
82#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
83# include "Ecore_Wayland.h"
84# include <Evas_Engine_Wayland_Shm.h>
85#endif
86
87#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
88# include "Ecore_Wayland.h"
89# include <Evas_Engine_Wayland_Egl.h>
90#endif
91
92/** Log domain macros and variables **/
93
94extern int _ecore_evas_log_dom;
95
96#ifdef ECORE_EVAS_DEFAULT_LOG_COLOR
97# undef ECORE_EVAS_DEFAULT_LOG_COLOR
98#endif
99#define ECORE_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
100
101#ifdef ERR
102# undef ERR
103#endif
104#define ERR(...) EINA_LOG_DOM_ERR(_ecore_evas_log_dom, __VA_ARGS__)
105#ifdef DBG
106# undef DBG
107#endif
108#define DBG(...) EINA_LOG_DOM_DBG(_ecore_evas_log_dom, __VA_ARGS__)
109#ifdef INF
110# undef INF
111#endif
112#define INF(...) EINA_LOG_DOM_INFO(_ecore_evas_log_dom, __VA_ARGS__)
113#ifdef WRN
114# undef WRN
115#endif
116#define WRN(...) EINA_LOG_DOM_WARN(_ecore_evas_log_dom, __VA_ARGS__)
117#ifdef CRIT
118# undef CRIT
119#endif
120#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_evas_log_dom, __VA_ARGS__)
121
122
123#define IDLE_FLUSH_TIME 0.5
124#ifndef _ECORE_EVAS_H
125typedef struct _Ecore_Evas Ecore_Evas;
126typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee);
127#endif
128
129typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine;
130typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func;
131
132struct _Ecore_Evas_Engine_Func
133{
134 void (*fn_free) (Ecore_Evas *ee);
135 void (*fn_callback_resize_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
136 void (*fn_callback_move_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
137 void (*fn_callback_show_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
138 void (*fn_callback_hide_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
139 void (*fn_callback_delete_request_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
140 void (*fn_callback_destroy_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
141 void (*fn_callback_focus_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
142 void (*fn_callback_focus_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
143 void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
144 void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
145 void (*fn_callback_sticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
146 void (*fn_callback_unsticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
147 void (*fn_callback_pre_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
148 void (*fn_callback_post_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
149 void (*fn_move) (Ecore_Evas *ee, int x, int y);
150 void (*fn_managed_move) (Ecore_Evas *ee, int x, int y);
151 void (*fn_resize) (Ecore_Evas *ee, int w, int h);
152 void (*fn_move_resize) (Ecore_Evas *ee, int x, int y, int w, int h);
153 void (*fn_rotation_set) (Ecore_Evas *ee, int rot, int resize);
154 void (*fn_shaped_set) (Ecore_Evas *ee, int shaped);
155 void (*fn_show) (Ecore_Evas *ee);
156 void (*fn_hide) (Ecore_Evas *ee);
157 void (*fn_raise) (Ecore_Evas *ee);
158 void (*fn_lower) (Ecore_Evas *ee);
159 void (*fn_activate) (Ecore_Evas *ee);
160 void (*fn_title_set) (Ecore_Evas *ee, const char *t);
161 void (*fn_name_class_set) (Ecore_Evas *ee, const char *n, const char *c);
162 void (*fn_size_min_set) (Ecore_Evas *ee, int w, int h);
163 void (*fn_size_max_set) (Ecore_Evas *ee, int w, int h);
164 void (*fn_size_base_set) (Ecore_Evas *ee, int w, int h);
165 void (*fn_size_step_set) (Ecore_Evas *ee, int w, int h);
166 void (*fn_object_cursor_set) (Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
167 void (*fn_layer_set) (Ecore_Evas *ee, int layer);
168 void (*fn_focus_set) (Ecore_Evas *ee, int on);
169 void (*fn_iconified_set) (Ecore_Evas *ee, int on);
170 void (*fn_borderless_set) (Ecore_Evas *ee, int on);
171 void (*fn_override_set) (Ecore_Evas *ee, int on);
172 void (*fn_maximized_set) (Ecore_Evas *ee, int on);
173 void (*fn_fullscreen_set) (Ecore_Evas *ee, int on);
174 void (*fn_avoid_damage_set) (Ecore_Evas *ee, int on);
175 void (*fn_withdrawn_set) (Ecore_Evas *ee, int withdrawn);
176 void (*fn_sticky_set) (Ecore_Evas *ee, int sticky);
177 void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore);
178 void (*fn_alpha_set) (Ecore_Evas *ee, int alpha);
179 void (*fn_transparent_set) (Ecore_Evas *ee, int transparent);
180
181 void (*fn_window_group_set) (Ecore_Evas *ee, const Ecore_Evas *ee_group);
182 void (*fn_aspect_set) (Ecore_Evas *ee, double aspect);
183 void (*fn_urgent_set) (Ecore_Evas *ee, int urgent);
184 void (*fn_modal_set) (Ecore_Evas *ee, int modal);
185 void (*fn_demands_attention_set) (Ecore_Evas *ee, int demand);
186 void (*fn_focus_skip_set) (Ecore_Evas *ee, int skip);
187
188 int (*fn_render) (Ecore_Evas *ee);
189 void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
190};
191
192struct _Ecore_Evas_Engine
193{
194 Ecore_Evas_Engine_Func *func;
195
196/* TODO: UGLY! This should be an union or inheritance! */
197#ifdef BUILD_ECORE_EVAS_X11
198 struct
199 {
200 Ecore_X_Window win_root;
201 Eina_List *win_extra;
202 Ecore_X_Pixmap pmap;
203 Ecore_X_Pixmap mask;
204 Ecore_X_GC gc;
205 Ecore_X_XRegion *damages;
206 Ecore_X_Sync_Counter sync_counter;
207 Ecore_X_Window leader;
208 Ecore_X_Sync_Counter netwm_sync_counter;
209 int netwm_sync_val_hi;
210 unsigned int netwm_sync_val_lo;
211 int sync_val; // bigger! this will screw up at 2 billion frames (414 days of continual rendering @ 60fps)
212 int screen_num;
213 int px, py, pw, ph;
214 unsigned char direct_resize : 1;
215 unsigned char using_bg_pixmap : 1;
216 unsigned char managed : 1;
217 unsigned char sync_began : 1;
218 unsigned char sync_cancel : 1;
219 unsigned char netwm_sync_set : 1;
220 unsigned char configure_coming : 1;
221 struct {
222 unsigned char modal : 1;
223 unsigned char sticky : 1;
224 unsigned char maximized_v : 1;
225 unsigned char maximized_h : 1;
226 unsigned char shaded : 1;
227 unsigned char skip_taskbar : 1;
228 unsigned char skip_pager : 1;
229 unsigned char fullscreen : 1;
230 unsigned char above : 1;
231 unsigned char below : 1;
232 } state;
233 Ecore_X_Window win_shaped_input;
234 } x;
235#endif
236#ifdef BUILD_ECORE_EVAS_FB
237 struct {
238 int real_w;
239 int real_h;
240 } fb;
241#endif
242#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
243 struct {
244 void *pixels;
245 Evas_Object *image;
246 void (*free_func) (void *data, void *pix);
247 void *(*alloc_func) (void *data, int size);
248 void *data;
249 } buffer;
250#endif
251#ifdef BUILD_ECORE_EVAS_DIRECTFB
252 struct {
253 Ecore_DirectFB_Window *window;
254 } directfb;
255#endif
256#ifdef BUILD_ECORE_EVAS_WIN32
257 struct {
258 Ecore_Win32_Window *parent;
259 struct {
260 unsigned char region : 1;
261 unsigned char fullscreen : 1;
262 } state;
263 } win32;
264#endif
265#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
266 struct {
267 Ecore_WinCE_Window *window;
268 struct {
269 unsigned char fullscreen : 1;
270 } state;
271 } wince;
272#endif
273#ifdef BUILD_ECORE_EVAS_EWS
274 struct {
275 Evas_Object *image;
276 } ews;
277#endif
278
279#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL)
280 struct
281 {
282 Ecore_Wl_Window *parent, *win;
283 Evas_Object *frame;
284
285# if defined(BUILD_ECORE_EVAS_WAYLAND_SHM)
286 struct wl_buffer *buffer;
287# endif
288
289 } wl;
290#endif
291
292 Ecore_Timer *idle_flush_timer;
293};
294
295struct _Ecore_Evas
296{
297 EINA_INLIST;
298 ECORE_MAGIC;
299 Evas *evas;
300 const char *driver;
301 char *name;
302 int x, y, w, h;
303 short rotation;
304 Eina_Bool shaped : 1;
305 Eina_Bool visible : 1;
306 Eina_Bool draw_ok : 1;
307 Eina_Bool should_be_visible : 1;
308 Eina_Bool alpha : 1;
309 Eina_Bool transparent : 1;
310 Eina_Bool in : 1;
311
312 Eina_Hash *data;
313
314 struct {
315 int x, y, w, h;
316 } req;
317
318 struct {
319 int x, y;
320 } mouse;
321
322 struct {
323 int w, h;
324 } expecting_resize;
325
326 struct {
327 char *title;
328 char *name;
329 char *clas;
330 struct {
331 int w, h;
332 } min,
333 max,
334 base,
335 step;
336 struct {
337 Evas_Object *object;
338 int layer;
339 struct {
340 int x, y;
341 } hot;
342 } cursor;
343 int layer;
344 Ecore_Window window;
345 unsigned char avoid_damage;
346 Ecore_Evas *group_ee;
347 Ecore_Window group_ee_win;
348 double aspect;
349 char focused : 1;
350 char iconified : 1;
351 char borderless : 1;
352 char override : 1;
353 char maximized : 1;
354 char fullscreen : 1;
355 char withdrawn : 1;
356 char sticky : 1;
357 char request_pos : 1;
358 char draw_frame : 1;
359 char hwsurface : 1;
360 char urgent : 1;
361 char modal : 1;
362 char demand_attention : 1;
363 char focus_skip : 1;
364 } prop;
365
366 struct {
367 void (*fn_resize) (Ecore_Evas *ee);
368 void (*fn_move) (Ecore_Evas *ee);
369 void (*fn_show) (Ecore_Evas *ee);
370 void (*fn_hide) (Ecore_Evas *ee);
371 void (*fn_delete_request) (Ecore_Evas *ee);
372 void (*fn_destroy) (Ecore_Evas *ee);
373 void (*fn_focus_in) (Ecore_Evas *ee);
374 void (*fn_focus_out) (Ecore_Evas *ee);
375 void (*fn_sticky) (Ecore_Evas *ee);
376 void (*fn_unsticky) (Ecore_Evas *ee);
377 void (*fn_mouse_in) (Ecore_Evas *ee);
378 void (*fn_mouse_out) (Ecore_Evas *ee);
379 void (*fn_pre_render) (Ecore_Evas *ee);
380 void (*fn_post_render) (Ecore_Evas *ee);
381 void (*fn_pre_free) (Ecore_Evas *ee);
382 void (*fn_state_change) (Ecore_Evas *ee);
383 } func;
384
385 Ecore_Evas_Engine engine;
386 Eina_List *sub_ecore_evas;
387
388 int refcount;
389
390 unsigned char ignore_events : 1;
391 unsigned char manual_render : 1;
392 unsigned char registered : 1;
393 unsigned char no_comp_sync : 1;
394 unsigned char semi_sync : 1;
395 unsigned char deleted : 1;
396};
397
398void _ecore_evas_ref(Ecore_Evas *ee);
399void _ecore_evas_unref(Ecore_Evas *ee);
400
401#ifdef BUILD_ECORE_EVAS_X11
402int _ecore_evas_x_shutdown(void);
403#endif
404#ifdef BUILD_ECORE_EVAS_FB
405int _ecore_evas_fb_shutdown(void);
406#endif
407#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
408int _ecore_evas_buffer_shutdown(void);
409int _ecore_evas_buffer_render(Ecore_Evas *ee);
410#endif
411#ifdef BUILD_ECORE_EVAS_DIRECTFB
412int _ecore_evas_directfb_shutdown(void);
413#endif
414#ifdef BUILD_ECORE_EVAS_WIN32
415int _ecore_evas_win32_shutdown(void);
416#endif
417#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
418int _ecore_evas_wince_shutdown(void);
419#endif
420#ifdef BUILD_ECORE_EVAS_EWS
421void _ecore_evas_ews_events_init(void);
422int _ecore_evas_ews_shutdown(void);
423#endif
424
425#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
426void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location);
427void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
428void _ecore_evas_wayland_shm_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y);
429void _ecore_evas_wayland_shm_type_set(Ecore_Evas *ee, int type);
430#endif
431
432#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
433void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location);
434void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
435void _ecore_evas_wayland_egl_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y);
436void _ecore_evas_wayland_egl_type_set(Ecore_Evas *ee, int type);
437#endif
438
439void _ecore_evas_fps_debug_init(void);
440void _ecore_evas_fps_debug_shutdown(void);
441void _ecore_evas_fps_debug_rendertime_add(double t);
442void _ecore_evas_register(Ecore_Evas *ee);
443void _ecore_evas_free(Ecore_Evas *ee);
444void _ecore_evas_idle_timeout_update(Ecore_Evas *ee);
445void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp);
446void _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device,
447 int x, int y,
448 double radius,
449 double radius_x, double radius_y,
450 double pressure,
451 double angle,
452 double mx, double my,
453 unsigned int timestamp);
454void _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device,
455 int x, int y,
456 double radius,
457 double radius_x, double radius_y,
458 double pressure,
459 double angle,
460 double mx, double my,
461 Evas_Button_Flags flags,
462 unsigned int timestamp);
463void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
464 int x, int y,
465 double radius,
466 double radius_x, double radius_y,
467 double pressure,
468 double angle,
469 double mx, double my,
470 Evas_Button_Flags flags,
471 unsigned int timestamp);
472
473extern Eina_Bool _ecore_evas_app_comp_sync;
474
475void _ecore_evas_extn_init(void);
476void _ecore_evas_extn_shutdown(void);
477
478#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
deleted file mode 100644
index 038654a..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c
+++ /dev/null
@@ -1,513 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#include <Ecore_Input.h>
7#include <Ecore_Input_Evas.h>
8
9#include "ecore_evas_private.h"
10#include "Ecore_Evas.h"
11
12#ifdef BUILD_ECORE_EVAS_PSL1GHT
13#include <Ecore_Psl1ght.h>
14#include <Evas_Engine_PSL1GHT.h>
15
16static int _ecore_evas_init_count = 0;
17
18static Ecore_Evas *psl1ght_ee = NULL;
19static Ecore_Event_Handler *ecore_evas_event_handlers[5] = {
20 NULL, NULL, NULL, NULL
21};
22
23static const char *ecore_evas_psl1ght_default = "EFL PSL1GHT";
24static int _ecore_evas_fps_debug = 0;
25static Ecore_Poller *ecore_evas_event;
26
27static unsigned int
28_ecore_evas_time_get()
29{
30 return (unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff;
31}
32
33static Ecore_Evas *
34_ecore_evas_psl1ght_match(void)
35{
36 return psl1ght_ee;
37}
38
39static Eina_Bool
40_ecore_evas_psl1ght_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
41{
42 Ecore_Evas *ee;
43
44 ee = _ecore_evas_psl1ght_match();
45
46 if (!ee) return ECORE_CALLBACK_PASS_ON;
47 /* pass on event */
48 ee->prop.focused = 1;
49 evas_focus_in(ee->evas);
50 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
51
52 return ECORE_CALLBACK_PASS_ON;
53}
54
55static Eina_Bool
56_ecore_evas_psl1ght_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
57{
58 Ecore_Evas *ee;
59
60 ee = _ecore_evas_psl1ght_match();
61
62 if (!ee) return ECORE_CALLBACK_PASS_ON;
63 /* pass on event */
64 evas_focus_out(ee->evas);
65 ee->prop.focused = 0;
66 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
67
68 return ECORE_CALLBACK_PASS_ON;
69}
70
71static Eina_Bool
72_ecore_evas_psl1ght_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
73{
74 Ecore_Evas *ee;
75 int w;
76 int h;
77
78 ee = _ecore_evas_psl1ght_match();
79
80 if (!ee) return ECORE_CALLBACK_PASS_ON;
81 evas_output_size_get(ee->evas, &w, &h);
82 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
83
84 return ECORE_CALLBACK_PASS_ON;
85}
86
87static Eina_Bool
88_ecore_evas_psl1ght_event_key_modifiers(void *data __UNUSED__, int type __UNUSED__, void *event)
89{
90 Ecore_Evas *ee;
91 Ecore_Psl1ght_Event_Key_Modifiers *e = event;
92
93 ee = _ecore_evas_psl1ght_match();
94
95 if (!ee) return ECORE_CALLBACK_PASS_ON;
96 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
97
98 return ECORE_CALLBACK_PASS_ON;
99}
100
101static Eina_Bool
102_ecore_evas_psl1ght_event_quit (void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
103{
104 Ecore_Evas *ee;
105
106 ee = _ecore_evas_psl1ght_match();
107
108 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
109 if (ee->func.fn_delete_request)
110 ee->func.fn_delete_request(ee);
111 return ECORE_CALLBACK_PASS_ON;
112}
113
114static int
115_ecore_evas_render(Ecore_Evas *ee)
116{
117 Eina_List *updates;
118
119 updates = evas_render_updates(ee->evas);
120 if (updates)
121 {
122 evas_render_updates_free(updates);
123 _ecore_evas_idle_timeout_update(ee);
124 }
125 return updates ? 1 : 0;
126}
127
128static int
129_ecore_evas_psl1ght_render(Ecore_Evas *ee)
130{
131 int rend = 0;
132
133#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
134 Eina_List *ll;
135 Ecore_Evas *ee2;
136
137 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
138 {
139 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
140 rend |= _ecore_evas_buffer_render(ee2);
141 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
142 }
143#endif
144
145 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
146
147 if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee);
148 else if ((ee->visible) ||
149 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
150 ((ee->should_be_visible) && (ee->prop.override)))
151 rend |= _ecore_evas_render(ee);
152 else
153 evas_norender(ee->evas);
154
155 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
156 return rend;
157}
158
159static Eina_Bool
160_ecore_evas_psl1ght_event(void *data __UNUSED__)
161{
162 ecore_psl1ght_poll_events();
163 return ECORE_CALLBACK_RENEW;
164}
165
166static int
167_ecore_evas_psl1ght_init(int w __UNUSED__, int h __UNUSED__)
168{
169 _ecore_evas_init_count++;
170 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
171
172 _ecore_evas_fps_debug = 1;
173
174 // this is pretty bad: poller? and set poll time? pol time is meant to be
175 // adjustable for things like polling battery state, or amoutn of spare
176 // memory etc.
177 //
178 ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_psl1ght_event, NULL);
179 ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006);
180
181 if (_ecore_evas_fps_debug)
182 _ecore_evas_fps_debug_init();
183
184 ecore_event_evas_init();
185
186 ecore_evas_event_handlers[0] =
187 ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS,
188 _ecore_evas_psl1ght_event_got_focus, NULL);
189 ecore_evas_event_handlers[1] =
190 ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS,
191 _ecore_evas_psl1ght_event_lost_focus, NULL);
192 ecore_evas_event_handlers[2] =
193 ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE,
194 _ecore_evas_psl1ght_event_video_expose, NULL);
195 ecore_evas_event_handlers[3] =
196 ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS,
197 _ecore_evas_psl1ght_event_key_modifiers, NULL);
198 ecore_evas_event_handlers[4] =
199 ecore_event_handler_add(ECORE_PSL1GHT_EVENT_QUIT,
200 _ecore_evas_psl1ght_event_quit, NULL);
201
202 return _ecore_evas_init_count;
203}
204
205static int
206_ecore_evas_psl1ght_shutdown(void)
207{
208 _ecore_evas_init_count--;
209 if (_ecore_evas_init_count == 0)
210 {
211 unsigned int i;
212
213 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler *); i++)
214 ecore_event_handler_del(ecore_evas_event_handlers[i]);
215 ecore_event_evas_shutdown();
216 ecore_poller_del(ecore_evas_event);
217 ecore_evas_event = NULL;
218 if (_ecore_evas_fps_debug)
219 _ecore_evas_fps_debug_shutdown();
220 }
221 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
222 return _ecore_evas_init_count;
223}
224
225static void
226_ecore_evas_psl1ght_free(Ecore_Evas *ee)
227{
228 if (psl1ght_ee == ee) psl1ght_ee = NULL;
229
230 ecore_event_window_unregister(0);
231 _ecore_evas_psl1ght_shutdown();
232 ecore_psl1ght_shutdown();
233}
234
235static void
236_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
237{
238 ee->func.fn_delete_request = func;
239}
240
241static void
242_ecore_evas_screen_resized(Ecore_Evas *ee)
243{
244 int w, h;
245
246 /* Do not resize if the window is not fullscreen */
247 if (ee->prop.fullscreen == 0) return;
248
249 ecore_psl1ght_screen_resolution_get (&w, &h);
250
251 if (w != ee->w || h != ee->h)
252 {
253 ee->req.w = ee->w = w;
254 ee->req.h = ee->h = h;
255 evas_output_size_set(ee->evas, ee->w, ee->h);
256 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
257 ecore_psl1ght_resolution_set (w, h);
258 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
259
260 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
261 _ecore_evas_time_get());
262 if (ee->func.fn_resize) ee->func.fn_resize(ee);
263 }
264}
265
266static void
267_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
268{
269 if ((w == ee->w) && (h == ee->h)) return;
270 ee->w = w;
271 ee->h = h;
272
273 evas_output_size_set(ee->evas, ee->w, ee->h);
274
275 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
276 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
277
278 ecore_psl1ght_resolution_set (w, h);
279
280 if (ee->func.fn_resize) ee->func.fn_resize(ee);
281
282 _ecore_evas_screen_resized (ee);
283}
284
285static void
286_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
287{
288 _ecore_evas_resize (ee, w, h);
289}
290
291static void
292_ecore_evas_show(Ecore_Evas *ee)
293{
294 if (ee->prop.focused) return;
295 ee->prop.focused = 1;
296 evas_focus_in(ee->evas);
297 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
298}
299
300static void
301_ecore_evas_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
302{
303 if (x) *x = 0;
304 if (y) *y = 0;
305 ecore_psl1ght_screen_resolution_get (w, h);
306}
307
308static void
309_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
310{
311 Ecore_Evas *ee;
312
313 ee = data;
314 if (ee)
315 ee->prop.cursor.object = NULL;
316}
317
318static void
319_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
320{
321 int x, y;
322
323 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
324
325 if (!obj)
326 {
327 ee->prop.cursor.object = NULL;
328 ee->prop.cursor.layer = 0;
329 ee->prop.cursor.hot.x = 0;
330 ee->prop.cursor.hot.y = 0;
331 return;
332 }
333
334 ee->prop.cursor.object = obj;
335 ee->prop.cursor.layer = layer;
336 ee->prop.cursor.hot.x = hot_x;
337 ee->prop.cursor.hot.y = hot_y;
338 evas_pointer_output_xy_get(ee->evas, &x, &y);
339 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
340 evas_object_move(ee->prop.cursor.object,
341 x - ee->prop.cursor.hot.x,
342 y - ee->prop.cursor.hot.y);
343 evas_object_pass_events_set(ee->prop.cursor.object, 1);
344 if (evas_pointer_inside_get(ee->evas))
345 evas_object_show(ee->prop.cursor.object);
346
347 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
348}
349
350static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
351{
352 _ecore_evas_psl1ght_free,
353 NULL,
354 NULL,
355 NULL,
356 NULL,
357 _ecore_evas_psl1ght_callback_delete_request_set,
358 NULL,
359 NULL,
360 NULL,
361 NULL,
362 NULL,
363 NULL,
364 NULL,
365 NULL,
366 NULL,
367 NULL,
368 NULL,
369 _ecore_evas_resize,
370 _ecore_evas_move_resize,
371 NULL,
372 NULL,
373 _ecore_evas_show,
374 NULL,
375 NULL,
376 NULL,
377 NULL,
378 NULL,
379 NULL,
380 NULL,
381 NULL,
382 NULL,
383 NULL,
384 _ecore_evas_object_cursor_set,
385 NULL,
386 NULL,
387 NULL,
388 NULL,
389 NULL,
390 NULL,
391 NULL,
392 NULL,
393 NULL,
394 NULL,
395 NULL,
396 NULL,
397 NULL, //transparent
398
399 NULL,
400 NULL,
401 NULL,
402 NULL,
403 NULL,
404 NULL,
405
406 NULL, // render
407 _ecore_evas_screen_geometry_get // screen_geometry_get
408};
409
410EAPI Ecore_Evas *
411ecore_evas_psl1ght_new(const char *name, int w, int h)
412{
413 void *einfo;
414 Ecore_Evas *ee;
415
416 if (!name)
417 name = ecore_evas_psl1ght_default;
418
419 ee = calloc(1, sizeof(Ecore_Evas));
420 if (!ee) return NULL;
421
422 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
423
424 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_psl1ght_engine_func;
425
426 ee->driver = "psl1ght";
427 if (name) ee->name = strdup(name);
428
429 if (w < 1) w = 1;
430 if (h < 1) h = 1;
431 ee->visible = 1;
432 ee->w = w;
433 ee->h = h;
434
435 ee->prop.max.w = 0;
436 ee->prop.max.h = 0;
437 ee->prop.layer = 0;
438 ee->prop.focused = 1;
439 ee->prop.borderless = 1;
440 ee->prop.override = 1;
441 ee->prop.maximized = 1;
442 ee->prop.fullscreen = 0;
443 ee->prop.withdrawn = 0;
444 ee->prop.sticky = 0;
445 ee->prop.window = 0;
446
447 /* init evas here */
448 ee->evas = evas_new();
449 evas_data_attach_set(ee->evas, ee);
450 evas_output_method_set(ee->evas, evas_render_method_lookup("psl1ght"));
451
452 evas_output_size_set(ee->evas, w, h);
453 evas_output_viewport_set(ee->evas, 0, 0, w, h);
454
455 einfo = evas_engine_info_get(ee->evas);
456 if (einfo)
457 {
458 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
459 {
460 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
461 ecore_evas_free(ee);
462 return NULL;
463 }
464 }
465 else
466 {
467 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
468 ecore_evas_free(ee);
469 return NULL;
470 }
471
472 if (!ecore_psl1ght_init(name))
473 {
474 evas_free(ee->evas);
475 if (ee->name) free(ee->name);
476 free(ee);
477 return NULL;
478 }
479 ecore_psl1ght_resolution_set (w, h);
480
481 _ecore_evas_psl1ght_init(w, h);
482
483 ecore_event_window_register(0, ee, ee->evas,
484 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
485 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
486 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
487 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
488
489 ee->engine.func->fn_render = _ecore_evas_psl1ght_render;
490 _ecore_evas_register(ee);
491
492 psl1ght_ee = ee;
493
494 _ecore_evas_screen_resized (ee);
495
496 if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"))
497 ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0);
498
499 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
500
501 return ee;
502}
503
504#else /* BUILD_ECORE_EVAS_PSL1GHT */
505
506EAPI Ecore_Evas *
507ecore_evas_psl1ght_new(const char *name __UNUSED__, int w __UNUSED__, int h __UNUSED__)
508{
509 ERR("OUTCH !");
510 return NULL;
511}
512
513#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
deleted file mode 100644
index b246a26..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c
+++ /dev/null
@@ -1,656 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#include <Ecore_Input.h>
7#include <Ecore_Input_Evas.h>
8#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
9# include <Ecore_Sdl.h>
10# ifdef BUILD_ECORE_EVAS_OPENGL_SDL
11# include <Evas_Engine_GL_SDL.h>
12# endif
13#endif
14
15#include <stdlib.h>
16#include <string.h>
17
18#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
19#include <SDL/SDL.h>
20#endif
21
22#include "ecore_evas_private.h"
23#include "Ecore_Evas.h"
24
25/**
26 ** SDL only handle one window at a time. That's by definition, there is nothing wrong here.
27 **
28 **/
29
30#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
31
32/* static char *ecore_evas_default_display = "0"; */
33/* static Ecore_List *ecore_evas_input_devices = NULL; */
34
35static int _ecore_evas_init_count = 0;
36
37static Ecore_Evas *sdl_ee = NULL;
38static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {
39 NULL, NULL, NULL, NULL
40};
41
42static const char *ecore_evas_sdl_default = "EFL SDL";
43static int _ecore_evas_fps_debug = 0;
44static Ecore_Poller *ecore_evas_event;
45
46static Ecore_Evas *
47_ecore_evas_sdl_match(void)
48{
49 return sdl_ee;
50}
51
52static void *
53_ecore_evas_sdl_switch_buffer(void *data, void *dest __UNUSED__)
54{
55 SDL_Flip(data);
56 return ((SDL_Surface*)data)->pixels;
57}
58
59static Eina_Bool
60_ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
61{
62 Ecore_Evas *ee;
63
64 ee = _ecore_evas_sdl_match();
65
66 if (!ee) return ECORE_CALLBACK_PASS_ON;
67 /* pass on event */
68 ee->prop.focused = 1;
69 evas_focus_in(ee->evas);
70 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
71 return ECORE_CALLBACK_PASS_ON;
72}
73
74static Eina_Bool
75_ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
76{
77 Ecore_Evas *ee;
78
79 ee = _ecore_evas_sdl_match();
80
81 if (!ee) return ECORE_CALLBACK_PASS_ON;
82 /* pass on event */
83 ee->prop.focused = 0;
84 evas_focus_out(ee->evas);
85 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
86 return ECORE_CALLBACK_PASS_ON;
87}
88
89static Eina_Bool
90_ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event)
91{
92 Ecore_Sdl_Event_Video_Resize *e;
93 Ecore_Evas *ee;
94 int rmethod;
95
96 e = event;
97 ee = _ecore_evas_sdl_match();
98
99 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
100
101 rmethod = evas_output_method_get(ee->evas);
102 if (rmethod == evas_render_method_lookup("buffer"))
103 {
104 Evas_Engine_Info_Buffer *einfo;
105
106 einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
107 if (einfo)
108 {
109 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
110 einfo->info.switch_data = SDL_SetVideoMode(e->w, e->h, 32,
111 (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
112 | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0)
113 | (ee->alpha ? SDL_SRCALPHA : 0)
114 | SDL_DOUBLEBUF);
115 if (!einfo->info.switch_data)
116 {
117 return EINA_FALSE;
118 }
119
120 SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
121 SDL_FillRect(einfo->info.switch_data, NULL, 0);
122
123 einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
124 einfo->info.dest_buffer_row_bytes = e->w * sizeof (int);
125 einfo->info.use_color_key = 0;
126 einfo->info.alpha_threshold = 0;
127 einfo->info.func.new_update_region = NULL;
128 einfo->info.func.free_update_region = NULL;
129 einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
130 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
131 {
132 return EINA_FALSE;
133 }
134 }
135 }
136
137 ee->w = e->w;
138 ee->h = e->h;
139
140 evas_output_size_set(ee->evas, e->w, e->h);
141 evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h);
142
143 return ECORE_CALLBACK_PASS_ON;
144}
145
146static Eina_Bool
147_ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
148{
149 Ecore_Evas *ee;
150 int w;
151 int h;
152
153 ee = _ecore_evas_sdl_match();
154
155 if (!ee) return ECORE_CALLBACK_PASS_ON;
156 evas_output_size_get(ee->evas, &w, &h);
157 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
158
159 return ECORE_CALLBACK_PASS_ON;
160}
161
162static int
163_ecore_evas_render(Ecore_Evas *ee)
164{
165 Eina_List *updates;
166
167 updates = evas_render_updates(ee->evas);
168 if (updates)
169 {
170 evas_render_updates_free(updates);
171 _ecore_evas_idle_timeout_update(ee);
172 }
173 return updates ? 1 : 0;
174}
175
176static int
177_ecore_evas_sdl_render(Ecore_Evas *ee)
178{
179 int rend = 0;
180 Eina_List *ll;
181 Ecore_Evas *ee2;
182
183 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
184 {
185 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
186 if (ee2->engine.func->fn_render)
187 rend |= ee2->engine.func->fn_render(ee2);
188 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
189 }
190
191 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
192
193 if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee);
194 else if ((ee->visible) ||
195 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
196 ((ee->should_be_visible) && (ee->prop.override)))
197 rend |= _ecore_evas_render(ee);
198 else
199 evas_norender(ee->evas);
200
201 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
202 return rend;
203}
204
205static Eina_Bool
206_ecore_evas_sdl_event(void *data __UNUSED__)
207{
208 ecore_sdl_feed_events();
209 return ECORE_CALLBACK_RENEW;
210}
211
212static int
213_ecore_evas_sdl_init(int w __UNUSED__, int h __UNUSED__)
214{
215 _ecore_evas_init_count++;
216 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
217
218#ifndef _WIN32
219 if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
220#endif /* _WIN32 */
221 // this is pretty bad: poller? and set poll time? pol time is meant to be
222 // adjustable for things like polling battery state, or amoutn of spare
223 // memory etc.
224 //
225 ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL);
226 ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006);
227#ifndef _WIN32
228 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
229#endif /* _WIN32 */
230
231 ecore_event_evas_init();
232
233 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL);
234 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL);
235 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL);
236 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL);
237
238 return _ecore_evas_init_count;
239}
240
241static int
242_ecore_evas_sdl_shutdown(void)
243{
244 _ecore_evas_init_count--;
245 if (_ecore_evas_init_count == 0)
246 {
247 unsigned int i;
248
249 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
250 ecore_event_handler_del(ecore_evas_event_handlers[i]);
251 ecore_event_evas_shutdown();
252 ecore_poller_del(ecore_evas_event);
253 ecore_evas_event = NULL;
254#ifndef _WIN32
255 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
256#endif /* _WIN32 */
257 }
258 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
259 return _ecore_evas_init_count;
260}
261
262static void
263_ecore_evas_sdl_free(Ecore_Evas *ee)
264{
265 if (sdl_ee == ee) sdl_ee = NULL;
266
267 ecore_event_window_unregister(0);
268 _ecore_evas_sdl_shutdown();
269 ecore_sdl_shutdown();
270}
271
272static void
273_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
274{
275 int rmethod;
276
277 if ((w == ee->w) && (h == ee->h)) return;
278 ee->w = w;
279 ee->h = h;
280
281 rmethod = evas_output_method_get(ee->evas);
282 if (rmethod == evas_render_method_lookup("buffer"))
283 {
284 Evas_Engine_Info_Buffer *einfo;
285
286 einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
287 if (einfo)
288 {
289 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
290 einfo->info.switch_data = SDL_SetVideoMode(w, h, 32,
291 (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
292 | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0)
293 | (ee->alpha ? SDL_SRCALPHA : 0)
294 | SDL_DOUBLEBUF);
295 if (!einfo->info.switch_data)
296 {
297 return ;
298 }
299
300 SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
301 SDL_FillRect(einfo->info.switch_data, NULL, 0);
302
303 einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
304 einfo->info.dest_buffer_row_bytes = w * sizeof (int);
305 einfo->info.use_color_key = 0;
306 einfo->info.alpha_threshold = 0;
307 einfo->info.func.new_update_region = NULL;
308 einfo->info.func.free_update_region = NULL;
309 einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
310 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
311 {
312 return ;
313 }
314 }
315 }
316
317 evas_output_size_set(ee->evas, ee->w, ee->h);
318 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
319 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
320
321 if (ee->func.fn_resize) ee->func.fn_resize(ee);
322}
323
324static void
325_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
326{
327 if ((w == ee->w) && (h == ee->h)) return;
328 ee->w = w;
329 ee->h = h;
330
331 evas_output_size_set(ee->evas, ee->w, ee->h);
332 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
333 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
334
335 if (ee->func.fn_resize) ee->func.fn_resize(ee);
336}
337
338static void
339_ecore_evas_show(Ecore_Evas *ee)
340{
341 if (ee->prop.focused) return;
342 ee->prop.focused = 1;
343 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
344}
345
346static void
347_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
348{
349 Ecore_Evas *ee;
350
351 ee = data;
352 if (ee) ee->prop.cursor.object = NULL;
353}
354
355static void
356_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
357{
358 int x, y;
359
360 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
361
362 if (!obj)
363 {
364 ee->prop.cursor.object = NULL;
365 ee->prop.cursor.layer = 0;
366 ee->prop.cursor.hot.x = 0;
367 ee->prop.cursor.hot.y = 0;
368 return;
369 }
370
371 ee->prop.cursor.object = obj;
372 ee->prop.cursor.layer = layer;
373 ee->prop.cursor.hot.x = hot_x;
374 ee->prop.cursor.hot.y = hot_y;
375 evas_pointer_output_xy_get(ee->evas, &x, &y);
376 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
377 evas_object_move(ee->prop.cursor.object,
378 x - ee->prop.cursor.hot.x,
379 y - ee->prop.cursor.hot.y);
380 evas_object_pass_events_set(ee->prop.cursor.object, 1);
381 if (evas_pointer_inside_get(ee->evas))
382 evas_object_show(ee->prop.cursor.object);
383
384 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
385}
386
387static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
388{
389 _ecore_evas_sdl_free,
390 NULL,
391 NULL,
392 NULL,
393 NULL,
394 NULL,
395 NULL,
396 NULL,
397 NULL,
398 NULL,
399 NULL,
400 NULL,
401 NULL,
402 NULL,
403 NULL,
404 NULL,
405 NULL,
406 _ecore_evas_resize,
407 _ecore_evas_move_resize,
408 NULL,
409 NULL,
410 _ecore_evas_show,
411 NULL,
412 NULL,
413 NULL,
414 NULL,
415 NULL,
416 NULL,
417 NULL,
418 NULL,
419 NULL,
420 NULL,
421 _ecore_evas_object_cursor_set,
422 NULL,
423 NULL,
424 NULL,
425 NULL,
426 NULL,
427 NULL,
428 NULL,
429 NULL,
430 NULL,
431 NULL,
432 NULL,
433 NULL,
434 NULL, //transparent
435
436 NULL,
437 NULL,
438 NULL,
439 NULL,
440 NULL,
441 NULL,
442
443 NULL, // render
444 NULL // screen_geometry_get
445};
446
447static Ecore_Evas*
448_ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha)
449{
450 Ecore_Evas *ee;
451
452 if (!name)
453 name = ecore_evas_sdl_default;
454
455 ee = calloc(1, sizeof(Ecore_Evas));
456 if (!ee) return NULL;
457
458 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
459
460 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_sdl_engine_func;
461
462 ee->driver = "sdl";
463 if (name) ee->name = strdup(name);
464
465 if (w < 1) w = 1;
466 if (h < 1) h = 1;
467 ee->visible = 1;
468 ee->w = w;
469 ee->h = h;
470
471 ee->prop.max.w = 0;
472 ee->prop.max.h = 0;
473 ee->prop.layer = 0;
474 ee->prop.focused = 1;
475 ee->prop.borderless = 1;
476 ee->prop.override = 1;
477 ee->prop.maximized = 1;
478 ee->prop.fullscreen = fullscreen;
479 ee->prop.withdrawn = 0;
480 ee->prop.sticky = 0;
481 ee->prop.window = 0;
482 ee->alpha = alpha;
483 ee->prop.hwsurface = hwsurface;
484
485 /* init evas here */
486 ee->evas = evas_new();
487 evas_data_attach_set(ee->evas, ee);
488 evas_output_method_set(ee->evas, rmethod);
489
490 evas_output_size_set(ee->evas, w, h);
491 evas_output_viewport_set(ee->evas, 0, 0, w, h);
492
493 if (rmethod == evas_render_method_lookup("buffer"))
494 {
495 Evas_Engine_Info_Buffer *einfo;
496
497 einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
498 if (einfo)
499 {
500 SDL_Init(SDL_INIT_NOPARACHUTE);
501
502 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
503 {
504 ERR("SDL_Init failed with %s", SDL_GetError());
505 SDL_Quit();
506 return NULL;
507 }
508
509 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
510 einfo->info.switch_data = SDL_SetVideoMode(w, h, 32,
511 (hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
512 | (fullscreen ? SDL_FULLSCREEN : 0)
513 | (noframe ? SDL_NOFRAME : 0)
514 | (alpha ? SDL_SRCALPHA : 0)
515 | SDL_DOUBLEBUF);
516 if (!einfo->info.switch_data)
517 {
518 ERR("SDL_SetVideoMode failed !");
519 ecore_evas_free(ee);
520 return NULL;
521 }
522
523 SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
524 SDL_FillRect(einfo->info.switch_data, NULL, 0);
525
526 einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
527 einfo->info.dest_buffer_row_bytes = w * sizeof (int);
528 einfo->info.use_color_key = 0;
529 einfo->info.alpha_threshold = 0;
530 einfo->info.func.new_update_region = NULL;
531 einfo->info.func.free_update_region = NULL;
532 einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
533 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
534 {
535 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
536 ecore_evas_free(ee);
537 return NULL;
538 }
539 }
540 else
541 {
542 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
543 ecore_evas_free(ee);
544 return NULL;
545 }
546 }
547 else if (rmethod == evas_render_method_lookup("gl_sdl"))
548 {
549#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
550 Evas_Engine_Info_GL_SDL *einfo;
551
552 einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas);
553 if (einfo)
554 {
555 einfo->flags.fullscreen = fullscreen;
556 einfo->flags.noframe = noframe;
557 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
558 {
559 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
560 ecore_evas_free(ee);
561 return NULL;
562 }
563 }
564 else
565 {
566 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
567 ecore_evas_free(ee);
568 return NULL;
569 }
570#endif
571 }
572 else
573 {
574 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
575 ecore_evas_free(ee);
576 return NULL;
577 }
578
579 if (!ecore_sdl_init(name))
580 {
581 evas_free(ee->evas);
582 if (ee->name) free(ee->name);
583 free(ee);
584 return NULL;
585 }
586
587 _ecore_evas_sdl_init(w, h);
588
589 ecore_event_window_register(0, ee, ee->evas,
590 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
591 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
592 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
593 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
594
595 SDL_ShowCursor(SDL_ENABLE);
596
597 ee->engine.func->fn_render = _ecore_evas_sdl_render;
598 _ecore_evas_register(ee);
599
600 sdl_ee = ee;
601 return ee;
602}
603#endif
604
605#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
606EAPI Ecore_Evas*
607ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha)
608{
609 Ecore_Evas *ee;
610 int rmethod;
611
612 rmethod = evas_render_method_lookup("buffer");
613 if (!rmethod) return NULL;
614
615 ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha);
616 return ee;
617}
618#else
619EAPI Ecore_Evas*
620ecore_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__)
621{
622 ERR("OUTCH !");
623 return NULL;
624}
625#endif
626
627EAPI Ecore_Evas*
628ecore_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__)
629{
630 ERR("OUTCH !");
631 return NULL;
632}
633
634#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
635EAPI Ecore_Evas*
636ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe)
637{
638 Ecore_Evas *ee;
639 int rmethod;
640
641 rmethod = evas_render_method_lookup("gl_sdl");
642 if (!rmethod) return NULL;
643
644 ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, 0, noframe, 0);
645 ee->driver = "gl_sdl";
646 return ee;
647}
648#else
649EAPI Ecore_Evas*
650ecore_evas_gl_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int noframe __UNUSED__)
651{
652 ERR("OUTCH !");
653 return NULL;
654}
655#endif
656
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c
deleted file mode 100644
index 839f0c8..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c
+++ /dev/null
@@ -1,439 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <string.h>
7
8#include <Ecore.h>
9#include "ecore_private.h"
10
11#include "ecore_evas_private.h"
12#include "Ecore_Evas.h"
13
14static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate";
15
16static void _ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags);
17static void _ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj);
18
19
20static Evas_Object *
21_ecore_evas_associate_get(const Ecore_Evas *ee)
22{
23 return ecore_evas_data_get(ee, ASSOCIATE_KEY);
24}
25
26static void
27_ecore_evas_associate_set(Ecore_Evas *ee, Evas_Object *obj)
28{
29 ecore_evas_data_set(ee, ASSOCIATE_KEY, obj);
30}
31
32static void
33_ecore_evas_associate_del(Ecore_Evas *ee)
34{
35 ecore_evas_data_set(ee, ASSOCIATE_KEY, NULL);
36}
37
38static Ecore_Evas *
39_evas_object_associate_get(const Evas_Object *obj)
40{
41 return evas_object_data_get(obj, ASSOCIATE_KEY);
42}
43
44static void
45_evas_object_associate_set(Evas_Object *obj, Ecore_Evas *ee)
46{
47 evas_object_data_set(obj, ASSOCIATE_KEY, ee);
48}
49
50static void
51_evas_object_associate_del(Evas_Object *obj)
52{
53 evas_object_data_del(obj, ASSOCIATE_KEY);
54}
55
56/** Associated Events: ******************************************************/
57
58/* Interceptors Callbacks */
59
60static void
61_ecore_evas_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
62{
63 Ecore_Evas *ee = data;
64 // FIXME: account for frame
65 ecore_evas_move(ee, x, y);
66 if (ecore_evas_override_get(ee)) evas_object_move(obj, x, y);
67}
68
69static void
70_ecore_evas_obj_intercept_raise(void *data, Evas_Object *obj __UNUSED__)
71{
72 Ecore_Evas *ee = data;
73 ecore_evas_raise(ee);
74}
75
76static void
77_ecore_evas_obj_intercept_lower(void *data, Evas_Object *obj __UNUSED__)
78{
79 Ecore_Evas *ee = data;
80 ecore_evas_lower(ee);
81}
82
83static void
84_ecore_evas_obj_intercept_stack_above(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *above __UNUSED__)
85{
86 INF("TODO: %s", __FUNCTION__);
87}
88
89static void
90_ecore_evas_obj_intercept_stack_below(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *below __UNUSED__)
91{
92 INF("TODO: %s", __FUNCTION__);
93}
94
95static void
96_ecore_evas_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l)
97{
98 Ecore_Evas *ee = data;
99 ecore_evas_layer_set(ee, l);
100}
101
102/* Event Callbacks */
103
104static void
105_ecore_evas_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
106{
107 Ecore_Evas *ee = data;
108 ecore_evas_show(ee);
109}
110
111static void
112_ecore_evas_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
113{
114 Ecore_Evas *ee = data;
115 ecore_evas_hide(ee);
116}
117
118static void
119_ecore_evas_obj_callback_resize(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
120{
121 Ecore_Evas *ee = data;
122 Evas_Coord ow, oh, fw, fh;
123
124 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
125 evas_output_framespace_get(e, NULL, NULL, &fw, &fh);
126 ow += fw;
127 oh += fh;
128 ecore_evas_resize(ee, ow, oh);
129}
130
131static void
132_ecore_evas_obj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
133{
134 Ecore_Evas *ee = data;
135 Evas_Coord w, h;
136
137 evas_object_size_hint_min_get(obj, &w, &h);
138 ecore_evas_size_min_set(ee, w, h);
139
140 evas_object_size_hint_max_get(obj, &w, &h);
141 if (w < 1) w = -1;
142 if (h < 1) h = -1;
143 ecore_evas_size_max_set(ee, w, h);
144}
145
146static void
147_ecore_evas_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
148{
149 Ecore_Evas *ee = data;
150 _ecore_evas_object_dissociate(ee, obj);
151 ecore_evas_free(ee);
152}
153
154static void
155_ecore_evas_obj_callback_del_dissociate(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
156{
157 Ecore_Evas *ee = data;
158 _ecore_evas_object_dissociate(ee, obj);
159}
160
161static void
162_ecore_evas_delete_request(Ecore_Evas *ee)
163{
164 Evas_Object *obj = _ecore_evas_associate_get(ee);
165 _ecore_evas_object_dissociate(ee, obj);
166 evas_object_del(obj);
167 ecore_evas_free(ee);
168}
169
170static void
171_ecore_evas_destroy(Ecore_Evas *ee)
172{
173 Evas_Object *obj = _ecore_evas_associate_get(ee);
174 if (!obj)
175 return;
176 _ecore_evas_object_dissociate(ee, obj);
177 evas_object_del(obj);
178}
179
180static void
181_ecore_evas_resize(Ecore_Evas *ee)
182{
183 Evas_Object *obj = _ecore_evas_associate_get(ee);
184 Evas_Coord w, h;
185 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
186 evas_object_resize(obj, w, h);
187}
188
189static void
190_ecore_evas_pre_free(Ecore_Evas *ee)
191{
192 Evas_Object *obj = _ecore_evas_associate_get(ee);
193 if (!obj)
194 return;
195 _ecore_evas_object_dissociate(ee, obj);
196 evas_object_del(obj);
197}
198
199static int
200_ecore_evas_object_evas_check(const char *function, const Ecore_Evas *ee, const Evas_Object *obj)
201{
202 const char *name, *type;
203 Evas *e;
204
205 e = evas_object_evas_get(obj);
206 if (e == ee->evas)
207 return 1;
208
209 name = evas_object_name_get(obj);
210 type = evas_object_type_get(obj);
211
212 ERR("ERROR: %s(): object %p (name=\"%s\", type=\"%s\") evas "
213 "is not the same as this Ecore_Evas evas: %p != %p",
214 function, obj,
215 name ? name : "", type ? type : "", e, ee->evas);
216 fflush(stderr);
217 if (getenv("ECORE_ERROR_ABORT")) abort();
218
219 return 0;
220}
221
222EAPI Eina_Bool
223ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags)
224{
225 Ecore_Evas *old_ee;
226 Evas_Object *old_obj;
227
228 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
229 {
230 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__);
231 return EINA_FALSE;
232 }
233
234 CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE);
235 if (!_ecore_evas_object_evas_check(__FUNCTION__, ee, obj))
236 return EINA_FALSE;
237
238 old_ee = _evas_object_associate_get(obj);;
239 if (old_ee)
240 ecore_evas_object_dissociate(old_ee, obj);
241
242 old_obj = _ecore_evas_associate_get(ee);
243 if (old_obj)
244 ecore_evas_object_dissociate(ee, old_obj);
245
246 _ecore_evas_object_associate(ee, obj, flags);
247 return EINA_TRUE;
248}
249
250EAPI Eina_Bool
251ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj)
252{
253 Ecore_Evas *old_ee;
254 Evas_Object *old_obj;
255
256 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
257 {
258 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__);
259 return EINA_FALSE;
260 }
261
262 CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE);
263 old_ee = _evas_object_associate_get(obj);
264 if (ee != old_ee) {
265 ERR("ERROR: trying to dissociate object that is not using "
266 "this Ecore_Evas: %p != %p", ee, old_ee);
267 return EINA_FALSE;
268 }
269
270 old_obj = _ecore_evas_associate_get(ee);
271 if (old_obj != obj) {
272 ERR("ERROR: trying to dissociate object that is not being "
273 "used by this Ecore_Evas: %p != %p", old_obj, obj);
274 return EINA_FALSE;
275 }
276
277 _ecore_evas_object_dissociate(ee, obj);
278
279 return EINA_TRUE;
280}
281
282EAPI Evas_Object *
283ecore_evas_object_associate_get(const Ecore_Evas *ee)
284{
285 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
286 {
287 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__);
288 return NULL;
289 }
290 return _ecore_evas_associate_get(ee);
291}
292
293static void
294_ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags)
295{
296 evas_object_event_callback_add
297 (obj, EVAS_CALLBACK_SHOW,
298 _ecore_evas_obj_callback_show, ee);
299 evas_object_event_callback_add
300 (obj, EVAS_CALLBACK_HIDE,
301 _ecore_evas_obj_callback_hide, ee);
302 evas_object_event_callback_add
303 (obj, EVAS_CALLBACK_RESIZE,
304 _ecore_evas_obj_callback_resize, ee);
305 evas_object_event_callback_add
306 (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
307 _ecore_evas_obj_callback_changed_size_hints, ee);
308 if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL)
309 evas_object_event_callback_add
310 (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee);
311 else
312 evas_object_event_callback_add
313 (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee);
314
315 evas_object_intercept_move_callback_add
316 (obj, _ecore_evas_obj_intercept_move, ee);
317
318 if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_STACK)
319 {
320 evas_object_intercept_raise_callback_add
321 (obj, _ecore_evas_obj_intercept_raise, ee);
322 evas_object_intercept_lower_callback_add
323 (obj, _ecore_evas_obj_intercept_lower, ee);
324 evas_object_intercept_stack_above_callback_add
325 (obj, _ecore_evas_obj_intercept_stack_above, ee);
326 evas_object_intercept_stack_below_callback_add
327 (obj, _ecore_evas_obj_intercept_stack_below, ee);
328 }
329
330 if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_LAYER)
331 evas_object_intercept_layer_set_callback_add
332 (obj, _ecore_evas_obj_intercept_layer_set, ee);
333
334 if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL)
335 {
336 ecore_evas_callback_delete_request_set(ee, _ecore_evas_delete_request);
337 ecore_evas_callback_destroy_set(ee, _ecore_evas_destroy);
338 }
339 ecore_evas_callback_pre_free_set(ee, _ecore_evas_pre_free);
340 ecore_evas_callback_resize_set(ee, _ecore_evas_resize);
341
342 _evas_object_associate_set(obj, ee);
343 _ecore_evas_associate_set(ee, obj);
344}
345
346static void
347_ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj)
348{
349 evas_object_event_callback_del_full
350 (obj, EVAS_CALLBACK_SHOW,
351 _ecore_evas_obj_callback_show, ee);
352 evas_object_event_callback_del_full
353 (obj, EVAS_CALLBACK_HIDE,
354 _ecore_evas_obj_callback_hide, ee);
355 evas_object_event_callback_del_full
356 (obj, EVAS_CALLBACK_RESIZE,
357 _ecore_evas_obj_callback_resize, ee);
358 evas_object_event_callback_del_full
359 (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
360 _ecore_evas_obj_callback_changed_size_hints, ee);
361 evas_object_event_callback_del_full
362 (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee);
363 evas_object_event_callback_del_full
364 (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee);
365
366 evas_object_intercept_move_callback_del
367 (obj, _ecore_evas_obj_intercept_move);
368
369 evas_object_intercept_raise_callback_del
370 (obj, _ecore_evas_obj_intercept_raise);
371 evas_object_intercept_lower_callback_del
372 (obj, _ecore_evas_obj_intercept_lower);
373 evas_object_intercept_stack_above_callback_del
374 (obj, _ecore_evas_obj_intercept_stack_above);
375 evas_object_intercept_stack_below_callback_del
376 (obj, _ecore_evas_obj_intercept_stack_below);
377
378 evas_object_intercept_layer_set_callback_del
379 (obj, _ecore_evas_obj_intercept_layer_set);
380
381 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
382 {
383 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__);
384 }
385 else
386 {
387 if (ee->func.fn_delete_request == _ecore_evas_delete_request)
388 ecore_evas_callback_delete_request_set(ee, NULL);
389 if (ee->func.fn_destroy == _ecore_evas_destroy)
390 ecore_evas_callback_destroy_set(ee, NULL);
391 if (ee->func.fn_resize == _ecore_evas_resize)
392 ecore_evas_callback_resize_set(ee, NULL);
393 if (ee->func.fn_pre_free == _ecore_evas_pre_free)
394 ecore_evas_callback_pre_free_set(ee, NULL);
395
396 _ecore_evas_associate_del(ee);
397 }
398
399 _evas_object_associate_del(obj);
400}
401
402/**
403 * Helper ecore_getopt callback to list available Ecore_Evas engines.
404 *
405 * This will list all available engines except buffer, this is useful
406 * for applications to let user choose how they should create windows
407 * with ecore_evas_new().
408 *
409 * @c callback_data value is used as @c FILE* and says where to output
410 * messages, by default it is @c stdout. You can specify this value
411 * with ECORE_GETOPT_CALLBACK_FULL() or ECORE_GETOPT_CALLBACK_ARGS().
412 *
413 * If there is a boolean storage provided, then it is marked with 1
414 * when this option is executed.
415 */
416unsigned char
417ecore_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)
418{
419 Eina_List *lst, *n;
420 const char *engine;
421 FILE *fp = data;
422
423 if (!fp)
424 fp = stdout;
425
426 lst = ecore_evas_engines_get();
427
428 fputs("supported engines:\n", fp);
429 EINA_LIST_FOREACH(lst, n, engine)
430 if (strcmp(engine, "buffer") != 0)
431 fprintf(fp, "\t%s\n", engine);
432
433 ecore_evas_engines_free(lst);
434
435 if (storage->boolp)
436 *storage->boolp = 1;
437
438 return 1;
439}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c
deleted file mode 100644
index e88fc35..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c
+++ /dev/null
@@ -1,1017 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5//#define LOGFNS 1
6
7#ifdef LOGFNS
8# include <stdio.h>
9# define LOGFN(fl, ln, fn) \
10 printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn);
11#else
12# define LOGFN(fl, ln, fn)
13#endif
14
15#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
16# include <stdlib.h>
17# include <string.h>
18# include <unistd.h>
19# include <sys/types.h>
20# include <sys/mman.h>
21#endif
22
23#include <Eina.h>
24#include <Evas.h>
25#include <Ecore.h>
26
27#include "ecore_evas_private.h"
28#include "Ecore_Evas.h"
29
30#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
31# include <Evas_Engine_Wayland_Egl.h>
32# include <Ecore_Wayland.h>
33
34/* local structures */
35typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
36struct _EE_Wl_Smart_Data
37{
38 Evas_Object *frame;
39 Evas_Object *text;
40 Evas_Coord x, y, w, h;
41};
42
43/* local function prototypes */
44static int _ecore_evas_wl_init(void);
45static int _ecore_evas_wl_shutdown(void);
46static void _ecore_evas_wl_pre_free(Ecore_Evas *ee);
47static void _ecore_evas_wl_free(Ecore_Evas *ee);
48static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
49static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
50static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
51static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
52static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
53static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
54static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
55static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
56static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
57static void _ecore_evas_wl_show(Ecore_Evas *ee);
58static void _ecore_evas_wl_hide(Ecore_Evas *ee);
59static void _ecore_evas_wl_raise(Ecore_Evas *ee);
60static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title);
61static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
62static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
63static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
64static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
65static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
66static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
67static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
68static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
69static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
70static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
71static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
72static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
73static int _ecore_evas_wl_render(Ecore_Evas *ee);
74static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
75
76static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
77static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
78static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
79static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
80static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
81
82/* SMART stuff for frame */
83static Evas_Smart *_ecore_evas_wl_smart = NULL;
84
85static void _ecore_evas_wl_smart_init(void);
86static void _ecore_evas_wl_smart_add(Evas_Object *obj);
87static void _ecore_evas_wl_smart_del(Evas_Object *obj);
88static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
89static void _ecore_evas_wl_smart_show(Evas_Object *obj);
90static void _ecore_evas_wl_smart_hide(Evas_Object *obj);
91
92static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
93
94/* local variables */
95static int _ecore_evas_wl_init_count = 0;
96static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5];
97
98static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
99{
100 _ecore_evas_wl_free,
101 _ecore_evas_wl_callback_resize_set,
102 _ecore_evas_wl_callback_move_set,
103 NULL,
104 NULL,
105 _ecore_evas_wl_callback_delete_request_set,
106 NULL,
107 _ecore_evas_wl_callback_focus_in_set,
108 _ecore_evas_wl_callback_focus_out_set,
109 _ecore_evas_wl_callback_mouse_in_set,
110 _ecore_evas_wl_callback_mouse_out_set,
111 NULL, // sticky_set
112 NULL, // unsticky_set
113 NULL, // pre_render_set
114 NULL, // post_render_set
115 _ecore_evas_wl_move,
116 NULL, // managed_move
117 _ecore_evas_wl_resize,
118 NULL, // move_resize
119 NULL, // rotation_set
120 NULL, // shaped_set
121 _ecore_evas_wl_show,
122 _ecore_evas_wl_hide,
123 _ecore_evas_wl_raise,
124 NULL, // lower
125 NULL, // activate
126 _ecore_evas_wl_title_set,
127 _ecore_evas_wl_name_class_set,
128 _ecore_evas_wl_size_min_set,
129 _ecore_evas_wl_size_max_set,
130 _ecore_evas_wl_size_base_set,
131 _ecore_evas_wl_size_step_set,
132 NULL, // object_cursor_set
133 _ecore_evas_wl_layer_set,
134 NULL, // focus set
135 _ecore_evas_wl_iconified_set,
136 NULL, // borderless set
137 NULL, // override set
138 _ecore_evas_wl_maximized_set,
139 _ecore_evas_wl_fullscreen_set,
140 NULL, // func avoid_damage set
141 NULL, // func withdrawn set
142 NULL, // func sticky set
143 _ecore_evas_wl_ignore_events_set,
144 _ecore_evas_wl_alpha_set,
145 _ecore_evas_wl_transparent_set,
146 NULL,
147 NULL,
148 NULL,
149 NULL,
150 NULL,
151 NULL,
152 _ecore_evas_wl_render,
153 _ecore_evas_wl_screen_geometry_get
154};
155
156/* external variables */
157
158/* external functions */
159EAPI Ecore_Evas *
160ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
161{
162 Ecore_Wl_Window *p = NULL;
163 Evas_Engine_Info_Wayland_Egl *einfo;
164 Ecore_Evas *ee;
165 int method = 0;
166
167 LOGFN(__FILE__, __LINE__, __FUNCTION__);
168
169 if (!(method = evas_render_method_lookup("wayland_egl")))
170 {
171 ERR("Render method lookup failed for Wayland_Egl");
172 return NULL;
173 }
174
175 if (!ecore_wl_init(disp_name))
176 {
177 ERR("Failed to initialize Ecore_Wayland");
178 return NULL;
179 }
180
181 if (!(ee = calloc(1, sizeof(Ecore_Evas))))
182 {
183 ERR("Failed to allocate Ecore_Evas");
184 ecore_wl_shutdown();
185 return NULL;
186 }
187
188 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
189
190 _ecore_evas_wl_init();
191
192 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
193
194 ee->driver = "wayland_egl";
195 if (disp_name) ee->name = strdup(disp_name);
196
197 if (w < 1) w = 1;
198 if (h < 1) h = 1;
199
200 ee->x = x;
201 ee->y = y;
202 ee->w = w;
203 ee->h = h;
204 ee->req.x = ee->x;
205 ee->req.y = ee->y;
206 ee->req.w = ee->w;
207 ee->req.h = ee->h;
208 ee->rotation = 0;
209 ee->prop.max.w = 32767;
210 ee->prop.max.h = 32767;
211 ee->prop.layer = 4;
212 ee->prop.request_pos = 0;
213 ee->prop.sticky = 0;
214 ee->prop.draw_frame = frame;
215 ee->alpha = EINA_FALSE;
216
217 ee->evas = evas_new();
218 evas_data_attach_set(ee->evas, ee);
219 evas_output_method_set(ee->evas, method);
220 evas_output_size_set(ee->evas, ee->w, ee->h);
221 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
222
223 /* FIXME: This needs to be set based on theme & scale */
224 if (ee->prop.draw_frame)
225 evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
226
227 if (parent)
228 p = ecore_wl_window_find(parent);
229
230 /* FIXME: Get if parent is alpha, and set */
231
232 ee->engine.wl.parent = p;
233 ee->engine.wl.win =
234 ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
235 ee->prop.window = ee->engine.wl.win->id;
236
237 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
238 {
239 einfo->info.display = ecore_wl_display_get();
240 einfo->info.destination_alpha = EINA_FALSE;
241 einfo->info.rotation = ee->rotation;
242 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
243 {
244 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
245 ecore_evas_free(ee);
246 _ecore_evas_wl_shutdown();
247 ecore_wl_shutdown();
248 return NULL;
249 }
250 }
251 else
252 {
253 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
254 ecore_evas_free(ee);
255 _ecore_evas_wl_shutdown();
256 ecore_wl_shutdown();
257 return NULL;
258 }
259
260 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
261
262 if (ee->prop.draw_frame)
263 {
264 ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas);
265 evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE);
266 evas_object_move(ee->engine.wl.frame, 0, 0);
267 }
268
269 ecore_evas_input_event_register(ee);
270 _ecore_evas_register(ee);
271
272 ecore_event_window_register(ee->prop.window, ee, ee->evas,
273 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
274 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
275 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
276 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
277
278 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
279
280 return ee;
281}
282
283/* local functions */
284static int
285_ecore_evas_wl_init(void)
286{
287 LOGFN(__FILE__, __LINE__, __FUNCTION__);
288
289 if (++_ecore_evas_wl_init_count != 1)
290 return _ecore_evas_wl_init_count;
291
292 _ecore_evas_wl_event_hdls[0] =
293 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
294 _ecore_evas_wl_cb_mouse_in, NULL);
295 _ecore_evas_wl_event_hdls[1] =
296 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
297 _ecore_evas_wl_cb_mouse_out, NULL);
298 _ecore_evas_wl_event_hdls[2] =
299 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
300 _ecore_evas_wl_cb_focus_in, NULL);
301 _ecore_evas_wl_event_hdls[3] =
302 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
303 _ecore_evas_wl_cb_focus_out, NULL);
304 _ecore_evas_wl_event_hdls[4] =
305 ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
306 _ecore_evas_wl_cb_window_configure, NULL);
307
308 ecore_event_evas_init();
309
310 return _ecore_evas_wl_init_count;
311}
312
313static int
314_ecore_evas_wl_shutdown(void)
315{
316 unsigned int i = 0;
317
318 LOGFN(__FILE__, __LINE__, __FUNCTION__);
319
320 if (--_ecore_evas_wl_init_count != 0)
321 return _ecore_evas_wl_init_count;
322
323 for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++)
324 {
325 if (_ecore_evas_wl_event_hdls[i])
326 ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
327 }
328
329 ecore_event_evas_shutdown();
330
331 return _ecore_evas_wl_init_count;
332}
333
334static void
335_ecore_evas_wl_pre_free(Ecore_Evas *ee)
336{
337 LOGFN(__FILE__, __LINE__, __FUNCTION__);
338
339 if (!ee) return;
340 if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
341}
342
343static void
344_ecore_evas_wl_free(Ecore_Evas *ee)
345{
346 LOGFN(__FILE__, __LINE__, __FUNCTION__);
347
348 if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win);
349 ee->engine.wl.win = NULL;
350
351 ecore_event_window_unregister(ee->prop.window);
352 ecore_evas_input_event_unregister(ee);
353
354 _ecore_evas_wl_shutdown();
355 ecore_wl_shutdown();
356}
357
358static void
359_ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
360{
361 LOGFN(__FILE__, __LINE__, __FUNCTION__);
362
363 if (!ee) return;
364 ee->func.fn_resize = func;
365}
366
367static void
368_ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
369{
370 LOGFN(__FILE__, __LINE__, __FUNCTION__);
371
372 if (!ee) return;
373 ee->func.fn_move = func;
374}
375
376static void
377_ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
378{
379 LOGFN(__FILE__, __LINE__, __FUNCTION__);
380
381 if (!ee) return;
382 ee->func.fn_delete_request = func;
383}
384
385static void
386_ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
387{
388 LOGFN(__FILE__, __LINE__, __FUNCTION__);
389
390 if (!ee) return;
391 ee->func.fn_focus_in = func;
392}
393
394static void
395_ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
396{
397 LOGFN(__FILE__, __LINE__, __FUNCTION__);
398
399 if (!ee) return;
400 ee->func.fn_focus_out = func;
401}
402
403static void
404_ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
405{
406 LOGFN(__FILE__, __LINE__, __FUNCTION__);
407
408 if (!ee) return;
409 ee->func.fn_mouse_in = func;
410}
411
412static void
413_ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
414{
415 LOGFN(__FILE__, __LINE__, __FUNCTION__);
416
417 if (!ee) return;
418 ee->func.fn_mouse_out = func;
419}
420
421static void
422_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
423{
424 LOGFN(__FILE__, __LINE__, __FUNCTION__);
425
426 if (!ee) return;
427 ee->req.x = x;
428 ee->req.y = y;
429 ee->x = x;
430 ee->y = y;
431 if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y);
432 if (ee->func.fn_move) ee->func.fn_move(ee);
433}
434
435static void
436_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
437{
438 LOGFN(__FILE__, __LINE__, __FUNCTION__);
439
440 if (!ee) return;
441 if (w < 1) w = 1;
442 if (h < 1) h = 1;
443// if ((ee->w == w) && (ee->h == h)) return;
444
445 if (ee->prop.min.w > w) w = ee->prop.min.w;
446 else if (w > ee->prop.max.w) w = ee->prop.max.w;
447 if (ee->prop.min.h > h) h = ee->prop.min.h;
448 else if (h > ee->prop.max.h) h = ee->prop.max.h;
449
450 ee->req.w = w;
451 ee->req.h = h;
452
453// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
454
455 ee->w = w;
456 ee->h = h;
457
458 /* change evas output & viewport sizes */
459 evas_output_size_set(ee->evas, ee->w, ee->h);
460 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
461 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
462 if (ee->engine.wl.frame)
463 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
464
465 /* set new engine destination */
466 /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
467
468 /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
469 ecore_wl_flush();
470
471 ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
472
473 if (ee->func.fn_resize) ee->func.fn_resize(ee);
474}
475
476static void
477_ecore_evas_wl_show(Ecore_Evas *ee)
478{
479 Evas_Engine_Info_Wayland_Egl *einfo;
480
481 LOGFN(__FILE__, __LINE__, __FUNCTION__);
482
483 if ((!ee) || (ee->visible)) return;
484
485 if (ee->engine.wl.win)
486 {
487 ecore_wl_window_show(ee->engine.wl.win);
488 ecore_wl_flush();
489 }
490
491 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
492 if (!einfo)
493 {
494 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
495 return;
496 }
497
498 einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win);
499 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
500
501 if (ee->engine.wl.frame)
502 {
503 evas_object_show(ee->engine.wl.frame);
504 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
505 }
506
507 /* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */
508
509 ee->visible = 1;
510 if (ee->func.fn_show) ee->func.fn_show(ee);
511}
512
513static void
514_ecore_evas_wl_hide(Ecore_Evas *ee)
515{
516 Evas_Engine_Info_Wayland_Egl *einfo;
517
518 LOGFN(__FILE__, __LINE__, __FUNCTION__);
519
520 if ((!ee) || (!ee->visible)) return;
521
522 if (ee->engine.wl.win)
523 {
524 ecore_wl_window_hide(ee->engine.wl.win);
525 ecore_wl_flush();
526 }
527
528 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
529 if (einfo)
530 {
531 einfo->info.surface = NULL;
532 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
533 }
534
535 ee->visible = 0;
536 ee->should_be_visible = 0;
537
538 if (ee->func.fn_hide) ee->func.fn_hide(ee);
539}
540
541static void
542_ecore_evas_wl_raise(Ecore_Evas *ee)
543{
544 LOGFN(__FILE__, __LINE__, __FUNCTION__);
545
546 if ((!ee) || (!ee->visible)) return;
547 ecore_wl_window_raise(ee->engine.wl.win);
548}
549
550static void
551_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
552{
553 LOGFN(__FILE__, __LINE__, __FUNCTION__);
554
555 if (!ee) return;
556 if (ee->prop.title) free(ee->prop.title);
557 ee->prop.title = NULL;
558 if (title) ee->prop.title = strdup(title);
559 if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
560 {
561 EE_Wl_Smart_Data *sd;
562
563 if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
564 evas_object_text_text_set(sd->text, ee->prop.title);
565 }
566}
567
568static void
569_ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
570{
571 LOGFN(__FILE__, __LINE__, __FUNCTION__);
572
573 if (!ee) return;
574 if (ee->prop.name) free(ee->prop.name);
575 if (ee->prop.clas) free(ee->prop.clas);
576 ee->prop.name = NULL;
577 ee->prop.clas = NULL;
578 if (n) ee->prop.name = strdup(n);
579 if (c) ee->prop.clas = strdup(c);
580 /* FIXME: Forward these changes to Wayland somehow */
581}
582
583static void
584_ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h)
585{
586 LOGFN(__FILE__, __LINE__, __FUNCTION__);
587
588 if (!ee) return;
589 if (w < 0) w = 0;
590 if (h < 0) h = 0;
591 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
592 ee->prop.min.w = w;
593 ee->prop.min.h = h;
594}
595
596static void
597_ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h)
598{
599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
600
601 if (!ee) return;
602 if (w < 0) w = 0;
603 if (h < 0) h = 0;
604 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
605 ee->prop.max.w = w;
606 ee->prop.max.h = h;
607}
608
609static void
610_ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h)
611{
612 LOGFN(__FILE__, __LINE__, __FUNCTION__);
613
614 if (!ee) return;
615 if (w < 0) w = 0;
616 if (h < 0) h = 0;
617 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
618 ee->prop.base.w = w;
619 ee->prop.base.h = h;
620}
621
622static void
623_ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
624{
625 LOGFN(__FILE__, __LINE__, __FUNCTION__);
626
627 if (!ee) return;
628 if (w < 0) w = 0;
629 if (h < 0) h = 0;
630 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
631 ee->prop.step.w = w;
632 ee->prop.step.h = h;
633}
634
635static void
636_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
637{
638 LOGFN(__FILE__, __LINE__, __FUNCTION__);
639
640 if (!ee) return;
641 if (ee->prop.layer == layer) return;
642 if (layer < 1) layer = 1;
643 else if (layer > 255) layer = 255;
644 ee->prop.layer = layer;
645}
646
647static void
648_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
649{
650 LOGFN(__FILE__, __LINE__, __FUNCTION__);
651
652 if (!ee) return;
653 if (ee->prop.iconified == iconify) return;
654 ee->prop.iconified = iconify;
655 /* FIXME: Implement this in Wayland someshow */
656}
657
658static void
659_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
660{
661 LOGFN(__FILE__, __LINE__, __FUNCTION__);
662
663 if (!ee) return;
664 if (ee->prop.maximized == max) return;
665 ee->prop.maximized = max;
666 ecore_wl_window_maximized_set(ee->engine.wl.win, max);
667}
668
669static void
670_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
671{
672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
673
674 if ((!ee) || (!ee->visible)) return;
675 if (ee->prop.fullscreen == full) return;
676 ee->prop.fullscreen = full;
677 ecore_wl_window_fullscreen_set(ee->engine.wl.win, full);
678}
679
680static void
681_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
682{
683 LOGFN(__FILE__, __LINE__, __FUNCTION__);
684
685 if (!ee) return;
686 ee->ignore_events = ignore;
687 /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */
688}
689
690static void
691_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
692{
693 Evas_Engine_Info_Wayland_Egl *einfo;
694
695 LOGFN(__FILE__, __LINE__, __FUNCTION__);
696
697 if (!ee) return;
698 if ((ee->alpha == alpha)) return;
699 ee->alpha = alpha;
700 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
701 {
702 einfo->info.destination_alpha = alpha;
703 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
704 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
705 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
706 }
707}
708
709static void
710_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
711{
712 Evas_Engine_Info_Wayland_Egl *einfo;
713
714 LOGFN(__FILE__, __LINE__, __FUNCTION__);
715
716 if (!ee) return;
717 if ((ee->transparent == transparent)) return;
718 ee->transparent = transparent;
719 if (!ee->visible) return;
720 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
721 {
722 einfo->info.destination_alpha = transparent;
723 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
724 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
725 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
726 }
727}
728
729static int
730_ecore_evas_wl_render(Ecore_Evas *ee)
731{
732 int rend = 0;
733
734 if (!ee) return 0;
735 if (!ee->visible)
736 evas_norender(ee->evas);
737 else
738 {
739 Eina_List *ll = NULL, *updates = NULL;
740 Ecore_Evas *ee2 = NULL;
741
742 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
743
744 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
745 {
746 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
747 if (ee2->engine.func->fn_render)
748 rend |= ee2->engine.func->fn_render(ee2);
749 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
750 }
751
752 if ((updates = evas_render_updates(ee->evas)))
753 {
754 Eina_List *l = NULL;
755 Eina_Rectangle *r;
756
757 LOGFN(__FILE__, __LINE__, __FUNCTION__);
758
759 EINA_LIST_FOREACH(updates, l, r)
760 ecore_wl_window_damage(ee->engine.wl.win,
761 r->x, r->y, r->w, r->h);
762
763 ecore_wl_flush();
764
765 evas_render_updates_free(updates);
766 _ecore_evas_idle_timeout_update(ee);
767 rend = 1;
768 }
769
770 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
771 }
772 return rend;
773}
774
775static void
776_ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
777{
778 LOGFN(__FILE__, __LINE__, __FUNCTION__);
779
780 if (x) *x = 0;
781 if (y) *y = 0;
782 ecore_wl_screen_size_get(w, h);
783}
784
785void
786_ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
787{
788 LOGFN(__FILE__, __LINE__, __FUNCTION__);
789
790 if (!ee) return;
791 if (ee->engine.wl.win)
792 ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location);
793}
794
795static Eina_Bool
796_ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
797{
798 Ecore_Evas *ee;
799 Ecore_Wl_Event_Mouse_In *ev;
800
801 LOGFN(__FILE__, __LINE__, __FUNCTION__);
802
803 ev = event;
804 ee = ecore_event_window_match(ev->win);
805 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
806 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
807 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
808 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
809 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
810 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
811 return ECORE_CALLBACK_PASS_ON;
812}
813
814static Eina_Bool
815_ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
816{
817 Ecore_Evas *ee;
818 Ecore_Wl_Event_Mouse_Out *ev;
819
820 LOGFN(__FILE__, __LINE__, __FUNCTION__);
821
822 ev = event;
823 ee = ecore_event_window_match(ev->win);
824 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
825 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
826 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
827 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
828 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
829 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
830 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
831 return ECORE_CALLBACK_PASS_ON;
832}
833
834static Eina_Bool
835_ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
836{
837 Ecore_Evas *ee;
838 Ecore_Wl_Event_Focus_In *ev;
839
840 LOGFN(__FILE__, __LINE__, __FUNCTION__);
841
842 ev = event;
843 ee = ecore_event_window_match(ev->win);
844 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
845 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
846 ee->prop.focused = 1;
847 evas_focus_in(ee->evas);
848 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
849 return ECORE_CALLBACK_PASS_ON;
850}
851
852static Eina_Bool
853_ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
854{
855 Ecore_Evas *ee;
856 Ecore_Wl_Event_Focus_In *ev;
857
858 LOGFN(__FILE__, __LINE__, __FUNCTION__);
859
860 ev = event;
861 ee = ecore_event_window_match(ev->win);
862 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
863 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
864 evas_focus_out(ee->evas);
865 ee->prop.focused = 0;
866 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
867 return ECORE_CALLBACK_PASS_ON;
868}
869
870static Eina_Bool
871_ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
872{
873 Ecore_Evas *ee;
874 Ecore_Wl_Event_Window_Configure *ev;
875
876 LOGFN(__FILE__, __LINE__, __FUNCTION__);
877
878 ev = event;
879 ee = ecore_event_window_match(ev->win);
880 if (!ee) return ECORE_CALLBACK_PASS_ON;
881 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
882 if ((ee->x != ev->x) || (ee->y != ev->y))
883 {
884 ee->x = ev->x;
885 ee->y = ev->y;
886 ee->req.x = ee->x;
887 ee->req.y = ee->y;
888 if (ee->func.fn_move) ee->func.fn_move(ee);
889 }
890 if ((ee->req.w != ev->w) || (ee->req.h != ev->h))
891 {
892 ee->req.w = ev->w;
893 ee->req.h = ev->h;
894 if (ee->func.fn_resize) ee->func.fn_resize(ee);
895 }
896
897 return ECORE_CALLBACK_PASS_ON;
898}
899
900static void
901_ecore_evas_wl_smart_init(void)
902{
903 if (_ecore_evas_wl_smart) return;
904 {
905 static const Evas_Smart_Class sc =
906 {
907 "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION,
908 _ecore_evas_wl_smart_add,
909 _ecore_evas_wl_smart_del,
910 NULL,
911 _ecore_evas_wl_smart_resize,
912 _ecore_evas_wl_smart_show,
913 _ecore_evas_wl_smart_hide,
914 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
915 };
916 _ecore_evas_wl_smart = evas_smart_class_new(&sc);
917 }
918}
919
920static void
921_ecore_evas_wl_smart_add(Evas_Object *obj)
922{
923 EE_Wl_Smart_Data *sd;
924 Evas *evas;
925
926 LOGFN(__FILE__, __LINE__, __FUNCTION__);
927
928 if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
929
930 evas = evas_object_evas_get(obj);
931
932 sd->x = 0;
933 sd->y = 0;
934 sd->w = 1;
935 sd->h = 1;
936
937 sd->frame = evas_object_rectangle_add(evas);
938 evas_object_is_frame_object_set(sd->frame, EINA_TRUE);
939 evas_object_color_set(sd->frame, 249, 249, 249, 255);
940 evas_object_smart_member_add(sd->frame, obj);
941
942 sd->text = evas_object_text_add(evas);
943 evas_object_color_set(sd->text, 0, 0, 0, 255);
944 evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
945 evas_object_text_font_set(sd->text, "Sans", 10);
946 evas_object_text_text_set(sd->text, "Smart Test");
947
948 evas_object_smart_data_set(obj, sd);
949}
950
951static void
952_ecore_evas_wl_smart_del(Evas_Object *obj)
953{
954 EE_Wl_Smart_Data *sd;
955
956 LOGFN(__FILE__, __LINE__, __FUNCTION__);
957
958 if (!(sd = evas_object_smart_data_get(obj))) return;
959 evas_object_del(sd->text);
960 evas_object_del(sd->frame);
961 free(sd);
962}
963
964static void
965_ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
966{
967 EE_Wl_Smart_Data *sd;
968
969 LOGFN(__FILE__, __LINE__, __FUNCTION__);
970
971 if (!(sd = evas_object_smart_data_get(obj))) return;
972 if ((sd->w == w) && (sd->h == h)) return;
973 sd->w = w;
974 sd->h = h;
975 evas_object_resize(sd->frame, w, h);
976}
977
978static void
979_ecore_evas_wl_smart_show(Evas_Object *obj)
980{
981 EE_Wl_Smart_Data *sd;
982
983 LOGFN(__FILE__, __LINE__, __FUNCTION__);
984
985 if (!(sd = evas_object_smart_data_get(obj))) return;
986 evas_object_show(sd->frame);
987 evas_object_show(sd->text);
988}
989
990static void
991_ecore_evas_wl_smart_hide(Evas_Object *obj)
992{
993 EE_Wl_Smart_Data *sd;
994
995 LOGFN(__FILE__, __LINE__, __FUNCTION__);
996
997 if (!(sd = evas_object_smart_data_get(obj))) return;
998 evas_object_hide(sd->text);
999 evas_object_hide(sd->frame);
1000}
1001
1002static Evas_Object *
1003_ecore_evas_wl_frame_add(Evas *evas)
1004{
1005 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1006
1007 _ecore_evas_wl_smart_init();
1008 return evas_object_smart_add(evas, _ecore_evas_wl_smart);
1009}
1010
1011#else
1012EAPI Ecore_Evas *
1013ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__)
1014{
1015 return NULL;
1016}
1017#endif
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c
deleted file mode 100644
index 4c7ee2d..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c
+++ /dev/null
@@ -1,1114 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#define LOGFNS 1
6
7#ifdef LOGFNS
8# include <stdio.h>
9# define LOGFN(fl, ln, fn) \
10 printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn);
11#else
12# define LOGFN(fl, ln, fn)
13#endif
14
15#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
16# include <stdlib.h>
17# include <string.h>
18# include <unistd.h>
19# include <sys/types.h>
20# include <sys/mman.h>
21#endif
22
23#include <Eina.h>
24#include <Evas.h>
25#include <Ecore.h>
26
27#include "ecore_evas_private.h"
28#include "Ecore_Evas.h"
29
30#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
31# include <Evas_Engine_Wayland_Shm.h>
32# include <Ecore_Wayland.h>
33
34/* local structures */
35typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
36struct _EE_Wl_Smart_Data
37{
38 Evas_Object *frame;
39 Evas_Object *text;
40 Evas_Coord x, y, w, h;
41};
42
43/* local function prototypes */
44static int _ecore_evas_wl_init(void);
45static int _ecore_evas_wl_shutdown(void);
46static void _ecore_evas_wl_pre_free(Ecore_Evas *ee);
47static void _ecore_evas_wl_free(Ecore_Evas *ee);
48static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
49static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
50static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
51static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
52static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
53static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
54static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
55static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
56static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
57static void _ecore_evas_wl_show(Ecore_Evas *ee);
58static void _ecore_evas_wl_hide(Ecore_Evas *ee);
59static void _ecore_evas_wl_raise(Ecore_Evas *ee);
60static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title);
61static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
62static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
63static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
64static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
65static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
66static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
67static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
68static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
69static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
70static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
71static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
72static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
73static int _ecore_evas_wl_render(Ecore_Evas *ee);
74static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
75static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest);
76
77static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
78static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
79static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
80static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
81static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
82
83/* SMART stuff for frame */
84static Evas_Smart *_ecore_evas_wl_smart = NULL;
85
86static void _ecore_evas_wl_smart_init(void);
87static void _ecore_evas_wl_smart_add(Evas_Object *obj);
88static void _ecore_evas_wl_smart_del(Evas_Object *obj);
89static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
90static void _ecore_evas_wl_smart_show(Evas_Object *obj);
91static void _ecore_evas_wl_smart_hide(Evas_Object *obj);
92
93static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
94
95/* local variables */
96static int _ecore_evas_wl_init_count = 0;
97static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5];
98
99static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
100{
101 _ecore_evas_wl_free,
102 _ecore_evas_wl_callback_resize_set,
103 _ecore_evas_wl_callback_move_set,
104 NULL,
105 NULL,
106 _ecore_evas_wl_callback_delete_request_set,
107 NULL,
108 _ecore_evas_wl_callback_focus_in_set,
109 _ecore_evas_wl_callback_focus_out_set,
110 _ecore_evas_wl_callback_mouse_in_set,
111 _ecore_evas_wl_callback_mouse_out_set,
112 NULL, // sticky_set
113 NULL, // unsticky_set
114 NULL, // pre_render_set
115 NULL, // post_render_set
116 _ecore_evas_wl_move,
117 NULL, // managed_move
118 _ecore_evas_wl_resize,
119 NULL, // move_resize
120 NULL, // rotation_set
121 NULL, // shaped_set
122 _ecore_evas_wl_show,
123 _ecore_evas_wl_hide,
124 _ecore_evas_wl_raise,
125 NULL, // lower
126 NULL, // activate
127 _ecore_evas_wl_title_set,
128 _ecore_evas_wl_name_class_set,
129 _ecore_evas_wl_size_min_set,
130 _ecore_evas_wl_size_max_set,
131 _ecore_evas_wl_size_base_set,
132 _ecore_evas_wl_size_step_set,
133 NULL, // object_cursor_set
134 _ecore_evas_wl_layer_set,
135 NULL, // focus set
136 _ecore_evas_wl_iconified_set,
137 NULL, // borderless set
138 NULL, // override set
139 _ecore_evas_wl_maximized_set,
140 _ecore_evas_wl_fullscreen_set,
141 NULL, // func avoid_damage set
142 NULL, // func withdrawn set
143 NULL, // func sticky set
144 _ecore_evas_wl_ignore_events_set,
145 _ecore_evas_wl_alpha_set,
146 _ecore_evas_wl_transparent_set,
147 NULL,
148 NULL,
149 NULL,
150 NULL,
151 NULL,
152 NULL,
153 _ecore_evas_wl_render,
154 _ecore_evas_wl_screen_geometry_get
155};
156
157/* external variables */
158
159/* external functions */
160EAPI Ecore_Evas *
161ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
162{
163 Ecore_Wl_Window *p = NULL;
164 Evas_Engine_Info_Wayland_Shm *einfo;
165 Ecore_Evas *ee;
166 int method = 0;
167
168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
169
170 if (!(method = evas_render_method_lookup("wayland_shm")))
171 {
172 ERR("Render method lookup failed for Wayland_Shm");
173 return NULL;
174 }
175
176 if (!ecore_wl_init(disp_name))
177 {
178 ERR("Failed to initialize Ecore_Wayland");
179 return NULL;
180 }
181
182 if (!(ee = calloc(1, sizeof(Ecore_Evas))))
183 {
184 ERR("Failed to allocate Ecore_Evas");
185 ecore_wl_shutdown();
186 return NULL;
187 }
188
189 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
190
191 _ecore_evas_wl_init();
192
193 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
194
195 ee->driver = "wayland_shm";
196 if (disp_name) ee->name = strdup(disp_name);
197
198 if (w < 1) w = 1;
199 if (h < 1) h = 1;
200
201 ee->x = x;
202 ee->y = y;
203 ee->w = w;
204 ee->h = h;
205 ee->req.x = ee->x;
206 ee->req.y = ee->y;
207 ee->req.w = ee->w;
208 ee->req.h = ee->h;
209 ee->rotation = 0;
210 ee->prop.max.w = 32767;
211 ee->prop.max.h = 32767;
212 ee->prop.layer = 4;
213 ee->prop.request_pos = 0;
214 ee->prop.sticky = 0;
215 ee->prop.draw_frame = frame;
216
217 ee->evas = evas_new();
218 evas_data_attach_set(ee->evas, ee);
219 evas_output_method_set(ee->evas, method);
220 evas_output_size_set(ee->evas, ee->w, ee->h);
221 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
222
223 /* FIXME: This needs to be set based on theme & scale */
224 if (ee->prop.draw_frame)
225 evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
226
227 if (parent)
228 p = ecore_wl_window_find(parent);
229
230 /* FIXME: Get if parent is alpha, and set */
231
232 ee->engine.wl.parent = p;
233 ee->engine.wl.win =
234 ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
235 ee->prop.window = ee->engine.wl.win->id;
236
237 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
238 {
239 einfo->info.rotation = ee->rotation;
240 einfo->info.debug = EINA_FALSE;
241 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
242 {
243 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
244 ecore_evas_free(ee);
245 _ecore_evas_wl_shutdown();
246 ecore_wl_shutdown();
247 return NULL;
248 }
249 }
250 else
251 {
252 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
253 ecore_evas_free(ee);
254 _ecore_evas_wl_shutdown();
255 ecore_wl_shutdown();
256 return NULL;
257 }
258
259 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
260
261 if (ee->prop.draw_frame)
262 {
263 ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas);
264 evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE);
265 evas_object_move(ee->engine.wl.frame, 0, 0);
266 }
267
268 ecore_evas_input_event_register(ee);
269 _ecore_evas_register(ee);
270
271 ecore_event_window_register(ee->prop.window, ee, ee->evas,
272 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
273 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
274 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
275 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
276
277 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
278
279 return ee;
280}
281
282/* local functions */
283static int
284_ecore_evas_wl_init(void)
285{
286 LOGFN(__FILE__, __LINE__, __FUNCTION__);
287
288 if (++_ecore_evas_wl_init_count != 1)
289 return _ecore_evas_wl_init_count;
290
291 _ecore_evas_wl_event_hdls[0] =
292 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
293 _ecore_evas_wl_cb_mouse_in, NULL);
294 _ecore_evas_wl_event_hdls[1] =
295 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
296 _ecore_evas_wl_cb_mouse_out, NULL);
297 _ecore_evas_wl_event_hdls[2] =
298 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
299 _ecore_evas_wl_cb_focus_in, NULL);
300 _ecore_evas_wl_event_hdls[3] =
301 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
302 _ecore_evas_wl_cb_focus_out, NULL);
303 _ecore_evas_wl_event_hdls[4] =
304 ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
305 _ecore_evas_wl_cb_window_configure, NULL);
306
307 ecore_event_evas_init();
308
309 return _ecore_evas_wl_init_count;
310}
311
312static int
313_ecore_evas_wl_shutdown(void)
314{
315 unsigned int i = 0;
316
317 LOGFN(__FILE__, __LINE__, __FUNCTION__);
318
319 if (--_ecore_evas_wl_init_count != 0)
320 return _ecore_evas_wl_init_count;
321
322 for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++)
323 {
324 if (_ecore_evas_wl_event_hdls[i])
325 ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
326 }
327
328 ecore_event_evas_shutdown();
329
330 return _ecore_evas_wl_init_count;
331}
332
333static void
334_ecore_evas_wl_pre_free(Ecore_Evas *ee)
335{
336 Evas_Engine_Info_Wayland_Shm *einfo;
337
338 LOGFN(__FILE__, __LINE__, __FUNCTION__);
339
340 if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
341
342 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
343 if ((einfo) && (einfo->info.dest))
344 {
345 int ret = 0;
346
347 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
348 if (!ret) ERR("Failed to unmap engine destination: %m");
349 }
350}
351
352static void
353_ecore_evas_wl_free(Ecore_Evas *ee)
354{
355 LOGFN(__FILE__, __LINE__, __FUNCTION__);
356
357 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
358 ee->engine.wl.buffer = NULL;
359
360 if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win);
361 ee->engine.wl.win = NULL;
362
363 ecore_event_window_unregister(ee->prop.window);
364 ecore_evas_input_event_unregister(ee);
365
366 _ecore_evas_wl_shutdown();
367 ecore_wl_shutdown();
368}
369
370static void
371_ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
372{
373 LOGFN(__FILE__, __LINE__, __FUNCTION__);
374
375 if (!ee) return;
376 ee->func.fn_resize = func;
377}
378
379static void
380_ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
381{
382 LOGFN(__FILE__, __LINE__, __FUNCTION__);
383
384 if (!ee) return;
385 ee->func.fn_move = func;
386}
387
388static void
389_ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
390{
391 LOGFN(__FILE__, __LINE__, __FUNCTION__);
392
393 if (!ee) return;
394 ee->func.fn_delete_request = func;
395}
396
397static void
398_ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
399{
400 LOGFN(__FILE__, __LINE__, __FUNCTION__);
401
402 if (!ee) return;
403 ee->func.fn_focus_in = func;
404}
405
406static void
407_ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
408{
409 LOGFN(__FILE__, __LINE__, __FUNCTION__);
410
411 if (!ee) return;
412 ee->func.fn_focus_out = func;
413}
414
415static void
416_ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
417{
418 LOGFN(__FILE__, __LINE__, __FUNCTION__);
419
420 if (!ee) return;
421 ee->func.fn_mouse_in = func;
422}
423
424static void
425_ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
426{
427 LOGFN(__FILE__, __LINE__, __FUNCTION__);
428
429 if (!ee) return;
430 ee->func.fn_mouse_out = func;
431}
432
433static void
434_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
435{
436 LOGFN(__FILE__, __LINE__, __FUNCTION__);
437
438 if (!ee) return;
439 ee->req.x = x;
440 ee->req.y = y;
441 ee->x = x;
442 ee->y = y;
443 if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y);
444 if (ee->func.fn_move) ee->func.fn_move(ee);
445}
446
447static void
448_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
449{
450 Evas_Engine_Info_Wayland_Shm *einfo;
451
452 if (!ee) return;
453 if (w < 1) w = 1;
454 if (h < 1) h = 1;
455// if ((ee->w == w) && (ee->h == h)) return;
456
457 LOGFN(__FILE__, __LINE__, __FUNCTION__);
458
459 if (ee->prop.min.w > w) w = ee->prop.min.w;
460 else if (w > ee->prop.max.w) w = ee->prop.max.w;
461 if (ee->prop.min.h > h) h = ee->prop.min.h;
462 else if (h > ee->prop.max.h) h = ee->prop.max.h;
463
464 ee->req.w = w;
465 ee->req.h = h;
466
467// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
468
469 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
470 if ((einfo) && (einfo->info.dest))
471 {
472 int ret = 0;
473
474 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
475 if (!ret) ERR("Failed to unmap engine destination: %m");
476 }
477 else if (!einfo)
478 {
479 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
480 return;
481 }
482
483 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
484 ee->engine.wl.buffer = NULL;
485
486 ee->w = w;
487 ee->h = h;
488
489 _ecore_evas_wl_buffer_new(ee, &einfo->info.dest);
490 ecore_wl_flush();
491
492 /* change evas output & viewport sizes */
493 evas_output_size_set(ee->evas, ee->w, ee->h);
494 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
495 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
496 if (ee->engine.wl.frame)
497 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
498
499 /* set new engine destination */
500 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
501
502 /* damage buffer */
503// wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h);
504
505 ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0);
506 /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
507 /* ecore_wl_flush(); */
508
509 ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
510
511 if (ee->func.fn_resize) ee->func.fn_resize(ee);
512}
513
514static void
515_ecore_evas_wl_show(Ecore_Evas *ee)
516{
517 Evas_Engine_Info_Wayland_Shm *einfo;
518
519 LOGFN(__FILE__, __LINE__, __FUNCTION__);
520
521 if ((!ee) || (ee->visible)) return;
522
523 if (ee->engine.wl.win)
524 ecore_wl_window_show(ee->engine.wl.win);
525
526 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
527 if (!einfo)
528 {
529 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
530 return;
531 }
532
533 _ecore_evas_wl_buffer_new(ee, &einfo->info.dest);
534 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
535
536 if (ee->engine.wl.frame)
537 {
538 evas_object_show(ee->engine.wl.frame);
539 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
540 }
541
542 ecore_wl_flush();
543
544 if (ee->engine.wl.win)
545 ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0);
546
547 ee->visible = 1;
548 if (ee->func.fn_show) ee->func.fn_show(ee);
549}
550
551static void
552_ecore_evas_wl_hide(Ecore_Evas *ee)
553{
554 Evas_Engine_Info_Wayland_Shm *einfo;
555
556 LOGFN(__FILE__, __LINE__, __FUNCTION__);
557
558 if ((!ee) || (!ee->visible)) return;
559
560 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
561 if ((einfo) && (einfo->info.dest))
562 {
563 int ret = 0;
564
565 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
566 if (!ret) ERR("Failed to unmap engine destination: %m");
567 }
568
569 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
570 ee->engine.wl.buffer = NULL;
571
572 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
573
574 ecore_wl_window_hide(ee->engine.wl.win);
575
576 ee->visible = 0;
577 ee->should_be_visible = 0;
578
579 if (ee->func.fn_hide) ee->func.fn_hide(ee);
580}
581
582static void
583_ecore_evas_wl_raise(Ecore_Evas *ee)
584{
585 LOGFN(__FILE__, __LINE__, __FUNCTION__);
586
587 if ((!ee) || (!ee->visible)) return;
588 ecore_wl_window_raise(ee->engine.wl.win);
589}
590
591static void
592_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
593{
594 LOGFN(__FILE__, __LINE__, __FUNCTION__);
595
596 if (!ee) return;
597 if (ee->prop.title) free(ee->prop.title);
598 ee->prop.title = NULL;
599 if (title) ee->prop.title = strdup(title);
600 if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
601 {
602 EE_Wl_Smart_Data *sd;
603
604 if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
605 evas_object_text_text_set(sd->text, ee->prop.title);
606 }
607}
608
609static void
610_ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
611{
612 LOGFN(__FILE__, __LINE__, __FUNCTION__);
613
614 if (!ee) return;
615 if (ee->prop.name) free(ee->prop.name);
616 if (ee->prop.clas) free(ee->prop.clas);
617 ee->prop.name = NULL;
618 ee->prop.clas = NULL;
619 if (n) ee->prop.name = strdup(n);
620 if (c) ee->prop.clas = strdup(c);
621 /* FIXME: Forward these changes to Wayland somehow */
622}
623
624static void
625_ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h)
626{
627 LOGFN(__FILE__, __LINE__, __FUNCTION__);
628
629 if (!ee) return;
630 if (w < 0) w = 0;
631 if (h < 0) h = 0;
632 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
633 ee->prop.min.w = w;
634 ee->prop.min.h = h;
635}
636
637static void
638_ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h)
639{
640 LOGFN(__FILE__, __LINE__, __FUNCTION__);
641
642 if (!ee) return;
643 if (w < 0) w = 0;
644 if (h < 0) h = 0;
645 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
646 ee->prop.max.w = w;
647 ee->prop.max.h = h;
648}
649
650static void
651_ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h)
652{
653 LOGFN(__FILE__, __LINE__, __FUNCTION__);
654
655 if (!ee) return;
656 if (w < 0) w = 0;
657 if (h < 0) h = 0;
658 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
659 ee->prop.base.w = w;
660 ee->prop.base.h = h;
661}
662
663static void
664_ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
665{
666 LOGFN(__FILE__, __LINE__, __FUNCTION__);
667
668 if (!ee) return;
669 if (w < 0) w = 0;
670 if (h < 0) h = 0;
671 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
672 ee->prop.step.w = w;
673 ee->prop.step.h = h;
674}
675
676static void
677_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
678{
679 LOGFN(__FILE__, __LINE__, __FUNCTION__);
680
681 if (!ee) return;
682 if (ee->prop.layer == layer) return;
683 if (layer < 1) layer = 1;
684 else if (layer > 255) layer = 255;
685 ee->prop.layer = layer;
686}
687
688static void
689_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
690{
691 LOGFN(__FILE__, __LINE__, __FUNCTION__);
692
693 if (!ee) return;
694 if (ee->prop.iconified == iconify) return;
695 ee->prop.iconified = iconify;
696 /* FIXME: Implement this in Wayland someshow */
697}
698
699static void
700_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
701{
702 LOGFN(__FILE__, __LINE__, __FUNCTION__);
703
704 if (!ee) return;
705 if (ee->prop.maximized == max) return;
706 ee->prop.maximized = max;
707 ecore_wl_window_maximized_set(ee->engine.wl.win, max);
708}
709
710static void
711_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
712{
713 LOGFN(__FILE__, __LINE__, __FUNCTION__);
714
715 if ((!ee) || (!ee->visible)) return;
716 if (ee->prop.fullscreen == full) return;
717 ee->prop.fullscreen = full;
718 ecore_wl_window_fullscreen_set(ee->engine.wl.win, full);
719}
720
721static void
722_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
723{
724 LOGFN(__FILE__, __LINE__, __FUNCTION__);
725
726 if (!ee) return;
727 ee->ignore_events = ignore;
728 /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */
729}
730
731static void
732_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
733{
734 Evas_Engine_Info_Wayland_Shm *einfo;
735
736 LOGFN(__FILE__, __LINE__, __FUNCTION__);
737
738 if (!ee) return;
739 if ((ee->alpha == alpha)) return;
740 ee->alpha = alpha;
741 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
742 {
743 einfo->info.destination_alpha = alpha;
744 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
745 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
746 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
747 }
748}
749
750static void
751_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
752{
753 Evas_Engine_Info_Wayland_Shm *einfo;
754
755 LOGFN(__FILE__, __LINE__, __FUNCTION__);
756
757 if (!ee) return;
758 if ((ee->transparent == transparent)) return;
759 ee->transparent = transparent;
760 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
761 {
762 einfo->info.destination_alpha = transparent;
763 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
764 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
765 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
766 }
767}
768
769static int
770_ecore_evas_wl_render(Ecore_Evas *ee)
771{
772 int rend = 0;
773
774 if (!ee) return 0;
775 if (!ee->visible)
776 evas_norender(ee->evas);
777 else
778 {
779 Eina_List *ll = NULL, *updates = NULL;
780 Ecore_Evas *ee2 = NULL;
781
782 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
783
784 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
785 {
786 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
787 if (ee2->engine.func->fn_render)
788 rend |= ee2->engine.func->fn_render(ee2);
789 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
790 }
791
792 if ((updates = evas_render_updates(ee->evas)))
793 {
794 Eina_List *l = NULL;
795 Eina_Rectangle *r;
796
797 LOGFN(__FILE__, __LINE__, __FUNCTION__);
798
799 EINA_LIST_FOREACH(updates, l, r)
800 {
801 if (ee->engine.wl.buffer)
802 wl_buffer_damage(ee->engine.wl.buffer,
803 r->x, r->y, r->w, r->h);
804
805 ecore_wl_window_damage(ee->engine.wl.win,
806 r->x, r->y, r->w, r->h);
807 }
808
809 ecore_wl_flush();
810
811 evas_render_updates_free(updates);
812 _ecore_evas_idle_timeout_update(ee);
813 rend = 1;
814 }
815
816 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
817 }
818 return rend;
819}
820
821static void
822_ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
823{
824 LOGFN(__FILE__, __LINE__, __FUNCTION__);
825
826 if (x) *x = 0;
827 if (y) *y = 0;
828 ecore_wl_screen_size_get(w, h);
829}
830
831static void
832_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest)
833{
834 struct wl_shm *shm;
835 static unsigned int format;
836 char tmp[PATH_MAX];
837 int fd = -1, stride = 0, size = 0;
838 void *ret;
839
840 LOGFN(__FILE__, __LINE__, __FUNCTION__);
841
842 if (dest) *dest = NULL;
843 if (!(shm = ecore_wl_shm_get())) return;
844 if (!format) format = WL_SHM_FORMAT_ARGB8888; //ecore_wl_format_get();
845
846 strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX");
847 if ((fd = mkstemp(tmp)) < 0)
848 {
849 ERR("Could not create temporary file.");
850 return;
851 }
852
853 stride = (ee->w * sizeof(int));
854 size = (stride * ee->h);
855 if (ftruncate(fd, size) < 0)
856 {
857 ERR("Could not truncate temporary file.");
858 close(fd);
859 return;
860 }
861
862 ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
863 unlink(tmp);
864
865 if (ret == MAP_FAILED)
866 {
867 ERR("mmap of temporary file failed.");
868 close(fd);
869 return;
870 }
871
872 if (dest) *dest = ret;
873
874 ee->engine.wl.buffer =
875 wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format);
876
877 close(fd);
878}
879
880void
881_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
882{
883 LOGFN(__FILE__, __LINE__, __FUNCTION__);
884
885 if (!ee) return;
886 if (ee->engine.wl.win)
887 ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location);
888}
889
890static Eina_Bool
891_ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
892{
893 Ecore_Evas *ee;
894 Ecore_Wl_Event_Mouse_In *ev;
895
896 LOGFN(__FILE__, __LINE__, __FUNCTION__);
897
898 ev = event;
899 ee = ecore_event_window_match(ev->win);
900 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
901 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
902 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
903 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
904 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
905 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
906 return ECORE_CALLBACK_PASS_ON;
907}
908
909static Eina_Bool
910_ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
911{
912 Ecore_Evas *ee;
913 Ecore_Wl_Event_Mouse_Out *ev;
914
915 LOGFN(__FILE__, __LINE__, __FUNCTION__);
916
917 ev = event;
918 ee = ecore_event_window_match(ev->win);
919 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
920 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
921 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
922 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
923 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
924 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
925 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
926 return ECORE_CALLBACK_PASS_ON;
927}
928
929static Eina_Bool
930_ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
931{
932 Ecore_Evas *ee;
933 Ecore_Wl_Event_Focus_In *ev;
934
935 LOGFN(__FILE__, __LINE__, __FUNCTION__);
936
937 ev = event;
938 ee = ecore_event_window_match(ev->win);
939 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
940 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
941 ee->prop.focused = 1;
942 evas_focus_in(ee->evas);
943 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
944 return ECORE_CALLBACK_PASS_ON;
945}
946
947static Eina_Bool
948_ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
949{
950 Ecore_Evas *ee;
951 Ecore_Wl_Event_Focus_In *ev;
952
953 LOGFN(__FILE__, __LINE__, __FUNCTION__);
954
955 ev = event;
956 ee = ecore_event_window_match(ev->win);
957 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
958 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
959 evas_focus_out(ee->evas);
960 ee->prop.focused = 0;
961 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
962 return ECORE_CALLBACK_PASS_ON;
963}
964
965static Eina_Bool
966_ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
967{
968 Ecore_Evas *ee;
969 Ecore_Wl_Event_Window_Configure *ev;
970
971 LOGFN(__FILE__, __LINE__, __FUNCTION__);
972
973 ev = event;
974 ee = ecore_event_window_match(ev->win);
975 if (!ee) return ECORE_CALLBACK_PASS_ON;
976 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
977 if ((ee->x != ev->x) || (ee->y != ev->y))
978 {
979 ee->x = ev->x;
980 ee->y = ev->y;
981 ee->req.x = ee->x;
982 ee->req.y = ee->y;
983 if (ee->func.fn_move) ee->func.fn_move(ee);
984 }
985 if ((ee->req.w != ev->w) || (ee->req.h != ev->h))
986 {
987 /* ee->w = ev->w; */
988 /* ee->h = ev->h; */
989 ee->req.w = ev->w;
990 ee->req.h = ev->h;
991 if (ee->func.fn_resize) ee->func.fn_resize(ee);
992 }
993
994 return ECORE_CALLBACK_PASS_ON;
995}
996
997static void
998_ecore_evas_wl_smart_init(void)
999{
1000 if (_ecore_evas_wl_smart) return;
1001 {
1002 static const Evas_Smart_Class sc =
1003 {
1004 "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION,
1005 _ecore_evas_wl_smart_add,
1006 _ecore_evas_wl_smart_del,
1007 NULL,
1008 _ecore_evas_wl_smart_resize,
1009 _ecore_evas_wl_smart_show,
1010 _ecore_evas_wl_smart_hide,
1011 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
1012 };
1013 _ecore_evas_wl_smart = evas_smart_class_new(&sc);
1014 }
1015}
1016
1017static void
1018_ecore_evas_wl_smart_add(Evas_Object *obj)
1019{
1020 EE_Wl_Smart_Data *sd;
1021 Evas *evas;
1022
1023 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1024
1025 if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
1026
1027 evas = evas_object_evas_get(obj);
1028
1029 sd->x = 0;
1030 sd->y = 0;
1031 sd->w = 1;
1032 sd->h = 1;
1033
1034 sd->frame = evas_object_rectangle_add(evas);
1035 evas_object_is_frame_object_set(sd->frame, EINA_TRUE);
1036 evas_object_color_set(sd->frame, 249, 249, 249, 255);
1037 evas_object_smart_member_add(sd->frame, obj);
1038
1039 sd->text = evas_object_text_add(evas);
1040 evas_object_color_set(sd->text, 0, 0, 0, 255);
1041 evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
1042 evas_object_text_font_set(sd->text, "Sans", 10);
1043 evas_object_text_text_set(sd->text, "Smart Test");
1044
1045 evas_object_smart_data_set(obj, sd);
1046}
1047
1048static void
1049_ecore_evas_wl_smart_del(Evas_Object *obj)
1050{
1051 EE_Wl_Smart_Data *sd;
1052
1053 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1054
1055 if (!(sd = evas_object_smart_data_get(obj))) return;
1056 evas_object_del(sd->text);
1057 evas_object_del(sd->frame);
1058 free(sd);
1059}
1060
1061static void
1062_ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
1063{
1064 EE_Wl_Smart_Data *sd;
1065
1066 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1067
1068 if (!(sd = evas_object_smart_data_get(obj))) return;
1069 if ((sd->w == w) && (sd->h == h)) return;
1070 sd->w = w;
1071 sd->h = h;
1072 evas_object_resize(sd->frame, w, h);
1073}
1074
1075static void
1076_ecore_evas_wl_smart_show(Evas_Object *obj)
1077{
1078 EE_Wl_Smart_Data *sd;
1079
1080 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1081
1082 if (!(sd = evas_object_smart_data_get(obj))) return;
1083 evas_object_show(sd->frame);
1084 evas_object_show(sd->text);
1085}
1086
1087static void
1088_ecore_evas_wl_smart_hide(Evas_Object *obj)
1089{
1090 EE_Wl_Smart_Data *sd;
1091
1092 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1093
1094 if (!(sd = evas_object_smart_data_get(obj))) return;
1095 evas_object_hide(sd->text);
1096 evas_object_hide(sd->frame);
1097}
1098
1099static Evas_Object *
1100_ecore_evas_wl_frame_add(Evas *evas)
1101{
1102 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1103
1104 _ecore_evas_wl_smart_init();
1105 return evas_object_smart_add(evas, _ecore_evas_wl_smart);
1106}
1107
1108#else
1109EAPI Ecore_Evas *
1110ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__)
1111{
1112 return NULL;
1113}
1114#endif
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c
deleted file mode 100644
index 32132b3..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c
+++ /dev/null
@@ -1,1452 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdlib.h> /* for NULL */
6
7#include <Ecore.h>
8#include "ecore_private.h"
9#ifdef BUILD_ECORE_EVAS_WIN32
10# define WIN32_LEAN_AND_MEAN
11# include <windows.h>
12# undef WIN32_LEAN_AND_MEAN
13# include <Ecore_Win32.h>
14# include <ecore_win32_private.h>
15#endif /* BUILD_ECORE_EVAS_WIN32 */
16
17#include "ecore_evas_private.h"
18#include "Ecore_Evas.h"
19
20#ifdef BUILD_ECORE_EVAS_WIN32
21
22#define ECORE_EVAS_EVENT_COUNT 10
23
24static int _ecore_evas_init_count = 0;
25
26static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT];
27
28static Eina_Bool _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
29
30static Eina_Bool _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
31
32static Eina_Bool _ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
33
34static Eina_Bool _ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
35
36static Eina_Bool _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
37
38static Eina_Bool _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
39
40static Eina_Bool _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
41
42static Eina_Bool _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
43
44static Eina_Bool _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
45
46static Eina_Bool _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
47
48/* Private functions */
49
50static int
51_ecore_evas_win32_render(Ecore_Evas *ee)
52{
53 int rend = 0;
54 Eina_List *updates = NULL;
55 Eina_List *ll;
56 Ecore_Evas *ee2;
57
58 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
59 {
60 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
61 if (ee2->engine.func->fn_render)
62 rend |= ee2->engine.func->fn_render(ee2);
63 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
64 }
65
66 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
67 if (ee->prop.avoid_damage)
68 {
69 updates = evas_render_updates(ee->evas);
70 if (updates) evas_render_updates_free(updates);
71 }
72 else if ((ee->visible) ||
73 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
74 ((ee->should_be_visible) && (ee->prop.override)))
75 {
76 if (ee->shaped)
77 {
78 updates = evas_render_updates(ee->evas);
79 if (updates) evas_render_updates_free(updates);
80 }
81 else
82 {
83 updates = evas_render_updates(ee->evas);
84 if (updates) evas_render_updates_free(updates);
85 }
86 }
87 else
88 evas_norender(ee->evas);
89 if (updates) rend = 1;
90 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
91 return rend;
92}
93
94static int
95_ecore_evas_win32_init(void)
96{
97 _ecore_evas_init_count++;
98 if (_ecore_evas_init_count > 1)
99 return _ecore_evas_init_count;
100
101 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL);
102 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL);
103 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, _ecore_evas_win32_event_window_focus_in, NULL);
104 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_win32_event_window_focus_out, NULL);
105 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL);
106 ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, _ecore_evas_win32_event_window_destroy, NULL);
107 ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_SHOW, _ecore_evas_win32_event_window_show, NULL);
108 ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_HIDE, _ecore_evas_win32_event_window_hide, NULL);
109 ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, _ecore_evas_win32_event_window_configure, NULL);
110 ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_win32_event_window_delete_request, NULL);
111
112 ecore_event_evas_init();
113 return _ecore_evas_init_count;
114}
115
116int
117_ecore_evas_win32_shutdown(void)
118{
119 _ecore_evas_init_count--;
120 if (_ecore_evas_init_count == 0)
121 {
122 int i;
123
124 for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++)
125 ecore_event_handler_del(ecore_evas_event_handlers[i]);
126 ecore_event_evas_shutdown();
127 }
128
129 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
130
131 return _ecore_evas_init_count;
132}
133
134static Eina_Bool
135_ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
136{
137 Ecore_Evas *ee;
138 Ecore_Win32_Event_Mouse_In *e;
139
140 INF("mouse in");
141
142 e = event;
143 ee = ecore_event_window_match((Ecore_Window)e->window);
144 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
145 if ((Ecore_Window)e->window != ee->prop.window) return 1;
146
147 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
148 /* FIXME to do */
149/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
150 evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL);
151 evas_focus_in(ee->evas);
152 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
153
154 return 1;
155}
156
157static Eina_Bool
158_ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
159{
160 Ecore_Evas *ee;
161 Ecore_Win32_Event_Mouse_Out *e;
162
163 INF("mouse out");
164
165 e = event;
166 ee = ecore_event_window_match((Ecore_Window)e->window);
167 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
168 if ((Ecore_Window)e->window != ee->prop.window) return 1;
169
170 /* FIXME to do */
171/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
172 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
173
174 evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL);
175 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
176 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
177
178 return 1;
179}
180
181static Eina_Bool
182_ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
183{
184 Ecore_Evas *ee;
185 Ecore_Win32_Event_Window_Focus_In *e;
186
187 e = event;
188 ee = ecore_event_window_match((Ecore_Window)e->window);
189 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
190 if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
191
192 ee->prop.focused = 1;
193 evas_focus_in(ee->evas);
194 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
195 return ECORE_CALLBACK_PASS_ON;
196}
197
198static Eina_Bool
199_ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
200{
201 Ecore_Evas *ee;
202 Ecore_Win32_Event_Window_Focus_Out *e;
203
204 e = event;
205 ee = ecore_event_window_match((Ecore_Window)e->window);
206 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
207 if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
208
209 evas_focus_out(ee->evas);
210 ee->prop.focused = 0;
211 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
212 return ECORE_CALLBACK_PASS_ON;
213}
214
215static Eina_Bool
216_ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
217{
218 Ecore_Evas *ee;
219 Ecore_Win32_Event_Window_Damage *e;
220
221 INF("window damage");
222
223 e = event;
224 ee = ecore_event_window_match((Ecore_Window)e->window);
225 if (!ee) return 1; /* pass on event */
226 if ((Ecore_Window)e->window != ee->prop.window) return 1;
227
228 if (ee->prop.avoid_damage)
229 {
230#ifdef _MSC_VER
231# pragma message ("[ECORE] [WIN32] No Region code")
232#else
233# warning [ECORE] [WIN32] No Region code
234#endif /* ! _MSC_VER */
235 }
236 else
237 {
238 if (ee->rotation == 0)
239 evas_damage_rectangle_add(ee->evas,
240 e->x,
241 e->y,
242 e->width,
243 e->height);
244 else if (ee->rotation == 90)
245 evas_damage_rectangle_add(ee->evas,
246 ee->h - e->y - e->height,
247 e->x,
248 e->height,
249 e->width);
250 else if (ee->rotation == 180)
251 evas_damage_rectangle_add(ee->evas,
252 ee->w - e->x - e->width,
253 ee->h - e->y - e->height,
254 e->width,
255 e->height);
256 else if (ee->rotation == 270)
257 evas_damage_rectangle_add(ee->evas,
258 e->y,
259 ee->w - e->x - e->width,
260 e->height,
261 e->width);
262 }
263
264 return 1;
265}
266
267static Eina_Bool
268_ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
269{
270 Ecore_Evas *ee;
271 Ecore_Win32_Event_Window_Destroy *e;
272
273 INF("window destroy");
274
275 e = event;
276 ee = ecore_event_window_match((Ecore_Window)e->window);
277 if (!ee) return 1; /* pass on event */
278 if ((Ecore_Window)e->window != ee->prop.window) return 1;
279 if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
280 ecore_evas_free(ee);
281
282 return 1;
283}
284
285static Eina_Bool
286_ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
287{
288 Ecore_Evas *ee;
289 Ecore_Win32_Event_Window_Show *e;
290
291 INF("window show");
292
293 e = event;
294 ee = ecore_event_window_match((Ecore_Window)e->window);
295 if (!ee) return 1; /* pass on event */
296 if ((Ecore_Window)e->window != ee->prop.window) return 1;
297 if (ee->visible) return 0; /* dont pass it on */
298 ee->visible = 1;
299 if (ee->func.fn_show) ee->func.fn_show(ee);
300
301 return 1;
302}
303
304static Eina_Bool
305_ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
306{
307 Ecore_Evas *ee;
308 Ecore_Win32_Event_Window_Hide *e;
309
310 INF("window hide");
311
312 e = event;
313 ee = ecore_event_window_match((Ecore_Window)e->window);
314 if (!ee) return 1; /* pass on event */
315 if ((Ecore_Window)e->window != ee->prop.window) return 1;
316 if (!ee->visible) return 0; /* dont pass it on */
317 ee->visible = 0;
318 if (ee->func.fn_hide) ee->func.fn_hide(ee);
319
320 return 1;
321}
322
323static Eina_Bool
324_ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
325{
326 Ecore_Evas *ee;
327 Ecore_Win32_Event_Window_Configure *e;
328
329 INF("window configure");
330
331 e = event;
332 ee = ecore_event_window_match((Ecore_Window)e->window);
333 if (!ee) return 1; /* pass on event */
334 if ((Ecore_Window)e->window != ee->prop.window) return 1;
335
336 if ((ee->x != e->x) || (ee->y != e->y))
337 {
338 ee->x = e->x;
339 ee->y = e->y;
340 ee->req.x = ee->x;
341 ee->req.y = ee->y;
342
343 if (ee->func.fn_move) ee->func.fn_move(ee);
344 }
345
346 if ((ee->w != e->width) || (ee->h != e->height))
347 {
348 ee->w = e->width;
349 ee->h = e->height;
350 ee->req.w = ee->w;
351 ee->req.h = ee->h;
352
353 if ((ee->rotation == 90) || (ee->rotation == 270))
354 {
355 evas_output_size_set(ee->evas, ee->h, ee->w);
356 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
357 }
358 else
359 {
360 evas_output_size_set(ee->evas, ee->w, ee->h);
361 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
362 }
363 if (ee->prop.avoid_damage)
364 {
365 int pdam;
366
367 pdam = ecore_evas_avoid_damage_get(ee);
368 ecore_evas_avoid_damage_set(ee, 0);
369 ecore_evas_avoid_damage_set(ee, pdam);
370 }
371/* if (ee->shaped) */
372/* _ecore_evas_win32_region_border_resize(ee); */
373 if ((ee->expecting_resize.w > 0) &&
374 (ee->expecting_resize.h > 0))
375 {
376 if ((ee->expecting_resize.w == ee->w) &&
377 (ee->expecting_resize.h == ee->h))
378 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
379 ecore_win32_current_time_get());
380 ee->expecting_resize.w = 0;
381 ee->expecting_resize.h = 0;
382 }
383 if (ee->func.fn_resize) ee->func.fn_resize(ee);
384 }
385
386 return 1;
387}
388
389static Eina_Bool
390_ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
391{
392 Ecore_Evas *ee;
393 Ecore_Win32_Event_Window_Delete_Request *e;
394
395 INF("window delete request");
396
397 e = event;
398 ee = ecore_event_window_match((Ecore_Window)e->window);
399 if (!ee) return 1; /* pass on event */
400 if ((Ecore_Window)e->window != ee->prop.window) return 1;
401 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
402
403 INF(" * ee event delete\n");
404 return 1;
405}
406
407
408/* Ecore_Evas interface */
409
410static void
411_ecore_evas_win32_free(Ecore_Evas *ee)
412{
413 INF("ecore evas free");
414
415 ecore_win32_window_free((struct _Ecore_Win32_Window *)ee->prop.window);
416 ecore_event_window_unregister(ee->prop.window);
417 _ecore_evas_win32_shutdown();
418 ecore_win32_shutdown();
419}
420
421static void
422_ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee,
423 Ecore_Evas_Event_Cb func)
424{
425 ee->func.fn_delete_request = func;
426}
427
428static void
429_ecore_evas_win32_move(Ecore_Evas *ee, int x, int y)
430{
431 INF("ecore evas move (%dx%d)", x, y);
432 ee->req.x = x;
433 ee->req.y = y;
434
435 if ((x != ee->x) || (y != ee->y))
436 {
437 ee->x = x;
438 ee->y = y;
439 ecore_win32_window_move((struct _Ecore_Win32_Window *)ee->prop.window,
440 x, y);
441 if (ee->func.fn_move) ee->func.fn_move(ee);
442 }
443}
444
445static void
446_ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height)
447{
448 INF("ecore evas resize (%dx%d)", width, height);
449 ee->req.w = width;
450 ee->req.h = height;
451
452 if ((ee->w != width) || (ee->h != height))
453 {
454 ee->w = width;
455 ee->h = height;
456 ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window,
457 width, height);
458 if ((ee->rotation == 90) || (ee->rotation == 270))
459 {
460 evas_output_size_set(ee->evas, ee->h, ee->w);
461 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
462 }
463 else
464 {
465 evas_output_size_set(ee->evas, ee->w, ee->h);
466 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
467 }
468 if (ee->prop.avoid_damage)
469 {
470 int pdam;
471
472 pdam = ecore_evas_avoid_damage_get(ee);
473 ecore_evas_avoid_damage_set(ee, 0);
474 ecore_evas_avoid_damage_set(ee, pdam);
475 }
476/* if ((ee->shaped) || (ee->alpha)) */
477/* _ecore_evas_win32_region_border_resize(ee); */
478 if (ee->func.fn_resize) ee->func.fn_resize(ee);
479 }
480}
481
482static void
483_ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int height)
484{
485 INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height);
486 ee->req.x = x;
487 ee->req.y = y;
488 ee->req.w = width;
489 ee->req.h = height;
490
491 if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y))
492 {
493 int change_size = 0;
494 int change_pos = 0;
495
496 if ((ee->w != width) || (ee->h != height)) change_size = 1;
497 if ((x != ee->x) || (y != ee->y)) change_pos = 1;
498
499 ee->x = x;
500 ee->y = y;
501 ee->w = width;
502 ee->h = height;
503 ecore_win32_window_move_resize((struct _Ecore_Win32_Window *)ee->prop.window,
504 x, y, width, height);
505 if ((ee->rotation == 90) || (ee->rotation == 270))
506 {
507 evas_output_size_set(ee->evas, ee->h, ee->w);
508 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
509 }
510 else
511 {
512 evas_output_size_set(ee->evas, ee->w, ee->h);
513 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
514 }
515 if (ee->prop.avoid_damage)
516 {
517 int pdam;
518
519 pdam = ecore_evas_avoid_damage_get(ee);
520 ecore_evas_avoid_damage_set(ee, 0);
521 ecore_evas_avoid_damage_set(ee, pdam);
522 }
523/* if ((ee->shaped) || (ee->alpha)) */
524/* _ecore_evas_win32_region_border_resize(ee); */
525 if (change_pos)
526 {
527 if (ee->func.fn_move) ee->func.fn_move(ee);
528 }
529 if (change_size)
530 {
531 if (ee->func.fn_resize) ee->func.fn_resize(ee);
532 }
533 }
534}
535
536static void
537_ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation)
538{
539 int rot_dif;
540
541 rot_dif = ee->rotation - rotation;
542 if (rot_dif < 0) rot_dif = -rot_dif;
543
544 if (rot_dif != 180)
545 {
546 int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
547
548 if (!ee->prop.fullscreen)
549 {
550 ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window,
551 ee->h, ee->w);
552 ee->expecting_resize.w = ee->h;
553 ee->expecting_resize.h = ee->w;
554 }
555 else
556 {
557 int w, h;
558
559 ecore_win32_window_size_get((struct _Ecore_Win32_Window *)ee->prop.window,
560 &w, &h);
561 ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window,
562 h, w);
563 if ((rotation == 0) || (rotation == 180))
564 {
565 evas_output_size_set(ee->evas, ee->w, ee->h);
566 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
567 }
568 else
569 {
570 evas_output_size_set(ee->evas, ee->h, ee->w);
571 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
572 }
573 if (ee->func.fn_resize) ee->func.fn_resize(ee);
574 }
575 ecore_evas_size_min_get(ee, &minw, &minh);
576 ecore_evas_size_max_get(ee, &maxw, &maxh);
577 ecore_evas_size_base_get(ee, &basew, &baseh);
578 ecore_evas_size_step_get(ee, &stepw, &steph);
579 ee->rotation = rotation;
580 ecore_evas_size_min_set(ee, minh, minw);
581 ecore_evas_size_max_set(ee, maxh, maxw);
582 ecore_evas_size_base_set(ee, baseh, basew);
583 ecore_evas_size_step_set(ee, steph, stepw);
584 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
585 ecore_win32_current_time_get());
586 }
587 else
588 {
589 ee->rotation = rotation;
590 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
591 ecore_win32_current_time_get());
592 if (ee->func.fn_resize) ee->func.fn_resize(ee);
593 }
594
595 if ((ee->rotation == 90) || (ee->rotation == 270))
596 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
597 else
598 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
599}
600
601static void
602_ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation, int resize)
603{
604 INF("ecore evas rotation: %s", rotation ? "yes" : "no");
605
606 if (ee->rotation == rotation) return;
607
608#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
609 if (!strcmp(ee->driver, "software_gdi"))
610 {
611 Evas_Engine_Info_Software_Gdi *einfo;
612
613 einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas);
614 if (!einfo) return;
615 einfo->info.rotation = rotation;
616 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
617 {
618 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
619 }
620 _ecore_evas_win32_rotation_set_internal(ee, rotation);
621 }
622#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */
623
624#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
625 if (!strcmp(ee->driver, "software_ddraw"))
626 {
627 Evas_Engine_Info_Software_DDraw *einfo;
628
629 einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas);
630 if (!einfo) return;
631 einfo->info.rotation = rotation;
632 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
633 {
634 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
635 }
636 _ecore_evas_win32_rotation_set_internal(ee, rotation);
637 }
638#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */
639}
640
641static void
642_ecore_evas_win32_shaped_set(Ecore_Evas *ee, int shaped)
643{
644 if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped)))
645 return;
646
647 if (!strcmp(ee->driver, "software_ddraw")) return;
648
649#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
650 if (!strcmp(ee->driver, "software_gdi"))
651 {
652 Evas_Engine_Info_Software_Gdi *einfo;
653
654 einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas);
655 ee->shaped = shaped;
656 if (einfo)
657 {
658 ee->engine.win32.state.region = ee->shaped;
659 einfo->info.region = ee->engine.win32.state.region;
660 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
661 {
662 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
663 }
664 if (ee->shaped)
665 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
666 }
667#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */
668 }
669}
670
671static void
672_ecore_evas_win32_show(Ecore_Evas *ee)
673{
674 INF("ecore evas show");
675
676 ee->should_be_visible = 1;
677 if (ee->prop.avoid_damage)
678 _ecore_evas_win32_render(ee);
679 ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window);
680/* if (ee->prop.fullscreen) */
681/* ecore_win32_window_focus(ee->prop.window); */
682}
683
684static void
685_ecore_evas_win32_hide(Ecore_Evas *ee)
686{
687 INF("ecore evas hide");
688
689 ecore_win32_window_hide((struct _Ecore_Win32_Window *)ee->prop.window);
690 ee->should_be_visible = 0;
691}
692
693static void
694_ecore_evas_win32_raise(Ecore_Evas *ee)
695{
696 INF("ecore evas raise");
697
698 if (!ee->prop.fullscreen)
699 ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window);
700 else
701 ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window);
702}
703
704static void
705_ecore_evas_win32_lower(Ecore_Evas *ee)
706{
707 INF("ecore evas lower");
708
709 if (!ee->prop.fullscreen)
710 ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window);
711 else
712 ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window);
713}
714
715static void
716_ecore_evas_win32_activate(Ecore_Evas *ee)
717{
718 INF("ecore evas activate");
719
720 ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window);
721}
722
723static void
724_ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title)
725{
726 INF("ecore evas title set");
727
728 if (ee->prop.title) free(ee->prop.title);
729 ee->prop.title = NULL;
730 if (title) ee->prop.title = strdup(title);
731 ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window,
732 ee->prop.title);
733}
734
735static void
736_ecore_evas_win32_size_min_set(Ecore_Evas *ee, int width, int height)
737{
738 if (width < 0) width = 0;
739 if (height < 0) height = 0;
740 if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return;
741 ee->prop.min.w = width;
742 ee->prop.min.h = height;
743 ecore_win32_window_size_min_set((struct _Ecore_Win32_Window *)ee->prop.window,
744 width, height);
745}
746
747static void
748_ecore_evas_win32_size_max_set(Ecore_Evas *ee, int width, int height)
749{
750 if (width < 0) width = 0;
751 if (height < 0) height = 0;
752 if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return;
753 ee->prop.max.w = width;
754 ee->prop.max.h = height;
755 ecore_win32_window_size_max_set((struct _Ecore_Win32_Window *)ee->prop.window,
756 width, height);
757}
758
759static void
760_ecore_evas_win32_size_base_set(Ecore_Evas *ee, int width, int height)
761{
762 if (width < 0) width = 0;
763 if (height < 0) height = 0;
764 if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return;
765 ee->prop.base.w = width;
766 ee->prop.base.h = height;
767 ecore_win32_window_size_base_set((struct _Ecore_Win32_Window *)ee->prop.window,
768 width, height);
769}
770
771static void
772_ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height)
773{
774 if (width < 1) width = 1;
775 if (height < 1) height = 1;
776 if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return;
777 ee->prop.step.w = width;
778 ee->prop.step.h = height;
779 ecore_win32_window_size_step_set((struct _Ecore_Win32_Window *)ee->prop.window,
780 width, height);
781}
782
783static void
784_ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
785{
786#if 0
787 int x, y;
788
789 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
790
791 if (obj == NULL)
792 {
793 ee->prop.cursor.object = NULL;
794 ee->prop.cursor.layer = 0;
795 ee->prop.cursor.hot.x = 0;
796 ee->prop.cursor.hot.y = 0;
797 ecore_win32_window_cursor_show(ee->prop.window, 1);
798 return;
799 }
800
801 ee->prop.cursor.object = obj;
802 ee->prop.cursor.layer = layer;
803 ee->prop.cursor.hot.x = hot_x;
804 ee->prop.cursor.hot.y = hot_y;
805
806 ecore_win32_window_cursor_show(ee->prop.window, 0);
807
808 evas_pointer_output_xy_get(ee->evas, &x, &y);
809 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
810 evas_object_move(ee->prop.cursor.object,
811 x - ee->prop.cursor.hot.x,
812 y - ee->prop.cursor.hot.y);
813 evas_object_pass_events_set(ee->prop.cursor.object, 1);
814 if (evas_pointer_inside_get(ee->evas))
815 evas_object_show(ee->prop.cursor.object);
816#endif
817}
818
819static void
820_ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__)
821{
822 ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window);
823}
824
825static void
826_ecore_evas_win32_iconified_set(Ecore_Evas *ee, int on)
827{
828/* if (((ee->prop.borderless) && (on)) || */
829/* ((!ee->prop.borderless) && (!on))) return; */
830 ee->prop.iconified = on;
831 ecore_win32_window_iconified_set((struct _Ecore_Win32_Window *)ee->prop.window,
832 ee->prop.iconified);
833}
834
835static void
836_ecore_evas_win32_borderless_set(Ecore_Evas *ee, int on)
837{
838 if (((ee->prop.borderless) && (on)) ||
839 ((!ee->prop.borderless) && (!on))) return;
840 ee->prop.borderless = on;
841 ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window,
842 ee->prop.borderless);
843
844#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
845 if (!strcmp(ee->driver, "software_gdi"))
846 {
847 Evas_Engine_Info_Software_Gdi *einfo;
848
849 einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas);
850 if (einfo)
851 {
852 einfo->info.borderless = ee->prop.borderless;
853 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
854 {
855 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
856 }
857 if (ee->prop.borderless)
858 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
859 }
860 }
861#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */
862}
863
864static void
865_ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on)
866{
867 struct _Ecore_Win32_Window *window;
868
869 INF("ecore evas fullscreen set");
870
871 if ((ee->engine.win32.state.fullscreen && on) ||
872 (!ee->engine.win32.state.fullscreen && !on))
873 return;
874
875 ee->engine.win32.state.fullscreen = on;
876 ee->prop.fullscreen = on;
877
878 window = (struct _Ecore_Win32_Window *)ee->prop.window;
879
880 if (on != 0)
881 {
882 ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window,
883 on);
884 }
885 else
886 {
887 ecore_win32_window_fullscreen_set(window, on);
888 }
889
890 /* Nothing to be done for the GDI backend at the evas level */
891
892#ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW
893 if (strcmp(ee->driver, "software_ddraw") == 0)
894 {
895 Evas_Engine_Info_Software_DDraw *einfo;
896
897 einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee));
898 if (einfo)
899 {
900 einfo->info.fullscreen = !!on;
901/* einfo->info.layered = window->shape.layered; */
902 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
903 {
904 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
905 }
906 }
907 }
908#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */
909
910#ifdef BUILD_ECORE_EVAS_DIRECT3D
911 if (strcmp(ee->driver, "direct3d") == 0)
912 {
913 Evas_Engine_Info_Direct3D *einfo;
914
915 einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee));
916 if (einfo)
917 {
918 einfo->info.fullscreen = !!on;
919 einfo->info.layered = window->shape.layered;
920 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
921 {
922 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
923 }
924 }
925 }
926#endif /* BUILD_ECORE_EVAS_DIRECT3D */
927}
928
929
930static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
931{
932 _ecore_evas_win32_free,
933 NULL,
934 NULL,
935 NULL,
936 NULL,
937 _ecore_evas_win32_callback_delete_request_set,
938 NULL,
939 NULL,
940 NULL,
941 NULL,
942 NULL,
943 NULL,
944 NULL,
945 NULL,
946 NULL,
947 _ecore_evas_win32_move,
948 NULL,
949 _ecore_evas_win32_resize,
950 _ecore_evas_win32_move_resize,
951 _ecore_evas_win32_rotation_set,
952 _ecore_evas_win32_shaped_set,
953 _ecore_evas_win32_show,
954 _ecore_evas_win32_hide,
955 _ecore_evas_win32_raise,
956 _ecore_evas_win32_lower,
957 _ecore_evas_win32_activate,
958 _ecore_evas_win32_title_set,
959 NULL, /* _ecore_evas_x_name_class_set */
960 _ecore_evas_win32_size_min_set,
961 _ecore_evas_win32_size_max_set,
962 _ecore_evas_win32_size_base_set,
963 _ecore_evas_win32_size_step_set,
964 _ecore_evas_win32_cursor_set,
965 NULL, /* _ecore_evas_x_layer_set */
966 _ecore_evas_win32_focus_set,
967 _ecore_evas_win32_iconified_set,
968 _ecore_evas_win32_borderless_set,
969 NULL, /* _ecore_evas_x_override_set */
970 NULL,
971 _ecore_evas_win32_fullscreen_set,
972 NULL, /* _ecore_evas_x_avoid_damage_set */
973 NULL, /* _ecore_evas_x_withdrawn_set */
974 NULL, /* _ecore_evas_x_sticky_set */
975 NULL, /* _ecore_evas_x_ignore_events_set */
976 NULL, /* _ecore_evas_x_alpha_set */
977 NULL, //transparent
978
979 NULL,
980 NULL,
981 NULL,
982 NULL,
983 NULL,
984 NULL,
985
986 NULL, // render
987 NULL //screen_geometry_get
988};
989
990#endif /* BUILD_ECORE_EVAS_WIN32 */
991
992/* API */
993
994#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
995static int
996_ecore_evas_engine_software_gdi_init(Ecore_Evas *ee)
997{
998 Evas_Engine_Info_Software_Gdi *einfo;
999 const char *driver;
1000 int rmethod;
1001
1002 driver = "software_gdi";
1003
1004 rmethod = evas_render_method_lookup(driver);
1005 if (!rmethod)
1006 return 0;
1007
1008 ee->driver = driver;
1009 evas_output_method_set(ee->evas, rmethod);
1010
1011 einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas);
1012 if (einfo)
1013 {
1014 /* FIXME: REDRAW_DEBUG missing for now */
1015 einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window;
1016 einfo->info.depth = ecore_win32_screen_depth_get();
1017 einfo->info.rotation = 0;
1018 einfo->info.borderless = 0;
1019 einfo->info.fullscreen = 0;
1020 einfo->info.region = 0;
1021 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1022 {
1023 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1024 return 0;
1025 }
1026 }
1027 else
1028 {
1029 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
1030 return 0;
1031 }
1032
1033 return 1;
1034}
1035#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */
1036
1037#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
1038static int
1039_ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee)
1040{
1041 Evas_Engine_Info_Software_DDraw *einfo;
1042 const char *driver;
1043 int rmethod;
1044
1045 driver = "software_ddraw";
1046
1047 rmethod = evas_render_method_lookup(driver);
1048 if (!rmethod)
1049 return 0;
1050
1051 ee->driver = driver;
1052 evas_output_method_set(ee->evas, rmethod);
1053
1054 einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas);
1055 if (einfo)
1056 {
1057 /* FIXME: REDRAW_DEBUG missing for now */
1058 einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window;
1059 einfo->info.depth = ecore_win32_screen_depth_get();
1060 einfo->info.rotation = 0;
1061 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1062 {
1063 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1064 return 0;
1065 }
1066 }
1067 else
1068 {
1069 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
1070 return 0;
1071 }
1072
1073 return 1;
1074}
1075#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */
1076
1077#ifdef BUILD_ECORE_EVAS_DIRECT3D
1078static int
1079_ecore_evas_engine_direct3d_init(Ecore_Evas *ee)
1080{
1081 Evas_Engine_Info_Direct3D *einfo;
1082 const char *driver;
1083 int rmethod;
1084
1085 driver = "direct3d";
1086
1087 rmethod = evas_render_method_lookup(driver);
1088 if (!rmethod)
1089 return 0;
1090
1091 ee->driver = driver;
1092 evas_output_method_set(ee->evas, rmethod);
1093
1094 einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ee->evas);
1095 if (einfo)
1096 {
1097 /* FIXME: REDRAW_DEBUG missing for now */
1098 einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window;
1099 einfo->info.depth = ecore_win32_screen_depth_get();
1100 einfo->info.rotation = 0;
1101 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1102 {
1103 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1104 return 0;
1105 }
1106 }
1107 else
1108 {
1109 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
1110 return 0;
1111 }
1112
1113 return 1;
1114}
1115#endif /* BUILD_ECORE_EVAS_DIRECT3D */
1116
1117#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
1118static int
1119_ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee)
1120{
1121 Evas_Engine_Info_GL_Glew *einfo;
1122 const char *driver;
1123 int rmethod;
1124
1125 driver = "gl_glew";
1126
1127 rmethod = evas_render_method_lookup(driver);
1128 if (!rmethod)
1129 return 0;
1130
1131 ee->driver = driver;
1132 evas_output_method_set(ee->evas, rmethod);
1133
1134 einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(ee->evas);
1135 if (einfo)
1136 {
1137 /* FIXME: REDRAW_DEBUG missing for now */
1138 einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window;
1139 einfo->info.depth = ecore_win32_screen_depth_get();
1140 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1141 {
1142 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1143 return 0;
1144 }
1145 }
1146 else
1147 {
1148 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
1149 return 0;
1150 }
1151
1152 return 1;
1153}
1154#endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */
1155
1156#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
1157static int
1158_ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee)
1159{
1160 Evas_Engine_Info_Software_DDraw *einfo;
1161 const char *driver;
1162 int rmethod;
1163
1164 driver = "software_16_ddraw";
1165
1166 rmethod = evas_render_method_lookup(driver);
1167 if (!rmethod)
1168 return 0;
1169
1170 ee->driver = driver;
1171 evas_output_method_set(ee->evas, rmethod);
1172
1173 if (ecore_win32_screen_depth_get() != 16)
1174 return 0;
1175
1176 einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(ee->evas);
1177 if (einfo)
1178 {
1179 /* FIXME: REDRAW_DEBUG missing for now */
1180 einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window;
1181 einfo->info.depth = ecore_win32_screen_depth_get();
1182 einfo->info.rotation = 0;
1183 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1184 {
1185 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1186 return 0;
1187 }
1188 }
1189 else
1190 {
1191 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
1192 return 0;
1193 }
1194
1195 return 1;
1196}
1197#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */
1198
1199#ifdef BUILD_ECORE_EVAS_WIN32
1200static Ecore_Evas *
1201_ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee),
1202 Ecore_Win32_Window *parent,
1203 int x,
1204 int y,
1205 int width,
1206 int height)
1207{
1208 Ecore_Evas *ee;
1209
1210 if (!ecore_win32_init())
1211 return NULL;
1212
1213 ee = calloc(1, sizeof(Ecore_Evas));
1214 if (!ee)
1215 return NULL;
1216
1217 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
1218
1219 _ecore_evas_win32_init();
1220
1221 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_win32_engine_func;
1222
1223 if (width < 1) width = 1;
1224 if (height < 1) height = 1;
1225 ee->x = x;
1226 ee->y = y;
1227 ee->w = width;
1228 ee->h = height;
1229 ee->req.x = ee->x;
1230 ee->req.y = ee->y;
1231 ee->req.w = ee->w;
1232 ee->req.h = ee->h;
1233
1234 ee->prop.max.w = 32767;
1235 ee->prop.max.h = 32767;
1236 ee->prop.layer = 4;
1237 ee->prop.request_pos = 0;
1238 ee->prop.sticky = 0;
1239 /* FIXME: sticky to add */
1240 ee->prop.window = 0;
1241
1242 /* init evas here */
1243 ee->evas = evas_new();
1244 evas_data_attach_set(ee->evas, ee);
1245 evas_output_size_set(ee->evas, width, height);
1246 evas_output_viewport_set(ee->evas, 0, 0, width, height);
1247
1248 ee->engine.win32.parent = parent;
1249 ee->prop.window = (Ecore_Window)ecore_win32_window_new(parent, x, y, width, height);
1250 if (!ee->prop.window)
1251 {
1252 _ecore_evas_win32_shutdown();
1253 free(ee);
1254 return NULL;
1255 }
1256
1257 if (!_ecore_evas_engine_init(ee))
1258 {
1259 _ecore_evas_win32_shutdown();
1260 free(ee);
1261 return NULL;
1262 }
1263
1264 ee->engine.func->fn_render = _ecore_evas_win32_render;
1265 _ecore_evas_register(ee);
1266 ecore_event_window_register(ee->prop.window, ee, ee->evas,
1267 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
1268 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
1269 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
1270 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
1271
1272 return ee;
1273}
1274
1275#endif /* BUILD_ECORE_EVAS_WIN32 */
1276
1277#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
1278
1279EAPI Ecore_Evas *
1280ecore_evas_software_gdi_new(Ecore_Win32_Window *parent,
1281 int x,
1282 int y,
1283 int width,
1284 int height)
1285{
1286 return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_gdi_init,
1287 parent,
1288 x,
1289 y,
1290 width,
1291 height);
1292}
1293
1294#else
1295
1296EAPI Ecore_Evas *
1297ecore_evas_software_gdi_new(Ecore_Win32_Window *parent __UNUSED__,
1298 int x __UNUSED__,
1299 int y __UNUSED__,
1300 int width __UNUSED__,
1301 int height __UNUSED__)
1302{
1303 return NULL;
1304}
1305
1306#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_GDI */
1307
1308#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
1309
1310EAPI Ecore_Evas *
1311ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent,
1312 int x,
1313 int y,
1314 int width,
1315 int height)
1316{
1317 return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_ddraw_init,
1318 parent,
1319 x,
1320 y,
1321 width,
1322 height);
1323}
1324
1325#else
1326
1327EAPI Ecore_Evas *
1328ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent __UNUSED__,
1329 int x __UNUSED__,
1330 int y __UNUSED__,
1331 int width __UNUSED__,
1332 int height __UNUSED__)
1333{
1334 return NULL;
1335}
1336
1337#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_DDRAW */
1338
1339
1340#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
1341
1342EAPI Ecore_Evas *
1343ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent,
1344 int x,
1345 int y,
1346 int width,
1347 int height)
1348{
1349 return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_16_ddraw_init,
1350 parent,
1351 x,
1352 y,
1353 width,
1354 height);
1355}
1356
1357#else
1358
1359EAPI Ecore_Evas *
1360ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent __UNUSED__,
1361 int x __UNUSED__,
1362 int y __UNUSED__,
1363 int width __UNUSED__,
1364 int height __UNUSED__)
1365{
1366 return NULL;
1367}
1368
1369#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */
1370
1371
1372#ifdef BUILD_ECORE_EVAS_DIRECT3D
1373
1374EAPI Ecore_Evas *
1375ecore_evas_direct3d_new(Ecore_Win32_Window *parent,
1376 int x,
1377 int y,
1378 int width,
1379 int height)
1380{
1381 return _ecore_evas_win32_new_internal(_ecore_evas_engine_direct3d_init,
1382 parent,
1383 x,
1384 y,
1385 width,
1386 height);
1387}
1388
1389#else
1390
1391EAPI Ecore_Evas *
1392ecore_evas_direct3d_new(Ecore_Win32_Window *parent __UNUSED__,
1393 int x __UNUSED__,
1394 int y __UNUSED__,
1395 int width __UNUSED__,
1396 int height __UNUSED__)
1397{
1398 return NULL;
1399}
1400
1401#endif /* ! BUILD_ECORE_EVAS_DIRECT3D */
1402
1403
1404#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
1405
1406EAPI Ecore_Evas *
1407ecore_evas_gl_glew_new(Ecore_Win32_Window *parent,
1408 int x,
1409 int y,
1410 int width,
1411 int height)
1412{
1413 return _ecore_evas_win32_new_internal(_ecore_evas_engine_opengl_glew_init,
1414 parent,
1415 x,
1416 y,
1417 width,
1418 height);
1419}
1420
1421#else
1422
1423EAPI Ecore_Evas *
1424ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__,
1425 int x __UNUSED__,
1426 int y __UNUSED__,
1427 int width __UNUSED__,
1428 int height __UNUSED__)
1429{
1430 return NULL;
1431}
1432
1433#endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */
1434
1435
1436#ifdef BUILD_ECORE_EVAS_WIN32
1437
1438EAPI Ecore_Win32_Window *
1439ecore_evas_win32_window_get(const Ecore_Evas *ee)
1440{
1441 return (Ecore_Win32_Window *) ecore_evas_window_get(ee);
1442}
1443
1444#else
1445
1446EAPI Ecore_Win32_Window *
1447ecore_evas_win32_window_get(const Ecore_Evas *ee __UNUSED__)
1448{
1449 return NULL;
1450}
1451
1452#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
deleted file mode 100644
index fecf26b..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
+++ /dev/null
@@ -1,992 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdlib.h> /* for NULL */
6
7#include <Ecore.h>
8#include "ecore_private.h"
9#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
10# define WIN32_LEAN_AND_MEAN
11# include <windows.h>
12# undef WIN32_LEAN_AND_MEAN
13# include <Ecore_WinCE.h>
14# include <ecore_wince_private.h>
15#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
16
17#include "ecore_evas_private.h"
18#include "Ecore_Evas.h"
19
20#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
21
22#define ECORE_EVAS_EVENT_COUNT 9
23
24static int _ecore_evas_init_count = 0;
25
26static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT];
27
28static Eina_Bool _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
29
30static Eina_Bool _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
31
32static Eina_Bool _ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
33
34static Eina_Bool _ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
35
36static Eina_Bool _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
37
38static Eina_Bool _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
39
40static Eina_Bool _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
41
42static Eina_Bool _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
43
44static Eina_Bool _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
45
46/* Private functions */
47
48static int
49_ecore_evas_wince_render(Ecore_Evas *ee)
50{
51 int rend = 0;
52 Eina_List *updates = NULL;
53 Eina_List *ll;
54 Ecore_Evas *ee2;
55
56 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
57 {
58 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
59 if (ee2->engine.func->fn_render)
60 rend |= ee2->engine.func->fn_render(ee2);
61 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
62 }
63
64 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
65 if (ee->prop.avoid_damage)
66 {
67 updates = evas_render_updates(ee->evas);
68 if (updates) evas_render_updates_free(updates);
69 }
70 else if ((ee->visible) ||
71 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
72 ((ee->should_be_visible) && (ee->prop.override)))
73 {
74 if (ee->shaped)
75 {
76 updates = evas_render_updates(ee->evas);
77 if (updates) evas_render_updates_free(updates);
78 }
79 else
80 {
81 updates = evas_render_updates(ee->evas);
82 if (updates) evas_render_updates_free(updates);
83 }
84 }
85 else
86 evas_norender(ee->evas);
87 if (updates) rend = 1;
88 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
89 return rend;
90}
91
92static int
93_ecore_evas_wince_init(void)
94{
95 _ecore_evas_init_count++;
96 if (_ecore_evas_init_count > 1)
97 return _ecore_evas_init_count;
98
99 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_IN, _ecore_evas_wince_event_mouse_in, NULL);
100 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_OUT, _ecore_evas_wince_event_mouse_out, NULL);
101 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, _ecore_evas_wince_event_window_focus_in, NULL);
102 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_wince_event_window_focus_out, NULL);
103 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, _ecore_evas_wince_event_window_damage, NULL);
104 ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, _ecore_evas_wince_event_window_destroy, NULL);
105 ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_SHOW, _ecore_evas_wince_event_window_show, NULL);
106 ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_HIDE, _ecore_evas_wince_event_window_hide, NULL);
107 ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_wince_event_window_delete_request, NULL);
108
109 ecore_event_evas_init();
110 return _ecore_evas_init_count;
111}
112
113int
114_ecore_evas_wince_shutdown(void)
115{
116 _ecore_evas_init_count--;
117 if (_ecore_evas_init_count == 0)
118 {
119 int i;
120
121 for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++)
122 ecore_event_handler_del(ecore_evas_event_handlers[i]);
123 ecore_event_evas_shutdown();
124 }
125
126 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
127
128 return _ecore_evas_init_count;
129}
130
131static Eina_Bool
132_ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
133{
134 Ecore_Evas *ee;
135 Ecore_WinCE_Event_Mouse_In *e;
136
137 INF("mouse in");
138
139 e = event;
140 ee = ecore_event_window_match((Ecore_Window)e->window);
141 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
142 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
143
144 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
145 /* FIXME to do */
146/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
147 evas_event_feed_mouse_in(ee->evas, e->time, NULL);
148 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
149
150 return 1;
151}
152
153static Eina_Bool
154_ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
155{
156 Ecore_Evas *ee;
157 Ecore_WinCE_Event_Mouse_Out *e;
158
159 INF("mouse out");
160
161 e = event;
162 ee = ecore_event_window_match((Ecore_Window)e->window);
163 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
164 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
165
166 /* FIXME to do */
167/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
168 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
169
170 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
171 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
172 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
173
174 return 1;
175}
176
177static Eina_Bool
178_ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
179{
180 Ecore_Evas *ee;
181 Ecore_WinCE_Event_Window_Focus_In *e;
182
183 e = event;
184 ee = ecore_event_window_match(e->window);
185 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
186 if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
187
188 ee->prop.focused = 1;
189 evas_focus_in(ee->evas);
190 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
191 return ECORE_CALLBACK_PASS_ON;
192}
193
194static Eina_Bool
195_ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
196{
197 Ecore_Evas *ee;
198 Ecore_WinCE_Event_Window_Focus_Out *e;
199
200 e = event;
201 ee = ecore_event_window_match(e->window);
202 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
203 if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
204
205 evas_focus_out(ee->evas);
206 ee->prop.focused = 0;
207 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
208 return ECORE_CALLBACK_PASS_ON;
209}
210
211static Eina_Bool
212_ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
213{
214 Ecore_Evas *ee;
215 Ecore_WinCE_Event_Window_Damage *e;
216
217 INF("window damage");
218
219 e = event;
220 ee = ecore_event_window_match((Ecore_Window)e->window);
221 if (!ee) return 1; /* pass on event */
222 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
223
224 if (ee->prop.avoid_damage)
225 {
226#warning [ECORE] [WINCE] No Region code
227 }
228 else
229 {
230 if (ee->rotation == 0)
231 evas_damage_rectangle_add(ee->evas,
232 e->x,
233 e->y,
234 e->width,
235 e->height);
236 else if (ee->rotation == 90)
237 evas_damage_rectangle_add(ee->evas,
238 ee->h - e->y - e->height,
239 e->x,
240 e->height,
241 e->width);
242 else if (ee->rotation == 180)
243 evas_damage_rectangle_add(ee->evas,
244 ee->w - e->x - e->width,
245 ee->h - e->y - e->height,
246 e->width,
247 e->height);
248 else if (ee->rotation == 270)
249 evas_damage_rectangle_add(ee->evas,
250 e->y,
251 ee->w - e->x - e->width,
252 e->height,
253 e->width);
254 }
255
256 return 1;
257}
258
259static Eina_Bool
260_ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
261{
262 Ecore_Evas *ee;
263 Ecore_WinCE_Event_Window_Destroy *e;
264
265 INF("window destroy");
266
267 e = event;
268 ee = ecore_event_window_match((Ecore_Window)e->window);
269 if (!ee) return 1; /* pass on event */
270 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
271 if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
272 ecore_evas_free(ee);
273
274 return 1;
275}
276
277static Eina_Bool
278_ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
279{
280 Ecore_Evas *ee;
281 Ecore_WinCE_Event_Window_Show *e;
282
283 INF("window show");
284
285 e = event;
286 ee = ecore_event_window_match((Ecore_Window)e->window);
287 if (!ee) return 1; /* pass on event */
288 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
289 if (ee->visible) return 0; /* dont pass it on */
290 ee->visible = 1;
291 if (ee->func.fn_show) ee->func.fn_show(ee);
292
293 return 1;
294}
295
296static Eina_Bool
297_ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
298{
299 Ecore_Evas *ee;
300 Ecore_WinCE_Event_Window_Hide *e;
301
302 INF("window hide");
303
304 e = event;
305 ee = ecore_event_window_match((Ecore_Window)e->window);
306 if (!ee) return 1; /* pass on event */
307 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
308 if (!ee->visible) return 0; /* dont pass it on */
309 ee->visible = 0;
310 if (ee->func.fn_hide) ee->func.fn_hide(ee);
311
312 return 1;
313}
314
315static Eina_Bool
316_ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
317{
318 Ecore_Evas *ee;
319 Ecore_WinCE_Event_Window_Delete_Request *e;
320
321 INF("window delete request");
322
323 e = event;
324 ee = ecore_event_window_match((Ecore_Window)e->window);
325 if (!ee) return 1; /* pass on event */
326 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
327 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
328
329 return 1;
330}
331
332
333/* Ecore_Evas interface */
334
335static void
336_ecore_evas_wince_free(Ecore_Evas *ee)
337{
338 INF("ecore evas free");
339
340 ecore_wince_window_free((Ecore_WinCE_Window *)ee->prop.window);
341 ecore_event_window_unregister(ee->prop.window);
342 _ecore_evas_wince_shutdown();
343 ecore_wince_shutdown();
344}
345
346static void
347_ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee,
348 Ecore_Evas_Event_Cb func)
349{
350 ee->func.fn_delete_request = func;
351}
352
353static void
354_ecore_evas_wince_move(Ecore_Evas *ee, int x, int y)
355{
356 INF("ecore evas move (%dx%d)", x, y);
357 ee->req.x = x;
358 ee->req.y = y;
359
360 if ((x != ee->x) || (y != ee->y))
361 {
362 ee->x = x;
363 ee->y = y;
364 ecore_wince_window_move((Ecore_WinCE_Window *)ee->prop.window, x, y);
365 if (ee->func.fn_move) ee->func.fn_move(ee);
366 }
367}
368
369static void
370_ecore_evas_wince_resize(Ecore_Evas *ee, int width, int height)
371{
372 INF("ecore evas resize (%dx%d)", width, height);
373 ee->req.w = width;
374 ee->req.h = height;
375
376 if ((ee->w != width) || (ee->h != height))
377 {
378 ee->w = width;
379 ee->h = height;
380 ecore_wince_window_resize((Ecore_WinCE_Window *)ee->prop.window, width, height);
381 if ((ee->rotation == 90) || (ee->rotation == 270))
382 {
383 evas_output_size_set(ee->evas, ee->h, ee->w);
384 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
385 }
386 else
387 {
388 evas_output_size_set(ee->evas, ee->w, ee->h);
389 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
390 }
391 /* FIXME: damage and shape */
392
393 if (ee->func.fn_resize) ee->func.fn_resize(ee);
394 }
395}
396
397static void
398_ecore_evas_wince_move_resize(Ecore_Evas *ee, int x, int y, int width, int height)
399{
400 INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height);
401 ee->req.x = x;
402 ee->req.y = y;
403 ee->req.w = width;
404 ee->req.h = height;
405
406 if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y))
407 {
408 int change_size = 0;
409 int change_pos = 0;
410
411 if ((ee->w != width) || (ee->h != height)) change_size = 1;
412 if ((x != ee->x) || (y != ee->y)) change_pos = 1;
413
414 ee->x = x;
415 ee->y = y;
416 ee->w = width;
417 ee->h = height;
418 ecore_wince_window_move_resize((Ecore_WinCE_Window *)ee->prop.window, x, y, width, height);
419 if ((ee->rotation == 90) || (ee->rotation == 270))
420 {
421 evas_output_size_set(ee->evas, ee->h, ee->w);
422 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
423 }
424 else
425 {
426 evas_output_size_set(ee->evas, ee->w, ee->h);
427 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
428 }
429 /* FIXME: damage and shape */
430 if (change_pos)
431 {
432 if (ee->func.fn_move) ee->func.fn_move(ee);
433 }
434 if (change_size)
435 {
436 if (ee->func.fn_resize) ee->func.fn_resize(ee);
437 }
438 }
439}
440
441/* static void */
442/* _ecore_evas_wince_rotation_set(Ecore_Evas *ee, int rotation) */
443/* { */
444/* int rot_dif; */
445
446/* if (ee->rotation == rotation) return; */
447/* rot_dif = ee->rotation - rotation; */
448/* if (rot_dif < 0) rot_dif = -rot_dif; */
449/* if (!strcmp(ee->driver, "software_ddraw")) */
450/* { */
451/* Evas_Engine_Info_Software_16_WinCE *einfo; */
452
453/* einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); */
454/* if (!einfo) return; */
455/* if (rot_dif != 180) */
456/* { */
457/* int minw, minh, maxw, maxh, basew, baseh, stepw, steph; */
458
459/* einfo->info.rotation = rotation; */
460/* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
461/* if (!ee->prop.fullscreen) */
462/* { */
463/* ecore_wince_window_resize(ee->prop.window, ee->h, ee->w); */
464/* ee->expecting_resize.w = ee->h; */
465/* ee->expecting_resize.h = ee->w; */
466/* } */
467/* else */
468/* { */
469/* int w, h; */
470
471/* ecore_wince_window_size_get(ee->prop.window, &w, &h); */
472/* ecore_wince_window_resize(ee->prop.window, h, w); */
473/* if ((rotation == 0) || (rotation == 180)) */
474/* { */
475/* evas_output_size_set(ee->evas, ee->w, ee->h); */
476/* evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); */
477/* } */
478/* else */
479/* { */
480/* evas_output_size_set(ee->evas, ee->h, ee->w); */
481/* evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); */
482/* } */
483/* if (ee->func.fn_resize) ee->func.fn_resize(ee); */
484/* } */
485/* ecore_evas_size_min_get(ee, &minw, &minh); */
486/* ecore_evas_size_max_get(ee, &maxw, &maxh); */
487/* ecore_evas_size_base_get(ee, &basew, &baseh); */
488/* ecore_evas_size_step_get(ee, &stepw, &steph); */
489/* ee->rotation = rotation; */
490/* ecore_evas_size_min_set(ee, minh, minw); */
491/* ecore_evas_size_max_set(ee, maxh, maxw); */
492/* ecore_evas_size_base_set(ee, baseh, basew); */
493/* ecore_evas_size_step_set(ee, steph, stepw); */
494/* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */
495/* ecore_wince_current_time_get()); */
496/* } */
497/* else */
498/* { */
499/* einfo->info.rotation = rotation; */
500/* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
501/* ee->rotation = rotation; */
502/* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */
503/* ecore_wince_current_time_get()); */
504/* if (ee->func.fn_resize) ee->func.fn_resize(ee); */
505/* } */
506/* if ((ee->rotation == 90) || (ee->rotation == 270)) */
507/* evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); */
508/* else */
509/* evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); */
510/* } */
511/* } */
512
513static void
514_ecore_evas_wince_show(Ecore_Evas *ee)
515{
516 INF("ecore evas show");
517
518 ee->should_be_visible = 1;
519 if (ee->prop.avoid_damage)
520 _ecore_evas_wince_render(ee);
521 ecore_wince_window_show((Ecore_WinCE_Window *)ee->prop.window);
522/* if (ee->prop.fullscreen) */
523/* ecore_wince_window_focus(ee->prop.window); */
524}
525
526static void
527_ecore_evas_wince_hide(Ecore_Evas *ee)
528{
529 INF("ecore evas hide");
530
531 ecore_wince_window_hide((Ecore_WinCE_Window *)ee->prop.window);
532 ee->should_be_visible = 0;
533}
534
535/* static void */
536/* _ecore_evas_wince_raise(Ecore_Evas *ee) */
537/* { */
538/* if (!ee->prop.fullscreen) */
539/* ecore_wince_window_raise(ee->prop.window); */
540/* else */
541/* ecore_wince_window_raise(ee->prop.window); */
542/* } */
543
544/* static void */
545/* _ecore_evas_wince_lower(Ecore_Evas *ee) */
546/* { */
547/* if (!ee->prop.fullscreen) */
548/* ecore_wince_window_lower(ee->prop.window); */
549/* else */
550/* ecore_wince_window_lower(ee->prop.window); */
551/* } */
552
553static void
554_ecore_evas_wince_title_set(Ecore_Evas *ee, const char *title)
555{
556 INF("ecore evas title set");
557
558 if (ee->prop.title) free(ee->prop.title);
559 ee->prop.title = NULL;
560 if (title) ee->prop.title = strdup(title);
561 ecore_wince_window_title_set((Ecore_WinCE_Window *)ee->prop.window, ee->prop.title);
562}
563
564/* static void */
565/* _ecore_evas_wince_size_min_set(Ecore_Evas *ee, int width, int height) */
566/* { */
567/* if (width < 0) width = 0; */
568/* if (height < 0) height = 0; */
569/* if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; */
570/* ee->prop.min.w = width; */
571/* ee->prop.min.h = height; */
572/* ecore_wince_window_size_min_set(ee->prop.window, width, height); */
573/* } */
574
575/* static void */
576/* _ecore_evas_wince_size_max_set(Ecore_Evas *ee, int width, int height) */
577/* { */
578/* if (width < 0) width = 0; */
579/* if (height < 0) height = 0; */
580/* if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; */
581/* ee->prop.max.w = width; */
582/* ee->prop.max.h = height; */
583/* ecore_wince_window_size_max_set(ee->prop.window, width, height); */
584/* } */
585
586/* static void */
587/* _ecore_evas_wince_size_base_set(Ecore_Evas *ee, int width, int height) */
588/* { */
589/* if (width < 0) width = 0; */
590/* if (height < 0) height = 0; */
591/* if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; */
592/* ee->prop.base.w = width; */
593/* ee->prop.base.h = height; */
594/* ecore_wince_window_size_base_set(ee->prop.window, width, height); */
595/* } */
596
597/* static void */
598/* _ecore_evas_wince_size_step_set(Ecore_Evas *ee, int width, int height) */
599/* { */
600/* if (width < 1) width = 1; */
601/* if (height < 1) height = 1; */
602/* if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; */
603/* ee->prop.step.w = width; */
604/* ee->prop.step.h = height; */
605/* ecore_wince_window_size_step_set(ee->prop.window, width, height); */
606/* } */
607
608static void
609_ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
610{
611#if 0
612 int x, y;
613
614 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
615
616 if (obj == NULL)
617 {
618 ee->prop.cursor.object = NULL;
619 ee->prop.cursor.layer = 0;
620 ee->prop.cursor.hot.x = 0;
621 ee->prop.cursor.hot.y = 0;
622 ecore_wince_window_cursor_show(ee->prop.window, 1);
623 return;
624 }
625
626 ee->prop.cursor.object = obj;
627 ee->prop.cursor.layer = layer;
628 ee->prop.cursor.hot.x = hot_x;
629 ee->prop.cursor.hot.y = hot_y;
630
631 ecore_wince_window_cursor_show(ee->prop.window, 0);
632
633 evas_pointer_output_xy_get(ee->evas, &x, &y);
634 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
635 evas_object_move(ee->prop.cursor.object,
636 x - ee->prop.cursor.hot.x,
637 y - ee->prop.cursor.hot.y);
638 evas_object_pass_events_set(ee->prop.cursor.object, 1);
639 if (evas_pointer_inside_get(ee->evas))
640 evas_object_show(ee->prop.cursor.object);
641#endif
642}
643
644static void
645_ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__)
646{
647 ecore_wince_window_focus(ee->prop.window);
648}
649
650/* static void */
651/* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */
652/* { */
653/* /\* if (((ee->prop.borderless) && (on)) || *\/ */
654/* /\* ((!ee->prop.borderless) && (!on))) return; *\/ */
655/* ee->prop.iconified = on; */
656/* ecore_wince_window_iconified_set(ee->prop.window, ee->prop.iconified); */
657/* } */
658
659/* static void */
660/* _ecore_evas_wince_borderless_set(Ecore_Evas *ee, int on) */
661/* { */
662/* if (((ee->prop.borderless) && (on)) || */
663/* ((!ee->prop.borderless) && (!on))) return; */
664/* ee->prop.borderless = on; */
665/* ecore_wince_window_borderless_set(ee->prop.window, ee->prop.borderless); */
666/* } */
667
668static void
669_ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on)
670{
671 Evas_Engine_Info_Software_16_WinCE *einfo;
672 struct _Ecore_WinCE_Window *window;
673
674 INF("ecore evas fullscreen set");
675
676 if ((ee->engine.wince.state.fullscreen && on) ||
677 (!ee->engine.wince.state.fullscreen && !on))
678 return;
679
680 ee->engine.wince.state.fullscreen = on;
681 ee->prop.fullscreen = on;
682
683 window = (struct _Ecore_WinCE_Window *)ee->prop.window;
684
685 if (on != 0)
686 {
687/* ecore_win32_window_shape_set(ee->engine.win32.window, 0, 0, NULL); */
688 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on);
689 ee->w = GetSystemMetrics(SM_CXSCREEN);
690 ee->h = GetSystemMetrics(SM_CYSCREEN);
691 ee->req.w = ee->w;
692 ee->req.h = ee->h;
693 evas_output_size_set(ee->evas, ee->w, ee->h);
694 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
695 }
696 else
697 {
698 int w;
699 int h;
700
701 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on);
702 ecore_wince_window_size_get((Ecore_WinCE_Window *)ee->prop.window, &w, &h);
703 ee->w = w;
704 ee->h = h;
705 ee->req.w = ee->w;
706 ee->req.h = ee->h;
707 evas_output_size_set(ee->evas, ee->w, ee->h);
708 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
709/* ecore_win32_window_shape_set(window, */
710/* window->shape.width, */
711/* window->shape.height, */
712/* window->shape.mask); */
713 }
714
715 einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ecore_evas_get(ee));
716 if (einfo)
717 {
718 einfo->info.fullscreen = !!on;
719/* einfo->info.layered = window->shape.layered; */
720 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
721 {
722 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
723 }
724 }
725}
726
727static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
728{
729 _ecore_evas_wince_free,
730 NULL,
731 NULL,
732 NULL,
733 NULL,
734 _ecore_evas_wince_callback_delete_request_set,
735 NULL,
736 NULL,
737 NULL,
738 NULL,
739 NULL,
740 NULL,
741 NULL,
742 NULL,
743 NULL,
744 _ecore_evas_wince_move,
745 NULL,
746 _ecore_evas_wince_resize,
747 _ecore_evas_wince_move_resize,
748 NULL, //_ecore_evas_wince_rotation_set,
749 NULL, /* _ecore_evas_x_shaped_set */
750 _ecore_evas_wince_show,
751 _ecore_evas_wince_hide,
752 NULL, //_ecore_evas_wince_raise,
753 NULL, //_ecore_evas_wince_lower,
754 NULL, //_ecore_evas_wince_activate,
755 _ecore_evas_wince_title_set,
756 NULL, /* _ecore_evas_x_name_class_set */
757 NULL, //_ecore_evas_wince_size_min_set,
758 NULL, //_ecore_evas_wince_size_max_set,
759 NULL, //_ecore_evas_wince_size_base_set,
760 NULL, //_ecore_evas_wince_size_step_set,
761 _ecore_evas_wince_cursor_set,
762 NULL, /* _ecore_evas_x_layer_set */
763 _ecore_evas_wince_focus_set,
764 NULL, //_ecore_evas_wince_iconified_set,
765 NULL, //_ecore_evas_wince_borderless_set,
766 NULL, /* _ecore_evas_x_override_set */
767 NULL,
768 _ecore_evas_wince_fullscreen_set,
769 NULL, /* _ecore_evas_x_avoid_damage_set */
770 NULL, /* _ecore_evas_x_withdrawn_set */
771 NULL, /* _ecore_evas_x_sticky_set */
772 NULL, /* _ecore_evas_x_ignore_events_set */
773 NULL, /* _ecore_evas_x_alpha_set */
774 NULL, //transparent
775
776 NULL,
777 NULL,
778 NULL,
779 NULL,
780 NULL,
781 NULL,
782
783 NULL, // render
784 NULL // screen_geometry_get
785};
786
787/* API */
788
789static Ecore_Evas *
790ecore_evas_software_wince_new_internal(int backend,
791 Ecore_WinCE_Window *parent,
792 int x,
793 int y,
794 int width,
795 int height,
796 int fullscreen)
797{
798 Evas_Engine_Info_Software_16_WinCE *einfo;
799 Ecore_Evas *ee;
800 int rmethod;
801
802 rmethod = evas_render_method_lookup("software_16_wince");
803 if (!rmethod)
804 return NULL;
805
806 if (!ecore_wince_init())
807 return NULL;
808
809 ee = calloc(1, sizeof(Ecore_Evas));
810 if (!ee)
811 {
812 ecore_wince_shutdown();
813 return NULL;
814 }
815
816 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
817
818 if (!_ecore_evas_wince_init())
819 {
820 free(ee);
821 ecore_wince_shutdown();
822 return NULL;
823 }
824
825 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wince_engine_func;
826
827 ee->driver = "software_16_wince";
828
829 if (width < 1) width = 1;
830 if (height < 1) height = 1;
831 ee->x = x;
832 ee->y = y;
833 ee->w = width;
834 ee->h = height;
835 ee->req.x = ee->x;
836 ee->req.y = ee->y;
837 ee->req.w = ee->w;
838 ee->req.h = ee->h;
839
840 ee->prop.max.w = 32767;
841 ee->prop.max.h = 32767;
842 ee->prop.layer = 4;
843 ee->prop.request_pos = 0;
844 ee->prop.sticky = 0;
845 /* FIXME: sticky to add */
846
847 ee->prop.window = (Ecore_Window)ecore_wince_window_new((Ecore_WinCE_Window *)parent, x, y, width, height);
848 if (!ee->prop.window)
849 {
850 _ecore_evas_wince_shutdown();
851 free(ee);
852 ecore_wince_shutdown();
853 return NULL;
854 }
855
856 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, fullscreen);
857
858 /* init evas here */
859 ee->evas = evas_new();
860 evas_data_attach_set(ee->evas, ee);
861 evas_output_method_set(ee->evas, rmethod);
862 evas_output_size_set(ee->evas, width, height);
863 evas_output_viewport_set(ee->evas, 0, 0, width, height);
864
865 einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas);
866 if (einfo)
867 {
868 /* FIXME: REDRAW_DEBUG missing for now */
869 einfo->info.window = ((struct _Ecore_WinCE_Window *)ee->prop.window)->window;
870 einfo->info.width = width;
871 einfo->info.height = height;
872 einfo->info.backend = backend;
873 einfo->info.rotation = 0;
874 einfo->info.fullscreen = fullscreen;
875 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
876 {
877 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
878 _ecore_evas_wince_shutdown();
879 free(ee);
880 ecore_wince_shutdown();
881 return NULL;
882 }
883
884 ecore_wince_window_backend_set((Ecore_WinCE_Window *)ee->prop.window, backend);
885 ecore_wince_window_suspend_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.suspend);
886 ecore_wince_window_resume_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.resume);
887 }
888 else
889 {
890 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
891 _ecore_evas_wince_shutdown();
892 free(ee);
893 ecore_wince_shutdown();
894 return NULL;
895 }
896
897 ee->engine.func->fn_render = _ecore_evas_wince_render;
898 _ecore_evas_register(ee);
899 ecore_event_window_register(ee->prop.window, ee, ee->evas,
900 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
901 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
902 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
903 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
904 evas_focus_in(ee->evas);
905
906 return ee;
907}
908
909#else
910
911static Ecore_Evas *
912ecore_evas_software_wince_new_internal(int backend __UNUSED__,
913 Ecore_WinCE_Window *parent __UNUSED__,
914 int x __UNUSED__,
915 int y __UNUSED__,
916 int width __UNUSED__,
917 int height __UNUSED__,
918 int fullscreen __UNUSED__)
919{
920 return NULL;
921}
922
923#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
924
925
926EAPI Ecore_Evas *
927ecore_evas_software_wince_new(Ecore_WinCE_Window *parent,
928 int x,
929 int y,
930 int width,
931 int height)
932{
933 return ecore_evas_software_wince_new_internal(0, parent, x, y, width, height, 1);
934}
935
936EAPI Ecore_Evas *
937ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent,
938 int x,
939 int y,
940 int width,
941 int height)
942{
943 return ecore_evas_software_wince_new_internal(1, parent, x, y, width, height, 1);
944}
945
946EAPI Ecore_Evas *
947ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent,
948 int x,
949 int y,
950 int width,
951 int height)
952{
953 return ecore_evas_software_wince_new_internal(2, parent, x, y, width, height, 1);
954}
955
956EAPI Ecore_Evas *
957ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent,
958 int x,
959 int y,
960 int width,
961 int height)
962{
963 return ecore_evas_software_wince_new_internal(3, parent, x, y, width, height, 1);
964}
965
966EAPI Ecore_Evas *
967ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent,
968 int x,
969 int y,
970 int width,
971 int height)
972{
973 return ecore_evas_software_wince_new_internal(4, parent, x, y, width, height, 0);
974}
975
976#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
977
978EAPI Ecore_WinCE_Window *
979ecore_evas_software_wince_window_get(const Ecore_Evas *ee)
980{
981 return (Ecore_WinCE_Window *) ecore_evas_window_get(ee);
982}
983
984#else
985
986EAPI Ecore_WinCE_Window *
987ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__)
988{
989 return NULL;
990}
991
992#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
deleted file mode 100644
index 6dd13de..0000000
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c
+++ /dev/null
@@ -1,4445 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <string.h>
7
8#include <Eina.h>
9#include <Ecore.h>
10
11#include "ecore_evas_private.h"
12#include "Ecore_Evas.h"
13
14#ifdef BUILD_ECORE_EVAS_X11
15static int _ecore_evas_init_count = 0;
16
17static Ecore_Event_Handler *ecore_evas_event_handlers[13];
18
19static int leader_ref = 0;
20static Ecore_X_Window leader_win = 0;
21
22static void
23_ecore_evas_x_hints_update(Ecore_Evas *ee)
24{
25 ecore_x_icccm_hints_set
26 (ee->prop.window,
27 !ee->prop.focus_skip /* accepts_focus */,
28 ee->prop.iconified ? ECORE_X_WINDOW_STATE_HINT_ICONIC :
29 ee->prop.withdrawn ? ECORE_X_WINDOW_STATE_HINT_WITHDRAWN :
30 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
31 0 /* icon_pixmap */,
32 0 /* icon_mask */,
33 0 /* icon_window */,
34 ee->prop.group_ee_win /* window_group */,
35 ee->prop.urgent /* is_urgent */);
36}
37
38static void
39_ecore_evas_x_group_leader_set(Ecore_Evas *ee)
40{
41 leader_ref++;
42 if (leader_ref == 1)
43 {
44 char *id = NULL;
45
46 leader_win =
47 ecore_x_window_override_new(ee->engine.x.win_root, 1234, 5678, 1, 2);
48 ecore_x_window_defaults_set(leader_win);
49 if ((id = getenv("DESKTOP_STARTUP_ID")))
50 ecore_x_netwm_startup_id_set(leader_win,id);
51 ecore_x_icccm_client_leader_set(leader_win, leader_win);
52 }
53 ee->engine.x.leader = leader_win;
54 ecore_x_icccm_client_leader_set(ee->prop.window, leader_win);
55}
56
57static void
58_ecore_evas_x_group_leader_unset(Ecore_Evas *ee)
59{
60 ecore_x_window_prop_property_del(ee->prop.window,
61 ECORE_X_ATOM_WM_CLIENT_LEADER);
62 if (ee->engine.x.leader == leader_win)
63 {
64 leader_ref--;
65 if (leader_ref <= 0)
66 {
67 ecore_x_window_free(leader_win);
68 leader_win = 0;
69 }
70 ee->engine.x.leader = 0;
71 }
72}
73
74static void
75_ecore_evas_x_group_leader_update(Ecore_Evas *ee)
76{
77 if (ee->engine.x.leader)
78 ecore_x_icccm_client_leader_set(ee->prop.window, ee->engine.x.leader);
79}
80
81static void
82_ecore_evas_x_protocols_set(Ecore_Evas *ee)
83{
84 Ecore_X_Atom protos[3];
85 unsigned int num = 0, tmp = 0;
86
87 if (ee->func.fn_delete_request)
88 protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW;
89 protos[num++] = ECORE_X_ATOM_NET_WM_PING;
90 protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
91 ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num);
92
93 if (!ee->engine.x.netwm_sync_counter)
94 ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0);
95
96 tmp = ee->engine.x.netwm_sync_counter;
97 ecore_x_window_prop_card32_set(ee->prop.window,
98 ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
99 &tmp, 1);
100}
101
102static void
103_ecore_evas_x_sync_set(Ecore_Evas *ee)
104{
105 if (((ee->should_be_visible) || (ee->visible)) &&
106 ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) &&
107 (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)))
108 {
109 if (!ee->engine.x.sync_counter)
110 ee->engine.x.sync_counter = ecore_x_sync_counter_new(0);
111 }
112 else
113 {
114 if (ee->engine.x.sync_counter)
115 ecore_x_sync_counter_free(ee->engine.x.sync_counter);
116 ee->engine.x.sync_counter = 0;
117 }
118 ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter);
119}
120
121static void
122_ecore_evas_x_sync_clear(Ecore_Evas *ee)
123{
124 if (!ee->engine.x.sync_counter) return;
125 ecore_x_sync_counter_free(ee->engine.x.sync_counter);
126 ee->engine.x.sync_counter = 0;
127}
128
129# ifdef BUILD_ECORE_EVAS_OPENGL_X11
130static Ecore_X_Window
131_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)
132{
133 Evas_Engine_Info_GL_X11 *einfo;
134 Ecore_X_Window win;
135
136 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
137 if (einfo)
138 {
139 int screen;
140
141 if (opt)
142 {
143 int op;
144
145 for (op = 0; opt[op]; op++)
146 {
147 if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT)
148 {
149 op++;
150 einfo->indirect = opt[op];
151 }
152 else if (opt[op] == ECORE_EVAS_GL_X11_OPT_VSYNC)
153 {
154 op++;
155 einfo->vsync = opt[op];
156 }
157 }
158 }
159
160 /* FIXME: this is inefficient as its 1 or more round trips */
161 screen = ecore_x_screen_index_get(ecore_x_default_screen_get());
162 if (ecore_x_screen_count_get() > 1)
163 {
164 Ecore_X_Window *roots;
165 int num, i;
166
167 num = 0;
168 roots = ecore_x_window_root_list(&num);
169 if (roots)
170 {
171 Ecore_X_Window root;
172
173 root = ecore_x_window_root_get(parent);
174 for (i = 0; i < num; i++)
175 {
176 if (root == roots[i])
177 {
178 screen = i;
179 break;
180 }
181 }
182 free(roots);
183 }
184 }
185
186 einfo->info.display = ecore_x_display_get();
187 einfo->info.screen = screen;
188
189 einfo->info.destination_alpha = argb;
190
191 einfo->info.visual = einfo->func.best_visual_get(einfo);
192 einfo->info.colormap = einfo->func.best_colormap_get(einfo);
193 einfo->info.depth = einfo->func.best_depth_get(einfo);
194
195 if ((!einfo->info.visual) ||
196 (!einfo->info.colormap) || (!einfo->info.depth))
197 {
198 WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver);
199 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
200 {
201 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
202 return 0;
203 }
204 }
205
206 if (argb)
207 {
208 if (override)
209 win = ecore_x_window_override_argb_new(parent, x, y, w, h);
210 else
211 win = ecore_x_window_argb_new(parent, x, y, w, h);
212 }
213 else
214 {
215 if (override)
216 win = ecore_x_window_override_new(parent, x, y, w, h);
217 else
218 win = ecore_x_window_new(parent, x, y, w, h);
219 }
220
221 ecore_x_window_pixel_gravity_set(win, ECORE_X_GRAVITY_FORGET);
222
223 /* attr.backing_store = NotUseful; */
224 /* attr.override_redirect = override; */
225 /* attr.colormap = einfo->info.colormap; */
226 /* attr.border_pixel = 0; */
227 /* attr.background_pixmap = None; */
228 /* attr.event_mask = */
229 /* KeyPressMask | KeyReleaseMask | */
230 /* ExposureMask | ButtonPressMask | ButtonReleaseMask | */
231 /* EnterWindowMask | LeaveWindowMask | */
232 /* PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | */
233 /* FocusChangeMask | PropertyChangeMask | ColormapChangeMask; */
234 /* attr.bit_gravity = ForgetGravity; */
235
236 /* win = */
237 /* XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, */
238 /* einfo->info.depth, InputOutput, einfo->info.visual, */
239 /* CWBackingStore | CWColormap | CWBackPixmap | */
240 /* CWBorderPixel | CWBitGravity | CWEventMask | */
241 /* CWOverrideRedirect, &attr); */
242
243 einfo->info.drawable = win;
244
245 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
246 {
247 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
248 ecore_x_window_free(win);
249 return 0;
250 }
251 }
252 else
253 win = 0;
254
255 return win;
256}
257#endif
258
259static int
260_ecore_evas_x_render(Ecore_Evas *ee)
261{
262 int rend = 0;
263 Eina_List *updates = NULL;
264 Eina_List *ll;
265 Ecore_Evas *ee2;
266
267 if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) &&
268 (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) &&
269 (!ee->engine.x.sync_cancel))
270 return 0;
271
272 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
273 {
274 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
275 if (ee2->engine.func->fn_render)
276 rend |= ee2->engine.func->fn_render(ee2);
277 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
278 }
279
280 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
281 updates = evas_render_updates(ee->evas);
282 if (ee->prop.avoid_damage)
283 {
284 if (ee->engine.x.using_bg_pixmap)
285 {
286 if (updates)
287 {
288 Eina_List *l = NULL;
289 Eina_Rectangle *r;
290
291 EINA_LIST_FOREACH(updates, l, r)
292 ecore_x_window_area_clear(ee->prop.window,
293 r->x, r->y, r->w, r->h);
294 if (ee->shaped)
295 {
296#ifdef EVAS_FRAME_QUEUING
297 evas_sync(ee->evas);
298#endif
299 ecore_x_window_shape_mask_set(ee->prop.window,
300 ee->engine.x.mask);
301 }
302 if (ee->alpha)
303 {
304#ifdef EVAS_FRAME_QUEUING
305 /* wait until ee->engine.x.mask being updated */
306// evas_sync(ee->evas);
307#endif
308// ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask);
309 }
310 evas_render_updates_free(updates);
311 _ecore_evas_idle_timeout_update(ee);
312 rend = 1;
313 }
314 }
315 else
316 {
317 if (updates)
318 {
319 Eina_List *l = NULL;
320 Eina_Rectangle *r;
321
322 EINA_LIST_FOREACH(updates, l, r)
323 {
324 Ecore_X_Rectangle rect;
325 Ecore_X_XRegion *tmpr;
326
327 if (!ee->engine.x.damages)
328 ee->engine.x.damages = ecore_x_xregion_new();
329 tmpr = ecore_x_xregion_new();
330 if (ee->rotation == 0)
331 {
332 rect.x = r->x;
333 rect.y = r->y;
334 rect.width = r->w;
335 rect.height = r->h;
336 }
337 else if (ee->rotation == 90)
338 {
339 rect.x = r->y;
340 rect.y = ee->h - r->x - r->w;
341 rect.width = r->h;
342 rect.height = r->w;
343 }
344 else if (ee->rotation == 180)
345 {
346 rect.x = ee->w - r->x - r->w;
347 rect.y = ee->h - r->y - r->h;
348 rect.width = r->w;
349 rect.height = r->h;
350 }
351 else if (ee->rotation == 270)
352 {
353 rect.x = ee->w - r->y - r->h;
354 rect.y = r->x;
355 rect.width = r->h;
356 rect.height = r->w;
357 }
358 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages,
359 &rect);
360 ecore_x_xregion_free(ee->engine.x.damages);
361 ee->engine.x.damages = tmpr;
362 }
363 if (ee->engine.x.damages)
364 {
365 /* if we have a damage pixmap - we can avoid exposures by
366 * disabling them just for setting the mask */
367 ecore_x_event_mask_set(ee->prop.window,
368 ECORE_X_EVENT_MASK_KEY_DOWN |
369 ECORE_X_EVENT_MASK_KEY_UP |
370 ECORE_X_EVENT_MASK_MOUSE_DOWN |
371 ECORE_X_EVENT_MASK_MOUSE_UP |
372 ECORE_X_EVENT_MASK_MOUSE_IN |
373 ECORE_X_EVENT_MASK_MOUSE_OUT |
374 ECORE_X_EVENT_MASK_MOUSE_MOVE |
375 // ECORE_X_EVENT_MASK_WINDOW_DAMAGE |
376 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY |
377 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE |
378 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE |
379 ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
380 ECORE_X_EVENT_MASK_WINDOW_COLORMAP
381 );
382 if (ee->shaped)
383 ecore_x_window_shape_mask_set(ee->prop.window,
384 ee->engine.x.mask);
385 /* and re-enable them again */
386 ecore_x_event_mask_set(ee->prop.window,
387 ECORE_X_EVENT_MASK_KEY_DOWN |
388 ECORE_X_EVENT_MASK_KEY_UP |
389 ECORE_X_EVENT_MASK_MOUSE_DOWN |
390 ECORE_X_EVENT_MASK_MOUSE_UP |
391 ECORE_X_EVENT_MASK_MOUSE_IN |
392 ECORE_X_EVENT_MASK_MOUSE_OUT |
393 ECORE_X_EVENT_MASK_MOUSE_MOVE |
394 ECORE_X_EVENT_MASK_WINDOW_DAMAGE |
395 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY |
396 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE |
397 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE |
398 ECORE_X_EVENT_MASK_WINDOW_PROPERTY |
399 ECORE_X_EVENT_MASK_WINDOW_COLORMAP
400 );
401 ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc);
402 ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window,
403 ee->engine.x.gc, 0, 0, ee->w, ee->h,
404 0, 0);
405 ecore_x_xregion_free(ee->engine.x.damages);
406 ee->engine.x.damages = NULL;
407 }
408 evas_render_updates_free(updates);
409 _ecore_evas_idle_timeout_update(ee);
410 rend = 1;
411 }
412 }
413 }
414 else if (((ee->visible) && (ee->draw_ok)) ||
415 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
416 ((ee->should_be_visible) && (ee->prop.override)))
417 {
418 if (updates)
419 {
420 if (ee->shaped)
421 {
422#ifdef EVAS_FRAME_QUEUING
423 evas_sync(ee->evas);
424#endif
425 ecore_x_window_shape_mask_set(ee->prop.window,
426 ee->engine.x.mask);
427 }
428 if (ee->alpha)
429 {
430#ifdef EVAS_FRAME_QUEUING
431 /* wait until ee->engine.x.mask being updated */
432// evas_sync(ee->evas);
433#endif
434// ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask);
435 }
436 evas_render_updates_free(updates);
437 _ecore_evas_idle_timeout_update(ee);
438 rend = 1;
439 }
440 }
441 else
442 evas_norender(ee->evas);
443 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
444/*
445 if (rend)
446 {
447 static int frames = 0;
448 static double t0 = 0.0;
449 double t, td;
450
451 t = ecore_time_get();
452 frames++;
453 if ((t - t0) > 1.0)
454 {
455 td = t - t0;
456 printf("FPS: %3.3f\n", (double)frames / td);
457 frames = 0;
458 t0 = t;
459 }
460 }
461 */
462
463 return rend;
464}
465
466static void
467_ecore_evas_x_resize_shape(Ecore_Evas *ee)
468{
469 if (!strcmp(ee->driver, "software_x11"))
470 {
471#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
472 Evas_Engine_Info_Software_X11 *einfo;
473
474 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
475 if (einfo)
476 {
477 unsigned int foreground;
478 Ecore_X_GC gc;
479
480 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
481 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
482 foreground = 0;
483 gc = ecore_x_gc_new(ee->engine.x.mask,
484 ECORE_X_GC_VALUE_MASK_FOREGROUND,
485 &foreground);
486 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
487 0, 0, ee->w, ee->h);
488 ecore_x_gc_free(gc);
489 einfo->info.mask = ee->engine.x.mask;
490 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
491 {
492 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
493 }
494 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
495 }
496#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
497 }
498 else if (!strcmp(ee->driver, "software_16_x11"))
499 {
500#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
501# if 0 /* XXX no shaped window support for software_16_x11 */
502 Evas_Engine_Info_Software_16_X11 *einfo;
503
504 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
505 if (einfo)
506 {
507 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
508 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
509 einfo->info.mask = ee->engine.x.mask;
510 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
511 {
512 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
513 }
514 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
515 }
516# endif /* XXX no shaped window support for software_16_x11 */
517#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
518 }
519 if (!strcmp(ee->driver, "software_8_x11"))
520 {
521#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
522 Evas_Engine_Info_Software_8_X11 *einfo;
523
524 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
525 if (einfo)
526 {
527 unsigned int foreground;
528 Ecore_X_GC gc;
529
530 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
531 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
532 foreground = 0;
533 gc = ecore_x_gc_new(ee->engine.x.mask,
534 ECORE_X_GC_VALUE_MASK_FOREGROUND,
535 &foreground);
536 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
537 0, 0, ee->w, ee->h);
538 ecore_x_gc_free(gc);
539 einfo->info.mask = ee->engine.x.mask;
540 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
541 {
542 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
543 }
544 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
545 }
546#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
547 }
548}
549
550/* TODO: we need to make this work for all the states, not just sticky */
551static Eina_Bool
552_ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event)
553{
554 Ecore_Evas *ee;
555 Ecore_X_Event_Window_Property *e;
556 int state_change = 0;
557
558 e = event;
559 ee = ecore_event_window_match(e->win);
560 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
561 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
562 if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
563 {
564 unsigned int i, num;
565 Ecore_X_Window_State *state;
566 struct {
567 struct {
568 unsigned char modal : 1;
569 unsigned char sticky : 1;
570 unsigned char maximized_v : 1;
571 unsigned char maximized_h : 1;
572 unsigned char shaded : 1;
573 unsigned char skip_taskbar : 1;
574 unsigned char skip_pager : 1;
575 unsigned char fullscreen : 1;
576 unsigned char above : 1;
577 unsigned char below : 1;
578 } x;
579 struct {
580 char modal : 1;
581 char maximized : 1;
582 char sticky : 1;
583 char fullscreen : 1;
584 char focus_skip : 1;
585 } prop;
586 } prev;
587
588 prev.x.modal = ee->engine.x.state.modal;
589 prev.x.sticky = ee->engine.x.state.sticky;
590 prev.x.maximized_v = ee->engine.x.state.maximized_v;
591 prev.x.maximized_h = ee->engine.x.state.maximized_h;
592 prev.x.shaded = ee->engine.x.state.shaded;
593 prev.x.skip_taskbar = ee->engine.x.state.skip_taskbar;
594 prev.x.skip_pager = ee->engine.x.state.skip_pager;
595 prev.x.fullscreen = ee->engine.x.state.fullscreen;
596 prev.x.above = ee->engine.x.state.above;
597 prev.x.below = ee->engine.x.state.below;
598
599 prev.prop.modal = ee->prop.modal;
600 prev.prop.maximized = ee->prop.maximized;
601 prev.prop.sticky = ee->prop.sticky;
602 prev.prop.fullscreen = ee->prop.fullscreen;
603 prev.prop.focus_skip = ee->prop.focus_skip;
604
605 ee->engine.x.state.modal = 0;
606 ee->engine.x.state.sticky = 0;
607 ee->engine.x.state.maximized_v = 0;
608 ee->engine.x.state.maximized_h = 0;
609 ee->engine.x.state.shaded = 0;
610 ee->engine.x.state.skip_taskbar = 0;
611 ee->engine.x.state.skip_pager = 0;
612 ee->engine.x.state.fullscreen = 0;
613 ee->engine.x.state.above = 0;
614 ee->engine.x.state.below = 0;
615
616 ee->prop.modal = 0;
617 ee->prop.maximized = 0;
618 ee->prop.sticky = 0;
619 ee->prop.fullscreen = 0;
620 ee->prop.focus_skip = 0;
621
622 ecore_x_netwm_window_state_get(e->win, &state, &num);
623 if (state)
624 {
625 for (i = 0; i < num; i++)
626 {
627 switch (state[i])
628 {
629 case ECORE_X_WINDOW_STATE_MODAL:
630 ee->engine.x.state.modal = 1;
631 ee->prop.modal = 1;
632 break;
633 case ECORE_X_WINDOW_STATE_STICKY:
634 ee->prop.sticky = 1;
635 ee->engine.x.state.sticky = 1;
636 break;
637 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
638 ee->engine.x.state.maximized_v = 1;
639 ee->prop.maximized = 1;
640 break;
641 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
642 ee->engine.x.state.maximized_h = 1;
643 ee->prop.maximized = 1;
644 break;
645 case ECORE_X_WINDOW_STATE_SHADED:
646 ee->engine.x.state.shaded = 1;
647 break;
648 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
649 ee->engine.x.state.skip_taskbar = 1;
650 ee->prop.focus_skip = 1;
651 break;
652 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
653 ee->engine.x.state.skip_pager = 1;
654 ee->prop.focus_skip = 1;
655 break;
656 case ECORE_X_WINDOW_STATE_FULLSCREEN:
657 ee->prop.fullscreen = 1;
658 ee->engine.x.state.fullscreen = 1;
659 break;
660 case ECORE_X_WINDOW_STATE_ABOVE:
661 ee->engine.x.state.above = 1;
662 break;
663 case ECORE_X_WINDOW_STATE_BELOW:
664 ee->engine.x.state.below = 1;
665 break;
666 default:
667 break;
668 }
669 }
670 free(state);
671 }
672 if (
673// (prev.x.modal != ee->engine.x.state.modal) ||
674 (prev.x.sticky != ee->engine.x.state.sticky) ||
675 (prev.x.maximized_v != ee->engine.x.state.maximized_v) ||
676 (prev.x.maximized_h != ee->engine.x.state.maximized_h) ||
677// (prev.x.shaded != ee->engine.x.state.shaded) ||
678// (prev.x.skip_taskbar != ee->engine.x.state.skip_taskbar) ||
679// (prev.x.skip_pager != ee->engine.x.state.skip_pager) ||
680 (prev.x.fullscreen != ee->engine.x.state.fullscreen) ||
681// (prev.x.above != ee->engine.x.state.above) ||
682// (prev.x.below != ee->engine.x.state.below) ||
683// (prev.prop.modal != ee->prop.modal) ||
684 (prev.prop.maximized != ee->prop.maximized) ||
685 (prev.prop.sticky != ee->prop.sticky) ||
686 (prev.prop.fullscreen != ee->prop.fullscreen) ||
687 (prev.prop.focus_skip != ee->prop.focus_skip))
688 state_change = 1;
689 }
690 else if (e->atom == ECORE_X_ATOM_WM_STATE)
691 {
692 Ecore_X_Window_State_Hint state;
693
694 // handle WM_STATE changes
695 state = ecore_x_icccm_state_get(e->win);
696 switch (state)
697 {
698 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
699 if ((!ee->prop.withdrawn) || (ee->prop.iconified))
700 {
701 state_change = 1;
702 ee->prop.withdrawn = 1;
703 ee->prop.iconified = 0;
704 }
705 break;
706 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
707 if ((!ee->prop.iconified) || (ee->prop.withdrawn))
708 {
709 state_change = 1;
710 ee->prop.iconified = 1;
711 ee->prop.withdrawn = 0;
712 }
713 break;
714 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
715 if ((ee->prop.iconified) || (ee->prop.withdrawn))
716 {
717 state_change = 1;
718 ee->prop.iconified = 0;
719 ee->prop.withdrawn = 0;
720 }
721 break;
722 default:
723 break;
724 }
725 }
726 if (state_change)
727 {
728 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
729 }
730
731 return ECORE_CALLBACK_PASS_ON;
732}
733
734static Eina_Bool
735_ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event)
736{
737 Ecore_Evas *ee;
738 Ecore_X_Event_Window_Visibility_Change *e;
739
740 e = event;
741 ee = ecore_event_window_match(e->win);
742 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
743 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
744// printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured);
745 if (e->fully_obscured)
746 {
747 /* FIXME: round trip */
748 if (!ecore_x_screen_is_composited(ee->engine.x.screen_num))
749 ee->draw_ok = 0;
750 }
751 else
752 ee->draw_ok = 1;
753 return ECORE_CALLBACK_PASS_ON;
754}
755
756static Eina_Bool
757_ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event)
758{
759 Ecore_Evas *ee;
760 Ecore_X_Event_Client_Message *e;
761
762 e = event;
763 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
764 if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN)
765 {
766 ee = ecore_event_window_match(e->data.l[0]);
767 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
768 if (e->data.l[0] != (long)ee->prop.window)
769 return ECORE_CALLBACK_PASS_ON;
770 if (!ee->engine.x.sync_began)
771 {
772 // qeue a damage + draw. work around an event re-ordering thing.
773 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
774 }
775 ee->engine.x.sync_began = 1;
776 ee->engine.x.sync_cancel = 0;
777 }
778 else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END)
779 {
780 ee = ecore_event_window_match(e->data.l[0]);
781 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
782 if (e->data.l[0] != (long)ee->prop.window)
783 return ECORE_CALLBACK_PASS_ON;
784 ee->engine.x.sync_began = 0;
785 ee->engine.x.sync_cancel = 0;
786 }
787 else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL)
788 {
789 ee = ecore_event_window_match(e->data.l[0]);
790 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
791 if (e->data.l[0] != (long)ee->prop.window)
792 return ECORE_CALLBACK_PASS_ON;
793 ee->engine.x.sync_began = 0;
794 ee->engine.x.sync_cancel = 1;
795 }
796 else if ((e->message_type == ECORE_X_ATOM_WM_PROTOCOLS) &&
797 (e->data.l[0] == (int)ECORE_X_ATOM_NET_WM_SYNC_REQUEST))
798 {
799 ee = ecore_event_window_match(e->win);
800 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
801 ee->engine.x.netwm_sync_val_lo = (unsigned int)e->data.l[2];
802 ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3];
803 ee->engine.x.netwm_sync_set = 1;
804 }
805 return ECORE_CALLBACK_PASS_ON;
806}
807
808static Eina_Bool
809_ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
810{
811 Ecore_Evas *ee;
812 Ecore_X_Event_Mouse_In *e;
813
814 e = event;
815 ee = ecore_event_window_match(e->win);
816 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
817 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
818/* { */
819/* time_t t; */
820/* char *ct; */
821
822/* const char *modes[] = { */
823/* "MODE_NORMAL", */
824/* "MODE_WHILE_GRABBED", */
825/* "MODE_GRAB", */
826/* "MODE_UNGRAB" */
827/* }; */
828/* const char *details[] = { */
829/* "DETAIL_ANCESTOR", */
830/* "DETAIL_VIRTUAL", */
831/* "DETAIL_INFERIOR", */
832/* "DETAIL_NON_LINEAR", */
833/* "DETAIL_NON_LINEAR_VIRTUAL", */
834/* "DETAIL_POINTER", */
835/* "DETAIL_POINTER_ROOT", */
836/* "DETAIL_DETAIL_NONE" */
837/* }; */
838/* t = time(NULL); */
839/* ct = ctime(&t); */
840/* ct[strlen(ct) - 1] = 0; */
841/* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */
842/* e->win, e->event_win, */
843/* ct, */
844/* modes[e->mode], */
845/* details[e->detail]); */
846/* } */
847 // disable. causes more problems than it fixes
848 // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
849 // (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
850 // return 0;
851 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
852 if (!ee->in)
853 {
854 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
855 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
856 evas_event_feed_mouse_in(ee->evas, e->time, NULL);
857 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
858 ee->in = EINA_TRUE;
859 }
860 return ECORE_CALLBACK_PASS_ON;
861}
862
863static Eina_Bool
864_ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
865{
866 Ecore_Evas *ee;
867 Ecore_X_Event_Mouse_Out *e;
868
869 e = event;
870 ee = ecore_event_window_match(e->win);
871 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
872 /* pass on event */
873 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
874/* { */
875/* time_t t; */
876/* char *ct; */
877
878/* const char *modes[] = { */
879/* "MODE_NORMAL", */
880/* "MODE_WHILE_GRABBED", */
881/* "MODE_GRAB", */
882/* "MODE_UNGRAB" */
883/* }; */
884/* const char *details[] = { */
885/* "DETAIL_ANCESTOR", */
886/* "DETAIL_VIRTUAL", */
887/* "DETAIL_INFERIOR", */
888/* "DETAIL_NON_LINEAR", */
889/* "DETAIL_NON_LINEAR_VIRTUAL", */
890/* "DETAIL_POINTER", */
891/* "DETAIL_POINTER_ROOT", */
892/* "DETAIL_DETAIL_NONE" */
893/* }; */
894/* t = time(NULL); */
895/* ct = ctime(&t); */
896/* ct[strlen(ct) - 1] = 0; */
897/* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */
898/* e->win, e->event_win, */
899/* ct, */
900/* modes[e->mode], */
901/* details[e->detail]); */
902/* } */
903 // disable. causes more problems than it fixes
904 // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
905 // (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
906 // return 0;
907 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
908// printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n",
909// ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas));
910 if (ee->in)
911 {
912 if ((evas_event_down_count_get(ee->evas) > 0) &&
913 (!((e->mode == ECORE_X_EVENT_MODE_GRAB) &&
914 (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR))))
915 return ECORE_CALLBACK_PASS_ON;
916 ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
917 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
918 if (e->mode == ECORE_X_EVENT_MODE_GRAB)
919 evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
920 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
921 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
922 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
923 ee->in = EINA_FALSE;
924 }
925 return ECORE_CALLBACK_PASS_ON;
926}
927
928static Eina_Bool
929_ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
930{
931 Ecore_Evas *ee;
932 Ecore_X_Event_Window_Focus_In *e;
933
934 e = event;
935 ee = ecore_event_window_match(e->win);
936 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
937 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
938//xx// filtering with these doesnt help
939//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON;
940 ee->prop.focused = 1;
941 evas_focus_in(ee->evas);
942 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
943 return ECORE_CALLBACK_PASS_ON;
944}
945
946static Eina_Bool
947_ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
948{
949 Ecore_Evas *ee;
950 Ecore_X_Event_Window_Focus_Out *e;
951
952 e = event;
953 ee = ecore_event_window_match(e->win);
954 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
955 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
956//xx// filtering with these doesnt help
957//xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON;
958
959// if (ee->prop.fullscreen)
960// ecore_x_window_focus(ee->prop.window);
961 evas_focus_out(ee->evas);
962 ee->prop.focused = 0;
963 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
964 return ECORE_CALLBACK_PASS_ON;
965}
966
967static Eina_Bool
968_ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
969{
970 Ecore_Evas *ee;
971 Ecore_X_Event_Window_Damage *e;
972
973 e = event;
974 ee = ecore_event_window_match(e->win);
975 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
976 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
977 if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON;
978// printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h);
979 if (ee->prop.avoid_damage)
980 {
981 Ecore_X_Rectangle rect;
982 Ecore_X_XRegion *tmpr;
983
984 if (!ee->engine.x.damages)
985 ee->engine.x.damages = ecore_x_xregion_new();
986 tmpr = ecore_x_xregion_new();
987 rect.x = e->x;
988 rect.y = e->y;
989 rect.width = e->w;
990 rect.height = e->h;
991 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
992 ecore_x_xregion_free(ee->engine.x.damages);
993 ee->engine.x.damages = tmpr;
994/* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see
995 * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID
996 Ecore_X_Rectangle rect;
997 Ecore_X_XRegion *tmpr;
998
999 if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new();
1000 tmpr = ecore_x_xregion_new();
1001 rect.x = e->x;
1002 rect.y = e->y;
1003 rect.width = e->w;
1004 rect.height = e->h;
1005 ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect);
1006 ecore_x_xregion_free(ee->engine.x.damages);
1007 ee->engine.x.damages = tmpr;
1008 */
1009 }
1010 else
1011 {
1012 if (ee->rotation == 0)
1013 evas_damage_rectangle_add(ee->evas, e->x, e->y, e->w, e->h);
1014 else if (ee->rotation == 90)
1015 evas_damage_rectangle_add(ee->evas,
1016 ee->h - e->y - e->h, e->x, e->h, e->w);
1017 else if (ee->rotation == 180)
1018 evas_damage_rectangle_add(ee->evas, ee->w - e->x - e->w,
1019 ee->h - e->y - e->h, e->w, e->h);
1020 else if (ee->rotation == 270)
1021 evas_damage_rectangle_add(ee->evas, e->y, ee->w - e->x - e->w,
1022 e->h, e->w);
1023 }
1024 return ECORE_CALLBACK_PASS_ON;
1025}
1026
1027static Eina_Bool
1028_ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
1029{
1030 Ecore_Evas *ee;
1031 Ecore_X_Event_Window_Destroy *e;
1032
1033 e = event;
1034 ee = ecore_event_window_match(e->win);
1035 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1036 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1037 if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
1038 _ecore_evas_x_sync_clear(ee);
1039 ecore_evas_free(ee);
1040 return ECORE_CALLBACK_PASS_ON;
1041}
1042
1043static Eina_Bool
1044_ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
1045{
1046 Ecore_Evas *ee;
1047 Ecore_X_Event_Window_Configure *e;
1048
1049 e = event;
1050 ee = ecore_event_window_match(e->win);
1051 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1052 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1053 if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON;
1054
1055 ee->engine.x.configure_coming = 0;
1056 if ((e->from_wm) || (ee->prop.override))
1057 {
1058 if ((ee->x != e->x) || (ee->y != e->y))
1059 {
1060 ee->x = e->x;
1061 ee->y = e->y;
1062 ee->req.x = ee->x;
1063 ee->req.y = ee->y;
1064 if (ee->func.fn_move) ee->func.fn_move(ee);
1065 }
1066 }
1067 if ((ee->w != e->w) || (ee->h != e->h))
1068 {
1069 ee->w = e->w;
1070 ee->h = e->h;
1071 ee->req.w = ee->w;
1072 ee->req.h = ee->h;
1073 if ((ee->rotation == 90) || (ee->rotation == 270))
1074 {
1075 evas_output_size_set(ee->evas, ee->h, ee->w);
1076 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1077 }
1078 else
1079 {
1080 evas_output_size_set(ee->evas, ee->w, ee->h);
1081 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1082 }
1083 if (ee->prop.avoid_damage)
1084 {
1085 int pdam;
1086
1087 pdam = ecore_evas_avoid_damage_get(ee);
1088 ecore_evas_avoid_damage_set(ee, 0);
1089 ecore_evas_avoid_damage_set(ee, pdam);
1090 }
1091 if ((ee->shaped) || (ee->alpha))
1092 _ecore_evas_x_resize_shape(ee);
1093 if ((ee->expecting_resize.w > 0) && (ee->expecting_resize.h > 0))
1094 {
1095 if ((ee->expecting_resize.w == ee->w) &&
1096 (ee->expecting_resize.h == ee->h))
1097 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1098 ecore_x_current_time_get());
1099 ee->expecting_resize.w = 0;
1100 ee->expecting_resize.h = 0;
1101 }
1102 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1103 }
1104 return ECORE_CALLBACK_PASS_ON;
1105}
1106
1107static Eina_Bool
1108_ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
1109{
1110 Ecore_Evas *ee;
1111 Ecore_X_Event_Window_Delete_Request *e;
1112
1113 e = event;
1114 ee = ecore_event_window_match(e->win);
1115 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1116 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1117 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
1118 return ECORE_CALLBACK_PASS_ON;
1119}
1120
1121static Eina_Bool
1122_ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
1123{
1124 Ecore_Evas *ee;
1125 Ecore_X_Event_Window_Show *e;
1126 static int first_map_bug = -1;
1127
1128 e = event;
1129 ee = ecore_event_window_match(e->win);
1130 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1131 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1132 if (first_map_bug < 0)
1133 {
1134 char *bug = NULL;
1135
1136 if ((bug = getenv("ECORE_EVAS_GL_FIRST_MAP_BUG")))
1137 first_map_bug = atoi(bug);
1138 else
1139 first_map_bug = 0;
1140 }
1141 if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11")))
1142 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1143 if (ee->visible) return ECORE_CALLBACK_PASS_ON;
1144// if (ee->visible) return ECORE_CALLBACK_DONE;
1145// printf("SHOW EVENT %p\n", ee);
1146 ee->visible = 1;
1147 if (ee->func.fn_show) ee->func.fn_show(ee);
1148 return ECORE_CALLBACK_PASS_ON;
1149}
1150
1151static Eina_Bool
1152_ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
1153{
1154 Ecore_Evas *ee;
1155 Ecore_X_Event_Window_Hide *e;
1156
1157 e = event;
1158 ee = ecore_event_window_match(e->win);
1159 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
1160 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1161 if (ee->in)
1162 {
1163 evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
1164 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
1165 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
1166 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
1167 ee->in = EINA_FALSE;
1168 }
1169 if (!ee->visible) return ECORE_CALLBACK_PASS_ON;
1170// if (!ee->visible) return ECORE_CALLBACK_DONE;
1171// printf("HIDE EVENT %p\n", ee);
1172 ee->visible = 0;
1173 if (ee->func.fn_hide) ee->func.fn_hide(ee);
1174 return ECORE_CALLBACK_PASS_ON;
1175}
1176
1177/* FIXME, should be in idler */
1178/* FIXME, round trip */
1179static void
1180_ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee)
1181{
1182 ecore_x_icccm_size_pos_hints_set(ee->prop.window,
1183 ee->prop.request_pos /*request_pos */,
1184 ECORE_X_GRAVITY_NW /* gravity */,
1185 ee->prop.min.w /* min_w */,
1186 ee->prop.min.h /* min_h */,
1187 ee->prop.max.w /* max_w */,
1188 ee->prop.max.h /* max_h */,
1189 ee->prop.base.w /* base_w */,
1190 ee->prop.base.h /* base_h */,
1191 ee->prop.step.w /* step_x */,
1192 ee->prop.step.h /* step_y */,
1193 ee->prop.aspect /* min_aspect */,
1194 ee->prop.aspect /* max_aspect */);
1195}
1196
1197/* FIXME, should be in idler */
1198static void
1199_ecore_evas_x_state_update(Ecore_Evas *ee)
1200{
1201 Ecore_X_Window_State state[10];
1202 int num = 0;
1203
1204 if (ee->prop.modal)
1205 state[num++] = ECORE_X_WINDOW_STATE_MODAL;
1206 if (ee->prop.sticky)
1207 state[num++] = ECORE_X_WINDOW_STATE_STICKY;
1208 if (ee->prop.maximized)
1209 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
1210 if (ee->prop.maximized)
1211 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
1212// if (bd->client.netwm.state.shaded)
1213// state[num++] = ECORE_X_WINDOW_STATE_SHADED;
1214 if (ee->prop.focus_skip)
1215 state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
1216 if (ee->prop.focus_skip)
1217 state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
1218// if (bd->client.netwm.state.hidden)
1219// state[num++] = ECORE_X_WINDOW_STATE_HIDDEN;
1220 if (ee->engine.x.state.fullscreen)
1221 state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
1222 if (ee->engine.x.state.above)
1223 state[num++] = ECORE_X_WINDOW_STATE_ABOVE;
1224 if (ee->engine.x.state.below)
1225 state[num++] = ECORE_X_WINDOW_STATE_BELOW;
1226 if (ee->prop.demand_attention)
1227 state[num++] = ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
1228
1229 ecore_x_netwm_window_state_set(ee->prop.window, state, num);
1230}
1231
1232static void
1233_ecore_evas_x_layer_update(Ecore_Evas *ee)
1234{
1235 if (ee->should_be_visible)
1236 {
1237 /* We need to send a netwm request to the wm */
1238 /* FIXME: Do we have to remove old state before adding new? */
1239 if (ee->prop.layer < 3)
1240 {
1241 if (ee->engine.x.state.above)
1242 {
1243 ee->engine.x.state.above = 0;
1244 ecore_x_netwm_state_request_send(ee->prop.window,
1245 ee->engine.x.win_root,
1246 ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
1247 }
1248 if (!ee->engine.x.state.below)
1249 {
1250 ee->engine.x.state.below = 1;
1251 ecore_x_netwm_state_request_send(ee->prop.window,
1252 ee->engine.x.win_root,
1253 ECORE_X_WINDOW_STATE_BELOW, -1, 1);
1254 }
1255 }
1256 else if (ee->prop.layer > 5)
1257 {
1258 if (ee->engine.x.state.below)
1259 {
1260 ee->engine.x.state.below = 0;
1261 ecore_x_netwm_state_request_send(ee->prop.window,
1262 ee->engine.x.win_root,
1263 ECORE_X_WINDOW_STATE_BELOW, -1, 0);
1264 }
1265 if (!ee->engine.x.state.above)
1266 {
1267 ee->engine.x.state.above = 1;
1268 ecore_x_netwm_state_request_send(ee->prop.window,
1269 ee->engine.x.win_root,
1270 ECORE_X_WINDOW_STATE_ABOVE, -1, 1);
1271 }
1272 }
1273 else
1274 {
1275 if (ee->engine.x.state.below)
1276 {
1277 ee->engine.x.state.below = 0;
1278 ecore_x_netwm_state_request_send(ee->prop.window,
1279 ee->engine.x.win_root,
1280 ECORE_X_WINDOW_STATE_BELOW, -1, 0);
1281 }
1282 if (ee->engine.x.state.above)
1283 {
1284 ee->engine.x.state.above = 0;
1285 ecore_x_netwm_state_request_send(ee->prop.window,
1286 ee->engine.x.win_root,
1287 ECORE_X_WINDOW_STATE_ABOVE, -1, 0);
1288 }
1289 }
1290 }
1291 else
1292 {
1293 /* Just set the state */
1294 if (ee->prop.layer < 3)
1295 {
1296 if ((ee->engine.x.state.above) || (!ee->engine.x.state.below))
1297 {
1298 ee->engine.x.state.above = 0;
1299 ee->engine.x.state.below = 1;
1300 _ecore_evas_x_state_update(ee);
1301 }
1302 }
1303 else if (ee->prop.layer > 5)
1304 {
1305 if ((!ee->engine.x.state.above) || (ee->engine.x.state.below))
1306 {
1307 ee->engine.x.state.above = 1;
1308 ee->engine.x.state.below = 0;
1309 _ecore_evas_x_state_update(ee);
1310 }
1311 }
1312 else
1313 {
1314 if ((ee->engine.x.state.above) || (ee->engine.x.state.below))
1315 {
1316 ee->engine.x.state.above = 0;
1317 ee->engine.x.state.below = 0;
1318 _ecore_evas_x_state_update(ee);
1319 }
1320 }
1321 }
1322 /* FIXME: Set gnome layer */
1323}
1324
1325static int
1326_ecore_evas_x_init(void)
1327{
1328 _ecore_evas_init_count++;
1329 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
1330 ecore_evas_event_handlers[0] =
1331 ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN,
1332 _ecore_evas_x_event_mouse_in, NULL);
1333 ecore_evas_event_handlers[1] =
1334 ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
1335 _ecore_evas_x_event_mouse_out, NULL);
1336 ecore_evas_event_handlers[2] =
1337 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN,
1338 _ecore_evas_x_event_window_focus_in, NULL);
1339 ecore_evas_event_handlers[3] =
1340 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT,
1341 _ecore_evas_x_event_window_focus_out, NULL);
1342 ecore_evas_event_handlers[4] =
1343 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE,
1344 _ecore_evas_x_event_window_damage, NULL);
1345 ecore_evas_event_handlers[5] =
1346 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY,
1347 _ecore_evas_x_event_window_destroy, NULL);
1348 ecore_evas_event_handlers[6] =
1349 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE,
1350 _ecore_evas_x_event_window_configure, NULL);
1351 ecore_evas_event_handlers[7] =
1352 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
1353 _ecore_evas_x_event_window_delete_request, NULL);
1354 ecore_evas_event_handlers[8] =
1355 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW,
1356 _ecore_evas_x_event_window_show, NULL);
1357 ecore_evas_event_handlers[9] =
1358 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE,
1359 _ecore_evas_x_event_window_hide, NULL);
1360 ecore_evas_event_handlers[10] =
1361 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY,
1362 _ecore_evas_x_event_property_change, NULL);
1363 ecore_evas_event_handlers[11] =
1364 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE,
1365 _ecore_evas_x_event_visibility_change, NULL);
1366 ecore_evas_event_handlers[12] =
1367 ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
1368 _ecore_evas_x_event_client_message, NULL);
1369 ecore_event_evas_init();
1370 return _ecore_evas_init_count;
1371}
1372
1373static void
1374_ecore_evas_x_free(Ecore_Evas *ee)
1375{
1376 _ecore_evas_x_group_leader_unset(ee);
1377 _ecore_evas_x_sync_set(ee);
1378 if (ee->engine.x.win_shaped_input)
1379 ecore_x_window_free(ee->engine.x.win_shaped_input);
1380 ecore_x_window_free(ee->prop.window);
1381 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
1382 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1383 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
1384 if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages);
1385 ee->engine.x.pmap = 0;
1386 ee->engine.x.mask = 0;
1387 ee->engine.x.gc = 0;
1388 ee->engine.x.damages = NULL;
1389 ecore_event_window_unregister(ee->prop.window);
1390 while (ee->engine.x.win_extra)
1391 {
1392 Ecore_X_Window *winp;
1393
1394 winp = ee->engine.x.win_extra->data;
1395 ee->engine.x.win_extra =
1396 eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra);
1397 ecore_event_window_unregister(*winp);
1398 free(winp);
1399 }
1400 _ecore_evas_x_shutdown();
1401 ecore_x_shutdown();
1402}
1403
1404static void
1405_ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1406{
1407 ee->func.fn_delete_request = func;
1408 _ecore_evas_x_protocols_set(ee);
1409 _ecore_evas_x_sync_set(ee);
1410}
1411
1412static void
1413_ecore_evas_x_move(Ecore_Evas *ee, int x, int y)
1414{
1415 ee->req.x = x;
1416 ee->req.y = y;
1417 if (ee->engine.x.direct_resize)
1418 {
1419 if (!ee->engine.x.managed)
1420 {
1421 if ((x != ee->x) || (y != ee->y))
1422 {
1423 ee->x = x;
1424 ee->y = y;
1425 ecore_x_window_move(ee->prop.window, x, y);
1426 if (!ee->should_be_visible)
1427 {
1428 /* We need to request pos */
1429 ee->prop.request_pos = 1;
1430 _ecore_evas_x_size_pos_hints_update(ee);
1431 }
1432 if (ee->func.fn_move) ee->func.fn_move(ee);
1433 }
1434 }
1435 }
1436 else
1437 {
1438 if (((ee->x != x) || (ee->y != y)) ||
1439 (ee->engine.x.configure_coming))
1440 {
1441 ee->engine.x.configure_coming = 1;
1442 if (!ee->engine.x.managed)
1443 {
1444 ee->x = x;
1445 ee->y = y;
1446 }
1447 ecore_x_window_move(ee->prop.window, x, y);
1448 }
1449 if (!ee->should_be_visible)
1450 {
1451 /* We need to request pos */
1452 ee->prop.request_pos = 1;
1453 _ecore_evas_x_size_pos_hints_update(ee);
1454 }
1455 }
1456}
1457
1458static void
1459_ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y)
1460{
1461 ee->req.x = x;
1462 ee->req.y = y;
1463 if (ee->engine.x.direct_resize)
1464 {
1465 ee->engine.x.managed = 1;
1466 if ((x != ee->x) || (y != ee->y))
1467 {
1468 ee->x = x;
1469 ee->y = y;
1470 if (ee->func.fn_move) ee->func.fn_move(ee);
1471 }
1472 }
1473}
1474
1475static void
1476_ecore_evas_x_resize(Ecore_Evas *ee, int w, int h)
1477{
1478 ee->req.w = w;
1479 ee->req.h = h;
1480 if (ee->engine.x.direct_resize)
1481 {
1482 if ((ee->w != w) || (ee->h != h))
1483 {
1484 ee->w = w;
1485 ee->h = h;
1486 ecore_x_window_resize(ee->prop.window, w, h);
1487 if ((ee->rotation == 90) || (ee->rotation == 270))
1488 {
1489 evas_output_size_set(ee->evas, ee->h, ee->w);
1490 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1491 }
1492 else
1493 {
1494 evas_output_size_set(ee->evas, ee->w, ee->h);
1495 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1496 }
1497 if (ee->prop.avoid_damage)
1498 {
1499 int pdam;
1500
1501 pdam = ecore_evas_avoid_damage_get(ee);
1502 ecore_evas_avoid_damage_set(ee, 0);
1503 ecore_evas_avoid_damage_set(ee, pdam);
1504 }
1505 if ((ee->shaped) || (ee->alpha))
1506 _ecore_evas_x_resize_shape(ee);
1507 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1508 }
1509 }
1510 else if (((ee->w != w) || (ee->h != h)) ||
1511 (ee->engine.x.configure_coming))
1512 {
1513 ee->engine.x.configure_coming = 1;
1514 ecore_x_window_resize(ee->prop.window, w, h);
1515 }
1516}
1517
1518static void
1519_ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1520{
1521 ee->req.x = x;
1522 ee->req.y = y;
1523 ee->req.w = w;
1524 ee->req.h = h;
1525 if (ee->engine.x.direct_resize)
1526 {
1527 if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y))
1528 {
1529 int change_size = 0, change_pos = 0;
1530
1531 if ((ee->w != w) || (ee->h != h)) change_size = 1;
1532 if (!ee->engine.x.managed)
1533 {
1534 if ((x != ee->x) || (y != ee->y)) change_pos = 1;
1535 }
1536 ecore_x_window_move_resize(ee->prop.window, x, y, w, h);
1537 if (!ee->engine.x.managed)
1538 {
1539 ee->x = x;
1540 ee->y = y;
1541 }
1542 ee->w = w;
1543 ee->h = h;
1544 if ((ee->rotation == 90) || (ee->rotation == 270))
1545 {
1546 evas_output_size_set(ee->evas, ee->h, ee->w);
1547 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1548 }
1549 else
1550 {
1551 evas_output_size_set(ee->evas, ee->w, ee->h);
1552 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1553 }
1554 if (ee->prop.avoid_damage)
1555 {
1556 int pdam;
1557
1558 pdam = ecore_evas_avoid_damage_get(ee);
1559 ecore_evas_avoid_damage_set(ee, 0);
1560 ecore_evas_avoid_damage_set(ee, pdam);
1561 }
1562 if ((ee->shaped) || (ee->alpha))
1563 _ecore_evas_x_resize_shape(ee);
1564 if (change_pos)
1565 {
1566 if (ee->func.fn_move) ee->func.fn_move(ee);
1567 }
1568 if (change_size)
1569 {
1570 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1571 }
1572 }
1573 }
1574 else if (((ee->w != w) || (ee->h != h) || (ee->x != x) || (ee->y != y)) ||
1575 (ee->engine.x.configure_coming))
1576 {
1577 ee->engine.x.configure_coming = 1;
1578 ecore_x_window_move_resize(ee->prop.window, x, y, w, h);
1579 if (!ee->engine.x.managed)
1580 {
1581 ee->x = x;
1582 ee->y = y;
1583 }
1584 }
1585}
1586
1587static void
1588_ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
1589 Evas_Engine_Info *einfo)
1590{
1591 int rot_dif;
1592
1593 rot_dif = ee->rotation - rotation;
1594 if (rot_dif < 0) rot_dif = -rot_dif;
1595
1596 if (rot_dif != 180)
1597 {
1598 int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
1599
1600 if (!evas_engine_info_set(ee->evas, einfo))
1601 {
1602 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1603 }
1604
1605 if (!resize)
1606 {
1607 ee->engine.x.configure_coming = 1;
1608 if (!ee->prop.fullscreen)
1609 {
1610 ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w);
1611 ee->expecting_resize.w = ee->h;
1612 ee->expecting_resize.h = ee->w;
1613 }
1614 else
1615 {
1616 int w, h;
1617
1618 ecore_x_window_size_get(ee->prop.window, &w, &h);
1619 ecore_x_window_resize(ee->prop.window, h, w);
1620 if ((rotation == 0) || (rotation == 180))
1621 {
1622 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
1623 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
1624 }
1625 else
1626 {
1627 evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
1628 evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w);
1629 }
1630 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1631 }
1632 if ((ee->rotation == 90) || (ee->rotation == 270))
1633 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
1634 else
1635 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1636 }
1637 else
1638 {
1639 /* int w, h; */
1640
1641 /* ecore_x_window_size_get(ee->prop.window, &w, &h); */
1642 if ((rotation == 0) || (rotation == 180))
1643 {
1644 evas_output_size_set(ee->evas, ee->w, ee->h);
1645 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
1646 }
1647 else
1648 {
1649 evas_output_size_set(ee->evas, ee->h, ee->w);
1650 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
1651 }
1652 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1653 if ((ee->rotation == 90) || (ee->rotation == 270))
1654 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1655 else
1656 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1657 }
1658 ecore_evas_size_min_get(ee, &minw, &minh);
1659 ecore_evas_size_max_get(ee, &maxw, &maxh);
1660 ecore_evas_size_base_get(ee, &basew, &baseh);
1661 ecore_evas_size_step_get(ee, &stepw, &steph);
1662 ee->rotation = rotation;
1663 ecore_evas_size_min_set(ee, minh, minw);
1664 ecore_evas_size_max_set(ee, maxh, maxw);
1665 ecore_evas_size_base_set(ee, baseh, basew);
1666 ecore_evas_size_step_set(ee, steph, stepw);
1667 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1668 ecore_x_current_time_get());
1669 }
1670 else
1671 {
1672 if (!evas_engine_info_set(ee->evas, einfo))
1673 {
1674 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1675 }
1676 ee->rotation = rotation;
1677 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
1678 ecore_x_current_time_get());
1679 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1680
1681 if ((ee->rotation == 90) || (ee->rotation == 270))
1682 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1683 else
1684 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1685 }
1686}
1687
1688static void
1689_ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1690{
1691 int angles[2];
1692 angles[0] = rotation;
1693 angles[1] = ee->rotation;
1694
1695 if (ee->rotation == rotation) return;
1696 if (!strcmp(ee->driver, "opengl_x11"))
1697 {
1698#ifdef BUILD_ECORE_EVAS_OPENGL_X11
1699 Evas_Engine_Info_GL_X11 *einfo;
1700
1701 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
1702 if (!einfo) return;
1703 einfo->info.rotation = rotation;
1704 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1705 (Evas_Engine_Info *)einfo);
1706 ecore_x_window_prop_property_set(ee->prop.window,
1707 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1708 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1709#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
1710 }
1711 else if (!strcmp(ee->driver, "software_x11"))
1712 {
1713#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1714 Evas_Engine_Info_Software_X11 *einfo;
1715
1716 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1717 if (!einfo) return;
1718 einfo->info.rotation = rotation;
1719 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1720 (Evas_Engine_Info *)einfo);
1721 ecore_x_window_prop_property_set(ee->prop.window,
1722 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1723 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1724#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1725 }
1726 else if (!strcmp(ee->driver, "software_16_x11"))
1727 {
1728#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1729 Evas_Engine_Info_Software_16_X11 *einfo;
1730
1731 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1732 if (!einfo) return;
1733 einfo->info.rotation = rotation;
1734 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1735 (Evas_Engine_Info *)einfo);
1736 ecore_x_window_prop_property_set(ee->prop.window,
1737 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1738 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1739#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1740 }
1741 else if (!strcmp(ee->driver, "software_8_x11"))
1742 {
1743#if BUILD_ECORE_EVAS_SOFTWARE_8_X11
1744 Evas_Engine_Info_Software_8_X11 *einfo;
1745
1746 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
1747 if (!einfo) return;
1748 einfo->info.rotation = rotation;
1749 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1750 (Evas_Engine_Info *)einfo);
1751 ecore_x_window_prop_property_set(ee->prop.window,
1752 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1753 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1754#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
1755 }
1756}
1757
1758static void
1759_ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped)
1760{
1761 if ((ee->shaped == shaped)) return;
1762 if (!strcmp(ee->driver, "opengl_x11")) return;
1763 if (!strcmp(ee->driver, "software_x11"))
1764 {
1765#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1766 Evas_Engine_Info_Software_X11 *einfo;
1767
1768 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1769 ee->shaped = shaped;
1770 if (einfo)
1771 {
1772 if (ee->shaped)
1773 {
1774 unsigned int foreground;
1775 Ecore_X_GC gc;
1776
1777 if (!ee->engine.x.mask)
1778 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1779 foreground = 0;
1780 gc = ecore_x_gc_new(ee->engine.x.mask,
1781 ECORE_X_GC_VALUE_MASK_FOREGROUND,
1782 &foreground);
1783 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
1784 0, 0, ee->w, ee->h);
1785 ecore_x_gc_free(gc);
1786 einfo->info.mask = ee->engine.x.mask;
1787 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1788 {
1789 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1790 }
1791 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1792 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1793 }
1794 else
1795 {
1796 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1797 ee->engine.x.mask = 0;
1798 einfo->info.mask = 0;
1799 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1800 {
1801 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1802 }
1803 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1804 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1805 }
1806 }
1807#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1808 }
1809 else if (!strcmp(ee->driver, "software_16_x11"))
1810 {
1811#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
1812# if 0 /* XXX no shaped window support for software_16_x11 */
1813 Evas_Engine_Info_Software_16_X11 *einfo;
1814
1815 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
1816 ee->shaped = shaped;
1817 if (einfo)
1818 {
1819 if (ee->shaped)
1820 {
1821 ee->engine.x.mask =
1822 ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1823 einfo->info.mask = ee->engine.x.mask;
1824 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1825 {
1826 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1827 }
1828 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1829 }
1830 else
1831 {
1832 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1833 ee->engine.x.mask = 0;
1834 einfo->info.mask = 0;
1835 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1836 {
1837 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1838 }
1839 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1840 }
1841 }
1842# endif /* XXX no shaped window support for software_16_x11 */
1843#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1844 }
1845 if (!strcmp(ee->driver, "software_8_x11"))
1846 {
1847#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
1848 Evas_Engine_Info_Software_8_X11 *einfo;
1849
1850 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
1851 ee->shaped = shaped;
1852 if (einfo)
1853 {
1854 if (ee->shaped)
1855 {
1856 unsigned int foreground;
1857 Ecore_X_GC gc;
1858
1859 if (!ee->engine.x.mask)
1860 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
1861 foreground = 0;
1862 gc = ecore_x_gc_new(ee->engine.x.mask,
1863 ECORE_X_GC_VALUE_MASK_FOREGROUND,
1864 &foreground);
1865 ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
1866 0, 0, ee->w, ee->h);
1867 ecore_x_gc_free(gc);
1868 einfo->info.mask = ee->engine.x.mask;
1869 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1870 {
1871 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1872 }
1873 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1874 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1875 }
1876 else
1877 {
1878 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1879 ee->engine.x.mask = 0;
1880 einfo->info.mask = 0;
1881 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1882 {
1883 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1884 }
1885 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1886 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1887 }
1888 }
1889#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
1890 }
1891}
1892
1893/* FIXME, round trip */
1894static void
1895_ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
1896{
1897 Ecore_X_Window_Attributes att;
1898 char *id = NULL;
1899
1900 if ((ee->alpha == alpha)) return;
1901
1902 if (!strcmp(ee->driver, "software_x11"))
1903 {
1904#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
1905 Evas_Engine_Info_Software_X11 *einfo;
1906
1907 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
1908 if (!einfo) return;
1909
1910 if (!ecore_x_composite_query()) return;
1911
1912 ee->shaped = 0;
1913 ee->alpha = alpha;
1914 ecore_x_window_free(ee->prop.window);
1915 ecore_event_window_unregister(ee->prop.window);
1916 if (ee->alpha)
1917 {
1918 if (ee->prop.override)
1919 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);
1920 else
1921 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);
1922 if (!ee->engine.x.mask)
1923 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
1924 }
1925 else
1926 {
1927 if (ee->prop.override)
1928 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);
1929 else
1930 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
1931 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1932 ee->engine.x.mask = 0;
1933 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
1934 }
1935
1936 einfo->info.destination_alpha = alpha;
1937
1938 ecore_x_window_attributes_get(ee->prop.window, &att);
1939 einfo->info.visual = att.visual;
1940 einfo->info.colormap = att.colormap;
1941 einfo->info.depth = att.depth;
1942
1943// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
1944// ee->engine.x.mask = 0;
1945 einfo->info.mask = ee->engine.x.mask;
1946 einfo->info.drawable = ee->prop.window;
1947 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1948 {
1949 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1950 }
1951 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
1952 ecore_x_window_shape_mask_set(ee->prop.window, 0);
1953 ecore_x_input_multi_select(ee->prop.window);
1954 ecore_event_window_register(ee->prop.window, ee, ee->evas,
1955 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
1956 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
1957 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
1958 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
1959 if (ee->prop.borderless)
1960 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
1961 if (ee->visible) ecore_x_window_show(ee->prop.window);
1962 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
1963 if (ee->prop.title)
1964 {
1965 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1966 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1967 }
1968 _ecore_evas_x_hints_update(ee);
1969 _ecore_evas_x_group_leader_update(ee);
1970 ecore_x_window_defaults_set(ee->prop.window);
1971 _ecore_evas_x_protocols_set(ee);
1972 _ecore_evas_x_sync_set(ee);
1973#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1974 if ((id = getenv("DESKTOP_STARTUP_ID")))
1975 {
1976 ecore_x_netwm_startup_id_set(ee->prop.window, id);
1977 /* NB: on linux this may simply empty the env as opposed to completely
1978 * unset it to being empty - unsure as solartis libc crashes looking
1979 * for the '=' char */
1980 // putenv((char*)"DESKTOP_STARTUP_ID=");
1981 }
1982 }
1983 else if (!strcmp(ee->driver, "opengl_x11"))
1984 {
1985#ifdef BUILD_ECORE_EVAS_OPENGL_X11
1986 Evas_Engine_Info_GL_X11 *einfo;
1987
1988 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
1989 if (!einfo) return;
1990
1991 if (!ecore_x_composite_query()) return;
1992
1993 ee->shaped = 0;
1994 ee->alpha = alpha;
1995 ecore_x_window_free(ee->prop.window);
1996 ecore_event_window_unregister(ee->prop.window);
1997 ee->prop.window = 0;
1998
1999 einfo->info.destination_alpha = alpha;
2000
2001 if (ee->engine.x.win_root != 0)
2002 {
2003 /* FIXME: round trip in ecore_x_window_argb_get */
2004 if (ecore_x_window_argb_get(ee->engine.x.win_root))
2005 {
2006 ee->prop.window =
2007 _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root,
2008 ee->req.x, ee->req.y,
2009 ee->req.w, ee->req.h,
2010 ee->prop.override, 1, NULL);
2011 }
2012 else
2013 {
2014 ee->prop.window =
2015 _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root,
2016 ee->req.x, ee->req.y,
2017 ee->req.w, ee->req.h,
2018 ee->prop.override, ee->alpha,
2019 NULL);
2020 }
2021 }
2022 else
2023 {
2024 ee->prop.window =
2025 _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root,
2026 ee->req.x, ee->req.y,
2027 ee->req.w, ee->req.h,
2028 ee->prop.override, ee->alpha, NULL);
2029 }
2030
2031 if (!ee->prop.window) return;
2032/*
2033 if (ee->alpha)
2034 {
2035 if (ee->prop.override)
2036 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);
2037 else
2038 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);
2039 if (!ee->engine.x.mask)
2040 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
2041 }
2042 else
2043 {
2044 if (ee->prop.override)
2045 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);
2046 else
2047 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
2048 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2049 ee->engine.x.mask = 0;
2050 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
2051 }
2052 */
2053
2054 ecore_x_window_attributes_get(ee->prop.window, &att);
2055 einfo->info.visual = att.visual;
2056 einfo->info.colormap = att.colormap;
2057 einfo->info.depth = att.depth;
2058
2059// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2060// ee->engine.x.mask = 0;
2061// einfo->info.mask = ee->engine.x.mask;
2062 einfo->info.drawable = ee->prop.window;
2063 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2064 {
2065 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2066 }
2067 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
2068// ecore_x_window_shape_mask_set(ee->prop.window, 0);
2069 ecore_x_input_multi_select(ee->prop.window);
2070 ecore_event_window_register(ee->prop.window, ee, ee->evas,
2071 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2072 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2073 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2074 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2075 if (ee->prop.borderless)
2076 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2077 if (ee->visible) ecore_x_window_show(ee->prop.window);
2078 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2079 if (ee->prop.title)
2080 {
2081 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2082 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2083 }
2084 _ecore_evas_x_hints_update(ee);
2085 _ecore_evas_x_group_leader_update(ee);
2086 ecore_x_window_defaults_set(ee->prop.window);
2087 _ecore_evas_x_protocols_set(ee);
2088 _ecore_evas_x_sync_set(ee);
2089#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
2090 if ((id = getenv("DESKTOP_STARTUP_ID")))
2091 {
2092 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2093 /* NB: on linux this may simply empty the env as opposed to completely
2094 * unset it to being empty - unsure as solartis libc crashes looking
2095 * for the '=' char */
2096 // putenv((char*)"DESKTOP_STARTUP_ID=");
2097 }
2098 }
2099 else if (!strcmp(ee->driver, "software_16_x11"))
2100 {
2101#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
2102 Evas_Engine_Info_Software_16_X11 *einfo;
2103
2104 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
2105 if (!einfo) return;
2106
2107 ee->shaped = 0;
2108 ee->alpha = alpha;
2109 ecore_x_window_free(ee->prop.window);
2110 ecore_event_window_unregister(ee->prop.window);
2111 if (ee->alpha)
2112 {
2113 if (ee->prop.override)
2114 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);
2115 else
2116 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);
2117 if (!ee->engine.x.mask)
2118 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
2119 }
2120 else
2121 {
2122 if (ee->prop.override)
2123 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);
2124 else
2125 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
2126 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2127 ee->engine.x.mask = 0;
2128 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
2129 }
2130
2131# if 0 /* XXX no alpha window support for software_16_x11 */
2132 einfo->info.destination_alpha = alpha;
2133# endif /* XXX no alpha window support for software_16_x11 */
2134
2135# if 0 /* XXX no shaped window support for software_16_x11 */
2136// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2137// ee->engine.x.mask = 0;
2138 einfo->info.mask = ee->engine.x.mask;
2139# endif /* XXX no shaped window support for software_16_x11 */
2140
2141 einfo->info.drawable = ee->prop.window;
2142 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2143 {
2144 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2145 }
2146 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
2147 ecore_x_window_shape_mask_set(ee->prop.window, 0);
2148 ecore_x_input_multi_select(ee->prop.window);
2149 ecore_event_window_register(ee->prop.window, ee, ee->evas,
2150 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2151 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2152 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2153 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2154 if (ee->prop.borderless)
2155 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2156 if (ee->visible) ecore_x_window_show(ee->prop.window);
2157 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2158 if (ee->prop.title)
2159 {
2160 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2161 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2162 }
2163 _ecore_evas_x_hints_update(ee);
2164 _ecore_evas_x_group_leader_update(ee);
2165 ecore_x_window_defaults_set(ee->prop.window);
2166 _ecore_evas_x_protocols_set(ee);
2167 _ecore_evas_x_sync_set(ee);
2168#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
2169 if ((id = getenv("DESKTOP_STARTUP_ID")))
2170 {
2171 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2172 /* NB: on linux this may simply empty the env as opposed to completely
2173 * unset it to being empty - unsure as solartis libc crashes looking
2174 * for the '=' char */
2175 // putenv((char*)"DESKTOP_STARTUP_ID=");
2176 }
2177 }
2178 else if (!strcmp(ee->driver, "software_8_x11"))
2179 {
2180#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
2181 Evas_Engine_Info_Software_8_X11 *einfo;
2182
2183 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
2184 if (!einfo) return;
2185
2186 ee->shaped = 0;
2187 ee->alpha = alpha;
2188 ecore_x_window_free(ee->prop.window);
2189 ecore_event_window_unregister(ee->prop.window);
2190 if (ee->alpha)
2191 {
2192 if (ee->prop.override)
2193 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);
2194 else
2195 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);
2196 if (!ee->engine.x.mask)
2197 ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
2198 }
2199 else
2200 {
2201 if (ee->prop.override)
2202 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);
2203 else
2204 ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
2205 if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2206 ee->engine.x.mask = 0;
2207 ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
2208 }
2209
2210 einfo->info.destination_alpha = alpha;
2211
2212 ecore_x_window_attributes_get(ee->prop.window, &att);
2213 einfo->info.visual = att.visual;
2214 einfo->info.colormap = att.colormap;
2215 einfo->info.depth = att.depth;
2216
2217// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
2218// ee->engine.x.mask = 0;
2219 einfo->info.mask = ee->engine.x.mask;
2220 einfo->info.drawable = ee->prop.window;
2221 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2222 {
2223 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2224 }
2225 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
2226 ecore_x_window_shape_mask_set(ee->prop.window, 0);
2227 ecore_x_input_multi_select(ee->prop.window);
2228 ecore_event_window_register(ee->prop.window, ee, ee->evas,
2229 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2230 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2231 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2232 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2233 if (ee->prop.borderless)
2234 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2235 if (ee->visible) ecore_x_window_show(ee->prop.window);
2236 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2237 if (ee->prop.title)
2238 {
2239 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2240 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2241 }
2242 _ecore_evas_x_hints_update(ee);
2243 _ecore_evas_x_group_leader_update(ee);
2244 ecore_x_window_defaults_set(ee->prop.window);
2245 _ecore_evas_x_protocols_set(ee);
2246 _ecore_evas_x_sync_set(ee);
2247
2248 if ((id = getenv("DESKTOP_STARTUP_ID")))
2249 {
2250 ecore_x_netwm_startup_id_set(ee->prop.window, id);
2251 /* NB: on linux this may simply empty the env as opposed to completely
2252 * unset it to being empty - unsure as solartis libc crashes looking
2253 * for the '=' char */
2254 // putenv((char*)"DESKTOP_STARTUP_ID=");
2255 }
2256#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
2257 }
2258}
2259
2260static void
2261_ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent)
2262{
2263 if ((ee->transparent == transparent)) return;
2264
2265 if (!strcmp(ee->driver, "software_x11"))
2266 {
2267#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2268 Evas_Engine_Info_Software_X11 *einfo;
2269
2270 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2271 if (!einfo) return;
2272
2273 ee->transparent = transparent;
2274 einfo->info.destination_alpha = transparent;
2275 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2276 {
2277 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2278 }
2279 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2280#endif
2281 }
2282}
2283
2284static void
2285_ecore_evas_x_window_group_set(Ecore_Evas *ee, const Ecore_Evas *group_ee)
2286{
2287 if (ee->prop.group_ee == group_ee) return;
2288
2289 ee->prop.group_ee = (Ecore_Evas *)group_ee;
2290 if (ee->prop.group_ee)
2291 ee->prop.group_ee_win = group_ee->prop.window;
2292 else
2293 ee->prop.group_ee_win = 0;
2294 _ecore_evas_x_hints_update(ee);
2295}
2296
2297static void
2298_ecore_evas_x_aspect_set(Ecore_Evas *ee, double aspect)
2299{
2300 if (ee->prop.aspect == aspect) return;
2301
2302 ee->prop.aspect = aspect;
2303 _ecore_evas_x_size_pos_hints_update(ee);
2304// netwm state
2305// if (ee->should_be_visible)
2306// ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2307// ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
2308// else
2309// _ecore_evas_x_state_update(ee);
2310}
2311
2312static void
2313_ecore_evas_x_urgent_set(Ecore_Evas *ee, int urgent)
2314{
2315 if (ee->prop.urgent == urgent) return;
2316
2317 ee->prop.urgent = urgent;
2318 _ecore_evas_x_hints_update(ee);
2319}
2320
2321static void
2322_ecore_evas_x_modal_set(Ecore_Evas *ee, int modal)
2323{
2324 if (ee->prop.modal == modal) return;
2325
2326 ee->prop.modal = modal;
2327 if (ee->should_be_visible)
2328 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2329 ECORE_X_WINDOW_STATE_MODAL, -1, modal);
2330 else
2331 _ecore_evas_x_state_update(ee);
2332}
2333
2334static void
2335_ecore_evas_x_demand_attention_set(Ecore_Evas *ee, int demand)
2336{
2337 if (ee->prop.demand_attention == demand) return;
2338
2339 ee->prop.demand_attention = demand;
2340 if (ee->should_be_visible)
2341 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2342 ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION, -1, demand);
2343 else
2344 _ecore_evas_x_state_update(ee);
2345}
2346
2347static void
2348_ecore_evas_x_focus_skip_set(Ecore_Evas *ee, int skip)
2349{
2350 if (ee->prop.focus_skip == skip) return;
2351
2352 ee->prop.focus_skip = skip;
2353 if (ee->should_be_visible)
2354 {
2355 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2356 ECORE_X_WINDOW_STATE_SKIP_TASKBAR, -1, skip);
2357 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2358 ECORE_X_WINDOW_STATE_SKIP_PAGER, -1, skip);
2359 }
2360 else
2361 _ecore_evas_x_state_update(ee);
2362 _ecore_evas_x_hints_update(ee);
2363}
2364
2365#endif /* BUILD_ECORE_EVAS_X11 */
2366
2367#ifdef BUILD_ECORE_EVAS_X11
2368static void
2369_ecore_evas_x_show(Ecore_Evas *ee)
2370{
2371 ee->should_be_visible = 1;
2372 if (ee->prop.avoid_damage)
2373 _ecore_evas_x_render(ee);
2374 _ecore_evas_x_sync_set(ee);
2375 ecore_x_window_show(ee->prop.window);
2376 if (ee->prop.fullscreen)
2377 ecore_x_window_focus(ee->prop.window);
2378}
2379
2380static void
2381_ecore_evas_x_hide(Ecore_Evas *ee)
2382{
2383 ecore_x_window_hide(ee->prop.window);
2384 ee->should_be_visible = 0;
2385 _ecore_evas_x_sync_set(ee);
2386}
2387
2388static void
2389_ecore_evas_x_raise(Ecore_Evas *ee)
2390{
2391 ecore_x_window_raise(ee->prop.window);
2392}
2393
2394static void
2395_ecore_evas_x_lower(Ecore_Evas *ee)
2396{
2397 ecore_x_window_lower(ee->prop.window);
2398}
2399
2400static void
2401_ecore_evas_x_activate(Ecore_Evas *ee)
2402{
2403 ecore_x_netwm_client_active_request(ee->engine.x.win_root,
2404 ee->prop.window, 2, 0);
2405}
2406
2407static void
2408_ecore_evas_x_title_set(Ecore_Evas *ee, const char *t)
2409{
2410 if (ee->prop.title) free(ee->prop.title);
2411 ee->prop.title = NULL;
2412 if (t) ee->prop.title = strdup(t);
2413 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2414 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2415}
2416
2417static void
2418_ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
2419{
2420 if (ee->prop.name) free(ee->prop.name);
2421 if (ee->prop.clas) free(ee->prop.clas);
2422 ee->prop.name = NULL;
2423 ee->prop.clas = NULL;
2424 if (n) ee->prop.name = strdup(n);
2425 if (c) ee->prop.clas = strdup(c);
2426 ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas);
2427}
2428
2429static void
2430_ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h)
2431{
2432 if (w < 0) w = 0;
2433 if (h < 0) h = 0;
2434 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
2435 ee->prop.min.w = w;
2436 ee->prop.min.h = h;
2437 _ecore_evas_x_size_pos_hints_update(ee);
2438}
2439
2440static void
2441_ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h)
2442{
2443 if (w < 0) w = 0;
2444 if (h < 0) h = 0;
2445 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
2446 ee->prop.max.w = w;
2447 ee->prop.max.h = h;
2448 _ecore_evas_x_size_pos_hints_update(ee);
2449}
2450
2451static void
2452_ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h)
2453{
2454 if (w < 0) w = 0;
2455 if (h < 0) h = 0;
2456 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
2457 ee->prop.base.w = w;
2458 ee->prop.base.h = h;
2459 _ecore_evas_x_size_pos_hints_update(ee);
2460}
2461
2462static void
2463_ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h)
2464{
2465 if (w < 1) w = 1;
2466 if (h < 1) h = 1;
2467 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
2468 ee->prop.step.w = w;
2469 ee->prop.step.h = h;
2470 _ecore_evas_x_size_pos_hints_update(ee);
2471}
2472
2473static void
2474_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2475{
2476 Ecore_Evas *ee;
2477
2478 ee = data;
2479 if (ee) ee->prop.cursor.object = NULL;
2480}
2481
2482static void
2483_ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
2484{
2485 int x, y;
2486
2487 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2488
2489 if (!obj)
2490 {
2491 ee->prop.cursor.object = NULL;
2492 ee->prop.cursor.layer = 0;
2493 ee->prop.cursor.hot.x = 0;
2494 ee->prop.cursor.hot.y = 0;
2495 ecore_x_window_cursor_show(ee->prop.window, 1);
2496 return;
2497 }
2498
2499 ee->prop.cursor.object = obj;
2500 ee->prop.cursor.layer = layer;
2501 ee->prop.cursor.hot.x = hot_x;
2502 ee->prop.cursor.hot.y = hot_y;
2503
2504 ecore_x_window_cursor_show(ee->prop.window, 0);
2505
2506 evas_pointer_output_xy_get(ee->evas, &x, &y);
2507 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
2508 evas_object_move(ee->prop.cursor.object,
2509 x - ee->prop.cursor.hot.x,
2510 y - ee->prop.cursor.hot.y);
2511 evas_object_pass_events_set(ee->prop.cursor.object, 1);
2512 if (evas_pointer_inside_get(ee->evas))
2513 evas_object_show(ee->prop.cursor.object);
2514
2515 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
2516}
2517
2518/*
2519 * @param ee
2520 * @param layer If < 3, @a ee will be put below all other windows.
2521 * If > 5, @a ee will be "always-on-top"
2522 * If = 4, @a ee will be put in the default layer.
2523 * Acceptable values range from 1 to 255 (0 reserved for
2524 * desktop windows)
2525 */
2526static void
2527_ecore_evas_x_layer_set(Ecore_Evas *ee, int layer)
2528{
2529 if (ee->prop.layer == layer) return;
2530
2531 /* FIXME: Should this logic be here? */
2532 if (layer < 1)
2533 layer = 1;
2534 else if (layer > 255)
2535 layer = 255;
2536
2537 ee->prop.layer = layer;
2538 _ecore_evas_x_layer_update(ee);
2539}
2540
2541static void
2542_ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__)
2543{
2544 ecore_x_window_focus(ee->prop.window);
2545}
2546
2547static void
2548_ecore_evas_x_iconified_set(Ecore_Evas *ee, int on)
2549{
2550 if (ee->prop.iconified == on) return;
2551 ee->prop.iconified = on;
2552 _ecore_evas_x_hints_update(ee);
2553 if (on)
2554 ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root);
2555 else
2556 ecore_evas_show(ee);
2557}
2558
2559static void
2560_ecore_evas_x_borderless_set(Ecore_Evas *ee, int on)
2561{
2562 if (ee->prop.borderless == on) return;
2563 ee->prop.borderless = on;
2564 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2565}
2566
2567/* FIXME: This function changes the initial state of the ee
2568 * whilest the iconic function changes the current state! */
2569static void
2570_ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn)
2571{
2572 if (ee->prop.withdrawn == withdrawn) return;
2573 ee->prop.withdrawn = withdrawn;
2574 _ecore_evas_x_hints_update(ee);
2575}
2576
2577static void
2578_ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky)
2579{
2580 if (ee->prop.sticky == sticky) return;
2581
2582 /* We dont want to set prop.sticky here as it will cause
2583 * the sticky callback not to get called. Its set on the
2584 * property change event.
2585 * ee->prop.sticky = sticky;
2586 */
2587 ee->engine.x.state.sticky = sticky;
2588 if (ee->should_be_visible)
2589 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2590 ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
2591 else
2592 _ecore_evas_x_state_update(ee);
2593}
2594
2595static void
2596_ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore)
2597{
2598 if (ee->ignore_events == ignore) return;
2599
2600 ee->ignore_events = ignore;
2601 if (ee->prop.window)
2602 ecore_x_window_ignore_set(ee->prop.window, ignore);
2603}
2604
2605/*
2606static void
2607_ecore_evas_x_reinit_win(Ecore_Evas *ee)
2608{
2609 if (!strcmp(ee->driver, "software_x11"))
2610 {
2611#ifdef BUILD_ECORE_EVAS_X11
2612 Evas_Engine_Info_Software_X11 *einfo;
2613
2614 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2615 if (einfo)
2616 {
2617 einfo->info.drawable = ee->prop.window;
2618 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2619 }
2620#endif
2621 }
2622 else if (!strcmp(ee->driver, "opengl_x11"))
2623 {
2624#ifdef BUILD_ECORE_EVAS_OPENGL_X11
2625 Evas_Engine_Info_GL_X11 *einfo;
2626
2627 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
2628 if (einfo)
2629 {
2630 einfo->info.drawable = ee->prop.window;
2631 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
2632 }
2633#endif
2634 }
2635}
2636*/
2637
2638static void
2639_ecore_evas_x_override_set(Ecore_Evas *ee, int on)
2640{
2641 if (ee->prop.override == on) return;
2642 if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window);
2643 ecore_x_window_override_set(ee->prop.window, on);
2644 if (ee->should_be_visible) ecore_x_window_show(ee->prop.window);
2645 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
2646 ee->prop.override = on;
2647}
2648
2649static void
2650_ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on)
2651{
2652 if (ee->prop.fullscreen == on) return;
2653
2654 /* FIXME: Detect if WM is EWMH compliant and handle properly if not,
2655 * i.e. reposition, resize, and change borderless hint */
2656 ee->engine.x.state.fullscreen = on;
2657 if (ee->should_be_visible)
2658 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2659 ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on);
2660 else
2661 _ecore_evas_x_state_update(ee);
2662}
2663
2664static void
2665_ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on)
2666{
2667 if (ee->prop.avoid_damage == on) return;
2668 if (!strcmp(ee->driver, "opengl_x11")) return;
2669
2670 if (!strcmp(ee->driver, "software_x11"))
2671 {
2672#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2673 Evas_Engine_Info_Software_X11 *einfo;
2674
2675 ee->prop.avoid_damage = on;
2676 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
2677 if (einfo)
2678 {
2679 if (ee->prop.avoid_damage)
2680 {
2681 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth);
2682 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2683 einfo->info.drawable = ee->engine.x.pmap;
2684 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2685 {
2686 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2687 }
2688 if ((ee->rotation == 90) || (ee->rotation == 270))
2689 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2690 else
2691 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2692 if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN)
2693 {
2694 ee->engine.x.using_bg_pixmap = 1;
2695 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2696 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2697 }
2698 if (ee->engine.x.direct_resize)
2699 {
2700 /* Turn this off for now
2701 ee->engine.x.using_bg_pixmap = 1;
2702 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2703 */
2704 }
2705 }
2706 else
2707 {
2708 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2709 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2710 if (ee->engine.x.using_bg_pixmap)
2711 {
2712 ecore_x_window_pixmap_set(ee->prop.window, 0);
2713 ee->engine.x.using_bg_pixmap = 0;
2714 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2715 }
2716 ee->engine.x.pmap = 0;
2717 ee->engine.x.gc = 0;
2718 einfo->info.drawable = ee->prop.window;
2719 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2720 {
2721 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2722 }
2723 }
2724 }
2725#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
2726 }
2727 else if (!strcmp(ee->driver, "software_16_x11"))
2728 {
2729#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
2730 Evas_Engine_Info_Software_16_X11 *einfo;
2731
2732 ee->prop.avoid_damage = on;
2733 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
2734 if (einfo)
2735 {
2736 if (ee->prop.avoid_damage)
2737 {
2738 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16);
2739 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2740 einfo->info.drawable = ee->engine.x.pmap;
2741 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2742 {
2743 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2744 }
2745 if ((ee->rotation == 90) || (ee->rotation == 270))
2746 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2747 else
2748 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2749 if (ee->engine.x.direct_resize)
2750 {
2751 /* Turn this off for now
2752 ee->engine.x.using_bg_pixmap = 1;
2753 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2754 */
2755 }
2756 }
2757 else
2758 {
2759 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2760 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2761 if (ee->engine.x.using_bg_pixmap)
2762 {
2763 ecore_x_window_pixmap_set(ee->prop.window, 0);
2764 ee->engine.x.using_bg_pixmap = 0;
2765 }
2766 ee->engine.x.pmap = 0;
2767 ee->engine.x.gc = 0;
2768 einfo->info.drawable = ee->prop.window;
2769 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2770 {
2771 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2772 }
2773 }
2774 }
2775#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
2776 }
2777 else if (!strcmp(ee->driver, "software_8_x11"))
2778 {
2779#if BUILD_ECORE_EVAS_SOFTWARE_8_X11
2780 Evas_Engine_Info_Software_8_X11 *einfo;
2781
2782 ee->prop.avoid_damage = on;
2783 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
2784 if (einfo)
2785 {
2786 if (ee->prop.avoid_damage)
2787 {
2788 ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth);
2789 ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
2790 einfo->info.drawable = ee->engine.x.pmap;
2791 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2792 {
2793 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2794 }
2795 if ((ee->rotation == 90) || (ee->rotation == 270))
2796 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
2797 else
2798 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
2799 if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN)
2800 {
2801 ee->engine.x.using_bg_pixmap = 1;
2802 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2803 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2804 }
2805 if (ee->engine.x.direct_resize)
2806 {
2807 /* Turn this off for now
2808 ee->engine.x.using_bg_pixmap = 1;
2809 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
2810 */
2811 }
2812 }
2813 else
2814 {
2815 if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
2816 if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
2817 if (ee->engine.x.using_bg_pixmap)
2818 {
2819 ecore_x_window_pixmap_set(ee->prop.window, 0);
2820 ee->engine.x.using_bg_pixmap = 0;
2821 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
2822 }
2823 ee->engine.x.pmap = 0;
2824 ee->engine.x.gc = 0;
2825 einfo->info.drawable = ee->prop.window;
2826 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
2827 {
2828 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
2829 }
2830 }
2831 }
2832#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
2833 }
2834}
2835
2836static void
2837_ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
2838{
2839 if (x) *x = 0;
2840 if (y) *y = 0;
2841 ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h);
2842}
2843
2844int
2845_ecore_evas_x_shutdown(void)
2846{
2847 _ecore_evas_init_count--;
2848 if (_ecore_evas_init_count == 0)
2849 {
2850 unsigned int i;
2851
2852 for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++)
2853 {
2854 if (ecore_evas_event_handlers[i])
2855 ecore_event_handler_del(ecore_evas_event_handlers[i]);
2856 }
2857 ecore_event_evas_shutdown();
2858 }
2859 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
2860 return _ecore_evas_init_count;
2861}
2862
2863static Ecore_Evas_Engine_Func _ecore_x_engine_func =
2864{
2865 _ecore_evas_x_free,
2866 NULL,
2867 NULL,
2868 NULL,
2869 NULL,
2870 _ecore_evas_x_callback_delete_request_set,
2871 NULL,
2872 NULL,
2873 NULL,
2874 NULL,
2875 NULL,
2876 NULL,
2877 NULL,
2878 NULL,
2879 NULL,
2880 _ecore_evas_x_move,
2881 _ecore_evas_x_managed_move,
2882 _ecore_evas_x_resize,
2883 _ecore_evas_x_move_resize,
2884 _ecore_evas_x_rotation_set,
2885 _ecore_evas_x_shaped_set,
2886 _ecore_evas_x_show,
2887 _ecore_evas_x_hide,
2888 _ecore_evas_x_raise,
2889 _ecore_evas_x_lower,
2890 _ecore_evas_x_activate,
2891 _ecore_evas_x_title_set,
2892 _ecore_evas_x_name_class_set,
2893 _ecore_evas_x_size_min_set,
2894 _ecore_evas_x_size_max_set,
2895 _ecore_evas_x_size_base_set,
2896 _ecore_evas_x_size_step_set,
2897 _ecore_evas_x_object_cursor_set,
2898 _ecore_evas_x_layer_set,
2899 _ecore_evas_x_focus_set,
2900 _ecore_evas_x_iconified_set,
2901 _ecore_evas_x_borderless_set,
2902 _ecore_evas_x_override_set,
2903 NULL,
2904 _ecore_evas_x_fullscreen_set,
2905 _ecore_evas_x_avoid_damage_set,
2906 _ecore_evas_x_withdrawn_set,
2907 _ecore_evas_x_sticky_set,
2908 _ecore_evas_x_ignore_events_set,
2909 _ecore_evas_x_alpha_set,
2910 _ecore_evas_x_transparent_set,
2911
2912 _ecore_evas_x_window_group_set,
2913 _ecore_evas_x_aspect_set,
2914 _ecore_evas_x_urgent_set,
2915 _ecore_evas_x_modal_set,
2916 _ecore_evas_x_demand_attention_set,
2917 _ecore_evas_x_focus_skip_set,
2918
2919 NULL, // render
2920 _ecore_evas_x_screen_geometry_get
2921};
2922#endif /* BUILD_ECORE_EVAS_X11 */
2923
2924/*
2925 * FIXME: there are some round trips. Especially, we can split
2926 * ecore_x_init in 2 functions and suppress some round trips.
2927 */
2928
2929#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)
2930static void
2931_ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
2932{
2933 Ecore_Evas *ee = data;
2934
2935 if (ee->no_comp_sync) return;
2936 if (!_ecore_evas_app_comp_sync) return;
2937 if (ee->engine.x.sync_counter)
2938 {
2939 if (ee->engine.x.sync_began)
2940 {
2941 ee->engine.x.sync_val++;
2942 if (!ee->engine.x.sync_cancel)
2943 {
2944 if (!ee->semi_sync)
2945 ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter,
2946 ee->engine.x.sync_val);
2947 }
2948 }
2949 }
2950}
2951
2952static void
2953_ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
2954{
2955 Ecore_Evas *ee = data;
2956
2957 if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))
2958 {
2959 if (ee->engine.x.sync_counter)
2960 {
2961 if (ee->engine.x.sync_began)
2962 {
2963 if (!ee->engine.x.sync_cancel)
2964 {
2965 ecore_x_e_comp_sync_draw_size_done_send
2966 (ee->engine.x.win_root, ee->prop.window, ee->w, ee->h);
2967 }
2968 }
2969 }
2970 }
2971 if (ee->engine.x.netwm_sync_set)
2972 {
2973 ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter,
2974 ee->engine.x.netwm_sync_val_hi,
2975 ee->engine.x.netwm_sync_val_lo);
2976 ee->engine.x.netwm_sync_set = 0;
2977 }
2978}
2979#endif
2980
2981/**
2982 * To be documented.
2983 *
2984 * FIXME: To be fixed.
2985 */
2986#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
2987EAPI Ecore_Evas *
2988ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent,
2989 int x, int y, int w, int h)
2990{
2991 Evas_Engine_Info_Software_X11 *einfo;
2992 Ecore_Evas *ee;
2993 int argb = 0, rmethod;
2994 static int redraw_debug = -1;
2995 char *id = NULL;
2996
2997 rmethod = evas_render_method_lookup("software_x11");
2998 if (!rmethod) return NULL;
2999 if (!ecore_x_init(disp_name)) return NULL;
3000 ee = calloc(1, sizeof(Ecore_Evas));
3001 if (!ee) return NULL;
3002
3003 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3004
3005 _ecore_evas_x_init();
3006
3007 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3008
3009 ee->driver = "software_x11";
3010 if (disp_name) ee->name = strdup(disp_name);
3011
3012 if (w < 1) w = 1;
3013 if (h < 1) h = 1;
3014 ee->x = x;
3015 ee->y = y;
3016 ee->w = w;
3017 ee->h = h;
3018 ee->req.x = ee->x;
3019 ee->req.y = ee->y;
3020 ee->req.w = ee->w;
3021 ee->req.h = ee->h;
3022
3023 ee->prop.max.w = 32767;
3024 ee->prop.max.h = 32767;
3025 ee->prop.layer = 4;
3026 ee->prop.request_pos = 0;
3027 ee->prop.sticky = 0;
3028 ee->engine.x.state.sticky = 0;
3029
3030 /* init evas here */
3031 ee->evas = evas_new();
3032 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE,
3033 _ecore_evas_x_flush_pre, ee);
3034 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST,
3035 _ecore_evas_x_flush_post, ee);
3036 evas_data_attach_set(ee->evas, ee);
3037 evas_output_method_set(ee->evas, rmethod);
3038 evas_output_size_set(ee->evas, w, h);
3039 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3040
3041 ee->engine.x.win_root = parent;
3042 ee->engine.x.screen_num = 0;
3043
3044 if (parent != 0)
3045 {
3046 ee->engine.x.screen_num = 1; /* FIXME: get real scren # */
3047 /* FIXME: round trip in ecore_x_window_argb_get */
3048 if (ecore_x_window_argb_get(parent))
3049 {
3050 ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h);
3051 argb = 1;
3052 }
3053 else
3054 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3055 }
3056 else
3057 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3058 if ((id = getenv("DESKTOP_STARTUP_ID")))
3059 {
3060 ecore_x_netwm_startup_id_set(ee->prop.window, id);
3061 /* NB: on linux this may simply empty the env as opposed to completely
3062 * unset it to being empty - unsure as solartis libc crashes looking
3063 * for the '=' char */
3064// putenv((char*)"DESKTOP_STARTUP_ID=");
3065 }
3066 einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas);
3067 if (einfo)
3068 {
3069 Ecore_X_Screen *screen;
3070
3071 /* FIXME: this is inefficient as its 1 or more round trips */
3072 screen = ecore_x_default_screen_get();
3073 if (ecore_x_screen_count_get() > 1)
3074 {
3075 Ecore_X_Window *roots;
3076 int num, i;
3077
3078 num = 0;
3079 roots = ecore_x_window_root_list(&num);
3080 if (roots)
3081 {
3082 Ecore_X_Window root;
3083
3084 root = ecore_x_window_root_get(parent);
3085 for (i = 0; i < num; i++)
3086 {
3087 if (root == roots[i])
3088 {
3089 screen = ecore_x_screen_get(i);
3090 break;
3091 }
3092 }
3093 free(roots);
3094 }
3095 }
3096
3097 einfo->info.destination_alpha = argb;
3098
3099 if (redraw_debug < 0)
3100 {
3101 if (getenv("REDRAW_DEBUG"))
3102 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
3103 else
3104 redraw_debug = 0;
3105 }
3106
3107# ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
3108 einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB;
3109 einfo->info.connection = ecore_x_connection_get();
3110 einfo->info.screen = screen;
3111# else
3112 einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB;
3113 einfo->info.connection = ecore_x_display_get();
3114 einfo->info.screen = NULL;
3115# endif
3116 einfo->info.drawable = ee->prop.window;
3117
3118# ifdef EVAS_FRAME_QUEUING
3119 {
3120 char *render_mode;
3121
3122 render_mode = getenv("EVAS_RENDER_MODE");
3123 if ((render_mode) && (!strcmp(render_mode, "non-blocking")))
3124 einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING;
3125 }
3126# endif
3127
3128 if (argb)
3129 {
3130 Ecore_X_Window_Attributes at;
3131
3132 ecore_x_window_attributes_get(ee->prop.window, &at);
3133 einfo->info.visual = at.visual;
3134 einfo->info.colormap = at.colormap;
3135 einfo->info.depth = at.depth;
3136 einfo->info.destination_alpha = 1;
3137 }
3138 else
3139 {
3140 einfo->info.visual =
3141 ecore_x_default_visual_get(einfo->info.connection, screen);
3142 einfo->info.colormap =
3143 ecore_x_default_colormap_get(einfo->info.connection, screen);
3144 einfo->info.depth =
3145 ecore_x_default_depth_get(einfo->info.connection, screen);
3146 einfo->info.destination_alpha = 0;
3147 }
3148
3149 einfo->info.rotation = 0;
3150 einfo->info.debug = redraw_debug;
3151 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3152 {
3153 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3154 ecore_evas_free(ee);
3155 return NULL;
3156 }
3157 }
3158
3159 _ecore_evas_x_hints_update(ee);
3160 _ecore_evas_x_group_leader_set(ee);
3161 ecore_x_window_defaults_set(ee->prop.window);
3162 _ecore_evas_x_protocols_set(ee);
3163 _ecore_evas_x_sync_set(ee);
3164
3165 ee->engine.func->fn_render = _ecore_evas_x_render;
3166 _ecore_evas_register(ee);
3167 ecore_x_input_multi_select(ee->prop.window);
3168 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3169 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3170 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3171 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3172 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3173 return ee;
3174}
3175#else
3176EAPI Ecore_Evas *
3177ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3178 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3179{
3180 return NULL;
3181}
3182#endif
3183
3184/**
3185 * To be documented.
3186 *
3187 * FIXME: To be fixed.
3188 */
3189#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3190EAPI Ecore_X_Window
3191ecore_evas_software_x11_window_get(const Ecore_Evas *ee)
3192{
3193 return (Ecore_X_Window) ecore_evas_window_get(ee);
3194}
3195#else
3196EAPI Ecore_X_Window
3197ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3198{
3199 return 0;
3200}
3201#endif
3202
3203/**
3204 * To be documented.
3205 *
3206 * FIXME: To be fixed.
3207 */
3208#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3209EAPI void
3210ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
3211{
3212 ee->engine.x.direct_resize = on;
3213 if (ee->prop.avoid_damage)
3214 {
3215 if (ee->engine.x.direct_resize)
3216 {
3217/* turn this off for now
3218 ee->engine.x.using_bg_pixmap = 1;
3219 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
3220 */
3221 }
3222 else
3223 {
3224/* turn this off too- bg pixmap is controlled by avoid damage directly
3225 ee->engine.x.using_bg_pixmap = 0;
3226 ecore_x_window_pixmap_set(ee->prop.window, 0);
3227 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
3228 */
3229 }
3230 }
3231}
3232#else
3233EAPI void
3234ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3235{
3236}
3237#endif
3238
3239/**
3240 * To be documented.
3241 *
3242 * FIXME: To be fixed.
3243 */
3244#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3245EAPI Eina_Bool
3246ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee)
3247{
3248 return ee->engine.x.direct_resize;
3249}
3250#else
3251EAPI Eina_Bool
3252ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3253{
3254 return 0;
3255}
3256#endif
3257
3258/**
3259 * To be documented.
3260 *
3261 * FIXME: To be fixed.
3262 */
3263#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
3264EAPI void
3265ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3266{
3267 Ecore_X_Window *winp;
3268
3269 winp = malloc(sizeof(Ecore_X_Window));
3270 if (winp)
3271 {
3272 *winp = win;
3273 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
3274 ecore_x_input_multi_select(win);
3275 ecore_event_window_register(win, ee, ee->evas,
3276 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3277 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3278 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3279 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3280 }
3281}
3282#else
3283EAPI void
3284ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3285{
3286}
3287#endif
3288
3289/**
3290 * To be documented.
3291 *
3292 * FIXME: To be fixed.
3293 */
3294#ifdef BUILD_ECORE_EVAS_OPENGL_X11
3295EAPI Ecore_Evas *
3296ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent,
3297 int x, int y, int w, int h)
3298{
3299 return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL);
3300}
3301
3302EAPI Ecore_Evas *
3303ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent,
3304 int x, int y, int w, int h, const int *opt)
3305{
3306 Ecore_Evas *ee;
3307 int rmethod;
3308 char *id = NULL;
3309
3310 rmethod = evas_render_method_lookup("gl_x11");
3311 if (!rmethod) return NULL;
3312 if (!ecore_x_init(disp_name)) return NULL;
3313 ee = calloc(1, sizeof(Ecore_Evas));
3314 if (!ee) return NULL;
3315
3316 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3317
3318 _ecore_evas_x_init();
3319
3320 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3321
3322 ee->driver = "opengl_x11";
3323 if (!getenv("ECORE_EVAS_COMP_NOSEMISYNC"))
3324 ee->semi_sync = 1; // gl engine doesn't need to sync - its whole swaps
3325// ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps
3326 if (disp_name) ee->name = strdup(disp_name);
3327
3328 if (w < 1) w = 1;
3329 if (h < 1) h = 1;
3330 ee->x = x;
3331 ee->y = y;
3332 ee->w = w;
3333 ee->h = h;
3334 ee->req.x = ee->x;
3335 ee->req.y = ee->y;
3336 ee->req.w = ee->w;
3337 ee->req.h = ee->h;
3338
3339 ee->prop.max.w = 32767;
3340 ee->prop.max.h = 32767;
3341 ee->prop.layer = 4;
3342 ee->prop.request_pos = 0;
3343 ee->prop.sticky = 0;
3344 ee->engine.x.state.sticky = 0;
3345
3346 /* init evas here */
3347 ee->evas = evas_new();
3348 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3349 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3350 evas_data_attach_set(ee->evas, ee);
3351 evas_output_method_set(ee->evas, rmethod);
3352 evas_output_size_set(ee->evas, w, h);
3353 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3354
3355 if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get());
3356 ee->engine.x.win_root = parent;
3357
3358 if (ee->engine.x.win_root != 0)
3359 {
3360 ee->engine.x.screen_num = 1; /* FIXME: get real scren # */
3361 /* FIXME: round trip in ecore_x_window_argb_get */
3362 if (ecore_x_window_argb_get(ee->engine.x.win_root))
3363 {
3364 ee->prop.window = _ecore_evas_x_gl_window_new
3365 (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt);
3366 }
3367 else
3368 ee->prop.window = _ecore_evas_x_gl_window_new
3369 (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt);
3370 }
3371 else
3372 ee->prop.window = _ecore_evas_x_gl_window_new
3373 (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt);
3374 if (!ee->prop.window)
3375 {
3376 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3377 ecore_evas_free(ee);
3378 return NULL;
3379 }
3380 if ((id = getenv("DESKTOP_STARTUP_ID")))
3381 {
3382 ecore_x_netwm_startup_id_set(ee->prop.window, id);
3383 /* NB: on linux this may simply empty the env as opposed to completely
3384 * unset it to being empty - unsure as solartis libc crashes looking
3385 * for the '=' char */
3386// putenv((char*)"DESKTOP_STARTUP_ID=");
3387 }
3388
3389 _ecore_evas_x_hints_update(ee);
3390 _ecore_evas_x_group_leader_set(ee);
3391 ecore_x_window_defaults_set(ee->prop.window);
3392 _ecore_evas_x_protocols_set(ee);
3393 _ecore_evas_x_sync_set(ee);
3394
3395 ee->engine.func->fn_render = _ecore_evas_x_render;
3396 _ecore_evas_register(ee);
3397 ecore_x_input_multi_select(ee->prop.window);
3398 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3399 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3400 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3401 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3402 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3403
3404 return ee;
3405}
3406#else
3407EAPI Ecore_Evas *
3408ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3409 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3410{
3411 return NULL;
3412}
3413EAPI Ecore_Evas *
3414ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3415 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, const int *opt __UNUSED__)
3416{
3417 return NULL;
3418}
3419#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3420
3421/**
3422 * To be documented.
3423 *
3424 * FIXME: To be fixed.
3425 */
3426#ifdef BUILD_ECORE_EVAS_OPENGL_X11
3427EAPI Ecore_X_Window
3428ecore_evas_gl_x11_window_get(const Ecore_Evas *ee)
3429{
3430 return (Ecore_X_Window) ecore_evas_window_get(ee);
3431}
3432#else
3433EAPI Ecore_X_Window
3434ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3435{
3436 return 0;
3437}
3438#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3439
3440/**
3441 * To be documented.
3442 *
3443 * FIXME: To be fixed.
3444 */
3445#ifdef BUILD_ECORE_EVAS_OPENGL_X11
3446EAPI void
3447ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
3448{
3449 ee->engine.x.direct_resize = on;
3450}
3451#else
3452EAPI void
3453ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3454{
3455}
3456#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3457
3458/**
3459 * To be documented.
3460 *
3461 * FIXME: To be fixed.
3462 */
3463#ifdef BUILD_ECORE_EVAS_OPENGL_X11
3464EAPI Eina_Bool
3465ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee)
3466{
3467 return ee->engine.x.direct_resize;
3468}
3469#else
3470EAPI Eina_Bool
3471ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3472{
3473 return 0;
3474}
3475#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3476
3477/**
3478 * To be documented.
3479 *
3480 * FIXME: To be fixed.
3481 */
3482#ifdef BUILD_ECORE_EVAS_OPENGL_X11
3483EAPI void
3484ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3485{
3486 ecore_evas_software_x11_extra_event_window_add(ee, win);
3487}
3488#else
3489EAPI void
3490ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3491{
3492}
3493#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3494
3495/**
3496 * To be documented.
3497 *
3498 * FIXME: To be fixed.
3499 */
3500#ifdef BUILD_ECORE_EVAS_OPENGL_X11
3501EAPI void
3502ecore_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))
3503{
3504 Evas_Engine_Info_GL_X11 *einfo;
3505
3506 if (!(!strcmp(ee->driver, "opengl_x11"))) return;
3507
3508 einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas);
3509 if (einfo)
3510 {
3511 einfo->callback.pre_swap = pre_cb;
3512 einfo->callback.post_swap = post_cb;
3513 einfo->callback.data = data;
3514 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3515 {
3516 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
3517 }
3518 }
3519}
3520#else
3521EAPI void
3522ecore_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__)
3523{
3524 return;
3525}
3526#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */
3527
3528/**
3529 * To be documented.
3530 *
3531 * FIXME: To be fixed or maybe removed rather?
3532 */
3533EAPI Ecore_Evas *
3534ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3535 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3536{
3537 return NULL;
3538}
3539
3540/**
3541 * To be documented.
3542 *
3543 * FIXME: To be fixed or maybe removed rather?
3544 */
3545EAPI Ecore_X_Window
3546ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__)
3547{
3548 return 0;
3549}
3550
3551/**
3552 * To be documented.
3553 *
3554 * FIXME: To be fixed.
3555 */
3556EAPI void
3557ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3558{
3559}
3560
3561/**
3562 * To be documented.
3563 *
3564 * FIXME: To be fixed.
3565 */
3566EAPI Eina_Bool
3567ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3568{
3569 return 0;
3570}
3571
3572/**
3573 * To be documented.
3574 *
3575 * FIXME: To be fixed.
3576 */
3577EAPI void
3578ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3579{
3580}
3581
3582/**
3583 * To be documented.
3584 *
3585 * FIXME: To be fixed.
3586 */
3587#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3588EAPI Ecore_Evas *
3589ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent,
3590 int x, int y, int w, int h)
3591{
3592 Evas_Engine_Info_Software_16_X11 *einfo;
3593 Ecore_Evas *ee;
3594 int rmethod;
3595 static int redraw_debug = -1;
3596
3597 rmethod = evas_render_method_lookup("software_16_x11");
3598 if (!rmethod) return NULL;
3599 if (!ecore_x_init(disp_name)) return NULL;
3600 ee = calloc(1, sizeof(Ecore_Evas));
3601 if (!ee) return NULL;
3602
3603 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3604
3605 _ecore_evas_x_init();
3606
3607 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3608
3609 ee->driver = "software_16_x11";
3610 if (disp_name) ee->name = strdup(disp_name);
3611
3612 if (w < 1) w = 1;
3613 if (h < 1) h = 1;
3614 ee->x = x;
3615 ee->y = y;
3616 ee->w = w;
3617 ee->h = h;
3618 ee->req.x = ee->x;
3619 ee->req.y = ee->y;
3620 ee->req.w = ee->w;
3621 ee->req.h = ee->h;
3622
3623 ee->prop.max.w = 32767;
3624 ee->prop.max.h = 32767;
3625 ee->prop.layer = 4;
3626 ee->prop.request_pos = 0;
3627 ee->prop.sticky = 0;
3628 ee->engine.x.state.sticky = 0;
3629
3630 /* init evas here */
3631 ee->evas = evas_new();
3632 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3633 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3634 evas_data_attach_set(ee->evas, ee);
3635 evas_output_method_set(ee->evas, rmethod);
3636 evas_output_size_set(ee->evas, w, h);
3637 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3638
3639 ee->engine.x.win_root = parent;
3640 if (parent != 0)
3641 {
3642 /* FIXME: round trip in ecore_x_window_argb_get */
3643 if (ecore_x_window_argb_get(parent))
3644 {
3645 ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h);
3646 }
3647 else
3648 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3649 }
3650 else
3651 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3652 if (getenv("DESKTOP_STARTUP_ID"))
3653 {
3654 ecore_x_netwm_startup_id_set(ee->prop.window,
3655 getenv("DESKTOP_STARTUP_ID"));
3656 /* NB: on linux this may simply empty the env as opposed to completely
3657 * unset it to being empty - unsure as solartis libc crashes looking
3658 * for the '=' char */
3659// putenv((char*)"DESKTOP_STARTUP_ID=");
3660 }
3661 einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas);
3662
3663 if (einfo)
3664 {
3665 if (ScreenCount(ecore_x_display_get()) > 1)
3666 {
3667 Ecore_X_Window *roots;
3668 int num, i;
3669
3670 num = 0;
3671 roots = ecore_x_window_root_list(&num);
3672 if (roots)
3673 {
3674 XWindowAttributes at;
3675
3676 if (XGetWindowAttributes(ecore_x_display_get(),
3677 parent, &at))
3678 {
3679 for (i = 0; i < num; i++)
3680 {
3681 if (at.root == roots[i])
3682 break;
3683 }
3684 }
3685 free(roots);
3686 }
3687 }
3688
3689 if (redraw_debug < 0)
3690 {
3691 if (getenv("REDRAW_DEBUG"))
3692 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
3693 else
3694 redraw_debug = 0;
3695 }
3696 einfo->info.display = ecore_x_display_get();
3697 einfo->info.drawable = ee->prop.window;
3698
3699 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
3700 {
3701 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3702 ecore_evas_free(ee);
3703 return NULL;
3704 }
3705 }
3706 else
3707 {
3708 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
3709 ecore_evas_free(ee);
3710 return NULL;
3711 }
3712
3713 _ecore_evas_x_hints_update(ee);
3714 _ecore_evas_x_group_leader_set(ee);
3715 ecore_x_window_defaults_set(ee->prop.window);
3716 _ecore_evas_x_protocols_set(ee);
3717 _ecore_evas_x_sync_set(ee);
3718
3719 ee->engine.func->fn_render = _ecore_evas_x_render;
3720 _ecore_evas_register(ee);
3721 ecore_x_input_multi_select(ee->prop.window);
3722 ecore_event_window_register(ee->prop.window, ee, ee->evas,
3723 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3724 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3725 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3726 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3727 return ee;
3728}
3729#else
3730EAPI Ecore_Evas *
3731ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__,
3732 int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
3733{
3734 return NULL;
3735}
3736#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3737
3738/**
3739 * To be documented.
3740 *
3741 * FIXME: To be fixed.
3742 */
3743#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3744EAPI Ecore_X_Window
3745ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee)
3746{
3747 return (Ecore_X_Window) ecore_evas_window_get(ee);
3748}
3749#else
3750EAPI Ecore_X_Window
3751ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__)
3752{
3753 return 0;
3754}
3755#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3756
3757/**
3758 * To be documented.
3759 *
3760 * FIXME: To be fixed.
3761 */
3762#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3763EAPI void
3764ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
3765{
3766 ee->engine.x.direct_resize = on;
3767 if (ee->prop.avoid_damage)
3768 {
3769 if (ee->engine.x.direct_resize)
3770 {
3771/* turn this off for now
3772 ee->engine.x.using_bg_pixmap = 1;
3773 ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
3774 */
3775 }
3776 else
3777 {
3778/* turn this off too- bg pixmap is controlled by avoid damage directly
3779 ee->engine.x.using_bg_pixmap = 0;
3780 ecore_x_window_pixmap_set(ee->prop.window, 0);
3781 ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
3782 */
3783 }
3784 }
3785}
3786#else
3787EAPI void
3788ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__)
3789{
3790}
3791#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3792
3793/**
3794 * To be documented.
3795 *
3796 * FIXME: To be fixed.
3797 */
3798#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3799EAPI Eina_Bool
3800ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee)
3801{
3802 return ee->engine.x.direct_resize;
3803}
3804#else
3805EAPI Eina_Bool
3806ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__)
3807{
3808 return 0;
3809}
3810#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3811
3812/**
3813 * To be documented.
3814 *
3815 * FIXME: To be fixed.
3816 */
3817#if BUILD_ECORE_EVAS_SOFTWARE_16_X11
3818EAPI void
3819ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
3820{
3821 Ecore_X_Window *winp;
3822
3823 winp = malloc(sizeof(Ecore_X_Window));
3824 if (winp)
3825 {
3826 *winp = win;
3827 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
3828 ecore_x_input_multi_select(win);
3829 ecore_event_window_register(win, ee, ee->evas,
3830 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
3831 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
3832 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
3833 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
3834 }
3835}
3836#else
3837EAPI void
3838ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__)
3839{
3840}
3841#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
3842
3843
3844/**
3845 * To be documented.
3846 *
3847 * FIXME: To be fixed.
3848 */
3849EAPI Ecore_Evas *
3850ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent,
3851 int x, int y, int w, int h)
3852{
3853#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
3854 Evas_Engine_Info_Software_8_X11 *einfo;
3855 Ecore_Evas *ee;
3856 int argb = 0;
3857 int rmethod;
3858 static int redraw_debug = -1;
3859
3860 rmethod = evas_render_method_lookup("software_8_x11");
3861 if (!rmethod) return NULL;
3862 if (!ecore_x_init(disp_name)) return NULL;
3863 ee = calloc(1, sizeof(Ecore_Evas));
3864 if (!ee) return NULL;
3865
3866 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
3867
3868 _ecore_evas_x_init();
3869
3870 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
3871
3872 ee->driver = "software_8_x11";
3873 if (disp_name) ee->name = strdup(disp_name);
3874
3875 if (w < 1) w = 1;
3876 if (h < 1) h = 1;
3877 ee->x = x;
3878 ee->y = y;
3879 ee->w = w;
3880 ee->h = h;
3881 ee->req.x = ee->x;
3882 ee->req.y = ee->y;
3883 ee->req.w = ee->w;
3884 ee->req.h = ee->h;
3885
3886 ee->prop.max.w = 32767;
3887 ee->prop.max.h = 32767;
3888 ee->prop.layer = 4;
3889 ee->prop.request_pos = 0;
3890 ee->prop.sticky = 0;
3891 ee->engine.x.state.sticky = 0;
3892
3893 /* init evas here */
3894 ee->evas = evas_new();
3895 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
3896 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
3897 evas_data_attach_set(ee->evas, ee);
3898 evas_output_method_set(ee->evas, rmethod);
3899 evas_output_size_set(ee->evas, w, h);
3900 evas_output_viewport_set(ee->evas, 0, 0, w, h);
3901
3902 ee->engine.x.win_root = parent;
3903 // if (parent != 0)
3904 // {
3905 // /* FIXME: round trip in ecore_x_window_argb_get */
3906 // if (ecore_x_window_argb_get(parent))
3907 // {
3908 // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h);
3909 // argb = 1;
3910 // }
3911 // else
3912 // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h);
3913 // }
3914 // else
3915 ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
3916 if (getenv("DESKTOP_STARTUP_ID"))
3917 {
3918 ecore_x_netwm_startup_id_set(ee->prop.window,
3919 getenv("DESKTOP_STARTUP_ID"));
3920 /* NB: on linux this may simply empty the env as opposed to completely
3921 * unset it to being empty - unsure as solartis libc crashes looking
3922 * for the '=' char */
3923 // putenv((char*)"DESKTOP_STARTUP_ID=");
3924 }
3925 einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
3926 if (einfo)
3927 {
3928 xcb_screen_iterator_t iter;
3929 xcb_screen_t *screen;
3930
3931 /* FIXME: this is inefficient as its a round trip */
3932 //einfo->info.backend = 1;
3933 screen = ecore_x_default_screen_get();
3934 iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get()));
3935 if (iter.rem > 1)
3936 {
3937 xcb_get_geometry_cookie_t cookie;
3938 xcb_get_geometry_reply_t *reply;
3939 Ecore_X_Window *roots;
3940 int num;
3941 uint8_t i;
3942
3943 num = 0;
3944 cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent);
3945 roots = ecore_x_window_root_list(&num);
3946 if (roots)
3947 {
3948 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
3949
3950 if (reply)
3951 {
3952 for (i = 0; i < num; xcb_screen_next (&iter), i++)
3953 {
3954 if (reply->root == roots[i])
3955 {
3956 screen = iter.data;
3957 break;
3958 }
3959 }
3960 free(reply);
3961 }
3962 free(roots);
3963 }
3964 else
3965 {
3966 reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
3967 if (reply) free(reply);
3968 }
3969 }
3970
3971 if (redraw_debug < 0)
3972 {
3973 if (getenv("REDRAW_DEBUG"))
3974 redraw_debug = atoi(getenv("REDRAW_DEBUG"));
3975 else
3976 redraw_debug = 0;
3977 }
3978 einfo->info.connection = ecore_x_connection_get();
3979 einfo->info.screen = screen;
3980 einfo->info.drawable = ee->prop.window;
3981 if (argb)
3982 {
3983 /* FIXME: round trip */
3984 xcb_get_geometry_cookie_t cookie_geom;
3985 xcb_get_window_attributes_cookie_t cookie_attr;
3986 xcb_get_geometry_reply_t *reply_geom;
3987 xcb_get_window_attributes_reply_t *reply_attr;
3988
3989 cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window);
3990 cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
3991
3992 reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL);
3993 reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
3994 if (reply_attr && reply_geom)
3995 {
3996 einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual);
3997 einfo->info.colormap = reply_attr->colormap;
3998 einfo->info.depth = reply_geom->depth;
3999 einfo->info.destination_alpha = 1;
4000 free(reply_geom);
4001 free(reply_attr);
4002 }
4003 }
4004 else
4005 {
4006 xcb_screen_t *screen;
4007
4008 screen = ecore_x_default_screen_get();
4009 einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual);
4010 einfo->info.colormap = screen->default_colormap;
4011 einfo->info.depth = screen->root_depth;
4012 einfo->info.destination_alpha = 0;
4013 }
4014 einfo->info.rotation = 0;
4015 einfo->info.debug = redraw_debug;
4016 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
4017 {
4018 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
4019 ecore_evas_free(ee);
4020 return NULL;
4021 }
4022 }
4023 else
4024 {
4025 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
4026 ecore_evas_free(ee);
4027 return NULL;
4028 }
4029
4030 _ecore_evas_x_hints_update(ee);
4031 _ecore_evas_x_group_leader_set(ee);
4032 ecore_x_window_defaults_set(ee->prop.window);
4033 _ecore_evas_x_protocols_set(ee);
4034 _ecore_evas_x_sync_set(ee);
4035
4036 ee->engine.func->fn_render = _ecore_evas_x_render;
4037 _ecore_evas_register(ee);
4038 ecore_x_input_multi_select(ee->prop.window);
4039 ecore_event_window_register(ee->prop.window, ee, ee->evas,
4040 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
4041 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
4042 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
4043 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
4044
4045 return ee;
4046#else
4047 return NULL;
4048 (void)(disp_name);
4049 (void)(parent);
4050 (void)(x);
4051 (void)(y);
4052 (void)(w);
4053 (void)(h);
4054#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
4055}
4056
4057/**
4058 * To be documented.
4059 *
4060 * FIXME: To be fixed.
4061 */
4062EAPI Ecore_X_Window
4063ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee)
4064{
4065#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4066 return (Ecore_X_Window) ecore_evas_window_get(ee);
4067#else
4068 return 0;
4069 (void)(ee);
4070#endif
4071}
4072
4073/**
4074 * To be documented.
4075 *
4076 * FIXME: To be fixed.
4077 */
4078EAPI Ecore_X_Window
4079ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee)
4080{
4081#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4082 return (Ecore_X_Window) ecore_evas_window_get(ee);
4083#else
4084 return 0;
4085 (void)(ee);
4086#endif
4087}
4088
4089/**
4090 * To be documented.
4091 *
4092 * FIXME: To be fixed.
4093 */
4094EAPI void
4095ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
4096{
4097#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4098 ee->engine.x.direct_resize = on;
4099 if (ee->prop.avoid_damage)
4100 {
4101 if (ee->engine.x.direct_resize)
4102 {
4103 /* turn this off for now
4104 ee->engine.x.using_bg_pixmap = 1;
4105 ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap);
4106 */
4107 }
4108 else
4109 {
4110 /* turn this off too- bg pixmap is controlled by avoid damage directly
4111 ee->engine.x.using_bg_pixmap = 0;
4112 ecore_x_window_pixmap_set(ee->engine.x.win, 0);
4113 ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h);
4114 */
4115 }
4116 }
4117#else
4118 return;
4119 (void)(ee);
4120 (void)(on);
4121#endif
4122}
4123
4124/**
4125 * To be documented.
4126 *
4127 * FIXME: To be fixed.
4128 */
4129EAPI Eina_Bool
4130ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee)
4131{
4132#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4133 return ee->engine.x.direct_resize;
4134#else
4135 return 0;
4136 (void)(ee);
4137#endif
4138}
4139
4140/**
4141 * To be documented.
4142 *
4143 * FIXME: To be fixed.
4144 */
4145EAPI void
4146ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
4147{
4148#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
4149 Ecore_X_Window *winp;
4150
4151 winp = malloc(sizeof(Ecore_X_Window));
4152 if (winp)
4153 {
4154 *winp = win;
4155 ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
4156 ecore_x_input_multi_select(win);
4157 ecore_event_window_register(win, ee, ee->evas,
4158 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
4159 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
4160 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
4161 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
4162 }
4163#else
4164 return;
4165 (void)(ee);
4166 (void)(win);
4167#endif
4168}
4169
4170EAPI void
4171ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win)
4172{
4173#ifdef BUILD_ECORE_EVAS_X11
4174 _ecore_evas_x_group_leader_unset(ee);
4175 ee->engine.x.leader = win;
4176 _ecore_evas_x_group_leader_update(ee);
4177#else
4178 return;
4179 ee = NULL;
4180 win = 0;
4181#endif
4182}
4183
4184EAPI Ecore_X_Window
4185ecore_evas_x11_leader_get(Ecore_Evas *ee)
4186{
4187#ifdef BUILD_ECORE_EVAS_X11
4188 return ee->engine.x.leader;
4189#else
4190 return 0;
4191 ee = NULL;
4192#endif
4193}
4194
4195EAPI void
4196ecore_evas_x11_leader_default_set(Ecore_Evas *ee)
4197{
4198#ifdef BUILD_ECORE_EVAS_X11
4199 _ecore_evas_x_group_leader_unset(ee);
4200 _ecore_evas_x_group_leader_set(ee);
4201#else
4202 return;
4203 ee = NULL;
4204#endif
4205}
4206
4207#ifdef BUILD_ECORE_EVAS_X11
4208static Eina_Bool
4209_ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect)
4210{
4211 if ((!src_rect) || (!dst_rect)) return 0;
4212
4213 if (ee->rotation == 0)
4214 {
4215 dst_rect->x = src_rect->x;
4216 dst_rect->y = src_rect->y;
4217 dst_rect->width = src_rect->width;
4218 dst_rect->height = src_rect->height;
4219 }
4220 else if (ee->rotation == 90)
4221 {
4222 dst_rect->x = src_rect->y;
4223 dst_rect->y = ee->req.h - src_rect->x - src_rect->width;
4224 dst_rect->width = src_rect->height;
4225 dst_rect->height = src_rect->width;
4226 }
4227 else if (ee->rotation == 180)
4228 {
4229 dst_rect->x = ee->req.w - src_rect->x - src_rect->width;
4230 dst_rect->y = ee->req.h - src_rect->y - src_rect->height;
4231 dst_rect->width = src_rect->width;
4232 dst_rect->height = src_rect->height;
4233 }
4234 else if (ee->rotation == 270)
4235 {
4236 dst_rect->x = ee->req.w - src_rect->y - src_rect->height;
4237 dst_rect->y = src_rect->x;
4238 dst_rect->width = src_rect->height;
4239 dst_rect->height = src_rect->width;
4240 }
4241 else
4242 {
4243 return 0;
4244 }
4245
4246 return 1;
4247}
4248#endif
4249
4250EAPI void
4251ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h)
4252{
4253#ifdef BUILD_ECORE_EVAS_X11
4254 Eina_Bool ret;
4255 Ecore_X_Rectangle src_rect;
4256 Ecore_X_Rectangle dst_rect;
4257
4258 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4259 {
4260 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4261 "ecore_evas_x11_shape_input_rectangle_set");
4262 return;
4263 }
4264
4265 src_rect.x = x;
4266 src_rect.y = y;
4267 src_rect.width = w;
4268 src_rect.height = h;
4269
4270 dst_rect.x = 0;
4271 dst_rect.y = 0;
4272 dst_rect.width = 0;
4273 dst_rect.height = 0;
4274
4275 ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect);
4276
4277 if (!ee->engine.x.win_shaped_input)
4278 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root,
4279 0, 0, 1, 1);
4280
4281 if (ret)
4282 ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input,
4283 dst_rect.x, dst_rect.y,
4284 dst_rect.width, dst_rect.height);
4285#else
4286 return;
4287 ee = NULL;
4288 x = 0;
4289 y = 0;
4290 w = 0;
4291 h = 0;
4292#endif
4293}
4294
4295EAPI void
4296ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h)
4297{
4298#ifdef BUILD_ECORE_EVAS_X11
4299 Eina_Bool ret;
4300 Ecore_X_Rectangle src_rect;
4301 Ecore_X_Rectangle dst_rect;
4302
4303 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4304 {
4305 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4306 "ecore_evas_x11_shape_input_rectangle_add");
4307 return;
4308 }
4309
4310 src_rect.x = x;
4311 src_rect.y = y;
4312 src_rect.width = w;
4313 src_rect.height = h;
4314
4315 dst_rect.x = 0;
4316 dst_rect.y = 0;
4317 dst_rect.width = 0;
4318 dst_rect.height = 0;
4319
4320 ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect);
4321
4322 if (!ee->engine.x.win_shaped_input)
4323 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root,
4324 0, 0, 1, 1);
4325
4326 if (ret)
4327 ecore_x_window_shape_input_rectangle_add(ee->engine.x.win_shaped_input,
4328 dst_rect.x, dst_rect.y,
4329 dst_rect.width, dst_rect.height);
4330#else
4331 return;
4332 ee = NULL;
4333 x = 0;
4334 y = 0;
4335 w = 0;
4336 h = 0;
4337#endif
4338}
4339
4340EAPI void
4341ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h)
4342{
4343#ifdef BUILD_ECORE_EVAS_X11
4344 Eina_Bool ret;
4345 Ecore_X_Rectangle src_rect;
4346 Ecore_X_Rectangle dst_rect;
4347
4348 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4349 {
4350 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4351 "ecore_evas_x11_shape_input_rectangle_subtract");
4352 return;
4353 }
4354
4355 src_rect.x = x;
4356 src_rect.y = y;
4357 src_rect.width = w;
4358 src_rect.height = h;
4359
4360 dst_rect.x = 0;
4361 dst_rect.y = 0;
4362 dst_rect.width = 0;
4363 dst_rect.height = 0;
4364
4365 ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect);
4366
4367 if (!ee->engine.x.win_shaped_input)
4368 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root,
4369 0, 0, 1, 1);
4370
4371 if (ret)
4372 ecore_x_window_shape_input_rectangle_subtract(ee->engine.x.win_shaped_input,
4373 dst_rect.x, dst_rect.y,
4374 dst_rect.width, dst_rect.height);
4375#else
4376 return;
4377 ee = NULL;
4378 x = 0;
4379 y = 0;
4380 w = 0;
4381 h = 0;
4382#endif
4383}
4384
4385EAPI void
4386ecore_evas_x11_shape_input_empty(Ecore_Evas *ee)
4387{
4388#ifdef BUILD_ECORE_EVAS_X11
4389 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4390 {
4391 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4392 "ecore_evas_x11_shape_input_empty");
4393 return;
4394 }
4395
4396 if (!ee->engine.x.win_shaped_input)
4397 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1);
4398
4399 ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 0, 0);
4400#else
4401 return;
4402 ee = NULL;
4403#endif
4404}
4405
4406EAPI void
4407ecore_evas_x11_shape_input_reset(Ecore_Evas *ee)
4408{
4409#ifdef BUILD_ECORE_EVAS_X11
4410 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4411 {
4412 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4413 "ecore_evas_x11_shape_input_reset");
4414 return;
4415 }
4416
4417 if (!ee->engine.x.win_shaped_input)
4418 ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1);
4419
4420 ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 65535, 65535);
4421#else
4422 return;
4423 ee = NULL;
4424#endif
4425}
4426
4427EAPI void
4428ecore_evas_x11_shape_input_apply(Ecore_Evas *ee)
4429{
4430#ifdef BUILD_ECORE_EVAS_X11
4431 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
4432 {
4433 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
4434 "ecore_evas_x11_shape_input_apply");
4435 return;
4436 }
4437
4438 if (!ee->engine.x.win_shaped_input) return;
4439
4440 ecore_x_window_shape_input_window_set(ee->prop.window, ee->engine.x.win_shaped_input);
4441#else
4442 return;
4443 ee = NULL;
4444#endif
4445}
diff --git a/libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h b/libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h
deleted file mode 100644
index 069cccd..0000000
--- a/libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h
+++ /dev/null
@@ -1,100 +0,0 @@
1#ifndef _ECORE_FB_H
2#define _ECORE_FB_H
3
4#include <Eina.h>
5
6#ifdef EAPI
7# undef EAPI
8#endif
9
10#ifdef __GNUC__
11# if __GNUC__ >= 4
12# define EAPI __attribute__ ((visibility("default")))
13# else
14# define EAPI
15# endif
16#else
17# define EAPI
18#endif
19
20/* FIXME:
21 * maybe a new module?
22 * - code to get battery info
23 * - code to get thermal info
24 * ecore evas fb isn't good enough for weird things, like multiple fb's, same happens here.
25 * backlight support using new kernel interface
26 * absolute axis
27 * joystick
28 * ecore_fb_li_device_close_all ? or a shutdown of the subsystem?
29 *
30 */
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
37 * @defgroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions.
38 *
39 * Functions used to set up and shut down the Ecore_Framebuffer functions.
40 *
41 * @{
42 */
43
44/**
45 * @typedef Ecore_Fb_Input_Device
46 * Input device handler.
47 */
48typedef struct _Ecore_Fb_Input_Device Ecore_Fb_Input_Device;
49
50/**
51 * @enum _Ecore_Fb_Input_Device_Cap
52 * Device capabilities.
53 */
54enum _Ecore_Fb_Input_Device_Cap
55{
56 ECORE_FB_INPUT_DEVICE_CAP_NONE = 0x00000000,
57 ECORE_FB_INPUT_DEVICE_CAP_RELATIVE = 0x00000001,
58 ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE = 0x00000002,
59 ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS = 0x00000004
60};
61
62/**
63 * @typedef Ecore_Fb_Input_Device_Cap
64 * Device capabilities.
65 */
66typedef enum _Ecore_Fb_Input_Device_Cap Ecore_Fb_Input_Device_Cap;
67
68/* ecore_fb_vt.c */
69EAPI void ecore_fb_callback_gain_set(void (*func) (void *data), void *data);
70EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data);
71
72/* ecore_fb_li.c */
73EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(const char *dev);
74EAPI void ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev);
75EAPI void ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen);
76EAPI const char *ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev);
77EAPI Ecore_Fb_Input_Device_Cap ecore_fb_input_device_cap_get(Ecore_Fb_Input_Device *dev);
78EAPI void ecore_fb_input_device_axis_size_set(Ecore_Fb_Input_Device *dev, int w, int h);
79EAPI void ecore_fb_input_threshold_click_set(Ecore_Fb_Input_Device *dev, double threshold);
80EAPI double ecore_fb_input_threshold_click_get(Ecore_Fb_Input_Device *dev);
81EAPI void ecore_fb_input_device_window_set(Ecore_Fb_Input_Device *dev, void *window);
82
83/* ecore_fb.c */
84
85EAPI int ecore_fb_init(const char *name);
86EAPI int ecore_fb_shutdown(void);
87EAPI void ecore_fb_size_get(int *w, int *h);
88
89EAPI void ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int ytrans, int xyswap);
90EAPI void ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int *ytrans, int *xyswap);
91
92/**
93 * @}
94 */
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif
diff --git a/libraries/ecore/src/lib/ecore_fb/Makefile.am b/libraries/ecore/src/lib/ecore_fb/Makefile.am
deleted file mode 100644
index 9129fec..0000000
--- a/libraries/ecore/src/lib/ecore_fb/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_builddir)/src/lib/ecore \
6-I$(top_srcdir)/src/lib/ecore_input \
7@TSLIB_CFLAGS@ \
8@EINA_CFLAGS@
9
10
11lib_LTLIBRARIES = libecore_fb.la
12includes_HEADERS = Ecore_Fb.h
13includesdir = $(includedir)/ecore-@VMAJ@
14
15libecore_fb_la_SOURCES = \
16ecore_fb.c \
17ecore_fb_vt.c \
18ecore_fb_li.c \
19ecore_fb_ts.c
20# deprecated sources (might not compile):
21# ecore_fb_kbd.c
22# ecore_fb_ps2.c
23
24libecore_fb_la_LIBADD = \
25@TSLIB_LIBS@ \
26$(top_builddir)/src/lib/ecore/libecore.la \
27$(top_builddir)/src/lib/ecore_input/libecore_input.la \
28@EINA_LIBS@
29
30libecore_fb_la_LDFLAGS = -version-info @version_info@ @release_info@
31
32EXTRA_DIST = \
33ecore_fb_private.h \
34ecore_fb_keytable.h
diff --git a/libraries/ecore/src/lib/ecore_fb/Makefile.in b/libraries/ecore/src/lib/ecore_fb/Makefile.in
deleted file mode 100644
index e8030b1..0000000
--- a/libraries/ecore/src/lib/ecore_fb/Makefile.in
+++ /dev/null
@@ -1,845 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_fb
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_fb_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la \
90 $(top_builddir)/src/lib/ecore_input/libecore_input.la
91am_libecore_fb_la_OBJECTS = ecore_fb.lo ecore_fb_vt.lo ecore_fb_li.lo \
92 ecore_fb_ts.lo
93libecore_fb_la_OBJECTS = $(am_libecore_fb_la_OBJECTS)
94AM_V_lt = $(am__v_lt_$(V))
95am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
96am__v_lt_0 = --silent
97libecore_fb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
98 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
99 $(AM_CFLAGS) $(CFLAGS) $(libecore_fb_la_LDFLAGS) $(LDFLAGS) -o \
100 $@
101DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
102depcomp = $(SHELL) $(top_srcdir)/depcomp
103am__depfiles_maybe = depfiles
104am__mv = mv -f
105COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
106 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
107LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
108 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
109 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
110 $(AM_CFLAGS) $(CFLAGS)
111AM_V_CC = $(am__v_CC_$(V))
112am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
113am__v_CC_0 = @echo " CC " $@;
114AM_V_at = $(am__v_at_$(V))
115am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
116am__v_at_0 = @
117CCLD = $(CC)
118LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
119 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
120 $(AM_LDFLAGS) $(LDFLAGS) -o $@
121AM_V_CCLD = $(am__v_CCLD_$(V))
122am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
123am__v_CCLD_0 = @echo " CCLD " $@;
124AM_V_GEN = $(am__v_GEN_$(V))
125am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
126am__v_GEN_0 = @echo " GEN " $@;
127SOURCES = $(libecore_fb_la_SOURCES)
128DIST_SOURCES = $(libecore_fb_la_SOURCES)
129HEADERS = $(includes_HEADERS)
130ETAGS = etags
131CTAGS = ctags
132DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
133ACLOCAL = @ACLOCAL@
134ALLOCA = @ALLOCA@
135AMTAR = @AMTAR@
136AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
137AR = @AR@
138AS = @AS@
139AUTOCONF = @AUTOCONF@
140AUTOHEADER = @AUTOHEADER@
141AUTOMAKE = @AUTOMAKE@
142AWK = @AWK@
143CARES_CFLAGS = @CARES_CFLAGS@
144CARES_LIBS = @CARES_LIBS@
145CC = @CC@
146CCDEPMODE = @CCDEPMODE@
147CFLAGS = @CFLAGS@
148CHECK_CFLAGS = @CHECK_CFLAGS@
149CHECK_LIBS = @CHECK_LIBS@
150CPP = @CPP@
151CPPFLAGS = @CPPFLAGS@
152CURL_CFLAGS = @CURL_CFLAGS@
153CURL_LIBS = @CURL_LIBS@
154CXX = @CXX@
155CXXCPP = @CXXCPP@
156CXXDEPMODE = @CXXDEPMODE@
157CXXFLAGS = @CXXFLAGS@
158CYGPATH_W = @CYGPATH_W@
159DEFS = @DEFS@
160DEPDIR = @DEPDIR@
161DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
162DIRECTFB_LIBS = @DIRECTFB_LIBS@
163DLLTOOL = @DLLTOOL@
164DSYMUTIL = @DSYMUTIL@
165DUMPBIN = @DUMPBIN@
166ECHO_C = @ECHO_C@
167ECHO_N = @ECHO_N@
168ECHO_T = @ECHO_T@
169ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
170ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
171EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
172EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
173EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
174EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
175EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
176EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
177EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
178EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
179EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
180EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
181EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
182EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
183EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
184EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
185EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
186EGREP = @EGREP@
187EINA_CFLAGS = @EINA_CFLAGS@
188EINA_LIBS = @EINA_LIBS@
189ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
190ESCAPE_LIBS = @ESCAPE_LIBS@
191EVAS_CFLAGS = @EVAS_CFLAGS@
192EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@
196EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
197EXOTIC_LIBS = @EXOTIC_LIBS@
198FGREP = @FGREP@
199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
200GLIB_CFLAGS = @GLIB_CFLAGS@
201GLIB_LIBS = @GLIB_LIBS@
202GMSGFMT = @GMSGFMT@
203GMSGFMT_015 = @GMSGFMT_015@
204GREP = @GREP@
205INSTALL = @INSTALL@
206INSTALL_DATA = @INSTALL_DATA@
207INSTALL_PROGRAM = @INSTALL_PROGRAM@
208INSTALL_SCRIPT = @INSTALL_SCRIPT@
209INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
210INTLLIBS = @INTLLIBS@
211INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
212KEYSYMDEFS = @KEYSYMDEFS@
213LD = @LD@
214LDFLAGS = @LDFLAGS@
215LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
216LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
217LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
218LIBICONV = @LIBICONV@
219LIBINTL = @LIBINTL@
220LIBOBJS = @LIBOBJS@
221LIBS = @LIBS@
222LIBTOOL = @LIBTOOL@
223LIPO = @LIPO@
224LN_S = @LN_S@
225LTLIBICONV = @LTLIBICONV@
226LTLIBINTL = @LTLIBINTL@
227LTLIBOBJS = @LTLIBOBJS@
228MAKEINFO = @MAKEINFO@
229MKDIR_P = @MKDIR_P@
230MSGFMT = @MSGFMT@
231MSGFMT_015 = @MSGFMT_015@
232MSGMERGE = @MSGMERGE@
233NM = @NM@
234NMEDIT = @NMEDIT@
235OBJC = @OBJC@
236OBJCDEPMODE = @OBJCDEPMODE@
237OBJCFLAGS = @OBJCFLAGS@
238OBJDUMP = @OBJDUMP@
239OBJEXT = @OBJEXT@
240OTOOL = @OTOOL@
241OTOOL64 = @OTOOL64@
242PACKAGE = @PACKAGE@
243PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
244PACKAGE_NAME = @PACKAGE_NAME@
245PACKAGE_STRING = @PACKAGE_STRING@
246PACKAGE_TARNAME = @PACKAGE_TARNAME@
247PACKAGE_URL = @PACKAGE_URL@
248PACKAGE_VERSION = @PACKAGE_VERSION@
249PATH_SEPARATOR = @PATH_SEPARATOR@
250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
251PIXMAN_LIBS = @PIXMAN_LIBS@
252PKG_CONFIG = @PKG_CONFIG@
253PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
254PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
255POSUB = @POSUB@
256RANLIB = @RANLIB@
257SCIM_CFLAGS = @SCIM_CFLAGS@
258SCIM_LIBS = @SCIM_LIBS@
259SDL_CFLAGS = @SDL_CFLAGS@
260SDL_CONFIG = @SDL_CONFIG@
261SDL_LIBS = @SDL_LIBS@
262SED = @SED@
263SET_MAKE = @SET_MAKE@
264SHELL = @SHELL@
265SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
266SSL_CFLAGS = @SSL_CFLAGS@
267SSL_LIBS = @SSL_LIBS@
268STRIP = @STRIP@
269TLS2_CFLAGS = @TLS2_CFLAGS@
270TLS2_LIBS = @TLS2_LIBS@
271TLS_CFLAGS = @TLS_CFLAGS@
272TLS_LIBS = @TLS_LIBS@
273TSLIB_CFLAGS = @TSLIB_CFLAGS@
274TSLIB_LIBS = @TSLIB_LIBS@
275USE_NLS = @USE_NLS@
276VERSION = @VERSION@
277VMAJ = @VMAJ@
278WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
279WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
280WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
281WAYLAND_LIBS = @WAYLAND_LIBS@
282WIN32_CFLAGS = @WIN32_CFLAGS@
283WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
284WIN32_LIBS = @WIN32_LIBS@
285XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
286XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
287XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
288XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
289XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
290XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
291XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
292XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
293XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
294XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
295XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
296XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
297XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
298XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
299XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
300XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
301XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
302XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
303XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
304XCB_X11_LIBS = @XCB_X11_LIBS@
305XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
306XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
307XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
308XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
309XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
310XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
311XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
312XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
313XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
314XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
315XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
316XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
317XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
318XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
319XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
320XDAMAGE_LIBS = @XDAMAGE_LIBS@
321XDPMS_CFLAGS = @XDPMS_CFLAGS@
322XDPMS_LIBS = @XDPMS_LIBS@
323XFIXES_CFLAGS = @XFIXES_CFLAGS@
324XFIXES_LIBS = @XFIXES_LIBS@
325XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
326XGESTURE_LIBS = @XGESTURE_LIBS@
327XGETTEXT = @XGETTEXT@
328XGETTEXT_015 = @XGETTEXT_015@
329XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
330XI2_CFLAGS = @XI2_CFLAGS@
331XI2_LIBS = @XI2_LIBS@
332XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
333XINERAMA_LIBS = @XINERAMA_LIBS@
334XKB_CFLAGS = @XKB_CFLAGS@
335XKB_LIBS = @XKB_LIBS@
336XMKMF = @XMKMF@
337XPRINT_CFLAGS = @XPRINT_CFLAGS@
338XPRINT_LIBS = @XPRINT_LIBS@
339XRANDR_CFLAGS = @XRANDR_CFLAGS@
340XRANDR_LIBS = @XRANDR_LIBS@
341XRENDER_CFLAGS = @XRENDER_CFLAGS@
342XRENDER_LIBS = @XRENDER_LIBS@
343XSS_CFLAGS = @XSS_CFLAGS@
344XSS_LIBS = @XSS_LIBS@
345XTEST_CFLAGS = @XTEST_CFLAGS@
346XTEST_LIBS = @XTEST_LIBS@
347X_CFLAGS = @X_CFLAGS@
348X_EXTRA_LIBS = @X_EXTRA_LIBS@
349X_LIBS = @X_LIBS@
350X_PRE_LIBS = @X_PRE_LIBS@
351Xcursor_cflags = @Xcursor_cflags@
352Xcursor_libs = @Xcursor_libs@
353abs_builddir = @abs_builddir@
354abs_srcdir = @abs_srcdir@
355abs_top_builddir = @abs_top_builddir@
356abs_top_srcdir = @abs_top_srcdir@
357ac_ct_CC = @ac_ct_CC@
358ac_ct_CXX = @ac_ct_CXX@
359ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
360ac_ct_OBJC = @ac_ct_OBJC@
361am__include = @am__include@
362am__leading_dot = @am__leading_dot@
363am__quote = @am__quote@
364am__tar = @am__tar@
365am__untar = @am__untar@
366bindir = @bindir@
367build = @build@
368build_alias = @build_alias@
369build_cpu = @build_cpu@
370build_os = @build_os@
371build_vendor = @build_vendor@
372builddir = @builddir@
373cocoa_ldflags = @cocoa_ldflags@
374datadir = @datadir@
375datarootdir = @datarootdir@
376dlopen_libs = @dlopen_libs@
377docdir = @docdir@
378dvidir = @dvidir@
379ecore_cocoa_cflags = @ecore_cocoa_cflags@
380ecore_cocoa_libs = @ecore_cocoa_libs@
381ecore_con_cflags = @ecore_con_cflags@
382ecore_con_libs = @ecore_con_libs@
383ecore_directfb_cflags = @ecore_directfb_cflags@
384ecore_directfb_libs = @ecore_directfb_libs@
385ecore_evas_cflags = @ecore_evas_cflags@
386ecore_evas_libs = @ecore_evas_libs@
387ecore_fb_cflags = @ecore_fb_cflags@
388ecore_fb_libs = @ecore_fb_libs@
389ecore_file_cflags = @ecore_file_cflags@
390ecore_file_libs = @ecore_file_libs@
391ecore_imf_cflags = @ecore_imf_cflags@
392ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
393ecore_imf_evas_libs = @ecore_imf_evas_libs@
394ecore_imf_libs = @ecore_imf_libs@
395ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
396ecore_imf_scim_libs = @ecore_imf_scim_libs@
397ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
398ecore_imf_xim_libs = @ecore_imf_xim_libs@
399ecore_input_cflags = @ecore_input_cflags@
400ecore_input_evas_cflags = @ecore_input_evas_cflags@
401ecore_input_evas_libs = @ecore_input_evas_libs@
402ecore_input_libs = @ecore_input_libs@
403ecore_ipc_cflags = @ecore_ipc_cflags@
404ecore_ipc_libs = @ecore_ipc_libs@
405ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
406ecore_psl1ght_libs = @ecore_psl1ght_libs@
407ecore_sdl_cflags = @ecore_sdl_cflags@
408ecore_sdl_libs = @ecore_sdl_libs@
409ecore_wayland_cflags = @ecore_wayland_cflags@
410ecore_wayland_libs = @ecore_wayland_libs@
411ecore_win32_cflags = @ecore_win32_cflags@
412ecore_win32_libs = @ecore_win32_libs@
413ecore_wince_cflags = @ecore_wince_cflags@
414ecore_wince_libs = @ecore_wince_libs@
415ecore_x_cflags = @ecore_x_cflags@
416ecore_x_libs = @ecore_x_libs@
417ecore_x_libs_private = @ecore_x_libs_private@
418efl_doxygen = @efl_doxygen@
419efl_have_doxygen = @efl_have_doxygen@
420exec_prefix = @exec_prefix@
421have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
422host = @host@
423host_alias = @host_alias@
424host_cpu = @host_cpu@
425host_os = @host_os@
426host_vendor = @host_vendor@
427htmldir = @htmldir@
428includedir = @includedir@
429infodir = @infodir@
430install_sh = @install_sh@
431libdir = @libdir@
432libexecdir = @libexecdir@
433localedir = @localedir@
434localstatedir = @localstatedir@
435lt_ECHO = @lt_ECHO@
436lt_enable_auto_import = @lt_enable_auto_import@
437mandir = @mandir@
438mkdir_p = @mkdir_p@
439oldincludedir = @oldincludedir@
440pdfdir = @pdfdir@
441pkgconfig_requires_private = @pkgconfig_requires_private@
442prefix = @prefix@
443program_transform_name = @program_transform_name@
444psdir = @psdir@
445release_info = @release_info@
446requirements_ecore = @requirements_ecore@
447requirements_ecore_cocoa = @requirements_ecore_cocoa@
448requirements_ecore_con = @requirements_ecore_con@
449requirements_ecore_directfb = @requirements_ecore_directfb@
450requirements_ecore_evas = @requirements_ecore_evas@
451requirements_ecore_fb = @requirements_ecore_fb@
452requirements_ecore_file = @requirements_ecore_file@
453requirements_ecore_imf = @requirements_ecore_imf@
454requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
455requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
456requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
457requirements_ecore_input = @requirements_ecore_input@
458requirements_ecore_input_evas = @requirements_ecore_input_evas@
459requirements_ecore_ipc = @requirements_ecore_ipc@
460requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
461requirements_ecore_sdl = @requirements_ecore_sdl@
462requirements_ecore_wayland = @requirements_ecore_wayland@
463requirements_ecore_win32 = @requirements_ecore_win32@
464requirements_ecore_wince = @requirements_ecore_wince@
465requirements_ecore_x = @requirements_ecore_x@
466rt_libs = @rt_libs@
467sbindir = @sbindir@
468sharedstatedir = @sharedstatedir@
469srcdir = @srcdir@
470sysconfdir = @sysconfdir@
471target_alias = @target_alias@
472top_build_prefix = @top_build_prefix@
473top_builddir = @top_builddir@
474top_srcdir = @top_srcdir@
475version_info = @version_info@
476x_cflags = @x_cflags@
477x_includes = @x_includes@
478x_libs = @x_libs@
479MAINTAINERCLEANFILES = Makefile.in
480AM_CPPFLAGS = \
481-I$(top_srcdir)/src/lib/ecore \
482-I$(top_builddir)/src/lib/ecore \
483-I$(top_srcdir)/src/lib/ecore_input \
484@TSLIB_CFLAGS@ \
485@EINA_CFLAGS@
486
487lib_LTLIBRARIES = libecore_fb.la
488includes_HEADERS = Ecore_Fb.h
489includesdir = $(includedir)/ecore-@VMAJ@
490libecore_fb_la_SOURCES = \
491ecore_fb.c \
492ecore_fb_vt.c \
493ecore_fb_li.c \
494ecore_fb_ts.c
495
496# deprecated sources (might not compile):
497# ecore_fb_kbd.c
498# ecore_fb_ps2.c
499libecore_fb_la_LIBADD = \
500@TSLIB_LIBS@ \
501$(top_builddir)/src/lib/ecore/libecore.la \
502$(top_builddir)/src/lib/ecore_input/libecore_input.la \
503@EINA_LIBS@
504
505libecore_fb_la_LDFLAGS = -version-info @version_info@ @release_info@
506EXTRA_DIST = \
507ecore_fb_private.h \
508ecore_fb_keytable.h
509
510all: all-am
511
512.SUFFIXES:
513.SUFFIXES: .c .lo .o .obj
514$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
515 @for dep in $?; do \
516 case '$(am__configure_deps)' in \
517 *$$dep*) \
518 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
519 && { if test -f $@; then exit 0; else break; fi; }; \
520 exit 1;; \
521 esac; \
522 done; \
523 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_fb/Makefile'; \
524 $(am__cd) $(top_srcdir) && \
525 $(AUTOMAKE) --gnu src/lib/ecore_fb/Makefile
526.PRECIOUS: Makefile
527Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
528 @case '$?' in \
529 *config.status*) \
530 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
531 *) \
532 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
533 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
534 esac;
535
536$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
537 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
538
539$(top_srcdir)/configure: $(am__configure_deps)
540 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
541$(ACLOCAL_M4): $(am__aclocal_m4_deps)
542 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
543$(am__aclocal_m4_deps):
544install-libLTLIBRARIES: $(lib_LTLIBRARIES)
545 @$(NORMAL_INSTALL)
546 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
547 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
548 list2=; for p in $$list; do \
549 if test -f $$p; then \
550 list2="$$list2 $$p"; \
551 else :; fi; \
552 done; \
553 test -z "$$list2" || { \
554 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
555 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
556 }
557
558uninstall-libLTLIBRARIES:
559 @$(NORMAL_UNINSTALL)
560 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
561 for p in $$list; do \
562 $(am__strip_dir) \
563 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
564 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
565 done
566
567clean-libLTLIBRARIES:
568 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
569 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
570 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
571 test "$$dir" != "$$p" || dir=.; \
572 echo "rm -f \"$${dir}/so_locations\""; \
573 rm -f "$${dir}/so_locations"; \
574 done
575libecore_fb.la: $(libecore_fb_la_OBJECTS) $(libecore_fb_la_DEPENDENCIES)
576 $(AM_V_CCLD)$(libecore_fb_la_LINK) -rpath $(libdir) $(libecore_fb_la_OBJECTS) $(libecore_fb_la_LIBADD) $(LIBS)
577
578mostlyclean-compile:
579 -rm -f *.$(OBJEXT)
580
581distclean-compile:
582 -rm -f *.tab.c
583
584@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb.Plo@am__quote@
585@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb_li.Plo@am__quote@
586@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb_ts.Plo@am__quote@
587@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb_vt.Plo@am__quote@
588
589.c.o:
590@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
591@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
592@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
594@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
595@am__fastdepCC_FALSE@ $(COMPILE) -c $<
596
597.c.obj:
598@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
599@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
600@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
601@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
602@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
603@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
604
605.c.lo:
606@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
607@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
608@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
609@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
610@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
611@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
612
613mostlyclean-libtool:
614 -rm -f *.lo
615
616clean-libtool:
617 -rm -rf .libs _libs
618install-includesHEADERS: $(includes_HEADERS)
619 @$(NORMAL_INSTALL)
620 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
621 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
622 for p in $$list; do \
623 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
624 echo "$$d$$p"; \
625 done | $(am__base_list) | \
626 while read files; do \
627 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
628 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
629 done
630
631uninstall-includesHEADERS:
632 @$(NORMAL_UNINSTALL)
633 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
634 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
635 test -n "$$files" || exit 0; \
636 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
637 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
638
639ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
640 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
641 unique=`for i in $$list; do \
642 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
643 done | \
644 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
645 END { if (nonempty) { for (i in files) print i; }; }'`; \
646 mkid -fID $$unique
647tags: TAGS
648
649TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
650 $(TAGS_FILES) $(LISP)
651 set x; \
652 here=`pwd`; \
653 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
654 unique=`for i in $$list; do \
655 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
656 done | \
657 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
658 END { if (nonempty) { for (i in files) print i; }; }'`; \
659 shift; \
660 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
661 test -n "$$unique" || unique=$$empty_fix; \
662 if test $$# -gt 0; then \
663 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
664 "$$@" $$unique; \
665 else \
666 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
667 $$unique; \
668 fi; \
669 fi
670ctags: CTAGS
671CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
672 $(TAGS_FILES) $(LISP)
673 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
674 unique=`for i in $$list; do \
675 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
676 done | \
677 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
678 END { if (nonempty) { for (i in files) print i; }; }'`; \
679 test -z "$(CTAGS_ARGS)$$unique" \
680 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
681 $$unique
682
683GTAGS:
684 here=`$(am__cd) $(top_builddir) && pwd` \
685 && $(am__cd) $(top_srcdir) \
686 && gtags -i $(GTAGS_ARGS) "$$here"
687
688distclean-tags:
689 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
690
691distdir: $(DISTFILES)
692 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
693 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
694 list='$(DISTFILES)'; \
695 dist_files=`for file in $$list; do echo $$file; done | \
696 sed -e "s|^$$srcdirstrip/||;t" \
697 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
698 case $$dist_files in \
699 */*) $(MKDIR_P) `echo "$$dist_files" | \
700 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
701 sort -u` ;; \
702 esac; \
703 for file in $$dist_files; do \
704 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
705 if test -d $$d/$$file; then \
706 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
707 if test -d "$(distdir)/$$file"; then \
708 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
709 fi; \
710 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
711 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
712 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
713 fi; \
714 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
715 else \
716 test -f "$(distdir)/$$file" \
717 || cp -p $$d/$$file "$(distdir)/$$file" \
718 || exit 1; \
719 fi; \
720 done
721check-am: all-am
722check: check-am
723all-am: Makefile $(LTLIBRARIES) $(HEADERS)
724installdirs:
725 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
726 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
727 done
728install: install-am
729install-exec: install-exec-am
730install-data: install-data-am
731uninstall: uninstall-am
732
733install-am: all-am
734 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
735
736installcheck: installcheck-am
737install-strip:
738 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
739 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
740 `test -z '$(STRIP)' || \
741 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
742mostlyclean-generic:
743
744clean-generic:
745
746distclean-generic:
747 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
748 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
749
750maintainer-clean-generic:
751 @echo "This command is intended for maintainers to use"
752 @echo "it deletes files that may require special tools to rebuild."
753 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
754clean: clean-am
755
756clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
757 mostlyclean-am
758
759distclean: distclean-am
760 -rm -rf ./$(DEPDIR)
761 -rm -f Makefile
762distclean-am: clean-am distclean-compile distclean-generic \
763 distclean-tags
764
765dvi: dvi-am
766
767dvi-am:
768
769html: html-am
770
771html-am:
772
773info: info-am
774
775info-am:
776
777install-data-am: install-includesHEADERS
778
779install-dvi: install-dvi-am
780
781install-dvi-am:
782
783install-exec-am: install-libLTLIBRARIES
784
785install-html: install-html-am
786
787install-html-am:
788
789install-info: install-info-am
790
791install-info-am:
792
793install-man:
794
795install-pdf: install-pdf-am
796
797install-pdf-am:
798
799install-ps: install-ps-am
800
801install-ps-am:
802
803installcheck-am:
804
805maintainer-clean: maintainer-clean-am
806 -rm -rf ./$(DEPDIR)
807 -rm -f Makefile
808maintainer-clean-am: distclean-am maintainer-clean-generic
809
810mostlyclean: mostlyclean-am
811
812mostlyclean-am: mostlyclean-compile mostlyclean-generic \
813 mostlyclean-libtool
814
815pdf: pdf-am
816
817pdf-am:
818
819ps: ps-am
820
821ps-am:
822
823uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
824
825.MAKE: install-am install-strip
826
827.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
828 clean-libLTLIBRARIES clean-libtool ctags distclean \
829 distclean-compile distclean-generic distclean-libtool \
830 distclean-tags distdir dvi dvi-am html html-am info info-am \
831 install install-am install-data install-data-am install-dvi \
832 install-dvi-am install-exec install-exec-am install-html \
833 install-html-am install-includesHEADERS install-info \
834 install-info-am install-libLTLIBRARIES install-man install-pdf \
835 install-pdf-am install-ps install-ps-am install-strip \
836 installcheck installcheck-am installdirs maintainer-clean \
837 maintainer-clean-generic mostlyclean mostlyclean-compile \
838 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
839 tags uninstall uninstall-am uninstall-includesHEADERS \
840 uninstall-libLTLIBRARIES
841
842
843# Tell versions [3.59,3.63) of GNU make to not export all variables.
844# Otherwise a system limit (for SysV at least) may be exceeded.
845.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb.c
deleted file mode 100644
index daeea0f..0000000
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb.c
+++ /dev/null
@@ -1,111 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore_Fb.h"
6#include "ecore_fb_private.h"
7
8static void _ecore_fb_size_get(int *w, int *h);
9
10static int _ecore_fb_init_count = 0;
11static int _ecore_fb_console_w = 0;
12static int _ecore_fb_console_h = 0;
13
14/**
15 * @addtogroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions.
16 *
17 * @{
18 */
19
20/**
21 * @brief Initialize the Ecore_Fb library.
22 *
23 * @param name Device target name.
24 * @return 1 or greater on success, 0 on error.
25 *
26 * This function sets up all the Ecore_Fb library. It returns 0 on
27 * failure, otherwise it returns the number of times it has already
28 * been called.
29 *
30 * When Ecore_Fb is not used anymore, call ecore_fb_shutdown() to shut down
31 * the Ecore_Fb library.
32 */
33EAPI int
34ecore_fb_init(const char *name __UNUSED__)
35{
36 if (++_ecore_fb_init_count != 1)
37 return _ecore_fb_init_count;
38
39 if (!ecore_fb_vt_init())
40 return --_ecore_fb_init_count;
41
42 _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
43
44 return _ecore_fb_init_count;
45}
46
47/**
48 * @brief Shut down the Ecore_Fb library.
49 *
50 * @return 0 when the library is completely shut down, 1 or
51 * greater otherwise.
52 *
53 * This function shuts down the Ecore_Fb library. It returns 0 when it has
54 * been called the same number of times than ecore_fb_init().
55 */
56EAPI int
57ecore_fb_shutdown(void)
58{
59 if (--_ecore_fb_init_count != 0)
60 return _ecore_fb_init_count;
61
62 ecore_fb_vt_shutdown();
63
64 return _ecore_fb_init_count;
65}
66
67
68/**
69 * @brief Retrieve the width and height of the current frame buffer in
70 * pixels.
71 *
72 * @param w Pointer to an integer in which to store the width.
73 * @param h Pointer to an interge in which to store the height.
74 *
75 * This function retrieves the size of the current frame buffer in
76 * pixels. @p w and @p h can be buffers that will be filled with the
77 * corresponding values. If one of them is @c NULL, nothing will be
78 * done for that parameter.
79 */
80EAPI void
81ecore_fb_size_get(int *w, int *h)
82{
83 if (w) *w = _ecore_fb_console_w;
84 if (h) *h = _ecore_fb_console_h;
85}
86
87static void
88_ecore_fb_size_get(int *w, int *h)
89{
90 struct fb_var_screeninfo fb_var;
91 int fb;
92
93 fb = open("/dev/fb0", O_RDWR);
94 if (fb < 0)
95 goto exit;
96
97 if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1)
98 goto err_ioctl;
99
100 *w = fb_var.xres;
101 *h = fb_var.yres;
102
103err_ioctl:
104 close(fb);
105exit:
106 return;
107}
108
109/**
110 * @}
111 */
diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h b/libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h
deleted file mode 100644
index 38de7bf..0000000
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/* this table was taken from ecore_fb, is the default en layout */
2 "0x00", "0x00", "0x00", /**/"", "", "",/***/
3 "Escape", "Escape", "Escape", /**/"", "", "",/***/
4 "1", "exclam", "1", /**/"1", "!", "1",/***/
5 "2", "at", "2", /**/"2", "@", "2",/***/
6 "3", "numbersign", "3", /**/"3", "#", "3",/***/
7 "4", "dollar", "4", /**/"4", "$", "4",/***/
8 "5", "percent", "5", /**/"5", "%", "5",/***/
9 "6", "asciicircumm", "6", /**/"6", "^", "6",/***/
10 "7", "ampersand", "7", /**/"7", "&", "7",/***/
11 "8", "asterisk", "8", /**/"8", "*", "8",/***/
12 "9", "parenleft", "9", /**/"9", "(", "9",/***/
13 "0", "parenright", "0", /**/"0", ")", "0",/***/
14 "minus", "underscore", "minus", /**/"-", "_", "-",/***/
15 "equal", "plus", "equal", /**/"=", "+", "=",/***/
16 "BackSpace", "BackSpace", "BackSpace", /**/"\010","\010","\010",/***/
17 "Tab", "ISO_Left_Tab", "Tab", /**/"\011","", "\011",/***/
18 "q", "Q", "Q", /**/"q", "Q", "Q",/***/
19 "w", "W", "W", /**/"w", "W", "W",/***/
20 "e", "E", "E", /**/"e", "E", "E",/***/
21 "r", "R", "R", /**/"r", "R", "R",/***/
22 "t", "T", "T", /**/"t", "T", "T",/***/
23 "y", "Y", "Y", /**/"y", "Y", "Y",/***/
24 "u", "U", "U", /**/"u", "U", "U",/***/
25 "i", "I", "I", /**/"i", "I", "I",/***/
26 "o", "O", "O", /**/"o", "O", "O",/***/
27 "p", "P", "P", /**/"p", "P", "P",/***/
28 "bracketleft", "braceleft", "bracketleft", /**/"[", "{", "[",/***/
29 "bracketright", "braceright", "bracketright", /**/"]", "}", "]",/***/
30 "Return", "Return", "Return", /**/"\015","\015","\015",/***/
31 "Control_L", "Control_L", "Control_L", /**/"", "", "",/***/
32 "a", "A", "A", /**/"a", "A", "A",/***/
33 "s", "S", "S", /**/"s", "S", "S",/***/
34 "d", "D", "D", /**/"d", "D", "D",/***/
35 "f", "F", "F", /**/"f", "F", "F",/***/
36 "g", "G", "G", /**/"g", "G", "G",/***/
37 "h", "h", "H", /**/"h", "H", "H",/***/
38 "j", "J", "J", /**/"j", "J", "J",/***/
39 "k", "K", "K", /**/"k", "K", "K",/***/
40 "l", "L", "L", /**/"l", "L", "L",/***/
41 "semicolon", "colon", "semicolon", /**/";", ":", ";",/***/
42 "apostrophe", "quotedbl", "apostrophe", /**/"'", "\"", "'",/***/
43 "grave", "asciitilde", "grave", /**/"`", "~", "`",/***/
44 "Shift_L", "Shift_L", "Shift_L", /**/"", "", "",/***/
45 "backslash", "bar", "backslash", /**/"\\", "|", "\\",/***/
46 "z", "Z", "Z", /**/"z", "Z", "Z",/***/
47 "x", "X", "X", /**/"x", "X", "X",/***/
48 "c", "C", "C", /**/"c", "C", "C",/***/
49 "v", "V", "V", /**/"v", "V", "V",/***/
50 "b", "B", "B", /**/"b", "B", "B",/***/
51 "n", "N", "N", /**/"n", "N", "N",/***/
52 "m", "M", "M", /**/"m", "M", "M",/***/
53 "comma", "less", "comma", /**/",", "<", ",",/***/
54 "period", "greater", "period", /**/".", ">", ".",/***/
55 "slash", "question", "slash", /**/"/", "?", "/",/***/
56 "Shift_R", "Shift_R", "Shift_R", /**/"", "", "",/***/
57 "KP_Multiply", "KP_Multiply", "KP_Multiply", /**/"", "*", "",/***/
58 "Alt_L", "Alt_L", "Alt_L", /**/"", "", "",/***/
59 "space", "space", "space", /**/" ", " ", " ",/***/
60 "Caps_Lock", "Caps_Lock", "Caps_Lock", /**/"", "", "",/***/
61 "F1", "F1", "F1", /**/"", "", "",/***/
62 "F2", "F2", "F2", /**/"", "", "",/***/
63 "F3", "F3", "F3", /**/"", "", "",/***/
64 "F4", "F4", "F4", /**/"", "", "",/***/
65 "F5", "F5", "F5", /**/"", "", "",/***/
66 "F6", "F6", "F6", /**/"", "", "",/***/
67 "F7", "F7", "F7", /**/"", "", "",/***/
68 "F8", "F8", "F8", /**/"", "", "",/***/
69 "F9", "F9", "F9", /**/"", "", "",/***/
70 "F10", "F10", "F10", /**/"", "", "",/***/
71 "Num_Lock", "Num_Lock", "Num_Lock", /**/"", "", "",/***/
72 "Scroll_Lock", "Scroll_Lock", "Scroll_Lock", /**/"", "", "",/***/
73 "KP_Home", "KP_7", "KP_Home", /**/"", "7", "",/***/
74 "KP_Up", "KP_8", "KP_Up", /**/"", "8", "",/***/
75 "KP_Prior", "KP_9", "KP_Prior", /**/"", "9", "",/***/
76 "KP_Subtract", "KP_Subtract", "KP_Subtract", /**/"", "", "",/***/
77 "KP_Left", "KP_4", "KP_Left", /**/"", "4", "",/***/
78 "KP_Begin", "KP_5", "KP_Begin", /**/"", "5", "",/***/
79 "KP_Right", "KP_6", "KP_Right", /**/"", "6", "",/***/
80 "KP_Add", "KP_Add", "KP_Add", /**/"", "", "",/***/
81 "KP_End", "KP_1", "KP_End", /**/"", "1", "",/***/
82 "KP_Down", "KP_2", "KP_Down", /**/"", "2", "",/***/
83 "KP_Next", "KP_3", "KP_Next", /**/"", "3", "",/***/
84 "KP_Insert", "KP_0", "KP_Insert", /**/"", "0", "",/***/
85 "KP_Delete", "KP_Decimal", "KP_Delete", /**/"", ".", "",/***/
86 "0x54", "0x54", "0x54", /**/"", "", "",/***/
87 "0x55", "0x55", "0x55", /**/"", "", "",/***/
88 "0x56", "0x56", "0x56", /**/"", "", "",/***/
89 "F11", "F11", "F11", /**/"", "", "",/***/
90 "F12", "F12", "F12", /**/"", "", "",/***/
91 "0x59", "0x59", "0x59", /**/"", "", "",/***/
92 "0x5a", "0x5a", "0x5a", /**/"", "", "",/***/
93 "0x5b", "0x5b", "0x5b", /**/"", "", "",/***/
94 "0x5c", "0x5c", "0x5c", /**/"", "", "",/***/
95 "0x5d", "0x5d", "0x5d", /**/"", "", "",/***/
96 "0x5e", "0x5e", "0x5e", /**/"", "", "",/***/
97 "0x5f", "0x5f", "0x5f", /**/"", "", "",/***/
98 "KP_Enter", "KP_Enter", "KP_Enter", /**/"", "", "",/***/
99 "Control_R", "Control_R", "Control_R", /**/"", "", "",/***/
100 "KP_Divide", "KP_Divide", "KP_Divide", /**/"", "", "",/***/
101 "Print", "Print", "Print", /**/"", "", "",/***/
102 "Alt_R", "Alt_R", "Alt_R", /**/"", "", "",/***/
103 "0x65", "0x65", "0x65", /**/"", "", "",/***/
104 "Home", "Home", "Home", /**/"", "", "",/***/
105 "Up", "Up", "Up", /**/"", "", "",/***/
106 "Prior", "Prior", "Prior", /**/"", "", "",/***/
107 "Left", "Left", "Left", /**/"", "", "",/***/
108 "Right", "Right", "Right", /**/"", "", "",/***/
109 "End", "End", "End", /**/"", "", "",/***/
110 "Down", "Down", "Down", /**/"", "", "",/***/
111 "Next", "Next", "Next", /**/"", "", "",/***/
112 "Insert", "Insert", "Insert", /**/"", "", "",/***/
113 "Delete", "Delete", "Delete", /**/"\177","\177","\177",/***/
114 "0x70", "0x70", "0x70", /**/"", "", "",/***/
115 "0x71", "0x71", "0x71", /**/"", "", "",/***/
116 "0x72", "0x72", "0x72", /**/"", "", "",/***/
117 "0x73", "0x73", "0x73", /**/"", "", "",/***/
118 "0x74", "0x74", "0x74", /**/"", "", "",/***/
119 "0x75", "0x75", "0x75", /**/"", "", "",/***/
120 "0x76", "0x76", "0x76", /**/"", "", "",/***/
121 "Pause", "Pause", "Pause", /**/"", "", "",/***/
122 "0x78", "0x78", "0x78", /**/"", "", "",/***/
123 "0x79", "0x79", "0x79", /**/"", "", "",/***/
124 "0x7a", "0x7a", "0x7a", /**/"", "", "",/***/
125 "0x7b", "0x7b", "0x7b", /**/"", "", "",/***/
126 "0x7c", "0x7c", "0x7c", /**/"", "", "",/***/
127 "Super_L", "Super_L", "Super_L", /**/"", "", "",/***/
128 "Super_R", "Super_R", "Super_R", /**/"", "", "",/***/
129 "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
deleted file mode 100644
index 3850792..0000000
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c
+++ /dev/null
@@ -1,708 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#include "Ecore_Fb.h"
8#include "ecore_fb_private.h"
9
10#define CLICK_THRESHOLD_DEFAULT 0.25
11
12static Eina_List *_ecore_fb_li_devices = NULL;
13
14static const char *_ecore_fb_li_kbd_syms[128 * 6] =
15{
16#include "ecore_fb_keytable.h"
17};
18
19/* Initial Copyright (C) Brad Hards (1999-2002),
20 * this function is used to tell if "bit" is set in "array"
21 * it selects a byte from the array, and does a boolean AND
22 * operation with a byte that only has the relevant bit set.
23 * eg. to check for the 12th bit, we do (array[1] & 1<<4).
24 * Moved to static inline in order to force compiler to otimized
25 * the unsued part away or force a link error if long has an unexpected
26 * size.
27 * - bigeasy
28 */
29extern int long_has_neither_32_nor_64_bits(void);
30static inline int
31test_bit(int bit, unsigned long *array)
32{
33 if (sizeof(long) == 4)
34 return array[bit / 32] & (1 << (bit % 32));
35 else if (sizeof(long) == 8)
36 return array[bit / 64] & (1 << (bit % 64));
37 else long_has_neither_32_nor_64_bits();
38}
39
40static void
41_ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *iev)
42{
43 if (!dev->listen) return;
44
45 /* check for basic keyboard keys */
46 if ((iev->code >= KEY_ESC) && (iev->code <= KEY_COMPOSE))
47 {
48 int offset = 0;
49 const char *keyname = _ecore_fb_li_kbd_syms[iev->code * 6];
50 /* check the key table */
51 if (iev->value)
52 {
53 /* its a repeated key, dont increment */
54 if (iev->value == 2)
55 return;
56 if (!strcmp(keyname, "Control_L"))
57 dev->keyboard.ctrl++;
58 else if (!strcmp(keyname, "Control_R"))
59 dev->keyboard.ctrl++;
60 else if (!strcmp(keyname, "Alt_L"))
61 dev->keyboard.alt++;
62 else if (!strcmp(keyname, "Alt_R"))
63 dev->keyboard.alt++;
64 else if (!strcmp(keyname, "Shift_L"))
65 dev->keyboard.shift++;
66 else if (!strcmp(keyname, "Shift_R"))
67 dev->keyboard.shift++;
68 else if (!strcmp(keyname, "Caps_Lock"))
69 dev->keyboard.lock = !dev->keyboard.lock;
70 if (dev->keyboard.ctrl > 2) dev->keyboard.ctrl = 2;
71 if (dev->keyboard.alt > 2) dev->keyboard.alt = 2;
72 if (dev->keyboard.shift > 2) dev->keyboard.shift = 2;
73 if (dev->keyboard.lock > 1) dev->keyboard.lock = 1;
74 }
75 else
76 {
77 if (!strcmp(keyname, "Control_L"))
78 dev->keyboard.ctrl--;
79 else if (!strcmp(keyname, "Control_R"))
80 dev->keyboard.ctrl--;
81 else if (!strcmp(keyname, "Alt_L"))
82 dev->keyboard.alt--;
83 else if (!strcmp(keyname, "Alt_R"))
84 dev->keyboard.alt--;
85 else if (!strcmp(keyname, "Shift_L"))
86 dev->keyboard.shift--;
87 else if (!strcmp(keyname, "Shift_R"))
88 dev->keyboard.shift--;
89 if (dev->keyboard.ctrl < 0) dev->keyboard.ctrl = 0;
90 if (dev->keyboard.alt < 0) dev->keyboard.alt = 0;
91 if (dev->keyboard.shift < 0) dev->keyboard.shift = 0;
92 if (dev->keyboard.lock < 0) dev->keyboard.lock = 0;
93 }
94
95 /* sending ecore_input_evas events */
96 Ecore_Event_Key *e;
97
98 if (dev->keyboard.shift) offset = 1;
99 else if (dev->keyboard.lock) offset = 2;
100
101 const char *key = _ecore_fb_li_kbd_syms[(iev->code * 6) + offset];
102 const char *compose = _ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset];
103
104 e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) +
105 strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
106 e->keyname = (char *)(e + 1);
107 e->key = e->keyname + strlen(keyname) + 1;
108 e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
109 e->string = e->compose;
110
111 strcpy((char *)e->keyname, keyname);
112 strcpy((char *)e->key, key);
113 if (compose)
114 strcpy((char *)e->compose, compose);
115
116 e->modifiers = 0;
117 if (dev->keyboard.shift)
118 e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
119 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
120 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
121 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
122
123 e->timestamp = ecore_time_get();
124 e->window = (Ecore_Window)dev->window;
125 e->event_window = (Ecore_Window)dev->window;
126 e->root_window = (Ecore_Window)dev->window;
127 e->same_screen = 1;
128
129 if (iev->value)
130 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
131 else
132 ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
133 }
134 /* check for mouse button events */
135 else if ((iev->code >= BTN_MOUSE) && (iev->code < BTN_JOYSTICK))
136 {
137 int button;
138 Ecore_Event_Mouse_Button *e;
139 double current = ecore_time_get();
140
141 button = ((iev->code & 0x00F) + 1);
142 if (iev->value)
143 {
144 dev->mouse.did_double = EINA_FALSE;
145 dev->mouse.did_triple = EINA_FALSE;
146
147 if (((current - dev->mouse.prev) <= dev->mouse.threshold) &&
148 (button == dev->mouse.prev_button))
149 {
150 dev->mouse.did_double = EINA_TRUE;
151 if (((current - dev->mouse.last) <= (2 * dev->mouse.threshold)) &&
152 (button == dev->mouse.last_button))
153 {
154 dev->mouse.did_triple = EINA_TRUE;
155 /* reset */
156 dev->mouse.prev = 0;
157 dev->mouse.last = 0;
158 current = 0;
159 }
160 }
161 dev->mouse.last = dev->mouse.prev;
162 dev->mouse.prev = current;
163 dev->mouse.last_button = dev->mouse.prev_button;
164 dev->mouse.prev_button = button;
165 }
166
167 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
168 if (!e)
169 return;
170
171 e->timestamp = current;
172 e->window = (Ecore_Window)dev->window;
173 e->event_window = (Ecore_Window)dev->window;
174 e->root_window = (Ecore_Window)dev->window;
175 e->same_screen = 1;
176
177 e->modifiers = 0;
178 if (dev->keyboard.shift)
179 e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
180 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
181 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
182 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
183
184 e->x = dev->mouse.x;
185 e->y = dev->mouse.y;
186 e->root.x = e->x;
187 e->root.y = e->y;
188 e->buttons = button;
189
190 if (dev->mouse.did_double)
191 e->double_click = 1;
192 if (dev->mouse.did_triple)
193 e->triple_click = 1;
194
195 if (iev->value)
196 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
197 else
198 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
199 }
200}
201
202static void
203_ecore_fb_li_device_event_rel(Ecore_Fb_Input_Device *dev, struct input_event *iev)
204{
205 if (!dev->listen) return;
206 /* dispatch the button events if they are queued */
207 switch (iev->code)
208 {
209 case REL_X:
210 case REL_Y:
211 {
212 Ecore_Event_Mouse_Move *e;
213 if(iev->code == REL_X)
214 {
215 dev->mouse.x += iev->value;
216 if(dev->mouse.x > dev->mouse.w - 1)
217 dev->mouse.x = dev->mouse.w;
218 else if(dev->mouse.x < 0)
219 dev->mouse.x = 0;
220 }
221 else
222 {
223 dev->mouse.y += iev->value;
224 if(dev->mouse.y > dev->mouse.h - 1)
225 dev->mouse.y = dev->mouse.h;
226 else if(dev->mouse.y < 0)
227 dev->mouse.y = 0;
228 }
229
230 e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
231 if (!e)
232 return;
233
234 e->window = (Ecore_Window)dev->window;
235 e->event_window = (Ecore_Window)dev->window;
236 e->root_window = (Ecore_Window)dev->window;
237 e->same_screen = 1;
238
239 e->modifiers = 0;
240 if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
241 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
242 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
243 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
244
245 e->x = dev->mouse.x;
246 e->y = dev->mouse.y;
247 e->root.x = e->x;
248 e->root.y = e->y;
249
250 e->timestamp = ecore_time_get();
251
252 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
253
254 break;
255 }
256 case REL_WHEEL:
257 case REL_HWHEEL:
258 {
259 Ecore_Event_Mouse_Wheel *e;
260
261 e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
262 if (!e)
263 return;
264
265 e->x = dev->mouse.x;
266 e->y = dev->mouse.y;
267 if (iev->code == REL_HWHEEL) e->direction = 1;
268 e->z = iev->value;
269 e->root.x = dev->mouse.x;
270 e->root.y = dev->mouse.y;
271
272 e->window = (Ecore_Window)dev->window;
273 e->event_window = (Ecore_Window)dev->window;
274 e->root_window = (Ecore_Window)dev->window;
275 e->same_screen = 1;
276
277 e->modifiers = 0;
278 if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
279 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
280 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
281 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
282
283 e->timestamp = ecore_time_get();
284
285 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
286
287 break;
288 }
289 default:
290 break;
291 }
292}
293
294static void
295_ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *iev)
296{
297 static int prev_pressure = 0;
298 int pressure;
299
300 if (!dev->listen) return;
301 switch (iev->code)
302 {
303 case ABS_X:
304 if (dev->mouse.w != 0)
305 {
306 int tmp;
307
308 tmp = (int)((double)(iev->value - dev->mouse.min_w) / dev->mouse.rel_w);
309 if (tmp < 0) dev->mouse.x = 0;
310 else if (tmp > dev->mouse.w) dev->mouse.x = dev->mouse.w;
311 else dev->mouse.x = tmp;
312 dev->mouse.event = ECORE_EVENT_MOUSE_MOVE;
313 }
314 break;
315
316 case ABS_Y:
317 if(dev->mouse.h != 0)
318 {
319 int tmp;
320
321 tmp = (int)((double)(iev->value - dev->mouse.min_h) / dev->mouse.rel_h);
322 if (tmp < 0) dev->mouse.y = 0;
323 else if (tmp > dev->mouse.h) dev->mouse.y = dev->mouse.h;
324 else dev->mouse.y = tmp;
325 dev->mouse.event = ECORE_EVENT_MOUSE_MOVE;
326 }
327 break;
328
329 case ABS_PRESSURE:
330 pressure = iev->value;
331 if ((pressure) && (!prev_pressure))
332 {
333 /* DOWN: mouse is down, but was not before */
334 dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_DOWN;
335 }
336 else if ((!pressure) && (prev_pressure))
337 {
338 /* UP: mouse was down, but is not now */
339 dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_UP;
340 }
341 prev_pressure = pressure;
342 break;
343 }
344}
345
346static void
347_ecore_fb_li_device_event_syn(Ecore_Fb_Input_Device *dev, struct input_event *iev __UNUSED__)
348{
349 if (!dev->listen) return;
350
351 if (dev->mouse.event == ECORE_EVENT_MOUSE_MOVE)
352 {
353 Ecore_Event_Mouse_Move *ev;
354 ev = calloc(1,sizeof(Ecore_Event_Mouse_Move));
355 ev->x = dev->mouse.x;
356 ev->y = dev->mouse.y;
357 ev->root.x = ev->x;
358 ev->root.y = ev->y;
359 ev->timestamp = ecore_time_get();
360 }
361 else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
362 {
363 Ecore_Event_Mouse_Button *ev;
364 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
365 ev->x = dev->mouse.x;
366 ev->y = dev->mouse.y;
367 ev->root.x = ev->x;
368 ev->root.y = ev->y;
369 ev->buttons = 1;
370 ev->timestamp = ecore_time_get();
371 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
372 }
373 else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_UP)
374 {
375 Ecore_Event_Mouse_Button *ev;
376 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
377 ev->x = dev->mouse.x;
378 ev->y = dev->mouse.y;
379 ev->root.x = ev->x;
380 ev->root.y = ev->y;
381 ev->buttons = 1;
382 ev->timestamp = ecore_time_get();
383 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
384 }
385}
386
387static Eina_Bool
388_ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh __UNUSED__)
389{
390 Ecore_Fb_Input_Device *dev;
391 struct input_event ev[64];
392 int len;
393 int i;
394
395 dev = (Ecore_Fb_Input_Device*)data;
396 /* read up to 64 events at once */
397 len = read(dev->fd, &ev, sizeof(ev));
398 for(i = 0; i < (int)(len / sizeof(ev[0])); i++)
399 {
400 switch(ev[i].type)
401 {
402 case EV_SYN:
403 _ecore_fb_li_device_event_syn(dev, &ev[i]);
404 break;
405 case EV_ABS:
406 _ecore_fb_li_device_event_abs(dev, &ev[i]);
407 break;
408 case EV_REL:
409 _ecore_fb_li_device_event_rel(dev, &ev[i]);
410 break;
411 case EV_KEY:
412 _ecore_fb_li_device_event_key(dev, &ev[i]);
413 break;
414 default:
415 break;
416 }
417 }
418 return EINA_TRUE;
419}
420
421/**
422 * @addtogroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions.
423 *
424 * @{
425 */
426
427/**
428 * @brief Set the listen mode for an input device .
429 *
430 * @param dev The device to set the mode of.
431 * @param listen EINA_FALSE to disable listening mode, EINA_TRUE to enable it.
432 *
433 * This function enables or disables listening on the input device @p
434 * dev. If @p listen is #EINA_FALSE, listening mode is disabled, if it
435 * is #EINA_TRUE, it is enabled.
436 */
437EAPI void
438ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen)
439{
440 if (!dev) return;
441 if ((listen && dev->listen) || (!listen && !dev->listen)) return;
442 if (listen)
443 {
444 /* if the device already had a handler */
445 if (!dev->handler)
446 dev->handler = ecore_main_fd_handler_add(dev->fd, ECORE_FD_READ, _ecore_fb_li_device_fd_callback, dev, NULL, NULL);
447
448 }
449 dev->listen = listen;
450}
451
452#ifndef EV_CNT
453# define EV_CNT (EV_MAX+1)
454#endif
455
456/**
457 * @brief Associates an input device with the given @ref Ecore_Evas_Group.
458 *
459 * @param dev The input being associated with an @ref Ecore_Evas_Group (not @c NULL).
460 * @param window The window which this input is being associated to.
461 * @c NULL will remove any previous association.
462 *
463 * Events generated by this device will have a pointer to @p window. If this @p
464 * window is registered with ecore_event_window_register() or
465 * ecore_evas_input_event_register(), respective evas events will be delivered
466 * by the ecore_input_evas system. An example can be seen in the following code:
467 *
468 * @code
469 * Ecore_Evas *ee = ecore_evas_new(NULL, 0, 0, 800, 600, NULL);
470 *
471 * ecore_evas_input_event_register(ee);
472 *
473 * device = ecore_fb_input_device_open(device_path);
474 * if (device)
475 * ecore_fb_input_device_window_set(device, ee);
476 *
477 * @endcode
478 *
479 * On the previous code, all input captured on the mentioned device will be
480 * delivered to the @c Ecore_Evas @c ee.
481 *
482 * @since 1.1
483 */
484EAPI void
485ecore_fb_input_device_window_set(Ecore_Fb_Input_Device *dev, void *window)
486{
487 if (!dev) return;
488
489 dev->window = window;
490}
491
492/**
493 * @brief Open an input device.
494 *
495 * @param dev The device to open.
496 * @return The @ref Ecore_Fb_Input_Device object that has been opened.
497 *
498 * This function opens the input device named @p dev and returns the
499 * object for it, or returns @c NULL on failure.
500 */
501EAPI Ecore_Fb_Input_Device *
502ecore_fb_input_device_open(const char *dev)
503{
504 Ecore_Fb_Input_Device *device;
505 unsigned long event_type_bitmask[EV_CNT / 32 + 1];
506 int event_type;
507 int fd;
508
509 if (!dev) return NULL;
510 device = calloc(1, sizeof(Ecore_Fb_Input_Device));
511 if (!device) return NULL;
512
513 if ((fd = open(dev, O_RDONLY, O_NONBLOCK)) < 0)
514 {
515 fprintf(stderr, "[ecore_fb_li:device_open] %s %s", dev, strerror(errno));
516 goto error_open;
517 }
518 /* query capabilities */
519 if (ioctl(fd, EVIOCGBIT(0, EV_MAX), event_type_bitmask) < 0)
520 {
521 fprintf(stderr,"[ecore_fb_li:device_open] query capabilities %s %s", dev, strerror(errno));
522 goto error_caps;
523 }
524 /* query name */
525 device->info.name = calloc(256, sizeof(char));
526 if (ioctl(fd, EVIOCGNAME(sizeof(char) * 256), device->info.name) < 0)
527 {
528 fprintf(stderr, "[ecore_fb_li:device_open] get name %s %s", dev, strerror(errno));
529 strcpy(device->info.name, "Unknown");
530 }
531 device->fd = fd;
532 device->info.dev = strdup(dev);
533 /* common */
534 device->mouse.threshold = CLICK_THRESHOLD_DEFAULT;
535
536 /* set info */
537 for (event_type = 0; event_type < EV_MAX; event_type++)
538 {
539 if(!test_bit(event_type, event_type_bitmask))
540 continue;
541 switch (event_type)
542 {
543 case EV_SYN:
544 break;
545 case EV_KEY:
546 device->info.cap |= ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS;
547 break;
548 case EV_REL:
549 device->info.cap |= ECORE_FB_INPUT_DEVICE_CAP_RELATIVE;
550 break;
551 case EV_ABS:
552 device->info.cap |= ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE;
553 break;
554 case EV_MSC:
555 case EV_LED:
556 case EV_SND:
557 case EV_REP:
558 case EV_FF :
559 case EV_FF_STATUS:
560 case EV_PWR:
561 default:
562 break;
563 }
564 }
565
566 _ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device);
567 return device;
568
569error_caps:
570 close(fd);
571error_open:
572 free(device);
573 return NULL;
574}
575
576/**
577 * @brief Close the given device.
578 *
579 * @param dev The device to close
580 *
581 * This function closes the device @p dev. If @p dev is @c NULL, this
582 * function does nothing.
583 */
584EAPI void
585ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev)
586{
587 if (!dev || dev->fd < 0) return;
588 /* close the fd */
589 close(dev->fd);
590 /* remove the element from the list */
591 _ecore_fb_li_devices = eina_list_remove(_ecore_fb_li_devices, dev);
592 free(dev);
593}
594
595
596/**
597 * @brief Set the axis size of the given device.
598 *
599 * @param dev The device to set the axis size to.
600 * @param w The width of the axis.
601 * @param h The height of the axis.
602 *
603 * This function sets set the width @p w and height @p h of the axis
604 * of device @p dev. If @p dev is a relative input device, a width and
605 * height must set for it. If its absolute set the ioctl correctly, if
606 * not, unsupported device.
607 */
608EAPI void
609ecore_fb_input_device_axis_size_set(Ecore_Fb_Input_Device *dev, int w, int h)
610{
611 if (!dev) return;
612 if ((w < 0) || (h < 0)) return;
613 /* FIXME
614 * this code is for a touchscreen device,
615 * make it configurable (ABSOLUTE | RELATIVE)
616 */
617 if (dev->info.cap & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)
618 {
619 /* FIXME looks like some kernels dont include this struct */
620 struct input_absinfo abs_features;
621
622 ioctl(dev->fd, EVIOCGABS(ABS_X), &abs_features);
623 dev->mouse.min_w = abs_features.minimum;
624 dev->mouse.rel_w = (double)(abs_features.maximum - abs_features.minimum)/(double)(w);
625
626 ioctl(dev->fd, EVIOCGABS(ABS_Y), &abs_features);
627 dev->mouse.min_h = abs_features.minimum;
628 dev->mouse.rel_h = (double)(abs_features.maximum - abs_features.minimum)/(double)(h);
629 }
630 else if (!(dev->info.cap & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE))
631 return;
632
633 /* update the local values */
634 if (dev->mouse.x > w - 1) dev->mouse.x = w -1;
635 if (dev->mouse.y > h - 1) dev->mouse.y = h -1;
636 dev->mouse.w = w;
637 dev->mouse.h = h;
638}
639
640/**
641 * @brief Retrieve the name of the given device.
642 *
643 * @param dev The device to get the name from.
644 * @return The name of the device.
645 *
646 * This function returns the name of the device @p dev. If @p dev is
647 * @c NULL, this function returns @c NULL.
648 */
649EAPI const char *
650ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev)
651{
652 if (!dev) return NULL;
653 return dev->info.name;
654}
655
656/**
657 * @brief Retrieve the capability of the given device.
658 *
659 * @param dev The device to get the name from.
660 * @return The capability of the device.
661 *
662 * This function returns the capability of the device @p dev. If @p dev is
663 * @c NULL, this function returns #ECORE_FB_INPUT_DEVICE_CAP_NONE.
664 */
665EAPI Ecore_Fb_Input_Device_Cap
666ecore_fb_input_device_cap_get(Ecore_Fb_Input_Device *dev)
667{
668 if (!dev) return ECORE_FB_INPUT_DEVICE_CAP_NONE;
669 return dev->info.cap;
670}
671
672/**
673 * @brief Set the threshold of mouse clicks of the given device.
674 *
675 * @param dev The device to set the threshodl mouse click to.
676 * @param threshold The threshold value.
677 *
678 * This function sets the threshold of mouse clicks of the device
679 * @p dev to @p threshold. If @p dev is @c NULL, this function does
680 * nothing.
681 */
682EAPI void
683ecore_fb_input_device_threshold_click_set(Ecore_Fb_Input_Device *dev, double threshold)
684{
685 if (!dev) return;
686 if ((threshold == dev->mouse.threshold) || (threshold == 0)) return;
687 dev->mouse.threshold = threshold;
688}
689
690/**
691 * @brief Get the threshold of mouse clicks of the given device.
692 *
693 * @param dev The device to set the threshodl mouse click from.
694 * @return The threshold value.
695 *
696 * This function returns the threshold of mouse clicks of the device
697 * @p dev. If @p dev is @c NULL, this function returns 0.0.
698 */
699EAPI double
700ecore_fb_input_device_threshold_click_get(Ecore_Fb_Input_Device *dev)
701{
702 if (!dev) return 0;
703 return dev->mouse.threshold;
704}
705
706/**
707 * @}
708 */
diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h b/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h
deleted file mode 100644
index 797f863..0000000
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h
+++ /dev/null
@@ -1,94 +0,0 @@
1#ifndef _ECORE_FB_PRIVATE_H
2#define _ECORE_FB_PRIVATE_H
3
4#include "Ecore.h"
5#include "ecore_private.h"
6#include "Ecore_Input.h"
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include <unistd.h>
12#include <termios.h>
13#include <sys/types.h>
14#include <sys/stat.h>
15#include <sys/ioctl.h>
16#include <linux/version.h>
17#include <linux/kd.h>
18#include <linux/vt.h>
19#include <linux/fb.h>
20#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
21 #define kernel_ulong_t unsigned long
22 #define BITS_PER_LONG 32
23 #include <linux/input.h>
24 #undef kernel_ulong_t
25 #undef BITS_PER_LONG
26#else
27 #include <linux/input.h>
28#endif
29
30#include <signal.h>
31#include <fcntl.h>
32#include <errno.h>
33
34#include <Ecore_Fb.h>
35
36/* ecore_fb_li.c */
37struct _Ecore_Fb_Input_Device
38{
39 int fd;
40 Ecore_Fd_Handler *handler;
41 int listen;
42 struct {
43 Ecore_Fb_Input_Device_Cap cap;
44 char *name;
45 char *dev;
46 } info;
47 struct
48 {
49 /* common mouse */
50 int x,y;
51 int w,h;
52
53 double last;
54 double prev;
55 double threshold;
56 Eina_Bool did_double;
57 Eina_Bool did_triple;
58 /* absolute axis */
59 int min_w, min_h;
60 double rel_w, rel_h;
61 int event;
62 int prev_button;
63 int last_button;
64 } mouse;
65 struct
66 {
67 int shift;
68 int ctrl;
69 int alt;
70 int lock;
71 } keyboard;
72 void *window;
73};
74
75/* ecore_fb_ts.c */
76EAPI int ecore_fb_ts_init(void);
77EAPI void ecore_fb_ts_shutdown(void);
78EAPI void ecore_fb_ts_events_window_set(void *window);
79EAPI void *ecore_fb_ts_events_window_get(void);
80EAPI void ecore_fb_ts_event_window_set(void *window);
81
82/* ecore_fb_vt.c */
83int ecore_fb_vt_init(void);
84void ecore_fb_vt_shutdown(void);
85
86/* hacks to stop people NEEDING #include <linux/h3600_ts.h> */
87#ifndef TS_SET_CAL
88#define TS_SET_CAL 0x4014660b
89#endif
90#ifndef TS_GET_CAL
91#define TS_GET_CAL 0x8014660a
92#endif
93
94#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
deleted file mode 100644
index 395e768..0000000
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c
+++ /dev/null
@@ -1,355 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef HAVE_TSLIB
6# include <tslib.h>
7# include <errno.h>
8#endif
9
10#include "Ecore_Fb.h"
11#include "ecore_fb_private.h"
12
13typedef struct _Ecore_Fb_Ts_Event Ecore_Fb_Ts_Event;
14typedef struct _Ecore_Fb_Ts_Calibrate Ecore_Fb_Ts_Calibrate;
15typedef struct _Ecore_Fb_Ts_Backlight Ecore_Fb_Ts_Backlight;
16typedef struct _Ecore_Fb_Ts_Contrast Ecore_Fb_Ts_Contrast;
17typedef struct _Ecore_Fb_Ts_Led Ecore_Fb_Ts_Led;
18typedef struct _Ecore_Fb_Ts_Flite Ecore_Fb_Ts_Flite;
19
20struct _Ecore_Fb_Ts_Event
21{
22 unsigned short pressure;
23 unsigned short x;
24 unsigned short y;
25 unsigned short _unused;
26};
27
28struct _Ecore_Fb_Ts_Calibrate
29{
30 int xscale;
31 int xtrans;
32 int yscale;
33 int ytrans;
34 int xyswap;
35};
36
37struct _Ecore_Fb_Ts_Backlight
38{
39 int on;
40 unsigned char brightness;
41};
42
43struct _Ecore_Fb_Ts_Contrast
44{
45 unsigned char contrast;
46};
47
48struct _Ecore_Fb_Ts_Led
49{
50 unsigned char on;
51 unsigned char blink_time;
52 unsigned char on_time;
53 unsigned char off_time;
54};
55
56struct _Ecore_Fb_Ts_Flite
57{
58 unsigned char mode;
59 unsigned char pwr;
60 unsigned char brightness;
61};
62
63static Eina_Bool _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
64static int _ecore_fb_ts_fd = -1;
65static int _ecore_fb_ts_event_byte_count = 0;
66static int _ecore_fb_ts_apply_cal = 0;
67static Ecore_Fb_Ts_Event _ecore_fb_ts_event;
68static Ecore_Fb_Ts_Calibrate _ecore_fb_ts_cal = {1,1,0,0,0};
69static Ecore_Fd_Handler *_ecore_fb_ts_fd_handler_handle = NULL;
70
71#ifdef HAVE_TSLIB
72struct tsdev *_ecore_fb_tslib_tsdev = NULL;
73struct ts_sample _ecore_fb_tslib_event;
74#endif
75
76static double _ecore_fb_double_click_time = 0.25;
77static void *_ecore_fb_ts_event_window = NULL;
78
79EAPI int
80ecore_fb_ts_init(void)
81{
82#ifdef HAVE_TSLIB
83 char *tslib_tsdevice = NULL;
84 if ( (tslib_tsdevice = getenv("TSLIB_TSDEVICE")) )
85 {
86 printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice );
87 _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */
88
89 if ( !_ecore_fb_tslib_tsdev )
90 {
91 printf( "ECORE_FB: Can't ts_open (%s)\n", strerror( errno ) );
92 return 0;
93 }
94
95 if ( ts_config( _ecore_fb_tslib_tsdev ) )
96 {
97 printf( "ECORE_FB: Can't ts_config (%s)\n", strerror( errno ) );
98 return 0;
99 }
100 _ecore_fb_ts_fd = ts_fd( _ecore_fb_tslib_tsdev );
101 if ( _ecore_fb_ts_fd < 0 )
102 {
103 printf( "ECORE_FB: Can't open touchscreen (%s)\n", strerror( errno ) );
104 return 0;
105 }
106 }
107#else
108 _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
109#endif
110 if (_ecore_fb_ts_fd >= 0)
111 {
112 _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ts_fd,
113 ECORE_FD_READ,
114 _ecore_fb_ts_fd_handler, NULL,
115 NULL, NULL);
116 if (!_ecore_fb_ts_fd_handler_handle)
117 {
118 close(_ecore_fb_ts_fd);
119 return 0;
120 }
121 // FIXME _ecore_fb_kbd_fd = open("/dev/touchscreen/key", O_RDONLY);
122 return 1;
123 }
124 return 0;
125}
126
127EAPI void
128ecore_fb_ts_shutdown(void)
129{
130 if (_ecore_fb_ts_fd_handler_handle)
131 ecore_main_fd_handler_del(_ecore_fb_ts_fd_handler_handle);
132 if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd);
133 _ecore_fb_ts_fd = -1;
134 _ecore_fb_ts_fd_handler_handle = NULL;
135 _ecore_fb_ts_event_window = NULL;
136}
137
138EAPI void
139ecore_fb_ts_event_window_set(void *window)
140{
141 _ecore_fb_ts_event_window = window;
142}
143
144EAPI void *
145ecore_fb_ts_event_window_get(void)
146{
147 return _ecore_fb_ts_event_window;
148}
149
150/**
151 * @defgroup Ecore_FB_Calibrate_Group Framebuffer Calibration Functions
152 *
153 * Functions that calibrate the screen.
154 */
155
156
157/**
158 * Calibrates the touschreen using the given parameters.
159 * @param xscale X scaling, where 256 = 1.0
160 * @param xtrans X translation.
161 * @param yscale Y scaling.
162 * @param ytrans Y translation.
163 * @param xyswap Swap X & Y flag.
164 * @ingroup Ecore_FB_Calibrate_Group
165 */
166EAPI void
167ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int ytrans, int xyswap)
168{
169 Ecore_Fb_Ts_Calibrate cal;
170
171 if (_ecore_fb_ts_fd < 0) return;
172 cal.xscale = xscale;
173 cal.xtrans = xtrans;
174 cal.yscale = yscale;
175 cal.ytrans = ytrans;
176 cal.xyswap = xyswap;
177 if (ioctl(_ecore_fb_ts_fd, TS_SET_CAL, (void *)&cal))
178 {
179 _ecore_fb_ts_cal = cal;
180 _ecore_fb_ts_apply_cal = 1;
181 }
182}
183
184/**
185 * Retrieves the calibration parameters of the touchscreen.
186 * @param xscale Pointer to an integer in which to store the X scaling.
187 * Note that 256 = 1.0.
188 * @param xtrans Pointer to an integer in which to store the X translation.
189 * @param yscale Pointer to an integer in which to store the Y scaling.
190 * @param ytrans Pointer to an integer in which to store the Y translation.
191 * @param xyswap Pointer to an integer in which to store the Swap X & Y flag.
192 * @ingroup Ecore_FB_Calibrate_Group
193 */
194EAPI void
195ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int *ytrans, int *xyswap)
196{
197 Ecore_Fb_Ts_Calibrate cal;
198
199 if (_ecore_fb_ts_fd < 0) return;
200 if (!_ecore_fb_ts_apply_cal)
201 {
202 if (ioctl(_ecore_fb_ts_fd, TS_GET_CAL, (void *)&cal))
203 _ecore_fb_ts_cal = cal;
204 }
205 else
206 cal = _ecore_fb_ts_cal;
207 if (xscale) *xscale = cal.xscale;
208 if (xtrans) *xtrans = cal.xtrans;
209 if (yscale) *yscale = cal.yscale;
210 if (ytrans) *ytrans = cal.ytrans;
211 if (xyswap) *xyswap = cal.xyswap;
212}
213
214static Eina_Bool
215_ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
216{
217 static int prev_x = 0, prev_y = 0, prev_pressure = 0;
218 static double last_time = 0;
219 static double last_last_time = 0;
220 int v = 0;
221
222 do
223 {
224 int x, y, pressure;
225 int num;
226 char *ptr;
227 double t = 0.0;
228 static int did_double = 0;
229 static int did_triple = 0;
230
231#ifdef HAVE_TSLIB
232 if (_ecore_fb_ts_apply_cal)
233 num = ts_read_raw(_ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1);
234 else
235 num = ts_read(_ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1);
236 if (num != 1) return 1; /* no more samples at this time */
237 x = _ecore_fb_tslib_event.x;
238 y = _ecore_fb_tslib_event.y;
239 pressure = _ecore_fb_tslib_event.pressure;
240 v = 1; /* loop, there might be more samples */
241 t = ecore_time_get();
242#else
243 ptr = (char *)&(_ecore_fb_ts_event);
244 ptr += _ecore_fb_ts_event_byte_count;
245 num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count;
246 v = read(_ecore_fb_ts_fd, ptr, num);
247 if (v < 0) return 1;
248 _ecore_fb_ts_event_byte_count += v;
249 if (v < num) return 1;
250 _ecore_fb_ts_event_byte_count = 0;
251 if (_ecore_fb_ts_apply_cal)
252 {
253 x = ((_ecore_fb_ts_cal.xscale * _ecore_fb_ts_event.x) >> 8) + _ecore_fb_ts_cal.xtrans;
254 y = ((_ecore_fb_ts_cal.yscale * _ecore_fb_ts_event.y) >> 8) + _ecore_fb_ts_cal.ytrans;
255 }
256 else
257 {
258 x = _ecore_fb_ts_event.x;
259 y = _ecore_fb_ts_event.y;
260 }
261 pressure = _ecore_fb_ts_event.pressure;
262#endif
263 /* add event to queue */
264 /* always add a move event */
265 if ((pressure) || (prev_pressure))
266 {
267 /* MOVE: mouse is down and was */
268 Ecore_Event_Mouse_Move *e;
269
270 e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
271 if (!e) goto retry;
272 e->x = x;
273 e->y = y;
274 e->root.x = x;
275 e->root.y = y;
276 e->window = (Ecore_Window)_ecore_fb_ts_event_window;
277 e->event_window = e->window;
278 e->root_window = e->window;
279 e->same_screen = 1;
280 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
281 }
282 if ((pressure) && (!prev_pressure))
283 {
284 /* DOWN: mouse is down, but was not now */
285 Ecore_Event_Mouse_Button *e;
286
287 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
288 if (!e) goto retry;
289 e->x = x;
290 e->y = y;
291 e->buttons = 1;
292 if ((t - last_time) <= _ecore_fb_double_click_time)
293 {
294 e->double_click = 1;
295 did_double = 1;
296 }
297 else
298 {
299 did_double = 0;
300 did_triple = 0;
301 }
302 if ((t - last_last_time) <= (2 * _ecore_fb_double_click_time))
303 {
304 did_triple = 1;
305 e->triple_click = 1;
306 }
307 else
308 {
309 did_triple = 0;
310 }
311 e->window = (Ecore_Window)_ecore_fb_ts_event_window;
312 e->event_window = e->window;
313 e->root_window = e->window;
314 e->same_screen = 1;
315 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
316 }
317 else if ((!pressure) && (prev_pressure))
318 {
319 /* UP: mouse was down, but is not now */
320 Ecore_Event_Mouse_Button *e;
321
322 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
323 if (!e) goto retry;
324 e->x = prev_x;
325 e->y = prev_y;
326 e->buttons = 1;
327 if (did_double)
328 e->double_click = 1;
329 if (did_triple)
330 e->triple_click = 1;
331 e->window = (Ecore_Window)_ecore_fb_ts_event_window;
332 e->event_window = e->window;
333 e->root_window = e->window;
334 e->same_screen = 1;
335 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
336 }
337 if (did_triple)
338 {
339 last_time = 0;
340 last_last_time = 0;
341 }
342 else
343 {
344 last_last_time = last_time;
345 last_time = t;
346 }
347retry:
348 prev_x = x;
349 prev_y = y;
350 prev_pressure = pressure;
351 }
352 while (v > 0);
353 return 1;
354}
355
diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c
deleted file mode 100644
index 09e3f37..0000000
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c
+++ /dev/null
@@ -1,322 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore_Fb.h"
6#include "ecore_fb_private.h"
7
8static int _ecore_fb_vt_do_switch = 0;
9
10static int _ecore_fb_vt_tty0_fd = -1;
11static int _ecore_fb_vt_tty_fd = -1;
12static int _ecore_fb_vt_current_vt = 0;
13static int _ecore_fb_vt_prev_vt = 0;
14
15static struct termios _ecore_fb_tty_prev_tio_mode;
16static struct vt_mode _ecore_fb_vt_prev_mode;
17
18static Eina_Bool _ecore_fb_signal_usr_handler(void *data, int type, void *ev);
19static Ecore_Event_Handler *_ecore_fb_user_handler = NULL;
20static int _ecore_fb_tty_prev_mode = 0;
21static int _ecore_fb_tty_prev_kd_mode = 0;
22
23/* callbacks for an attach/release of a vt */
24static void (*_ecore_fb_func_fb_lost) (void *data) = NULL;
25static void *_ecore_fb_func_fb_lost_data = NULL;
26static void (*_ecore_fb_func_fb_gain) (void *data) = NULL;
27static void *_ecore_fb_func_fb_gain_data = NULL;
28
29/* FIXME what is the filter for? */
30static Ecore_Event_Filter *_ecore_fb_filter_handler = NULL;
31
32/* prototypes */
33/* XXX: unused
34static void _ecore_fb_vt_switch(int vt);
35static void *_ecore_fb_event_filter_start(void *data);
36static Eina_Bool _ecore_fb_event_filter_filter(void *data, void *loop_data, int type, void *event);
37static void _ecore_fb_event_filter_end(void *data, void *loop_data);
38*/
39
40static Eina_Bool
41_ecore_fb_signal_usr_handler(void *data __UNUSED__, int type __UNUSED__, void *ev)
42{
43 Ecore_Event_Signal_User *e;
44
45 e = (Ecore_Event_Signal_User *)ev;
46 if (e->number == 1)
47 {
48 /* release vt */
49 if (_ecore_fb_func_fb_lost) _ecore_fb_func_fb_lost(_ecore_fb_func_fb_lost_data);
50 /* TODO stop listening from the devices? let the callback do it? */
51 ioctl(_ecore_fb_vt_tty_fd, VT_RELDISP, 1);
52 }
53 else if (e->number == 2)
54 {
55 /* attach vt */
56 if (_ecore_fb_func_fb_gain) _ecore_fb_func_fb_gain(_ecore_fb_func_fb_gain_data);
57 /* TODO reattach all devices */
58 }
59 return 1;
60}
61
62/* XXX: unused
63static void
64_ecore_fb_vt_switch(int vt)
65{
66 vt++;
67 if (_ecore_fb_vt_tty_fd != 0)
68 {
69 if (vt != _ecore_fb_vt_current_vt)
70 {
71 tcsetattr(_ecore_fb_vt_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode);
72 ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode);
73 ioctl(_ecore_fb_vt_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode);
74 }
75 }
76 ioctl(_ecore_fb_vt_tty_fd, VT_ACTIVATE, vt);
77}
78*/
79
80static int
81_ecore_fb_vt_setup(void)
82{
83 char buf[64];
84// XXX: unused
85// struct termios tio;
86 struct vt_mode new_vtmode;
87
88 if (_ecore_fb_vt_current_vt != _ecore_fb_vt_prev_vt)
89 {
90 snprintf(buf, sizeof(buf), "/dev/tty%i", _ecore_fb_vt_current_vt);
91 if ((_ecore_fb_vt_tty_fd = open(buf, O_RDWR)) < 0)
92 {
93 printf("[ecore_fb:vt_setup] can't open tty %d\n", _ecore_fb_vt_current_vt);
94 return 0;
95 }
96 close(_ecore_fb_vt_tty0_fd);
97 _ecore_fb_vt_tty0_fd = -1;
98 /* FIXME detach the process from current tty ? */
99 }
100 else
101 _ecore_fb_vt_tty_fd = _ecore_fb_vt_tty0_fd;
102 /* for backup */
103 tcgetattr(_ecore_fb_vt_tty_fd, &_ecore_fb_tty_prev_tio_mode);
104 ioctl(_ecore_fb_vt_tty_fd, KDGETMODE, &_ecore_fb_tty_prev_kd_mode);
105 ioctl(_ecore_fb_vt_tty_fd, VT_GETMODE, &_ecore_fb_vt_prev_mode);
106
107 if (ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, KD_GRAPHICS) < 0)
108 {
109 perror("[ecore_fb:vt_setup] can't set the mode to KD_GRAPHICS");
110 close(_ecore_fb_vt_tty_fd);
111 _ecore_fb_vt_tty_fd = -1;
112 return 0;
113 }
114 ioctl(_ecore_fb_vt_tty_fd, KDGKBMODE, &_ecore_fb_tty_prev_mode);
115
116 /* support of switching */
117 new_vtmode.mode = VT_PROCESS;
118 new_vtmode.waitv = 0;
119 new_vtmode.relsig = SIGUSR1;
120 new_vtmode.acqsig = SIGUSR2;
121 if (ioctl(_ecore_fb_vt_tty_fd, VT_SETMODE, &new_vtmode) < 0)
122 {
123 perror("[ecore_fb:vt_setup] can't set the tty mode");
124 close(_ecore_fb_vt_tty_fd);
125 _ecore_fb_vt_tty_fd = -1;
126 return 0;
127 }
128 /* register signal handlers when alloc/detach of vt */
129 _ecore_fb_user_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
130 _ecore_fb_signal_usr_handler,
131 NULL);
132 /* What does this do? */
133 /*
134 _ecore_fb_filter_handler = ecore_event_filter_add(_ecore_fb_event_filter_start, _ecore_fb_event_filter_filter, _ecore_fb_event_filter_end, NULL);
135 */
136
137 usleep(40000);
138 if (ioctl(_ecore_fb_vt_tty_fd, VT_ACTIVATE, _ecore_fb_vt_current_vt) < 0)
139 {
140 perror("[ecore_fb:vt_setup] error on VT_ACTIVATE");
141 close(_ecore_fb_vt_tty_fd);
142 _ecore_fb_vt_tty_fd = -1;
143 return 0;
144 }
145 if(ioctl(_ecore_fb_vt_tty_fd, VT_WAITACTIVE, _ecore_fb_vt_current_vt) < 0)
146 {
147 perror("[ecore_fb:vt_setup] error on VT_WAITACTIVE");
148 close(_ecore_fb_vt_tty_fd);
149 _ecore_fb_vt_tty_fd = -1;
150 return 0;
151 }
152 /* FIXME assign the fb to the tty in case isn't setup */
153 return 1;
154}
155
156int
157ecore_fb_vt_init(void)
158{
159 struct vt_stat vtstat;
160
161 /* as root you can allocate another tty */
162 if (!geteuid())
163 _ecore_fb_vt_do_switch = 1;
164 if ((_ecore_fb_vt_tty0_fd = open("/dev/tty0", O_RDONLY)) < 0)
165 {
166 printf("[ecore_fb:init] can't open /dev/tty0\n");
167 return 0;
168 }
169 /* query current vt state */
170 if ((ioctl(_ecore_fb_vt_tty0_fd, VT_GETSTATE, &vtstat)) < 0)
171 {
172 printf("[ecore_fb:init] can't get current tty state\n");
173 return 0;
174 }
175 _ecore_fb_vt_prev_vt = vtstat.v_active;
176 /* switch to another tty */
177 if (_ecore_fb_vt_do_switch)
178 {
179 int vtno;
180
181 if ((ioctl(_ecore_fb_vt_tty0_fd, VT_OPENQRY, &vtno) < 0))
182 {
183 printf("[ecore_fb:init] can't query for a vt\n");
184 return 0;
185 }
186 _ecore_fb_vt_current_vt = vtno;
187 }
188 /* use current tty */
189 else
190 _ecore_fb_vt_current_vt = _ecore_fb_vt_prev_vt;
191 if (!_ecore_fb_vt_setup())
192 {
193 printf("[ecore_fb:init] can't setup the vt, restoring previous mode...\n");
194 /* TODO finish this */
195 if (_ecore_fb_vt_do_switch)
196 {
197 printf("[ecore_fb:init] switching back to vt %d\n", _ecore_fb_vt_prev_vt);
198 }
199 return 0;
200 }
201 return 1;
202}
203
204void
205ecore_fb_vt_shutdown(void)
206{
207 /* restore the previous mode */
208 if (_ecore_fb_vt_tty_fd != -1)
209 {
210 tcsetattr(_ecore_fb_vt_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode);
211 ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode);
212 ioctl(_ecore_fb_vt_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode);
213 ioctl(_ecore_fb_vt_tty_fd, VT_SETMODE, &_ecore_fb_vt_prev_mode);
214 /* go back to previous vt */
215 close(_ecore_fb_vt_tty_fd);
216 _ecore_fb_vt_tty_fd = -1;
217 }
218
219 if (_ecore_fb_user_handler) ecore_event_handler_del(_ecore_fb_user_handler);
220 _ecore_fb_user_handler = NULL;
221
222 if (_ecore_fb_filter_handler) ecore_event_filter_del(_ecore_fb_filter_handler);
223 _ecore_fb_filter_handler = NULL;
224}
225
226/**
227 * @addtogroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions.
228 *
229 * @{
230 */
231
232/**
233 * @brief Set a callback called when a virtual terminal is gained.
234 *
235 * @param func The callback called when vt is gained.
236 * @param data The data to pass to the callback.
237 *
238 * This function sets the callback @p func which will be called when a
239 * virtual terminal is gained (for example you press Ctrl-Alt-F1 to go
240 * to vt1 and your app was using vt1). @p data will be pass to @p func if
241 * the callback is called.
242 */
243EAPI void
244ecore_fb_callback_gain_set(void (*func) (void *data), void *data)
245{
246 _ecore_fb_func_fb_gain = func;
247 _ecore_fb_func_fb_gain_data = data;
248}
249
250/**
251 * @brief Set a callback called when a virtual terminal is lost.
252 *
253 * @param func The callback called when vt is lost.
254 * @param data The data to pass to the callback.
255 *
256 * This function sets the callback @p func which will be called when a
257 * virtual terminal is lost (someone wants the tv from you and you
258 * want to give up that vt). @p data will be pass to @p func if the
259 * callback is called.
260 */
261EAPI void
262ecore_fb_callback_lose_set(void (*func) (void *data), void *data)
263{
264 _ecore_fb_func_fb_lost = func;
265 _ecore_fb_func_fb_lost_data = data;
266
267}
268
269/**
270 * @}
271 */
272
273/*
274 * This filter should take into account that the MOUSE_MOVE event can be
275 * triggered by a mouse, not just a touchscreen device, so you can't discard
276 * them (only those generated by a device that sends events with absolute
277 * coordinates).
278
279typedef struct _Ecore_Fb_Filter_Data Ecore_Fb_Filter_Data;
280
281struct _Ecore_Fb_Filter_Data
282{
283 int last_event_type;
284};
285
286static void *
287_ecore_fb_event_filter_start(void *data __UNUSED__)
288{
289 Ecore_Fb_Filter_Data *filter_data;
290
291 filter_data = calloc(1, sizeof(Ecore_Fb_Filter_Data));
292 return filter_data;
293}
294
295static Eina_Bool
296_ecore_fb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__)
297{
298 Ecore_Fb_Filter_Data *filter_data;
299
300 filter_data = loop_data;
301 if (!filter_data) return EINA_TRUE;
302 if (type == ECORE_EVENT_MOUSE_MOVE)
303 {
304 if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
305 {
306 filter_data->last_event_type = type;
307 return EINA_FALSE;
308 }
309 }
310 filter_data->last_event_type = type;
311 return EINA_TRUE;
312}
313
314static void
315_ecore_fb_event_filter_end(void *data __UNUSED__, void *loop_data)
316{
317 Ecore_Fb_Filter_Data *filter_data;
318
319 filter_data = loop_data;
320 if (filter_data) free(filter_data);
321}
322*/
diff --git a/libraries/ecore/src/lib/ecore_file/Ecore_File.h b/libraries/ecore/src/lib/ecore_file/Ecore_File.h
deleted file mode 100644
index e4b8851..0000000
--- a/libraries/ecore/src/lib/ecore_file/Ecore_File.h
+++ /dev/null
@@ -1,190 +0,0 @@
1#ifndef ECORE_FILE_H
2#define ECORE_FILE_H
3
4/*
5 * TODO:
6 * - More events, move/rename of directory file
7 */
8
9#include <Eina.h>
10
11#ifdef EAPI
12# undef EAPI
13#endif
14
15#ifdef _WIN32
16# ifdef EFL_ECORE_FILE_BUILD
17# ifdef DLL_EXPORT
18# define EAPI __declspec(dllexport)
19# else
20# define EAPI
21# endif /* ! DLL_EXPORT */
22# else
23# define EAPI __declspec(dllimport)
24# endif /* ! EFL_ECORE_FILE_BUILD */
25#else
26# ifdef __GNUC__
27# if __GNUC__ >= 4
28# define EAPI __attribute__ ((visibility("default")))
29# else
30# define EAPI
31# endif
32# else
33# define EAPI
34# endif
35#endif /* ! _WIN32 */
36
37/**
38 * @file Ecore_File.h
39 * @brief Files utility functions
40 */
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/**
47 * @defgroup Ecore_File_Group Ecore_File - Files and directories convenience functions
48 *
49 * @{
50 */
51
52/**
53 * @typedef Ecore_File_Monitor
54 * Abstract type used when monitoring a directory.
55 */
56typedef struct _Ecore_File_Monitor Ecore_File_Monitor;
57
58/**
59 * @typedef Ecore_File_Download_Job
60 * Abstract type used when aborting a download.
61 */
62typedef struct _Ecore_File_Download_Job Ecore_File_Download_Job;
63
64/**
65 * @typedef Ecore_File_Event
66 * The event type returned when a file or directory is monitored.
67 */
68typedef enum _Ecore_File_Event
69{
70 ECORE_FILE_EVENT_NONE, /**< No event. */
71 ECORE_FILE_EVENT_CREATED_FILE, /**< Created file event. */
72 ECORE_FILE_EVENT_CREATED_DIRECTORY, /**< Created directory event. */
73 ECORE_FILE_EVENT_DELETED_FILE, /**< Deleted file event. */
74 ECORE_FILE_EVENT_DELETED_DIRECTORY, /**< Deleted directory event. */
75 ECORE_FILE_EVENT_DELETED_SELF, /**< Deleted monitored directory event. */
76 ECORE_FILE_EVENT_MODIFIED, /**< Modified file or directory event. */
77 ECORE_FILE_EVENT_CLOSED /**< Closed file event */
78} Ecore_File_Event;
79
80/**
81 * @typedef Ecore_File_Monitor_Cb
82 * Callback type used when a monitored directory has changes.
83 */
84typedef void (*Ecore_File_Monitor_Cb)(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path);
85
86/**
87 * @typedef Ecore_File_Download_Completion_Cb
88 * Callback type used when a download is finished.
89 */
90typedef void (*Ecore_File_Download_Completion_Cb)(void *data, const char *file, int status);
91
92/**
93 * @typedef Ecore_File_Progress_Return
94 * What to do with the download as a return from the
95 * Ecore_File_Download_Progress_Cb function, if provided.
96 */
97typedef enum _Ecore_File_Progress_Return
98{
99 ECORE_FILE_PROGRESS_CONTINUE = 0, /**< Continue the download. */
100 ECORE_FILE_PROGRESS_ABORT = 1 /**< Abort the download. */
101} Ecore_File_Progress_Return;
102
103/**
104 * @typedef Ecore_File_Download_Progress_Cb
105 * Callback type used while a download is in progress.
106 */
107typedef int (*Ecore_File_Download_Progress_Cb)(void *data,
108 const char *file,
109 long int dltotal,
110 long int dlnow,
111 long int ultotal,
112 long int ulnow);
113
114/* File operations */
115
116EAPI int ecore_file_init (void);
117EAPI int ecore_file_shutdown (void);
118EAPI long long ecore_file_mod_time (const char *file);
119EAPI long long ecore_file_size (const char *file);
120EAPI Eina_Bool ecore_file_exists (const char *file);
121EAPI Eina_Bool ecore_file_is_dir (const char *file);
122EAPI Eina_Bool ecore_file_mkdir (const char *dir);
123EAPI int ecore_file_mkdirs (const char **dirs);
124EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs);
125EAPI Eina_Bool ecore_file_rmdir (const char *dir);
126EAPI Eina_Bool ecore_file_recursive_rm (const char *dir);
127EAPI Eina_Bool ecore_file_mkpath (const char *path);
128EAPI int ecore_file_mkpaths (const char **paths);
129EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst);
130EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst);
131EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest);
132EAPI char *ecore_file_realpath (const char *file);
133EAPI Eina_Bool ecore_file_unlink (const char *file);
134EAPI Eina_Bool ecore_file_remove (const char *file);
135EAPI const char *ecore_file_file_get (const char *path);
136EAPI char *ecore_file_dir_get (const char *path);
137EAPI Eina_Bool ecore_file_can_read (const char *file);
138EAPI Eina_Bool ecore_file_can_write (const char *file);
139EAPI Eina_Bool ecore_file_can_exec (const char *file);
140EAPI char *ecore_file_readlink (const char *link);
141EAPI Eina_List *ecore_file_ls (const char *dir);
142EAPI Eina_Iterator *ecore_file_ls_iterator (const char *dir);
143EAPI char *ecore_file_app_exe_get (const char *app);
144EAPI char *ecore_file_escape_name (const char *filename);
145EAPI char *ecore_file_strip_ext (const char *file);
146EAPI int ecore_file_dir_is_empty (const char *dir);
147
148/* Monitoring */
149
150EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path,
151 Ecore_File_Monitor_Cb func,
152 void *data);
153EAPI void ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor);
154EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor);
155
156/* Path */
157
158EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir);
159EAPI Eina_Bool ecore_file_app_installed(const char *exe);
160EAPI Eina_List *ecore_file_app_list(void);
161
162/* Download */
163
164EAPI Eina_Bool ecore_file_download(const char *url,
165 const char *dst,
166 Ecore_File_Download_Completion_Cb completion_cb,
167 Ecore_File_Download_Progress_Cb progress_cb,
168 void *data,
169 Ecore_File_Download_Job **job_ret);
170EAPI Eina_Bool ecore_file_download_full(const char *url,
171 const char *dst,
172 Ecore_File_Download_Completion_Cb completion_cb,
173 Ecore_File_Download_Progress_Cb progress_cb,
174 void *data,
175 Ecore_File_Download_Job **job_ret,
176 Eina_Hash *headers);
177
178EAPI void ecore_file_download_abort_all(void);
179EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job);
180EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol);
181
182/**
183 * @}
184 */
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif
diff --git a/libraries/ecore/src/lib/ecore_file/Makefile.am b/libraries/ecore/src/lib/ecore_file/Makefile.am
deleted file mode 100644
index ab23ace..0000000
--- a/libraries/ecore/src/lib/ecore_file/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_con \
6-I$(top_builddir)/src/lib/ecore \
7@EFL_ECORE_FILE_BUILD@ \
8@CURL_CFLAGS@ \
9@EVIL_CFLAGS@ \
10@EINA_CFLAGS@ \
11@WIN32_CPPFLAGS@
12
13AM_CFLAGS = @WIN32_CFLAGS@
14
15if BUILD_ECORE_CON
16lib_ecore_con_la = $(top_builddir)/src/lib/ecore_con/libecore_con.la
17endif
18
19lib_LTLIBRARIES = libecore_file.la
20includes_HEADERS = Ecore_File.h
21includesdir = $(includedir)/ecore-@VMAJ@
22
23libecore_file_la_SOURCES = \
24ecore_file.c \
25ecore_file_monitor.c \
26ecore_file_monitor_inotify.c \
27ecore_file_monitor_win32.c \
28ecore_file_monitor_poll.c \
29ecore_file_path.c \
30ecore_file_download.c
31
32libecore_file_la_LIBADD = \
33$(top_builddir)/src/lib/ecore/libecore.la \
34$(lib_ecore_con_la) \
35@EVIL_LIBS@ \
36@EINA_LIBS@
37
38libecore_file_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
39
40EXTRA_DIST = ecore_file_private.h
41
diff --git a/libraries/ecore/src/lib/ecore_file/Makefile.in b/libraries/ecore/src/lib/ecore_file/Makefile.in
deleted file mode 100644
index a80ece3..0000000
--- a/libraries/ecore/src/lib/ecore_file/Makefile.in
+++ /dev/null
@@ -1,851 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_file
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_file_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la $(lib_ecore_con_la)
90am_libecore_file_la_OBJECTS = ecore_file.lo ecore_file_monitor.lo \
91 ecore_file_monitor_inotify.lo ecore_file_monitor_win32.lo \
92 ecore_file_monitor_poll.lo ecore_file_path.lo \
93 ecore_file_download.lo
94libecore_file_la_OBJECTS = $(am_libecore_file_la_OBJECTS)
95AM_V_lt = $(am__v_lt_$(V))
96am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
97am__v_lt_0 = --silent
98libecore_file_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
99 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
100 $(AM_CFLAGS) $(CFLAGS) $(libecore_file_la_LDFLAGS) $(LDFLAGS) \
101 -o $@
102DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
103depcomp = $(SHELL) $(top_srcdir)/depcomp
104am__depfiles_maybe = depfiles
105am__mv = mv -f
106COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
107 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
108LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
109 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
110 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
111 $(AM_CFLAGS) $(CFLAGS)
112AM_V_CC = $(am__v_CC_$(V))
113am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
114am__v_CC_0 = @echo " CC " $@;
115AM_V_at = $(am__v_at_$(V))
116am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
117am__v_at_0 = @
118CCLD = $(CC)
119LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
120 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
121 $(AM_LDFLAGS) $(LDFLAGS) -o $@
122AM_V_CCLD = $(am__v_CCLD_$(V))
123am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
124am__v_CCLD_0 = @echo " CCLD " $@;
125AM_V_GEN = $(am__v_GEN_$(V))
126am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
127am__v_GEN_0 = @echo " GEN " $@;
128SOURCES = $(libecore_file_la_SOURCES)
129DIST_SOURCES = $(libecore_file_la_SOURCES)
130HEADERS = $(includes_HEADERS)
131ETAGS = etags
132CTAGS = ctags
133DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
134ACLOCAL = @ACLOCAL@
135ALLOCA = @ALLOCA@
136AMTAR = @AMTAR@
137AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
138AR = @AR@
139AS = @AS@
140AUTOCONF = @AUTOCONF@
141AUTOHEADER = @AUTOHEADER@
142AUTOMAKE = @AUTOMAKE@
143AWK = @AWK@
144CARES_CFLAGS = @CARES_CFLAGS@
145CARES_LIBS = @CARES_LIBS@
146CC = @CC@
147CCDEPMODE = @CCDEPMODE@
148CFLAGS = @CFLAGS@
149CHECK_CFLAGS = @CHECK_CFLAGS@
150CHECK_LIBS = @CHECK_LIBS@
151CPP = @CPP@
152CPPFLAGS = @CPPFLAGS@
153CURL_CFLAGS = @CURL_CFLAGS@
154CURL_LIBS = @CURL_LIBS@
155CXX = @CXX@
156CXXCPP = @CXXCPP@
157CXXDEPMODE = @CXXDEPMODE@
158CXXFLAGS = @CXXFLAGS@
159CYGPATH_W = @CYGPATH_W@
160DEFS = @DEFS@
161DEPDIR = @DEPDIR@
162DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
163DIRECTFB_LIBS = @DIRECTFB_LIBS@
164DLLTOOL = @DLLTOOL@
165DSYMUTIL = @DSYMUTIL@
166DUMPBIN = @DUMPBIN@
167ECHO_C = @ECHO_C@
168ECHO_N = @ECHO_N@
169ECHO_T = @ECHO_T@
170ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
171ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
172EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
173EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
174EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
175EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
176EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
177EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
178EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
179EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
180EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
181EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
182EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
183EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
184EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
185EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
186EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
187EGREP = @EGREP@
188EINA_CFLAGS = @EINA_CFLAGS@
189EINA_LIBS = @EINA_LIBS@
190ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
191ESCAPE_LIBS = @ESCAPE_LIBS@
192EVAS_CFLAGS = @EVAS_CFLAGS@
193EVAS_LIBS = @EVAS_LIBS@
194EVIL_CFLAGS = @EVIL_CFLAGS@
195EVIL_LIBS = @EVIL_LIBS@
196EXEEXT = @EXEEXT@
197EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
198EXOTIC_LIBS = @EXOTIC_LIBS@
199FGREP = @FGREP@
200GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
201GLIB_CFLAGS = @GLIB_CFLAGS@
202GLIB_LIBS = @GLIB_LIBS@
203GMSGFMT = @GMSGFMT@
204GMSGFMT_015 = @GMSGFMT_015@
205GREP = @GREP@
206INSTALL = @INSTALL@
207INSTALL_DATA = @INSTALL_DATA@
208INSTALL_PROGRAM = @INSTALL_PROGRAM@
209INSTALL_SCRIPT = @INSTALL_SCRIPT@
210INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
211INTLLIBS = @INTLLIBS@
212INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
213KEYSYMDEFS = @KEYSYMDEFS@
214LD = @LD@
215LDFLAGS = @LDFLAGS@
216LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
217LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
218LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
219LIBICONV = @LIBICONV@
220LIBINTL = @LIBINTL@
221LIBOBJS = @LIBOBJS@
222LIBS = @LIBS@
223LIBTOOL = @LIBTOOL@
224LIPO = @LIPO@
225LN_S = @LN_S@
226LTLIBICONV = @LTLIBICONV@
227LTLIBINTL = @LTLIBINTL@
228LTLIBOBJS = @LTLIBOBJS@
229MAKEINFO = @MAKEINFO@
230MKDIR_P = @MKDIR_P@
231MSGFMT = @MSGFMT@
232MSGFMT_015 = @MSGFMT_015@
233MSGMERGE = @MSGMERGE@
234NM = @NM@
235NMEDIT = @NMEDIT@
236OBJC = @OBJC@
237OBJCDEPMODE = @OBJCDEPMODE@
238OBJCFLAGS = @OBJCFLAGS@
239OBJDUMP = @OBJDUMP@
240OBJEXT = @OBJEXT@
241OTOOL = @OTOOL@
242OTOOL64 = @OTOOL64@
243PACKAGE = @PACKAGE@
244PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
245PACKAGE_NAME = @PACKAGE_NAME@
246PACKAGE_STRING = @PACKAGE_STRING@
247PACKAGE_TARNAME = @PACKAGE_TARNAME@
248PACKAGE_URL = @PACKAGE_URL@
249PACKAGE_VERSION = @PACKAGE_VERSION@
250PATH_SEPARATOR = @PATH_SEPARATOR@
251PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
252PIXMAN_LIBS = @PIXMAN_LIBS@
253PKG_CONFIG = @PKG_CONFIG@
254PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
255PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
256POSUB = @POSUB@
257RANLIB = @RANLIB@
258SCIM_CFLAGS = @SCIM_CFLAGS@
259SCIM_LIBS = @SCIM_LIBS@
260SDL_CFLAGS = @SDL_CFLAGS@
261SDL_CONFIG = @SDL_CONFIG@
262SDL_LIBS = @SDL_LIBS@
263SED = @SED@
264SET_MAKE = @SET_MAKE@
265SHELL = @SHELL@
266SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
267SSL_CFLAGS = @SSL_CFLAGS@
268SSL_LIBS = @SSL_LIBS@
269STRIP = @STRIP@
270TLS2_CFLAGS = @TLS2_CFLAGS@
271TLS2_LIBS = @TLS2_LIBS@
272TLS_CFLAGS = @TLS_CFLAGS@
273TLS_LIBS = @TLS_LIBS@
274TSLIB_CFLAGS = @TSLIB_CFLAGS@
275TSLIB_LIBS = @TSLIB_LIBS@
276USE_NLS = @USE_NLS@
277VERSION = @VERSION@
278VMAJ = @VMAJ@
279WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
280WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
281WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
282WAYLAND_LIBS = @WAYLAND_LIBS@
283WIN32_CFLAGS = @WIN32_CFLAGS@
284WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
285WIN32_LIBS = @WIN32_LIBS@
286XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
287XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
288XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
289XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
290XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
291XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
292XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
293XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
294XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
295XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
296XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
297XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
298XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
299XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
300XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
301XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
302XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
303XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
304XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
305XCB_X11_LIBS = @XCB_X11_LIBS@
306XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
307XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
308XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
309XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
310XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
311XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
312XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
313XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
314XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
315XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
316XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
317XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
318XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
319XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
320XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
321XDAMAGE_LIBS = @XDAMAGE_LIBS@
322XDPMS_CFLAGS = @XDPMS_CFLAGS@
323XDPMS_LIBS = @XDPMS_LIBS@
324XFIXES_CFLAGS = @XFIXES_CFLAGS@
325XFIXES_LIBS = @XFIXES_LIBS@
326XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
327XGESTURE_LIBS = @XGESTURE_LIBS@
328XGETTEXT = @XGETTEXT@
329XGETTEXT_015 = @XGETTEXT_015@
330XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
331XI2_CFLAGS = @XI2_CFLAGS@
332XI2_LIBS = @XI2_LIBS@
333XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
334XINERAMA_LIBS = @XINERAMA_LIBS@
335XKB_CFLAGS = @XKB_CFLAGS@
336XKB_LIBS = @XKB_LIBS@
337XMKMF = @XMKMF@
338XPRINT_CFLAGS = @XPRINT_CFLAGS@
339XPRINT_LIBS = @XPRINT_LIBS@
340XRANDR_CFLAGS = @XRANDR_CFLAGS@
341XRANDR_LIBS = @XRANDR_LIBS@
342XRENDER_CFLAGS = @XRENDER_CFLAGS@
343XRENDER_LIBS = @XRENDER_LIBS@
344XSS_CFLAGS = @XSS_CFLAGS@
345XSS_LIBS = @XSS_LIBS@
346XTEST_CFLAGS = @XTEST_CFLAGS@
347XTEST_LIBS = @XTEST_LIBS@
348X_CFLAGS = @X_CFLAGS@
349X_EXTRA_LIBS = @X_EXTRA_LIBS@
350X_LIBS = @X_LIBS@
351X_PRE_LIBS = @X_PRE_LIBS@
352Xcursor_cflags = @Xcursor_cflags@
353Xcursor_libs = @Xcursor_libs@
354abs_builddir = @abs_builddir@
355abs_srcdir = @abs_srcdir@
356abs_top_builddir = @abs_top_builddir@
357abs_top_srcdir = @abs_top_srcdir@
358ac_ct_CC = @ac_ct_CC@
359ac_ct_CXX = @ac_ct_CXX@
360ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
361ac_ct_OBJC = @ac_ct_OBJC@
362am__include = @am__include@
363am__leading_dot = @am__leading_dot@
364am__quote = @am__quote@
365am__tar = @am__tar@
366am__untar = @am__untar@
367bindir = @bindir@
368build = @build@
369build_alias = @build_alias@
370build_cpu = @build_cpu@
371build_os = @build_os@
372build_vendor = @build_vendor@
373builddir = @builddir@
374cocoa_ldflags = @cocoa_ldflags@
375datadir = @datadir@
376datarootdir = @datarootdir@
377dlopen_libs = @dlopen_libs@
378docdir = @docdir@
379dvidir = @dvidir@
380ecore_cocoa_cflags = @ecore_cocoa_cflags@
381ecore_cocoa_libs = @ecore_cocoa_libs@
382ecore_con_cflags = @ecore_con_cflags@
383ecore_con_libs = @ecore_con_libs@
384ecore_directfb_cflags = @ecore_directfb_cflags@
385ecore_directfb_libs = @ecore_directfb_libs@
386ecore_evas_cflags = @ecore_evas_cflags@
387ecore_evas_libs = @ecore_evas_libs@
388ecore_fb_cflags = @ecore_fb_cflags@
389ecore_fb_libs = @ecore_fb_libs@
390ecore_file_cflags = @ecore_file_cflags@
391ecore_file_libs = @ecore_file_libs@
392ecore_imf_cflags = @ecore_imf_cflags@
393ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
394ecore_imf_evas_libs = @ecore_imf_evas_libs@
395ecore_imf_libs = @ecore_imf_libs@
396ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
397ecore_imf_scim_libs = @ecore_imf_scim_libs@
398ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
399ecore_imf_xim_libs = @ecore_imf_xim_libs@
400ecore_input_cflags = @ecore_input_cflags@
401ecore_input_evas_cflags = @ecore_input_evas_cflags@
402ecore_input_evas_libs = @ecore_input_evas_libs@
403ecore_input_libs = @ecore_input_libs@
404ecore_ipc_cflags = @ecore_ipc_cflags@
405ecore_ipc_libs = @ecore_ipc_libs@
406ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
407ecore_psl1ght_libs = @ecore_psl1ght_libs@
408ecore_sdl_cflags = @ecore_sdl_cflags@
409ecore_sdl_libs = @ecore_sdl_libs@
410ecore_wayland_cflags = @ecore_wayland_cflags@
411ecore_wayland_libs = @ecore_wayland_libs@
412ecore_win32_cflags = @ecore_win32_cflags@
413ecore_win32_libs = @ecore_win32_libs@
414ecore_wince_cflags = @ecore_wince_cflags@
415ecore_wince_libs = @ecore_wince_libs@
416ecore_x_cflags = @ecore_x_cflags@
417ecore_x_libs = @ecore_x_libs@
418ecore_x_libs_private = @ecore_x_libs_private@
419efl_doxygen = @efl_doxygen@
420efl_have_doxygen = @efl_have_doxygen@
421exec_prefix = @exec_prefix@
422have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
423host = @host@
424host_alias = @host_alias@
425host_cpu = @host_cpu@
426host_os = @host_os@
427host_vendor = @host_vendor@
428htmldir = @htmldir@
429includedir = @includedir@
430infodir = @infodir@
431install_sh = @install_sh@
432libdir = @libdir@
433libexecdir = @libexecdir@
434localedir = @localedir@
435localstatedir = @localstatedir@
436lt_ECHO = @lt_ECHO@
437lt_enable_auto_import = @lt_enable_auto_import@
438mandir = @mandir@
439mkdir_p = @mkdir_p@
440oldincludedir = @oldincludedir@
441pdfdir = @pdfdir@
442pkgconfig_requires_private = @pkgconfig_requires_private@
443prefix = @prefix@
444program_transform_name = @program_transform_name@
445psdir = @psdir@
446release_info = @release_info@
447requirements_ecore = @requirements_ecore@
448requirements_ecore_cocoa = @requirements_ecore_cocoa@
449requirements_ecore_con = @requirements_ecore_con@
450requirements_ecore_directfb = @requirements_ecore_directfb@
451requirements_ecore_evas = @requirements_ecore_evas@
452requirements_ecore_fb = @requirements_ecore_fb@
453requirements_ecore_file = @requirements_ecore_file@
454requirements_ecore_imf = @requirements_ecore_imf@
455requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
456requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
457requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
458requirements_ecore_input = @requirements_ecore_input@
459requirements_ecore_input_evas = @requirements_ecore_input_evas@
460requirements_ecore_ipc = @requirements_ecore_ipc@
461requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
462requirements_ecore_sdl = @requirements_ecore_sdl@
463requirements_ecore_wayland = @requirements_ecore_wayland@
464requirements_ecore_win32 = @requirements_ecore_win32@
465requirements_ecore_wince = @requirements_ecore_wince@
466requirements_ecore_x = @requirements_ecore_x@
467rt_libs = @rt_libs@
468sbindir = @sbindir@
469sharedstatedir = @sharedstatedir@
470srcdir = @srcdir@
471sysconfdir = @sysconfdir@
472target_alias = @target_alias@
473top_build_prefix = @top_build_prefix@
474top_builddir = @top_builddir@
475top_srcdir = @top_srcdir@
476version_info = @version_info@
477x_cflags = @x_cflags@
478x_includes = @x_includes@
479x_libs = @x_libs@
480MAINTAINERCLEANFILES = Makefile.in
481AM_CPPFLAGS = \
482-I$(top_srcdir)/src/lib/ecore \
483-I$(top_srcdir)/src/lib/ecore_con \
484-I$(top_builddir)/src/lib/ecore \
485@EFL_ECORE_FILE_BUILD@ \
486@CURL_CFLAGS@ \
487@EVIL_CFLAGS@ \
488@EINA_CFLAGS@ \
489@WIN32_CPPFLAGS@
490
491AM_CFLAGS = @WIN32_CFLAGS@
492@BUILD_ECORE_CON_TRUE@lib_ecore_con_la = $(top_builddir)/src/lib/ecore_con/libecore_con.la
493lib_LTLIBRARIES = libecore_file.la
494includes_HEADERS = Ecore_File.h
495includesdir = $(includedir)/ecore-@VMAJ@
496libecore_file_la_SOURCES = \
497ecore_file.c \
498ecore_file_monitor.c \
499ecore_file_monitor_inotify.c \
500ecore_file_monitor_win32.c \
501ecore_file_monitor_poll.c \
502ecore_file_path.c \
503ecore_file_download.c
504
505libecore_file_la_LIBADD = \
506$(top_builddir)/src/lib/ecore/libecore.la \
507$(lib_ecore_con_la) \
508@EVIL_LIBS@ \
509@EINA_LIBS@
510
511libecore_file_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
512EXTRA_DIST = ecore_file_private.h
513all: all-am
514
515.SUFFIXES:
516.SUFFIXES: .c .lo .o .obj
517$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
518 @for dep in $?; do \
519 case '$(am__configure_deps)' in \
520 *$$dep*) \
521 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
522 && { if test -f $@; then exit 0; else break; fi; }; \
523 exit 1;; \
524 esac; \
525 done; \
526 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_file/Makefile'; \
527 $(am__cd) $(top_srcdir) && \
528 $(AUTOMAKE) --gnu src/lib/ecore_file/Makefile
529.PRECIOUS: Makefile
530Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
531 @case '$?' in \
532 *config.status*) \
533 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
534 *) \
535 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
536 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
537 esac;
538
539$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
540 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
541
542$(top_srcdir)/configure: $(am__configure_deps)
543 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
544$(ACLOCAL_M4): $(am__aclocal_m4_deps)
545 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
546$(am__aclocal_m4_deps):
547install-libLTLIBRARIES: $(lib_LTLIBRARIES)
548 @$(NORMAL_INSTALL)
549 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
550 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
551 list2=; for p in $$list; do \
552 if test -f $$p; then \
553 list2="$$list2 $$p"; \
554 else :; fi; \
555 done; \
556 test -z "$$list2" || { \
557 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
558 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
559 }
560
561uninstall-libLTLIBRARIES:
562 @$(NORMAL_UNINSTALL)
563 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
564 for p in $$list; do \
565 $(am__strip_dir) \
566 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
567 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
568 done
569
570clean-libLTLIBRARIES:
571 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
572 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
573 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
574 test "$$dir" != "$$p" || dir=.; \
575 echo "rm -f \"$${dir}/so_locations\""; \
576 rm -f "$${dir}/so_locations"; \
577 done
578libecore_file.la: $(libecore_file_la_OBJECTS) $(libecore_file_la_DEPENDENCIES)
579 $(AM_V_CCLD)$(libecore_file_la_LINK) -rpath $(libdir) $(libecore_file_la_OBJECTS) $(libecore_file_la_LIBADD) $(LIBS)
580
581mostlyclean-compile:
582 -rm -f *.$(OBJEXT)
583
584distclean-compile:
585 -rm -f *.tab.c
586
587@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file.Plo@am__quote@
588@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_download.Plo@am__quote@
589@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor.Plo@am__quote@
590@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor_inotify.Plo@am__quote@
591@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor_poll.Plo@am__quote@
592@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor_win32.Plo@am__quote@
593@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_path.Plo@am__quote@
594
595.c.o:
596@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
597@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
598@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
599@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
601@am__fastdepCC_FALSE@ $(COMPILE) -c $<
602
603.c.obj:
604@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
605@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
606@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
607@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
608@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
609@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
610
611.c.lo:
612@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
613@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
614@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
615@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
616@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
617@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
618
619mostlyclean-libtool:
620 -rm -f *.lo
621
622clean-libtool:
623 -rm -rf .libs _libs
624install-includesHEADERS: $(includes_HEADERS)
625 @$(NORMAL_INSTALL)
626 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
627 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
628 for p in $$list; do \
629 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
630 echo "$$d$$p"; \
631 done | $(am__base_list) | \
632 while read files; do \
633 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
634 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
635 done
636
637uninstall-includesHEADERS:
638 @$(NORMAL_UNINSTALL)
639 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
640 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
641 test -n "$$files" || exit 0; \
642 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
643 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
644
645ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
646 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
647 unique=`for i in $$list; do \
648 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
649 done | \
650 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
651 END { if (nonempty) { for (i in files) print i; }; }'`; \
652 mkid -fID $$unique
653tags: TAGS
654
655TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
656 $(TAGS_FILES) $(LISP)
657 set x; \
658 here=`pwd`; \
659 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
660 unique=`for i in $$list; do \
661 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
662 done | \
663 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
664 END { if (nonempty) { for (i in files) print i; }; }'`; \
665 shift; \
666 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
667 test -n "$$unique" || unique=$$empty_fix; \
668 if test $$# -gt 0; then \
669 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
670 "$$@" $$unique; \
671 else \
672 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
673 $$unique; \
674 fi; \
675 fi
676ctags: CTAGS
677CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
678 $(TAGS_FILES) $(LISP)
679 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
680 unique=`for i in $$list; do \
681 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
682 done | \
683 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
684 END { if (nonempty) { for (i in files) print i; }; }'`; \
685 test -z "$(CTAGS_ARGS)$$unique" \
686 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
687 $$unique
688
689GTAGS:
690 here=`$(am__cd) $(top_builddir) && pwd` \
691 && $(am__cd) $(top_srcdir) \
692 && gtags -i $(GTAGS_ARGS) "$$here"
693
694distclean-tags:
695 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
696
697distdir: $(DISTFILES)
698 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
699 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
700 list='$(DISTFILES)'; \
701 dist_files=`for file in $$list; do echo $$file; done | \
702 sed -e "s|^$$srcdirstrip/||;t" \
703 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
704 case $$dist_files in \
705 */*) $(MKDIR_P) `echo "$$dist_files" | \
706 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
707 sort -u` ;; \
708 esac; \
709 for file in $$dist_files; do \
710 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
711 if test -d $$d/$$file; then \
712 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
713 if test -d "$(distdir)/$$file"; then \
714 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
715 fi; \
716 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
717 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
718 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
719 fi; \
720 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
721 else \
722 test -f "$(distdir)/$$file" \
723 || cp -p $$d/$$file "$(distdir)/$$file" \
724 || exit 1; \
725 fi; \
726 done
727check-am: all-am
728check: check-am
729all-am: Makefile $(LTLIBRARIES) $(HEADERS)
730installdirs:
731 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
732 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
733 done
734install: install-am
735install-exec: install-exec-am
736install-data: install-data-am
737uninstall: uninstall-am
738
739install-am: all-am
740 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
741
742installcheck: installcheck-am
743install-strip:
744 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
745 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
746 `test -z '$(STRIP)' || \
747 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
748mostlyclean-generic:
749
750clean-generic:
751
752distclean-generic:
753 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
754 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
755
756maintainer-clean-generic:
757 @echo "This command is intended for maintainers to use"
758 @echo "it deletes files that may require special tools to rebuild."
759 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
760clean: clean-am
761
762clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
763 mostlyclean-am
764
765distclean: distclean-am
766 -rm -rf ./$(DEPDIR)
767 -rm -f Makefile
768distclean-am: clean-am distclean-compile distclean-generic \
769 distclean-tags
770
771dvi: dvi-am
772
773dvi-am:
774
775html: html-am
776
777html-am:
778
779info: info-am
780
781info-am:
782
783install-data-am: install-includesHEADERS
784
785install-dvi: install-dvi-am
786
787install-dvi-am:
788
789install-exec-am: install-libLTLIBRARIES
790
791install-html: install-html-am
792
793install-html-am:
794
795install-info: install-info-am
796
797install-info-am:
798
799install-man:
800
801install-pdf: install-pdf-am
802
803install-pdf-am:
804
805install-ps: install-ps-am
806
807install-ps-am:
808
809installcheck-am:
810
811maintainer-clean: maintainer-clean-am
812 -rm -rf ./$(DEPDIR)
813 -rm -f Makefile
814maintainer-clean-am: distclean-am maintainer-clean-generic
815
816mostlyclean: mostlyclean-am
817
818mostlyclean-am: mostlyclean-compile mostlyclean-generic \
819 mostlyclean-libtool
820
821pdf: pdf-am
822
823pdf-am:
824
825ps: ps-am
826
827ps-am:
828
829uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
830
831.MAKE: install-am install-strip
832
833.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
834 clean-libLTLIBRARIES clean-libtool ctags distclean \
835 distclean-compile distclean-generic distclean-libtool \
836 distclean-tags distdir dvi dvi-am html html-am info info-am \
837 install install-am install-data install-data-am install-dvi \
838 install-dvi-am install-exec install-exec-am install-html \
839 install-html-am install-includesHEADERS install-info \
840 install-info-am install-libLTLIBRARIES install-man install-pdf \
841 install-pdf-am install-ps install-ps-am install-strip \
842 installcheck installcheck-am installdirs maintainer-clean \
843 maintainer-clean-generic mostlyclean mostlyclean-compile \
844 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
845 tags uninstall uninstall-am uninstall-includesHEADERS \
846 uninstall-libLTLIBRARIES
847
848
849# Tell versions [3.59,3.63) of GNU make to not export all variables.
850# Otherwise a system limit (for SysV at least) may be exceeded.
851.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file.c b/libraries/ecore/src/lib/ecore_file/ecore_file.c
deleted file mode 100644
index cb03717..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file.c
+++ /dev/null
@@ -1,1109 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8
9#ifndef _MSC_VER
10# include <unistd.h>
11# include <libgen.h>
12#endif
13
14#ifdef _WIN32
15# include <direct.h>
16#endif
17
18#ifdef HAVE_FEATURES_H
19# include <features.h>
20#endif
21#include <ctype.h>
22#include <errno.h>
23
24#ifdef HAVE_ATFILE_SOURCE
25# include <dirent.h>
26#endif
27
28#include "ecore_file_private.h"
29
30int _ecore_file_log_dom = -1;
31static int _ecore_file_init_count = 0;
32
33/* externally accessible functions */
34
35/**
36 * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions
37 *
38 * @{
39 */
40
41/**
42 * @brief Initialize the Ecore_File library.
43 *
44 * @return 1 or greater on success, 0 on error.
45 *
46 * This function sets up Ecore_File and the services it will use
47 * (monitoring, downloading, PATH related feature). It returns 0 on
48 * failure, otherwise it returns the number of times it has already
49 * been called.
50 *
51 * When Ecore_File is not used anymore, call ecore_file_shutdown()
52 * to shut down the Ecore_File library.
53 */
54EAPI int
55ecore_file_init()
56{
57 if (++_ecore_file_init_count != 1)
58 return _ecore_file_init_count;
59
60 if (!ecore_init())
61 return --_ecore_file_init_count;
62
63 _ecore_file_log_dom = eina_log_domain_register
64 ("ecore_file", ECORE_FILE_DEFAULT_LOG_COLOR);
65 if(_ecore_file_log_dom < 0)
66 {
67 EINA_LOG_ERR("Impossible to create a log domain for the ecore file module.");
68 return --_ecore_file_init_count;
69 }
70 ecore_file_path_init();
71 ecore_file_monitor_init();
72 ecore_file_download_init();
73
74 /* FIXME: were the tests disabled for a good reason ? */
75
76 /*
77 if (!ecore_file_monitor_init())
78 goto shutdown_ecore_file_path;
79
80 if (!ecore_file_download_init())
81 goto shutdown_ecore_file_monitor;
82 */
83
84 return _ecore_file_init_count;
85
86 /*
87 shutdown_ecore_file_monitor:
88 ecore_file_monitor_shutdown();
89 shutdown_ecore_file_path:
90 ecore_file_path_shutdown();
91
92 return --_ecore_file_init_count;
93 */
94}
95
96/**
97 * @brief Shut down the Ecore_File library.
98 *
99 * @return 0 when the library is completely shut down, 1 or
100 * greater otherwise.
101 *
102 * This function shuts down the Ecore_File library. It returns 0 when it has
103 * been called the same number of times than ecore_file_init(). In that case
104 * it shuts down all the services it uses.
105 */
106EAPI int
107ecore_file_shutdown()
108{
109 if (--_ecore_file_init_count != 0)
110 return _ecore_file_init_count;
111
112 ecore_file_download_shutdown();
113 ecore_file_monitor_shutdown();
114 ecore_file_path_shutdown();
115
116 eina_log_domain_unregister(_ecore_file_log_dom);
117 _ecore_file_log_dom = -1;
118
119 ecore_shutdown();
120
121 return _ecore_file_init_count;
122}
123
124/**
125 * @brief Get the time of the last modification to the given file.
126 *
127 * @param file The name of the file.
128 * @return Return the time of the last data modification, or 0 on
129 * failure.
130 *
131 * This function returns the time of the last modification of
132 * @p file. On failure, it returns 0.
133 */
134EAPI long long
135ecore_file_mod_time(const char *file)
136{
137 struct stat st;
138
139 if (stat(file, &st) < 0) return 0;
140 return st.st_mtime;
141}
142
143/**
144 * @brief Get the size of the given file.
145 *
146 * @param file The name of the file.
147 * @return Return the size of the file in bytes, or 0 on failure.
148 *
149 * This function returns the size of @p file in bytes. On failure, it
150 * returns 0.
151 */
152EAPI long long
153ecore_file_size(const char *file)
154{
155 struct stat st;
156
157 if (stat(file, &st) < 0) return 0;
158 return st.st_size;
159}
160
161/**
162 * @brief Check if the given file exists.
163 *
164 * @param file The name of the file.
165 * @return Return EINA_TRUE if the file exists, EINA_FALSE otherwise.
166 *
167 * This function returns EINA_TRUE if @p file exists on local filesystem,
168 * EINA_FALSE otherwise.
169 */
170EAPI Eina_Bool
171ecore_file_exists(const char *file)
172{
173 struct stat st;
174 if (!file) return EINA_FALSE;
175
176 /*Workaround so that "/" returns a true, otherwise we can't monitor "/" in ecore_file_monitor*/
177 if (stat(file, &st) < 0 && strcmp(file, "/")) return EINA_FALSE;
178 return EINA_TRUE;
179}
180
181/**
182 * @brief Check if the given file is a directory.
183 *
184 * @param file The name of the file.
185 * @return Return EINA_TRUE if the file exists and is a directory,
186 * EINA_FALSE otherwise.
187 *
188 * This function returns EINA_TRUE if @p file exists exists and is a
189 * directory on local filesystem, EINA_FALSE otherwise.
190 */
191EAPI Eina_Bool
192ecore_file_is_dir(const char *file)
193{
194 struct stat st;
195
196 if (stat(file, &st) < 0) return EINA_FALSE;
197 if (S_ISDIR(st.st_mode)) return EINA_TRUE;
198 return EINA_FALSE;
199}
200
201static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
202
203/**
204 * @brief Create a new directory.
205 *
206 * @param dir The name of the directory to create
207 * @return EINA_TRUE on successful creation, EINA_FALSE otherwise.
208 *
209 * This function creates the directory @p dir with the mode S_IRUSR |
210 * S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH. On
211 * success, it returns EINA_TRUE, EINA_FALSE otherwise.
212 */
213EAPI Eina_Bool
214ecore_file_mkdir(const char *dir)
215{
216 if (mkdir(dir, default_mode) < 0) return EINA_FALSE;
217 return EINA_TRUE;
218}
219
220/**
221 * @brief Create complete directory in a batch.
222 *
223 * @param dirs The list of directories, null terminated.
224 * @return The number of successful directories created, -1 if dirs is
225 * @c NULL.
226 *
227 * This function creates all the directories that are in the null
228 * terminated array @p dirs. The function loops over the directories
229 * and call ecore_file_mkdir(). This function returns -1 if @p dirs is
230 * @c NULL, otherwise if returns the number of suceesfully created
231 * directories.
232 */
233EAPI int
234ecore_file_mkdirs(const char **dirs)
235{
236 int i = 0;
237
238 if (!dirs) return -1;
239
240 for (; *dirs; dirs++)
241 if (ecore_file_mkdir(*dirs))
242 i++;
243 return i;
244}
245
246/**
247 * @brief Create complete list of sub-directories in a batch (optimized).
248 *
249 * @param base The base directory to act on.
250 * @param subdirs The list of directories, null terminated.
251 * @return number of successful directories created, -1 on failure.
252 *
253 * This function creates all the directories that are in the null
254 * terminated array @p dirs in the @p base directory. If @p base does
255 * not exist, it will be created. The function loops over the directories
256 * and call ecore_file_mkdir(). The whole path of the directories must
257 * exist. So if base/a/b/c wants to be created, @p subdirs must
258 * contain "a", "a/b" and "a/b/c", in that order. This function
259 * returns -1 if @p dirs or @p base are @c NULL, or if @p base is
260 * empty ("\0"). It returns 0 is @p base is not a directory or
261 * invalid, or if it can't be created. Otherwise if returns the number
262 * of suceesfully created directories.
263 */
264EAPI int
265ecore_file_mksubdirs(const char *base, const char **subdirs)
266{
267#ifndef HAVE_ATFILE_SOURCE
268 char buf[PATH_MAX];
269 int baselen;
270#else
271 int fd;
272 DIR *dir;
273#endif
274 int i;
275
276 if (!subdirs) return -1;
277 if ((!base) || (base[0] == '\0')) return -1;
278
279 if ((!ecore_file_is_dir(base)) && (!ecore_file_mkpath(base)))
280 return 0;
281
282#ifndef HAVE_ATFILE_SOURCE
283 baselen = eina_strlcpy(buf, base, sizeof(buf));
284 if ((baselen < 1) || (baselen + 1 >= (int)sizeof(buf)))
285 return 0;
286
287 if (buf[baselen - 1] != '/')
288 {
289 buf[baselen] = '/';
290 baselen++;
291 }
292#else
293 dir = opendir(base);
294 if (!dir)
295 return 0;
296 fd = dirfd(dir);
297#endif
298
299 i = 0;
300 for (; *subdirs; subdirs++)
301 {
302 struct stat st;
303
304#ifndef HAVE_ATFILE_SOURCE
305 eina_strlcpy(buf + baselen, *subdirs, sizeof(buf) - baselen);
306 if (stat(buf, &st) == 0)
307#else
308 if (fstatat(fd, *subdirs, &st, 0) == 0)
309#endif
310 {
311 if (S_ISDIR(st.st_mode))
312 {
313 i++;
314 continue;
315 }
316 }
317 else
318 {
319 if (errno == ENOENT)
320 {
321#ifndef HAVE_ATFILE_SOURCE
322 if (mkdir(buf, default_mode) == 0)
323#else
324 if (mkdirat(fd, *subdirs, default_mode) == 0)
325#endif
326 {
327 i++;
328 continue;
329 }
330 }
331 }
332 }
333
334#ifdef HAVE_ATFILE_SOURCE
335 closedir(dir);
336#endif
337
338 return i;
339}
340
341/**
342 * @brief Delete the given directory.
343 *
344 * @param dir The name of the directory to delete.
345 * @return EINA_TRUE on success, EINA_FALSE otherwise.
346 *
347 * This function deletes @p dir. It returns EINA_TRUE on success,
348 * EINA_FALSE otherwise.
349 */
350EAPI Eina_Bool
351ecore_file_rmdir(const char *dir)
352{
353 if (rmdir(dir) < 0) return EINA_FALSE;
354 return EINA_TRUE;
355}
356
357/**
358 * @brief Delete the given file.
359 *
360 * @param file The name of the file to delete.
361 * @return EINA_TRUE on success, EINA_FALSE otherwise.
362 *
363 * This function deletes @p file. It returns EINA_TRUE on success,
364 * EINA_FALSE otherwise.
365 */
366EAPI Eina_Bool
367ecore_file_unlink(const char *file)
368{
369 if (unlink(file) < 0) return EINA_FALSE;
370 return EINA_TRUE;
371}
372
373/**
374 * @brief Remove the given file or directory.
375 *
376 * @param file The name of the file or directory to delete.
377 * @return EINA_TRUE on success, EINA_FALSE otherwise.
378 *
379 * This function removes @p file. It returns EINA_TRUE on success,
380 * EINA_FALSE otherwise.
381 */
382EAPI Eina_Bool
383ecore_file_remove(const char *file)
384{
385 if (remove(file) < 0) return EINA_FALSE;
386 return EINA_TRUE;
387}
388
389/**
390 * @brief Delete the given directory and all its contents.
391 *
392 * @param dir The name of the directory to delete.
393 * @return EINA_TRUE on success, EINA_FALSE otherwise.
394 *
395 * This function delete @p dir and all its contents. If @p dir is a
396 * link only the link is removed. It returns EINA_TRUE on success,
397 * EINA_FALSE otherwise.
398 */
399EAPI Eina_Bool
400ecore_file_recursive_rm(const char *dir)
401{
402 Eina_Iterator *it;
403 char buf[PATH_MAX];
404 struct stat st;
405 int ret;
406
407 if (readlink(dir, buf, sizeof(buf)) > 0)
408 return ecore_file_unlink(dir);
409
410 ret = stat(dir, &st);
411 if ((ret == 0) && (S_ISDIR(st.st_mode)))
412 {
413 Eina_File_Direct_Info *info;
414
415 ret = 1;
416 if (stat(dir, &st) == -1) return EINA_FALSE; /* WOOT: WHY ARE WE CALLING STAT TWO TIMES ??? */
417
418 it = eina_file_direct_ls(dir);
419 EINA_ITERATOR_FOREACH(it, info)
420 {
421 if (!ecore_file_recursive_rm(info->path))
422 ret = 0;
423 }
424 eina_iterator_free(it);
425
426 if (!ecore_file_rmdir(dir)) ret = 0;
427 if (ret)
428 return EINA_TRUE;
429 else
430 return EINA_FALSE;
431 }
432 else
433 {
434 if (ret == -1) return EINA_FALSE;
435 return ecore_file_unlink(dir);
436 }
437}
438
439static inline Eina_Bool
440_ecore_file_mkpath_if_not_exists(const char *path)
441{
442 struct stat st;
443
444 /* Windows: path like C: or D: etc are valid, but stat() returns an error */
445#ifdef _WIN32
446 if ((strlen(path) == 2) &&
447 ((path[0] >= 'a' && path[0] <= 'z') ||
448 (path[0] >= 'A' && path[0] <= 'Z')) &&
449 (path[1] == ':'))
450 return EINA_TRUE;
451#endif
452
453 if (stat(path, &st) < 0)
454 return ecore_file_mkdir(path);
455 else if (!S_ISDIR(st.st_mode))
456 return EINA_FALSE;
457 else
458 return EINA_TRUE;
459}
460
461/**
462 * @brief Create a complete path.
463 *
464 * @param path The path to create
465 * @return EINA_TRUE on success, EINA_FALSE otherwise.
466 *
467 * This function creates @p path and all the subdirectories it
468 * contains. The separator is '/' or '\'. If @p path exists, this
469 * function returns EINA_TRUE immediately. It returns EINA_TRUE on
470 * success, EINA_FALSE otherwise.
471 */
472EAPI Eina_Bool
473ecore_file_mkpath(const char *path)
474{
475 char ss[PATH_MAX];
476 unsigned int i;
477
478 if (ecore_file_is_dir(path))
479 return EINA_TRUE;
480
481 for (i = 0; path[i] != '\0'; ss[i] = path[i], i++)
482 {
483 if (i == sizeof(ss) - 1) return EINA_FALSE;
484 if (((path[i] == '/') || (path[i] == '\\')) && (i > 0))
485 {
486 ss[i] = '\0';
487 if (!_ecore_file_mkpath_if_not_exists(ss))
488 return EINA_FALSE;
489 }
490 }
491 ss[i] = '\0';
492 return _ecore_file_mkpath_if_not_exists(ss);
493}
494
495/**
496 * @brief Create complete paths in a batch.
497 *
498 * @param paths list of paths, null terminated.
499 * @return number of successful paths created, -1 if paths is NULL.
500 *
501 * This function creates all the directories that are in the null
502 * terminated array @p paths. The function loops over the directories
503 * and call ecore_file_mkpath(), hence on Windows, '\' must be
504 * replaced by '/' before calling that function. This function
505 * returns -1 if @p paths is @c NULL. Otherwise if returns the number
506 * of suceesfully created directories.
507 */
508EAPI int
509ecore_file_mkpaths(const char **paths)
510{
511 int i = 0;
512
513 if (!paths) return -1;
514
515 for (; *paths; paths++)
516 if (ecore_file_mkpath(*paths))
517 i++;
518 return i;
519}
520
521/**
522 * @brief Copy the given file to the given destination.
523 *
524 * @param src The name of the source file.
525 * @param dst The name of the destination file.
526 * @return EINA_TRUE on success, EINA_FALSE otherwise.
527 *
528 * This function copies @p src to @p dst. If the absolute path name of
529 * @p src and @p dst can not be computed, or if they are equal, or if
530 * the copy fails, the function returns EINA_FALSE, otherwise it
531 * returns EINA_TRUE.
532 */
533EAPI Eina_Bool
534ecore_file_cp(const char *src, const char *dst)
535{
536 FILE *f1, *f2;
537 char buf[16384];
538 char realpath1[PATH_MAX], realpath2[PATH_MAX];
539 size_t num;
540 Eina_Bool ret = EINA_TRUE;
541
542 if (!realpath(src, realpath1)) return EINA_FALSE;
543 if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return EINA_FALSE;
544
545 f1 = fopen(src, "rb");
546 if (!f1) return EINA_FALSE;
547 f2 = fopen(dst, "wb");
548 if (!f2)
549 {
550 fclose(f1);
551 return EINA_FALSE;
552 }
553 while ((num = fread(buf, 1, sizeof(buf), f1)) > 0)
554 {
555 if (fwrite(buf, 1, num, f2) != num) ret = EINA_FALSE;
556 }
557 fclose(f1);
558 fclose(f2);
559 return ret;
560}
561
562/**
563 * @brief Move the given file to the given destination.
564 *
565 * @param src The name of the source file.
566 * @param dst The name of the destination file.
567 * @return EINA_TRUE on success, EINA_FALSE otherwise.
568 *
569 * This function moves @p src to @p dst. It returns EINA_TRUE on
570 * success, EINA_FALSE otherwise.
571 */
572EAPI Eina_Bool
573ecore_file_mv(const char *src, const char *dst)
574{
575 char buf[PATH_MAX];
576 int fd;
577
578 if (rename(src, dst))
579 {
580 // File cannot be moved directly because
581 // it resides on a different mount point.
582 if (errno == EXDEV)
583 {
584 struct stat st;
585
586 // Make sure this is a regular file before
587 // we do anything fancy.
588 stat(src, &st);
589 if (S_ISREG(st.st_mode))
590 {
591 char *dir;
592
593 dir = ecore_file_dir_get(dst);
594 // Since we can't directly rename, try to
595 // copy to temp file in the dst directory
596 // and then rename.
597 snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX",
598 dir, ecore_file_file_get(dst));
599 free(dir);
600 fd = mkstemp(buf);
601 if (fd < 0) goto FAIL;
602 close(fd);
603
604 // Copy to temp file
605 if (!ecore_file_cp(src, buf))
606 goto FAIL;
607
608 // Set file permissions of temp file to match src
609 chmod(buf, st.st_mode);
610
611 // Try to atomically move temp file to dst
612 if (rename(buf, dst))
613 {
614 // If we still cannot atomically move
615 // do a normal copy and hope for the best.
616 if (!ecore_file_cp(buf, dst))
617 goto FAIL;
618 }
619
620 // Delete temporary file and src
621 ecore_file_unlink(buf);
622 ecore_file_unlink(src);
623 goto PASS;
624 }
625 }
626 goto FAIL;
627 }
628
629PASS:
630 return EINA_TRUE;
631
632FAIL:
633 return EINA_FALSE;
634}
635
636/**
637 * @brief Create a symbolic link.
638 *
639 * @param src The name of the file to link.
640 * @param dest The name of link.
641 * @return EINA_TRUE on success, EINA_FALSE otherwise.
642 *
643 * This function create the symbolic link @p dest of @p src. This
644 * function does not work on Windows. It returns EINA_TRUE on success,
645 * EINA_FALSE otherwise.
646 */
647EAPI Eina_Bool
648ecore_file_symlink(const char *src, const char *dest)
649{
650 if (!symlink(src, dest)) return EINA_TRUE;
651
652 return EINA_FALSE;
653}
654
655/**
656 * @brief Get the canonicalized absolute path name.
657 *
658 * @param file The file path.
659 * @return The canonicalized absolute pathname or an empty string on
660 * failure.
661 *
662 * This function returns the absolute path name of @p file as a newly
663 * allocated string. If @p file is @c NULL, or on error, this function
664 * returns an empty string. Otherwise, it returns the absolute path
665 * name. When not needed anymore, the returned value must be freed.
666 */
667EAPI char *
668ecore_file_realpath(const char *file)
669{
670 char buf[PATH_MAX];
671
672 /*
673 * Some implementations of realpath do not conform to the SUS.
674 * And as a result we must prevent a null arg from being passed.
675 */
676 if (!file) return strdup("");
677 if (!realpath(file, buf)) return strdup("");
678
679 return strdup(buf);
680}
681
682/**
683 * Get the filename from a given path.
684 *
685 * @param path The complete path.
686 * @return The file name.
687 *
688 * This function returns the file name of @p path. If @p path is
689 * @c NULL, the functions returns @c NULL.
690 */
691EAPI const char *
692ecore_file_file_get(const char *path)
693{
694 char *result = NULL;
695
696 if (!path) return NULL;
697 if ((result = strrchr(path, '/'))) result++;
698 else result = (char *)path;
699 return result;
700}
701
702/**
703 * @brief Get the directory where the given file resides.
704 *
705 * @param file The name of the file.
706 * @return The directory name.
707 *
708 * This function returns the directory where @p file resides as anewly
709 * allocated string. If @p file is @c NULL or on error, this function
710 * returns @c NULL. When not needed anymore, the returned value must
711 * be freed.
712 */
713EAPI char *
714ecore_file_dir_get(const char *file)
715{
716 char *p;
717 char buf[PATH_MAX];
718
719 if (!file) return NULL;
720 strncpy(buf, file, PATH_MAX);
721 buf[PATH_MAX - 1] = 0;
722 p = dirname(buf);
723 return strdup(p);
724}
725
726/**
727 * @brief Check if the given file can be read.
728 *
729 * @param file The name of the file.
730 * @return EINA_TRUE if the file is readable, EINA_FALSE otherwise.
731 *
732 * This function returns EINA_TRUE if @p file can be read, EINA_FALSE
733 * otherwise.
734 */
735EAPI Eina_Bool
736ecore_file_can_read(const char *file)
737{
738 if (!file) return EINA_FALSE;
739 if (!access(file, R_OK)) return EINA_TRUE;
740 return EINA_FALSE;
741}
742
743/**
744 * @brief Check if the given file can be written.
745 *
746 * @param file The name of the file.
747 * @return EINA_TRUE if the file is writable, EINA_FALSE otherwise.
748 *
749 * This function returns EINA_TRUE if @p file can be written, EINA_FALSE
750 * otherwise.
751 */
752EAPI Eina_Bool
753ecore_file_can_write(const char *file)
754{
755 if (!file) return EINA_FALSE;
756 if (!access(file, W_OK)) return EINA_TRUE;
757 return EINA_FALSE;
758}
759
760/**
761 * @brief Check if the given file can be executed.
762 *
763 * @param file The name of the file.
764 * @return EINA_TRUE if the file can be executed, EINA_FALSE otherwise.
765 *
766 * This function returns EINA_TRUE if @p file can be executed, EINA_FALSE
767 * otherwise.
768 */
769EAPI Eina_Bool
770ecore_file_can_exec(const char *file)
771{
772 if (!file) return EINA_FALSE;
773 if (!access(file, X_OK)) return EINA_TRUE;
774 return EINA_FALSE;
775}
776
777/**
778 * @brief Get the path pointed by the given link.
779 *
780 * @param lnk The name of the link.
781 * @return The path pointed by link or NULL.
782 *
783 * This function returns the path pointed by @p link as a newly
784 * allocated string. This function does not work on Windows. On
785 * failure, the function returns @c NULL. When not needed anymore, the
786 * returned value must be freed.
787 */
788EAPI char *
789ecore_file_readlink(const char *lnk)
790{
791 char buf[PATH_MAX];
792 int count;
793
794 if ((count = readlink(lnk, buf, sizeof(buf) - 1)) < 0) return NULL;
795 buf[count] = 0;
796 return strdup(buf);
797}
798
799/**
800 * @brief Get the list of the files and directories in the given
801 * directory.
802 *
803 * @param dir The name of the directory to list
804 * @return Return an Eina_List containing all the files in the directory;
805 * on failure it returns NULL.
806 *
807 * This function returns a list of allocated strings of all the files
808 * and directories contained in @p dir. The list will be sorted with
809 * strcoll as compare function. That means that you may want to set
810 * the current locale for the category LC_COLLATE with
811 * setlocale(). For more information see the manual pages of strcoll
812 * and setlocale. The list will not contain the directory entries for
813 * '.' and '..'. On failure, @c NULL is returned. When not needed
814 * anymore, the list elements must be freed.
815 */
816EAPI Eina_List *
817ecore_file_ls(const char *dir)
818{
819 Eina_File_Direct_Info *info;
820 Eina_Iterator *ls;
821 Eina_List *list = NULL;
822
823 ls = eina_file_direct_ls(dir);
824 if (!ls) return NULL;
825
826 EINA_ITERATOR_FOREACH(ls, info)
827 {
828 char *f;
829
830 f = strdup(info->path + info->name_start);
831 list = eina_list_append(list, f);
832 }
833 eina_iterator_free(ls);
834
835 list = eina_list_sort(list, eina_list_count(list), EINA_COMPARE_CB(strcoll));
836
837 return list;
838}
839
840/**
841 * @brief Return the executable from the given command.
842 *
843 * @param app The application command, with parameters.
844 *
845 * This function returns the executable from @p app as a newly
846 * allocated string. Arguments are removed and escae characters are
847 * handled. If @p app is @c NULL, or on failure, the function returns
848 * @c NULL. When not needed anymore, the returned value must be freed.
849 */
850EAPI char *
851ecore_file_app_exe_get(const char *app)
852{
853 char *p, *pp, *exe1 = NULL, *exe2 = NULL;
854 char *exe = NULL;
855 int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
856
857 if (!app) return NULL;
858
859 p = (char *)app;
860restart:
861 while ((*p) && (isspace((unsigned char)*p))) p++;
862 exe1 = p;
863 while (*p)
864 {
865 if (in_quot_sing)
866 {
867 if (*p == '\'')
868 in_quot_sing = 0;
869 }
870 else if (in_quot_dbl)
871 {
872 if (*p == '\"')
873 in_quot_dbl = 0;
874 }
875 else
876 {
877 if (*p == '\'')
878 in_quot_sing = 1;
879 else if (*p == '\"')
880 in_quot_dbl = 1;
881 if ((isspace((unsigned char)*p)) && ((p <= app) || (p[-1] == '\\')))
882 break;
883 }
884 p++;
885 }
886 exe2 = p;
887 if (exe2 == exe1) return NULL;
888 if (*exe1 == '~')
889 {
890 char *homedir;
891 int len;
892
893 /* Skip ~ */
894 exe1++;
895
896 homedir = getenv("HOME");
897 if (!homedir) return NULL;
898 len = strlen(homedir);
899 if (exe) free(exe);
900 exe = malloc(len + exe2 - exe1 + 2);
901 if (!exe) return NULL;
902 pp = exe;
903 if (len)
904 {
905 strcpy(exe, homedir);
906 pp += len;
907 if (*(pp - 1) != '/')
908 {
909 *pp = '/';
910 pp++;
911 }
912 }
913 }
914 else
915 {
916 if (exe) free(exe);
917 exe = malloc(exe2 - exe1 + 1);
918 if (!exe) return NULL;
919 pp = exe;
920 }
921 p = exe1;
922 restart = 0;
923 in_quot_dbl = 0;
924 in_quot_sing = 0;
925 while (*p)
926 {
927 if (in_quot_sing)
928 {
929 if (*p == '\'')
930 in_quot_sing = 0;
931 else
932 {
933 *pp = *p;
934 pp++;
935 }
936 }
937 else if (in_quot_dbl)
938 {
939 if (*p == '\"')
940 in_quot_dbl = 0;
941 else
942 {
943 /* technically this is wrong. double quotes also accept
944 * special chars:
945 *
946 * $, `, \
947 */
948 *pp = *p;
949 pp++;
950 }
951 }
952 else
953 {
954 /* technically we should handle special chars:
955 *
956 * $, `, \, etc.
957 */
958 if ((p > exe1) && (p[-1] == '\\'))
959 {
960 if (*p != '\n')
961 {
962 *pp = *p;
963 pp++;
964 }
965 }
966 else if ((p > exe1) && (*p == '='))
967 {
968 restart = 1;
969 *pp = *p;
970 pp++;
971 }
972 else if (*p == '\'')
973 in_quot_sing = 1;
974 else if (*p == '\"')
975 in_quot_dbl = 1;
976 else if (isspace((unsigned char)*p))
977 {
978 if (restart)
979 goto restart;
980 else
981 break;
982 }
983 else
984 {
985 *pp = *p;
986 pp++;
987 }
988 }
989 p++;
990 }
991 *pp = 0;
992 return exe;
993}
994
995/**
996 * @brief Add the escape sequence ('\\') to the given file name.
997 *
998 * @param filename The file name.
999 * @return The file name with special characters escaped.
1000 *
1001 * This function adds the escape sequence ('\\') to the given file
1002 * name and returns the result as a newly allocated string. If the
1003 * length of the returned string is longer than PATH_MAX, or on
1004 * failure, @c NULL is returned. When not needed anymore, the returned
1005 * value must be freed.
1006 */
1007EAPI char *
1008ecore_file_escape_name(const char *filename)
1009{
1010 const char *p;
1011 char *q;
1012 char buf[PATH_MAX];
1013
1014 p = filename;
1015 q = buf;
1016 while (*p)
1017 {
1018 if ((q - buf) > (PATH_MAX - 6)) return NULL;
1019 if (
1020 (*p == ' ') || (*p == '\t') || (*p == '\n') ||
1021 (*p == '\\') || (*p == '\'') || (*p == '\"') ||
1022 (*p == ';') || (*p == '!') || (*p == '#') ||
1023 (*p == '$') || (*p == '%') || (*p == '&') ||
1024 (*p == '*') || (*p == '(') || (*p == ')') ||
1025 (*p == '[') || (*p == ']') || (*p == '{') ||
1026 (*p == '}') || (*p == '|') || (*p == '<') ||
1027 (*p == '>') || (*p == '?')
1028 )
1029 {
1030 *q = '\\';
1031 q++;
1032 }
1033 *q = *p;
1034 q++;
1035 p++;
1036 }
1037 *q = 0;
1038 return strdup(buf);
1039}
1040
1041/**
1042 * @brief Remove the extension from the given file name.
1043 *
1044 * @param path The name of the file.
1045 * @return A newly allocated string with the extension stripped out or
1046 * NULL on errors.
1047 *
1048 * This function removes the extension from @p path and returns the
1049 * result as a newly allocated string. If @p path is @c NULL, or on
1050 * failure, the function returns @c NULL. When not needed anymore, the
1051 * returned value must be freed.
1052 */
1053EAPI char *
1054ecore_file_strip_ext(const char *path)
1055{
1056 char *p, *file = NULL;
1057
1058 if (!path)
1059 return NULL;
1060
1061 p = strrchr(path, '.');
1062 if (!p)
1063 file = strdup(path);
1064 else if (p != path)
1065 {
1066 file = malloc(((p - path) + 1) * sizeof(char));
1067 if (file)
1068 {
1069 memcpy(file, path, (p - path));
1070 file[p - path] = 0;
1071 }
1072 }
1073
1074 return file;
1075}
1076
1077/**
1078 * @brief Check if the given directory is empty.
1079 *
1080 * @param dir The name of the directory to check.
1081 * @return 1 if directory is empty, 0 if it has at least one file or
1082 * -1 in case of errors.
1083 *
1084 * This functions checks if @p dir is empty. The '.' and '..' files
1085 * will be ignored. If @p dir is empty, 1 is returned, if it contains
1086 * at least 1 file, 0 is returned. On failure, -1 is returned.
1087 */
1088EAPI int
1089ecore_file_dir_is_empty(const char *dir)
1090{
1091 Eina_File_Direct_Info *info;
1092 Eina_Iterator *it;
1093
1094 it = eina_file_direct_ls(dir);
1095 if (!it) return -1;
1096
1097 EINA_ITERATOR_FOREACH(it, info)
1098 {
1099 eina_iterator_free(it);
1100 return 0;
1101 }
1102
1103 eina_iterator_free(it);
1104 return 1;
1105}
1106
1107/**
1108 * @}
1109 */
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_download.c b/libraries/ecore/src/lib/ecore_file/ecore_file_download.c
deleted file mode 100644
index 971493e..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_download.c
+++ /dev/null
@@ -1,449 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8
9#ifdef BUILD_ECORE_CON
10# include "Ecore_Con.h"
11#endif
12
13#include "ecore_file_private.h"
14
15#ifdef BUILD_ECORE_CON
16
17#define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8
18#define ECORE_FILE_DOWNLOAD_TIMEOUT 30
19
20struct _Ecore_File_Download_Job
21{
22 ECORE_MAGIC;
23
24 Ecore_Con_Url *url_con;
25 FILE *file;
26
27 char *dst;
28
29 Ecore_File_Download_Completion_Cb completion_cb;
30 Ecore_File_Download_Progress_Cb progress_cb;
31};
32
33#ifdef HAVE_CURL
34Ecore_File_Download_Job *_ecore_file_download_curl(const char *url, const char *dst,
35 Ecore_File_Download_Completion_Cb completion_cb,
36 Ecore_File_Download_Progress_Cb progress_cb,
37 void *data,
38 Eina_Hash *headers);
39
40static Eina_Bool _ecore_file_download_url_complete_cb(void *data, int type, void *event);
41static Eina_Bool _ecore_file_download_url_progress_cb(void *data, int type, void *event);
42#endif
43
44static Ecore_Event_Handler *_url_complete_handler = NULL;
45static Ecore_Event_Handler *_url_progress_download = NULL;
46static Eina_List *_job_list;
47
48static int download_init = 0;
49
50#endif /* BUILD_ECORE_CON */
51
52int
53ecore_file_download_init(void)
54{
55#ifdef BUILD_ECORE_CON
56 download_init++;
57 if (download_init > 1) return 1;
58 if (!ecore_con_init()) return 0;
59 if (!ecore_con_url_init())
60 {
61 ecore_con_shutdown();
62 return 0;
63 }
64# ifdef HAVE_CURL
65 _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL);
66 _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
67# endif
68#endif /* BUILD_ECORE_CON */
69 return 1;
70}
71
72void
73ecore_file_download_shutdown(void)
74{
75#ifdef BUILD_ECORE_CON
76 download_init--;
77 if (download_init > 0) return;
78 if (_url_complete_handler)
79 ecore_event_handler_del(_url_complete_handler);
80 if (_url_progress_download)
81 ecore_event_handler_del(_url_progress_download);
82 _url_complete_handler = NULL;
83 _url_progress_download = NULL;
84 ecore_file_download_abort_all();
85 ecore_con_url_shutdown();
86 ecore_con_shutdown();
87#endif /* BUILD_ECORE_CON */
88}
89
90#ifdef BUILD_ECORE_CON
91# ifdef HAVE_CURL
92static Eina_Bool
93_ecore_file_download_headers_foreach_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data, void *fdata)
94{
95 Ecore_File_Download_Job *job = fdata;
96 ecore_con_url_additional_header_add(job->url_con, key, data);
97
98 return EINA_TRUE;
99}
100# endif
101#endif
102
103static Eina_Bool
104_ecore_file_download(const char *url,
105 const char *dst,
106 Ecore_File_Download_Completion_Cb completion_cb,
107 Ecore_File_Download_Progress_Cb progress_cb,
108 void *data,
109 Ecore_File_Download_Job **job_ret,
110 Eina_Hash *headers)
111{
112#ifdef BUILD_ECORE_CON
113 char *dir = ecore_file_dir_get(dst);
114
115 if (!ecore_file_is_dir(dir))
116 {
117 ERR("%s is not a directory", dir);
118 free(dir);
119 return EINA_FALSE;
120 }
121 free(dir);
122 if (ecore_file_exists(dst))
123 {
124 WRN("%s already exists", dst);
125 return EINA_FALSE;
126 }
127
128 if (!strncmp(url, "file://", 7))
129 {
130 /* FIXME: Maybe fork? Might take a while to copy.
131 * Check filesize? */
132 /* Just copy it */
133
134 url += 7;
135 /* skip hostname */
136 url = strchr(url, '/');
137 return ecore_file_cp(url, dst);
138 }
139# ifdef HAVE_CURL
140 else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) ||
141 (!strncmp(url, "ftp://", 6)))
142 {
143 /* download */
144 Ecore_File_Download_Job *job;
145
146 job = _ecore_file_download_curl(url, dst, completion_cb, progress_cb, data, headers);
147 if(job_ret) *job_ret = job;
148 if(job)
149 return EINA_TRUE;
150 else
151 {
152 ERR("no job returned\n");
153 return EINA_FALSE;
154 }
155 return job ? EINA_TRUE : EINA_FALSE;
156 }
157# else
158 else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) ||
159 (!strncmp(url, "ftp://", 6)))
160 {
161 (void)completion_cb;
162 (void)progress_cb;
163 (void)data;
164 (void)job_ret;
165 (void)headers;
166 return EINA_FALSE;
167 }
168# endif
169 else
170 {
171 return EINA_FALSE;
172 }
173#else
174 (void)url;
175 (void)dst;
176 (void)completion_cb;
177 (void)progress_cb;
178 (void)data;
179 (void)job_ret;
180 (void)headers;
181 return EINA_FALSE;
182#endif /* BUILD_ECORE_CON */
183}
184
185/**
186 * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions
187 *
188 * @{
189 */
190
191/**
192 * @brief Download the given url to the given destination.
193 *
194 * @param url The complete url to download.
195 * @param dst The local file to save the downloaded to.
196 * @param completion_cb A callback called on download complete.
197 * @param progress_cb A callback called during the download operation.
198 * @param data User data passed to both callbacks.
199 * @param job_ret Job used to abort the download.
200 * @return EINA_TRUE if the download start or EINA_FALSE on failure
201 *
202 * This function starts the download of the URL @p url and saves it to
203 * @p dst. @p url must provide the protocol, including 'http://',
204 * 'ftp://' or 'file://'. Ecore_File must be compiled with CURL to
205 * download using http and ftp protocols. If @p dst is ill-formed, or
206 * if it already exists, the function returns EINA_FALSE. When the
207 * download is complete, the callback @p completion_cb is called and
208 * @p data is passed to it. The @p status parameter of @p completion_cb
209 * will be filled with the status of the download (200, 404,...). The
210 * @p progress_cb is called during the download operation, each time a
211 * packet is received or when CURL wants. It can be used to display the
212 * percentage of the downloaded file. Return 0 from this callback, if provided,
213 * to continue the operation or anything else to abort the download. The only
214 * operations that can be aborted are those with protocol 'http' or 'ftp'. In
215 * that case @p job_ret can be filled. It can be used with
216 * ecore_file_download_abort() or ecore_file_download_abort_all() to
217 * respectively abort one or all download operations. This function returns
218 * EINA_TRUE if the download starts, EINA_FALSE otherwise.
219 */
220EAPI Eina_Bool
221ecore_file_download(const char *url,
222 const char *dst,
223 Ecore_File_Download_Completion_Cb completion_cb,
224 Ecore_File_Download_Progress_Cb progress_cb,
225 void *data,
226 Ecore_File_Download_Job **job_ret)
227{
228 return _ecore_file_download(url, dst, completion_cb, progress_cb, data, job_ret, NULL);
229}
230
231/**
232 * @brief Download the given url to the given destination with additional headers.
233 *
234 * @param url The complete url to download.
235 * @param dst The local file to save the downloaded to.
236 * @param completion_cb A callback called on download complete.
237 * @param progress_cb A callback called during the download operation.
238 * @param data User data passed to both callbacks.
239 * @param job_ret Job used to abort the download.
240 * @param headers pointer of header lists.
241 * @return EINA_TRUE if the download start or EINA_FALSE on failure
242 */
243EAPI Eina_Bool
244ecore_file_download_full(const char *url,
245 const char *dst,
246 Ecore_File_Download_Completion_Cb completion_cb,
247 Ecore_File_Download_Progress_Cb progress_cb,
248 void *data,
249 Ecore_File_Download_Job **job_ret,
250 Eina_Hash *headers)
251{
252 return _ecore_file_download(url, dst, completion_cb, progress_cb, data, job_ret, headers);
253}
254
255/**
256 * @brief Check if the given protocol is available.
257 *
258 * @param protocol The protocol to check.
259 * @return EINA_TRUE if protocol is handled, EINA_FALSE otherwise.
260 *
261 * This function returns EINA_TRUE if @p protocol is supported,
262 * EINA_FALSE otherwise. @p protocol can be 'http://', 'ftp://' or
263 * 'file://'. Ecore_FILE must be compiled with CURL to handle http and
264 * ftp protocols.
265 */
266EAPI Eina_Bool
267ecore_file_download_protocol_available(const char *protocol)
268{
269#ifdef BUILD_ECORE_CON
270 if (!strncmp(protocol, "file://", 7)) return EINA_TRUE;
271# ifdef HAVE_CURL
272 else if (!strncmp(protocol, "http://", 7)) return EINA_TRUE;
273 else if (!strncmp(protocol, "ftp://", 6)) return EINA_TRUE;
274# endif
275#else
276 (void)protocol;
277#endif /* BUILD_ECORE_CON */
278
279 return EINA_FALSE;
280}
281
282#ifdef BUILD_ECORE_CON
283
284# ifdef HAVE_CURL
285static int
286_ecore_file_download_url_compare_job(const void *data1, const void *data2)
287{
288 const Ecore_File_Download_Job *job = data1;
289 const Ecore_Con_Url *url = data2;
290
291 if (job->url_con == url) return 0;
292 return -1;
293}
294
295static Eina_Bool
296_ecore_file_download_url_complete_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
297{
298 Ecore_Con_Event_Url_Complete *ev = event;
299 Ecore_File_Download_Job *job;
300
301 job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
302 if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return ECORE_CALLBACK_PASS_ON;
303
304 fclose(job->file);
305 if (job->completion_cb)
306 job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, ev->status);
307
308 _job_list = eina_list_remove(_job_list, job);
309 free(job->dst);
310 ecore_con_url_free(job->url_con);
311 free(job);
312
313 return ECORE_CALLBACK_DONE;
314}
315
316static Eina_Bool
317_ecore_file_download_url_progress_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
318{
319/* this reports the downloads progress. if we return 0, then download
320 * continues, if we return anything else, then the download stops */
321 Ecore_Con_Event_Url_Progress *ev = event;
322 Ecore_File_Download_Job *job;
323
324 job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
325 if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return ECORE_CALLBACK_PASS_ON;
326
327 if (job->progress_cb)
328 if (job->progress_cb(ecore_con_url_data_get(job->url_con), job->dst,
329 (long int) ev->down.total, (long int) ev->down.now,
330 (long int) ev->up.total, (long int) ev->up.now) != 0)
331 {
332 _job_list = eina_list_remove(_job_list, job);
333 fclose(job->file);
334 free(job->dst);
335 free(job);
336
337 return ECORE_CALLBACK_PASS_ON;
338 }
339
340 return ECORE_CALLBACK_DONE;
341}
342
343Ecore_File_Download_Job *
344_ecore_file_download_curl(const char *url, const char *dst,
345 Ecore_File_Download_Completion_Cb completion_cb,
346 Ecore_File_Download_Progress_Cb progress_cb,
347 void *data,
348 Eina_Hash *headers)
349{
350 Ecore_File_Download_Job *job;
351
352 job = calloc(1, sizeof(Ecore_File_Download_Job));
353 if (!job) return NULL;
354
355 ECORE_MAGIC_SET(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB);
356
357 job->file = fopen(dst, "wb");
358 if (!job->file)
359 {
360 free(job);
361 return NULL;
362 }
363 job->url_con = ecore_con_url_new(url);
364 if (!job->url_con)
365 {
366 fclose(job->file);
367 free(job);
368 return NULL;
369 }
370
371 if (headers) eina_hash_foreach(headers, _ecore_file_download_headers_foreach_cb, job);
372 ecore_con_url_fd_set(job->url_con, fileno(job->file));
373 ecore_con_url_data_set(job->url_con, data);
374
375 job->dst = strdup(dst);
376
377 job->completion_cb = completion_cb;
378 job->progress_cb = progress_cb;
379 _job_list = eina_list_append(_job_list, job);
380
381 if (!ecore_con_url_get(job->url_con))
382 {
383 ecore_con_url_free(job->url_con);
384 _job_list = eina_list_remove(_job_list, job);
385 fclose(job->file);
386 ecore_file_remove(job->dst);
387 free(job->dst);
388 free(job);
389 return NULL;
390 }
391
392 return job;
393}
394# endif
395#endif
396
397/**
398 * @brief Abort the given download job and call the completion_cb
399 * callbck with a status of 1 (error).
400 *
401 * @param job The download job to abort.
402 *
403 * This function aborts a download operation started by
404 * ecore_file_download(). @p job is the #Ecore_File_Download_Job
405 * structure filled by ecore_file_download(). If it is @c NULL, this
406 * function does nothing. To abort all the currently downloading
407 * operations, call ecore_file_download_abort_all().
408 */
409EAPI void
410ecore_file_download_abort(Ecore_File_Download_Job *job)
411{
412 if (!job)
413 return;
414
415#ifdef BUILD_ECORE_CON
416 if (job->completion_cb)
417 job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, 1);
418# ifdef HAVE_CURL
419 ecore_con_url_free(job->url_con);
420# endif
421 _job_list = eina_list_remove(_job_list, job);
422 fclose(job->file);
423 free(job->dst);
424 free(job);
425#endif /* BUILD_ECORE_CON */
426}
427
428/**
429 * @brief Abort all downloads.
430 *
431 * This function aborts all the downloads that have been started by
432 * ecore_file_download(). It loops over the started downloads and call
433 * ecore_file_download_abort() for each of them. To abort only one
434 * specific download operation, call ecore_file_download_abort().
435 */
436EAPI void
437ecore_file_download_abort_all(void)
438{
439#ifdef BUILD_ECORE_CON
440 Ecore_File_Download_Job *job;
441
442 EINA_LIST_FREE(_job_list, job)
443 ecore_file_download_abort(job);
444#endif /* BUILD_ECORE_CON */
445}
446
447/**
448 * @}
449 */
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c
deleted file mode 100644
index 7c334c0..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c
+++ /dev/null
@@ -1,180 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecore_file_private.h"
6
7typedef enum {
8 ECORE_FILE_MONITOR_TYPE_NONE,
9#ifdef HAVE_INOTIFY
10 ECORE_FILE_MONITOR_TYPE_INOTIFY,
11#endif
12#ifdef HAVE_NOTIFY_WIN32
13 ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32,
14#endif
15#ifdef HAVE_POLL
16 ECORE_FILE_MONITOR_TYPE_POLL
17#endif
18} Ecore_File_Monitor_Type;
19
20static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
21
22int
23ecore_file_monitor_init(void)
24{
25#ifdef HAVE_INOTIFY
26 monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY;
27 if (ecore_file_monitor_inotify_init())
28 return 1;
29#endif
30#ifdef HAVE_NOTIFY_WIN32
31 monitor_type = ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32;
32 if (ecore_file_monitor_win32_init())
33 return 1;
34#endif
35#ifdef HAVE_POLL
36 monitor_type = ECORE_FILE_MONITOR_TYPE_POLL;
37 if (ecore_file_monitor_poll_init())
38 return 1;
39#endif
40 monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
41 return 0;
42}
43
44void
45ecore_file_monitor_shutdown(void)
46{
47 switch (monitor_type)
48 {
49 case ECORE_FILE_MONITOR_TYPE_NONE:
50 break;
51#ifdef HAVE_INOTIFY
52 case ECORE_FILE_MONITOR_TYPE_INOTIFY:
53 ecore_file_monitor_inotify_shutdown();
54 break;
55#endif
56#ifdef HAVE_NOTIFY_WIN32
57 case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32:
58 ecore_file_monitor_win32_shutdown();
59 break;
60#endif
61#ifdef HAVE_POLL
62 case ECORE_FILE_MONITOR_TYPE_POLL:
63 ecore_file_monitor_poll_shutdown();
64 break;
65#endif
66 }
67}
68
69/**
70 * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions
71 *
72 * @{
73 */
74
75/**
76 * @brief Monitor the given path using inotify, Windows notification, or polling.
77 *
78 * @param path The path to monitor.
79 * @param func The function to call on changes.
80 * @param data The data passed to func.
81 * @return An Ecore_File_Monitor pointer or NULL on failure.
82 *
83 * This function monitors @p path. If @p path is @c NULL, or is an
84 * empty string, or none of the notify methods (Inotify, Windows
85 * notification or polling) is available, or if @p path is not a file,
86 * the function returns @c NULL. Otherwise, it returns a newly
87 * allocated Ecore_File_Monitor object and the monitoring begins. When
88 * one of the #Ecore_File_Event event is notified, @p func is called
89 * and @p data is passed to @p func. Call ecore_file_monitor_del() to
90 * stop the monitoring.
91 */
92EAPI Ecore_File_Monitor *
93ecore_file_monitor_add(const char *path,
94 Ecore_File_Monitor_Cb func,
95 void *data)
96{
97 if (!path || !*path)
98 return NULL;
99
100 switch (monitor_type)
101 {
102 case ECORE_FILE_MONITOR_TYPE_NONE:
103 return NULL;
104#ifdef HAVE_INOTIFY
105 case ECORE_FILE_MONITOR_TYPE_INOTIFY:
106 return ecore_file_monitor_inotify_add(path, func, data);
107#endif
108#ifdef HAVE_NOTIFY_WIN32
109 case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32:
110 return ecore_file_monitor_win32_add(path, func, data);
111#endif
112#ifdef HAVE_POLL
113 case ECORE_FILE_MONITOR_TYPE_POLL:
114 return ecore_file_monitor_poll_add(path, func, data);
115#endif
116 }
117 return NULL;
118}
119
120/**
121 * @brief Stop the monitoring of the given path.
122 *
123 * @param em The Ecore_File_Monitor to stop.
124 *
125 * This function stops the the monitoring of the path that has been
126 * monitored by ecore_file_monitor_add(). @p em must be the value
127 * returned by ecore_file_monitor_add(). If @p em is @c NULL, or none
128 * of the notify methods (Inotify, Windows notification or polling) is
129 * availablethis function does nothing.
130 */
131EAPI void
132ecore_file_monitor_del(Ecore_File_Monitor *em)
133{
134 if (!em)
135 return;
136
137 switch (monitor_type)
138 {
139 case ECORE_FILE_MONITOR_TYPE_NONE:
140 break;
141#ifdef HAVE_INOTIFY
142 case ECORE_FILE_MONITOR_TYPE_INOTIFY:
143 ecore_file_monitor_inotify_del(em);
144 break;
145#endif
146#ifdef HAVE_NOTIFY_WIN32
147 case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32:
148 ecore_file_monitor_win32_del(em);
149 break;
150#endif
151#ifdef HAVE_POLL
152 case ECORE_FILE_MONITOR_TYPE_POLL:
153 ecore_file_monitor_poll_del(em);
154 break;
155#endif
156 }
157}
158
159/**
160 * @brief Get the monitored path.
161 *
162 * @param em The Ecore_File_Monitor to query.
163 * @return The path that is monitored by @p em.
164 *
165 * This function returns the monitored path that has been
166 * monitored by ecore_file_monitor_add(). @p em must be the value
167 * returned by ecore_file_monitor_add(). If @p em is @c NULL, the
168 * function returns @c NULL.
169 */
170EAPI const char *
171ecore_file_monitor_path_get(Ecore_File_Monitor *em)
172{
173 if (!em)
174 return NULL;
175 return em->path;
176}
177
178/**
179 * @}
180 */
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
deleted file mode 100644
index efdd8c2..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ /dev/null
@@ -1,370 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8#include <sys/types.h>
9#include <unistd.h>
10
11#include "ecore_file_private.h"
12
13/*
14 * TODO:
15 *
16 * - Listen to these events:
17 * IN_ACCESS, IN_ATTRIB, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, IN_OPEN
18 * - Read all events first, then call the callbacks. This will prevent several
19 * callbacks with the typic save cycle (delete file, new file)
20 * - Listen to IN_IGNORED, emitted when the watch is removed
21 */
22
23#ifdef HAVE_INOTIFY
24
25#ifdef HAVE_SYS_INOTIFY
26# include <sys/inotify.h>
27#else
28# include <asm/unistd.h>
29# include <linux/inotify.h>
30#endif
31
32#ifndef HAVE_SYS_INOTIFY
33static inline int inotify_init(void);
34static inline int inotify_add_watch(int fd, const char *name, __u32 mask);
35static inline int inotify_rm_watch(int fd, __u32 wd);
36#endif
37
38
39typedef struct _Ecore_File_Monitor_Inotify Ecore_File_Monitor_Inotify;
40
41#define ECORE_FILE_MONITOR_INOTIFY(x) ((Ecore_File_Monitor_Inotify *)(x))
42
43struct _Ecore_File_Monitor_Inotify
44{
45 Ecore_File_Monitor monitor;
46 int wd;
47};
48
49static Ecore_Fd_Handler *_fdh = NULL;
50static Ecore_File_Monitor *_monitors = NULL;
51static pid_t _inotify_fd_pid = -1;
52
53static Eina_Bool _ecore_file_monitor_inotify_handler(void *data, Ecore_Fd_Handler *fdh);
54static Ecore_File_Monitor *_ecore_file_monitor_inotify_monitor_find(int wd);
55static void _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask);
56static int _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path);
57#if 0
58static void _ecore_file_monitor_inotify_print(char *file, int mask);
59#endif
60
61int
62ecore_file_monitor_inotify_init(void)
63{
64 int fd;
65
66 fd = inotify_init();
67 if (fd < 0)
68 return 0;
69
70 _fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler,
71 NULL, NULL, NULL);
72 if (!_fdh)
73 {
74 close(fd);
75 return 0;
76 }
77
78 _inotify_fd_pid = getpid();
79 return 1;
80}
81
82int
83ecore_file_monitor_inotify_shutdown(void)
84{
85 int fd;
86
87 while(_monitors)
88 ecore_file_monitor_inotify_del(_monitors);
89
90 if (_fdh)
91 {
92 fd = ecore_main_fd_handler_fd_get(_fdh);
93 ecore_main_fd_handler_del(_fdh);
94 close(fd);
95 }
96 _inotify_fd_pid = -1;
97 return 1;
98}
99
100Ecore_File_Monitor *
101ecore_file_monitor_inotify_add(const char *path,
102 void (*func) (void *data, Ecore_File_Monitor *em,
103 Ecore_File_Event event,
104 const char *path),
105 void *data)
106{
107 Ecore_File_Monitor *em;
108 int len;
109
110 if (_inotify_fd_pid == -1) return NULL;
111
112 if (_inotify_fd_pid != getpid())
113 {
114 ecore_file_monitor_inotify_shutdown();
115 ecore_file_monitor_inotify_init();
116 }
117
118 em = calloc(1, sizeof(Ecore_File_Monitor_Inotify));
119 if (!em) return NULL;
120
121 em->func = func;
122 em->data = data;
123
124 em->path = strdup(path);
125 len = strlen(em->path);
126 if (em->path[len - 1] == '/' && strcmp(em->path, "/"))
127 em->path[len - 1] = 0;
128
129 _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
130
131 if (ecore_file_exists(em->path))
132 {
133 if (!_ecore_file_monitor_inotify_monitor(em, em->path))
134 return NULL;
135 }
136 else
137 {
138 ecore_file_monitor_inotify_del(em);
139 return NULL;
140 }
141
142 return em;
143}
144
145void
146ecore_file_monitor_inotify_del(Ecore_File_Monitor *em)
147{
148 int fd;
149
150 if (_monitors)
151 _monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
152
153 fd = ecore_main_fd_handler_fd_get(_fdh);
154 if (ECORE_FILE_MONITOR_INOTIFY(em)->wd)
155 inotify_rm_watch(fd, ECORE_FILE_MONITOR_INOTIFY(em)->wd);
156 free(em->path);
157 free(em);
158}
159
160static Eina_Bool
161_ecore_file_monitor_inotify_handler(void *data __UNUSED__, Ecore_Fd_Handler *fdh)
162{
163 Ecore_File_Monitor *em;
164 char buffer[16384];
165 struct inotify_event *event;
166 int i = 0;
167 int event_size;
168 ssize_t size;
169
170 size = read(ecore_main_fd_handler_fd_get(fdh), buffer, sizeof(buffer));
171 while (i < size)
172 {
173 event = (struct inotify_event *)&buffer[i];
174 event_size = sizeof(struct inotify_event) + event->len;
175 i += event_size;
176
177 em = _ecore_file_monitor_inotify_monitor_find(event->wd);
178 if (!em) continue;
179
180 _ecore_file_monitor_inotify_events(em, (event->len ? event->name : NULL), event->mask);
181 }
182
183 return ECORE_CALLBACK_RENEW;
184}
185
186static Ecore_File_Monitor *
187_ecore_file_monitor_inotify_monitor_find(int wd)
188{
189 Ecore_File_Monitor *l;
190
191 EINA_INLIST_FOREACH(_monitors, l)
192 {
193 if (ECORE_FILE_MONITOR_INOTIFY(l)->wd == wd)
194 return l;
195 }
196 return NULL;
197}
198
199static void
200_ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask)
201{
202 char buf[PATH_MAX];
203 int isdir;
204
205 if ((file) && (file[0]))
206 snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
207 else
208 strcpy(buf, em->path);
209 isdir = mask & IN_ISDIR;
210
211#if 0
212 _ecore_file_monitor_inotify_print(buf, mask);
213#endif
214
215 if (mask & IN_ATTRIB)
216 {
217 em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf);
218 }
219 if (mask & IN_CLOSE_WRITE)
220 {
221 if (!isdir)
222 em->func(em->data, em, ECORE_FILE_EVENT_CLOSED, buf);
223 }
224 if (mask & IN_MODIFY)
225 {
226 if (!isdir)
227 em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf);
228 }
229 if (mask & IN_MOVED_FROM)
230 {
231 if (isdir)
232 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_DIRECTORY, buf);
233 else
234 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_FILE, buf);
235 }
236 if (mask & IN_MOVED_TO)
237 {
238 if (isdir)
239 em->func(em->data, em, ECORE_FILE_EVENT_CREATED_DIRECTORY, buf);
240 else
241 em->func(em->data, em, ECORE_FILE_EVENT_CREATED_FILE, buf);
242 }
243 if (mask & IN_DELETE)
244 {
245 if (isdir)
246 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_DIRECTORY, buf);
247 else
248 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_FILE, buf);
249 }
250 if (mask & IN_CREATE)
251 {
252 if (isdir)
253 em->func(em->data, em, ECORE_FILE_EVENT_CREATED_DIRECTORY, buf);
254 else
255 em->func(em->data, em, ECORE_FILE_EVENT_CREATED_FILE, buf);
256 }
257 if (mask & IN_DELETE_SELF)
258 {
259 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
260 }
261 if (mask & IN_MOVE_SELF)
262 {
263 /* We just call delete. The dir is gone... */
264 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
265 }
266 if (mask & IN_UNMOUNT)
267 {
268 /* We just call delete. The dir is gone... */
269 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
270 }
271 if (mask & IN_IGNORED)
272 {
273 /* The watch is removed. If the file name still exists monitor the new one,
274 * else delete it */
275 if (ecore_file_exists(em->path))
276 {
277 if (!_ecore_file_monitor_inotify_monitor(em, em->path))
278 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
279 }
280 else
281 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
282 }
283}
284
285static int
286_ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path)
287{
288 int mask =
289 IN_ATTRIB |
290 IN_CLOSE_WRITE |
291 IN_MOVED_FROM |
292 IN_MOVED_TO |
293 IN_DELETE |
294 IN_CREATE |
295 IN_MODIFY |
296 IN_DELETE_SELF |
297 IN_MOVE_SELF |
298 IN_UNMOUNT;
299
300 ECORE_FILE_MONITOR_INOTIFY(em)->wd =
301 inotify_add_watch(ecore_main_fd_handler_fd_get(_fdh), path, mask);
302 if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
303 {
304 ERR("inotify_add_watch error");
305 ecore_file_monitor_inotify_del(em);
306 return 0;
307 }
308 return 1;
309}
310
311#ifndef HAVE_SYS_INOTIFY
312static inline int
313inotify_init(void)
314{
315 return syscall(__NR_inotify_init);
316}
317
318static inline int
319inotify_add_watch(int fd, const char *name, __u32 mask)
320{
321 return syscall(__NR_inotify_add_watch, fd, name, mask);
322}
323
324static inline int
325inotify_rm_watch(int fd, __u32 wd)
326{
327 return syscall(__NR_inotify_rm_watch, fd, wd);
328}
329#endif
330
331#if 0
332static void
333_ecore_file_monitor_inotify_print(char *file, int mask)
334{
335 const char *type;
336
337 if (mask & IN_ISDIR)
338 type = "dir";
339 else
340 type = "file";
341
342 if (mask & IN_ACCESS)
343 INF("Inotify accessed %s: %s", type, file);
344 if (mask & IN_MODIFY)
345 INF("Inotify modified %s: %s", type, file);
346 if (mask & IN_ATTRIB)
347 INF("Inotify attributes %s: %s", type, file);
348 if (mask & IN_CLOSE_WRITE)
349 INF("Inotify close write %s: %s", type, file);
350 if (mask & IN_CLOSE_NOWRITE)
351 INF("Inotify close write %s: %s", type, file);
352 if (mask & IN_OPEN)
353 INF("Inotify open %s: %s", type, file);
354 if (mask & IN_MOVED_FROM)
355 INF("Inotify moved from %s: %s", type, file);
356 if (mask & IN_MOVED_TO)
357 INF("Inotify moved to %s: %s", type, file);
358 if (mask & IN_DELETE)
359 INF("Inotify delete %s: %s", type, file);
360 if (mask & IN_CREATE)
361 INF("Inotify create %s: %s", type, file);
362 if (mask & IN_DELETE_SELF)
363 INF("Inotify delete self %s: %s", type, file);
364 if (mask & IN_MOVE_SELF)
365 INF("Inotify move self %s: %s", type, file);
366 if (mask & IN_UNMOUNT)
367 INF("Inotify unmount %s: %s", type, file);
368}
369#endif
370#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
deleted file mode 100644
index 49bfcb6..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c
+++ /dev/null
@@ -1,340 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8
9#include "ecore_file_private.h"
10
11#ifdef HAVE_POLL
12
13/*
14 * TODO:
15 * - Implement recursive as an option!
16 * - Keep whole path or just name of file? (Memory or CPU...)
17 * - Remove requests without files?
18 * - Change poll time
19 */
20
21typedef struct _Ecore_File_Monitor_Poll Ecore_File_Monitor_Poll;
22
23#define ECORE_FILE_MONITOR_POLL(x) ((Ecore_File_Monitor_Poll *)(x))
24
25struct _Ecore_File_Monitor_Poll
26{
27 Ecore_File_Monitor monitor;
28 int mtime;
29 unsigned char deleted;
30};
31
32#define ECORE_FILE_INTERVAL_MIN 1.0
33#define ECORE_FILE_INTERVAL_STEP 0.5
34#define ECORE_FILE_INTERVAL_MAX 5.0
35
36static double _interval = ECORE_FILE_INTERVAL_MIN;
37static Ecore_Timer *_timer = NULL;
38static Ecore_File_Monitor *_monitors = NULL;
39static int _lock = 0;
40
41static Eina_Bool _ecore_file_monitor_poll_handler(void *data);
42static void _ecore_file_monitor_poll_check(Ecore_File_Monitor *em);
43static int _ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, char *name);
44
45int
46ecore_file_monitor_poll_init(void)
47{
48 return 1;
49}
50
51int
52ecore_file_monitor_poll_shutdown(void)
53{
54 while(_monitors)
55 ecore_file_monitor_poll_del(_monitors);
56
57 if (_timer)
58 {
59 ecore_timer_del(_timer);
60 _timer = NULL;
61 }
62 return 1;
63}
64
65Ecore_File_Monitor *
66ecore_file_monitor_poll_add(const char *path,
67 void (*func) (void *data, Ecore_File_Monitor *em,
68 Ecore_File_Event event,
69 const char *path),
70 void *data)
71{
72 Ecore_File_Monitor *em;
73 size_t len;
74
75 if (!path) return NULL;
76 if (!func) return NULL;
77
78 em = calloc(1, sizeof(Ecore_File_Monitor_Poll));
79 if (!em) return NULL;
80
81 if (!_timer)
82 _timer = ecore_timer_add(_interval, _ecore_file_monitor_poll_handler, NULL);
83 else
84 ecore_timer_interval_set(_timer, ECORE_FILE_INTERVAL_MIN);
85
86 em->path = strdup(path);
87 len = strlen(em->path);
88 if (em->path[len - 1] == '/' && strcmp(em->path, "/"))
89 em->path[len - 1] = 0;
90
91 em->func = func;
92 em->data = data;
93
94 ECORE_FILE_MONITOR_POLL(em)->mtime = ecore_file_mod_time(em->path);
95 _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
96
97 if (ecore_file_exists(em->path))
98 {
99 if (ecore_file_is_dir(em->path))
100 {
101 /* Check for subdirs */
102 Eina_List *files;
103 char *file;
104
105 files = ecore_file_ls(em->path);
106 EINA_LIST_FREE(files, file)
107 {
108 Ecore_File *f;
109 char buf[PATH_MAX];
110
111 f = calloc(1, sizeof(Ecore_File));
112 if (!f)
113 {
114 free(file);
115 continue;
116 }
117
118 snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
119 f->name = file;
120 f->mtime = ecore_file_mod_time(buf);
121 f->is_dir = ecore_file_is_dir(buf);
122 em->files = (Ecore_File *) eina_inlist_append(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f));
123 }
124 }
125 }
126 else
127 {
128 ecore_file_monitor_poll_del(em);
129 return NULL;
130 }
131
132 return em;
133}
134
135void
136ecore_file_monitor_poll_del(Ecore_File_Monitor *em)
137{
138 Ecore_File *l;
139
140 if (_lock)
141 {
142 ECORE_FILE_MONITOR_POLL(em)->deleted = 1;
143 return;
144 }
145
146 /* Remove files */
147 /*It's possible there weren't any files to monitor, so check if the list is init*/
148 if (em->files)
149 {
150 for (l = em->files; l;)
151 {
152 Ecore_File *file = l;
153
154 l = (Ecore_File *) EINA_INLIST_GET(l)->next;
155 free(file->name);
156 free(file);
157 }
158 }
159
160 if (_monitors)
161 _monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
162
163 free(em->path);
164 free(em);
165
166 if (_timer)
167 {
168 if (!_monitors)
169 {
170 ecore_timer_del(_timer);
171 _timer = NULL;
172 }
173 else
174 ecore_timer_interval_set(_timer, ECORE_FILE_INTERVAL_MIN);
175 }
176}
177
178static Eina_Bool
179_ecore_file_monitor_poll_handler(void *data __UNUSED__)
180{
181 Ecore_File_Monitor *l;
182
183 _interval += ECORE_FILE_INTERVAL_STEP;
184
185 _lock = 1;
186 EINA_INLIST_FOREACH(_monitors, l)
187 _ecore_file_monitor_poll_check(l);
188 _lock = 0;
189
190 if (_interval > ECORE_FILE_INTERVAL_MAX)
191 _interval = ECORE_FILE_INTERVAL_MAX;
192 ecore_timer_interval_set(_timer, _interval);
193
194 for (l = _monitors; l;)
195 {
196 Ecore_File_Monitor *em = l;
197
198 l = ECORE_FILE_MONITOR(EINA_INLIST_GET(l)->next);
199 if (ECORE_FILE_MONITOR_POLL(em)->deleted)
200 ecore_file_monitor_del(em);
201 }
202 return ECORE_CALLBACK_RENEW;
203}
204
205static void
206_ecore_file_monitor_poll_check(Ecore_File_Monitor *em)
207{
208 int mtime;
209
210 mtime = ecore_file_mod_time(em->path);
211 if (mtime < ECORE_FILE_MONITOR_POLL(em)->mtime)
212 {
213 Ecore_File *l;
214 Ecore_File_Event event;
215
216 /* Notify all files deleted */
217 for (l = em->files; l;)
218 {
219 Ecore_File *f = l;
220 char buf[PATH_MAX];
221
222 l = (Ecore_File *) EINA_INLIST_GET(l)->next;
223
224 snprintf(buf, sizeof(buf), "%s/%s", em->path, f->name);
225 if (f->is_dir)
226 event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
227 else
228 event = ECORE_FILE_EVENT_DELETED_FILE;
229 em->func(em->data, em, event, buf);
230 free(f->name);
231 free(f);
232 }
233 em->files = NULL;
234 em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
235 _interval = ECORE_FILE_INTERVAL_MIN;
236 }
237 else
238 {
239 Ecore_File *l;
240
241 /* Check for changed files */
242 for (l = em->files; l;)
243 {
244 Ecore_File *f = l;
245 char buf[PATH_MAX];
246 int mt;
247 Ecore_File_Event event;
248
249 l = (Ecore_File *) EINA_INLIST_GET(l)->next;
250
251 snprintf(buf, sizeof(buf), "%s/%s", em->path, f->name);
252 mt = ecore_file_mod_time(buf);
253 if (mt < f->mtime)
254 {
255 if (f->is_dir)
256 event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
257 else
258 event = ECORE_FILE_EVENT_DELETED_FILE;
259
260 em->func(em->data, em, event, buf);
261 em->files = (Ecore_File *) eina_inlist_remove(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f));
262 free(f->name);
263 free(f);
264 _interval = ECORE_FILE_INTERVAL_MIN;
265 }
266 else if ((mt > f->mtime) && !(f->is_dir))
267 {
268 em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf);
269 _interval = ECORE_FILE_INTERVAL_MIN;
270 f->mtime = mt;
271 }
272 else
273 f->mtime = mt;
274 }
275
276 /* Check for new files */
277 if (ECORE_FILE_MONITOR_POLL(em)->mtime < mtime)
278 {
279 Eina_List *files;
280 Eina_List *fl;
281 char *file;
282
283 /* Files have been added or removed */
284 files = ecore_file_ls(em->path);
285 if (files)
286 {
287 /* Are we a directory? We should check first, rather than rely on null here*/
288 EINA_LIST_FOREACH(files, fl, file)
289 {
290 Ecore_File *f;
291 char buf[PATH_MAX];
292 Ecore_File_Event event;
293
294 if (_ecore_file_monitor_poll_checking(em, file))
295 continue;
296
297 snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
298 f = calloc(1, sizeof(Ecore_File));
299 if (!f)
300 continue;
301
302 f->name = strdup(file);
303 f->mtime = ecore_file_mod_time(buf);
304 f->is_dir = ecore_file_is_dir(buf);
305 if (f->is_dir)
306 event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
307 else
308 event = ECORE_FILE_EVENT_CREATED_FILE;
309 em->func(em->data, em, event, buf);
310 em->files = (Ecore_File *) eina_inlist_append(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f));
311 }
312 while (files)
313 {
314 file = eina_list_data_get(files);
315 free(file);
316 files = eina_list_remove_list(files, files);
317 }
318 }
319
320 if (!ecore_file_is_dir(em->path))
321 em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, em->path);
322 _interval = ECORE_FILE_INTERVAL_MIN;
323 }
324 }
325 ECORE_FILE_MONITOR_POLL(em)->mtime = mtime;
326}
327
328static int
329_ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, char *name)
330{
331 Ecore_File *l;
332
333 EINA_INLIST_FOREACH(em->files, l)
334 {
335 if (!strcmp(l->name, name))
336 return 1;
337 }
338 return 0;
339}
340#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
deleted file mode 100644
index 7f3af09..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_win32.c
+++ /dev/null
@@ -1,310 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#ifdef HAVE_NOTIFY_WIN32
10
11# define WIN32_LEAN_AND_MEAN
12# include <windows.h>
13# undef WIN32_LEAN_AND_MEAN
14# include <process.h>
15
16# include "ecore_file_private.h"
17
18
19typedef struct _Ecore_File_Monitor_Win32 Ecore_File_Monitor_Win32;
20typedef struct _Ecore_File_Monitor_Win32_Data Ecore_File_Monitor_Win32_Data;
21
22/* 4096 = 256 * sizeof(FILE_NOTIFY_INFORMATION) */
23# define ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE 4096
24# define ECORE_FILE_MONITOR_WIN32(x) ((Ecore_File_Monitor_Win32 *)(x))
25
26struct _Ecore_File_Monitor_Win32_Data
27{
28 char buffer[ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE];
29 OVERLAPPED overlapped;
30 HANDLE handle;
31 HANDLE event;
32 Ecore_File_Monitor *monitor;
33 Ecore_Win32_Handler *h;
34 DWORD buf_length;
35 int is_dir;
36};
37
38struct _Ecore_File_Monitor_Win32
39{
40 Ecore_File_Monitor monitor;
41 Ecore_File_Monitor_Win32_Data *file;
42 Ecore_File_Monitor_Win32_Data *dir;
43};
44
45static Ecore_File_Monitor *_monitors = NULL;
46
47static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh);
48
49
50static Ecore_File_Monitor_Win32_Data *
51_ecore_file_monitor_win32_data_new(Ecore_File_Monitor *monitor, int type)
52{
53 Ecore_File_Monitor_Win32_Data *md;
54 DWORD filter;
55
56 md = (Ecore_File_Monitor_Win32_Data *)calloc(1, sizeof(Ecore_File_Monitor_Win32_Data));
57 if (!md) return NULL;
58
59 md->handle = CreateFile(monitor->path,
60 FILE_LIST_DIRECTORY,
61 FILE_SHARE_READ |
62 FILE_SHARE_WRITE,
63 NULL,
64 OPEN_EXISTING,
65 FILE_FLAG_BACKUP_SEMANTICS |
66 FILE_FLAG_OVERLAPPED,
67 NULL);
68 if (md->handle == INVALID_HANDLE_VALUE)
69 goto free_md;
70
71 md->event = CreateEvent(NULL, FALSE, FALSE, NULL);
72 if (!md->event)
73 goto close_handle;
74
75 ZeroMemory (&md->overlapped, sizeof(md->overlapped));
76 md->overlapped.hEvent = md->event;
77
78 filter = (type == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME;
79 filter |=
80 FILE_NOTIFY_CHANGE_ATTRIBUTES |
81 FILE_NOTIFY_CHANGE_SIZE |
82 FILE_NOTIFY_CHANGE_LAST_WRITE |
83 FILE_NOTIFY_CHANGE_LAST_ACCESS |
84 FILE_NOTIFY_CHANGE_CREATION |
85 FILE_NOTIFY_CHANGE_SECURITY;
86
87 if (!ReadDirectoryChangesW(md->handle,
88 md->buffer,
89 ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE,
90 FALSE,
91 filter,
92 &md->buf_length,
93 &md->overlapped,
94 NULL))
95 goto close_event;
96
97 md->h = ecore_main_win32_handler_add(md->event,
98 _ecore_file_monitor_win32_cb,
99 md);
100 if (!md->h)
101 goto close_event;
102
103 md->monitor = monitor;
104 md->is_dir = type;
105
106 return md;
107
108 close_event:
109 CloseHandle(md->event);
110 close_handle:
111 CloseHandle(md->handle);
112 free_md:
113 free(md);
114
115 return NULL;
116}
117
118static void
119_ecore_file_monitor_win32_data_free(Ecore_File_Monitor_Win32_Data *md)
120{
121 if (!md) return;
122
123 CloseHandle(md->event);
124 CloseHandle (md->handle);
125 free (md);
126}
127
128static Eina_Bool
129_ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh)
130{
131 char filename[PATH_MAX];
132 PFILE_NOTIFY_INFORMATION fni;
133 Ecore_File_Monitor_Win32_Data *md;
134 wchar_t *wname;
135 char *name;
136 DWORD filter;
137 DWORD offset;
138 DWORD buf_length;
139 Ecore_File_Event event = ECORE_FILE_EVENT_NONE;
140
141 md = (Ecore_File_Monitor_Win32_Data *)data;
142
143 if (!GetOverlappedResult (md->handle, &md->overlapped, &buf_length, TRUE))
144 return 1;
145
146 fni = (PFILE_NOTIFY_INFORMATION)md->buffer;
147 do {
148 if (!fni)
149 break;
150 offset = fni->NextEntryOffset;
151
152 wname = (wchar_t *)malloc(sizeof(wchar_t) * (fni->FileNameLength + 1));
153 if (!wname)
154 return 0;
155
156 memcpy(wname, fni->FileName, fni->FileNameLength);
157 wname[fni->FileNameLength]='\0';
158 name = evil_wchar_to_char(wname);
159 free(wname);
160 if (!name)
161 return 0;
162
163 _snprintf(filename, PATH_MAX, "%s\\%s", md->monitor->path, name);
164 free(name);
165
166 switch (fni->Action)
167 {
168 case FILE_ACTION_ADDED:
169 if (md->is_dir)
170 event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
171 else
172 event = ECORE_FILE_EVENT_CREATED_FILE;
173 break;
174 case FILE_ACTION_REMOVED:
175 if (md->is_dir)
176 event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
177 else
178 event = ECORE_FILE_EVENT_DELETED_FILE;
179 break;
180 case FILE_ACTION_MODIFIED:
181 if (!md->is_dir)
182 event = ECORE_FILE_EVENT_MODIFIED;
183 break;
184 case FILE_ACTION_RENAMED_OLD_NAME:
185 if (md->is_dir)
186 event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
187 else
188 event = ECORE_FILE_EVENT_DELETED_FILE;
189 break;
190 case FILE_ACTION_RENAMED_NEW_NAME:
191 if (md->is_dir)
192 event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
193 else
194 event = ECORE_FILE_EVENT_CREATED_FILE;
195 break;
196 default:
197 fprintf(stderr, "unknown event\n");
198 event = ECORE_FILE_EVENT_NONE;
199 break;
200 }
201 if (event != ECORE_FILE_EVENT_NONE)
202 md->monitor->func(md->monitor->data, md->monitor, event, filename);
203
204 fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE)fni + offset);
205 } while (offset);
206
207 filter = (md->is_dir == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME;
208 filter |=
209 FILE_NOTIFY_CHANGE_ATTRIBUTES |
210 FILE_NOTIFY_CHANGE_SIZE |
211 FILE_NOTIFY_CHANGE_LAST_WRITE |
212 FILE_NOTIFY_CHANGE_LAST_ACCESS |
213 FILE_NOTIFY_CHANGE_CREATION |
214 FILE_NOTIFY_CHANGE_SECURITY;
215
216 ReadDirectoryChangesW(md->handle,
217 md->buffer,
218 ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE,
219 FALSE,
220 filter,
221 &md->buf_length,
222 &md->overlapped,
223 NULL);
224 return 1;
225}
226
227int
228ecore_file_monitor_win32_init(void)
229{
230 return 1;
231}
232
233int
234ecore_file_monitor_win32_shutdown(void)
235{
236 return 1;
237}
238
239Ecore_File_Monitor *
240ecore_file_monitor_win32_add(const char *path,
241 void (*func) (void *data, Ecore_File_Monitor *em,
242 Ecore_File_Event event,
243 const char *path),
244 void *data)
245{
246 Ecore_File_Monitor_Win32 *m;
247 Ecore_File_Monitor *em;
248 size_t len;
249
250 if (!path || (*path == '\0')) return NULL;
251 if (!ecore_file_exists(path) || !ecore_file_is_dir(path))
252 return NULL;
253 if (!func) return NULL;
254
255 em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Win32));
256 if (!em) return NULL;
257
258 em->func = func;
259 em->data = data;
260
261 em->path = strdup(path);
262 if (!em->path)
263 {
264 free(em);
265 return NULL;
266 }
267 len = strlen(em->path);
268 if (em->path[len - 1] == '/' || em->path[len - 1] == '\\')
269 em->path[len - 1] = '\0';
270
271 m = ECORE_FILE_MONITOR_WIN32(em);
272
273 m->file = _ecore_file_monitor_win32_data_new(em, 0);
274 if (!m->file)
275 {
276 free(em->path);
277 free(em);
278 return NULL;
279 }
280
281 m->dir = _ecore_file_monitor_win32_data_new(em, 1);
282 if (!m->dir)
283 {
284 _ecore_file_monitor_win32_data_free(m->file);
285 free(em->path);
286 free(em);
287 return NULL;
288 }
289
290 _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
291
292 return em;
293}
294
295void
296ecore_file_monitor_win32_del(Ecore_File_Monitor *em)
297{
298 Ecore_File_Monitor_Win32 *m;
299
300 if (!em)
301 return;
302
303 m = ECORE_FILE_MONITOR_WIN32(em);
304 _ecore_file_monitor_win32_data_free(m->dir);
305 _ecore_file_monitor_win32_data_free(m->file);
306 free(em->path);
307 free(em);
308}
309
310#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
deleted file mode 100644
index f5294b7..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_path.c
+++ /dev/null
@@ -1,185 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#undef alloca
6#ifdef HAVE_ALLOCA_H
7# include <alloca.h>
8#elif defined __GNUC__
9# define alloca __builtin_alloca
10#elif defined _AIX
11# define alloca __alloca
12#elif defined _MSC_VER
13# include <malloc.h>
14# define alloca _alloca
15#else
16# include <stddef.h>
17# ifdef __cplusplus
18extern "C"
19# endif
20void *alloca (size_t);
21#endif
22
23#include <stdlib.h>
24#include <stdio.h>
25#include <string.h>
26
27#include "ecore_file_private.h"
28
29static Eina_List *__ecore_file_path_bin = NULL;
30
31static Eina_List *_ecore_file_path_from_env(const char *env);
32
33void
34ecore_file_path_init(void)
35{
36 __ecore_file_path_bin = _ecore_file_path_from_env("PATH");
37}
38
39void
40ecore_file_path_shutdown(void)
41{
42 char *dir;
43
44 EINA_LIST_FREE(__ecore_file_path_bin, dir)
45 eina_stringshare_del(dir);
46}
47
48Eina_List *
49_ecore_file_path_from_env(const char *env)
50{
51 Eina_List *path = NULL;
52 char *env_tmp, *env_path, *p, *last;
53
54 env_tmp = getenv(env);
55 if (!env_tmp)
56 return path;
57
58 env_path = alloca(sizeof(char) * strlen(env_tmp) + 1);
59 memset(env_path, 0, strlen(env_tmp));
60 strcpy(env_path, env_tmp);
61 last = env_path;
62 for (p = env_path; *p; p++)
63 {
64 if (*p == ':')
65 *p = '\0';
66
67 if (!*p)
68 {
69 if (!ecore_file_path_dir_exists(last))
70 path = eina_list_append(path, eina_stringshare_add(last));
71 last = p + 1;
72 }
73 }
74 if (p > last)
75 path = eina_list_append(path, eina_stringshare_add(last));
76
77 return path;
78}
79
80/**
81 * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions
82 *
83 * @{
84 */
85
86/**
87 * @brief Check if the given directory is in PATH.
88 *
89 * @param in_dir The name of the directory to search in PATH.
90 * @return EINA_TRUE if the directory exist in PATH, EINA_FALSE otherwise.
91 *
92 * This function checks if @p in_dir is in the environment variable
93 * PATH. If @p in_dir is @c NULL, or if PATH is empty, or @p in_dir is
94 * not in PATH, the function returns EINA_FALSE, otherwise it returns
95 * EINA_TRUE.
96 */
97EAPI Eina_Bool
98ecore_file_path_dir_exists(const char *in_dir)
99{
100 Eina_List *l;
101 char *dir;
102
103 if (!in_dir)
104 return EINA_FALSE;
105
106 if (!__ecore_file_path_bin) return EINA_FALSE;
107 EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
108 {
109 if (strcmp(dir, in_dir))
110 return EINA_TRUE;
111 }
112
113 return EINA_FALSE;
114}
115
116/**
117 * @brief Check if the given application is installed.
118 *
119 * @param exe The name of the application
120 * @return EINA_TRUE if the exe is in PATH and is executable,
121 * EINA_FALSE otherwise.
122 *
123 *
124 * This function checks if @p exe exists in PATH and is executable. If
125 * @p exe is @c NULL or is not executable, the function returns
126 * EINA_FALSE, otherwise it returns EINA_TRUE.
127 */
128EAPI Eina_Bool
129ecore_file_app_installed(const char *exe)
130{
131 Eina_List *l;
132 char *dir;
133 char buf[PATH_MAX];
134
135 if (!exe) return EINA_FALSE;
136 if (ecore_file_can_exec(exe)) return EINA_TRUE;
137
138 EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
139 {
140 snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
141 if (ecore_file_can_exec(buf))
142 return EINA_TRUE;
143 }
144
145 return EINA_FALSE;
146}
147
148/**
149 * @brief Get a list of all the applications installed on the system.
150 *
151 * @return An Eina_List containing all the executable files in the
152 * system.
153 *
154 * This function returns a list of allocated strings of all the
155 * executable files. If no files are found, the function returns
156 * @c NULL. When not needed anymore, the element of the list must be
157 * freed.
158 */
159EAPI Eina_List *
160ecore_file_app_list(void)
161{
162 Eina_List *list = NULL;
163 Eina_List *files;
164 Eina_List *l;
165 char buf[PATH_MAX], *dir, *exe;
166
167 EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir)
168 {
169 files = ecore_file_ls(dir);
170 EINA_LIST_FREE(files, exe)
171 {
172 snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
173 if ((ecore_file_can_exec(buf)) &&
174 (!ecore_file_is_dir(buf)))
175 list = eina_list_append(list, strdup(buf));
176 free(exe);
177 }
178 }
179
180 return list;
181}
182
183/**
184 * @}
185 */
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_private.h b/libraries/ecore/src/lib/ecore_file/ecore_file_private.h
deleted file mode 100644
index 45d2cbd..0000000
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_private.h
+++ /dev/null
@@ -1,129 +0,0 @@
1#ifndef ECORE_FILE_PRIVATE_H_
2#define ECORE_FILE_PRIVATE_H_
3
4#ifdef __linux__
5# include <features.h>
6#endif
7
8#ifdef HAVE_EVIL
9# include <Evil.h>
10#endif
11
12#ifdef HAVE_ESCAPE
13# include <Escape.h>
14#endif
15
16#include <sys/types.h>
17#include <sys/stat.h>
18
19#include "Ecore.h"
20#include "ecore_private.h"
21
22#include "Ecore_File.h"
23
24extern int _ecore_file_log_dom;
25
26#ifdef ECORE_FILE_DEFAULT_LOG_COLOR
27#undef ECORE_FILE_DEFAULT_LOG_COLOR
28#endif
29#define ECORE_FILE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
30
31#ifdef ERR
32# undef ERR
33#endif
34#define ERR(...) EINA_LOG_DOM_ERR(_ecore_file_log_dom, __VA_ARGS__)
35
36#ifdef DBG
37# undef DBG
38#endif
39#define DBG(...) EINA_LOG_DOM_DBG(_ecore_file_log_dom, __VA_ARGS__)
40
41#ifdef INF
42# undef INF
43#endif
44#define INF(...) EINA_LOG_DOM_INFO(_ecore_file_log_dom, __VA_ARGS__)
45
46#ifdef WRN
47# undef WRN
48#endif
49#define WRN(...) EINA_LOG_DOM_WARN(_ecore_file_log_dom, __VA_ARGS__)
50
51#ifdef CRIT
52# undef CRIT
53#endif
54#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_file_log_dom, __VA_ARGS__)
55
56/* ecore_file_monitor */
57int ecore_file_monitor_init(void);
58void ecore_file_monitor_shutdown(void);
59
60#define ECORE_FILE_MONITOR(x) ((Ecore_File_Monitor *)(x))
61
62typedef struct _Ecore_File Ecore_File;
63struct _Ecore_File
64{
65 EINA_INLIST;
66 char *name;
67 int mtime;
68 unsigned char is_dir;
69};
70
71struct _Ecore_File_Monitor
72{
73 EINA_INLIST;
74 void (*func) (void *data,
75 Ecore_File_Monitor *ecore_file_monitor,
76 Ecore_File_Event event,
77 const char *path);
78
79 char *path;
80 void *data;
81 Ecore_File *files;
82};
83
84#ifdef HAVE_INOTIFY
85int ecore_file_monitor_inotify_init(void);
86int ecore_file_monitor_inotify_shutdown(void);
87Ecore_File_Monitor *ecore_file_monitor_inotify_add(const char *path,
88 void (*func) (void *data,
89 Ecore_File_Monitor *ecore_file_monitor,
90 Ecore_File_Event event,
91 const char *path),
92 void *data);
93void ecore_file_monitor_inotify_del(Ecore_File_Monitor *ecore_file_monitor);
94#endif
95
96#ifdef HAVE_NOTIFY_WIN32
97int ecore_file_monitor_win32_init(void);
98int ecore_file_monitor_win32_shutdown(void);
99Ecore_File_Monitor *ecore_file_monitor_win32_add(const char *path,
100 void (*func) (void *data,
101 Ecore_File_Monitor *ecore_file_monitor,
102 Ecore_File_Event event,
103 const char *path),
104 void *data);
105void ecore_file_monitor_win32_del(Ecore_File_Monitor *ecore_file_monitor);
106#endif
107
108#ifdef HAVE_POLL
109int ecore_file_monitor_poll_init(void);
110int ecore_file_monitor_poll_shutdown(void);
111Ecore_File_Monitor *ecore_file_monitor_poll_add(const char *path,
112 void (*func) (void *data,
113 Ecore_File_Monitor *ecore_file_monitor,
114 Ecore_File_Event event,
115 const char *path),
116 void *data);
117void ecore_file_monitor_poll_del(Ecore_File_Monitor *ecore_file_monitor);
118
119#endif
120
121/* ecore_file_path */
122void ecore_file_path_init(void);
123void ecore_file_path_shutdown(void);
124
125/* ecore_file_download */
126int ecore_file_download_init(void);
127void ecore_file_download_shutdown(void);
128
129#endif
diff --git a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h
deleted file mode 100644
index 1757d79..0000000
--- a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h
+++ /dev/null
@@ -1,526 +0,0 @@
1#ifndef _ECORE_IMF_H
2#define _ECORE_IMF_H
3
4#include <Eina.h>
5
6#ifdef EAPI
7# undef EAPI
8#endif
9
10#ifdef _WIN32
11# ifdef EFL_ECORE_IMF_BUILD
12# ifdef DLL_EXPORT
13# define EAPI __declspec(dllexport)
14# else
15# define EAPI
16# endif /* ! DLL_EXPORT */
17# else
18# define EAPI __declspec(dllimport)
19# endif /* ! EFL_ECORE_IMF_BUILD */
20#else
21# ifdef __GNUC__
22# if __GNUC__ >= 4
23# define EAPI __attribute__ ((visibility("default")))
24# else
25# define EAPI
26# endif
27# else
28# define EAPI
29# endif
30#endif /* ! _WIN32 */
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
37 * @addtogroup Ecore_IMF_Context_Group
38 *
39 * @{
40 */
41
42/* Events sent by the Input Method */
43typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start;
44typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End;
45typedef struct _Ecore_IMF_Event_Preedit_Changed Ecore_IMF_Event_Preedit_Changed;
46typedef struct _Ecore_IMF_Event_Commit Ecore_IMF_Event_Commit;
47typedef struct _Ecore_IMF_Event_Delete_Surrounding Ecore_IMF_Event_Delete_Surrounding;
48
49/* Events to filter */
50typedef struct _Ecore_IMF_Event_Mouse_Down Ecore_IMF_Event_Mouse_Down;
51typedef struct _Ecore_IMF_Event_Mouse_Up Ecore_IMF_Event_Mouse_Up;
52typedef struct _Ecore_IMF_Event_Mouse_In Ecore_IMF_Event_Mouse_In;
53typedef struct _Ecore_IMF_Event_Mouse_Out Ecore_IMF_Event_Mouse_Out;
54typedef struct _Ecore_IMF_Event_Mouse_Move Ecore_IMF_Event_Mouse_Move;
55typedef struct _Ecore_IMF_Event_Mouse_Wheel Ecore_IMF_Event_Mouse_Wheel;
56typedef struct _Ecore_IMF_Event_Key_Down Ecore_IMF_Event_Key_Down;
57typedef struct _Ecore_IMF_Event_Key_Up Ecore_IMF_Event_Key_Up;
58typedef union _Ecore_IMF_Event Ecore_IMF_Event;
59
60typedef struct _Ecore_IMF_Context Ecore_IMF_Context; /**< An Input Method Context */
61typedef struct _Ecore_IMF_Context_Class Ecore_IMF_Context_Class; /**< An Input Method Context class */
62typedef struct _Ecore_IMF_Context_Info Ecore_IMF_Context_Info; /**< An Input Method Context info */
63
64/* Preedit attribute info */
65typedef struct _Ecore_IMF_Preedit_Attr Ecore_IMF_Preedit_Attr;
66
67EAPI extern int ECORE_IMF_EVENT_PREEDIT_START;
68EAPI extern int ECORE_IMF_EVENT_PREEDIT_END;
69EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED;
70EAPI extern int ECORE_IMF_EVENT_COMMIT;
71EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING;
72
73typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info);
74
75/**
76 * @enum _Ecore_IMF_Callback_Type
77 * @typedef Ecore_IMF_Callback_Type
78 *
79 * Ecore IMF Event callback types.
80 *
81 * @see ecore_imf_context_event_callback_add()
82 */
83typedef enum
84{
85 ECORE_IMF_CALLBACK_PREEDIT_START, /**< "PREEDIT_START" is called when a new preediting sequence starts. */
86 ECORE_IMF_CALLBACK_PREEDIT_END, /**< "PREEDIT_END" is called when a preediting sequence has been completed or canceled. */
87 ECORE_IMF_CALLBACK_PREEDIT_CHANGED, /**< "PREEDIT_CHANGED" is called whenever the preedit sequence currently being entered has changed. */
88 ECORE_IMF_CALLBACK_COMMIT, /**< "COMMIT" is called when a complete input sequence has been entered by the user */
89 ECORE_IMF_CALLBACK_DELETE_SURROUNDING /**< "DELETE_SURROUNDING" is called when the input method needs to delete all or part of the context surrounding the cursor */
90} Ecore_IMF_Callback_Type;
91
92/**
93 * @enum _Ecore_IMF_Event_Type
94 * @typedef Ecore_IMF_Event_Type
95 *
96 * Ecore IMF event types.
97 *
98 * @see ecore_imf_context_filter_event()
99 */
100typedef enum
101{
102 ECORE_IMF_EVENT_MOUSE_DOWN, /**< Mouse Down event */
103 ECORE_IMF_EVENT_MOUSE_UP, /**< Mouse Up event */
104 ECORE_IMF_EVENT_MOUSE_IN, /**< Mouse In event */
105 ECORE_IMF_EVENT_MOUSE_OUT, /**< Mouse Out event */
106 ECORE_IMF_EVENT_MOUSE_MOVE, /**< Mouse Move event */
107 ECORE_IMF_EVENT_MOUSE_WHEEL, /**< Mouse Wheel event */
108 ECORE_IMF_EVENT_KEY_DOWN, /**< Key Down event */
109 ECORE_IMF_EVENT_KEY_UP /**< Key Up event */
110} Ecore_IMF_Event_Type;
111
112typedef enum
113{
114 ECORE_IMF_KEYBOARD_MODIFIER_NONE = 0, /**< No active modifiers */
115 ECORE_IMF_KEYBOARD_MODIFIER_CTRL = 1 << 0, /**< "Control" is pressed */
116 ECORE_IMF_KEYBOARD_MODIFIER_ALT = 1 << 1, /**< "Alt" is pressed */
117 ECORE_IMF_KEYBOARD_MODIFIER_SHIFT = 1 << 2, /**< "Shift" is pressed */
118 ECORE_IMF_KEYBOARD_MODIFIER_WIN = 1 << 3 /**< "Win" (between "Ctrl" and "Alt") is pressed */
119} Ecore_IMF_Keyboard_Modifiers;
120
121typedef enum
122{
123 ECORE_IMF_KEYBOARD_LOCK_NONE = 0, /**< No locks are active */
124 ECORE_IMF_KEYBOARD_LOCK_NUM = 1 << 0, /**< "Num" lock is active */
125 ECORE_IMF_KEYBOARD_LOCK_CAPS = 1 << 1, /**< "Caps" lock is active */
126 ECORE_IMF_KEYBOARD_LOCK_SCROLL = 1 << 2 /**< "Scroll" lock is active */
127} Ecore_IMF_Keyboard_Locks;
128
129typedef enum
130{
131 ECORE_IMF_MOUSE_NONE = 0, /**< A single click */
132 ECORE_IMF_MOUSE_DOUBLE_CLICK = 1 << 0, /**< A double click */
133 ECORE_IMF_MOUSE_TRIPLE_CLICK = 1 << 1 /**< A triple click */
134} Ecore_IMF_Mouse_Flags;
135
136typedef enum
137{
138 ECORE_IMF_INPUT_MODE_ALPHA = 1 << 0,
139 ECORE_IMF_INPUT_MODE_NUMERIC = 1 << 1,
140 ECORE_IMF_INPUT_MODE_SPECIAL = 1 << 2,
141 ECORE_IMF_INPUT_MODE_HEXA = 1 << 3,
142 ECORE_IMF_INPUT_MODE_TELE = 1 << 4,
143 ECORE_IMF_INPUT_MODE_FULL = (ECORE_IMF_INPUT_MODE_ALPHA | ECORE_IMF_INPUT_MODE_NUMERIC | ECORE_IMF_INPUT_MODE_SPECIAL),
144 ECORE_IMF_INPUT_MODE_INVISIBLE = 1 << 29,
145 ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30
146} Ecore_IMF_Input_Mode;
147
148/**
149 * @enum _Ecore_IMF_Preedit_Type
150 * @typedef Ecore_IMF_Preedit_Type
151 *
152 * Ecore IMF Preedit style types
153 *
154 * @see ecore_imf_context_preedit_string_with_attributes_get()
155 */
156typedef enum
157{
158 ECORE_IMF_PREEDIT_TYPE_NONE, /**< None style */
159 ECORE_IMF_PREEDIT_TYPE_SUB1, /**< Substring style 1 */
160 ECORE_IMF_PREEDIT_TYPE_SUB2, /**< Substring style 2 */
161 ECORE_IMF_PREEDIT_TYPE_SUB3 /**< Substring style 3 */
162} Ecore_IMF_Preedit_Type;
163
164/**
165 * @enum _Ecore_IMF_Autocapital_Type
166 * @typedef Ecore_IMF_Autocapital_Type
167 *
168 * Autocapitalization Types.
169 *
170 * @see ecore_imf_context_autocapital_type_set()
171 */
172typedef enum
173{
174 ECORE_IMF_AUTOCAPITAL_TYPE_NONE, /**< No auto-capitalization when typing */
175 ECORE_IMF_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed */
176 ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence */
177 ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER, /**< Autocapitalize all letters */
178} Ecore_IMF_Autocapital_Type;
179
180/**
181 * @enum _Ecore_IMF_Input_Panel_Layout
182 * @typedef Ecore_IMF_Input_Panel_Layout
183 *
184 * Input panel (virtual keyboard) layout types.
185 *
186 * @see ecore_imf_context_input_panel_layout_set()
187 */
188typedef enum
189{
190 ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */
191 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */
192 ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */
193 ECORE_IMF_INPUT_PANEL_LAYOUT_URL, /**< URL layout */
194 ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */
195 ECORE_IMF_INPUT_PANEL_LAYOUT_IP, /**< IP layout */
196 ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */
197 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */
198 ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this */
199 ECORE_IMF_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout @since 1.2 */
200 ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout @since 1.2 */
201 ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */
202} Ecore_IMF_Input_Panel_Layout;
203
204/**
205 * @enum _Ecore_IMF_Input_Panel_Lang
206 * @typedef Ecore_IMF_Input_Panel_Lang
207 *
208 * Input panel (virtual keyboard) language modes.
209 *
210 * @see ecore_imf_context_input_panel_language_set()
211 */
212typedef enum
213{
214 ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic @since 1.2 */
215 ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet @since 1.2 */
216} Ecore_IMF_Input_Panel_Lang;
217
218/**
219 * @enum _Ecore_IMF_Input_Panel_Return_Key_Type
220 * @typedef Ecore_IMF_Input_Panel_Return_Key_Type
221 *
222 * "Return" Key types on the input panel (virtual keyboard).
223 *
224 * @see ecore_imf_context_input_panel_return_key_type_set()
225 */
226typedef enum
227{
228 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, /**< Default @since 1.2 */
229 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE, /**< Done @since 1.2 */
230 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO, /**< Go @since 1.2 */
231 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, /**< Join @since 1.2 */
232 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, /**< Login @since 1.2 */
233 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, /**< Next @since 1.2 */
234 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, /**< Search or magnifier icon @since 1.2 */
235 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND /**< Send @since 1.2 */
236} Ecore_IMF_Input_Panel_Return_Key_Type;
237
238struct _Ecore_IMF_Event_Preedit_Start
239{
240 Ecore_IMF_Context *ctx;
241};
242
243struct _Ecore_IMF_Event_Preedit_End
244{
245 Ecore_IMF_Context *ctx;
246};
247
248struct _Ecore_IMF_Event_Preedit_Changed
249{
250 Ecore_IMF_Context *ctx;
251};
252
253struct _Ecore_IMF_Event_Commit
254{
255 Ecore_IMF_Context *ctx;
256 char *str;
257};
258
259struct _Ecore_IMF_Event_Delete_Surrounding
260{
261 Ecore_IMF_Context *ctx;
262 int offset;
263 int n_chars;
264};
265
266struct _Ecore_IMF_Event_Mouse_Down
267{
268 int button; /**< The button which has been pressed */
269 struct {
270 int x, y;
271 } output;
272 struct {
273 int x, y;
274 } canvas;
275 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
276 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
277 Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
278 unsigned int timestamp; /**< The timestamp when the event occurred */
279};
280
281struct _Ecore_IMF_Event_Mouse_Up
282{
283 int button; /**< The button which has been pressed */
284 struct {
285 int x, y;
286 } output;
287 struct {
288 int x, y;
289 } canvas;
290 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
291 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
292 Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
293 unsigned int timestamp; /**< The timestamp when the event occurred */
294};
295
296struct _Ecore_IMF_Event_Mouse_In
297{
298 int buttons;
299 struct {
300 int x, y;
301 } output;
302 struct {
303 int x, y;
304 } canvas;
305 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
306 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
307 unsigned int timestamp; /**< The timestamp when the event occurred */
308};
309
310struct _Ecore_IMF_Event_Mouse_Out
311{
312 int buttons;
313 struct {
314 int x, y;
315 } output;
316 struct {
317 int x, y;
318 } canvas;
319 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
320 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
321 unsigned int timestamp; /**< The timestamp when the event occurred */
322};
323
324struct _Ecore_IMF_Event_Mouse_Move
325{
326 int buttons;
327 struct {
328 struct {
329 int x, y;
330 } output;
331 struct {
332 int x, y;
333 } canvas;
334 } cur, prev;
335 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
336 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
337 unsigned int timestamp; /**< The timestamp when the event occurred */
338};
339
340struct _Ecore_IMF_Event_Mouse_Wheel
341{
342 int direction; /* 0 = default up/down wheel */
343 int z; /* ...,-2,-1 = down, 1,2,... = up */
344 struct {
345 int x, y;
346 } output;
347 struct {
348 int x, y;
349 } canvas;
350 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
351 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
352 unsigned int timestamp; /**< The timestamp when the event occurred */
353};
354
355struct _Ecore_IMF_Event_Key_Down
356{
357 const char *keyname; /**< The string name of the key pressed */
358 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
359 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
360 const char *key; /**< The logical key : (eg shift+1 == exclamation) */
361 const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
362 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 */
363 unsigned int timestamp; /**< The timestamp when the event occurred */
364};
365
366struct _Ecore_IMF_Event_Key_Up
367{
368 const char *keyname; /**< The string name of the key pressed */
369 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
370 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
371 const char *key; /**< The logical key : (eg shift+1 == exclamation) */
372 const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
373 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 */
374 unsigned int timestamp; /**< The timestamp when the event occurred */
375};
376
377union _Ecore_IMF_Event
378{
379 Ecore_IMF_Event_Mouse_Down mouse_down;
380 Ecore_IMF_Event_Mouse_Up mouse_up;
381 Ecore_IMF_Event_Mouse_In mouse_in;
382 Ecore_IMF_Event_Mouse_Out mouse_out;
383 Ecore_IMF_Event_Mouse_Move mouse_move;
384 Ecore_IMF_Event_Mouse_Wheel mouse_wheel;
385 Ecore_IMF_Event_Key_Down key_down;
386 Ecore_IMF_Event_Key_Up key_up;
387};
388
389struct _Ecore_IMF_Preedit_Attr
390{
391 Ecore_IMF_Preedit_Type preedit_type; /**< preedit style type */
392 unsigned int start_index; /**< start index of the range (in bytes) */
393 unsigned int end_index; /**< end index of the range (in bytes) */
394};
395
396struct _Ecore_IMF_Context_Class
397{
398 void (*add) (Ecore_IMF_Context *ctx);
399 void (*del) (Ecore_IMF_Context *ctx);
400 void (*client_window_set) (Ecore_IMF_Context *ctx, void *window);
401 void (*client_canvas_set) (Ecore_IMF_Context *ctx, void *canvas);
402 void (*show) (Ecore_IMF_Context *ctx);
403 void (*hide) (Ecore_IMF_Context *ctx);
404 void (*preedit_string_get) (Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
405 void (*focus_in) (Ecore_IMF_Context *ctx);
406 void (*focus_out) (Ecore_IMF_Context *ctx);
407 void (*reset) (Ecore_IMF_Context *ctx);
408 void (*cursor_position_set) (Ecore_IMF_Context *ctx, int cursor_pos);
409 void (*use_preedit_set) (Ecore_IMF_Context *ctx, Eina_Bool use_preedit);
410 void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
411 Eina_Bool (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
412 void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
413 void (*prediction_allow_set)(Ecore_IMF_Context *ctx, Eina_Bool prediction);
414 void (*autocapital_type_set)(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
415 void (*control_panel_show) (Ecore_IMF_Context *ctx);
416 void (*control_panel_hide) (Ecore_IMF_Context *ctx);
417 void (*input_panel_layout_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout);
418 Ecore_IMF_Input_Panel_Layout (*input_panel_layout_get) (Ecore_IMF_Context *ctx);
419 void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
420 Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
421 void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
422 void (*input_panel_imdata_set)(Ecore_IMF_Context *ctx, const void* data, int len);
423 void (*input_panel_imdata_get)(Ecore_IMF_Context *ctx, void* data, int *len);
424 void (*input_panel_return_key_type_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type);
425 void (*input_panel_return_key_disabled_set) (Ecore_IMF_Context *ctx, Eina_Bool disabled);
426 void (*input_panel_caps_lock_mode_set) (Ecore_IMF_Context *ctx, Eina_Bool mode);
427};
428
429struct _Ecore_IMF_Context_Info
430{
431 const char *id; /* ID */
432 const char *description; /* Human readable description */
433 const char *default_locales; /* Languages for which this context is the default, separated by : */
434 const char *canvas_type; /* The canvas type used by the input method. Eg.: evas */
435 int canvas_required; /* Whether the canvas usage is required for this input method */
436};
437
438EAPI int ecore_imf_init(void);
439EAPI int ecore_imf_shutdown(void);
440
441EAPI 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));
442
443EAPI Eina_List *ecore_imf_context_available_ids_get(void);
444EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
445EAPI const char *ecore_imf_context_default_id_get(void);
446EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
447EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
448
449EAPI Ecore_IMF_Context *ecore_imf_context_add(const char *id);
450EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_get(Ecore_IMF_Context *ctx);
451EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx);
452EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window);
453EAPI void *ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx);
454EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas);
455EAPI void *ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx);
456EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx);
457EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx);
458EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
459EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
460EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx);
461EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx);
462EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx);
463EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos);
464EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h);
465EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit);
466EAPI 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);
467EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
468EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx);
469EAPI Eina_Bool ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
470
471/* plugin specific functions */
472EAPI Ecore_IMF_Context *ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc);
473EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data);
474EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx);
475EAPI Eina_Bool ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
476EAPI void ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx);
477EAPI void ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx);
478EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx);
479EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str);
480EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars);
481EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data);
482EAPI void *ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func);
483EAPI void ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info);
484EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction);
485EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx);
486EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
487EAPI Ecore_IMF_Autocapital_Type ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx);
488
489EAPI void ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx);
490EAPI void ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx);
491
492EAPI void ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx);
493EAPI void ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx);
494EAPI void ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout);
495EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx);
496EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
497EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx);
498EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable);
499EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx);
500EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len);
501EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len);
502EAPI void ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type);
503EAPI Ecore_IMF_Input_Panel_Return_Key_Type ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx);
504EAPI void ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled);
505EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx);
506EAPI void ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode);
507EAPI Eina_Bool ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx);
508
509/* The following entry points must be exported by each input method module
510 */
511
512/*
513 * int imf_module_init (const Ecore_IMF_Context_Info **info);
514 * void imf_module_exit (void);
515 * Ecore_IMF_Context *imf_module_create (void);
516 */
517
518#ifdef __cplusplus
519}
520#endif
521
522#endif
523
524/**
525 * @}
526 */
diff --git a/libraries/ecore/src/lib/ecore_imf/Makefile.am b/libraries/ecore/src/lib/ecore_imf/Makefile.am
deleted file mode 100644
index 10f6c2f..0000000
--- a/libraries/ecore/src/lib/ecore_imf/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-DPACKAGE_LIB_DIR=\"$(libdir)\" \
6@EFL_ECORE_IMF_BUILD@ \
7@EVIL_CFLAGS@ \
8@EINA_CFLAGS@
9
10AM_CFLAGS = @WIN32_CFLAGS@
11
12lib_LTLIBRARIES = libecore_imf.la
13includes_HEADERS = Ecore_IMF.h
14includesdir = $(includedir)/ecore-@VMAJ@
15
16libecore_imf_la_SOURCES = \
17ecore_imf.c \
18ecore_imf_context.c \
19ecore_imf_module.c
20
21libecore_imf_la_LIBADD = \
22$(top_builddir)/src/lib/ecore/libecore.la \
23@EINA_LIBS@ \
24@EVIL_LIBS@
25
26libecore_imf_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
27
28EXTRA_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
deleted file mode 100644
index 4d71b5d..0000000
--- a/libraries/ecore/src/lib/ecore_imf/Makefile.in
+++ /dev/null
@@ -1,836 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_imf
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_imf_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la
90am_libecore_imf_la_OBJECTS = ecore_imf.lo ecore_imf_context.lo \
91 ecore_imf_module.lo
92libecore_imf_la_OBJECTS = $(am_libecore_imf_la_OBJECTS)
93AM_V_lt = $(am__v_lt_$(V))
94am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
95am__v_lt_0 = --silent
96libecore_imf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
97 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
98 $(AM_CFLAGS) $(CFLAGS) $(libecore_imf_la_LDFLAGS) $(LDFLAGS) \
99 -o $@
100DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
101depcomp = $(SHELL) $(top_srcdir)/depcomp
102am__depfiles_maybe = depfiles
103am__mv = mv -f
104COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
105 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
106LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
107 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
108 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
109 $(AM_CFLAGS) $(CFLAGS)
110AM_V_CC = $(am__v_CC_$(V))
111am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
112am__v_CC_0 = @echo " CC " $@;
113AM_V_at = $(am__v_at_$(V))
114am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
115am__v_at_0 = @
116CCLD = $(CC)
117LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
118 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
119 $(AM_LDFLAGS) $(LDFLAGS) -o $@
120AM_V_CCLD = $(am__v_CCLD_$(V))
121am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
122am__v_CCLD_0 = @echo " CCLD " $@;
123AM_V_GEN = $(am__v_GEN_$(V))
124am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
125am__v_GEN_0 = @echo " GEN " $@;
126SOURCES = $(libecore_imf_la_SOURCES)
127DIST_SOURCES = $(libecore_imf_la_SOURCES)
128HEADERS = $(includes_HEADERS)
129ETAGS = etags
130CTAGS = ctags
131DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
132ACLOCAL = @ACLOCAL@
133ALLOCA = @ALLOCA@
134AMTAR = @AMTAR@
135AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
136AR = @AR@
137AS = @AS@
138AUTOCONF = @AUTOCONF@
139AUTOHEADER = @AUTOHEADER@
140AUTOMAKE = @AUTOMAKE@
141AWK = @AWK@
142CARES_CFLAGS = @CARES_CFLAGS@
143CARES_LIBS = @CARES_LIBS@
144CC = @CC@
145CCDEPMODE = @CCDEPMODE@
146CFLAGS = @CFLAGS@
147CHECK_CFLAGS = @CHECK_CFLAGS@
148CHECK_LIBS = @CHECK_LIBS@
149CPP = @CPP@
150CPPFLAGS = @CPPFLAGS@
151CURL_CFLAGS = @CURL_CFLAGS@
152CURL_LIBS = @CURL_LIBS@
153CXX = @CXX@
154CXXCPP = @CXXCPP@
155CXXDEPMODE = @CXXDEPMODE@
156CXXFLAGS = @CXXFLAGS@
157CYGPATH_W = @CYGPATH_W@
158DEFS = @DEFS@
159DEPDIR = @DEPDIR@
160DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
161DIRECTFB_LIBS = @DIRECTFB_LIBS@
162DLLTOOL = @DLLTOOL@
163DSYMUTIL = @DSYMUTIL@
164DUMPBIN = @DUMPBIN@
165ECHO_C = @ECHO_C@
166ECHO_N = @ECHO_N@
167ECHO_T = @ECHO_T@
168ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
169ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
170EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
171EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
172EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
173EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
174EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
175EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
176EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
177EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
178EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
179EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
180EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
181EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
182EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
183EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
184EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
185EGREP = @EGREP@
186EINA_CFLAGS = @EINA_CFLAGS@
187EINA_LIBS = @EINA_LIBS@
188ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
189ESCAPE_LIBS = @ESCAPE_LIBS@
190EVAS_CFLAGS = @EVAS_CFLAGS@
191EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@
200GLIB_LIBS = @GLIB_LIBS@
201GMSGFMT = @GMSGFMT@
202GMSGFMT_015 = @GMSGFMT_015@
203GREP = @GREP@
204INSTALL = @INSTALL@
205INSTALL_DATA = @INSTALL_DATA@
206INSTALL_PROGRAM = @INSTALL_PROGRAM@
207INSTALL_SCRIPT = @INSTALL_SCRIPT@
208INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
209INTLLIBS = @INTLLIBS@
210INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
211KEYSYMDEFS = @KEYSYMDEFS@
212LD = @LD@
213LDFLAGS = @LDFLAGS@
214LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
215LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
216LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
217LIBICONV = @LIBICONV@
218LIBINTL = @LIBINTL@
219LIBOBJS = @LIBOBJS@
220LIBS = @LIBS@
221LIBTOOL = @LIBTOOL@
222LIPO = @LIPO@
223LN_S = @LN_S@
224LTLIBICONV = @LTLIBICONV@
225LTLIBINTL = @LTLIBINTL@
226LTLIBOBJS = @LTLIBOBJS@
227MAKEINFO = @MAKEINFO@
228MKDIR_P = @MKDIR_P@
229MSGFMT = @MSGFMT@
230MSGFMT_015 = @MSGFMT_015@
231MSGMERGE = @MSGMERGE@
232NM = @NM@
233NMEDIT = @NMEDIT@
234OBJC = @OBJC@
235OBJCDEPMODE = @OBJCDEPMODE@
236OBJCFLAGS = @OBJCFLAGS@
237OBJDUMP = @OBJDUMP@
238OBJEXT = @OBJEXT@
239OTOOL = @OTOOL@
240OTOOL64 = @OTOOL64@
241PACKAGE = @PACKAGE@
242PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
243PACKAGE_NAME = @PACKAGE_NAME@
244PACKAGE_STRING = @PACKAGE_STRING@
245PACKAGE_TARNAME = @PACKAGE_TARNAME@
246PACKAGE_URL = @PACKAGE_URL@
247PACKAGE_VERSION = @PACKAGE_VERSION@
248PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
254POSUB = @POSUB@
255RANLIB = @RANLIB@
256SCIM_CFLAGS = @SCIM_CFLAGS@
257SCIM_LIBS = @SCIM_LIBS@
258SDL_CFLAGS = @SDL_CFLAGS@
259SDL_CONFIG = @SDL_CONFIG@
260SDL_LIBS = @SDL_LIBS@
261SED = @SED@
262SET_MAKE = @SET_MAKE@
263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@
268TLS2_CFLAGS = @TLS2_CFLAGS@
269TLS2_LIBS = @TLS2_LIBS@
270TLS_CFLAGS = @TLS_CFLAGS@
271TLS_LIBS = @TLS_LIBS@
272TSLIB_CFLAGS = @TSLIB_CFLAGS@
273TSLIB_LIBS = @TSLIB_LIBS@
274USE_NLS = @USE_NLS@
275VERSION = @VERSION@
276VMAJ = @VMAJ@
277WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
278WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
279WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
280WAYLAND_LIBS = @WAYLAND_LIBS@
281WIN32_CFLAGS = @WIN32_CFLAGS@
282WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
283WIN32_LIBS = @WIN32_LIBS@
284XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
285XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
286XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
287XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
288XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
289XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
290XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
291XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
292XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
293XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
294XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
295XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
296XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
297XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
298XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
299XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
300XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
301XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
302XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
303XCB_X11_LIBS = @XCB_X11_LIBS@
304XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
305XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
306XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
307XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
308XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
309XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
310XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
311XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
312XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
313XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
314XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
315XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
316XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
317XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
318XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
319XDAMAGE_LIBS = @XDAMAGE_LIBS@
320XDPMS_CFLAGS = @XDPMS_CFLAGS@
321XDPMS_LIBS = @XDPMS_LIBS@
322XFIXES_CFLAGS = @XFIXES_CFLAGS@
323XFIXES_LIBS = @XFIXES_LIBS@
324XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
325XGESTURE_LIBS = @XGESTURE_LIBS@
326XGETTEXT = @XGETTEXT@
327XGETTEXT_015 = @XGETTEXT_015@
328XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
329XI2_CFLAGS = @XI2_CFLAGS@
330XI2_LIBS = @XI2_LIBS@
331XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
332XINERAMA_LIBS = @XINERAMA_LIBS@
333XKB_CFLAGS = @XKB_CFLAGS@
334XKB_LIBS = @XKB_LIBS@
335XMKMF = @XMKMF@
336XPRINT_CFLAGS = @XPRINT_CFLAGS@
337XPRINT_LIBS = @XPRINT_LIBS@
338XRANDR_CFLAGS = @XRANDR_CFLAGS@
339XRANDR_LIBS = @XRANDR_LIBS@
340XRENDER_CFLAGS = @XRENDER_CFLAGS@
341XRENDER_LIBS = @XRENDER_LIBS@
342XSS_CFLAGS = @XSS_CFLAGS@
343XSS_LIBS = @XSS_LIBS@
344XTEST_CFLAGS = @XTEST_CFLAGS@
345XTEST_LIBS = @XTEST_LIBS@
346X_CFLAGS = @X_CFLAGS@
347X_EXTRA_LIBS = @X_EXTRA_LIBS@
348X_LIBS = @X_LIBS@
349X_PRE_LIBS = @X_PRE_LIBS@
350Xcursor_cflags = @Xcursor_cflags@
351Xcursor_libs = @Xcursor_libs@
352abs_builddir = @abs_builddir@
353abs_srcdir = @abs_srcdir@
354abs_top_builddir = @abs_top_builddir@
355abs_top_srcdir = @abs_top_srcdir@
356ac_ct_CC = @ac_ct_CC@
357ac_ct_CXX = @ac_ct_CXX@
358ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
359ac_ct_OBJC = @ac_ct_OBJC@
360am__include = @am__include@
361am__leading_dot = @am__leading_dot@
362am__quote = @am__quote@
363am__tar = @am__tar@
364am__untar = @am__untar@
365bindir = @bindir@
366build = @build@
367build_alias = @build_alias@
368build_cpu = @build_cpu@
369build_os = @build_os@
370build_vendor = @build_vendor@
371builddir = @builddir@
372cocoa_ldflags = @cocoa_ldflags@
373datadir = @datadir@
374datarootdir = @datarootdir@
375dlopen_libs = @dlopen_libs@
376docdir = @docdir@
377dvidir = @dvidir@
378ecore_cocoa_cflags = @ecore_cocoa_cflags@
379ecore_cocoa_libs = @ecore_cocoa_libs@
380ecore_con_cflags = @ecore_con_cflags@
381ecore_con_libs = @ecore_con_libs@
382ecore_directfb_cflags = @ecore_directfb_cflags@
383ecore_directfb_libs = @ecore_directfb_libs@
384ecore_evas_cflags = @ecore_evas_cflags@
385ecore_evas_libs = @ecore_evas_libs@
386ecore_fb_cflags = @ecore_fb_cflags@
387ecore_fb_libs = @ecore_fb_libs@
388ecore_file_cflags = @ecore_file_cflags@
389ecore_file_libs = @ecore_file_libs@
390ecore_imf_cflags = @ecore_imf_cflags@
391ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
392ecore_imf_evas_libs = @ecore_imf_evas_libs@
393ecore_imf_libs = @ecore_imf_libs@
394ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
395ecore_imf_scim_libs = @ecore_imf_scim_libs@
396ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
397ecore_imf_xim_libs = @ecore_imf_xim_libs@
398ecore_input_cflags = @ecore_input_cflags@
399ecore_input_evas_cflags = @ecore_input_evas_cflags@
400ecore_input_evas_libs = @ecore_input_evas_libs@
401ecore_input_libs = @ecore_input_libs@
402ecore_ipc_cflags = @ecore_ipc_cflags@
403ecore_ipc_libs = @ecore_ipc_libs@
404ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
405ecore_psl1ght_libs = @ecore_psl1ght_libs@
406ecore_sdl_cflags = @ecore_sdl_cflags@
407ecore_sdl_libs = @ecore_sdl_libs@
408ecore_wayland_cflags = @ecore_wayland_cflags@
409ecore_wayland_libs = @ecore_wayland_libs@
410ecore_win32_cflags = @ecore_win32_cflags@
411ecore_win32_libs = @ecore_win32_libs@
412ecore_wince_cflags = @ecore_wince_cflags@
413ecore_wince_libs = @ecore_wince_libs@
414ecore_x_cflags = @ecore_x_cflags@
415ecore_x_libs = @ecore_x_libs@
416ecore_x_libs_private = @ecore_x_libs_private@
417efl_doxygen = @efl_doxygen@
418efl_have_doxygen = @efl_have_doxygen@
419exec_prefix = @exec_prefix@
420have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
421host = @host@
422host_alias = @host_alias@
423host_cpu = @host_cpu@
424host_os = @host_os@
425host_vendor = @host_vendor@
426htmldir = @htmldir@
427includedir = @includedir@
428infodir = @infodir@
429install_sh = @install_sh@
430libdir = @libdir@
431libexecdir = @libexecdir@
432localedir = @localedir@
433localstatedir = @localstatedir@
434lt_ECHO = @lt_ECHO@
435lt_enable_auto_import = @lt_enable_auto_import@
436mandir = @mandir@
437mkdir_p = @mkdir_p@
438oldincludedir = @oldincludedir@
439pdfdir = @pdfdir@
440pkgconfig_requires_private = @pkgconfig_requires_private@
441prefix = @prefix@
442program_transform_name = @program_transform_name@
443psdir = @psdir@
444release_info = @release_info@
445requirements_ecore = @requirements_ecore@
446requirements_ecore_cocoa = @requirements_ecore_cocoa@
447requirements_ecore_con = @requirements_ecore_con@
448requirements_ecore_directfb = @requirements_ecore_directfb@
449requirements_ecore_evas = @requirements_ecore_evas@
450requirements_ecore_fb = @requirements_ecore_fb@
451requirements_ecore_file = @requirements_ecore_file@
452requirements_ecore_imf = @requirements_ecore_imf@
453requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
454requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
455requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
456requirements_ecore_input = @requirements_ecore_input@
457requirements_ecore_input_evas = @requirements_ecore_input_evas@
458requirements_ecore_ipc = @requirements_ecore_ipc@
459requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
460requirements_ecore_sdl = @requirements_ecore_sdl@
461requirements_ecore_wayland = @requirements_ecore_wayland@
462requirements_ecore_win32 = @requirements_ecore_win32@
463requirements_ecore_wince = @requirements_ecore_wince@
464requirements_ecore_x = @requirements_ecore_x@
465rt_libs = @rt_libs@
466sbindir = @sbindir@
467sharedstatedir = @sharedstatedir@
468srcdir = @srcdir@
469sysconfdir = @sysconfdir@
470target_alias = @target_alias@
471top_build_prefix = @top_build_prefix@
472top_builddir = @top_builddir@
473top_srcdir = @top_srcdir@
474version_info = @version_info@
475x_cflags = @x_cflags@
476x_includes = @x_includes@
477x_libs = @x_libs@
478MAINTAINERCLEANFILES = Makefile.in
479AM_CPPFLAGS = \
480-I$(top_srcdir)/src/lib/ecore \
481-DPACKAGE_LIB_DIR=\"$(libdir)\" \
482@EFL_ECORE_IMF_BUILD@ \
483@EVIL_CFLAGS@ \
484@EINA_CFLAGS@
485
486AM_CFLAGS = @WIN32_CFLAGS@
487lib_LTLIBRARIES = libecore_imf.la
488includes_HEADERS = Ecore_IMF.h
489includesdir = $(includedir)/ecore-@VMAJ@
490libecore_imf_la_SOURCES = \
491ecore_imf.c \
492ecore_imf_context.c \
493ecore_imf_module.c
494
495libecore_imf_la_LIBADD = \
496$(top_builddir)/src/lib/ecore/libecore.la \
497@EINA_LIBS@ \
498@EVIL_LIBS@
499
500libecore_imf_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
501EXTRA_DIST = ecore_imf_private.h
502all: all-am
503
504.SUFFIXES:
505.SUFFIXES: .c .lo .o .obj
506$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
507 @for dep in $?; do \
508 case '$(am__configure_deps)' in \
509 *$$dep*) \
510 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
511 && { if test -f $@; then exit 0; else break; fi; }; \
512 exit 1;; \
513 esac; \
514 done; \
515 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_imf/Makefile'; \
516 $(am__cd) $(top_srcdir) && \
517 $(AUTOMAKE) --gnu src/lib/ecore_imf/Makefile
518.PRECIOUS: Makefile
519Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
520 @case '$?' in \
521 *config.status*) \
522 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
523 *) \
524 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
525 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
526 esac;
527
528$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
529 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
530
531$(top_srcdir)/configure: $(am__configure_deps)
532 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
533$(ACLOCAL_M4): $(am__aclocal_m4_deps)
534 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
535$(am__aclocal_m4_deps):
536install-libLTLIBRARIES: $(lib_LTLIBRARIES)
537 @$(NORMAL_INSTALL)
538 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
539 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
540 list2=; for p in $$list; do \
541 if test -f $$p; then \
542 list2="$$list2 $$p"; \
543 else :; fi; \
544 done; \
545 test -z "$$list2" || { \
546 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
547 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
548 }
549
550uninstall-libLTLIBRARIES:
551 @$(NORMAL_UNINSTALL)
552 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
553 for p in $$list; do \
554 $(am__strip_dir) \
555 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
556 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
557 done
558
559clean-libLTLIBRARIES:
560 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
561 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
562 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
563 test "$$dir" != "$$p" || dir=.; \
564 echo "rm -f \"$${dir}/so_locations\""; \
565 rm -f "$${dir}/so_locations"; \
566 done
567libecore_imf.la: $(libecore_imf_la_OBJECTS) $(libecore_imf_la_DEPENDENCIES)
568 $(AM_V_CCLD)$(libecore_imf_la_LINK) -rpath $(libdir) $(libecore_imf_la_OBJECTS) $(libecore_imf_la_LIBADD) $(LIBS)
569
570mostlyclean-compile:
571 -rm -f *.$(OBJEXT)
572
573distclean-compile:
574 -rm -f *.tab.c
575
576@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf.Plo@am__quote@
577@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf_context.Plo@am__quote@
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf_module.Plo@am__quote@
579
580.c.o:
581@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
582@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
583@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
584@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
585@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
586@am__fastdepCC_FALSE@ $(COMPILE) -c $<
587
588.c.obj:
589@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
590@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
591@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
592@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
594@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
595
596.c.lo:
597@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
598@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
599@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
601@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
602@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
603
604mostlyclean-libtool:
605 -rm -f *.lo
606
607clean-libtool:
608 -rm -rf .libs _libs
609install-includesHEADERS: $(includes_HEADERS)
610 @$(NORMAL_INSTALL)
611 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
612 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
613 for p in $$list; do \
614 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
615 echo "$$d$$p"; \
616 done | $(am__base_list) | \
617 while read files; do \
618 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
619 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
620 done
621
622uninstall-includesHEADERS:
623 @$(NORMAL_UNINSTALL)
624 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
625 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
626 test -n "$$files" || exit 0; \
627 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
628 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
629
630ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
631 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
632 unique=`for i in $$list; do \
633 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
634 done | \
635 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
636 END { if (nonempty) { for (i in files) print i; }; }'`; \
637 mkid -fID $$unique
638tags: TAGS
639
640TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
641 $(TAGS_FILES) $(LISP)
642 set x; \
643 here=`pwd`; \
644 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
645 unique=`for i in $$list; do \
646 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
647 done | \
648 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
649 END { if (nonempty) { for (i in files) print i; }; }'`; \
650 shift; \
651 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
652 test -n "$$unique" || unique=$$empty_fix; \
653 if test $$# -gt 0; then \
654 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
655 "$$@" $$unique; \
656 else \
657 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
658 $$unique; \
659 fi; \
660 fi
661ctags: CTAGS
662CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
663 $(TAGS_FILES) $(LISP)
664 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
665 unique=`for i in $$list; do \
666 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
667 done | \
668 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
669 END { if (nonempty) { for (i in files) print i; }; }'`; \
670 test -z "$(CTAGS_ARGS)$$unique" \
671 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
672 $$unique
673
674GTAGS:
675 here=`$(am__cd) $(top_builddir) && pwd` \
676 && $(am__cd) $(top_srcdir) \
677 && gtags -i $(GTAGS_ARGS) "$$here"
678
679distclean-tags:
680 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
681
682distdir: $(DISTFILES)
683 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
684 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
685 list='$(DISTFILES)'; \
686 dist_files=`for file in $$list; do echo $$file; done | \
687 sed -e "s|^$$srcdirstrip/||;t" \
688 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
689 case $$dist_files in \
690 */*) $(MKDIR_P) `echo "$$dist_files" | \
691 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
692 sort -u` ;; \
693 esac; \
694 for file in $$dist_files; do \
695 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
696 if test -d $$d/$$file; then \
697 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
698 if test -d "$(distdir)/$$file"; then \
699 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
700 fi; \
701 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
702 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
703 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
704 fi; \
705 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
706 else \
707 test -f "$(distdir)/$$file" \
708 || cp -p $$d/$$file "$(distdir)/$$file" \
709 || exit 1; \
710 fi; \
711 done
712check-am: all-am
713check: check-am
714all-am: Makefile $(LTLIBRARIES) $(HEADERS)
715installdirs:
716 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
717 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
718 done
719install: install-am
720install-exec: install-exec-am
721install-data: install-data-am
722uninstall: uninstall-am
723
724install-am: all-am
725 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
726
727installcheck: installcheck-am
728install-strip:
729 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
730 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
731 `test -z '$(STRIP)' || \
732 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
733mostlyclean-generic:
734
735clean-generic:
736
737distclean-generic:
738 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
739 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
740
741maintainer-clean-generic:
742 @echo "This command is intended for maintainers to use"
743 @echo "it deletes files that may require special tools to rebuild."
744 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
745clean: clean-am
746
747clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
748 mostlyclean-am
749
750distclean: distclean-am
751 -rm -rf ./$(DEPDIR)
752 -rm -f Makefile
753distclean-am: clean-am distclean-compile distclean-generic \
754 distclean-tags
755
756dvi: dvi-am
757
758dvi-am:
759
760html: html-am
761
762html-am:
763
764info: info-am
765
766info-am:
767
768install-data-am: install-includesHEADERS
769
770install-dvi: install-dvi-am
771
772install-dvi-am:
773
774install-exec-am: install-libLTLIBRARIES
775
776install-html: install-html-am
777
778install-html-am:
779
780install-info: install-info-am
781
782install-info-am:
783
784install-man:
785
786install-pdf: install-pdf-am
787
788install-pdf-am:
789
790install-ps: install-ps-am
791
792install-ps-am:
793
794installcheck-am:
795
796maintainer-clean: maintainer-clean-am
797 -rm -rf ./$(DEPDIR)
798 -rm -f Makefile
799maintainer-clean-am: distclean-am maintainer-clean-generic
800
801mostlyclean: mostlyclean-am
802
803mostlyclean-am: mostlyclean-compile mostlyclean-generic \
804 mostlyclean-libtool
805
806pdf: pdf-am
807
808pdf-am:
809
810ps: ps-am
811
812ps-am:
813
814uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
815
816.MAKE: install-am install-strip
817
818.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
819 clean-libLTLIBRARIES clean-libtool ctags distclean \
820 distclean-compile distclean-generic distclean-libtool \
821 distclean-tags distdir dvi dvi-am html html-am info info-am \
822 install install-am install-data install-data-am install-dvi \
823 install-dvi-am install-exec install-exec-am install-html \
824 install-html-am install-includesHEADERS install-info \
825 install-info-am install-libLTLIBRARIES install-man install-pdf \
826 install-pdf-am install-ps install-ps-am install-strip \
827 installcheck installcheck-am installdirs maintainer-clean \
828 maintainer-clean-generic mostlyclean mostlyclean-compile \
829 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
830 tags uninstall uninstall-am uninstall-includesHEADERS \
831 uninstall-libLTLIBRARIES
832
833
834# Tell versions [3.59,3.63) of GNU make to not export all variables.
835# Otherwise a system limit (for SysV at least) may be exceeded.
836.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf.c
deleted file mode 100644
index 7cf8a4a..0000000
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf.c
+++ /dev/null
@@ -1,73 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#include <ecore_private.h>
7
8#include "Ecore_IMF.h"
9#include "ecore_imf_private.h"
10
11EAPI int ECORE_IMF_EVENT_PREEDIT_START = 0;
12EAPI int ECORE_IMF_EVENT_PREEDIT_END = 0;
13EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0;
14EAPI int ECORE_IMF_EVENT_COMMIT = 0;
15EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0;
16
17int _ecore_imf_log_dom = -1;
18static int _ecore_imf_init_count = 0;
19
20/**
21 * @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions
22 *
23 * Utility functions that set up and shut down the Ecore Input Method
24 * library.
25 */
26
27/**
28 * Initialises the Ecore_IMF library.
29 * @return Number of times the library has been initialised without being
30 * shut down.
31 * @ingroup Ecore_IMF_Lib_Group
32 */
33EAPI int
34ecore_imf_init(void)
35{
36 if (++_ecore_imf_init_count != 1) return _ecore_imf_init_count;
37
38 if (!ecore_init()) return --_ecore_imf_init_count;
39 _ecore_imf_log_dom = eina_log_domain_register
40 ("ecore_imf", ECORE_IMF_DEFAULT_LOG_COLOR);
41 if (_ecore_imf_log_dom < 0)
42 {
43 EINA_LOG_ERR("Impossible to create a log domain for the Ecore IMF module.");
44 ecore_shutdown();
45 return --_ecore_imf_init_count;
46 }
47 ecore_imf_module_init();
48
49 ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
50 ECORE_IMF_EVENT_PREEDIT_END = ecore_event_type_new();
51 ECORE_IMF_EVENT_PREEDIT_CHANGED = ecore_event_type_new();
52 ECORE_IMF_EVENT_COMMIT = ecore_event_type_new();
53 ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new();
54
55 return _ecore_imf_init_count;
56}
57
58/**
59 * Shuts down the Ecore_IMF library.
60 * @return Number of times the library has been initialised without being
61 * shut down.
62 * @ingroup Ecore_IMF_Lib_Group
63 */
64EAPI int
65ecore_imf_shutdown(void)
66{
67 if (--_ecore_imf_init_count != 0) return _ecore_imf_init_count;
68 ecore_imf_module_shutdown();
69 eina_log_domain_unregister(_ecore_imf_log_dom);
70 _ecore_imf_log_dom = -1;
71 ecore_shutdown();
72 return _ecore_imf_init_count;
73}
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
deleted file mode 100644
index 423c461..0000000
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
+++ /dev/null
@@ -1,1718 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <string.h>
7#include <locale.h>
8
9#include <Ecore.h>
10#include <ecore_private.h>
11
12#include "Ecore_IMF.h"
13#include "ecore_imf_private.h"
14
15/**
16 * @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions
17 *
18 * Functions that operate on Ecore Input Method Context objects.
19 */
20
21/**
22 * Get the list of the available Input Method Context ids.
23 *
24 * Note that the caller is responsible for freeing the Eina_List
25 * when finished with it. There is no need to finish the list strings.
26 *
27 * @return Return an Eina_List of strings;
28 * on failure it returns NULL.
29 * @ingroup Ecore_IMF_Context_Group
30 */
31EAPI Eina_List *
32ecore_imf_context_available_ids_get(void)
33{
34 return ecore_imf_module_context_ids_get();
35}
36
37EAPI Eina_List *
38ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
39{
40 return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
41}
42
43/*
44 * Match @locale against @against.
45 *
46 * 'en_US' against 'en_US' => 4
47 * 'en_US' against 'en' => 3
48 * 'en', 'en_UK' against 'en_US' => 2
49 * all locales, against '*' => 1
50 */
51static int
52_ecore_imf_context_match_locale(const char *locale, const char *against, int against_len)
53{
54 if (strcmp(against, "*") == 0)
55 return 1;
56
57 if (strcasecmp(locale, against) == 0)
58 return 4;
59
60 if (strncasecmp(locale, against, 2) == 0)
61 return (against_len == 2) ? 3 : 2;
62
63 return 0;
64}
65
66/**
67 * Get the id of the default Input Method Context.
68 * The id may to used to create a new instance of an Input Method
69 * Context object.
70 *
71 * @return Return a string containing the id of the default Input
72 * Method Context; on failure it returns NULL.
73 * @ingroup Ecore_IMF_Context_Group
74 */
75EAPI const char *
76ecore_imf_context_default_id_get(void)
77{
78 return ecore_imf_context_default_id_by_canvas_type_get(NULL);
79}
80
81EAPI const char *
82ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
83{
84 const char *id;
85 Eina_List *modules;
86 Ecore_IMF_Module *module;
87 char *locale;
88 char *tmp;
89 int best_goodness = 0;
90
91 id = getenv("ECORE_IMF_MODULE");
92 if (id)
93 {
94 if (strcmp(id, "none") == 0) return NULL;
95 if (ecore_imf_module_get(id)) return id;
96 }
97
98 modules = ecore_imf_module_available_get();
99 if (!modules) return NULL;
100
101 locale = setlocale(LC_CTYPE, NULL);
102 if (!locale) return NULL;
103
104 locale = strdup(locale);
105
106 tmp = strchr(locale, '.');
107 if (tmp) *tmp = '\0';
108 tmp = strchr(locale, '@');
109 if (tmp) *tmp = '\0';
110
111 id = NULL;
112
113 EINA_LIST_FREE(modules, module)
114 {
115 if (canvas_type &&
116 strcmp(module->info->canvas_type, canvas_type) == 0)
117 continue;
118
119 const char *p = module->info->default_locales;
120 while (p)
121 {
122 const char *q = strchr(p, ':');
123 int goodness = _ecore_imf_context_match_locale(locale, p, q ? (size_t)(q - p) : strlen (p));
124
125 if (goodness > best_goodness)
126 {
127 id = module->info->id;
128 best_goodness = goodness;
129 }
130
131 p = q ? q + 1 : NULL;
132 }
133 }
134
135 free(locale);
136 return id;
137}
138
139/**
140 * Retrieve the info for the Input Method Context with @p id.
141 *
142 * @param id The Input Method Context id to query for.
143 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id;
144 * on failure it returns NULL.
145 * @ingroup Ecore_IMF_Context_Group
146 *
147 * Example
148 * @code
149 *
150 * const char *ctx_id;
151 * const Ecore_IMF_Context_Info *ctx_info;
152 * Ecore_IMF_Context *imf_context;
153 * ctx_id = ecore_imf_context_default_id_get();
154 * if (ctx_id)
155 * {
156 * ctx_info = ecore_imf_context_info_by_id_get(ctx_id);
157 * if (!ctx_info->canvas_type ||
158 * strcmp(ctx_info->canvas_type, "evas") == 0)
159 * {
160 * imf_context = ecore_imf_context_add(ctx_id);
161 * }
162 * else
163 * {
164 * ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
165 * if (ctx_id)
166 * {
167 * imf_context = ecore_imf_context_add(ctx_id);
168 * }
169 * }
170 * }
171 * @endcode
172 */
173EAPI const Ecore_IMF_Context_Info *
174ecore_imf_context_info_by_id_get(const char *id)
175{
176 Ecore_IMF_Module *module;
177
178 if (!id) return NULL;
179 module = ecore_imf_module_get(id);
180 if (!module) return NULL;
181 return module->info;
182}
183
184/**
185 * Create a new Input Method Context defined by the given id.
186 *
187 * @param id The Input Method Context id.
188 * @return A newly allocated Input Method Context;
189 * on failure it returns NULL.
190 * @ingroup Ecore_IMF_Context_Group
191 */
192EAPI Ecore_IMF_Context *
193ecore_imf_context_add(const char *id)
194{
195 Ecore_IMF_Context *ctx;
196
197 if (!id) return NULL;
198 ctx = ecore_imf_module_context_create(id);
199 if (!ctx || !ctx->klass) return NULL;
200 if (ctx->klass->add) ctx->klass->add(ctx);
201 /* default use_preedit is EINA_TRUE, so let's make sure it's
202 * set on the immodule */
203 ecore_imf_context_use_preedit_set(ctx, EINA_TRUE);
204
205 /* default prediction is EINA_TRUE, so let's make sure it's
206 * set on the immodule */
207 ecore_imf_context_prediction_allow_set(ctx, EINA_TRUE);
208
209 /* default autocapital type is SENTENCE type, so let's make sure it's
210 * set on the immodule */
211 ecore_imf_context_autocapital_type_set(ctx, ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE);
212
213 /* default input panel enabled status is EINA_TRUE, so let's make sure it's
214 * set on the immodule */
215 ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE);
216
217 /* default input panel layout type is NORMAL type, so let's make sure it's
218 * set on the immodule */
219 ecore_imf_context_input_panel_layout_set(ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL);
220
221 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
222 * set on the immodule */
223 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
224 return ctx;
225}
226
227/**
228 * Retrieve the info for the given Input Method Context.
229 *
230 * @param ctx An #Ecore_IMF_Context.
231 * @return Return a #Ecore_IMF_Context_Info for the given Input Method Context;
232 * on failure it returns NULL.
233 * @ingroup Ecore_IMF_Context_Group
234 */
235EAPI const Ecore_IMF_Context_Info *
236ecore_imf_context_info_get(Ecore_IMF_Context *ctx)
237{
238 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
239 {
240 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
241 "ecore_imf_context_info_get");
242 return NULL;
243 }
244 return ctx->module->info;
245}
246
247/**
248 * Delete the given Input Method Context and free its memory.
249 *
250 * @param ctx An #Ecore_IMF_Context.
251 * @ingroup Ecore_IMF_Context_Group
252 */
253EAPI void
254ecore_imf_context_del(Ecore_IMF_Context *ctx)
255{
256 Ecore_IMF_Func_Node *fn;
257
258 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
259 {
260 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
261 "ecore_imf_context_del");
262 return;
263 }
264 if (ctx->klass->del) ctx->klass->del(ctx);
265
266 if (ctx->callbacks)
267 {
268 EINA_LIST_FREE(ctx->callbacks, fn)
269 free(fn);
270 }
271
272 ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE);
273 free(ctx);
274}
275
276/**
277 * Set the client window for the Input Method Context; this is the
278 * Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc.
279 * This window is used in order to correctly position status windows, and may
280 * also be used for purposes internal to the Input Method Context.
281 *
282 * @param ctx An #Ecore_IMF_Context.
283 * @param window The client window. This may be NULL to indicate
284 * that the previous client window no longer exists.
285 * @ingroup Ecore_IMF_Context_Group
286 */
287EAPI void
288ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
289{
290 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
291 {
292 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
293 "ecore_imf_context_client_window_set");
294 return;
295 }
296 if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window);
297 ctx->window = window;
298}
299
300/**
301 * Get the client window of the Input Method Context
302 *
303 * See @ref ecore_imf_context_client_window_set for more details.
304 *
305 * @param ctx An #Ecore_IMF_Context.
306 * @return Return the client window.
307 * @ingroup Ecore_IMF_Context_Group
308 * @since 1.1.0
309 */
310EAPI void *
311ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx)
312{
313 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
314 {
315 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
316 "ecore_imf_context_client_window_get");
317 return NULL;
318 }
319 return ctx->window;
320}
321
322/**
323 * Set the client canvas for the Input Method Context; this is the
324 * canvas in which the input appears.
325 * The canvas type can be determined by using the context canvas type.
326 * Actually only canvas with type "evas" (Evas *) is supported.
327 * This canvas may be used in order to correctly position status windows, and may
328 * also be used for purposes internal to the Input Method Context.
329 *
330 * @param ctx An #Ecore_IMF_Context.
331 * @param canvas The client canvas. This may be NULL to indicate
332 * that the previous client canvas no longer exists.
333 * @ingroup Ecore_IMF_Context_Group
334 */
335EAPI void
336ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
337{
338 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
339 {
340 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
341 "ecore_imf_context_client_canvas_set");
342 return;
343 }
344 if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas);
345 ctx->client_canvas = canvas;
346}
347
348/**
349 * Get the client canvas of the Input Method Context.
350 *
351 * See @ref ecore_imf_context_client_canvas_set for more details.
352 *
353 * @param ctx An #Ecore_IMF_Context.
354 * @return Return the client canvas.
355 * @ingroup Ecore_IMF_Context_Group
356 * @since 1.1.0
357 */
358EAPI void *
359ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx)
360{
361 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
362 {
363 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
364 "ecore_imf_context_client_canvas_get");
365 return NULL;
366 }
367 return ctx->client_canvas;
368}
369
370/**
371 * Ask the Input Method Context to show itself.
372 *
373 * @param ctx An #Ecore_IMF_Context.
374 * @ingroup Ecore_IMF_Context_Group
375 */
376EAPI void
377ecore_imf_context_show(Ecore_IMF_Context *ctx)
378{
379 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
380 {
381 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
382 "ecore_imf_context_show");
383 return;
384 }
385 if (ctx->klass->show) ctx->klass->show(ctx);
386}
387
388/**
389 * Ask the Input Method Context to hide itself.
390 *
391 * @param ctx An #Ecore_IMF_Context.
392 * @ingroup Ecore_IMF_Context_Group
393 */
394EAPI void
395ecore_imf_context_hide(Ecore_IMF_Context *ctx)
396{
397 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
398 {
399 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
400 "ecore_imf_context_hide");
401 return;
402 }
403 if (ctx->klass->hide) ctx->klass->hide(ctx);
404}
405
406/**
407 * Retrieve the current preedit string and cursor position
408 * for the Input Method Context.
409 *
410 * @param ctx An #Ecore_IMF_Context.
411 * @param str Location to store the retrieved string. The
412 * string retrieved must be freed with free().
413 * @param cursor_pos Location to store position of cursor (in characters)
414 * within the preedit string.
415 * @ingroup Ecore_IMF_Context_Group
416 */
417EAPI void
418ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos)
419{
420 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
421 {
422 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
423 "ecore_imf_context_preedit_string_get");
424 return;
425 }
426 if (ctx->klass->preedit_string_get)
427 ctx->klass->preedit_string_get(ctx, str, cursor_pos);
428 else
429 {
430 if (str) *str = strdup("");
431 if (cursor_pos) *cursor_pos = 0;
432 }
433}
434
435/**
436 * Retrieve the current preedit string, attributes and
437 * cursor position for the Input Method Context.
438 *
439 * @param ctx An #Ecore_IMF_Context.
440 * @param str Location to store the retrieved string. The
441 * string retrieved must be freed with free().
442 * @param attrs an Eina_List of attributes
443 * @param cursor_pos Location to store position of cursor (in characters)
444 * within the preedit string.
445 * @ingroup Ecore_IMF_Context_Group
446 *
447 * Example
448 * @code
449 * char *preedit_string;
450 * int cursor_pos;
451 * Eina_List *attrs = NULL, *l = NULL;
452 * Ecore_IMF_Preedit_Attr *attr;
453 *
454 * ecore_imf_context_preedit_string_with_attributes_get(imf_context,
455 * &preedit_string,
456 * &attrs, &cursor_pos);
457 * if (!preedit_string) return;
458 *
459 * if (strlen(preedit_string) > 0)
460 * {
461 * if (attrs)
462 * {
463 * EINA_LIST_FOREACH(attrs, l, attr)
464 * {
465 * if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1)
466 * {
467 * // Something to do
468 * }
469 * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2)
470 * {
471 * // Something to do
472 * }
473 * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3)
474 * {
475 * // Something to do
476 * }
477 * }
478 * }
479 * }
480 *
481 * // delete attribute list
482 * if (attrs)
483 * {
484 * EINA_LIST_FREE(attrs, attr) free(attr);
485 * }
486 *
487 * free(preedit_string);
488 * @endcode
489 * @since 1.1.0
490 */
491EAPI void
492ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos)
493{
494 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
495 {
496 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
497 "ecore_imf_context_preedit_string_with_attributes_get");
498 return;
499 }
500 if (ctx->klass->preedit_string_with_attributes_get)
501 ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos);
502 else
503 {
504 if (str) *str = strdup("");
505 if (attrs) *attrs = NULL;
506 if (cursor_pos) *cursor_pos = 0;
507 }
508}
509
510/**
511 * Notify the Input Method Context that the widget to which its
512 * correspond has gained focus.
513 *
514 * @param ctx An #Ecore_IMF_Context.
515 * @ingroup Ecore_IMF_Context_Group
516 *
517 * Example
518 * @code
519 * static void
520 * _focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source)
521 * {
522 * ecore_imf_context_reset(imf_context);
523 * ecore_imf_context_focus_in(imf_context);
524 * }
525 *
526 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _focus_in_cb, ed);
527 * @endcode
528 */
529EAPI void
530ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
531{
532 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
533 {
534 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
535 "ecore_imf_context_focus_in");
536 return;
537 }
538 if (ctx->klass->focus_in) ctx->klass->focus_in(ctx);
539}
540
541/**
542 * Notify the Input Method Context that the widget to which its
543 * correspond has lost focus.
544 *
545 * @param ctx An #Ecore_IMF_Context.
546 * @ingroup Ecore_IMF_Context_Group
547 *
548 * Example
549 * @code
550 * static void
551 * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source)
552 * {
553 * ecore_imf_context_reset(imf_context);
554 * ecore_imf_context_focus_out(imf_context);
555 * }
556 *
557 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed);
558 * @endcode
559 */
560EAPI void
561ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
562{
563 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
564 {
565 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
566 "ecore_imf_context_focus_out");
567 return;
568 }
569 if (ctx->klass->focus_out) ctx->klass->focus_out(ctx);
570}
571
572/**
573 * Notify the Input Method Context that a change such as a
574 * change in cursor position has been made. This will typically
575 * cause the Input Method Context to clear the preedit state.
576 *
577 * @param ctx An #Ecore_IMF_Context.
578 * @ingroup Ecore_IMF_Context_Group
579 *
580 * Example
581 * @code
582 * static void
583 * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source)
584 * {
585 * ecore_imf_context_reset(imf_context);
586 * ecore_imf_context_focus_out(imf_context);
587 * }
588 *
589 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed);
590 * @endcode
591 */
592EAPI void
593ecore_imf_context_reset(Ecore_IMF_Context *ctx)
594{
595 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
596 {
597 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
598 "ecore_imf_context_reset");
599 return;
600 }
601 if (ctx->klass->reset) ctx->klass->reset(ctx);
602}
603
604/**
605 * Notify the Input Method Context that a change in the cursor
606 * position has been made.
607 *
608 * @param ctx An #Ecore_IMF_Context.
609 * @param cursor_pos New cursor position in characters.
610 * @ingroup Ecore_IMF_Context_Group
611 */
612EAPI void
613ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
614{
615 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
616 {
617 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
618 "ecore_imf_context_cursor_position_set");
619 return;
620 }
621 if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos);
622}
623
624/**
625 * Notify the Input Method Context that a change in the cursor
626 * location has been made. The location is relative to the canvas.
627 * The cursor location can be used to determine the position of
628 * candidate word window in the immodule.
629 *
630 * @param ctx An #Ecore_IMF_Context.
631 * @param x cursor x position.
632 * @param y cursor y position.
633 * @param w cursor width.
634 * @param h cursor height.
635 * @ingroup Ecore_IMF_Context_Group
636 * @since 1.1.0
637 */
638EAPI void
639ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
640{
641 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
642 {
643 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
644 "ecore_imf_context_cursor_location_set");
645 return;
646 }
647 if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h);
648}
649
650/**
651 * Set whether the IM context should use the preedit string
652 * to display feedback. If @c use_preedit is EINA_FALSE (default
653 * is EINA_TRUE), then the IM context may use some other method to display
654 * feedback, such as displaying it in a child of the root window.
655 *
656 * @param ctx An #Ecore_IMF_Context.
657 * @param use_preedit Whether the IM context should use the preedit string.
658 * @ingroup Ecore_IMF_Context_Group
659 */
660EAPI void
661ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit)
662{
663 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
664 {
665 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
666 "ecore_imf_context_use_preedit_set");
667 return;
668 }
669 if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit);
670}
671
672/**
673 * Set whether the IM context should allow to use the text prediction.
674 * If @c prediction is EINA_FALSE (default is EINA_TRUE), then the IM context will not display the text prediction window.
675 *
676 * @param ctx An #Ecore_IMF_Context.
677 * @param prediction Whether the IM context should allow to use the text prediction.
678 * @ingroup Ecore_IMF_Context_Group
679 * @since 1.1.0
680 */
681EAPI void
682ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction)
683{
684 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
685 {
686 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
687 "ecore_imf_context_prediction_allow_set");
688 return;
689 }
690
691 ctx->allow_prediction = prediction;
692
693 if (ctx->klass->prediction_allow_set)
694 ctx->klass->prediction_allow_set(ctx, prediction);
695}
696
697/**
698 * Get whether the IM context should allow to use the text prediction.
699 *
700 * @param ctx An #Ecore_IMF_Context.
701 * @return EINA_TRUE if it allows to use the text prediction, otherwise EINA_FALSE.
702 * @ingroup Ecore_IMF_Context_Group
703 * @since 1.1.0
704 */
705EAPI Eina_Bool
706ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx)
707{
708 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
709 {
710 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
711 "ecore_imf_context_prediction_allow_get");
712 return EINA_FALSE;
713 }
714
715 return ctx->allow_prediction;
716}
717
718/**
719 * Set the autocapitalization type on the immodule.
720 *
721 * @param ctx An #Ecore_IMF_Context.
722 * @param autocapital_type the autocapitalization type.
723 * @ingroup Ecore_IMF_Context_Group
724 * @since 1.1.0
725 */
726EAPI void
727ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type)
728{
729 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
730 {
731 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
732 "ecore_imf_context_autocapital_type_set");
733 return;
734 }
735
736 ctx->autocapital_type = autocapital_type;
737
738 if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type);
739}
740
741/**
742 * Get the autocapitalization type.
743 *
744 * @param ctx An #Ecore_IMF_Context.
745 * @return The autocapital type being used by @p ctx.
746 * @ingroup Ecore_IMF_Context_Group
747 * @since 1.1.0
748 */
749EAPI Ecore_IMF_Autocapital_Type
750ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx)
751{
752 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
753 {
754 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
755 "ecore_imf_context_autocapital_allow_get");
756 return ECORE_IMF_AUTOCAPITAL_TYPE_NONE;
757 }
758
759 return ctx->autocapital_type;
760}
761
762/**
763 * Set the callback to be used on get_surrounding request.
764 *
765 * This callback will be called when the Input Method Context
766 * module requests the surrounding context.
767 *
768 * @param ctx An #Ecore_IMF_Context.
769 * @param func The callback to be called.
770 * @param data The data pointer to be passed to @p func
771 * @ingroup Ecore_IMF_Context_Group
772 */
773EAPI void
774ecore_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)
775{
776 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
777 {
778 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
779 "ecore_imf_context_retrieve_surrounding_callback_set");
780 return;
781 }
782
783 ctx->retrieve_surrounding_func = func;
784 ctx->retrieve_surrounding_data = (void *) data;
785}
786
787/**
788 * Set the input mode used by the Ecore Input Context.
789 *
790 * The input mode can be one of the input modes defined in
791 * #Ecore_IMF_Input_Mode. The default input mode is
792 * ECORE_IMF_INPUT_MODE_FULL.
793 *
794 * @param ctx An #Ecore_IMF_Context.
795 * @param input_mode The input mode to be used by @p ctx.
796 * @ingroup Ecore_IMF_Context_Group
797 */
798EAPI void
799ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
800{
801 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
802 {
803 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
804 "ecore_imf_context_input_mode_set");
805 return;
806 }
807 if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode);
808 ctx->input_mode = input_mode;
809}
810
811/**
812 * Get the input mode being used by the Ecore Input Context.
813 *
814 * See @ref ecore_imf_context_input_mode_set for more details.
815 *
816 * @param ctx An #Ecore_IMF_Context.
817 * @return The input mode being used by @p ctx.
818 * @ingroup Ecore_IMF_Context_Group
819 */
820EAPI Ecore_IMF_Input_Mode
821ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
822{
823 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
824 {
825 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
826 "ecore_imf_context_input_mode_set");
827 return 0;
828 }
829 return ctx->input_mode;
830}
831
832/**
833 * Allow an Ecore Input Context to internally handle an event.
834 * If this function returns EINA_TRUE, then no further processing
835 * should be done for this event.
836 *
837 * Input methods must be able to accept all types of events (simply
838 * returning EINA_FALSE if the event was not handled), but there is no
839 * obligation of any events to be submitted to this function.
840 *
841 * @param ctx An #Ecore_IMF_Context.
842 * @param type The type of event defined by #Ecore_IMF_Event_Type.
843 * @param event The event itself.
844 * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE.
845 * @ingroup Ecore_IMF_Context_Group
846 *
847 * Example
848 * @code
849 * static void
850 * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
851 * {
852 * Evas_Event_Key_Down *ev = event_info;
853 * if (!ev->keyname) return;
854 *
855 * if (imf_context)
856 * {
857 * Ecore_IMF_Event_Key_Down ecore_ev;
858 * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
859 * if (ecore_imf_context_filter_event(imf_context,
860 * ECORE_IMF_EVENT_KEY_DOWN,
861 * (Ecore_IMF_Event *)&ecore_ev))
862 * return;
863 * }
864 * }
865 *
866 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data);
867 * @endcode
868 */
869EAPI Eina_Bool
870ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
871{
872 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
873 {
874 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
875 "ecore_imf_context_filter_event");
876 return EINA_FALSE;
877 }
878 if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event);
879 return EINA_FALSE;
880}
881
882/**
883 * @defgroup Ecore_IMF_Context_Module_Group Ecore Input Method Context Module Functions
884 *
885 * Functions that should be used by Ecore Input Method Context modules.
886 */
887
888/**
889 * Creates a new Input Method Context with klass specified by @p ctxc.
890 *
891 * This method should be used by modules implementing the Input
892 * Method Context interface.
893 *
894 * @param ctxc An #Ecore_IMF_Context_Class.
895 * @return A new #Ecore_IMF_Context; on failure it returns NULL.
896 * @ingroup Ecore_IMF_Context_Module_Group
897 */
898EAPI Ecore_IMF_Context *
899ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc)
900{
901 Ecore_IMF_Context *ctx;
902
903 if (!ctxc) return NULL;
904 ctx = calloc(1, sizeof(Ecore_IMF_Context));
905 if (!ctx) return NULL;
906 ECORE_MAGIC_SET(ctx, ECORE_MAGIC_CONTEXT);
907 ctx->klass = ctxc;
908 ctx->data = NULL;
909 ctx->retrieve_surrounding_func = NULL;
910 ctx->retrieve_surrounding_data = NULL;
911 return ctx;
912}
913
914/**
915 * Set the Input Method Context specific data.
916 *
917 * Note that this method should be used by modules to set
918 * the Input Method Context specific data and it's not meant to
919 * be used by applications to store application specific data.
920 *
921 * @param ctx An #Ecore_IMF_Context.
922 * @param data The Input Method Context specific data.
923 * @return A new #Ecore_IMF_Context; on failure it returns NULL.
924 * @ingroup Ecore_IMF_Context_Module_Group
925 */
926EAPI void
927ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data)
928{
929 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
930 {
931 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
932 "ecore_imf_context_data_set");
933 return;
934 }
935 ctx->data = data;
936}
937
938/**
939 * Get the Input Method Context specific data.
940 *
941 * See @ref ecore_imf_context_data_set for more details.
942 *
943 * @param ctx An #Ecore_IMF_Context.
944 * @return The Input Method Context specific data.
945 * @ingroup Ecore_IMF_Context_Module_Group
946 */
947EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx)
948{
949 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
950 {
951 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
952 "ecore_imf_context_data_get");
953 return NULL;
954 }
955 return ctx->data;
956}
957
958/**
959 * Retrieve context around insertion point.
960 *
961 * This function is implemented by calling the
962 * Ecore_IMF_Context::retrieve_surrounding_func (
963 * set using #ecore_imf_context_retrieve_surrounding_callback_set).
964 *
965 * There is no obligation for a widget to respond to the
966 * ::retrieve_surrounding_func, so input methods must be prepared
967 * to function without context.
968 *
969 * @param ctx An #Ecore_IMF_Context.
970 * @param text Location to store a UTF-8 encoded string of text
971 * holding context around the insertion point.
972 * If the function returns EINA_TRUE, then you must free
973 * the result stored in this location with free().
974 * @param cursor_pos Location to store the position in characters of
975 * the insertion cursor within @p text.
976 * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE.
977 * @ingroup Ecore_IMF_Context_Module_Group
978 */
979EAPI Eina_Bool
980ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos)
981{
982 int result = EINA_FALSE;
983
984 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
985 {
986 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
987 "ecore_imf_context_surrounding_get");
988 return EINA_FALSE;
989 }
990
991 if (ctx->retrieve_surrounding_func)
992 {
993 result = ctx->retrieve_surrounding_func(ctx->retrieve_surrounding_data, ctx, text, cursor_pos);
994 if (!result)
995 {
996 if (text) *text = NULL;
997 if (cursor_pos) *cursor_pos = 0;
998 }
999 }
1000 return result;
1001}
1002
1003static void
1004_ecore_imf_event_free_preedit(void *data __UNUSED__, void *event)
1005{
1006 free(event);
1007}
1008
1009/**
1010 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue.
1011 *
1012 * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts.
1013 * It's asynchronous method to put event to the event queue.
1014 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1015 *
1016 * @param ctx An #Ecore_IMF_Context.
1017 * @ingroup Ecore_IMF_Context_Module_Group
1018 */
1019EAPI void
1020ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
1021{
1022 Ecore_IMF_Event_Commit *ev;
1023
1024 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1025 {
1026 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1027 "ecore_imf_context_preedit_start_event_add");
1028 return;
1029 }
1030
1031 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Start));
1032 ev->ctx = ctx;
1033 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_START,
1034 ev, _ecore_imf_event_free_preedit, NULL);
1035}
1036
1037/**
1038 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue.
1039 *
1040 * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled.
1041 * It's asynchronous method to put event to the event queue.
1042 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1043 *
1044 * @param ctx An #Ecore_IMF_Context.
1045 * @ingroup Ecore_IMF_Context_Module_Group
1046 */
1047EAPI void
1048ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
1049{
1050 Ecore_IMF_Event_Commit *ev;
1051
1052 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1053 {
1054 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1055 "ecore_imf_context_preedit_end_event_add");
1056 return;
1057 }
1058
1059 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_End));
1060 ev->ctx = ctx;
1061 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_END,
1062 ev, _ecore_imf_event_free_preedit, NULL);
1063}
1064
1065/**
1066 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue.
1067 *
1068 * It's asynchronous method to put event to the event queue.
1069 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1070 *
1071 * @param ctx An #Ecore_IMF_Context.
1072 * @ingroup Ecore_IMF_Context_Module_Group
1073 */
1074EAPI void
1075ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx)
1076{
1077 Ecore_IMF_Event_Commit *ev;
1078
1079 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1080 {
1081 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1082 "ecore_imf_context_preedit_changed_event_add");
1083 return;
1084 }
1085
1086 ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Changed));
1087 ev->ctx = ctx;
1088 ecore_event_add(ECORE_IMF_EVENT_PREEDIT_CHANGED,
1089 ev, _ecore_imf_event_free_preedit, NULL);
1090}
1091
1092static void
1093_ecore_imf_event_free_commit(void *data __UNUSED__, void *event)
1094{
1095 Ecore_IMF_Event_Commit *ev;
1096
1097 ev = event;
1098 if (ev->str) free(ev->str);
1099 free(ev);
1100}
1101
1102/**
1103 * Adds ECORE_IMF_EVENT_COMMIT to the event queue.
1104 *
1105 * It's asynchronous method to put event to the event queue.
1106 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1107 *
1108 * @param ctx An #Ecore_IMF_Context.
1109 * @param str The committed string.
1110 * @ingroup Ecore_IMF_Context_Module_Group
1111 */
1112EAPI void
1113ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str)
1114{
1115 Ecore_IMF_Event_Commit *ev;
1116
1117 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1118 {
1119 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1120 "ecore_imf_context_commit_event_add");
1121 return;
1122 }
1123
1124 ev = malloc(sizeof(Ecore_IMF_Event_Commit));
1125 ev->ctx = ctx;
1126 ev->str = str ? strdup(str) : NULL;
1127 ecore_event_add(ECORE_IMF_EVENT_COMMIT,
1128 ev, _ecore_imf_event_free_commit, NULL);
1129
1130}
1131
1132static void
1133_ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event)
1134{
1135 free(event);
1136}
1137
1138/**
1139 * Adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
1140 *
1141 * Asks the widget that the input context is attached to to delete characters around the cursor position
1142 * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
1143 * Note that offset and n_chars are in characters not in bytes.
1144 *
1145 * It's asynchronous method to put ECORE_IMF_EVENT_DELETE_SURROUNDING event to the event queue.
1146 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1147 *
1148 * @param ctx An #Ecore_IMF_Context.
1149 * @param offset The start offset of surrounding to be deleted.
1150 * @param n_chars The number of characters to be deleted.
1151 * @ingroup Ecore_IMF_Context_Module_Group
1152 */
1153EAPI void
1154ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars)
1155{
1156 Ecore_IMF_Event_Delete_Surrounding *ev;
1157
1158 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1159 {
1160 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1161 "ecore_imf_context_delete_surrounding_event_add");
1162 return;
1163 }
1164
1165 ev = malloc(sizeof(Ecore_IMF_Event_Delete_Surrounding));
1166 ev->ctx = ctx;
1167 ev->offset = offset;
1168 ev->n_chars = n_chars;
1169 ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING,
1170 ev, _ecore_imf_event_free_delete_surrounding, NULL);
1171}
1172
1173/**
1174 * Add (register) a callback function to a given context event.
1175 *
1176 * This function adds a function callback to the context @p ctx when the
1177 * event of type @p type occurs on it. The function pointer is @p
1178 * func.
1179 *
1180 * The event type @p type to trigger the function may be one of
1181 * #ECORE_IMF_CALLBACK_PREEDIT_START, #ECORE_IMF_CALLBACK_PREEDIT_END,
1182 * #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT and
1183 * #ECORE_IMF_CALLBACK_DELETE_SURROUNDING.
1184 *
1185 * @param ctx Ecore_IMF_Context to attach a callback to.
1186 * @param type The type of event that will trigger the callback
1187 * @param func The (callback) function to be called when the event is
1188 * triggered
1189 * @param data The data pointer to be passed to @p func
1190 * @ingroup Ecore_IMF_Context_Group
1191 * @since 1.2.0
1192 *
1193 * Example
1194 * @code
1195 * static void
1196 * _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
1197 * {
1198 * char *commit_str = event_info;
1199 * // something to do
1200 * }
1201 *
1202 * ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data);
1203 * @endcode
1204 */
1205EAPI void
1206ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data)
1207{
1208 Ecore_IMF_Func_Node *fn = NULL;
1209
1210 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1211 {
1212 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1213 "ecore_imf_context_event_callback_add");
1214 return;
1215 }
1216
1217 if (!func) return;
1218
1219 fn = calloc(1, sizeof (Ecore_IMF_Func_Node));
1220 if (!fn) return;
1221
1222 fn->func = func;
1223 fn->data = data;
1224 fn->type = type;
1225
1226 ctx->callbacks = eina_list_append(ctx->callbacks, fn);
1227}
1228
1229/**
1230 * Delete (unregister) a callback function registered to a given
1231 * context event.
1232 *
1233 * This function removes a function callback from the context @p ctx when the
1234 * event of type @p type occurs on it. The function pointer is @p
1235 * func.
1236 *
1237 * @see ecore_imf_context_event_callback_add() for more details
1238 *
1239 * @param ctx Ecore_IMF_Context to remove a callback from.
1240 * @param type The type of event that was triggering the callback
1241 * @param func The (callback) function that was to be called when the event was triggered
1242 * @return the data pointer
1243 * @ingroup Ecore_IMF_Context_Group
1244 * @since 1.2.0
1245 */
1246EAPI void *
1247ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func)
1248{
1249 Eina_List *l = NULL;
1250 Eina_List *l_next = NULL;
1251 Ecore_IMF_Func_Node *fn = NULL;
1252
1253 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1254 {
1255 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1256 "ecore_imf_context_event_callback_del");
1257 return NULL;
1258 }
1259
1260 if (!func) return NULL;
1261 if (!ctx->callbacks) return NULL;
1262
1263 EINA_LIST_FOREACH_SAFE(ctx->callbacks, l, l_next, fn)
1264 {
1265 if ((fn) && (fn->func == func) && (fn->type == type))
1266 {
1267 void *tmp = (void *)fn->data;
1268 free(fn);
1269 ctx->callbacks = eina_list_remove_list(ctx->callbacks, l);
1270 return tmp;
1271 }
1272 }
1273 return NULL;
1274}
1275
1276/**
1277 * Call a given callback on the context @p ctx.
1278 *
1279 * ecore_imf_context_preedit_start_event_add, ecore_imf_context_preedit_end_event_add,
1280 * ecore_imf_context_preedit_changed_event_add, ecore_imf_context_commit_event_add and
1281 * ecore_imf_context_delete_surrounding_event_add APIs are asynchronous
1282 * because those API adds each event to the event queue.
1283 *
1284 * This API provides the way to call each callback function immediately.
1285 *
1286 * @param ctx Ecore_IMF_Context.
1287 * @param type The type of event that will trigger the callback
1288 * @param event_info The pointer to event specific struct or information to
1289 * pass to the callback functions registered on this event
1290 * @ingroup Ecore_IMF_Context_Module_Group
1291 * @since 1.2.0
1292 */
1293EAPI void
1294ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info)
1295{
1296 Ecore_IMF_Func_Node *fn = NULL;
1297 Eina_List *l = NULL;
1298
1299 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1300 {
1301 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1302 "ecore_imf_context_event_callback_call");
1303 return;
1304 }
1305
1306 EINA_LIST_FOREACH(ctx->callbacks, l, fn)
1307 {
1308 if ((fn) && (fn->type == type) && (fn->func))
1309 fn->func(fn->data, ctx, event_info);
1310 }
1311}
1312
1313/**
1314 * Ask the Input Method Context to show the control panel of using Input Method.
1315 *
1316 * @param ctx An #Ecore_IMF_Context.
1317 * @ingroup Ecore_IMF_Context_Group
1318 * @since 1.1.0
1319 */
1320EAPI void
1321ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx)
1322{
1323 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1324 {
1325 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1326 "ecore_imf_context_control_panel_show");
1327 return;
1328 }
1329
1330 if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx);
1331}
1332
1333/**
1334 * Ask the Input Method Context to hide the control panel of using Input Method.
1335 *
1336 * @param ctx An #Ecore_IMF_Context.
1337 * @ingroup Ecore_IMF_Context_Group
1338 * @since 1.1.0
1339 */
1340EAPI void
1341ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx)
1342{
1343 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1344 {
1345 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1346 "ecore_imf_context_control_panel_hide");
1347 return;
1348 }
1349
1350 if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx);
1351}
1352
1353/**
1354 * Ask the Input Method Context to show the input panel (virtual keyboard).
1355 *
1356 * @param ctx An #Ecore_IMF_Context.
1357 * @ingroup Ecore_IMF_Context_Group
1358 * @since 1.1.0
1359 */
1360EAPI void
1361ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
1362{
1363 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1364 {
1365 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1366 "ecore_imf_context_input_panel_show");
1367 return;
1368 }
1369
1370 if (ctx->klass->show) ctx->klass->show(ctx);
1371}
1372
1373/**
1374 * Ask the Input Method Context to hide the input panel.
1375 *
1376 * @param ctx An #Ecore_IMF_Context.
1377 * @ingroup Ecore_IMF_Context_Group
1378 * @since 1.1.0
1379 */
1380EAPI void
1381ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
1382{
1383 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1384 {
1385 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1386 "ecore_imf_context_input_panel_hide");
1387 return;
1388 }
1389
1390 if (ctx->klass->hide) ctx->klass->hide(ctx);
1391}
1392
1393/**
1394 * Set the layout of the input panel.
1395 *
1396 * @param ctx An #Ecore_IMF_Context.
1397 * @param layout see #Ecore_IMF_Input_Panel_Layout
1398 * @ingroup Ecore_IMF_Context_Group
1399 * @since 1.1.0
1400 */
1401EAPI void
1402ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
1403{
1404 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1405 {
1406 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1407 "ecore_imf_context_input_panel_layout_set");
1408 return;
1409 }
1410
1411 if (ctx->klass->input_panel_layout_set)
1412 ctx->klass->input_panel_layout_set(ctx, layout);
1413
1414 ctx->input_panel_layout = layout;
1415}
1416
1417/**
1418 * Get the layout of the current active input panel.
1419 *
1420 * @param ctx An #Ecore_IMF_Context.
1421 * @return layout see #Ecore_IMF_Input_Panel_Layout
1422 * @ingroup Ecore_IMF_Context_Group
1423 * @since 1.1.0
1424 */
1425EAPI Ecore_IMF_Input_Panel_Layout
1426ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx)
1427{
1428 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1429 {
1430 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1431 "ecore_imf_context_input_panel_layout_get");
1432 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
1433 }
1434
1435 if (ctx->klass->input_panel_layout_get)
1436 return ctx->input_panel_layout;
1437 else
1438 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
1439}
1440
1441/**
1442 * Set the language of the input panel.
1443 * This API can be used when you want to show the English keyboard.
1444 *
1445 * @param ctx An #Ecore_IMF_Context.
1446 * @param lang the language to be set to the input panel.
1447 * @ingroup Ecore_IMF_Context_Group
1448 * @since 1.1.0
1449 */
1450EAPI void
1451ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
1452{
1453 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1454 {
1455 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1456 "ecore_imf_context_input_panel_language_set");
1457 return;
1458 }
1459
1460 if (ctx->klass->input_panel_language_set) ctx->klass->input_panel_language_set(ctx, lang);
1461 ctx->input_panel_lang = lang;
1462}
1463
1464/**
1465 * Get the language of the input panel.
1466 *
1467 * See @ref ecore_imf_context_input_panel_language_set for more details.
1468 *
1469 * @param ctx An #Ecore_IMF_Context.
1470 * @return Ecore_IMF_Input_Panel_Lang
1471 * @ingroup Ecore_IMF_Context_Group
1472 * @since 1.1.0
1473 */
1474EAPI Ecore_IMF_Input_Panel_Lang
1475ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx)
1476{
1477 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1478 {
1479 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1480 "ecore_imf_context_input_panel_language_get");
1481 return ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC;
1482 }
1483
1484 return ctx->input_panel_lang;
1485}
1486
1487/**
1488 * Set whether the Input Method Context should request to show the input panel automatically
1489 * when the widget has focus.
1490 *
1491 * @param ctx An #Ecore_IMF_Context.
1492 * @param enabled If true, the input panel will be shown when the widget is clicked or has focus.
1493 * @ingroup Ecore_IMF_Context_Group
1494 * @since 1.1.0
1495 */
1496EAPI void
1497ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx,
1498 Eina_Bool enabled)
1499{
1500 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1501 {
1502 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1503 "ecore_imf_context_input_panel_enabled_set");
1504 return;
1505 }
1506
1507 ctx->input_panel_enabled = enabled;
1508}
1509
1510/**
1511 * Get whether the Input Method Context requests to show the input panel automatically.
1512 *
1513 * @param ctx An #Ecore_IMF_Context.
1514 * @return Return the attribute to show the input panel automatically
1515 * @ingroup Ecore_IMF_Context_Group
1516 * @since 1.1.0
1517 */
1518EAPI Eina_Bool
1519ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx)
1520{
1521 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1522 {
1523 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1524 "ecore_imf_context_input_panel_enabled_get");
1525 return EINA_FALSE;
1526 }
1527
1528 return ctx->input_panel_enabled;
1529}
1530
1531/**
1532 * Set the input panel-specific data to deliver to the input panel.
1533 * This API is used by applications to deliver specific data to the input panel.
1534 * The data format MUST be negotiated by both application and the input panel.
1535 * The size and format of data are defined by the input panel.
1536 *
1537 * @param ctx An #Ecore_IMF_Context.
1538 * @param data The specific data to be set to the input panel.
1539 * @param len the length of data, in bytes, to send to the input panel
1540 * @ingroup Ecore_IMF_Context_Group
1541 * @since 1.2.0
1542 */
1543EAPI void
1544ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len)
1545{
1546 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1547 {
1548 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1549 "ecore_imf_context_input_panel_imdata_set");
1550 return;
1551 }
1552
1553 if (!data) return;
1554
1555 if (ctx->klass->input_panel_imdata_set)
1556 ctx->klass->input_panel_imdata_set(ctx, data, len);
1557}
1558
1559/**
1560 * Get the specific data of the current active input panel.
1561 *
1562 * @param ctx An #Ecore_IMF_Context.
1563 * @param data The specific data to be got from the input panel
1564 * @param len The length of data
1565 * @ingroup Ecore_IMF_Context_Group
1566 * @since 1.2.0
1567 */
1568EAPI void
1569ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len)
1570{
1571 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1572 {
1573 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1574 "ecore_imf_context_input_panel_imdata_get");
1575 return;
1576 }
1577
1578 if (!data) return;
1579
1580 if (ctx->klass->input_panel_imdata_get)
1581 ctx->klass->input_panel_imdata_get(ctx, data, len);
1582}
1583
1584/**
1585 * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel.
1586 *
1587 * An input panel displays the string or icon associated with this type
1588 *
1589 * @param ctx An #Ecore_IMF_Context.
1590 * @param return_key_type The type of "return" key on the input panel
1591 * @ingroup Ecore_IMF_Context_Group
1592 * @since 1.2.0
1593 */
1594EAPI void
1595ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type)
1596{
1597 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1598 {
1599 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1600 "ecore_imf_context_input_panel_return_key_type_set");
1601 return;
1602 }
1603
1604 ctx->input_panel_return_key_type = return_key_type;
1605 if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type);
1606}
1607
1608/**
1609 * Get the "return" key type.
1610 *
1611 * @see ecore_imf_context_input_panel_return_key_type_set() for more details
1612 *
1613 * @param ctx An #Ecore_IMF_Context.
1614 * @return The type of "return" key on the input panel
1615 * @ingroup Ecore_IMF_Context_Group
1616 * @since 1.2.0
1617 */
1618EAPI Ecore_IMF_Input_Panel_Return_Key_Type
1619ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx)
1620{
1621 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1622 {
1623 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1624 "ecore_imf_context_input_panel_return_key_type_get");
1625 return EINA_FALSE;
1626 }
1627
1628 return ctx->input_panel_return_key_type;
1629}
1630
1631/**
1632 * Set the return key on the input panel to be disabled.
1633 *
1634 * @param ctx An #Ecore_IMF_Context.
1635 * @param disabled The state
1636 * @ingroup Ecore_IMF_Context_Group
1637 * @since 1.2.0
1638 */
1639EAPI void
1640ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled)
1641{
1642 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1643 {
1644 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1645 "ecore_imf_context_input_panel_return_key_disabled_set");
1646 return;
1647 }
1648
1649 ctx->input_panel_return_key_disabled = disabled;
1650 if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled);
1651}
1652
1653/**
1654 * Get whether the return key on the input panel should be disabled or not.
1655 *
1656 * @param ctx An #Ecore_IMF_Context.
1657 * @return EINA_TRUE if it should be disabled
1658 * @ingroup Ecore_IMF_Context_Group
1659 * @since 1.2.0
1660 */
1661EAPI Eina_Bool
1662ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx)
1663{
1664 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1665 {
1666 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1667 "ecore_imf_context_input_panel_return_key_disabled_get");
1668 return EINA_FALSE;
1669 }
1670
1671 return ctx->input_panel_return_key_disabled;
1672}
1673
1674/**
1675 * Set the caps lock mode on the input panel.
1676 *
1677 * @param ctx An #Ecore_IMF_Context.
1678 * @param mode Turn on caps lock on the input panel if EINA_TRUE
1679 * @ingroup Ecore_IMF_Context_Group
1680 * @since 1.2.0
1681 */
1682EAPI void
1683ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode)
1684{
1685 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1686 {
1687 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1688 "ecore_imf_context_input_panel_caps_lock_mode_set");
1689 return;
1690 }
1691
1692 if (ctx->klass->input_panel_caps_lock_mode_set)
1693 ctx->klass->input_panel_caps_lock_mode_set(ctx, mode);
1694
1695 ctx->input_panel_caps_lock_mode = mode;
1696}
1697
1698/**
1699 * Get the caps lock mode on the input panel.
1700 *
1701 * @param ctx An #Ecore_IMF_Context.
1702 * @return EINA_TRUE if the caps lock is turned on.
1703 * @ingroup Ecore_IMF_Context_Group
1704 * @since 1.2.0
1705 */
1706EAPI Eina_Bool
1707ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx)
1708{
1709 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1710 {
1711 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1712 "ecore_imf_context_input_panel_caps_lock_mode_get");
1713 return EINA_FALSE;
1714 }
1715
1716 return ctx->input_panel_caps_lock_mode;
1717}
1718
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c
deleted file mode 100644
index 946f5bc..0000000
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c
+++ /dev/null
@@ -1,212 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <limits.h>
9
10#include <Ecore.h>
11#include <ecore_private.h>
12
13#include "Ecore_IMF.h"
14#include "ecore_imf_private.h"
15
16static void _ecore_imf_module_free(Ecore_IMF_Module *module);
17static int _ecore_imf_modules_exists(const char *ctx_id);
18
19typedef struct _Ecore_IMF_Selector
20{
21 const char *toselect;
22 void *selected;
23} Ecore_IMF_Selector;
24
25static Eina_Hash *modules = NULL;
26static Eina_Array *module_list = NULL;
27
28void
29ecore_imf_module_init(void)
30{
31 char *homedir;
32
33 module_list = eina_module_list_get(NULL, PACKAGE_LIB_DIR "/ecore/immodules", 0, NULL, NULL);
34 homedir = eina_module_environment_path_get("HOME", "/.ecore/immodules");
35 if (homedir)
36 {
37 module_list = eina_module_list_get(module_list, homedir, 0, NULL, NULL);
38 free(homedir);
39 }
40 eina_module_list_load(module_list);
41}
42
43void
44ecore_imf_module_shutdown(void)
45{
46 if (modules)
47 {
48 eina_hash_free(modules);
49 modules = NULL;
50 }
51 if (module_list)
52 {
53 eina_module_list_free(module_list);
54 eina_array_free(module_list);
55 module_list = NULL;
56 }
57}
58
59static Eina_Bool
60_hash_module_available_get(const Eina_Hash *hash __UNUSED__, int *data, void *list)
61{
62 *(Eina_List**)list = eina_list_append(*(Eina_List**)list, data);
63 return EINA_TRUE;
64}
65
66Eina_List *
67ecore_imf_module_available_get(void)
68{
69 Eina_List *values = NULL;
70 Eina_Iterator *it = NULL;
71
72 if (!modules) return NULL;
73
74 it = eina_hash_iterator_data_new(modules);
75 if (!it)
76 return NULL;
77
78 eina_iterator_foreach(it, EINA_EACH_CB(_hash_module_available_get), &values);
79 eina_iterator_free(it);
80
81 return values;
82}
83
84Ecore_IMF_Module *
85ecore_imf_module_get(const char *ctx_id)
86{
87 if (!modules) return NULL;
88 return eina_hash_find(modules, ctx_id);
89}
90
91Ecore_IMF_Context *
92ecore_imf_module_context_create(const char *ctx_id)
93{
94 Ecore_IMF_Module *module;
95 Ecore_IMF_Context *ctx = NULL;
96
97 if (!modules) return NULL;
98 module = eina_hash_find(modules, ctx_id);
99 if (module)
100 {
101 ctx = module->create();
102 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
103 {
104 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
105 "ecore_imf_module_context_create");
106 return NULL;
107 }
108 ctx->module = module;
109 }
110 return ctx;
111}
112
113static Eina_Bool
114_hash_ids_get(const Eina_Hash *hash __UNUSED__, const char *key, void *list)
115{
116 *(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
117 return EINA_TRUE;
118}
119
120Eina_List *
121ecore_imf_module_context_ids_get(void)
122{
123 Eina_List *l = NULL;
124 Eina_Iterator *it = NULL;
125
126 if (!modules) return NULL;
127
128 it = eina_hash_iterator_key_new(modules);
129 if (!it)
130 return NULL;
131
132 eina_iterator_foreach(it, EINA_EACH_CB(_hash_ids_get), &l);
133 eina_iterator_free(it);
134
135 return l;
136}
137
138static Eina_Bool
139_hash_ids_by_canvas_type_get(const Eina_Hash *hash __UNUSED__, void *data, void *fdata)
140{
141 Ecore_IMF_Module *module = data;
142 Ecore_IMF_Selector *selector = fdata;
143
144 if (!strcmp(module->info->canvas_type, selector->toselect))
145 selector->selected = eina_list_append(selector->selected, (void *)module->info->id);
146
147 return EINA_TRUE;
148}
149
150Eina_List *
151ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
152{
153 Ecore_IMF_Selector selector;
154 Eina_List *values = NULL;
155 Eina_Iterator *it = NULL;
156
157 if (!modules) return NULL;
158
159 if (!canvas_type)
160 return ecore_imf_module_context_ids_get();
161
162 it = eina_hash_iterator_data_new(modules);
163 if (!it)
164 return NULL;
165
166 selector.toselect = canvas_type;
167 selector.selected = values;
168 eina_iterator_foreach(it, EINA_EACH_CB(_hash_ids_by_canvas_type_get), &selector);
169 eina_iterator_free(it);
170
171 return values;
172}
173
174EAPI void
175ecore_imf_module_register(const Ecore_IMF_Context_Info *info,
176 Ecore_IMF_Context *(*imf_module_create)(void),
177 Ecore_IMF_Context *(*imf_module_exit)(void))
178{
179 Ecore_IMF_Module *module;
180
181 if (_ecore_imf_modules_exists(info->id)) return;
182
183 if (!modules)
184 modules = eina_hash_string_superfast_new(EINA_FREE_CB(_ecore_imf_module_free));
185
186 module = malloc(sizeof(Ecore_IMF_Module));
187 module->info = info;
188 /* cache imf_module_create as it may be used several times */
189 module->create = imf_module_create;
190 module->exit = imf_module_exit;
191
192 eina_hash_add(modules, info->id, module);
193}
194
195static void
196_ecore_imf_module_free(Ecore_IMF_Module *module)
197{
198 if (module->exit) module->exit();
199 free(module);
200}
201
202static int
203_ecore_imf_modules_exists(const char *ctx_id)
204{
205 if (!modules) return 0;
206 if (!ctx_id) return 0;
207
208 if (eina_hash_find(modules, ctx_id))
209 return 1;
210
211 return 0;
212}
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h b/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h
deleted file mode 100644
index b4ff0f2..0000000
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h
+++ /dev/null
@@ -1,84 +0,0 @@
1#ifndef _ECORE_IMF_PRIVATE_H
2#define _ECORE_IMF_PRIVATE_H
3
4#define ECORE_MAGIC_CONTEXT 0x56c1b39a
5
6#ifdef ECORE_IMF_DEFAULT_LOG_COLOR
7#undef ECORE_IMF_DEFAULT_LOG_COLOR
8#endif
9#define ECORE_IMF_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
10
11extern int _ecore_imf_log_dom;
12#ifdef ERR
13# undef ERR
14#endif
15#define ERR(...) EINA_LOG_DOM_ERR(_ecore_imf_log_dom, __VA_ARGS__)
16
17#ifdef DBG
18# undef DBG
19#endif
20#define DBG(...) EINA_LOG_DOM_DBG(_ecore_imf_log_dom, __VA_ARGS__)
21
22#ifdef INF
23# undef INF
24#endif
25#define INF(...) EINA_LOG_DOM_INFO(_ecore_imf_log_dom, __VA_ARGS__)
26
27#ifdef WRN
28# undef WRN
29#endif
30#define WRN(...) EINA_LOG_DOM_WARN(_ecore_imf_log_dom, __VA_ARGS__)
31
32#ifdef CRIT
33# undef CRIT
34#endif
35#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_imf_log_dom, __VA_ARGS__)
36
37typedef struct _Ecore_IMF_Module Ecore_IMF_Module;
38typedef struct _Ecore_IMF_Func_Node Ecore_IMF_Func_Node;
39
40struct _Ecore_IMF_Context
41{
42 ECORE_MAGIC;
43 const Ecore_IMF_Module *module;
44 const Ecore_IMF_Context_Class *klass;
45 void *data;
46 int input_mode;
47 void *window;
48 void *client_canvas;
49 Eina_Bool (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
50 void *retrieve_surrounding_data;
51 Eina_List *callbacks;
52 Ecore_IMF_Autocapital_Type autocapital_type;
53 Ecore_IMF_Input_Panel_Layout input_panel_layout;
54 Ecore_IMF_Input_Panel_Lang input_panel_lang;
55 Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
56 Eina_Bool allow_prediction : 1;
57 Eina_Bool input_panel_enabled : 1;
58 Eina_Bool input_panel_return_key_disabled : 1;
59 Eina_Bool input_panel_caps_lock_mode : 1;
60};
61
62struct _Ecore_IMF_Module
63{
64 const Ecore_IMF_Context_Info *info;
65 Ecore_IMF_Context *(*create)(void);
66 Ecore_IMF_Context *(*exit)(void);
67};
68
69struct _Ecore_IMF_Func_Node
70{
71 void (*func) ();
72 const void *data;
73 Ecore_IMF_Callback_Type type;
74};
75
76void ecore_imf_module_init(void);
77void ecore_imf_module_shutdown(void);
78Eina_List *ecore_imf_module_available_get(void);
79Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id);
80Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id);
81Eina_List *ecore_imf_module_context_ids_get(void);
82Eina_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type);
83
84#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
deleted file mode 100644
index 5f7cdb9..0000000
--- a/libraries/ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef _ECORE_IMF_EVAS_H
2#define _ECORE_IMF_EVAS_H
3
4#include <Ecore_IMF.h>
5#include <Evas.h>
6
7#ifdef EAPI
8# undef EAPI
9#endif
10
11#ifdef _WIN32
12# ifdef EFL_ECORE_IMF_EVAS_BUILD
13# ifdef DLL_EXPORT
14# define EAPI __declspec(dllexport)
15# else
16# define EAPI
17# endif /* ! DLL_EXPORT */
18# else
19# define EAPI __declspec(dllimport)
20# endif /* ! EFL_ECORE_IMF_BUILD */
21#else
22# ifdef __GNUC__
23# if __GNUC__ >= 4
24# define EAPI __attribute__ ((visibility("default")))
25# else
26# define EAPI
27# endif
28# else
29# define EAPI
30# endif
31#endif /* ! _WIN32 */
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37EAPI void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ecore_IMF_Event_Mouse_In *imf_event);
38EAPI void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, Ecore_IMF_Event_Mouse_Out *imf_event);
39EAPI void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, Ecore_IMF_Event_Mouse_Move *imf_event);
40EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event);
41EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event);
42EAPI void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, Ecore_IMF_Event_Mouse_Wheel *imf_event);
43EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event);
44EAPI void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event);
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif
diff --git a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.am b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.am
deleted file mode 100644
index fa5c491..0000000
--- a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_imf \
6@EFL_ECORE_IMF_EVAS_BUILD@ \
7@EVAS_CFLAGS@ \
8@EINA_CFLAGS@
9
10lib_LTLIBRARIES = libecore_imf_evas.la
11includes_HEADERS = Ecore_IMF_Evas.h
12includesdir = $(includedir)/ecore-@VMAJ@
13
14libecore_imf_evas_la_SOURCES = \
15ecore_imf_evas.c
16
17libecore_imf_evas_la_LIBADD = \
18$(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
19@EVAS_LIBS@ \
20@EINA_LIBS@
21
22libecore_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
deleted file mode 100644
index 1542919..0000000
--- a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in
+++ /dev/null
@@ -1,829 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_imf_evas
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_imf_evas_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore_imf/libecore_imf.la
90am_libecore_imf_evas_la_OBJECTS = ecore_imf_evas.lo
91libecore_imf_evas_la_OBJECTS = $(am_libecore_imf_evas_la_OBJECTS)
92AM_V_lt = $(am__v_lt_$(V))
93am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
94am__v_lt_0 = --silent
95libecore_imf_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
96 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
97 $(AM_CFLAGS) $(CFLAGS) $(libecore_imf_evas_la_LDFLAGS) \
98 $(LDFLAGS) -o $@
99DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
100depcomp = $(SHELL) $(top_srcdir)/depcomp
101am__depfiles_maybe = depfiles
102am__mv = mv -f
103COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
104 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
105LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
106 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
107 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
108 $(AM_CFLAGS) $(CFLAGS)
109AM_V_CC = $(am__v_CC_$(V))
110am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
111am__v_CC_0 = @echo " CC " $@;
112AM_V_at = $(am__v_at_$(V))
113am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
114am__v_at_0 = @
115CCLD = $(CC)
116LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
117 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
118 $(AM_LDFLAGS) $(LDFLAGS) -o $@
119AM_V_CCLD = $(am__v_CCLD_$(V))
120am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
121am__v_CCLD_0 = @echo " CCLD " $@;
122AM_V_GEN = $(am__v_GEN_$(V))
123am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
124am__v_GEN_0 = @echo " GEN " $@;
125SOURCES = $(libecore_imf_evas_la_SOURCES)
126DIST_SOURCES = $(libecore_imf_evas_la_SOURCES)
127HEADERS = $(includes_HEADERS)
128ETAGS = etags
129CTAGS = ctags
130DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
131ACLOCAL = @ACLOCAL@
132ALLOCA = @ALLOCA@
133AMTAR = @AMTAR@
134AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
135AR = @AR@
136AS = @AS@
137AUTOCONF = @AUTOCONF@
138AUTOHEADER = @AUTOHEADER@
139AUTOMAKE = @AUTOMAKE@
140AWK = @AWK@
141CARES_CFLAGS = @CARES_CFLAGS@
142CARES_LIBS = @CARES_LIBS@
143CC = @CC@
144CCDEPMODE = @CCDEPMODE@
145CFLAGS = @CFLAGS@
146CHECK_CFLAGS = @CHECK_CFLAGS@
147CHECK_LIBS = @CHECK_LIBS@
148CPP = @CPP@
149CPPFLAGS = @CPPFLAGS@
150CURL_CFLAGS = @CURL_CFLAGS@
151CURL_LIBS = @CURL_LIBS@
152CXX = @CXX@
153CXXCPP = @CXXCPP@
154CXXDEPMODE = @CXXDEPMODE@
155CXXFLAGS = @CXXFLAGS@
156CYGPATH_W = @CYGPATH_W@
157DEFS = @DEFS@
158DEPDIR = @DEPDIR@
159DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
160DIRECTFB_LIBS = @DIRECTFB_LIBS@
161DLLTOOL = @DLLTOOL@
162DSYMUTIL = @DSYMUTIL@
163DUMPBIN = @DUMPBIN@
164ECHO_C = @ECHO_C@
165ECHO_N = @ECHO_N@
166ECHO_T = @ECHO_T@
167ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
168ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
169EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
170EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
171EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
172EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
173EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
174EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
175EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
176EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
177EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
178EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
179EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
180EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
181EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
182EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
183EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
184EGREP = @EGREP@
185EINA_CFLAGS = @EINA_CFLAGS@
186EINA_LIBS = @EINA_LIBS@
187ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
188ESCAPE_LIBS = @ESCAPE_LIBS@
189EVAS_CFLAGS = @EVAS_CFLAGS@
190EVAS_LIBS = @EVAS_LIBS@
191EVIL_CFLAGS = @EVIL_CFLAGS@
192EVIL_LIBS = @EVIL_LIBS@
193EXEEXT = @EXEEXT@
194EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
195EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@
199GLIB_LIBS = @GLIB_LIBS@
200GMSGFMT = @GMSGFMT@
201GMSGFMT_015 = @GMSGFMT_015@
202GREP = @GREP@
203INSTALL = @INSTALL@
204INSTALL_DATA = @INSTALL_DATA@
205INSTALL_PROGRAM = @INSTALL_PROGRAM@
206INSTALL_SCRIPT = @INSTALL_SCRIPT@
207INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
208INTLLIBS = @INTLLIBS@
209INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
210KEYSYMDEFS = @KEYSYMDEFS@
211LD = @LD@
212LDFLAGS = @LDFLAGS@
213LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
214LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
215LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
216LIBICONV = @LIBICONV@
217LIBINTL = @LIBINTL@
218LIBOBJS = @LIBOBJS@
219LIBS = @LIBS@
220LIBTOOL = @LIBTOOL@
221LIPO = @LIPO@
222LN_S = @LN_S@
223LTLIBICONV = @LTLIBICONV@
224LTLIBINTL = @LTLIBINTL@
225LTLIBOBJS = @LTLIBOBJS@
226MAKEINFO = @MAKEINFO@
227MKDIR_P = @MKDIR_P@
228MSGFMT = @MSGFMT@
229MSGFMT_015 = @MSGFMT_015@
230MSGMERGE = @MSGMERGE@
231NM = @NM@
232NMEDIT = @NMEDIT@
233OBJC = @OBJC@
234OBJCDEPMODE = @OBJCDEPMODE@
235OBJCFLAGS = @OBJCFLAGS@
236OBJDUMP = @OBJDUMP@
237OBJEXT = @OBJEXT@
238OTOOL = @OTOOL@
239OTOOL64 = @OTOOL64@
240PACKAGE = @PACKAGE@
241PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
242PACKAGE_NAME = @PACKAGE_NAME@
243PACKAGE_STRING = @PACKAGE_STRING@
244PACKAGE_TARNAME = @PACKAGE_TARNAME@
245PACKAGE_URL = @PACKAGE_URL@
246PACKAGE_VERSION = @PACKAGE_VERSION@
247PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@
251PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
252PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
253POSUB = @POSUB@
254RANLIB = @RANLIB@
255SCIM_CFLAGS = @SCIM_CFLAGS@
256SCIM_LIBS = @SCIM_LIBS@
257SDL_CFLAGS = @SDL_CFLAGS@
258SDL_CONFIG = @SDL_CONFIG@
259SDL_LIBS = @SDL_LIBS@
260SED = @SED@
261SET_MAKE = @SET_MAKE@
262SHELL = @SHELL@
263SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
264SSL_CFLAGS = @SSL_CFLAGS@
265SSL_LIBS = @SSL_LIBS@
266STRIP = @STRIP@
267TLS2_CFLAGS = @TLS2_CFLAGS@
268TLS2_LIBS = @TLS2_LIBS@
269TLS_CFLAGS = @TLS_CFLAGS@
270TLS_LIBS = @TLS_LIBS@
271TSLIB_CFLAGS = @TSLIB_CFLAGS@
272TSLIB_LIBS = @TSLIB_LIBS@
273USE_NLS = @USE_NLS@
274VERSION = @VERSION@
275VMAJ = @VMAJ@
276WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
277WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
278WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
279WAYLAND_LIBS = @WAYLAND_LIBS@
280WIN32_CFLAGS = @WIN32_CFLAGS@
281WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
282WIN32_LIBS = @WIN32_LIBS@
283XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
284XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
285XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
286XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
287XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
288XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
289XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
290XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
291XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
292XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
293XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
294XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
295XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
296XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
297XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
298XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
299XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
300XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
301XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
302XCB_X11_LIBS = @XCB_X11_LIBS@
303XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
304XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
305XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
306XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
307XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
308XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
309XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
310XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
311XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
312XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
313XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
314XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
315XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
316XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
317XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
318XDAMAGE_LIBS = @XDAMAGE_LIBS@
319XDPMS_CFLAGS = @XDPMS_CFLAGS@
320XDPMS_LIBS = @XDPMS_LIBS@
321XFIXES_CFLAGS = @XFIXES_CFLAGS@
322XFIXES_LIBS = @XFIXES_LIBS@
323XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
324XGESTURE_LIBS = @XGESTURE_LIBS@
325XGETTEXT = @XGETTEXT@
326XGETTEXT_015 = @XGETTEXT_015@
327XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
328XI2_CFLAGS = @XI2_CFLAGS@
329XI2_LIBS = @XI2_LIBS@
330XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
331XINERAMA_LIBS = @XINERAMA_LIBS@
332XKB_CFLAGS = @XKB_CFLAGS@
333XKB_LIBS = @XKB_LIBS@
334XMKMF = @XMKMF@
335XPRINT_CFLAGS = @XPRINT_CFLAGS@
336XPRINT_LIBS = @XPRINT_LIBS@
337XRANDR_CFLAGS = @XRANDR_CFLAGS@
338XRANDR_LIBS = @XRANDR_LIBS@
339XRENDER_CFLAGS = @XRENDER_CFLAGS@
340XRENDER_LIBS = @XRENDER_LIBS@
341XSS_CFLAGS = @XSS_CFLAGS@
342XSS_LIBS = @XSS_LIBS@
343XTEST_CFLAGS = @XTEST_CFLAGS@
344XTEST_LIBS = @XTEST_LIBS@
345X_CFLAGS = @X_CFLAGS@
346X_EXTRA_LIBS = @X_EXTRA_LIBS@
347X_LIBS = @X_LIBS@
348X_PRE_LIBS = @X_PRE_LIBS@
349Xcursor_cflags = @Xcursor_cflags@
350Xcursor_libs = @Xcursor_libs@
351abs_builddir = @abs_builddir@
352abs_srcdir = @abs_srcdir@
353abs_top_builddir = @abs_top_builddir@
354abs_top_srcdir = @abs_top_srcdir@
355ac_ct_CC = @ac_ct_CC@
356ac_ct_CXX = @ac_ct_CXX@
357ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
358ac_ct_OBJC = @ac_ct_OBJC@
359am__include = @am__include@
360am__leading_dot = @am__leading_dot@
361am__quote = @am__quote@
362am__tar = @am__tar@
363am__untar = @am__untar@
364bindir = @bindir@
365build = @build@
366build_alias = @build_alias@
367build_cpu = @build_cpu@
368build_os = @build_os@
369build_vendor = @build_vendor@
370builddir = @builddir@
371cocoa_ldflags = @cocoa_ldflags@
372datadir = @datadir@
373datarootdir = @datarootdir@
374dlopen_libs = @dlopen_libs@
375docdir = @docdir@
376dvidir = @dvidir@
377ecore_cocoa_cflags = @ecore_cocoa_cflags@
378ecore_cocoa_libs = @ecore_cocoa_libs@
379ecore_con_cflags = @ecore_con_cflags@
380ecore_con_libs = @ecore_con_libs@
381ecore_directfb_cflags = @ecore_directfb_cflags@
382ecore_directfb_libs = @ecore_directfb_libs@
383ecore_evas_cflags = @ecore_evas_cflags@
384ecore_evas_libs = @ecore_evas_libs@
385ecore_fb_cflags = @ecore_fb_cflags@
386ecore_fb_libs = @ecore_fb_libs@
387ecore_file_cflags = @ecore_file_cflags@
388ecore_file_libs = @ecore_file_libs@
389ecore_imf_cflags = @ecore_imf_cflags@
390ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
391ecore_imf_evas_libs = @ecore_imf_evas_libs@
392ecore_imf_libs = @ecore_imf_libs@
393ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
394ecore_imf_scim_libs = @ecore_imf_scim_libs@
395ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
396ecore_imf_xim_libs = @ecore_imf_xim_libs@
397ecore_input_cflags = @ecore_input_cflags@
398ecore_input_evas_cflags = @ecore_input_evas_cflags@
399ecore_input_evas_libs = @ecore_input_evas_libs@
400ecore_input_libs = @ecore_input_libs@
401ecore_ipc_cflags = @ecore_ipc_cflags@
402ecore_ipc_libs = @ecore_ipc_libs@
403ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
404ecore_psl1ght_libs = @ecore_psl1ght_libs@
405ecore_sdl_cflags = @ecore_sdl_cflags@
406ecore_sdl_libs = @ecore_sdl_libs@
407ecore_wayland_cflags = @ecore_wayland_cflags@
408ecore_wayland_libs = @ecore_wayland_libs@
409ecore_win32_cflags = @ecore_win32_cflags@
410ecore_win32_libs = @ecore_win32_libs@
411ecore_wince_cflags = @ecore_wince_cflags@
412ecore_wince_libs = @ecore_wince_libs@
413ecore_x_cflags = @ecore_x_cflags@
414ecore_x_libs = @ecore_x_libs@
415ecore_x_libs_private = @ecore_x_libs_private@
416efl_doxygen = @efl_doxygen@
417efl_have_doxygen = @efl_have_doxygen@
418exec_prefix = @exec_prefix@
419have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
420host = @host@
421host_alias = @host_alias@
422host_cpu = @host_cpu@
423host_os = @host_os@
424host_vendor = @host_vendor@
425htmldir = @htmldir@
426includedir = @includedir@
427infodir = @infodir@
428install_sh = @install_sh@
429libdir = @libdir@
430libexecdir = @libexecdir@
431localedir = @localedir@
432localstatedir = @localstatedir@
433lt_ECHO = @lt_ECHO@
434lt_enable_auto_import = @lt_enable_auto_import@
435mandir = @mandir@
436mkdir_p = @mkdir_p@
437oldincludedir = @oldincludedir@
438pdfdir = @pdfdir@
439pkgconfig_requires_private = @pkgconfig_requires_private@
440prefix = @prefix@
441program_transform_name = @program_transform_name@
442psdir = @psdir@
443release_info = @release_info@
444requirements_ecore = @requirements_ecore@
445requirements_ecore_cocoa = @requirements_ecore_cocoa@
446requirements_ecore_con = @requirements_ecore_con@
447requirements_ecore_directfb = @requirements_ecore_directfb@
448requirements_ecore_evas = @requirements_ecore_evas@
449requirements_ecore_fb = @requirements_ecore_fb@
450requirements_ecore_file = @requirements_ecore_file@
451requirements_ecore_imf = @requirements_ecore_imf@
452requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
453requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
454requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
455requirements_ecore_input = @requirements_ecore_input@
456requirements_ecore_input_evas = @requirements_ecore_input_evas@
457requirements_ecore_ipc = @requirements_ecore_ipc@
458requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
459requirements_ecore_sdl = @requirements_ecore_sdl@
460requirements_ecore_wayland = @requirements_ecore_wayland@
461requirements_ecore_win32 = @requirements_ecore_win32@
462requirements_ecore_wince = @requirements_ecore_wince@
463requirements_ecore_x = @requirements_ecore_x@
464rt_libs = @rt_libs@
465sbindir = @sbindir@
466sharedstatedir = @sharedstatedir@
467srcdir = @srcdir@
468sysconfdir = @sysconfdir@
469target_alias = @target_alias@
470top_build_prefix = @top_build_prefix@
471top_builddir = @top_builddir@
472top_srcdir = @top_srcdir@
473version_info = @version_info@
474x_cflags = @x_cflags@
475x_includes = @x_includes@
476x_libs = @x_libs@
477MAINTAINERCLEANFILES = Makefile.in
478AM_CPPFLAGS = \
479-I$(top_srcdir)/src/lib/ecore \
480-I$(top_srcdir)/src/lib/ecore_imf \
481@EFL_ECORE_IMF_EVAS_BUILD@ \
482@EVAS_CFLAGS@ \
483@EINA_CFLAGS@
484
485lib_LTLIBRARIES = libecore_imf_evas.la
486includes_HEADERS = Ecore_IMF_Evas.h
487includesdir = $(includedir)/ecore-@VMAJ@
488libecore_imf_evas_la_SOURCES = \
489ecore_imf_evas.c
490
491libecore_imf_evas_la_LIBADD = \
492$(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
493@EVAS_LIBS@ \
494@EINA_LIBS@
495
496libecore_imf_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
497all: all-am
498
499.SUFFIXES:
500.SUFFIXES: .c .lo .o .obj
501$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
502 @for dep in $?; do \
503 case '$(am__configure_deps)' in \
504 *$$dep*) \
505 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
506 && { if test -f $@; then exit 0; else break; fi; }; \
507 exit 1;; \
508 esac; \
509 done; \
510 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_imf_evas/Makefile'; \
511 $(am__cd) $(top_srcdir) && \
512 $(AUTOMAKE) --gnu src/lib/ecore_imf_evas/Makefile
513.PRECIOUS: Makefile
514Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
515 @case '$?' in \
516 *config.status*) \
517 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
518 *) \
519 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
520 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
521 esac;
522
523$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
524 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
525
526$(top_srcdir)/configure: $(am__configure_deps)
527 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
528$(ACLOCAL_M4): $(am__aclocal_m4_deps)
529 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
530$(am__aclocal_m4_deps):
531install-libLTLIBRARIES: $(lib_LTLIBRARIES)
532 @$(NORMAL_INSTALL)
533 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
534 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
535 list2=; for p in $$list; do \
536 if test -f $$p; then \
537 list2="$$list2 $$p"; \
538 else :; fi; \
539 done; \
540 test -z "$$list2" || { \
541 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
542 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
543 }
544
545uninstall-libLTLIBRARIES:
546 @$(NORMAL_UNINSTALL)
547 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
548 for p in $$list; do \
549 $(am__strip_dir) \
550 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
551 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
552 done
553
554clean-libLTLIBRARIES:
555 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
556 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
557 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
558 test "$$dir" != "$$p" || dir=.; \
559 echo "rm -f \"$${dir}/so_locations\""; \
560 rm -f "$${dir}/so_locations"; \
561 done
562libecore_imf_evas.la: $(libecore_imf_evas_la_OBJECTS) $(libecore_imf_evas_la_DEPENDENCIES)
563 $(AM_V_CCLD)$(libecore_imf_evas_la_LINK) -rpath $(libdir) $(libecore_imf_evas_la_OBJECTS) $(libecore_imf_evas_la_LIBADD) $(LIBS)
564
565mostlyclean-compile:
566 -rm -f *.$(OBJEXT)
567
568distclean-compile:
569 -rm -f *.tab.c
570
571@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf_evas.Plo@am__quote@
572
573.c.o:
574@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
575@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
576@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
577@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
578@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
579@am__fastdepCC_FALSE@ $(COMPILE) -c $<
580
581.c.obj:
582@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
583@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
584@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
585@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
586@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
587@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
588
589.c.lo:
590@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
591@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
592@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
594@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
595@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
596
597mostlyclean-libtool:
598 -rm -f *.lo
599
600clean-libtool:
601 -rm -rf .libs _libs
602install-includesHEADERS: $(includes_HEADERS)
603 @$(NORMAL_INSTALL)
604 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
605 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
606 for p in $$list; do \
607 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
608 echo "$$d$$p"; \
609 done | $(am__base_list) | \
610 while read files; do \
611 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
612 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
613 done
614
615uninstall-includesHEADERS:
616 @$(NORMAL_UNINSTALL)
617 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
618 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
619 test -n "$$files" || exit 0; \
620 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
621 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
622
623ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
624 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
625 unique=`for i in $$list; do \
626 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
627 done | \
628 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
629 END { if (nonempty) { for (i in files) print i; }; }'`; \
630 mkid -fID $$unique
631tags: TAGS
632
633TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
634 $(TAGS_FILES) $(LISP)
635 set x; \
636 here=`pwd`; \
637 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
638 unique=`for i in $$list; do \
639 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
640 done | \
641 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
642 END { if (nonempty) { for (i in files) print i; }; }'`; \
643 shift; \
644 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
645 test -n "$$unique" || unique=$$empty_fix; \
646 if test $$# -gt 0; then \
647 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
648 "$$@" $$unique; \
649 else \
650 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
651 $$unique; \
652 fi; \
653 fi
654ctags: CTAGS
655CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
656 $(TAGS_FILES) $(LISP)
657 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
658 unique=`for i in $$list; do \
659 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
660 done | \
661 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
662 END { if (nonempty) { for (i in files) print i; }; }'`; \
663 test -z "$(CTAGS_ARGS)$$unique" \
664 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
665 $$unique
666
667GTAGS:
668 here=`$(am__cd) $(top_builddir) && pwd` \
669 && $(am__cd) $(top_srcdir) \
670 && gtags -i $(GTAGS_ARGS) "$$here"
671
672distclean-tags:
673 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
674
675distdir: $(DISTFILES)
676 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
677 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
678 list='$(DISTFILES)'; \
679 dist_files=`for file in $$list; do echo $$file; done | \
680 sed -e "s|^$$srcdirstrip/||;t" \
681 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
682 case $$dist_files in \
683 */*) $(MKDIR_P) `echo "$$dist_files" | \
684 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
685 sort -u` ;; \
686 esac; \
687 for file in $$dist_files; do \
688 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
689 if test -d $$d/$$file; then \
690 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
691 if test -d "$(distdir)/$$file"; then \
692 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
693 fi; \
694 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
695 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
696 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
697 fi; \
698 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
699 else \
700 test -f "$(distdir)/$$file" \
701 || cp -p $$d/$$file "$(distdir)/$$file" \
702 || exit 1; \
703 fi; \
704 done
705check-am: all-am
706check: check-am
707all-am: Makefile $(LTLIBRARIES) $(HEADERS)
708installdirs:
709 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
710 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
711 done
712install: install-am
713install-exec: install-exec-am
714install-data: install-data-am
715uninstall: uninstall-am
716
717install-am: all-am
718 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
719
720installcheck: installcheck-am
721install-strip:
722 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
723 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
724 `test -z '$(STRIP)' || \
725 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
726mostlyclean-generic:
727
728clean-generic:
729
730distclean-generic:
731 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
732 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
733
734maintainer-clean-generic:
735 @echo "This command is intended for maintainers to use"
736 @echo "it deletes files that may require special tools to rebuild."
737 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
738clean: clean-am
739
740clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
741 mostlyclean-am
742
743distclean: distclean-am
744 -rm -rf ./$(DEPDIR)
745 -rm -f Makefile
746distclean-am: clean-am distclean-compile distclean-generic \
747 distclean-tags
748
749dvi: dvi-am
750
751dvi-am:
752
753html: html-am
754
755html-am:
756
757info: info-am
758
759info-am:
760
761install-data-am: install-includesHEADERS
762
763install-dvi: install-dvi-am
764
765install-dvi-am:
766
767install-exec-am: install-libLTLIBRARIES
768
769install-html: install-html-am
770
771install-html-am:
772
773install-info: install-info-am
774
775install-info-am:
776
777install-man:
778
779install-pdf: install-pdf-am
780
781install-pdf-am:
782
783install-ps: install-ps-am
784
785install-ps-am:
786
787installcheck-am:
788
789maintainer-clean: maintainer-clean-am
790 -rm -rf ./$(DEPDIR)
791 -rm -f Makefile
792maintainer-clean-am: distclean-am maintainer-clean-generic
793
794mostlyclean: mostlyclean-am
795
796mostlyclean-am: mostlyclean-compile mostlyclean-generic \
797 mostlyclean-libtool
798
799pdf: pdf-am
800
801pdf-am:
802
803ps: ps-am
804
805ps-am:
806
807uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
808
809.MAKE: install-am install-strip
810
811.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
812 clean-libLTLIBRARIES clean-libtool ctags distclean \
813 distclean-compile distclean-generic distclean-libtool \
814 distclean-tags distdir dvi dvi-am html html-am info info-am \
815 install install-am install-data install-data-am install-dvi \
816 install-dvi-am install-exec install-exec-am install-html \
817 install-html-am install-includesHEADERS install-info \
818 install-info-am install-libLTLIBRARIES install-man install-pdf \
819 install-pdf-am install-ps install-ps-am install-strip \
820 installcheck installcheck-am installdirs maintainer-clean \
821 maintainer-clean-generic mostlyclean mostlyclean-compile \
822 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
823 tags uninstall uninstall-am uninstall-includesHEADERS \
824 uninstall-libLTLIBRARIES
825
826
827# Tell versions [3.59,3.63) of GNU make to not export all variables.
828# Otherwise a system limit (for SysV at least) may be exceeded.
829.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
deleted file mode 100644
index 62ba4c8..0000000
--- a/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c
+++ /dev/null
@@ -1,303 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore_IMF_Evas.h"
6
7/**
8 * @defgroup Ecore_IMF_Evas_Group Ecore Input Method Context Evas Helper Functions
9 *
10 * Helper functions to make it easy to use Evas with Ecore_IMF.
11 */
12
13static const char *_ecore_imf_evas_event_empty = "";
14
15/* Converts the Evas modifiers to Ecore_IMF keyboard modifiers */
16static void
17_ecore_imf_evas_event_modifiers_wrap(Evas_Modifier *evas_modifiers,
18 Ecore_IMF_Keyboard_Modifiers *imf_keyboard_modifiers)
19{
20 if (!evas_modifiers || !imf_keyboard_modifiers)
21 return;
22
23 *imf_keyboard_modifiers = ECORE_IMF_KEYBOARD_MODIFIER_NONE;
24 if (evas_key_modifier_is_set(evas_modifiers, "Control"))
25 *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
26 if (evas_key_modifier_is_set(evas_modifiers, "Alt"))
27 *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
28 if (evas_key_modifier_is_set(evas_modifiers, "Shift"))
29 *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;
30 if (evas_key_modifier_is_set(evas_modifiers, "Super") || evas_key_modifier_is_set(evas_modifiers, "Hyper"))
31 *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
32}
33
34/* Converts the Evas locks to Ecore_IMF keyboard locks */
35static void
36_ecore_imf_evas_event_locks_wrap(Evas_Lock *evas_locks,
37 Ecore_IMF_Keyboard_Locks *imf_keyboard_locks)
38{
39 if (!evas_locks || !imf_keyboard_locks)
40 return;
41
42 *imf_keyboard_locks = ECORE_IMF_KEYBOARD_LOCK_NONE;
43 if (evas_key_lock_is_set(evas_locks, "Num_Lock"))
44 *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_NUM;
45 if (evas_key_lock_is_set(evas_locks, "Caps_Lock"))
46 *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_CAPS;
47 if (evas_key_lock_is_set(evas_locks, "Scroll_Lock"))
48 *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_SCROLL;
49}
50
51/* Converts the Evas mouse flags to Ecore_IMF mouse flags */
52static void
53_ecore_imf_evas_event_mouse_flags_wrap(Evas_Button_Flags evas_flags,
54 Ecore_IMF_Mouse_Flags *imf_flags)
55{
56 if (!imf_flags)
57 return;
58
59 *imf_flags = ECORE_IMF_MOUSE_NONE;
60 if (evas_flags & EVAS_BUTTON_DOUBLE_CLICK)
61 *imf_flags |= ECORE_IMF_MOUSE_DOUBLE_CLICK;
62 if (evas_flags & EVAS_BUTTON_TRIPLE_CLICK)
63 *imf_flags |= ECORE_IMF_MOUSE_TRIPLE_CLICK;
64}
65
66/**
67 * Converts a "mouse_in" event from Evas to the corresponding event of Ecore_IMF.
68 *
69 * @param evas_event The received Evas event.
70 * @param imf_event The location to store the converted Ecore_IMF event.
71 * @ingroup Ecore_IMF_Evas_Group
72 */
73EAPI void
74ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event,
75 Ecore_IMF_Event_Mouse_In *imf_event)
76{
77 if (!evas_event || !imf_event)
78 return;
79
80 imf_event->buttons = evas_event->buttons;
81 imf_event->output.x = evas_event->output.x;
82 imf_event->output.y = evas_event->output.y;
83 imf_event->canvas.x = evas_event->canvas.x;
84 imf_event->canvas.y = evas_event->canvas.y;
85 imf_event->timestamp = evas_event->timestamp;
86 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
87 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
88}
89
90/**
91 * Converts a "mouse_out" event from Evas to the corresponding event of Ecore_IMF.
92 *
93 * @param evas_event The received Evas event.
94 * @param imf_event The location to store the converted Ecore_IMF event.
95 * @ingroup Ecore_IMF_Evas_Group
96 */
97EAPI void
98ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event,
99 Ecore_IMF_Event_Mouse_Out *imf_event)
100{
101 if (!evas_event || !imf_event)
102 return;
103
104 imf_event->buttons = evas_event->buttons;
105 imf_event->output.x = evas_event->output.x;
106 imf_event->output.y = evas_event->output.y;
107 imf_event->canvas.x = evas_event->canvas.x;
108 imf_event->canvas.y = evas_event->canvas.y;
109 imf_event->timestamp = evas_event->timestamp;
110 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
111 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
112}
113
114/**
115 * Converts a "mouse_move" event from Evas to the corresponding event of Ecore_IMF.
116 *
117 * @param evas_event The received Evas event.
118 * @param imf_event The location to store the converted Ecore_IMF event.
119 * @ingroup Ecore_IMF_Evas_Group
120 */
121EAPI void
122ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event,
123 Ecore_IMF_Event_Mouse_Move *imf_event)
124{
125 if (!evas_event || !imf_event)
126 return;
127
128 imf_event->buttons = evas_event->buttons;
129 imf_event->cur.output.x = evas_event->cur.output.x;
130 imf_event->cur.output.y = evas_event->cur.output.y;
131 imf_event->prev.output.x = evas_event->prev.output.x;
132 imf_event->prev.output.y = evas_event->prev.output.y;
133 imf_event->cur.canvas.x = evas_event->cur.canvas.x;
134 imf_event->cur.canvas.y = evas_event->cur.canvas.y;
135 imf_event->prev.canvas.x = evas_event->prev.canvas.x;
136 imf_event->prev.canvas.y = evas_event->prev.canvas.y;
137 imf_event->timestamp = evas_event->timestamp;
138 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
139 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
140}
141
142/**
143 * Converts a "mouse_down" event from Evas to the corresponding event of Ecore_IMF.
144 *
145 * @param evas_event The received Evas event.
146 * @param imf_event The location to store the converted Ecore_IMF event.
147 * @ingroup Ecore_IMF_Evas_Group
148 */
149EAPI void
150ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event,
151 Ecore_IMF_Event_Mouse_Down *imf_event)
152{
153 if (!evas_event || !imf_event)
154 return;
155
156 imf_event->button = evas_event->button;
157 imf_event->output.x = evas_event->output.x;
158 imf_event->output.y = evas_event->output.y;
159 imf_event->canvas.x = evas_event->canvas.x;
160 imf_event->canvas.y = evas_event->canvas.y;
161 imf_event->timestamp = evas_event->timestamp;
162 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
163 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
164 _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags);
165}
166
167/**
168 * Converts a "mouse_up" event from Evas to the corresponding event of Ecore_IMF.
169 *
170 * @param evas_event The received Evas event.
171 * @param imf_event The location to store the converted Ecore_IMF event.
172 * @ingroup Ecore_IMF_Evas_Group
173 */
174EAPI void
175ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event,
176 Ecore_IMF_Event_Mouse_Up *imf_event)
177{
178 if (!evas_event || !imf_event)
179 return;
180
181 imf_event->button = evas_event->button;
182 imf_event->output.x = evas_event->output.x;
183 imf_event->output.y = evas_event->output.y;
184 imf_event->canvas.x = evas_event->canvas.x;
185 imf_event->canvas.y = evas_event->canvas.y;
186 imf_event->timestamp = evas_event->timestamp;
187 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
188 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
189 _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags);
190}
191
192/**
193 * Converts a "mouse_wheel" event from Evas to the corresponding event of Ecore_IMF.
194 *
195 * @param evas_event The received Evas event.
196 * @param imf_event The location to store the converted Ecore_IMF event.
197 * @ingroup Ecore_IMF_Evas_Group
198 */
199EAPI void
200ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event,
201 Ecore_IMF_Event_Mouse_Wheel *imf_event)
202{
203 if (!evas_event || !imf_event)
204 return;
205
206 imf_event->direction = evas_event->direction;
207 imf_event->z = evas_event->z;
208 imf_event->output.x = evas_event->output.x;
209 imf_event->output.y = evas_event->output.y;
210 imf_event->canvas.x = evas_event->canvas.x;
211 imf_event->canvas.y = evas_event->canvas.y;
212 imf_event->timestamp = evas_event->timestamp;
213 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
214 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
215 imf_event->timestamp = evas_event->timestamp;
216}
217
218/**
219 * Converts a "key_down" event from Evas to the corresponding event of Ecore_IMF.
220 *
221 * @param evas_event The received Evas event.
222 * @param imf_event The location to store the converted Ecore_IMF event.
223 * @ingroup Ecore_IMF_Evas_Group
224 *
225 * Example
226 * @code
227 * static void
228 * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
229 * {
230 * Evas_Event_Key_Down *ev = event_info;
231 * if (!ev->keyname) return;
232 *
233 * if (imf_context)
234 * {
235 * Ecore_IMF_Event_Key_Down ecore_ev;
236 * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
237 * if (ecore_imf_context_filter_event(imf_context,
238 * ECORE_IMF_EVENT_KEY_DOWN,
239 * (Ecore_IMF_Event *)&ecore_ev))
240 * return;
241 * }
242 * }
243 *
244 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data);
245 * @endcode
246 */
247EAPI void
248ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event,
249 Ecore_IMF_Event_Key_Down *imf_event)
250{
251 if (!evas_event || !imf_event)
252 return;
253
254 imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty;
255 imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty;
256 imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty;
257 imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty;
258 imf_event->timestamp = evas_event->timestamp;
259 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
260 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
261}
262
263/**
264 * Converts a "key_up" event from Evas to the corresponding event of Ecore_IMF.
265 *
266 * @param evas_event The received Evas event.
267 * @param imf_event The location to store the converted Ecore_IMF event.
268 * @ingroup Ecore_IMF_Evas_Group
269 *
270 * Example
271 * @code
272 * static void
273 * _key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
274 * {
275 * Evas_Event_Key_Up *ev = event_info;
276 * if (!ev->keyname) return;
277 *
278 * if (imf_context)
279 * {
280 * Ecore_IMF_Event_Key_Up ecore_ev;
281 * ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
282 * if (ecore_imf_context_filter_event(imf_context,
283 * ECORE_IMF_EVENT_KEY_UP,
284 * (Ecore_IMF_Event *)&ecore_ev))
285 * return;
286 * }
287 * }
288 *
289 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, _key_up_cb, data);
290 * @endcode
291 */
292EAPI void
293ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event,
294 Ecore_IMF_Event_Key_Up *imf_event)
295{
296 imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty;
297 imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty;
298 imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty;
299 imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty;
300 imf_event->timestamp = evas_event->timestamp;
301 _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers);
302 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
303}
diff --git a/libraries/ecore/src/lib/ecore_input/Ecore_Input.h b/libraries/ecore/src/lib/ecore_input/Ecore_Input.h
deleted file mode 100644
index a64bb2b..0000000
--- a/libraries/ecore/src/lib/ecore_input/Ecore_Input.h
+++ /dev/null
@@ -1,220 +0,0 @@
1#ifndef _ECORE_INPUT_H
2#define _ECORE_INPUT_H
3
4#ifdef _WIN32
5# include <stddef.h>
6#else
7# include <inttypes.h>
8#endif
9
10#ifdef EAPI
11# undef EAPI
12#endif
13
14#ifdef _WIN32
15# ifdef EFL_ECORE_INPUT_BUILD
16# ifdef DLL_EXPORT
17# define EAPI __declspec(dllexport)
18# else
19# define EAPI
20# endif /* ! DLL_EXPORT */
21# else
22# define EAPI __declspec(dllimport)
23# endif /* ! EFL_ECORE_INPUT_BUILD */
24#else
25# ifdef __GNUC__
26# if __GNUC__ >= 4
27# define EAPI __attribute__ ((visibility("default")))
28# else
29# define EAPI
30# endif
31# else
32# define EAPI
33# endif
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40 EAPI extern int ECORE_EVENT_KEY_DOWN;
41 EAPI extern int ECORE_EVENT_KEY_UP;
42 EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN;
43 EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP;
44 EAPI extern int ECORE_EVENT_MOUSE_MOVE;
45 EAPI extern int ECORE_EVENT_MOUSE_WHEEL;
46 EAPI extern int ECORE_EVENT_MOUSE_IN;
47 EAPI extern int ECORE_EVENT_MOUSE_OUT;
48
49#define ECORE_EVENT_MODIFIER_SHIFT 0x0001
50#define ECORE_EVENT_MODIFIER_CTRL 0x0002
51#define ECORE_EVENT_MODIFIER_ALT 0x0004
52#define ECORE_EVENT_MODIFIER_WIN 0x0008
53#define ECORE_EVENT_MODIFIER_SCROLL 0x0010
54#define ECORE_EVENT_MODIFIER_NUM 0x0020
55#define ECORE_EVENT_MODIFIER_CAPS 0x0040
56#define ECORE_EVENT_LOCK_SCROLL 0x0080
57#define ECORE_EVENT_LOCK_NUM 0x0100
58#define ECORE_EVENT_LOCK_CAPS 0x0200
59#define ECORE_EVENT_LOCK_SHIFT 0x0300
60
61 typedef uintptr_t Ecore_Window;
62 typedef struct _Ecore_Event_Key Ecore_Event_Key;
63 typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button;
64 typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel;
65 typedef struct _Ecore_Event_Mouse_Move Ecore_Event_Mouse_Move;
66 typedef struct _Ecore_Event_Mouse_IO Ecore_Event_Mouse_IO;
67 typedef struct _Ecore_Event_Modifiers Ecore_Event_Modifiers;
68
69 typedef enum _Ecore_Event_Modifier
70 {
71 ECORE_NONE,
72 ECORE_SHIFT,
73 ECORE_CTRL,
74 ECORE_ALT,
75 ECORE_WIN,
76 ECORE_SCROLL,
77 ECORE_CAPS,
78 ECORE_LAST
79 } Ecore_Event_Modifier;
80
81 typedef enum _Ecore_Event_Press
82 {
83 ECORE_DOWN,
84 ECORE_UP
85 } Ecore_Event_Press;
86
87 typedef enum _Ecore_Event_IO
88 {
89 ECORE_IN,
90 ECORE_OUT
91 } Ecore_Event_IO;
92
93 struct _Ecore_Event_Key
94 {
95 const char *keyname;
96 const char *key;
97 const char *string;
98 const char *compose;
99 Ecore_Window window;
100 Ecore_Window root_window;
101 Ecore_Window event_window;
102
103 unsigned int timestamp;
104 unsigned int modifiers;
105
106 int same_screen;
107 };
108
109 struct _Ecore_Event_Mouse_Button
110 {
111 Ecore_Window window;
112 Ecore_Window root_window;
113 Ecore_Window event_window;
114
115 unsigned int timestamp;
116 unsigned int modifiers;
117 unsigned int buttons;
118 unsigned int double_click;
119 unsigned int triple_click;
120 int same_screen;
121
122 int x;
123 int y;
124 struct {
125 int x;
126 int y;
127 } root;
128
129 struct {
130 int device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
131 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) */
132 double pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
133 double angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
134 double x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
135 struct {
136 double x, y;
137 } root;
138 } multi;
139 };
140
141 struct _Ecore_Event_Mouse_Wheel
142 {
143 Ecore_Window window;
144 Ecore_Window root_window;
145 Ecore_Window event_window;
146
147 unsigned int timestamp;
148 unsigned int modifiers;
149
150 int same_screen;
151 int direction;
152 int z;
153
154 int x;
155 int y;
156 struct {
157 int x;
158 int y;
159 } root;
160 };
161
162 struct _Ecore_Event_Mouse_Move
163 {
164 Ecore_Window window;
165 Ecore_Window root_window;
166 Ecore_Window event_window;
167
168 unsigned int timestamp;
169 unsigned int modifiers;
170
171 int same_screen;
172
173 int x;
174 int y;
175 struct {
176 int x;
177 int y;
178 } root;
179
180 struct {
181 int device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
182 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) */
183 double pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
184 double angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
185 double x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
186 struct {
187 double x, y;
188 } root;
189 } multi;
190 };
191
192 struct _Ecore_Event_Mouse_IO
193 {
194 Ecore_Window window;
195 Ecore_Window event_window;
196
197 unsigned int timestamp;
198 unsigned int modifiers;
199
200 int x;
201 int y;
202 };
203
204 struct _Ecore_Event_Modifiers
205 {
206 unsigned int size;
207 unsigned int array[ECORE_LAST];
208 };
209
210 EAPI int ecore_event_init(void);
211 EAPI int ecore_event_shutdown(void);
212
213 EAPI unsigned int ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
214 EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
215
216#ifdef __cplusplus
217}
218#endif
219
220#endif
diff --git a/libraries/ecore/src/lib/ecore_input/Makefile.am b/libraries/ecore/src/lib/ecore_input/Makefile.am
deleted file mode 100644
index 427dc1a..0000000
--- a/libraries/ecore/src/lib/ecore_input/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_builddir)/src/lib/ecore \
6@EFL_ECORE_INPUT_BUILD@ \
7@EINA_CFLAGS@ \
8@EVIL_CFLAGS@
9
10lib_LTLIBRARIES = libecore_input.la
11includes_HEADERS = Ecore_Input.h
12includesdir = $(includedir)/ecore-@VMAJ@
13
14libecore_input_la_SOURCES = \
15ecore_input.c
16
17libecore_input_la_LIBADD = \
18$(top_builddir)/src/lib/ecore/libecore.la \
19@EINA_LIBS@ \
20@EVIL_LIBS@
21
22libecore_input_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
23
24EXTRA_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
deleted file mode 100644
index a3eeb2e..0000000
--- a/libraries/ecore/src/lib/ecore_input/Makefile.in
+++ /dev/null
@@ -1,830 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_input
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_input_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la
90am_libecore_input_la_OBJECTS = ecore_input.lo
91libecore_input_la_OBJECTS = $(am_libecore_input_la_OBJECTS)
92AM_V_lt = $(am__v_lt_$(V))
93am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
94am__v_lt_0 = --silent
95libecore_input_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
96 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
97 $(AM_CFLAGS) $(CFLAGS) $(libecore_input_la_LDFLAGS) $(LDFLAGS) \
98 -o $@
99DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
100depcomp = $(SHELL) $(top_srcdir)/depcomp
101am__depfiles_maybe = depfiles
102am__mv = mv -f
103COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
104 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
105LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
106 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
107 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
108 $(AM_CFLAGS) $(CFLAGS)
109AM_V_CC = $(am__v_CC_$(V))
110am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
111am__v_CC_0 = @echo " CC " $@;
112AM_V_at = $(am__v_at_$(V))
113am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
114am__v_at_0 = @
115CCLD = $(CC)
116LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
117 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
118 $(AM_LDFLAGS) $(LDFLAGS) -o $@
119AM_V_CCLD = $(am__v_CCLD_$(V))
120am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
121am__v_CCLD_0 = @echo " CCLD " $@;
122AM_V_GEN = $(am__v_GEN_$(V))
123am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
124am__v_GEN_0 = @echo " GEN " $@;
125SOURCES = $(libecore_input_la_SOURCES)
126DIST_SOURCES = $(libecore_input_la_SOURCES)
127HEADERS = $(includes_HEADERS)
128ETAGS = etags
129CTAGS = ctags
130DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
131ACLOCAL = @ACLOCAL@
132ALLOCA = @ALLOCA@
133AMTAR = @AMTAR@
134AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
135AR = @AR@
136AS = @AS@
137AUTOCONF = @AUTOCONF@
138AUTOHEADER = @AUTOHEADER@
139AUTOMAKE = @AUTOMAKE@
140AWK = @AWK@
141CARES_CFLAGS = @CARES_CFLAGS@
142CARES_LIBS = @CARES_LIBS@
143CC = @CC@
144CCDEPMODE = @CCDEPMODE@
145CFLAGS = @CFLAGS@
146CHECK_CFLAGS = @CHECK_CFLAGS@
147CHECK_LIBS = @CHECK_LIBS@
148CPP = @CPP@
149CPPFLAGS = @CPPFLAGS@
150CURL_CFLAGS = @CURL_CFLAGS@
151CURL_LIBS = @CURL_LIBS@
152CXX = @CXX@
153CXXCPP = @CXXCPP@
154CXXDEPMODE = @CXXDEPMODE@
155CXXFLAGS = @CXXFLAGS@
156CYGPATH_W = @CYGPATH_W@
157DEFS = @DEFS@
158DEPDIR = @DEPDIR@
159DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
160DIRECTFB_LIBS = @DIRECTFB_LIBS@
161DLLTOOL = @DLLTOOL@
162DSYMUTIL = @DSYMUTIL@
163DUMPBIN = @DUMPBIN@
164ECHO_C = @ECHO_C@
165ECHO_N = @ECHO_N@
166ECHO_T = @ECHO_T@
167ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
168ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
169EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
170EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
171EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
172EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
173EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
174EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
175EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
176EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
177EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
178EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
179EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
180EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
181EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
182EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
183EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
184EGREP = @EGREP@
185EINA_CFLAGS = @EINA_CFLAGS@
186EINA_LIBS = @EINA_LIBS@
187ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
188ESCAPE_LIBS = @ESCAPE_LIBS@
189EVAS_CFLAGS = @EVAS_CFLAGS@
190EVAS_LIBS = @EVAS_LIBS@
191EVIL_CFLAGS = @EVIL_CFLAGS@
192EVIL_LIBS = @EVIL_LIBS@
193EXEEXT = @EXEEXT@
194EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
195EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@
199GLIB_LIBS = @GLIB_LIBS@
200GMSGFMT = @GMSGFMT@
201GMSGFMT_015 = @GMSGFMT_015@
202GREP = @GREP@
203INSTALL = @INSTALL@
204INSTALL_DATA = @INSTALL_DATA@
205INSTALL_PROGRAM = @INSTALL_PROGRAM@
206INSTALL_SCRIPT = @INSTALL_SCRIPT@
207INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
208INTLLIBS = @INTLLIBS@
209INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
210KEYSYMDEFS = @KEYSYMDEFS@
211LD = @LD@
212LDFLAGS = @LDFLAGS@
213LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
214LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
215LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
216LIBICONV = @LIBICONV@
217LIBINTL = @LIBINTL@
218LIBOBJS = @LIBOBJS@
219LIBS = @LIBS@
220LIBTOOL = @LIBTOOL@
221LIPO = @LIPO@
222LN_S = @LN_S@
223LTLIBICONV = @LTLIBICONV@
224LTLIBINTL = @LTLIBINTL@
225LTLIBOBJS = @LTLIBOBJS@
226MAKEINFO = @MAKEINFO@
227MKDIR_P = @MKDIR_P@
228MSGFMT = @MSGFMT@
229MSGFMT_015 = @MSGFMT_015@
230MSGMERGE = @MSGMERGE@
231NM = @NM@
232NMEDIT = @NMEDIT@
233OBJC = @OBJC@
234OBJCDEPMODE = @OBJCDEPMODE@
235OBJCFLAGS = @OBJCFLAGS@
236OBJDUMP = @OBJDUMP@
237OBJEXT = @OBJEXT@
238OTOOL = @OTOOL@
239OTOOL64 = @OTOOL64@
240PACKAGE = @PACKAGE@
241PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
242PACKAGE_NAME = @PACKAGE_NAME@
243PACKAGE_STRING = @PACKAGE_STRING@
244PACKAGE_TARNAME = @PACKAGE_TARNAME@
245PACKAGE_URL = @PACKAGE_URL@
246PACKAGE_VERSION = @PACKAGE_VERSION@
247PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@
251PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
252PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
253POSUB = @POSUB@
254RANLIB = @RANLIB@
255SCIM_CFLAGS = @SCIM_CFLAGS@
256SCIM_LIBS = @SCIM_LIBS@
257SDL_CFLAGS = @SDL_CFLAGS@
258SDL_CONFIG = @SDL_CONFIG@
259SDL_LIBS = @SDL_LIBS@
260SED = @SED@
261SET_MAKE = @SET_MAKE@
262SHELL = @SHELL@
263SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
264SSL_CFLAGS = @SSL_CFLAGS@
265SSL_LIBS = @SSL_LIBS@
266STRIP = @STRIP@
267TLS2_CFLAGS = @TLS2_CFLAGS@
268TLS2_LIBS = @TLS2_LIBS@
269TLS_CFLAGS = @TLS_CFLAGS@
270TLS_LIBS = @TLS_LIBS@
271TSLIB_CFLAGS = @TSLIB_CFLAGS@
272TSLIB_LIBS = @TSLIB_LIBS@
273USE_NLS = @USE_NLS@
274VERSION = @VERSION@
275VMAJ = @VMAJ@
276WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
277WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
278WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
279WAYLAND_LIBS = @WAYLAND_LIBS@
280WIN32_CFLAGS = @WIN32_CFLAGS@
281WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
282WIN32_LIBS = @WIN32_LIBS@
283XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
284XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
285XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
286XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
287XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
288XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
289XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
290XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
291XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
292XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
293XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
294XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
295XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
296XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
297XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
298XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
299XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
300XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
301XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
302XCB_X11_LIBS = @XCB_X11_LIBS@
303XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
304XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
305XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
306XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
307XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
308XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
309XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
310XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
311XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
312XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
313XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
314XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
315XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
316XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
317XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
318XDAMAGE_LIBS = @XDAMAGE_LIBS@
319XDPMS_CFLAGS = @XDPMS_CFLAGS@
320XDPMS_LIBS = @XDPMS_LIBS@
321XFIXES_CFLAGS = @XFIXES_CFLAGS@
322XFIXES_LIBS = @XFIXES_LIBS@
323XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
324XGESTURE_LIBS = @XGESTURE_LIBS@
325XGETTEXT = @XGETTEXT@
326XGETTEXT_015 = @XGETTEXT_015@
327XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
328XI2_CFLAGS = @XI2_CFLAGS@
329XI2_LIBS = @XI2_LIBS@
330XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
331XINERAMA_LIBS = @XINERAMA_LIBS@
332XKB_CFLAGS = @XKB_CFLAGS@
333XKB_LIBS = @XKB_LIBS@
334XMKMF = @XMKMF@
335XPRINT_CFLAGS = @XPRINT_CFLAGS@
336XPRINT_LIBS = @XPRINT_LIBS@
337XRANDR_CFLAGS = @XRANDR_CFLAGS@
338XRANDR_LIBS = @XRANDR_LIBS@
339XRENDER_CFLAGS = @XRENDER_CFLAGS@
340XRENDER_LIBS = @XRENDER_LIBS@
341XSS_CFLAGS = @XSS_CFLAGS@
342XSS_LIBS = @XSS_LIBS@
343XTEST_CFLAGS = @XTEST_CFLAGS@
344XTEST_LIBS = @XTEST_LIBS@
345X_CFLAGS = @X_CFLAGS@
346X_EXTRA_LIBS = @X_EXTRA_LIBS@
347X_LIBS = @X_LIBS@
348X_PRE_LIBS = @X_PRE_LIBS@
349Xcursor_cflags = @Xcursor_cflags@
350Xcursor_libs = @Xcursor_libs@
351abs_builddir = @abs_builddir@
352abs_srcdir = @abs_srcdir@
353abs_top_builddir = @abs_top_builddir@
354abs_top_srcdir = @abs_top_srcdir@
355ac_ct_CC = @ac_ct_CC@
356ac_ct_CXX = @ac_ct_CXX@
357ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
358ac_ct_OBJC = @ac_ct_OBJC@
359am__include = @am__include@
360am__leading_dot = @am__leading_dot@
361am__quote = @am__quote@
362am__tar = @am__tar@
363am__untar = @am__untar@
364bindir = @bindir@
365build = @build@
366build_alias = @build_alias@
367build_cpu = @build_cpu@
368build_os = @build_os@
369build_vendor = @build_vendor@
370builddir = @builddir@
371cocoa_ldflags = @cocoa_ldflags@
372datadir = @datadir@
373datarootdir = @datarootdir@
374dlopen_libs = @dlopen_libs@
375docdir = @docdir@
376dvidir = @dvidir@
377ecore_cocoa_cflags = @ecore_cocoa_cflags@
378ecore_cocoa_libs = @ecore_cocoa_libs@
379ecore_con_cflags = @ecore_con_cflags@
380ecore_con_libs = @ecore_con_libs@
381ecore_directfb_cflags = @ecore_directfb_cflags@
382ecore_directfb_libs = @ecore_directfb_libs@
383ecore_evas_cflags = @ecore_evas_cflags@
384ecore_evas_libs = @ecore_evas_libs@
385ecore_fb_cflags = @ecore_fb_cflags@
386ecore_fb_libs = @ecore_fb_libs@
387ecore_file_cflags = @ecore_file_cflags@
388ecore_file_libs = @ecore_file_libs@
389ecore_imf_cflags = @ecore_imf_cflags@
390ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
391ecore_imf_evas_libs = @ecore_imf_evas_libs@
392ecore_imf_libs = @ecore_imf_libs@
393ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
394ecore_imf_scim_libs = @ecore_imf_scim_libs@
395ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
396ecore_imf_xim_libs = @ecore_imf_xim_libs@
397ecore_input_cflags = @ecore_input_cflags@
398ecore_input_evas_cflags = @ecore_input_evas_cflags@
399ecore_input_evas_libs = @ecore_input_evas_libs@
400ecore_input_libs = @ecore_input_libs@
401ecore_ipc_cflags = @ecore_ipc_cflags@
402ecore_ipc_libs = @ecore_ipc_libs@
403ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
404ecore_psl1ght_libs = @ecore_psl1ght_libs@
405ecore_sdl_cflags = @ecore_sdl_cflags@
406ecore_sdl_libs = @ecore_sdl_libs@
407ecore_wayland_cflags = @ecore_wayland_cflags@
408ecore_wayland_libs = @ecore_wayland_libs@
409ecore_win32_cflags = @ecore_win32_cflags@
410ecore_win32_libs = @ecore_win32_libs@
411ecore_wince_cflags = @ecore_wince_cflags@
412ecore_wince_libs = @ecore_wince_libs@
413ecore_x_cflags = @ecore_x_cflags@
414ecore_x_libs = @ecore_x_libs@
415ecore_x_libs_private = @ecore_x_libs_private@
416efl_doxygen = @efl_doxygen@
417efl_have_doxygen = @efl_have_doxygen@
418exec_prefix = @exec_prefix@
419have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
420host = @host@
421host_alias = @host_alias@
422host_cpu = @host_cpu@
423host_os = @host_os@
424host_vendor = @host_vendor@
425htmldir = @htmldir@
426includedir = @includedir@
427infodir = @infodir@
428install_sh = @install_sh@
429libdir = @libdir@
430libexecdir = @libexecdir@
431localedir = @localedir@
432localstatedir = @localstatedir@
433lt_ECHO = @lt_ECHO@
434lt_enable_auto_import = @lt_enable_auto_import@
435mandir = @mandir@
436mkdir_p = @mkdir_p@
437oldincludedir = @oldincludedir@
438pdfdir = @pdfdir@
439pkgconfig_requires_private = @pkgconfig_requires_private@
440prefix = @prefix@
441program_transform_name = @program_transform_name@
442psdir = @psdir@
443release_info = @release_info@
444requirements_ecore = @requirements_ecore@
445requirements_ecore_cocoa = @requirements_ecore_cocoa@
446requirements_ecore_con = @requirements_ecore_con@
447requirements_ecore_directfb = @requirements_ecore_directfb@
448requirements_ecore_evas = @requirements_ecore_evas@
449requirements_ecore_fb = @requirements_ecore_fb@
450requirements_ecore_file = @requirements_ecore_file@
451requirements_ecore_imf = @requirements_ecore_imf@
452requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
453requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
454requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
455requirements_ecore_input = @requirements_ecore_input@
456requirements_ecore_input_evas = @requirements_ecore_input_evas@
457requirements_ecore_ipc = @requirements_ecore_ipc@
458requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
459requirements_ecore_sdl = @requirements_ecore_sdl@
460requirements_ecore_wayland = @requirements_ecore_wayland@
461requirements_ecore_win32 = @requirements_ecore_win32@
462requirements_ecore_wince = @requirements_ecore_wince@
463requirements_ecore_x = @requirements_ecore_x@
464rt_libs = @rt_libs@
465sbindir = @sbindir@
466sharedstatedir = @sharedstatedir@
467srcdir = @srcdir@
468sysconfdir = @sysconfdir@
469target_alias = @target_alias@
470top_build_prefix = @top_build_prefix@
471top_builddir = @top_builddir@
472top_srcdir = @top_srcdir@
473version_info = @version_info@
474x_cflags = @x_cflags@
475x_includes = @x_includes@
476x_libs = @x_libs@
477MAINTAINERCLEANFILES = Makefile.in
478AM_CPPFLAGS = \
479-I$(top_srcdir)/src/lib/ecore \
480-I$(top_builddir)/src/lib/ecore \
481@EFL_ECORE_INPUT_BUILD@ \
482@EINA_CFLAGS@ \
483@EVIL_CFLAGS@
484
485lib_LTLIBRARIES = libecore_input.la
486includes_HEADERS = Ecore_Input.h
487includesdir = $(includedir)/ecore-@VMAJ@
488libecore_input_la_SOURCES = \
489ecore_input.c
490
491libecore_input_la_LIBADD = \
492$(top_builddir)/src/lib/ecore/libecore.la \
493@EINA_LIBS@ \
494@EVIL_LIBS@
495
496libecore_input_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
497EXTRA_DIST = ecore_input_private.h
498all: all-am
499
500.SUFFIXES:
501.SUFFIXES: .c .lo .o .obj
502$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
503 @for dep in $?; do \
504 case '$(am__configure_deps)' in \
505 *$$dep*) \
506 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
507 && { if test -f $@; then exit 0; else break; fi; }; \
508 exit 1;; \
509 esac; \
510 done; \
511 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_input/Makefile'; \
512 $(am__cd) $(top_srcdir) && \
513 $(AUTOMAKE) --gnu src/lib/ecore_input/Makefile
514.PRECIOUS: Makefile
515Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
516 @case '$?' in \
517 *config.status*) \
518 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
519 *) \
520 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
521 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
522 esac;
523
524$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
525 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
526
527$(top_srcdir)/configure: $(am__configure_deps)
528 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
529$(ACLOCAL_M4): $(am__aclocal_m4_deps)
530 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
531$(am__aclocal_m4_deps):
532install-libLTLIBRARIES: $(lib_LTLIBRARIES)
533 @$(NORMAL_INSTALL)
534 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
535 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
536 list2=; for p in $$list; do \
537 if test -f $$p; then \
538 list2="$$list2 $$p"; \
539 else :; fi; \
540 done; \
541 test -z "$$list2" || { \
542 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
543 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
544 }
545
546uninstall-libLTLIBRARIES:
547 @$(NORMAL_UNINSTALL)
548 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
549 for p in $$list; do \
550 $(am__strip_dir) \
551 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
552 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
553 done
554
555clean-libLTLIBRARIES:
556 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
557 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
558 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
559 test "$$dir" != "$$p" || dir=.; \
560 echo "rm -f \"$${dir}/so_locations\""; \
561 rm -f "$${dir}/so_locations"; \
562 done
563libecore_input.la: $(libecore_input_la_OBJECTS) $(libecore_input_la_DEPENDENCIES)
564 $(AM_V_CCLD)$(libecore_input_la_LINK) -rpath $(libdir) $(libecore_input_la_OBJECTS) $(libecore_input_la_LIBADD) $(LIBS)
565
566mostlyclean-compile:
567 -rm -f *.$(OBJEXT)
568
569distclean-compile:
570 -rm -f *.tab.c
571
572@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_input.Plo@am__quote@
573
574.c.o:
575@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
576@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
577@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
578@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
579@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
580@am__fastdepCC_FALSE@ $(COMPILE) -c $<
581
582.c.obj:
583@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
584@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
585@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
586@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
587@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
588@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
589
590.c.lo:
591@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
592@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
593@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
594@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
595@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
596@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
597
598mostlyclean-libtool:
599 -rm -f *.lo
600
601clean-libtool:
602 -rm -rf .libs _libs
603install-includesHEADERS: $(includes_HEADERS)
604 @$(NORMAL_INSTALL)
605 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
606 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
607 for p in $$list; do \
608 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
609 echo "$$d$$p"; \
610 done | $(am__base_list) | \
611 while read files; do \
612 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
613 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
614 done
615
616uninstall-includesHEADERS:
617 @$(NORMAL_UNINSTALL)
618 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
619 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
620 test -n "$$files" || exit 0; \
621 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
622 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
623
624ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
625 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
626 unique=`for i in $$list; do \
627 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
628 done | \
629 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
630 END { if (nonempty) { for (i in files) print i; }; }'`; \
631 mkid -fID $$unique
632tags: TAGS
633
634TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
635 $(TAGS_FILES) $(LISP)
636 set x; \
637 here=`pwd`; \
638 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
639 unique=`for i in $$list; do \
640 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
641 done | \
642 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
643 END { if (nonempty) { for (i in files) print i; }; }'`; \
644 shift; \
645 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
646 test -n "$$unique" || unique=$$empty_fix; \
647 if test $$# -gt 0; then \
648 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
649 "$$@" $$unique; \
650 else \
651 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
652 $$unique; \
653 fi; \
654 fi
655ctags: CTAGS
656CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
657 $(TAGS_FILES) $(LISP)
658 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
659 unique=`for i in $$list; do \
660 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
661 done | \
662 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
663 END { if (nonempty) { for (i in files) print i; }; }'`; \
664 test -z "$(CTAGS_ARGS)$$unique" \
665 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
666 $$unique
667
668GTAGS:
669 here=`$(am__cd) $(top_builddir) && pwd` \
670 && $(am__cd) $(top_srcdir) \
671 && gtags -i $(GTAGS_ARGS) "$$here"
672
673distclean-tags:
674 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
675
676distdir: $(DISTFILES)
677 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
678 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
679 list='$(DISTFILES)'; \
680 dist_files=`for file in $$list; do echo $$file; done | \
681 sed -e "s|^$$srcdirstrip/||;t" \
682 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
683 case $$dist_files in \
684 */*) $(MKDIR_P) `echo "$$dist_files" | \
685 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
686 sort -u` ;; \
687 esac; \
688 for file in $$dist_files; do \
689 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
690 if test -d $$d/$$file; then \
691 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
692 if test -d "$(distdir)/$$file"; then \
693 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
694 fi; \
695 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
696 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
697 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
698 fi; \
699 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
700 else \
701 test -f "$(distdir)/$$file" \
702 || cp -p $$d/$$file "$(distdir)/$$file" \
703 || exit 1; \
704 fi; \
705 done
706check-am: all-am
707check: check-am
708all-am: Makefile $(LTLIBRARIES) $(HEADERS)
709installdirs:
710 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
711 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
712 done
713install: install-am
714install-exec: install-exec-am
715install-data: install-data-am
716uninstall: uninstall-am
717
718install-am: all-am
719 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
720
721installcheck: installcheck-am
722install-strip:
723 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
724 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
725 `test -z '$(STRIP)' || \
726 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
727mostlyclean-generic:
728
729clean-generic:
730
731distclean-generic:
732 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
733 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
734
735maintainer-clean-generic:
736 @echo "This command is intended for maintainers to use"
737 @echo "it deletes files that may require special tools to rebuild."
738 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
739clean: clean-am
740
741clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
742 mostlyclean-am
743
744distclean: distclean-am
745 -rm -rf ./$(DEPDIR)
746 -rm -f Makefile
747distclean-am: clean-am distclean-compile distclean-generic \
748 distclean-tags
749
750dvi: dvi-am
751
752dvi-am:
753
754html: html-am
755
756html-am:
757
758info: info-am
759
760info-am:
761
762install-data-am: install-includesHEADERS
763
764install-dvi: install-dvi-am
765
766install-dvi-am:
767
768install-exec-am: install-libLTLIBRARIES
769
770install-html: install-html-am
771
772install-html-am:
773
774install-info: install-info-am
775
776install-info-am:
777
778install-man:
779
780install-pdf: install-pdf-am
781
782install-pdf-am:
783
784install-ps: install-ps-am
785
786install-ps-am:
787
788installcheck-am:
789
790maintainer-clean: maintainer-clean-am
791 -rm -rf ./$(DEPDIR)
792 -rm -f Makefile
793maintainer-clean-am: distclean-am maintainer-clean-generic
794
795mostlyclean: mostlyclean-am
796
797mostlyclean-am: mostlyclean-compile mostlyclean-generic \
798 mostlyclean-libtool
799
800pdf: pdf-am
801
802pdf-am:
803
804ps: ps-am
805
806ps-am:
807
808uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
809
810.MAKE: install-am install-strip
811
812.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
813 clean-libLTLIBRARIES clean-libtool ctags distclean \
814 distclean-compile distclean-generic distclean-libtool \
815 distclean-tags distdir dvi dvi-am html html-am info info-am \
816 install install-am install-data install-data-am install-dvi \
817 install-dvi-am install-exec install-exec-am install-html \
818 install-html-am install-includesHEADERS install-info \
819 install-info-am install-libLTLIBRARIES install-man install-pdf \
820 install-pdf-am install-ps install-ps-am install-strip \
821 installcheck installcheck-am installdirs maintainer-clean \
822 maintainer-clean-generic mostlyclean mostlyclean-compile \
823 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
824 tags uninstall uninstall-am uninstall-includesHEADERS \
825 uninstall-libLTLIBRARIES
826
827
828# Tell versions [3.59,3.63) of GNU make to not export all variables.
829# Otherwise a system limit (for SysV at least) may be exceeded.
830.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_input/ecore_input.c b/libraries/ecore/src/lib/ecore_input/ecore_input.c
deleted file mode 100644
index ce4c275..0000000
--- a/libraries/ecore/src/lib/ecore_input/ecore_input.c
+++ /dev/null
@@ -1,120 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10
11#include "Ecore_Input.h"
12#include "ecore_input_private.h"
13
14
15int _ecore_input_log_dom = -1;
16
17EAPI int ECORE_EVENT_KEY_DOWN = 0;
18EAPI int ECORE_EVENT_KEY_UP = 0;
19EAPI int ECORE_EVENT_MOUSE_BUTTON_DOWN = 0;
20EAPI int ECORE_EVENT_MOUSE_BUTTON_UP = 0;
21EAPI int ECORE_EVENT_MOUSE_MOVE = 0;
22EAPI int ECORE_EVENT_MOUSE_WHEEL = 0;
23EAPI int ECORE_EVENT_MOUSE_IN = 0;
24EAPI int ECORE_EVENT_MOUSE_OUT = 0;
25
26static int _ecore_event_init_count = 0;
27
28EAPI int
29ecore_event_init(void)
30{
31 if (++_ecore_event_init_count != 1)
32 return _ecore_event_init_count;
33
34 _ecore_input_log_dom = eina_log_domain_register
35 ("ecore_input", ECORE_INPUT_DEFAULT_LOG_COLOR);
36 if(_ecore_input_log_dom < 0)
37 {
38 EINA_LOG_ERR("Impossible to create a log domain for the ecore input module.");
39 return --_ecore_event_init_count;
40 }
41
42 ECORE_EVENT_KEY_DOWN = ecore_event_type_new();
43 ECORE_EVENT_KEY_UP = ecore_event_type_new();
44 ECORE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
45 ECORE_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
46 ECORE_EVENT_MOUSE_MOVE = ecore_event_type_new();
47 ECORE_EVENT_MOUSE_WHEEL = ecore_event_type_new();
48 ECORE_EVENT_MOUSE_IN = ecore_event_type_new();
49 ECORE_EVENT_MOUSE_OUT = ecore_event_type_new();
50
51 return _ecore_event_init_count;
52}
53
54EAPI int
55ecore_event_shutdown(void)
56{
57 if (--_ecore_event_init_count != 0)
58 return _ecore_event_init_count;
59
60 ECORE_EVENT_KEY_DOWN = 0;
61 ECORE_EVENT_KEY_UP = 0;
62 ECORE_EVENT_MOUSE_BUTTON_DOWN = 0;
63 ECORE_EVENT_MOUSE_BUTTON_UP = 0;
64 ECORE_EVENT_MOUSE_MOVE = 0;
65 ECORE_EVENT_MOUSE_WHEEL = 0;
66 ECORE_EVENT_MOUSE_IN = 0;
67 ECORE_EVENT_MOUSE_OUT = 0;
68 eina_log_domain_unregister(_ecore_input_log_dom);
69 _ecore_input_log_dom = -1;
70 return _ecore_event_init_count;
71}
72
73typedef struct _Ecore_Event_Modifier_Match Ecore_Event_Modifier_Match;
74struct _Ecore_Event_Modifier_Match
75{
76 const char *key;
77 Ecore_Event_Modifier modifier;
78 unsigned int event_modifier;
79};
80
81static const Ecore_Event_Modifier_Match matchs[] = {
82 { "Shift_L", ECORE_SHIFT, ECORE_EVENT_MODIFIER_SHIFT },
83 { "Shift_R", ECORE_SHIFT, ECORE_EVENT_MODIFIER_SHIFT },
84 { "Alt_L", ECORE_ALT, ECORE_EVENT_MODIFIER_ALT },
85 { "Alt_R", ECORE_ALT, ECORE_EVENT_MODIFIER_ALT },
86 { "Control_L", ECORE_CTRL, ECORE_EVENT_MODIFIER_CTRL },
87 { "Control_R", ECORE_CTRL, ECORE_EVENT_MODIFIER_CTRL },
88 { "Caps_Lock", ECORE_CAPS, ECORE_EVENT_MODIFIER_CAPS },
89 { "Super_L", ECORE_WIN, ECORE_EVENT_MODIFIER_WIN },
90 { "Super_R", ECORE_WIN, ECORE_EVENT_MODIFIER_WIN },
91 { "Scroll_Lock", ECORE_SCROLL, ECORE_EVENT_MODIFIER_SCROLL }
92};
93
94EAPI unsigned int
95ecore_event_modifier_mask(Ecore_Event_Modifier modifier)
96{
97 size_t i;
98
99 for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++)
100 if (matchs[i].modifier == modifier)
101 return matchs[i].event_modifier;
102
103 return 0;
104}
105
106EAPI Ecore_Event_Modifier
107ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc)
108{
109 size_t i;
110
111 for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++)
112 if (strcmp(matchs[i].key, key) == 0)
113 {
114 if (modifiers && matchs[i].modifier < modifiers->size)
115 modifiers->array[matchs[i].modifier] += inc;
116 return matchs[i].modifier;
117 }
118
119 return ECORE_NONE;
120}
diff --git a/libraries/ecore/src/lib/ecore_input/ecore_input_private.h b/libraries/ecore/src/lib/ecore_input/ecore_input_private.h
deleted file mode 100644
index 5660a20..0000000
--- a/libraries/ecore/src/lib/ecore_input/ecore_input_private.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _ECORE_INPUT_PRIVATE_H
2#define _ECORE_INPUT_PRIVATE_H
3
4extern int _ecore_input_log_dom;
5
6#ifdef ECORE_INPUT_DEFAULT_LOG_COLOR
7# undef ECORE_INPUT_DEFAULT_LOG_COLOR
8#endif
9
10#define ECORE_INPUT_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
11
12#ifdef ERR
13# undef ERR
14#endif
15#define ERR(...) EINA_LOG_DOM_ERR(_ecore_input_log_dom, __VA_ARGS__)
16
17#ifdef DBG
18# undef DBG
19#endif
20#define DBG(...) EINA_LOG_DOM_DBG(_ecore_input_log_dom, __VA_ARGS__)
21
22#ifdef INF
23# undef INF
24#endif
25#define INF(...) EINA_LOG_DOM_INFO(_ecore_input_log_dom, __VA_ARGS__)
26
27#ifdef WRN
28# undef WRN
29#endif
30#define WRN(...) EINA_LOG_DOM_WARN(_ecore_input_log_dom, __VA_ARGS__)
31
32#ifdef CRIT
33# undef CRIT
34#endif
35#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_input_log_dom, __VA_ARGS__)
36
37#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
deleted file mode 100644
index c97274e..0000000
--- a/libraries/ecore/src/lib/ecore_input_evas/Ecore_Input_Evas.h
+++ /dev/null
@@ -1,64 +0,0 @@
1#ifndef _ECORE_INPUT_EVAS_H
2#define _ECORE_INPUT_EVAS_H
3
4#include <Evas.h>
5
6#ifdef EAPI
7# undef EAPI
8#endif
9
10#ifdef _WIN32
11# ifdef EFL_ECORE_INPUT_EVAS_BUILD
12# ifdef DLL_EXPORT
13# define EAPI __declspec(dllexport)
14# else
15# define EAPI
16# endif /* ! DLL_EXPORT */
17# else
18# define EAPI __declspec(dllimport)
19# endif /* ! EFL_ECORE_INPUT_EVAS_BUILD */
20#else
21# ifdef __GNUC__
22# if __GNUC__ >= 4
23# define EAPI __attribute__ ((visibility("default")))
24# else
25# define EAPI
26# endif
27# else
28# define EAPI
29# endif
30#endif
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36typedef void (*Ecore_Event_Mouse_Move_Cb)(void *window, int x, int y, unsigned int timestamp);
37typedef 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);
38typedef 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);
39typedef 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);
40
41EAPI int ecore_event_evas_init(void);
42EAPI int ecore_event_evas_shutdown(void);
43
44EAPI Eina_Bool ecore_event_evas_key_down(void *data, int type, void *event);
45EAPI Eina_Bool ecore_event_evas_key_up(void *data, int type, void *event);
46EAPI Eina_Bool ecore_event_evas_mouse_button_up(void *data, int type, void *event);
47EAPI Eina_Bool ecore_event_evas_mouse_button_down(void *data, int type, void *event);
48EAPI Eina_Bool ecore_event_evas_mouse_wheel(void *data, int type, void *event);
49EAPI Eina_Bool ecore_event_evas_mouse_move(void *data, int type, void *event);
50EAPI Eina_Bool ecore_event_evas_mouse_in(void *data, int type, void *event);
51EAPI Eina_Bool ecore_event_evas_mouse_out(void *data, int type, void *event);
52
53EAPI 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);
54EAPI void ecore_event_window_unregister(Ecore_Window id);
55EAPI void *ecore_event_window_match(Ecore_Window id);
56EAPI void ecore_event_window_ignore_events(Ecore_Window id, int ignore_event);
57
58EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers);
59
60#ifdef __cplusplus
61}
62#endif
63
64#endif
diff --git a/libraries/ecore/src/lib/ecore_input_evas/Makefile.am b/libraries/ecore/src/lib/ecore_input_evas/Makefile.am
deleted file mode 100644
index ab5cd3b..0000000
--- a/libraries/ecore/src/lib/ecore_input_evas/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore_input \
5-I$(top_builddir)/src/lib/ecore_input \
6-I$(top_srcdir)/src/lib/ecore \
7-I$(top_builddir)/src/lib/ecore \
8@EFL_ECORE_INPUT_EVAS_BUILD@ \
9@EVAS_CFLAGS@ \
10@EINA_CFLAGS@ \
11@EVIL_CFLAGS@
12
13lib_LTLIBRARIES = libecore_input_evas.la
14includes_HEADERS = Ecore_Input_Evas.h
15includesdir = $(includedir)/ecore-@VMAJ@
16
17libecore_input_evas_la_SOURCES = \
18ecore_input_evas.c
19
20libecore_input_evas_la_LIBADD = \
21$(top_builddir)/src/lib/ecore_input/libecore_input.la \
22$(top_builddir)/src/lib/ecore/libecore.la \
23@EVAS_LIBS@ \
24@EINA_LIBS@ \
25@EVIL_LIBS@
26
27libecore_input_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
28
29EXTRA_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
deleted file mode 100644
index d3937d9..0000000
--- a/libraries/ecore/src/lib/ecore_input_evas/Makefile.in
+++ /dev/null
@@ -1,836 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_input_evas
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_input_evas_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore_input/libecore_input.la \
90 $(top_builddir)/src/lib/ecore/libecore.la
91am_libecore_input_evas_la_OBJECTS = ecore_input_evas.lo
92libecore_input_evas_la_OBJECTS = $(am_libecore_input_evas_la_OBJECTS)
93AM_V_lt = $(am__v_lt_$(V))
94am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
95am__v_lt_0 = --silent
96libecore_input_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
97 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
98 $(AM_CFLAGS) $(CFLAGS) $(libecore_input_evas_la_LDFLAGS) \
99 $(LDFLAGS) -o $@
100DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
101depcomp = $(SHELL) $(top_srcdir)/depcomp
102am__depfiles_maybe = depfiles
103am__mv = mv -f
104COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
105 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
106LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
107 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
108 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
109 $(AM_CFLAGS) $(CFLAGS)
110AM_V_CC = $(am__v_CC_$(V))
111am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
112am__v_CC_0 = @echo " CC " $@;
113AM_V_at = $(am__v_at_$(V))
114am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
115am__v_at_0 = @
116CCLD = $(CC)
117LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
118 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
119 $(AM_LDFLAGS) $(LDFLAGS) -o $@
120AM_V_CCLD = $(am__v_CCLD_$(V))
121am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
122am__v_CCLD_0 = @echo " CCLD " $@;
123AM_V_GEN = $(am__v_GEN_$(V))
124am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
125am__v_GEN_0 = @echo " GEN " $@;
126SOURCES = $(libecore_input_evas_la_SOURCES)
127DIST_SOURCES = $(libecore_input_evas_la_SOURCES)
128HEADERS = $(includes_HEADERS)
129ETAGS = etags
130CTAGS = ctags
131DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
132ACLOCAL = @ACLOCAL@
133ALLOCA = @ALLOCA@
134AMTAR = @AMTAR@
135AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
136AR = @AR@
137AS = @AS@
138AUTOCONF = @AUTOCONF@
139AUTOHEADER = @AUTOHEADER@
140AUTOMAKE = @AUTOMAKE@
141AWK = @AWK@
142CARES_CFLAGS = @CARES_CFLAGS@
143CARES_LIBS = @CARES_LIBS@
144CC = @CC@
145CCDEPMODE = @CCDEPMODE@
146CFLAGS = @CFLAGS@
147CHECK_CFLAGS = @CHECK_CFLAGS@
148CHECK_LIBS = @CHECK_LIBS@
149CPP = @CPP@
150CPPFLAGS = @CPPFLAGS@
151CURL_CFLAGS = @CURL_CFLAGS@
152CURL_LIBS = @CURL_LIBS@
153CXX = @CXX@
154CXXCPP = @CXXCPP@
155CXXDEPMODE = @CXXDEPMODE@
156CXXFLAGS = @CXXFLAGS@
157CYGPATH_W = @CYGPATH_W@
158DEFS = @DEFS@
159DEPDIR = @DEPDIR@
160DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
161DIRECTFB_LIBS = @DIRECTFB_LIBS@
162DLLTOOL = @DLLTOOL@
163DSYMUTIL = @DSYMUTIL@
164DUMPBIN = @DUMPBIN@
165ECHO_C = @ECHO_C@
166ECHO_N = @ECHO_N@
167ECHO_T = @ECHO_T@
168ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
169ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
170EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
171EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
172EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
173EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
174EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
175EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
176EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
177EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
178EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
179EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
180EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
181EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
182EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
183EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
184EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
185EGREP = @EGREP@
186EINA_CFLAGS = @EINA_CFLAGS@
187EINA_LIBS = @EINA_LIBS@
188ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
189ESCAPE_LIBS = @ESCAPE_LIBS@
190EVAS_CFLAGS = @EVAS_CFLAGS@
191EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@
200GLIB_LIBS = @GLIB_LIBS@
201GMSGFMT = @GMSGFMT@
202GMSGFMT_015 = @GMSGFMT_015@
203GREP = @GREP@
204INSTALL = @INSTALL@
205INSTALL_DATA = @INSTALL_DATA@
206INSTALL_PROGRAM = @INSTALL_PROGRAM@
207INSTALL_SCRIPT = @INSTALL_SCRIPT@
208INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
209INTLLIBS = @INTLLIBS@
210INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
211KEYSYMDEFS = @KEYSYMDEFS@
212LD = @LD@
213LDFLAGS = @LDFLAGS@
214LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
215LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
216LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
217LIBICONV = @LIBICONV@
218LIBINTL = @LIBINTL@
219LIBOBJS = @LIBOBJS@
220LIBS = @LIBS@
221LIBTOOL = @LIBTOOL@
222LIPO = @LIPO@
223LN_S = @LN_S@
224LTLIBICONV = @LTLIBICONV@
225LTLIBINTL = @LTLIBINTL@
226LTLIBOBJS = @LTLIBOBJS@
227MAKEINFO = @MAKEINFO@
228MKDIR_P = @MKDIR_P@
229MSGFMT = @MSGFMT@
230MSGFMT_015 = @MSGFMT_015@
231MSGMERGE = @MSGMERGE@
232NM = @NM@
233NMEDIT = @NMEDIT@
234OBJC = @OBJC@
235OBJCDEPMODE = @OBJCDEPMODE@
236OBJCFLAGS = @OBJCFLAGS@
237OBJDUMP = @OBJDUMP@
238OBJEXT = @OBJEXT@
239OTOOL = @OTOOL@
240OTOOL64 = @OTOOL64@
241PACKAGE = @PACKAGE@
242PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
243PACKAGE_NAME = @PACKAGE_NAME@
244PACKAGE_STRING = @PACKAGE_STRING@
245PACKAGE_TARNAME = @PACKAGE_TARNAME@
246PACKAGE_URL = @PACKAGE_URL@
247PACKAGE_VERSION = @PACKAGE_VERSION@
248PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
254POSUB = @POSUB@
255RANLIB = @RANLIB@
256SCIM_CFLAGS = @SCIM_CFLAGS@
257SCIM_LIBS = @SCIM_LIBS@
258SDL_CFLAGS = @SDL_CFLAGS@
259SDL_CONFIG = @SDL_CONFIG@
260SDL_LIBS = @SDL_LIBS@
261SED = @SED@
262SET_MAKE = @SET_MAKE@
263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@
268TLS2_CFLAGS = @TLS2_CFLAGS@
269TLS2_LIBS = @TLS2_LIBS@
270TLS_CFLAGS = @TLS_CFLAGS@
271TLS_LIBS = @TLS_LIBS@
272TSLIB_CFLAGS = @TSLIB_CFLAGS@
273TSLIB_LIBS = @TSLIB_LIBS@
274USE_NLS = @USE_NLS@
275VERSION = @VERSION@
276VMAJ = @VMAJ@
277WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
278WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
279WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
280WAYLAND_LIBS = @WAYLAND_LIBS@
281WIN32_CFLAGS = @WIN32_CFLAGS@
282WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
283WIN32_LIBS = @WIN32_LIBS@
284XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
285XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
286XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
287XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
288XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
289XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
290XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
291XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
292XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
293XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
294XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
295XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
296XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
297XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
298XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
299XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
300XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
301XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
302XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
303XCB_X11_LIBS = @XCB_X11_LIBS@
304XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
305XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
306XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
307XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
308XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
309XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
310XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
311XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
312XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
313XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
314XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
315XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
316XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
317XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
318XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
319XDAMAGE_LIBS = @XDAMAGE_LIBS@
320XDPMS_CFLAGS = @XDPMS_CFLAGS@
321XDPMS_LIBS = @XDPMS_LIBS@
322XFIXES_CFLAGS = @XFIXES_CFLAGS@
323XFIXES_LIBS = @XFIXES_LIBS@
324XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
325XGESTURE_LIBS = @XGESTURE_LIBS@
326XGETTEXT = @XGETTEXT@
327XGETTEXT_015 = @XGETTEXT_015@
328XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
329XI2_CFLAGS = @XI2_CFLAGS@
330XI2_LIBS = @XI2_LIBS@
331XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
332XINERAMA_LIBS = @XINERAMA_LIBS@
333XKB_CFLAGS = @XKB_CFLAGS@
334XKB_LIBS = @XKB_LIBS@
335XMKMF = @XMKMF@
336XPRINT_CFLAGS = @XPRINT_CFLAGS@
337XPRINT_LIBS = @XPRINT_LIBS@
338XRANDR_CFLAGS = @XRANDR_CFLAGS@
339XRANDR_LIBS = @XRANDR_LIBS@
340XRENDER_CFLAGS = @XRENDER_CFLAGS@
341XRENDER_LIBS = @XRENDER_LIBS@
342XSS_CFLAGS = @XSS_CFLAGS@
343XSS_LIBS = @XSS_LIBS@
344XTEST_CFLAGS = @XTEST_CFLAGS@
345XTEST_LIBS = @XTEST_LIBS@
346X_CFLAGS = @X_CFLAGS@
347X_EXTRA_LIBS = @X_EXTRA_LIBS@
348X_LIBS = @X_LIBS@
349X_PRE_LIBS = @X_PRE_LIBS@
350Xcursor_cflags = @Xcursor_cflags@
351Xcursor_libs = @Xcursor_libs@
352abs_builddir = @abs_builddir@
353abs_srcdir = @abs_srcdir@
354abs_top_builddir = @abs_top_builddir@
355abs_top_srcdir = @abs_top_srcdir@
356ac_ct_CC = @ac_ct_CC@
357ac_ct_CXX = @ac_ct_CXX@
358ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
359ac_ct_OBJC = @ac_ct_OBJC@
360am__include = @am__include@
361am__leading_dot = @am__leading_dot@
362am__quote = @am__quote@
363am__tar = @am__tar@
364am__untar = @am__untar@
365bindir = @bindir@
366build = @build@
367build_alias = @build_alias@
368build_cpu = @build_cpu@
369build_os = @build_os@
370build_vendor = @build_vendor@
371builddir = @builddir@
372cocoa_ldflags = @cocoa_ldflags@
373datadir = @datadir@
374datarootdir = @datarootdir@
375dlopen_libs = @dlopen_libs@
376docdir = @docdir@
377dvidir = @dvidir@
378ecore_cocoa_cflags = @ecore_cocoa_cflags@
379ecore_cocoa_libs = @ecore_cocoa_libs@
380ecore_con_cflags = @ecore_con_cflags@
381ecore_con_libs = @ecore_con_libs@
382ecore_directfb_cflags = @ecore_directfb_cflags@
383ecore_directfb_libs = @ecore_directfb_libs@
384ecore_evas_cflags = @ecore_evas_cflags@
385ecore_evas_libs = @ecore_evas_libs@
386ecore_fb_cflags = @ecore_fb_cflags@
387ecore_fb_libs = @ecore_fb_libs@
388ecore_file_cflags = @ecore_file_cflags@
389ecore_file_libs = @ecore_file_libs@
390ecore_imf_cflags = @ecore_imf_cflags@
391ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
392ecore_imf_evas_libs = @ecore_imf_evas_libs@
393ecore_imf_libs = @ecore_imf_libs@
394ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
395ecore_imf_scim_libs = @ecore_imf_scim_libs@
396ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
397ecore_imf_xim_libs = @ecore_imf_xim_libs@
398ecore_input_cflags = @ecore_input_cflags@
399ecore_input_evas_cflags = @ecore_input_evas_cflags@
400ecore_input_evas_libs = @ecore_input_evas_libs@
401ecore_input_libs = @ecore_input_libs@
402ecore_ipc_cflags = @ecore_ipc_cflags@
403ecore_ipc_libs = @ecore_ipc_libs@
404ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
405ecore_psl1ght_libs = @ecore_psl1ght_libs@
406ecore_sdl_cflags = @ecore_sdl_cflags@
407ecore_sdl_libs = @ecore_sdl_libs@
408ecore_wayland_cflags = @ecore_wayland_cflags@
409ecore_wayland_libs = @ecore_wayland_libs@
410ecore_win32_cflags = @ecore_win32_cflags@
411ecore_win32_libs = @ecore_win32_libs@
412ecore_wince_cflags = @ecore_wince_cflags@
413ecore_wince_libs = @ecore_wince_libs@
414ecore_x_cflags = @ecore_x_cflags@
415ecore_x_libs = @ecore_x_libs@
416ecore_x_libs_private = @ecore_x_libs_private@
417efl_doxygen = @efl_doxygen@
418efl_have_doxygen = @efl_have_doxygen@
419exec_prefix = @exec_prefix@
420have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
421host = @host@
422host_alias = @host_alias@
423host_cpu = @host_cpu@
424host_os = @host_os@
425host_vendor = @host_vendor@
426htmldir = @htmldir@
427includedir = @includedir@
428infodir = @infodir@
429install_sh = @install_sh@
430libdir = @libdir@
431libexecdir = @libexecdir@
432localedir = @localedir@
433localstatedir = @localstatedir@
434lt_ECHO = @lt_ECHO@
435lt_enable_auto_import = @lt_enable_auto_import@
436mandir = @mandir@
437mkdir_p = @mkdir_p@
438oldincludedir = @oldincludedir@
439pdfdir = @pdfdir@
440pkgconfig_requires_private = @pkgconfig_requires_private@
441prefix = @prefix@
442program_transform_name = @program_transform_name@
443psdir = @psdir@
444release_info = @release_info@
445requirements_ecore = @requirements_ecore@
446requirements_ecore_cocoa = @requirements_ecore_cocoa@
447requirements_ecore_con = @requirements_ecore_con@
448requirements_ecore_directfb = @requirements_ecore_directfb@
449requirements_ecore_evas = @requirements_ecore_evas@
450requirements_ecore_fb = @requirements_ecore_fb@
451requirements_ecore_file = @requirements_ecore_file@
452requirements_ecore_imf = @requirements_ecore_imf@
453requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
454requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
455requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
456requirements_ecore_input = @requirements_ecore_input@
457requirements_ecore_input_evas = @requirements_ecore_input_evas@
458requirements_ecore_ipc = @requirements_ecore_ipc@
459requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
460requirements_ecore_sdl = @requirements_ecore_sdl@
461requirements_ecore_wayland = @requirements_ecore_wayland@
462requirements_ecore_win32 = @requirements_ecore_win32@
463requirements_ecore_wince = @requirements_ecore_wince@
464requirements_ecore_x = @requirements_ecore_x@
465rt_libs = @rt_libs@
466sbindir = @sbindir@
467sharedstatedir = @sharedstatedir@
468srcdir = @srcdir@
469sysconfdir = @sysconfdir@
470target_alias = @target_alias@
471top_build_prefix = @top_build_prefix@
472top_builddir = @top_builddir@
473top_srcdir = @top_srcdir@
474version_info = @version_info@
475x_cflags = @x_cflags@
476x_includes = @x_includes@
477x_libs = @x_libs@
478MAINTAINERCLEANFILES = Makefile.in
479AM_CPPFLAGS = \
480-I$(top_srcdir)/src/lib/ecore_input \
481-I$(top_builddir)/src/lib/ecore_input \
482-I$(top_srcdir)/src/lib/ecore \
483-I$(top_builddir)/src/lib/ecore \
484@EFL_ECORE_INPUT_EVAS_BUILD@ \
485@EVAS_CFLAGS@ \
486@EINA_CFLAGS@ \
487@EVIL_CFLAGS@
488
489lib_LTLIBRARIES = libecore_input_evas.la
490includes_HEADERS = Ecore_Input_Evas.h
491includesdir = $(includedir)/ecore-@VMAJ@
492libecore_input_evas_la_SOURCES = \
493ecore_input_evas.c
494
495libecore_input_evas_la_LIBADD = \
496$(top_builddir)/src/lib/ecore_input/libecore_input.la \
497$(top_builddir)/src/lib/ecore/libecore.la \
498@EVAS_LIBS@ \
499@EINA_LIBS@ \
500@EVIL_LIBS@
501
502libecore_input_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
503EXTRA_DIST = ecore_input_evas_private.h
504all: all-am
505
506.SUFFIXES:
507.SUFFIXES: .c .lo .o .obj
508$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
509 @for dep in $?; do \
510 case '$(am__configure_deps)' in \
511 *$$dep*) \
512 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
513 && { if test -f $@; then exit 0; else break; fi; }; \
514 exit 1;; \
515 esac; \
516 done; \
517 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_input_evas/Makefile'; \
518 $(am__cd) $(top_srcdir) && \
519 $(AUTOMAKE) --gnu src/lib/ecore_input_evas/Makefile
520.PRECIOUS: Makefile
521Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
522 @case '$?' in \
523 *config.status*) \
524 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
525 *) \
526 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
527 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
528 esac;
529
530$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
531 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
532
533$(top_srcdir)/configure: $(am__configure_deps)
534 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
535$(ACLOCAL_M4): $(am__aclocal_m4_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(am__aclocal_m4_deps):
538install-libLTLIBRARIES: $(lib_LTLIBRARIES)
539 @$(NORMAL_INSTALL)
540 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
541 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
542 list2=; for p in $$list; do \
543 if test -f $$p; then \
544 list2="$$list2 $$p"; \
545 else :; fi; \
546 done; \
547 test -z "$$list2" || { \
548 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
549 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
550 }
551
552uninstall-libLTLIBRARIES:
553 @$(NORMAL_UNINSTALL)
554 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
555 for p in $$list; do \
556 $(am__strip_dir) \
557 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
558 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
559 done
560
561clean-libLTLIBRARIES:
562 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
563 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
564 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
565 test "$$dir" != "$$p" || dir=.; \
566 echo "rm -f \"$${dir}/so_locations\""; \
567 rm -f "$${dir}/so_locations"; \
568 done
569libecore_input_evas.la: $(libecore_input_evas_la_OBJECTS) $(libecore_input_evas_la_DEPENDENCIES)
570 $(AM_V_CCLD)$(libecore_input_evas_la_LINK) -rpath $(libdir) $(libecore_input_evas_la_OBJECTS) $(libecore_input_evas_la_LIBADD) $(LIBS)
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_input_evas.Plo@am__quote@
579
580.c.o:
581@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
582@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
583@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
584@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
585@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
586@am__fastdepCC_FALSE@ $(COMPILE) -c $<
587
588.c.obj:
589@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
590@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
591@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
592@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
594@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
595
596.c.lo:
597@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
598@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
599@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
601@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
602@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
603
604mostlyclean-libtool:
605 -rm -f *.lo
606
607clean-libtool:
608 -rm -rf .libs _libs
609install-includesHEADERS: $(includes_HEADERS)
610 @$(NORMAL_INSTALL)
611 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
612 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
613 for p in $$list; do \
614 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
615 echo "$$d$$p"; \
616 done | $(am__base_list) | \
617 while read files; do \
618 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
619 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
620 done
621
622uninstall-includesHEADERS:
623 @$(NORMAL_UNINSTALL)
624 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
625 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
626 test -n "$$files" || exit 0; \
627 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
628 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
629
630ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
631 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
632 unique=`for i in $$list; do \
633 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
634 done | \
635 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
636 END { if (nonempty) { for (i in files) print i; }; }'`; \
637 mkid -fID $$unique
638tags: TAGS
639
640TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
641 $(TAGS_FILES) $(LISP)
642 set x; \
643 here=`pwd`; \
644 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
645 unique=`for i in $$list; do \
646 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
647 done | \
648 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
649 END { if (nonempty) { for (i in files) print i; }; }'`; \
650 shift; \
651 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
652 test -n "$$unique" || unique=$$empty_fix; \
653 if test $$# -gt 0; then \
654 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
655 "$$@" $$unique; \
656 else \
657 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
658 $$unique; \
659 fi; \
660 fi
661ctags: CTAGS
662CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
663 $(TAGS_FILES) $(LISP)
664 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
665 unique=`for i in $$list; do \
666 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
667 done | \
668 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
669 END { if (nonempty) { for (i in files) print i; }; }'`; \
670 test -z "$(CTAGS_ARGS)$$unique" \
671 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
672 $$unique
673
674GTAGS:
675 here=`$(am__cd) $(top_builddir) && pwd` \
676 && $(am__cd) $(top_srcdir) \
677 && gtags -i $(GTAGS_ARGS) "$$here"
678
679distclean-tags:
680 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
681
682distdir: $(DISTFILES)
683 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
684 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
685 list='$(DISTFILES)'; \
686 dist_files=`for file in $$list; do echo $$file; done | \
687 sed -e "s|^$$srcdirstrip/||;t" \
688 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
689 case $$dist_files in \
690 */*) $(MKDIR_P) `echo "$$dist_files" | \
691 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
692 sort -u` ;; \
693 esac; \
694 for file in $$dist_files; do \
695 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
696 if test -d $$d/$$file; then \
697 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
698 if test -d "$(distdir)/$$file"; then \
699 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
700 fi; \
701 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
702 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
703 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
704 fi; \
705 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
706 else \
707 test -f "$(distdir)/$$file" \
708 || cp -p $$d/$$file "$(distdir)/$$file" \
709 || exit 1; \
710 fi; \
711 done
712check-am: all-am
713check: check-am
714all-am: Makefile $(LTLIBRARIES) $(HEADERS)
715installdirs:
716 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
717 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
718 done
719install: install-am
720install-exec: install-exec-am
721install-data: install-data-am
722uninstall: uninstall-am
723
724install-am: all-am
725 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
726
727installcheck: installcheck-am
728install-strip:
729 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
730 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
731 `test -z '$(STRIP)' || \
732 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
733mostlyclean-generic:
734
735clean-generic:
736
737distclean-generic:
738 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
739 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
740
741maintainer-clean-generic:
742 @echo "This command is intended for maintainers to use"
743 @echo "it deletes files that may require special tools to rebuild."
744 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
745clean: clean-am
746
747clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
748 mostlyclean-am
749
750distclean: distclean-am
751 -rm -rf ./$(DEPDIR)
752 -rm -f Makefile
753distclean-am: clean-am distclean-compile distclean-generic \
754 distclean-tags
755
756dvi: dvi-am
757
758dvi-am:
759
760html: html-am
761
762html-am:
763
764info: info-am
765
766info-am:
767
768install-data-am: install-includesHEADERS
769
770install-dvi: install-dvi-am
771
772install-dvi-am:
773
774install-exec-am: install-libLTLIBRARIES
775
776install-html: install-html-am
777
778install-html-am:
779
780install-info: install-info-am
781
782install-info-am:
783
784install-man:
785
786install-pdf: install-pdf-am
787
788install-pdf-am:
789
790install-ps: install-ps-am
791
792install-ps-am:
793
794installcheck-am:
795
796maintainer-clean: maintainer-clean-am
797 -rm -rf ./$(DEPDIR)
798 -rm -f Makefile
799maintainer-clean-am: distclean-am maintainer-clean-generic
800
801mostlyclean: mostlyclean-am
802
803mostlyclean-am: mostlyclean-compile mostlyclean-generic \
804 mostlyclean-libtool
805
806pdf: pdf-am
807
808pdf-am:
809
810ps: ps-am
811
812ps-am:
813
814uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
815
816.MAKE: install-am install-strip
817
818.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
819 clean-libLTLIBRARIES clean-libtool ctags distclean \
820 distclean-compile distclean-generic distclean-libtool \
821 distclean-tags distdir dvi dvi-am html html-am info info-am \
822 install install-am install-data install-data-am install-dvi \
823 install-dvi-am install-exec install-exec-am install-html \
824 install-html-am install-includesHEADERS install-info \
825 install-info-am install-libLTLIBRARIES install-man install-pdf \
826 install-pdf-am install-ps install-ps-am install-strip \
827 installcheck installcheck-am installdirs maintainer-clean \
828 maintainer-clean-generic mostlyclean mostlyclean-compile \
829 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
830 tags uninstall uninstall-am uninstall-includesHEADERS \
831 uninstall-libLTLIBRARIES
832
833
834# Tell versions [3.59,3.63) of GNU make to not export all variables.
835# Otherwise a system limit (for SysV at least) may be exceeded.
836.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
deleted file mode 100644
index 53d206e..0000000
--- a/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c
+++ /dev/null
@@ -1,413 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <string.h>
6#include <stdlib.h>
7
8#include "Ecore.h"
9#include "Ecore_Input.h"
10
11#include "Ecore_Input_Evas.h"
12#include "ecore_input_evas_private.h"
13
14int _ecore_input_evas_log_dom = -1;
15
16typedef struct _Ecore_Input_Window Ecore_Input_Window;
17struct _Ecore_Input_Window
18{
19 Evas *evas;
20 void *window;
21 Ecore_Event_Mouse_Move_Cb move_mouse;
22 Ecore_Event_Multi_Move_Cb move_multi;
23 Ecore_Event_Multi_Down_Cb down_multi;
24 Ecore_Event_Multi_Up_Cb up_multi;
25 int ignore_event;
26};
27
28static int _ecore_event_evas_init_count = 0;
29static Ecore_Event_Handler *ecore_event_evas_handlers[8];
30static Eina_Hash *_window_hash = NULL;
31
32EAPI void
33ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers)
34{
35 if (modifiers & ECORE_EVENT_MODIFIER_SHIFT)
36 evas_key_modifier_on(e, "Shift");
37 else evas_key_modifier_off(e, "Shift");
38
39 if (modifiers & ECORE_EVENT_MODIFIER_CTRL)
40 evas_key_modifier_on(e, "Control");
41 else evas_key_modifier_off(e, "Control");
42
43 if (modifiers & ECORE_EVENT_MODIFIER_ALT)
44 evas_key_modifier_on(e, "Alt");
45 else evas_key_modifier_off(e, "Alt");
46
47 if (modifiers & ECORE_EVENT_MODIFIER_WIN)
48 {
49 evas_key_modifier_on(e, "Super");
50 evas_key_modifier_on(e, "Hyper");
51 }
52 else
53 {
54 evas_key_modifier_off(e, "Super");
55 evas_key_modifier_off(e, "Hyper");
56 }
57
58 if (modifiers & ECORE_EVENT_LOCK_SCROLL)
59 evas_key_lock_on(e, "Scroll_Lock");
60 else evas_key_lock_off(e, "Scroll_Lock");
61
62 if (modifiers & ECORE_EVENT_LOCK_NUM)
63 evas_key_lock_on(e, "Num_Lock");
64 else evas_key_lock_off(e, "Num_Lock");
65
66 if (modifiers & ECORE_EVENT_LOCK_CAPS)
67 evas_key_lock_on(e, "Caps_Lock");
68 else evas_key_lock_off(e, "Caps_Lock");
69
70 if (modifiers & ECORE_EVENT_LOCK_SHIFT)
71 evas_key_lock_on(e, "Shift_Lock");
72 else evas_key_lock_off(e, "Shift_Lock");
73}
74
75EAPI void
76ecore_event_window_register(Ecore_Window id, void *window, Evas *evas,
77 Ecore_Event_Mouse_Move_Cb move_mouse,
78 Ecore_Event_Multi_Move_Cb move_multi,
79 Ecore_Event_Multi_Down_Cb down_multi,
80 Ecore_Event_Multi_Up_Cb up_multi)
81{
82 Ecore_Input_Window *w;
83
84 w = calloc(1, sizeof(Ecore_Input_Window));
85 if (!w) return;
86
87 w->evas = evas;
88 w->window = window;
89 w->move_mouse = move_mouse;
90 w->move_multi = move_multi;
91 w->down_multi = down_multi;
92 w->up_multi = up_multi;
93 w->ignore_event = 0;
94
95 eina_hash_add(_window_hash, &id, w);
96
97 evas_key_modifier_add(evas, "Shift");
98 evas_key_modifier_add(evas, "Control");
99 evas_key_modifier_add(evas, "Alt");
100 evas_key_modifier_add(evas, "Meta");
101 evas_key_modifier_add(evas, "Hyper");
102 evas_key_modifier_add(evas, "Super");
103 evas_key_lock_add(evas, "Caps_Lock");
104 evas_key_lock_add(evas, "Num_Lock");
105 evas_key_lock_add(evas, "Scroll_Lock");
106}
107
108EAPI void
109ecore_event_window_unregister(Ecore_Window id)
110{
111 eina_hash_del(_window_hash, &id, NULL);
112}
113
114EAPI void *
115ecore_event_window_match(Ecore_Window id)
116{
117 Ecore_Input_Window *lookup;
118
119 lookup = eina_hash_find(_window_hash, &id);
120 if (lookup) return lookup->window;
121 return NULL;
122}
123
124EAPI void
125ecore_event_window_ignore_events(Ecore_Window id, int ignore_event)
126{
127 Ecore_Input_Window *lookup;
128
129 lookup = eina_hash_find(_window_hash, &id);
130 if (!lookup) return;
131 lookup->ignore_event = ignore_event;
132}
133
134static Ecore_Input_Window*
135_ecore_event_window_match(Ecore_Window id)
136{
137 Ecore_Input_Window *lookup;
138
139 lookup = eina_hash_find(_window_hash, &id);
140 if (!lookup) return NULL;
141 if (lookup->ignore_event) return NULL; /* Pass on event. */
142 return lookup;
143}
144
145static Eina_Bool
146_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
147{
148 Ecore_Input_Window *lookup;
149
150 lookup = _ecore_event_window_match(e->event_window);
151 if (!lookup) return ECORE_CALLBACK_RENEW;
152 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
153 if (press == ECORE_DOWN)
154 evas_event_feed_key_down(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
155 else
156 evas_event_feed_key_up(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
157 return ECORE_CALLBACK_RENEW;
158}
159
160static Eina_Bool
161_ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press)
162{
163 Ecore_Input_Window *lookup;
164 Evas_Button_Flags flags = EVAS_BUTTON_NONE;
165
166 lookup = _ecore_event_window_match(e->event_window);
167 if (!lookup) return ECORE_CALLBACK_RENEW;
168 if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
169 if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
170 if (e->multi.device == 0)
171 {
172 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
173 if (press == ECORE_DOWN)
174 evas_event_feed_mouse_down(lookup->evas, e->buttons, flags,
175 e->timestamp, NULL);
176 else
177 evas_event_feed_mouse_up(lookup->evas, e->buttons, flags,
178 e->timestamp, NULL);
179 }
180 else
181 {
182 if (press == ECORE_DOWN)
183 {
184 if (lookup->down_multi)
185 lookup->down_multi(lookup->window, e->multi.device,
186 e->x, e->y, e->multi.radius,
187 e->multi.radius_x, e->multi.radius_y,
188 e->multi.pressure, e->multi.angle,
189 e->multi.x, e->multi.y, flags,
190 e->timestamp);
191 else
192 evas_event_feed_multi_down(lookup->evas, e->multi.device,
193 e->x, e->y, e->multi.radius,
194 e->multi.radius_x, e->multi.radius_y,
195 e->multi.pressure, e->multi.angle,
196 e->multi.x, e->multi.y, flags,
197 e->timestamp, NULL);
198 }
199 else
200 {
201 if (lookup->up_multi)
202 lookup->up_multi(lookup->window, e->multi.device,
203 e->x, e->y, e->multi.radius,
204 e->multi.radius_x, e->multi.radius_y,
205 e->multi.pressure, e->multi.angle,
206 e->multi.x, e->multi.y, flags,
207 e->timestamp);
208 else
209 evas_event_feed_multi_up(lookup->evas, e->multi.device,
210 e->x, e->y, e->multi.radius,
211 e->multi.radius_x, e->multi.radius_y,
212 e->multi.pressure, e->multi.angle,
213 e->multi.x, e->multi.y, flags,
214 e->timestamp, NULL);
215 }
216 }
217 return ECORE_CALLBACK_RENEW;
218}
219
220EAPI Eina_Bool
221ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
222{
223 Ecore_Event_Mouse_Move *e;
224 Ecore_Input_Window *lookup;
225
226 e = event;
227 lookup = _ecore_event_window_match(e->event_window);
228 if (!lookup) return ECORE_CALLBACK_RENEW;
229 if (e->multi.device == 0)
230 {
231 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
232 if (lookup->move_mouse)
233 lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
234 else
235 evas_event_feed_mouse_move(lookup->evas, e->x, e->y, e->timestamp,
236 NULL);
237 }
238 else
239 {
240 if (lookup->move_multi)
241 lookup->move_multi(lookup->window, e->multi.device,
242 e->x, e->y, e->multi.radius,
243 e->multi.radius_x, e->multi.radius_y,
244 e->multi.pressure, e->multi.angle,
245 e->multi.x, e->multi.y, e->timestamp);
246 else
247 evas_event_feed_multi_move(lookup->evas, e->multi.device,
248 e->x, e->y, e->multi.radius,
249 e->multi.radius_x, e->multi.radius_y,
250 e->multi.pressure, e->multi.angle,
251 e->multi.x, e->multi.y, e->timestamp,
252 NULL);
253 }
254 return ECORE_CALLBACK_RENEW;
255}
256
257EAPI Eina_Bool
258ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
259{
260 return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_DOWN);
261}
262
263EAPI Eina_Bool
264ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
265{
266 return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_UP);
267}
268
269static Eina_Bool
270_ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
271{
272 Ecore_Input_Window *lookup;
273
274 lookup = _ecore_event_window_match(e->event_window);
275 if (!lookup) return ECORE_CALLBACK_RENEW;
276 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
277 switch (io)
278 {
279 case ECORE_IN:
280 evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL);
281 break;
282 case ECORE_OUT:
283 evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL);
284 break;
285 default:
286 break;
287 }
288
289 lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
290 return ECORE_CALLBACK_RENEW;
291}
292
293EAPI Eina_Bool
294ecore_event_evas_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
295{
296 return _ecore_event_evas_key((Ecore_Event_Key *)event, ECORE_DOWN);
297}
298
299EAPI Eina_Bool
300ecore_event_evas_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
301{
302 return _ecore_event_evas_key((Ecore_Event_Key *)event, ECORE_UP);
303}
304
305EAPI Eina_Bool
306ecore_event_evas_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
307{
308 Ecore_Event_Mouse_Wheel *e;
309 Ecore_Input_Window *lookup;
310
311 e = event;
312 lookup = _ecore_event_window_match(e->event_window);
313 if (!lookup) return ECORE_CALLBACK_RENEW;
314 ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
315 evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL);
316 return ECORE_CALLBACK_RENEW;
317}
318
319EAPI Eina_Bool
320ecore_event_evas_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
321{
322 return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO *)event, ECORE_IN);
323}
324
325EAPI Eina_Bool
326ecore_event_evas_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
327{
328 return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO *)event, ECORE_OUT);
329}
330
331EAPI int
332ecore_event_evas_init(void)
333{
334 if (++_ecore_event_evas_init_count != 1)
335 return _ecore_event_evas_init_count;
336
337 _ecore_input_evas_log_dom = eina_log_domain_register
338 ("ecore_input_evas", ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR);
339 if (_ecore_input_evas_log_dom < 0)
340 {
341 EINA_LOG_ERR("Impossible to create a log domain for the ecore input evas_module.");
342 return --_ecore_event_evas_init_count;
343 }
344
345 if (!ecore_init())
346 {
347 return --_ecore_event_evas_init_count;
348 }
349
350 if (!ecore_event_init())
351 {
352 goto shutdown_ecore;
353 }
354
355 ecore_event_evas_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
356 ecore_event_evas_key_down,
357 NULL);
358 ecore_event_evas_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
359 ecore_event_evas_key_up,
360 NULL);
361 ecore_event_evas_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
362 ecore_event_evas_mouse_button_down,
363 NULL);
364 ecore_event_evas_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
365 ecore_event_evas_mouse_button_up,
366 NULL);
367 ecore_event_evas_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
368 ecore_event_evas_mouse_move,
369 NULL);
370 ecore_event_evas_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
371 ecore_event_evas_mouse_wheel,
372 NULL);
373 ecore_event_evas_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
374 ecore_event_evas_mouse_in,
375 NULL);
376 ecore_event_evas_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
377 ecore_event_evas_mouse_out,
378 NULL);
379
380 _window_hash = eina_hash_pointer_new(free);
381
382 return _ecore_event_evas_init_count;
383
384 shutdown_ecore:
385 ecore_shutdown();
386
387 return --_ecore_event_evas_init_count;
388}
389
390EAPI int
391ecore_event_evas_shutdown(void)
392{
393 size_t i;
394
395 if (--_ecore_event_evas_init_count != 0)
396 return _ecore_event_evas_init_count;
397
398 eina_hash_free(_window_hash);
399 _window_hash = NULL;
400 for (i = 0; i < sizeof(ecore_event_evas_handlers) / sizeof(Ecore_Event_Handler *); i++)
401 {
402 ecore_event_handler_del(ecore_event_evas_handlers[i]);
403 ecore_event_evas_handlers[i] = NULL;
404 }
405
406 ecore_event_shutdown();
407 ecore_shutdown();
408
409 eina_log_domain_unregister(_ecore_input_evas_log_dom);
410 _ecore_input_evas_log_dom = -1;
411
412 return _ecore_event_evas_init_count;
413}
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
deleted file mode 100644
index c19cfbf..0000000
--- a/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas_private.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _ECORE_INPUT_PRIVATE_H
2#define _ECORE_INPUT_PRIVATE_H
3
4extern int _ecore_input_evas_log_dom;
5
6#ifdef ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR
7#undef ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR
8#endif
9
10#define ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
11
12#ifdef ERR
13#undef ERR
14#endif
15#define ERR(...) EINA_LOG_DOM_ERR(_ecore_input_evas_log_dom, __VA_ARGS__)
16
17#ifdef DBG
18#undef DBG
19#endif
20#define DBG(...) EINA_LOG_DOM_DBG(_ecore_input_evas_log_dom, __VA_ARGS__)
21
22#ifdef INF
23#undef INF
24#endif
25#define INF(...) EINA_LOG_DOM_INFO(_ecore_input_evas_log_dom, __VA_ARGS__)
26
27#ifdef WRN
28#undef WRN
29#endif
30#define WRN(...) EINA_LOG_DOM_WARN(_ecore_input_evas_log_dom, __VA_ARGS__)
31
32#ifdef CRIT
33#undef CRIT
34#endif
35#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_input_evas_log_dom, __VA_ARGS__)
36
37#endif
diff --git a/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h b/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
deleted file mode 100644
index 40ae621..0000000
--- a/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
+++ /dev/null
@@ -1,325 +0,0 @@
1#ifndef _ECORE_IPC_H
2#define _ECORE_IPC_H
3
4#ifdef EAPI
5# undef EAPI
6#endif
7
8#ifdef _WIN32
9# ifdef EFL_ECORE_IPC_BUILD
10# ifdef DLL_EXPORT
11# define EAPI __declspec(dllexport)
12# else
13# define EAPI
14# endif
15# else
16# define EAPI __declspec(dllimport)
17# endif
18#else
19# ifdef __GNUC__
20# if __GNUC__ >= 4
21# define EAPI __attribute__ ((visibility("default")))
22# else
23# define EAPI
24# endif
25# else
26# define EAPI
27# endif
28#endif
29
30/**
31 * @file Ecore_Ipc.h
32 * @brief Ecore inter-process communication functions.
33 */
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39typedef struct _Ecore_Ipc_Server Ecore_Ipc_Server; /**< An IPC connection handle */
40typedef struct _Ecore_Ipc_Client Ecore_Ipc_Client; /**< An IPC connection handle */
41
42EAPI unsigned short _ecore_ipc_swap_16(unsigned short v);
43EAPI unsigned int _ecore_ipc_swap_32(unsigned int v);
44EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v);
45
46#ifdef WORDS_BIGENDIAN
47#define ECORE_IPC_SWAP2NET64(x) _ecore_ipc_swap_64(x)
48#define ECORE_IPC_SWAP2CPU64(x) _ecore_ipc_swap_64(x)
49#define ECORE_IPC_SWAP2NET32(x) _ecore_ipc_swap_32(x)
50#define ECORE_IPC_SWAP2CPU32(x) _ecore_ipc_swap_32(x)
51#define ECORE_IPC_SWAP2NET16(x) _ecore_ipc_swap_16(x)
52#define ECORE_IPC_SWAP2CPU16(x) _ecore_ipc_swap_16(x)
53#define ECORE_IPC_SWAP2NET8(x) (x)
54#define ECORE_IPC_SWAP2CPU8(x) (x)
55#else
56#define ECORE_IPC_SWAP2NET64(x) (x)
57#define ECORE_IPC_SWAP2CPU64(x) (x)
58#define ECORE_IPC_SWAP2NET32(x) (x)
59#define ECORE_IPC_SWAP2CPU32(x) (x)
60#define ECORE_IPC_SWAP2NET16(x) (x)
61#define ECORE_IPC_SWAP2CPU16(x) (x)
62#define ECORE_IPC_SWAP2NET8(x) (x)
63#define ECORE_IPC_SWAP2CPU8(x) (x)
64#endif
65
66/* 1, 2, 4 and 8 byte datatypes */
67/* unpacking */
68#define ECORE_IPC_GET64(v)\
69 { \
70 p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \
71 ptr += 8; \
72 }
73#define ECORE_IPC_GET32(v)\
74 { \
75 p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \
76 ptr += 4; \
77 }
78#define ECORE_IPC_GET16(v)\
79 { \
80 p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \
81 ptr += 2; \
82 }
83#define ECORE_IPC_GET8(v) \
84 { \
85 p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \
86 ptr += 1; \
87 }
88/* packing */
89#define ECORE_IPC_PUT64(v)\
90 { \
91 *(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \
92 ptr += 8; \
93 }
94#define ECORE_IPC_PUT32(v)\
95 { \
96 *(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \
97 ptr += 4; \
98 }
99#define ECORE_IPC_PUT16(v)\
100 { \
101 *(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \
102 ptr += 2; \
103 }
104#define ECORE_IPC_PUT8(v) \
105 { \
106 *(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \
107 ptr += 1; \
108 }
109/* padding data */
110#define ECORE_IPC_PAD8() ptr += 1
111#define ECORE_IPC_PAD16() ptr += 2
112#define ECORE_IPC_PAD32() ptr += 4
113#define ECORE_IPC_PAD64() ptr += 8
114
115/* counting data when encoding lists */
116#define ECORE_IPC_CNT8() len += 1
117#define ECORE_IPC_CNT16() len += 2
118#define ECORE_IPC_CNT32() len += 4
119#define ECORE_IPC_CNT64() len += 8
120
121/* strings */
122#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0;
123#define ECORE_IPC_GETS(v) \
124 { \
125 if (ptr < ((unsigned char *)d + s)) \
126 { \
127 p->v = (char *)ptr; \
128 ptr += strlen(p->v) + 1; \
129 } \
130 }
131#define ECORE_IPC_PUTS(v, l)\
132 { \
133 strcpy((char *)ptr, p->v); \
134 ptr += l + 1; \
135 }
136
137/* handy to calculate what sized block we need to alloc */
138#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1)
139#define ECORE_IPC_CNTS(v) len += strlen(p->v) + 1
140
141/* saves typing function headers */
142#define ECORE_IPC_DEC_STRUCT_PROTO(x) static int x(void *d, int s, void *pp)
143#define ECORE_IPC_ENC_STRUCT_PROTO(x) static void *x(void *pp, int *s)
144#define ECORE_IPC_DEC_EINA_LIST_PROTO(x) static Eina_List *x(void *d, int s)
145#define ECORE_IPC_ENC_EINA_LIST_PROTO(x) static void *x(Eina_List *lp, int *s)
146
147
148/* decoder setup - saves typing. requires data packet of exact size, or fail */
149#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \
150 typ *p; \
151 unsigned char *ptr; \
152 p = (typ *)pp; \
153 if (!d) return 0; if (s != (x)) return 0; \
154 ptr = d;
155/* decoder setup - saves typing. requires data packet of a minimum size */
156#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \
157 typ *p; \
158 unsigned char *ptr; \
159 p = (typ *)pp; \
160 if (!d) return 0; if (s < (x)) return 0; \
161 ptr = d;
162/* footer for the hell of it */
163#define ECORE_IPC_DEC_STRUCT_FOOT() return 1
164/* header for encoder - gives native strct type and size of flattened packet */
165#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \
166 typ *p; \
167 unsigned char *d, *ptr; \
168 int len; \
169 *s = 0; \
170 if(!pp) return NULL; \
171 p = (typ *)pp; \
172 len = sz; \
173 d = malloc(len); \
174 if (!d) return NULL; \
175 *s = len; \
176 ptr = d;
177/* footer for the hell of it */
178#define ECORE_IPC_ENC_STRUCT_FOOT() return d
179
180#define ECORE_IPC_DEC_EINA_LIST_HEAD(typ) \
181 unsigned char *ptr; \
182 Eina_List *l; \
183 typ *p; \
184 l = NULL; \
185 ptr = d; \
186 while(ptr < (unsigned char *)(d + s)) \
187 { \
188 p = malloc(sizeof(typ));
189
190#define ECORE_IPC_DEC_EINA_LIST_FOOT() \
191 l = eina_list_append(l, p); \
192 } \
193 return l
194#define ECORE_IPC_ENC_EINA_LIST_HEAD_START(typ) \
195 Eina_List *l; \
196 typ *p; \
197 unsigned char *d, *ptr; \
198 int len; \
199 *s = 0; \
200 len = 0; \
201 for (l = lp; l; l = l->next) \
202 { \
203 p = l->data;
204#define ECORE_IPC_ENC_EINA_LIST_HEAD_FINISH() \
205 } \
206 d = malloc(len); \
207 if(!d) return NULL; \
208 *s = len; \
209 ptr = d; \
210 for (l = lp; l; l = l->next) \
211 { \
212 p = l->data;
213
214#define ECORE_IPC_ENC_EINA_LIST_FOOT() \
215 } \
216 return d
217
218typedef enum _Ecore_Ipc_Type
219{
220 ECORE_IPC_LOCAL_USER,
221 ECORE_IPC_LOCAL_SYSTEM,
222 ECORE_IPC_REMOTE_SYSTEM,
223 ECORE_IPC_USE_SSL = 16
224} Ecore_Ipc_Type;
225
226typedef struct _Ecore_Ipc_Event_Client_Add Ecore_Ipc_Event_Client_Add;
227typedef struct _Ecore_Ipc_Event_Client_Del Ecore_Ipc_Event_Client_Del;
228typedef struct _Ecore_Ipc_Event_Server_Add Ecore_Ipc_Event_Server_Add;
229typedef struct _Ecore_Ipc_Event_Server_Del Ecore_Ipc_Event_Server_Del;
230typedef struct _Ecore_Ipc_Event_Client_Data Ecore_Ipc_Event_Client_Data;
231typedef struct _Ecore_Ipc_Event_Server_Data Ecore_Ipc_Event_Server_Data;
232
233struct _Ecore_Ipc_Event_Client_Add
234{
235 Ecore_Ipc_Client *client;
236};
237
238struct _Ecore_Ipc_Event_Client_Del
239{
240 Ecore_Ipc_Client *client;
241};
242
243struct _Ecore_Ipc_Event_Server_Add
244{
245 Ecore_Ipc_Server *server;
246};
247
248struct _Ecore_Ipc_Event_Server_Del
249{
250 Ecore_Ipc_Server *server;
251};
252
253struct _Ecore_Ipc_Event_Client_Data
254{
255 Ecore_Ipc_Client *client;
256 /* FIXME: this needs to become an ipc message */
257 int major;
258 int minor;
259 int ref;
260 int ref_to;
261 int response;
262 void *data;
263 int size;
264};
265
266struct _Ecore_Ipc_Event_Server_Data
267{
268 Ecore_Ipc_Server *server;
269 /* FIXME: this needs to become an ipc message */
270 int major;
271 int minor;
272 int ref;
273 int ref_to;
274 int response;
275 void *data;
276 int size;
277};
278
279EAPI extern int ECORE_IPC_EVENT_CLIENT_ADD;
280EAPI extern int ECORE_IPC_EVENT_CLIENT_DEL;
281EAPI extern int ECORE_IPC_EVENT_SERVER_ADD;
282EAPI extern int ECORE_IPC_EVENT_SERVER_DEL;
283EAPI extern int ECORE_IPC_EVENT_CLIENT_DATA;
284EAPI extern int ECORE_IPC_EVENT_SERVER_DATA;
285
286EAPI int ecore_ipc_init(void);
287EAPI int ecore_ipc_shutdown(void);
288
289/* FIXME: need to add protocol type parameter */
290EAPI Ecore_Ipc_Server *ecore_ipc_server_add(Ecore_Ipc_Type type, const char *name, int port, const void *data);
291
292/* FIXME: need to add protocol type parameter */
293EAPI Ecore_Ipc_Server *ecore_ipc_server_connect(Ecore_Ipc_Type type, char *name, int port, const void *data);
294EAPI void *ecore_ipc_server_del(Ecore_Ipc_Server *svr);
295EAPI void *ecore_ipc_server_data_get(Ecore_Ipc_Server *svr);
296EAPI Eina_Bool ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr);
297EAPI Eina_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr);
298/* FIXME: this needs to become an ipc message */
299EAPI 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);
300EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients);
301EAPI void ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *srv, int size);
302EAPI int ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *srv);
303EAPI const char *ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr);
304EAPI void ecore_ipc_server_flush(Ecore_Ipc_Server *svr);
305
306/* FIXME: this needs to become an ipc message */
307EAPI 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);
308EAPI Ecore_Ipc_Server *ecore_ipc_client_server_get(Ecore_Ipc_Client *cl);
309EAPI void *ecore_ipc_client_del(Ecore_Ipc_Client *cl);
310EAPI void ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data);
311EAPI void *ecore_ipc_client_data_get(Ecore_Ipc_Client *cl);
312EAPI void ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size);
313EAPI int ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl);
314EAPI const char *ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl);
315EAPI void ecore_ipc_client_flush(Ecore_Ipc_Client *cl);
316
317EAPI int ecore_ipc_ssl_available_get(void);
318/* FIXME: need to add a callback to "ok" large ipc messages greater than */
319/* a certain size (seurity/DOS attack safety) */
320
321#ifdef __cplusplus
322}
323#endif
324
325#endif
diff --git a/libraries/ecore/src/lib/ecore_ipc/Makefile.am b/libraries/ecore/src/lib/ecore_ipc/Makefile.am
deleted file mode 100644
index 9cbed43..0000000
--- a/libraries/ecore/src/lib/ecore_ipc/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_builddir)/src/lib/ecore \
5-I$(top_builddir)/src/lib/ecore_con \
6-I$(top_builddir)/src/lib/ecore_ipc \
7-I$(top_srcdir)/src/lib/ecore \
8-I$(top_srcdir)/src/lib/ecore_con \
9-I$(top_srcdir)/src/lib/ecore_ipc \
10@EFL_ECORE_IPC_BUILD@ \
11@SSL_CFLAGS@ \
12@EINA_CFLAGS@
13
14lib_LTLIBRARIES = libecore_ipc.la
15includes_HEADERS = Ecore_Ipc.h
16includesdir = $(includedir)/ecore-@VMAJ@
17
18libecore_ipc_la_SOURCES = \
19ecore_ipc.c
20
21libecore_ipc_la_LIBADD = \
22$(top_builddir)/src/lib/ecore/libecore.la \
23$(top_builddir)/src/lib/ecore_con/libecore_con.la \
24@SSL_LIBS@ \
25@EINA_LIBS@
26
27libecore_ipc_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
28
29EXTRA_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
deleted file mode 100644
index e339ffc..0000000
--- a/libraries/ecore/src/lib/ecore_ipc/Makefile.in
+++ /dev/null
@@ -1,836 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_ipc
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_ipc_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la \
90 $(top_builddir)/src/lib/ecore_con/libecore_con.la
91am_libecore_ipc_la_OBJECTS = ecore_ipc.lo
92libecore_ipc_la_OBJECTS = $(am_libecore_ipc_la_OBJECTS)
93AM_V_lt = $(am__v_lt_$(V))
94am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
95am__v_lt_0 = --silent
96libecore_ipc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
97 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
98 $(AM_CFLAGS) $(CFLAGS) $(libecore_ipc_la_LDFLAGS) $(LDFLAGS) \
99 -o $@
100DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
101depcomp = $(SHELL) $(top_srcdir)/depcomp
102am__depfiles_maybe = depfiles
103am__mv = mv -f
104COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
105 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
106LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
107 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
108 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
109 $(AM_CFLAGS) $(CFLAGS)
110AM_V_CC = $(am__v_CC_$(V))
111am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
112am__v_CC_0 = @echo " CC " $@;
113AM_V_at = $(am__v_at_$(V))
114am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
115am__v_at_0 = @
116CCLD = $(CC)
117LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
118 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
119 $(AM_LDFLAGS) $(LDFLAGS) -o $@
120AM_V_CCLD = $(am__v_CCLD_$(V))
121am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
122am__v_CCLD_0 = @echo " CCLD " $@;
123AM_V_GEN = $(am__v_GEN_$(V))
124am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
125am__v_GEN_0 = @echo " GEN " $@;
126SOURCES = $(libecore_ipc_la_SOURCES)
127DIST_SOURCES = $(libecore_ipc_la_SOURCES)
128HEADERS = $(includes_HEADERS)
129ETAGS = etags
130CTAGS = ctags
131DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
132ACLOCAL = @ACLOCAL@
133ALLOCA = @ALLOCA@
134AMTAR = @AMTAR@
135AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
136AR = @AR@
137AS = @AS@
138AUTOCONF = @AUTOCONF@
139AUTOHEADER = @AUTOHEADER@
140AUTOMAKE = @AUTOMAKE@
141AWK = @AWK@
142CARES_CFLAGS = @CARES_CFLAGS@
143CARES_LIBS = @CARES_LIBS@
144CC = @CC@
145CCDEPMODE = @CCDEPMODE@
146CFLAGS = @CFLAGS@
147CHECK_CFLAGS = @CHECK_CFLAGS@
148CHECK_LIBS = @CHECK_LIBS@
149CPP = @CPP@
150CPPFLAGS = @CPPFLAGS@
151CURL_CFLAGS = @CURL_CFLAGS@
152CURL_LIBS = @CURL_LIBS@
153CXX = @CXX@
154CXXCPP = @CXXCPP@
155CXXDEPMODE = @CXXDEPMODE@
156CXXFLAGS = @CXXFLAGS@
157CYGPATH_W = @CYGPATH_W@
158DEFS = @DEFS@
159DEPDIR = @DEPDIR@
160DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
161DIRECTFB_LIBS = @DIRECTFB_LIBS@
162DLLTOOL = @DLLTOOL@
163DSYMUTIL = @DSYMUTIL@
164DUMPBIN = @DUMPBIN@
165ECHO_C = @ECHO_C@
166ECHO_N = @ECHO_N@
167ECHO_T = @ECHO_T@
168ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
169ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
170EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
171EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
172EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
173EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
174EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
175EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
176EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
177EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
178EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
179EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
180EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
181EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
182EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
183EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
184EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
185EGREP = @EGREP@
186EINA_CFLAGS = @EINA_CFLAGS@
187EINA_LIBS = @EINA_LIBS@
188ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
189ESCAPE_LIBS = @ESCAPE_LIBS@
190EVAS_CFLAGS = @EVAS_CFLAGS@
191EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@
200GLIB_LIBS = @GLIB_LIBS@
201GMSGFMT = @GMSGFMT@
202GMSGFMT_015 = @GMSGFMT_015@
203GREP = @GREP@
204INSTALL = @INSTALL@
205INSTALL_DATA = @INSTALL_DATA@
206INSTALL_PROGRAM = @INSTALL_PROGRAM@
207INSTALL_SCRIPT = @INSTALL_SCRIPT@
208INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
209INTLLIBS = @INTLLIBS@
210INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
211KEYSYMDEFS = @KEYSYMDEFS@
212LD = @LD@
213LDFLAGS = @LDFLAGS@
214LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
215LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
216LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
217LIBICONV = @LIBICONV@
218LIBINTL = @LIBINTL@
219LIBOBJS = @LIBOBJS@
220LIBS = @LIBS@
221LIBTOOL = @LIBTOOL@
222LIPO = @LIPO@
223LN_S = @LN_S@
224LTLIBICONV = @LTLIBICONV@
225LTLIBINTL = @LTLIBINTL@
226LTLIBOBJS = @LTLIBOBJS@
227MAKEINFO = @MAKEINFO@
228MKDIR_P = @MKDIR_P@
229MSGFMT = @MSGFMT@
230MSGFMT_015 = @MSGFMT_015@
231MSGMERGE = @MSGMERGE@
232NM = @NM@
233NMEDIT = @NMEDIT@
234OBJC = @OBJC@
235OBJCDEPMODE = @OBJCDEPMODE@
236OBJCFLAGS = @OBJCFLAGS@
237OBJDUMP = @OBJDUMP@
238OBJEXT = @OBJEXT@
239OTOOL = @OTOOL@
240OTOOL64 = @OTOOL64@
241PACKAGE = @PACKAGE@
242PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
243PACKAGE_NAME = @PACKAGE_NAME@
244PACKAGE_STRING = @PACKAGE_STRING@
245PACKAGE_TARNAME = @PACKAGE_TARNAME@
246PACKAGE_URL = @PACKAGE_URL@
247PACKAGE_VERSION = @PACKAGE_VERSION@
248PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
254POSUB = @POSUB@
255RANLIB = @RANLIB@
256SCIM_CFLAGS = @SCIM_CFLAGS@
257SCIM_LIBS = @SCIM_LIBS@
258SDL_CFLAGS = @SDL_CFLAGS@
259SDL_CONFIG = @SDL_CONFIG@
260SDL_LIBS = @SDL_LIBS@
261SED = @SED@
262SET_MAKE = @SET_MAKE@
263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@
268TLS2_CFLAGS = @TLS2_CFLAGS@
269TLS2_LIBS = @TLS2_LIBS@
270TLS_CFLAGS = @TLS_CFLAGS@
271TLS_LIBS = @TLS_LIBS@
272TSLIB_CFLAGS = @TSLIB_CFLAGS@
273TSLIB_LIBS = @TSLIB_LIBS@
274USE_NLS = @USE_NLS@
275VERSION = @VERSION@
276VMAJ = @VMAJ@
277WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
278WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
279WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
280WAYLAND_LIBS = @WAYLAND_LIBS@
281WIN32_CFLAGS = @WIN32_CFLAGS@
282WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
283WIN32_LIBS = @WIN32_LIBS@
284XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
285XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
286XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
287XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
288XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
289XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
290XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
291XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
292XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
293XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
294XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
295XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
296XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
297XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
298XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
299XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
300XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
301XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
302XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
303XCB_X11_LIBS = @XCB_X11_LIBS@
304XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
305XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
306XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
307XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
308XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
309XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
310XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
311XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
312XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
313XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
314XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
315XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
316XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
317XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
318XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
319XDAMAGE_LIBS = @XDAMAGE_LIBS@
320XDPMS_CFLAGS = @XDPMS_CFLAGS@
321XDPMS_LIBS = @XDPMS_LIBS@
322XFIXES_CFLAGS = @XFIXES_CFLAGS@
323XFIXES_LIBS = @XFIXES_LIBS@
324XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
325XGESTURE_LIBS = @XGESTURE_LIBS@
326XGETTEXT = @XGETTEXT@
327XGETTEXT_015 = @XGETTEXT_015@
328XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
329XI2_CFLAGS = @XI2_CFLAGS@
330XI2_LIBS = @XI2_LIBS@
331XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
332XINERAMA_LIBS = @XINERAMA_LIBS@
333XKB_CFLAGS = @XKB_CFLAGS@
334XKB_LIBS = @XKB_LIBS@
335XMKMF = @XMKMF@
336XPRINT_CFLAGS = @XPRINT_CFLAGS@
337XPRINT_LIBS = @XPRINT_LIBS@
338XRANDR_CFLAGS = @XRANDR_CFLAGS@
339XRANDR_LIBS = @XRANDR_LIBS@
340XRENDER_CFLAGS = @XRENDER_CFLAGS@
341XRENDER_LIBS = @XRENDER_LIBS@
342XSS_CFLAGS = @XSS_CFLAGS@
343XSS_LIBS = @XSS_LIBS@
344XTEST_CFLAGS = @XTEST_CFLAGS@
345XTEST_LIBS = @XTEST_LIBS@
346X_CFLAGS = @X_CFLAGS@
347X_EXTRA_LIBS = @X_EXTRA_LIBS@
348X_LIBS = @X_LIBS@
349X_PRE_LIBS = @X_PRE_LIBS@
350Xcursor_cflags = @Xcursor_cflags@
351Xcursor_libs = @Xcursor_libs@
352abs_builddir = @abs_builddir@
353abs_srcdir = @abs_srcdir@
354abs_top_builddir = @abs_top_builddir@
355abs_top_srcdir = @abs_top_srcdir@
356ac_ct_CC = @ac_ct_CC@
357ac_ct_CXX = @ac_ct_CXX@
358ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
359ac_ct_OBJC = @ac_ct_OBJC@
360am__include = @am__include@
361am__leading_dot = @am__leading_dot@
362am__quote = @am__quote@
363am__tar = @am__tar@
364am__untar = @am__untar@
365bindir = @bindir@
366build = @build@
367build_alias = @build_alias@
368build_cpu = @build_cpu@
369build_os = @build_os@
370build_vendor = @build_vendor@
371builddir = @builddir@
372cocoa_ldflags = @cocoa_ldflags@
373datadir = @datadir@
374datarootdir = @datarootdir@
375dlopen_libs = @dlopen_libs@
376docdir = @docdir@
377dvidir = @dvidir@
378ecore_cocoa_cflags = @ecore_cocoa_cflags@
379ecore_cocoa_libs = @ecore_cocoa_libs@
380ecore_con_cflags = @ecore_con_cflags@
381ecore_con_libs = @ecore_con_libs@
382ecore_directfb_cflags = @ecore_directfb_cflags@
383ecore_directfb_libs = @ecore_directfb_libs@
384ecore_evas_cflags = @ecore_evas_cflags@
385ecore_evas_libs = @ecore_evas_libs@
386ecore_fb_cflags = @ecore_fb_cflags@
387ecore_fb_libs = @ecore_fb_libs@
388ecore_file_cflags = @ecore_file_cflags@
389ecore_file_libs = @ecore_file_libs@
390ecore_imf_cflags = @ecore_imf_cflags@
391ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
392ecore_imf_evas_libs = @ecore_imf_evas_libs@
393ecore_imf_libs = @ecore_imf_libs@
394ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
395ecore_imf_scim_libs = @ecore_imf_scim_libs@
396ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
397ecore_imf_xim_libs = @ecore_imf_xim_libs@
398ecore_input_cflags = @ecore_input_cflags@
399ecore_input_evas_cflags = @ecore_input_evas_cflags@
400ecore_input_evas_libs = @ecore_input_evas_libs@
401ecore_input_libs = @ecore_input_libs@
402ecore_ipc_cflags = @ecore_ipc_cflags@
403ecore_ipc_libs = @ecore_ipc_libs@
404ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
405ecore_psl1ght_libs = @ecore_psl1ght_libs@
406ecore_sdl_cflags = @ecore_sdl_cflags@
407ecore_sdl_libs = @ecore_sdl_libs@
408ecore_wayland_cflags = @ecore_wayland_cflags@
409ecore_wayland_libs = @ecore_wayland_libs@
410ecore_win32_cflags = @ecore_win32_cflags@
411ecore_win32_libs = @ecore_win32_libs@
412ecore_wince_cflags = @ecore_wince_cflags@
413ecore_wince_libs = @ecore_wince_libs@
414ecore_x_cflags = @ecore_x_cflags@
415ecore_x_libs = @ecore_x_libs@
416ecore_x_libs_private = @ecore_x_libs_private@
417efl_doxygen = @efl_doxygen@
418efl_have_doxygen = @efl_have_doxygen@
419exec_prefix = @exec_prefix@
420have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
421host = @host@
422host_alias = @host_alias@
423host_cpu = @host_cpu@
424host_os = @host_os@
425host_vendor = @host_vendor@
426htmldir = @htmldir@
427includedir = @includedir@
428infodir = @infodir@
429install_sh = @install_sh@
430libdir = @libdir@
431libexecdir = @libexecdir@
432localedir = @localedir@
433localstatedir = @localstatedir@
434lt_ECHO = @lt_ECHO@
435lt_enable_auto_import = @lt_enable_auto_import@
436mandir = @mandir@
437mkdir_p = @mkdir_p@
438oldincludedir = @oldincludedir@
439pdfdir = @pdfdir@
440pkgconfig_requires_private = @pkgconfig_requires_private@
441prefix = @prefix@
442program_transform_name = @program_transform_name@
443psdir = @psdir@
444release_info = @release_info@
445requirements_ecore = @requirements_ecore@
446requirements_ecore_cocoa = @requirements_ecore_cocoa@
447requirements_ecore_con = @requirements_ecore_con@
448requirements_ecore_directfb = @requirements_ecore_directfb@
449requirements_ecore_evas = @requirements_ecore_evas@
450requirements_ecore_fb = @requirements_ecore_fb@
451requirements_ecore_file = @requirements_ecore_file@
452requirements_ecore_imf = @requirements_ecore_imf@
453requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
454requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
455requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
456requirements_ecore_input = @requirements_ecore_input@
457requirements_ecore_input_evas = @requirements_ecore_input_evas@
458requirements_ecore_ipc = @requirements_ecore_ipc@
459requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
460requirements_ecore_sdl = @requirements_ecore_sdl@
461requirements_ecore_wayland = @requirements_ecore_wayland@
462requirements_ecore_win32 = @requirements_ecore_win32@
463requirements_ecore_wince = @requirements_ecore_wince@
464requirements_ecore_x = @requirements_ecore_x@
465rt_libs = @rt_libs@
466sbindir = @sbindir@
467sharedstatedir = @sharedstatedir@
468srcdir = @srcdir@
469sysconfdir = @sysconfdir@
470target_alias = @target_alias@
471top_build_prefix = @top_build_prefix@
472top_builddir = @top_builddir@
473top_srcdir = @top_srcdir@
474version_info = @version_info@
475x_cflags = @x_cflags@
476x_includes = @x_includes@
477x_libs = @x_libs@
478MAINTAINERCLEANFILES = Makefile.in
479AM_CPPFLAGS = \
480-I$(top_builddir)/src/lib/ecore \
481-I$(top_builddir)/src/lib/ecore_con \
482-I$(top_builddir)/src/lib/ecore_ipc \
483-I$(top_srcdir)/src/lib/ecore \
484-I$(top_srcdir)/src/lib/ecore_con \
485-I$(top_srcdir)/src/lib/ecore_ipc \
486@EFL_ECORE_IPC_BUILD@ \
487@SSL_CFLAGS@ \
488@EINA_CFLAGS@
489
490lib_LTLIBRARIES = libecore_ipc.la
491includes_HEADERS = Ecore_Ipc.h
492includesdir = $(includedir)/ecore-@VMAJ@
493libecore_ipc_la_SOURCES = \
494ecore_ipc.c
495
496libecore_ipc_la_LIBADD = \
497$(top_builddir)/src/lib/ecore/libecore.la \
498$(top_builddir)/src/lib/ecore_con/libecore_con.la \
499@SSL_LIBS@ \
500@EINA_LIBS@
501
502libecore_ipc_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
503EXTRA_DIST = ecore_ipc_private.h
504all: all-am
505
506.SUFFIXES:
507.SUFFIXES: .c .lo .o .obj
508$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
509 @for dep in $?; do \
510 case '$(am__configure_deps)' in \
511 *$$dep*) \
512 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
513 && { if test -f $@; then exit 0; else break; fi; }; \
514 exit 1;; \
515 esac; \
516 done; \
517 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_ipc/Makefile'; \
518 $(am__cd) $(top_srcdir) && \
519 $(AUTOMAKE) --gnu src/lib/ecore_ipc/Makefile
520.PRECIOUS: Makefile
521Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
522 @case '$?' in \
523 *config.status*) \
524 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
525 *) \
526 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
527 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
528 esac;
529
530$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
531 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
532
533$(top_srcdir)/configure: $(am__configure_deps)
534 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
535$(ACLOCAL_M4): $(am__aclocal_m4_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(am__aclocal_m4_deps):
538install-libLTLIBRARIES: $(lib_LTLIBRARIES)
539 @$(NORMAL_INSTALL)
540 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
541 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
542 list2=; for p in $$list; do \
543 if test -f $$p; then \
544 list2="$$list2 $$p"; \
545 else :; fi; \
546 done; \
547 test -z "$$list2" || { \
548 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
549 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
550 }
551
552uninstall-libLTLIBRARIES:
553 @$(NORMAL_UNINSTALL)
554 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
555 for p in $$list; do \
556 $(am__strip_dir) \
557 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
558 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
559 done
560
561clean-libLTLIBRARIES:
562 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
563 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
564 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
565 test "$$dir" != "$$p" || dir=.; \
566 echo "rm -f \"$${dir}/so_locations\""; \
567 rm -f "$${dir}/so_locations"; \
568 done
569libecore_ipc.la: $(libecore_ipc_la_OBJECTS) $(libecore_ipc_la_DEPENDENCIES)
570 $(AM_V_CCLD)$(libecore_ipc_la_LINK) -rpath $(libdir) $(libecore_ipc_la_OBJECTS) $(libecore_ipc_la_LIBADD) $(LIBS)
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_ipc.Plo@am__quote@
579
580.c.o:
581@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
582@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
583@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
584@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
585@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
586@am__fastdepCC_FALSE@ $(COMPILE) -c $<
587
588.c.obj:
589@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
590@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
591@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
592@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
594@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
595
596.c.lo:
597@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
598@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
599@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
601@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
602@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
603
604mostlyclean-libtool:
605 -rm -f *.lo
606
607clean-libtool:
608 -rm -rf .libs _libs
609install-includesHEADERS: $(includes_HEADERS)
610 @$(NORMAL_INSTALL)
611 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
612 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
613 for p in $$list; do \
614 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
615 echo "$$d$$p"; \
616 done | $(am__base_list) | \
617 while read files; do \
618 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
619 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
620 done
621
622uninstall-includesHEADERS:
623 @$(NORMAL_UNINSTALL)
624 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
625 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
626 test -n "$$files" || exit 0; \
627 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
628 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
629
630ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
631 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
632 unique=`for i in $$list; do \
633 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
634 done | \
635 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
636 END { if (nonempty) { for (i in files) print i; }; }'`; \
637 mkid -fID $$unique
638tags: TAGS
639
640TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
641 $(TAGS_FILES) $(LISP)
642 set x; \
643 here=`pwd`; \
644 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
645 unique=`for i in $$list; do \
646 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
647 done | \
648 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
649 END { if (nonempty) { for (i in files) print i; }; }'`; \
650 shift; \
651 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
652 test -n "$$unique" || unique=$$empty_fix; \
653 if test $$# -gt 0; then \
654 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
655 "$$@" $$unique; \
656 else \
657 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
658 $$unique; \
659 fi; \
660 fi
661ctags: CTAGS
662CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
663 $(TAGS_FILES) $(LISP)
664 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
665 unique=`for i in $$list; do \
666 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
667 done | \
668 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
669 END { if (nonempty) { for (i in files) print i; }; }'`; \
670 test -z "$(CTAGS_ARGS)$$unique" \
671 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
672 $$unique
673
674GTAGS:
675 here=`$(am__cd) $(top_builddir) && pwd` \
676 && $(am__cd) $(top_srcdir) \
677 && gtags -i $(GTAGS_ARGS) "$$here"
678
679distclean-tags:
680 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
681
682distdir: $(DISTFILES)
683 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
684 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
685 list='$(DISTFILES)'; \
686 dist_files=`for file in $$list; do echo $$file; done | \
687 sed -e "s|^$$srcdirstrip/||;t" \
688 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
689 case $$dist_files in \
690 */*) $(MKDIR_P) `echo "$$dist_files" | \
691 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
692 sort -u` ;; \
693 esac; \
694 for file in $$dist_files; do \
695 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
696 if test -d $$d/$$file; then \
697 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
698 if test -d "$(distdir)/$$file"; then \
699 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
700 fi; \
701 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
702 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
703 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
704 fi; \
705 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
706 else \
707 test -f "$(distdir)/$$file" \
708 || cp -p $$d/$$file "$(distdir)/$$file" \
709 || exit 1; \
710 fi; \
711 done
712check-am: all-am
713check: check-am
714all-am: Makefile $(LTLIBRARIES) $(HEADERS)
715installdirs:
716 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
717 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
718 done
719install: install-am
720install-exec: install-exec-am
721install-data: install-data-am
722uninstall: uninstall-am
723
724install-am: all-am
725 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
726
727installcheck: installcheck-am
728install-strip:
729 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
730 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
731 `test -z '$(STRIP)' || \
732 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
733mostlyclean-generic:
734
735clean-generic:
736
737distclean-generic:
738 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
739 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
740
741maintainer-clean-generic:
742 @echo "This command is intended for maintainers to use"
743 @echo "it deletes files that may require special tools to rebuild."
744 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
745clean: clean-am
746
747clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
748 mostlyclean-am
749
750distclean: distclean-am
751 -rm -rf ./$(DEPDIR)
752 -rm -f Makefile
753distclean-am: clean-am distclean-compile distclean-generic \
754 distclean-tags
755
756dvi: dvi-am
757
758dvi-am:
759
760html: html-am
761
762html-am:
763
764info: info-am
765
766info-am:
767
768install-data-am: install-includesHEADERS
769
770install-dvi: install-dvi-am
771
772install-dvi-am:
773
774install-exec-am: install-libLTLIBRARIES
775
776install-html: install-html-am
777
778install-html-am:
779
780install-info: install-info-am
781
782install-info-am:
783
784install-man:
785
786install-pdf: install-pdf-am
787
788install-pdf-am:
789
790install-ps: install-ps-am
791
792install-ps-am:
793
794installcheck-am:
795
796maintainer-clean: maintainer-clean-am
797 -rm -rf ./$(DEPDIR)
798 -rm -f Makefile
799maintainer-clean-am: distclean-am maintainer-clean-generic
800
801mostlyclean: mostlyclean-am
802
803mostlyclean-am: mostlyclean-compile mostlyclean-generic \
804 mostlyclean-libtool
805
806pdf: pdf-am
807
808pdf-am:
809
810ps: ps-am
811
812ps-am:
813
814uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
815
816.MAKE: install-am install-strip
817
818.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
819 clean-libLTLIBRARIES clean-libtool ctags distclean \
820 distclean-compile distclean-generic distclean-libtool \
821 distclean-tags distdir dvi dvi-am html html-am info info-am \
822 install install-am install-data install-data-am install-dvi \
823 install-dvi-am install-exec install-exec-am install-html \
824 install-html-am install-includesHEADERS install-info \
825 install-info-am install-libLTLIBRARIES install-man install-pdf \
826 install-pdf-am install-ps install-ps-am install-strip \
827 installcheck installcheck-am installdirs maintainer-clean \
828 maintainer-clean-generic mostlyclean mostlyclean-compile \
829 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
830 tags uninstall uninstall-am uninstall-includesHEADERS \
831 uninstall-libLTLIBRARIES
832
833
834# Tell versions [3.59,3.63) of GNU make to not export all variables.
835# Otherwise a system limit (for SysV at least) may be exceeded.
836.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c
deleted file mode 100644
index 0210f1d..0000000
--- a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c
+++ /dev/null
@@ -1,1593 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <string.h>
6
7#ifdef HAVE_NETINET_IN_H
8# include <sys/types.h>
9# include <netinet/in.h>
10#endif
11
12#ifdef HAVE_WINSOCK2_H
13# include <winsock2.h>
14#endif
15
16#if USE_GNUTLS_OPENSSL
17# include <gnutls/openssl.h>
18#elif USE_OPENSSL
19# include <openssl/ssl.h>
20#endif
21
22#include <Ecore.h>
23#include <ecore_private.h>
24#include <Ecore_Con.h>
25
26#include "Ecore_Ipc.h"
27#include "ecore_ipc_private.h"
28
29#define DLT_ZERO 0
30#define DLT_ONE 1
31#define DLT_SAME 2
32#define DLT_SHL 3
33#define DLT_SHR 4
34#define DLT_ADD8 5
35#define DLT_DEL8 6
36#define DLT_ADDU8 7
37#define DLT_DELU8 8
38#define DLT_ADD16 9
39#define DLT_DEL16 10
40#define DLT_ADDU16 11
41#define DLT_DELU16 12
42#define DLT_SET 13
43#define DLT_R1 14
44#define DLT_R2 15
45
46int _ecore_ipc_log_dom = -1;
47
48EAPI unsigned short
49_ecore_ipc_swap_16(unsigned short v)
50{
51 unsigned char *s, t;
52
53 s = (unsigned char *)(&v);
54 t = s[0]; s[0] = s[1]; s[1] = t;
55 return v;
56}
57
58EAPI unsigned int
59_ecore_ipc_swap_32(unsigned int v)
60{
61 unsigned char *s, t;
62
63 s = (unsigned char *)(&v);
64 t = s[0]; s[0] = s[3]; s[3] = t;
65 t = s[1]; s[1] = s[2]; s[2] = t;
66 return v;
67}
68
69EAPI unsigned long long
70_ecore_ipc_swap_64(unsigned long long v)
71{
72 unsigned char *s, t;
73
74 s = (unsigned char *)(&v);
75 t = s[0]; s[0] = s[7]; s[7] = t;
76 t = s[1]; s[1] = s[6]; s[6] = t;
77 t = s[2]; s[2] = s[5]; s[5] = t;
78 t = s[3]; s[3] = s[4]; s[4] = t;
79 return v;
80}
81
82static int _ecore_ipc_dlt_int(int out, int prev, int *mode);
83static int _ecore_ipc_ddlt_int(int in, int prev, int mode);
84
85static int
86_ecore_ipc_dlt_int(int out, int prev, int *mode)
87{
88 int dlt;
89
90 /* 0 byte */
91 if (out == 0)
92 {
93 *mode = DLT_ZERO;
94 return 0;
95 }
96 if (out == (int)0xffffffff)
97 {
98 *mode = DLT_ONE;
99 return 0;
100 }
101 if (out == prev)
102 {
103 *mode = DLT_SAME;
104 return 0;
105 }
106 if (out == prev << 1)
107 {
108 *mode = DLT_SHL;
109 return 0;
110 }
111 if (out == prev >> 1)
112 {
113 *mode = DLT_SHR;
114 return 0;
115 }
116 /* 1 byte */
117 dlt = out - prev;
118 if (!(dlt & 0xffffff00))
119 {
120 *mode = DLT_ADD8;
121 return dlt & 0xff;
122 }
123 dlt = prev - out;
124 if (!(dlt & 0xffffff00))
125 {
126 *mode = DLT_DEL8;
127 return dlt & 0xff;
128 }
129 dlt = out - prev;
130 if (!(dlt & 0x00ffffff))
131 {
132 *mode = DLT_ADDU8;
133 return (dlt >> 24) & 0xff;
134 }
135 dlt = prev - out;
136 if (!(dlt & 0x00ffffff))
137 {
138 *mode = DLT_DELU8;
139 return (dlt >> 24) & 0xff;
140 }
141 /* 2 byte */
142 dlt = out - prev;
143 if (!(dlt & 0xffff0000))
144 {
145 *mode = DLT_ADD16;
146 return dlt & 0xffff;
147 }
148 dlt = prev - out;
149 if (!(dlt & 0xffff0000))
150 {
151 *mode = DLT_DEL16;
152 return dlt & 0xffff;
153 }
154 dlt = out - prev;
155 if (!(dlt & 0x0000ffff))
156 {
157 *mode = DLT_ADDU16;
158 return (dlt >> 16) & 0xffff;
159 }
160 dlt = prev - out;
161 if (!(dlt & 0x0000ffff))
162 {
163 *mode = DLT_DELU16;
164 return (dlt >> 16) & 0xffff;
165 }
166 /* 4 byte */
167 *mode = DLT_SET;
168 return out;
169}
170
171static int
172_ecore_ipc_ddlt_int(int in, int prev, int mode)
173{
174 switch (mode)
175 {
176 case DLT_ZERO:
177 return 0;
178 break;
179 case DLT_ONE:
180 return 0xffffffff;
181 break;
182 case DLT_SAME:
183 return prev;
184 break;
185 case DLT_SHL:
186 return prev << 1;
187 break;
188 case DLT_SHR:
189 return prev >> 1;
190 break;
191 case DLT_ADD8:
192 return prev + in;
193 break;
194 case DLT_DEL8:
195 return prev - in;
196 break;
197 case DLT_ADDU8:
198 return prev + (in << 24);
199 break;
200 case DLT_DELU8:
201 return prev - (in << 24);
202 break;
203 case DLT_ADD16:
204 return prev + in;
205 break;
206 case DLT_DEL16:
207 return prev - in;
208 break;
209 case DLT_ADDU16:
210 return prev + (in << 16);
211 break;
212 case DLT_DELU16:
213 return prev - (in << 16);
214 break;
215 case DLT_SET:
216 return in;
217 break;
218 case DLT_R1:
219 return 0;
220 break;
221 case DLT_R2:
222 return 0;
223 break;
224 default:
225 break;
226 }
227 return 0;
228}
229
230static Eina_Bool _ecore_ipc_event_client_add(void *data, int ev_type, void *ev);
231static Eina_Bool _ecore_ipc_event_client_del(void *data, int ev_type, void *ev);
232static Eina_Bool _ecore_ipc_event_server_add(void *data, int ev_type, void *ev);
233static Eina_Bool _ecore_ipc_event_server_del(void *data, int ev_type, void *ev);
234static Eina_Bool _ecore_ipc_event_client_data(void *data, int ev_type, void *ev);
235static Eina_Bool _ecore_ipc_event_server_data(void *data, int ev_type, void *ev);
236static void _ecore_ipc_event_client_add_free(void *data, void *ev);
237static void _ecore_ipc_event_client_del_free(void *data, void *ev);
238static void _ecore_ipc_event_client_data_free(void *data, void *ev);
239static void _ecore_ipc_event_server_add_free(void *data, void *ev);
240static void _ecore_ipc_event_server_del_free(void *data, void *ev);
241static void _ecore_ipc_event_server_data_free(void *data, void *ev);
242
243EAPI int ECORE_IPC_EVENT_CLIENT_ADD = 0;
244EAPI int ECORE_IPC_EVENT_CLIENT_DEL = 0;
245EAPI int ECORE_IPC_EVENT_SERVER_ADD = 0;
246EAPI int ECORE_IPC_EVENT_SERVER_DEL = 0;
247EAPI int ECORE_IPC_EVENT_CLIENT_DATA = 0;
248EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0;
249
250static int _ecore_ipc_init_count = 0;
251static Eina_List *servers = NULL;
252static Ecore_Event_Handler *handler[6];
253
254/**
255 * @defgroup Ecore_IPC_Library_Group IPC Library Functions
256 *
257 * Functions that set up and shut down the Ecore IPC Library.
258 */
259
260/**
261 * Initialises the Ecore IPC library.
262 * @return Number of times the library has been initialised without
263 * being shut down.
264 * @ingroup Ecore_IPC_Library_Group
265 */
266EAPI int
267ecore_ipc_init(void)
268{
269 int i = 0;
270
271 if (++_ecore_ipc_init_count != 1)
272 return _ecore_ipc_init_count;
273 _ecore_ipc_log_dom = eina_log_domain_register
274 ("ecore_ipc", ECORE_IPC_DEFAULT_LOG_COLOR);
275 if(_ecore_ipc_log_dom < 0)
276 {
277 EINA_LOG_ERR("Impossible to create a log domain for the Ecore IPC module.");
278 return --_ecore_ipc_init_count;
279 }
280 if (!ecore_con_init())
281 return --_ecore_ipc_init_count;
282
283 ECORE_IPC_EVENT_CLIENT_ADD = ecore_event_type_new();
284 ECORE_IPC_EVENT_CLIENT_DEL = ecore_event_type_new();
285 ECORE_IPC_EVENT_SERVER_ADD = ecore_event_type_new();
286 ECORE_IPC_EVENT_SERVER_DEL = ecore_event_type_new();
287 ECORE_IPC_EVENT_CLIENT_DATA = ecore_event_type_new();
288 ECORE_IPC_EVENT_SERVER_DATA = ecore_event_type_new();
289
290 handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
291 _ecore_ipc_event_client_add, NULL);
292 handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
293 _ecore_ipc_event_client_del, NULL);
294 handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
295 _ecore_ipc_event_server_add, NULL);
296 handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL,
297 _ecore_ipc_event_server_del, NULL);
298 handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
299 _ecore_ipc_event_client_data, NULL);
300 handler[i] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
301 _ecore_ipc_event_server_data, NULL);
302 return _ecore_ipc_init_count;
303}
304
305/**
306 * Shuts down the Ecore IPC library.
307 * @return Number of times the library has been initialised without being
308 * shut down.
309 * @ingroup Ecore_IPC_Library_Group
310 */
311EAPI int
312ecore_ipc_shutdown(void)
313{
314 int i;
315
316 if (--_ecore_ipc_init_count != 0)
317 return _ecore_ipc_init_count;
318
319 Eina_List *l, *l2;
320 Ecore_Ipc_Server *svr;
321 EINA_LIST_FOREACH_SAFE(servers, l, l2, svr)
322 ecore_ipc_server_del(svr);
323
324 for (i = 0; i < 6; i++)
325 ecore_event_handler_del(handler[i]);
326
327 ecore_con_shutdown();
328 eina_log_domain_unregister(_ecore_ipc_log_dom);
329 _ecore_ipc_log_dom = -1;
330 return _ecore_ipc_init_count;
331}
332
333/**
334 * @defgroup Ecore_IPC_Server_Group IPC Server Functions
335 *
336 * Functions the deal with IPC server objects.
337 */
338
339/**
340 * Creates an IPC server that listens for connections.
341 *
342 * For more details about the @p compl_type, @p name and @p port
343 * parameters, see the @ref ecore_con_server_add documentation.
344 *
345 * @param compl_type The connection type.
346 * @param name Name to associate with the socket used for connection.
347 * @param port Number to identify with socket used for connection.
348 * @param data Data to associate with the IPC server.
349 * @return New IPC server. If there is an error, @c NULL is returned.
350 * @ingroup Ecore_IPC_Server_Group
351 * @todo Need to add protocol type parameter to this function.
352 */
353EAPI Ecore_Ipc_Server *
354ecore_ipc_server_add(Ecore_Ipc_Type compl_type, const char *name, int port, const void *data)
355{
356 Ecore_Ipc_Server *svr;
357 Ecore_Ipc_Type type;
358 Ecore_Con_Type extra = 0;
359
360 svr = calloc(1, sizeof(Ecore_Ipc_Server));
361 if (!svr) return NULL;
362 type = compl_type;
363 type &= ~ECORE_IPC_USE_SSL;
364 if (compl_type & ECORE_IPC_USE_SSL) extra = ECORE_CON_USE_SSL;
365 switch (type)
366 {
367 case ECORE_IPC_LOCAL_USER:
368 svr->server = ecore_con_server_add(ECORE_CON_LOCAL_USER | extra, name, port, svr);
369 break;
370 case ECORE_IPC_LOCAL_SYSTEM:
371 svr->server = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM | extra, name, port, svr);
372 break;
373 case ECORE_IPC_REMOTE_SYSTEM:
374 svr->server = ecore_con_server_add(ECORE_CON_REMOTE_SYSTEM | extra, name, port, svr);
375 break;
376 default:
377 free(svr);
378 return NULL;
379 }
380 if (!svr->server)
381 {
382 free(svr);
383 return NULL;
384 }
385 svr->max_buf_size = 32 * 1024;
386 svr->data = (void *)data;
387 servers = eina_list_append(servers, svr);
388 ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER);
389 return svr;
390}
391
392/**
393 * Creates an IPC server object to represent the IPC server listening
394 * on the given port.
395 *
396 * For more details about the @p compl_type, @p name and @p port
397 * parameters, see the @ref ecore_con_server_connect documentation.
398 *
399 * @param compl_type The IPC connection type.
400 * @param name Name used to determine which socket to use for the
401 * IPC connection.
402 * @param port Number used to identify the socket to use for the
403 * IPC connection.
404 * @param data Data to associate with the server.
405 * @return A new IPC server. @c NULL is returned on error.
406 * @ingroup Ecore_IPC_Server_Group
407 * @todo Need to add protocol type parameter.
408 */
409EAPI Ecore_Ipc_Server *
410ecore_ipc_server_connect(Ecore_Ipc_Type compl_type, char *name, int port, const void *data)
411{
412 Ecore_Ipc_Server *svr;
413 Ecore_Ipc_Type type;
414 Ecore_Con_Type extra = 0;
415
416 svr = calloc(1, sizeof(Ecore_Ipc_Server));
417 if (!svr) return NULL;
418 type = compl_type;
419 type &= ~ECORE_IPC_USE_SSL;
420 if (compl_type & ECORE_IPC_USE_SSL) extra = ECORE_CON_USE_SSL;
421 switch (type)
422 {
423 case ECORE_IPC_LOCAL_USER:
424 svr->server = ecore_con_server_connect(ECORE_CON_LOCAL_USER | extra, name, port, svr);
425 break;
426 case ECORE_IPC_LOCAL_SYSTEM:
427 svr->server = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM | extra, name, port, svr);
428 break;
429 case ECORE_IPC_REMOTE_SYSTEM:
430 svr->server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM | extra, name, port, svr);
431 break;
432 default:
433 free(svr);
434 return NULL;
435 }
436 if (!svr->server)
437 {
438 free(svr);
439 return NULL;
440 }
441 svr->max_buf_size = -1;
442 svr->data = (void *)data;
443 servers = eina_list_append(servers, svr);
444 ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER);
445 return svr;
446}
447
448/**
449 * Closes the connection and frees the given IPC server.
450 * @param svr The given IPC server.
451 * @return The data associated with the server when it was created.
452 * @ingroup Ecore_IPC_Server_Group
453 */
454EAPI void *
455ecore_ipc_server_del(Ecore_Ipc_Server *svr)
456{
457 void *data;
458
459 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
460 {
461 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
462 "ecore_ipc_server_del");
463 return NULL;
464 }
465 if (svr->delete_me) return NULL;
466
467 data = svr->data;
468 svr->data = NULL;
469 svr->delete_me = 1;
470 if (svr->event_count == 0)
471 {
472 Ecore_Ipc_Client *cl;
473
474 EINA_LIST_FREE(svr->clients, cl)
475 ecore_ipc_client_del(cl);
476 ecore_con_server_del(svr->server);
477 servers = eina_list_remove(servers, svr);
478
479 if (svr->buf) free(svr->buf);
480 ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE);
481 free(svr);
482 }
483 return data;
484}
485
486/**
487 * Retrieves the data associated with the given IPC server.
488 * @param svr The given IPC server.
489 * @return The associated data.
490 * @ingroup Ecore_IPC_Server_Group
491 */
492EAPI void *
493ecore_ipc_server_data_get(Ecore_Ipc_Server *svr)
494{
495 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
496 {
497 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
498 "ecore_ipc_server_data_get");
499 return NULL;
500 }
501 return svr->data;
502}
503
504/**
505 * Retrieves whether the given IPC server is currently connected.
506 * @param svr The given IPC server.
507 * @return #EINA_TRUE if the server is connected. #EINA_FALSE otherwise.
508 * @ingroup Ecore_IPC_Server_Group
509 */
510EAPI Eina_Bool
511ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr)
512{
513 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
514 {
515 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
516 "ecore_ipc_server_connected_get");
517 return EINA_FALSE;
518 }
519 return ecore_con_server_connected_get(svr->server);
520}
521
522/**
523 * Retrieves the list of clients for this server.
524 * @param svr The given IPC server.
525 * @return An Eina_List with the clients.
526 * @ingroup Ecore_IPC_Server_Group
527 */
528EAPI Eina_List *
529ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
530{
531 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
532 {
533 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
534 "ecore_ipc_server_clients_get");
535 return NULL;
536 }
537 return svr->client_list;
538}
539
540#define SVENC(_member) \
541 d = _ecore_ipc_dlt_int(msg._member, svr->prev.o._member, &md); \
542 if (md >= DLT_SET) \
543 { \
544 unsigned int v; \
545 unsigned char *dd; \
546 dd = (unsigned char *)&v; \
547 v = d; \
548 v = htonl(v); \
549 *(dat + s + 0) = dd[0]; \
550 *(dat + s + 1) = dd[1]; \
551 *(dat + s + 2) = dd[2]; \
552 *(dat + s + 3) = dd[3]; \
553 s += 4; \
554 } \
555 else if (md >= DLT_ADD16) \
556 { \
557 unsigned short v; \
558 unsigned char *dd; \
559 dd = (unsigned char *)&v; \
560 v = d; \
561 v = htons(v); \
562 *(dat + s + 0) = dd[0]; \
563 *(dat + s + 1) = dd[1]; \
564 s += 2; \
565 } \
566 else if (md >= DLT_ADD8) \
567 { \
568 *(dat + s + 0) = (unsigned char)d; \
569 s += 1; \
570 }
571
572/**
573 * Sends a message to the given IPC server.
574 *
575 * The content of the parameters, excluding the @p svr paramter, is up to
576 * the client.
577 *
578 * @param svr The given IPC server.
579 * @param major Major opcode of the message.
580 * @param minor Minor opcode of the message.
581 * @param ref Message reference number.
582 * @param ref_to Reference number of the message this message refers to.
583 * @param response Requires response.
584 * @param data The data to send as part of the message.
585 * @param size Length of the data, in bytes, to send.
586 * @return Number of bytes sent. @c 0 is returned if there is an error.
587 * @ingroup Ecore_IPC_Server_Group
588 * @todo This function needs to become an IPC message.
589 * @todo Fix up the documentation: Make sure what ref_to and response are.
590 */
591EAPI int
592ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size)
593{
594 Ecore_Ipc_Msg_Head msg;
595 int ret;
596 int *head, md = 0, d, s;
597 unsigned char dat[sizeof(Ecore_Ipc_Msg_Head)];
598
599 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
600 {
601 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
602 "ecore_ipc_server_send");
603 return 0;
604 }
605 if (size < 0) size = 0;
606 msg.major = major;
607 msg.minor = minor;
608 msg.ref = ref;
609 msg.ref_to = ref_to;
610 msg.response = response;
611 msg.size = size;
612 head = (int *)dat;
613 s = 4;
614 SVENC(major);
615 *head = md;
616 SVENC(minor);
617 *head |= md << (4 * 1);
618 SVENC(ref);
619 *head |= md << (4 * 2);
620 SVENC(ref_to);
621 *head |= md << (4 * 3);
622 SVENC(response);
623 *head |= md << (4 * 4);
624 SVENC(size);
625 *head |= md << (4 * 5);
626 *head = htonl(*head);
627 svr->prev.o = msg;
628 ret = ecore_con_server_send(svr->server, dat, s);
629 if (size > 0) ret += ecore_con_server_send(svr->server, data, size);
630 return ret;
631}
632
633/**
634 * Sets a limit on the number of clients that can be handled concurrently
635 * by the given server, and a policy on what to do if excess clients try to
636 * connect.
637 * Beware that if you set this once ecore is already running, you may
638 * already have pending CLIENT_ADD events in your event queue. Those
639 * clients have already connected and will not be affected by this call.
640 * Only clients subsequently trying to connect will be affected.
641 * @param svr The given server.
642 * @param client_limit The maximum number of clients to handle
643 * concurrently. -1 means unlimited (default). 0
644 * effectively disables the server.
645 * @param reject_excess_clients Set to 1 to automatically disconnect
646 * excess clients as soon as they connect if you are
647 * already handling client_limit clients. Set to 0
648 * (default) to just hold off on the "accept()"
649 * system call until the number of active clients
650 * drops. This causes the kernel to queue up to 4096
651 * connections (or your kernel's limit, whichever is
652 * lower).
653 * @ingroup Ecore_Ipc_Server_Group
654 */
655EAPI void
656ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients)
657{
658 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
659 {
660 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
661 "ecore_ipc_server_client_limit_set");
662 return;
663 }
664 ecore_con_server_client_limit_set(svr->server, client_limit, reject_excess_clients);
665}
666
667/**
668 * Sets the max data payload size for an Ipc message in bytes
669 *
670 * @param svr The given server.
671 * @param size The maximum data payload size in bytes.
672 * @ingroup Ecore_Ipc_Server_Group
673 */
674EAPI void
675ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *svr, int size)
676{
677 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
678 {
679 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
680 "ecore_ipc_server_data_size_max_set");
681 return;
682 }
683 svr->max_buf_size = size;
684}
685
686/**
687 * Gets the max data payload size for an Ipc message in bytes
688 *
689 * @param svr The given server.
690 * @return The maximum data payload in bytes.
691 * @ingroup Ecore_Ipc_Server_Group
692 */
693EAPI int
694ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *svr)
695{
696 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
697 {
698 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
699 "ecore_ipc_server_data_size_max_get");
700 return -1;
701 }
702 return svr->max_buf_size;
703}
704
705/**
706 * Gets the IP address of a server that has been connected to.
707 *
708 * @param svr The given server.
709 * @return A pointer to an internal string that contains the IP address of
710 * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
711 * This string should not be modified or trusted to stay valid after
712 * deletion for the @p svr object. If no IP is known NULL is returned.
713 * @ingroup Ecore_Ipc_Server_Group
714 */
715EAPI const char *
716ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr)
717{
718 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
719 {
720 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
721 "ecore_ipc_server_ip_get");
722 return NULL;
723 }
724 return ecore_con_server_ip_get(svr->server);
725}
726
727/**
728 * Flushes all pending data to the given server. Will return when done.
729 *
730 * @param svr The given server.
731 * @ingroup Ecore_Ipc_Server_Group
732 */
733EAPI void
734ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
735{
736 if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
737 {
738 ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
739 "ecore_ipc_server_server_flush");
740 return;
741 }
742 ecore_con_server_flush(svr->server);
743}
744
745#define CLENC(_member) \
746 d = _ecore_ipc_dlt_int(msg._member, cl->prev.o._member, &md); \
747 if (md >= DLT_SET) \
748 { \
749 unsigned int v; \
750 unsigned char *dd; \
751 dd = (unsigned char *)&v; \
752 v = d; \
753 v = htonl(v); \
754 *(dat + s + 0) = dd[0]; \
755 *(dat + s + 1) = dd[1]; \
756 *(dat + s + 2) = dd[2]; \
757 *(dat + s + 3) = dd[3]; \
758 s += 4; \
759 } \
760 else if (md >= DLT_ADD16) \
761 { \
762 unsigned short v; \
763 unsigned char *dd; \
764 dd = (unsigned char *)&v; \
765 v = d; \
766 v = htons(v); \
767 *(dat + s + 0) = dd[0]; \
768 *(dat + s + 1) = dd[1]; \
769 s += 2; \
770 } \
771 else if (md >= DLT_ADD8) \
772 { \
773 *(dat + s) = (unsigned char)d; \
774 s += 1; \
775 }
776
777/**
778 * @defgroup Ecore_IPC_Client_Group IPC Client Functions
779 *
780 * Functions that deal with IPC client objects.
781 */
782
783/**
784 * Sends a message to the given IPC client.
785 * @param cl The given IPC client.
786 * @param major Major opcode of the message.
787 * @param minor Minor opcode of the message.
788 * @param ref Reference number of the message.
789 * @param ref_to Reference number of the message this message refers to.
790 * @param response Requires response.
791 * @param data The data to send as part of the message.
792 * @param size Length of the data, in bytes, to send.
793 * @return The number of bytes sent. @c 0 will be returned if there is
794 * an error.
795 * @ingroup Ecore_IPC_Client_Group
796 * @todo This function needs to become an IPC message.
797 * @todo Make sure ref_to and response parameters are described correctly.
798 */
799EAPI int
800ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, const void *data, int size)
801{
802 Ecore_Ipc_Msg_Head msg;
803 int ret;
804 int *head, md = 0, d, s;
805 unsigned char dat[sizeof(Ecore_Ipc_Msg_Head)];
806
807 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
808 {
809 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
810 "ecore_ipc_client_send");
811 return 0;
812 }
813 if (size < 0) size = 0;
814 msg.major = major;
815 msg.minor = minor;
816 msg.ref = ref;
817 msg.ref_to = ref_to;
818 msg.response = response;
819 msg.size = size;
820 head = (int *)dat;
821 s = 4;
822 CLENC(major);
823 *head = md;
824 CLENC(minor);
825 *head |= md << (4 * 1);
826 CLENC(ref);
827 *head |= md << (4 * 2);
828 CLENC(ref_to);
829 *head |= md << (4 * 3);
830 CLENC(response);
831 *head |= md << (4 * 4);
832 CLENC(size);
833 *head |= md << (4 * 5);
834 *head = htonl(*head);
835 cl->prev.o = msg;
836 ret = ecore_con_client_send(cl->client, dat, s);
837 if (size > 0) ret += ecore_con_client_send(cl->client, data, size);
838 return ret;
839}
840
841/**
842 * Retrieves the IPC server that the given IPC client is connected to.
843 * @param cl The given IPC client.
844 * @return The IPC server the IPC client is connected to.
845 * @ingroup Ecore_IPC_Client_Group
846 */
847EAPI Ecore_Ipc_Server *
848ecore_ipc_client_server_get(Ecore_Ipc_Client *cl)
849{
850 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
851 {
852 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
853 "ecore_ipc_client_server_get");
854 return NULL;
855 }
856 return (ecore_con_server_data_get(ecore_con_client_server_get(cl->client)));
857}
858
859/**
860 * Closes the connection and frees memory allocated to the given IPC
861 * client.
862 * @param cl The given client.
863 * @return Data associated with the client.
864 * @ingroup Ecore_IPC_Client_Group
865 */
866EAPI void *
867ecore_ipc_client_del(Ecore_Ipc_Client *cl)
868{
869 void *data;
870 Ecore_Ipc_Server *svr;
871
872 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
873 {
874 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
875 "ecore_ipc_client_del");
876 return NULL;
877 }
878 data = cl->data;
879 cl->data = NULL;
880 cl->delete_me = 1;
881 if (cl->event_count == 0)
882 {
883 svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client));
884 ecore_con_client_del(cl->client);
885 svr->clients = eina_list_remove(svr->clients, cl);
886 if (cl->buf) free(cl->buf);
887 ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
888 free(cl);
889 }
890 return data;
891}
892
893/**
894 * Sets the IPC data associated with the given IPC client to @p data.
895 * @param cl The given IPC client.
896 * @param data The data to associate with the IPC client.
897 * @ingroup Ecore_IPC_Client_Group
898 */
899EAPI void
900ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data)
901{
902 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
903 {
904 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
905 "ecore_ipc_client_data_set");
906 return;
907 }
908 cl->data = (void *)data;
909}
910
911/**
912 * Retrieves the data that has been associated with the given IPC client.
913 * @param cl The given client.
914 * @return The data associated with the IPC client.
915 * @ingroup Ecore_IPC_Client_Group
916 */
917EAPI void *
918ecore_ipc_client_data_get(Ecore_Ipc_Client *cl)
919{
920 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
921 {
922 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
923 "ecore_ipc_client_data_get");
924 return NULL;
925 }
926 return cl->data;
927}
928
929/**
930 * Sets the max data payload size for an Ipc message in bytes
931 *
932 * @param cl The given client.
933 * @param size The maximum data payload size in bytes.
934 * @ingroup Ecore_Ipc_Client_Group
935 */
936EAPI void
937ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size)
938{
939 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
940 {
941 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
942 "ecore_ipc_client_data_size_max_set");
943 return;
944 }
945 cl->max_buf_size = size;
946}
947
948/**
949 * Sets the max data payload size for an Ipc message in bytes
950 *
951 * @param cl The given client.
952 * @ingroup Ecore_Ipc_Client_Group
953 */
954EAPI int
955ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl)
956{
957 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
958 {
959 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
960 "ecore_ipc_client_data_size_max_get");
961 return -1;
962 }
963 return cl->max_buf_size;
964}
965
966/**
967 * Gets the IP address of a client that has been connected to.
968 *
969 * @param cl The given client.
970 * @return A pointer to an internal string that contains the IP address of
971 * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
972 * This string should not be modified or trusted to stay valid after
973 * deletion for the @p cl object. If no IP is known NULL is returned.
974 * @ingroup Ecore_Ipc_Client_Group
975 */
976EAPI const char *
977ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl)
978{
979 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
980 {
981 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
982 "ecore_ipc_client_ip_get");
983 return NULL;
984 }
985 return ecore_con_client_ip_get(cl->client);
986}
987
988/**
989 * Flushes all pending data to the given client. Will return when done.
990 *
991 * @param cl The given client.
992 * @ingroup Ecore_Ipc_Client_Group
993 */
994EAPI void
995ecore_ipc_client_flush(Ecore_Ipc_Client *cl)
996{
997 if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
998 {
999 ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
1000 "ecore_ipc_client_flush");
1001 return;
1002 }
1003 ecore_con_client_flush(cl->client);
1004}
1005
1006/**
1007 * Returns if SSL support is available
1008 * @return 1 if SSL is available, 0 if it is not.
1009 * @ingroup Ecore_Con_Client_Group
1010 */
1011EAPI int
1012ecore_ipc_ssl_available_get(void)
1013{
1014 return ecore_con_ssl_available_get();
1015}
1016
1017
1018static Eina_Bool
1019_ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
1020{
1021 Ecore_Con_Event_Client_Add *e;
1022
1023 e = ev;
1024 if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
1025 /* handling code here */
1026 {
1027 Ecore_Ipc_Client *cl;
1028 Ecore_Ipc_Server *svr;
1029
1030 cl = calloc(1, sizeof(Ecore_Ipc_Client));
1031 if (!cl) return ECORE_CALLBACK_CANCEL;
1032 svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
1033 ECORE_MAGIC_SET(cl, ECORE_MAGIC_IPC_CLIENT);
1034 cl->client = e->client;
1035 cl->max_buf_size = 32 * 1024;
1036 ecore_con_client_data_set(cl->client, (void *)cl);
1037 svr->clients = eina_list_append(svr->clients, cl);
1038 svr->client_list = eina_list_append(svr->client_list, cl);
1039 if (!cl->delete_me)
1040 {
1041 Ecore_Ipc_Event_Client_Add *e2;
1042
1043 e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Add));
1044 if (e2)
1045 {
1046 cl->event_count++;
1047 e2->client = cl;
1048 ecore_event_add(ECORE_IPC_EVENT_CLIENT_ADD, e2,
1049 _ecore_ipc_event_client_add_free, NULL);
1050 }
1051 }
1052 }
1053 return ECORE_CALLBACK_CANCEL;
1054}
1055
1056static Eina_Bool
1057_ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
1058{
1059 Ecore_Con_Event_Client_Del *e;
1060
1061 e = ev;
1062 if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
1063 /* handling code here */
1064 {
1065 Ecore_Ipc_Client *cl;
1066
1067 cl = ecore_con_client_data_get(e->client);
1068 {
1069 Ecore_Ipc_Event_Client_Del *e2;
1070 Ecore_Ipc_Server *svr;
1071
1072 svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
1073 svr->client_list = eina_list_remove(svr->client_list, cl);
1074 if (!cl->delete_me)
1075 {
1076 e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del));
1077 if (e2)
1078 {
1079 cl->event_count++;
1080 e2->client = cl;
1081 ecore_event_add(ECORE_IPC_EVENT_CLIENT_DEL, e2,
1082 _ecore_ipc_event_client_del_free, NULL);
1083 }
1084 }
1085 }
1086 }
1087 return ECORE_CALLBACK_CANCEL;
1088}
1089
1090static Eina_Bool
1091_ecore_ipc_event_server_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
1092{
1093 Ecore_Con_Event_Server_Add *e;
1094
1095 e = ev;
1096 if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW;
1097 /* handling code here */
1098 {
1099 Ecore_Ipc_Server *svr;
1100
1101 svr = ecore_con_server_data_get(e->server);
1102 if (!svr->delete_me)
1103 {
1104 Ecore_Ipc_Event_Server_Add *e2;
1105
1106 e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Add));
1107 if (e2)
1108 {
1109 svr->event_count++;
1110 e2->server = svr;
1111 ecore_event_add(ECORE_IPC_EVENT_SERVER_ADD, e2,
1112 _ecore_ipc_event_server_add_free, NULL);
1113 }
1114 }
1115 }
1116 return ECORE_CALLBACK_CANCEL;
1117}
1118
1119static Eina_Bool
1120_ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
1121{
1122 Ecore_Con_Event_Server_Del *e;
1123
1124 e = ev;
1125 if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW;
1126 /* handling code here */
1127 {
1128 Ecore_Ipc_Server *svr;
1129
1130 svr = ecore_con_server_data_get(e->server);
1131 if (!svr->delete_me)
1132 {
1133 Ecore_Ipc_Event_Server_Del *e2;
1134
1135 e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Del));
1136 if (e2)
1137 {
1138 svr->event_count++;
1139 e2->server = svr;
1140 ecore_event_add(ECORE_IPC_EVENT_SERVER_DEL, e2,
1141 _ecore_ipc_event_server_del_free, NULL);
1142 }
1143 }
1144 }
1145 return ECORE_CALLBACK_CANCEL;
1146}
1147
1148#define CLSZ(_n) \
1149 md = ((head >> (4 * _n)) & 0xf); \
1150 if (md >= DLT_SET) s += 4; \
1151 else if (md >= DLT_ADD16) s += 2; \
1152 else if (md >= DLT_ADD8) s += 1;
1153
1154#define CLDEC(_n, _member) \
1155 md = ((head >> (4 * _n)) & 0xf); \
1156 if (md >= DLT_SET) \
1157 { \
1158 unsigned int v; \
1159 unsigned char *dv; \
1160 dv = (unsigned char *)&v; \
1161 dv[0] = *(cl->buf + offset + s + 0); \
1162 dv[1] = *(cl->buf + offset + s + 1); \
1163 dv[2] = *(cl->buf + offset + s + 2); \
1164 dv[3] = *(cl->buf + offset + s + 3); \
1165 d = (int)ntohl(v); \
1166 s += 4; \
1167 } \
1168 else if (md >= DLT_ADD16) \
1169 { \
1170 unsigned short v; \
1171 unsigned char *dv; \
1172 dv = (unsigned char *)&v; \
1173 dv[0] = *(cl->buf + offset + s + 0); \
1174 dv[1] = *(cl->buf + offset + s + 1); \
1175 d = (int)ntohs(v); \
1176 s += 2; \
1177 } \
1178 else if (md >= DLT_ADD8) \
1179 { \
1180 unsigned char v; \
1181 unsigned char *dv; \
1182 dv = (unsigned char *)&v; \
1183 dv[0] = *(cl->buf + offset + s + 0); \
1184 d = (int)v; \
1185 s += 1; \
1186 } \
1187 msg._member = _ecore_ipc_ddlt_int(d, cl->prev.i._member, md);
1188
1189static Eina_Bool
1190_ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
1191{
1192 Ecore_Con_Event_Client_Data *e;
1193
1194 e = ev;
1195 if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
1196 /* handling code here */
1197 {
1198 Ecore_Ipc_Client *cl;
1199 Ecore_Ipc_Msg_Head msg;
1200 int offset = 0;
1201 unsigned char *buf;
1202
1203 cl = ecore_con_client_data_get(e->client);
1204
1205 if (!cl->buf)
1206 {
1207 cl->buf_size = e->size;
1208 cl->buf = e->data;
1209 e->data = NULL; /* take it out of the old event */
1210 }
1211 else
1212 {
1213 buf = realloc(cl->buf, cl->buf_size + e->size);
1214 if (!buf)
1215 {
1216 free(cl->buf);
1217 cl->buf = 0;
1218 cl->buf_size = 0;
1219 return ECORE_CALLBACK_CANCEL;
1220 }
1221 cl->buf = buf;
1222 memcpy(cl->buf + cl->buf_size, e->data, e->size);
1223 cl->buf_size += e->size;
1224 }
1225 /* examine header */
1226 redo:
1227 if ((cl->buf_size - offset) >= (int)sizeof(int))
1228 {
1229 int s, md, d = 0, head;
1230 unsigned char *dd;
1231
1232 dd = (unsigned char *)&head;
1233 dd[0] = *(cl->buf + offset + 0);
1234 dd[1] = *(cl->buf + offset + 1);
1235 dd[2] = *(cl->buf + offset + 2);
1236 dd[3] = *(cl->buf + offset + 3);
1237 head = ntohl(head);
1238 dd = (unsigned char *)&d;
1239 s = 4;
1240 CLSZ(0);
1241 CLSZ(1);
1242 CLSZ(2);
1243 CLSZ(3);
1244 CLSZ(4);
1245 CLSZ(5);
1246 if ((cl->buf_size - offset) < s)
1247 {
1248 if (offset > 0) goto scroll;
1249 return ECORE_CALLBACK_CANCEL;
1250 }
1251
1252 s = 4;
1253 CLDEC(0, major);
1254 CLDEC(1, minor);
1255 CLDEC(2, ref);
1256 CLDEC(3, ref_to);
1257 CLDEC(4, response);
1258 CLDEC(5, size);
1259 if (msg.size < 0) msg.size = 0;
1260 /* there is enough data in the buffer for a full message */
1261 if ((cl->buf_size - offset) >= (s + msg.size))
1262 {
1263 Ecore_Ipc_Event_Client_Data *e2;
1264 Ecore_Ipc_Server *svr;
1265 int max, max2;
1266
1267 buf = NULL;
1268 svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client));
1269 max = svr->max_buf_size;
1270 max2 = cl->max_buf_size;
1271 if ((max >= 0) && (max2 >= 0))
1272 {
1273 if (max2 < max) max = max2;
1274 }
1275 else
1276 {
1277 if (max < 0) max = max2;
1278 }
1279 if ((max < 0) || (msg.size <= max))
1280 {
1281 if (msg.size > 0)
1282 {
1283 buf = malloc(msg.size);
1284 if (!buf) return ECORE_CALLBACK_CANCEL;
1285 memcpy(buf, cl->buf + offset + s, msg.size);
1286 }
1287 if (!cl->delete_me)
1288 {
1289 e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Data));
1290 if (e2)
1291 {
1292 cl->event_count++;
1293 e2->client = cl;
1294 e2->major = msg.major;
1295 e2->minor = msg.minor;
1296 e2->ref = msg.ref;
1297 e2->ref_to = msg.ref_to;
1298 e2->response = msg.response;
1299 e2->size = msg.size;
1300 e2->data = buf;
1301 ecore_event_add(ECORE_IPC_EVENT_CLIENT_DATA, e2,
1302 _ecore_ipc_event_client_data_free,
1303 NULL);
1304 }
1305 }
1306 }
1307 cl->prev.i = msg;
1308 offset += (s + msg.size);
1309 if (cl->buf_size == offset)
1310 {
1311 free(cl->buf);
1312 cl->buf = NULL;
1313 cl->buf_size = 0;
1314 return ECORE_CALLBACK_CANCEL;
1315 }
1316 goto redo;
1317 }
1318 else goto scroll;
1319 }
1320 else
1321 {
1322 scroll:
1323 buf = malloc(cl->buf_size - offset);
1324 if (!buf)
1325 {
1326 free(cl->buf);
1327 cl->buf = NULL;
1328 cl->buf_size = 0;
1329 return ECORE_CALLBACK_CANCEL;
1330 }
1331 memcpy(buf, cl->buf + offset, cl->buf_size - offset);
1332 free(cl->buf);
1333 cl->buf = buf;
1334 cl->buf_size -= offset;
1335 }
1336 }
1337 return ECORE_CALLBACK_CANCEL;
1338}
1339
1340#define SVSZ(_n) \
1341 md = ((head >> (4 * _n)) & 0xf); \
1342 if (md >= DLT_SET) s += 4; \
1343 else if (md >= DLT_ADD16) s += 2; \
1344 else if (md >= DLT_ADD8) s += 1;
1345
1346#define SVDEC(_n, _member) \
1347 md = ((head >> (4 * _n)) & 0xf); \
1348 if (md >= DLT_SET) \
1349 { \
1350 unsigned int v; \
1351 unsigned char *dv; \
1352 dv = (unsigned char *)&v; \
1353 dv[0] = *(svr->buf + offset + s + 0); \
1354 dv[1] = *(svr->buf + offset + s + 1); \
1355 dv[2] = *(svr->buf + offset + s + 2); \
1356 dv[3] = *(svr->buf + offset + s + 3); \
1357 d = (int)ntohl(v); \
1358 s += 4; \
1359 } \
1360 else if (md >= DLT_ADD16) \
1361 { \
1362 unsigned short v; \
1363 unsigned char *dv; \
1364 dv = (unsigned char *)&v; \
1365 dv[0] = *(svr->buf + offset + s + 0); \
1366 dv[1] = *(svr->buf + offset + s + 1); \
1367 d = (int)ntohs(v); \
1368 s += 2; \
1369 } \
1370 else if (md >= DLT_ADD8) \
1371 { \
1372 unsigned char v; \
1373 unsigned char *dv; \
1374 dv = (unsigned char *)&v; \
1375 dv[0] = *(svr->buf + offset + s + 0); \
1376 d = (int)v; \
1377 s += 1; \
1378 } \
1379 msg._member = _ecore_ipc_ddlt_int(d, svr->prev.i._member, md);
1380
1381static Eina_Bool
1382_ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
1383{
1384 Ecore_Con_Event_Server_Data *e;
1385
1386 e = ev;
1387 if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW;
1388 /* handling code here */
1389 {
1390 Ecore_Ipc_Server *svr;
1391 Ecore_Ipc_Msg_Head msg;
1392 int offset = 0;
1393 unsigned char *buf;
1394
1395 svr = ecore_con_server_data_get(e->server);
1396
1397 if (!svr->buf)
1398 {
1399 svr->buf_size = e->size;
1400 svr->buf = e->data;
1401 e->data = NULL; /* take it out of the old event */
1402 }
1403 else
1404 {
1405 buf = realloc(svr->buf, svr->buf_size + e->size);
1406 if (!buf)
1407 {
1408 free(svr->buf);
1409 svr->buf = 0;
1410 svr->buf_size = 0;
1411 return ECORE_CALLBACK_CANCEL;
1412 }
1413 svr->buf = buf;
1414 memcpy(svr->buf + svr->buf_size, e->data, e->size);
1415 svr->buf_size += e->size;
1416 }
1417 /* examine header */
1418 redo:
1419 if ((svr->buf_size - offset) >= (int)sizeof(int))
1420 {
1421 int s, md, d = 0, head;
1422 unsigned char *dd;
1423
1424 dd = (unsigned char *)&head;
1425 dd[0] = *(svr->buf + offset + 0);
1426 dd[1] = *(svr->buf + offset + 1);
1427 dd[2] = *(svr->buf + offset + 2);
1428 dd[3] = *(svr->buf + offset + 3);
1429 head = ntohl(head);
1430 dd = (unsigned char *)&d;
1431 s = 4;
1432 SVSZ(0);
1433 SVSZ(1);
1434 SVSZ(2);
1435 SVSZ(3);
1436 SVSZ(4);
1437 SVSZ(5);
1438 if ((svr->buf_size - offset) < s)
1439 {
1440 if (offset > 0) goto scroll;
1441 return ECORE_CALLBACK_CANCEL;
1442 }
1443
1444 s = 4;
1445 SVDEC(0, major);
1446 SVDEC(1, minor);
1447 SVDEC(2, ref);
1448 SVDEC(3, ref_to);
1449 SVDEC(4, response);
1450 SVDEC(5, size);
1451 if (msg.size < 0) msg.size = 0;
1452 /* there is enough data in the buffer for a full message */
1453 if ((svr->buf_size - offset) >= (s + msg.size))
1454 {
1455 Ecore_Ipc_Event_Server_Data *e2;
1456 int max;
1457
1458 buf = NULL;
1459 max = svr->max_buf_size;
1460 if ((max < 0) || (msg.size <= max))
1461 {
1462 if (msg.size > 0)
1463 {
1464 buf = malloc(msg.size);
1465 if (!buf) return ECORE_CALLBACK_CANCEL;
1466 memcpy(buf, svr->buf + offset + s, msg.size);
1467 }
1468 if (!svr->delete_me)
1469 {
1470 e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Data));
1471 if (e2)
1472 {
1473 svr->event_count++;
1474 e2->server = svr;
1475 e2->major = msg.major;
1476 e2->minor = msg.minor;
1477 e2->ref = msg.ref;
1478 e2->ref_to = msg.ref_to;
1479 e2->response = msg.response;
1480 e2->size = msg.size;
1481 e2->data = buf;
1482 ecore_event_add(ECORE_IPC_EVENT_SERVER_DATA, e2,
1483 _ecore_ipc_event_server_data_free,
1484 NULL);
1485 }
1486 }
1487 }
1488 svr->prev.i = msg;
1489 offset += (s + msg.size);
1490 if (svr->buf_size == offset)
1491 {
1492 free(svr->buf);
1493 svr->buf = NULL;
1494 svr->buf_size = 0;
1495 return ECORE_CALLBACK_CANCEL;
1496 }
1497 goto redo;
1498 }
1499 else goto scroll;
1500 }
1501 else
1502 {
1503 scroll:
1504 buf = malloc(svr->buf_size - offset);
1505 if (!buf)
1506 {
1507 free(svr->buf);
1508 svr->buf = NULL;
1509 svr->buf_size = 0;
1510 return ECORE_CALLBACK_CANCEL;
1511 }
1512 memcpy(buf, svr->buf + offset, svr->buf_size - offset);
1513 free(svr->buf);
1514 svr->buf = buf;
1515 svr->buf_size -= offset;
1516 }
1517 }
1518 return ECORE_CALLBACK_CANCEL;
1519}
1520
1521static void
1522_ecore_ipc_event_client_add_free(void *data __UNUSED__, void *ev)
1523{
1524 Ecore_Ipc_Event_Client_Add *e;
1525
1526 e = ev;
1527 e->client->event_count--;
1528 if ((e->client->event_count == 0) && (e->client->delete_me))
1529 ecore_ipc_client_del(e->client);
1530 free(e);
1531}
1532
1533static void
1534_ecore_ipc_event_client_del_free(void *data __UNUSED__, void *ev)
1535{
1536 Ecore_Ipc_Event_Client_Del *e;
1537
1538 e = ev;
1539 e->client->event_count--;
1540 if ((e->client->event_count == 0) && (e->client->delete_me))
1541 ecore_ipc_client_del(e->client);
1542 free(e);
1543}
1544
1545static void
1546_ecore_ipc_event_client_data_free(void *data __UNUSED__, void *ev)
1547{
1548 Ecore_Ipc_Event_Client_Data *e;
1549
1550 e = ev;
1551 e->client->event_count--;
1552 if (e->data) free(e->data);
1553 if ((e->client->event_count == 0) && (e->client->delete_me))
1554 ecore_ipc_client_del(e->client);
1555 free(e);
1556}
1557
1558static void
1559_ecore_ipc_event_server_add_free(void *data __UNUSED__, void *ev)
1560{
1561 Ecore_Ipc_Event_Server_Add *e;
1562
1563 e = ev;
1564 e->server->event_count--;
1565 if ((e->server->event_count == 0) && (e->server->delete_me))
1566 ecore_ipc_server_del(e->server);
1567 free(e);
1568}
1569
1570static void
1571_ecore_ipc_event_server_del_free(void *data __UNUSED__, void *ev)
1572{
1573 Ecore_Ipc_Event_Server_Add *e;
1574
1575 e = ev;
1576 e->server->event_count--;
1577 if ((e->server->event_count == 0) && (e->server->delete_me))
1578 ecore_ipc_server_del(e->server);
1579 free(e);
1580}
1581
1582static void
1583_ecore_ipc_event_server_data_free(void *data __UNUSED__, void *ev)
1584{
1585 Ecore_Ipc_Event_Server_Data *e;
1586
1587 e = ev;
1588 if (e->data) free(e->data);
1589 e->server->event_count--;
1590 if ((e->server->event_count == 0) && (e->server->delete_me))
1591 ecore_ipc_server_del(e->server);
1592 free(e);
1593}
diff --git a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h
deleted file mode 100644
index 57f7849..0000000
--- a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h
+++ /dev/null
@@ -1,104 +0,0 @@
1#ifndef _ECORE_IPC_PRIVATE_H
2#define _ECORE_IPC_PRIVATE_H
3
4
5extern int _ecore_ipc_log_dom;
6
7#ifdef ECORE_IPC_DEFAULT_LOG_COLOR
8# undef ECORE_IPC_DEFAULT_LOG_COLOR
9#endif
10#define ECORE_IPC_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
11
12#ifdef ERR
13# undef ERR
14#endif
15#define ERR(...) EINA_LOG_DOM_ERR(_ecore_ipc_log_dom, __VA_ARGS__)
16
17#ifdef DBG
18# undef DBG
19#endif
20#define DBG(...) EINA_LOG_DOM_DBG(_ecore_ipc_log_dom, __VA_ARGS__)
21
22#ifdef INF
23# undef INF
24#endif
25#define INF(...) EINA_LOG_DOM_INFO(_ecore_ipc_log_dom, __VA_ARGS__)
26
27#ifdef WRN
28# undef WRN
29#endif
30#define WRN(...) EINA_LOG_DOM_WARN(_ecore_ipc_log_dom, __VA_ARGS__)
31
32#ifdef CRIT
33# undef CRIT
34#endif
35#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_ipc_log_dom, __VA_ARGS__)
36
37#define ECORE_MAGIC_IPC_SERVER 0x87786556
38#define ECORE_MAGIC_IPC_CLIENT 0x78875665
39
40typedef struct _Ecore_Ipc_Msg_Head Ecore_Ipc_Msg_Head;
41
42
43#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
44# pragma pack(1)
45# define ECORE_IPC_STRUCT_PACKED
46#elif defined (__GNUC__) || (defined (__SUNPRO_C) && __SUNPRO_C >= 0x5100)
47# define ECORE_IPC_STRUCT_PACKED __attribute__((packed))
48#else
49# define ECORE_IPC_STRUCT_PACKED
50#endif
51
52#ifdef __sgi
53#pragma pack 4
54#endif
55struct _Ecore_Ipc_Msg_Head
56{
57 int major;
58 int minor;
59 int ref;
60 int ref_to;
61 int response;
62 int size;
63} ECORE_IPC_STRUCT_PACKED;
64#ifdef __sgi
65#pragma pack 0
66#endif
67
68struct _Ecore_Ipc_Client
69{
70 ECORE_MAGIC;
71 Ecore_Con_Client *client;
72 void *data;
73 unsigned char *buf;
74 int buf_size;
75 int max_buf_size;
76
77 struct {
78 Ecore_Ipc_Msg_Head i, o;
79 } prev;
80
81 int event_count;
82 char delete_me : 1;
83};
84
85struct _Ecore_Ipc_Server
86{
87 ECORE_MAGIC;
88 Ecore_Con_Server *server;
89 Eina_List *clients;
90 Eina_List *client_list;
91 void *data;
92 unsigned char *buf;
93 int buf_size;
94 int max_buf_size;
95
96 struct {
97 Ecore_Ipc_Msg_Head i, o;
98 } prev;
99
100 int event_count;
101 char delete_me : 1;
102};
103
104#endif
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h
deleted file mode 100644
index c6300fd..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h
+++ /dev/null
@@ -1,121 +0,0 @@
1#ifndef _ECORE_PSL1GHT_H
2#define _ECORE_PSL1GHT_H
3
4#ifdef EAPI
5# undef EAPI
6#endif
7
8#ifdef __GNUC__
9# if __GNUC__ >= 4
10# define EAPI __attribute__ ((visibility("default")))
11# else
12# define EAPI
13# endif
14#else
15# define EAPI
16#endif
17
18/**
19 * @file
20 * @brief Ecore PSL1GHT system functions.
21 */
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27EAPI extern int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS;
28EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS;
29EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS;
30EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE;
31EAPI extern int ECORE_PSL1GHT_EVENT_QUIT;
32
33typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers;
34struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */
35{
36 unsigned int timestamp;
37 unsigned int modifiers;
38 int shift_changed : 1;
39 int shift : 1;
40 int alt_changed : 1;
41 int alt : 1;
42 int ctrl_changed : 1;
43 int ctrl : 1;
44 int win_changed : 1;
45 int win : 1;
46 int num_lock_changed : 1;
47 int num_lock : 1;
48 int caps_lock_changed : 1;
49 int caps_lock : 1;
50 int scroll_lock_changed : 1;
51 int scroll_lock : 1;
52};
53
54typedef struct _Ecore_Psl1ght_Event_Key_Down Ecore_Psl1ght_Event_Key_Down;
55struct _Ecore_Psl1ght_Event_Key_Down /** PSL1GHT Key Down event */
56{
57 const char *keyname; /**< The name of the key that was pressed */
58 const char *keycompose; /**< The UTF-8 string conversion if any */
59 unsigned int time;
60};
61
62typedef struct _Ecore_Psl1ght_Event_Key_Up Ecore_Psl1ght_Event_Key_Up;
63struct _Ecore_Psl1ght_Event_Key_Up /** PSL1GHT Key Up event */
64{
65 const char *keyname; /**< The name of the key that was released */
66 const char *keycompose; /**< The UTF-8 string conversion if any */
67 unsigned int time;
68};
69
70typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Down Ecore_Psl1ght_Event_Mouse_Button_Down;
71struct _Ecore_Psl1ght_Event_Mouse_Button_Down /** PSL1GHT Mouse Down event */
72{
73 int button; /**< Mouse button that was pressed (1 - 32) */
74 int x; /**< Mouse co-ordinates when mouse button was pressed */
75 int y; /**< Mouse co-ordinates when mouse button was pressed */
76 int double_click : 1; /**< Set if click was a double click */
77 int triple_click : 1; /**< Set if click was a triple click */
78 unsigned int time;
79};
80
81typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Up Ecore_Psl1ght_Event_Mouse_Button_Up;
82struct _Ecore_Psl1ght_Event_Mouse_Button_Up /** PSL1GHT Mouse Up event */
83{
84 int button; /**< Mouse button that was released (1 - 32) */
85 int x; /**< Mouse co-ordinates when mouse button was raised */
86 int y; /**< Mouse co-ordinates when mouse button was raised */
87 int double_click : 1; /**< Set if click was a double click */
88 int triple_click : 1; /**< Set if click was a triple click */
89 unsigned int time;
90};
91
92typedef struct _Ecore_Psl1ght_Event_Mouse_Move Ecore_Psl1ght_Event_Mouse_Move;
93struct _Ecore_Psl1ght_Event_Mouse_Move /** PSL1GHT Mouse Move event */
94{
95 int x; /**< Mouse co-ordinates where the mouse cursor moved to */
96 int y; /**< Mouse co-ordinates where the mouse cursor moved to */
97 unsigned int time;
98};
99
100typedef struct _Ecore_Psl1ght_Event_Mouse_Wheel Ecore_Psl1ght_Event_Mouse_Wheel;
101struct _Ecore_Psl1ght_Event_Mouse_Wheel /** PSL1GHT Mouse Wheel event */
102{
103 int x, y;
104 int direction; /* 0 = vertical, 1 = horizontal */
105 int wheel; /* value 1 (left/up), -1 (right/down) */
106 unsigned int time;
107};
108
109EAPI int ecore_psl1ght_init(const char *name);
110EAPI int ecore_psl1ght_shutdown(void);
111EAPI void ecore_psl1ght_resolution_set(int width, int height);
112EAPI void ecore_psl1ght_poll_events(void);
113
114EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h);
115EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h);
116
117#ifdef __cplusplus
118}
119#endif
120
121#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
deleted file mode 100644
index e385af8..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef ECORE_PSL1GHT_KEYS_H__
2# define ECORE_PSL1GHT_KEYS_H__
3
4struct _ecore_psl1ght_keys_s
5{
6 int code;
7 const char *name;
8 const char *compose;
9};
10
11static const struct _ecore_psl1ght_keys_s keystable[] =
12{
13 { KB_RAWKEY_NO_EVENT, "0x00", "" },
14 { KB_RAWKEY_BS, "BackSpace", "\010" },
15 { KB_RAWKEY_TAB, "Tab", "\011" },
16 { KB_RAWKEY_ENTER, "Return", "\015" },
17 { KB_RAWKEY_PAUSE, "Pause", "Pause" },
18 { KB_RAWKEY_ESCAPE, "Escape", "\033" },
19 { KB_RAWKEY_SPACE, "space", " " },
20
21 /* Skip uppercase letters */
22 { KB_RAWKEY_LEFT_BRACKET_101, "bracketleft", "[" },
23 { KB_RAWKEY_BACKSLASH_101, "backslash", "\\" },
24 { KB_RAWKEY_RIGHT_BRACKET_101, "bracketright", "]" },
25 { KB_RAWKEY_ACCENT_CIRCONFLEX_106, "asciicircumm", "^" },
26 { KB_RAWKEY_DELETE, "Delete", "\177" },
27 /* End of ASCII mapped keysyms */
28
29 /* Numeric keypad */
30 { KB_RAWKEY_KPAD_0, "KP0", "0" },
31 { KB_RAWKEY_KPAD_1, "KP1", "1" },
32 { KB_RAWKEY_KPAD_2, "KP2", "2" },
33 { KB_RAWKEY_KPAD_3, "KP3", "3" },
34 { KB_RAWKEY_KPAD_4, "KP4", "4" },
35 { KB_RAWKEY_KPAD_5, "KP5", "5" },
36 { KB_RAWKEY_KPAD_6, "KP6", "6" },
37 { KB_RAWKEY_KPAD_7, "KP7", "7" },
38 { KB_RAWKEY_KPAD_8, "KP8", "8" },
39 { KB_RAWKEY_KPAD_9, "KP9", "9" },
40 { KB_RAWKEY_KPAD_PERIOD, "period", "." },
41 { KB_RAWKEY_KPAD_SLASH, "KP_Divide", "/" },
42 { KB_RAWKEY_KPAD_ASTERISK, "KP_Multiply", "*" },
43 { KB_RAWKEY_KPAD_MINUS, "KP_Minus", "-" },
44 { KB_RAWKEY_KPAD_PLUS, "KP_Plus", "+" },
45 { KB_RAWKEY_KPAD_ENTER, "KP_Enter", "\015" },
46
47 /* Arrows + Home/End pad */
48 { KB_RAWKEY_UP_ARROW, "Up", "Up" },
49 { KB_RAWKEY_DOWN_ARROW, "Down", "Down" },
50 { KB_RAWKEY_RIGHT_ARROW, "Right", "Right" },
51 { KB_RAWKEY_LEFT_ARROW, "Left", "Left" },
52 { KB_RAWKEY_INSERT, "Insert", "Insert" },
53 { KB_RAWKEY_HOME, "Home", "Home" },
54 { KB_RAWKEY_END, "End", "End" },
55 { KB_RAWKEY_PAGE_UP, "Page_Up", "Page_Up" },
56 { KB_RAWKEY_PAGE_DOWN, "Page_Down", "Page_Down" },
57
58 /* Function keys */
59 { KB_RAWKEY_F1, "F1", "F1" },
60 { KB_RAWKEY_F2, "F2", "F2" },
61 { KB_RAWKEY_F3, "F3", "F3" },
62 { KB_RAWKEY_F4, "F4", "F4" },
63 { KB_RAWKEY_F5, "F5", "F5" },
64 { KB_RAWKEY_F6, "F6", "F6" },
65 { KB_RAWKEY_F7, "F7", "F7" },
66 { KB_RAWKEY_F8, "F8", "F8" },
67 { KB_RAWKEY_F9, "F9", "F9" },
68 { KB_RAWKEY_F10, "F10", "F10" },
69 { KB_RAWKEY_F11, "F11", "F11" },
70 { KB_RAWKEY_F12, "F12", "F12" },
71
72 /* Key state modifier keys */
73 { KB_RAWKEY_KPAD_NUMLOCK, "Num_Lock", "Num_Lock" },
74 { KB_RAWKEY_CAPS_LOCK, "Caps_Lock", "Caps_Lock" },
75 { KB_RAWKEY_SCROLL_LOCK, "Scroll_Lock", "Scroll_Lock" },
76};
77
78#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
deleted file mode 100644
index 8e7328a..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_evas \
6-I$(top_srcdir)/src/lib/ecore_input \
7-I$(top_builddir)/src/lib/ecore \
8-I$(top_builddir)/src/lib/ecore_evas \
9-I$(top_builddir)/src/lib/ecore_input \
10@EFL_ECORE_PSL1GHT_BUILD@ \
11@EVAS_CFLAGS@ \
12@EINA_CFLAGS@
13
14lib_LTLIBRARIES = libecore_psl1ght.la
15includes_HEADERS = Ecore_Psl1ght.h
16includesdir = $(includedir)/ecore-@VMAJ@
17
18libecore_psl1ght_la_SOURCES = \
19ecore_psl1ght.c \
20moveutil.c \
21spursutil.c
22
23libecore_psl1ght_la_LIBADD = \
24$(top_builddir)/src/lib/ecore/libecore.la \
25$(top_builddir)/src/lib/ecore_input/libecore_input.la \
26@EINA_LIBS@
27
28libecore_psl1ght_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
29
30EXTRA_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
deleted file mode 100644
index 54a0435..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
+++ /dev/null
@@ -1,840 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_psl1ght
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_psl1ght_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la \
90 $(top_builddir)/src/lib/ecore_input/libecore_input.la
91am_libecore_psl1ght_la_OBJECTS = ecore_psl1ght.lo moveutil.lo \
92 spursutil.lo
93libecore_psl1ght_la_OBJECTS = $(am_libecore_psl1ght_la_OBJECTS)
94AM_V_lt = $(am__v_lt_$(V))
95am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
96am__v_lt_0 = --silent
97libecore_psl1ght_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
98 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
99 $(AM_CFLAGS) $(CFLAGS) $(libecore_psl1ght_la_LDFLAGS) \
100 $(LDFLAGS) -o $@
101DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
102depcomp = $(SHELL) $(top_srcdir)/depcomp
103am__depfiles_maybe = depfiles
104am__mv = mv -f
105COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
106 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
107LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
108 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
109 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
110 $(AM_CFLAGS) $(CFLAGS)
111AM_V_CC = $(am__v_CC_$(V))
112am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
113am__v_CC_0 = @echo " CC " $@;
114AM_V_at = $(am__v_at_$(V))
115am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
116am__v_at_0 = @
117CCLD = $(CC)
118LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
119 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
120 $(AM_LDFLAGS) $(LDFLAGS) -o $@
121AM_V_CCLD = $(am__v_CCLD_$(V))
122am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
123am__v_CCLD_0 = @echo " CCLD " $@;
124AM_V_GEN = $(am__v_GEN_$(V))
125am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
126am__v_GEN_0 = @echo " GEN " $@;
127SOURCES = $(libecore_psl1ght_la_SOURCES)
128DIST_SOURCES = $(libecore_psl1ght_la_SOURCES)
129HEADERS = $(includes_HEADERS)
130ETAGS = etags
131CTAGS = ctags
132DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
133ACLOCAL = @ACLOCAL@
134ALLOCA = @ALLOCA@
135AMTAR = @AMTAR@
136AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
137AR = @AR@
138AS = @AS@
139AUTOCONF = @AUTOCONF@
140AUTOHEADER = @AUTOHEADER@
141AUTOMAKE = @AUTOMAKE@
142AWK = @AWK@
143CARES_CFLAGS = @CARES_CFLAGS@
144CARES_LIBS = @CARES_LIBS@
145CC = @CC@
146CCDEPMODE = @CCDEPMODE@
147CFLAGS = @CFLAGS@
148CHECK_CFLAGS = @CHECK_CFLAGS@
149CHECK_LIBS = @CHECK_LIBS@
150CPP = @CPP@
151CPPFLAGS = @CPPFLAGS@
152CURL_CFLAGS = @CURL_CFLAGS@
153CURL_LIBS = @CURL_LIBS@
154CXX = @CXX@
155CXXCPP = @CXXCPP@
156CXXDEPMODE = @CXXDEPMODE@
157CXXFLAGS = @CXXFLAGS@
158CYGPATH_W = @CYGPATH_W@
159DEFS = @DEFS@
160DEPDIR = @DEPDIR@
161DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
162DIRECTFB_LIBS = @DIRECTFB_LIBS@
163DLLTOOL = @DLLTOOL@
164DSYMUTIL = @DSYMUTIL@
165DUMPBIN = @DUMPBIN@
166ECHO_C = @ECHO_C@
167ECHO_N = @ECHO_N@
168ECHO_T = @ECHO_T@
169ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
170ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
171EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
172EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
173EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
174EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
175EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
176EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
177EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
178EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
179EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
180EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
181EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
182EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
183EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
184EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
185EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
186EGREP = @EGREP@
187EINA_CFLAGS = @EINA_CFLAGS@
188EINA_LIBS = @EINA_LIBS@
189ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
190ESCAPE_LIBS = @ESCAPE_LIBS@
191EVAS_CFLAGS = @EVAS_CFLAGS@
192EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@
196EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
197EXOTIC_LIBS = @EXOTIC_LIBS@
198FGREP = @FGREP@
199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
200GLIB_CFLAGS = @GLIB_CFLAGS@
201GLIB_LIBS = @GLIB_LIBS@
202GMSGFMT = @GMSGFMT@
203GMSGFMT_015 = @GMSGFMT_015@
204GREP = @GREP@
205INSTALL = @INSTALL@
206INSTALL_DATA = @INSTALL_DATA@
207INSTALL_PROGRAM = @INSTALL_PROGRAM@
208INSTALL_SCRIPT = @INSTALL_SCRIPT@
209INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
210INTLLIBS = @INTLLIBS@
211INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
212KEYSYMDEFS = @KEYSYMDEFS@
213LD = @LD@
214LDFLAGS = @LDFLAGS@
215LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
216LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
217LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
218LIBICONV = @LIBICONV@
219LIBINTL = @LIBINTL@
220LIBOBJS = @LIBOBJS@
221LIBS = @LIBS@
222LIBTOOL = @LIBTOOL@
223LIPO = @LIPO@
224LN_S = @LN_S@
225LTLIBICONV = @LTLIBICONV@
226LTLIBINTL = @LTLIBINTL@
227LTLIBOBJS = @LTLIBOBJS@
228MAKEINFO = @MAKEINFO@
229MKDIR_P = @MKDIR_P@
230MSGFMT = @MSGFMT@
231MSGFMT_015 = @MSGFMT_015@
232MSGMERGE = @MSGMERGE@
233NM = @NM@
234NMEDIT = @NMEDIT@
235OBJC = @OBJC@
236OBJCDEPMODE = @OBJCDEPMODE@
237OBJCFLAGS = @OBJCFLAGS@
238OBJDUMP = @OBJDUMP@
239OBJEXT = @OBJEXT@
240OTOOL = @OTOOL@
241OTOOL64 = @OTOOL64@
242PACKAGE = @PACKAGE@
243PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
244PACKAGE_NAME = @PACKAGE_NAME@
245PACKAGE_STRING = @PACKAGE_STRING@
246PACKAGE_TARNAME = @PACKAGE_TARNAME@
247PACKAGE_URL = @PACKAGE_URL@
248PACKAGE_VERSION = @PACKAGE_VERSION@
249PATH_SEPARATOR = @PATH_SEPARATOR@
250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
251PIXMAN_LIBS = @PIXMAN_LIBS@
252PKG_CONFIG = @PKG_CONFIG@
253PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
254PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
255POSUB = @POSUB@
256RANLIB = @RANLIB@
257SCIM_CFLAGS = @SCIM_CFLAGS@
258SCIM_LIBS = @SCIM_LIBS@
259SDL_CFLAGS = @SDL_CFLAGS@
260SDL_CONFIG = @SDL_CONFIG@
261SDL_LIBS = @SDL_LIBS@
262SED = @SED@
263SET_MAKE = @SET_MAKE@
264SHELL = @SHELL@
265SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
266SSL_CFLAGS = @SSL_CFLAGS@
267SSL_LIBS = @SSL_LIBS@
268STRIP = @STRIP@
269TLS2_CFLAGS = @TLS2_CFLAGS@
270TLS2_LIBS = @TLS2_LIBS@
271TLS_CFLAGS = @TLS_CFLAGS@
272TLS_LIBS = @TLS_LIBS@
273TSLIB_CFLAGS = @TSLIB_CFLAGS@
274TSLIB_LIBS = @TSLIB_LIBS@
275USE_NLS = @USE_NLS@
276VERSION = @VERSION@
277VMAJ = @VMAJ@
278WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
279WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
280WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
281WAYLAND_LIBS = @WAYLAND_LIBS@
282WIN32_CFLAGS = @WIN32_CFLAGS@
283WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
284WIN32_LIBS = @WIN32_LIBS@
285XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
286XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
287XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
288XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
289XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
290XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
291XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
292XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
293XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
294XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
295XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
296XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
297XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
298XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
299XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
300XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
301XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
302XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
303XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
304XCB_X11_LIBS = @XCB_X11_LIBS@
305XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
306XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
307XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
308XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
309XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
310XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
311XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
312XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
313XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
314XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
315XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
316XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
317XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
318XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
319XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
320XDAMAGE_LIBS = @XDAMAGE_LIBS@
321XDPMS_CFLAGS = @XDPMS_CFLAGS@
322XDPMS_LIBS = @XDPMS_LIBS@
323XFIXES_CFLAGS = @XFIXES_CFLAGS@
324XFIXES_LIBS = @XFIXES_LIBS@
325XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
326XGESTURE_LIBS = @XGESTURE_LIBS@
327XGETTEXT = @XGETTEXT@
328XGETTEXT_015 = @XGETTEXT_015@
329XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
330XI2_CFLAGS = @XI2_CFLAGS@
331XI2_LIBS = @XI2_LIBS@
332XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
333XINERAMA_LIBS = @XINERAMA_LIBS@
334XKB_CFLAGS = @XKB_CFLAGS@
335XKB_LIBS = @XKB_LIBS@
336XMKMF = @XMKMF@
337XPRINT_CFLAGS = @XPRINT_CFLAGS@
338XPRINT_LIBS = @XPRINT_LIBS@
339XRANDR_CFLAGS = @XRANDR_CFLAGS@
340XRANDR_LIBS = @XRANDR_LIBS@
341XRENDER_CFLAGS = @XRENDER_CFLAGS@
342XRENDER_LIBS = @XRENDER_LIBS@
343XSS_CFLAGS = @XSS_CFLAGS@
344XSS_LIBS = @XSS_LIBS@
345XTEST_CFLAGS = @XTEST_CFLAGS@
346XTEST_LIBS = @XTEST_LIBS@
347X_CFLAGS = @X_CFLAGS@
348X_EXTRA_LIBS = @X_EXTRA_LIBS@
349X_LIBS = @X_LIBS@
350X_PRE_LIBS = @X_PRE_LIBS@
351Xcursor_cflags = @Xcursor_cflags@
352Xcursor_libs = @Xcursor_libs@
353abs_builddir = @abs_builddir@
354abs_srcdir = @abs_srcdir@
355abs_top_builddir = @abs_top_builddir@
356abs_top_srcdir = @abs_top_srcdir@
357ac_ct_CC = @ac_ct_CC@
358ac_ct_CXX = @ac_ct_CXX@
359ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
360ac_ct_OBJC = @ac_ct_OBJC@
361am__include = @am__include@
362am__leading_dot = @am__leading_dot@
363am__quote = @am__quote@
364am__tar = @am__tar@
365am__untar = @am__untar@
366bindir = @bindir@
367build = @build@
368build_alias = @build_alias@
369build_cpu = @build_cpu@
370build_os = @build_os@
371build_vendor = @build_vendor@
372builddir = @builddir@
373cocoa_ldflags = @cocoa_ldflags@
374datadir = @datadir@
375datarootdir = @datarootdir@
376dlopen_libs = @dlopen_libs@
377docdir = @docdir@
378dvidir = @dvidir@
379ecore_cocoa_cflags = @ecore_cocoa_cflags@
380ecore_cocoa_libs = @ecore_cocoa_libs@
381ecore_con_cflags = @ecore_con_cflags@
382ecore_con_libs = @ecore_con_libs@
383ecore_directfb_cflags = @ecore_directfb_cflags@
384ecore_directfb_libs = @ecore_directfb_libs@
385ecore_evas_cflags = @ecore_evas_cflags@
386ecore_evas_libs = @ecore_evas_libs@
387ecore_fb_cflags = @ecore_fb_cflags@
388ecore_fb_libs = @ecore_fb_libs@
389ecore_file_cflags = @ecore_file_cflags@
390ecore_file_libs = @ecore_file_libs@
391ecore_imf_cflags = @ecore_imf_cflags@
392ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
393ecore_imf_evas_libs = @ecore_imf_evas_libs@
394ecore_imf_libs = @ecore_imf_libs@
395ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
396ecore_imf_scim_libs = @ecore_imf_scim_libs@
397ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
398ecore_imf_xim_libs = @ecore_imf_xim_libs@
399ecore_input_cflags = @ecore_input_cflags@
400ecore_input_evas_cflags = @ecore_input_evas_cflags@
401ecore_input_evas_libs = @ecore_input_evas_libs@
402ecore_input_libs = @ecore_input_libs@
403ecore_ipc_cflags = @ecore_ipc_cflags@
404ecore_ipc_libs = @ecore_ipc_libs@
405ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
406ecore_psl1ght_libs = @ecore_psl1ght_libs@
407ecore_sdl_cflags = @ecore_sdl_cflags@
408ecore_sdl_libs = @ecore_sdl_libs@
409ecore_wayland_cflags = @ecore_wayland_cflags@
410ecore_wayland_libs = @ecore_wayland_libs@
411ecore_win32_cflags = @ecore_win32_cflags@
412ecore_win32_libs = @ecore_win32_libs@
413ecore_wince_cflags = @ecore_wince_cflags@
414ecore_wince_libs = @ecore_wince_libs@
415ecore_x_cflags = @ecore_x_cflags@
416ecore_x_libs = @ecore_x_libs@
417ecore_x_libs_private = @ecore_x_libs_private@
418efl_doxygen = @efl_doxygen@
419efl_have_doxygen = @efl_have_doxygen@
420exec_prefix = @exec_prefix@
421have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
422host = @host@
423host_alias = @host_alias@
424host_cpu = @host_cpu@
425host_os = @host_os@
426host_vendor = @host_vendor@
427htmldir = @htmldir@
428includedir = @includedir@
429infodir = @infodir@
430install_sh = @install_sh@
431libdir = @libdir@
432libexecdir = @libexecdir@
433localedir = @localedir@
434localstatedir = @localstatedir@
435lt_ECHO = @lt_ECHO@
436lt_enable_auto_import = @lt_enable_auto_import@
437mandir = @mandir@
438mkdir_p = @mkdir_p@
439oldincludedir = @oldincludedir@
440pdfdir = @pdfdir@
441pkgconfig_requires_private = @pkgconfig_requires_private@
442prefix = @prefix@
443program_transform_name = @program_transform_name@
444psdir = @psdir@
445release_info = @release_info@
446requirements_ecore = @requirements_ecore@
447requirements_ecore_cocoa = @requirements_ecore_cocoa@
448requirements_ecore_con = @requirements_ecore_con@
449requirements_ecore_directfb = @requirements_ecore_directfb@
450requirements_ecore_evas = @requirements_ecore_evas@
451requirements_ecore_fb = @requirements_ecore_fb@
452requirements_ecore_file = @requirements_ecore_file@
453requirements_ecore_imf = @requirements_ecore_imf@
454requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
455requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
456requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
457requirements_ecore_input = @requirements_ecore_input@
458requirements_ecore_input_evas = @requirements_ecore_input_evas@
459requirements_ecore_ipc = @requirements_ecore_ipc@
460requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
461requirements_ecore_sdl = @requirements_ecore_sdl@
462requirements_ecore_wayland = @requirements_ecore_wayland@
463requirements_ecore_win32 = @requirements_ecore_win32@
464requirements_ecore_wince = @requirements_ecore_wince@
465requirements_ecore_x = @requirements_ecore_x@
466rt_libs = @rt_libs@
467sbindir = @sbindir@
468sharedstatedir = @sharedstatedir@
469srcdir = @srcdir@
470sysconfdir = @sysconfdir@
471target_alias = @target_alias@
472top_build_prefix = @top_build_prefix@
473top_builddir = @top_builddir@
474top_srcdir = @top_srcdir@
475version_info = @version_info@
476x_cflags = @x_cflags@
477x_includes = @x_includes@
478x_libs = @x_libs@
479MAINTAINERCLEANFILES = Makefile.in
480AM_CPPFLAGS = \
481-I$(top_srcdir)/src/lib/ecore \
482-I$(top_srcdir)/src/lib/ecore_evas \
483-I$(top_srcdir)/src/lib/ecore_input \
484-I$(top_builddir)/src/lib/ecore \
485-I$(top_builddir)/src/lib/ecore_evas \
486-I$(top_builddir)/src/lib/ecore_input \
487@EFL_ECORE_PSL1GHT_BUILD@ \
488@EVAS_CFLAGS@ \
489@EINA_CFLAGS@
490
491lib_LTLIBRARIES = libecore_psl1ght.la
492includes_HEADERS = Ecore_Psl1ght.h
493includesdir = $(includedir)/ecore-@VMAJ@
494libecore_psl1ght_la_SOURCES = \
495ecore_psl1ght.c \
496moveutil.c \
497spursutil.c
498
499libecore_psl1ght_la_LIBADD = \
500$(top_builddir)/src/lib/ecore/libecore.la \
501$(top_builddir)/src/lib/ecore_input/libecore_input.la \
502@EINA_LIBS@
503
504libecore_psl1ght_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
505EXTRA_DIST = Ecore_Psl1ght_Keys.h ecore_psl1ght_private.h
506all: all-am
507
508.SUFFIXES:
509.SUFFIXES: .c .lo .o .obj
510$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
511 @for dep in $?; do \
512 case '$(am__configure_deps)' in \
513 *$$dep*) \
514 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
515 && { if test -f $@; then exit 0; else break; fi; }; \
516 exit 1;; \
517 esac; \
518 done; \
519 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_psl1ght/Makefile'; \
520 $(am__cd) $(top_srcdir) && \
521 $(AUTOMAKE) --gnu src/lib/ecore_psl1ght/Makefile
522.PRECIOUS: Makefile
523Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
524 @case '$?' in \
525 *config.status*) \
526 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
527 *) \
528 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
529 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
530 esac;
531
532$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
533 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
534
535$(top_srcdir)/configure: $(am__configure_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(ACLOCAL_M4): $(am__aclocal_m4_deps)
538 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
539$(am__aclocal_m4_deps):
540install-libLTLIBRARIES: $(lib_LTLIBRARIES)
541 @$(NORMAL_INSTALL)
542 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
543 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
544 list2=; for p in $$list; do \
545 if test -f $$p; then \
546 list2="$$list2 $$p"; \
547 else :; fi; \
548 done; \
549 test -z "$$list2" || { \
550 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
551 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
552 }
553
554uninstall-libLTLIBRARIES:
555 @$(NORMAL_UNINSTALL)
556 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
557 for p in $$list; do \
558 $(am__strip_dir) \
559 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
560 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
561 done
562
563clean-libLTLIBRARIES:
564 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
565 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
566 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
567 test "$$dir" != "$$p" || dir=.; \
568 echo "rm -f \"$${dir}/so_locations\""; \
569 rm -f "$${dir}/so_locations"; \
570 done
571libecore_psl1ght.la: $(libecore_psl1ght_la_OBJECTS) $(libecore_psl1ght_la_DEPENDENCIES)
572 $(AM_V_CCLD)$(libecore_psl1ght_la_LINK) -rpath $(libdir) $(libecore_psl1ght_la_OBJECTS) $(libecore_psl1ght_la_LIBADD) $(LIBS)
573
574mostlyclean-compile:
575 -rm -f *.$(OBJEXT)
576
577distclean-compile:
578 -rm -f *.tab.c
579
580@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_psl1ght.Plo@am__quote@
581@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moveutil.Plo@am__quote@
582@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spursutil.Plo@am__quote@
583
584.c.o:
585@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
586@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
587@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
588@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
589@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
590@am__fastdepCC_FALSE@ $(COMPILE) -c $<
591
592.c.obj:
593@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
594@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
595@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
596@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
597@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
598@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
599
600.c.lo:
601@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
602@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
603@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
604@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
605@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
606@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
607
608mostlyclean-libtool:
609 -rm -f *.lo
610
611clean-libtool:
612 -rm -rf .libs _libs
613install-includesHEADERS: $(includes_HEADERS)
614 @$(NORMAL_INSTALL)
615 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
616 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
617 for p in $$list; do \
618 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
619 echo "$$d$$p"; \
620 done | $(am__base_list) | \
621 while read files; do \
622 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
623 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
624 done
625
626uninstall-includesHEADERS:
627 @$(NORMAL_UNINSTALL)
628 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
629 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
630 test -n "$$files" || exit 0; \
631 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
632 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
633
634ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
635 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
636 unique=`for i in $$list; do \
637 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
638 done | \
639 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
640 END { if (nonempty) { for (i in files) print i; }; }'`; \
641 mkid -fID $$unique
642tags: TAGS
643
644TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
645 $(TAGS_FILES) $(LISP)
646 set x; \
647 here=`pwd`; \
648 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
649 unique=`for i in $$list; do \
650 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
651 done | \
652 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
653 END { if (nonempty) { for (i in files) print i; }; }'`; \
654 shift; \
655 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
656 test -n "$$unique" || unique=$$empty_fix; \
657 if test $$# -gt 0; then \
658 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
659 "$$@" $$unique; \
660 else \
661 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
662 $$unique; \
663 fi; \
664 fi
665ctags: CTAGS
666CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
667 $(TAGS_FILES) $(LISP)
668 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
669 unique=`for i in $$list; do \
670 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
671 done | \
672 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
673 END { if (nonempty) { for (i in files) print i; }; }'`; \
674 test -z "$(CTAGS_ARGS)$$unique" \
675 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
676 $$unique
677
678GTAGS:
679 here=`$(am__cd) $(top_builddir) && pwd` \
680 && $(am__cd) $(top_srcdir) \
681 && gtags -i $(GTAGS_ARGS) "$$here"
682
683distclean-tags:
684 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
685
686distdir: $(DISTFILES)
687 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
688 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
689 list='$(DISTFILES)'; \
690 dist_files=`for file in $$list; do echo $$file; done | \
691 sed -e "s|^$$srcdirstrip/||;t" \
692 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
693 case $$dist_files in \
694 */*) $(MKDIR_P) `echo "$$dist_files" | \
695 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
696 sort -u` ;; \
697 esac; \
698 for file in $$dist_files; do \
699 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
700 if test -d $$d/$$file; then \
701 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
702 if test -d "$(distdir)/$$file"; then \
703 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
704 fi; \
705 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
706 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
707 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
708 fi; \
709 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
710 else \
711 test -f "$(distdir)/$$file" \
712 || cp -p $$d/$$file "$(distdir)/$$file" \
713 || exit 1; \
714 fi; \
715 done
716check-am: all-am
717check: check-am
718all-am: Makefile $(LTLIBRARIES) $(HEADERS)
719installdirs:
720 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
721 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
722 done
723install: install-am
724install-exec: install-exec-am
725install-data: install-data-am
726uninstall: uninstall-am
727
728install-am: all-am
729 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
730
731installcheck: installcheck-am
732install-strip:
733 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
734 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
735 `test -z '$(STRIP)' || \
736 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
737mostlyclean-generic:
738
739clean-generic:
740
741distclean-generic:
742 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
743 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
744
745maintainer-clean-generic:
746 @echo "This command is intended for maintainers to use"
747 @echo "it deletes files that may require special tools to rebuild."
748 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
749clean: clean-am
750
751clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
752 mostlyclean-am
753
754distclean: distclean-am
755 -rm -rf ./$(DEPDIR)
756 -rm -f Makefile
757distclean-am: clean-am distclean-compile distclean-generic \
758 distclean-tags
759
760dvi: dvi-am
761
762dvi-am:
763
764html: html-am
765
766html-am:
767
768info: info-am
769
770info-am:
771
772install-data-am: install-includesHEADERS
773
774install-dvi: install-dvi-am
775
776install-dvi-am:
777
778install-exec-am: install-libLTLIBRARIES
779
780install-html: install-html-am
781
782install-html-am:
783
784install-info: install-info-am
785
786install-info-am:
787
788install-man:
789
790install-pdf: install-pdf-am
791
792install-pdf-am:
793
794install-ps: install-ps-am
795
796install-ps-am:
797
798installcheck-am:
799
800maintainer-clean: maintainer-clean-am
801 -rm -rf ./$(DEPDIR)
802 -rm -f Makefile
803maintainer-clean-am: distclean-am maintainer-clean-generic
804
805mostlyclean: mostlyclean-am
806
807mostlyclean-am: mostlyclean-compile mostlyclean-generic \
808 mostlyclean-libtool
809
810pdf: pdf-am
811
812pdf-am:
813
814ps: ps-am
815
816ps-am:
817
818uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
819
820.MAKE: install-am install-strip
821
822.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
823 clean-libLTLIBRARIES clean-libtool ctags distclean \
824 distclean-compile distclean-generic distclean-libtool \
825 distclean-tags distdir dvi dvi-am html html-am info info-am \
826 install install-am install-data install-data-am install-dvi \
827 install-dvi-am install-exec install-exec-am install-html \
828 install-html-am install-includesHEADERS install-info \
829 install-info-am install-libLTLIBRARIES install-man install-pdf \
830 install-pdf-am install-ps install-ps-am install-strip \
831 installcheck installcheck-am installdirs maintainer-clean \
832 maintainer-clean-generic mostlyclean mostlyclean-compile \
833 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
834 tags uninstall uninstall-am uninstall-includesHEADERS \
835 uninstall-libLTLIBRARIES
836
837
838# Tell versions [3.59,3.63) of GNU make to not export all variables.
839# Otherwise a system limit (for SysV at least) may be exceeded.
840.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c
deleted file mode 100644
index 16487ad..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c
+++ /dev/null
@@ -1,859 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <sysutil/video.h>
6#include <sysutil/sysutil.h>
7#include <sysmodule/sysmodule.h>
8#include <io/pad.h>
9#include <io/mouse.h>
10#include <io/kb.h>
11#include <io/camera.h>
12#include <io/move.h>
13#include <sys/process.h>
14
15#include "moveutil.h"
16
17#include "Eina.h"
18#include "Ecore_Psl1ght.h"
19#include "Ecore_Input.h"
20#include "Ecore.h"
21#include "ecore_psl1ght_private.h"
22#include "ecore_private.h"
23#include "Ecore_Psl1ght_Keys.h"
24
25/* Allocate 1MB stack to avoid overflows */
26SYS_PROCESS_PARAM(1001, 0x100000);
27
28int _ecore_psl1ght_log_dom = -1;
29
30EAPI int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
31EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0;
32EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
33EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0;
34EAPI int ECORE_PSL1GHT_EVENT_QUIT = 0;
35
36static int _ecore_psl1ght_init_count = 0;
37static int window_width = 0;
38static int window_height = 0;
39/* Mouse support */
40static int mouse_connected = FALSE;
41static u8 mouse_buttons = 0;
42static int mouse_x = 0;
43static int mouse_y = 0;
44/* Keyboard support */
45static int keyboard_connected = FALSE;
46static KbLed keyboard_leds = {{0}};
47static KbMkey keyboard_mods = {{0}};
48static u16 keyboard_old_key = 0;
49/* Pad support */
50static padData pad_data;
51static padData old_pad_data = {0};
52static int pad_old_x = 0;
53static int pad_old_o = 0;
54/* Move support */
55static int move_connected = FALSE;
56static moveContext *move_context = NULL;
57u16 move_buttons = 0;
58
59static void xmb_event_handler(u64 status, u64 param, void *user_data);
60
61/**
62 * @defgroup Ecore_Psl1ght_Library_Group PSL1GHT Library Functions
63 *
64 * Functions used to set up and shut down the Ecore_Psl1ght functions.
65 */
66
67/**
68 * Sets up the Ecore_Psl1ght library.
69 * @param name device target name
70 * @return @c 0 on failure. Otherwise, the number of times the library has
71 * been initialised without being shut down.
72 * @ingroup Ecore_PSL1GHT_Library_Group
73 */
74EAPI int
75ecore_psl1ght_init(const char *name __UNUSED__)
76{
77 videoState state;
78 videoResolution resolution;
79 int ret, camera_loaded, gem_loaded;
80
81 if (++_ecore_psl1ght_init_count != 1)
82 return _ecore_psl1ght_init_count;
83 _ecore_psl1ght_log_dom = eina_log_domain_register
84 ("ecore_psl1ght", ECORE_PSL1GHT_DEFAULT_LOG_COLOR);
85 if (_ecore_psl1ght_log_dom < 0)
86 {
87 EINA_LOG_ERR("Impossible to create a log domain for the Ecore PSL1GHT module.");
88 return --_ecore_psl1ght_init_count;
89 }
90 if (!ecore_event_init())
91 {
92 eina_log_domain_unregister(_ecore_psl1ght_log_dom);
93 _ecore_psl1ght_log_dom = -1;
94 return --_ecore_psl1ght_init_count;
95 }
96
97 if (videoGetState (0, 0, &state) == 0 &&
98 videoGetResolution (state.displayMode.resolution, &resolution) == 0)
99 {
100 ecore_psl1ght_resolution_set (resolution.width, resolution.height);
101 }
102 else
103 {
104 ecore_event_shutdown();
105 eina_log_domain_unregister(_ecore_psl1ght_log_dom);
106 _ecore_psl1ght_log_dom = -1;
107 return --_ecore_psl1ght_init_count;
108 }
109
110 /* Pad support */
111 ioPadInit (7);
112 /* Mouse support */
113 ioMouseInit(2);
114 mouse_buttons = 0;
115 mouse_x = 0;
116 mouse_y = 0;
117
118 /* Keyboard support */
119 ioKbInit(2);
120 keyboard_leds._KbLedU.leds = 0;
121 keyboard_mods._KbMkeyU.mkeys = 0;
122
123 /* Initialize Move */
124 move_context = NULL;
125 move_buttons = 0;
126
127 camera_loaded = !sysModuleIsLoaded (SYSMODULE_CAMERA);
128 if (!camera_loaded)
129 ret = sysModuleLoad (SYSMODULE_CAMERA);
130 else
131 ret = 0;
132 if (ret == 0)
133 {
134 gem_loaded = !sysModuleIsLoaded (SYSMODULE_GEM);
135 if (!gem_loaded)
136 ret = sysModuleLoad (SYSMODULE_GEM);
137 if (ret == 0)
138 {
139 move_context = initMove ();
140 }
141 else {
142 if (gem_loaded)
143 sysModuleUnload (SYSMODULE_CAMERA);
144 }
145 }
146
147 sysUtilRegisterCallback (SYSUTIL_EVENT_SLOT0, xmb_event_handler, NULL);
148
149 ECORE_PSL1GHT_EVENT_GOT_FOCUS = ecore_event_type_new();
150 ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new();
151 ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new();
152 ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new();
153 ECORE_PSL1GHT_EVENT_QUIT = ecore_event_type_new();
154
155 mouse_x = 0;
156 mouse_y = 0;
157
158 return _ecore_psl1ght_init_count;
159}
160
161/**
162 * Shuts down the Ecore_Psl1ght library.
163 * @return @c The number of times the system has been initialised without
164 * being shut down.
165 * @ingroup Ecore_PSL1GHT_Library_Group
166 */
167EAPI int
168ecore_psl1ght_shutdown(void)
169{
170 if (--_ecore_psl1ght_init_count != 0)
171 return _ecore_psl1ght_init_count;
172
173 ecore_event_shutdown();
174 eina_log_domain_unregister(_ecore_psl1ght_log_dom);
175 _ecore_psl1ght_log_dom = -1;
176
177 ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0;
178 ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
179 ECORE_PSL1GHT_EVENT_EXPOSE = 0;
180 ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
181 ECORE_PSL1GHT_EVENT_QUIT = 0;
182
183 ioPadEnd();
184 ioMouseEnd();
185 ioKbEnd();
186
187 if (move_context)
188 {
189 endMove (move_context);
190 move_context = NULL;
191 sysModuleUnload (SYSMODULE_CAMERA);
192 sysModuleUnload (SYSMODULE_GEM);
193 }
194
195 sysUtilUnregisterCallback(SYSUTIL_EVENT_SLOT0);
196
197 return _ecore_psl1ght_init_count;
198}
199
200static unsigned int
201_ecore_psl1ght_get_time(void)
202{
203 return (unsigned int)((unsigned long long)
204 (ecore_time_get() * 1000.0) & 0xffffffff);
205}
206
207static unsigned int
208_ecore_psl1ght_get_modifiers(void)
209{
210 unsigned int modifiers = 0;
211
212 if (keyboard_mods._KbMkeyU._KbMkeyS.r_shift ||
213 keyboard_mods._KbMkeyU._KbMkeyS.l_shift)
214 modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
215 if (keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl ||
216 keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl)
217 modifiers |= ECORE_EVENT_MODIFIER_CTRL;
218 if (keyboard_mods._KbMkeyU._KbMkeyS.r_alt ||
219 keyboard_mods._KbMkeyU._KbMkeyS.l_alt)
220 modifiers |= ECORE_EVENT_MODIFIER_ALT;
221 if (keyboard_mods._KbMkeyU._KbMkeyS.r_win ||
222 keyboard_mods._KbMkeyU._KbMkeyS.l_win)
223 modifiers |= ECORE_EVENT_MODIFIER_WIN;
224
225 if (keyboard_leds._KbLedU._KbLedS.num_lock)
226 modifiers |= ECORE_EVENT_LOCK_NUM;
227 if (keyboard_leds._KbLedU._KbLedS.caps_lock)
228 modifiers |= ECORE_EVENT_LOCK_CAPS;
229 if (keyboard_leds._KbLedU._KbLedS.scroll_lock)
230 modifiers |= ECORE_EVENT_LOCK_SCROLL;
231
232 return modifiers;
233}
234
235static void
236_ecore_psl1ght_key_modifiers(KbMkey *mods, KbLed *leds)
237{
238 Ecore_Psl1ght_Event_Key_Modifiers *ev;
239 Eina_Bool emit = EINA_FALSE;
240
241 ev = malloc(sizeof(Ecore_Psl1ght_Event_Key_Modifiers));
242 if (!ev) return;
243
244 if (mods->_KbMkeyU._KbMkeyS.l_shift !=
245 keyboard_mods._KbMkeyU._KbMkeyS.l_shift ||
246 mods->_KbMkeyU._KbMkeyS.r_shift !=
247 keyboard_mods._KbMkeyU._KbMkeyS.r_shift)
248 {
249 emit = EINA_TRUE;
250 ev->shift_changed = EINA_TRUE;
251 ev->shift = mods->_KbMkeyU._KbMkeyS.r_shift |
252 mods->_KbMkeyU._KbMkeyS.l_shift;
253 }
254 if (mods->_KbMkeyU._KbMkeyS.l_ctrl !=
255 keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl ||
256 mods->_KbMkeyU._KbMkeyS.r_ctrl !=
257 keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl)
258 {
259 emit = EINA_TRUE;
260 ev->ctrl_changed = EINA_TRUE;
261 ev->ctrl = mods->_KbMkeyU._KbMkeyS.r_ctrl |
262 mods->_KbMkeyU._KbMkeyS.l_ctrl;
263 }
264 if (mods->_KbMkeyU._KbMkeyS.l_alt !=
265 keyboard_mods._KbMkeyU._KbMkeyS.l_alt ||
266 mods->_KbMkeyU._KbMkeyS.r_alt !=
267 keyboard_mods._KbMkeyU._KbMkeyS.r_alt)
268 {
269 emit = EINA_TRUE;
270 ev->alt_changed = EINA_TRUE;
271 ev->alt = mods->_KbMkeyU._KbMkeyS.r_alt |
272 mods->_KbMkeyU._KbMkeyS.l_alt;
273 }
274 if (mods->_KbMkeyU._KbMkeyS.l_win !=
275 keyboard_mods._KbMkeyU._KbMkeyS.l_win ||
276 mods->_KbMkeyU._KbMkeyS.r_win !=
277 keyboard_mods._KbMkeyU._KbMkeyS.r_win)
278 {
279 emit = EINA_TRUE;
280 ev->win_changed = EINA_TRUE;
281 ev->win = mods->_KbMkeyU._KbMkeyS.r_win |
282 mods->_KbMkeyU._KbMkeyS.l_win;
283 }
284 keyboard_mods = *mods;
285
286 if (leds->_KbLedU._KbLedS.num_lock !=
287 keyboard_leds._KbLedU._KbLedS.num_lock)
288 {
289 emit = EINA_TRUE;
290 ev->num_lock_changed = EINA_TRUE;
291 ev->num_lock = leds->_KbLedU._KbLedS.num_lock;
292 }
293 if (leds->_KbLedU._KbLedS.caps_lock !=
294 keyboard_leds._KbLedU._KbLedS.caps_lock)
295 {
296 emit = EINA_TRUE;
297 ev->caps_lock_changed = EINA_TRUE;
298 ev->caps_lock = leds->_KbLedU._KbLedS.caps_lock;
299 }
300 if (leds->_KbLedU._KbLedS.scroll_lock !=
301 keyboard_leds._KbLedU._KbLedS.scroll_lock)
302 {
303 emit = EINA_TRUE;
304 ev->scroll_lock_changed = EINA_TRUE;
305 ev->scroll_lock = leds->_KbLedU._KbLedS.scroll_lock;
306 }
307 keyboard_leds = *leds;
308
309 if (emit)
310 {
311 ev->timestamp = _ecore_psl1ght_get_time ();
312 ev->modifiers = _ecore_psl1ght_get_modifiers();
313 ecore_event_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, ev, NULL, NULL);
314 }
315 else
316 {
317 free(ev);
318 }
319}
320
321static void
322unicodeToUtf8(u16 w, char *utf8buf)
323{
324 unsigned char *utf8s = (unsigned char *)utf8buf;
325
326 if ( w < 0x0080 )
327 {
328 utf8s[0] = ( unsigned char )w;
329 utf8s[1] = 0;
330 }
331 else if ( w < 0x0800 )
332 {
333 utf8s[0] = 0xc0 | ((w) >> 6);
334 utf8s[1] = 0x80 | ((w) & 0x3f);
335 utf8s[2] = 0;
336 }
337 else {
338 utf8s[0] = 0xe0 | ((w) >> 12);
339 utf8s[1] = 0x80 | (((w) >> 6) & 0x3f);
340 utf8s[2] = 0x80 | ((w) & 0x3f);
341 utf8s[3] = 0;
342 }
343}
344
345static Ecore_Event_Key *
346_ecore_psl1ght_event_key(u16 key)
347{
348 Ecore_Event_Key *ev;
349 char utf8[4];
350 u16 utf16;
351 unsigned int i;
352
353 ev = malloc(sizeof(Ecore_Event_Key));
354 if (!ev) return NULL;
355
356 ev->timestamp = _ecore_psl1ght_get_time ();
357 ev->window = 0;
358 ev->event_window = 0;
359 ev->modifiers = _ecore_psl1ght_get_modifiers();
360
361 key &= ~KB_KEYPAD;
362 for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i)
363 if (keystable[i].code == key)
364 {
365 ev->keyname = keystable[i].name;
366 ev->key = keystable[i].name;
367 ev->string = keystable[i].compose;
368 ev->compose = keystable[i].compose;
369
370 return ev;
371 }
372
373 utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key);
374 unicodeToUtf8(utf16, utf8);
375 ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8);
376
377 return ev;
378}
379
380static void
381_ecore_psl1ght_mouse_move(s32 x_axis, s32 y_axis)
382{
383 Ecore_Event_Mouse_Move *ev;
384
385 ev = malloc(sizeof(Ecore_Event_Mouse_Move));
386 if (!ev) return;
387
388 mouse_x += x_axis;
389 mouse_y += y_axis;
390 if (mouse_x < 0) mouse_x = 0;
391 if (mouse_y < 0) mouse_y = 0;
392 if (mouse_x > window_width) mouse_x = window_width;
393 if (mouse_y > window_height) mouse_y = window_height;
394
395 ev->window = 0;
396 ev->root_window = 0;
397 ev->event_window = 0;
398 ev->same_screen = 0;
399 ev->timestamp = _ecore_psl1ght_get_time ();
400 ev->modifiers = _ecore_psl1ght_get_modifiers ();
401 ev->x = ev->root.x = mouse_x;
402 ev->y = ev->root.x = mouse_y;
403
404 ev->multi.device = 0;
405 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
406 ev->multi.pressure = ev->multi.angle = 0;
407 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
408
409 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
410}
411
412static void
413_ecore_psl1ght_mouse_button(int button, int pressed)
414{
415 Ecore_Event_Mouse_Button *ev;
416 static unsigned int previous_timestamp = 0;
417
418 ev = malloc(sizeof(Ecore_Event_Mouse_Button));
419 if (!ev) return;
420
421 ev->window = 0;
422 ev->root_window = 0;
423 ev->event_window = 0;
424 ev->same_screen = 0;
425 ev->timestamp = _ecore_psl1ght_get_time ();
426 ev->modifiers = _ecore_psl1ght_get_modifiers ();
427 ev->buttons = button;
428 if (ev->timestamp - previous_timestamp <= 500)
429 ev->double_click = 1;
430 ev->triple_click = 0;
431 previous_timestamp = ev->timestamp;
432
433 ev->x = ev->root.x = mouse_x;
434 ev->y = ev->root.y = mouse_y;
435 ev->multi.device = 0;
436 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
437 ev->multi.pressure = ev->multi.angle = 0;
438 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
439
440 if (pressed)
441 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
442 else
443 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
444}
445
446static void
447_ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt)
448{
449 Ecore_Event_Mouse_Wheel *ev;
450
451 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
452 if (!ev) return;
453
454 ev->timestamp = _ecore_psl1ght_get_time ();
455 ev->window = 0;
456 ev->event_window = 0;
457 ev->modifiers = _ecore_psl1ght_get_modifiers ();
458 ev->direction = 0;
459 ev->z = wheel;
460
461 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
462}
463
464static void
465_ecore_psl1ght_pad_button (const char *name, int pressed)
466{
467 Ecore_Event_Key *ev = NULL;
468
469 ev = malloc(sizeof(Ecore_Event_Key));
470 if (!ev) return;
471
472 ev->timestamp = _ecore_psl1ght_get_time ();
473 ev->window = 0;
474 ev->event_window = 0;
475 ev->modifiers = 0;
476
477 ev->keyname = name;
478 ev->key = name;
479 ev->string = "";
480 ev->compose = "";
481
482 if (pressed)
483 ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
484 else
485 ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
486}
487
488#define PAD_STICK_DEADZONE 0x20
489
490static void
491_ecore_psl1ght_poll_joypad(void)
492{
493 padInfo padinfo;
494 int i;
495
496 /**/
497 /* Check mouse events */
498 ioPadGetInfo (&padinfo);
499
500 for (i = 0; i < 4; i++) /* Ignore the move */
501 {
502 if (padinfo.status[i])
503 {
504 int analog_h, analog_v;
505
506 if (ioPadGetData (i, &pad_data) != 0)
507 continue;
508 analog_h = pad_data.ANA_L_H - 0x80;
509 analog_v = pad_data.ANA_L_V - 0x80;
510
511 if (analog_h > PAD_STICK_DEADZONE)
512 analog_h -= PAD_STICK_DEADZONE;
513 else if (analog_h < -PAD_STICK_DEADZONE)
514 analog_h += PAD_STICK_DEADZONE;
515 else
516 analog_h = 0;
517 analog_h /= 10;
518
519 if (analog_v > PAD_STICK_DEADZONE)
520 analog_v -= PAD_STICK_DEADZONE;
521 else if (analog_v < -PAD_STICK_DEADZONE)
522 analog_v += PAD_STICK_DEADZONE;
523 else
524 analog_v = 0;
525 analog_v /= 10;
526
527 if (analog_h != 0 || analog_v != 0)
528 _ecore_psl1ght_mouse_move (analog_h, analog_v);
529
530 if (old_pad_data.BTN_CROSS ^ pad_data.BTN_CROSS) {
531 _ecore_psl1ght_pad_button ("Cross", pad_data.BTN_CROSS);
532 _ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS);
533 }
534 if (old_pad_data.BTN_CIRCLE ^ pad_data.BTN_CIRCLE) {
535 _ecore_psl1ght_pad_button ("Circle", pad_data.BTN_CIRCLE);
536 _ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE);
537 }
538 if (old_pad_data.BTN_SQUARE ^ pad_data.BTN_SQUARE)
539 _ecore_psl1ght_pad_button ("Square", pad_data.BTN_SQUARE);
540 if (old_pad_data.BTN_TRIANGLE ^ pad_data.BTN_TRIANGLE)
541 _ecore_psl1ght_pad_button ("Triangle", pad_data.BTN_TRIANGLE);
542 if (old_pad_data.BTN_UP ^ pad_data.BTN_UP)
543 _ecore_psl1ght_pad_button ("Up", pad_data.BTN_UP);
544 if (old_pad_data.BTN_DOWN ^ pad_data.BTN_DOWN)
545 _ecore_psl1ght_pad_button ("Down", pad_data.BTN_DOWN);
546 if (old_pad_data.BTN_LEFT ^ pad_data.BTN_LEFT)
547 _ecore_psl1ght_pad_button ("Left", pad_data.BTN_LEFT);
548 if (old_pad_data.BTN_RIGHT ^ pad_data.BTN_RIGHT)
549 _ecore_psl1ght_pad_button ("Right", pad_data.BTN_RIGHT);
550 if (old_pad_data.BTN_L1 ^ pad_data.BTN_L1)
551 _ecore_psl1ght_pad_button ("L1", pad_data.BTN_L1);
552 if (old_pad_data.BTN_L2 ^ pad_data.BTN_L2)
553 _ecore_psl1ght_pad_button ("L2", pad_data.BTN_L2);
554 if (old_pad_data.BTN_L3 ^ pad_data.BTN_L3)
555 _ecore_psl1ght_pad_button ("L3", pad_data.BTN_L3);
556 if (old_pad_data.BTN_R1 ^ pad_data.BTN_R1)
557 _ecore_psl1ght_pad_button ("R1", pad_data.BTN_R1);
558 if (old_pad_data.BTN_R2 ^ pad_data.BTN_R2)
559 _ecore_psl1ght_pad_button ("R2", pad_data.BTN_R2);
560 if (old_pad_data.BTN_R3 ^ pad_data.BTN_R3)
561 _ecore_psl1ght_pad_button ("R3", pad_data.BTN_R3);
562 if (old_pad_data.BTN_START ^ pad_data.BTN_START)
563 _ecore_psl1ght_pad_button ("Start", pad_data.BTN_START);
564 if (old_pad_data.BTN_SELECT ^ pad_data.BTN_SELECT)
565 _ecore_psl1ght_pad_button ("Select", pad_data.BTN_SELECT);
566
567 old_pad_data = pad_data;
568 }
569 }
570}
571
572static void
573_ecore_psl1ght_poll_mouse(void)
574{
575 mouseInfo mouseinfo;
576 u32 i;
577
578 /**/
579 /* Check mouse events */
580 ioMouseGetInfo(&mouseinfo);
581
582 if (mouseinfo.status[0] == 1 && !mouse_connected) // Connected
583 {
584 mouse_connected = TRUE;
585 mouse_buttons = 0;
586
587 // Old events in the queue are discarded
588 ioMouseClearBuf(0);
589 }
590 else if (mouseinfo.status[0] != 1 && mouse_connected) // Disconnected
591 {
592 mouse_connected = FALSE;
593 mouse_buttons = 0;
594 }
595
596 if (mouse_connected)
597 {
598 mouseDataList datalist;
599
600 ioMouseGetDataList(0, &datalist);
601
602 for (i = 0; i < datalist.count; i++)
603 {
604 u8 old_left = mouse_buttons & 1;
605 u8 new_left = datalist.list[i].buttons & 1;
606 u8 old_right = mouse_buttons & 2;
607 u8 new_right = datalist.list[i].buttons & 2;
608 u8 old_middle = mouse_buttons & 4;
609 u8 new_middle = datalist.list[i].buttons & 4;
610
611 if (datalist.list[i].x_axis != 0 ||
612 datalist.list[i].y_axis != 0)
613 _ecore_psl1ght_mouse_move (datalist.list[i].x_axis,
614 datalist.list[i].y_axis);
615
616 if (old_left != new_left)
617 _ecore_psl1ght_mouse_button (1, new_left);
618 if (old_middle != new_middle)
619 _ecore_psl1ght_mouse_button (2, new_middle);
620 if (old_right != new_right)
621 _ecore_psl1ght_mouse_button (3, new_right);
622
623 if (datalist.list[i].wheel != 0)
624 _ecore_psl1ght_mouse_wheel (datalist.list[i].wheel,
625 datalist.list[i].tilt);
626
627 mouse_buttons = datalist.list[i].buttons;
628 }
629 }
630}
631
632static void
633_ecore_psl1ght_poll_move(void)
634{
635 int i;
636 u16 new_buttons;
637 static int t_pressed = 0;
638 static int calibrated = 0;
639 static float prev_x = 0;
640 static float prev_y = 0;
641 static int gyro = 0;
642 float x, y, z;
643
644 /* Check move events */
645 processMove (move_context);
646 new_buttons = move_context->state.paddata.buttons & (~move_buttons);
647 move_buttons = move_context->state.paddata.buttons;
648
649 moveGet3DPosition (move_context, &x, &y, &z);
650 //printf ("Move 3D position is : %f, %f, %f\n", x,y,z);
651
652 switch (new_buttons) {
653 case 1:
654 gyro = !gyro;
655 break;
656
657 case 4:
658 // Move button
659 //printf ("Calibrating\n");
660 gemCalibrate (0);
661 calibrated = 1;
662 break;
663
664 case 8:
665 // start button
666 _ecore_psl1ght_mouse_move ((window_width / 2) - mouse_x, (window_height / 2) - mouse_y);
667 break;
668 }
669
670 if (calibrated)
671 {
672 float x_axis, y_axis;
673
674 if (gyro)
675 {
676 gemInertialState gem_inert;
677
678 gemGetInertialState (0, 0, 0, &gem_inert);
679 x_axis = -vec_array (gem_inert.gyro, 1) * 25;
680 y_axis = -vec_array (gem_inert.gyro, 0) * 25;
681 if (abs (x_axis) > 2 || abs (y_axis) > 2)
682 _ecore_psl1ght_mouse_move (x_axis, y_axis);
683 }
684 else {
685 x_axis = (x - prev_x) * 2.5;
686 y_axis = -(y - prev_y) * 2.5;
687 prev_x = x;
688 prev_y = y;
689 _ecore_psl1ght_mouse_move (x_axis, y_axis);
690 }
691
692 if (!t_pressed && (move_buttons & 0x2))
693 _ecore_psl1ght_mouse_button (1, 1);
694 else if (t_pressed && (move_buttons & 0x2) == 0)
695 _ecore_psl1ght_mouse_button (1, 0);
696 t_pressed = move_buttons & 0x2;
697 }
698}
699
700static void
701_ecore_psl1ght_poll_keyboard(void)
702{
703 KbInfo kbInfo;
704 int i;
705
706 /* Check keyboard events */
707 ioKbGetInfo(&kbInfo);
708
709 if (kbInfo.status[0] == 1 && !keyboard_connected)
710 {
711 /* Connected */
712 keyboard_connected = true;
713
714 // Old events in the queue are discarded
715 ioKbClearBuf(0);
716 keyboard_leds._KbLedU.leds = 0;
717 keyboard_mods._KbMkeyU.mkeys = 0;
718 keyboard_old_key = 0;
719
720 // Set raw keyboard code types to get scan codes
721 ioKbSetCodeType(0, KB_CODETYPE_RAW);
722 ioKbSetReadMode(0, KB_RMODE_INPUTCHAR);
723 }
724 else if (kbInfo.status[0] != 1 && keyboard_connected)
725 {
726 /* Disconnected keyboard */
727 keyboard_connected = FALSE;
728 }
729
730 if (keyboard_connected)
731 {
732 KbData Keys;
733
734 // Read data from the keyboard buffer
735 if (ioKbRead(0, &Keys) == 0 && Keys.nb_keycode > 0)
736 {
737 Ecore_Event_Key *ev = NULL;
738
739 _ecore_psl1ght_key_modifiers (&Keys.mkey, &Keys.led);
740
741 if (Keys.nb_keycode == 0 && keyboard_old_key != 0)
742 {
743 ev = _ecore_psl1ght_event_key (keyboard_old_key);
744 if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
745 }
746 for (i = 0; i < Keys.nb_keycode; i++)
747 {
748 if (Keys.keycode[i] != keyboard_old_key)
749 {
750 if (Keys.keycode[i] != 0)
751 {
752 ev = _ecore_psl1ght_event_key (Keys.keycode[i]);
753 if (ev)
754 ecore_event_add(ECORE_EVENT_KEY_DOWN, ev,
755 NULL, NULL);
756 }
757 else
758 {
759 ev = _ecore_psl1ght_event_key (keyboard_old_key);
760 if (ev)
761 ecore_event_add(ECORE_EVENT_KEY_UP, ev,
762 NULL, NULL);
763 }
764 keyboard_old_key = Keys.keycode[0];
765 }
766 }
767 }
768 }
769}
770
771static void
772xmb_event_handler(u64 status, u64 param, void *user_data)
773{
774 //printf ("Received event %lX\n", status);
775 switch (status) {
776 case SYSUTIL_EXIT_GAME:
777 ecore_event_add(ECORE_PSL1GHT_EVENT_QUIT, NULL, NULL, NULL);
778 break;
779 case SYSUTIL_DRAW_BEGIN:
780 ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
781 case SYSUTIL_MENU_OPEN:
782 ecore_event_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, NULL, NULL, NULL);
783 break;
784 case SYSUTIL_DRAW_END:
785 ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
786 case SYSUTIL_MENU_CLOSE:
787 ecore_event_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, NULL, NULL, NULL);
788 break;
789 default:
790 break;
791 }
792}
793
794EAPI void
795ecore_psl1ght_poll_events(void)
796{
797 _ecore_psl1ght_poll_joypad ();
798 _ecore_psl1ght_poll_mouse ();
799 if (move_context)
800 _ecore_psl1ght_poll_move ();
801 _ecore_psl1ght_poll_keyboard ();
802
803 sysUtilCheckCallback ();
804}
805
806EAPI void
807ecore_psl1ght_resolution_set(int width, int height)
808{
809 window_width = width;
810 window_height = height;
811 if (mouse_x > window_width) mouse_x = window_width;
812 if (mouse_y > window_height) mouse_y = window_height;
813}
814
815EAPI void
816ecore_psl1ght_screen_resolution_get(int *w, int *h)
817{
818 videoState state;
819 videoResolution resolution;
820
821 /* Get the state of the display */
822 if (videoGetState (0, 0, &state) == 0 &&
823 videoGetResolution (state.displayMode.resolution, &resolution) == 0)
824 {
825 if (w) *w = resolution.width;
826 if (h) *h = resolution.height;
827 }
828 else {
829 if (w) *w = 0;
830 if (h) *h = 0;
831 }
832}
833
834EAPI void
835ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h)
836{
837 videoDeviceInfo info;
838 videoResolution res;
839 int area = 720 * 480;
840 int mode_area;
841 int i;
842
843 if (w) *w = 720;
844 if (h) *h = 480;
845
846 videoGetDeviceInfo(0, 0, &info);
847
848 for (i = 0; i < info.availableModeCount; i++) {
849 videoGetResolution (info.availableModes[i].resolution, &res);
850 mode_area = res.width * res.height;
851 if (mode_area > area)
852 {
853 area = mode_area;
854 if (w) *w = res.width;
855 if (h) *h = res.height;
856 }
857 }
858}
859
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h
deleted file mode 100644
index bd5a86e..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ECORE_PSL1GHT_PRIVATE_H
2# define _ECORE_PSL1GHT_PRIVATE_H
3
4extern int _ecore_psl1ght_log_dom;
5
6# ifdef ECORE_PSL1GHT_DEFAULT_LOG_COLOR
7# undef ECORE_PSL1GHT_DEFAULT_LOG_COLOR
8# endif
9# define ECORE_PSL1GHT_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
10
11# ifdef ERR
12# undef ERR
13# endif
14# define ERR(...) EINA_LOG_DOM_ERR(_ecore_psl1ght_log_dom, __VA_ARGS__)
15
16# ifdef DBG
17# undef DBG
18# endif
19# define DBG(...) EINA_LOG_DOM_DBG(_ecore_psl1ght_log_dom, __VA_ARGS__)
20
21# ifdef INF
22# undef INF
23# endif
24# define INF(...) EINA_LOG_DOM_INFO(_ecore_psl1ght_log_dom, __VA_ARGS__)
25
26# ifdef WRN
27# undef WRN
28# endif
29# define WRN(...) EINA_LOG_DOM_WARN(_ecore_psl1ght_log_dom, __VA_ARGS__)
30
31# ifdef CRIT
32# undef CRIT
33# endif
34# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_psl1ght_log_dom, __VA_ARGS__)
35
36#endif
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/moveutil.c b/libraries/ecore/src/lib/ecore_psl1ght/moveutil.c
deleted file mode 100644
index 1dadfbc..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/moveutil.c
+++ /dev/null
@@ -1,245 +0,0 @@
1#include <stdio.h>
2#include <io/move.h>
3#include <sys/memory.h>
4#include <ppu-types.h>
5#include <io/camera.h>
6#include <ppu-types.h>
7#include <spurs/spurs.h>
8#include <sys/thread.h>
9#include <sys/systime.h>
10
11#include "spursutil.h"
12#include "moveutil.h"
13
14u16 oldGemPad = 0;
15u16 newGemPad = 0;
16u16 newGemAnalogT = 0;
17
18static void
19endCamera(moveContext *context)
20{
21 cameraStop (0);
22
23 cameraClose (0);
24 cameraEnd ();
25
26 sysMemContainerDestroy (context->camInfo.container);
27}
28
29static int
30initCamera(moveContext *context)
31{
32 int ret;
33
34 context->camInfo.container = NULL;
35
36 ret = cameraInit ();
37 printf ("cameraInit() returned %d\n", ret);
38 if (ret == 0)
39 {
40 cameraType type = CAM_TYPE_UNKNOWN;
41
42 ret = cameraGetType (0, &type);
43 if (ret == 0 && type == CAM_TYPE_PLAYSTATION_EYE)
44 {
45 context->camInfo.format = CAM_FORM_RAW8;
46 context->camInfo.framerate = 60;
47 context->camInfo.resolution = CAM_RESO_VGA;
48 context->camInfo.info_ver = 0x0101;
49 ret = sysMemContainerCreate (&context->camInfo.container, 0x200000);
50 printf ("sysMemContainerCreate() for camera container returned %d\n", ret);
51
52 ret = cameraOpenEx (0, &context->camInfo);
53 switch (ret) {
54 case 0:
55 printf ("Found me an eye, arrr!\n");
56 printf ("cameraOpenEx returned %08X\n", ret);
57 printf ("Video dimensions: %dx%d\n", context->camInfo.width, context->camInfo.height);
58 printf ("Buffer at %08X\n", context->camInfo.buffer);
59 printf ("pbuf0 Buffer at %08X\n", context->camInfo.pbuf[0]);
60 printf ("pbuf0 Buffer at %08X\n", context->camInfo.pbuf[1]);
61 printf ("context->camInfo.info_ver %X\n", context->camInfo.info_ver);
62
63 context->camRead.buffer = context->camInfo.buffer;
64 context->camRead.version = 0x0100;
65 printf ("Setting CameraReadEx %08X buffer to cameraInfoex buffer \n",
66 context->camRead.buffer);
67 break;
68
69 default:
70 printf ("Error %X detected opening PlayStation Eye\n", ret);
71 goto error;
72 }
73 }
74 else {
75 printf ("Device detected is not a PlayStation Eye and this sample need it\n");
76 goto error;
77 }
78 }
79 else {
80 goto error;
81 }
82 return ret;
83
84error:
85 if (context->camInfo.container)
86 sysMemContainerDestroy (context->camInfo.container);
87 return ret;
88}
89
90static int
91readCamera(moveContext *context)
92{
93 int ret;
94
95 ret = cameraReadEx (0, &context->camRead);
96 switch (ret) {
97 case CAMERA_ERRO_NEED_START:
98 cameraReset (0);
99 ret = gemPrepareCamera (128, 0.5);
100 printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5 before cameraStart\n",
101 ret);
102 printf ("lets go!! It's time to look your face in Sony Bravia :P\n");
103 ret = cameraStart (0);
104 printf ("cameraStart return %d \n", ret);
105 printf ("*******************************************\n");
106 printf ("* Now make sure you have a Move connected\n");
107 printf ("* and point it towards the camera and press\n");
108 printf ("* the action button to calibrate\n");
109 printf ("*******************************************\n");
110 break;
111
112 case 0:
113 break;
114
115 default:
116 printf ("error %08X ", ret);
117 ret = 1;
118 break;
119 }
120 // printf("despues de start return %d \n",ret);
121 if (ret == 0 && context->camRead.readcount != 0)
122 {
123 return context->camRead.readcount;
124 }
125 else {
126 return 0;
127 }
128}
129
130moveContext *
131initMove()
132{
133 moveContext *context = NULL;
134 Spurs *spurs;
135 gemAttribute gem_attr;
136 int ret;
137 int i;
138
139 spurs = initSpurs ("gem_spurs");
140
141 if (spurs == NULL)
142 goto error;
143
144 printf ("preparing GemAttribute structure with spurs\n");
145
146 gem_attr.version = 2;
147 gem_attr.max = 1;
148 gem_attr.spurs = spurs;
149 gem_attr.memory = NULL;
150 gem_attr.spu_priorities[0] = 1;
151 for (i = 1; i < 8; ++i)
152 gem_attr.spu_priorities[i] = 0;
153
154 printf ("calling GemInit with GemAttribute structure version=%d max_connect=%d spurs=%X\n",
155 gem_attr.version, gem_attr.max, gem_attr.spurs);
156 ret = gemInit (&gem_attr);
157 printf ("return from GemInit %X \n", ret);
158 if (ret)
159 goto error;
160
161 ret = gemPrepareCamera (128, 0.5);
162 printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5\n",
163 ret);
164 if (ret)
165 goto error;
166 ret = gemReset (0);
167 printf ("GemReset return %X \n", ret);
168 if (ret)
169 goto error;
170
171 context = (moveContext *)malloc (sizeof (moveContext));
172 context->spurs = spurs;
173 ret = initCamera (context);
174
175 if (ret == 0)
176 return context;
177
178error:
179 if (spurs)
180 endSpurs (spurs);
181 if (context)
182 free (context);
183 return NULL;
184}
185
186void
187endMove(moveContext *context)
188{
189 /* Stop Move */
190 gemEnd ();
191 /* Stop Camera */
192 endCamera (context);
193 /* Stop Spurs */
194 endSpurs (context->spurs);
195
196 free (context);
197}
198
199int
200processMove(moveContext *context)
201{
202 const unsigned int hues[] = { 4 << 24, 4 << 24, 4 << 24, 4 << 24 };
203 int ret = -1;
204
205 if (readCamera (context) > 0)
206 {
207 ret = gemUpdateStart (context->camRead.buffer, context->camRead.timestamp);
208 //printf ("Return from gemUpdateStart %X\n", ret);
209 if (ret == 0)
210 {
211 ret = gemUpdateFinish ();
212 //printf ("Return from gemUpdateFinish %X\n", ret);
213 if (ret == 0)
214 {
215 ret = gemGetState (0, STATE_LATEST_IMAGE_TIME, 0, &context->state);
216 switch (ret) {
217 case 2:
218 gemForceRGB (0, 0.5, 0.5, 0.5);
219 break;
220
221 case 5:
222 gemTrackHues (hues, NULL);
223 break;
224
225 default:
226 break;
227 }
228 }
229 }
230 }
231
232 return ret;
233}
234
235void
236moveGet3DPosition(moveContext *context, float *x, float *y, float *z)
237{
238 if (x)
239 *x = vec_array (context->state.pos, 0);
240 if (y)
241 *y = vec_array (context->state.pos, 1);
242 if (z)
243 *z = vec_array (context->state.pos, 2);
244}
245
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/spursutil.c b/libraries/ecore/src/lib/ecore_psl1ght/spursutil.c
deleted file mode 100644
index 27b5c1d..0000000
--- a/libraries/ecore/src/lib/ecore_psl1ght/spursutil.c
+++ /dev/null
@@ -1,62 +0,0 @@
1#include "spursutil.h"
2#include <sys/spu.h>
3
4#define SPURS_DEFAULT_PREFIX_NAME "spursutil"
5
6Spurs *
7initSpurs(const char *prefix_name)
8{
9 Spurs *spurs = NULL;
10 SpursAttribute attributeSpurs;
11 int ret;
12 int i;
13
14 ret = sysSpuInitialize (6, 0);
15 printf ("sysSpuInitialize return %d\n", ret);
16
17 /* initialize spurs */
18 printf ("Initializing spurs\n");
19 spurs = (void *)memalign (SPURS_ALIGN, sizeof (Spurs));
20 printf ("Initializing spurs attribute\n");
21
22 ret = spursAttributeInitialize (&attributeSpurs, 5, 250, 1000, true);
23 if (ret)
24 {
25 printf ("error : spursAttributeInitialize failed %x\n", ret);
26 goto error;
27 }
28
29 printf ("Setting name prefix\n");
30 if (!prefix_name)
31 prefix_name = SPURS_DEFAULT_PREFIX_NAME;
32 ret = spursAttributeSetNamePrefix (&attributeSpurs,
33 prefix_name, strlen (prefix_name));
34 if (ret)
35 {
36 printf ("error : spursAttributeInitialize failed %x\n", ret);
37 goto error;
38 }
39
40 printf ("Initializing with attribute\n");
41 ret = spursInitializeWithAttribute (spurs, &attributeSpurs);
42 if (ret)
43 {
44 printf ("error: spursInitializeWithAttribute failed %x\n", ret);
45 goto error;
46 }
47
48 return spurs;
49
50error:
51 if (spurs)
52 free (spurs);
53 return NULL;
54}
55
56void
57endSpurs(Spurs *spurs)
58{
59 spursFinalize (spurs);
60 free (spurs);
61}
62
diff --git a/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h b/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h
deleted file mode 100644
index 359e974..0000000
--- a/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _ECORE_SDL_H
2#define _ECORE_SDL_H
3
4#ifdef EAPI
5# undef EAPI
6#endif
7
8#ifdef _WIN32
9# ifdef EFL_ECORE_SDL_BUILD
10# ifdef DLL_EXPORT
11# define EAPI __declspec(dllexport)
12# else
13# define EAPI
14# endif /* ! DLL_EXPORT */
15# else
16# define EAPI __declspec(dllimport)
17# endif /* ! EFL_ECORE_SDL_BUILD */
18#else
19# ifdef __GNUC__
20# if __GNUC__ >= 4
21# define EAPI __attribute__ ((visibility("default")))
22# else
23# define EAPI
24# endif
25# else
26# define EAPI
27# endif
28#endif /* ! _WIN32 */
29
30/**
31 * @file
32 * @brief Ecore SDL system functions.
33 */
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39EAPI extern int ECORE_SDL_EVENT_GOT_FOCUS;
40EAPI extern int ECORE_SDL_EVENT_LOST_FOCUS;
41EAPI extern int ECORE_SDL_EVENT_RESIZE;
42EAPI extern int ECORE_SDL_EVENT_EXPOSE;
43
44typedef struct _Ecore_Sdl_Event_Key_Down Ecore_Sdl_Event_Key_Down;
45struct _Ecore_Sdl_Event_Key_Down /** SDL Key Down event */
46{
47 const char *keyname; /**< The name of the key that was pressed */
48 const char *keycompose; /**< The UTF-8 string conversion if any */
49 unsigned int time;
50};
51
52typedef struct _Ecore_Sdl_Event_Key_Up Ecore_Sdl_Event_Key_Up;
53struct _Ecore_Sdl_Event_Key_Up /** SDL Key Up event */
54{
55 const char *keyname; /**< The name of the key that was released */
56 const char *keycompose; /**< The UTF-8 string conversion if any */
57 unsigned int time;
58};
59
60typedef struct _Ecore_Sdl_Event_Mouse_Button_Down Ecore_Sdl_Event_Mouse_Button_Down;
61struct _Ecore_Sdl_Event_Mouse_Button_Down /** SDL Mouse Down event */
62{
63 int button; /**< Mouse button that was pressed (1 - 32) */
64 int x; /**< Mouse co-ordinates when mouse button was pressed */
65 int y; /**< Mouse co-ordinates when mouse button was pressed */
66 int double_click : 1; /**< Set if click was a double click */
67 int triple_click : 1; /**< Set if click was a triple click */
68 unsigned int time;
69};
70
71typedef struct _Ecore_Sdl_Event_Mouse_Button_Up Ecore_Sdl_Event_Mouse_Button_Up;
72struct _Ecore_Sdl_Event_Mouse_Button_Up /** SDL Mouse Up event */
73{
74 int button; /**< Mouse button that was released (1 - 32) */
75 int x; /**< Mouse co-ordinates when mouse button was raised */
76 int y; /**< Mouse co-ordinates when mouse button was raised */
77 int double_click : 1; /**< Set if click was a double click */
78 int triple_click : 1; /**< Set if click was a triple click */
79 unsigned int time;
80};
81
82typedef struct _Ecore_Sdl_Event_Mouse_Move Ecore_Sdl_Event_Mouse_Move;
83struct _Ecore_Sdl_Event_Mouse_Move /** SDL Mouse Move event */
84{
85 int x; /**< Mouse co-ordinates where the mouse cursor moved to */
86 int y; /**< Mouse co-ordinates where the mouse cursor moved to */
87 unsigned int time;
88};
89
90typedef struct _Ecore_Sdl_Event_Mouse_Wheel Ecore_Sdl_Event_Mouse_Wheel;
91struct _Ecore_Sdl_Event_Mouse_Wheel /** SDL Mouse Wheel event */
92{
93 int x,y;
94 int direction; /* 0 = vertical, 1 = horizontal */
95 int wheel; /* value 1 (left/up), -1 (right/down) */
96 unsigned int time;
97};
98
99typedef struct _Ecore_Sdl_Event_Video_Resize Ecore_Sdl_Event_Video_Resize;
100struct _Ecore_Sdl_Event_Video_Resize
101{
102 int w;
103 int h;
104};
105
106EAPI int ecore_sdl_init(const char *name);
107EAPI int ecore_sdl_shutdown(void);
108EAPI void ecore_sdl_feed_events(void);
109
110#ifdef __cplusplus
111}
112#endif
113
114#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
deleted file mode 100644
index 4d0b60b..0000000
--- a/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h
+++ /dev/null
@@ -1,266 +0,0 @@
1#ifndef ECORE_SDL_KEYS_H__
2# define ECORE_SDL_KEYS_H__
3
4struct _ecore_sdl_keys_s
5{
6 int code;
7 const char* name;
8 const char* compose;
9};
10
11static const struct _ecore_sdl_keys_s keystable[] =
12{
13 { SDLK_UNKNOWN, "0x00", "" },
14#ifndef BUILD_ECORE_EVAS_SDL_130
15 { SDLK_FIRST, "First", "First" },
16#endif
17 { SDLK_BACKSPACE, "BackSpace", "\010" },
18 { SDLK_TAB, "Tab", "\011" },
19 { SDLK_CLEAR, "Clear", "Clear" },
20 { SDLK_RETURN, "Return", "\015" },
21 { SDLK_PAUSE, "Pause", "Pause" },
22 { SDLK_ESCAPE, "Escape", "\033" },
23 { SDLK_SPACE, "space", " " },
24 { SDLK_EXCLAIM, "exclam", "!" },
25 { SDLK_QUOTEDBL, "quotedbl", "\"" },
26 { SDLK_HASH, "numbersign", "#" },
27 { SDLK_DOLLAR, "dollar", "$" },
28 { SDLK_AMPERSAND, "ampersand", "&" },
29 { SDLK_QUOTE, "apostrophe", "'" },
30 { SDLK_LEFTPAREN, "parenleft", "(" },
31 { SDLK_RIGHTPAREN, "parenright", ")" },
32 { SDLK_ASTERISK, "asterisk", "*" },
33 { SDLK_PLUS, "plus", "+" },
34 { SDLK_COMMA, "comma", "," },
35 { SDLK_MINUS, "minus", "-" },
36 { SDLK_PERIOD, "period", "." },
37 { SDLK_SLASH, "slash", "/" },
38 { SDLK_0, "0", "0" },
39 { SDLK_1, "1", "1" },
40 { SDLK_2, "2", "2" },
41 { SDLK_3, "3", "3" },
42 { SDLK_4, "4", "4" },
43 { SDLK_5, "5", "5" },
44 { SDLK_6, "6", "6" },
45 { SDLK_7, "7", "7" },
46 { SDLK_8, "8", "8" },
47 { SDLK_9, "9", "9" },
48 { SDLK_COLON, "colon", ":" },
49 { SDLK_SEMICOLON, "semicolon", ";" },
50 { SDLK_LESS, "less", "<" },
51 { SDLK_EQUALS, "equal", "=" },
52 { SDLK_GREATER, "greater", ">" },
53 { SDLK_QUESTION, "question", "?" },
54 { SDLK_AT, "at", "@" },
55
56 /* Skip uppercase letters */
57 { SDLK_LEFTBRACKET, "bracketleft", "[" },
58 { SDLK_BACKSLASH, "backslash", "\\" },
59 { SDLK_RIGHTBRACKET, "bracketright", "]" },
60 { SDLK_CARET, "asciicircumm", "^" },
61 { SDLK_UNDERSCORE, "underscore", "_" },
62 { SDLK_BACKQUOTE, "asciitilde", "`" },
63 { SDLK_a, "a", "a" },
64 { SDLK_b, "b", "b" },
65 { SDLK_c, "c", "c" },
66 { SDLK_d, "d", "d" },
67 { SDLK_e, "e", "e" },
68 { SDLK_f, "f", "f" },
69 { SDLK_g, "g", "g" },
70 { SDLK_h, "h", "h" },
71 { SDLK_i, "i", "i" },
72 { SDLK_j, "j", "j" },
73 { SDLK_k, "k", "k" },
74 { SDLK_l, "l", "l" },
75 { SDLK_m, "m", "m" },
76 { SDLK_n, "n", "n" },
77 { SDLK_o, "o", "o" },
78 { SDLK_p, "p", "p" },
79 { SDLK_q, "q", "q" },
80 { SDLK_r, "r", "r" },
81 { SDLK_s, "s", "s" },
82 { SDLK_t, "t", "t" },
83 { SDLK_u, "u", "u" },
84 { SDLK_v, "v", "v" },
85 { SDLK_w, "w", "w" },
86 { SDLK_x, "x", "x" },
87 { SDLK_y, "y", "y" },
88 { SDLK_z, "z", "z" },
89 { SDLK_DELETE, "Delete", "\177" },
90 /* End of ASCII mapped keysyms */
91
92#ifndef BUILD_ECORE_EVAS_SDL_130
93 /* International keyboard syms */
94 { SDLK_WORLD_0, "w0", "" }, /* 0xA0 */
95 { SDLK_WORLD_1, "w1", "" },
96 { SDLK_WORLD_2, "w2", "" },
97 { SDLK_WORLD_3, "w3", "" },
98 { SDLK_WORLD_4, "w4", "" },
99 { SDLK_WORLD_5, "w5", "" },
100 { SDLK_WORLD_6, "w6", "" },
101 { SDLK_WORLD_7, "w7", "" },
102 { SDLK_WORLD_8, "w8", "" },
103 { SDLK_WORLD_9, "w9", "" },
104 { SDLK_WORLD_10, "w10", "" },
105 { SDLK_WORLD_11, "w11", "" },
106 { SDLK_WORLD_12, "w12", "" },
107 { SDLK_WORLD_13, "w13", "" },
108 { SDLK_WORLD_14, "w14", "" },
109 { SDLK_WORLD_15, "w15", "" },
110 { SDLK_WORLD_16, "w16", "" },
111 { SDLK_WORLD_17, "w17", "" },
112 { SDLK_WORLD_18, "w18", "" },
113 { SDLK_WORLD_19, "w19", "" },
114 { SDLK_WORLD_20, "w20", "" },
115 { SDLK_WORLD_21, "w21", "" },
116 { SDLK_WORLD_22, "w22", "" },
117 { SDLK_WORLD_23, "w23", "" },
118 { SDLK_WORLD_24, "w24", "" },
119 { SDLK_WORLD_25, "w25", "" },
120 { SDLK_WORLD_26, "w26", "" },
121 { SDLK_WORLD_27, "w27", "" },
122 { SDLK_WORLD_28, "w28", "" },
123 { SDLK_WORLD_29, "w29", "" },
124 { SDLK_WORLD_30, "w30", "" },
125 { SDLK_WORLD_31, "w31", "" },
126 { SDLK_WORLD_32, "w32", "" },
127 { SDLK_WORLD_33, "w33", "" },
128 { SDLK_WORLD_34, "w34", "" },
129 { SDLK_WORLD_35, "w35", "" },
130 { SDLK_WORLD_36, "w36", "" },
131 { SDLK_WORLD_37, "w37", "" },
132 { SDLK_WORLD_38, "w38", "" },
133 { SDLK_WORLD_39, "w39", "" },
134 { SDLK_WORLD_40, "w40", "" },
135 { SDLK_WORLD_41, "w41", "" },
136 { SDLK_WORLD_42, "w42", "" },
137 { SDLK_WORLD_43, "w43", "" },
138 { SDLK_WORLD_44, "w44", "" },
139 { SDLK_WORLD_45, "w45", "" },
140 { SDLK_WORLD_46, "w46", "" },
141 { SDLK_WORLD_47, "w47", "" },
142 { SDLK_WORLD_48, "w48", "" },
143 { SDLK_WORLD_49, "w49", "" },
144 { SDLK_WORLD_50, "w50", "" },
145 { SDLK_WORLD_51, "w51", "" },
146 { SDLK_WORLD_52, "w52", "" },
147 { SDLK_WORLD_53, "w53", "" },
148 { SDLK_WORLD_54, "w54", "" },
149 { SDLK_WORLD_55, "w55", "" },
150 { SDLK_WORLD_56, "w56", "" },
151 { SDLK_WORLD_57, "w57", "" },
152 { SDLK_WORLD_58, "w58", "" },
153 { SDLK_WORLD_59, "w59", "" },
154 { SDLK_WORLD_60, "w60", "" },
155 { SDLK_WORLD_61, "w61", "" },
156 { SDLK_WORLD_62, "w62", "" },
157 { SDLK_WORLD_63, "w63", "" },
158 { SDLK_WORLD_64, "w64", "" },
159 { SDLK_WORLD_65, "w65", "" },
160 { SDLK_WORLD_66, "w66", "" },
161 { SDLK_WORLD_67, "w67", "" },
162 { SDLK_WORLD_68, "w68", "" },
163 { SDLK_WORLD_69, "w69", "" },
164 { SDLK_WORLD_70, "w70", "" },
165 { SDLK_WORLD_71, "w71", "" },
166 { SDLK_WORLD_72, "w72", "" },
167 { SDLK_WORLD_73, "w73", "" },
168 { SDLK_WORLD_74, "w74", "" },
169 { SDLK_WORLD_75, "w75", "" },
170 { SDLK_WORLD_76, "w76", "" },
171 { SDLK_WORLD_77, "w77", "" },
172 { SDLK_WORLD_78, "w78", "" },
173 { SDLK_WORLD_79, "w79", "" },
174 { SDLK_WORLD_80, "w80", "" },
175 { SDLK_WORLD_81, "w81", "" },
176 { SDLK_WORLD_82, "w82", "" },
177 { SDLK_WORLD_83, "w83", "" },
178 { SDLK_WORLD_84, "w84", "" },
179 { SDLK_WORLD_85, "w85", "" },
180 { SDLK_WORLD_86, "w86", "" },
181 { SDLK_WORLD_87, "w87", "" },
182 { SDLK_WORLD_88, "w88", "" },
183 { SDLK_WORLD_89, "w89", "" },
184 { SDLK_WORLD_90, "w90", "" },
185 { SDLK_WORLD_91, "w91", "" },
186 { SDLK_WORLD_92, "w92", "" },
187 { SDLK_WORLD_93, "w93", "" },
188 { SDLK_WORLD_94, "w94", "" },
189 { SDLK_WORLD_95, "w95", "" },
190#endif
191 /* Numeric keypad */
192 { SDLK_KP0, "KP0", "0" },
193 { SDLK_KP1, "KP1", "1" },
194 { SDLK_KP2, "KP2", "2" },
195 { SDLK_KP3, "KP3", "3" },
196 { SDLK_KP4, "KP4", "4" },
197 { SDLK_KP5, "KP5", "5" },
198 { SDLK_KP6, "KP6", "6" },
199 { SDLK_KP7, "KP7", "7" },
200 { SDLK_KP8, "KP8", "8" },
201 { SDLK_KP9, "KP9", "9" },
202 { SDLK_KP_PERIOD, "period", "." },
203 { SDLK_KP_DIVIDE, "KP_Divide", "/" },
204 { SDLK_KP_MULTIPLY, "KP_Multiply", "*" },
205 { SDLK_KP_MINUS, "KP_Minus", "-" },
206 { SDLK_KP_PLUS, "KP_Plus", "+" },
207 { SDLK_KP_ENTER, "KP_Enter", "\015" },
208 { SDLK_KP_EQUALS, "KP_Equals", "=" },
209
210 /* Arrows + Home/End pad */
211 { SDLK_UP, "Up", "Up" },
212 { SDLK_DOWN, "Down", "Down" },
213 { SDLK_RIGHT, "Right", "Right" },
214 { SDLK_LEFT, "Left", "Left" },
215 { SDLK_INSERT, "Insert", "Insert" },
216 { SDLK_HOME, "Home", "Home" },
217 { SDLK_END, "End", "End" },
218 { SDLK_PAGEUP, "Page_Up", "Page_Up" },
219 { SDLK_PAGEDOWN, "Page_Down", "Page_Down" },
220
221 /* Function keys */
222 { SDLK_F1, "F1", "F1" },
223 { SDLK_F2, "F2", "F2" },
224 { SDLK_F3, "F3", "F3" },
225 { SDLK_F4, "F4", "F4" },
226 { SDLK_F5, "F5", "F5" },
227 { SDLK_F6, "F6", "F6" },
228 { SDLK_F7, "F7", "F7" },
229 { SDLK_F8, "F8", "F8" },
230 { SDLK_F9, "F9", "F9" },
231 { SDLK_F10, "F10", "F10" },
232 { SDLK_F11, "F11", "F11" },
233 { SDLK_F12, "F12", "F12" },
234 { SDLK_F13, "F13", "F13" },
235 { SDLK_F14, "F14", "F14" },
236 { SDLK_F15, "F15", "F15" },
237
238 /* Key state modifier keys */
239 { SDLK_NUMLOCK, "Num_Lock", "Num_Lock" },
240 { SDLK_CAPSLOCK, "Caps_Lock", "Caps_Lock" },
241 { SDLK_SCROLLOCK, "Scroll_Lock", "Scroll_Lock" },
242 { SDLK_RSHIFT, "Shift_R", "Shift_R" },
243 { SDLK_LSHIFT, "Shift_L", "Shift_L" },
244 { SDLK_RCTRL, "Control_R", "Control_R" },
245 { SDLK_LCTRL, "Control_L", "Control_L" },
246 { SDLK_RALT, "Alt_R", "Alt_R" },
247 { SDLK_LALT, "Alt_L", "Alt_L" },
248 { SDLK_RMETA, "Meta_R", "Meta_R" },
249 { SDLK_LMETA, "Meta_L", "Meta_L" },
250 { SDLK_LSUPER, "Super_L", "Super_L" }, /* Left "Windows" key */
251 { SDLK_RSUPER, "Super_R", "Super_R" }, /* Right "Windows" key */
252 { SDLK_MODE, "Mode", "Mode" }, /* "Alt Gr" key */
253 { SDLK_COMPOSE, "Compose", "Compose" }, /* Multi-key compose key */
254
255 /* Miscellaneous function keys */
256 { SDLK_HELP, "Help", "Help" },
257 { SDLK_PRINT, "Print", "Print" },
258 { SDLK_SYSREQ, "SysReq", "SysReq" },
259 { SDLK_BREAK, "Break", "Break" },
260 { SDLK_MENU, "Menu", "Menu" },
261 { SDLK_POWER, "Power", "Power" }, /* Power Macintosh power key */
262 { SDLK_EURO, "Euro", "\200" }, /* Some european keyboards */
263 { SDLK_UNDO, "Undo", "Undo" } /* Atari keyboard has Undo */
264};
265
266#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
deleted file mode 100644
index 27210bb..0000000
--- a/libraries/ecore/src/lib/ecore_sdl/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_evas \
6-I$(top_srcdir)/src/lib/ecore_input \
7-I$(top_builddir)/src/lib/ecore \
8-I$(top_builddir)/src/lib/ecore_evas \
9-I$(top_builddir)/src/lib/ecore_input \
10@EFL_ECORE_SDL_BUILD@ \
11@SDL_CFLAGS@ \
12@EVAS_CFLAGS@ \
13@EINA_CFLAGS@
14
15lib_LTLIBRARIES = libecore_sdl.la
16includes_HEADERS = Ecore_Sdl.h
17includesdir = $(includedir)/ecore-@VMAJ@
18
19libecore_sdl_la_SOURCES = \
20ecore_sdl.c
21
22libecore_sdl_la_LIBADD = \
23$(top_builddir)/src/lib/ecore/libecore.la \
24$(top_builddir)/src/lib/ecore_input/libecore_input.la \
25@SDL_LIBS@ @EVIL_LIBS@ @EINA_LIBS@
26
27libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
28
29EXTRA_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
deleted file mode 100644
index 50003ab..0000000
--- a/libraries/ecore/src/lib/ecore_sdl/Makefile.in
+++ /dev/null
@@ -1,836 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_sdl
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_sdl_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la \
90 $(top_builddir)/src/lib/ecore_input/libecore_input.la
91am_libecore_sdl_la_OBJECTS = ecore_sdl.lo
92libecore_sdl_la_OBJECTS = $(am_libecore_sdl_la_OBJECTS)
93AM_V_lt = $(am__v_lt_$(V))
94am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
95am__v_lt_0 = --silent
96libecore_sdl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
97 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
98 $(AM_CFLAGS) $(CFLAGS) $(libecore_sdl_la_LDFLAGS) $(LDFLAGS) \
99 -o $@
100DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
101depcomp = $(SHELL) $(top_srcdir)/depcomp
102am__depfiles_maybe = depfiles
103am__mv = mv -f
104COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
105 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
106LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
107 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
108 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
109 $(AM_CFLAGS) $(CFLAGS)
110AM_V_CC = $(am__v_CC_$(V))
111am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
112am__v_CC_0 = @echo " CC " $@;
113AM_V_at = $(am__v_at_$(V))
114am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
115am__v_at_0 = @
116CCLD = $(CC)
117LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
118 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
119 $(AM_LDFLAGS) $(LDFLAGS) -o $@
120AM_V_CCLD = $(am__v_CCLD_$(V))
121am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
122am__v_CCLD_0 = @echo " CCLD " $@;
123AM_V_GEN = $(am__v_GEN_$(V))
124am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
125am__v_GEN_0 = @echo " GEN " $@;
126SOURCES = $(libecore_sdl_la_SOURCES)
127DIST_SOURCES = $(libecore_sdl_la_SOURCES)
128HEADERS = $(includes_HEADERS)
129ETAGS = etags
130CTAGS = ctags
131DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
132ACLOCAL = @ACLOCAL@
133ALLOCA = @ALLOCA@
134AMTAR = @AMTAR@
135AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
136AR = @AR@
137AS = @AS@
138AUTOCONF = @AUTOCONF@
139AUTOHEADER = @AUTOHEADER@
140AUTOMAKE = @AUTOMAKE@
141AWK = @AWK@
142CARES_CFLAGS = @CARES_CFLAGS@
143CARES_LIBS = @CARES_LIBS@
144CC = @CC@
145CCDEPMODE = @CCDEPMODE@
146CFLAGS = @CFLAGS@
147CHECK_CFLAGS = @CHECK_CFLAGS@
148CHECK_LIBS = @CHECK_LIBS@
149CPP = @CPP@
150CPPFLAGS = @CPPFLAGS@
151CURL_CFLAGS = @CURL_CFLAGS@
152CURL_LIBS = @CURL_LIBS@
153CXX = @CXX@
154CXXCPP = @CXXCPP@
155CXXDEPMODE = @CXXDEPMODE@
156CXXFLAGS = @CXXFLAGS@
157CYGPATH_W = @CYGPATH_W@
158DEFS = @DEFS@
159DEPDIR = @DEPDIR@
160DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
161DIRECTFB_LIBS = @DIRECTFB_LIBS@
162DLLTOOL = @DLLTOOL@
163DSYMUTIL = @DSYMUTIL@
164DUMPBIN = @DUMPBIN@
165ECHO_C = @ECHO_C@
166ECHO_N = @ECHO_N@
167ECHO_T = @ECHO_T@
168ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
169ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
170EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
171EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
172EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
173EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
174EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
175EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
176EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
177EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
178EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
179EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
180EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
181EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
182EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
183EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
184EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
185EGREP = @EGREP@
186EINA_CFLAGS = @EINA_CFLAGS@
187EINA_LIBS = @EINA_LIBS@
188ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
189ESCAPE_LIBS = @ESCAPE_LIBS@
190EVAS_CFLAGS = @EVAS_CFLAGS@
191EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@
200GLIB_LIBS = @GLIB_LIBS@
201GMSGFMT = @GMSGFMT@
202GMSGFMT_015 = @GMSGFMT_015@
203GREP = @GREP@
204INSTALL = @INSTALL@
205INSTALL_DATA = @INSTALL_DATA@
206INSTALL_PROGRAM = @INSTALL_PROGRAM@
207INSTALL_SCRIPT = @INSTALL_SCRIPT@
208INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
209INTLLIBS = @INTLLIBS@
210INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
211KEYSYMDEFS = @KEYSYMDEFS@
212LD = @LD@
213LDFLAGS = @LDFLAGS@
214LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
215LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
216LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
217LIBICONV = @LIBICONV@
218LIBINTL = @LIBINTL@
219LIBOBJS = @LIBOBJS@
220LIBS = @LIBS@
221LIBTOOL = @LIBTOOL@
222LIPO = @LIPO@
223LN_S = @LN_S@
224LTLIBICONV = @LTLIBICONV@
225LTLIBINTL = @LTLIBINTL@
226LTLIBOBJS = @LTLIBOBJS@
227MAKEINFO = @MAKEINFO@
228MKDIR_P = @MKDIR_P@
229MSGFMT = @MSGFMT@
230MSGFMT_015 = @MSGFMT_015@
231MSGMERGE = @MSGMERGE@
232NM = @NM@
233NMEDIT = @NMEDIT@
234OBJC = @OBJC@
235OBJCDEPMODE = @OBJCDEPMODE@
236OBJCFLAGS = @OBJCFLAGS@
237OBJDUMP = @OBJDUMP@
238OBJEXT = @OBJEXT@
239OTOOL = @OTOOL@
240OTOOL64 = @OTOOL64@
241PACKAGE = @PACKAGE@
242PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
243PACKAGE_NAME = @PACKAGE_NAME@
244PACKAGE_STRING = @PACKAGE_STRING@
245PACKAGE_TARNAME = @PACKAGE_TARNAME@
246PACKAGE_URL = @PACKAGE_URL@
247PACKAGE_VERSION = @PACKAGE_VERSION@
248PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
254POSUB = @POSUB@
255RANLIB = @RANLIB@
256SCIM_CFLAGS = @SCIM_CFLAGS@
257SCIM_LIBS = @SCIM_LIBS@
258SDL_CFLAGS = @SDL_CFLAGS@
259SDL_CONFIG = @SDL_CONFIG@
260SDL_LIBS = @SDL_LIBS@
261SED = @SED@
262SET_MAKE = @SET_MAKE@
263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@
268TLS2_CFLAGS = @TLS2_CFLAGS@
269TLS2_LIBS = @TLS2_LIBS@
270TLS_CFLAGS = @TLS_CFLAGS@
271TLS_LIBS = @TLS_LIBS@
272TSLIB_CFLAGS = @TSLIB_CFLAGS@
273TSLIB_LIBS = @TSLIB_LIBS@
274USE_NLS = @USE_NLS@
275VERSION = @VERSION@
276VMAJ = @VMAJ@
277WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
278WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
279WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
280WAYLAND_LIBS = @WAYLAND_LIBS@
281WIN32_CFLAGS = @WIN32_CFLAGS@
282WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
283WIN32_LIBS = @WIN32_LIBS@
284XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
285XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
286XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
287XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
288XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
289XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
290XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
291XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
292XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
293XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
294XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
295XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
296XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
297XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
298XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
299XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
300XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
301XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
302XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
303XCB_X11_LIBS = @XCB_X11_LIBS@
304XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
305XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
306XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
307XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
308XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
309XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
310XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
311XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
312XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
313XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
314XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
315XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
316XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
317XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
318XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
319XDAMAGE_LIBS = @XDAMAGE_LIBS@
320XDPMS_CFLAGS = @XDPMS_CFLAGS@
321XDPMS_LIBS = @XDPMS_LIBS@
322XFIXES_CFLAGS = @XFIXES_CFLAGS@
323XFIXES_LIBS = @XFIXES_LIBS@
324XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
325XGESTURE_LIBS = @XGESTURE_LIBS@
326XGETTEXT = @XGETTEXT@
327XGETTEXT_015 = @XGETTEXT_015@
328XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
329XI2_CFLAGS = @XI2_CFLAGS@
330XI2_LIBS = @XI2_LIBS@
331XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
332XINERAMA_LIBS = @XINERAMA_LIBS@
333XKB_CFLAGS = @XKB_CFLAGS@
334XKB_LIBS = @XKB_LIBS@
335XMKMF = @XMKMF@
336XPRINT_CFLAGS = @XPRINT_CFLAGS@
337XPRINT_LIBS = @XPRINT_LIBS@
338XRANDR_CFLAGS = @XRANDR_CFLAGS@
339XRANDR_LIBS = @XRANDR_LIBS@
340XRENDER_CFLAGS = @XRENDER_CFLAGS@
341XRENDER_LIBS = @XRENDER_LIBS@
342XSS_CFLAGS = @XSS_CFLAGS@
343XSS_LIBS = @XSS_LIBS@
344XTEST_CFLAGS = @XTEST_CFLAGS@
345XTEST_LIBS = @XTEST_LIBS@
346X_CFLAGS = @X_CFLAGS@
347X_EXTRA_LIBS = @X_EXTRA_LIBS@
348X_LIBS = @X_LIBS@
349X_PRE_LIBS = @X_PRE_LIBS@
350Xcursor_cflags = @Xcursor_cflags@
351Xcursor_libs = @Xcursor_libs@
352abs_builddir = @abs_builddir@
353abs_srcdir = @abs_srcdir@
354abs_top_builddir = @abs_top_builddir@
355abs_top_srcdir = @abs_top_srcdir@
356ac_ct_CC = @ac_ct_CC@
357ac_ct_CXX = @ac_ct_CXX@
358ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
359ac_ct_OBJC = @ac_ct_OBJC@
360am__include = @am__include@
361am__leading_dot = @am__leading_dot@
362am__quote = @am__quote@
363am__tar = @am__tar@
364am__untar = @am__untar@
365bindir = @bindir@
366build = @build@
367build_alias = @build_alias@
368build_cpu = @build_cpu@
369build_os = @build_os@
370build_vendor = @build_vendor@
371builddir = @builddir@
372cocoa_ldflags = @cocoa_ldflags@
373datadir = @datadir@
374datarootdir = @datarootdir@
375dlopen_libs = @dlopen_libs@
376docdir = @docdir@
377dvidir = @dvidir@
378ecore_cocoa_cflags = @ecore_cocoa_cflags@
379ecore_cocoa_libs = @ecore_cocoa_libs@
380ecore_con_cflags = @ecore_con_cflags@
381ecore_con_libs = @ecore_con_libs@
382ecore_directfb_cflags = @ecore_directfb_cflags@
383ecore_directfb_libs = @ecore_directfb_libs@
384ecore_evas_cflags = @ecore_evas_cflags@
385ecore_evas_libs = @ecore_evas_libs@
386ecore_fb_cflags = @ecore_fb_cflags@
387ecore_fb_libs = @ecore_fb_libs@
388ecore_file_cflags = @ecore_file_cflags@
389ecore_file_libs = @ecore_file_libs@
390ecore_imf_cflags = @ecore_imf_cflags@
391ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
392ecore_imf_evas_libs = @ecore_imf_evas_libs@
393ecore_imf_libs = @ecore_imf_libs@
394ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
395ecore_imf_scim_libs = @ecore_imf_scim_libs@
396ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
397ecore_imf_xim_libs = @ecore_imf_xim_libs@
398ecore_input_cflags = @ecore_input_cflags@
399ecore_input_evas_cflags = @ecore_input_evas_cflags@
400ecore_input_evas_libs = @ecore_input_evas_libs@
401ecore_input_libs = @ecore_input_libs@
402ecore_ipc_cflags = @ecore_ipc_cflags@
403ecore_ipc_libs = @ecore_ipc_libs@
404ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
405ecore_psl1ght_libs = @ecore_psl1ght_libs@
406ecore_sdl_cflags = @ecore_sdl_cflags@
407ecore_sdl_libs = @ecore_sdl_libs@
408ecore_wayland_cflags = @ecore_wayland_cflags@
409ecore_wayland_libs = @ecore_wayland_libs@
410ecore_win32_cflags = @ecore_win32_cflags@
411ecore_win32_libs = @ecore_win32_libs@
412ecore_wince_cflags = @ecore_wince_cflags@
413ecore_wince_libs = @ecore_wince_libs@
414ecore_x_cflags = @ecore_x_cflags@
415ecore_x_libs = @ecore_x_libs@
416ecore_x_libs_private = @ecore_x_libs_private@
417efl_doxygen = @efl_doxygen@
418efl_have_doxygen = @efl_have_doxygen@
419exec_prefix = @exec_prefix@
420have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
421host = @host@
422host_alias = @host_alias@
423host_cpu = @host_cpu@
424host_os = @host_os@
425host_vendor = @host_vendor@
426htmldir = @htmldir@
427includedir = @includedir@
428infodir = @infodir@
429install_sh = @install_sh@
430libdir = @libdir@
431libexecdir = @libexecdir@
432localedir = @localedir@
433localstatedir = @localstatedir@
434lt_ECHO = @lt_ECHO@
435lt_enable_auto_import = @lt_enable_auto_import@
436mandir = @mandir@
437mkdir_p = @mkdir_p@
438oldincludedir = @oldincludedir@
439pdfdir = @pdfdir@
440pkgconfig_requires_private = @pkgconfig_requires_private@
441prefix = @prefix@
442program_transform_name = @program_transform_name@
443psdir = @psdir@
444release_info = @release_info@
445requirements_ecore = @requirements_ecore@
446requirements_ecore_cocoa = @requirements_ecore_cocoa@
447requirements_ecore_con = @requirements_ecore_con@
448requirements_ecore_directfb = @requirements_ecore_directfb@
449requirements_ecore_evas = @requirements_ecore_evas@
450requirements_ecore_fb = @requirements_ecore_fb@
451requirements_ecore_file = @requirements_ecore_file@
452requirements_ecore_imf = @requirements_ecore_imf@
453requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
454requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
455requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
456requirements_ecore_input = @requirements_ecore_input@
457requirements_ecore_input_evas = @requirements_ecore_input_evas@
458requirements_ecore_ipc = @requirements_ecore_ipc@
459requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
460requirements_ecore_sdl = @requirements_ecore_sdl@
461requirements_ecore_wayland = @requirements_ecore_wayland@
462requirements_ecore_win32 = @requirements_ecore_win32@
463requirements_ecore_wince = @requirements_ecore_wince@
464requirements_ecore_x = @requirements_ecore_x@
465rt_libs = @rt_libs@
466sbindir = @sbindir@
467sharedstatedir = @sharedstatedir@
468srcdir = @srcdir@
469sysconfdir = @sysconfdir@
470target_alias = @target_alias@
471top_build_prefix = @top_build_prefix@
472top_builddir = @top_builddir@
473top_srcdir = @top_srcdir@
474version_info = @version_info@
475x_cflags = @x_cflags@
476x_includes = @x_includes@
477x_libs = @x_libs@
478MAINTAINERCLEANFILES = Makefile.in
479AM_CPPFLAGS = \
480-I$(top_srcdir)/src/lib/ecore \
481-I$(top_srcdir)/src/lib/ecore_evas \
482-I$(top_srcdir)/src/lib/ecore_input \
483-I$(top_builddir)/src/lib/ecore \
484-I$(top_builddir)/src/lib/ecore_evas \
485-I$(top_builddir)/src/lib/ecore_input \
486@EFL_ECORE_SDL_BUILD@ \
487@SDL_CFLAGS@ \
488@EVAS_CFLAGS@ \
489@EINA_CFLAGS@
490
491lib_LTLIBRARIES = libecore_sdl.la
492includes_HEADERS = Ecore_Sdl.h
493includesdir = $(includedir)/ecore-@VMAJ@
494libecore_sdl_la_SOURCES = \
495ecore_sdl.c
496
497libecore_sdl_la_LIBADD = \
498$(top_builddir)/src/lib/ecore/libecore.la \
499$(top_builddir)/src/lib/ecore_input/libecore_input.la \
500@SDL_LIBS@ @EVIL_LIBS@ @EINA_LIBS@
501
502libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
503EXTRA_DIST = Ecore_Sdl_Keys.h ecore_sdl_private.h
504all: all-am
505
506.SUFFIXES:
507.SUFFIXES: .c .lo .o .obj
508$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
509 @for dep in $?; do \
510 case '$(am__configure_deps)' in \
511 *$$dep*) \
512 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
513 && { if test -f $@; then exit 0; else break; fi; }; \
514 exit 1;; \
515 esac; \
516 done; \
517 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_sdl/Makefile'; \
518 $(am__cd) $(top_srcdir) && \
519 $(AUTOMAKE) --gnu src/lib/ecore_sdl/Makefile
520.PRECIOUS: Makefile
521Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
522 @case '$?' in \
523 *config.status*) \
524 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
525 *) \
526 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
527 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
528 esac;
529
530$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
531 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
532
533$(top_srcdir)/configure: $(am__configure_deps)
534 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
535$(ACLOCAL_M4): $(am__aclocal_m4_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(am__aclocal_m4_deps):
538install-libLTLIBRARIES: $(lib_LTLIBRARIES)
539 @$(NORMAL_INSTALL)
540 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
541 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
542 list2=; for p in $$list; do \
543 if test -f $$p; then \
544 list2="$$list2 $$p"; \
545 else :; fi; \
546 done; \
547 test -z "$$list2" || { \
548 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
549 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
550 }
551
552uninstall-libLTLIBRARIES:
553 @$(NORMAL_UNINSTALL)
554 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
555 for p in $$list; do \
556 $(am__strip_dir) \
557 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
558 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
559 done
560
561clean-libLTLIBRARIES:
562 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
563 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
564 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
565 test "$$dir" != "$$p" || dir=.; \
566 echo "rm -f \"$${dir}/so_locations\""; \
567 rm -f "$${dir}/so_locations"; \
568 done
569libecore_sdl.la: $(libecore_sdl_la_OBJECTS) $(libecore_sdl_la_DEPENDENCIES)
570 $(AM_V_CCLD)$(libecore_sdl_la_LINK) -rpath $(libdir) $(libecore_sdl_la_OBJECTS) $(libecore_sdl_la_LIBADD) $(LIBS)
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_sdl.Plo@am__quote@
579
580.c.o:
581@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
582@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
583@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
584@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
585@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
586@am__fastdepCC_FALSE@ $(COMPILE) -c $<
587
588.c.obj:
589@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
590@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
591@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
592@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
593@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
594@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
595
596.c.lo:
597@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
598@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
599@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
601@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
602@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
603
604mostlyclean-libtool:
605 -rm -f *.lo
606
607clean-libtool:
608 -rm -rf .libs _libs
609install-includesHEADERS: $(includes_HEADERS)
610 @$(NORMAL_INSTALL)
611 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
612 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
613 for p in $$list; do \
614 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
615 echo "$$d$$p"; \
616 done | $(am__base_list) | \
617 while read files; do \
618 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
619 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
620 done
621
622uninstall-includesHEADERS:
623 @$(NORMAL_UNINSTALL)
624 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
625 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
626 test -n "$$files" || exit 0; \
627 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
628 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
629
630ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
631 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
632 unique=`for i in $$list; do \
633 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
634 done | \
635 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
636 END { if (nonempty) { for (i in files) print i; }; }'`; \
637 mkid -fID $$unique
638tags: TAGS
639
640TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
641 $(TAGS_FILES) $(LISP)
642 set x; \
643 here=`pwd`; \
644 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
645 unique=`for i in $$list; do \
646 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
647 done | \
648 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
649 END { if (nonempty) { for (i in files) print i; }; }'`; \
650 shift; \
651 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
652 test -n "$$unique" || unique=$$empty_fix; \
653 if test $$# -gt 0; then \
654 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
655 "$$@" $$unique; \
656 else \
657 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
658 $$unique; \
659 fi; \
660 fi
661ctags: CTAGS
662CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
663 $(TAGS_FILES) $(LISP)
664 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
665 unique=`for i in $$list; do \
666 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
667 done | \
668 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
669 END { if (nonempty) { for (i in files) print i; }; }'`; \
670 test -z "$(CTAGS_ARGS)$$unique" \
671 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
672 $$unique
673
674GTAGS:
675 here=`$(am__cd) $(top_builddir) && pwd` \
676 && $(am__cd) $(top_srcdir) \
677 && gtags -i $(GTAGS_ARGS) "$$here"
678
679distclean-tags:
680 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
681
682distdir: $(DISTFILES)
683 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
684 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
685 list='$(DISTFILES)'; \
686 dist_files=`for file in $$list; do echo $$file; done | \
687 sed -e "s|^$$srcdirstrip/||;t" \
688 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
689 case $$dist_files in \
690 */*) $(MKDIR_P) `echo "$$dist_files" | \
691 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
692 sort -u` ;; \
693 esac; \
694 for file in $$dist_files; do \
695 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
696 if test -d $$d/$$file; then \
697 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
698 if test -d "$(distdir)/$$file"; then \
699 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
700 fi; \
701 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
702 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
703 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
704 fi; \
705 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
706 else \
707 test -f "$(distdir)/$$file" \
708 || cp -p $$d/$$file "$(distdir)/$$file" \
709 || exit 1; \
710 fi; \
711 done
712check-am: all-am
713check: check-am
714all-am: Makefile $(LTLIBRARIES) $(HEADERS)
715installdirs:
716 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
717 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
718 done
719install: install-am
720install-exec: install-exec-am
721install-data: install-data-am
722uninstall: uninstall-am
723
724install-am: all-am
725 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
726
727installcheck: installcheck-am
728install-strip:
729 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
730 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
731 `test -z '$(STRIP)' || \
732 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
733mostlyclean-generic:
734
735clean-generic:
736
737distclean-generic:
738 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
739 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
740
741maintainer-clean-generic:
742 @echo "This command is intended for maintainers to use"
743 @echo "it deletes files that may require special tools to rebuild."
744 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
745clean: clean-am
746
747clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
748 mostlyclean-am
749
750distclean: distclean-am
751 -rm -rf ./$(DEPDIR)
752 -rm -f Makefile
753distclean-am: clean-am distclean-compile distclean-generic \
754 distclean-tags
755
756dvi: dvi-am
757
758dvi-am:
759
760html: html-am
761
762html-am:
763
764info: info-am
765
766info-am:
767
768install-data-am: install-includesHEADERS
769
770install-dvi: install-dvi-am
771
772install-dvi-am:
773
774install-exec-am: install-libLTLIBRARIES
775
776install-html: install-html-am
777
778install-html-am:
779
780install-info: install-info-am
781
782install-info-am:
783
784install-man:
785
786install-pdf: install-pdf-am
787
788install-pdf-am:
789
790install-ps: install-ps-am
791
792install-ps-am:
793
794installcheck-am:
795
796maintainer-clean: maintainer-clean-am
797 -rm -rf ./$(DEPDIR)
798 -rm -f Makefile
799maintainer-clean-am: distclean-am maintainer-clean-generic
800
801mostlyclean: mostlyclean-am
802
803mostlyclean-am: mostlyclean-compile mostlyclean-generic \
804 mostlyclean-libtool
805
806pdf: pdf-am
807
808pdf-am:
809
810ps: ps-am
811
812ps-am:
813
814uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
815
816.MAKE: install-am install-strip
817
818.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
819 clean-libLTLIBRARIES clean-libtool ctags distclean \
820 distclean-compile distclean-generic distclean-libtool \
821 distclean-tags distdir dvi dvi-am html html-am info info-am \
822 install install-am install-data install-data-am install-dvi \
823 install-dvi-am install-exec install-exec-am install-html \
824 install-html-am install-includesHEADERS install-info \
825 install-info-am install-libLTLIBRARIES install-man install-pdf \
826 install-pdf-am install-ps install-ps-am install-strip \
827 installcheck installcheck-am installdirs maintainer-clean \
828 maintainer-clean-generic mostlyclean mostlyclean-compile \
829 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
830 tags uninstall uninstall-am uninstall-includesHEADERS \
831 uninstall-libLTLIBRARIES
832
833
834# Tell versions [3.59,3.63) of GNU make to not export all variables.
835# Otherwise a system limit (for SysV at least) may be exceeded.
836.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c b/libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c
deleted file mode 100644
index 3f28216..0000000
--- a/libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c
+++ /dev/null
@@ -1,335 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <SDL/SDL.h>
6
7#include "Eina.h"
8#include "Ecore_Sdl.h"
9#include "Ecore_Input.h"
10#include "Ecore.h"
11#include "ecore_sdl_private.h"
12#include "ecore_private.h"
13#include "Ecore_Sdl_Keys.h"
14
15#include <eina_rbtree.h>
16
17int _ecore_sdl_log_dom = -1;
18
19typedef struct _Ecore_SDL_Pressed Ecore_SDL_Pressed;
20struct _Ecore_SDL_Pressed
21{
22 EINA_RBTREE;
23
24 SDLKey key;
25};
26
27EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0;
28EAPI int ECORE_SDL_EVENT_LOST_FOCUS = 0;
29EAPI int ECORE_SDL_EVENT_RESIZE = 0;
30EAPI int ECORE_SDL_EVENT_EXPOSE = 0;
31
32static int _ecore_sdl_init_count = 0;
33static Eina_Rbtree *repeat = NULL;
34
35static Eina_Rbtree_Direction
36_ecore_sdl_pressed_key(const Ecore_SDL_Pressed *left,
37 const Ecore_SDL_Pressed *right,
38 __UNUSED__ void *data)
39{
40 return left->key < right->key ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT;
41}
42
43static int
44_ecore_sdl_pressed_node(const Ecore_SDL_Pressed *node,
45 const SDLKey *key,
46 __UNUSED__ int length,
47 __UNUSED__ void *data)
48{
49 return node->key - *key;
50}
51
52/**
53 * @defgroup Ecore_Sdl_Library_Group SDL Library Functions
54 *
55 * Functions used to set up and shut down the Ecore_Sdl functions.
56 */
57
58/**
59 * Sets up the Ecore_Sdl library.
60 * @param name device target name
61 * @return @c 0 on failure. Otherwise, the number of times the library has
62 * been initialised without being shut down.
63 * @ingroup Ecore_SDL_Library_Group
64 */
65EAPI int
66ecore_sdl_init(const char *name __UNUSED__)
67{
68 if(++_ecore_sdl_init_count != 1)
69 return _ecore_sdl_init_count;
70 _ecore_sdl_log_dom = eina_log_domain_register
71 ("ecore_sdl", ECORE_SDL_DEFAULT_LOG_COLOR);
72 if(_ecore_sdl_log_dom < 0)
73 {
74 EINA_LOG_ERR("Impossible to create a log domain for the Ecore SDL module.");
75 return --_ecore_sdl_init_count;
76 }
77 if (!ecore_event_init())
78 return --_ecore_sdl_init_count;
79
80 ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new();
81 ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new();
82 ECORE_SDL_EVENT_RESIZE = ecore_event_type_new();
83 ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new();
84
85 SDL_EnableKeyRepeat(200, 100);
86
87 return _ecore_sdl_init_count;
88}
89
90/**
91 * Shuts down the Ecore_Sdl library.
92 * @return @c The number of times the system has been initialised without
93 * being shut down.
94 * @ingroup Ecore_SDL_Library_Group
95 */
96EAPI int
97ecore_sdl_shutdown(void)
98{
99 if (--_ecore_sdl_init_count != 0)
100 return _ecore_sdl_init_count;
101
102 ecore_event_shutdown();
103 eina_log_domain_unregister(_ecore_sdl_log_dom);
104 _ecore_sdl_log_dom = -1;
105 return _ecore_sdl_init_count;
106}
107
108static unsigned int
109_ecore_sdl_event_modifiers(int mod)
110{
111 unsigned int modifiers = 0;
112
113 if(mod & KMOD_LSHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
114 if(mod & KMOD_RSHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
115 if(mod & KMOD_LCTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL;
116 if(mod & KMOD_RCTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL;
117 if(mod & KMOD_LALT) modifiers |= ECORE_EVENT_MODIFIER_ALT;
118 if(mod & KMOD_RALT) modifiers |= ECORE_EVENT_MODIFIER_ALT;
119 if(mod & KMOD_NUM) modifiers |= ECORE_EVENT_LOCK_NUM;
120 if(mod & KMOD_CAPS) modifiers |= ECORE_EVENT_LOCK_CAPS;
121
122 return modifiers;
123}
124
125static Ecore_Event_Key*
126_ecore_sdl_event_key(SDL_Event *event, double time)
127{
128 Ecore_Event_Key *ev;
129 unsigned int i;
130
131 ev = malloc(sizeof(Ecore_Event_Key));
132 if (!ev) return NULL;
133
134 ev->timestamp = time;
135 ev->window = 0;
136 ev->event_window = 0;
137 ev->modifiers = _ecore_sdl_event_modifiers(SDL_GetModState());
138 ev->key = NULL;
139 ev->compose = NULL;
140
141 for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_sdl_keys_s); ++i)
142 if (keystable[i].code == event->key.keysym.sym)
143 {
144 ev->keyname = keystable[i].name;
145 ev->string = keystable[i].compose;
146
147 return ev;
148 }
149
150 free(ev);
151 return NULL;
152}
153
154EAPI void
155ecore_sdl_feed_events(void)
156{
157 SDL_Event event;
158 unsigned int time;
159
160 while(SDL_PollEvent(&event))
161 {
162 time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
163 switch(event.type)
164 {
165 case SDL_MOUSEMOTION:
166 {
167 Ecore_Event_Mouse_Move *ev;
168
169 ev = malloc(sizeof(Ecore_Event_Mouse_Move));
170 if (!ev) return ;
171
172 ev->timestamp = time;
173 ev->window = 0;
174 ev->event_window = 0;
175 ev->modifiers = 0; /* FIXME: keep modifier around. */
176 ev->x = event.motion.x;
177 ev->y = event.motion.y;
178 ev->root.x = ev->x;
179 ev->root.y = ev->y;
180
181 /* Must set multi touch device to 0 or it will get ignored */
182 ev->multi.device = 0;
183 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
184 ev->multi.pressure = ev->multi.angle = 0;
185 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
186
187 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
188 break;
189 }
190 case SDL_MOUSEBUTTONDOWN:
191 {
192 if (event.button.button == SDL_BUTTON_WHEELUP ||
193 event.button.button == SDL_BUTTON_WHEELDOWN)
194 {
195 Ecore_Event_Mouse_Wheel *ev;
196
197 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
198 if (!ev) return ;
199
200 ev->timestamp = time;
201 ev->window = 0;
202 ev->event_window = 0;
203 ev->modifiers = 0; /* FIXME: keep modifier around. */
204 ev->direction = 0;
205 ev->z = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1;
206
207 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
208 }
209 else
210 {
211 Ecore_Event_Mouse_Button *ev;
212
213 ev = malloc(sizeof(Ecore_Event_Mouse_Button));
214 if (!ev) return ;
215
216 ev->timestamp = time;
217 ev->window = 0;
218 ev->event_window = 0;
219 ev->modifiers = 0; /* FIXME: keep modifier around. */
220 ev->buttons = event.button.button;
221 ev->double_click = 0;
222 ev->triple_click = 0;
223
224 /* Must set multi touch device to 0 or it will get ignored */
225 ev->multi.device = 0;
226 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
227 ev->multi.pressure = ev->multi.angle = 0;
228 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
229
230 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
231 }
232 break;
233 }
234 case SDL_MOUSEBUTTONUP:
235 {
236 Ecore_Event_Mouse_Button *ev;
237
238 ev = malloc(sizeof(Ecore_Event_Mouse_Button));
239 if (!ev) return ;
240 ev->timestamp = time;
241 ev->window = 0;
242 ev->event_window = 0;
243 ev->modifiers = 0; /* FIXME: keep modifier around. */
244 ev->buttons = event.button.button;
245 ev->double_click = 0;
246 ev->triple_click = 0;
247
248 /* Must set multi touch device to 0 or it will get ignored */
249 ev->multi.device = 0;
250 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
251 ev->multi.pressure = ev->multi.angle = 0;
252 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
253
254 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
255 break;
256 }
257 case SDL_VIDEORESIZE:
258 {
259 Ecore_Sdl_Event_Video_Resize *ev;
260
261 ev = malloc(sizeof (Ecore_Sdl_Event_Video_Resize));
262 ev->w = event.resize.w;
263 ev->h = event.resize.h;
264
265 ecore_event_add(ECORE_SDL_EVENT_RESIZE, ev, NULL, NULL);
266 break;
267 }
268 case SDL_VIDEOEXPOSE:
269 ecore_event_add(ECORE_SDL_EVENT_EXPOSE, NULL, NULL, NULL);
270 break;
271 case SDL_QUIT:
272 ecore_main_loop_quit();
273 break;
274
275 case SDL_KEYDOWN:
276 {
277 Ecore_SDL_Pressed *entry;
278 Ecore_Event_Key *ev;
279
280 entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym),
281 EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL);
282 if (entry)
283 {
284 ev = _ecore_sdl_event_key(&event, time);
285 if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
286 }
287
288 ev = _ecore_sdl_event_key(&event, time);
289 if (ev) ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
290
291 if (!entry)
292 {
293 entry = malloc(sizeof (Ecore_SDL_Pressed));
294 if (!entry) break;
295
296 entry->key = event.key.keysym.sym;
297
298 repeat = eina_rbtree_inline_insert(repeat, EINA_RBTREE_GET(entry),
299 EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL);
300 }
301 break;
302 }
303 case SDL_KEYUP:
304 {
305 Ecore_Event_Key *ev;
306 Ecore_SDL_Pressed *entry;
307
308 entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym),
309 EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL);
310 if (entry)
311 {
312 repeat = eina_rbtree_inline_remove(repeat, EINA_RBTREE_GET(entry),
313 EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL);
314 free(entry);
315 }
316
317 ev = _ecore_sdl_event_key(&event, time);
318 if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
319 break;
320 }
321 case SDL_ACTIVEEVENT:
322 /* FIXME: Focus gain. */
323 break;
324 case SDL_SYSWMEVENT:
325 case SDL_USEREVENT:
326 case SDL_JOYAXISMOTION:
327 case SDL_JOYBALLMOTION:
328 case SDL_JOYHATMOTION:
329 case SDL_JOYBUTTONDOWN:
330 case SDL_JOYBUTTONUP:
331 default:
332 break;
333 }
334 }
335}
diff --git a/libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h b/libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h
deleted file mode 100644
index 37e9570..0000000
--- a/libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ECORE_SDL_PRIVATE_H
2# define _ECORE_SDL_PRIVATE_H
3
4extern int _ecore_sdl_log_dom;
5
6# ifdef ECORE_SDL_DEFAULT_LOG_COLOR
7# undef ECORE_SDL_DEFAULT_LOG_COLOR
8# endif
9# define ECORE_SDL_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
10
11# ifdef ERR
12# undef ERR
13# endif
14# define ERR(...) EINA_LOG_DOM_ERR(_ecore_sdl_log_dom, __VA_ARGS__)
15
16# ifdef DBG
17# undef DBG
18# endif
19# define DBG(...) EINA_LOG_DOM_DBG(_ecore_sdl_log_dom, __VA_ARGS__)
20
21# ifdef INF
22# undef INF
23# endif
24# define INF(...) EINA_LOG_DOM_INFO(_ecore_sdl_log_dom, __VA_ARGS__)
25
26# ifdef WRN
27# undef WRN
28# endif
29# define WRN(...) EINA_LOG_DOM_WARN(_ecore_sdl_log_dom, __VA_ARGS__)
30
31# ifdef CRIT
32# undef CRIT
33# endif
34# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_sdl_log_dom, __VA_ARGS__)
35
36#endif
diff --git a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
deleted file mode 100644
index 7dab37c..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
+++ /dev/null
@@ -1,304 +0,0 @@
1#ifndef _ECORE_WAYLAND_H_
2# define _ECORE_WAYLAND_H_
3
4# define GL_GLEXT_PROTOTYPES
5
6# include <Eina.h>
7# include <wayland-client.h>
8# include <wayland-egl.h> // NB: already includes wayland-client.h
9# include <EGL/egl.h>
10# include <EGL/eglext.h>
11
12# ifdef EAPI
13# undef EAPI
14# endif
15
16# ifdef __GNUC__
17# if __GNUC__ >= 4
18# define EAPI __attribute__ ((visibility("default")))
19# else
20# define EAPI
21# endif
22# else
23# define EAPI
24# endif
25
26typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
27typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
28
29typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
30typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
31typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
32# ifndef _ECORE_WAYLAND_WINDOW_PREDEF
33typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
34# endif
35typedef struct _Ecore_Wl_Dnd_Source Ecore_Wl_Dnd_Source;
36typedef struct _Ecore_Wl_Dnd_Target Ecore_Wl_Dnd_Target;
37
38typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In;
39typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out;
40typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In;
41typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out;
42typedef struct _Ecore_Wl_Event_Window_Configure Ecore_Wl_Event_Window_Configure;
43typedef struct _Ecore_Wl_Event_Dnd_Enter Ecore_Wl_Event_Dnd_Enter;
44typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position;
45typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave;
46typedef struct _Ecore_Wl_Event_Dnd_Drop Ecore_Wl_Event_Dnd_Drop;
47typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound;
48
49enum _Ecore_Wl_Window_Type
50{
51 ECORE_WL_WINDOW_TYPE_TOPLEVEL,
52 ECORE_WL_WINDOW_TYPE_FULLSCREEN,
53 ECORE_WL_WINDOW_TYPE_MAXIMIZED,
54 ECORE_WL_WINDOW_TYPE_TRANSIENT,
55 ECORE_WL_WINDOW_TYPE_MENU,
56 ECORE_WL_WINDOW_TYPE_CUSTOM
57};
58
59enum _Ecore_Wl_Window_Buffer_Type
60{
61 ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW,
62 ECORE_WL_WINDOW_BUFFER_TYPE_EGL_IMAGE,
63 ECORE_WL_WINDOW_BUFFER_TYPE_SHM
64};
65
66struct _Ecore_Wl_Display
67{
68 struct
69 {
70 struct wl_display *display;
71 struct wl_compositor *compositor;
72 struct wl_shell *shell;
73 struct wl_shm *shm;
74 struct wl_data_device_manager *data_device_manager;
75 } wl;
76
77 struct
78 {
79 EGLDisplay display;
80 EGLConfig rgb_config;
81 EGLConfig argb_config;
82 EGLContext rgb_context;
83 EGLContext argb_context;
84 } egl;
85
86 int fd;
87 unsigned int mask;
88 Ecore_Fd_Handler *fd_hdl;
89
90 struct wl_list inputs;
91 struct wl_list outputs;
92
93 struct xkb_desc *xkb;
94
95 Ecore_Wl_Output *output;
96
97 PFNEGLCREATEIMAGEKHRPROC create_image;
98 PFNEGLDESTROYIMAGEKHRPROC destroy_image;
99
100 void (*output_configure)(Ecore_Wl_Output *output, void *data);
101 void *data;
102};
103
104struct _Ecore_Wl_Output
105{
106 Ecore_Wl_Display *display;
107 struct wl_output *output;
108 Eina_Rectangle allocation;
109 struct wl_list link;
110
111 void (*destroy) (Ecore_Wl_Output *output, void *data);
112 void *data;
113};
114
115struct _Ecore_Wl_Input
116{
117 Ecore_Wl_Display *display;
118 struct wl_input_device *input_device;
119 struct wl_data_device *data_device;
120
121 Ecore_Wl_Window *pointer_focus;
122 Ecore_Wl_Window *keyboard_focus;
123
124 unsigned int button;
125 unsigned int timestamp;
126 unsigned int modifiers;
127 int sx, sy;
128
129 struct wl_list link;
130
131 /* TODO: grab */
132 unsigned int grab_button;
133
134 Ecore_Wl_Dnd_Source *drag_source;
135 Ecore_Wl_Dnd_Source *selection_source;
136};
137
138struct _Ecore_Wl_Window
139{
140 Ecore_Wl_Display *display;
141 Ecore_Wl_Window *parent;
142
143 struct wl_surface *surface;
144 struct wl_shell_surface *shell_surface;
145
146 int id;
147 int x, y;
148 int edges;
149
150 Eina_Rectangle allocation, pending_allocation;
151 Eina_Rectangle saved_allocation, server_allocation;
152
153 /* Eina_Bool redraw_scheduled : 1; */
154 /* Eina_Bool resize_scheduled : 1; */
155 Eina_Bool transparent : 1;
156
157 Ecore_Wl_Window_Type type;
158 Ecore_Wl_Window_Buffer_Type buffer_type;
159
160 Ecore_Wl_Input *pointer_device;
161 Ecore_Wl_Input *keyboard_device;
162
163 void *data;
164};
165
166struct _Ecore_Wl_Event_Mouse_In
167{
168 int modifiers;
169 int x, y;
170 struct
171 {
172 int x, y;
173 } root;
174 unsigned int win;
175 unsigned int event_win;
176 unsigned int root_win;
177 unsigned int timestamp;
178};
179
180struct _Ecore_Wl_Event_Mouse_Out
181{
182 int modifiers;
183 int x, y;
184 struct
185 {
186 int x, y;
187 } root;
188 unsigned int win;
189 unsigned int event_win;
190 unsigned int root_win;
191 unsigned int timestamp;
192};
193
194struct _Ecore_Wl_Event_Focus_In
195{
196 unsigned int win;
197 unsigned int timestamp;
198};
199
200struct _Ecore_Wl_Event_Focus_Out
201{
202 unsigned int win;
203 unsigned int timestamp;
204};
205
206struct _Ecore_Wl_Event_Window_Configure
207{
208 unsigned int win;
209 unsigned int event_win;
210 int x, y, w, h;
211 unsigned int timestamp;
212};
213
214struct _Ecore_Wl_Event_Dnd_Enter
215{
216 unsigned int win, source;
217 char **types;
218 int num_types;
219 struct
220 {
221 int x, y;
222 } position;
223};
224
225struct _Ecore_Wl_Event_Dnd_Position
226{
227 unsigned int win, source;
228 struct
229 {
230 int x, y;
231 } position;
232};
233
234struct _Ecore_Wl_Event_Dnd_Leave
235{
236 unsigned int win, source;
237};
238
239struct _Ecore_Wl_Event_Dnd_Drop
240{
241 unsigned int win, source;
242 struct
243 {
244 int x, y;
245 } position;
246};
247
248struct _Ecore_Wl_Event_Interfaces_Bound
249{
250 Eina_Bool compositor : 1;
251 Eina_Bool shm : 1;
252 Eina_Bool shell : 1;
253};
254
255/**
256 * @file
257 * @brief Ecore functions for dealing with the Wayland window system
258 *
259 * Ecore_Wl provides a wrapper and convenience functions for using the
260 * Wayland window system. Function groups for this part of the library
261 * include the following:
262 *
263 * @li @ref Ecore_Wl_Init_Group
264 * @li @ref Ecore_Wl_Display_Group
265 * @li @ref Ecore_Wl_Flush_Group
266 * @li @ref Ecore_Wl_Window_Group
267 */
268
269EAPI extern int ECORE_WL_EVENT_MOUSE_IN;
270EAPI extern int ECORE_WL_EVENT_MOUSE_OUT;
271EAPI extern int ECORE_WL_EVENT_FOCUS_IN;
272EAPI extern int ECORE_WL_EVENT_FOCUS_OUT;
273EAPI extern int ECORE_WL_EVENT_WINDOW_CONFIGURE;
274EAPI extern int ECORE_WL_EVENT_DND_ENTER;
275EAPI extern int ECORE_WL_EVENT_DND_POSITION;
276EAPI extern int ECORE_WL_EVENT_DND_LEAVE;
277EAPI extern int ECORE_WL_EVENT_DND_DROP;
278EAPI extern int ECORE_WL_EVENT_INTERFACES_BOUND;
279
280EAPI int ecore_wl_init(const char *name);
281EAPI int ecore_wl_shutdown(void);
282EAPI void ecore_wl_flush(void);
283EAPI void ecore_wl_sync(void);
284EAPI struct wl_shm *ecore_wl_shm_get(void);
285EAPI struct wl_display *ecore_wl_display_get(void);
286EAPI void ecore_wl_screen_size_get(int *w, int *h);
287EAPI void ecore_wl_pointer_xy_get(int *x, int *y);
288
289EAPI Ecore_Wl_Window *ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type);
290EAPI void ecore_wl_window_free(Ecore_Wl_Window *win);
291EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y);
292EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location);
293EAPI void ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h);
294EAPI void ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y);
295EAPI void ecore_wl_window_show(Ecore_Wl_Window *win);
296EAPI void ecore_wl_window_hide(Ecore_Wl_Window *win);
297EAPI void ecore_wl_window_raise(Ecore_Wl_Window *win);
298EAPI void ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized);
299EAPI void ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen);
300EAPI void ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h);
301EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win);
302EAPI Ecore_Wl_Window *ecore_wl_window_find(unsigned int id);
303
304#endif
diff --git a/libraries/ecore/src/lib/ecore_wayland/Makefile.am b/libraries/ecore/src/lib/ecore_wayland/Makefile.am
deleted file mode 100644
index f6b801d..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_input \
6-I$(top_builddir)/src/lib/ecore \
7-I$(top_builddir)/src/lib/ecore_input \
8@WAYLAND_CFLAGS@ \
9@EVAS_CFLAGS@ \
10@EINA_CFLAGS@
11
12lib_LTLIBRARIES = libecore_wayland.la
13includes_HEADERS = Ecore_Wayland.h
14includesdir = $(includedir)/ecore-@VMAJ@
15
16libecore_wayland_la_SOURCES = \
17ecore_wl.c \
18ecore_wl_output.c \
19ecore_wl_input.c \
20ecore_wl_window.c \
21ecore_wl_dnd.c
22
23libecore_wayland_la_LIBADD = \
24$(top_builddir)/src/lib/ecore/libecore.la \
25$(top_builddir)/src/lib/ecore_input/libecore_input.la \
26@WAYLAND_LIBS@ \
27@EVAS_LIBS@ \
28@EINA_LIBS@
29
30libecore_wayland_la_LDFLAGS = -version-info @version_info@ @release_info@
31libecore_wayland_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la
32
33EXTRA_DIST = ecore_wl_private.h
diff --git a/libraries/ecore/src/lib/ecore_wayland/Makefile.in b/libraries/ecore/src/lib/ecore_wayland/Makefile.in
deleted file mode 100644
index 39c633d..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/Makefile.in
+++ /dev/null
@@ -1,842 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_wayland
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88am_libecore_wayland_la_OBJECTS = ecore_wl.lo ecore_wl_output.lo \
89 ecore_wl_input.lo ecore_wl_window.lo ecore_wl_dnd.lo
90libecore_wayland_la_OBJECTS = $(am_libecore_wayland_la_OBJECTS)
91AM_V_lt = $(am__v_lt_$(V))
92am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
93am__v_lt_0 = --silent
94libecore_wayland_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
95 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
96 $(AM_CFLAGS) $(CFLAGS) $(libecore_wayland_la_LDFLAGS) \
97 $(LDFLAGS) -o $@
98DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
99depcomp = $(SHELL) $(top_srcdir)/depcomp
100am__depfiles_maybe = depfiles
101am__mv = mv -f
102COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
103 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
104LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
105 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
106 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
107 $(AM_CFLAGS) $(CFLAGS)
108AM_V_CC = $(am__v_CC_$(V))
109am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
110am__v_CC_0 = @echo " CC " $@;
111AM_V_at = $(am__v_at_$(V))
112am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
113am__v_at_0 = @
114CCLD = $(CC)
115LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
116 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
117 $(AM_LDFLAGS) $(LDFLAGS) -o $@
118AM_V_CCLD = $(am__v_CCLD_$(V))
119am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
120am__v_CCLD_0 = @echo " CCLD " $@;
121AM_V_GEN = $(am__v_GEN_$(V))
122am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
123am__v_GEN_0 = @echo " GEN " $@;
124SOURCES = $(libecore_wayland_la_SOURCES)
125DIST_SOURCES = $(libecore_wayland_la_SOURCES)
126HEADERS = $(includes_HEADERS)
127ETAGS = etags
128CTAGS = ctags
129DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
130ACLOCAL = @ACLOCAL@
131ALLOCA = @ALLOCA@
132AMTAR = @AMTAR@
133AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
134AR = @AR@
135AS = @AS@
136AUTOCONF = @AUTOCONF@
137AUTOHEADER = @AUTOHEADER@
138AUTOMAKE = @AUTOMAKE@
139AWK = @AWK@
140CARES_CFLAGS = @CARES_CFLAGS@
141CARES_LIBS = @CARES_LIBS@
142CC = @CC@
143CCDEPMODE = @CCDEPMODE@
144CFLAGS = @CFLAGS@
145CHECK_CFLAGS = @CHECK_CFLAGS@
146CHECK_LIBS = @CHECK_LIBS@
147CPP = @CPP@
148CPPFLAGS = @CPPFLAGS@
149CURL_CFLAGS = @CURL_CFLAGS@
150CURL_LIBS = @CURL_LIBS@
151CXX = @CXX@
152CXXCPP = @CXXCPP@
153CXXDEPMODE = @CXXDEPMODE@
154CXXFLAGS = @CXXFLAGS@
155CYGPATH_W = @CYGPATH_W@
156DEFS = @DEFS@
157DEPDIR = @DEPDIR@
158DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
159DIRECTFB_LIBS = @DIRECTFB_LIBS@
160DLLTOOL = @DLLTOOL@
161DSYMUTIL = @DSYMUTIL@
162DUMPBIN = @DUMPBIN@
163ECHO_C = @ECHO_C@
164ECHO_N = @ECHO_N@
165ECHO_T = @ECHO_T@
166ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
167ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
168EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
169EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
170EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
171EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
172EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
173EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
174EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
175EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
176EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
177EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
178EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
179EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
180EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
181EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
182EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
183EGREP = @EGREP@
184EINA_CFLAGS = @EINA_CFLAGS@
185EINA_LIBS = @EINA_LIBS@
186ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
187ESCAPE_LIBS = @ESCAPE_LIBS@
188EVAS_CFLAGS = @EVAS_CFLAGS@
189EVAS_LIBS = @EVAS_LIBS@
190EVIL_CFLAGS = @EVIL_CFLAGS@
191EVIL_LIBS = @EVIL_LIBS@
192EXEEXT = @EXEEXT@
193EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
194EXOTIC_LIBS = @EXOTIC_LIBS@
195FGREP = @FGREP@
196GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
197GLIB_CFLAGS = @GLIB_CFLAGS@
198GLIB_LIBS = @GLIB_LIBS@
199GMSGFMT = @GMSGFMT@
200GMSGFMT_015 = @GMSGFMT_015@
201GREP = @GREP@
202INSTALL = @INSTALL@
203INSTALL_DATA = @INSTALL_DATA@
204INSTALL_PROGRAM = @INSTALL_PROGRAM@
205INSTALL_SCRIPT = @INSTALL_SCRIPT@
206INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
207INTLLIBS = @INTLLIBS@
208INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
209KEYSYMDEFS = @KEYSYMDEFS@
210LD = @LD@
211LDFLAGS = @LDFLAGS@
212LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
213LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
214LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
215LIBICONV = @LIBICONV@
216LIBINTL = @LIBINTL@
217LIBOBJS = @LIBOBJS@
218LIBS = @LIBS@
219LIBTOOL = @LIBTOOL@
220LIPO = @LIPO@
221LN_S = @LN_S@
222LTLIBICONV = @LTLIBICONV@
223LTLIBINTL = @LTLIBINTL@
224LTLIBOBJS = @LTLIBOBJS@
225MAKEINFO = @MAKEINFO@
226MKDIR_P = @MKDIR_P@
227MSGFMT = @MSGFMT@
228MSGFMT_015 = @MSGFMT_015@
229MSGMERGE = @MSGMERGE@
230NM = @NM@
231NMEDIT = @NMEDIT@
232OBJC = @OBJC@
233OBJCDEPMODE = @OBJCDEPMODE@
234OBJCFLAGS = @OBJCFLAGS@
235OBJDUMP = @OBJDUMP@
236OBJEXT = @OBJEXT@
237OTOOL = @OTOOL@
238OTOOL64 = @OTOOL64@
239PACKAGE = @PACKAGE@
240PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
241PACKAGE_NAME = @PACKAGE_NAME@
242PACKAGE_STRING = @PACKAGE_STRING@
243PACKAGE_TARNAME = @PACKAGE_TARNAME@
244PACKAGE_URL = @PACKAGE_URL@
245PACKAGE_VERSION = @PACKAGE_VERSION@
246PATH_SEPARATOR = @PATH_SEPARATOR@
247PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
248PIXMAN_LIBS = @PIXMAN_LIBS@
249PKG_CONFIG = @PKG_CONFIG@
250PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
251PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
252POSUB = @POSUB@
253RANLIB = @RANLIB@
254SCIM_CFLAGS = @SCIM_CFLAGS@
255SCIM_LIBS = @SCIM_LIBS@
256SDL_CFLAGS = @SDL_CFLAGS@
257SDL_CONFIG = @SDL_CONFIG@
258SDL_LIBS = @SDL_LIBS@
259SED = @SED@
260SET_MAKE = @SET_MAKE@
261SHELL = @SHELL@
262SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
263SSL_CFLAGS = @SSL_CFLAGS@
264SSL_LIBS = @SSL_LIBS@
265STRIP = @STRIP@
266TLS2_CFLAGS = @TLS2_CFLAGS@
267TLS2_LIBS = @TLS2_LIBS@
268TLS_CFLAGS = @TLS_CFLAGS@
269TLS_LIBS = @TLS_LIBS@
270TSLIB_CFLAGS = @TSLIB_CFLAGS@
271TSLIB_LIBS = @TSLIB_LIBS@
272USE_NLS = @USE_NLS@
273VERSION = @VERSION@
274VMAJ = @VMAJ@
275WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
276WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
277WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
278WAYLAND_LIBS = @WAYLAND_LIBS@
279WIN32_CFLAGS = @WIN32_CFLAGS@
280WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
281WIN32_LIBS = @WIN32_LIBS@
282XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
283XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
284XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
285XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
286XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
287XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
288XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
289XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
290XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
291XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
292XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
293XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
294XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
295XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
296XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
297XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
298XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
299XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
300XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
301XCB_X11_LIBS = @XCB_X11_LIBS@
302XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
303XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
304XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
305XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
306XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
307XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
308XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
309XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
310XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
311XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
312XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
313XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
314XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
315XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
316XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
317XDAMAGE_LIBS = @XDAMAGE_LIBS@
318XDPMS_CFLAGS = @XDPMS_CFLAGS@
319XDPMS_LIBS = @XDPMS_LIBS@
320XFIXES_CFLAGS = @XFIXES_CFLAGS@
321XFIXES_LIBS = @XFIXES_LIBS@
322XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
323XGESTURE_LIBS = @XGESTURE_LIBS@
324XGETTEXT = @XGETTEXT@
325XGETTEXT_015 = @XGETTEXT_015@
326XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
327XI2_CFLAGS = @XI2_CFLAGS@
328XI2_LIBS = @XI2_LIBS@
329XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
330XINERAMA_LIBS = @XINERAMA_LIBS@
331XKB_CFLAGS = @XKB_CFLAGS@
332XKB_LIBS = @XKB_LIBS@
333XMKMF = @XMKMF@
334XPRINT_CFLAGS = @XPRINT_CFLAGS@
335XPRINT_LIBS = @XPRINT_LIBS@
336XRANDR_CFLAGS = @XRANDR_CFLAGS@
337XRANDR_LIBS = @XRANDR_LIBS@
338XRENDER_CFLAGS = @XRENDER_CFLAGS@
339XRENDER_LIBS = @XRENDER_LIBS@
340XSS_CFLAGS = @XSS_CFLAGS@
341XSS_LIBS = @XSS_LIBS@
342XTEST_CFLAGS = @XTEST_CFLAGS@
343XTEST_LIBS = @XTEST_LIBS@
344X_CFLAGS = @X_CFLAGS@
345X_EXTRA_LIBS = @X_EXTRA_LIBS@
346X_LIBS = @X_LIBS@
347X_PRE_LIBS = @X_PRE_LIBS@
348Xcursor_cflags = @Xcursor_cflags@
349Xcursor_libs = @Xcursor_libs@
350abs_builddir = @abs_builddir@
351abs_srcdir = @abs_srcdir@
352abs_top_builddir = @abs_top_builddir@
353abs_top_srcdir = @abs_top_srcdir@
354ac_ct_CC = @ac_ct_CC@
355ac_ct_CXX = @ac_ct_CXX@
356ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
357ac_ct_OBJC = @ac_ct_OBJC@
358am__include = @am__include@
359am__leading_dot = @am__leading_dot@
360am__quote = @am__quote@
361am__tar = @am__tar@
362am__untar = @am__untar@
363bindir = @bindir@
364build = @build@
365build_alias = @build_alias@
366build_cpu = @build_cpu@
367build_os = @build_os@
368build_vendor = @build_vendor@
369builddir = @builddir@
370cocoa_ldflags = @cocoa_ldflags@
371datadir = @datadir@
372datarootdir = @datarootdir@
373dlopen_libs = @dlopen_libs@
374docdir = @docdir@
375dvidir = @dvidir@
376ecore_cocoa_cflags = @ecore_cocoa_cflags@
377ecore_cocoa_libs = @ecore_cocoa_libs@
378ecore_con_cflags = @ecore_con_cflags@
379ecore_con_libs = @ecore_con_libs@
380ecore_directfb_cflags = @ecore_directfb_cflags@
381ecore_directfb_libs = @ecore_directfb_libs@
382ecore_evas_cflags = @ecore_evas_cflags@
383ecore_evas_libs = @ecore_evas_libs@
384ecore_fb_cflags = @ecore_fb_cflags@
385ecore_fb_libs = @ecore_fb_libs@
386ecore_file_cflags = @ecore_file_cflags@
387ecore_file_libs = @ecore_file_libs@
388ecore_imf_cflags = @ecore_imf_cflags@
389ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
390ecore_imf_evas_libs = @ecore_imf_evas_libs@
391ecore_imf_libs = @ecore_imf_libs@
392ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
393ecore_imf_scim_libs = @ecore_imf_scim_libs@
394ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
395ecore_imf_xim_libs = @ecore_imf_xim_libs@
396ecore_input_cflags = @ecore_input_cflags@
397ecore_input_evas_cflags = @ecore_input_evas_cflags@
398ecore_input_evas_libs = @ecore_input_evas_libs@
399ecore_input_libs = @ecore_input_libs@
400ecore_ipc_cflags = @ecore_ipc_cflags@
401ecore_ipc_libs = @ecore_ipc_libs@
402ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
403ecore_psl1ght_libs = @ecore_psl1ght_libs@
404ecore_sdl_cflags = @ecore_sdl_cflags@
405ecore_sdl_libs = @ecore_sdl_libs@
406ecore_wayland_cflags = @ecore_wayland_cflags@
407ecore_wayland_libs = @ecore_wayland_libs@
408ecore_win32_cflags = @ecore_win32_cflags@
409ecore_win32_libs = @ecore_win32_libs@
410ecore_wince_cflags = @ecore_wince_cflags@
411ecore_wince_libs = @ecore_wince_libs@
412ecore_x_cflags = @ecore_x_cflags@
413ecore_x_libs = @ecore_x_libs@
414ecore_x_libs_private = @ecore_x_libs_private@
415efl_doxygen = @efl_doxygen@
416efl_have_doxygen = @efl_have_doxygen@
417exec_prefix = @exec_prefix@
418have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
419host = @host@
420host_alias = @host_alias@
421host_cpu = @host_cpu@
422host_os = @host_os@
423host_vendor = @host_vendor@
424htmldir = @htmldir@
425includedir = @includedir@
426infodir = @infodir@
427install_sh = @install_sh@
428libdir = @libdir@
429libexecdir = @libexecdir@
430localedir = @localedir@
431localstatedir = @localstatedir@
432lt_ECHO = @lt_ECHO@
433lt_enable_auto_import = @lt_enable_auto_import@
434mandir = @mandir@
435mkdir_p = @mkdir_p@
436oldincludedir = @oldincludedir@
437pdfdir = @pdfdir@
438pkgconfig_requires_private = @pkgconfig_requires_private@
439prefix = @prefix@
440program_transform_name = @program_transform_name@
441psdir = @psdir@
442release_info = @release_info@
443requirements_ecore = @requirements_ecore@
444requirements_ecore_cocoa = @requirements_ecore_cocoa@
445requirements_ecore_con = @requirements_ecore_con@
446requirements_ecore_directfb = @requirements_ecore_directfb@
447requirements_ecore_evas = @requirements_ecore_evas@
448requirements_ecore_fb = @requirements_ecore_fb@
449requirements_ecore_file = @requirements_ecore_file@
450requirements_ecore_imf = @requirements_ecore_imf@
451requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
452requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
453requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
454requirements_ecore_input = @requirements_ecore_input@
455requirements_ecore_input_evas = @requirements_ecore_input_evas@
456requirements_ecore_ipc = @requirements_ecore_ipc@
457requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
458requirements_ecore_sdl = @requirements_ecore_sdl@
459requirements_ecore_wayland = @requirements_ecore_wayland@
460requirements_ecore_win32 = @requirements_ecore_win32@
461requirements_ecore_wince = @requirements_ecore_wince@
462requirements_ecore_x = @requirements_ecore_x@
463rt_libs = @rt_libs@
464sbindir = @sbindir@
465sharedstatedir = @sharedstatedir@
466srcdir = @srcdir@
467sysconfdir = @sysconfdir@
468target_alias = @target_alias@
469top_build_prefix = @top_build_prefix@
470top_builddir = @top_builddir@
471top_srcdir = @top_srcdir@
472version_info = @version_info@
473x_cflags = @x_cflags@
474x_includes = @x_includes@
475x_libs = @x_libs@
476MAINTAINERCLEANFILES = Makefile.in
477AM_CPPFLAGS = \
478-I$(top_srcdir)/src/lib/ecore \
479-I$(top_srcdir)/src/lib/ecore_input \
480-I$(top_builddir)/src/lib/ecore \
481-I$(top_builddir)/src/lib/ecore_input \
482@WAYLAND_CFLAGS@ \
483@EVAS_CFLAGS@ \
484@EINA_CFLAGS@
485
486lib_LTLIBRARIES = libecore_wayland.la
487includes_HEADERS = Ecore_Wayland.h
488includesdir = $(includedir)/ecore-@VMAJ@
489libecore_wayland_la_SOURCES = \
490ecore_wl.c \
491ecore_wl_output.c \
492ecore_wl_input.c \
493ecore_wl_window.c \
494ecore_wl_dnd.c
495
496libecore_wayland_la_LIBADD = \
497$(top_builddir)/src/lib/ecore/libecore.la \
498$(top_builddir)/src/lib/ecore_input/libecore_input.la \
499@WAYLAND_LIBS@ \
500@EVAS_LIBS@ \
501@EINA_LIBS@
502
503libecore_wayland_la_LDFLAGS = -version-info @version_info@ @release_info@
504libecore_wayland_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la
505EXTRA_DIST = ecore_wl_private.h
506all: all-am
507
508.SUFFIXES:
509.SUFFIXES: .c .lo .o .obj
510$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
511 @for dep in $?; do \
512 case '$(am__configure_deps)' in \
513 *$$dep*) \
514 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
515 && { if test -f $@; then exit 0; else break; fi; }; \
516 exit 1;; \
517 esac; \
518 done; \
519 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_wayland/Makefile'; \
520 $(am__cd) $(top_srcdir) && \
521 $(AUTOMAKE) --gnu src/lib/ecore_wayland/Makefile
522.PRECIOUS: Makefile
523Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
524 @case '$?' in \
525 *config.status*) \
526 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
527 *) \
528 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
529 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
530 esac;
531
532$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
533 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
534
535$(top_srcdir)/configure: $(am__configure_deps)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537$(ACLOCAL_M4): $(am__aclocal_m4_deps)
538 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
539$(am__aclocal_m4_deps):
540install-libLTLIBRARIES: $(lib_LTLIBRARIES)
541 @$(NORMAL_INSTALL)
542 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
543 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
544 list2=; for p in $$list; do \
545 if test -f $$p; then \
546 list2="$$list2 $$p"; \
547 else :; fi; \
548 done; \
549 test -z "$$list2" || { \
550 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
551 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
552 }
553
554uninstall-libLTLIBRARIES:
555 @$(NORMAL_UNINSTALL)
556 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
557 for p in $$list; do \
558 $(am__strip_dir) \
559 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
560 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
561 done
562
563clean-libLTLIBRARIES:
564 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
565 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
566 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
567 test "$$dir" != "$$p" || dir=.; \
568 echo "rm -f \"$${dir}/so_locations\""; \
569 rm -f "$${dir}/so_locations"; \
570 done
571libecore_wayland.la: $(libecore_wayland_la_OBJECTS) $(libecore_wayland_la_DEPENDENCIES)
572 $(AM_V_CCLD)$(libecore_wayland_la_LINK) -rpath $(libdir) $(libecore_wayland_la_OBJECTS) $(libecore_wayland_la_LIBADD) $(LIBS)
573
574mostlyclean-compile:
575 -rm -f *.$(OBJEXT)
576
577distclean-compile:
578 -rm -f *.tab.c
579
580@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl.Plo@am__quote@
581@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_dnd.Plo@am__quote@
582@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_input.Plo@am__quote@
583@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_output.Plo@am__quote@
584@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_window.Plo@am__quote@
585
586.c.o:
587@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
588@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
589@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
590@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
591@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
592@am__fastdepCC_FALSE@ $(COMPILE) -c $<
593
594.c.obj:
595@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
596@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
597@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
598@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
599@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
600@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
601
602.c.lo:
603@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
604@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
605@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
606@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
607@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
608@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
609
610mostlyclean-libtool:
611 -rm -f *.lo
612
613clean-libtool:
614 -rm -rf .libs _libs
615install-includesHEADERS: $(includes_HEADERS)
616 @$(NORMAL_INSTALL)
617 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
618 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
619 for p in $$list; do \
620 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
621 echo "$$d$$p"; \
622 done | $(am__base_list) | \
623 while read files; do \
624 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
625 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
626 done
627
628uninstall-includesHEADERS:
629 @$(NORMAL_UNINSTALL)
630 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
631 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
632 test -n "$$files" || exit 0; \
633 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
634 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
635
636ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
637 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
638 unique=`for i in $$list; do \
639 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
640 done | \
641 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
642 END { if (nonempty) { for (i in files) print i; }; }'`; \
643 mkid -fID $$unique
644tags: TAGS
645
646TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
647 $(TAGS_FILES) $(LISP)
648 set x; \
649 here=`pwd`; \
650 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
651 unique=`for i in $$list; do \
652 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
653 done | \
654 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
655 END { if (nonempty) { for (i in files) print i; }; }'`; \
656 shift; \
657 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
658 test -n "$$unique" || unique=$$empty_fix; \
659 if test $$# -gt 0; then \
660 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
661 "$$@" $$unique; \
662 else \
663 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
664 $$unique; \
665 fi; \
666 fi
667ctags: CTAGS
668CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
669 $(TAGS_FILES) $(LISP)
670 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
671 unique=`for i in $$list; do \
672 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
673 done | \
674 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
675 END { if (nonempty) { for (i in files) print i; }; }'`; \
676 test -z "$(CTAGS_ARGS)$$unique" \
677 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
678 $$unique
679
680GTAGS:
681 here=`$(am__cd) $(top_builddir) && pwd` \
682 && $(am__cd) $(top_srcdir) \
683 && gtags -i $(GTAGS_ARGS) "$$here"
684
685distclean-tags:
686 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
687
688distdir: $(DISTFILES)
689 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
690 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
691 list='$(DISTFILES)'; \
692 dist_files=`for file in $$list; do echo $$file; done | \
693 sed -e "s|^$$srcdirstrip/||;t" \
694 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
695 case $$dist_files in \
696 */*) $(MKDIR_P) `echo "$$dist_files" | \
697 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
698 sort -u` ;; \
699 esac; \
700 for file in $$dist_files; do \
701 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
702 if test -d $$d/$$file; then \
703 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
704 if test -d "$(distdir)/$$file"; then \
705 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
706 fi; \
707 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
708 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
709 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
710 fi; \
711 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
712 else \
713 test -f "$(distdir)/$$file" \
714 || cp -p $$d/$$file "$(distdir)/$$file" \
715 || exit 1; \
716 fi; \
717 done
718check-am: all-am
719check: check-am
720all-am: Makefile $(LTLIBRARIES) $(HEADERS)
721installdirs:
722 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
723 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
724 done
725install: install-am
726install-exec: install-exec-am
727install-data: install-data-am
728uninstall: uninstall-am
729
730install-am: all-am
731 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
732
733installcheck: installcheck-am
734install-strip:
735 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
736 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
737 `test -z '$(STRIP)' || \
738 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
739mostlyclean-generic:
740
741clean-generic:
742
743distclean-generic:
744 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
745 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
746
747maintainer-clean-generic:
748 @echo "This command is intended for maintainers to use"
749 @echo "it deletes files that may require special tools to rebuild."
750 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
751clean: clean-am
752
753clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
754 mostlyclean-am
755
756distclean: distclean-am
757 -rm -rf ./$(DEPDIR)
758 -rm -f Makefile
759distclean-am: clean-am distclean-compile distclean-generic \
760 distclean-tags
761
762dvi: dvi-am
763
764dvi-am:
765
766html: html-am
767
768html-am:
769
770info: info-am
771
772info-am:
773
774install-data-am: install-includesHEADERS
775
776install-dvi: install-dvi-am
777
778install-dvi-am:
779
780install-exec-am: install-libLTLIBRARIES
781
782install-html: install-html-am
783
784install-html-am:
785
786install-info: install-info-am
787
788install-info-am:
789
790install-man:
791
792install-pdf: install-pdf-am
793
794install-pdf-am:
795
796install-ps: install-ps-am
797
798install-ps-am:
799
800installcheck-am:
801
802maintainer-clean: maintainer-clean-am
803 -rm -rf ./$(DEPDIR)
804 -rm -f Makefile
805maintainer-clean-am: distclean-am maintainer-clean-generic
806
807mostlyclean: mostlyclean-am
808
809mostlyclean-am: mostlyclean-compile mostlyclean-generic \
810 mostlyclean-libtool
811
812pdf: pdf-am
813
814pdf-am:
815
816ps: ps-am
817
818ps-am:
819
820uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
821
822.MAKE: install-am install-strip
823
824.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
825 clean-libLTLIBRARIES clean-libtool ctags distclean \
826 distclean-compile distclean-generic distclean-libtool \
827 distclean-tags distdir dvi dvi-am html html-am info info-am \
828 install install-am install-data install-data-am install-dvi \
829 install-dvi-am install-exec install-exec-am install-html \
830 install-html-am install-includesHEADERS install-info \
831 install-info-am install-libLTLIBRARIES install-man install-pdf \
832 install-pdf-am install-ps install-ps-am install-strip \
833 installcheck installcheck-am installdirs maintainer-clean \
834 maintainer-clean-generic mostlyclean mostlyclean-compile \
835 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
836 tags uninstall uninstall-am uninstall-includesHEADERS \
837 uninstall-libLTLIBRARIES
838
839
840# Tell versions [3.59,3.63) of GNU make to not export all variables.
841# Otherwise a system limit (for SysV at least) may be exceeded.
842.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c
deleted file mode 100644
index 5f1b20d..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c
+++ /dev/null
@@ -1,551 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <fcntl.h>
6
7/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ...
8 * What about other OSs ?? */
9#ifdef __linux__
10# include <linux/input.h>
11#else
12# define BTN_LEFT 0x110
13# define BTN_RIGHT 0x111
14# define BTN_MIDDLE 0x112
15# define BTN_SIDE 0x113
16# define BTN_EXTRA 0x114
17# define BTN_FORWARD 0x115
18# define BTN_BACK 0x116
19#endif
20
21#include "Ecore.h"
22#include "ecore_private.h"
23#include "Ecore_Input.h"
24#include "ecore_wl_private.h"
25#include "Ecore_Wayland.h"
26
27/* local function prototypes */
28static Eina_Bool _ecore_wl_shutdown(Eina_Bool close);
29static int _ecore_wl_cb_event_mask_update(unsigned int mask, void *data);
30static Eina_Bool _ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__);
31static void _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data);
32static Eina_Bool _ecore_wl_egl_init(Ecore_Wl_Display *ewd);
33static Eina_Bool _ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd);
34static Eina_Bool _ecore_wl_xkb_init(Ecore_Wl_Display *ewd);
35static Eina_Bool _ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd);
36
37/* local variables */
38static int _ecore_wl_init_count = 0;
39
40/* external variables */
41int _ecore_wl_log_dom = -1;
42Ecore_Wl_Display *_ecore_wl_disp = NULL;
43
44EAPI int ECORE_WL_EVENT_MOUSE_IN = 0;
45EAPI int ECORE_WL_EVENT_MOUSE_OUT = 0;
46EAPI int ECORE_WL_EVENT_FOCUS_IN = 0;
47EAPI int ECORE_WL_EVENT_FOCUS_OUT = 0;
48EAPI int ECORE_WL_EVENT_WINDOW_CONFIGURE = 0;
49EAPI int ECORE_WL_EVENT_DND_ENTER = 0;
50EAPI int ECORE_WL_EVENT_DND_POSITION = 0;
51EAPI int ECORE_WL_EVENT_DND_LEAVE = 0;
52EAPI int ECORE_WL_EVENT_DND_DROP = 0;
53EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0;
54
55/**
56 * @defgroup Ecore_Wl_Init_Group Wayland Library Init and Shutdown Functions
57 *
58 * Functions that start and shutdown the Ecore Wayland Library.
59 */
60
61/**
62 * Initialize the Wayland display connection to the given display.
63 *
64 * @param name Display target name. if @c NULL, the default display is
65 * assumed.
66 * @return The number of times the library has been initialized without being
67 * shut down. 0 is returned if an error occurs.
68 *
69 * @ingroup Ecore_Wl_Init_Group
70 */
71EAPI int
72ecore_wl_init(const char *name)
73{
74 LOGFN(__FILE__, __LINE__, __FUNCTION__);
75
76 if (++_ecore_wl_init_count != 1) return _ecore_wl_init_count;
77
78 if (!eina_init()) return --_ecore_wl_init_count;
79
80 _ecore_wl_log_dom =
81 eina_log_domain_register("ecore_wl", ECORE_WL_DEFAULT_LOG_COLOR);
82 if (_ecore_wl_log_dom < 0)
83 {
84 EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland");
85 eina_shutdown();
86 return --_ecore_wl_init_count;
87 }
88
89 if (!ecore_init())
90 {
91 ERR("Could not initialize ecore");
92 eina_log_domain_unregister(_ecore_wl_log_dom);
93 _ecore_wl_log_dom = -1;
94 eina_shutdown();
95 return --_ecore_wl_init_count;
96 }
97
98 if (!ecore_event_init())
99 {
100 ERR("Could not initialize ecore_event");
101 eina_log_domain_unregister(_ecore_wl_log_dom);
102 _ecore_wl_log_dom = -1;
103 ecore_shutdown();
104 eina_shutdown();
105 return --_ecore_wl_init_count;
106 }
107
108 if (!ECORE_WL_EVENT_MOUSE_IN)
109 {
110 ECORE_WL_EVENT_MOUSE_IN = ecore_event_type_new();
111 ECORE_WL_EVENT_MOUSE_OUT = ecore_event_type_new();
112 ECORE_WL_EVENT_FOCUS_IN = ecore_event_type_new();
113 ECORE_WL_EVENT_FOCUS_OUT = ecore_event_type_new();
114 ECORE_WL_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
115 ECORE_WL_EVENT_DND_ENTER = ecore_event_type_new();
116 ECORE_WL_EVENT_DND_POSITION = ecore_event_type_new();
117 ECORE_WL_EVENT_DND_LEAVE = ecore_event_type_new();
118 ECORE_WL_EVENT_DND_DROP = ecore_event_type_new();
119 ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new();
120 }
121
122 if (!(_ecore_wl_disp = malloc(sizeof(Ecore_Wl_Display))))
123 {
124 ERR("Could not allocate memory for Ecore_Wl_Display structure");
125 eina_log_domain_unregister(_ecore_wl_log_dom);
126 _ecore_wl_log_dom = -1;
127 ecore_event_shutdown();
128 ecore_shutdown();
129 eina_shutdown();
130 return --_ecore_wl_init_count;
131 }
132
133 memset(_ecore_wl_disp, 0, sizeof(Ecore_Wl_Display));
134
135 if (!(_ecore_wl_disp->wl.display = wl_display_connect(name)))
136 {
137 ERR("Could not connect to Wayland display");
138 eina_log_domain_unregister(_ecore_wl_log_dom);
139 _ecore_wl_log_dom = -1;
140 ecore_event_shutdown();
141 ecore_shutdown();
142 eina_shutdown();
143 return --_ecore_wl_init_count;
144 }
145
146 _ecore_wl_disp->fd =
147 wl_display_get_fd(_ecore_wl_disp->wl.display,
148 _ecore_wl_cb_event_mask_update, _ecore_wl_disp);
149
150 _ecore_wl_disp->fd_hdl =
151 ecore_main_fd_handler_add(_ecore_wl_disp->fd, ECORE_FD_READ,
152 _ecore_wl_cb_handle_data, _ecore_wl_disp,
153 NULL, NULL);
154
155 wl_list_init(&_ecore_wl_disp->inputs);
156 wl_list_init(&_ecore_wl_disp->outputs);
157
158 wl_display_add_global_listener(_ecore_wl_disp->wl.display,
159 _ecore_wl_cb_handle_global, _ecore_wl_disp);
160
161 /* FIXME: Process connection events ?? */
162 wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE);
163
164 /* if (!_ecore_wl_egl_init(_ecore_wl_disp)) */
165 /* { */
166 /* ERR("Could not initialize EGL"); */
167 /* free(_ecore_wl_disp); */
168 /* eina_log_domain_unregister(_ecore_wl_log_dom); */
169 /* _ecore_wl_log_dom = -1; */
170 /* ecore_event_shutdown(); */
171 /* ecore_shutdown(); */
172 /* eina_shutdown(); */
173 /* return --_ecore_wl_init_count; */
174 /* } */
175
176 /* _ecore_wl_disp->create_image = */
177 /* (void *)eglGetProcAddress("eglCreateImageKHR"); */
178 /* _ecore_wl_disp->destroy_image = */
179 /* (void *)eglGetProcAddress("eglDestroyImageKHR"); */
180
181 /* TODO: create pointer surfaces */
182
183 if (!_ecore_wl_xkb_init(_ecore_wl_disp))
184 {
185 ERR("Could not initialize XKB");
186 _ecore_wl_egl_shutdown(_ecore_wl_disp);
187 free(_ecore_wl_disp);
188 eina_log_domain_unregister(_ecore_wl_log_dom);
189 _ecore_wl_log_dom = -1;
190 ecore_event_shutdown();
191 ecore_shutdown();
192 eina_shutdown();
193 return --_ecore_wl_init_count;
194 }
195
196 _ecore_wl_window_init();
197
198 return _ecore_wl_init_count;
199}
200
201/**
202 * Shuts down the Ecore Wayland Library
203 *
204 * In shutting down the library, the Wayland display connection is terminated
205 * and any event handlers for it are removed.
206 *
207 * @return The number of times the library has been initialized without
208 * being shut down.
209 *
210 * @ingroup Ecore_Wl_Init_Group
211 */
212EAPI int
213ecore_wl_shutdown(void)
214{
215 LOGFN(__FILE__, __LINE__, __FUNCTION__);
216
217 return _ecore_wl_shutdown(EINA_TRUE);
218}
219
220/**
221 * @defgroup Ecore_Wl_Flush_Group Wayland Synchronization Functions
222 *
223 * Functions that ensure that all commands which have been issued by the
224 * Ecore Wayland library have been sent to the server.
225 */
226
227/**
228 * Sends all Wayland commands to the Wayland Display.
229 *
230 * @ingroup Ecore_Wl_Flush_Group
231 * @since 1.2
232 */
233EAPI void
234ecore_wl_flush(void)
235{
236 LOGFN(__FILE__, __LINE__, __FUNCTION__);
237
238 while (_ecore_wl_disp->mask & WL_DISPLAY_WRITABLE)
239 wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_WRITABLE);
240// wl_display_flush(_ecore_wl_disp->wl.display); // old flush code
241}
242
243/**
244 * Flushes the command buffer and waits until all requests have been
245 * processed by the server.
246 *
247 * @ingroup Ecore_Wl_Flush_Group
248 * @since 1.2
249 */
250EAPI void
251ecore_wl_sync(void)
252{
253 LOGFN(__FILE__, __LINE__, __FUNCTION__);
254
255 wl_display_roundtrip(_ecore_wl_disp->wl.display);
256 // old sync code
257// wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE);
258}
259
260/**
261 * @defgroup Ecore_Wl_Display_Group Wayland Display Functions
262 *
263 * Functions that set and retrieve various information about the Wayland Display.
264 */
265
266/**
267 * Retrieves the Wayland Shm Interface used for the current Wayland connection.
268 *
269 * @return The current wayland shm interface
270 *
271 * @ingroup Ecore_Wl_Display_Group
272 * @since 1.2
273 */
274EAPI struct wl_shm *
275ecore_wl_shm_get(void)
276{
277 return _ecore_wl_disp->wl.shm;
278}
279
280/**
281 * Retrieves the Wayland Display Interface used for the current Wayland connection.
282 *
283 * @return The current wayland display interface
284 *
285 * @ingroup Ecore_Wl_Display_Group
286 * @since 1.2
287 */
288EAPI struct wl_display *
289ecore_wl_display_get(void)
290{
291 return _ecore_wl_disp->wl.display;
292}
293
294/**
295 * Retrieves the size of the current screen.
296 *
297 * @param w where to return the width. May be NULL. Returns 0 on error.
298 * @param h where to return the height. May be NULL. Returns 0 on error.
299 *
300 * @ingroup Ecore_Wl_Display_Group
301 * @since 1.2
302 */
303EAPI void
304ecore_wl_screen_size_get(int *w, int *h)
305{
306 LOGFN(__FILE__, __LINE__, __FUNCTION__);
307
308 if (w) *w = _ecore_wl_disp->output->allocation.w;
309 if (h) *h = _ecore_wl_disp->output->allocation.h;
310}
311
312/* @since 1.2 */
313EAPI void
314ecore_wl_pointer_xy_get(int *x, int *y)
315{
316 LOGFN(__FILE__, __LINE__, __FUNCTION__);
317
318 _ecore_wl_input_pointer_xy_get(x, y);
319}
320
321/* local functions */
322static Eina_Bool
323_ecore_wl_shutdown(Eina_Bool close)
324{
325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
326
327 if (--_ecore_wl_init_count != 0) return _ecore_wl_init_count;
328 if (!_ecore_wl_disp) return _ecore_wl_init_count;
329
330 _ecore_wl_window_shutdown();
331
332 if (_ecore_wl_disp->fd_hdl)
333 ecore_main_fd_handler_del(_ecore_wl_disp->fd_hdl);
334
335 if (close)
336 {
337 Ecore_Wl_Output *out, *tout;
338 Ecore_Wl_Input *in, *tin;
339
340 wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link)
341 _ecore_wl_output_del(out);
342
343 wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link)
344 _ecore_wl_input_del(in);
345
346 _ecore_wl_xkb_shutdown(_ecore_wl_disp);
347 /* _ecore_wl_egl_shutdown(_ecore_wl_disp); */
348
349 if (_ecore_wl_disp->wl.shell)
350 wl_shell_destroy(_ecore_wl_disp->wl.shell);
351 if (_ecore_wl_disp->wl.shm) wl_shm_destroy(_ecore_wl_disp->wl.shm);
352 if (_ecore_wl_disp->wl.data_device_manager)
353 wl_data_device_manager_destroy(_ecore_wl_disp->wl.data_device_manager);
354 if (_ecore_wl_disp->wl.compositor)
355 wl_compositor_destroy(_ecore_wl_disp->wl.compositor);
356 if (_ecore_wl_disp->wl.display)
357 {
358 wl_display_flush(_ecore_wl_disp->wl.display);
359 wl_display_disconnect(_ecore_wl_disp->wl.display);
360 }
361 free(_ecore_wl_disp);
362 }
363
364 ecore_event_shutdown();
365 ecore_shutdown();
366
367 eina_log_domain_unregister(_ecore_wl_log_dom);
368 _ecore_wl_log_dom = -1;
369 eina_shutdown();
370
371 return _ecore_wl_init_count;
372}
373
374static int
375_ecore_wl_cb_event_mask_update(unsigned int mask, void *data)
376{
377 Ecore_Wl_Display *ewd;
378
379 LOGFN(__FILE__, __LINE__, __FUNCTION__);
380
381 ewd = data;
382 ewd->mask = mask;
383 return 0;
384}
385
386static Eina_Bool
387_ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
388{
389 Ecore_Wl_Display *ewd;
390
391 LOGFN(__FILE__, __LINE__, __FUNCTION__);
392
393 if (!(ewd = data)) return ECORE_CALLBACK_RENEW;
394 wl_display_iterate(ewd->wl.display, ewd->mask);
395 return ECORE_CALLBACK_RENEW;
396}
397
398static void
399_ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data)
400{
401 Ecore_Wl_Display *ewd;
402
403 LOGFN(__FILE__, __LINE__, __FUNCTION__);
404
405 if ((!strcmp(interface, "wl_display")) ||
406 (!strcmp(interface, "wl_drm")) ||
407 (!strcmp(interface, "desktop_shell")))
408 return;
409
410 ewd = data;
411
412 if (!strcmp(interface, "wl_compositor"))
413 ewd->wl.compositor = wl_display_bind(disp, id, &wl_compositor_interface);
414 else if (!strcmp(interface, "wl_output"))
415 _ecore_wl_output_add(ewd, id);
416 else if (!strcmp(interface, "wl_input_device"))
417 _ecore_wl_input_add(ewd, id);
418 else if (!strcmp(interface, "wl_shell"))
419 ewd->wl.shell = wl_display_bind(disp, id, &wl_shell_interface);
420 else if (!strcmp(interface, "wl_shm"))
421 ewd->wl.shm = wl_display_bind(disp, id, &wl_shm_interface);
422 else if (!strcmp(interface, "wl_data_device_manager"))
423 {
424 ewd->wl.data_device_manager =
425 wl_display_bind(disp, id, &wl_data_device_manager_interface);
426 }
427
428 if ((ewd->wl.compositor) && (ewd->wl.shm) && (ewd->wl.shell))
429 {
430 Ecore_Wl_Event_Interfaces_Bound *ev;
431
432 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Interfaces_Bound))))
433 return;
434
435 ev->compositor = (ewd->wl.compositor != NULL);
436 ev->shm = (ewd->wl.shm != NULL);
437 ev->shell = (ewd->wl.shell != NULL);
438
439 ecore_event_add(ECORE_WL_EVENT_INTERFACES_BOUND, ev, NULL, NULL);
440 }
441}
442
443static Eina_Bool
444_ecore_wl_egl_init(Ecore_Wl_Display *ewd)
445{
446 EGLint major, minor, n;
447 static const EGLint context_attribs[] =
448 {
449 EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE
450 };
451 static const EGLint argb_attribs[] =
452 {
453 EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
454 EGL_ALPHA_SIZE, 1, EGL_DEPTH_SIZE, 0, EGL_STENCIL_SIZE, 0,
455 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE,
456 EGL_WINDOW_BIT, EGL_NONE
457 };
458
459 LOGFN(__FILE__, __LINE__, __FUNCTION__);
460
461 ewd->egl.display = eglGetDisplay(ewd->wl.display);
462 if (!eglInitialize(ewd->egl.display, &major, &minor))
463 {
464 ERR("Failed to initialize EGL display");
465 return EINA_FALSE;
466 }
467
468 if (!eglBindAPI(EGL_OPENGL_ES_API))
469 {
470 ERR("Failed to bind EGL Api");
471 return EINA_FALSE;
472 }
473
474 if ((!eglChooseConfig(ewd->egl.display, argb_attribs, &ewd->egl.argb_config,
475 1, &n)) || (n == 0))
476 {
477 ERR("Failed to choose ARGB config");
478 return EINA_FALSE;
479 }
480
481 ewd->egl.argb_context =
482 eglCreateContext(ewd->egl.display, ewd->egl.argb_config,
483 EGL_NO_CONTEXT, context_attribs);
484 if (!ewd->egl.argb_context)
485 {
486 ERR("Failed to create ARGB context");
487 return EINA_FALSE;
488 }
489
490 if (!eglMakeCurrent(ewd->egl.display, EGL_NO_SURFACE,
491 EGL_NO_SURFACE, ewd->egl.argb_context))
492 {
493 ERR("Failed to make ARGB context current");
494 return EINA_FALSE;
495 }
496
497 return EINA_TRUE;
498}
499
500static Eina_Bool
501_ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd)
502{
503 LOGFN(__FILE__, __LINE__, __FUNCTION__);
504
505 eglMakeCurrent(ewd->egl.display,
506 EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
507
508 eglDestroyContext(ewd->egl.display, ewd->egl.argb_context);
509
510 /* NB: This is hanging when we run elm apps as wayland clients
511 * inside the weston compositor */
512
513 /* printf("Egl Terminate\n"); */
514 /* eglTerminate(ewd->egl.display); */
515 /* printf("Egl Terminate Done\n"); */
516
517 eglReleaseThread();
518
519 return EINA_TRUE;
520}
521
522static Eina_Bool
523_ecore_wl_xkb_init(Ecore_Wl_Display *ewd)
524{
525 struct xkb_rule_names names;
526
527 LOGFN(__FILE__, __LINE__, __FUNCTION__);
528
529 names.rules = "evdev";
530 names.model = "evdev";
531 names.layout = "us";
532 names.variant = "";
533 names.options = "";
534
535 if (!(ewd->xkb = xkb_compile_keymap_from_rules(&names)))
536 {
537 ERR("Failed to compile keymap");
538 return EINA_FALSE;
539 }
540
541 return EINA_TRUE;
542}
543
544static Eina_Bool
545_ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd)
546{
547 LOGFN(__FILE__, __LINE__, __FUNCTION__);
548
549 if (ewd->xkb) xkb_free_keymap(ewd->xkb);
550 return EINA_TRUE;
551}
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
deleted file mode 100644
index 5d81225..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
+++ /dev/null
@@ -1,189 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "ecore_wl_private.h"
8#include "Ecore_Wayland.h"
9
10/* local function prototypes */
11static void _ecore_wl_dnd_offer(void *data, struct wl_data_offer *wl_data_offer __UNUSED__, const char *type);
12static void _ecore_wl_dnd_cb_enter_free(void *data __UNUSED__, void *event);
13
14/* wayland listeners */
15static const struct wl_data_offer_listener _ecore_wl_data_offer_listener =
16{
17 _ecore_wl_dnd_offer,
18};
19
20void
21_ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, unsigned int id)
22{
23 Ecore_Wl_Dnd_Source *source;
24
25 LOGFN(__FILE__, __LINE__, __FUNCTION__);
26
27 if (!(source = malloc(sizeof(Ecore_Wl_Dnd_Source)))) return;
28 wl_array_init(&source->types);
29 source->refcount = 1;
30 source->input = input;
31 /* FIXME: Change this when wayland has typesafe wrapper for it */
32 source->offer = (struct wl_data_offer *)
33 wl_proxy_create_for_id((struct wl_proxy *)data_device,
34 id, &wl_data_offer_interface);
35 wl_data_offer_add_listener(source->offer,
36 &_ecore_wl_data_offer_listener, source);
37}
38
39void
40_ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer)
41{
42 Ecore_Wl_Event_Dnd_Enter *event;
43 Ecore_Wl_Input *input;
44 Ecore_Wl_Window *win;
45 char **p;
46
47 LOGFN(__FILE__, __LINE__, __FUNCTION__);
48
49 if (!(input = data)) return;
50
51 input->drag_source = wl_data_offer_get_user_data(offer);
52
53 win = wl_surface_get_user_data(surface);
54// input->pointer_focus = win;
55
56 p = wl_array_add(&input->drag_source->types, sizeof(*p));
57 *p = NULL;
58
59 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Enter)))) return;
60
61 event->win = win->id;
62 event->source = input->drag_source->input->keyboard_focus->id;
63 event->position.x = x;
64 event->position.y = y;
65 event->num_types = input->drag_source->types.size;
66 event->types = input->drag_source->types.data;
67
68 ecore_event_add(ECORE_WL_EVENT_DND_ENTER, event,
69 _ecore_wl_dnd_cb_enter_free, NULL);
70}
71
72void
73_ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device __UNUSED__)
74{
75 Ecore_Wl_Input *input;
76
77 LOGFN(__FILE__, __LINE__, __FUNCTION__);
78
79 if (!(input = data)) return;
80 _ecore_wl_dnd_del(input->drag_source);
81 input->drag_source = NULL;
82}
83
84void
85_ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y)
86{
87 Ecore_Wl_Event_Dnd_Position *event;
88 Ecore_Wl_Input *input;
89
90 LOGFN(__FILE__, __LINE__, __FUNCTION__);
91
92 if (!(input = data)) return;
93
94 input->sx = x;
95 input->sy = y;
96
97 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Position)))) return;
98
99 event->win = input->drag_source->input->pointer_focus->id;
100 event->source = input->drag_source->input->keyboard_focus->id;
101 event->position.x = x;
102 event->position.y = y;
103
104 ecore_event_add(ECORE_WL_EVENT_DND_POSITION, event, NULL, NULL);
105}
106
107void
108_ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device __UNUSED__)
109{
110 Ecore_Wl_Event_Dnd_Drop *event;
111 Ecore_Wl_Input *input;
112
113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
114
115 if (!(input = data)) return;
116
117 if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Drop)))) return;
118
119 event->win = input->drag_source->input->pointer_focus->id;
120 event->source = input->drag_source->input->keyboard_focus->id;
121 event->position.x = input->sx;
122 event->position.y = input->sy;
123
124 ecore_event_add(ECORE_WL_EVENT_DND_DROP, event, NULL, NULL);
125}
126
127void
128_ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device __UNUSED__, struct wl_data_offer *offer)
129{
130 Ecore_Wl_Input *input;
131
132 LOGFN(__FILE__, __LINE__, __FUNCTION__);
133
134 if (!(input = data)) return;
135 if (input->selection_source) _ecore_wl_dnd_del(input->selection_source);
136 input->selection_source = NULL;
137 if (offer)
138 {
139 char **p;
140
141 input->selection_source = wl_data_offer_get_user_data(offer);
142 p = wl_array_add(&input->selection_source->types, sizeof(*p));
143 *p = NULL;
144 }
145}
146
147void
148_ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source)
149{
150 LOGFN(__FILE__, __LINE__, __FUNCTION__);
151
152 if (!source) return;
153 source->refcount--;
154 if (source->refcount == 0)
155 {
156 char **p;
157
158 wl_data_offer_destroy(source->offer);
159 for (p = source->types.data; *p; p++)
160 free(*p);
161 wl_array_release(&source->types);
162 free(source);
163 }
164}
165
166/* local functions */
167static void
168_ecore_wl_dnd_offer(void *data, struct wl_data_offer *wl_data_offer __UNUSED__, const char *type)
169{
170 Ecore_Wl_Dnd_Source *source;
171 char **p;
172
173 LOGFN(__FILE__, __LINE__, __FUNCTION__);
174
175 if (!(source = data)) return;
176 p = wl_array_add(&source->types, sizeof(*p));
177 *p = strdup(type);
178}
179
180static void
181_ecore_wl_dnd_cb_enter_free(void *data __UNUSED__, void *event)
182{
183 Ecore_Wl_Event_Dnd_Enter *ev;
184
185 LOGFN(__FILE__, __LINE__, __FUNCTION__);
186
187 if (!(ev = event)) return;
188 free(ev);
189}
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_input.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_input.c
deleted file mode 100644
index d44daa7..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_input.c
+++ /dev/null
@@ -1,658 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "Ecore_Input.h"
8#include "ecore_wl_private.h"
9#include "Ecore_Wayland.h"
10
11/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ...
12 * What about other OSs ?? */
13#ifdef __linux__
14# include <linux/input.h>
15#else
16# define BTN_LEFT 0x110
17# define BTN_RIGHT 0x111
18# define BTN_MIDDLE 0x112
19# define BTN_SIDE 0x113
20# define BTN_EXTRA 0x114
21# define BTN_FORWARD 0x115
22# define BTN_BACK 0x116
23#endif
24
25/* local function prototypes */
26static void _ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy);
27static void _ecore_wl_input_cb_button(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int button, unsigned int state);
28static void _ecore_wl_input_cb_key(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp __UNUSED__, unsigned int key, unsigned int state);
29static void _ecore_wl_input_cb_pointer_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface, int sx, int sy);
30static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__);
31static void _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface, struct wl_array *keys);
32static void _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__);
33static void _ecore_wl_input_cb_touch_down(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__, int id __UNUSED__, int x, int y);
34static void _ecore_wl_input_cb_touch_up(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int id __UNUSED__);
35static void _ecore_wl_input_cb_touch_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int id __UNUSED__, int x, int y);
36static void _ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__);
37static void _ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__);
38static void _ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, unsigned int id);
39static void _ecore_wl_input_cb_data_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer);
40static void _ecore_wl_input_cb_data_leave(void *data, struct wl_data_device *data_device);
41static void _ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, int x, int y);
42static void _ecore_wl_input_cb_data_drop(void *data, struct wl_data_device *data_device);
43static void _ecore_wl_input_cb_data_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer);
44
45static void _ecore_wl_input_keyboard_focus_remove(Ecore_Wl_Input *input, unsigned int timestamp);
46static void _ecore_wl_input_pointer_focus_remove(Ecore_Wl_Input *input, unsigned int timestamp);
47static void _ecore_wl_input_mouse_move_send(Ecore_Wl_Input *input, unsigned int timestamp);
48static void _ecore_wl_input_cb_mouse_move_free(void *data __UNUSED__, void *event);
49static void _ecore_wl_input_mouse_in_send(Ecore_Wl_Input *input, unsigned int timestamp);
50static void _ecore_wl_input_mouse_out_send(Ecore_Wl_Input *input, unsigned int timestamp);
51static void _ecore_wl_input_focus_in_send(Ecore_Wl_Input *input, unsigned int timestamp);
52static void _ecore_wl_input_focus_out_send(Ecore_Wl_Input *input, unsigned int timestamp);
53static void _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, unsigned int timestamp);
54static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, unsigned int timestamp);
55
56/* wayland interfaces */
57static const struct wl_input_device_listener _ecore_wl_input_listener =
58{
59 _ecore_wl_input_cb_motion,
60 _ecore_wl_input_cb_button,
61 _ecore_wl_input_cb_key,
62 _ecore_wl_input_cb_pointer_enter,
63 _ecore_wl_input_cb_pointer_leave,
64 _ecore_wl_input_cb_keyboard_enter,
65 _ecore_wl_input_cb_keyboard_leave,
66 _ecore_wl_input_cb_touch_down,
67 _ecore_wl_input_cb_touch_up,
68 _ecore_wl_input_cb_touch_motion,
69 _ecore_wl_input_cb_touch_frame,
70 _ecore_wl_input_cb_touch_cancel
71};
72
73static const struct wl_data_device_listener _ecore_wl_data_listener =
74{
75 _ecore_wl_input_cb_data_offer,
76 _ecore_wl_input_cb_data_enter,
77 _ecore_wl_input_cb_data_leave,
78 _ecore_wl_input_cb_data_motion,
79 _ecore_wl_input_cb_data_drop,
80 _ecore_wl_input_cb_data_selection
81};
82
83/* local variables */
84static int _pointer_x, _pointer_y;
85
86void
87_ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)
88{
89 Ecore_Wl_Input *input;
90
91 LOGFN(__FILE__, __LINE__, __FUNCTION__);
92
93 if (!(input = malloc(sizeof(Ecore_Wl_Input)))) return;
94
95 memset(input, 0, sizeof(Ecore_Wl_Input));
96
97 input->display = ewd;
98 input->pointer_focus = NULL;
99 input->keyboard_focus = NULL;
100
101 input->input_device =
102 wl_display_bind(ewd->wl.display, id, &wl_input_device_interface);
103 wl_list_insert(ewd->inputs.prev, &input->link);
104 wl_input_device_add_listener(input->input_device,
105 &_ecore_wl_input_listener, input);
106 wl_input_device_set_user_data(input->input_device, input);
107
108 input->data_device =
109 wl_data_device_manager_get_data_device(ewd->wl.data_device_manager,
110 input->input_device);
111 wl_data_device_add_listener(input->data_device,
112 &_ecore_wl_data_listener, input);
113}
114
115void
116_ecore_wl_input_del(Ecore_Wl_Input *input)
117{
118 if (!input) return;
119
120 _ecore_wl_input_keyboard_focus_remove(input, 0);
121 _ecore_wl_input_pointer_focus_remove(input, 0);
122
123 if (input->drag_source) _ecore_wl_dnd_del(input->drag_source);
124 input->drag_source = NULL;
125
126 if (input->selection_source) _ecore_wl_dnd_del(input->selection_source);
127 input->selection_source = NULL;
128
129 if (input->data_device) wl_data_device_destroy(input->data_device);
130 if (input->input_device) wl_input_device_destroy(input->input_device);
131 wl_list_remove(&input->link);
132 free(input);
133}
134
135void
136_ecore_wl_input_pointer_xy_get(int *x, int *y)
137{
138 if (x) *x = _pointer_x;
139 if (y) *y = _pointer_y;
140}
141
142/* local functions */
143static void
144_ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy)
145{
146 Ecore_Wl_Input *input;
147
148 LOGFN(__FILE__, __LINE__, __FUNCTION__);
149
150 if (!(input = data)) return;
151
152 _pointer_x = sx;
153 _pointer_y = sy;
154
155 input->sx = sx;
156 input->sy = sy;
157
158 /* TODO: FIXME: NB: Weston window code has set pointer image here also */
159 _ecore_wl_input_mouse_move_send(input, timestamp);
160}
161
162static void
163_ecore_wl_input_cb_button(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int button, unsigned int state)
164{
165 Ecore_Wl_Input *input;
166
167 LOGFN(__FILE__, __LINE__, __FUNCTION__);
168
169 if (!(input = data)) return;
170
171 input->timestamp = timestamp;
172
173 _ecore_wl_input_mouse_move_send(input, timestamp);
174
175 if ((button >= BTN_SIDE) && (button <= BTN_BACK))
176 {
177 /* TODO: raise mouse wheel */
178 printf("Raise Mouse Wheel Event\n");
179 }
180 else
181 {
182 if (state)
183 {
184 input->button = button;
185 _ecore_wl_input_mouse_down_send(input, timestamp);
186 }
187 else
188 {
189 _ecore_wl_input_mouse_up_send(input, timestamp);
190 input->button = 0;
191 }
192 }
193}
194
195static void
196_ecore_wl_input_cb_key(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp __UNUSED__, unsigned int key, unsigned int state)
197{
198 Ecore_Wl_Input *input;
199 Ecore_Wl_Window *win;
200 unsigned int keycode = 0;
201
202 LOGFN(__FILE__, __LINE__, __FUNCTION__);
203
204 if (!(input = data)) return;
205
206 win = input->keyboard_focus;
207 if ((!win) || (win->keyboard_device != input)) return;
208
209 /* FIXME: NB: I believe this should be min_key_code rather than 8,
210 * but weston code has it like this */
211 keycode = key + 8;
212
213 /* if ((input->modifiers & XKB_COMMON_SHIFT_MASK) && */
214 /* (XkbKeyGroupWidth(_ecore_wl_disp->xkb, keycode, 0) > 1)) */
215 /* level = 1; */
216 /* keysym = XkbKeySymEntry(_ecore_wl_disp->xkb, keycode, level, 0); */
217
218 if (state)
219 input->modifiers |= _ecore_wl_disp->xkb->map->modmap[keycode];
220 else
221 input->modifiers &= ~_ecore_wl_disp->xkb->map->modmap[keycode];
222}
223
224static void
225_ecore_wl_input_cb_pointer_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface, int sx, int sy)
226{
227 Ecore_Wl_Input *input;
228 Ecore_Wl_Window *win = NULL;
229
230 LOGFN(__FILE__, __LINE__, __FUNCTION__);
231
232 if (!(input = data)) return;
233
234 input->sx = sx;
235 input->sy = sy;
236
237 _ecore_wl_input_mouse_move_send(input, timestamp);
238
239 win = input->pointer_focus;
240 if ((win) && (win->surface != surface))
241 {
242 if (!input->button)
243 _ecore_wl_input_pointer_focus_remove(input, timestamp);
244 }
245
246 if (surface)
247 {
248 if ((win = wl_surface_get_user_data(surface)))
249 {
250 input->pointer_focus = win;
251 win->pointer_device = input;
252 }
253 if (input->button)
254 {
255 _ecore_wl_input_mouse_up_send(input, timestamp);
256 input->button = 0;
257 }
258 else
259 _ecore_wl_input_mouse_in_send(input, timestamp);
260 }
261}
262
263static void
264_ecore_wl_input_cb_pointer_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__)
265{
266 Ecore_Wl_Input *input;
267
268 LOGFN(__FILE__, __LINE__, __FUNCTION__);
269
270 if (!(input = data)) return;
271 _ecore_wl_input_pointer_focus_remove(input, timestamp);
272}
273
274static void
275_ecore_wl_input_cb_keyboard_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface, struct wl_array *keys)
276{
277 Ecore_Wl_Input *input;
278 Ecore_Wl_Window *win = NULL;
279 unsigned int *k, *end;
280
281 LOGFN(__FILE__, __LINE__, __FUNCTION__);
282
283 if (!(input = data)) return;
284
285 end = keys->data + keys->size;
286 input->modifiers = 0;
287 for (k = keys->data; k < end; k++)
288 input->modifiers |= _ecore_wl_disp->xkb->map->modmap[*k];
289
290 if (surface)
291 {
292 if ((win = wl_surface_get_user_data(surface)))
293 {
294 input->keyboard_focus = win;
295 win->keyboard_device = input;
296 }
297 else
298 input->keyboard_focus = NULL;
299 _ecore_wl_input_focus_in_send(input, timestamp);
300 }
301}
302
303static void
304_ecore_wl_input_cb_keyboard_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__)
305{
306 Ecore_Wl_Input *input;
307
308 LOGFN(__FILE__, __LINE__, __FUNCTION__);
309
310 if (!(input = data)) return;
311 _ecore_wl_input_keyboard_focus_remove(input, timestamp);
312}
313
314static void
315_ecore_wl_input_cb_touch_down(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__, int id __UNUSED__, int x, int y)
316{
317 Ecore_Wl_Input *input;
318
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320
321 if (!(input = data)) return;
322
323 /* FIXME: NB: Not sure yet if input->timestamp should be set here.
324 * This needs to be tested with an actual touch device */
325 /* input->timestamp = timestamp; */
326 input->button = 0;
327 input->sx = x;
328 input->sy = y;
329 _ecore_wl_input_mouse_down_send(input, timestamp);
330}
331
332static void
333_ecore_wl_input_cb_touch_up(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int id __UNUSED__)
334{
335 Ecore_Wl_Input *input;
336
337 LOGFN(__FILE__, __LINE__, __FUNCTION__);
338
339 if (!(input = data)) return;
340
341 /* FIXME: NB: Not sure yet if input->timestamp should be set here.
342 * This needs to be tested with an actual touch device */
343 /* input->timestamp = timestamp; */
344 input->button = 0;
345 _ecore_wl_input_mouse_up_send(input, timestamp);
346}
347
348static void
349_ecore_wl_input_cb_touch_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int id __UNUSED__, int x, int y)
350{
351 Ecore_Wl_Input *input;
352
353 LOGFN(__FILE__, __LINE__, __FUNCTION__);
354
355 if (!(input = data)) return;
356
357 /* FIXME: NB: Not sure yet if input->timestamp should be set here.
358 * This needs to be tested with an actual touch device */
359 /* input->timestamp = timestamp; */
360 input->sx = x;
361 input->sy = y;
362
363 _ecore_wl_input_mouse_move_send(input, timestamp);
364}
365
366static void
367_ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__)
368{
369 LOGFN(__FILE__, __LINE__, __FUNCTION__);
370}
371
372static void
373_ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__)
374{
375 LOGFN(__FILE__, __LINE__, __FUNCTION__);
376}
377
378static void
379_ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, unsigned int id)
380{
381 LOGFN(__FILE__, __LINE__, __FUNCTION__);
382
383 _ecore_wl_dnd_add(data, data_device, id);
384}
385
386static void
387_ecore_wl_input_cb_data_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer)
388{
389 LOGFN(__FILE__, __LINE__, __FUNCTION__);
390
391 _ecore_wl_dnd_enter(data, data_device, timestamp, surface, x, y, offer);
392}
393
394static void
395_ecore_wl_input_cb_data_leave(void *data, struct wl_data_device *data_device)
396{
397 LOGFN(__FILE__, __LINE__, __FUNCTION__);
398
399 _ecore_wl_dnd_leave(data, data_device);
400}
401
402static void
403_ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, int x, int y)
404{
405 LOGFN(__FILE__, __LINE__, __FUNCTION__);
406
407 _ecore_wl_dnd_motion(data, data_device, timestamp, x, y);
408}
409
410static void
411_ecore_wl_input_cb_data_drop(void *data, struct wl_data_device *data_device)
412{
413 LOGFN(__FILE__, __LINE__, __FUNCTION__);
414
415 _ecore_wl_dnd_drop(data, data_device);
416}
417
418static void
419_ecore_wl_input_cb_data_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer)
420{
421 LOGFN(__FILE__, __LINE__, __FUNCTION__);
422
423 _ecore_wl_dnd_selection(data, data_device, offer);
424}
425
426static void
427_ecore_wl_input_keyboard_focus_remove(Ecore_Wl_Input *input, unsigned int timestamp)
428{
429 Ecore_Wl_Window *win;
430
431 LOGFN(__FILE__, __LINE__, __FUNCTION__);
432
433 _ecore_wl_input_focus_out_send(input, timestamp);
434 if ((win = input->keyboard_focus))
435 win->keyboard_device = NULL;
436 input->keyboard_focus = NULL;
437}
438
439static void
440_ecore_wl_input_pointer_focus_remove(Ecore_Wl_Input *input, unsigned int timestamp)
441{
442 Ecore_Wl_Window *win;
443
444 LOGFN(__FILE__, __LINE__, __FUNCTION__);
445
446 if (!input->button)
447 _ecore_wl_input_mouse_out_send(input, timestamp);
448
449 if ((win = input->pointer_focus))
450 win->pointer_device = NULL;
451 input->pointer_focus = NULL;
452}
453
454static void
455_ecore_wl_input_mouse_move_send(Ecore_Wl_Input *input, unsigned int timestamp)
456{
457 Ecore_Event_Mouse_Move *ev;
458 Ecore_Event *event;
459
460 LOGFN(__FILE__, __LINE__, __FUNCTION__);
461
462 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
463
464 ev->timestamp = timestamp;
465 ev->x = input->sx;
466 ev->y = input->sy;
467 ev->modifiers = input->modifiers;
468 ev->multi.device = 0;
469 ev->multi.radius = 1;
470 ev->multi.radius_x = 1;
471 ev->multi.radius_y = 1;
472 ev->multi.pressure = 1.0;
473 ev->multi.angle = 0.0;
474 ev->multi.x = input->sx;
475 ev->multi.y = input->sy;
476
477 if (input->pointer_focus)
478 {
479 ev->window = input->pointer_focus->id;
480 ev->event_window = input->pointer_focus->id;
481 }
482
483 event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev,
484 _ecore_wl_input_cb_mouse_move_free, NULL);
485}
486
487static void
488_ecore_wl_input_cb_mouse_move_free(void *data __UNUSED__, void *event)
489{
490 Ecore_Event_Mouse_Move *ev;
491
492 if ((ev = event)) free(ev);
493}
494
495static void
496_ecore_wl_input_mouse_in_send(Ecore_Wl_Input *input, unsigned int timestamp)
497{
498 Ecore_Wl_Event_Mouse_In *ev;
499 Ecore_Event *event;
500
501 LOGFN(__FILE__, __LINE__, __FUNCTION__);
502
503 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_In)))) return;
504
505 ev->x = input->sx;
506 ev->y = input->sy;
507 ev->modifiers = input->modifiers;
508 ev->timestamp = timestamp;
509
510 if (input->pointer_focus)
511 {
512 ev->win = input->pointer_focus->id;
513 ev->event_win = input->pointer_focus->id;
514 }
515
516 event = ecore_event_add(ECORE_WL_EVENT_MOUSE_IN, ev, NULL, NULL);
517}
518
519static void
520_ecore_wl_input_mouse_out_send(Ecore_Wl_Input *input, unsigned int timestamp)
521{
522 Ecore_Wl_Event_Mouse_Out *ev;
523
524 LOGFN(__FILE__, __LINE__, __FUNCTION__);
525
526 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_Out)))) return;
527
528 ev->x = input->sx;
529 ev->y = input->sy;
530 ev->modifiers = input->modifiers;
531 ev->timestamp = timestamp;
532
533 if (input->pointer_focus)
534 {
535 ev->win = input->pointer_focus->id;
536 ev->event_win = input->pointer_focus->id;
537 }
538
539 ecore_event_add(ECORE_WL_EVENT_MOUSE_OUT, ev, NULL, NULL);
540}
541
542static void
543_ecore_wl_input_focus_in_send(Ecore_Wl_Input *input, unsigned int timestamp)
544{
545 Ecore_Wl_Event_Focus_In *ev;
546
547 LOGFN(__FILE__, __LINE__, __FUNCTION__);
548
549 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_In)))) return;
550 ev->timestamp = timestamp;
551 if (input->keyboard_focus)
552 ev->win = input->keyboard_focus->id;
553 ecore_event_add(ECORE_WL_EVENT_FOCUS_IN, ev, NULL, NULL);
554}
555
556static void
557_ecore_wl_input_focus_out_send(Ecore_Wl_Input *input, unsigned int timestamp)
558{
559 Ecore_Wl_Event_Focus_Out *ev;
560
561 LOGFN(__FILE__, __LINE__, __FUNCTION__);
562
563 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_Out)))) return;
564 ev->timestamp = timestamp;
565 if (input->keyboard_focus)
566 ev->win = input->keyboard_focus->id;
567 ecore_event_add(ECORE_WL_EVENT_FOCUS_OUT, ev, NULL, NULL);
568}
569
570static void
571_ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, unsigned int timestamp)
572{
573 Ecore_Event_Mouse_Button *ev;
574
575 LOGFN(__FILE__, __LINE__, __FUNCTION__);
576
577 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
578
579 if (input->button == BTN_LEFT)
580 ev->buttons = 1;
581 else if (input->button == BTN_MIDDLE)
582 ev->buttons = 2;
583 else if (input->button == BTN_RIGHT)
584 ev->buttons = 3;
585 else
586 ev->buttons = input->button;
587
588 ev->timestamp = timestamp;
589 ev->x = input->sx;
590 ev->y = input->sy;
591 ev->modifiers = input->modifiers;
592
593 /* FIXME: Need to get these from wayland somehow */
594 ev->double_click = 0;
595 ev->triple_click = 0;
596
597 ev->multi.device = 0;
598 ev->multi.radius = 1;
599 ev->multi.radius_x = 1;
600 ev->multi.radius_y = 1;
601 ev->multi.pressure = 1.0;
602 ev->multi.angle = 0.0;
603 ev->multi.x = input->sx;
604 ev->multi.y = input->sy;
605
606 if (input->pointer_focus)
607 {
608 ev->window = input->pointer_focus->id;
609 ev->event_window = input->pointer_focus->id;
610 }
611
612 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
613}
614
615static void
616_ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, unsigned int timestamp)
617{
618 Ecore_Event_Mouse_Button *ev;
619
620 LOGFN(__FILE__, __LINE__, __FUNCTION__);
621
622 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
623
624 if (input->button == BTN_LEFT)
625 ev->buttons = 1;
626 else if (input->button == BTN_MIDDLE)
627 ev->buttons = 2;
628 else if (input->button == BTN_RIGHT)
629 ev->buttons = 3;
630 else
631 ev->buttons = input->button;
632
633 ev->timestamp = timestamp;
634 ev->x = input->sx;
635 ev->y = input->sy;
636 ev->modifiers = input->modifiers;
637
638 /* FIXME: Need to get these from wayland somehow */
639 ev->double_click = 0;
640 ev->triple_click = 0;
641
642 ev->multi.device = 0;
643 ev->multi.radius = 1;
644 ev->multi.radius_x = 1;
645 ev->multi.radius_y = 1;
646 ev->multi.pressure = 1.0;
647 ev->multi.angle = 0.0;
648 ev->multi.x = input->sx;
649 ev->multi.y = input->sy;
650
651 if (input->pointer_focus)
652 {
653 ev->window = input->pointer_focus->id;
654 ev->event_window = input->pointer_focus->id;
655 }
656
657 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
658}
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c
deleted file mode 100644
index 9f540d4..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "ecore_wl_private.h"
8#include "Ecore_Wayland.h"
9
10/* local function prototypes */
11static void _ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__, int x, int y, int w __UNUSED__, int h __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__);
12static void _ecore_wl_output_cb_mode(void *data, struct wl_output *wl_output __UNUSED__, unsigned int flags, int w, int h, int refresh __UNUSED__);
13
14/* wayland listeners */
15static const struct wl_output_listener _ecore_wl_output_listener =
16{
17 _ecore_wl_output_cb_geometry,
18 _ecore_wl_output_cb_mode
19};
20
21void
22_ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id)
23{
24 Ecore_Wl_Output *output;
25
26 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27
28 if (!(output = malloc(sizeof(Ecore_Wl_Output)))) return;
29
30 memset(output, 0, sizeof(Ecore_Wl_Output));
31
32 output->display = ewd;
33
34 output->output = wl_display_bind(ewd->wl.display, id, &wl_output_interface);
35 wl_list_insert(ewd->outputs.prev, &output->link);
36 wl_output_add_listener(output->output, &_ecore_wl_output_listener, output);
37}
38
39void
40_ecore_wl_output_del(Ecore_Wl_Output *output)
41{
42 if (!output) return;
43 if (output->destroy) (*output->destroy)(output, output->data);
44 if (output->output) wl_output_destroy(output->output);
45 wl_list_remove(&output->link);
46 free(output);
47}
48
49/* local functions */
50static void
51_ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__, int x, int y, int w __UNUSED__, int h __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__)
52{
53 Ecore_Wl_Output *output;
54
55 LOGFN(__FILE__, __LINE__, __FUNCTION__);
56
57 output = data;
58 output->allocation.x = x;
59 output->allocation.y = y;
60}
61
62static void
63_ecore_wl_output_cb_mode(void *data, struct wl_output *wl_output __UNUSED__, unsigned int flags, int w, int h, int refresh __UNUSED__)
64{
65 Ecore_Wl_Output *output;
66 Ecore_Wl_Display *ewd;
67
68 LOGFN(__FILE__, __LINE__, __FUNCTION__);
69
70 output = data;
71 ewd = output->display;
72 if (flags & WL_OUTPUT_MODE_CURRENT)
73 {
74 output->allocation.w = w;
75 output->allocation.h = h;
76 _ecore_wl_disp->output = output;
77 if (ewd->output_configure) (*ewd->output_configure)(output, ewd->data);
78 }
79}
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h
deleted file mode 100644
index 31956a1..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef _ECORE_WAYLAND_PRIVATE_H
2# define _ECORE_WAYLAND_PRIVATE_H
3
4# include <limits.h>
5# include <xkbcommon/xkbcommon.h>
6
7# include "Ecore_Wayland.h"
8
9//# define LOGFNS 1
10
11# ifdef LOGFNS
12# include <stdio.h>
13# define LOGFN(fl, ln, fn) printf("-ECORE-WL: %25s: %5i - %s\n", fl, ln, fn);
14# else
15# define LOGFN(fl, ln, fn)
16# endif
17
18extern int _ecore_wl_log_dom;
19extern Ecore_Wl_Display *_ecore_wl_disp;
20
21# ifdef ECORE_WL_DEFAULT_LOG_COLOR
22# undef ECORE_WL_DEFAULT_LOG_COLOR
23# endif
24# define ECORE_WL_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
25
26# ifdef ERR
27# undef ERR
28# endif
29# define ERR(...) EINA_LOG_DOM_ERR(_ecore_wl_log_dom, __VA_ARGS__)
30
31# ifdef DBG
32# undef DBG
33# endif
34# define DBG(...) EINA_LOG_DOM_DBG(_ecore_wl_log_dom, __VA_ARGS__)
35
36# ifdef INF
37# undef INF
38# endif
39# define INF(...) EINA_LOG_DOM_INFO(_ecore_wl_log_dom, __VA_ARGS__)
40
41# ifdef WRN
42# undef WRN
43# endif
44# define WRN(...) EINA_LOG_DOM_WARN(_ecore_wl_log_dom, __VA_ARGS__)
45
46# ifdef CRIT
47# undef CRIT
48# endif
49# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__)
50
51struct _Ecore_Wl_Dnd_Source
52{
53 struct wl_data_offer *offer;
54 Ecore_Wl_Input *input;
55 struct wl_array types;
56 int refcount;
57 int fd;
58 int x, y;
59
60 /* TODO: task & data_func */
61 void *data;
62};
63
64struct _Ecore_Wl_Dnd_Target
65{
66 Ecore_Wl_Dnd_Source *source;
67};
68
69void _ecore_wl_window_init(void);
70void _ecore_wl_window_shutdown(void);
71
72void _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id);
73void _ecore_wl_output_del(Ecore_Wl_Output *output);
74
75void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id);
76void _ecore_wl_input_del(Ecore_Wl_Input *input);
77void _ecore_wl_input_pointer_xy_get(int *x, int *y);
78
79void _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, unsigned int id);
80void _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer);
81void _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device __UNUSED__);
82void _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y);
83void _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device __UNUSED__);
84void _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device __UNUSED__, struct wl_data_offer *offer);
85void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source);
86
87#endif
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_window.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_window.c
deleted file mode 100644
index e8a8bfb..0000000
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_window.c
+++ /dev/null
@@ -1,440 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "ecore_wl_private.h"
8#include "Ecore_Wayland.h"
9
10/* local function prototypes */
11static void _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, unsigned int timestamp, unsigned int edges, int w, int h);
12static void _ecore_wl_window_cb_popup_done(void *data, struct wl_shell_surface *shell_surface __UNUSED__);
13static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int timestamp);
14
15/* local variables */
16static Eina_Hash *_windows = NULL;
17
18/* wayland listeners */
19static const struct wl_shell_surface_listener _ecore_wl_shell_surface_listener =
20{
21 _ecore_wl_window_cb_configure,
22 _ecore_wl_window_cb_popup_done
23};
24
25/* internal functions */
26void
27_ecore_wl_window_init(void)
28{
29 if (!_windows) _windows = eina_hash_pointer_new(free);
30}
31
32void
33_ecore_wl_window_shutdown(void)
34{
35 eina_hash_free(_windows);
36 _windows = NULL;
37}
38
39/**
40 * @defgroup Ecore_Wl_Window_Group Wayland Library Init and Shutdown Functions
41 *
42 * Functions that can be used to create a Wayland window.
43 */
44
45/**
46 * Creates a new window
47 *
48 * @param parent The parent window to use. If @p parent is @c 0, the root window
49 * of the default display is used.
50 * @param x X Position
51 * @param y Y position
52 * @param w Width
53 * @param h Height
54 *
55 * @return The new window
56 *
57 * @ingroup Ecore_Wl_Window_Group
58 * @since 1.2
59 */
60EAPI Ecore_Wl_Window *
61ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type)
62{
63 Ecore_Wl_Window *win;
64 static int _win_id = 1;
65
66 LOGFN(__FILE__, __LINE__, __FUNCTION__);
67
68 if (!(win = malloc(sizeof(Ecore_Wl_Window))))
69 {
70 ERR("Failed to allocate an Ecore Wayland Window");
71 return NULL;
72 }
73
74 memset(win, 0, sizeof(Ecore_Wl_Window));
75
76 win->display = _ecore_wl_disp;
77 win->parent = parent;
78 win->allocation.x = x;
79 win->allocation.y = y;
80 win->allocation.w = w;
81 win->allocation.h = h;
82 win->saved_allocation = win->allocation;
83 win->transparent = EINA_TRUE;
84 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
85 win->buffer_type = buffer_type;
86 win->id = _win_id++;
87
88 eina_hash_add(_windows, &win->id, win);
89 return win;
90}
91
92/**
93 * Deletes the given window
94 *
95 * @param win The given window
96 *
97 * @ingroup Ecore_Wl_Window_Group
98 * @since 1.2
99 */
100EAPI void
101ecore_wl_window_free(Ecore_Wl_Window *win)
102{
103 Ecore_Wl_Input *input;
104
105 LOGFN(__FILE__, __LINE__, __FUNCTION__);
106
107 if (!win) return;
108
109 eina_hash_del(_windows, &win->id, NULL);
110
111 wl_list_for_each(input, &_ecore_wl_disp->inputs, link)
112 {
113 if ((input->pointer_focus) && (input->pointer_focus == win))
114 input->pointer_focus = NULL;
115 if ((input->keyboard_focus) && (input->keyboard_focus == win))
116 input->keyboard_focus = NULL;
117 }
118
119 if (win->shell_surface) wl_shell_surface_destroy(win->shell_surface);
120 win->shell_surface = NULL;
121
122 if (win->surface) wl_surface_destroy(win->surface);
123 win->surface = NULL;
124
125// free(win);
126}
127
128/**
129 * Signals for Wayland to initiate a window move.
130 *
131 * The position requested (@p x, @p y) is not honored by Wayland because
132 * Wayland does not allow specific window placement to be set.
133 *
134 * @param win The window to move.
135 * @param x X Position
136 * @param y Y Position
137 *
138 * @ingroup Ecore_Wl_Window_Group
139 * @since 1.2
140 */
141EAPI void
142ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y)
143{
144 LOGFN(__FILE__, __LINE__, __FUNCTION__);
145
146 if (!win) return;
147 win->allocation.x = x;
148 win->allocation.y = y;
149 if (win->shell_surface)
150 {
151 Ecore_Wl_Input *input;
152
153 input = win->keyboard_device;
154 wl_shell_surface_move(win->shell_surface, input->input_device,
155 input->timestamp);
156 }
157}
158
159/**
160 * Signals for Wayland to initiate a window resize.
161 *
162 * The size requested (@p w, @p h) is not honored by Wayland because
163 * Wayland does not allow specific window sizes to be set.
164 *
165 * @param win The window to resize.
166 * @param w Width
167 * @param h Height
168 * @param location The edge of the window from where the resize should start.
169 *
170 * @ingroup Ecore_Wl_Window_Group
171 * @since 1.2
172 */
173EAPI void
174ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location)
175{
176 LOGFN(__FILE__, __LINE__, __FUNCTION__);
177
178 if (!win) return;
179 win->allocation.w = w;
180 win->allocation.h = h;
181 if (win->shell_surface)
182 {
183 Ecore_Wl_Input *input;
184
185 input = win->keyboard_device;
186 wl_shell_surface_resize(win->shell_surface, input->input_device,
187 input->timestamp, location);
188 }
189}
190
191EAPI void
192ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h)
193{
194 LOGFN(__FILE__, __LINE__, __FUNCTION__);
195
196 if (!win) return;
197 if (win->surface)
198 wl_surface_damage(win->surface, x, y, w, h);
199}
200
201EAPI void
202ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y)
203{
204 LOGFN(__FILE__, __LINE__, __FUNCTION__);
205
206 if (!win) return;
207 if ((win->surface) && (buffer))
208 wl_surface_attach(win->surface, buffer, x, y);
209}
210
211/**
212 * Shows a window
213 *
214 * Synonymous to "mapping" a window in Wayland System terminology.
215 *
216 * @param win The window to show.
217 *
218 * @ingroup Ecore_Wl_Window_Group
219 * @since 1.2
220 */
221EAPI void
222ecore_wl_window_show(Ecore_Wl_Window *win)
223{
224 LOGFN(__FILE__, __LINE__, __FUNCTION__);
225
226 if (!win) return;
227 if (win->surface) return;
228
229 win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
230 wl_surface_set_user_data(win->surface, win);
231
232 win->shell_surface =
233 wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, win->surface);
234 wl_shell_surface_add_listener(win->shell_surface,
235 &_ecore_wl_shell_surface_listener, win);
236
237 switch (win->type)
238 {
239 case ECORE_WL_WINDOW_TYPE_FULLSCREEN:
240 wl_shell_surface_set_fullscreen(win->shell_surface,
241 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
242 0, NULL);
243 break;
244 case ECORE_WL_WINDOW_TYPE_MAXIMIZED:
245 wl_shell_surface_set_maximized(win->shell_surface, NULL);
246 break;
247 case ECORE_WL_WINDOW_TYPE_TRANSIENT:
248 wl_shell_surface_set_transient(win->shell_surface,
249 win->parent->shell_surface,
250 win->allocation.x, win->allocation.y, 0);
251 break;
252 case ECORE_WL_WINDOW_TYPE_MENU:
253 wl_shell_surface_set_popup(win->shell_surface,
254 win->pointer_device->input_device,
255 win->pointer_device->timestamp,
256 win->parent->shell_surface,
257 win->allocation.x, win->allocation.y, 0);
258 break;
259 case ECORE_WL_WINDOW_TYPE_TOPLEVEL:
260 default:
261 wl_shell_surface_set_toplevel(win->shell_surface);
262 break;
263 }
264}
265
266/**
267 * Hides a window
268 *
269 * Synonymous to "unmapping" a window in Wayland System terminology.
270 *
271 * @param win The window to hide.
272 *
273 * @ingroup Ecore_Wl_Window_Group
274 * @since 1.2
275 */
276EAPI void
277ecore_wl_window_hide(Ecore_Wl_Window *win)
278{
279 LOGFN(__FILE__, __LINE__, __FUNCTION__);
280
281 if (!win) return;
282 if (win->shell_surface) wl_shell_surface_destroy(win->shell_surface);
283 win->shell_surface = NULL;
284 if (win->surface) wl_surface_destroy(win->surface);
285 win->surface = NULL;
286}
287
288/**
289 * Raises a window
290 *
291 * @param win The window to raise.
292 *
293 * @ingroup Ecore_Wl_Window_Group
294 * @since 1.2
295 */
296EAPI void
297ecore_wl_window_raise(Ecore_Wl_Window *win)
298{
299 LOGFN(__FILE__, __LINE__, __FUNCTION__);
300
301 if (!win) return;
302 if (win->shell_surface)
303 wl_shell_surface_set_toplevel(win->shell_surface);
304}
305
306EAPI void
307ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
308{
309 LOGFN(__FILE__, __LINE__, __FUNCTION__);
310
311 if (!win) return;
312 if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return;
313 if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
314 {
315 win->saved_allocation = win->allocation;
316 if (win->shell_surface)
317 wl_shell_surface_set_maximized(win->shell_surface, NULL);
318 win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
319 }
320 else
321 {
322 Ecore_Wl_Input *input;
323
324 input = win->keyboard_device;
325
326 if (win->shell_surface)
327 wl_shell_surface_set_toplevel(win->shell_surface);
328 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
329 win->allocation = win->saved_allocation;
330 _ecore_wl_window_configure_send(win, win->allocation.w,
331 win->allocation.h, input->timestamp);
332 }
333}
334
335EAPI void
336ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
337{
338 LOGFN(__FILE__, __LINE__, __FUNCTION__);
339
340 if (!win) return;
341 if ((win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN) == fullscreen) return;
342 if (fullscreen)
343 {
344 win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
345 win->saved_allocation = win->allocation;
346 if (win->shell_surface)
347 wl_shell_surface_set_fullscreen(win->shell_surface,
348 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
349 0, NULL);
350 }
351 else
352 {
353 Ecore_Wl_Input *input;
354
355 input = win->keyboard_device;
356
357 if (win->shell_surface)
358 wl_shell_surface_set_toplevel(win->shell_surface);
359 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
360 win->allocation = win->saved_allocation;
361 _ecore_wl_window_configure_send(win, win->allocation.w,
362 win->allocation.h, input->timestamp);
363 }
364}
365
366EAPI void
367ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
368{
369 LOGFN(__FILE__, __LINE__, __FUNCTION__);
370
371 if (!win) return;
372 win->allocation.w = w;
373 win->allocation.h = h;
374}
375
376EAPI struct wl_surface *
377ecore_wl_window_surface_get(Ecore_Wl_Window *win)
378{
379 LOGFN(__FILE__, __LINE__, __FUNCTION__);
380
381 if (!win) return NULL;
382 return win->surface;
383}
384
385EAPI Ecore_Wl_Window *
386ecore_wl_window_find(unsigned int id)
387{
388 Ecore_Wl_Window *win;
389
390 if (!id) return NULL;
391 win = eina_hash_find(_windows, &id);
392 if (win) return win;
393 return NULL;
394}
395
396/* local functions */
397static void
398_ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, unsigned int timestamp, unsigned int edges, int w, int h)
399{
400 Ecore_Wl_Window *win;
401
402 LOGFN(__FILE__, __LINE__, __FUNCTION__);
403
404 if (!(win = data)) return;
405 if ((w <= 0) || (h <= 0)) return;
406
407 win->edges = edges;
408 win->allocation.w = w;
409 win->allocation.h = h;
410 _ecore_wl_window_configure_send(win, w, h, timestamp);
411}
412
413static void
414_ecore_wl_window_cb_popup_done(void *data, struct wl_shell_surface *shell_surface __UNUSED__)
415{
416 Ecore_Wl_Window *win;
417
418 LOGFN(__FILE__, __LINE__, __FUNCTION__);
419
420 if (!(win = data)) return;
421 /* TODO: handle popup destroy */
422}
423
424static void
425_ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int timestamp)
426{
427 Ecore_Wl_Event_Window_Configure *ev;
428
429 LOGFN(__FILE__, __LINE__, __FUNCTION__);
430
431 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Window_Configure)))) return;
432 ev->win = win->id;
433 ev->event_win = win->id;
434 ev->x = win->allocation.x;
435 ev->y = win->allocation.y;
436 ev->w = w;
437 ev->h = h;
438 ev->timestamp = timestamp;
439 ecore_event_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
440}
diff --git a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h
deleted file mode 100644
index 5df3346..0000000
--- a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h
+++ /dev/null
@@ -1,526 +0,0 @@
1#ifndef __ECORE_WIN32_H__
2#define __ECORE_WIN32_H__
3
4/*
5 * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
6 * THE API MAY CHANGE.
7 */
8
9#ifndef ECORE_WIN32_WIP_POZEFLKSD
10# ifdef _MSC_VER
11# pragma message ("You are using a work in progress API. This API is not stable")
12# pragma message ("and is subject to change. You use this at your own risk.")
13# else
14# warning "You are using a work in progress API. This API is not stable"
15# warning "and is subject to change. You use this at your own risk."
16# endif
17#endif
18
19#include <Eina.h>
20
21#ifdef EAPI
22# undef EAPI
23#endif
24
25#ifdef _WIN32
26# ifdef EFL_ECORE_WIN32_BUILD
27# ifdef DLL_EXPORT
28# define EAPI __declspec(dllexport)
29# else
30# define EAPI
31# endif /* ! DLL_EXPORT */
32# else
33# define EAPI __declspec(dllimport)
34# endif /* ! EFL_ECORE_WIN32_BUILD */
35#else
36# ifdef __GNUC__
37# if __GNUC__ >= 4
38# define EAPI __attribute__ ((visibility("default")))
39# else
40# define EAPI
41# endif
42# else
43# define EAPI
44# endif
45#endif /* ! _WIN32 */
46
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/**
53 * @defgroup Ecore_Win32_Group Ecore_Win32 library
54 *
55 * @{
56 */
57
58/**
59 * @typedef Ecore_Win32_Window_State
60 * State of a window.
61 */
62typedef enum
63{
64 ECORE_WIN32_WINDOW_STATE_ICONIFIED, /**< iconified window */
65 ECORE_WIN32_WINDOW_STATE_MODAL, /**< modal dialog box */
66 ECORE_WIN32_WINDOW_STATE_STICKY, /**< sticky window */
67 ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT, /**< maximum vertical sized window */
68 ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ, /**< maximum horizontal sized window */
69 ECORE_WIN32_WINDOW_STATE_MAXIMIZED, /**< maximum sized window */
70 ECORE_WIN32_WINDOW_STATE_SHADED, /**< shaded window */
71 ECORE_WIN32_WINDOW_STATE_HIDDEN, /**< hidden (minimized or iconified) window */
72 ECORE_WIN32_WINDOW_STATE_FULLSCREEN, /**< fullscreen window */
73 ECORE_WIN32_WINDOW_STATE_ABOVE, /**< above window */
74 ECORE_WIN32_WINDOW_STATE_BELOW, /**< below window */
75 ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION, /**< To document */
76 ECORE_WIN32_WINDOW_STATE_UNKNOWN /**< Unknown state */
77} Ecore_Win32_Window_State;
78
79/**
80 * @typedef Ecore_Win32_Window_Type
81 * Type of a window.
82 */
83typedef enum
84{
85 ECORE_WIN32_WINDOW_TYPE_DESKTOP, /**< Desktop feature */
86 ECORE_WIN32_WINDOW_TYPE_DOCK, /**< Dock window (should be on top of other windows) */
87 ECORE_WIN32_WINDOW_TYPE_TOOLBAR, /**< Toolbar window */
88 ECORE_WIN32_WINDOW_TYPE_MENU, /**< Menu window */
89 ECORE_WIN32_WINDOW_TYPE_UTILITY, /**< Small persistent utility window, such as a palette or toolbox */
90 ECORE_WIN32_WINDOW_TYPE_SPLASH, /**< Splash screen window displayed as an application is starting up */
91 ECORE_WIN32_WINDOW_TYPE_DIALOG, /**< Dialog window */
92 ECORE_WIN32_WINDOW_TYPE_NORMAL, /**< Normal top-level window */
93 ECORE_WIN32_WINDOW_TYPE_UNKNOWN /**< Unknown type */
94} Ecore_Win32_Window_Type;
95
96/**
97 * @typedef Ecore_Win32_Cursor_Shape
98 * Shape of a cursor.
99 */
100typedef enum
101{
102 ECORE_WIN32_CURSOR_SHAPE_APP_STARTING, /**< Standard arrow and small hourglass */
103 ECORE_WIN32_CURSOR_SHAPE_ARROW, /**< Standard arrow */
104 ECORE_WIN32_CURSOR_SHAPE_CROSS, /**< Crosshair */
105 ECORE_WIN32_CURSOR_SHAPE_HAND, /**< Hand */
106 ECORE_WIN32_CURSOR_SHAPE_HELP, /**< Arrow and question mark */
107 ECORE_WIN32_CURSOR_SHAPE_I_BEAM, /**< I-beam */
108 ECORE_WIN32_CURSOR_SHAPE_NO, /**< Slashed circle */
109 ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL, /**< Four-pointed arrow pointing north, south, east, and west */
110 ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW, /**< Double-pointed arrow pointing northeast and southwest */
111 ECORE_WIN32_CURSOR_SHAPE_SIZE_NS, /**< Double-pointed arrow pointing north and south */
112 ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE, /**< Double-pointed arrow pointing northwest and southeast */
113 ECORE_WIN32_CURSOR_SHAPE_SIZE_WE, /**< Double-pointed arrow pointing west and east */
114 ECORE_WIN32_CURSOR_SHAPE_UP_ARROW, /**< Vertical arrow */
115 ECORE_WIN32_CURSOR_SHAPE_WAIT /**< Hourglass */
116} Ecore_Win32_Cursor_Shape;
117
118/**
119 * @typedef Ecore_Win32_DnD_State
120 * State of a DnD operation.
121 */
122typedef enum
123{
124 ECORE_WIN32_DND_EVENT_DRAG_ENTER = 1, /**< Drag enter */
125 ECORE_WIN32_DND_EVENT_DRAG_OVER = 2, /**< Drag over */
126 ECORE_WIN32_DND_EVENT_DRAG_LEAVE = 3, /**< Drag leave */
127 ECORE_WIN32_DND_EVENT_DROP = 4 /**< Drop */
128} Ecore_Win32_DnD_State;
129
130/**
131 * @typedef Ecore_Win32_Window
132 * Abstract type for a window.
133 */
134typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
135
136/**
137 * @typedef Ecore_Win32_Cursor
138 * Abstract type for a cursor.
139 */
140typedef void Ecore_Win32_Cursor;
141
142
143/**
144 * @typedef Ecore_Win32_Event_Mouse_In
145 * Event sent when the mouse enters the window.
146 */
147typedef struct _Ecore_Win32_Event_Mouse_In Ecore_Win32_Event_Mouse_In;
148
149/**
150 * @typedef Ecore_Win32_Event_Mouse_Out
151 * Event sent when the mouse leaves the window.
152 */
153typedef struct _Ecore_Win32_Event_Mouse_Out Ecore_Win32_Event_Mouse_Out;
154
155/**
156 * @typedef Ecore_Win32_Event_Window_Focus_In
157 * Event sent when the window gets the focus.
158 */
159typedef struct _Ecore_Win32_Event_Window_Focus_In Ecore_Win32_Event_Window_Focus_In;
160
161/**
162 * @typedef Ecore_Win32_Event_Window_Focus_Out
163 * Event sent when the window looses the focus.
164 */
165typedef struct _Ecore_Win32_Event_Window_Focus_Out Ecore_Win32_Event_Window_Focus_Out;
166
167/**
168 * @typedef Ecore_Win32_Event_Window_Damage
169 * Event sent when the window is damaged.
170 */
171typedef struct _Ecore_Win32_Event_Window_Damage Ecore_Win32_Event_Window_Damage;
172
173/**
174 * @typedef Ecore_Win32_Event_Window_Create
175 * Event sent when the window is created.
176 */
177typedef struct _Ecore_Win32_Event_Window_Create Ecore_Win32_Event_Window_Create;
178
179/**
180 * @typedef Ecore_Win32_Event_Window_Destroy
181 * Event sent when the window is destroyed.
182 */
183typedef struct _Ecore_Win32_Event_Window_Destroy Ecore_Win32_Event_Window_Destroy;
184
185/**
186 * @typedef Ecore_Win32_Event_Window_Hide
187 * Event sent when the window is hidden.
188 */
189typedef struct _Ecore_Win32_Event_Window_Hide Ecore_Win32_Event_Window_Hide;
190
191/**
192 * @typedef Ecore_Win32_Event_Window_Show
193 * Event sent when the window is shown.
194 */
195typedef struct _Ecore_Win32_Event_Window_Show Ecore_Win32_Event_Window_Show;
196
197/**
198 * @typedef Ecore_Win32_Event_Window_Configure
199 * Event sent when the window is configured.
200 */
201typedef struct _Ecore_Win32_Event_Window_Configure Ecore_Win32_Event_Window_Configure;
202
203/**
204 * @typedef Ecore_Win32_Event_Window_Resize
205 * Event sent when the window is resized.
206 */
207typedef struct _Ecore_Win32_Event_Window_Resize Ecore_Win32_Event_Window_Resize;
208
209/**
210 * @typedef Ecore_Win32_Event_Window_Delete_Request
211 * Event sent when the window is deleted.
212 */
213typedef struct _Ecore_Win32_Event_Window_Delete_Request Ecore_Win32_Event_Window_Delete_Request;
214
215/**
216 * @struct _Ecore_Win32_Event_Mouse_In
217 * Event sent when the mouse enters the window.
218 */
219struct _Ecore_Win32_Event_Mouse_In
220{
221 Ecore_Win32_Window *window; /**< The window that received the event */
222 int x; /**< The x coordinate where the mouse leaved */
223 int y; /**< The y coordinate where the mouse entered */
224 unsigned long timestamp; /**< The time the event occurred */
225};
226
227/**
228 * @struct _Ecore_Win32_Event_Mouse_Out
229 * Event sent when the mouse leaves the window.
230 */
231struct _Ecore_Win32_Event_Mouse_Out
232{
233 Ecore_Win32_Window *window; /**< The window that received the event */
234 int x; /**< The x coordinate where the mouse leaved */
235 int y; /**< The y coordinate where the mouse leaved */
236 unsigned long timestamp; /**< The time the event occurred */
237};
238
239/**
240 * @struct _Ecore_Win32_Event_Window_Focus_In
241 * Event sent when the window gets the focus.
242 */
243struct _Ecore_Win32_Event_Window_Focus_In
244{
245 Ecore_Win32_Window *window; /**< The window that received the event */
246 unsigned long timestamp; /**< The time the event occurred */
247};
248
249/**
250 * @struct _Ecore_Win32_Event_Window_Focus_Out
251 * Event sent when the window looses the focus.
252 */
253struct _Ecore_Win32_Event_Window_Focus_Out
254{
255 Ecore_Win32_Window *window; /**< The window that received the event */
256 unsigned long timestamp; /**< The time the event occurred */
257};
258
259/**
260 * @struct _Ecore_Win32_Event_Window_Damage
261 * Event sent when the window is damaged.
262 */
263struct _Ecore_Win32_Event_Window_Damage
264{
265 Ecore_Win32_Window *window; /**< The window that received the event */
266 int x; /**< The x coordinate of the top left corner of the damaged region */
267 int y; /**< The y coordinate of the top left corner of the damaged region */
268 int width; /**< The width of the damaged region */
269 int height; /**< The time the event occurred */
270 unsigned long timestamp; /**< The time the event occurred */
271};
272
273/**
274 * @struct _Ecore_Win32_Event_Window_Create
275 * Event sent when the window is created.
276 */
277struct _Ecore_Win32_Event_Window_Create
278{
279 Ecore_Win32_Window *window; /**< The window that received the event */
280 unsigned long timestamp; /**< The time the event occurred */
281};
282
283/**
284 * @struct _Ecore_Win32_Event_Window_Destroy
285 * Event sent when the window is destroyed.
286 */
287struct _Ecore_Win32_Event_Window_Destroy
288{
289 Ecore_Win32_Window *window; /**< The window that received the event */
290 unsigned long timestamp; /**< The time the event occurred */
291};
292
293/**
294 * @struct _Ecore_Win32_Event_Window_Hide
295 * Event sent when the window is hidden.
296 */
297struct _Ecore_Win32_Event_Window_Hide
298{
299 Ecore_Win32_Window *window; /**< The window that received the event */
300 unsigned long timestamp; /**< The time the event occurred */
301};
302
303/**
304 * @struct _Ecore_Win32_Event_Window_Show
305 * Event sent when the window is shown.
306 */
307struct _Ecore_Win32_Event_Window_Show
308{
309 Ecore_Win32_Window *window; /**< The window that received the event */
310 unsigned long timestamp; /**< The time the event occurred */
311};
312
313/**
314 * @struct _Ecore_Win32_Event_Window_Configure
315 * Event sent when the window is configured.
316 */
317struct _Ecore_Win32_Event_Window_Configure
318{
319 Ecore_Win32_Window *window; /**< The window that received the event */
320 Ecore_Win32_Window *abovewin;
321 int x; /**< The new x coordinate of the top left corner */
322 int y; /**< The new y coordinate of the top left corner */
323 int width; /**< The new width */
324 int height; /**< The new height */
325 unsigned long timestamp; /**< The time the event occurred */
326};
327
328/**
329 * @struct _Ecore_Win32_Event_Window_Resize
330 * Event sent when the window is resized.
331 */
332struct _Ecore_Win32_Event_Window_Resize
333{
334 Ecore_Win32_Window *window; /**< The window that received the event */
335 int width; /**< The new width */
336 int height; /**< The new height */
337 unsigned long timestamp; /**< The time the event occurred */
338};
339
340/**
341 * @struct _Ecore_Win32_Event_Window_Delete_Request
342 * Event sent when the window is deleted.
343 */
344struct _Ecore_Win32_Event_Window_Delete_Request
345{
346 Ecore_Win32_Window *window; /**< The window that received the event */
347 unsigned long timestamp; /**< The time the event occurred */
348};
349
350/**
351 * @typedef Ecore_Win32_Dnd_DropTarget_Callback
352 * Callback type for Drop operations. See ecore_win32_dnd_register_drop_target().
353 */
354typedef int (*Ecore_Win32_Dnd_DropTarget_Callback)(void *window, int event, int pt_x, int pt_y, void *data, int size);
355
356EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_In event */
357EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_Out event */
358EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_In event */
359EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_Out event */
360EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the #Ecore_Win32_Event_Damage event */
361EAPI extern int ECORE_WIN32_EVENT_WINDOW_CREATE; /**< Ecore_Event for the #Ecore_Win32_Event_Create event */
362EAPI extern int ECORE_WIN32_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the #Ecore_Win32_Event_Destroy event */
363EAPI extern int ECORE_WIN32_EVENT_WINDOW_HIDE; /**< Ecore_Event for the #Ecore_Win32_Event_Hide event */
364EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW; /**< Ecore_Event for the #Ecore_Win32_Event_Show event */
365EAPI extern int ECORE_WIN32_EVENT_WINDOW_CONFIGURE; /**< Ecore_Event for the #Ecore_Win32_Event_Configure event */
366EAPI extern int ECORE_WIN32_EVENT_WINDOW_RESIZE; /**< Ecore_Event for the #Ecore_Win32_Event_Resize event */
367EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Delete_Request event */
368
369
370/* Core */
371
372EAPI int ecore_win32_init();
373EAPI int ecore_win32_shutdown();
374EAPI int ecore_win32_screen_depth_get();
375EAPI void ecore_win32_double_click_time_set(double t);
376EAPI double ecore_win32_double_click_time_get(void);
377EAPI unsigned long ecore_win32_current_time_get(void);
378
379/* Window */
380
381EAPI Ecore_Win32_Window *ecore_win32_window_new(Ecore_Win32_Window *parent,
382 int x,
383 int y,
384 int width,
385 int height);
386EAPI Ecore_Win32_Window *ecore_win32_window_override_new(Ecore_Win32_Window *parent,
387 int x,
388 int y,
389 int width,
390 int height);
391
392EAPI void ecore_win32_window_free(Ecore_Win32_Window *window);
393
394EAPI void *ecore_win32_window_hwnd_get(Ecore_Win32_Window *window);
395
396EAPI void ecore_win32_window_move(Ecore_Win32_Window *window,
397 int x,
398 int y);
399
400EAPI void ecore_win32_window_resize(Ecore_Win32_Window *window,
401 int width,
402 int height);
403
404EAPI void ecore_win32_window_move_resize(Ecore_Win32_Window *window,
405 int x,
406 int y,
407 int width,
408 int height);
409
410EAPI void ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
411 int *x,
412 int *y,
413 int *width,
414 int *height);
415
416EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window,
417 int *width,
418 int *height);
419
420EAPI void ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
421 unsigned int min_width,
422 unsigned int min_height);
423
424EAPI void ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
425 unsigned int *min_width,
426 unsigned int *min_height);
427
428EAPI void ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
429 unsigned int max_width,
430 unsigned int max_height);
431
432EAPI void ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
433 unsigned int *max_width,
434 unsigned int *max_height);
435
436EAPI void ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
437 unsigned int base_width,
438 unsigned int base_height);
439
440EAPI void ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
441 unsigned int *base_width,
442 unsigned int *base_height);
443
444EAPI void ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
445 unsigned int step_width,
446 unsigned int step_height);
447
448EAPI void ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
449 unsigned int *step_width,
450 unsigned int *step_height);
451
452EAPI void ecore_win32_window_show(Ecore_Win32_Window *window);
453
454EAPI void ecore_win32_window_hide(Ecore_Win32_Window *window);
455
456EAPI void ecore_win32_window_raise(Ecore_Win32_Window *window);
457
458EAPI void ecore_win32_window_lower(Ecore_Win32_Window *window);
459
460EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window,
461 const char *title);
462
463EAPI void ecore_win32_window_focus(Ecore_Win32_Window *window);
464
465EAPI void *ecore_win32_window_focus_get(void);
466
467EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
468 Eina_Bool on);
469
470EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
471 Eina_Bool on);
472
473EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
474 Eina_Bool on);
475
476EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
477 Ecore_Win32_Cursor *cursor);
478
479EAPI void ecore_win32_window_state_set(Ecore_Win32_Window *window,
480 Ecore_Win32_Window_State *state,
481 unsigned int num);
482
483EAPI void ecore_win32_window_state_request_send(Ecore_Win32_Window *window,
484 Ecore_Win32_Window_State state,
485 unsigned int set);
486
487EAPI void ecore_win32_window_type_set(Ecore_Win32_Window *window,
488 Ecore_Win32_Window_Type type);
489
490/* Cursor */
491
492EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and,
493 const void *pixels_xor,
494 int width,
495 int height,
496 int hot_x,
497 int hot_y);
498
499EAPI void ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor);
500
501EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape);
502
503EAPI void ecore_win32_cursor_size_get(int *width, int *height);
504
505
506
507/* Drag and drop */
508EAPI int ecore_win32_dnd_init();
509EAPI int ecore_win32_dnd_shutdown();
510EAPI Eina_Bool ecore_win32_dnd_begin(const char *data,
511 int size);
512EAPI Eina_Bool ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *window,
513 Ecore_Win32_Dnd_DropTarget_Callback callback);
514EAPI void ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window);
515
516/**
517 * @}
518 */
519
520
521#ifdef __cplusplus
522}
523#endif
524
525
526#endif /* __ECORE_WIN32_H__ */
diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.am b/libraries/ecore/src/lib/ecore_win32/Makefile.am
deleted file mode 100644
index ce317c7..0000000
--- a/libraries/ecore/src/lib/ecore_win32/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_input \
6-I$(top_builddir)/src/lib/ecore \
7-I$(top_builddir)/src/lib/ecore_input \
8@EFL_ECORE_WIN32_BUILD@ \
9@EINA_CFLAGS@ \
10@WIN32_CPPFLAGS@
11
12lib_LTLIBRARIES = libecore_win32.la
13
14includes_HEADERS = Ecore_Win32.h
15includesdir = $(includedir)/ecore-@VMAJ@
16
17libecore_win32_la_SOURCES = \
18ecore_win32.c \
19ecore_win32_cursor.c \
20ecore_win32_dnd.c \
21ecore_win32_dnd_enumformatetc.cpp \
22ecore_win32_dnd_data_object.cpp \
23ecore_win32_dnd_drop_source.cpp \
24ecore_win32_dnd_drop_target.cpp \
25ecore_win32_event.c \
26ecore_win32_window.c
27
28libecore_win32_la_LIBADD = \
29@ecore_win32_libs@ \
30@WIN32_LIBS@ \
31$(top_builddir)/src/lib/ecore/libecore.la \
32$(top_builddir)/src/lib/ecore_input/libecore_input.la \
33@EINA_LIBS@
34
35libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
36
37EXTRA_DIST = \
38ecore_win32_private.h \
39ecore_win32_dnd_enumformatetc.h \
40ecore_win32_dnd_data_object.h \
41ecore_win32_dnd_drop_source.h \
42ecore_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
deleted file mode 100644
index b512021..0000000
--- a/libraries/ecore/src/lib/ecore_win32/Makefile.in
+++ /dev/null
@@ -1,901 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_win32
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_win32_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore/libecore.la \
90 $(top_builddir)/src/lib/ecore_input/libecore_input.la
91am_libecore_win32_la_OBJECTS = ecore_win32.lo ecore_win32_cursor.lo \
92 ecore_win32_dnd.lo ecore_win32_dnd_enumformatetc.lo \
93 ecore_win32_dnd_data_object.lo ecore_win32_dnd_drop_source.lo \
94 ecore_win32_dnd_drop_target.lo ecore_win32_event.lo \
95 ecore_win32_window.lo
96libecore_win32_la_OBJECTS = $(am_libecore_win32_la_OBJECTS)
97AM_V_lt = $(am__v_lt_$(V))
98am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
99am__v_lt_0 = --silent
100libecore_win32_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
101 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
102 $(AM_CXXFLAGS) $(CXXFLAGS) $(libecore_win32_la_LDFLAGS) \
103 $(LDFLAGS) -o $@
104DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
105depcomp = $(SHELL) $(top_srcdir)/depcomp
106am__depfiles_maybe = depfiles
107am__mv = mv -f
108COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
109 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
110LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
111 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
112 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
113 $(AM_CFLAGS) $(CFLAGS)
114AM_V_CC = $(am__v_CC_$(V))
115am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
116am__v_CC_0 = @echo " CC " $@;
117AM_V_at = $(am__v_at_$(V))
118am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
119am__v_at_0 = @
120CCLD = $(CC)
121LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
122 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
123 $(AM_LDFLAGS) $(LDFLAGS) -o $@
124AM_V_CCLD = $(am__v_CCLD_$(V))
125am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
126am__v_CCLD_0 = @echo " CCLD " $@;
127CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
128 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
129LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
130 $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
131 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
132 $(AM_CXXFLAGS) $(CXXFLAGS)
133AM_V_CXX = $(am__v_CXX_$(V))
134am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
135am__v_CXX_0 = @echo " CXX " $@;
136CXXLD = $(CXX)
137CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
138 $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
139 $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
140AM_V_CXXLD = $(am__v_CXXLD_$(V))
141am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
142am__v_CXXLD_0 = @echo " CXXLD " $@;
143AM_V_GEN = $(am__v_GEN_$(V))
144am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
145am__v_GEN_0 = @echo " GEN " $@;
146SOURCES = $(libecore_win32_la_SOURCES)
147DIST_SOURCES = $(libecore_win32_la_SOURCES)
148HEADERS = $(includes_HEADERS)
149ETAGS = etags
150CTAGS = ctags
151DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
152ACLOCAL = @ACLOCAL@
153ALLOCA = @ALLOCA@
154AMTAR = @AMTAR@
155AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
156AR = @AR@
157AS = @AS@
158AUTOCONF = @AUTOCONF@
159AUTOHEADER = @AUTOHEADER@
160AUTOMAKE = @AUTOMAKE@
161AWK = @AWK@
162CARES_CFLAGS = @CARES_CFLAGS@
163CARES_LIBS = @CARES_LIBS@
164CC = @CC@
165CCDEPMODE = @CCDEPMODE@
166CFLAGS = @CFLAGS@
167CHECK_CFLAGS = @CHECK_CFLAGS@
168CHECK_LIBS = @CHECK_LIBS@
169CPP = @CPP@
170CPPFLAGS = @CPPFLAGS@
171CURL_CFLAGS = @CURL_CFLAGS@
172CURL_LIBS = @CURL_LIBS@
173CXX = @CXX@
174CXXCPP = @CXXCPP@
175CXXDEPMODE = @CXXDEPMODE@
176CXXFLAGS = @CXXFLAGS@
177CYGPATH_W = @CYGPATH_W@
178DEFS = @DEFS@
179DEPDIR = @DEPDIR@
180DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
181DIRECTFB_LIBS = @DIRECTFB_LIBS@
182DLLTOOL = @DLLTOOL@
183DSYMUTIL = @DSYMUTIL@
184DUMPBIN = @DUMPBIN@
185ECHO_C = @ECHO_C@
186ECHO_N = @ECHO_N@
187ECHO_T = @ECHO_T@
188ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
189ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
190EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
191EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
192EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
193EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
194EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
195EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
196EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
197EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
198EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
199EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
200EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
201EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
202EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
203EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
204EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
205EGREP = @EGREP@
206EINA_CFLAGS = @EINA_CFLAGS@
207EINA_LIBS = @EINA_LIBS@
208ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
209ESCAPE_LIBS = @ESCAPE_LIBS@
210EVAS_CFLAGS = @EVAS_CFLAGS@
211EVAS_LIBS = @EVAS_LIBS@
212EVIL_CFLAGS = @EVIL_CFLAGS@
213EVIL_LIBS = @EVIL_LIBS@
214EXEEXT = @EXEEXT@
215EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
216EXOTIC_LIBS = @EXOTIC_LIBS@
217FGREP = @FGREP@
218GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
219GLIB_CFLAGS = @GLIB_CFLAGS@
220GLIB_LIBS = @GLIB_LIBS@
221GMSGFMT = @GMSGFMT@
222GMSGFMT_015 = @GMSGFMT_015@
223GREP = @GREP@
224INSTALL = @INSTALL@
225INSTALL_DATA = @INSTALL_DATA@
226INSTALL_PROGRAM = @INSTALL_PROGRAM@
227INSTALL_SCRIPT = @INSTALL_SCRIPT@
228INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
229INTLLIBS = @INTLLIBS@
230INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
231KEYSYMDEFS = @KEYSYMDEFS@
232LD = @LD@
233LDFLAGS = @LDFLAGS@
234LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
235LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
236LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
237LIBICONV = @LIBICONV@
238LIBINTL = @LIBINTL@
239LIBOBJS = @LIBOBJS@
240LIBS = @LIBS@
241LIBTOOL = @LIBTOOL@
242LIPO = @LIPO@
243LN_S = @LN_S@
244LTLIBICONV = @LTLIBICONV@
245LTLIBINTL = @LTLIBINTL@
246LTLIBOBJS = @LTLIBOBJS@
247MAKEINFO = @MAKEINFO@
248MKDIR_P = @MKDIR_P@
249MSGFMT = @MSGFMT@
250MSGFMT_015 = @MSGFMT_015@
251MSGMERGE = @MSGMERGE@
252NM = @NM@
253NMEDIT = @NMEDIT@
254OBJC = @OBJC@
255OBJCDEPMODE = @OBJCDEPMODE@
256OBJCFLAGS = @OBJCFLAGS@
257OBJDUMP = @OBJDUMP@
258OBJEXT = @OBJEXT@
259OTOOL = @OTOOL@
260OTOOL64 = @OTOOL64@
261PACKAGE = @PACKAGE@
262PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
263PACKAGE_NAME = @PACKAGE_NAME@
264PACKAGE_STRING = @PACKAGE_STRING@
265PACKAGE_TARNAME = @PACKAGE_TARNAME@
266PACKAGE_URL = @PACKAGE_URL@
267PACKAGE_VERSION = @PACKAGE_VERSION@
268PATH_SEPARATOR = @PATH_SEPARATOR@
269PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
270PIXMAN_LIBS = @PIXMAN_LIBS@
271PKG_CONFIG = @PKG_CONFIG@
272PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
273PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
274POSUB = @POSUB@
275RANLIB = @RANLIB@
276SCIM_CFLAGS = @SCIM_CFLAGS@
277SCIM_LIBS = @SCIM_LIBS@
278SDL_CFLAGS = @SDL_CFLAGS@
279SDL_CONFIG = @SDL_CONFIG@
280SDL_LIBS = @SDL_LIBS@
281SED = @SED@
282SET_MAKE = @SET_MAKE@
283SHELL = @SHELL@
284SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
285SSL_CFLAGS = @SSL_CFLAGS@
286SSL_LIBS = @SSL_LIBS@
287STRIP = @STRIP@
288TLS2_CFLAGS = @TLS2_CFLAGS@
289TLS2_LIBS = @TLS2_LIBS@
290TLS_CFLAGS = @TLS_CFLAGS@
291TLS_LIBS = @TLS_LIBS@
292TSLIB_CFLAGS = @TSLIB_CFLAGS@
293TSLIB_LIBS = @TSLIB_LIBS@
294USE_NLS = @USE_NLS@
295VERSION = @VERSION@
296VMAJ = @VMAJ@
297WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
298WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
299WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
300WAYLAND_LIBS = @WAYLAND_LIBS@
301WIN32_CFLAGS = @WIN32_CFLAGS@
302WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
303WIN32_LIBS = @WIN32_LIBS@
304XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
305XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
306XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
307XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
308XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
309XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
310XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
311XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
312XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
313XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
314XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
315XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
316XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
317XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
318XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
319XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
320XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
321XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
322XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
323XCB_X11_LIBS = @XCB_X11_LIBS@
324XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
325XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
326XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
327XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
328XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
329XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
330XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
331XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
332XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
333XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
334XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
335XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
336XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
337XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
338XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
339XDAMAGE_LIBS = @XDAMAGE_LIBS@
340XDPMS_CFLAGS = @XDPMS_CFLAGS@
341XDPMS_LIBS = @XDPMS_LIBS@
342XFIXES_CFLAGS = @XFIXES_CFLAGS@
343XFIXES_LIBS = @XFIXES_LIBS@
344XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
345XGESTURE_LIBS = @XGESTURE_LIBS@
346XGETTEXT = @XGETTEXT@
347XGETTEXT_015 = @XGETTEXT_015@
348XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
349XI2_CFLAGS = @XI2_CFLAGS@
350XI2_LIBS = @XI2_LIBS@
351XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
352XINERAMA_LIBS = @XINERAMA_LIBS@
353XKB_CFLAGS = @XKB_CFLAGS@
354XKB_LIBS = @XKB_LIBS@
355XMKMF = @XMKMF@
356XPRINT_CFLAGS = @XPRINT_CFLAGS@
357XPRINT_LIBS = @XPRINT_LIBS@
358XRANDR_CFLAGS = @XRANDR_CFLAGS@
359XRANDR_LIBS = @XRANDR_LIBS@
360XRENDER_CFLAGS = @XRENDER_CFLAGS@
361XRENDER_LIBS = @XRENDER_LIBS@
362XSS_CFLAGS = @XSS_CFLAGS@
363XSS_LIBS = @XSS_LIBS@
364XTEST_CFLAGS = @XTEST_CFLAGS@
365XTEST_LIBS = @XTEST_LIBS@
366X_CFLAGS = @X_CFLAGS@
367X_EXTRA_LIBS = @X_EXTRA_LIBS@
368X_LIBS = @X_LIBS@
369X_PRE_LIBS = @X_PRE_LIBS@
370Xcursor_cflags = @Xcursor_cflags@
371Xcursor_libs = @Xcursor_libs@
372abs_builddir = @abs_builddir@
373abs_srcdir = @abs_srcdir@
374abs_top_builddir = @abs_top_builddir@
375abs_top_srcdir = @abs_top_srcdir@
376ac_ct_CC = @ac_ct_CC@
377ac_ct_CXX = @ac_ct_CXX@
378ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
379ac_ct_OBJC = @ac_ct_OBJC@
380am__include = @am__include@
381am__leading_dot = @am__leading_dot@
382am__quote = @am__quote@
383am__tar = @am__tar@
384am__untar = @am__untar@
385bindir = @bindir@
386build = @build@
387build_alias = @build_alias@
388build_cpu = @build_cpu@
389build_os = @build_os@
390build_vendor = @build_vendor@
391builddir = @builddir@
392cocoa_ldflags = @cocoa_ldflags@
393datadir = @datadir@
394datarootdir = @datarootdir@
395dlopen_libs = @dlopen_libs@
396docdir = @docdir@
397dvidir = @dvidir@
398ecore_cocoa_cflags = @ecore_cocoa_cflags@
399ecore_cocoa_libs = @ecore_cocoa_libs@
400ecore_con_cflags = @ecore_con_cflags@
401ecore_con_libs = @ecore_con_libs@
402ecore_directfb_cflags = @ecore_directfb_cflags@
403ecore_directfb_libs = @ecore_directfb_libs@
404ecore_evas_cflags = @ecore_evas_cflags@
405ecore_evas_libs = @ecore_evas_libs@
406ecore_fb_cflags = @ecore_fb_cflags@
407ecore_fb_libs = @ecore_fb_libs@
408ecore_file_cflags = @ecore_file_cflags@
409ecore_file_libs = @ecore_file_libs@
410ecore_imf_cflags = @ecore_imf_cflags@
411ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
412ecore_imf_evas_libs = @ecore_imf_evas_libs@
413ecore_imf_libs = @ecore_imf_libs@
414ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
415ecore_imf_scim_libs = @ecore_imf_scim_libs@
416ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
417ecore_imf_xim_libs = @ecore_imf_xim_libs@
418ecore_input_cflags = @ecore_input_cflags@
419ecore_input_evas_cflags = @ecore_input_evas_cflags@
420ecore_input_evas_libs = @ecore_input_evas_libs@
421ecore_input_libs = @ecore_input_libs@
422ecore_ipc_cflags = @ecore_ipc_cflags@
423ecore_ipc_libs = @ecore_ipc_libs@
424ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
425ecore_psl1ght_libs = @ecore_psl1ght_libs@
426ecore_sdl_cflags = @ecore_sdl_cflags@
427ecore_sdl_libs = @ecore_sdl_libs@
428ecore_wayland_cflags = @ecore_wayland_cflags@
429ecore_wayland_libs = @ecore_wayland_libs@
430ecore_win32_cflags = @ecore_win32_cflags@
431ecore_win32_libs = @ecore_win32_libs@
432ecore_wince_cflags = @ecore_wince_cflags@
433ecore_wince_libs = @ecore_wince_libs@
434ecore_x_cflags = @ecore_x_cflags@
435ecore_x_libs = @ecore_x_libs@
436ecore_x_libs_private = @ecore_x_libs_private@
437efl_doxygen = @efl_doxygen@
438efl_have_doxygen = @efl_have_doxygen@
439exec_prefix = @exec_prefix@
440have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
441host = @host@
442host_alias = @host_alias@
443host_cpu = @host_cpu@
444host_os = @host_os@
445host_vendor = @host_vendor@
446htmldir = @htmldir@
447includedir = @includedir@
448infodir = @infodir@
449install_sh = @install_sh@
450libdir = @libdir@
451libexecdir = @libexecdir@
452localedir = @localedir@
453localstatedir = @localstatedir@
454lt_ECHO = @lt_ECHO@
455lt_enable_auto_import = @lt_enable_auto_import@
456mandir = @mandir@
457mkdir_p = @mkdir_p@
458oldincludedir = @oldincludedir@
459pdfdir = @pdfdir@
460pkgconfig_requires_private = @pkgconfig_requires_private@
461prefix = @prefix@
462program_transform_name = @program_transform_name@
463psdir = @psdir@
464release_info = @release_info@
465requirements_ecore = @requirements_ecore@
466requirements_ecore_cocoa = @requirements_ecore_cocoa@
467requirements_ecore_con = @requirements_ecore_con@
468requirements_ecore_directfb = @requirements_ecore_directfb@
469requirements_ecore_evas = @requirements_ecore_evas@
470requirements_ecore_fb = @requirements_ecore_fb@
471requirements_ecore_file = @requirements_ecore_file@
472requirements_ecore_imf = @requirements_ecore_imf@
473requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
474requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
475requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
476requirements_ecore_input = @requirements_ecore_input@
477requirements_ecore_input_evas = @requirements_ecore_input_evas@
478requirements_ecore_ipc = @requirements_ecore_ipc@
479requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
480requirements_ecore_sdl = @requirements_ecore_sdl@
481requirements_ecore_wayland = @requirements_ecore_wayland@
482requirements_ecore_win32 = @requirements_ecore_win32@
483requirements_ecore_wince = @requirements_ecore_wince@
484requirements_ecore_x = @requirements_ecore_x@
485rt_libs = @rt_libs@
486sbindir = @sbindir@
487sharedstatedir = @sharedstatedir@
488srcdir = @srcdir@
489sysconfdir = @sysconfdir@
490target_alias = @target_alias@
491top_build_prefix = @top_build_prefix@
492top_builddir = @top_builddir@
493top_srcdir = @top_srcdir@
494version_info = @version_info@
495x_cflags = @x_cflags@
496x_includes = @x_includes@
497x_libs = @x_libs@
498MAINTAINERCLEANFILES = Makefile.in
499AM_CPPFLAGS = \
500-I$(top_srcdir)/src/lib/ecore \
501-I$(top_srcdir)/src/lib/ecore_input \
502-I$(top_builddir)/src/lib/ecore \
503-I$(top_builddir)/src/lib/ecore_input \
504@EFL_ECORE_WIN32_BUILD@ \
505@EINA_CFLAGS@ \
506@WIN32_CPPFLAGS@
507
508lib_LTLIBRARIES = libecore_win32.la
509includes_HEADERS = Ecore_Win32.h
510includesdir = $(includedir)/ecore-@VMAJ@
511libecore_win32_la_SOURCES = \
512ecore_win32.c \
513ecore_win32_cursor.c \
514ecore_win32_dnd.c \
515ecore_win32_dnd_enumformatetc.cpp \
516ecore_win32_dnd_data_object.cpp \
517ecore_win32_dnd_drop_source.cpp \
518ecore_win32_dnd_drop_target.cpp \
519ecore_win32_event.c \
520ecore_win32_window.c
521
522libecore_win32_la_LIBADD = \
523@ecore_win32_libs@ \
524@WIN32_LIBS@ \
525$(top_builddir)/src/lib/ecore/libecore.la \
526$(top_builddir)/src/lib/ecore_input/libecore_input.la \
527@EINA_LIBS@
528
529libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
530EXTRA_DIST = \
531ecore_win32_private.h \
532ecore_win32_dnd_enumformatetc.h \
533ecore_win32_dnd_data_object.h \
534ecore_win32_dnd_drop_source.h \
535ecore_win32_dnd_drop_target.h
536
537all: all-am
538
539.SUFFIXES:
540.SUFFIXES: .c .cpp .lo .o .obj
541$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
542 @for dep in $?; do \
543 case '$(am__configure_deps)' in \
544 *$$dep*) \
545 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
546 && { if test -f $@; then exit 0; else break; fi; }; \
547 exit 1;; \
548 esac; \
549 done; \
550 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_win32/Makefile'; \
551 $(am__cd) $(top_srcdir) && \
552 $(AUTOMAKE) --gnu src/lib/ecore_win32/Makefile
553.PRECIOUS: Makefile
554Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
555 @case '$?' in \
556 *config.status*) \
557 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
558 *) \
559 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
560 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
561 esac;
562
563$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
564 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
565
566$(top_srcdir)/configure: $(am__configure_deps)
567 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
568$(ACLOCAL_M4): $(am__aclocal_m4_deps)
569 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
570$(am__aclocal_m4_deps):
571install-libLTLIBRARIES: $(lib_LTLIBRARIES)
572 @$(NORMAL_INSTALL)
573 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
574 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
575 list2=; for p in $$list; do \
576 if test -f $$p; then \
577 list2="$$list2 $$p"; \
578 else :; fi; \
579 done; \
580 test -z "$$list2" || { \
581 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
582 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
583 }
584
585uninstall-libLTLIBRARIES:
586 @$(NORMAL_UNINSTALL)
587 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
588 for p in $$list; do \
589 $(am__strip_dir) \
590 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
591 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
592 done
593
594clean-libLTLIBRARIES:
595 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
596 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
597 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
598 test "$$dir" != "$$p" || dir=.; \
599 echo "rm -f \"$${dir}/so_locations\""; \
600 rm -f "$${dir}/so_locations"; \
601 done
602libecore_win32.la: $(libecore_win32_la_OBJECTS) $(libecore_win32_la_DEPENDENCIES)
603 $(AM_V_CXXLD)$(libecore_win32_la_LINK) -rpath $(libdir) $(libecore_win32_la_OBJECTS) $(libecore_win32_la_LIBADD) $(LIBS)
604
605mostlyclean-compile:
606 -rm -f *.$(OBJEXT)
607
608distclean-compile:
609 -rm -f *.tab.c
610
611@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32.Plo@am__quote@
612@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_cursor.Plo@am__quote@
613@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd.Plo@am__quote@
614@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_data_object.Plo@am__quote@
615@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_drop_source.Plo@am__quote@
616@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_drop_target.Plo@am__quote@
617@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_enumformatetc.Plo@am__quote@
618@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_event.Plo@am__quote@
619@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_window.Plo@am__quote@
620
621.c.o:
622@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
623@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
624@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
625@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
626@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
627@am__fastdepCC_FALSE@ $(COMPILE) -c $<
628
629.c.obj:
630@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
631@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
632@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
633@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
634@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
635@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
636
637.c.lo:
638@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
639@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
640@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
641@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
642@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
643@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
644
645.cpp.o:
646@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
647@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
648@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
649@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
650@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
651@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
652
653.cpp.obj:
654@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
655@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
656@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
657@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
658@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
659@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
660
661.cpp.lo:
662@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
663@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
664@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
665@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
666@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
667@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
668
669mostlyclean-libtool:
670 -rm -f *.lo
671
672clean-libtool:
673 -rm -rf .libs _libs
674install-includesHEADERS: $(includes_HEADERS)
675 @$(NORMAL_INSTALL)
676 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
677 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
678 for p in $$list; do \
679 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
680 echo "$$d$$p"; \
681 done | $(am__base_list) | \
682 while read files; do \
683 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
684 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
685 done
686
687uninstall-includesHEADERS:
688 @$(NORMAL_UNINSTALL)
689 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
690 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
691 test -n "$$files" || exit 0; \
692 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
693 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
694
695ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
696 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
697 unique=`for i in $$list; do \
698 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
699 done | \
700 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
701 END { if (nonempty) { for (i in files) print i; }; }'`; \
702 mkid -fID $$unique
703tags: TAGS
704
705TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
706 $(TAGS_FILES) $(LISP)
707 set x; \
708 here=`pwd`; \
709 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
710 unique=`for i in $$list; do \
711 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
712 done | \
713 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
714 END { if (nonempty) { for (i in files) print i; }; }'`; \
715 shift; \
716 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
717 test -n "$$unique" || unique=$$empty_fix; \
718 if test $$# -gt 0; then \
719 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
720 "$$@" $$unique; \
721 else \
722 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
723 $$unique; \
724 fi; \
725 fi
726ctags: CTAGS
727CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
728 $(TAGS_FILES) $(LISP)
729 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
730 unique=`for i in $$list; do \
731 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
732 done | \
733 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
734 END { if (nonempty) { for (i in files) print i; }; }'`; \
735 test -z "$(CTAGS_ARGS)$$unique" \
736 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
737 $$unique
738
739GTAGS:
740 here=`$(am__cd) $(top_builddir) && pwd` \
741 && $(am__cd) $(top_srcdir) \
742 && gtags -i $(GTAGS_ARGS) "$$here"
743
744distclean-tags:
745 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
746
747distdir: $(DISTFILES)
748 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
749 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
750 list='$(DISTFILES)'; \
751 dist_files=`for file in $$list; do echo $$file; done | \
752 sed -e "s|^$$srcdirstrip/||;t" \
753 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
754 case $$dist_files in \
755 */*) $(MKDIR_P) `echo "$$dist_files" | \
756 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
757 sort -u` ;; \
758 esac; \
759 for file in $$dist_files; do \
760 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
761 if test -d $$d/$$file; then \
762 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
763 if test -d "$(distdir)/$$file"; then \
764 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
765 fi; \
766 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
767 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
768 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
769 fi; \
770 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
771 else \
772 test -f "$(distdir)/$$file" \
773 || cp -p $$d/$$file "$(distdir)/$$file" \
774 || exit 1; \
775 fi; \
776 done
777check-am: all-am
778check: check-am
779all-am: Makefile $(LTLIBRARIES) $(HEADERS)
780installdirs:
781 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
782 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
783 done
784install: install-am
785install-exec: install-exec-am
786install-data: install-data-am
787uninstall: uninstall-am
788
789install-am: all-am
790 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
791
792installcheck: installcheck-am
793install-strip:
794 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
795 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
796 `test -z '$(STRIP)' || \
797 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
798mostlyclean-generic:
799
800clean-generic:
801
802distclean-generic:
803 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
804 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
805
806maintainer-clean-generic:
807 @echo "This command is intended for maintainers to use"
808 @echo "it deletes files that may require special tools to rebuild."
809 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
810clean: clean-am
811
812clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
813 mostlyclean-am
814
815distclean: distclean-am
816 -rm -rf ./$(DEPDIR)
817 -rm -f Makefile
818distclean-am: clean-am distclean-compile distclean-generic \
819 distclean-tags
820
821dvi: dvi-am
822
823dvi-am:
824
825html: html-am
826
827html-am:
828
829info: info-am
830
831info-am:
832
833install-data-am: install-includesHEADERS
834
835install-dvi: install-dvi-am
836
837install-dvi-am:
838
839install-exec-am: install-libLTLIBRARIES
840
841install-html: install-html-am
842
843install-html-am:
844
845install-info: install-info-am
846
847install-info-am:
848
849install-man:
850
851install-pdf: install-pdf-am
852
853install-pdf-am:
854
855install-ps: install-ps-am
856
857install-ps-am:
858
859installcheck-am:
860
861maintainer-clean: maintainer-clean-am
862 -rm -rf ./$(DEPDIR)
863 -rm -f Makefile
864maintainer-clean-am: distclean-am maintainer-clean-generic
865
866mostlyclean: mostlyclean-am
867
868mostlyclean-am: mostlyclean-compile mostlyclean-generic \
869 mostlyclean-libtool
870
871pdf: pdf-am
872
873pdf-am:
874
875ps: ps-am
876
877ps-am:
878
879uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
880
881.MAKE: install-am install-strip
882
883.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
884 clean-libLTLIBRARIES clean-libtool ctags distclean \
885 distclean-compile distclean-generic distclean-libtool \
886 distclean-tags distdir dvi dvi-am html html-am info info-am \
887 install install-am install-data install-data-am install-dvi \
888 install-dvi-am install-exec install-exec-am install-html \
889 install-html-am install-includesHEADERS install-info \
890 install-info-am install-libLTLIBRARIES install-man install-pdf \
891 install-pdf-am install-ps install-ps-am install-strip \
892 installcheck installcheck-am installdirs maintainer-clean \
893 maintainer-clean-generic mostlyclean mostlyclean-compile \
894 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
895 tags uninstall uninstall-am uninstall-includesHEADERS \
896 uninstall-libLTLIBRARIES
897
898
899# Tell versions [3.59,3.63) of GNU make to not export all variables.
900# Otherwise a system limit (for SysV at least) may be exceeded.
901.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c
deleted file mode 100644
index b571d74..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32.c
+++ /dev/null
@@ -1,841 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#define WIN32_LEAN_AND_MEAN
8#include <windows.h>
9#undef WIN32_LEAN_AND_MEAN
10#include <windowsx.h>
11
12#include <Eina.h>
13#include <Ecore.h>
14#include <Ecore_Input.h>
15
16#include "Ecore_Win32.h"
17#include "ecore_win32_private.h"
18
19/*============================================================================*
20 * Local *
21 *============================================================================*/
22
23/**
24 * @cond LOCAL
25 */
26
27/* OLE IID for Drag'n Drop */
28
29# define INITGUID
30# include <basetyps.h>
31DEFINE_OLEGUID(IID_IEnumFORMATETC, 0x00000103L, 0, 0);
32DEFINE_OLEGUID(IID_IDataObject, 0x0000010EL, 0, 0);
33DEFINE_OLEGUID(IID_IDropSource, 0x00000121L, 0, 0);
34DEFINE_OLEGUID(IID_IDropTarget, 0x00000122L, 0, 0);
35DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0);
36
37#define IDI_ICON 101
38
39static int _ecore_win32_init_count = 0;
40
41static void
42_ecore_win32_size_check(Ecore_Win32_Window *win, int w, int h, int *dx, int *dy)
43{
44 int minimal_width;
45 int minimal_height;
46
47 minimal_width = GetSystemMetrics(SM_CXMIN);
48 minimal_height = GetSystemMetrics(SM_CYMIN);
49 if ((w) < MAX(minimal_width, (int)win->min_width))
50 *dx = 0;
51 if ((w) > (int)win->max_width)
52 *dx = 0;
53 if ((h) < MAX(minimal_height, (int)win->min_height))
54 *dy = 0;
55 if ((h) > (int)win->max_height)
56 *dy = 0;
57}
58
59LRESULT CALLBACK
60_ecore_win32_window_procedure(HWND window,
61 UINT message,
62 WPARAM window_param,
63 LPARAM data_param)
64{
65 Ecore_Win32_Callback_Data *data;
66 POINTS point;
67 DWORD coord;
68
69 data = (Ecore_Win32_Callback_Data *)malloc(sizeof(Ecore_Win32_Callback_Data));
70 if (!data) return DefWindowProc(window, message, window_param, data_param);
71
72 data->window = window;
73 data->message = message;
74 data->window_param = window_param;
75 data->data_param = data_param;
76 data->timestamp = GetMessageTime();
77 coord = GetMessagePos();
78 point = MAKEPOINTS(coord);
79 data->x = point.x;
80 data->y = point.y;
81 data->discard_ctrl = EINA_FALSE;
82
83 switch (data->message)
84 {
85 /* Keyboard input notifications */
86 case WM_KEYDOWN:
87 case WM_SYSKEYDOWN:
88 if ((data->message == WM_KEYDOWN) &&
89 (data->window_param == VK_CONTROL) &&
90 ((HIWORD(data->data_param) & KF_EXTENDED) == 0))
91 {
92 /* Ctrl left key is pressed */
93 BOOL res;
94 MSG next_msg;
95
96 /*
97 * we check if the next message
98 * - is a WM_KEYDOWN
99 * - has the same timestamp than the Ctrl one
100 * - is the key press of the right Alt key
101 */
102 res = PeekMessage(&next_msg, data->window,
103 WM_KEYDOWN, WM_KEYDOWN,
104 PM_NOREMOVE);
105 if (res &&
106 (next_msg.wParam == VK_MENU) &&
107 (next_msg.time == data->timestamp) &&
108 (HIWORD(next_msg.lParam) & KF_EXTENDED))
109 {
110 INF("discard left Ctrl key press (sent by AltGr key press)");
111 data->discard_ctrl = EINA_TRUE;
112 }
113 }
114 _ecore_win32_event_handle_key_press(data, 1);
115 return 0;
116 case WM_CHAR:
117 case WM_SYSCHAR:
118 INF("char message");
119 _ecore_win32_event_handle_key_press(data, 0);
120 return 0;
121 case WM_KEYUP:
122 case WM_SYSKEYUP:
123 INF("keyup message");
124 if ((data->window_param == VK_CONTROL) &&
125 ((HIWORD(data->data_param) & KF_EXTENDED) == 0))
126 {
127 /* Ctrl left key is pressed */
128 BOOL res;
129 MSG next_msg;
130
131 /*
132 * we check if the next message
133 * - is a WM_KEYUP or WM_SYSKEYUP
134 * - has the same timestamp than the Ctrl one
135 * - is the key release of the right Alt key
136 */
137 res = PeekMessage(&next_msg, data->window,
138 WM_KEYUP, WM_SYSKEYUP,
139 PM_NOREMOVE);
140 if (res &&
141 ((next_msg.message == WM_KEYUP) ||
142 (next_msg.message == WM_SYSKEYUP)) &&
143 (next_msg.wParam == VK_MENU) &&
144 (next_msg.time == data->timestamp) &&
145 (HIWORD(next_msg.lParam) & KF_EXTENDED))
146 {
147 INF("discard left Ctrl key release (sent by AltGr key release)");
148 data->discard_ctrl = EINA_TRUE;
149 }
150 }
151 _ecore_win32_event_handle_key_release(data);
152 return 0;
153 case WM_SETFOCUS:
154 INF("setfocus message");
155 _ecore_win32_event_handle_focus_in(data);
156 return 0;
157 case WM_KILLFOCUS:
158 INF("kill focus message");
159 _ecore_win32_event_handle_focus_out(data);
160 return 0;
161 /* Mouse input notifications */
162 case WM_LBUTTONDOWN:
163 INF("left button down message");
164 SetCapture(window);
165 _ecore_win32_event_handle_button_press(data, 1);
166 return 0;
167 case WM_MBUTTONDOWN:
168 INF("middle button down message");
169 _ecore_win32_event_handle_button_press(data, 2);
170 return 0;
171 case WM_RBUTTONDOWN:
172 INF("right button down message");
173 _ecore_win32_event_handle_button_press(data, 3);
174 return 0;
175 case WM_LBUTTONUP:
176 {
177 Ecore_Win32_Window *w = NULL;
178
179 INF("left button up message");
180
181 ReleaseCapture();
182 w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA);
183 if (w->drag.dragging)
184 {
185 w->drag.dragging = 0;
186 return 0;
187 }
188
189 _ecore_win32_event_handle_button_release(data, 1);
190 return 0;
191 }
192 case WM_MBUTTONUP:
193 INF("middle button up message");
194 _ecore_win32_event_handle_button_release(data, 2);
195 return 0;
196 case WM_RBUTTONUP:
197 INF("right button up message");
198 _ecore_win32_event_handle_button_release(data, 3);
199 return 0;
200 case WM_MOUSEMOVE:
201 {
202 RECT rect;
203 Ecore_Win32_Window *w = NULL;
204
205 INF("moue move message");
206
207 w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA);
208
209 if (w->drag.dragging)
210 {
211 POINT pt;
212
213 pt.x = GET_X_LPARAM(data_param);
214 pt.y = GET_Y_LPARAM(data_param);
215 if (ClientToScreen(window, &pt))
216 {
217 if (w->drag.type == HTCAPTION)
218 {
219 int dx;
220 int dy;
221
222 dx = pt.x - w->drag.px;
223 dy = pt.y - w->drag.py;
224 ecore_win32_window_move(w, w->drag.x + dx, w->drag.y + dy);
225 w->drag.x += dx;
226 w->drag.y += dy;
227 w->drag.px = pt.x;
228 w->drag.py = pt.y;
229 return 0;
230 }
231 if (w->drag.type == HTLEFT)
232 {
233 int dw;
234
235 dw = pt.x - w->drag.px;
236 ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y, w->drag.w - dw, w->drag.h);
237 w->drag.x += dw;
238 w->drag.w -= dw;
239 w->drag.px = pt.x;
240 w->drag.py = pt.y;
241 return 0;
242 }
243 if (w->drag.type == HTRIGHT)
244 {
245 int dw;
246
247 dw = pt.x - w->drag.px;
248 ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h);
249 w->drag.w += dw;
250 w->drag.px = pt.x;
251 w->drag.py = pt.y;
252 return 0;
253 }
254 if (w->drag.type == HTTOP)
255 {
256 int dh;
257
258 dh = pt.y - w->drag.py;
259 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dh, w->drag.w, w->drag.h - dh);
260 w->drag.y += dh;
261 w->drag.h -= dh;
262 w->drag.px = pt.x;
263 w->drag.py = pt.y;
264 return 0;
265 }
266 if (w->drag.type == HTBOTTOM)
267 {
268 int dh;
269
270 dh = pt.y - w->drag.py;
271 ecore_win32_window_resize(w, w->drag.w, w->drag.h + dh);
272 w->drag.h += dh;
273 w->drag.px = pt.x;
274 w->drag.py = pt.y;
275 return 0;
276 }
277 if (w->drag.type == HTTOPLEFT)
278 {
279 int dx;
280 int dy;
281 int dh;
282 int dw;
283
284 dw = pt.x - w->drag.px;
285 dh = pt.y - w->drag.py;
286 dx = dw;
287 dy = dh;
288 _ecore_win32_size_check(w,
289 w->drag.w - dw, w->drag.h - dh,
290 &dx, &dy);
291
292 ecore_win32_window_move_resize(w, w->drag.x + dx, w->drag.y + dy, w->drag.w - dw, w->drag.h - dh);
293 w->drag.x += dx;
294 w->drag.y += dy;
295 w->drag.w -= dw;
296 w->drag.h -= dh;
297 w->drag.px = pt.x;
298 w->drag.py = pt.y;
299 return 0;
300 }
301 if (w->drag.type == HTTOPRIGHT)
302 {
303 int dx;
304 int dy;
305 int dh;
306 int dw;
307
308 dw = pt.x - w->drag.px;
309 dh = pt.y - w->drag.py;
310 dx = dw;
311 dy = dh;
312 _ecore_win32_size_check(w,
313 w->drag.w, w->drag.h - dh,
314 &dx, &dy);
315 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dy, w->drag.w, w->drag.h - dh);
316 w->drag.y += dy;
317 w->drag.w += dw;
318 w->drag.h -= dh;
319 w->drag.px = pt.x;
320 w->drag.py = pt.y;
321 return 0;
322 }
323 if (w->drag.type == HTBOTTOMLEFT)
324 {
325 int dx;
326 int dy;
327 int dh;
328 int dw;
329
330 dw = pt.x - w->drag.px;
331 dh = pt.y - w->drag.py;
332 dx = dw;
333 dy = dh;
334 _ecore_win32_size_check(w,
335 w->drag.w - dw, w->drag.h + dh,
336 &dx, &dy);
337 ecore_win32_window_move_resize(w, w->drag.x + dx, w->drag.y, w->drag.w - dw, w->drag.h + dh);
338 w->drag.x += dx;
339 w->drag.w -= dw;
340 w->drag.h += dh;
341 w->drag.px = pt.x;
342 w->drag.py = pt.y;
343 return 0;
344 }
345 if (w->drag.type == HTBOTTOMRIGHT)
346 {
347 int dh;
348 int dw;
349
350 dw = pt.x - w->drag.px;
351 dh = pt.y - w->drag.py;
352 ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h + dh);
353 w->drag.w += dw;
354 w->drag.h += dh;
355 w->drag.px = pt.x;
356 w->drag.py = pt.y;
357 return 0;
358 }
359 }
360 }
361
362 if (GetClientRect(window, &rect))
363 {
364 POINT pt;
365
366 INF("mouse in window");
367
368 pt.x = GET_X_LPARAM(data_param);
369 pt.y = GET_Y_LPARAM(data_param);
370 if (!PtInRect(&rect, pt))
371 {
372 if (w->pointer_is_in)
373 {
374 w->pointer_is_in = 0;
375 _ecore_win32_event_handle_leave_notify(data);
376 }
377 }
378 else
379 {
380 if (!w->pointer_is_in)
381 {
382 w->pointer_is_in = 1;
383 _ecore_win32_event_handle_enter_notify(data);
384 }
385 }
386 }
387 else
388 {
389 ERR("GetClientRect() failed");
390 }
391 _ecore_win32_event_handle_motion_notify(data);
392
393 return 0;
394 }
395 case WM_MOUSEWHEEL:
396 INF("mouse wheel message");
397 _ecore_win32_event_handle_button_press(data, 4);
398 return 0;
399 /* Window notifications */
400 case WM_CREATE:
401 INF("create window message");
402 _ecore_win32_event_handle_create_notify(data);
403 return 0;
404 case WM_DESTROY:
405 INF("destroy window message");
406 _ecore_win32_event_handle_destroy_notify(data);
407 return 0;
408 case WM_SHOWWINDOW:
409 INF("show window message");
410 if ((data->data_param == SW_OTHERUNZOOM) ||
411 (data->data_param == SW_OTHERZOOM))
412 return 0;
413
414 if (data->window_param)
415 _ecore_win32_event_handle_map_notify(data);
416 else
417 _ecore_win32_event_handle_unmap_notify(data);
418
419 return 0;
420 case WM_CLOSE:
421 INF("close window message");
422 _ecore_win32_event_handle_delete_request(data);
423 return 0;
424 case WM_GETMINMAXINFO:
425 INF("get min max info window message");
426 return TRUE;
427 case WM_MOVING:
428 INF("moving window message");
429 _ecore_win32_event_handle_configure_notify(data);
430 return TRUE;
431 case WM_MOVE:
432 INF("move window message");
433 return 0;
434 case WM_SIZING:
435 INF("sizing window message");
436 _ecore_win32_event_handle_resize(data);
437 _ecore_win32_event_handle_configure_notify(data);
438 return TRUE;
439 case WM_SIZE:
440 INF("size window message");
441 return 0;
442/* case WM_WINDOWPOSCHANGING: */
443/* { */
444/* RECT rect; */
445/* GetClientRect(window, &rect); */
446/* printf (" *** ecore message : WINDOWPOSCHANGING %ld %ld\n", */
447/* rect.right - rect.left, rect.bottom - rect.top); */
448/* } */
449/* _ecore_win32_event_handle_configure_notify(data); */
450/* return 0; */
451 case WM_WINDOWPOSCHANGED:
452 INF("position changed window message");
453 _ecore_win32_event_handle_configure_notify(data);
454 _ecore_win32_event_handle_expose(data);
455 return 0;
456 case WM_ENTERSIZEMOVE:
457 INF("enter size move window message");
458 return 0;
459 case WM_EXITSIZEMOVE:
460 INF("exit size move window message");
461 return 0;
462 case WM_NCLBUTTONDOWN:
463 INF("non client left button down window message");
464
465 if (((DWORD)window_param == HTCAPTION) ||
466 ((DWORD)window_param == HTBOTTOM) ||
467 ((DWORD)window_param == HTBOTTOMLEFT) ||
468 ((DWORD)window_param == HTBOTTOMRIGHT) ||
469 ((DWORD)window_param == HTLEFT) ||
470 ((DWORD)window_param == HTRIGHT) ||
471 ((DWORD)window_param == HTTOP) ||
472 ((DWORD)window_param == HTTOPLEFT) ||
473 ((DWORD)window_param == HTTOPRIGHT))
474 {
475 Ecore_Win32_Window *w;
476
477 w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA);
478 ecore_win32_window_geometry_get(w,
479 NULL, NULL,
480 &w->drag.w, &w->drag.h);
481 SetCapture(window);
482 w->drag.type = (DWORD)window_param;
483 w->drag.px = GET_X_LPARAM(data_param);
484 w->drag.py = GET_Y_LPARAM(data_param);
485 w->drag.dragging = 1;
486 return 0;
487 }
488 return DefWindowProc(window, message, window_param, data_param);
489 case WM_SYSCOMMAND:
490 INF("sys command window message %d", (int)window_param);
491
492 if ((((DWORD)window_param & 0xfff0) == SC_MOVE) ||
493 (((DWORD)window_param & 0xfff0) == SC_SIZE))
494 {
495 Ecore_Win32_Window *w;
496
497 INF("sys command MOVE or SIZE window message : %dx%d", GET_X_LPARAM(data_param), GET_Y_LPARAM(data_param));
498
499 w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA);
500 w->drag.dragging = 1;
501 return 0;
502 }
503 return DefWindowProc(window, message, window_param, data_param);
504 /* GDI notifications */
505 case WM_ERASEBKGND:
506 return 1;
507 case WM_PAINT:
508 {
509 RECT rect;
510
511 INF("paint message");
512
513 if (GetUpdateRect(window, &rect, FALSE))
514 {
515 PAINTSTRUCT ps;
516 HDC hdc;
517
518 hdc = BeginPaint(window, &ps);
519 data->update = rect;
520 _ecore_win32_event_handle_expose(data);
521 EndPaint(window, &ps);
522 }
523 return 0;
524 }
525 case WM_SETREDRAW:
526 INF("set redraw message");
527 return 0;
528 case WM_SYNCPAINT:
529 INF("sync paint message");
530 return 0;
531 default:
532 return DefWindowProc(window, message, window_param, data_param);
533 }
534}
535
536/**
537 * @endcond
538 */
539
540
541/*============================================================================*
542 * Global *
543 *============================================================================*/
544
545
546HINSTANCE _ecore_win32_instance = NULL;
547double _ecore_win32_double_click_time = 0.25;
548unsigned long _ecore_win32_event_last_time = 0;
549Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
550int _ecore_win32_log_dom_global = -1;
551
552int ECORE_WIN32_EVENT_MOUSE_IN = 0;
553int ECORE_WIN32_EVENT_MOUSE_OUT = 0;
554int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0;
555int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0;
556int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0;
557int ECORE_WIN32_EVENT_WINDOW_CREATE = 0;
558int ECORE_WIN32_EVENT_WINDOW_DESTROY = 0;
559int ECORE_WIN32_EVENT_WINDOW_SHOW = 0;
560int ECORE_WIN32_EVENT_WINDOW_HIDE = 0;
561int ECORE_WIN32_EVENT_WINDOW_CONFIGURE = 0;
562int ECORE_WIN32_EVENT_WINDOW_RESIZE = 0;
563int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0;
564
565/*============================================================================*
566 * API *
567 *============================================================================*/
568
569/**
570 * @addtogroup Ecore_Win32_Group Ecore_Win32 library
571 *
572 * Ecore_Win32 is a library that wraps Windows graphic functions
573 * and integrate them nicely into the Ecore main loop.
574 *
575 * @section Ecore_Win32_Sec_Init Initialisation / Shutdown
576 *
577 * To fill...
578 *
579 * @section Ecore_Win32_Sec_Icons How to set icons to an application
580 *
581 * It is possible to also sets the icon of the application easily:
582 *
583 * @li Create an icon with your favorite image creator. The Gimp is a
584 * good choice. Create several images of size 16, 32 and 48. You can
585 * also create images of size 24, 64, 128 and 256. Paste all of them
586 * in the image of size 16 as a layer. Save the image of size 16 with
587 * the name my_icon.ico. Put it where the source code of the
588 * application is located.
589 * @li Create my_icon_rc.rc file with your code editor and add in it:
590 * @code
591 * 101 ICON DISCARDABLE "my_icon.ico"
592 * @endcode
593 * @li With Visual Studio, put that file in the 'Resource file' part
594 * of the project.
595 * @li With MinGW, you have to compile it with windres:
596 * @code
597 * windres my_icon_rc.rc my_icon_rc.o
598 * @endcode
599 * and add my_icon_rc.o to the object files of the application.
600 *
601 * @note The value 101 must not be changed, it's the ID used
602 * internally by Ecore_Win32 to get the icons.
603 *
604 * @{
605 */
606
607/**
608 * @brief Initialize the Ecore_Win32 library.
609 *
610 * @return 1 or greater on success, 0 on error.
611 *
612 * This function sets up the Windows graphic system. It returns 0 on
613 * failure, otherwise it returns the number of times it has already been
614 * called.
615 *
616 * When Ecore_Win32 is not used anymore, call ecore_win32_shutdown()
617 * to shut down the Ecore_Win32 library.
618 */
619EAPI int
620ecore_win32_init()
621{
622 WNDCLASSEX wc;
623 HICON icon;
624 HICON icon_sm;
625
626 if (++_ecore_win32_init_count != 1)
627 return _ecore_win32_init_count;
628
629 if (!eina_init())
630 return --_ecore_win32_init_count;
631
632 _ecore_win32_log_dom_global = eina_log_domain_register
633 ("ecore_win32", ECORE_WIN32_DEFAULT_LOG_COLOR);
634 if (_ecore_win32_log_dom_global < 0)
635 {
636 EINA_LOG_ERR("Ecore_Win32: Could not register log domain");
637 goto shutdown_eina;
638 }
639
640 if (!ecore_event_init())
641 {
642 ERR("Ecore_Win32: Could not init ecore_event");
643 goto unregister_log_domain;
644 }
645
646 _ecore_win32_instance = GetModuleHandle(NULL);
647 if (!_ecore_win32_instance)
648 {
649 ERR("GetModuleHandle() failed");
650 goto shutdown_ecore_event;
651 }
652
653 icon = LoadImage(_ecore_win32_instance,
654 MAKEINTRESOURCE(IDI_ICON),
655 IMAGE_ICON,
656 GetSystemMetrics(SM_CXICON),
657 GetSystemMetrics(SM_CYICON),
658 LR_DEFAULTCOLOR);
659 icon_sm = LoadImage(_ecore_win32_instance,
660 MAKEINTRESOURCE(IDI_ICON),
661 IMAGE_ICON,
662 GetSystemMetrics(SM_CXSMICON),
663 GetSystemMetrics(SM_CYSMICON),
664 LR_DEFAULTCOLOR);
665 if (!icon)
666 icon = LoadIcon (NULL, IDI_APPLICATION);
667 if (!icon_sm)
668 icon_sm = LoadIcon (NULL, IDI_APPLICATION);
669
670 memset (&wc, 0, sizeof (WNDCLASSEX));
671 wc.cbSize = sizeof (WNDCLASSEX);
672 wc.style = CS_HREDRAW | CS_VREDRAW;
673 wc.lpfnWndProc = _ecore_win32_window_procedure;
674 wc.cbClsExtra = 0;
675 wc.cbWndExtra = 0;
676 wc.hInstance = _ecore_win32_instance;
677 wc.hIcon = icon;
678 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
679 wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
680 wc.lpszMenuName = NULL;
681 wc.lpszClassName = ECORE_WIN32_WINDOW_CLASS;
682 wc.hIconSm = icon_sm;
683
684 if(!RegisterClassEx(&wc))
685 {
686 ERR("RegisterClass() failed");
687 goto free_library;
688 }
689
690 if (!ecore_win32_dnd_init())
691 {
692 ERR("ecore_win32_dnd_init() failed");
693 goto unregister_class;
694 }
695
696 if (!ECORE_WIN32_EVENT_MOUSE_IN)
697 {
698 ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new();
699 ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new();
700 ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
701 ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
702 ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
703 ECORE_WIN32_EVENT_WINDOW_CREATE = ecore_event_type_new();
704 ECORE_WIN32_EVENT_WINDOW_DESTROY = ecore_event_type_new();
705 ECORE_WIN32_EVENT_WINDOW_SHOW = ecore_event_type_new();
706 ECORE_WIN32_EVENT_WINDOW_HIDE = ecore_event_type_new();
707 ECORE_WIN32_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
708 ECORE_WIN32_EVENT_WINDOW_RESIZE = ecore_event_type_new();
709 ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
710 }
711
712 return _ecore_win32_init_count;
713
714 unregister_class:
715 UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
716 free_library:
717 FreeLibrary(_ecore_win32_instance);
718 shutdown_ecore_event:
719 ecore_event_shutdown();
720 unregister_log_domain:
721 eina_log_domain_unregister(_ecore_win32_log_dom_global);
722 shutdown_eina:
723 eina_shutdown();
724
725 return --_ecore_win32_init_count;
726}
727
728/**
729 * @brief Shut down the Ecore_Win32 library.
730 *
731 * @return 0 when the library is completely shut down, 1 or
732 * greater otherwise.
733 *
734 * This function shuts down the Ecore_Win32 library. It returns 0 when it has
735 * been called the same number of times than ecore_win32_init(). In that case
736 * it shuts down all the Windows graphic system.
737 */
738EAPI int
739ecore_win32_shutdown()
740{
741 if (--_ecore_win32_init_count != 0)
742 return _ecore_win32_init_count;
743
744 ecore_win32_dnd_shutdown();
745
746 if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance))
747 INF("UnregisterClass() failed");
748
749 if (!FreeLibrary(_ecore_win32_instance))
750 INF("FreeLibrary() failed");
751
752 _ecore_win32_instance = NULL;
753
754 ecore_event_shutdown();
755 eina_log_domain_unregister(_ecore_win32_log_dom_global);
756 _ecore_win32_log_dom_global = -1;
757 eina_shutdown();
758
759 return _ecore_win32_init_count;
760}
761
762/**
763 * @brief Retrieve the depth of the screen.
764 *
765 * @return The depth of the screen.
766 *
767 * This function returns the depth of the screen. If an error occurs,
768 * it returns 0.
769 */
770EAPI int
771ecore_win32_screen_depth_get()
772{
773 HDC dc;
774 int depth;
775
776 INF("getting screen depth");
777
778 dc = GetDC(NULL);
779 if (!dc)
780 {
781 ERR("GetDC() failed");
782 return 0;
783 }
784
785 depth = GetDeviceCaps(dc, BITSPIXEL);
786 if (!ReleaseDC(NULL, dc))
787 {
788 ERR("ReleaseDC() failed (device context not released)");
789 }
790
791 return depth;
792}
793
794/**
795 * @brief Sets the timeout for a double and triple clicks to be flagged.
796 *
797 * @param t The time in seconds.
798 *
799 * This function sets the time @p t between clicks before the
800 * double_click flag is set in a button down event. If 3 clicks occur
801 * within double this time, the triple_click flag is also set.
802 */
803EAPI void
804ecore_win32_double_click_time_set(double t)
805{
806 if (t < 0.0) t = 0.0;
807 _ecore_win32_double_click_time = t;
808}
809
810/**
811 * @brief Retrieve the double and triple click flag timeout.
812 *
813 * @return The timeout for double clicks in seconds.
814 *
815 * This function returns the double clicks in seconds. If
816 * ecore_win32_double_click_time_set() has not been called, the
817 * default value is returned. See ecore_win32_double_click_time_set()
818 * for more informations.
819 */
820EAPI double
821ecore_win32_double_click_time_get(void)
822{
823 return _ecore_win32_double_click_time;
824}
825
826/**
827 * @brief Return the last event time.
828 *
829 * @return The last envent time.
830 *
831 * This function returns the last event time.
832 */
833EAPI unsigned long
834ecore_win32_current_time_get(void)
835{
836 return _ecore_win32_event_last_time;
837}
838
839/**
840 * @}
841 */
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c
deleted file mode 100644
index 9a5a7eb..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c
+++ /dev/null
@@ -1,306 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#define WIN32_LEAN_AND_MEAN
6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN
8
9#include <Eina.h>
10
11#include "Ecore_Win32.h"
12#include "ecore_win32_private.h"
13
14/*============================================================================*
15 * Local *
16 *============================================================================*/
17
18
19/*============================================================================*
20 * Global *
21 *============================================================================*/
22
23
24/*============================================================================*
25 * API *
26 *============================================================================*/
27
28/**
29 * @addtogroup Ecore_Win32_Group Ecore_Win32 library
30 *
31 * @{
32 */
33
34/**
35 * @brief Create a new cursor.
36 *
37 * @param pixels_and The array of bytes containing the bit values for
38 * the AND mask of the cursor.
39 * @param pixels_xor The array of bytes containing the bit values for
40 * the XOR mask of the cursor.
41 * @param width The width of the cursor.
42 * @param height The height of the cursor.
43 * @param hot_x The horizontal position of the cursor's hot spot.
44 * @param hot_y The vertical position of the cursor's hot spot.
45 * @return A newly user-defined cursor.
46 *
47 * This function creates a new cursor of size @p width and @p
48 * height. They must be valid size. To determine the valid size of a
49 * cursor, useecore_win32_cursor_size_get(). @p pixels_and is an array
50 * of bytes (unsigned char) containing the bits of the cursor that
51 * will be visible. @p pixels_xor is similar but will allow the cursor
52 * to have a shape. Here is the truth table for the masks:
53 *
54 * <table border=1>
55 * <tr><td>AND mask</td><td>XOR mask</td><td>Display</td></tr>
56 * <tr><td>0</td> <td>0</td> <td>Black</td></tr>
57 * <tr><td>0</td> <td>1</td> <td>White</td></tr>
58 * <tr><td>1</td> <td>0</td> <td>Screen</td></tr>
59 * <tr><td>1</td> <td>1</td> <td>Reverse screen</td></tr>
60 * </table>
61 *
62 * @p hot_x and @p hot_y are the position of the hot spot of the
63 * cursor. If @p pixels_and or @p pixels_xor are @c NULL, the function
64 * returns NULL. If @p width or @p height does not match the valid
65 * size of a cursor, the function returns @c NULL. On success, the
66 * function creates a user-defined cursor, otherwise it returns
67 * @c NULL.
68 *
69 * Once the cursor is not used anymore, use ecore_win32_cursor_free()
70 * to free the ressources.
71 *
72 * Example of use:
73 *
74 * @code
75 * unsigned char pixels_and[] ={
76 * 0xFF, 0xFC, 0x3F, 0xFF, // line 1
77 * 0xFF, 0xC0, 0x1F, 0xFF, // line 2
78 * 0xFF, 0x00, 0x3F, 0xFF, // line 3
79 * 0xFE, 0x00, 0xFF, 0xFF, // line 4
80 *
81 * 0xF7, 0x01, 0xFF, 0xFF, // line 5
82 * 0xF0, 0x03, 0xFF, 0xFF, // line 6
83 * 0xF0, 0x03, 0xFF, 0xFF, // line 7
84 * 0xE0, 0x07, 0xFF, 0xFF, // line 8
85 *
86 * 0xC0, 0x07, 0xFF, 0xFF, // line 9
87 * 0xC0, 0x0F, 0xFF, 0xFF, // line 10
88 * 0x80, 0x0F, 0xFF, 0xFF, // line 11
89 * 0x80, 0x0F, 0xFF, 0xFF, // line 12
90 *
91 * 0x80, 0x07, 0xFF, 0xFF, // line 13
92 * 0x00, 0x07, 0xFF, 0xFF, // line 14
93 * 0x00, 0x03, 0xFF, 0xFF, // line 15
94 * 0x00, 0x00, 0xFF, 0xFF, // line 16
95 *
96 * 0x00, 0x00, 0x7F, 0xFF, // line 17
97 * 0x00, 0x00, 0x1F, 0xFF, // line 18
98 * 0x00, 0x00, 0x0F, 0xFF, // line 19
99 * 0x80, 0x00, 0x0F, 0xFF, // line 20
100 *
101 * 0x80, 0x00, 0x07, 0xFF, // line 21
102 * 0x80, 0x00, 0x07, 0xFF, // line 22
103 * 0xC0, 0x00, 0x07, 0xFF, // line 23
104 * 0xC0, 0x00, 0x0F, 0xFF, // line 24
105 *
106 * 0xE0, 0x00, 0x0F, 0xFF, // line 25
107 * 0xF0, 0x00, 0x1F, 0xFF, // line 26
108 * 0xF0, 0x00, 0x1F, 0xFF, // line 27
109 * 0xF8, 0x00, 0x3F, 0xFF, // line 28
110 *
111 * 0xFE, 0x00, 0x7F, 0xFF, // line 29
112 * 0xFF, 0x00, 0xFF, 0xFF, // line 30
113 * 0xFF, 0xC3, 0xFF, 0xFF, // line 31
114 * 0xFF, 0xFF, 0xFF, 0xFF // line 32
115 * };
116 *
117 * unsigned char pixels_xor[] =
118 * {
119 * 0x00, 0x00, 0x00, 0x00, // line 1
120 * 0x00, 0x03, 0xC0, 0x00, // line 2
121 * 0x00, 0x3F, 0x00, 0x00, // line 3
122 * 0x00, 0xFE, 0x00, 0x00, // line 4
123 *
124 * 0x0E, 0xFC, 0x00, 0x00, // line 5
125 * 0x07, 0xF8, 0x00, 0x00, // line 6
126 * 0x07, 0xF8, 0x00, 0x00, // line 7
127 * 0x0F, 0xF0, 0x00, 0x00, // line 8
128 *
129 * 0x1F, 0xF0, 0x00, 0x00, // line 9
130 * 0x1F, 0xE0, 0x00, 0x00, // line 10
131 * 0x3F, 0xE0, 0x00, 0x00, // line 11
132 * 0x3F, 0xE0, 0x00, 0x00, // line 12
133 *
134 * 0x3F, 0xF0, 0x00, 0x00, // line 13
135 * 0x7F, 0xF0, 0x00, 0x00, // line 14
136 * 0x7F, 0xF8, 0x00, 0x00, // line 15
137 * 0x7F, 0xFC, 0x00, 0x00, // line 16
138 *
139 * 0x7F, 0xFF, 0x00, 0x00, // line 17
140 * 0x7F, 0xFF, 0x80, 0x00, // line 18
141 * 0x7F, 0xFF, 0xE0, 0x00, // line 19
142 * 0x3F, 0xFF, 0xE0, 0x00, // line 20
143 *
144 * 0x3F, 0xC7, 0xF0, 0x00, // line 21
145 * 0x3F, 0x83, 0xF0, 0x00, // line 22
146 * 0x1F, 0x83, 0xF0, 0x00, // line 23
147 * 0x1F, 0x83, 0xE0, 0x00, // line 24
148 *
149 * 0x0F, 0xC7, 0xE0, 0x00, // line 25
150 * 0x07, 0xFF, 0xC0, 0x00, // line 26
151 * 0x07, 0xFF, 0xC0, 0x00, // line 27
152 * 0x01, 0xFF, 0x80, 0x00, // line 28
153 *
154 * 0x00, 0xFF, 0x00, 0x00, // line 29
155 * 0x00, 0x3C, 0x00, 0x00, // line 30
156 * 0x00, 0x00, 0x00, 0x00, // line 31
157 * 0x00, 0x00, 0x00, 0x00 // line 32
158 * };
159 *
160 * Ecore_Win32_Cursor cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2);
161 * @endcode
162 */
163EAPI Ecore_Win32_Cursor *
164ecore_win32_cursor_new(const void *pixels_and,
165 const void *pixels_xor,
166 int width,
167 int height,
168 int hot_x,
169 int hot_y)
170{
171 Ecore_Win32_Cursor *cursor = NULL;
172 int cursor_width;
173 int cursor_height;
174
175 INF("creating cursor");
176
177 if (!pixels_and || !pixels_xor)
178 return NULL;
179
180 cursor_width = GetSystemMetrics(SM_CXCURSOR);
181 cursor_height = GetSystemMetrics(SM_CYCURSOR);
182
183 if ((cursor_width != width) ||
184 (cursor_height != height))
185 return NULL;
186
187 if (!(cursor = CreateCursor(_ecore_win32_instance,
188 hot_x, hot_y,
189 width, height,
190 pixels_and,
191 pixels_xor)))
192 return NULL;
193
194 return cursor;
195}
196
197/**
198 * @brief Free the given cursor.
199 *
200 * @param cursor The cursor to free.
201 *
202 * This function free @p cursor. @p cursor must have been obtained
203 * with ecore_win32_cursor_new().
204 */
205EAPI void
206ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
207{
208 INF("destroying cursor");
209
210 DestroyCursor(cursor);
211}
212
213/**
214 * @brief Create a cursor from a Windows ressource.
215 *
216 * @param shape The pre-defined shape of the cursor.
217 * @return The new cursor.
218 *
219 * This function returns a pre-defined cursor with a specified
220 * @p shape. This cursor does not need to be freed, as it is loaded
221 * from an existing resource.
222 */
223EAPI Ecore_Win32_Cursor *
224ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape)
225{
226 Ecore_Win32_Cursor *cursor = NULL;
227 const char *cursor_name;
228
229 INF("geting shape cursor");
230
231 switch (shape)
232 {
233 case ECORE_WIN32_CURSOR_SHAPE_APP_STARTING:
234 cursor_name = IDC_APPSTARTING;
235 break;
236 case ECORE_WIN32_CURSOR_SHAPE_ARROW:
237 cursor_name = IDC_ARROW;
238 break;
239 case ECORE_WIN32_CURSOR_SHAPE_CROSS:
240 cursor_name = IDC_CROSS;
241 break;
242 case ECORE_WIN32_CURSOR_SHAPE_HAND:
243 cursor_name = IDC_HAND;
244 break;
245 case ECORE_WIN32_CURSOR_SHAPE_HELP:
246 cursor_name = IDC_HELP;
247 break;
248 case ECORE_WIN32_CURSOR_SHAPE_I_BEAM:
249 cursor_name = IDC_IBEAM;
250 break;
251 case ECORE_WIN32_CURSOR_SHAPE_NO:
252 cursor_name = IDC_NO;
253 break;
254 case ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL:
255 cursor_name = IDC_SIZEALL;
256 break;
257 case ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW:
258 cursor_name = IDC_SIZENESW;
259 break;
260 case ECORE_WIN32_CURSOR_SHAPE_SIZE_NS:
261 cursor_name = IDC_SIZENS;
262 break;
263 case ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE:
264 cursor_name = IDC_SIZENWSE;
265 break;
266 case ECORE_WIN32_CURSOR_SHAPE_SIZE_WE:
267 cursor_name = IDC_SIZEWE;
268 break;
269 case ECORE_WIN32_CURSOR_SHAPE_UP_ARROW:
270 cursor_name = IDC_UPARROW;
271 break;
272 case ECORE_WIN32_CURSOR_SHAPE_WAIT:
273 cursor_name = IDC_WAIT;
274 break;
275 default:
276 return NULL;
277 }
278
279 if (!(cursor = LoadCursor(NULL, cursor_name)))
280 return NULL;
281
282 return cursor;
283}
284
285/**
286 * @brief Retrieve the size of a valid cursor.
287 *
288 * @param width The width of a valid cursor.
289 * @param height The height of a valid cursor.
290 *
291 * This function returns the size of a cursor that must be passed to
292 * ecore_win32_cursor_new(). @p width and @p height are buffers that
293 * will be filled with the correct size. They can be @c NULL.
294 */
295EAPI void
296ecore_win32_cursor_size_get(int *width, int *height)
297{
298 INF("geting size cursor");
299
300 if (*width) *width = GetSystemMetrics(SM_CXCURSOR);
301 if (*height) *height = GetSystemMetrics(SM_CYCURSOR);
302}
303
304/**
305 * @}
306 */
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c
deleted file mode 100755
index a629c8b..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c
+++ /dev/null
@@ -1,221 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <windows.h>
6
7#include "Ecore_Win32.h"
8#include "ecore_win32_private.h"
9
10/*============================================================================*
11 * Local *
12 *============================================================================*/
13
14/**
15 * @cond LOCAL
16 */
17
18
19static int _ecore_win32_dnd_init_count = 0;
20
21static HANDLE DataToHandle(const char *data, int size)
22{
23 char *ptr;
24 ptr = (char *)GlobalAlloc(GMEM_FIXED, size);
25 memcpy(ptr, data, size);
26 return ptr;
27}
28
29/**
30 * @endcond
31 */
32
33
34/*============================================================================*
35 * Global *
36 *============================================================================*/
37
38
39/*============================================================================*
40 * API *
41 *============================================================================*/
42
43/**
44 * @addtogroup Ecore_Win32_Group Ecore_Win32 library
45 *
46 * @{
47 */
48
49/**
50 * @brief Initialize the Ecore_Win32 Drag and Drop module.
51 *
52 * @return 1 or greater on success, 0 on error.
53 *
54 * This function initialize the Drag and Drop module. It returns 0 on
55 * failure, otherwise it returns the number of times it has already
56 * been called.
57 *
58 * When the Drag and Drop module is not used anymore, call
59 * ecore_win32_dnd_shutdown() to shut down the module.
60 */
61EAPI int
62ecore_win32_dnd_init()
63{
64 if (_ecore_win32_dnd_init_count > 0)
65 {
66 _ecore_win32_dnd_init_count++;
67 return _ecore_win32_dnd_init_count;
68 }
69
70 if (OleInitialize(NULL) != S_OK)
71 return 0;
72
73 _ecore_win32_dnd_init_count++;
74
75 return _ecore_win32_dnd_init_count;
76}
77
78/**
79 * @brief Shut down the Ecore_Win32 Drag and Drop module.
80 *
81 * @return 0 when the module is completely shut down, 1 or
82 * greater otherwise.
83 *
84 * This function shuts down the Drag and Drop module. It returns 0 when it has
85 * been called the same number of times than ecore_win32_dnd_init(). In that case
86 * it shut down the module.
87 */
88EAPI int
89ecore_win32_dnd_shutdown()
90{
91 _ecore_win32_dnd_init_count--;
92 if (_ecore_win32_dnd_init_count > 0) return _ecore_win32_dnd_init_count;
93
94 OleUninitialize();
95
96 if (_ecore_win32_dnd_init_count < 0) _ecore_win32_dnd_init_count = 0;
97
98 return _ecore_win32_dnd_init_count;
99}
100
101/**
102 * @brief Begin a DnD operation.
103 *
104 * @param data The name pf the Drag operation.
105 * @param size The size of the name.
106 * @return EINA_TRUE on success, EINA_FALSE otherwise.
107 *
108 * This function start a Drag operation with the name @p data. If
109 * @p data is @c NULL, EINA_FALSE is returned. if @p size is less than
110 * 0, it is set to the length (as strlen()) of @p data. On success the
111 * function returns EINA_TRUE, otherwise it returns EINA_FALSE.
112 */
113EAPI Eina_Bool
114ecore_win32_dnd_begin(const char *data,
115 int size)
116{
117 IDataObject *pDataObject = NULL;
118 IDropSource *pDropSource = NULL;
119 FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
120 STGMEDIUM stgmed = { TYMED_HGLOBAL, { 0 }, 0 };
121 Eina_Bool res = EINA_FALSE;
122
123 if (!data)
124 return EINA_FALSE;
125
126 if (size < 0)
127 size = strlen(data) + 1;
128
129 stgmed.hGlobal = DataToHandle(data, size);
130
131 // create the data object
132 pDataObject = (IDataObject *)_ecore_win32_dnd_data_object_new((void *)&fmtetc,
133 (void *)&stgmed,
134 1);
135 pDropSource = (IDropSource *)_ecore_win32_dnd_drop_source_new();
136
137 if (pDataObject && pDropSource)
138 {
139 DWORD dwResult;
140 DWORD dwEffect = DROPEFFECT_COPY;
141
142 // do the drag-drop!
143 dwResult = DoDragDrop(pDataObject, pDropSource, DROPEFFECT_COPY, &dwEffect);
144
145 // finished. Check the return values to see if we need to do anything else
146 if (dwResult == DRAGDROP_S_DROP)
147 {
148 //printf(">>> \"%s\" Dropped <<<\n", str);
149 if(dwEffect == DROPEFFECT_MOVE)
150 {
151 // remove the data we just dropped from active document
152 }
153 }
154 //else if (dwResult == DRAGDROP_S_CANCEL)
155 // printf("DND cancelled\n");
156 //else
157 // printf("DND error\n");
158
159 res = EINA_TRUE;
160 }
161
162 _ecore_win32_dnd_data_object_free(pDataObject);
163 _ecore_win32_dnd_drop_source_free(pDropSource);
164
165 // cleanup
166 ReleaseStgMedium(&stgmed);
167
168 return res;
169}
170
171/**
172 * @brief Register a Drop operation.
173 *
174 * @param window The destination of the Drop operation.
175 * @param callback The callback called when the Drop operation
176 * finishes.
177 * @return EINA_TRUE on success, EINA_FALSE otherwise.
178 *
179 * This function register a Drop operation on @p window. Once the Drop
180 * operation finishes, @p callback is called. If @p window is @c NULL,
181 * the function returns EINA_FALSE. On success, it returns EINA_TRUE,
182 * otherwise it returns EINA_FALSE.
183 */
184EAPI Eina_Bool
185ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *window,
186 Ecore_Win32_Dnd_DropTarget_Callback callback)
187{
188 Ecore_Win32_Window *wnd = (Ecore_Win32_Window *)window;
189
190 if (!window)
191 return EINA_FALSE;
192
193 wnd->dnd_drop_target = _ecore_win32_dnd_register_drop_window(wnd->window,
194 callback,
195 (void *)wnd);
196 return wnd->dnd_drop_target ? EINA_TRUE : EINA_FALSE;
197}
198
199/**
200 * @brief Unregister a Drop operation.
201 *
202 * @param window The destination of the Drop operation.
203 *
204 * This function unregister a Drop operation on @p window. If
205 * @p window is @c NULL, the function does nothing.
206 */
207EAPI void
208ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window)
209{
210 Ecore_Win32_Window *wnd = (Ecore_Win32_Window *)window;
211
212 if (!window)
213 return;
214
215 if (wnd->dnd_drop_target)
216 _ecore_win32_dnd_unregister_drop_window(wnd->window, wnd->dnd_drop_target);
217}
218
219/**
220 * @}
221 */
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
deleted file mode 100644
index 75e26f5..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include <assert.h>
10
11#define WIN32_LEAN_AND_MEAN
12#include <windows.h>
13#undef WIN32_LEAN_AND_MEAN
14#include <ole2.h>
15
16#include "Ecore_Win32.h"
17#include "ecore_win32_private.h"
18
19#include "ecore_win32_dnd_enumformatetc.h"
20#include "ecore_win32_dnd_data_object.h"
21
22
23static HGLOBAL DupGlobalMem(HGLOBAL hMem)
24{
25 DWORD len = (DWORD)GlobalSize(hMem);
26 PVOID source = GlobalLock(hMem);
27 PVOID dest = GlobalAlloc(GMEM_FIXED, len);
28 memcpy(dest, source, len);
29 GlobalUnlock(hMem);
30 return dest;
31}
32
33// structors
34
35DataObject::DataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count)
36{
37 assert(fmtetc != NULL);
38 assert(stgmed != NULL);
39 assert(count > 0);
40
41 // reference count must ALWAYS start at 1
42 ref_count_ = 1;
43 formats_num_ = count;
44
45 format_etc_ = new FORMATETC[count];
46 stg_medium_ = new STGMEDIUM[count];
47
48 for(int i = 0; i < count; i++)
49 {
50 format_etc_[i] = fmtetc[i];
51 stg_medium_[i] = stgmed[i];
52 }
53}
54
55DataObject::~DataObject()
56{
57 delete[] format_etc_;
58 delete[] stg_medium_;
59}
60
61
62// IUnknown
63
64HRESULT DataObject::QueryInterface(REFIID iid, void **ppvObject)
65{
66 // check to see what interface has been requested
67 if ((iid == IID_IDataObject) || (iid == IID_IUnknown))
68 {
69 AddRef();
70 *ppvObject = this;
71 return S_OK;
72 }
73 *ppvObject = 0;
74 return E_NOINTERFACE;
75}
76
77ULONG DataObject::AddRef()
78{
79 return InterlockedIncrement(&ref_count_);
80}
81
82ULONG DataObject::Release()
83{
84 LONG count = InterlockedDecrement(&ref_count_);
85 if(count == 0)
86 {
87 delete this;
88 return 0;
89 }
90 return count;
91}
92
93// IDataObject
94
95HRESULT DataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium)
96{
97 assert(pMedium != NULL);
98 int idx;
99
100 // try to match the specified FORMATETC with one of our supported formats
101 if((idx = lookup_format_etc(pFormatEtc)) == -1)
102 return DV_E_FORMATETC;
103
104 // found a match - transfer data into supplied storage medium
105 pMedium->tymed = format_etc_[idx].tymed;
106 pMedium->pUnkForRelease = 0;
107
108 // copy the data into the caller's storage medium
109 switch(format_etc_[idx].tymed)
110 {
111 case TYMED_HGLOBAL:
112 pMedium->hGlobal = DupGlobalMem(stg_medium_[idx].hGlobal);
113 break;
114
115 default:
116 return DV_E_FORMATETC;
117 }
118
119 return S_OK;
120}
121
122HRESULT DataObject::GetDataHere(FORMATETC *pFormatEtc __UNUSED__, STGMEDIUM *pmedium __UNUSED__)
123{
124 return DATA_E_FORMATETC;
125}
126
127HRESULT DataObject::QueryGetData(FORMATETC *pFormatEtc)
128{
129 return (lookup_format_etc(pFormatEtc) == -1) ? DV_E_FORMATETC : S_OK;
130}
131
132HRESULT DataObject::GetCanonicalFormatEtc(FORMATETC *pFormatEct __UNUSED__, FORMATETC *pFormatEtcOut)
133{
134 // Apparently we have to set this field to NULL even though we don't do anything else
135 pFormatEtcOut->ptd = NULL;
136 return E_NOTIMPL;
137}
138
139HRESULT DataObject::SetData(FORMATETC *pFormatEtc __UNUSED__, STGMEDIUM *pMedium __UNUSED__, BOOL fRelease __UNUSED__)
140{
141 return E_NOTIMPL;
142}
143
144HRESULT DataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc)
145{
146 // only the get direction is supported for OLE
147 if(dwDirection == DATADIR_GET)
148 {
149 // for Win2k+ you can use the SHCreateStdEnumFmtEtc API call, however
150 // to support all Windows platforms we need to implement IEnumFormatEtc ourselves.
151 return CreateEnumFormatEtc(formats_num_, format_etc_, ppEnumFormatEtc);
152 }
153 else
154 {
155 // the direction specified is not supported for drag+drop
156 return E_NOTIMPL;
157 }
158}
159
160HRESULT DataObject::DAdvise(FORMATETC *pFormatEtc __UNUSED__, DWORD advf __UNUSED__, IAdviseSink *, DWORD *)
161{
162 return OLE_E_ADVISENOTSUPPORTED;
163}
164
165HRESULT DataObject::DUnadvise(DWORD dwConnection __UNUSED__)
166{
167 return OLE_E_ADVISENOTSUPPORTED;
168}
169
170HRESULT DataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise __UNUSED__)
171{
172 return OLE_E_ADVISENOTSUPPORTED;
173}
174
175// internal helper function
176
177int DataObject::lookup_format_etc(FORMATETC *pFormatEtc)
178{
179 // check each of our formats in turn to see if one matches
180 for(int i = 0; i < formats_num_; i++)
181 {
182 if((format_etc_[i].tymed & pFormatEtc->tymed) &&
183 (format_etc_[i].cfFormat == pFormatEtc->cfFormat) &&
184 (format_etc_[i].dwAspect == pFormatEtc->dwAspect))
185 {
186 // return index of stored format
187 return i;
188 }
189 }
190
191 // error, format not found
192 return -1;
193}
194
195void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count)
196{
197 IDataObject *object = new DataObject((FORMATETC *)fmtetc, (STGMEDIUM *)stgmeds, (UINT)count);
198 assert(object != NULL);
199 return object;
200}
201
202void _ecore_win32_dnd_data_object_free(void *data_object)
203{
204 if (!data_object)
205 return;
206
207 IDataObject *object = (IDataObject *)data_object;
208 object->Release();
209}
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
deleted file mode 100644
index 3d289cf..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef __ECORE_WIN32_DND_DATA_OBJECT_H__
2#define __ECORE_WIN32_DND_DATA_OBJECT_H__
3
4
5#define WIN32_LEAN_AND_MEAN
6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN
8#include <objbase.h>
9
10
11class DataObject : public IDataObject
12{
13 private:
14
15 LONG ref_count_;
16 int formats_num_;
17 FORMATETC *format_etc_;
18 STGMEDIUM *stg_medium_;
19
20 private: // internal helper function
21
22 int lookup_format_etc(FORMATETC *format_etc);
23
24 public: // structors
25
26 DataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count);
27 ~DataObject();
28
29 public: // IUnknown
30
31 HRESULT __stdcall QueryInterface(REFIID iid, void **ppvObject);
32 ULONG __stdcall AddRef();
33 ULONG __stdcall Release();
34
35 public: // IDataObject
36
37 HRESULT __stdcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium);
38 HRESULT __stdcall GetDataHere(FORMATETC *pFormatEtc, STGMEDIUM *pmedium);
39 HRESULT __stdcall QueryGetData(FORMATETC *pFormatEtc);
40 HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut);
41 HRESULT __stdcall SetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease);
42 HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc);
43 HRESULT __stdcall DAdvise(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *, DWORD *);
44 HRESULT __stdcall DUnadvise(DWORD dwConnection);
45 HRESULT __stdcall EnumDAdvise(IEnumSTATDATA **ppEnumAdvise);
46};
47
48
49#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
deleted file mode 100644
index bea7736..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include <assert.h>
10
11#include "ecore_win32_dnd_drop_source.h"
12
13#include "ecore_win32_private.h"
14
15// structors
16
17// reference count must ALWAYS start at 1
18DropSource::DropSource() : ref_count_(1)
19{ }
20
21
22// IUnknown
23
24HRESULT DropSource::QueryInterface(REFIID iid, void **ppvObject)
25{
26 // check to see what interface has been requested
27 if (iid == IID_IDropSource || iid == IID_IUnknown)
28 {
29 AddRef();
30 *ppvObject = this;
31 return S_OK;
32 }
33 *ppvObject = 0;
34 return E_NOINTERFACE;
35}
36
37ULONG DropSource::AddRef()
38{
39 return InterlockedIncrement(&ref_count_);
40}
41
42ULONG DropSource::Release()
43{
44 LONG count = InterlockedDecrement(&ref_count_);
45 if(count == 0)
46 {
47 delete this;
48 return 0;
49 }
50 return count;
51}
52
53
54// IDropSource
55
56HRESULT DropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
57{
58 // if the Escape key has been pressed since the last call, cancel the drop
59 if(fEscapePressed == TRUE)
60 return DRAGDROP_S_CANCEL;
61
62 // if the LeftMouse button has been released, then do the drop!
63 if((grfKeyState & MK_LBUTTON) == 0)
64 return DRAGDROP_S_DROP;
65
66 // continue with the drag-drop
67 return S_OK;
68}
69
70HRESULT DropSource::GiveFeedback(DWORD dwEffect __UNUSED__)
71{
72 return DRAGDROP_S_USEDEFAULTCURSORS;
73}
74
75
76// ecore_win32 private functions
77
78void *_ecore_win32_dnd_drop_source_new()
79{
80 IDropSource *object = new DropSource();
81 assert(object != NULL);
82 return object;
83}
84
85void _ecore_win32_dnd_drop_source_free(void *drop_source)
86{
87 if (!drop_source)
88 return;
89
90 IDropSource *object = (IDropSource *)drop_source;
91 object->Release();
92}
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
deleted file mode 100644
index 9081f46..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef __ECORE_WIN32_DND_DROP_SOURCE_H__
2#define __ECORE_WIN32_DND_DROP_SOURCE_H__
3
4
5#define WIN32_LEAN_AND_MEAN
6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN
8#include <ole2.h>
9
10#include "Ecore_Win32.h"
11
12
13class DropSource : public IDropSource
14{
15 private:
16
17 LONG ref_count_;
18
19 public: // structors
20
21 DropSource();
22
23 public: // IUnknown
24
25 HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject);
26 ULONG __stdcall AddRef();
27 ULONG __stdcall Release();
28
29 public: // IDropSource
30
31 HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
32 HRESULT __stdcall GiveFeedback(DWORD dwEffect);
33};
34
35
36#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
deleted file mode 100644
index e19fb5d..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include "ecore_win32_dnd_drop_target.h"
10
11#include "ecore_win32_private.h"
12
13
14// structors
15
16DropTarget::DropTarget(HWND window, Ecore_Win32_Dnd_DropTarget_Callback callback, void *window_obj_ptr)
17 : ref_count_(1)
18 , window_(window)
19 , allow_drop_(false)
20 , drop_callback_(callback)
21 ,drop_callback_ptr_(window_obj_ptr)
22{ }
23
24
25// IUnknown
26
27HRESULT DropTarget::QueryInterface(REFIID iid, void **ppvObject)
28{
29 // check to see what interface has been requested
30 if (iid == IID_IDropTarget || iid == IID_IUnknown)
31 {
32 AddRef();
33 *ppvObject = this;
34 return S_OK;
35 }
36 *ppvObject = 0;
37
38 return E_NOINTERFACE;
39}
40
41ULONG DropTarget::AddRef()
42{
43 return InterlockedIncrement(&ref_count_);
44}
45
46ULONG DropTarget::Release()
47{
48 LONG count = InterlockedDecrement(&ref_count_);
49 if (count == 0)
50 {
51 delete this;
52 return 0;
53 }
54
55 return count;
56}
57
58
59// IDropTarget
60
61HRESULT DropTarget::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
62{
63 // does the dataobject contain data we want?
64 allow_drop_ = QueryDataObject(pDataObject) &&
65 (drop_callback_ == NULL ||
66 (drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_ENTER, pt.x, pt.y, NULL, 0) != 0));
67
68 if (allow_drop_)
69 {
70 // get the dropeffect based on keyboard state
71 *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect);
72 SetFocus(window_);
73 //PositionCursor(_hwnd, pt);
74 }
75 else
76 *pdwEffect = DROPEFFECT_NONE;
77 return S_OK;
78}
79
80HRESULT DropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect)
81{
82 allow_drop_ =
83 (drop_callback_ == NULL) ||
84 (drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_OVER, pt.x, pt.y, NULL, 0) != 0);
85
86 if (allow_drop_)
87 {
88 *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect);
89 //PositionCursor(m_hWnd, pt);
90 }
91 else
92 {
93 *pdwEffect = DROPEFFECT_NONE;
94 }
95
96 return S_OK;
97}
98
99HRESULT DropTarget::DragLeave()
100{
101 POINT pt;
102
103 GetCursorPos(&pt);
104 if (drop_callback_ != NULL)
105 drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_LEAVE, pt.x, pt.y, NULL, 0);
106
107 return S_OK;
108}
109
110HRESULT DropTarget::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
111{
112 if (allow_drop_)
113 {
114 // construct a FORMATETC object
115 FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
116 STGMEDIUM stgmed;
117
118 // See if the dataobject contains any TEXT stored as a HGLOBAL
119 if (pDataObject->QueryGetData(&fmtetc) == S_OK)
120 {
121 // Yippie! the data is there, so go get it!
122 if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
123 {
124 // we asked for the data as a HGLOBAL, so access it appropriately
125 PVOID data = GlobalLock(stgmed.hGlobal);
126 UINT size = GlobalSize(stgmed.hGlobal);
127
128 if (drop_callback_ != NULL)
129 {
130 drop_callback_(drop_callback_ptr_,
131 ECORE_WIN32_DND_EVENT_DROP,
132 pt.x, pt.y,
133 data, size);
134 }
135
136 GlobalUnlock(stgmed.hGlobal);
137
138 // release the data using the COM API
139 ReleaseStgMedium(&stgmed);
140 }
141 }
142 *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect);
143 }
144 else
145 {
146 *pdwEffect = DROPEFFECT_NONE;
147 }
148
149 return S_OK;
150}
151
152
153// internal helper function
154
155DWORD DropTarget::DropEffect(DWORD grfKeyState, POINTL pt __UNUSED__, DWORD dwAllowed)
156{
157 DWORD dwEffect = 0;
158
159 // 1. check "pt" -> do we allow a drop at the specified coordinates?
160
161 // 2. work out that the drop-effect should be based on grfKeyState
162 if (grfKeyState & MK_CONTROL)
163 {
164 dwEffect = dwAllowed & DROPEFFECT_COPY;
165 }
166 else if (grfKeyState & MK_SHIFT)
167 {
168 dwEffect = dwAllowed & DROPEFFECT_MOVE;
169 }
170
171 // 3. no key-modifiers were specified (or drop effect not allowed), so
172 // base the effect on those allowed by the dropsource
173 if (dwEffect == 0)
174 {
175 if (dwAllowed & DROPEFFECT_COPY) dwEffect = DROPEFFECT_COPY;
176 if (dwAllowed & DROPEFFECT_MOVE) dwEffect = DROPEFFECT_MOVE;
177 }
178
179 return dwEffect;
180}
181
182bool DropTarget::QueryDataObject(IDataObject *pDataObject)
183{
184 FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
185
186 // does the data object support CF_TEXT using a HGLOBAL?
187 return pDataObject->QueryGetData(&fmtetc) == S_OK;
188}
189
190
191// ecore_win32 private functions
192
193void *_ecore_win32_dnd_register_drop_window(HWND hwnd, Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr)
194{
195 DropTarget *pDropTarget = new DropTarget(hwnd, callback, ptr);
196
197 if (pDropTarget == NULL)
198 return NULL;
199
200 // acquire a strong lock
201 if (FAILED(CoLockObjectExternal(pDropTarget, TRUE, FALSE)))
202 {
203 delete pDropTarget;
204 return NULL;
205 }
206
207 // tell OLE that the window is a drop target
208 if (FAILED(RegisterDragDrop(hwnd, pDropTarget)))
209 {
210 delete pDropTarget;
211 return NULL;
212 }
213
214 return pDropTarget;
215}
216
217void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target)
218{
219 IDropTarget *pDropTarget = (IDropTarget *)drop_target;
220
221 if (drop_target == NULL)
222 return;
223
224 // remove drag+drop
225 RevokeDragDrop(hwnd);
226
227 // remove the strong lock
228 CoLockObjectExternal(pDropTarget, FALSE, TRUE);
229
230 // release our own reference
231 pDropTarget->Release();
232}
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
deleted file mode 100644
index 24c3de3..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef __ECORE_WIN32_DND_DROP_TARGET_H__
2#define __ECORE_WIN32_DND_DROP_TARGET_H__
3
4
5#define WIN32_LEAN_AND_MEAN
6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN
8#include <ole2.h>
9
10#include "Ecore_Win32.h"
11
12
13class DropTarget : public IDropTarget
14{
15 private:
16
17 LONG ref_count_;
18 HWND window_;
19 bool allow_drop_;
20 Ecore_Win32_Dnd_DropTarget_Callback drop_callback_;
21 void *drop_callback_ptr_;
22
23 private: // internal helper function
24
25 DWORD DropEffect(DWORD grfKeyState, POINTL pt, DWORD dwAllowed);
26 bool QueryDataObject(IDataObject *pDataObject);
27
28 public: // structors
29
30 DropTarget(HWND hwnd, Ecore_Win32_Dnd_DropTarget_Callback callback, void *window_obj_ptr);
31
32public: // IUnknown
33
34 HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject);
35 ULONG __stdcall AddRef();
36 ULONG __stdcall Release();
37
38 public: // IDropTarget
39
40 HRESULT __stdcall DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
41 HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
42 HRESULT __stdcall DragLeave();
43 HRESULT __stdcall Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
44};
45
46
47#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
deleted file mode 100644
index a3858bc..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
1
2#include <ole2.h>
3
4#include "ecore_win32_dnd_enumformatetc.h"
5
6
7// structors
8
9CEnumFormatEtc::CEnumFormatEtc(FORMATETC *format_etc, int formats_num)
10 : ref_count_(1)
11 , index_(0)
12 , formats_num_(formats_num)
13 , format_etc_(new FORMATETC[formats_num])
14{
15 // make a new copy of each FORMATETC structure
16 for (unsigned int i = 0; i < formats_num_; i++)
17 {
18 DeepCopyFormatEtc(&format_etc_[i], &format_etc[i]);
19 }
20}
21
22CEnumFormatEtc::~CEnumFormatEtc()
23{
24 if (format_etc_)
25 {
26 // first free any DVTARGETDEVICE structures
27 for (ULONG i = 0; i < formats_num_; i++)
28 {
29 if (format_etc_[i].ptd)
30 CoTaskMemFree(format_etc_[i].ptd);
31 }
32
33 // now free the main array
34 delete[] format_etc_;
35 }
36}
37
38// IUnknown
39
40ULONG __stdcall CEnumFormatEtc::AddRef(void)
41{
42 // increment object reference count
43 return InterlockedIncrement(&ref_count_);
44}
45
46ULONG __stdcall CEnumFormatEtc::Release(void)
47{
48 // decrement object reference count
49 LONG count = InterlockedDecrement(&ref_count_);
50
51 if (count == 0)
52 {
53 delete this;
54 return 0;
55 }
56 else
57 {
58 return count;
59 }
60}
61
62HRESULT __stdcall CEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject)
63{
64 // check to see what interface has been requested
65 if ((iid == IID_IEnumFORMATETC) || (iid == IID_IUnknown))
66 {
67 AddRef();
68 *ppvObject = this;
69 return S_OK;
70 }
71 else
72 {
73 *ppvObject = 0;
74 return E_NOINTERFACE;
75 }
76}
77
78// IEnumFormatEtc
79
80HRESULT CEnumFormatEtc::Reset(void)
81{
82 index_ = 0;
83 return S_OK;
84}
85
86HRESULT CEnumFormatEtc::Skip(ULONG celt)
87{
88 index_ += celt;
89 return (index_ <= formats_num_) ? S_OK : S_FALSE;
90}
91
92HRESULT CEnumFormatEtc::Clone(IEnumFORMATETC **ppEnumFormatEtc)
93{
94 HRESULT hResult;
95
96 // make a duplicate enumerator
97 hResult = CreateEnumFormatEtc(formats_num_, format_etc_, ppEnumFormatEtc);
98
99 if (hResult == S_OK)
100 {
101 // manually set the index state
102 ((CEnumFormatEtc *)*ppEnumFormatEtc)->index_ = index_;
103 }
104
105 return hResult;
106}
107
108HRESULT CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG *pceltFetched)
109{
110 ULONG copied = 0;
111
112 // validate arguments
113 if ((celt == 0) || (pFormatEtc == 0))
114 return E_INVALIDARG;
115
116 // copy the FORMATETC structures into the caller's buffer
117 while (index_ < formats_num_ && copied < celt)
118 {
119 DeepCopyFormatEtc(&pFormatEtc[copied], &format_etc_[index_]);
120 copied++;
121 index_++;
122 }
123
124 // store result
125 if (pceltFetched != 0)
126 *pceltFetched = copied;
127
128 // did we copy all that was requested?
129 return (copied == celt) ? S_OK : S_FALSE;
130}
131
132// external functions
133
134void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source)
135{
136 // copy the source FORMATETC into dest
137 *dest = *source;
138
139 if (source->ptd)
140 {
141 // allocate memory for the DVTARGETDEVICE if necessary
142 dest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE));
143
144 // copy the contents of the source DVTARGETDEVICE into dest->ptd
145 *(dest->ptd) = *(source->ptd);
146 }
147}
148
149HRESULT CreateEnumFormatEtc(UINT cfmt, FORMATETC *afmt, IEnumFORMATETC **ppEnumFormatEtc)
150{
151 if((cfmt == 0) || (afmt == 0) || (ppEnumFormatEtc == 0))
152 return E_INVALIDARG;
153
154 *ppEnumFormatEtc = new CEnumFormatEtc(afmt, cfmt);
155
156 return (*ppEnumFormatEtc) ? S_OK : E_OUTOFMEMORY;
157}
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
deleted file mode 100644
index 9f17f56..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef __ECORE_WIN32_DND_ENUMFORMATETC_H__
2#define __ECORE_WIN32_DND_ENUMFORMATETC_H__
3
4
5#define WIN32_LEAN_AND_MEAN
6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN
8#include <objbase.h>
9
10
11class CEnumFormatEtc : public IEnumFORMATETC
12{
13 private:
14
15 LONG ref_count_; // Reference count for this COM interface
16 ULONG index_; // current enumerator index
17 ULONG formats_num_; // number of FORMATETC members
18 FORMATETC *format_etc_; // array of FORMATETC objects
19
20 public: // structors
21
22 CEnumFormatEtc(FORMATETC *pFormatEtc, int nNumFormats);
23
24 ~CEnumFormatEtc();
25
26 public: // IUnknown
27
28 HRESULT __stdcall QueryInterface (REFIID iid, void ** ppvObject);
29
30 ULONG __stdcall AddRef (void);
31
32 ULONG __stdcall Release (void);
33
34 public: // IEnumFormatEtc
35
36 HRESULT __stdcall Next (ULONG celt, FORMATETC * rgelt, ULONG * pceltFetched);
37
38 HRESULT __stdcall Skip (ULONG celt);
39
40 HRESULT __stdcall Reset (void);
41
42 HRESULT __stdcall Clone (IEnumFORMATETC ** ppEnumFormatEtc);
43};
44
45void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source);
46
47HRESULT CreateEnumFormatEtc(UINT cfmt, FORMATETC *afmt, IEnumFORMATETC **ppEnumFormatEtc);
48
49
50#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
deleted file mode 100644
index 388776c..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c
+++ /dev/null
@@ -1,1295 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h> /* for printf */
7
8#define WIN32_LEAN_AND_MEAN
9#include <windows.h>
10#undef WIN32_LEAN_AND_MEAN
11#include <windowsx.h>
12
13#include <Eina.h>
14#include <Ecore.h>
15#include <Ecore_Input.h>
16
17#include "Ecore_Win32.h"
18#include "ecore_win32_private.h"
19
20
21typedef enum
22{
23 ECORE_WIN32_KEY_MASK_LSHIFT = 1 << 0,
24 ECORE_WIN32_KEY_MASK_RSHIFT = 1 << 1,
25 ECORE_WIN32_KEY_MASK_LCONTROL = 1 << 2,
26 ECORE_WIN32_KEY_MASK_RCONTROL = 1 << 3,
27 ECORE_WIN32_KEY_MASK_LMENU = 1 << 4,
28 ECORE_WIN32_KEY_MASK_RMENU = 1 << 5
29} Ecore_Win32_Key_Mask;
30
31/***** Private declarations *****/
32
33
34static Ecore_Win32_Window *_ecore_win32_mouse_down_last_window = NULL;
35static Ecore_Win32_Window *_ecore_win32_mouse_down_last_last_window = NULL;
36static long _ecore_win32_mouse_down_last_time = 0 ;
37static long _ecore_win32_mouse_down_last_last_time = 0 ;
38static int _ecore_win32_mouse_down_did_triple = 0;
39static int _ecore_win32_mouse_up_count = 0;
40static Ecore_Win32_Key_Mask _ecore_win32_key_mask = 0;
41
42static void _ecore_win32_event_free_key_down(void *data,
43 void *ev);
44
45static void _ecore_win32_event_free_key_up(void *data,
46 void *ev);
47
48static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
49 Eina_Bool is_down,
50 char **keyname,
51 char **keysymbol,
52 char **keycompose,
53 unsigned int *modifiers);
54
55static int _ecore_win32_event_char_get(int key,
56 char **keyname,
57 char **keysymbol,
58 char **keycompose,
59 unsigned int *modifiers);
60
61
62/***** Global functions definitions *****/
63
64void
65_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
66 int is_keystroke)
67{
68 Ecore_Event_Key *e;
69
70 INF("key pressed");
71
72 e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
73 if (!e) return;
74
75 if (is_keystroke)
76 {
77 if (!_ecore_win32_event_keystroke_get(msg,
78 EINA_TRUE,
79 (char **)&e->keyname,
80 (char **)&e->key,
81 (char **)&e->string,
82 &e->modifiers))
83 {
84 free(e);
85 return;
86 }
87 }
88 else
89 {
90 if (!_ecore_win32_event_char_get(LOWORD(msg->window_param),
91 (char **)&e->keyname,
92 (char **)&e->key,
93 (char **)&e->string,
94 &e->modifiers))
95 {
96 free(e);
97 return;
98 }
99 }
100
101 e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA);
102 if (!e->window)
103 {
104 free(e);
105 return;
106 }
107 e->event_window = e->window;
108 e->timestamp = msg->timestamp;
109
110 _ecore_win32_event_last_time = e->timestamp;
111
112 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL);
113}
114
115void
116_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg)
117{
118 Ecore_Event_Key *e;
119
120 INF("key released");
121
122 e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
123 if (!e) return;
124
125 if (!_ecore_win32_event_keystroke_get(msg,
126 EINA_FALSE,
127 (char **)&e->keyname,
128 (char **)&e->key,
129 (char **)&e->string,
130 &e->modifiers))
131 {
132 if (msg->discard_ctrl ||
133 !_ecore_win32_event_char_get(LOWORD(msg->window_param),
134 (char **)&e->keyname,
135 (char **)&e->key,
136 (char **)&e->string,
137 &e->modifiers))
138 {
139 free(e);
140 return;
141 }
142 }
143
144 e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA);
145 if (!e->window)
146 {
147 free(e);
148 return;
149 }
150 e->event_window = e->window;
151 e->timestamp = msg->timestamp;
152
153 _ecore_win32_event_last_time = e->timestamp;
154
155 ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL);
156}
157
158void
159_ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
160 int button)
161{
162 Ecore_Win32_Window *window;
163
164 INF("mouse button pressed");
165
166 window = (Ecore_Win32_Window *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
167
168 if (button > 3)
169 {
170 Ecore_Event_Mouse_Wheel *e;
171
172 e = (Ecore_Event_Mouse_Wheel *)calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
173 if (!e) return;
174
175 e->window = (Ecore_Window)window;
176 e->event_window = e->window;
177 e->direction = 0;
178 /* wheel delta is positive or negative, never 0 */
179 e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1;
180 e->x = GET_X_LPARAM(msg->data_param);
181 e->y = GET_Y_LPARAM(msg->data_param);
182 e->timestamp = msg->timestamp;
183
184 _ecore_win32_event_last_time = e->timestamp;
185 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
186
187 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
188 }
189 else
190 {
191 {
192 Ecore_Event_Mouse_Move *e;
193
194 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
195 if (!e) return;
196
197 e->window = (Ecore_Window)window;
198 e->event_window = e->window;
199 e->x = GET_X_LPARAM(msg->data_param);
200 e->y = GET_Y_LPARAM(msg->data_param);
201 e->timestamp = msg->timestamp;
202
203 _ecore_win32_event_last_time = e->timestamp;
204 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
205
206 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
207 }
208
209 {
210 Ecore_Event_Mouse_Button *e;
211
212 if (_ecore_win32_mouse_down_did_triple)
213 {
214 _ecore_win32_mouse_down_last_window = NULL;
215 _ecore_win32_mouse_down_last_last_window = NULL;
216 _ecore_win32_mouse_down_last_time = 0;
217 _ecore_win32_mouse_down_last_last_time = 0;
218 }
219
220 e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button));
221 if (!e) return;
222
223 e->window = (Ecore_Window)window;
224 e->event_window = e->window;
225 e->buttons = button;
226 e->x = GET_X_LPARAM(msg->data_param);
227 e->y = GET_Y_LPARAM(msg->data_param);
228 e->timestamp = msg->timestamp;
229
230 if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) &&
231 (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window))
232 e->double_click = 1;
233
234 if (((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (unsigned long)(2 * 1000 * _ecore_win32_double_click_time)) &&
235 (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) &&
236 (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window))
237 {
238 e->triple_click = 1;
239 _ecore_win32_mouse_down_did_triple = 1;
240 }
241 else
242 _ecore_win32_mouse_down_did_triple = 0;
243
244 if (!e->double_click && !e->triple_click)
245 _ecore_win32_mouse_up_count = 0;
246
247 _ecore_win32_event_last_time = e->timestamp;
248 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
249
250 if (!_ecore_win32_mouse_down_did_triple)
251 {
252 _ecore_win32_mouse_down_last_last_window = _ecore_win32_mouse_down_last_window;
253 _ecore_win32_mouse_down_last_window = (Ecore_Win32_Window *)e->window;
254 _ecore_win32_mouse_down_last_last_time = _ecore_win32_mouse_down_last_time;
255 _ecore_win32_mouse_down_last_time = e->timestamp;
256 }
257
258 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
259 }
260 }
261}
262
263void
264_ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
265 int button)
266{
267 Ecore_Win32_Window *window;
268
269 INF("mouse button released");
270
271 window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
272
273 {
274 Ecore_Event_Mouse_Move *e;
275
276 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
277 if (!e) return;
278
279 e->window = (Ecore_Window)window;
280 e->event_window = e->window;
281 e->x = GET_X_LPARAM(msg->data_param);
282 e->y = GET_Y_LPARAM(msg->data_param);
283 e->timestamp = msg->timestamp;
284
285 _ecore_win32_event_last_time = e->timestamp;
286 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
287
288 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
289 }
290
291 {
292 Ecore_Event_Mouse_Button *e;
293
294 e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button));
295 if (!e) return;
296
297 e->window = (Ecore_Window)window;
298 e->event_window = e->window;
299 e->buttons = button;
300 e->x = GET_X_LPARAM(msg->data_param);
301 e->y = GET_Y_LPARAM(msg->data_param);
302 e->timestamp = msg->timestamp;
303
304 _ecore_win32_mouse_up_count++;
305
306 if ((_ecore_win32_mouse_up_count >= 2) &&
307 ((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) &&
308 (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window))
309 e->double_click = 1;
310
311 if ((_ecore_win32_mouse_up_count >= 3) &&
312 ((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (unsigned long)(2 * 1000 * _ecore_win32_double_click_time)) &&
313 (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) &&
314 (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window))
315 e->triple_click = 1;
316
317 _ecore_win32_event_last_time = e->timestamp;
318 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
319
320 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
321 }
322}
323
324void
325_ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg)
326{
327 Ecore_Event_Mouse_Move *e;
328
329 INF("mouse moved");
330
331 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
332 if (!e) return;
333
334 e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA);
335 e->event_window = e->window;
336 e->x = GET_X_LPARAM(msg->data_param);
337 e->y = GET_Y_LPARAM(msg->data_param);
338 e->timestamp = msg->timestamp;
339
340 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
341}
342
343void
344_ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg)
345{
346 {
347 Ecore_Event_Mouse_Move *e;
348
349 INF("mouse in");
350
351 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
352 if (!e) return;
353
354 e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA);
355 e->event_window = e->window;
356 e->x = msg->x;
357 e->y = msg->y;
358 e->timestamp = msg->timestamp;
359
360 _ecore_win32_event_last_time = e->timestamp;
361 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
362
363 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
364 }
365
366 {
367 Ecore_Win32_Event_Mouse_In *e;
368
369 e = (Ecore_Win32_Event_Mouse_In *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_In));
370 if (!e) return;
371
372 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
373 e->x = msg->x;
374 e->y = msg->y;
375 e->timestamp = msg->timestamp ;
376
377 _ecore_win32_event_last_time = e->timestamp;
378
379 ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL);
380 }
381}
382
383void
384_ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg)
385{
386 {
387 Ecore_Event_Mouse_Move *e;
388
389 INF("mouse out");
390
391 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
392 if (!e) return;
393
394 e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA);
395 e->event_window = e->window;
396 e->x = msg->x;
397 e->y = msg->y;
398 e->timestamp = msg->timestamp;
399
400 _ecore_win32_event_last_time = e->timestamp;
401 _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
402
403 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
404 }
405
406 {
407 Ecore_Win32_Event_Mouse_Out *e;
408
409 e = (Ecore_Win32_Event_Mouse_Out *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Out));
410 if (!e) return;
411
412 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
413 e->x = msg->x;
414 e->y = msg->y;
415 e->timestamp = msg->timestamp;
416
417 _ecore_win32_event_last_time = e->timestamp;
418
419 ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL);
420 }
421}
422
423void
424_ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg)
425{
426 Ecore_Win32_Event_Window_Focus_In *e;
427
428 INF("focus in");
429
430 e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In));
431 if (!e) return;
432
433 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
434
435 e->timestamp = _ecore_win32_event_last_time;
436 _ecore_win32_event_last_time = e->timestamp;
437
438 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
439}
440
441void
442_ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg)
443{
444 Ecore_Win32_Event_Window_Focus_Out *e;
445
446 INF("focus out");
447
448 e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out));
449 if (!e) return;
450
451 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
452
453 e->timestamp = _ecore_win32_event_last_time;
454 _ecore_win32_event_last_time = e->timestamp;
455
456 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
457}
458
459void
460_ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg)
461{
462 Ecore_Win32_Event_Window_Damage *e;
463
464 INF("window expose");
465
466 e = (Ecore_Win32_Event_Window_Damage *)calloc(1, sizeof(Ecore_Win32_Event_Window_Damage));
467 if (!e) return;
468
469 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
470
471 e->x = msg->update.left;
472 e->y = msg->update.top;
473 e->width = msg->update.right - msg->update.left;
474 e->height = msg->update.bottom - msg->update.top;
475
476 e->timestamp = _ecore_win32_event_last_time;
477
478 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
479}
480
481void
482_ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg)
483{
484 Ecore_Win32_Event_Window_Create *e;
485
486 INF("window create notify");
487
488 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create));
489 if (!e) return;
490
491 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
492
493 e->timestamp = _ecore_win32_event_last_time;
494
495 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL);
496}
497
498void
499_ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg)
500{
501 Ecore_Win32_Event_Window_Destroy *e;
502
503 INF("window destroy notify");
504
505 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy));
506 if (!e) return;
507
508 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
509
510 e->timestamp = _ecore_win32_event_last_time;
511 if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL;
512
513 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL);
514}
515
516void
517_ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg)
518{
519 Ecore_Win32_Event_Window_Show *e;
520
521 INF("window map notify");
522
523 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show));
524 if (!e) return;
525
526 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
527
528 e->timestamp = _ecore_win32_event_last_time;
529
530 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL);
531}
532
533void
534_ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg)
535{
536 Ecore_Win32_Event_Window_Hide *e;
537
538 INF("window unmap notify");
539
540 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide));
541 if (!e) return;
542
543 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
544
545 e->timestamp = _ecore_win32_event_last_time;
546
547 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL);
548}
549
550void
551_ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg)
552{
553 WINDOWINFO wi;
554 Ecore_Win32_Event_Window_Configure *e;
555 WINDOWPOS *window_pos;
556
557 INF("window configure notify");
558
559 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Configure));
560 if (!e) return;
561
562 window_pos = (WINDOWPOS *)msg->data_param;
563 wi.cbSize = sizeof(WINDOWINFO);
564 if (!GetWindowInfo(window_pos->hwnd, &wi))
565 {
566 free(e);
567 return;
568 }
569
570 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
571 e->abovewin = (void *)GetWindowLongPtr(window_pos->hwndInsertAfter, GWLP_USERDATA);
572 e->x = wi.rcClient.left;
573 e->y = wi.rcClient.top;
574 e->width = wi.rcClient.right - wi.rcClient.left;
575 e->height = wi.rcClient.bottom - wi.rcClient.top;
576 e->timestamp = _ecore_win32_event_last_time;
577
578 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
579}
580
581void
582_ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg)
583{
584 RECT rect;
585 Ecore_Win32_Event_Window_Resize *e;
586
587 INF("window resize");
588
589 if (!GetClientRect(msg->window, &rect))
590 return;
591
592 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Resize));
593 if (!e) return;
594
595 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
596 e->width = rect.right - rect.left;
597 e->height = rect.bottom - rect.top;
598 e->timestamp = _ecore_win32_event_last_time;
599
600 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL);
601}
602
603void
604_ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg)
605{
606 Ecore_Win32_Event_Window_Delete_Request *e;
607
608 INF("window delete request");
609
610 e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request));
611 if (!e) return;
612
613 e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
614 e->timestamp = _ecore_win32_event_last_time;
615
616 ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
617}
618
619
620/***** Private functions definitions *****/
621
622static void
623_ecore_win32_event_free_key_down(void *data __UNUSED__,
624 void *ev)
625{
626 Ecore_Event_Key *e;
627
628 e = ev;
629 if (e->keyname) free((char *)e->keyname);
630 if (e->key) free((char *)e->key);
631 if (e->string) free((char *)e->string);
632 free(e);
633}
634
635static void
636_ecore_win32_event_free_key_up(void *data __UNUSED__,
637 void *ev)
638{
639 Ecore_Event_Key *e;
640
641 e = ev;
642 if (e->keyname) free((char *)e->keyname);
643 if (e->key) free((char *)e->key);
644 if (e->string) free((char *)e->string);
645 free(e);
646}
647
648static int
649_ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
650 Eina_Bool is_down,
651 char **keyname,
652 char **keysymbol,
653 char **keycompose,
654 unsigned int *modifiers)
655{
656 WCHAR buf[3];
657 char delete_string[2] = { 0x7f, 0 };
658 char *kn = NULL;
659 char *ks = NULL;
660 char *kc = NULL;
661 int key;
662 int is_extended;
663
664 key = msg->window_param;
665 is_extended = msg->data_param & 0x01000000;
666
667 *keyname = NULL;
668 *keysymbol = NULL;
669 *keycompose = NULL;
670
671 switch (key)
672 {
673 /* Keystroke */
674 case VK_PRIOR:
675 if (is_extended)
676 {
677 kn = "Prior";
678 ks = "Prior";
679 kc = NULL;
680 }
681 else
682 {
683 kn = "KP_Prior";
684 ks = "KP_9";
685 kc = "KP_Prior";
686 }
687 break;
688 case VK_NEXT:
689 if (is_extended)
690 {
691 kn = "Next";
692 ks = "Next";
693 kc = NULL;
694 }
695 else
696 {
697 kn = "KP_Next";
698 ks = "KP_3";
699 kc = "KP_Next";
700 }
701 break;
702 case VK_END:
703 if (is_extended)
704 {
705 kn = "End";
706 ks = "End";
707 kc = NULL;
708 }
709 else
710 {
711 kn = "KP_End";
712 ks = "KP_1";
713 kc = "KP_End";
714 }
715 break;
716 case VK_HOME:
717 if (is_extended)
718 {
719 kn = "Home";
720 ks = "Home";
721 kc = NULL;
722 }
723 else
724 {
725 kn = "KP_Home";
726 ks = "KP_7";
727 kc = "KP_Home";
728 }
729 break;
730 case VK_LEFT:
731 if (is_extended)
732 {
733 kn = "Left";
734 ks = "Left";
735 kc = NULL;
736 }
737 else
738 {
739 kn = "KP_Left";
740 ks = "KP_4";
741 kc = "KP_Left";
742 }
743 break;
744 case VK_UP:
745 if (is_extended)
746 {
747 kn = "Up";
748 ks = "Up";
749 kc = NULL;
750 }
751 else
752 {
753 kn = "KP_Up";
754 ks = "KP_8";
755 kc = "KP_Up";
756 }
757 break;
758 case VK_RIGHT:
759 if (is_extended)
760 {
761 kn = "Right";
762 ks = "Right";
763 kc = NULL;
764 }
765 else
766 {
767 kn = "KP_Right";
768 ks = "KP_6";
769 kc = "KP_Right";
770 }
771 break;
772 case VK_DOWN:
773 if (is_extended)
774 {
775 kn = "Down";
776 ks = "Down";
777 kc = NULL;
778 }
779 else
780 {
781 kn = "KP_Down";
782 ks = "KP_2";
783 kc = "KP_Down";
784 }
785 break;
786 case VK_INSERT:
787 if (is_extended)
788 {
789 kn = "Insert";
790 ks = "Insert";
791 kc = NULL;
792 }
793 else
794 {
795 kn = "KP_Insert";
796 ks = "KP_0";
797 kc = "KP_Insert";
798 }
799 break;
800 case VK_DELETE:
801 if (is_extended)
802 {
803 kn = "Delete";
804 ks = "Delete";
805 kc = delete_string;
806 }
807 else
808 {
809 kn = "KP_Delete";
810 ks = "KP_Decimal";
811 kc = "KP_Delete";
812 }
813 break;
814 case VK_SHIFT:
815 {
816 SHORT res;
817
818 if (is_down)
819 {
820 res = GetKeyState(VK_LSHIFT);
821 if (res & 0x8000)
822 {
823 _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LSHIFT;
824 kn = "Shift_L";
825 ks = "Shift_L";
826 kc = "";
827 }
828 res = GetKeyState(VK_RSHIFT);
829 if (res & 0x8000)
830 {
831 _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RSHIFT;
832 kn = "Shift_R";
833 ks = "Shift_R";
834 kc = "";
835 }
836 *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
837 }
838 else /* is_up */
839 {
840 res = GetKeyState(VK_LSHIFT);
841 if (!(res & 0x8000) &&
842 (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LSHIFT))
843 {
844 kn = "Shift_L";
845 ks = "Shift_L";
846 kc = "";
847 _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LSHIFT;
848 }
849 res = GetKeyState(VK_RSHIFT);
850 if (!(res & 0x8000) &&
851 (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RSHIFT))
852 {
853 kn = "Shift_R";
854 ks = "Shift_R";
855 kc = "";
856 _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT;
857 }
858 *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
859 }
860 break;
861 }
862 case VK_CONTROL:
863 {
864 SHORT res;
865
866 if (msg->discard_ctrl)
867 return 0;
868
869 if (is_down)
870 {
871 res = GetKeyState(VK_LCONTROL);
872 if (res & 0x8000)
873 {
874 _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LCONTROL;
875 kn = "Control_L";
876 ks = "Control_L";
877 kc = "";
878 break;
879 }
880 res = GetKeyState(VK_RCONTROL);
881 if (res & 0x8000)
882 {
883 _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RCONTROL;
884 kn = "Control_R";
885 ks = "Control_R";
886 kc = "";
887 break;
888 }
889 *modifiers |= ECORE_EVENT_MODIFIER_CTRL;
890 }
891 else /* is_up */
892 {
893 res = GetKeyState(VK_LCONTROL);
894 if (!(res & 0x8000) &&
895 (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LCONTROL))
896 {
897 kn = "Control_L";
898 ks = "Control_L";
899 kc = "";
900 _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LCONTROL;
901 break;
902 }
903 res = GetKeyState(VK_RCONTROL);
904 if (!(res & 0x8000) &&
905 (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RCONTROL))
906 {
907 kn = "Control_R";
908 ks = "Control_R";
909 kc = "";
910 _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RCONTROL;
911 break;
912 }
913 *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
914 }
915 break;
916 }
917 case VK_MENU:
918 {
919 SHORT res;
920
921 if (is_down)
922 {
923 res = GetKeyState(VK_LMENU);
924 if (res & 0x8000)
925 {
926 _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LMENU;
927 kn = "Alt_L";
928 ks = "Alt_L";
929 kc = "";
930 }
931 res = GetKeyState(VK_RMENU);
932 if (res & 0x8000)
933 {
934 _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RMENU;
935 kn = "Alt_R";
936 ks = "Alt_R";
937 kc = "";
938 }
939 *modifiers |= ECORE_EVENT_MODIFIER_ALT;
940 }
941 else /* is_up */
942 {
943 res = GetKeyState(VK_LMENU);
944 if (!(res & 0x8000) &&
945 (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LMENU))
946 {
947 kn = "Alt_L";
948 ks = "Alt_L";
949 kc = "";
950 _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LMENU;
951 }
952 res = GetKeyState(VK_RMENU);
953 if (!(res & 0x8000) &&
954 (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RMENU))
955 {
956 kn = "Alt_R";
957 ks = "Alt_R";
958 kc = "";
959 _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RMENU;
960 }
961 *modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
962 }
963 break;
964 }
965 case VK_LWIN:
966 {
967 if (is_down)
968 {
969 kn = "Super_L";
970 ks = "Super_L";
971 kc = "";
972 *modifiers |= ECORE_EVENT_MODIFIER_WIN;
973 }
974 else /* is_up */
975 {
976 kn = "Super_L";
977 ks = "Super_L";
978 kc = "";
979 *modifiers &= ~ECORE_EVENT_MODIFIER_WIN;
980 }
981 break;
982 }
983 case VK_RWIN:
984 {
985 if (is_down)
986 {
987 kn = "Super_R";
988 ks = "Super_R";
989 kc = "";
990 *modifiers |= ECORE_EVENT_MODIFIER_WIN;
991 }
992 else /* is_up */
993 {
994 kn = "Super_R";
995 ks = "Super_R";
996 kc = "";
997 *modifiers &= ~ECORE_EVENT_MODIFIER_WIN;
998 }
999 break;
1000 }
1001 case VK_F1:
1002 kn = "F1";
1003 ks = "F1";
1004 kc = "";
1005 break;
1006 case VK_F2:
1007 kn = "F2";
1008 ks = "F2";
1009 kc = "";
1010 break;
1011 case VK_F3:
1012 kn = "F3";
1013 ks = "F3";
1014 kc = "";
1015 break;
1016 case VK_F4:
1017 kn = "F4";
1018 ks = "F4";
1019 kc = "";
1020 break;
1021 case VK_F5:
1022 kn = "F5";
1023 ks = "F5";
1024 kc = "";
1025 break;
1026 case VK_F6:
1027 kn = "F6";
1028 ks = "F6";
1029 kc = "";
1030 break;
1031 case VK_F7:
1032 kn = "F7";
1033 ks = "F7";
1034 kc = "";
1035 break;
1036 case VK_F8:
1037 kn = "F8";
1038 ks = "F8";
1039 kc = "";
1040 break;
1041 case VK_F9:
1042 kn = "F9";
1043 ks = "F9";
1044 kc = "";
1045 break;
1046 case VK_F10:
1047 kn = "F10";
1048 ks = "F10";
1049 kc = "";
1050 break;
1051 case VK_F11:
1052 kn = "F11";
1053 ks = "F11";
1054 kc = "";
1055 break;
1056 case VK_F12:
1057 kn = "F12";
1058 ks = "F12";
1059 kc = "";
1060 break;
1061 case VK_F13:
1062 kn = "F13";
1063 ks = "F13";
1064 kc = "";
1065 break;
1066 case VK_F14:
1067 kn = "F14";
1068 ks = "F14";
1069 kc = "";
1070 break;
1071 case VK_F15:
1072 kn = "F15";
1073 ks = "F15";
1074 kc = "";
1075 break;
1076 case VK_F16:
1077 kn = "F16";
1078 ks = "F16";
1079 kc = "";
1080 break;
1081 case VK_F17:
1082 kn = "F17";
1083 ks = "F17";
1084 kc = "";
1085 break;
1086 case VK_F18:
1087 kn = "F18";
1088 ks = "F18";
1089 kc = "";
1090 break;
1091 case VK_F19:
1092 kn = "F19";
1093 ks = "F19";
1094 kc = "";
1095 break;
1096 case VK_F20:
1097 kn = "F20";
1098 ks = "F20";
1099 kc = "";
1100 break;
1101 case VK_F21:
1102 kn = "F21";
1103 ks = "F21";
1104 kc = "";
1105 break;
1106 case VK_F22:
1107 kn = "F22";
1108 ks = "F22";
1109 kc = "";
1110 break;
1111 case VK_F23:
1112 kn = "F23";
1113 ks = "F23";
1114 kc = "";
1115 break;
1116 case VK_F24:
1117 kn = "F24";
1118 ks = "F24";
1119 kc = "";
1120 break;
1121 default:
1122 {
1123 /* other non keystroke characters */
1124 BYTE kbd_state[256];
1125 int res;
1126
1127 if (is_down)
1128 return 0;
1129
1130 if (!GetKeyboardState(kbd_state))
1131 return 0;
1132
1133 res = ToUnicode(msg->window_param,
1134 MapVirtualKey(msg->window_param, 2),
1135 kbd_state, buf, 3, 0);
1136 if (res == 1)
1137 {
1138 /* FIXME: might be troublesome for non european languages */
1139 /* in that case, UNICODE should be used, I guess */
1140 buf[1] = '\0';
1141 kn = (char *)buf;
1142 ks = (char *)buf;
1143 kc = (char *)buf;
1144
1145 res = GetAsyncKeyState(VK_SHIFT);
1146 if (res & 0x8000)
1147 *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
1148 else
1149 *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
1150
1151 res = GetKeyState(VK_CONTROL);
1152 if (res & 0x8000)
1153 *modifiers |= ECORE_EVENT_MODIFIER_CTRL;
1154 else
1155 *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
1156
1157 res = GetKeyState(VK_MENU);
1158 if (res & 0x8000)
1159 *modifiers |= ECORE_EVENT_MODIFIER_ALT;
1160 else
1161 *modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
1162
1163 break;
1164 }
1165 return 0;
1166 }
1167 }
1168
1169 *keyname = strdup(kn);
1170 if (!*keyname) return 0;
1171 *keysymbol = strdup(ks);
1172 if (!*keysymbol)
1173 {
1174 free(*keyname);
1175 *keyname = NULL;
1176 return 0;
1177 }
1178 if (!kc)
1179 *keycompose = NULL;
1180 else
1181 {
1182 *keycompose = strdup(kc);
1183 if (!*keycompose)
1184 {
1185 free(*keyname);
1186 free(*keysymbol);
1187 *keyname = NULL;
1188 *keysymbol = NULL;
1189 return 0;
1190 }
1191 }
1192
1193 return 1;
1194}
1195
1196static int
1197_ecore_win32_event_char_get(int key,
1198 char **keyname,
1199 char **keysymbol,
1200 char **keycompose,
1201 unsigned int *modifiers)
1202{
1203 char *kn = NULL;
1204 char *ks = NULL;
1205 char *kc = NULL;
1206 char buf[2];
1207 SHORT res;
1208
1209 *keyname = NULL;
1210 *keysymbol = NULL;
1211 *keycompose = NULL;
1212
1213 switch (key)
1214 {
1215 case VK_PROCESSKEY:
1216 break;
1217 case VK_BACK:
1218 kn = "BackSpace";
1219 ks = "BackSpace";
1220 kc = "\b";
1221 break;
1222 case VK_TAB:
1223 kn = "Tab";
1224 ks = "Tab";
1225 kc = "\t";
1226 break;
1227 case 0x0a:
1228 /* Line feed (Shift + Enter) */
1229 kn = "LineFeed";
1230 ks = "LineFeed";
1231 kc = "LineFeed";
1232 break;
1233 case VK_RETURN:
1234 kn = "Return";
1235 ks = "Return";
1236 kc = "\n";
1237 break;
1238 case VK_ESCAPE:
1239 kn = "Escape";
1240 ks = "Escape";
1241 kc = "\e";
1242 break;
1243 case VK_SPACE:
1244 kn = "space";
1245 ks = "space";
1246 kc = " ";
1247 break;
1248 default:
1249 /* displayable characters */
1250 buf[0] = key;
1251 buf[1] = '\0';
1252 kn = buf;
1253 ks = buf;
1254 kc = buf;
1255 break;
1256 }
1257 *keyname = strdup(kn);
1258 if (!*keyname) return 0;
1259 *keysymbol = strdup(ks);
1260 if (!*keysymbol)
1261 {
1262 free(*keyname);
1263 *keyname = NULL;
1264 return 0;
1265 }
1266 *keycompose = strdup(kc);
1267 if (!*keycompose)
1268 {
1269 free(*keyname);
1270 free(*keysymbol);
1271 *keyname = NULL;
1272 *keysymbol = NULL;
1273 return 0;
1274 }
1275
1276 res = GetAsyncKeyState(VK_SHIFT);
1277 if (res & 0x8000)
1278 *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
1279 else
1280 *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
1281
1282 res = GetKeyState(VK_CONTROL);
1283 if (res & 0x8000)
1284 *modifiers |= ECORE_EVENT_MODIFIER_CTRL;
1285 else
1286 *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
1287
1288 res = GetKeyState(VK_MENU);
1289 if (res & 0x8000)
1290 *modifiers |= ECORE_EVENT_MODIFIER_ALT;
1291 else
1292 *modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
1293
1294 return 1;
1295}
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h
deleted file mode 100644
index e3e4426..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h
+++ /dev/null
@@ -1,170 +0,0 @@
1#ifndef __ECORE_WIN32_PRIVATE_H__
2#define __ECORE_WIN32_PRIVATE_H__
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#ifdef MIN
10# undef MIN
11#endif
12#define MIN(a,b) (((a) < (b)) ? (a) : (b))
13
14#ifdef MAX
15# undef MAX
16#endif
17#define MAX(a,b) (((a) < (b)) ? (b) : (a))
18
19/* logging messages macros */
20extern int _ecore_win32_log_dom_global;
21
22#ifdef ECORE_WIN32_DEFAULT_LOG_COLOR
23# undef ECORE_WIN32_DEFAULT_LOG_COLOR
24#endif
25#define ECORE_WIN32_DEFAULT_LOG_COLOR EINA_COLOR_LIGHTBLUE
26
27#ifdef ERR
28# undef ERR
29#endif
30#define ERR(...) EINA_LOG_DOM_ERR(_ecore_win32_log_dom_global , __VA_ARGS__)
31#ifdef DBG
32#undef DBG
33#endif
34#define DBG(...) EINA_LOG_DOM_DBG(_ecore_win32_log_dom_global , __VA_ARGS__)
35
36#ifdef INF
37#undef INF
38#endif
39#define INF(...) EINA_LOG_DOM_INFO(_ecore_win32_log_dom_global , __VA_ARGS__)
40
41#ifdef WRN
42# undef WRN
43#endif
44#define WRN(...) EINA_LOG_DOM_WARN(_ecore_win32_log_dom_global, __VA_ARGS__)
45
46#define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class"
47
48typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data;
49
50struct _Ecore_Win32_Callback_Data
51{
52 RECT update;
53 HWND window;
54 unsigned int message;
55 WPARAM window_param;
56 LPARAM data_param;
57 unsigned long timestamp;
58 int x;
59 int y;
60 Eina_Bool discard_ctrl;
61};
62
63struct _Ecore_Win32_Window
64{
65 HWND window;
66
67 DWORD style; /* used to go fullscreen to normal */
68 RECT rect; /* used to go fullscreen to normal */
69
70 unsigned int min_width;
71 unsigned int min_height;
72 unsigned int max_width;
73 unsigned int max_height;
74 int base_width;
75 int base_height;
76 unsigned int step_width;
77 unsigned int step_height;
78
79 struct {
80 unsigned int iconified : 1;
81 unsigned int modal : 1;
82 unsigned int sticky : 1;
83 unsigned int maximized_vert : 1;
84 unsigned int maximized_horz : 1;
85 unsigned int shaded : 1;
86 unsigned int hidden : 1;
87 unsigned int fullscreen : 1;
88 unsigned int above : 1;
89 unsigned int below : 1;
90 unsigned int demands_attention : 1;
91 } state;
92
93 struct {
94 unsigned int desktop : 1;
95 unsigned int dock : 1;
96 unsigned int toolbar : 1;
97 unsigned int menu : 1;
98 unsigned int utility : 1;
99 unsigned int splash : 1;
100 unsigned int dialog : 1;
101 unsigned int normal : 1;
102 } type;
103
104 unsigned int pointer_is_in : 1;
105 unsigned int borderless : 1;
106 unsigned int iconified : 1;
107 unsigned int fullscreen : 1;
108
109 struct {
110 unsigned short width;
111 unsigned short height;
112 unsigned char *mask;
113 unsigned int enabled : 1;
114 unsigned int layered : 1;
115 } shape;
116
117 struct {
118 DWORD type;
119 int x;
120 int y;
121 int w;
122 int h;
123 int px;
124 int py;
125 unsigned int dragging : 1;
126 } drag;
127
128 void *dnd_drop_target;
129};
130
131
132extern HINSTANCE _ecore_win32_instance;
133extern double _ecore_win32_double_click_time;
134extern unsigned long _ecore_win32_event_last_time;
135extern Ecore_Win32_Window *_ecore_win32_event_last_window;
136
137
138void _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke);
139void _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg);
140void _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, int button);
141void _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, int button);
142void _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg);
143void _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg);
144void _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg);
145void _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg);
146void _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg);
147void _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg);
148void _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg);
149void _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg);
150void _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg);
151void _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg);
152void _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg);
153void _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg);
154void _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg);
155
156void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count);
157void _ecore_win32_dnd_data_object_free(void *data_object);
158void *_ecore_win32_dnd_drop_source_new();
159void _ecore_win32_dnd_drop_source_free(void *drop_source);
160void *_ecore_win32_dnd_register_drop_window(HWND hwnd,
161 Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr);
162void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target);
163
164
165#ifdef __cplusplus
166}
167#endif
168
169
170#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
deleted file mode 100644
index 058aef0..0000000
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c
+++ /dev/null
@@ -1,1418 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h> /* for printf */
7
8#define WIN32_LEAN_AND_MEAN
9#include <windows.h>
10#undef WIN32_LEAN_AND_MEAN
11
12#include <Eina.h>
13
14#include "Ecore_Win32.h"
15#include "ecore_win32_private.h"
16
17/*============================================================================*
18 * Local *
19 *============================================================================*/
20
21/**
22 * @cond LOCAL
23 */
24
25
26typedef enum _Ecore_Win32_Window_Z_Order Ecore_Win32_Window_Z_Order;
27enum _Ecore_Win32_Window_Z_Order
28{
29 ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM,
30 ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST,
31 ECORE_WIN32_WINDOW_Z_ORDER_TOP,
32 ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST
33};
34
35static Ecore_Win32_Window *
36ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
37 int x,
38 int y,
39 int width,
40 int height,
41 DWORD style)
42{
43 RECT rect;
44 Ecore_Win32_Window *w;
45 int minimal_width;
46 int minimal_height;
47
48 w = (Ecore_Win32_Window *)calloc(1, sizeof(Ecore_Win32_Window));
49 if (!w)
50 {
51 ERR("malloc() failed");
52 return NULL;
53 }
54
55 rect.left = 0;
56 rect.top = 0;
57 rect.right = width;
58 rect.bottom = height;
59 if (!AdjustWindowRectEx(&rect, style, FALSE, 0))
60 {
61 ERR("AdjustWindowRect() failed");
62 free(w);
63 return NULL;
64 }
65
66 minimal_width = GetSystemMetrics(SM_CXMIN);
67 minimal_height = GetSystemMetrics(SM_CYMIN);
68/* if (((rect.right - rect.left) < minimal_width) || */
69/* ((rect.bottom - rect.top) < minimal_height)) */
70/* { */
71/* fprintf (stderr, "[Ecore] [Win32] ERROR !!\n"); */
72/* fprintf (stderr, " Wrong size %ld\n", rect.right - rect.left); */
73/* free(w); */
74/* return NULL; */
75/* } */
76 if ((rect.right - rect.left) < minimal_width)
77 {
78 rect.right = rect.left + minimal_width;
79 }
80
81 w->window = CreateWindowEx(0,
82 ECORE_WIN32_WINDOW_CLASS, "",
83 style,
84 x, y,
85 rect.right - rect.left,
86 rect.bottom - rect.top,
87 parent ? parent->window : NULL,
88 NULL, _ecore_win32_instance, NULL);
89 if (!w->window)
90 {
91 ERR("CreateWindowEx() failed");
92 free(w);
93 return NULL;
94 }
95
96 SetLastError(0);
97 if (!SetWindowLongPtr(w->window, GWLP_USERDATA, (LONG_PTR)w) &&
98 (GetLastError() != 0))
99 {
100 ERR("SetWindowLongPtr() failed");
101 DestroyWindow(w->window);
102 free(w);
103 return NULL;
104 }
105
106 w->min_width = 0;
107 w->min_height = 0;
108 w->max_width = 32767;
109 w->max_height = 32767;
110 w->base_width = -1;
111 w->base_height = -1;
112 w->step_width = 1;
113 w->step_height = 1;
114
115 w->state.iconified = 0;
116 w->state.modal = 0;
117 w->state.sticky = 0;
118 w->state.maximized_vert = 0;
119 w->state.maximized_horz = 0;
120 w->state.shaded = 0;
121 w->state.hidden = 0;
122 w->state.fullscreen = 0;
123 w->state.above = 0;
124 w->state.below = 0;
125 w->state.demands_attention = 0;
126
127 w->type.desktop = 0;
128 w->type.dock = 0;
129 w->type.toolbar = 0;
130 w->type.menu = 0;
131 w->type.utility = 0;
132 w->type.splash = 0;
133 w->type.dialog = 0;
134 w->type.normal = 0;
135
136 w->pointer_is_in = 0;
137 w->borderless = 0;
138 w->iconified = 0;
139 w->fullscreen = 0;
140
141 return w;
142}
143
144/**
145 * @endcond
146 */
147
148
149/*============================================================================*
150 * Global *
151 *============================================================================*/
152
153/*============================================================================*
154 * API *
155 *============================================================================*/
156
157/**
158 * @addtogroup Ecore_Win32_Group Ecore_Win32 library
159 *
160 * @{
161 */
162
163/**
164 * @brief Creates a new window.
165 *
166 * @param parent The parent window.
167 * @param x The x coordinate of the top-left corner of the window.
168 * @param y The y coordinate of the top-left corner of the window.
169 * @param width The width of the window.
170 * @param height The height of hte window.
171 * @return A newly allocated window.
172 *
173 * This function creates a new window which parent is @p parent. @p width and
174 * @p height are the size of the window content (the client part),
175 * without the border and title bar. @p x and @p y are the system
176 * coordinates of the top left cerner of the window (that is, of the
177 * title bar). This function returns a newly created window on
178 * success, and @c NULL on failure.
179 */
180EAPI Ecore_Win32_Window *
181ecore_win32_window_new(Ecore_Win32_Window *parent,
182 int x,
183 int y,
184 int width,
185 int height)
186{
187 INF("creating window with border");
188
189 return ecore_win32_window_internal_new(parent,
190 x, y,
191 width, height,
192 WS_OVERLAPPEDWINDOW | WS_SIZEBOX);
193}
194
195/**
196 * @brief Creates a new borderless window.
197 *
198 * @param parent The parent window.
199 * @param x The x coordinate of the top-left corner of the window.
200 * @param y The y coordinate of the top-left corner of the window.
201 * @param width The width of the window.
202 * @param height The height of hte window.
203 * @return A newly allocated window.
204 *
205 * This function is the same than ecore_win32_window_override_new()
206 * but the returned window is borderless.
207 */
208EAPI Ecore_Win32_Window *
209ecore_win32_window_override_new(Ecore_Win32_Window *parent,
210 int x,
211 int y,
212 int width,
213 int height)
214{
215 INF("creating window without border");
216
217 return ecore_win32_window_internal_new(parent,
218 x, y,
219 width, height,
220 WS_POPUP);
221}
222
223/**
224 * @brief Free the given window.
225 *
226 * @param window The window to free.
227 *
228 * This function frees @p window. If @p window is @c NULL, this
229 * function does nothing.
230 */
231EAPI void
232ecore_win32_window_free(Ecore_Win32_Window *window)
233{
234 if (!window) return;
235
236 INF("destroying window");
237
238 if (window->shape.mask)
239 free(window->shape.mask);
240
241 DestroyWindow(window->window);
242 free(window);
243}
244
245/**
246 * @brief Return the window HANDLE associated to the given window.
247 *
248 * @param window The window to retrieve the HANDLE from.
249 *
250 * This function returns the window HANDLE associated to @p window. If
251 * @p window is @c NULL, this function returns @c NULL.
252 *
253 * @note The returned value is of type HWND.
254 */
255EAPI void *
256ecore_win32_window_hwnd_get(Ecore_Win32_Window *window)
257{
258 if (!window) return NULL;
259
260 return window->window;
261}
262
263/*
264void
265ecore_win32_window_configure(Ecore_Win32_Window *window,
266 Ecore_Win32_Window_Z_Order order,
267 int x,
268 int y,
269 int width,
270 int height)
271{
272 HWND w;
273
274 switch (order)
275 {
276 case ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM:
277 w = HWND_BOTTOM;
278 break;
279 case ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST:
280 w = HWND_NOTOPMOST;
281 break;
282 case ECORE_WIN32_WINDOW_Z_ORDER_TOP:
283 w = HWND_TOP;
284 break;
285 case ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST:
286 w = HWND_TOPMOST;
287 break;
288 default:
289 return;
290 }
291 SetWindowPos((Ecore_Win32_Window *)window->window, w, x, y, width, height, ???);
292}
293*/
294
295/**
296 * @brief Move the given window to a given position.
297 *
298 * @param window The window to move.
299 * @param x The x coordinate of the destination position.
300 * @param y The y coordinate of the destination position.
301 *
302 * This function move @p window to the new position of coordinates @p x
303 * and @p y. If @p window is @c NULL, or if it is fullscreen, or on
304 * error, this function does nothing.
305 */
306EAPI void
307ecore_win32_window_move(Ecore_Win32_Window *window,
308 int x,
309 int y)
310{
311 RECT rect;
312
313 /* FIXME: on fullscreen, should not move it */
314 if (!window) return;
315
316 INF("moving window (%dx%d)", x, y);
317
318 if (!GetWindowRect(window->window, &rect))
319 {
320 ERR("GetWindowRect() failed");
321 return;
322 }
323
324 if (!MoveWindow(window->window, x, y,
325 rect.right - rect.left,
326 rect.bottom - rect.top,
327 TRUE))
328 {
329 ERR("MoveWindow() failed");
330 }
331}
332
333/**
334 * @brief Resize the given window to a given size.
335 *
336 * @param window The window to resize.
337 * @param width The new width.
338 * @param height The new height.
339 *
340 * This function resize @p window to the new @p width and @p height.
341 * If @p window is @c NULL, or if it is fullscreen, or on error, this
342 * function does nothing.
343 */
344EAPI void
345ecore_win32_window_resize(Ecore_Win32_Window *window,
346 int width,
347 int height)
348{
349 RECT rect;
350 DWORD style;
351 int x;
352 int y;
353 int minimal_width;
354 int minimal_height;
355
356 /* FIXME: on fullscreen, should not resize it */
357 if (!window) return;
358
359 INF("resizing window (%dx%d)", width, height);
360
361 minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width);
362 minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height);
363
364 if (!GetWindowRect(window->window, &rect))
365 {
366 ERR("GetWindowRect() failed");
367 return;
368 }
369
370 x = rect.left;
371 y = rect.top;
372 rect.left = 0;
373 rect.top = 0;
374 if (width < minimal_width) width = minimal_width;
375 if (width > (int)window->max_width) width = window->max_width;
376 if (height < minimal_height) height = minimal_height;
377 if (height > (int)window->max_height) height = window->max_height;
378 rect.right = width;
379 rect.bottom = height;
380 if (!(style = GetWindowLong(window->window, GWL_STYLE)))
381 {
382 ERR("GetWindowLong() failed");
383 return;
384 }
385 if (!AdjustWindowRect(&rect, style, FALSE))
386 {
387 ERR("AdjustWindowRect() failed");
388 return;
389 }
390
391 if (!MoveWindow(window->window, x, y,
392 rect.right - rect.left,
393 rect.bottom - rect.top,
394 TRUE))
395 {
396 ERR("MoveWindow() failed");
397 }
398}
399
400/**
401 * @brief Move and resize the given window to a given position and size.
402 *
403 * @param window The window to move and resize.
404 * @param x The x coordinate of the destination position.
405 * @param y The x coordinate of the destination position.
406 * @param width The new width.
407 * @param height The new height.
408 *
409 * This function resize @p window to the new position of coordinates @p x
410 * and @p y and the new @p width and @p height. If @p window is @c NULL,
411 * or if it is fullscreen, or on error, this function does nothing.
412 */
413EAPI void
414ecore_win32_window_move_resize(Ecore_Win32_Window *window,
415 int x,
416 int y,
417 int width,
418 int height)
419{
420 RECT rect;
421 DWORD style;
422 int minimal_width;
423 int minimal_height;
424
425 /* FIXME: on fullscreen, should not move/resize it */
426 if (!window) return;
427
428 INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
429
430 minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width);
431 minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height);
432
433 rect.left = 0;
434 rect.top = 0;
435 if (width < minimal_width) width = minimal_width;
436 if (width > (int)window->max_width) width = window->max_width;
437 if (height < minimal_height) height = minimal_height;
438 if (height > (int)window->max_height) height = window->max_height;
439 rect.right = width;
440 rect.bottom = height;
441 if (!(style = GetWindowLong(window->window, GWL_STYLE)))
442 {
443 ERR("GetWindowLong() failed");
444 return;
445 }
446 if (!AdjustWindowRect(&rect, style, FALSE))
447 {
448 ERR("AdjustWindowRect() failed");
449 return;
450 }
451
452 if (!MoveWindow(window->window, x, y,
453 rect.right - rect.left,
454 rect.bottom - rect.top,
455 TRUE))
456 {
457 ERR("MoveWindow() failed");
458 }
459}
460
461/**
462 * @brief Get the geometry of the given window.
463 *
464 * @param window The window to retrieve the geometry from.
465 * @param x The x coordinate of the position.
466 * @param y The x coordinate of the position.
467 * @param width The width.
468 * @param height The height.
469 *
470 * This function retrieves the position and size of @p window. @p x,
471 * @p y, @p width and @p height can be buffers that will be filled with
472 * the corresponding values. If one of them is @c NULL, nothing will
473 * be done for that parameter. If @p window is @c NULL, and if the
474 * buffers are not @c NULL, they will be filled with respectively 0,
475 * 0, the size of the screen and the height of the screen.
476 */
477EAPI void
478ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
479 int *x,
480 int *y,
481 int *width,
482 int *height)
483{
484 RECT rect;
485 int w;
486 int h;
487
488 INF("getting window geometry");
489
490 if (!window)
491 {
492 if (x) *x = 0;
493 if (y) *y = 0;
494 if (width) *width = GetSystemMetrics(SM_CXSCREEN);
495 if (height) *height = GetSystemMetrics(SM_CYSCREEN);
496
497 return;
498 }
499
500 if (!GetClientRect(window->window, &rect))
501 {
502 ERR("GetClientRect() failed");
503
504 if (x) *x = 0;
505 if (y) *y = 0;
506 if (width) *width = 0;
507 if (height) *height = 0;
508
509 return;
510 }
511
512 w = rect.right - rect.left;
513 h = rect.bottom - rect.top;
514
515 if (!GetWindowRect(window->window, &rect))
516 {
517 ERR("GetWindowRect() failed");
518
519 if (x) *x = 0;
520 if (y) *y = 0;
521 if (width) *width = 0;
522 if (height) *height = 0;
523
524 return;
525 }
526
527 if (x) *x = rect.left;
528 if (y) *y = rect.top;
529 if (width) *width = w;
530 if (height) *height = h;
531}
532
533/**
534 * @brief Get the size of the given window.
535 *
536 * @param window The window to retrieve the size from.
537 * @param width The width.
538 * @param height The height.
539 *
540 * This function retrieves the size of @p window. @p width and
541 * @p height can be buffers that will be filled with the corresponding
542 * values. If one of them is @c NULL, nothing will be done for that
543 * parameter. If @p window is @c NULL, and if the buffers are not
544 * @c NULL, they will be filled with respectively the size of the screen
545 * and the height of the screen.
546 */
547EAPI void
548ecore_win32_window_size_get(Ecore_Win32_Window *window,
549 int *width,
550 int *height)
551{
552 RECT rect;
553
554 INF("getting window size");
555
556 if (!window)
557 {
558 if (width) *width = GetSystemMetrics(SM_CXSCREEN);
559 if (height) *height = GetSystemMetrics(SM_CYSCREEN);
560
561 return;
562 }
563
564 if (!GetClientRect(window->window, &rect))
565 {
566 ERR("GetClientRect() failed");
567
568 if (width) *width = 0;
569 if (height) *height = 0;
570 }
571
572 if (width) *width = rect.right - rect.left;
573 if (height) *height = rect.bottom - rect.top;
574}
575
576/**
577 * @brief Set the minimum size of the given window.
578 *
579 * @param window The window.
580 * @param min_width The minimal width.
581 * @param min_height The minimal height.
582 *
583 * This function sets the minimum size of @p window to @p min_width
584 * and *p min_height. If @p window is @c NULL, this functions does
585 * nothing.
586 */
587EAPI void
588ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
589 unsigned int min_width,
590 unsigned int min_height)
591{
592 if (!window) return;
593
594 printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height);
595 window->min_width = min_width;
596 window->min_height = min_height;
597}
598
599/**
600 * @brief Get the minimum size of the given window.
601 *
602 * @param window The window.
603 * @param min_width The minimal width.
604 * @param min_height The minimal height.
605 *
606 * This function fills the minimum size of @p window in the buffers
607 * @p min_width and *p min_height. They both can be @c NULL. If
608 * @p window is @c NULL, this functions does nothing.
609 */
610EAPI void
611ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
612 unsigned int *min_width,
613 unsigned int *min_height)
614{
615 if (!window) return;
616
617 printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, window->min_width, window->min_height);
618 if (min_width) *min_width = window->min_width;
619 if (min_height) *min_height = window->min_height;
620}
621
622/**
623 * @brief Set the maximum size of the given window.
624 *
625 * @param window The window.
626 * @param max_width The maximal width.
627 * @param max_height The maximal height.
628 *
629 * This function sets the maximum size of @p window to @p max_width
630 * and *p max_height. If @p window is @c NULL, this functions does
631 * nothing.
632 */
633EAPI void
634ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
635 unsigned int max_width,
636 unsigned int max_height)
637{
638 if (!window) return;
639
640 printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height);
641 window->max_width = max_width;
642 window->max_height = max_height;
643}
644
645/**
646 * @brief Get the maximum size of the given window.
647 *
648 * @param window The window.
649 * @param max_width The maximal width.
650 * @param max_height The maximal height.
651 *
652 * This function fills the maximum size of @p window in the buffers
653 * @p max_width and *p max_height. They both can be @c NULL. If
654 * @p window is @c NULL, this functions does nothing.
655 */
656EAPI void
657ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
658 unsigned int *max_width,
659 unsigned int *max_height)
660{
661 if (!window) return;
662
663 printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, window->max_width, window->max_height);
664 if (max_width) *max_width = window->max_width;
665 if (max_height) *max_height = window->max_height;
666}
667
668/**
669 * @brief Set the base size of the given window.
670 *
671 * @param window The window.
672 * @param base_width The base width.
673 * @param base_height The base height.
674 *
675 * This function sets the base size of @p window to @p base_width
676 * and *p base_height. If @p window is @c NULL, this functions does
677 * nothing.
678 */
679EAPI void
680ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
681 unsigned int base_width,
682 unsigned int base_height)
683{
684 printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height);
685 if (!window) return;
686
687 window->base_width = base_width;
688 window->base_height = base_height;
689}
690
691/**
692 * @brief Get the base size of the given window.
693 *
694 * @param window The window.
695 * @param base_width The base width.
696 * @param base_height The bas height.
697 *
698 * This function fills the base size of @p window in the buffers
699 * @p base_width and *p base_height. They both can be @c NULL. If
700 * @p window is @c NULL, this functions does nothing.
701 */
702EAPI void
703ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
704 unsigned int *base_width,
705 unsigned int *base_height)
706{
707 if (!window) return;
708
709 printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, window->base_width, window->base_height);
710 if (base_width) *base_width = window->base_width;
711 if (base_height) *base_height = window->base_height;
712}
713
714/**
715 * @brief Set the step size of the given window.
716 *
717 * @param window The window.
718 * @param step_width The step width.
719 * @param step_height The step height.
720 *
721 * This function sets the step size of @p window to @p step_width
722 * and *p step_height. If @p window is @c NULL, this functions does
723 * nothing.
724 */
725EAPI void
726ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
727 unsigned int step_width,
728 unsigned int step_height)
729{
730 printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height);
731 if (!window) return;
732
733 window->step_width = step_width;
734 window->step_height = step_height;
735}
736
737/**
738 * @brief Get the step size of the given window.
739 *
740 * @param window The window.
741 * @param step_width The step width.
742 * @param step_height The bas height.
743 *
744 * This function fills the step size of @p window in the buffers
745 * @p step_width and *p step_height. They both can be @c NULL. If
746 * @p window is @c NULL, this functions does nothing.
747 */
748EAPI void
749ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
750 unsigned int *step_width,
751 unsigned int *step_height)
752{
753 if (!window) return;
754
755 printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, window->step_width, window->step_height);
756 if (step_width) *step_width = window->step_width;
757 if (step_height) *step_height = window->step_height;
758}
759
760/**
761 * @brief Show the given window.
762 *
763 * @param window The window to show.
764 *
765 * This function shows @p window. If @p window is @c NULL, or on
766 * error, this function does nothing.
767 */
768EAPI void
769ecore_win32_window_show(Ecore_Win32_Window *window)
770{
771 if (!window) return;
772
773 INF("showing window");
774
775 ShowWindow(window->window, SW_SHOWNORMAL);
776 if (!UpdateWindow(window->window))
777 {
778 ERR("UpdateWindow() failed");
779 }
780}
781
782/* FIXME: seems to block the taskbar */
783/**
784 * @brief Hide the given window.
785 *
786 * @param window The window to show.
787 *
788 * This function hides @p window. If @p window is @c NULL, or on
789 * error, this function does nothing.
790 */
791EAPI void
792ecore_win32_window_hide(Ecore_Win32_Window *window)
793{
794 if (!window) return;
795
796 INF("hiding window");
797
798 ShowWindow(window->window, SW_HIDE);
799}
800
801/**
802 * @brief Place the given window at the top of the Z order.
803 *
804 * @param window The window to place at the top.
805 *
806 * This function places @p window at the top of the Z order. If
807 * @p window is @c NULL, this function does nothing.
808 */
809EAPI void
810ecore_win32_window_raise(Ecore_Win32_Window *window)
811{
812 if (!window) return;
813
814 INF("raising window");
815
816 if (!SetWindowPos(window->window,
817 HWND_TOP, 0, 0, 0, 0,
818 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
819 {
820 ERR("SetWindowPos() failed");
821 }
822}
823
824/**
825 * @brief Place the given window at the bottom of the Z order.
826 *
827 * @param window The window to place at the bottom.
828 *
829 * This function places @p window at the bottom of the Z order. If
830 * @p window is @c NULL, this function does nothing.
831 */
832EAPI void
833ecore_win32_window_lower(Ecore_Win32_Window *window)
834{
835 if (!window) return;
836
837 INF("lowering window");
838
839 if (!SetWindowPos(window->window,
840 HWND_BOTTOM, 0, 0, 0, 0,
841 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
842 {
843 ERR("SetWindowPos() failed");
844 }
845}
846
847/**
848 * @brief Set the title of the given window.
849 *
850 * @param window The window to set the title.
851 * @param title The new title.
852 *
853 * This function sets the title of @p window to @p title. If @p window
854 * is @c NULL, or if @p title is @c NULL or empty, or on error, this
855 * function does nothing.
856 */
857EAPI void
858ecore_win32_window_title_set(Ecore_Win32_Window *window,
859 const char *title)
860{
861 if (!window) return;
862
863 if (!title || !title[0]) return;
864
865 INF("setting window title");
866
867 if (!SetWindowText(window->window, title))
868 {
869 ERR("SetWindowText() failed");
870 }
871}
872
873/**
874 * @brief Set the focus to the given window.
875 *
876 * @param window The window to give focus to.
877 *
878 * This function gives the focus to @p window. If @p window is
879 * @c NULL, this function does nothing.
880 */
881EAPI void
882ecore_win32_window_focus(Ecore_Win32_Window *window)
883{
884 if (!window) return;
885
886 INF("focusing window");
887
888 if (!SetFocus(window->window))
889 {
890 ERR("SetFocus() failed");
891 }
892}
893
894/**
895 * @brief Get the current focused window.
896 *
897 * @return The window that has focus.
898 *
899 * This function returns the window that has focus. If the calling
900 * thread's message queue does not have an associated window with the
901 * keyboard focus, the return value is @c NULL.
902 *
903 * @note Even if the returned value is @c NULL, another thread's queue
904 * may be associated with a window that has the keyboard focus.
905 *
906 * @note The returned value is of type HWND.
907 */
908EAPI void *
909ecore_win32_window_focus_get(void)
910{
911 HWND focused;
912
913 INF("getting focused window");
914
915 focused = GetFocus();
916 if (!focused)
917 {
918 ERR("GetFocus() failed");
919 return NULL;
920 }
921
922 return focused;
923}
924
925/**
926 * @brief Iconify or restore the given window.
927 *
928 * @param window The window.
929 * @param on EINA_TRUE to iconify the window, EINA_FALSE to restore it.
930 *
931 * This function iconify or restore @p window. If @p on
932 * is set to EINA_TRUE, the window will be iconified, if it is set to
933 * EINA_FALSE, it will be restored. If @p window is @c NULL or if the
934 * state does not change (like iconifying the window while it is
935 * already iconified), this function does nothing.
936 */
937EAPI void
938ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
939 Eina_Bool on)
940{
941 if (!window) return;
942
943 if (((window->iconified) && (on)) ||
944 ((!window->iconified) && (!on)))
945 return;
946
947 INF("iconifying window: %s", on ? "yes" : "no");
948
949 ShowWindow(window->window, on ? SW_MINIMIZE : SW_RESTORE);
950 window->iconified = on;
951}
952
953/**
954 * @brief Remove or restore the border of the given window.
955 *
956 * @param window The window.
957 * @param on EINA_TRUE to remove the border, EINA_FALSE to restore it.
958 *
959 * This function remove or restore the border of @p window. If @p on
960 * is set to EINA_TRUE, the window will have no border, if it is set to
961 * EINA_FALSE, it will have a border. If @p window is @c NULL or if the
962 * state does not change (like setting to borderless while the window
963 * has no border), this function does nothing.
964 */
965EAPI void
966ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
967 Eina_Bool on)
968{
969 RECT rect;
970 DWORD style;
971
972 if (!window) return;
973
974 if (((window->borderless) && (on)) ||
975 ((!window->borderless) && (!on)))
976 return;
977
978 INF("setting window without border: %s", on ? "yes" : "no");
979
980 style = GetWindowLong(window->window, GWL_STYLE);
981 if (on)
982 {
983 if (!GetClientRect(window->window, &rect))
984 {
985 ERR("GetClientRect() failed");
986 return;
987 }
988 SetLastError(0);
989 if (!SetWindowLongPtr(window->window, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) &&
990 (GetLastError() != 0))
991 {
992 ERR("SetWindowLongPtr() failed");
993 return;
994 }
995 }
996 else
997 {
998 if (!GetWindowRect(window->window, &rect))
999 {
1000 ERR("GetWindowRect() failed");
1001 return;
1002 }
1003 style |= WS_CAPTION | WS_THICKFRAME;
1004 if (!AdjustWindowRect (&rect, style, FALSE))
1005 {
1006 ERR("AdjustWindowRect() failed");
1007 return;
1008 }
1009 SetLastError(0);
1010 if (!SetWindowLongPtr(window->window, GWL_STYLE, style) &&
1011 (GetLastError() != 0))
1012 {
1013 ERR("SetWindowLongPtr() failed");
1014 return;
1015 }
1016 }
1017 if (!SetWindowPos(window->window, HWND_TOPMOST,
1018 rect.left, rect.top,
1019 rect.right - rect.left, rect.bottom - rect.top,
1020 SWP_NOMOVE | SWP_FRAMECHANGED))
1021 {
1022 ERR("SetWindowPos() failed");
1023 return;
1024 }
1025
1026 window->borderless = on;
1027}
1028
1029/**
1030 * @brief Set the given window to fullscreen.
1031 *
1032 * @param window The window.
1033 * @param on EINA_TRUE for fullscreen mode, EINA_FALSE for windowed mode.
1034 *
1035 * This function set @p window to fullscreen or windowed mode. If @p on
1036 * is set to EINA_TRUE, the window will be fullscreen, if it is set to
1037 * EINA_FALSE, it will be windowed. If @p window is @c NULL or if the
1038 * state does not change (like setting to fullscreen while the window
1039 * is already fullscreen), this function does nothing.
1040 */
1041EAPI void
1042ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
1043 Eina_Bool on)
1044{
1045 if (!window) return;
1046
1047 if (((window->fullscreen) && (on)) ||
1048 ((!window->fullscreen) && (!on)))
1049 return;
1050
1051 INF("setting fullscreen: %s", on ? "yes" : "no");
1052
1053 window->fullscreen = !!on;
1054
1055 if (on)
1056 {
1057 DWORD style;
1058
1059 if (!GetWindowRect(window->window, &window->rect))
1060 {
1061 ERR("GetWindowRect() failed");
1062 return;
1063 }
1064 if (!(window->style = GetWindowLong(window->window, GWL_STYLE)))
1065 {
1066 ERR("GetWindowLong() failed");
1067 return;
1068 }
1069 style = window->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX;
1070 style |= WS_VISIBLE | WS_POPUP;
1071 SetLastError(0);
1072 if (!SetWindowLongPtr(window->window, GWL_STYLE, style) &&
1073 (GetLastError() != 0))
1074 {
1075 ERR("SetWindowLongPtr() failed");
1076 return;
1077 }
1078 SetLastError(0);
1079 if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, WS_EX_TOPMOST) &&
1080 (GetLastError() != 0))
1081 {
1082 ERR("SetWindowLongPtr() failed");
1083 return;
1084 }
1085 if (!SetWindowPos(window->window, HWND_TOPMOST, 0, 0,
1086 GetSystemMetrics (SM_CXSCREEN),
1087 GetSystemMetrics (SM_CYSCREEN),
1088 SWP_NOCOPYBITS | SWP_SHOWWINDOW))
1089 {
1090 ERR("SetWindowPos() failed");
1091 return;
1092 }
1093 }
1094 else
1095 {
1096 SetLastError(0);
1097 if (!SetWindowLongPtr(window->window, GWL_STYLE, window->style) &&
1098 (GetLastError() != 0))
1099 {
1100 ERR("SetWindowLongPtr() failed");
1101 return;
1102 }
1103 SetLastError(0);
1104 if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, 0) &&
1105 (GetLastError() != 0))
1106 {
1107 ERR("SetWindowLongPtr() failed");
1108 return;
1109 }
1110 if (!SetWindowPos(window->window, HWND_NOTOPMOST,
1111 window->rect.left,
1112 window->rect.top,
1113 window->rect.right - window->rect.left,
1114 window->rect.bottom - window->rect.top,
1115 SWP_NOCOPYBITS | SWP_SHOWWINDOW))
1116 {
1117 ERR("SetWindowPos() failed");
1118 return;
1119 }
1120 }
1121}
1122
1123/**
1124 * @brief Set the given cursor to the given window.
1125 *
1126 * @param window The window to modify the cursor.
1127 * @param cursor The new cursor.
1128 *
1129 * This function sets @p cursor to @p window. @p cursor must have been
1130 * obtained by ecore_win32_cursor_new() or
1131 * ecore_win32_cursor_shaped_new(). If @p window or @p cursor is
1132 * @c NULL, the function does nothing.
1133 */
1134EAPI void
1135ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
1136 Ecore_Win32_Cursor *cursor)
1137{
1138 INF("setting cursor");
1139
1140 if (!window || !cursor)
1141 return;
1142
1143 if (!SetClassLongPtr(window->window,
1144 GCLP_HCURSOR, (LONG_PTR)cursor))
1145 {
1146 ERR("SetClassLong() failed");
1147 }
1148}
1149
1150/**
1151 * @brief Set the state of the given window.
1152 *
1153 * @param window The window to modify the state.
1154 * @param state An array of the new states.
1155 * @param num The number of states in the array.
1156 *
1157 * This function set the state of @p window. @p state is an array of
1158 * states of size @p num. If @p window or @p state are @c NULL, or if
1159 * @p num is less or equal than 0, the function does nothing.
1160 */
1161EAPI void
1162ecore_win32_window_state_set(Ecore_Win32_Window *window,
1163 Ecore_Win32_Window_State *state,
1164 unsigned int num)
1165{
1166 unsigned int i;
1167
1168 if (!window || !state || (num <= 0))
1169 return;
1170
1171 INF("setting cursor state");
1172
1173 for (i = 0; i < num; i++)
1174 {
1175 switch (state[i])
1176 {
1177 case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
1178 window->state.iconified = 1;
1179 break;
1180 case ECORE_WIN32_WINDOW_STATE_MODAL:
1181 window->state.modal = 1;
1182 break;
1183 case ECORE_WIN32_WINDOW_STATE_STICKY:
1184 window->state.sticky = 1;
1185 break;
1186 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
1187 window->state.maximized_vert = 1;
1188 break;
1189 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
1190 window->state.maximized_horz = 1;
1191 break;
1192 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
1193 window->state.maximized_horz = 1;
1194 window->state.maximized_vert = 1;
1195 break;
1196 case ECORE_WIN32_WINDOW_STATE_SHADED:
1197 window->state.shaded = 1;
1198 break;
1199 case ECORE_WIN32_WINDOW_STATE_HIDDEN:
1200 window->state.hidden = 1;
1201 break;
1202 case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
1203 window->state.fullscreen = 1;
1204 break;
1205 case ECORE_WIN32_WINDOW_STATE_ABOVE:
1206 window->state.above = 1;
1207 break;
1208 case ECORE_WIN32_WINDOW_STATE_BELOW:
1209 window->state.below = 1;
1210 break;
1211 case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
1212 window->state.demands_attention = 1;
1213 break;
1214 case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
1215 /* nothing to be done */
1216 break;
1217 }
1218 }
1219}
1220
1221/**
1222 * @brief Apply the modification of the state to the given window.
1223 *
1224 * @param window The window.
1225 * @param state The state to apply changes.
1226 * @param set The value of the state change.
1227 *
1228 * This function applies the modification of the state @p state of
1229 * @p window. @p set is used only for
1230 * #ECORE_WIN32_WINDOW_STATE_ICONIFIED and
1231 * #ECORE_WIN32_WINDOW_STATE_FULLSCREEN. If @p window is @c NULL, the
1232 * function does nothing.
1233 */
1234EAPI void
1235ecore_win32_window_state_request_send(Ecore_Win32_Window *window,
1236 Ecore_Win32_Window_State state,
1237 unsigned int set)
1238{
1239 if (!window) return;
1240
1241 INF("sending cursor state");
1242
1243 switch (state)
1244 {
1245 case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
1246 if (window->state.iconified)
1247 ecore_win32_window_iconified_set(window, set);
1248 break;
1249 case ECORE_WIN32_WINDOW_STATE_MODAL:
1250 window->state.modal = 1;
1251 break;
1252 case ECORE_WIN32_WINDOW_STATE_STICKY:
1253 window->state.sticky = 1;
1254 break;
1255 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
1256 if (window->state.maximized_vert)
1257 {
1258 RECT rect;
1259 int y;
1260 int height;
1261
1262 if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
1263 &rect, 0))
1264 {
1265 ERR("SystemParametersInfo() failed");
1266 break;
1267 }
1268 y = rect.top;
1269 height = rect.bottom - rect.top;
1270
1271 if (!GetClientRect(window->window, &rect))
1272 {
1273 ERR("GetClientRect() failed");
1274 break;
1275 }
1276
1277 if (!MoveWindow(window->window, rect.left, y,
1278 rect.right - rect.left,
1279 height,
1280 TRUE))
1281 {
1282 ERR("MoveWindow() failed");
1283 }
1284 }
1285 break;
1286 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
1287 if (window->state.maximized_horz)
1288 {
1289 RECT rect;
1290
1291 if (!GetClientRect(window->window, &rect))
1292 {
1293 ERR("GetClientRect() failed");
1294 break;
1295 }
1296
1297 if (!MoveWindow(window->window, 0, rect.top,
1298 GetSystemMetrics(SM_CXSCREEN),
1299 rect.bottom - rect.top,
1300 TRUE))
1301 {
1302 ERR("MoveWindow() failed");
1303 }
1304 }
1305 break;
1306 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
1307 if (window->state.maximized_vert && window->state.maximized_horz)
1308 {
1309 RECT rect;
1310
1311 if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
1312 &rect, 0))
1313 {
1314 ERR("SystemParametersInfo() failed");
1315 break;
1316 }
1317
1318 if (!MoveWindow(window->window, 0, 0,
1319 GetSystemMetrics(SM_CXSCREEN),
1320 rect.bottom - rect.top,
1321 TRUE))
1322 {
1323 ERR("MoveWindow() failed");
1324 }
1325 }
1326 break;
1327 case ECORE_WIN32_WINDOW_STATE_SHADED:
1328 window->state.shaded = 1;
1329 break;
1330 case ECORE_WIN32_WINDOW_STATE_HIDDEN:
1331 window->state.hidden = 1;
1332 break;
1333 case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
1334 if (window->state.fullscreen)
1335 ecore_win32_window_fullscreen_set(window, set);
1336 break;
1337 case ECORE_WIN32_WINDOW_STATE_ABOVE:
1338 if (window->state.above)
1339 if (!SetWindowPos(window->window, HWND_TOP,
1340 0, 0,
1341 0, 0,
1342 SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW))
1343 {
1344 ERR("SetWindowPos() failed");
1345 }
1346 break;
1347 case ECORE_WIN32_WINDOW_STATE_BELOW:
1348 if (window->state.below)
1349 if (!SetWindowPos(window->window, HWND_BOTTOM,
1350 0, 0,
1351 0, 0,
1352 SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW))
1353 {
1354 ERR("SetWindowPos() failed");
1355 }
1356 break;
1357 case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
1358 window->state.demands_attention = 1;
1359 break;
1360 case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
1361 /* nothing to be done */
1362 break;
1363 }
1364}
1365
1366/**
1367 * @brief Set the type of the given window.
1368 *
1369 * @param window The window to modify the type.
1370 * @param type The nwindow types.
1371 *
1372 * This function set the type of @p window to @p type. If
1373 * @p window is @c NULL, the function does nothing.
1374 */
1375EAPI void
1376ecore_win32_window_type_set(Ecore_Win32_Window *window,
1377 Ecore_Win32_Window_Type type)
1378{
1379 if (!window)
1380 return;
1381
1382 INF("setting window type");
1383
1384 switch (type)
1385 {
1386 case ECORE_WIN32_WINDOW_TYPE_DESKTOP:
1387 window->type.desktop = 1;
1388 break;
1389 case ECORE_WIN32_WINDOW_TYPE_DOCK:
1390 window->type.dock = 1;
1391 break;
1392 case ECORE_WIN32_WINDOW_TYPE_TOOLBAR:
1393 window->type.toolbar = 1;
1394 break;
1395 case ECORE_WIN32_WINDOW_TYPE_MENU:
1396 window->type.menu = 1;
1397 break;
1398 case ECORE_WIN32_WINDOW_TYPE_UTILITY:
1399 window->type.utility = 1;
1400 break;
1401 case ECORE_WIN32_WINDOW_TYPE_SPLASH:
1402 window->type.splash = 1;
1403 break;
1404 case ECORE_WIN32_WINDOW_TYPE_DIALOG:
1405 window->type.dialog = 1;
1406 break;
1407 case ECORE_WIN32_WINDOW_TYPE_NORMAL:
1408 window->type.normal = 1;
1409 break;
1410 case ECORE_WIN32_WINDOW_TYPE_UNKNOWN:
1411 window->type.normal = 1;
1412 break;
1413 }
1414}
1415
1416/**
1417 * @}
1418 */
diff --git a/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h b/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h
deleted file mode 100644
index 63e20d5..0000000
--- a/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h
+++ /dev/null
@@ -1,314 +0,0 @@
1#ifndef __ECORE_WINCE_H__
2#define __ECORE_WINCE_H__
3
4/*
5 * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
6 * THE API MAY CHANGE.
7 */
8
9#ifndef ECORE_WINCE_WIP_OSXCKQSD
10# warning "You are using a work in progress API. This API is not stable"
11# warning "and is subject to change. You use this at your own risk."
12#endif
13
14#include <Eina.h>
15
16#ifdef EAPI
17# undef EAPI
18#endif
19
20#ifdef _WIN32
21# ifdef EFL_ECORE_WINCE_BUILD
22# ifdef DLL_EXPORT
23# define EAPI __declspec(dllexport)
24# else
25# define EAPI
26# endif /* ! DLL_EXPORT */
27# else
28# define EAPI __declspec(dllimport)
29# endif /* ! EFL_ECORE_WINCE_BUILD */
30#else
31# ifdef __GNUC__
32# if __GNUC__ >= 4
33# define EAPI __attribute__ ((visibility("default")))
34# else
35# define EAPI
36# endif
37# else
38# define EAPI
39# endif
40#endif /* ! _WINCE */
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/**
47 * @defgroup Ecore_WinCE_Group Ecore_WinCE library
48 *
49 * @{
50 */
51
52
53/**
54 * @typedef Ecore_WinCE_Window
55 * Abstract type for a window.
56 */
57typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
58
59
60/**
61 * @typedef Ecore_WinCE_Event_Mouse_In
62 * Event sent when the mouse enters the window.
63 */
64typedef struct _Ecore_WinCE_Event_Mouse_In Ecore_WinCE_Event_Mouse_In;
65
66/**
67 * @typedef Ecore_WinCE_Event_Mouse_Out
68 * Event sent when the mouse leaves the window.
69 */
70typedef struct _Ecore_WinCE_Event_Mouse_Out Ecore_WinCE_Event_Mouse_Out;
71
72/**
73 * @typedef Ecore_WinCE_Event_Window_Focus_In
74 * Event sent when the window gets the focus.
75 */
76typedef struct _Ecore_WinCE_Event_Window_Focus_In Ecore_WinCE_Event_Window_Focus_In;
77
78/**
79 * @typedef Ecore_WinCE_Event_Window_Focus_Out
80 * Event sent when the window looses the focus.
81 */
82typedef struct _Ecore_WinCE_Event_Window_Focus_Out Ecore_WinCE_Event_Window_Focus_Out;
83
84/**
85 * @typedef Ecore_WinCE_Event_Window_Damage
86 * Event sent when the window is damaged.
87 */
88typedef struct _Ecore_WinCE_Event_Window_Damage Ecore_WinCE_Event_Window_Damage;
89
90/**
91 * @typedef Ecore_WinCE_Event_Window_Create
92 * Event sent when the window is created.
93 */
94typedef struct _Ecore_WinCE_Event_Window_Create Ecore_WinCE_Event_Window_Create;
95
96/**
97 * @typedef Ecore_WinCE_Event_Window_Destroy
98 * Event sent when the window is destroyed.
99 */
100typedef struct _Ecore_WinCE_Event_Window_Destroy Ecore_WinCE_Event_Window_Destroy;
101
102/**
103 * @typedef Ecore_WinCE_Event_Window_Hide
104 * Event sent when the window is hidden.
105 */
106typedef struct _Ecore_WinCE_Event_Window_Hide Ecore_WinCE_Event_Window_Hide;
107
108/**
109 * @typedef Ecore_WinCE_Event_Window_Show
110 * Event sent when the window is shown.
111 */
112typedef struct _Ecore_WinCE_Event_Window_Show Ecore_WinCE_Event_Window_Show;
113
114/**
115 * @typedef Ecore_WinCE_Event_Window_Delete_Request
116 * Event sent when the window is deleted.
117 */
118typedef struct _Ecore_WinCE_Event_Window_Delete_Request Ecore_WinCE_Event_Window_Delete_Request;
119
120
121/**
122 * @struct _Ecore_WinCE_Event_Mouse_In
123 * Event sent when the mouse enters the window.
124 */
125struct _Ecore_WinCE_Event_Mouse_In
126{
127 Ecore_WinCE_Window *window; /**< The window that received the event */
128 int x; /**< The x coordinate where the mouse entered */
129 int y; /**< The y coordinate where the mouse entered */
130 long time; /**< The time the event occurred */
131};
132
133/**
134 * @struct _Ecore_WinCE_Event_Mouse_Out
135 * Event sent when the mouse leaves the window.
136 */
137struct _Ecore_WinCE_Event_Mouse_Out
138{
139 Ecore_WinCE_Window *window; /**< The window that received the event */
140 int x; /**< The x coordinate where the mouse leaved */
141 int y; /**< The y coordinate where the mouse leaved */
142 long time; /**< The time the event occurred */
143};
144
145/**
146 * @struct _Ecore_WinCE_Event_Window_Focus_In
147 * Event sent when the window gets the focus.
148 */
149struct _Ecore_WinCE_Event_Window_Focus_In
150{
151 Ecore_WinCE_Window *window; /**< The window that received the event */
152 long time; /**< The time the event occurred */
153};
154
155/**
156 * @struct _Ecore_WinCE_Event_Window_Focus_Out
157 * Event sent when the window looses the focus.
158 */
159struct _Ecore_WinCE_Event_Window_Focus_Out
160{
161 Ecore_WinCE_Window *window; /**< The window that received the event */
162 long time; /**< The time the event occurred */
163};
164
165/**
166 * @struct _Ecore_WinCE_Event_Window_Damage
167 * Event sent when the window is damaged.
168 */
169struct _Ecore_WinCE_Event_Window_Damage
170{
171 Ecore_WinCE_Window *window; /**< The window that received the event */
172 int x; /**< The x coordinate of the top left corner of the damaged region */
173 int y; /**< The y coordinate of the top left corner of the damaged region */
174 int width; /**< The width of the damaged region */
175 int height; /**< The height of the damaged region */
176 long time; /**< The time the event occurred */
177};
178
179/**
180 * @struct _Ecore_WinCE_Event_Window_Create
181 * Event sent when the window is created.
182 */
183struct _Ecore_WinCE_Event_Window_Create
184{
185 Ecore_WinCE_Window *window; /**< The window that received the event */
186 long time; /**< The time the event occurred */
187};
188
189/**
190 * @struct _Ecore_WinCE_Event_Window_Destroy
191 * Event sent when the window is destroyed.
192 */
193struct _Ecore_WinCE_Event_Window_Destroy
194{
195 Ecore_WinCE_Window *window; /**< The window that received the event */
196 long time; /**< The time the event occurred */
197};
198
199/**
200 * @struct _Ecore_WinCE_Event_Window_Hide
201 * Event sent when the window is hidden.
202 */
203struct _Ecore_WinCE_Event_Window_Hide
204{
205 Ecore_WinCE_Window *window; /**< The window that received the event */
206 long time; /**< The time the event occurred */
207};
208
209/**
210 * @struct _Ecore_WinCE_Event_Window_Show
211 * Event sent when the window is shown.
212 */
213struct _Ecore_WinCE_Event_Window_Show
214{
215 Ecore_WinCE_Window *window; /**< The window that received the event */
216 long time; /**< The time the event occurred */
217};
218
219/**
220 * @struct _Ecore_WinCE_Event_Window_Delete_Request
221 * Event sent when the window is deleted.
222 */
223struct _Ecore_WinCE_Event_Window_Delete_Request
224{
225 Ecore_WinCE_Window *window; /**< The window that received the event */
226 long time; /**< The time the event occurred */
227};
228
229
230EAPI extern int ECORE_WINCE_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_WinCE_Event_Mouse_In event */
231EAPI extern int ECORE_WINCE_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_WinCE_Event_Mouse_Out event */
232EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Focus_In event */
233EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Focus_Out event */
234EAPI extern int ECORE_WINCE_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the #Ecore_WinCE_Event_Damage event */
235EAPI extern int ECORE_WINCE_EVENT_WINDOW_CREATE; /**< Ecore_Event for the #Ecore_WinCE_Event_Create event */
236EAPI extern int ECORE_WINCE_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the #Ecore_WinCE_Event_Destroy event */
237EAPI extern int ECORE_WINCE_EVENT_WINDOW_HIDE; /**< Ecore_Event for the #Ecore_WinCE_Event_Hide event */
238EAPI extern int ECORE_WINCE_EVENT_WINDOW_SHOW; /**< Ecore_Event for the #Ecore_WinCE_Event_Show event */
239EAPI extern int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Delete_Request event */
240
241
242/* Core */
243
244EAPI int ecore_wince_init();
245EAPI int ecore_wince_shutdown();
246EAPI void ecore_wince_double_click_time_set(double t);
247EAPI double ecore_wince_double_click_time_get(void);
248EAPI long ecore_wince_current_time_get(void);
249
250/* Window */
251
252EAPI Ecore_WinCE_Window *ecore_wince_window_new(Ecore_WinCE_Window *parent,
253 int x,
254 int y,
255 int width,
256 int height);
257
258EAPI void ecore_wince_window_free(Ecore_WinCE_Window *window);
259
260EAPI void *ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window);
261
262EAPI void ecore_wince_window_move(Ecore_WinCE_Window *window,
263 int x,
264 int y);
265
266EAPI void ecore_wince_window_resize(Ecore_WinCE_Window *window,
267 int width,
268 int height);
269
270EAPI void ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
271 int x,
272 int y,
273 int width,
274 int height);
275
276EAPI void ecore_wince_window_show(Ecore_WinCE_Window *window);
277
278EAPI void ecore_wince_window_hide(Ecore_WinCE_Window *window);
279
280EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window,
281 const char *title);
282
283EAPI void ecore_wince_window_focus(Ecore_WinCE_Window *window);
284
285EAPI void *ecore_wince_window_focus_get(void);
286
287EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend);
288
289EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int));
290
291EAPI void ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int));
292
293EAPI void ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
294 int *x,
295 int *y,
296 int *width,
297 int *height);
298
299EAPI void ecore_wince_window_size_get(Ecore_WinCE_Window *window,
300 int *width,
301 int *height);
302
303EAPI void ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
304 Eina_Bool on);
305
306/**
307 * @}
308 */
309
310#ifdef __cplusplus
311}
312#endif
313
314#endif /* __ECORE_WINCE_H__ */
diff --git a/libraries/ecore/src/lib/ecore_wince/Makefile.am b/libraries/ecore/src/lib/ecore_wince/Makefile.am
deleted file mode 100644
index a264ffb..0000000
--- a/libraries/ecore/src/lib/ecore_wince/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_input \
6-I$(top_builddir)/src/lib/ecore \
7-I$(top_builddir)/src/lib/ecore_input \
8@EFL_ECORE_WINCE_BUILD@ \
9@EVAS_CFLAGS@ \
10@EINA_CFLAGS@ \
11@WIN32_CPPFLAGS@
12
13AM_CFLAGS = @WIN32_CFLAGS@
14
15lib_LTLIBRARIES = libecore_wince.la
16
17includes_HEADERS = Ecore_WinCE.h
18includesdir = $(includedir)/ecore-@VMAJ@
19
20libecore_wince_la_SOURCES = \
21ecore_wince.c \
22ecore_wince_event.c \
23ecore_wince_window.c
24
25libecore_wince_la_LIBADD = \
26@WIN32_LIBS@ \
27$(top_builddir)/src/lib/ecore_input/libecore_input.la \
28$(top_builddir)/src/lib/ecore/libecore.la \
29@EVAS_LIBS@ \
30@EINA_LIBS@ \
31@EVIL_LIBS@
32
33libecore_wince_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
34
35EXTRA_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
deleted file mode 100644
index 340416b..0000000
--- a/libraries/ecore/src/lib/ecore_wince/Makefile.in
+++ /dev/null
@@ -1,843 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_wince
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88libecore_wince_la_DEPENDENCIES = \
89 $(top_builddir)/src/lib/ecore_input/libecore_input.la \
90 $(top_builddir)/src/lib/ecore/libecore.la
91am_libecore_wince_la_OBJECTS = ecore_wince.lo ecore_wince_event.lo \
92 ecore_wince_window.lo
93libecore_wince_la_OBJECTS = $(am_libecore_wince_la_OBJECTS)
94AM_V_lt = $(am__v_lt_$(V))
95am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
96am__v_lt_0 = --silent
97libecore_wince_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
98 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
99 $(AM_CFLAGS) $(CFLAGS) $(libecore_wince_la_LDFLAGS) $(LDFLAGS) \
100 -o $@
101DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
102depcomp = $(SHELL) $(top_srcdir)/depcomp
103am__depfiles_maybe = depfiles
104am__mv = mv -f
105COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
106 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
107LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
108 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
109 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
110 $(AM_CFLAGS) $(CFLAGS)
111AM_V_CC = $(am__v_CC_$(V))
112am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
113am__v_CC_0 = @echo " CC " $@;
114AM_V_at = $(am__v_at_$(V))
115am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
116am__v_at_0 = @
117CCLD = $(CC)
118LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
119 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
120 $(AM_LDFLAGS) $(LDFLAGS) -o $@
121AM_V_CCLD = $(am__v_CCLD_$(V))
122am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
123am__v_CCLD_0 = @echo " CCLD " $@;
124AM_V_GEN = $(am__v_GEN_$(V))
125am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
126am__v_GEN_0 = @echo " GEN " $@;
127SOURCES = $(libecore_wince_la_SOURCES)
128DIST_SOURCES = $(libecore_wince_la_SOURCES)
129HEADERS = $(includes_HEADERS)
130ETAGS = etags
131CTAGS = ctags
132DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
133ACLOCAL = @ACLOCAL@
134ALLOCA = @ALLOCA@
135AMTAR = @AMTAR@
136AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
137AR = @AR@
138AS = @AS@
139AUTOCONF = @AUTOCONF@
140AUTOHEADER = @AUTOHEADER@
141AUTOMAKE = @AUTOMAKE@
142AWK = @AWK@
143CARES_CFLAGS = @CARES_CFLAGS@
144CARES_LIBS = @CARES_LIBS@
145CC = @CC@
146CCDEPMODE = @CCDEPMODE@
147CFLAGS = @CFLAGS@
148CHECK_CFLAGS = @CHECK_CFLAGS@
149CHECK_LIBS = @CHECK_LIBS@
150CPP = @CPP@
151CPPFLAGS = @CPPFLAGS@
152CURL_CFLAGS = @CURL_CFLAGS@
153CURL_LIBS = @CURL_LIBS@
154CXX = @CXX@
155CXXCPP = @CXXCPP@
156CXXDEPMODE = @CXXDEPMODE@
157CXXFLAGS = @CXXFLAGS@
158CYGPATH_W = @CYGPATH_W@
159DEFS = @DEFS@
160DEPDIR = @DEPDIR@
161DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
162DIRECTFB_LIBS = @DIRECTFB_LIBS@
163DLLTOOL = @DLLTOOL@
164DSYMUTIL = @DSYMUTIL@
165DUMPBIN = @DUMPBIN@
166ECHO_C = @ECHO_C@
167ECHO_N = @ECHO_N@
168ECHO_T = @ECHO_T@
169ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
170ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
171EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
172EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
173EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
174EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
175EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
176EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
177EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
178EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
179EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
180EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
181EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
182EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
183EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
184EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
185EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
186EGREP = @EGREP@
187EINA_CFLAGS = @EINA_CFLAGS@
188EINA_LIBS = @EINA_LIBS@
189ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
190ESCAPE_LIBS = @ESCAPE_LIBS@
191EVAS_CFLAGS = @EVAS_CFLAGS@
192EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@
196EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
197EXOTIC_LIBS = @EXOTIC_LIBS@
198FGREP = @FGREP@
199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
200GLIB_CFLAGS = @GLIB_CFLAGS@
201GLIB_LIBS = @GLIB_LIBS@
202GMSGFMT = @GMSGFMT@
203GMSGFMT_015 = @GMSGFMT_015@
204GREP = @GREP@
205INSTALL = @INSTALL@
206INSTALL_DATA = @INSTALL_DATA@
207INSTALL_PROGRAM = @INSTALL_PROGRAM@
208INSTALL_SCRIPT = @INSTALL_SCRIPT@
209INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
210INTLLIBS = @INTLLIBS@
211INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
212KEYSYMDEFS = @KEYSYMDEFS@
213LD = @LD@
214LDFLAGS = @LDFLAGS@
215LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
216LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
217LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
218LIBICONV = @LIBICONV@
219LIBINTL = @LIBINTL@
220LIBOBJS = @LIBOBJS@
221LIBS = @LIBS@
222LIBTOOL = @LIBTOOL@
223LIPO = @LIPO@
224LN_S = @LN_S@
225LTLIBICONV = @LTLIBICONV@
226LTLIBINTL = @LTLIBINTL@
227LTLIBOBJS = @LTLIBOBJS@
228MAKEINFO = @MAKEINFO@
229MKDIR_P = @MKDIR_P@
230MSGFMT = @MSGFMT@
231MSGFMT_015 = @MSGFMT_015@
232MSGMERGE = @MSGMERGE@
233NM = @NM@
234NMEDIT = @NMEDIT@
235OBJC = @OBJC@
236OBJCDEPMODE = @OBJCDEPMODE@
237OBJCFLAGS = @OBJCFLAGS@
238OBJDUMP = @OBJDUMP@
239OBJEXT = @OBJEXT@
240OTOOL = @OTOOL@
241OTOOL64 = @OTOOL64@
242PACKAGE = @PACKAGE@
243PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
244PACKAGE_NAME = @PACKAGE_NAME@
245PACKAGE_STRING = @PACKAGE_STRING@
246PACKAGE_TARNAME = @PACKAGE_TARNAME@
247PACKAGE_URL = @PACKAGE_URL@
248PACKAGE_VERSION = @PACKAGE_VERSION@
249PATH_SEPARATOR = @PATH_SEPARATOR@
250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
251PIXMAN_LIBS = @PIXMAN_LIBS@
252PKG_CONFIG = @PKG_CONFIG@
253PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
254PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
255POSUB = @POSUB@
256RANLIB = @RANLIB@
257SCIM_CFLAGS = @SCIM_CFLAGS@
258SCIM_LIBS = @SCIM_LIBS@
259SDL_CFLAGS = @SDL_CFLAGS@
260SDL_CONFIG = @SDL_CONFIG@
261SDL_LIBS = @SDL_LIBS@
262SED = @SED@
263SET_MAKE = @SET_MAKE@
264SHELL = @SHELL@
265SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
266SSL_CFLAGS = @SSL_CFLAGS@
267SSL_LIBS = @SSL_LIBS@
268STRIP = @STRIP@
269TLS2_CFLAGS = @TLS2_CFLAGS@
270TLS2_LIBS = @TLS2_LIBS@
271TLS_CFLAGS = @TLS_CFLAGS@
272TLS_LIBS = @TLS_LIBS@
273TSLIB_CFLAGS = @TSLIB_CFLAGS@
274TSLIB_LIBS = @TSLIB_LIBS@
275USE_NLS = @USE_NLS@
276VERSION = @VERSION@
277VMAJ = @VMAJ@
278WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
279WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
280WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
281WAYLAND_LIBS = @WAYLAND_LIBS@
282WIN32_CFLAGS = @WIN32_CFLAGS@
283WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
284WIN32_LIBS = @WIN32_LIBS@
285XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
286XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
287XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
288XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
289XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
290XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
291XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
292XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
293XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
294XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
295XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
296XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
297XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
298XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
299XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
300XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
301XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
302XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
303XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
304XCB_X11_LIBS = @XCB_X11_LIBS@
305XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
306XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
307XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
308XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
309XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
310XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
311XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
312XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
313XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
314XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
315XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
316XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
317XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
318XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
319XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
320XDAMAGE_LIBS = @XDAMAGE_LIBS@
321XDPMS_CFLAGS = @XDPMS_CFLAGS@
322XDPMS_LIBS = @XDPMS_LIBS@
323XFIXES_CFLAGS = @XFIXES_CFLAGS@
324XFIXES_LIBS = @XFIXES_LIBS@
325XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
326XGESTURE_LIBS = @XGESTURE_LIBS@
327XGETTEXT = @XGETTEXT@
328XGETTEXT_015 = @XGETTEXT_015@
329XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
330XI2_CFLAGS = @XI2_CFLAGS@
331XI2_LIBS = @XI2_LIBS@
332XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
333XINERAMA_LIBS = @XINERAMA_LIBS@
334XKB_CFLAGS = @XKB_CFLAGS@
335XKB_LIBS = @XKB_LIBS@
336XMKMF = @XMKMF@
337XPRINT_CFLAGS = @XPRINT_CFLAGS@
338XPRINT_LIBS = @XPRINT_LIBS@
339XRANDR_CFLAGS = @XRANDR_CFLAGS@
340XRANDR_LIBS = @XRANDR_LIBS@
341XRENDER_CFLAGS = @XRENDER_CFLAGS@
342XRENDER_LIBS = @XRENDER_LIBS@
343XSS_CFLAGS = @XSS_CFLAGS@
344XSS_LIBS = @XSS_LIBS@
345XTEST_CFLAGS = @XTEST_CFLAGS@
346XTEST_LIBS = @XTEST_LIBS@
347X_CFLAGS = @X_CFLAGS@
348X_EXTRA_LIBS = @X_EXTRA_LIBS@
349X_LIBS = @X_LIBS@
350X_PRE_LIBS = @X_PRE_LIBS@
351Xcursor_cflags = @Xcursor_cflags@
352Xcursor_libs = @Xcursor_libs@
353abs_builddir = @abs_builddir@
354abs_srcdir = @abs_srcdir@
355abs_top_builddir = @abs_top_builddir@
356abs_top_srcdir = @abs_top_srcdir@
357ac_ct_CC = @ac_ct_CC@
358ac_ct_CXX = @ac_ct_CXX@
359ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
360ac_ct_OBJC = @ac_ct_OBJC@
361am__include = @am__include@
362am__leading_dot = @am__leading_dot@
363am__quote = @am__quote@
364am__tar = @am__tar@
365am__untar = @am__untar@
366bindir = @bindir@
367build = @build@
368build_alias = @build_alias@
369build_cpu = @build_cpu@
370build_os = @build_os@
371build_vendor = @build_vendor@
372builddir = @builddir@
373cocoa_ldflags = @cocoa_ldflags@
374datadir = @datadir@
375datarootdir = @datarootdir@
376dlopen_libs = @dlopen_libs@
377docdir = @docdir@
378dvidir = @dvidir@
379ecore_cocoa_cflags = @ecore_cocoa_cflags@
380ecore_cocoa_libs = @ecore_cocoa_libs@
381ecore_con_cflags = @ecore_con_cflags@
382ecore_con_libs = @ecore_con_libs@
383ecore_directfb_cflags = @ecore_directfb_cflags@
384ecore_directfb_libs = @ecore_directfb_libs@
385ecore_evas_cflags = @ecore_evas_cflags@
386ecore_evas_libs = @ecore_evas_libs@
387ecore_fb_cflags = @ecore_fb_cflags@
388ecore_fb_libs = @ecore_fb_libs@
389ecore_file_cflags = @ecore_file_cflags@
390ecore_file_libs = @ecore_file_libs@
391ecore_imf_cflags = @ecore_imf_cflags@
392ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
393ecore_imf_evas_libs = @ecore_imf_evas_libs@
394ecore_imf_libs = @ecore_imf_libs@
395ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
396ecore_imf_scim_libs = @ecore_imf_scim_libs@
397ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
398ecore_imf_xim_libs = @ecore_imf_xim_libs@
399ecore_input_cflags = @ecore_input_cflags@
400ecore_input_evas_cflags = @ecore_input_evas_cflags@
401ecore_input_evas_libs = @ecore_input_evas_libs@
402ecore_input_libs = @ecore_input_libs@
403ecore_ipc_cflags = @ecore_ipc_cflags@
404ecore_ipc_libs = @ecore_ipc_libs@
405ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
406ecore_psl1ght_libs = @ecore_psl1ght_libs@
407ecore_sdl_cflags = @ecore_sdl_cflags@
408ecore_sdl_libs = @ecore_sdl_libs@
409ecore_wayland_cflags = @ecore_wayland_cflags@
410ecore_wayland_libs = @ecore_wayland_libs@
411ecore_win32_cflags = @ecore_win32_cflags@
412ecore_win32_libs = @ecore_win32_libs@
413ecore_wince_cflags = @ecore_wince_cflags@
414ecore_wince_libs = @ecore_wince_libs@
415ecore_x_cflags = @ecore_x_cflags@
416ecore_x_libs = @ecore_x_libs@
417ecore_x_libs_private = @ecore_x_libs_private@
418efl_doxygen = @efl_doxygen@
419efl_have_doxygen = @efl_have_doxygen@
420exec_prefix = @exec_prefix@
421have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
422host = @host@
423host_alias = @host_alias@
424host_cpu = @host_cpu@
425host_os = @host_os@
426host_vendor = @host_vendor@
427htmldir = @htmldir@
428includedir = @includedir@
429infodir = @infodir@
430install_sh = @install_sh@
431libdir = @libdir@
432libexecdir = @libexecdir@
433localedir = @localedir@
434localstatedir = @localstatedir@
435lt_ECHO = @lt_ECHO@
436lt_enable_auto_import = @lt_enable_auto_import@
437mandir = @mandir@
438mkdir_p = @mkdir_p@
439oldincludedir = @oldincludedir@
440pdfdir = @pdfdir@
441pkgconfig_requires_private = @pkgconfig_requires_private@
442prefix = @prefix@
443program_transform_name = @program_transform_name@
444psdir = @psdir@
445release_info = @release_info@
446requirements_ecore = @requirements_ecore@
447requirements_ecore_cocoa = @requirements_ecore_cocoa@
448requirements_ecore_con = @requirements_ecore_con@
449requirements_ecore_directfb = @requirements_ecore_directfb@
450requirements_ecore_evas = @requirements_ecore_evas@
451requirements_ecore_fb = @requirements_ecore_fb@
452requirements_ecore_file = @requirements_ecore_file@
453requirements_ecore_imf = @requirements_ecore_imf@
454requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
455requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
456requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
457requirements_ecore_input = @requirements_ecore_input@
458requirements_ecore_input_evas = @requirements_ecore_input_evas@
459requirements_ecore_ipc = @requirements_ecore_ipc@
460requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
461requirements_ecore_sdl = @requirements_ecore_sdl@
462requirements_ecore_wayland = @requirements_ecore_wayland@
463requirements_ecore_win32 = @requirements_ecore_win32@
464requirements_ecore_wince = @requirements_ecore_wince@
465requirements_ecore_x = @requirements_ecore_x@
466rt_libs = @rt_libs@
467sbindir = @sbindir@
468sharedstatedir = @sharedstatedir@
469srcdir = @srcdir@
470sysconfdir = @sysconfdir@
471target_alias = @target_alias@
472top_build_prefix = @top_build_prefix@
473top_builddir = @top_builddir@
474top_srcdir = @top_srcdir@
475version_info = @version_info@
476x_cflags = @x_cflags@
477x_includes = @x_includes@
478x_libs = @x_libs@
479MAINTAINERCLEANFILES = Makefile.in
480AM_CPPFLAGS = \
481-I$(top_srcdir)/src/lib/ecore \
482-I$(top_srcdir)/src/lib/ecore_input \
483-I$(top_builddir)/src/lib/ecore \
484-I$(top_builddir)/src/lib/ecore_input \
485@EFL_ECORE_WINCE_BUILD@ \
486@EVAS_CFLAGS@ \
487@EINA_CFLAGS@ \
488@WIN32_CPPFLAGS@
489
490AM_CFLAGS = @WIN32_CFLAGS@
491lib_LTLIBRARIES = libecore_wince.la
492includes_HEADERS = Ecore_WinCE.h
493includesdir = $(includedir)/ecore-@VMAJ@
494libecore_wince_la_SOURCES = \
495ecore_wince.c \
496ecore_wince_event.c \
497ecore_wince_window.c
498
499libecore_wince_la_LIBADD = \
500@WIN32_LIBS@ \
501$(top_builddir)/src/lib/ecore_input/libecore_input.la \
502$(top_builddir)/src/lib/ecore/libecore.la \
503@EVAS_LIBS@ \
504@EINA_LIBS@ \
505@EVIL_LIBS@
506
507libecore_wince_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
508EXTRA_DIST = ecore_wince_private.h
509all: all-am
510
511.SUFFIXES:
512.SUFFIXES: .c .lo .o .obj
513$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
514 @for dep in $?; do \
515 case '$(am__configure_deps)' in \
516 *$$dep*) \
517 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
518 && { if test -f $@; then exit 0; else break; fi; }; \
519 exit 1;; \
520 esac; \
521 done; \
522 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_wince/Makefile'; \
523 $(am__cd) $(top_srcdir) && \
524 $(AUTOMAKE) --gnu src/lib/ecore_wince/Makefile
525.PRECIOUS: Makefile
526Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
527 @case '$?' in \
528 *config.status*) \
529 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
530 *) \
531 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
532 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
533 esac;
534
535$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
536 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
537
538$(top_srcdir)/configure: $(am__configure_deps)
539 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
540$(ACLOCAL_M4): $(am__aclocal_m4_deps)
541 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
542$(am__aclocal_m4_deps):
543install-libLTLIBRARIES: $(lib_LTLIBRARIES)
544 @$(NORMAL_INSTALL)
545 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
546 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
547 list2=; for p in $$list; do \
548 if test -f $$p; then \
549 list2="$$list2 $$p"; \
550 else :; fi; \
551 done; \
552 test -z "$$list2" || { \
553 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
554 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
555 }
556
557uninstall-libLTLIBRARIES:
558 @$(NORMAL_UNINSTALL)
559 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
560 for p in $$list; do \
561 $(am__strip_dir) \
562 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
563 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
564 done
565
566clean-libLTLIBRARIES:
567 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
568 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
569 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
570 test "$$dir" != "$$p" || dir=.; \
571 echo "rm -f \"$${dir}/so_locations\""; \
572 rm -f "$${dir}/so_locations"; \
573 done
574libecore_wince.la: $(libecore_wince_la_OBJECTS) $(libecore_wince_la_DEPENDENCIES)
575 $(AM_V_CCLD)$(libecore_wince_la_LINK) -rpath $(libdir) $(libecore_wince_la_OBJECTS) $(libecore_wince_la_LIBADD) $(LIBS)
576
577mostlyclean-compile:
578 -rm -f *.$(OBJEXT)
579
580distclean-compile:
581 -rm -f *.tab.c
582
583@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wince.Plo@am__quote@
584@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wince_event.Plo@am__quote@
585@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wince_window.Plo@am__quote@
586
587.c.o:
588@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
589@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
590@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
591@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
592@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
593@am__fastdepCC_FALSE@ $(COMPILE) -c $<
594
595.c.obj:
596@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
597@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
598@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
599@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
600@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
601@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
602
603.c.lo:
604@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
605@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
606@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
607@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
608@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
609@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
610
611mostlyclean-libtool:
612 -rm -f *.lo
613
614clean-libtool:
615 -rm -rf .libs _libs
616install-includesHEADERS: $(includes_HEADERS)
617 @$(NORMAL_INSTALL)
618 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
619 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
620 for p in $$list; do \
621 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
622 echo "$$d$$p"; \
623 done | $(am__base_list) | \
624 while read files; do \
625 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
626 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
627 done
628
629uninstall-includesHEADERS:
630 @$(NORMAL_UNINSTALL)
631 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
632 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
633 test -n "$$files" || exit 0; \
634 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
635 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
636
637ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
638 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
639 unique=`for i in $$list; do \
640 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
641 done | \
642 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
643 END { if (nonempty) { for (i in files) print i; }; }'`; \
644 mkid -fID $$unique
645tags: TAGS
646
647TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
648 $(TAGS_FILES) $(LISP)
649 set x; \
650 here=`pwd`; \
651 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
652 unique=`for i in $$list; do \
653 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
654 done | \
655 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
656 END { if (nonempty) { for (i in files) print i; }; }'`; \
657 shift; \
658 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
659 test -n "$$unique" || unique=$$empty_fix; \
660 if test $$# -gt 0; then \
661 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
662 "$$@" $$unique; \
663 else \
664 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
665 $$unique; \
666 fi; \
667 fi
668ctags: CTAGS
669CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
670 $(TAGS_FILES) $(LISP)
671 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
672 unique=`for i in $$list; do \
673 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
674 done | \
675 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
676 END { if (nonempty) { for (i in files) print i; }; }'`; \
677 test -z "$(CTAGS_ARGS)$$unique" \
678 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
679 $$unique
680
681GTAGS:
682 here=`$(am__cd) $(top_builddir) && pwd` \
683 && $(am__cd) $(top_srcdir) \
684 && gtags -i $(GTAGS_ARGS) "$$here"
685
686distclean-tags:
687 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
688
689distdir: $(DISTFILES)
690 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
691 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
692 list='$(DISTFILES)'; \
693 dist_files=`for file in $$list; do echo $$file; done | \
694 sed -e "s|^$$srcdirstrip/||;t" \
695 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
696 case $$dist_files in \
697 */*) $(MKDIR_P) `echo "$$dist_files" | \
698 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
699 sort -u` ;; \
700 esac; \
701 for file in $$dist_files; do \
702 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
703 if test -d $$d/$$file; then \
704 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
705 if test -d "$(distdir)/$$file"; then \
706 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
707 fi; \
708 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
709 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
710 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
711 fi; \
712 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
713 else \
714 test -f "$(distdir)/$$file" \
715 || cp -p $$d/$$file "$(distdir)/$$file" \
716 || exit 1; \
717 fi; \
718 done
719check-am: all-am
720check: check-am
721all-am: Makefile $(LTLIBRARIES) $(HEADERS)
722installdirs:
723 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
724 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
725 done
726install: install-am
727install-exec: install-exec-am
728install-data: install-data-am
729uninstall: uninstall-am
730
731install-am: all-am
732 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
733
734installcheck: installcheck-am
735install-strip:
736 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
737 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
738 `test -z '$(STRIP)' || \
739 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
740mostlyclean-generic:
741
742clean-generic:
743
744distclean-generic:
745 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
746 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
747
748maintainer-clean-generic:
749 @echo "This command is intended for maintainers to use"
750 @echo "it deletes files that may require special tools to rebuild."
751 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
752clean: clean-am
753
754clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
755 mostlyclean-am
756
757distclean: distclean-am
758 -rm -rf ./$(DEPDIR)
759 -rm -f Makefile
760distclean-am: clean-am distclean-compile distclean-generic \
761 distclean-tags
762
763dvi: dvi-am
764
765dvi-am:
766
767html: html-am
768
769html-am:
770
771info: info-am
772
773info-am:
774
775install-data-am: install-includesHEADERS
776
777install-dvi: install-dvi-am
778
779install-dvi-am:
780
781install-exec-am: install-libLTLIBRARIES
782
783install-html: install-html-am
784
785install-html-am:
786
787install-info: install-info-am
788
789install-info-am:
790
791install-man:
792
793install-pdf: install-pdf-am
794
795install-pdf-am:
796
797install-ps: install-ps-am
798
799install-ps-am:
800
801installcheck-am:
802
803maintainer-clean: maintainer-clean-am
804 -rm -rf ./$(DEPDIR)
805 -rm -f Makefile
806maintainer-clean-am: distclean-am maintainer-clean-generic
807
808mostlyclean: mostlyclean-am
809
810mostlyclean-am: mostlyclean-compile mostlyclean-generic \
811 mostlyclean-libtool
812
813pdf: pdf-am
814
815pdf-am:
816
817ps: ps-am
818
819ps-am:
820
821uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
822
823.MAKE: install-am install-strip
824
825.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
826 clean-libLTLIBRARIES clean-libtool ctags distclean \
827 distclean-compile distclean-generic distclean-libtool \
828 distclean-tags distdir dvi dvi-am html html-am info info-am \
829 install install-am install-data install-data-am install-dvi \
830 install-dvi-am install-exec install-exec-am install-html \
831 install-html-am install-includesHEADERS install-info \
832 install-info-am install-libLTLIBRARIES install-man install-pdf \
833 install-pdf-am install-ps install-ps-am install-strip \
834 installcheck installcheck-am installdirs maintainer-clean \
835 maintainer-clean-generic mostlyclean mostlyclean-compile \
836 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
837 tags uninstall uninstall-am uninstall-includesHEADERS \
838 uninstall-libLTLIBRARIES
839
840
841# Tell versions [3.59,3.63) of GNU make to not export all variables.
842# Otherwise a system limit (for SysV at least) may be exceeded.
843.NOEXPORT:
diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince.c b/libraries/ecore/src/lib/ecore_wince/ecore_wince.c
deleted file mode 100644
index 5638ad3..0000000
--- a/libraries/ecore/src/lib/ecore_wince/ecore_wince.c
+++ /dev/null
@@ -1,400 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h> /* for printf */
7
8#define WIN32_LEAN_AND_MEAN
9#include <windows.h>
10#undef WIN32_LEAN_AND_MEAN
11
12#include <Eina.h>
13#include <Ecore.h>
14#include <Ecore_Input.h>
15
16#include "Ecore_WinCE.h"
17#include "ecore_wince_private.h"
18
19/*============================================================================*
20 * Local *
21 *============================================================================*/
22
23/**
24 * @cond LOCAL
25 */
26
27static int _ecore_wince_init_count = 0;
28
29LRESULT CALLBACK
30_ecore_wince_window_procedure(HWND window,
31 UINT message,
32 WPARAM window_param,
33 LPARAM data_param)
34{
35 Ecore_WinCE_Callback_Data *data;
36 POINTS pt;
37 DWORD coord;
38
39 data = (Ecore_WinCE_Callback_Data *)malloc(sizeof(Ecore_WinCE_Callback_Data));
40 if (!data) return DefWindowProc(window, message, window_param, data_param);
41
42 data->window = window;
43 data->message = message;
44 data->window_param = window_param;
45 data->data_param = data_param;
46 data->time = GetTickCount();
47 coord = GetMessagePos();
48 pt = MAKEPOINTS(coord);
49 data->x = pt.x;
50 data->y = pt.y;
51
52 switch (data->message)
53 {
54 /* Keyboard input notifications */
55 case WM_CHAR:
56 _ecore_wince_event_handle_key_press(data, 0);
57 break;
58 case WM_HOTKEY:
59 _ecore_wince_event_handle_key_press(data, 1);
60 break;
61 case WM_KEYDOWN:
62 case WM_SYSKEYDOWN:
63 _ecore_wince_event_handle_key_press(data, 1);
64 break;
65 case WM_KEYUP:
66 case WM_SYSKEYUP:
67 _ecore_wince_event_handle_key_release(data, 1);
68 break;
69 case WM_SETFOCUS:
70 _ecore_wince_event_handle_focus_in(data);
71 break;
72 case WM_KILLFOCUS:
73 _ecore_wince_event_handle_focus_out(data);
74 break;
75 /* Mouse input notifications */
76 case WM_LBUTTONDOWN:
77 _ecore_wince_event_handle_button_press(data, 1);
78 break;
79 case WM_LBUTTONUP:
80 _ecore_wince_event_handle_button_release(data, 1);
81 break;
82 case WM_MOUSEMOVE:
83 {
84 RECT rect;
85 Ecore_WinCE_Window *w = NULL;
86
87 w = (Ecore_WinCE_Window *)GetWindowLong(window, GWL_USERDATA);
88
89 if (GetClientRect(window, &rect))
90 {
91 POINT pt;
92
93 INF("mouse in window");
94
95 pt.x = LOWORD(data_param);
96 pt.y = HIWORD(data_param);
97 if (!PtInRect(&rect, pt))
98 {
99 if (w->pointer_is_in)
100 {
101 w->pointer_is_in = 0;
102 _ecore_wince_event_handle_leave_notify(data);
103 }
104 }
105 else
106 {
107 if (!w->pointer_is_in)
108 {
109 w->pointer_is_in = 1;
110 _ecore_wince_event_handle_enter_notify(data);
111 }
112 }
113 }
114 else
115 {
116 ERR("GetClientRect() failed");
117 }
118 _ecore_wince_event_handle_motion_notify(data);
119
120 break;
121 }
122 /* Window notifications */
123 case WM_CREATE:
124 _ecore_wince_event_handle_create_notify(data);
125 break;
126 case WM_DESTROY:
127 _ecore_wince_event_handle_destroy_notify(data);
128 break;
129 case WM_SHOWWINDOW:
130 if ((data->data_param == SW_OTHERUNZOOM) ||
131 (data->data_param == SW_OTHERZOOM))
132 break;
133
134 if (data->window_param)
135 _ecore_wince_event_handle_map_notify(data);
136 else
137 _ecore_wince_event_handle_unmap_notify(data);
138
139 break;
140 case WM_CLOSE:
141 _ecore_wince_event_handle_delete_request(data);
142 break;
143 /* GDI notifications */
144 case WM_ERASEBKGND:
145 return 1;
146 case WM_PAINT:
147 {
148 PAINTSTRUCT paint;
149
150 if (BeginPaint(window, &paint))
151 {
152 data->update = paint.rcPaint;
153 _ecore_wince_event_handle_expose(data);
154 EndPaint(window, &paint);
155 }
156 break;
157 }
158 default:
159 return DefWindowProc(window, message, window_param, data_param);
160 }
161
162 return 0;
163}
164
165static void
166_ecore_wince_error_print_cb(const Eina_Log_Domain *d __UNUSED__,
167 Eina_Log_Level level __UNUSED__,
168 const char *file __UNUSED__,
169 const char *fnc,
170 int line,
171 const char *fmt,
172 void *data __UNUSED__,
173 va_list args)
174{
175 fprintf(stderr, "[%s:%d] ", fnc, line);
176 vfprintf(stderr, fmt, args);
177}
178
179/**
180 * @endcond
181 */
182
183
184/*============================================================================*
185 * Global *
186 *============================================================================*/
187
188
189double _ecore_wince_double_click_time = 0.25;
190long _ecore_wince_event_last_time = 0;
191Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL;
192HINSTANCE _ecore_wince_instance = NULL;
193int _ecore_wince_log_dom_global = -1;
194
195int ECORE_WINCE_EVENT_MOUSE_IN = 0;
196int ECORE_WINCE_EVENT_MOUSE_OUT = 0;
197int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = 0;
198int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = 0;
199int ECORE_WINCE_EVENT_WINDOW_DAMAGE = 0;
200int ECORE_WINCE_EVENT_WINDOW_CREATE = 0;
201int ECORE_WINCE_EVENT_WINDOW_DESTROY = 0;
202int ECORE_WINCE_EVENT_WINDOW_SHOW = 0;
203int ECORE_WINCE_EVENT_WINDOW_HIDE = 0;
204int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0;
205
206/*============================================================================*
207 * API *
208 *============================================================================*/
209
210/**
211 * @addtogroup Ecore_WinCE_Group Ecore_WinCE library
212 *
213 * Ecore_WinCE is a library that wraps Windows CE graphic functions
214 * and integrate them nicely into the Ecore main loop.
215 *
216 * @{
217 */
218
219/**
220 * @brief Initialize the Ecore_WinCE library.
221 *
222 * @return 1 or greater on success, 0 on error.
223 *
224 * This function sets up the Windows CE graphic system. It returns 0 on
225 * failure, otherwise it returns the number of times it has already been
226 * called.
227 *
228 * When Ecore_WinCE is not used anymore, call ecore_wince_shutdown()
229 * to shut down the Ecore_WinCE library.
230 */
231EAPI int
232ecore_wince_init()
233{
234 WNDCLASS wc;
235
236 if (++_ecore_wince_init_count != 1)
237 return _ecore_wince_init_count;
238
239 if (!eina_init())
240 return --_ecore_wince_init_count;
241
242 eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL);
243 _ecore_wince_log_dom_global = eina_log_domain_register
244 ("ecore_wince", ECORE_WINCE_DEFAULT_LOG_COLOR);
245 if (_ecore_wince_log_dom_global < 0)
246 {
247 EINA_LOG_ERR("Ecore_WinCE: Could not register log domain");
248 goto shutdown_eina;
249 }
250
251 if (!ecore_event_init())
252 {
253 ERR("Ecore_WinCE: Could not init ecore_event");
254 goto unregister_log_domain;
255 }
256
257 _ecore_wince_instance = GetModuleHandle(NULL);
258 if (!_ecore_wince_instance)
259 {
260 ERR("GetModuleHandle() failed");
261 goto shutdown_ecore_event;
262 }
263
264 memset (&wc, 0, sizeof (wc));
265 wc.style = CS_HREDRAW | CS_VREDRAW;
266 wc.lpfnWndProc = _ecore_wince_window_procedure;
267 wc.cbClsExtra = 0;
268 wc.cbWndExtra = 0;
269 wc.hInstance = _ecore_wince_instance;
270 wc.hIcon = NULL;
271 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
272 wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
273 wc.lpszMenuName = NULL;
274 wc.lpszClassName = ECORE_WINCE_WINDOW_CLASS;
275
276 if(!RegisterClass(&wc))
277 {
278 ERR("RegisterClass() failed");
279 goto free_library;
280 }
281
282 if (!ECORE_WINCE_EVENT_MOUSE_IN)
283 {
284 ECORE_WINCE_EVENT_MOUSE_IN = ecore_event_type_new();
285 ECORE_WINCE_EVENT_MOUSE_OUT = ecore_event_type_new();
286 ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
287 ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
288 ECORE_WINCE_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
289 ECORE_WINCE_EVENT_WINDOW_CREATE = ecore_event_type_new();
290 ECORE_WINCE_EVENT_WINDOW_DESTROY = ecore_event_type_new();
291 ECORE_WINCE_EVENT_WINDOW_SHOW = ecore_event_type_new();
292 ECORE_WINCE_EVENT_WINDOW_HIDE = ecore_event_type_new();
293 ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
294 }
295
296 return _ecore_wince_init_count;
297
298 free_library:
299 FreeLibrary(_ecore_wince_instance);
300 shutdown_ecore_event:
301 ecore_event_shutdown();
302 unregister_log_domain:
303 eina_log_domain_unregister(_ecore_wince_log_dom_global);
304 shutdown_eina:
305 eina_shutdown();
306
307 return --_ecore_wince_init_count;
308}
309
310/**
311 * @brief Shut down the Ecore_WinCE library.
312 *
313 * @return 0 when the library is completely shut down, 1 or
314 * greater otherwise.
315 *
316 * This function shuts down the Ecore_WinCE library. It returns 0 when it has
317 * been called the same number of times than ecore_wince_init(). In that case
318 * it shuts down all the Windows CE graphic system.
319 */
320EAPI int
321ecore_wince_shutdown()
322{
323 HWND task_bar;
324
325 if (--_ecore_wince_init_count != 0)
326 return _ecore_wince_init_count;
327
328 /* force task bar to be shown (in case the application exits */
329 /* while being fullscreen) */
330 task_bar = FindWindow(L"HHTaskBar", NULL);
331 if (task_bar)
332 {
333 ShowWindow(task_bar, SW_SHOW);
334 EnableWindow(task_bar, TRUE);
335 }
336
337 if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance))
338 ERR("UnregisterClass() failed");
339
340 if (!FreeLibrary(_ecore_wince_instance))
341 ERR("FreeLibrary() failed");
342
343 _ecore_wince_instance = NULL;
344
345 ecore_event_shutdown();
346 eina_log_domain_unregister(_ecore_wince_log_dom_global);
347 _ecore_wince_log_dom_global = -1;
348 eina_shutdown();
349
350 return _ecore_wince_init_count;
351}
352
353/**
354 * @brief Set the timeout for a double and triple clicks to be flagged.
355 *
356 * @param t The time in seconds.
357 *
358 * This function sets the time @p t between clicks before the
359 * double_click flag is set in a button down event. If 3 clicks occur
360 * within double this time, the triple_click flag is also set.
361 */
362EAPI void
363ecore_wince_double_click_time_set(double t)
364{
365 if (t < 0.0) t = 0.0;
366 _ecore_wince_double_click_time = t;
367}
368
369/**
370 * @brief Retrieve the double and triple click flag timeout.
371 *
372 * @return The timeout for double clicks in seconds.
373 *
374 * This function returns the double clicks in seconds. If
375 * ecore_wince_double_click_time_set() has not been called, the
376 * default value is returned. See ecore_wince_double_click_time_set()
377 * for more informations.
378 */
379EAPI double
380ecore_wince_double_click_time_get(void)
381{
382 return _ecore_wince_double_click_time;
383}
384
385/**
386 * @brief Return the last event time.
387 *
388 * @return The last envent time.
389 *
390 * This function returns the last event time.
391 */
392EAPI long
393ecore_wince_current_time_get(void)
394{
395 return _ecore_wince_event_last_time;
396}
397
398/**
399 * @}
400 */
diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c b/libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c
deleted file mode 100644
index 41c355b..0000000
--- a/libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c
+++ /dev/null
@@ -1,1074 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6
7#define WIN32_LEAN_AND_MEAN
8#include <windows.h>
9#undef WIN32_LEAN_AND_MEAN
10
11#include <Eina.h>
12#include <Ecore.h>
13#include <Ecore_Input.h>
14
15#include "Ecore_WinCE.h"
16#include "ecore_wince_private.h"
17
18/*============================================================================*
19 * Local *
20 *============================================================================*/
21
22/**
23 * @cond LOCAL
24 */
25
26typedef enum
27{
28 ECORE_WINCE_KEY_MASK_LSHIFT = 1 << 0,
29 ECORE_WINCE_KEY_MASK_RSHIFT = 1 << 1,
30 ECORE_WINCE_KEY_MASK_LCONTROL = 1 << 2,
31 ECORE_WINCE_KEY_MASK_RCONTROL = 1 << 3,
32 ECORE_WINCE_KEY_MASK_LMENU = 1 << 4,
33 ECORE_WINCE_KEY_MASK_RMENU = 1 << 5
34} Ecore_Wince_Key_Mask;
35
36static Ecore_WinCE_Window *_ecore_wince_mouse_down_last_window = NULL;
37static Ecore_WinCE_Window *_ecore_wince_mouse_down_last_last_window = NULL;
38static long _ecore_wince_mouse_down_last_time = 0;
39static long _ecore_wince_mouse_down_last_last_time = 0;
40static int _ecore_wince_mouse_down_did_triple = 0;
41static int _ecore_wince_mouse_up_count = 0;
42static Ecore_Wince_Key_Mask _ecore_wince_key_mask = 0;
43
44static void
45_ecore_wince_event_free_key_down(void *data __UNUSED__,
46 void *ev)
47{
48 Ecore_Event_Key *e;
49
50 e = ev;
51 if (e->keyname) free((char *)e->keyname);
52 if (e->key) free((char *)e->key);
53 if (e->string) free((char *)e->string);
54 free(e);
55}
56
57static void
58_ecore_wince_event_free_key_up(void *data __UNUSED__,
59 void *ev)
60{
61 Ecore_Event_Key *e;
62
63 e = ev;
64 if (e->keyname) free((char *)e->keyname);
65 if (e->key) free((char *)e->key);
66 if (e->string) free((char *)e->string);
67 free(e);
68}
69
70static int
71_ecore_wince_event_keystroke_get(int key,
72 Eina_Bool is_down,
73 char **keyname,
74 char **keysymbol,
75 char **keycompose)
76{
77 char *kn;
78 char *ks;
79 char *kc;
80
81 *keyname = NULL;
82 *keysymbol = NULL;
83 *keycompose = NULL;
84
85 switch (key)
86 {
87 /* Keystroke */
88 case VK_PRIOR:
89 kn = "Prior";
90 ks = "Prior";
91 kc = "Prior";
92 break;
93 case VK_NEXT:
94 kn = "Next";
95 ks = "Next";
96 kc = "Next";
97 break;
98 case VK_END:
99 kn = "End";
100 ks = "End";
101 kc = "End";
102 break;
103 case VK_HOME:
104 kn = "Home";
105 ks = "Home";
106 kc = "Home";
107 break;
108 case VK_LEFT:
109 kn = "Left";
110 ks = "Left";
111 kc = "Left";
112 break;
113 case VK_UP:
114 kn = "Up";
115 ks = "Up";
116 kc = "Up";
117 break;
118 case VK_RIGHT:
119 kn = "Right";
120 ks = "Right";
121 kc = "Right";
122 break;
123 case VK_DOWN:
124 kn = "Down";
125 ks = "Down";
126 kc = "Down";
127 break;
128 case VK_INSERT:
129 kn = "Insert";
130 ks = "Insert";
131 kc = "Insert";
132 break;
133 case VK_DELETE:
134 kn = "Delete";
135 ks = "Delete";
136 kc = "Delete";
137 break;
138 case VK_F1:
139 kn = "F1";
140 ks = "F1";
141 kc = "";
142 break;
143 case VK_F2:
144 kn = "F2";
145 ks = "F2";
146 kc = "";
147 break;
148 case VK_F3:
149 kn = "F3";
150 ks = "F3";
151 kc = "";
152 break;
153 case VK_F4:
154 kn = "F4";
155 ks = "F4";
156 kc = "";
157 break;
158 case VK_F5:
159 kn = "F5";
160 ks = "F5";
161 kc = "";
162 break;
163 case VK_F6:
164 kn = "F6";
165 ks = "F6";
166 kc = "";
167 break;
168 case VK_F7:
169 kn = "F7";
170 ks = "F7";
171 kc = "";
172 break;
173 case VK_F8:
174 kn = "F8";
175 ks = "F8";
176 kc = "";
177 break;
178 case VK_F9:
179 kn = "F9";
180 ks = "F9";
181 kc = "";
182 break;
183 case VK_F10:
184 kn = "F10";
185 ks = "F10";
186 kc = "";
187 break;
188 case VK_F11:
189 kn = "F11";
190 ks = "F11";
191 kc = "";
192 break;
193 case VK_F12:
194 kn = "F12";
195 ks = "F12";
196 kc = "";
197 break;
198 case VK_F13:
199 kn = "F13";
200 ks = "F13";
201 kc = "";
202 break;
203 case VK_F14:
204 kn = "F14";
205 ks = "F14";
206 kc = "";
207 break;
208 case VK_F15:
209 kn = "F15";
210 ks = "F15";
211 kc = "";
212 break;
213 case VK_F16:
214 kn = "F16";
215 ks = "F16";
216 kc = "";
217 break;
218 case VK_F17:
219 kn = "F17";
220 ks = "F17";
221 kc = "";
222 break;
223 case VK_F18:
224 kn = "F18";
225 ks = "F18";
226 kc = "";
227 break;
228 case VK_F19:
229 kn = "F19";
230 ks = "F19";
231 kc = "";
232 break;
233 case VK_F20:
234 /*
235 * VK_F20 indicates that an arrow key came from a rocker.
236 * This can safely be ignored.
237 */
238 return 0;
239 case VK_F21:
240 /*
241 * VK_F21 indicates that an arrow key came from a directional
242 * pad. This can safely be ignored.
243 */
244 return 0;
245 case VK_F22:
246 kn = "F22";
247 ks = "F22";
248 kc = "";
249 break;
250 case VK_F23:
251 /*
252 * Sent with VK_RETURN when doing an action (usually the middle
253 * button on a directional pad. This can safely be ignored.
254 */
255 return 0;
256 case VK_F24:
257 kn = "F24";
258 ks = "F24";
259 kc = "";
260 break;
261 case VK_APPS:
262 kn = "Application";
263 ks = "Application";
264 kc = "";
265 break;
266 case VK_SHIFT:
267 {
268 SHORT res;
269
270 if (is_down)
271 {
272 res = GetKeyState(VK_LSHIFT);
273 if (res & 0x8000)
274 {
275 _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_LSHIFT;
276 kn = "Shift_L";
277 ks = "Shift_L";
278 kc = "";
279 }
280 res = GetKeyState(VK_RSHIFT);
281 if (res & 0x8000)
282 {
283 _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_RSHIFT;
284 kn = "Shift_R";
285 ks = "Shift_R";
286 kc = "";
287 }
288 }
289 else /* is_up */
290 {
291 res = GetKeyState(VK_LSHIFT);
292 if (!(res & 0x8000) &&
293 (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_LSHIFT))
294 {
295 kn = "Shift_L";
296 ks = "Shift_L";
297 kc = "";
298 _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_LSHIFT;
299 }
300 res = GetKeyState(VK_RSHIFT);
301 if (!(res & 0x8000) &&
302 (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_RSHIFT))
303 {
304 kn = "Shift_R";
305 ks = "Shift_R";
306 kc = "";
307 _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_RSHIFT;
308 }
309 }
310 break;
311 }
312 case VK_CONTROL:
313 {
314 SHORT res;
315
316 if (is_down)
317 {
318 res = GetKeyState(VK_LCONTROL);
319 if (res & 0x8000)
320 {
321 _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_LCONTROL;
322 kn = "Control_L";
323 ks = "Control_L";
324 kc = "";
325 break;
326 }
327 res = GetKeyState(VK_RCONTROL);
328 if (res & 0x8000)
329 {
330 _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_RCONTROL;
331 kn = "Control_R";
332 ks = "Control_R";
333 kc = "";
334 break;
335 }
336 }
337 else /* is_up */
338 {
339 res = GetKeyState(VK_LCONTROL);
340 if (!(res & 0x8000) &&
341 (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_LCONTROL))
342 {
343 kn = "Control_L";
344 ks = "Control_L";
345 kc = "";
346 _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_LCONTROL;
347 break;
348 }
349 res = GetKeyState(VK_RCONTROL);
350 if (!(res & 0x8000) &&
351 (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_RCONTROL))
352 {
353 kn = "Control_R";
354 ks = "Control_R";
355 kc = "";
356 _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_RCONTROL;
357 break;
358 }
359 }
360 break;
361 }
362 case VK_MENU:
363 {
364 SHORT res;
365
366 if (is_down)
367 {
368 res = GetKeyState(VK_LMENU);
369 if (res & 0x8000)
370 {
371 _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_LMENU;
372 kn = "Alt_L";
373 ks = "Alt_L";
374 kc = "";
375 }
376 res = GetKeyState(VK_RMENU);
377 if (res & 0x8000)
378 {
379 _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_RMENU;
380 kn = "Alt_R";
381 ks = "Alt_R";
382 kc = "";
383 }
384 }
385 else /* is_up */
386 {
387 res = GetKeyState(VK_LMENU);
388 if (!(res & 0x8000) &&
389 (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_LMENU))
390 {
391 kn = "Alt_L";
392 ks = "Alt_L";
393 kc = "";
394 _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_LMENU;
395 }
396 res = GetKeyState(VK_RMENU);
397 if (!(res & 0x8000) &&
398 (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_RMENU))
399 {
400 kn = "Alt_R";
401 ks = "Alt_R";
402 kc = "";
403 _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_RMENU;
404 }
405 }
406 break;
407 }
408 default:
409 /* other non keystroke characters */
410 return 0;
411 }
412 *keyname = strdup(kn);
413 if (!*keyname) return 0;
414 *keysymbol = strdup(ks);
415 if (!*keysymbol)
416 {
417 free(*keyname);
418 *keyname = NULL;
419 return 0;
420 }
421 *keycompose = strdup(kc);
422 if (!*keycompose)
423 {
424 free(*keyname);
425 free(*keysymbol);
426 *keyname = NULL;
427 *keysymbol = NULL;
428 return 0;
429 }
430
431 return 1;
432}
433
434static int
435_ecore_wince_event_char_get(int key,
436 char **keyname,
437 char **keysymbol,
438 char **keycompose)
439{
440 char kn[32];
441 char ks[32];
442 char kc[32];
443
444 *keyname = NULL;
445 *keysymbol = NULL;
446 *keycompose = NULL;
447
448 switch (key)
449 {
450 case VK_APP3:
451 case VK_BACK:
452 strncpy(kn, "BackSpace", 32);
453 strncpy(ks, "BackSpace", 32);
454 strncpy(kc, "BackSpace", 32);
455 break;
456 case VK_APP4:
457 case VK_TAB:
458 strncpy(kn, "Tab", 32);
459 strncpy(ks, "Tab", 32);
460 strncpy(kc, "Tab", 32);
461 break;
462 case VK_APP5:
463 case 0x0a:
464 /* Line feed (Shift + Enter) */
465 strncpy(kn, "LineFeed", 32);
466 strncpy(ks, "LineFeed", 32);
467 strncpy(kc, "LineFeed", 32);
468 break;
469 case VK_APP2:
470 case VK_RETURN:
471 strncpy(kn, "Return", 32);
472 strncpy(ks, "Return", 32);
473 strncpy(kc, "Return", 32);
474 break;
475 case VK_APP1:
476 case VK_ESCAPE:
477 strncpy(kn, "Escape", 32);
478 strncpy(ks, "Escape", 32);
479 strncpy(kc, "Escape", 32);
480 break;
481 case VK_SPACE:
482 strncpy(kn, "space", 32);
483 strncpy(ks, "space", 32);
484 strncpy(kc, " ", 32);
485 break;
486 default:
487 /* displayable characters */
488 printf (" * key : %d\n", key);
489 kn[0] = (TCHAR)key;
490 kn[1] = '\0';
491 ks[0] = (TCHAR)key;
492 ks[1] = '\0';
493 kc[0] = (TCHAR)key;
494 kc[1] = '\0';
495 break;
496 }
497 *keyname = strdup(kn);
498 if (!*keyname) return 0;
499 *keysymbol = strdup(ks);
500 if (!*keysymbol)
501 {
502 free(*keyname);
503 *keyname = NULL;
504 return 0;
505 }
506 *keycompose = strdup(kc);
507 if (!*keycompose)
508 {
509 free(*keyname);
510 free(*keysymbol);
511 *keyname = NULL;
512 *keysymbol = NULL;
513 return 0;
514 }
515
516 return 1;
517}
518
519/**
520 * @endcond
521 */
522
523
524/*============================================================================*
525 * Global *
526 *============================================================================*/
527
528void
529_ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg,
530 int is_keystroke)
531{
532 Ecore_Event_Key *e;
533
534 INF("key pressed");
535
536 e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key));
537 if (!e) return;
538
539 if (is_keystroke)
540 {
541 if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
542 EINA_TRUE,
543 (char **)&e->keyname,
544 (char **)&e->key,
545 (char **)&e->string))
546 {
547 free(e);
548 return;
549 }
550 }
551 else
552 {
553 if (!_ecore_wince_event_char_get(LOWORD(msg->window_param),
554 (char **)&e->keyname,
555 (char **)&e->key,
556 (char **)&e->string))
557 {
558 free(e);
559 return;
560 }
561 }
562
563 e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA);
564 e->event_window = e->window;
565 if (!e->window)
566 {
567 free(e);
568 return;
569 }
570 e->timestamp = msg->time;
571
572 _ecore_wince_event_last_time = e->timestamp;
573
574 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_wince_event_free_key_down, NULL);
575}
576
577void
578_ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg,
579 int is_keystroke)
580{
581 Ecore_Event_Key *e;
582
583 INF("key released");
584
585 e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
586 if (!e) return;
587
588 if (is_keystroke)
589 {
590 if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
591 EINA_FALSE,
592 (char **)&e->keyname,
593 (char **)&e->key,
594 (char **)&e->string))
595 {
596 free(e);
597 return;
598 }
599 }
600 else
601 {
602 if (!_ecore_wince_event_char_get(LOWORD(msg->window_param),
603 (char **)&e->keyname,
604 (char **)&e->key,
605 (char **)&e->string))
606 {
607 free(e);
608 return;
609 }
610 }
611
612 e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA);
613 e->event_window = e->window;
614 if (!e->window)
615 {
616 free(e);
617 return;
618 }
619 e->timestamp = msg->time;
620
621 _ecore_wince_event_last_time = e->timestamp;
622
623 ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_wince_event_free_key_up, NULL);
624}
625
626void
627_ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg,
628 int button)
629{
630 Ecore_WinCE_Window *window;
631
632 INF("mouse button pressed");
633
634 window = (Ecore_WinCE_Window *)GetWindowLong(msg->window, GWL_USERDATA);
635
636 {
637 Ecore_Event_Mouse_Move *e;
638
639 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
640 if (!e) return;
641
642 e->window = (Ecore_Window)window;
643 e->event_window = e->window;
644 e->x = LOWORD(msg->data_param);
645 e->y = HIWORD(msg->data_param);
646 e->timestamp = msg->time;
647
648 _ecore_wince_event_last_time = e->timestamp;
649 _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window;
650
651 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
652 }
653
654 {
655 Ecore_Event_Mouse_Button *e;
656
657 if (_ecore_wince_mouse_down_did_triple)
658 {
659 _ecore_wince_mouse_down_last_window = NULL;
660 _ecore_wince_mouse_down_last_last_window = NULL;
661 _ecore_wince_mouse_down_last_time = 0;
662 _ecore_wince_mouse_down_last_last_time = 0;
663 }
664
665 e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button));
666 if (!e) return;
667
668 e->window = (Ecore_Window)window;
669 e->event_window = e->window;
670 e->buttons = button;
671 e->x = LOWORD(msg->data_param);
672 e->y = HIWORD(msg->data_param);
673 e->timestamp = msg->time;
674
675 if (((e->timestamp - _ecore_wince_mouse_down_last_time) <= (long)(1000 * _ecore_wince_double_click_time)) &&
676 (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window))
677 e->double_click = 1;
678
679 if (((e->timestamp - _ecore_wince_mouse_down_last_last_time) <= (long)(2 * 1000 * _ecore_wince_double_click_time)) &&
680 (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window) &&
681 (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_last_window))
682 {
683 e->triple_click = 1;
684 _ecore_wince_mouse_down_did_triple = 1;
685 }
686 else
687 _ecore_wince_mouse_down_did_triple = 0;
688
689 if (!e->double_click && !e->triple_click)
690 _ecore_wince_mouse_up_count = 0;
691
692 _ecore_wince_event_last_time = e->timestamp;
693 _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window;
694
695 if (!_ecore_wince_mouse_down_did_triple)
696 {
697 _ecore_wince_mouse_down_last_last_window = _ecore_wince_mouse_down_last_window;
698 _ecore_wince_mouse_down_last_window = (Ecore_WinCE_Window *)e->window;
699 _ecore_wince_mouse_down_last_last_time = _ecore_wince_mouse_down_last_time;
700 _ecore_wince_mouse_down_last_time = e->timestamp;
701 }
702
703 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
704 }
705}
706
707void
708_ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg,
709 int button)
710{
711 Ecore_WinCE_Window *window;
712
713 INF("mouse button released");
714
715 window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
716
717 {
718 Ecore_Event_Mouse_Move *e;
719
720 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
721 if (!e) return;
722
723 e->window = (Ecore_Window)window;
724 e->event_window = e->window;
725 e->x = LOWORD(msg->data_param);
726 e->y = HIWORD(msg->data_param);
727 e->timestamp = msg->time;
728
729 _ecore_wince_event_last_time = e->timestamp;
730 _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window;
731
732 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
733 }
734
735 {
736 Ecore_Event_Mouse_Button *e;
737
738 e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button));
739 if (!e) return;
740
741 e->window = (Ecore_Window)window;
742 e->event_window = e->window;
743 e->buttons = button;
744 e->x = LOWORD(msg->data_param);
745 e->y = HIWORD(msg->data_param);
746 e->timestamp = msg->time;
747
748 _ecore_wince_mouse_up_count++;
749
750 if ((_ecore_wince_mouse_up_count >= 2) &&
751 ((e->timestamp - _ecore_wince_mouse_down_last_time) <= (long)(1000 * _ecore_wince_double_click_time)) &&
752 (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window))
753 e->double_click = 1;
754
755 if ((_ecore_wince_mouse_up_count >= 3) &&
756 ((e->timestamp - _ecore_wince_mouse_down_last_last_time) <= (long)(2 * 1000 * _ecore_wince_double_click_time)) &&
757 (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window) &&
758 (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_last_window))
759 e->triple_click = 1;
760
761 _ecore_wince_event_last_time = e->timestamp;
762 _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window;
763
764 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
765 }
766}
767
768void
769_ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg)
770{
771 Ecore_Event_Mouse_Move *e;
772
773 INF("mouse moved");
774
775 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
776 if (!e) return;
777
778 e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA);
779 e->event_window = e->window;
780 e->x = LOWORD(msg->data_param);
781 e->y = HIWORD(msg->data_param);
782 e->timestamp = msg->time;
783
784 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
785}
786
787void
788_ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg)
789{
790 Ecore_WinCE_Window *window;
791
792 INF("mouse in");
793
794 window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
795
796 {
797 Ecore_Event_Mouse_Move *e;
798
799 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
800 if (!e) return;
801
802 e->window = (Ecore_Window)window;
803 e->event_window = e->window;
804 e->x = msg->x;
805 e->y = msg->y;
806 e->timestamp = msg->time;
807
808 _ecore_wince_event_last_time = e->timestamp;
809 _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window;
810
811 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
812 }
813
814 {
815 Ecore_WinCE_Event_Mouse_In *e;
816
817 e = (Ecore_WinCE_Event_Mouse_In *)calloc(1, sizeof(Ecore_WinCE_Event_Mouse_In));
818 if (!e) return;
819
820 e->window = window;
821 e->x = msg->x;
822 e->y = msg->y;
823 e->time = msg->time;
824
825 _ecore_wince_event_last_time = e->time;
826
827 ecore_event_add(ECORE_WINCE_EVENT_MOUSE_IN, e, NULL, NULL);
828 }
829}
830
831void
832_ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg)
833{
834 Ecore_WinCE_Window *window;
835
836 INF("mouse out");
837
838 window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
839
840 {
841 Ecore_Event_Mouse_Move *e;
842
843 e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
844 if (!e) return;
845
846 e->window = (Ecore_Window)window;
847 e->event_window = e->window;
848 e->x = msg->x;
849 e->y = msg->y;
850 e->timestamp = msg->time;
851
852 _ecore_wince_event_last_time = e->timestamp;
853 _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window;
854
855 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
856 }
857
858 {
859 Ecore_WinCE_Event_Mouse_Out *e;
860
861 e = (Ecore_WinCE_Event_Mouse_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Mouse_Out));
862 if (!e) return;
863
864 e->window = window;
865 e->x = msg->x;
866 e->y = msg->y;
867 e->time = msg->time;
868
869 _ecore_wince_event_last_time = e->time;
870
871 ecore_event_add(ECORE_WINCE_EVENT_MOUSE_OUT, e, NULL, NULL);
872 }
873}
874
875void
876_ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg)
877{
878 Ecore_WinCE_Event_Window_Focus_In *e;
879 Ecore_WinCE_Window *window;
880
881 INF("focus in");
882
883 e = (Ecore_WinCE_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_In));
884 if (!e) return;
885
886 window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
887 if (!e->window)
888 {
889 free(e);
890 return;
891 }
892
893 if (window->resume_cb)
894 window->resume_cb(window->backend);
895
896 e->window = window;
897
898 e->time = _ecore_wince_event_last_time;
899 _ecore_wince_event_last_time = e->time;
900
901 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
902}
903
904void
905_ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg)
906{
907 Ecore_WinCE_Event_Window_Focus_Out *e;
908 Ecore_WinCE_Window *window;
909
910 INF("focus out");
911
912 e = (Ecore_WinCE_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_Out));
913 if (!e) return;
914
915 window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
916 if (!e->window)
917 {
918 free(e);
919 return;
920 }
921 if (window->suspend_cb)
922 window->suspend_cb(window->backend);
923
924 e->window = window;
925
926 e->time = _ecore_wince_event_last_time;
927 _ecore_wince_event_last_time = e->time;
928
929 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
930}
931
932void
933_ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg)
934{
935 Ecore_WinCE_Event_Window_Damage *e;
936
937 INF("window expose");
938
939 e = (Ecore_WinCE_Event_Window_Damage *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Damage));
940 if (!e) return;
941
942 e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
943 if (!e->window)
944 {
945 free(e);
946 return;
947 }
948
949 e->x = msg->update.left;
950 e->y = msg->update.top;
951 e->width = msg->update.right - msg->update.left;
952 e->height = msg->update.bottom - msg->update.top;
953 INF("window expose size: %dx%d", e->width, e->height);
954
955 e->time = _ecore_wince_event_last_time;
956
957 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
958}
959
960void
961_ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg)
962{
963 Ecore_WinCE_Event_Window_Create *e;
964
965 INF("window create notify");
966
967 e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Create));
968 if (!e) return;
969
970 e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
971 if (!e->window)
972 {
973 free(e);
974 return;
975 }
976
977 e->time = _ecore_wince_event_last_time;
978
979 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_CREATE, e, NULL, NULL);
980}
981
982void
983_ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg)
984{
985 Ecore_WinCE_Event_Window_Destroy *e;
986
987 INF("window destroy notify");
988
989 e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Destroy));
990 if (!e) return;
991
992 e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
993 if (!e->window)
994 {
995 free(e);
996 return;
997 }
998
999 e->time = _ecore_wince_event_last_time;
1000/* if (e->window == _ecore_wince_event_last_window) _ecore_wince_event_last_window = NULL; */
1001
1002 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, e, NULL, NULL);
1003}
1004
1005void
1006_ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg)
1007{
1008 Ecore_WinCE_Event_Window_Show *e;
1009
1010 INF("window map notify");
1011
1012 e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Show));
1013 if (!e) return;
1014
1015 e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
1016 if (!e->window)
1017 {
1018 free(e);
1019 return;
1020 }
1021
1022 e->time = _ecore_wince_event_last_time;
1023
1024 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_SHOW, e, NULL, NULL);
1025}
1026
1027void
1028_ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg)
1029{
1030 Ecore_WinCE_Event_Window_Hide *e;
1031
1032 INF("window unmap notify");
1033
1034 e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Hide));
1035 if (!e) return;
1036
1037 e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
1038 if (!e->window)
1039 {
1040 free(e);
1041 return;
1042 }
1043
1044 e->time = _ecore_wince_event_last_time;
1045
1046 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_HIDE, e, NULL, NULL);
1047}
1048
1049void
1050_ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg)
1051{
1052 Ecore_WinCE_Event_Window_Delete_Request *e;
1053
1054 INF("window delete request");
1055
1056 e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Delete_Request));
1057 if (!e) return;
1058
1059 e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
1060 if (!e->window)
1061 {
1062 free(e);
1063 return;
1064 }
1065
1066 e->time = _ecore_wince_event_last_time;
1067
1068 ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
1069}
1070
1071/*============================================================================*
1072 * API *
1073 *============================================================================*/
1074
diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h b/libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h
deleted file mode 100644
index b506312..0000000
--- a/libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h
+++ /dev/null
@@ -1,85 +0,0 @@
1#ifndef __ECORE_WINCE_PRIVATE_H__
2#define __ECORE_WINCE_PRIVATE_H__
3
4
5/* logging messages macros */
6extern int _ecore_wince_log_dom_global;
7
8#ifdef ECORE_WINCE_DEFAULT_LOG_COLOR
9#undef ECORE_WINCE_DEFAULT_LOG_COLOR
10#endif
11#define ECORE_WINCE_DEFAULT_LOG_COLOR EINA_COLOR_LIGHTBLUE
12
13#ifdef ERR
14# undef ERR
15#endif
16#define ERR(...) EINA_LOG_DOM_ERR(_ecore_wince_log_dom_global , __VA_ARGS__)
17#ifdef DBG
18# undef DBG
19#endif
20#define DBG(...) EINA_LOG_DOM_DBG(_ecore_wince_log_dom_global , __VA_ARGS__)
21#ifdef INF
22# undef INF
23#endif
24#define INF(...) EINA_LOG_DOM_INFO(_ecore_wince_log_dom_global , __VA_ARGS__)
25
26#define ECORE_WINCE_WINDOW_CLASS L"Ecore_WinCE_Window_Class"
27
28
29typedef struct _Ecore_WinCE_Callback_Data Ecore_WinCE_Callback_Data;
30
31struct _Ecore_WinCE_Callback_Data
32{
33 RECT update;
34 HWND window;
35 unsigned int message;
36 WPARAM window_param;
37 LPARAM data_param;
38 long time;
39 int x;
40 int y;
41};
42
43
44typedef int (*ecore_wince_suspend_cb) (int);
45typedef int (*ecore_wince_resume_cb) (int);
46
47
48struct _Ecore_WinCE_Window
49{
50 HWND window;
51
52 int backend;
53 ecore_wince_suspend_cb suspend_cb;
54 ecore_wince_resume_cb resume_cb;
55
56 RECT rect; /* used to go fullscreen to normal */
57
58 unsigned int pointer_is_in : 1;
59 unsigned int fullscreen : 1;
60};
61
62extern HINSTANCE _ecore_wince_instance;
63extern double _ecore_wince_double_click_time;
64extern long _ecore_wince_event_last_time;
65extern Ecore_WinCE_Window *_ecore_wince_event_last_window;
66
67
68void _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg, int is_keystroke);
69void _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg, int is_keystroke);
70void _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg, int button);
71void _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg, int button);
72void _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg);
73void _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg);
74void _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg);
75void _ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg);
76void _ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg);
77void _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg);
78void _ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg);
79void _ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg);
80void _ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg);
81void _ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg);
82void _ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg);
83
84
85#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
deleted file mode 100644
index 72353ce..0000000
--- a/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c
+++ /dev/null
@@ -1,827 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#define WIN32_LEAN_AND_MEAN
6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN
8
9#include <Evil.h>
10#include <Eina.h>
11
12#include "Ecore_WinCE.h"
13#include "ecore_wince_private.h"
14
15/*============================================================================*
16 * Local *
17 *============================================================================*/
18
19/**
20 * @cond LOCAL
21 */
22
23
24typedef BOOL (__stdcall *UnregisterFunc1Proc)(UINT, UINT);
25
26static int
27_ecore_wince_hardware_keys_register(HWND window)
28{
29 HINSTANCE core_dll;
30 UnregisterFunc1Proc unregister_fct;
31 int i;
32
33 core_dll = LoadLibrary(L"coredll.dll");
34 if (!core_dll)
35 {
36 ERR("LoadLibrary() failed");
37 return 0;
38 }
39
40 unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1");
41 if (!unregister_fct)
42 {
43 ERR("GetProcAddress() failed");
44 FreeLibrary(core_dll);
45 return 0;
46 }
47
48 for (i = 0xc1; i <= 0xcf; i++)
49 {
50 unregister_fct(MOD_WIN, i);
51 RegisterHotKey(window, i, MOD_WIN, i);
52 }
53
54 FreeLibrary(core_dll);
55
56 return 1;
57}
58
59/**
60 * @endcond
61 */
62
63
64/*============================================================================*
65 * Global *
66 *============================================================================*/
67
68/*============================================================================*
69 * API *
70 *============================================================================*/
71
72/**
73 * @addtogroup Ecore_WinCE_Group Ecore_WinCE library
74 *
75 * @{
76 */
77
78/**
79 * @brief Creates a new window.
80 *
81 * @param parent The parent window.
82 * @param x The x coordinate of the top-left corner of the window.
83 * @param y The y coordinate of the top-left corner of the window.
84 * @param width The width of the window.
85 * @param height The height of hte window.
86 * @return A newly allocated window.
87 *
88 * This function creates a new window which parent is @p parent. @p width and
89 * @p height are the size of the window content (the client part),
90 * without the border and title bar. @p x and @p y are the system
91 * coordinates of the top left cerner of the window (that is, of the
92 * title bar). This function returns a newly created window on
93 * success, and @c NULL on failure.
94 */
95EAPI Ecore_WinCE_Window *
96ecore_wince_window_new(Ecore_WinCE_Window *parent,
97 int x,
98 int y,
99 int width,
100 int height)
101{
102 Ecore_WinCE_Window *w;
103 HWND window;
104 RECT rect;
105
106 INF("creating window");
107
108 w = (Ecore_WinCE_Window *)calloc(1, sizeof(Ecore_WinCE_Window));
109 if (!w)
110 {
111 ERR("malloc() failed");
112 return NULL;
113 }
114
115 rect.left = 0;
116 rect.top = 0;
117 rect.right = width;
118 rect.bottom = height;
119 if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST))
120 {
121 ERR("AdjustWindowRectEx() failed");
122 free(w);
123 return NULL;
124 }
125
126 window = CreateWindowEx(WS_EX_TOPMOST,
127 ECORE_WINCE_WINDOW_CLASS,
128 L"",
129 WS_CAPTION | WS_SYSMENU | WS_VISIBLE,
130 x, y,
131 rect.right - rect.left, rect.bottom - rect.top,
132 parent ? ((Ecore_WinCE_Window *)parent)->window : NULL,
133 NULL, _ecore_wince_instance, NULL);
134 if (!window)
135 {
136 ERR("CreateWindowEx() failed");
137 free(w);
138 return NULL;
139 }
140
141 if (!_ecore_wince_hardware_keys_register(window))
142 {
143 ERR("_ecore_wince_hardware_keys_register() failed");
144 DestroyWindow(window);
145 free(w);
146 return NULL;
147 }
148
149 w->window = window;
150
151 SetLastError(0);
152 if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
153 {
154 ERR("SetWindowLong() failed");
155 DestroyWindow(window);
156 free(w);
157 return NULL;
158 }
159
160 w->pointer_is_in = 0;
161
162 return w;
163}
164
165/**
166 * @brief Free the given window.
167 *
168 * @param window The window to free.
169 *
170 * This function frees @p window. If @p window is @c NULL, this
171 * function does nothing.
172 */
173EAPI void
174ecore_wince_window_free(Ecore_WinCE_Window *window)
175{
176 if (!window) return;
177
178 INF("destroying window");
179
180 DestroyWindow(window->window);
181 free(window);
182}
183
184/**
185 * @brief Return the window HANDLE associated to the given window.
186 *
187 * @param window The window to retrieve the HANDLE from.
188 *
189 * This function returns the window HANDLE associated to @p window. If
190 * @p window is @c NULL, this function returns @c NULL.
191 */
192EAPI void *
193ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window)
194{
195 if (!window)
196 return NULL;
197
198 return window->window;
199}
200
201/**
202 * @brief Move the given window to a given position.
203 *
204 * @param window The window to move.
205 * @param x The x coordinate of the destination position.
206 * @param y The y coordinate of the destination position.
207 *
208 * This function move @p window to the new position of coordinates @p x
209 * and @p y. If @p window is @c NULL, or if it is fullscreen, or on
210 * error, this function does nothing.
211 */
212EAPI void
213ecore_wince_window_move(Ecore_WinCE_Window *window,
214 int x,
215 int y)
216{
217 RECT rect;
218
219 if (!window || window->fullscreen)
220 return;
221
222 INF("moving window (%dx%d)", x, y);
223
224 if (!GetWindowRect(window->window, &rect))
225 {
226 ERR("GetWindowRect() failed");
227 return;
228 }
229
230 if (!MoveWindow(window->window, x, y,
231 rect.right - rect.left,
232 rect.bottom - rect.top,
233 TRUE))
234 {
235 ERR("MoveWindow() failed");
236 }
237}
238
239/**
240 * @brief Resize the given window to a given size.
241 *
242 * @param window The window to resize.
243 * @param width The new width.
244 * @param height The new height.
245 *
246 * This function resize @p window to the new @p width and @p height.
247 * If @p window is @c NULL, or if it is fullscreen, or on error, this
248 * function does nothing.
249 */
250EAPI void
251ecore_wince_window_resize(Ecore_WinCE_Window *window,
252 int width,
253 int height)
254{
255 RECT rect;
256 DWORD style;
257 DWORD exstyle;
258 int x;
259 int y;
260
261 if (!window || window->fullscreen)
262 return;
263
264 INF("resizing window (%dx%d)", width, height);
265
266 if (!GetWindowRect(window->window, &rect))
267 {
268 ERR("GetWindowRect() failed");
269 return;
270 }
271
272 x = rect.left;
273 y = rect.top;
274 rect.left = 0;
275 rect.top = 0;
276 rect.right = width;
277 rect.bottom = height;
278 if (!(style = GetWindowLong(window->window, GWL_STYLE)))
279 {
280 ERR("GetWindowLong() failed");
281 return;
282 }
283 if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE)))
284 {
285 ERR("GetWindowLong() failed");
286 return;
287 }
288 if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
289 {
290 ERR("AdjustWindowRectEx() failed");
291 return;
292 }
293
294 if (!MoveWindow(window->window, x, y,
295 rect.right - rect.left,
296 rect.bottom - rect.top,
297 FALSE))
298 {
299 ERR("MoveWindow() failed");
300 }
301}
302
303/**
304 * @brief Move and resize the given window to a given position and size.
305 *
306 * @param window The window to move and resize.
307 * @param x The x coordinate of the destination position.
308 * @param y The x coordinate of the destination position.
309 * @param width The new width.
310 * @param height The new height.
311 *
312 * This function resize @p window to the new position of coordinates @p x
313 * and @p y and the new @p width and @p height. If @p window is @c NULL,
314 * or if it is fullscreen, or on error, this function does nothing.
315 */
316EAPI void
317ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
318 int x,
319 int y,
320 int width,
321 int height)
322{
323 RECT rect;
324 DWORD style;
325 DWORD exstyle;
326
327 if (!window || window->fullscreen)
328 return;
329
330 INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
331
332 rect.left = 0;
333 rect.top = 0;
334 rect.right = width;
335 rect.bottom = height;
336 if (!(style = GetWindowLong(window->window, GWL_STYLE)))
337 {
338 ERR("GetWindowLong() failed");
339 return;
340 }
341 if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE)))
342 {
343 ERR("GetWindowLong() failed");
344 return;
345 }
346 if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
347 {
348 ERR("AdjustWindowRectEx() failed");
349 return;
350 }
351
352 if (!MoveWindow(window->window, x, y,
353 rect.right - rect.left,
354 rect.bottom - rect.top,
355 TRUE))
356 {
357 ERR("MoveWindow() failed");
358 }
359}
360
361/**
362 * @brief Show the given window.
363 *
364 * @param window The window to show.
365 *
366 * This function shows @p window. If @p window is @c NULL, or on
367 * error, this function does nothing.
368 */
369EAPI void
370ecore_wince_window_show(Ecore_WinCE_Window *window)
371{
372 if (!window) return;
373
374 INF("showing window");
375
376 if (!ShowWindow(window->window, SW_SHOWNORMAL))
377 {
378 ERR("ShowWindow() failed");
379 return;
380 }
381 if (!UpdateWindow(window->window))
382 {
383 ERR("UpdateWindow() failed");
384 }
385 if (!SendMessage(window->window, WM_SHOWWINDOW, 1, 0))
386 {
387 ERR("SendMessage() failed");
388 }
389}
390
391/**
392 * @brief Hide the given window.
393 *
394 * @param window The window to show.
395 *
396 * This function hides @p window. If @p window is @c NULL, or on
397 * error, this function does nothing.
398 */
399EAPI void
400ecore_wince_window_hide(Ecore_WinCE_Window *window)
401{
402 if (!window) return;
403
404 INF("hiding window");
405
406 if (!ShowWindow(window->window, SW_HIDE))
407 {
408 ERR("ShowWindow() failed");
409 return;
410 }
411 if (!SendMessage(window->window, WM_SHOWWINDOW, 0, 0))
412 {
413 ERR("SendMessage() failed");
414 }
415}
416
417/**
418 * @brief Set the title of the given window.
419 *
420 * @param window The window to set the title.
421 * @param title The new title.
422 *
423 * This function sets the title of @p window to @p title. If @p window
424 * is @c NULL, or if @p title is @c NULL or empty, or on error, this
425 * function does nothing.
426 */
427EAPI void
428ecore_wince_window_title_set(Ecore_WinCE_Window *window,
429 const char *title)
430{
431 wchar_t *wtitle;
432
433 if (!window) return;
434
435 if (!title || !title[0]) return;
436
437 INF("setting window title");
438
439 wtitle = evil_char_to_wchar(title);
440 if (!wtitle) return;
441
442 if (!SetWindowText(window->window, wtitle))
443 {
444 ERR("SetWindowText() failed");
445 }
446 free(wtitle);
447}
448
449/**
450 * @brief Set the focus to the given window.
451 *
452 * @param window The window to give focus to.
453 *
454 * This function gives the focus to @p window. If @p window is
455 * @c NULL, this function does nothing.
456 */
457EAPI void
458ecore_wince_window_focus(Ecore_WinCE_Window *window)
459{
460 if (!window) return;
461
462 INF("focusing window");
463
464 if (!SetFocus(window->window))
465 {
466 ERR("SetFocus() failed");
467 }
468}
469
470/**
471 * @brief Get the current focused window.
472 *
473 * @return The window that has focus.
474 *
475 * This function returns the window that has focus. If the calling
476 * thread's message queue does not have an associated window with the
477 * keyboard focus, the return value is @c NULL.
478 *
479 * @note Even if the returned value is @c NULL, another thread's queue
480 * may be associated with a window that has the keyboard focus.
481 *
482 * @note The returned value is of type HWND.
483 */
484EAPI void *
485ecore_wince_window_focus_get(void)
486{
487 HWND focused;
488
489 INF("getting focused window");
490
491 focused = GetFocus();
492 if (!focused)
493 {
494 ERR("GetFocus() failed");
495 return NULL;
496 }
497
498 return focused;
499}
500
501/**
502 * @brief Set the graphic backend used for the given window.
503 *
504 * @param window The window.
505 * @param backend The backend.
506 *
507 * This function sets the graphic backend to use with @p window to
508 * @p backend. If @p window if @c NULL, this function does nothing.
509 *
510 * The valid values for @p backend are
511 *
512 * @li 0: automatic choice of the backend.
513 * @li 1: the framebuffer (fast but could be not well suported).
514 * @li 2: GAPI (less fast but almost always supported).
515 * @li 3: DirectDraw (less fast than GAPI but almost always
516 * supported).
517 * @li 4: GDI (the slowest but always supported).
518 *
519 * The @p backend is used only in Evas and Ecore_Evas. So this
520 * function should not be called if Ecore_Evas is used.
521 */
522EAPI void
523ecore_wince_window_backend_set(Ecore_WinCE_Window *window,
524 int backend)
525{
526 if (!window)
527 return;
528
529 INF("setting backend");
530
531 window->backend = backend;
532}
533
534/**
535 * @brief Set the suspend callback used for the given window.
536 *
537 * @param window The window.
538 * @param suspend_cb The suspend callback.
539 *
540 * This function sets the suspend callback to use with @p window to
541 * @p suspend_cb. If @p window if @c NULL, this function does nothing.
542 *
543 * The @p suspend_cb is used only in Evas and Ecore_Evas. So this
544 * function should not be called if Ecore_Evas is used.
545 */
546EAPI void
547ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int))
548{
549 if (!window)
550 return;
551
552 INF("setting suspend callback");
553
554 window->suspend_cb = suspend_cb;
555}
556
557/**
558 * @brief Set the resume callback used for the given window.
559 *
560 * @param window The window.
561 * @param resume_cb The resume callback.
562 *
563 * This function sets the resume callback to use with @p window to
564 * @p resume_cb. If @p window if @c NULL, this function does nothing.
565 *
566 * The @p resume_cb is used only in Evas and Ecore_Evas. So this
567 * function should not be called if Ecore_Evas is used.
568 */
569EAPI void
570ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int))
571{
572 if (!window)
573 return;
574
575 INF("setting resume callback");
576
577 window->resume_cb = resume_cb;
578}
579
580/**
581 * @brief Get the geometry of the given window.
582 *
583 * @param window The window to retrieve the geometry from.
584 * @param x The x coordinate of the position.
585 * @param y The x coordinate of the position.
586 * @param width The width.
587 * @param height The height.
588 *
589 * This function retrieves the position and size of @p window. @p x,
590 * @p y, @p width and @p height can be buffers that will be filled with
591 * the corresponding values. If one of them is @c NULL, nothing will
592 * be done for that parameter. If @p window is @c NULL, and if the
593 * buffers are not @c NULL, they will be filled with respectively 0,
594 * 0, the size of the screen and the height of the screen.
595 */
596EAPI void
597ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
598 int *x,
599 int *y,
600 int *width,
601 int *height)
602{
603 RECT rect;
604 int w;
605 int h;
606
607 INF("getting window geometry");
608
609 if (!window)
610 {
611 if (x) *x = 0;
612 if (y) *y = 0;
613 if (width) *width = GetSystemMetrics(SM_CXSCREEN);
614 if (height) *height = GetSystemMetrics(SM_CYSCREEN);
615
616 return;
617 }
618
619 if (!GetClientRect(window->window, &rect))
620 {
621 ERR("GetClientRect() failed");
622
623 if (x) *x = 0;
624 if (y) *y = 0;
625 if (width) *width = 0;
626 if (height) *height = 0;
627
628 return;
629 }
630
631 w = rect.right - rect.left;
632 h = rect.bottom - rect.top;
633
634 if (!GetWindowRect(window->window, &rect))
635 {
636 ERR("GetWindowRect() failed");
637
638 if (x) *x = 0;
639 if (y) *y = 0;
640 if (width) *width = 0;
641 if (height) *height = 0;
642
643 return;
644 }
645
646 if (x) *x = rect.left;
647 if (y) *y = rect.top;
648 if (width) *width = w;
649 if (height) *height = h;
650}
651
652/**
653 * @brief Get the size of the given window.
654 *
655 * @param window The window to retrieve the size from.
656 * @param width The width.
657 * @param height The height.
658 *
659 * This function retrieves the size of @p window. @p width and
660 * @p height can be buffers that will be filled with the corresponding
661 * values. If one of them is @c NULL, nothing will be done for that
662 * parameter. If @p window is @c NULL, and if the buffers are not
663 * @c NULL, they will be filled with respectively the size of the screen
664 * and the height of the screen.
665 */
666EAPI void
667ecore_wince_window_size_get(Ecore_WinCE_Window *window,
668 int *width,
669 int *height)
670{
671 RECT rect;
672
673 INF("getting window size");
674
675 if (!window)
676 {
677 if (width) *width = GetSystemMetrics(SM_CXSCREEN);
678 if (height) *height = GetSystemMetrics(SM_CYSCREEN);
679
680 return;
681 }
682
683 if (!GetClientRect(window->window, &rect))
684 {
685 ERR("GetClientRect() failed");
686
687 if (width) *width = 0;
688 if (height) *height = 0;
689 }
690
691 if (width) *width = rect.right - rect.left;
692 if (height) *height = rect.bottom - rect.top;
693}
694
695/**
696 * @brief Set the given window to fullscreen.
697 *
698 * @param window The window.
699 * @param on EINA_TRUE for fullscreen mode, EINA_FALSE for windowed mode.
700 *
701 * This function set @p window to fullscreen or windowed mode. If @p on
702 * is set to EINA_TRUE, the window will be fullscreen, if it is set to
703 * EINA_FALSE, it will be windowed. If @p window is @c NULL or if the
704 * state does not change (like setting to fullscreen while the window
705 * is already fullscreen), this function does nothing.
706 */
707EAPI void
708ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
709 Eina_Bool on)
710{
711 HWND task_bar;
712
713 if (!window) return;
714
715 if (((window->fullscreen) && (on)) ||
716 ((!window->fullscreen) && (!on)))
717 return;
718
719 INF("setting fullscreen: %s", on ? "yes" : "no");
720
721 window->fullscreen = !!on;
722
723 if (on)
724 {
725 /* save the position and size of the window */
726 if (!GetWindowRect(window->window, &window->rect))
727 {
728 ERR("GetWindowRect() failed");
729 return;
730 }
731
732 /* hide task bar */
733 task_bar = FindWindow(L"HHTaskBar", NULL);
734 if (!task_bar)
735 {
736 INF("FindWindow(): can not find task bar");
737 }
738 if (!ShowWindow(task_bar, SW_HIDE))
739 {
740 INF("ShowWindow(): task bar already hidden");
741 }
742 if (!EnableWindow(task_bar, FALSE))
743 {
744 INF("EnableWindow(): input already disabled");
745 }
746
747 /* style: visible + popup */
748 if (!SetWindowLong(window->window, GWL_STYLE, WS_POPUP | WS_VISIBLE))
749 {
750 INF("SetWindowLong() failed");
751 }
752
753 /* resize window to fit the entire screen */
754 if (!SetWindowPos(window->window, HWND_TOPMOST,
755 0, 0,
756 GetSystemMetrics(SM_CXSCREEN),
757 GetSystemMetrics(SM_CYSCREEN),
758 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
759 {
760 INF("SetWindowPos() failed");
761 }
762 /*
763 * It seems that SetWindowPos is not sufficient.
764 * Call MoveWindow with the correct size and force painting.
765 * Note that UpdateWindow (forcing repainting) is not sufficient
766 */
767 if (!MoveWindow(window->window,
768 0, 0,
769 GetSystemMetrics(SM_CXSCREEN),
770 GetSystemMetrics(SM_CYSCREEN),
771 TRUE))
772 {
773 INF("MoveWindow() failed");
774 }
775 }
776 else
777 {
778 /* show task bar */
779 task_bar = FindWindow(L"HHTaskBar", NULL);
780 if (!task_bar)
781 {
782 INF("FindWindow(): can not find task bar");
783 }
784 if (!ShowWindow(task_bar, SW_SHOW))
785 {
786 INF("ShowWindow(): task bar already visible");
787 }
788 if (!EnableWindow(task_bar, TRUE))
789 {
790 INF("EnableWindow(): input already enabled");
791 }
792
793 /* style: visible + caption + sysmenu */
794 if (!SetWindowLong(window->window, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE))
795 {
796 INF("SetWindowLong() failed");
797 }
798 /* restaure the position and size of the window */
799 if (!SetWindowPos(window->window, HWND_TOPMOST,
800 window->rect.left,
801 window->rect.top,
802 window->rect.right - window->rect.left,
803 window->rect.bottom - window->rect.top,
804 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
805 {
806 INF("SetWindowLong() failed");
807 }
808 /*
809 * It seems that SetWindowPos is not sufficient.
810 * Call MoveWindow with the correct size and force painting.
811 * Note that UpdateWindow (forcing repainting) is not sufficient
812 */
813 if (!MoveWindow(window->window,
814 window->rect.left,
815 window->rect.top,
816 window->rect.right - window->rect.left,
817 window->rect.bottom - window->rect.top,
818 TRUE))
819 {
820 INF("MoveWindow() failed");
821 }
822 }
823}
824
825/**
826 * @}
827 */
diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X.h b/libraries/ecore/src/lib/ecore_x/Ecore_X.h
deleted file mode 100644
index 336b656..0000000
--- a/libraries/ecore/src/lib/ecore_x/Ecore_X.h
+++ /dev/null
@@ -1,3714 +0,0 @@
1#ifndef _ECORE_X_H
2#define _ECORE_X_H
3
4#include <Eina.h>
5
6#ifdef EAPI
7# undef EAPI
8#endif // ifdef EAPI
9
10#ifdef _MSC_VER
11# ifdef BUILDING_DLL
12# define EAPI __declspec(dllexport)
13# else // ifdef BUILDING_DLL
14# define EAPI __declspec(dllimport)
15# endif // ifdef BUILDING_DLL
16#else // ifdef _MSC_VER
17# ifdef __GNUC__
18# if __GNUC__ >= 4
19# define EAPI __attribute__ ((visibility("default")))
20# else // if __GNUC__ >= 4
21# define EAPI
22# endif // if __GNUC__ >= 4
23# else // ifdef __GNUC__
24# define EAPI
25# endif // ifdef __GNUC__
26#endif // ifdef _MSC_VER
27
28#include <sys/types.h>
29
30/**
31 * @file
32 * @brief Ecore functions for dealing with the X Windows System
33 *
34 * Ecore_X provides a wrapper and convenience functions for using the
35 * X Windows System. Function groups for this part of the library
36 * include the following:
37 * @li @ref Ecore_X_Init_Group
38 * @li @ref Ecore_X_Display_Attr_Group
39 * @li @ref Ecore_X_Flush_Group
40 */
41
42typedef unsigned int Ecore_X_ID;
43#ifndef _ECORE_X_WINDOW_PREDEF
44typedef Ecore_X_ID Ecore_X_Window;
45#endif // ifndef _ECORE_X_WINDOW_PREDEF
46typedef void *Ecore_X_Visual;
47typedef Ecore_X_ID Ecore_X_Pixmap;
48typedef Ecore_X_ID Ecore_X_Drawable;
49#ifdef HAVE_ECORE_X_XCB
50typedef Ecore_X_ID Ecore_X_GC;
51#else // ifdef HAVE_ECORE_X_XCB
52typedef void *Ecore_X_GC;
53#endif /* HAVE_ECORE_X_XCB */
54typedef Ecore_X_ID Ecore_X_Atom;
55typedef Ecore_X_ID Ecore_X_Colormap;
56typedef Ecore_X_ID Ecore_X_Time;
57typedef Ecore_X_ID Ecore_X_Cursor;
58typedef void Ecore_X_Display;
59typedef void Ecore_X_Connection;
60typedef void Ecore_X_Screen;
61typedef Ecore_X_ID Ecore_X_Sync_Counter;
62typedef Ecore_X_ID Ecore_X_Sync_Alarm;
63typedef void Ecore_X_XRegion;
64
65typedef Ecore_X_ID Ecore_X_Randr_Output;
66typedef Ecore_X_ID Ecore_X_Randr_Crtc;
67typedef Ecore_X_ID Ecore_X_Randr_Mode;
68typedef unsigned short Ecore_X_Randr_Size_ID;
69typedef int Ecore_X_Randr_Screen;
70
71typedef Ecore_X_ID Ecore_X_Device;
72
73#ifdef __cplusplus
74extern "C" {
75#endif // ifdef __cplusplus
76
77typedef struct _Ecore_X_Rectangle
78{
79 int x, y;
80 unsigned int width, height;
81} Ecore_X_Rectangle;
82
83typedef struct _Ecore_X_Icon
84{
85 unsigned int width, height;
86 unsigned int *data;
87} Ecore_X_Icon;
88
89typedef enum _Ecore_X_GC_Value_Mask
90{
91 ECORE_X_GC_VALUE_MASK_FUNCTION = (1L << 0),
92 ECORE_X_GC_VALUE_MASK_PLANE_MASK = (1L << 1),
93 ECORE_X_GC_VALUE_MASK_FOREGROUND = (1L << 2),
94 ECORE_X_GC_VALUE_MASK_BACKGROUND = (1L << 3),
95 ECORE_X_GC_VALUE_MASK_LINE_WIDTH = (1L << 4),
96 ECORE_X_GC_VALUE_MASK_LINE_STYLE = (1L << 5),
97 ECORE_X_GC_VALUE_MASK_CAP_STYLE = (1L << 6),
98 ECORE_X_GC_VALUE_MASK_JOIN_STYLE = (1L << 7),
99 ECORE_X_GC_VALUE_MASK_FILL_STYLE = (1L << 8),
100 ECORE_X_GC_VALUE_MASK_FILL_RULE = (1L << 9),
101 ECORE_X_GC_VALUE_MASK_TILE = (1L << 10),
102 ECORE_X_GC_VALUE_MASK_STIPPLE = (1L << 11),
103 ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X = (1L << 12),
104 ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y = (1L << 13),
105 ECORE_X_GC_VALUE_MASK_FONT = (1L << 14),
106 ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE = (1L << 15),
107 ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES = (1L << 16),
108 ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X = (1L << 17),
109 ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y = (1L << 18),
110 ECORE_X_GC_VALUE_MASK_CLIP_MASK = (1L << 19),
111 ECORE_X_GC_VALUE_MASK_DASH_OFFSET = (1L << 20),
112 ECORE_X_GC_VALUE_MASK_DASH_LIST = (1L << 21),
113 ECORE_X_GC_VALUE_MASK_ARC_MODE = (1L << 22)
114} Ecore_X_GC_Value_Mask;
115
116typedef enum _Ecore_X_Composite_Update_Type
117{
118 ECORE_X_COMPOSITE_UPDATE_AUTOMATIC,
119 ECORE_X_COMPOSITE_UPDATE_MANUAL
120} Ecore_X_Composite_Update_Type;
121
122typedef enum _Ecore_X_Window_State
123{
124 /* Unknown state */
125 ECORE_X_WINDOW_STATE_UNKNOWN = 0,
126 /** The window is iconified. */
127 ECORE_X_WINDOW_STATE_ICONIFIED,
128 /** The window is a modal dialog box. */
129 ECORE_X_WINDOW_STATE_MODAL,
130 /** The window manager should keep the window's position fixed
131 * even if the virtual desktop scrolls. */
132 ECORE_X_WINDOW_STATE_STICKY,
133 /** The window has the maximum vertical size. */
134 ECORE_X_WINDOW_STATE_MAXIMIZED_VERT,
135 /** The window has the maximum horizontal size. */
136 ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ,
137 /** The window is shaded. */
138 ECORE_X_WINDOW_STATE_SHADED,
139 /** The window should not be included in the taskbar. */
140 ECORE_X_WINDOW_STATE_SKIP_TASKBAR,
141 /** The window should not be included in the pager. */
142 ECORE_X_WINDOW_STATE_SKIP_PAGER,
143 /** The window is invisible (i.e. minimized/iconified) */
144 ECORE_X_WINDOW_STATE_HIDDEN,
145 /** The window should fill the entire screen and have no
146 * window border/decorations */
147 ECORE_X_WINDOW_STATE_FULLSCREEN,
148 /* The following are not documented because they are not
149 * intended for use in applications. */
150 ECORE_X_WINDOW_STATE_ABOVE,
151 ECORE_X_WINDOW_STATE_BELOW,
152 /* FIXME: Documentation */
153 ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION
154} Ecore_X_Window_State;
155
156typedef enum _Ecore_X_Window_State_Action
157{
158 ECORE_X_WINDOW_STATE_ACTION_REMOVE,
159 ECORE_X_WINDOW_STATE_ACTION_ADD,
160 ECORE_X_WINDOW_STATE_ACTION_TOGGLE
161} Ecore_X_Window_State_Action;
162
163typedef enum _Ecore_X_Window_Stack_Mode
164{
165 ECORE_X_WINDOW_STACK_ABOVE = 0,
166 ECORE_X_WINDOW_STACK_BELOW = 1,
167 ECORE_X_WINDOW_STACK_TOP_IF = 2,
168 ECORE_X_WINDOW_STACK_BOTTOM_IF = 3,
169 ECORE_X_WINDOW_STACK_OPPOSITE = 4
170} Ecore_X_Window_Stack_Mode;
171
172typedef enum _Ecore_X_Randr_Orientation
173{
174 ECORE_X_RANDR_ORIENTATION_ROT_0 = (1 << 0),
175 ECORE_X_RANDR_ORIENTATION_ROT_90 = (1 << 1),
176 ECORE_X_RANDR_ORIENTATION_ROT_180 = (1 << 2),
177 ECORE_X_RANDR_ORIENTATION_ROT_270 = (1 << 3),
178 ECORE_X_RANDR_ORIENTATION_FLIP_X = (1 << 4),
179 ECORE_X_RANDR_ORIENTATION_FLIP_Y = (1 << 5)
180} Ecore_X_Randr_Orientation;
181
182typedef enum _Ecore_X_Randr_Connection_Status
183{
184 ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED = 0,
185 ECORE_X_RANDR_CONNECTION_STATUS_DISCONNECTED = 1,
186 ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN = 2
187} Ecore_X_Randr_Connection_Status;
188
189typedef enum _Ecore_X_Randr_Output_Policy
190{
191 ECORE_X_RANDR_OUTPUT_POLICY_ABOVE = 1,
192 ECORE_X_RANDR_OUTPUT_POLICY_RIGHT = 2,
193 ECORE_X_RANDR_OUTPUT_POLICY_BELOW = 3,
194 ECORE_X_RANDR_OUTPUT_POLICY_LEFT = 4,
195 ECORE_X_RANDR_OUTPUT_POLICY_CLONE = 5,
196 ECORE_X_RANDR_OUTPUT_POLICY_NONE = 6
197} Ecore_X_Randr_Output_Policy;
198
199typedef enum _Ecore_X_Randr_Relative_Alignment
200{
201 ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE = 0,
202 ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL = 1,
203 ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR = 2
204} Ecore_X_Randr_Relative_Alignment;
205
206typedef enum _Ecore_X_Render_Subpixel_Order
207{
208 ECORE_X_RENDER_SUBPIXEL_ORDER_UNKNOWN = 0,
209 ECORE_X_RENDER_SUBPIXEL_ORDER_HORIZONTAL_RGB = 1,
210 ECORE_X_RENDER_SUBPIXEL_ORDER_HORIZONTAL_BGR = 2,
211 ECORE_X_RENDER_SUBPIXEL_ORDER_VERTICAL_RGB = 3,
212 ECORE_X_RENDER_SUBPIXEL_ORDER_VERTICAL_BGR = 4,
213 ECORE_X_RENDER_SUBPIXEL_ORDER_NONE = 5
214} Ecore_X_Render_Subpixel_Order;
215
216typedef enum _Ecore_X_Randr_Edid_Display_Interface_Type
217{
218 ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_UNDEFINED,
219 ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DVI,
220 ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_A,
221 ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_B,
222 ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_MDDI,
223 ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT
224} Ecore_X_Randr_Edid_Display_Interface_Type;
225
226typedef enum _Ecore_X_Randr_Edid_Display_Colorscheme
227{
228 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_MONOCHROME_GRAYSCALE = 0x00,
229 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB = 0x08,
230 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_NON_RGB = 0x10,
231 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_UNDEFINED = 0x18,
232 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4 = 0x444000,
233 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4 = 0x444,
234 ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2 = 0x422
235} Ecore_X_Randr_Edid_Display_Colorscheme;
236
237typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio
238{
239 ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3 = 0x0,
240 ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9 = 0x1,
241 ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10 = 0x2,
242 ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4 = 0x4,
243 ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9 = 0x8
244} Ecore_X_Randr_Edid_Aspect_Ratio;
245
246#define ECORE_X_RANDR_EDID_UNKNOWN_VALUE -1
247
248#define ECORE_X_SELECTION_TARGET_TARGETS "TARGETS"
249#define ECORE_X_SELECTION_TARGET_TEXT "TEXT"
250#define ECORE_X_SELECTION_TARGET_COMPOUND_TEXT "COMPOUND_TEXT"
251#define ECORE_X_SELECTION_TARGET_STRING "STRING"
252#define ECORE_X_SELECTION_TARGET_UTF8_STRING "UTF8_STRING"
253#define ECORE_X_SELECTION_TARGET_FILENAME "FILENAME"
254
255#define ECORE_X_DND_VERSION 5
256
257typedef enum _Ecore_X_Selection
258{
259 ECORE_X_SELECTION_PRIMARY,
260 ECORE_X_SELECTION_SECONDARY,
261 ECORE_X_SELECTION_XDND,
262 ECORE_X_SELECTION_CLIPBOARD,
263 ECORE_X_SELECTION_OTHER
264} Ecore_X_Selection;
265
266typedef enum _Ecore_X_Event_Mode
267{
268 ECORE_X_EVENT_MODE_NORMAL,
269 ECORE_X_EVENT_MODE_WHILE_GRABBED,
270 ECORE_X_EVENT_MODE_GRAB,
271 ECORE_X_EVENT_MODE_UNGRAB
272} Ecore_X_Event_Mode;
273
274typedef enum _Ecore_X_Event_Detail
275{
276 ECORE_X_EVENT_DETAIL_ANCESTOR,
277 ECORE_X_EVENT_DETAIL_VIRTUAL,
278 ECORE_X_EVENT_DETAIL_INFERIOR,
279 ECORE_X_EVENT_DETAIL_NON_LINEAR,
280 ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL,
281 ECORE_X_EVENT_DETAIL_POINTER,
282 ECORE_X_EVENT_DETAIL_POINTER_ROOT,
283 ECORE_X_EVENT_DETAIL_DETAIL_NONE
284} Ecore_X_Event_Detail;
285
286typedef enum _Ecore_X_Event_Mask
287{
288 ECORE_X_EVENT_MASK_NONE = 0L,
289 ECORE_X_EVENT_MASK_KEY_DOWN = (1L << 0),
290 ECORE_X_EVENT_MASK_KEY_UP = (1L << 1),
291 ECORE_X_EVENT_MASK_MOUSE_DOWN = (1L << 2),
292 ECORE_X_EVENT_MASK_MOUSE_UP = (1L << 3),
293 ECORE_X_EVENT_MASK_MOUSE_IN = (1L << 4),
294 ECORE_X_EVENT_MASK_MOUSE_OUT = (1L << 5),
295 ECORE_X_EVENT_MASK_MOUSE_MOVE = (1L << 6),
296 ECORE_X_EVENT_MASK_WINDOW_DAMAGE = (1L << 15),
297 ECORE_X_EVENT_MASK_WINDOW_VISIBILITY = (1L << 16),
298 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE = (1L << 17),
299 ECORE_X_EVENT_MASK_WINDOW_RESIZE_MANAGE = (1L << 18),
300 ECORE_X_EVENT_MASK_WINDOW_MANAGE = (1L << 19),
301 ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE = (1L << 20),
302 ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE = (1L << 21),
303 ECORE_X_EVENT_MASK_WINDOW_PROPERTY = (1L << 22),
304 ECORE_X_EVENT_MASK_WINDOW_COLORMAP = (1L << 23),
305 ECORE_X_EVENT_MASK_WINDOW_GRAB = (1L << 24),
306 ECORE_X_EVENT_MASK_MOUSE_WHEEL = (1L << 29),
307 ECORE_X_EVENT_MASK_WINDOW_FOCUS_IN = (1L << 30),
308 ECORE_X_EVENT_MASK_WINDOW_FOCUS_OUT = (1L << 31)
309} Ecore_X_Event_Mask;
310
311typedef enum _Ecore_X_Gravity
312{
313 ECORE_X_GRAVITY_FORGET = 0,
314 ECORE_X_GRAVITY_UNMAP = 0,
315 ECORE_X_GRAVITY_NW = 1,
316 ECORE_X_GRAVITY_N = 2,
317 ECORE_X_GRAVITY_NE = 3,
318 ECORE_X_GRAVITY_W = 4,
319 ECORE_X_GRAVITY_CENTER = 5,
320 ECORE_X_GRAVITY_E = 6,
321 ECORE_X_GRAVITY_SW = 7,
322 ECORE_X_GRAVITY_S = 8,
323 ECORE_X_GRAVITY_SE = 9,
324 ECORE_X_GRAVITY_STATIC = 10
325} Ecore_X_Gravity;
326
327/* Needed for ecore_x_region_window_shape_set */
328typedef enum _Ecore_X_Shape_Type
329{
330 ECORE_X_SHAPE_BOUNDING,
331 ECORE_X_SHAPE_CLIP,
332 ECORE_X_SHAPE_INPUT
333} Ecore_X_Shape_Type;
334
335typedef enum _Ecore_X_Mapping_Type
336{
337 ECORE_X_MAPPING_MODIFIER,
338 ECORE_X_MAPPING_KEYBOARD,
339 ECORE_X_MAPPING_MOUSE
340} Ecore_X_Mapping_Type;
341
342typedef enum _Ecore_X_Randr_Property_Change
343{
344 ECORE_X_RANDR_PROPERTY_CHANGE_ADD,
345 ECORE_X_RANDR_PROPERTY_CHANGE_DEL
346} Ecore_X_Randr_Property_Change;
347
348typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In;
349typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
350typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In;
351typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out;
352typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap;
353typedef struct _Ecore_X_Event_Window_Damage Ecore_X_Event_Window_Damage;
354typedef struct _Ecore_X_Event_Window_Visibility_Change Ecore_X_Event_Window_Visibility_Change;
355typedef struct _Ecore_X_Event_Window_Create Ecore_X_Event_Window_Create;
356typedef struct _Ecore_X_Event_Window_Destroy Ecore_X_Event_Window_Destroy;
357typedef struct _Ecore_X_Event_Window_Hide Ecore_X_Event_Window_Hide;
358typedef struct _Ecore_X_Event_Window_Show Ecore_X_Event_Window_Show;
359typedef struct _Ecore_X_Event_Window_Show_Request Ecore_X_Event_Window_Show_Request;
360typedef struct _Ecore_X_Event_Window_Reparent Ecore_X_Event_Window_Reparent;
361typedef struct _Ecore_X_Event_Window_Configure Ecore_X_Event_Window_Configure;
362typedef struct _Ecore_X_Event_Window_Configure_Request Ecore_X_Event_Window_Configure_Request;
363typedef struct _Ecore_X_Event_Window_Gravity Ecore_X_Event_Window_Gravity;
364typedef struct _Ecore_X_Event_Window_Resize_Request Ecore_X_Event_Window_Resize_Request;
365typedef struct _Ecore_X_Event_Window_Stack Ecore_X_Event_Window_Stack;
366typedef struct _Ecore_X_Event_Window_Stack_Request Ecore_X_Event_Window_Stack_Request;
367typedef struct _Ecore_X_Event_Window_Property Ecore_X_Event_Window_Property;
368typedef struct _Ecore_X_Event_Window_Colormap Ecore_X_Event_Window_Colormap;
369typedef struct _Ecore_X_Event_Mapping_Change Ecore_X_Event_Mapping_Change;
370typedef struct _Ecore_X_Event_Window_Mapping Ecore_X_Event_Window_Mapping;
371typedef struct _Ecore_X_Event_Selection_Clear Ecore_X_Event_Selection_Clear;
372typedef struct _Ecore_X_Event_Selection_Request Ecore_X_Event_Selection_Request;
373typedef struct _Ecore_X_Event_Selection_Notify Ecore_X_Event_Selection_Notify;
374typedef struct _Ecore_X_Event_Fixes_Selection_Notify Ecore_X_Event_Fixes_Selection_Notify;
375typedef struct _Ecore_X_Selection_Data Ecore_X_Selection_Data;
376typedef struct _Ecore_X_Selection_Data_Files Ecore_X_Selection_Data_Files;
377typedef struct _Ecore_X_Selection_Data_Text Ecore_X_Selection_Data_Text;
378typedef struct _Ecore_X_Selection_Data_Targets Ecore_X_Selection_Data_Targets;
379typedef struct _Ecore_X_Event_Xdnd_Enter Ecore_X_Event_Xdnd_Enter;
380typedef struct _Ecore_X_Event_Xdnd_Position Ecore_X_Event_Xdnd_Position;
381typedef struct _Ecore_X_Event_Xdnd_Status Ecore_X_Event_Xdnd_Status;
382typedef struct _Ecore_X_Event_Xdnd_Leave Ecore_X_Event_Xdnd_Leave;
383typedef struct _Ecore_X_Event_Xdnd_Drop Ecore_X_Event_Xdnd_Drop;
384typedef struct _Ecore_X_Event_Xdnd_Finished Ecore_X_Event_Xdnd_Finished;
385typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message;
386typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape;
387typedef struct _Ecore_X_Event_Screensaver_Notify Ecore_X_Event_Screensaver_Notify;
388typedef struct _Ecore_X_Event_Gesture_Notify_Flick Ecore_X_Event_Gesture_Notify_Flick;
389typedef struct _Ecore_X_Event_Gesture_Notify_Pan Ecore_X_Event_Gesture_Notify_Pan;
390typedef struct _Ecore_X_Event_Gesture_Notify_PinchRotation Ecore_X_Event_Gesture_Notify_PinchRotation;
391typedef struct _Ecore_X_Event_Gesture_Notify_Tap Ecore_X_Event_Gesture_Notify_Tap;
392typedef struct _Ecore_X_Event_Gesture_Notify_TapNHold Ecore_X_Event_Gesture_Notify_TapNHold;
393typedef struct _Ecore_X_Event_Gesture_Notify_Hold Ecore_X_Event_Gesture_Notify_Hold;
394typedef struct _Ecore_X_Event_Gesture_Notify_Group Ecore_X_Event_Gesture_Notify_Group;
395typedef struct _Ecore_X_Event_Sync_Counter Ecore_X_Event_Sync_Counter;
396typedef struct _Ecore_X_Event_Sync_Alarm Ecore_X_Event_Sync_Alarm;
397typedef struct _Ecore_X_Event_Screen_Change Ecore_X_Event_Screen_Change;
398typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Change;
399typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change;
400typedef struct _Ecore_X_Event_Randr_Output_Property_Notify Ecore_X_Event_Randr_Output_Property_Notify;
401
402typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Window_Delete_Request;
403typedef struct _Ecore_X_Event_Window_Move_Resize_Request Ecore_X_Event_Window_Move_Resize_Request;
404typedef struct _Ecore_X_Event_Window_State_Request Ecore_X_Event_Window_State_Request;
405typedef struct _Ecore_X_Event_Frame_Extents_Request Ecore_X_Event_Frame_Extents_Request;
406typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping;
407typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change;
408
409typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence;
410
411typedef struct _Ecore_X_Event_Generic Ecore_X_Event_Generic;
412
413typedef struct _Ecore_X_Randr_Screen_Size Ecore_X_Randr_Screen_Size;
414typedef struct _Ecore_X_Randr_Screen_Size_MM Ecore_X_Randr_Screen_Size_MM;
415
416typedef struct _Ecore_X_Xdnd_Position Ecore_X_Xdnd_Position;
417
418struct _Ecore_X_Event_Mouse_In
419{
420 int modifiers;
421 int x, y;
422 Eina_Bool same_screen : 1;
423 struct
424 {
425 int x, y;
426 } root;
427 Ecore_X_Window win;
428 Ecore_X_Window event_win;
429 Ecore_X_Window root_win;
430 Ecore_X_Event_Mode mode;
431 Ecore_X_Event_Detail detail;
432 Ecore_X_Time time;
433};
434
435struct _Ecore_X_Event_Mouse_Out
436{
437 int modifiers;
438 int x, y;
439 int same_screen;
440 struct
441 {
442 int x, y;
443 } root;
444 Ecore_X_Window win;
445 Ecore_X_Window event_win;
446 Ecore_X_Window root_win;
447 Ecore_X_Event_Mode mode;
448 Ecore_X_Event_Detail detail;
449 Ecore_X_Time time;
450};
451
452struct _Ecore_X_Event_Window_Focus_In
453{
454 Ecore_X_Window win;
455 Ecore_X_Event_Mode mode;
456 Ecore_X_Event_Detail detail;
457 Ecore_X_Time time;
458};
459
460struct _Ecore_X_Event_Window_Focus_Out
461{
462 Ecore_X_Window win;
463 Ecore_X_Event_Mode mode;
464 Ecore_X_Event_Detail detail;
465 Ecore_X_Time time;
466};
467
468struct _Ecore_X_Event_Window_Keymap
469{
470 Ecore_X_Window win;
471};
472
473struct _Ecore_X_Event_Window_Damage
474{
475 Ecore_X_Window win;
476 int x, y, w, h;
477 int count;
478 Ecore_X_Time time;
479};
480
481struct _Ecore_X_Event_Window_Visibility_Change
482{
483 Ecore_X_Window win;
484 int fully_obscured;
485 Ecore_X_Time time;
486};
487
488struct _Ecore_X_Event_Window_Create
489{
490 Ecore_X_Window win;
491 Ecore_X_Window parent;
492 int override;
493 int x, y, w, h;
494 int border;
495 Ecore_X_Time time;
496};
497
498struct _Ecore_X_Event_Window_Destroy
499{
500 Ecore_X_Window win;
501 Ecore_X_Window event_win;
502 Ecore_X_Time time;
503};
504
505struct _Ecore_X_Event_Window_Hide
506{
507 Ecore_X_Window win;
508 Ecore_X_Window event_win;
509 Ecore_X_Time time;
510};
511
512struct _Ecore_X_Event_Window_Show
513{
514 Ecore_X_Window win;
515 Ecore_X_Window event_win;
516 Ecore_X_Time time;
517};
518
519struct _Ecore_X_Event_Window_Show_Request
520{
521 Ecore_X_Window win;
522 Ecore_X_Window parent;
523 Ecore_X_Time time;
524};
525
526struct _Ecore_X_Event_Window_Reparent
527{
528 Ecore_X_Window win;
529 Ecore_X_Window event_win;
530 Ecore_X_Window parent;
531 Ecore_X_Time time;
532};
533
534struct _Ecore_X_Event_Window_Configure
535{
536 Ecore_X_Window win;
537 Ecore_X_Window event_win;
538 Ecore_X_Window abovewin;
539 int x, y, w, h;
540 int border;
541 Eina_Bool override : 1;
542 Eina_Bool from_wm : 1;
543 Ecore_X_Time time;
544};
545
546struct _Ecore_X_Event_Window_Configure_Request
547{
548 Ecore_X_Window win;
549 Ecore_X_Window parent_win;
550 Ecore_X_Window abovewin;
551 int x, y, w, h;
552 int border;
553 Ecore_X_Window_Stack_Mode detail;
554 unsigned long value_mask;
555 Ecore_X_Time time;
556};
557
558struct _Ecore_X_Event_Window_Gravity
559{
560 Ecore_X_Window win;
561 Ecore_X_Window event_win;
562 Ecore_X_Time time;
563};
564
565struct _Ecore_X_Event_Window_Resize_Request
566{
567 Ecore_X_Window win;
568 int w, h;
569 Ecore_X_Time time;
570};
571
572struct _Ecore_X_Event_Window_Stack
573{
574 Ecore_X_Window win;
575 Ecore_X_Window event_win;
576 Ecore_X_Window_Stack_Mode detail;
577 Ecore_X_Time time;
578};
579
580struct _Ecore_X_Event_Window_Stack_Request
581{
582 Ecore_X_Window win;
583 Ecore_X_Window parent;
584 Ecore_X_Window_Stack_Mode detail;
585 Ecore_X_Time time;
586};
587
588struct _Ecore_X_Event_Window_Property
589{
590 Ecore_X_Window win;
591 Ecore_X_Atom atom;
592 Ecore_X_Time time;
593};
594
595struct _Ecore_X_Event_Window_Colormap
596{
597 Ecore_X_Window win;
598 Ecore_X_Colormap cmap;
599 Eina_Bool installed : 1;
600 Ecore_X_Time time;
601};
602
603struct _Ecore_X_Event_Mapping_Change
604{
605 Ecore_X_Mapping_Type type;
606 int keycode;
607 int num;
608};
609
610struct _Ecore_X_Event_Selection_Clear
611{
612 Ecore_X_Window win;
613 Ecore_X_Selection selection;
614 Ecore_X_Atom atom;
615 Ecore_X_Time time;
616};
617
618struct _Ecore_X_Event_Selection_Request
619{
620 Ecore_X_Window owner;
621 Ecore_X_Window requestor;
622 Ecore_X_Time time;
623 Ecore_X_Atom selection;
624 Ecore_X_Atom target;
625 Ecore_X_Atom property;
626};
627
628typedef enum
629{
630 ECORE_X_OWNER_CHANGE_REASON_NEW_OWNER,
631 ECORE_X_OWNER_CHANGE_REASON_DESTROY,
632 ECORE_X_OWNER_CHANGE_REASON_CLOSE
633} Ecore_X_Owner_Change_Reason;
634
635struct _Ecore_X_Event_Fixes_Selection_Notify
636{
637 Ecore_X_Window win;
638 Ecore_X_Window owner;
639 Ecore_X_Time time;
640 Ecore_X_Time selection_time;
641 Ecore_X_Selection selection;
642 Ecore_X_Atom atom;
643 Ecore_X_Owner_Change_Reason reason;
644};
645
646struct _Ecore_X_Event_Selection_Notify
647{
648 Ecore_X_Window win;
649 Ecore_X_Time time;
650 Ecore_X_Selection selection;
651 Ecore_X_Atom atom;
652 char *target;
653 void *data;
654};
655
656struct _Ecore_X_Selection_Data
657{
658 enum
659 {
660 ECORE_X_SELECTION_CONTENT_NONE,
661 ECORE_X_SELECTION_CONTENT_TEXT,
662 ECORE_X_SELECTION_CONTENT_FILES,
663 ECORE_X_SELECTION_CONTENT_TARGETS,
664 ECORE_X_SELECTION_CONTENT_CUSTOM
665 } content;
666 unsigned char *data;
667 int length;
668 int format;
669 int (*free)(void *data);
670};
671
672struct _Ecore_X_Selection_Data_Files
673{
674 Ecore_X_Selection_Data data;
675 char **files;
676 int num_files;
677};
678
679struct _Ecore_X_Selection_Data_Text
680{
681 Ecore_X_Selection_Data data;
682 char *text;
683};
684
685struct _Ecore_X_Selection_Data_Targets
686{
687 Ecore_X_Selection_Data data;
688 char **targets;
689 int num_targets;
690};
691
692struct _Ecore_X_Event_Xdnd_Enter
693{
694 Ecore_X_Window win, source;
695
696 char **types;
697 int num_types;
698};
699
700struct _Ecore_X_Event_Xdnd_Position
701{
702 Ecore_X_Window win, source;
703 struct
704 {
705 int x, y;
706 } position;
707 Ecore_X_Atom action;
708};
709
710struct _Ecore_X_Xdnd_Position
711{
712 Ecore_X_Window win, prev;
713 struct
714 {
715 int x, y;
716 } position;
717};
718
719struct _Ecore_X_Event_Xdnd_Status
720{
721 Ecore_X_Window win, target;
722 Eina_Bool will_accept : 1;
723 Ecore_X_Rectangle rectangle;
724 Ecore_X_Atom action;
725};
726
727struct _Ecore_X_Event_Xdnd_Leave
728{
729 Ecore_X_Window win, source;
730};
731
732struct _Ecore_X_Event_Xdnd_Drop
733{
734 Ecore_X_Window win, source;
735 Ecore_X_Atom action;
736 struct
737 {
738 int x, y;
739 } position;
740};
741
742struct _Ecore_X_Event_Xdnd_Finished
743{
744 Ecore_X_Window win, target;
745 Eina_Bool completed : 1;
746 Ecore_X_Atom action;
747};
748
749struct _Ecore_X_Event_Client_Message
750{
751 Ecore_X_Window win;
752 Ecore_X_Atom message_type;
753 int format;
754 union
755 {
756 char b[20];
757 short s[10];
758 long l[5];
759 } data;
760 Ecore_X_Time time;
761};
762
763struct _Ecore_X_Event_Window_Shape
764{
765 Ecore_X_Window win;
766 Ecore_X_Time time;
767 Ecore_X_Shape_Type type;
768 int x, y, w, h;
769 Eina_Bool shaped : 1;
770};
771
772struct _Ecore_X_Event_Screensaver_Notify
773{
774 Ecore_X_Window win;
775 Eina_Bool on : 1;
776 Ecore_X_Time time;
777};
778
779struct _Ecore_X_Event_Sync_Counter
780{
781 Ecore_X_Time time;
782};
783
784struct _Ecore_X_Event_Sync_Alarm
785{
786 Ecore_X_Time time;
787 Ecore_X_Sync_Alarm alarm;
788};
789
790struct _Ecore_X_Randr_Screen_Size
791{
792 int width, height;
793};
794
795struct _Ecore_X_Randr_Screen_Size_MM
796{
797 int width, height, width_mm, height_mm;
798};
799
800struct _Ecore_X_Event_Screen_Change
801{
802 Ecore_X_Window win;
803 Ecore_X_Window root;
804 Ecore_X_Randr_Screen_Size_MM size; /* in pixel and millimeters */
805 Ecore_X_Time time;
806 Ecore_X_Time config_time;
807 Ecore_X_Randr_Orientation orientation;
808 Ecore_X_Render_Subpixel_Order subpixel_order;
809 Ecore_X_Randr_Size_ID size_id;
810};
811
812struct _Ecore_X_Event_Randr_Crtc_Change
813{
814 Ecore_X_Window win;
815 Ecore_X_Randr_Crtc crtc;
816 Ecore_X_Randr_Mode mode;
817 Ecore_X_Randr_Orientation orientation;
818 Eina_Rectangle geo;
819};
820
821struct _Ecore_X_Event_Randr_Output_Change
822{
823 Ecore_X_Window win;
824 Ecore_X_Randr_Output output;
825 Ecore_X_Randr_Crtc crtc;
826 Ecore_X_Randr_Mode mode;
827 Ecore_X_Randr_Orientation orientation;
828 Ecore_X_Randr_Connection_Status connection;
829 Ecore_X_Render_Subpixel_Order subpixel_order;
830};
831
832struct _Ecore_X_Event_Randr_Output_Property_Notify
833{
834 Ecore_X_Window win;
835 Ecore_X_Randr_Output output;
836 Ecore_X_Atom property;
837 Ecore_X_Time time;
838 Ecore_X_Randr_Property_Change state;
839};
840
841struct _Ecore_X_Event_Window_Delete_Request
842{
843 Ecore_X_Window win;
844 Ecore_X_Time time;
845};
846
847struct _Ecore_X_Event_Startup_Sequence
848{
849 Ecore_X_Window win;
850};
851
852struct _Ecore_X_Event_Window_Move_Resize_Request
853{
854 Ecore_X_Window win;
855 int x, y;
856 int direction;
857 int button;
858 int source;
859};
860
861struct _Ecore_X_Event_Window_State_Request
862{
863 Ecore_X_Window win;
864 Ecore_X_Window_State_Action action;
865 Ecore_X_Window_State state[2];
866 int source;
867};
868
869struct _Ecore_X_Event_Frame_Extents_Request
870{
871 Ecore_X_Window win;
872};
873
874struct _Ecore_X_Event_Ping
875{
876 Ecore_X_Window win;
877 Ecore_X_Window event_win;
878 Ecore_X_Time time;
879};
880
881struct _Ecore_X_Event_Desktop_Change
882{
883 Ecore_X_Window win;
884 unsigned int desk;
885 int source;
886};
887
888struct _Ecore_X_Event_Generic
889{
890 int extension;
891 int evtype;
892 unsigned int cookie;
893 void *data;
894};
895
896EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on
897 backend in use, if Xlib will be XEvent,
898 if XCB will be xcb_generic_event_t.
899 @warning avoid using it.
900 */
901EAPI extern int ECORE_X_EVENT_MOUSE_IN;
902EAPI extern int ECORE_X_EVENT_MOUSE_OUT;
903EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_IN;
904EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_OUT;
905EAPI extern int ECORE_X_EVENT_WINDOW_KEYMAP;
906EAPI extern int ECORE_X_EVENT_WINDOW_DAMAGE;
907EAPI extern int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE;
908EAPI extern int ECORE_X_EVENT_WINDOW_CREATE;
909EAPI extern int ECORE_X_EVENT_WINDOW_DESTROY;
910EAPI extern int ECORE_X_EVENT_WINDOW_HIDE;
911EAPI extern int ECORE_X_EVENT_WINDOW_SHOW;
912EAPI extern int ECORE_X_EVENT_WINDOW_SHOW_REQUEST;
913EAPI extern int ECORE_X_EVENT_WINDOW_REPARENT;
914EAPI extern int ECORE_X_EVENT_WINDOW_CONFIGURE;
915EAPI extern int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST;
916EAPI extern int ECORE_X_EVENT_WINDOW_GRAVITY;
917EAPI extern int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST;
918EAPI extern int ECORE_X_EVENT_WINDOW_STACK;
919EAPI extern int ECORE_X_EVENT_WINDOW_STACK_REQUEST;
920EAPI extern int ECORE_X_EVENT_WINDOW_PROPERTY;
921EAPI extern int ECORE_X_EVENT_WINDOW_COLORMAP;
922EAPI extern int ECORE_X_EVENT_WINDOW_MAPPING;
923EAPI extern int ECORE_X_EVENT_MAPPING_CHANGE;
924EAPI extern int ECORE_X_EVENT_SELECTION_CLEAR;
925EAPI extern int ECORE_X_EVENT_SELECTION_REQUEST;
926EAPI extern int ECORE_X_EVENT_SELECTION_NOTIFY;
927EAPI extern int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY;
928EAPI extern int ECORE_X_EVENT_CLIENT_MESSAGE;
929EAPI extern int ECORE_X_EVENT_WINDOW_SHAPE;
930EAPI extern int ECORE_X_EVENT_SCREENSAVER_NOTIFY;
931EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK;
932EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_PAN;
933EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION;
934EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_TAP;
935EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD;
936EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD;
937EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP;
938EAPI extern int ECORE_X_EVENT_SYNC_COUNTER;
939EAPI extern int ECORE_X_EVENT_SYNC_ALARM;
940EAPI extern int ECORE_X_EVENT_SCREEN_CHANGE;
941EAPI extern int ECORE_X_EVENT_RANDR_CRTC_CHANGE;
942EAPI extern int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE;
943EAPI extern int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY;
944EAPI extern int ECORE_X_EVENT_DAMAGE_NOTIFY;
945
946EAPI extern int ECORE_X_EVENT_WINDOW_DELETE_REQUEST;
947
948EAPI extern int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST;
949EAPI extern int ECORE_X_EVENT_WINDOW_STATE_REQUEST;
950EAPI extern int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST;
951EAPI extern int ECORE_X_EVENT_PING;
952EAPI extern int ECORE_X_EVENT_DESKTOP_CHANGE;
953
954EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
955EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
956EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
957
958EAPI extern int ECORE_X_EVENT_GENERIC;
959
960EAPI extern int ECORE_X_EVENT_XDND_ENTER;
961EAPI extern int ECORE_X_EVENT_XDND_POSITION;
962EAPI extern int ECORE_X_EVENT_XDND_STATUS;
963EAPI extern int ECORE_X_EVENT_XDND_LEAVE;
964EAPI extern int ECORE_X_EVENT_XDND_DROP;
965EAPI extern int ECORE_X_EVENT_XDND_FINISHED;
966
967EAPI extern int ECORE_X_LOCK_SCROLL;
968EAPI extern int ECORE_X_LOCK_NUM;
969EAPI extern int ECORE_X_LOCK_CAPS;
970EAPI extern int ECORE_X_LOCK_SHIFT;
971
972typedef enum _Ecore_X_WM_Protocol
973{
974 /* If enabled the window manager will be asked to send a
975 * delete message instead of just closing (destroying) the window. */
976 ECORE_X_WM_PROTOCOL_DELETE_REQUEST,
977
978 /* If enabled the window manager will be told that the window
979 * explicitly sets input focus. */
980 ECORE_X_WM_PROTOCOL_TAKE_FOCUS,
981
982 /* If enabled the window manager can ping the window to check
983 * if it is alive. */
984 ECORE_X_NET_WM_PROTOCOL_PING,
985
986 /* If enabled the window manager can sync updating with the
987 * window (?) */
988 ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST,
989
990 /* Number of defined items */
991 ECORE_X_WM_PROTOCOL_NUM
992} Ecore_X_WM_Protocol;
993
994typedef enum _Ecore_X_Window_Input_Mode
995{
996 /* The window can never be focused */
997 ECORE_X_WINDOW_INPUT_MODE_NONE,
998
999 /* The window can be focused by the WM but doesn't focus itself */
1000 ECORE_X_WINDOW_INPUT_MODE_PASSIVE,
1001
1002 /* The window sets the focus itself if one of its sub-windows
1003 * already is focused */
1004 ECORE_X_WINDOW_INPUT_MODE_ACTIVE_LOCAL,
1005
1006 /* The window sets the focus itself even if another window
1007 * is currently focused */
1008 ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL
1009} Ecore_X_Window_Input_Mode;
1010
1011typedef enum _Ecore_X_Window_State_Hint
1012{
1013 /** Do not provide any state hint to the window manager */
1014 ECORE_X_WINDOW_STATE_HINT_NONE = -1,
1015
1016 /** The window wants to remain hidden and NOT iconified */
1017 ECORE_X_WINDOW_STATE_HINT_WITHDRAWN,
1018
1019 /** The window wants to be mapped normally */
1020 ECORE_X_WINDOW_STATE_HINT_NORMAL,
1021
1022 /** The window wants to start in an iconified state */
1023 ECORE_X_WINDOW_STATE_HINT_ICONIC
1024} Ecore_X_Window_State_Hint;
1025
1026typedef enum _Ecore_X_Window_Type
1027{
1028 ECORE_X_WINDOW_TYPE_UNKNOWN = 0,
1029 ECORE_X_WINDOW_TYPE_DESKTOP,
1030 ECORE_X_WINDOW_TYPE_DOCK,
1031 ECORE_X_WINDOW_TYPE_TOOLBAR,
1032 ECORE_X_WINDOW_TYPE_MENU,
1033 ECORE_X_WINDOW_TYPE_UTILITY,
1034 ECORE_X_WINDOW_TYPE_SPLASH,
1035 ECORE_X_WINDOW_TYPE_DIALOG,
1036 ECORE_X_WINDOW_TYPE_NORMAL,
1037 ECORE_X_WINDOW_TYPE_DROPDOWN_MENU,
1038 ECORE_X_WINDOW_TYPE_POPUP_MENU,
1039 ECORE_X_WINDOW_TYPE_TOOLTIP,
1040 ECORE_X_WINDOW_TYPE_NOTIFICATION,
1041 ECORE_X_WINDOW_TYPE_COMBO,
1042 ECORE_X_WINDOW_TYPE_DND
1043} Ecore_X_Window_Type;
1044
1045typedef enum _Ecore_X_Action
1046{
1047 ECORE_X_ACTION_MOVE,
1048 ECORE_X_ACTION_RESIZE,
1049 ECORE_X_ACTION_MINIMIZE,
1050 ECORE_X_ACTION_SHADE,
1051 ECORE_X_ACTION_STICK,
1052 ECORE_X_ACTION_MAXIMIZE_HORZ,
1053 ECORE_X_ACTION_MAXIMIZE_VERT,
1054 ECORE_X_ACTION_FULLSCREEN,
1055 ECORE_X_ACTION_CHANGE_DESKTOP,
1056 ECORE_X_ACTION_CLOSE,
1057 ECORE_X_ACTION_ABOVE,
1058 ECORE_X_ACTION_BELOW
1059} Ecore_X_Action;
1060
1061typedef enum _Ecore_X_Window_Configure_Mask
1062{
1063 ECORE_X_WINDOW_CONFIGURE_MASK_X = (1 << 0),
1064 ECORE_X_WINDOW_CONFIGURE_MASK_Y = (1 << 1),
1065 ECORE_X_WINDOW_CONFIGURE_MASK_W = (1 << 2),
1066 ECORE_X_WINDOW_CONFIGURE_MASK_H = (1 << 3),
1067 ECORE_X_WINDOW_CONFIGURE_MASK_BORDER_WIDTH = (1 << 4),
1068 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING = (1 << 5),
1069 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE = (1 << 6)
1070} Ecore_X_Window_Configure_Mask;
1071
1072typedef enum _Ecore_X_Virtual_Keyboard_State
1073{
1074 ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN = 0,
1075 ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF,
1076 ECORE_X_VIRTUAL_KEYBOARD_STATE_ON,
1077 ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA,
1078 ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC,
1079 ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN,
1080 ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER,
1081 ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX,
1082 ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL,
1083 ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD,
1084 ECORE_X_VIRTUAL_KEYBOARD_STATE_IP,
1085 ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST,
1086 ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE,
1087 ECORE_X_VIRTUAL_KEYBOARD_STATE_URL,
1088 ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD,
1089 ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME
1090} Ecore_X_Virtual_Keyboard_State;
1091
1092typedef enum _Ecore_X_Illume_Mode
1093{
1094 ECORE_X_ILLUME_MODE_UNKNOWN = 0,
1095 ECORE_X_ILLUME_MODE_SINGLE,
1096 ECORE_X_ILLUME_MODE_DUAL_TOP,
1097 ECORE_X_ILLUME_MODE_DUAL_LEFT
1098} Ecore_X_Illume_Mode;
1099
1100typedef enum _Ecore_X_Illume_Quickpanel_State
1101{
1102 ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN = 0,
1103 ECORE_X_ILLUME_QUICKPANEL_STATE_OFF,
1104 ECORE_X_ILLUME_QUICKPANEL_STATE_ON
1105} Ecore_X_Illume_Quickpanel_State;
1106
1107typedef enum _Ecore_X_Illume_Indicator_State
1108{
1109 ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN = 0,
1110 ECORE_X_ILLUME_INDICATOR_STATE_OFF,
1111 ECORE_X_ILLUME_INDICATOR_STATE_ON
1112} Ecore_X_Illume_Indicator_State;
1113
1114typedef enum _Ecore_X_Illume_Clipboard_State
1115{
1116 ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN = 0,
1117 ECORE_X_ILLUME_CLIPBOARD_STATE_OFF,
1118 ECORE_X_ILLUME_CLIPBOARD_STATE_ON
1119} Ecore_X_Illume_Clipboard_State;
1120
1121typedef enum _Ecore_X_Illume_Indicator_Opacity_Mode
1122{
1123 ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN = 0,
1124 ECORE_X_ILLUME_INDICATOR_OPAQUE,
1125 ECORE_X_ILLUME_INDICATOR_TRANSLUCENT,
1126 ECORE_X_ILLUME_INDICATOR_TRANSPARENT
1127} Ecore_X_Illume_Indicator_Opacity_Mode;
1128
1129/* Window layer constants */
1130#define ECORE_X_WINDOW_LAYER_BELOW 2
1131#define ECORE_X_WINDOW_LAYER_NORMAL 4
1132#define ECORE_X_WINDOW_LAYER_ABOVE 6
1133
1134/* Property list operations */
1135#define ECORE_X_PROP_LIST_REMOVE 0
1136#define ECORE_X_PROP_LIST_ADD 1
1137#define ECORE_X_PROP_LIST_TOGGLE 2
1138
1139EAPI int
1140 ecore_x_init(const char *name);
1141EAPI int
1142 ecore_x_shutdown(void);
1143EAPI int
1144 ecore_x_disconnect(void);
1145EAPI Ecore_X_Display *
1146 ecore_x_display_get(void);
1147EAPI Ecore_X_Connection *
1148 ecore_x_connection_get(void);
1149EAPI int
1150 ecore_x_fd_get(void);
1151EAPI Ecore_X_Screen *
1152 ecore_x_default_screen_get(void);
1153EAPI void
1154 ecore_x_screen_size_get(const Ecore_X_Screen *screen,
1155 int *w,
1156 int *h);
1157EAPI int
1158 ecore_x_screen_count_get(void);
1159EAPI int
1160 ecore_x_screen_index_get(const Ecore_X_Screen *screen);
1161EAPI Ecore_X_Screen *
1162 ecore_x_screen_get(int index);
1163
1164EAPI void
1165 ecore_x_double_click_time_set(double t);
1166EAPI double
1167 ecore_x_double_click_time_get(void);
1168EAPI void
1169 ecore_x_flush(void);
1170EAPI void
1171 ecore_x_sync(void);
1172EAPI void
1173 ecore_x_killall(Ecore_X_Window root);
1174EAPI void
1175 ecore_x_kill(Ecore_X_Window win);
1176EAPI int
1177 ecore_x_dpi_get(void);
1178EAPI Eina_Bool
1179 ecore_x_bell(int percent);
1180EAPI unsigned int
1181 ecore_x_visual_id_get(Ecore_X_Visual visual);
1182
1183EAPI Ecore_X_Visual
1184ecore_x_default_visual_get(Ecore_X_Display *disp,
1185 Ecore_X_Screen *screen);
1186EAPI Ecore_X_Colormap
1187ecore_x_default_colormap_get(Ecore_X_Display *disp,
1188 Ecore_X_Screen *screen);
1189EAPI int
1190ecore_x_default_depth_get(Ecore_X_Display *disp,
1191 Ecore_X_Screen *screen);
1192
1193EAPI Ecore_X_Time
1194ecore_x_current_time_get(void);
1195
1196EAPI void
1197ecore_x_error_handler_set(void (*func)(void *data),
1198 const void *data);
1199EAPI void
1200ecore_x_io_error_handler_set(void (*func)(void *data),
1201 const void *data);
1202EAPI int
1203 ecore_x_error_request_get(void);
1204EAPI int
1205 ecore_x_error_code_get(void);
1206EAPI Ecore_X_ID
1207ecore_x_error_resource_id_get(void);
1208
1209EAPI void
1210ecore_x_event_mask_set(Ecore_X_Window w,
1211 Ecore_X_Event_Mask mask);
1212EAPI void
1213ecore_x_event_mask_unset(Ecore_X_Window w,
1214 Ecore_X_Event_Mask mask);
1215
1216EAPI Eina_Bool
1217ecore_x_selection_notify_send(Ecore_X_Window requestor,
1218 Ecore_X_Atom selection,
1219 Ecore_X_Atom target,
1220 Ecore_X_Atom property,
1221 Ecore_X_Time time);
1222EAPI Eina_Bool
1223ecore_x_selection_primary_set(Ecore_X_Window w,
1224 const void *data,
1225 int size);
1226EAPI Eina_Bool
1227 ecore_x_selection_primary_clear(void);
1228EAPI Eina_Bool
1229 ecore_x_selection_secondary_set(Ecore_X_Window w,
1230 const void *data,
1231 int size);
1232EAPI Eina_Bool
1233 ecore_x_selection_secondary_clear(void);
1234EAPI Eina_Bool
1235 ecore_x_selection_xdnd_set(Ecore_X_Window w,
1236 const void *data,
1237 int size);
1238EAPI Eina_Bool
1239 ecore_x_selection_xdnd_clear(void);
1240EAPI Eina_Bool
1241 ecore_x_selection_clipboard_set(Ecore_X_Window w,
1242 const void *data,
1243 int size);
1244EAPI Eina_Bool
1245 ecore_x_selection_clipboard_clear(void);
1246EAPI void
1247 ecore_x_selection_primary_request(Ecore_X_Window w,
1248 const char *target);
1249EAPI void
1250ecore_x_selection_secondary_request(Ecore_X_Window w,
1251 const char *target);
1252EAPI void
1253ecore_x_selection_xdnd_request(Ecore_X_Window w,
1254 const char *target);
1255EAPI void
1256ecore_x_selection_clipboard_request(Ecore_X_Window w,
1257 const char *target);
1258EAPI Eina_Bool
1259ecore_x_selection_convert(Ecore_X_Atom selection,
1260 Ecore_X_Atom target,
1261 void **data_ret,
1262 int *len,
1263 Ecore_X_Atom *targprop,
1264 int *targsize);
1265EAPI void
1266ecore_x_selection_converter_add(char *target,
1267 Eina_Bool (*func)(char *target,
1268 void *data,
1269 int size,
1270 void **data_ret,
1271 int *size_ret,
1272 Ecore_X_Atom *,
1273 int *));
1274EAPI void
1275ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
1276 Eina_Bool (*func)(char *target,
1277 void *data,
1278 int size,
1279 void **data_ret,
1280 int *size_ret,
1281 Ecore_X_Atom *tprop,
1282 int *tsize));
1283EAPI void
1284 ecore_x_selection_converter_del(char *target);
1285EAPI void
1286 ecore_x_selection_converter_atom_del(Ecore_X_Atom target);
1287EAPI void
1288 ecore_x_selection_parser_add(const char *target,
1289 void *(*func)(const char *target, void *data, int size, int format));
1290EAPI void
1291 ecore_x_selection_parser_del(const char *target);
1292EAPI void
1293 ecore_x_selection_owner_set(Ecore_X_Window win,
1294 Ecore_X_Atom atom,
1295 Ecore_X_Time tm);
1296EAPI Ecore_X_Window
1297ecore_x_selection_owner_get(Ecore_X_Atom atom);
1298
1299EAPI void
1300ecore_x_dnd_aware_set(Ecore_X_Window win,
1301 Eina_Bool on);
1302EAPI int
1303 ecore_x_dnd_version_get(Ecore_X_Window win);
1304EAPI Eina_Bool
1305 ecore_x_dnd_type_isset(Ecore_X_Window win,
1306 const char *type);
1307EAPI void
1308ecore_x_dnd_type_set(Ecore_X_Window win,
1309 const char *type,
1310 Eina_Bool on);
1311EAPI void
1312ecore_x_dnd_types_set(Ecore_X_Window win,
1313 const char **types,
1314 unsigned int num_types);
1315EAPI void
1316ecore_x_dnd_actions_set(Ecore_X_Window win,
1317 Ecore_X_Atom *actions,
1318 unsigned int num_actions);
1319EAPI Eina_Bool
1320ecore_x_dnd_begin(Ecore_X_Window source,
1321 unsigned char *data,
1322 int size);
1323EAPI Eina_Bool
1324 ecore_x_dnd_drop(void);
1325EAPI void
1326 ecore_x_dnd_send_status(Eina_Bool will_accept,
1327 Eina_Bool suppress,
1328 Ecore_X_Rectangle rectangle,
1329 Ecore_X_Atom action);
1330EAPI void
1331 ecore_x_dnd_send_finished(void);
1332EAPI void
1333 ecore_x_dnd_source_action_set(Ecore_X_Atom action);
1334EAPI Ecore_X_Atom
1335 ecore_x_dnd_source_action_get(void);
1336EAPI void
1337 ecore_x_dnd_callback_pos_update_set(void (*cb)(void *,
1338 Ecore_X_Xdnd_Position *data),
1339 const void *data);
1340
1341EAPI Ecore_X_Window
1342ecore_x_window_new(Ecore_X_Window parent,
1343 int x,
1344 int y,
1345 int w,
1346 int h);
1347EAPI Ecore_X_Window
1348ecore_x_window_override_new(Ecore_X_Window parent,
1349 int x,
1350 int y,
1351 int w,
1352 int h);
1353EAPI int
1354 ecore_x_window_argb_get(Ecore_X_Window win);
1355EAPI Ecore_X_Window
1356 ecore_x_window_manager_argb_new(Ecore_X_Window parent,
1357 int x,
1358 int y,
1359 int w,
1360 int h);
1361EAPI Ecore_X_Window
1362ecore_x_window_argb_new(Ecore_X_Window parent,
1363 int x,
1364 int y,
1365 int w,
1366 int h);
1367EAPI Ecore_X_Window
1368ecore_x_window_override_argb_new(Ecore_X_Window parent,
1369 int x,
1370 int y,
1371 int w,
1372 int h);
1373EAPI Ecore_X_Window
1374ecore_x_window_input_new(Ecore_X_Window parent,
1375 int x,
1376 int y,
1377 int w,
1378 int h);
1379EAPI void
1380ecore_x_window_configure(Ecore_X_Window win,
1381 Ecore_X_Window_Configure_Mask mask,
1382 int x,
1383 int y,
1384 int w,
1385 int h,
1386 int border_width,
1387 Ecore_X_Window sibling,
1388 int stack_mode);
1389EAPI void
1390ecore_x_window_cursor_set(Ecore_X_Window win,
1391 Ecore_X_Cursor c);
1392EAPI void
1393 ecore_x_window_free(Ecore_X_Window win);
1394EAPI void
1395 ecore_x_window_ignore_set(Ecore_X_Window win,
1396 int ignore);
1397EAPI Ecore_X_Window *
1398ecore_x_window_ignore_list(int *num);
1399
1400EAPI void
1401 ecore_x_window_delete_request_send(Ecore_X_Window win);
1402EAPI void
1403 ecore_x_window_show(Ecore_X_Window win);
1404EAPI void
1405 ecore_x_window_hide(Ecore_X_Window win);
1406EAPI void
1407 ecore_x_window_move(Ecore_X_Window win,
1408 int x,
1409 int y);
1410EAPI void
1411ecore_x_window_resize(Ecore_X_Window win,
1412 int w,
1413 int h);
1414EAPI void
1415ecore_x_window_move_resize(Ecore_X_Window win,
1416 int x,
1417 int y,
1418 int w,
1419 int h);
1420EAPI void
1421 ecore_x_window_focus(Ecore_X_Window win);
1422EAPI void
1423 ecore_x_window_focus_at_time(Ecore_X_Window win,
1424 Ecore_X_Time t);
1425EAPI Ecore_X_Window
1426 ecore_x_window_focus_get(void);
1427EAPI void
1428 ecore_x_window_raise(Ecore_X_Window win);
1429EAPI void
1430 ecore_x_window_lower(Ecore_X_Window win);
1431EAPI void
1432 ecore_x_window_reparent(Ecore_X_Window win,
1433 Ecore_X_Window new_parent,
1434 int x,
1435 int y);
1436EAPI void
1437ecore_x_window_size_get(Ecore_X_Window win,
1438 int *w,
1439 int *h);
1440EAPI void
1441ecore_x_window_geometry_get(Ecore_X_Window win,
1442 int *x,
1443 int *y,
1444 int *w,
1445 int *h);
1446EAPI int
1447 ecore_x_window_border_width_get(Ecore_X_Window win);
1448EAPI void
1449 ecore_x_window_border_width_set(Ecore_X_Window win,
1450 int width);
1451EAPI int
1452 ecore_x_window_depth_get(Ecore_X_Window win);
1453EAPI void
1454 ecore_x_window_cursor_show(Ecore_X_Window win,
1455 Eina_Bool show);
1456EAPI void
1457 ecore_x_window_defaults_set(Ecore_X_Window win);
1458EAPI int
1459 ecore_x_window_visible_get(Ecore_X_Window win);
1460EAPI Ecore_X_Window
1461 ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base,
1462 int x,
1463 int y,
1464 Ecore_X_Window *skip,
1465 int skip_num);
1466EAPI Ecore_X_Window
1467ecore_x_window_shadow_parent_get(Ecore_X_Window root,
1468 Ecore_X_Window win);
1469EAPI void
1470 ecore_x_window_shadow_tree_flush(void);
1471EAPI Ecore_X_Window
1472 ecore_x_window_root_get(Ecore_X_Window win);
1473EAPI Ecore_X_Window
1474 ecore_x_window_at_xy_get(int x,
1475 int y);
1476EAPI Ecore_X_Window
1477ecore_x_window_at_xy_with_skip_get(int x,
1478 int y,
1479 Ecore_X_Window *skip,
1480 int skip_num);
1481EAPI Ecore_X_Window
1482ecore_x_window_at_xy_begin_get(Ecore_X_Window begin,
1483 int x,
1484 int y);
1485EAPI Ecore_X_Window
1486ecore_x_window_parent_get(Ecore_X_Window win);
1487
1488EAPI void
1489ecore_x_window_background_color_set(Ecore_X_Window win,
1490 unsigned short r,
1491 unsigned short g,
1492 unsigned short b);
1493EAPI void
1494ecore_x_window_gravity_set(Ecore_X_Window win,
1495 Ecore_X_Gravity grav);
1496EAPI void
1497ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
1498 Ecore_X_Gravity grav);
1499EAPI void
1500ecore_x_window_pixmap_set(Ecore_X_Window win,
1501 Ecore_X_Pixmap pmap);
1502EAPI void
1503ecore_x_window_area_clear(Ecore_X_Window win,
1504 int x,
1505 int y,
1506 int w,
1507 int h);
1508EAPI void
1509ecore_x_window_area_expose(Ecore_X_Window win,
1510 int x,
1511 int y,
1512 int w,
1513 int h);
1514EAPI void
1515ecore_x_window_override_set(Ecore_X_Window win,
1516 Eina_Bool override);
1517
1518EAPI void
1519ecore_x_window_prop_card32_set(Ecore_X_Window win,
1520 Ecore_X_Atom atom,
1521 unsigned int *val,
1522 unsigned int num);
1523EAPI int
1524ecore_x_window_prop_card32_get(Ecore_X_Window win,
1525 Ecore_X_Atom atom,
1526 unsigned int *val,
1527 unsigned int len);
1528EAPI int
1529ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
1530 Ecore_X_Atom atom,
1531 unsigned int **plst);
1532
1533EAPI void
1534ecore_x_window_prop_xid_set(Ecore_X_Window win,
1535 Ecore_X_Atom atom,
1536 Ecore_X_Atom type,
1537 Ecore_X_ID *lst,
1538 unsigned int num);
1539EAPI int
1540ecore_x_window_prop_xid_get(Ecore_X_Window win,
1541 Ecore_X_Atom atom,
1542 Ecore_X_Atom type,
1543 Ecore_X_ID *lst,
1544 unsigned int len);
1545EAPI int
1546ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
1547 Ecore_X_Atom atom,
1548 Ecore_X_Atom type,
1549 Ecore_X_ID **plst);
1550EAPI void
1551ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
1552 Ecore_X_Atom atom,
1553 Ecore_X_Atom type,
1554 Ecore_X_ID item,
1555 int op);
1556EAPI void
1557ecore_x_window_prop_atom_set(Ecore_X_Window win,
1558 Ecore_X_Atom atom,
1559 Ecore_X_Atom *val,
1560 unsigned int num);
1561EAPI int
1562ecore_x_window_prop_atom_get(Ecore_X_Window win,
1563 Ecore_X_Atom atom,
1564 Ecore_X_Atom *val,
1565 unsigned int len);
1566EAPI int
1567ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
1568 Ecore_X_Atom atom,
1569 Ecore_X_Atom **plst);
1570EAPI void
1571ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
1572 Ecore_X_Atom atom,
1573 Ecore_X_Atom item,
1574 int op);
1575EAPI void
1576ecore_x_window_prop_window_set(Ecore_X_Window win,
1577 Ecore_X_Atom atom,
1578 Ecore_X_Window *val,
1579 unsigned int num);
1580EAPI int
1581ecore_x_window_prop_window_get(Ecore_X_Window win,
1582 Ecore_X_Atom atom,
1583 Ecore_X_Window *val,
1584 unsigned int len);
1585EAPI int
1586ecore_x_window_prop_window_list_get(Ecore_X_Window win,
1587 Ecore_X_Atom atom,
1588 Ecore_X_Window **plst);
1589
1590EAPI Ecore_X_Atom
1591 ecore_x_window_prop_any_type(void);
1592EAPI void
1593 ecore_x_window_prop_property_set(Ecore_X_Window win,
1594 Ecore_X_Atom type,
1595 Ecore_X_Atom format,
1596 int size,
1597 void *data,
1598 int number);
1599EAPI int
1600ecore_x_window_prop_property_get(Ecore_X_Window win,
1601 Ecore_X_Atom property,
1602 Ecore_X_Atom type,
1603 int size,
1604 unsigned char **data,
1605 int *num);
1606EAPI void
1607ecore_x_window_prop_property_del(Ecore_X_Window win,
1608 Ecore_X_Atom property);
1609EAPI Ecore_X_Atom *
1610ecore_x_window_prop_list(Ecore_X_Window win,
1611 int *num_ret);
1612EAPI void
1613ecore_x_window_prop_string_set(Ecore_X_Window win,
1614 Ecore_X_Atom type,
1615 const char *str);
1616EAPI char *
1617ecore_x_window_prop_string_get(Ecore_X_Window win,
1618 Ecore_X_Atom type);
1619EAPI Eina_Bool
1620ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
1621 Ecore_X_WM_Protocol protocol);
1622EAPI Ecore_X_WM_Protocol *
1623ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
1624 int *num_ret);
1625
1626EAPI void
1627ecore_x_window_shape_mask_set(Ecore_X_Window win,
1628 Ecore_X_Pixmap mask);
1629EAPI void
1630ecore_x_window_shape_window_set(Ecore_X_Window win,
1631 Ecore_X_Window shape_win);
1632EAPI void
1633ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
1634 Ecore_X_Window shape_win,
1635 int x,
1636 int y);
1637EAPI void
1638ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
1639 int x,
1640 int y,
1641 int w,
1642 int h);
1643EAPI void
1644ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
1645 Ecore_X_Rectangle *rects,
1646 int num);
1647EAPI void
1648ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
1649 int x,
1650 int y,
1651 int w,
1652 int h);
1653EAPI void
1654ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
1655 Ecore_X_Rectangle *rects,
1656 int num);
1657EAPI void
1658ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
1659 int x,
1660 int y,
1661 int w,
1662 int h);
1663EAPI void
1664ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
1665 int x,
1666 int y,
1667 int w,
1668 int h);
1669EAPI void
1670ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
1671 int x,
1672 int y,
1673 int w,
1674 int h);
1675EAPI void
1676ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
1677 Ecore_X_Window shape_win,
1678 int x,
1679 int y);
1680EAPI void
1681ecore_x_window_shape_input_window_set(Ecore_X_Window win,
1682 Ecore_X_Window shape_win);
1683EAPI void
1684ecore_x_window_shape_window_add(Ecore_X_Window win,
1685 Ecore_X_Window shape_win);
1686EAPI void
1687ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
1688 Ecore_X_Window shape_win,
1689 int x,
1690 int y);
1691EAPI void
1692ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
1693 Ecore_X_Window shape_win,
1694 int x,
1695 int y);
1696EAPI void
1697ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
1698 int x,
1699 int y,
1700 int w,
1701 int h);
1702EAPI void
1703ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
1704 int x,
1705 int y,
1706 int w,
1707 int h);
1708EAPI void
1709ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
1710 int x,
1711 int y,
1712 int w,
1713 int h);
1714EAPI void
1715ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
1716 Ecore_X_Rectangle *rects,
1717 int num);
1718EAPI void
1719ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
1720 Ecore_X_Rectangle *rects,
1721 int num);
1722EAPI Ecore_X_Rectangle *
1723ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
1724 int *num_ret);
1725EAPI Ecore_X_Rectangle *
1726ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
1727 int *num_ret);
1728EAPI void
1729ecore_x_window_shape_events_select(Ecore_X_Window win,
1730 Eina_Bool on);
1731EAPI void
1732ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
1733 Ecore_X_Pixmap mask);
1734
1735EAPI Ecore_X_Pixmap
1736ecore_x_pixmap_new(Ecore_X_Window win,
1737 int w,
1738 int h,
1739 int dep);
1740EAPI void
1741 ecore_x_pixmap_free(Ecore_X_Pixmap pmap);
1742EAPI void
1743 ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
1744 Ecore_X_Drawable dest,
1745 Ecore_X_GC gc,
1746 int sx,
1747 int sy,
1748 int w,
1749 int h,
1750 int dx,
1751 int dy);
1752EAPI void
1753ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
1754 int *x,
1755 int *y,
1756 int *w,
1757 int *h);
1758EAPI int
1759ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap);
1760
1761EAPI Ecore_X_GC
1762ecore_x_gc_new(Ecore_X_Drawable draw,
1763 Ecore_X_GC_Value_Mask value_mask,
1764 const unsigned int *value_list);
1765EAPI void
1766 ecore_x_gc_free(Ecore_X_GC gc);
1767EAPI void
1768 ecore_x_gc_foreground_set(Ecore_X_GC gc,
1769 unsigned long foreground);
1770EAPI void
1771ecore_x_gc_background_set(Ecore_X_GC gc,
1772 unsigned long background);
1773
1774EAPI Eina_Bool
1775ecore_x_client_message32_send(Ecore_X_Window win,
1776 Ecore_X_Atom type,
1777 Ecore_X_Event_Mask mask,
1778 long d0,
1779 long d1,
1780 long d2,
1781 long d3,
1782 long d4);
1783EAPI Eina_Bool
1784ecore_x_client_message8_send(Ecore_X_Window win,
1785 Ecore_X_Atom type,
1786 const void *data,
1787 int len);
1788EAPI Eina_Bool
1789ecore_x_mouse_move_send(Ecore_X_Window win,
1790 int x,
1791 int y);
1792EAPI Eina_Bool
1793ecore_x_mouse_down_send(Ecore_X_Window win,
1794 int x,
1795 int y,
1796 int b);
1797EAPI Eina_Bool
1798ecore_x_mouse_up_send(Ecore_X_Window win,
1799 int x,
1800 int y,
1801 int b);
1802
1803EAPI void
1804ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
1805 int *x,
1806 int *y,
1807 int *w,
1808 int *h);
1809EAPI int
1810 ecore_x_drawable_border_width_get(Ecore_X_Drawable d);
1811EAPI int
1812 ecore_x_drawable_depth_get(Ecore_X_Drawable d);
1813EAPI void
1814 ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
1815 Ecore_X_GC gc,
1816 int x,
1817 int y,
1818 int width,
1819 int height);
1820
1821EAPI Eina_Bool
1822 ecore_x_cursor_color_supported_get(void);
1823EAPI Ecore_X_Cursor
1824 ecore_x_cursor_new(Ecore_X_Window win,
1825 int *pixels,
1826 int w,
1827 int h,
1828 int hot_x,
1829 int hot_y);
1830EAPI void
1831 ecore_x_cursor_free(Ecore_X_Cursor c);
1832EAPI Ecore_X_Cursor
1833 ecore_x_cursor_shape_get(int shape);
1834EAPI void
1835 ecore_x_cursor_size_set(int size);
1836EAPI int
1837 ecore_x_cursor_size_get(void);
1838
1839/* FIXME: these funcs need categorising */
1840EAPI Ecore_X_Window *
1841 ecore_x_window_root_list(int *num_ret);
1842EAPI Ecore_X_Window
1843 ecore_x_window_root_first_get(void);
1844EAPI Eina_Bool
1845 ecore_x_window_manage(Ecore_X_Window win);
1846EAPI void
1847 ecore_x_window_container_manage(Ecore_X_Window win);
1848EAPI void
1849 ecore_x_window_client_manage(Ecore_X_Window win);
1850EAPI void
1851 ecore_x_window_sniff(Ecore_X_Window win);
1852EAPI void
1853 ecore_x_window_client_sniff(Ecore_X_Window win);
1854
1855EAPI Ecore_X_Atom
1856 ecore_x_atom_get(const char *name);
1857EAPI void
1858 ecore_x_atoms_get(const char **names,
1859 int num,
1860 Ecore_X_Atom *atoms);
1861EAPI char *
1862ecore_x_atom_name_get(Ecore_X_Atom atom);
1863
1864EAPI void
1865 ecore_x_icccm_init(void);
1866EAPI void
1867 ecore_x_icccm_state_set(Ecore_X_Window win,
1868 Ecore_X_Window_State_Hint state);
1869EAPI Ecore_X_Window_State_Hint
1870 ecore_x_icccm_state_get(Ecore_X_Window win);
1871EAPI void
1872 ecore_x_icccm_delete_window_send(Ecore_X_Window win,
1873 Ecore_X_Time t);
1874EAPI void
1875ecore_x_icccm_take_focus_send(Ecore_X_Window win,
1876 Ecore_X_Time t);
1877EAPI void
1878ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
1879 Ecore_X_Time t);
1880EAPI void
1881ecore_x_icccm_move_resize_send(Ecore_X_Window win,
1882 int x,
1883 int y,
1884 int w,
1885 int h);
1886EAPI void
1887ecore_x_icccm_hints_set(Ecore_X_Window win,
1888 Eina_Bool accepts_focus,
1889 Ecore_X_Window_State_Hint initial_state,
1890 Ecore_X_Pixmap icon_pixmap,
1891 Ecore_X_Pixmap icon_mask,
1892 Ecore_X_Window icon_window,
1893 Ecore_X_Window window_group,
1894 Eina_Bool is_urgent);
1895EAPI Eina_Bool
1896ecore_x_icccm_hints_get(Ecore_X_Window win,
1897 Eina_Bool *accepts_focus,
1898 Ecore_X_Window_State_Hint *initial_state,
1899 Ecore_X_Pixmap *icon_pixmap,
1900 Ecore_X_Pixmap *icon_mask,
1901 Ecore_X_Window *icon_window,
1902 Ecore_X_Window *window_group,
1903 Eina_Bool *is_urgent);
1904EAPI void
1905ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
1906 Eina_Bool request_pos,
1907 Ecore_X_Gravity gravity,
1908 int min_w,
1909 int min_h,
1910 int max_w,
1911 int max_h,
1912 int base_w,
1913 int base_h,
1914 int step_x,
1915 int step_y,
1916 double min_aspect,
1917 double max_aspect);
1918EAPI Eina_Bool
1919ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
1920 Eina_Bool *request_pos,
1921 Ecore_X_Gravity *gravity,
1922 int *min_w,
1923 int *min_h,
1924 int *max_w,
1925 int *max_h,
1926 int *base_w,
1927 int *base_h,
1928 int *step_x,
1929 int *step_y,
1930 double *min_aspect,
1931 double *max_aspect);
1932EAPI void
1933ecore_x_icccm_title_set(Ecore_X_Window win,
1934 const char *t);
1935EAPI char *
1936 ecore_x_icccm_title_get(Ecore_X_Window win);
1937EAPI void
1938 ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
1939 Ecore_X_Atom *protos,
1940 int num);
1941EAPI void
1942ecore_x_icccm_protocol_set(Ecore_X_Window win,
1943 Ecore_X_WM_Protocol protocol,
1944 Eina_Bool on);
1945EAPI Eina_Bool
1946ecore_x_icccm_protocol_isset(Ecore_X_Window win,
1947 Ecore_X_WM_Protocol protocol);
1948EAPI void
1949ecore_x_icccm_name_class_set(Ecore_X_Window win,
1950 const char *n,
1951 const char *c);
1952EAPI void
1953ecore_x_icccm_name_class_get(Ecore_X_Window win,
1954 char **n,
1955 char **c);
1956EAPI char *
1957 ecore_x_icccm_client_machine_get(Ecore_X_Window win);
1958EAPI void
1959 ecore_x_icccm_command_set(Ecore_X_Window win,
1960 int argc,
1961 char **argv);
1962EAPI void
1963ecore_x_icccm_command_get(Ecore_X_Window win,
1964 int *argc,
1965 char ***argv);
1966EAPI char *
1967 ecore_x_icccm_icon_name_get(Ecore_X_Window win);
1968EAPI void
1969 ecore_x_icccm_icon_name_set(Ecore_X_Window win,
1970 const char *t);
1971EAPI void
1972ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
1973 Ecore_X_Window subwin);
1974EAPI void
1975ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
1976 Ecore_X_Window subwin);
1977EAPI void
1978ecore_x_icccm_transient_for_set(Ecore_X_Window win,
1979 Ecore_X_Window forwin);
1980EAPI void
1981 ecore_x_icccm_transient_for_unset(Ecore_X_Window win);
1982EAPI Ecore_X_Window
1983 ecore_x_icccm_transient_for_get(Ecore_X_Window win);
1984EAPI void
1985 ecore_x_icccm_window_role_set(Ecore_X_Window win,
1986 const char *role);
1987EAPI char *
1988 ecore_x_icccm_window_role_get(Ecore_X_Window win);
1989EAPI void
1990 ecore_x_icccm_client_leader_set(Ecore_X_Window win,
1991 Ecore_X_Window l);
1992EAPI Ecore_X_Window
1993 ecore_x_icccm_client_leader_get(Ecore_X_Window win);
1994EAPI void
1995 ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
1996 Ecore_X_Window root);
1997
1998typedef enum _Ecore_X_MWM_Hint_Func
1999{
2000 ECORE_X_MWM_HINT_FUNC_ALL = (1 << 0),
2001 ECORE_X_MWM_HINT_FUNC_RESIZE = (1 << 1),
2002 ECORE_X_MWM_HINT_FUNC_MOVE = (1 << 2),
2003 ECORE_X_MWM_HINT_FUNC_MINIMIZE = (1 << 3),
2004 ECORE_X_MWM_HINT_FUNC_MAXIMIZE = (1 << 4),
2005 ECORE_X_MWM_HINT_FUNC_CLOSE = (1 << 5)
2006} Ecore_X_MWM_Hint_Func;
2007
2008typedef enum _Ecore_X_MWM_Hint_Decor
2009{
2010 ECORE_X_MWM_HINT_DECOR_ALL = (1 << 0),
2011 ECORE_X_MWM_HINT_DECOR_BORDER = (1 << 1),
2012 ECORE_X_MWM_HINT_DECOR_RESIZEH = (1 << 2),
2013 ECORE_X_MWM_HINT_DECOR_TITLE = (1 << 3),
2014 ECORE_X_MWM_HINT_DECOR_MENU = (1 << 4),
2015 ECORE_X_MWM_HINT_DECOR_MINIMIZE = (1 << 5),
2016 ECORE_X_MWM_HINT_DECOR_MAXIMIZE = (1 << 6)
2017} Ecore_X_MWM_Hint_Decor;
2018
2019typedef enum _Ecore_X_MWM_Hint_Input
2020{
2021 ECORE_X_MWM_HINT_INPUT_MODELESS = 0,
2022 ECORE_X_MWM_HINT_INPUT_PRIMARY_APPLICATION_MODAL = 1,
2023 ECORE_X_MWM_HINT_INPUT_SYSTEM_MODAL = 2,
2024 ECORE_X_MWM_HINT_INPUT_FULL_APPLICATION_MODAL = 3
2025} Ecore_X_MWM_Hint_Input;
2026
2027EAPI Eina_Bool
2028ecore_x_mwm_hints_get(Ecore_X_Window win,
2029 Ecore_X_MWM_Hint_Func *fhint,
2030 Ecore_X_MWM_Hint_Decor *dhint,
2031 Ecore_X_MWM_Hint_Input *ihint);
2032EAPI void
2033ecore_x_mwm_borderless_set(Ecore_X_Window win,
2034 Eina_Bool borderless);
2035
2036/* netwm */
2037EAPI void
2038 ecore_x_netwm_init(void);
2039EAPI void
2040 ecore_x_netwm_shutdown(void);
2041EAPI void
2042 ecore_x_netwm_wm_identify(Ecore_X_Window root,
2043 Ecore_X_Window check,
2044 const char *wm_name);
2045EAPI void
2046ecore_x_netwm_supported_set(Ecore_X_Window root,
2047 Ecore_X_Atom *supported,
2048 int num);
2049EAPI Eina_Bool
2050ecore_x_netwm_supported_get(Ecore_X_Window root,
2051 Ecore_X_Atom **supported,
2052 int *num);
2053EAPI void
2054ecore_x_netwm_desk_count_set(Ecore_X_Window root,
2055 unsigned int n_desks);
2056EAPI void
2057ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
2058 Ecore_X_Window *vroots,
2059 unsigned int n_desks);
2060EAPI void
2061ecore_x_netwm_desk_names_set(Ecore_X_Window root,
2062 const char **names,
2063 unsigned int n_desks);
2064EAPI void
2065ecore_x_netwm_desk_size_set(Ecore_X_Window root,
2066 unsigned int width,
2067 unsigned int height);
2068EAPI void
2069ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
2070 unsigned int *areas,
2071 unsigned int n_desks);
2072EAPI unsigned int *
2073ecore_x_netwm_desk_workareas_get(Ecore_X_Window root,
2074 unsigned int *n_desks);
2075EAPI void
2076ecore_x_netwm_desk_current_set(Ecore_X_Window root,
2077 unsigned int desk);
2078EAPI void
2079ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
2080 unsigned int *origins,
2081 unsigned int n_desks);
2082EAPI void
2083ecore_x_netwm_desk_layout_set(Ecore_X_Window root,
2084 int orientation,
2085 int columns,
2086 int rows,
2087 int starting_corner);
2088EAPI void
2089ecore_x_netwm_showing_desktop_set(Ecore_X_Window root,
2090 Eina_Bool on);
2091EAPI void
2092ecore_x_netwm_client_list_set(Ecore_X_Window root,
2093 Ecore_X_Window *p_clients,
2094 unsigned int n_clients);
2095EAPI void
2096ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
2097 Ecore_X_Window *p_clients,
2098 unsigned int n_clients);
2099EAPI void
2100ecore_x_netwm_client_active_set(Ecore_X_Window root,
2101 Ecore_X_Window win);
2102EAPI void
2103ecore_x_netwm_client_active_request(Ecore_X_Window root,
2104 Ecore_X_Window win,
2105 int type,
2106 Ecore_X_Window current_win);
2107EAPI void
2108ecore_x_netwm_name_set(Ecore_X_Window win,
2109 const char *name);
2110EAPI int
2111ecore_x_netwm_name_get(Ecore_X_Window win,
2112 char **name);
2113EAPI void
2114ecore_x_netwm_startup_id_set(Ecore_X_Window win,
2115 const char *id);
2116EAPI int
2117ecore_x_netwm_startup_id_get(Ecore_X_Window win,
2118 char **id);
2119EAPI void
2120ecore_x_netwm_visible_name_set(Ecore_X_Window win,
2121 const char *name);
2122EAPI int
2123ecore_x_netwm_visible_name_get(Ecore_X_Window win,
2124 char **name);
2125EAPI void
2126ecore_x_netwm_icon_name_set(Ecore_X_Window win,
2127 const char *name);
2128EAPI int
2129ecore_x_netwm_icon_name_get(Ecore_X_Window win,
2130 char **name);
2131EAPI void
2132ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win,
2133 const char *name);
2134EAPI int
2135ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win,
2136 char **name);
2137EAPI void
2138ecore_x_netwm_desktop_set(Ecore_X_Window win,
2139 unsigned int desk);
2140EAPI Eina_Bool
2141ecore_x_netwm_desktop_get(Ecore_X_Window win,
2142 unsigned int *desk);
2143EAPI void
2144ecore_x_netwm_strut_set(Ecore_X_Window win,
2145 int left,
2146 int right,
2147 int top,
2148 int bottom);
2149EAPI Eina_Bool
2150ecore_x_netwm_strut_get(Ecore_X_Window win,
2151 int *left,
2152 int *right,
2153 int *top,
2154 int *bottom);
2155EAPI void
2156ecore_x_netwm_strut_partial_set(Ecore_X_Window win,
2157 int left,
2158 int right,
2159 int top,
2160 int bottom,
2161 int left_start_y,
2162 int left_end_y,
2163 int right_start_y,
2164 int right_end_y,
2165 int top_start_x,
2166 int top_end_x,
2167 int bottom_start_x,
2168 int bottom_end_x);
2169EAPI Eina_Bool
2170ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
2171 int *left,
2172 int *right,
2173 int *top,
2174 int *bottom,
2175 int *left_start_y,
2176 int *left_end_y,
2177 int *right_start_y,
2178 int *right_end_y,
2179 int *top_start_x,
2180 int *top_end_x,
2181 int *bottom_start_x,
2182 int *bottom_end_x);
2183
2184EAPI void
2185ecore_x_netwm_icons_set(Ecore_X_Window win,
2186 Ecore_X_Icon *icon,
2187 int num);
2188
2189EAPI Eina_Bool
2190ecore_x_netwm_icons_get(Ecore_X_Window win,
2191 Ecore_X_Icon **icon,
2192 int *num);
2193EAPI void
2194ecore_x_netwm_icon_geometry_set(Ecore_X_Window win,
2195 int x,
2196 int y,
2197 int width,
2198 int height);
2199EAPI Eina_Bool
2200ecore_x_netwm_icon_geometry_get(Ecore_X_Window win,
2201 int *x,
2202 int *y,
2203 int *width,
2204 int *height);
2205EAPI void
2206ecore_x_netwm_pid_set(Ecore_X_Window win,
2207 int pid);
2208EAPI Eina_Bool
2209ecore_x_netwm_pid_get(Ecore_X_Window win,
2210 int *pid);
2211EAPI void
2212 ecore_x_netwm_handled_icons_set(Ecore_X_Window win);
2213EAPI Eina_Bool
2214 ecore_x_netwm_handled_icons_get(Ecore_X_Window win);
2215EAPI void
2216 ecore_x_netwm_user_time_set(Ecore_X_Window win,
2217 unsigned int time);
2218EAPI Eina_Bool
2219ecore_x_netwm_user_time_get(Ecore_X_Window win,
2220 unsigned int *time);
2221EAPI void
2222ecore_x_netwm_window_state_set(Ecore_X_Window win,
2223 Ecore_X_Window_State *state,
2224 unsigned int num);
2225EAPI Eina_Bool
2226ecore_x_netwm_window_state_get(Ecore_X_Window win,
2227 Ecore_X_Window_State **state,
2228 unsigned int *num);
2229EAPI void
2230ecore_x_netwm_window_type_set(Ecore_X_Window win,
2231 Ecore_X_Window_Type type);
2232EAPI Eina_Bool
2233ecore_x_netwm_window_type_get(Ecore_X_Window win,
2234 Ecore_X_Window_Type *type);
2235EAPI int
2236ecore_x_netwm_window_types_get(Ecore_X_Window win,
2237 Ecore_X_Window_Type **types);
2238EAPI Eina_Bool
2239ecore_x_netwm_allowed_action_isset(Ecore_X_Window win,
2240 Ecore_X_Action action);
2241EAPI void
2242ecore_x_netwm_allowed_action_set(Ecore_X_Window win,
2243 Ecore_X_Action *action,
2244 unsigned int num);
2245EAPI Eina_Bool
2246ecore_x_netwm_allowed_action_get(Ecore_X_Window win,
2247 Ecore_X_Action **action,
2248 unsigned int *num);
2249EAPI void
2250ecore_x_netwm_opacity_set(Ecore_X_Window win,
2251 unsigned int opacity);
2252EAPI Eina_Bool
2253ecore_x_netwm_opacity_get(Ecore_X_Window win,
2254 unsigned int *opacity);
2255EAPI void
2256ecore_x_netwm_frame_size_set(Ecore_X_Window win,
2257 int fl,
2258 int fr,
2259 int ft,
2260 int fb);
2261EAPI Eina_Bool
2262ecore_x_netwm_frame_size_get(Ecore_X_Window win,
2263 int *fl,
2264 int *fr,
2265 int *ft,
2266 int *fb);
2267EAPI Eina_Bool
2268ecore_x_netwm_sync_counter_get(Ecore_X_Window win,
2269 Ecore_X_Sync_Counter *counter);
2270EAPI void
2271 ecore_x_netwm_ping_send(Ecore_X_Window win);
2272EAPI void
2273 ecore_x_netwm_sync_request_send(Ecore_X_Window win,
2274 unsigned int serial);
2275EAPI void
2276ecore_x_netwm_state_request_send(Ecore_X_Window win,
2277 Ecore_X_Window root,
2278 Ecore_X_Window_State s1,
2279 Ecore_X_Window_State s2,
2280 Eina_Bool set);
2281EAPI void
2282ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
2283 Ecore_X_Window root,
2284 unsigned int desktop);
2285
2286EAPI void
2287 ecore_x_e_init(void);
2288EAPI void
2289 ecore_x_e_frame_size_set(Ecore_X_Window win,
2290 int fl,
2291 int fr,
2292 int ft,
2293 int fb);
2294EAPI void
2295ecore_x_e_virtual_keyboard_set(Ecore_X_Window win,
2296 unsigned int is_keyboard);
2297EAPI Eina_Bool
2298 ecore_x_e_virtual_keyboard_get(Ecore_X_Window win);
2299EAPI void
2300 ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win,
2301 Ecore_X_Virtual_Keyboard_State state);
2302EAPI Ecore_X_Virtual_Keyboard_State
2303 ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win);
2304EAPI void
2305 ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win,
2306 Ecore_X_Virtual_Keyboard_State state);
2307
2308/* Illume functions */
2309EAPI void
2310ecore_x_e_illume_zone_set(Ecore_X_Window win,
2311 Ecore_X_Window zone);
2312EAPI Ecore_X_Window
2313 ecore_x_e_illume_zone_get(Ecore_X_Window win);
2314EAPI void
2315 ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
2316 Ecore_X_Window *zones,
2317 unsigned int n_zones);
2318EAPI void
2319ecore_x_e_illume_conformant_set(Ecore_X_Window win,
2320 unsigned int is_conformant);
2321EAPI Eina_Bool
2322 ecore_x_e_illume_conformant_get(Ecore_X_Window win);
2323EAPI void
2324 ecore_x_e_illume_mode_set(Ecore_X_Window win,
2325 Ecore_X_Illume_Mode mode);
2326EAPI Ecore_X_Illume_Mode
2327 ecore_x_e_illume_mode_get(Ecore_X_Window win);
2328EAPI void
2329 ecore_x_e_illume_mode_send(Ecore_X_Window win,
2330 Ecore_X_Illume_Mode mode);
2331EAPI void
2332 ecore_x_e_illume_focus_back_send(Ecore_X_Window win);
2333EAPI void
2334 ecore_x_e_illume_focus_forward_send(Ecore_X_Window win);
2335EAPI void
2336 ecore_x_e_illume_focus_home_send(Ecore_X_Window win);
2337EAPI void
2338 ecore_x_e_illume_close_send(Ecore_X_Window win);
2339EAPI void
2340 ecore_x_e_illume_home_new_send(Ecore_X_Window win);
2341EAPI void
2342 ecore_x_e_illume_home_del_send(Ecore_X_Window win);
2343EAPI void
2344 ecore_x_e_illume_drag_set(Ecore_X_Window win,
2345 unsigned int drag);
2346EAPI Eina_Bool
2347 ecore_x_e_illume_drag_get(Ecore_X_Window win);
2348EAPI void
2349 ecore_x_e_illume_drag_locked_set(Ecore_X_Window win,
2350 unsigned int is_locked);
2351EAPI Eina_Bool
2352 ecore_x_e_illume_drag_locked_get(Ecore_X_Window win);
2353EAPI void
2354 ecore_x_e_illume_drag_start_send(Ecore_X_Window win);
2355EAPI void
2356 ecore_x_e_illume_drag_end_send(Ecore_X_Window win);
2357EAPI void
2358 ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win,
2359 int x,
2360 int y,
2361 int w,
2362 int h);
2363EAPI Eina_Bool
2364ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win,
2365 int *x,
2366 int *y,
2367 int *w,
2368 int *h);
2369EAPI void
2370ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win,
2371 int x,
2372 int y,
2373 int w,
2374 int h);
2375EAPI Eina_Bool
2376ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win,
2377 int *x,
2378 int *y,
2379 int *w,
2380 int *h);
2381EAPI void
2382ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win,
2383 int x,
2384 int y,
2385 int w,
2386 int h);
2387EAPI Eina_Bool
2388ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win,
2389 int *x,
2390 int *y,
2391 int *w,
2392 int *h);
2393EAPI void
2394ecore_x_e_illume_quickpanel_set(Ecore_X_Window win,
2395 unsigned int is_quickpanel);
2396EAPI Eina_Bool
2397 ecore_x_e_illume_quickpanel_get(Ecore_X_Window win);
2398EAPI void
2399 ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win,
2400 Ecore_X_Illume_Quickpanel_State state);
2401EAPI Ecore_X_Illume_Quickpanel_State
2402 ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win);
2403EAPI void
2404 ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win,
2405 Ecore_X_Illume_Quickpanel_State state);
2406EAPI void
2407 ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win);
2408EAPI void
2409 ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win,
2410 unsigned int priority);
2411EAPI int
2412 ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win);
2413EAPI void
2414 ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win,
2415 unsigned int priority);
2416EAPI int
2417 ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win);
2418EAPI void
2419 ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win,
2420 unsigned int zone);
2421EAPI int
2422 ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win);
2423EAPI void
2424 ecore_x_e_illume_quickpanel_zone_request_send(Ecore_X_Window win);
2425EAPI void
2426 ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win);
2427
2428EAPI void
2429ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
2430 Ecore_X_Illume_Clipboard_State state);
2431
2432EAPI Ecore_X_Illume_Clipboard_State
2433ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win);
2434
2435EAPI void
2436ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
2437 int x,
2438 int y,
2439 int w,
2440 int h);
2441EAPI Eina_Bool
2442ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
2443 int *x,
2444 int *y,
2445 int *w,
2446 int *h);
2447EAPI void
2448ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
2449 Ecore_X_Sync_Counter counter);
2450EAPI Ecore_X_Sync_Counter
2451 ecore_x_e_comp_sync_counter_get(Ecore_X_Window win);
2452EAPI void
2453 ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
2454 Ecore_X_Window win);
2455EAPI void
2456ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
2457 Ecore_X_Window win,
2458 int w,
2459 int h);
2460EAPI void
2461ecore_x_e_comp_sync_supported_set(Ecore_X_Window root,
2462 Eina_Bool enabled);
2463EAPI Eina_Bool
2464 ecore_x_e_comp_sync_supported_get(Ecore_X_Window root);
2465EAPI void
2466 ecore_x_e_comp_sync_begin_send(Ecore_X_Window win);
2467EAPI void
2468 ecore_x_e_comp_sync_end_send(Ecore_X_Window win);
2469EAPI void
2470 ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win);
2471
2472EAPI void
2473 ecore_x_e_comp_flush_send(Ecore_X_Window win);
2474EAPI void
2475 ecore_x_e_comp_dump_send(Ecore_X_Window win);
2476EAPI void
2477 ecore_x_e_comp_pixmap_set(Ecore_X_Window win,
2478 Ecore_X_Pixmap pixmap);
2479EAPI Ecore_X_Pixmap
2480ecore_x_e_comp_pixmap_get(Ecore_X_Window win);
2481
2482EAPI Ecore_X_Sync_Alarm
2483 ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter);
2484EAPI Eina_Bool
2485 ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm);
2486EAPI Eina_Bool
2487 ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
2488 unsigned int *val);
2489EAPI Ecore_X_Sync_Counter
2490 ecore_x_sync_counter_new(int val);
2491EAPI void
2492 ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter);
2493EAPI void
2494 ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
2495 int by);
2496EAPI void
2497ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
2498 int val);
2499
2500EAPI void
2501ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
2502 int val);
2503EAPI void
2504ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
2505 int val_hi,
2506 unsigned int val_lo);
2507EAPI Eina_Bool
2508ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
2509 int *val_hi,
2510 unsigned int *val_lo);
2511
2512EAPI int
2513 ecore_x_xinerama_screen_count_get(void);
2514EAPI Eina_Bool
2515 ecore_x_xinerama_screen_geometry_get(int screen,
2516 int *x,
2517 int *y,
2518 int *w,
2519 int *h);
2520
2521EAPI Eina_Bool
2522 ecore_x_screensaver_event_available_get(void);
2523EAPI int
2524 ecore_x_screensaver_idle_time_get(void);
2525EAPI void
2526 ecore_x_screensaver_set(int timeout,
2527 int interval,
2528 int prefer_blanking,
2529 int allow_exposures);
2530EAPI void
2531 ecore_x_screensaver_timeout_set(int timeout);
2532EAPI int
2533 ecore_x_screensaver_timeout_get(void);
2534EAPI void
2535 ecore_x_screensaver_blank_set(int timeout);
2536EAPI int
2537 ecore_x_screensaver_blank_get(void);
2538EAPI void
2539 ecore_x_screensaver_expose_set(int timeout);
2540EAPI int
2541 ecore_x_screensaver_expose_get(void);
2542EAPI void
2543 ecore_x_screensaver_interval_set(int timeout);
2544EAPI int
2545 ecore_x_screensaver_interval_get(void);
2546EAPI void
2547 ecore_x_screensaver_event_listen_set(Eina_Bool on);
2548
2549/* FIXME: these funcs need categorising */
2550
2551typedef struct _Ecore_X_Window_Attributes
2552{
2553 Ecore_X_Window root;
2554 int x, y, w, h;
2555 int border;
2556 int depth;
2557 Eina_Bool visible : 1;
2558 Eina_Bool viewable : 1;
2559 Eina_Bool override : 1;
2560 Eina_Bool input_only : 1;
2561 Eina_Bool save_under : 1;
2562 struct
2563 {
2564 Ecore_X_Event_Mask mine;
2565 Ecore_X_Event_Mask all;
2566 Ecore_X_Event_Mask no_propagate;
2567 } event_mask;
2568 Ecore_X_Gravity window_gravity;
2569 Ecore_X_Gravity pixel_gravity;
2570 Ecore_X_Colormap colormap;
2571 Ecore_X_Visual visual;
2572 /* FIXME: missing
2573 * int map_installed;
2574 * Screen *screen;
2575 */
2576} Ecore_X_Window_Attributes;
2577
2578EAPI Eina_Bool
2579ecore_x_window_attributes_get(Ecore_X_Window win,
2580 Ecore_X_Window_Attributes *att_ret);
2581EAPI void
2582 ecore_x_window_save_set_add(Ecore_X_Window win);
2583EAPI void
2584 ecore_x_window_save_set_del(Ecore_X_Window win);
2585EAPI Ecore_X_Window *
2586 ecore_x_window_children_get(Ecore_X_Window win,
2587 int *num);
2588
2589EAPI Eina_Bool
2590ecore_x_pointer_control_set(int accel_num,
2591 int accel_denom,
2592 int threshold);
2593EAPI Eina_Bool
2594ecore_x_pointer_control_get(int *accel_num,
2595 int *accel_denom,
2596 int *threshold);
2597EAPI Eina_Bool
2598ecore_x_pointer_mapping_set(unsigned char *map,
2599 int nmap);
2600EAPI Eina_Bool
2601ecore_x_pointer_mapping_get(unsigned char *map,
2602 int nmap);
2603EAPI Eina_Bool
2604 ecore_x_pointer_grab(Ecore_X_Window win);
2605EAPI Eina_Bool
2606 ecore_x_pointer_confine_grab(Ecore_X_Window win);
2607EAPI void
2608 ecore_x_pointer_ungrab(void);
2609EAPI Eina_Bool
2610 ecore_x_pointer_warp(Ecore_X_Window win,
2611 int x,
2612 int y);
2613EAPI Eina_Bool
2614 ecore_x_keyboard_grab(Ecore_X_Window win);
2615EAPI void
2616 ecore_x_keyboard_ungrab(void);
2617EAPI void
2618 ecore_x_grab(void);
2619EAPI void
2620 ecore_x_ungrab(void);
2621EAPI void
2622 ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
2623 int event_type,
2624 void *event),
2625 void *data);
2626EAPI void
2627ecore_x_window_button_grab(Ecore_X_Window win,
2628 int button,
2629 Ecore_X_Event_Mask event_mask,
2630 int mod,
2631 int any_mod);
2632EAPI void
2633ecore_x_window_button_ungrab(Ecore_X_Window win,
2634 int button,
2635 int mod,
2636 int any_mod);
2637EAPI void
2638ecore_x_window_key_grab(Ecore_X_Window win,
2639 const char *key,
2640 int mod,
2641 int any_mod);
2642EAPI void
2643ecore_x_window_key_ungrab(Ecore_X_Window win,
2644 const char *key,
2645 int mod,
2646 int any_mod);
2647
2648EAPI void
2649 ecore_x_focus_reset(void);
2650EAPI void
2651 ecore_x_events_allow_all(void);
2652EAPI void
2653 ecore_x_pointer_last_xy_get(int *x,
2654 int *y);
2655EAPI void
2656ecore_x_pointer_xy_get(Ecore_X_Window win,
2657 int *x,
2658 int *y);
2659
2660/* ecore_x_region.c */
2661EAPI Ecore_X_XRegion *
2662 ecore_x_xregion_new(void);
2663EAPI void
2664 ecore_x_xregion_free(Ecore_X_XRegion *region);
2665EAPI Eina_Bool
2666 ecore_x_xregion_set(Ecore_X_XRegion *region,
2667 Ecore_X_GC gc);
2668EAPI void
2669ecore_x_xregion_translate(Ecore_X_XRegion *region,
2670 int x,
2671 int y);
2672EAPI Eina_Bool
2673ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
2674 Ecore_X_XRegion *r1,
2675 Ecore_X_XRegion *r2);
2676EAPI Eina_Bool
2677ecore_x_xregion_union(Ecore_X_XRegion *dst,
2678 Ecore_X_XRegion *r1,
2679 Ecore_X_XRegion *r2);
2680EAPI Eina_Bool
2681ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
2682 Ecore_X_XRegion *src,
2683 Ecore_X_Rectangle *rect);
2684EAPI Eina_Bool
2685ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
2686 Ecore_X_XRegion *r1,
2687 Ecore_X_XRegion *r2);
2688EAPI Eina_Bool
2689 ecore_x_xregion_is_empty(Ecore_X_XRegion *region);
2690EAPI Eina_Bool
2691 ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
2692 Ecore_X_XRegion *r2);
2693EAPI Eina_Bool
2694ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
2695 int x,
2696 int y);
2697EAPI Eina_Bool
2698ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
2699 Ecore_X_Rectangle *rect);
2700
2701/* ecore_x_randr.c */
2702
2703/* The usage of 'Ecore_X_Randr_None' or 'Ecore_X_Randr_Unset'
2704 * depends on the context. In most cases 'Ecore_X_Randr_Unset'
2705 * can be used, but in some cases -1 is a special value to
2706 * functions, thus 'Ecore_X_Randr_None' (=0) must be used.
2707 */
2708
2709typedef short Ecore_X_Randr_Refresh_Rate;
2710typedef int Ecore_X_Randr_Crtc_Gamma;
2711typedef int Ecore_X_Randr_Signal_Format;
2712typedef int Ecore_X_Randr_Signal_Property;
2713typedef int Ecore_X_Randr_Connector_Type;
2714
2715typedef struct _Ecore_X_Randr_Mode_Info
2716{
2717 Ecore_X_ID xid;
2718 unsigned int width;
2719 unsigned int height;
2720 unsigned long dotClock;
2721 unsigned int hSyncStart;
2722 unsigned int hSyncEnd;
2723 unsigned int hTotal;
2724 unsigned int hSkew;
2725 unsigned int vSyncStart;
2726 unsigned int vSyncEnd;
2727 unsigned int vTotal;
2728 char *name;
2729 unsigned int nameLength;
2730 unsigned long modeFlags;
2731} Ecore_X_Randr_Mode_Info;
2732
2733EAPI int
2734 ecore_x_randr_version_get(void);
2735EAPI Eina_Bool
2736 ecore_x_randr_query(void);
2737
2738/* ecore_x_randr_11.c */
2739EAPI Ecore_X_Randr_Orientation
2740 ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root);
2741EAPI Ecore_X_Randr_Orientation
2742 ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root);
2743EAPI Eina_Bool
2744 ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root,
2745 Ecore_X_Randr_Orientation orientation);
2746EAPI Ecore_X_Randr_Screen_Size_MM *
2747ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
2748 int *num);
2749EAPI void
2750ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root,
2751 int *w,
2752 int *h,
2753 int *w_mm,
2754 int *h_mm,
2755 int *size_index);
2756EAPI Eina_Bool
2757ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
2758 int size_index);
2759EAPI Ecore_X_Randr_Refresh_Rate
2760 ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root);
2761EAPI Ecore_X_Randr_Refresh_Rate *
2762 ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
2763 int size_index,
2764 int *num);
2765EAPI Eina_Bool
2766ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root,
2767 int size_index,
2768 Ecore_X_Randr_Refresh_Rate rate);
2769
2770/* ecore_x_randr_12.c */
2771EAPI void
2772ecore_x_randr_events_select(Ecore_X_Window win,
2773 Eina_Bool on);
2774
2775EAPI void
2776ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
2777 int *w,
2778 int *h,
2779 int *w_mm,
2780 int *h_mm);
2781EAPI void
2782ecore_x_randr_screen_size_range_get(Ecore_X_Window root,
2783 int *wmin,
2784 int *hmin,
2785 int *wmax,
2786 int *hmax);
2787EAPI void
2788 ecore_x_randr_screen_reset(Ecore_X_Window root);
2789EAPI Eina_Bool
2790 ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
2791 int w,
2792 int h,
2793 int w_mm,
2794 int h_mm);
2795EAPI Ecore_X_Randr_Mode_Info **
2796ecore_x_randr_modes_info_get(Ecore_X_Window root,
2797 int *num);
2798EAPI Ecore_X_Randr_Mode
2799ecore_x_randr_mode_info_add(Ecore_X_Window root,
2800 Ecore_X_Randr_Mode_Info *mode_info);
2801EAPI void
2802ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode);
2803EAPI Ecore_X_Randr_Mode_Info *
2804ecore_x_randr_mode_info_get(Ecore_X_Window root,
2805 Ecore_X_Randr_Mode mode);
2806EAPI void
2807 ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info);
2808EAPI Ecore_X_Randr_Crtc *
2809 ecore_x_randr_crtcs_get(Ecore_X_Window root,
2810 int *num);
2811EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(Ecore_X_Window root,
2812 int *num);
2813EAPI Ecore_X_Randr_Output *
2814ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2815 int *num);
2816EAPI Ecore_X_Randr_Output *
2817ecore_x_randr_current_output_get(Ecore_X_Window window,
2818 int *num);
2819EAPI Ecore_X_Randr_Crtc *
2820ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
2821 int *num);
2822EAPI Ecore_X_Randr_Crtc *
2823ecore_x_randr_current_crtc_get(Ecore_X_Window window,
2824 int *num);
2825EAPI Ecore_X_Randr_Output *
2826ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
2827 Ecore_X_Randr_Crtc crtc,
2828 int *num);
2829EAPI Ecore_X_Randr_Output *
2830ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root,
2831 Ecore_X_Randr_Crtc crtc,
2832 int *num);
2833EAPI void
2834ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
2835 Ecore_X_Randr_Crtc crtc,
2836 int *x,
2837 int *y,
2838 int *w,
2839 int *h);
2840EAPI void
2841ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
2842 Ecore_X_Randr_Crtc crtc,
2843 int *x,
2844 int *y);
2845EAPI Eina_Bool
2846ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
2847 Ecore_X_Randr_Crtc crtc,
2848 int x,
2849 int y);
2850EAPI Ecore_X_Randr_Mode
2851ecore_x_randr_crtc_mode_get(Ecore_X_Window root,
2852 Ecore_X_Randr_Crtc crtc);
2853EAPI Eina_Bool
2854ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
2855 Ecore_X_Randr_Crtc crtc,
2856 Ecore_X_Randr_Output *outputs,
2857 int noutputs,
2858 Ecore_X_Randr_Mode mode);
2859EAPI void
2860ecore_x_randr_crtc_size_get(Ecore_X_Window root,
2861 Ecore_X_Randr_Crtc crtc,
2862 int *w,
2863 int *h);
2864EAPI Ecore_X_Randr_Refresh_Rate
2865ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
2866 Ecore_X_Randr_Crtc crtc,
2867 Ecore_X_Randr_Mode mode);
2868EAPI Ecore_X_Randr_Orientation
2869ecore_x_randr_crtc_orientations_get(Ecore_X_Window root,
2870 Ecore_X_Randr_Crtc crtc);
2871EAPI Ecore_X_Randr_Orientation
2872ecore_x_randr_crtc_orientation_get(Ecore_X_Window root,
2873 Ecore_X_Randr_Crtc crtc);
2874EAPI Eina_Bool
2875ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
2876 Ecore_X_Randr_Crtc crtc,
2877 const Ecore_X_Randr_Orientation orientation);
2878EAPI Eina_Bool
2879ecore_x_randr_crtc_clone_set(Ecore_X_Window root,
2880 Ecore_X_Randr_Crtc original,
2881 Ecore_X_Randr_Crtc clone);
2882EAPI Eina_Bool
2883ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
2884 Ecore_X_Randr_Crtc crtc,
2885 Ecore_X_Randr_Output *outputs,
2886 int noutputs,
2887 int x,
2888 int y,
2889 Ecore_X_Randr_Mode mode,
2890 Ecore_X_Randr_Orientation orientation);
2891EAPI Eina_Bool
2892ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
2893 Ecore_X_Randr_Crtc crtc_r1,
2894 Ecore_X_Randr_Crtc crtc_r2,
2895 Ecore_X_Randr_Output_Policy policy,
2896 Ecore_X_Randr_Relative_Alignment alignment);
2897EAPI Eina_Bool
2898ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
2899 Ecore_X_Randr_Mode mode);
2900EAPI void
2901ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
2902 Ecore_X_Randr_Mode mode);
2903EAPI Ecore_X_Randr_Mode *
2904ecore_x_randr_output_modes_get(Ecore_X_Window root,
2905 Ecore_X_Randr_Output output,
2906 int *num,
2907 int *npreferred);
2908EAPI Ecore_X_Randr_Output *ecore_x_randr_output_clones_get(Ecore_X_Window root,
2909 Ecore_X_Randr_Output output,
2910 int *num);
2911EAPI Ecore_X_Randr_Crtc *ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root,
2912 Ecore_X_Randr_Output output,
2913 int *num);
2914EAPI Ecore_X_Randr_Crtc
2915ecore_x_randr_output_crtc_get(Ecore_X_Window root,
2916 Ecore_X_Randr_Output output);
2917EAPI char *
2918ecore_x_randr_output_name_get(Ecore_X_Window root,
2919 Ecore_X_Randr_Output output,
2920 int *len);
2921EAPI int
2922 ecore_x_randr_crtc_gamma_ramp_size_get(Ecore_X_Randr_Crtc crtc);
2923EAPI Ecore_X_Randr_Crtc_Gamma **
2924 ecore_x_randr_crtc_gamma_ramps_get(Ecore_X_Randr_Crtc crtc);
2925EAPI Eina_Bool
2926 ecore_x_randr_crtc_gamma_ramps_set(Ecore_X_Randr_Crtc crtc,
2927 const Ecore_X_Randr_Crtc_Gamma *red,
2928 const Ecore_X_Randr_Crtc_Gamma *green,
2929 const Ecore_X_Randr_Crtc_Gamma *blue);
2930EAPI Eina_Bool
2931ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root,
2932 const Ecore_X_Randr_Crtc *not_moved,
2933 int nnot_moved,
2934 int dx,
2935 int dy);
2936EAPI Eina_Bool
2937ecore_x_randr_move_crtcs(Ecore_X_Window root,
2938 const Ecore_X_Randr_Crtc *crtcs,
2939 int ncrtc,
2940 int dx,
2941 int dy);
2942EAPI void
2943ecore_x_randr_mode_size_get(Ecore_X_Window root,
2944 Ecore_X_Randr_Mode mode,
2945 int *w,
2946 int *h);
2947EAPI Ecore_X_Randr_Connection_Status
2948ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
2949 Ecore_X_Randr_Output output);
2950EAPI void
2951ecore_x_randr_output_size_mm_get(Ecore_X_Window root,
2952 Ecore_X_Randr_Output output,
2953 int *w,
2954 int *h);
2955EAPI Eina_Bool
2956ecore_x_randr_output_crtc_set(Ecore_X_Window root,
2957 Ecore_X_Randr_Output output,
2958 const Ecore_X_Randr_Crtc crtc);
2959
2960/* ecore_x_randr_12_edid.c */
2961
2962/*
2963 * @brief Validates the header from raw EDID data.
2964 *
2965 * @param edid the edid structure
2966 * @param edid_length length of the edid structure
2967 * @return EINA_TRUE, if the header is valid. Else EINA_FALSE.
2968 */
2969EAPI Eina_Bool
2970ecore_x_randr_edid_has_valid_header(unsigned char *edid,
2971 unsigned long edid_length);
2972
2973/*
2974 * @brief Checks whether a display's EDID has a valid checksum.
2975 *
2976 * @param edid the edid structure
2977 * @param edid_length length of the edid structure
2978 * @return EINA_TRUE, if the checksum is valid. Else EINA_FALSE.
2979 */
2980EAPI Eina_Bool
2981ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid,
2982 unsigned long edid_length);
2983
2984/*
2985 * @brief Get the encoded version from raw EDID data.
2986 *
2987 * The return value has the minor version in the lowest 8 bits, and the major
2988 * version in all the rest of the bits. i.e.
2989 *
2990 * minor = (version & 0x000000ff);
2991 * major = (version & 0xffffff00) >> 8;
2992 *
2993 * @param edid the edid structure
2994 * @param edid_length length of the edid structure
2995 * @return The encoded major and minor version encasuplated an int.
2996 */
2997EAPI int
2998ecore_x_randr_edid_version_get(unsigned char *edid,
2999 unsigned long edid_length);
3000
3001/*
3002 * @brief Get the encoded manufacturer from raw EDID data.
3003 *
3004 * @param edid the edid structure
3005 * @param edid_length length of the edid structure
3006 * @return The encoded manufacturer identifier.
3007 */
3008EAPI char *
3009ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid,
3010 unsigned long edid_length);
3011
3012/*
3013 * @brief Get the encoded name from raw EDID data.
3014 *
3015 * @param edid the edid structure
3016 * @param edid_length length of the edid structure
3017 * @return The encoded manufacturer identifier.
3018 */
3019EAPI char *
3020ecore_x_randr_edid_display_name_get(unsigned char *edid,
3021 unsigned long edid_length);
3022
3023/*
3024 * @brief Get the encoded ASCII from raw EDID data.
3025 *
3026 * @param edid the edid structure
3027 * @param edid_length length of the edid structure
3028 * @return The encoded ASCII display identifier.
3029 */
3030EAPI char *
3031ecore_x_randr_edid_display_ascii_get(unsigned char *edid,
3032 unsigned long edid_length);
3033
3034/*
3035 * @brief Get the encoded serial identifier from raw EDID data.
3036 *
3037 * @param edid the edid structure
3038 * @param edid_length length of the edid structure
3039 * @return The encoded serial identifier.
3040 */
3041EAPI char *
3042ecore_x_randr_edid_display_serial_get(unsigned char *edid,
3043 unsigned long edid_length);
3044
3045/*
3046 * @brief Get the encoded model number from raw EDID data.
3047 *
3048 * The manufacturer ID table is necessary for a useful description.
3049 *
3050 * @param edid the edid structure
3051 * @param edid_length length of the edid structure
3052 * @return The encoded model number.
3053 */
3054EAPI int
3055ecore_x_randr_edid_model_get(unsigned char *edid,
3056 unsigned long edid_length);
3057
3058/*
3059 * @brief Get the manufacturer serial number from raw EDID data.
3060 *
3061 * @param edid the edid structure
3062 * @param edid_length length of the edid structure
3063 * @return The encoded serial manufacturer serial number.
3064 */
3065EAPI int
3066ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid,
3067 unsigned long edid_length);
3068
3069/*
3070 * @brief Get the manufacturer model number from raw EDID data.
3071 *
3072 * @param edid the edid structure
3073 * @param edid_length length of the edid structure
3074 * @return The manufacturer's model number.
3075 */
3076EAPI int
3077ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid,
3078 unsigned long edid_length);
3079
3080/*
3081 * @brief Looks up the DPMS support from raw EDID data.
3082 *
3083 * @param edid the edid structure
3084 * @param edid_length length of the edid structure
3085 * @return EINA_TRUE, if DPMS is supported in some way. Else EINA_FALSE.
3086 */
3087EAPI Eina_Bool
3088ecore_x_randr_edid_dpms_available_get(unsigned char *edid,
3089 unsigned long edid_length);
3090
3091/*
3092 * @brief Looks up the DPMS Standby support from raw EDID data.
3093 *
3094 * @param edid the edid structure
3095 * @param edid_length length of the edid structure
3096 * @return EINA_TRUE, if DPMS Standby is supported. Else EINA_FALSE.
3097 */
3098EAPI Eina_Bool
3099ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid,
3100 unsigned long edid_length);
3101
3102/*
3103 * @brief Looks up the DPMS Suspend support from raw EDID data.
3104 *
3105 * @param edid the edid structure
3106 * @param edid_length length of the edid structure
3107 * @return EINA_TRUE, if DPMS Suspend is supported. Else EINA_FALSE.
3108 */
3109EAPI Eina_Bool
3110ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid,
3111 unsigned long edid_length);
3112
3113/*
3114 * @brief Looks up the DPMS Off support from raw EDID data.
3115 *
3116 * @param edid the edid structure
3117 * @param edid_length length of the edid structure
3118 * @return EINA_TRUE, if DPMS Off is supported. Else EINA_FALSE.
3119 */
3120EAPI Eina_Bool
3121ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid,
3122 unsigned long edid_length);
3123
3124/*
3125 * @brief Get the preferred aspect ratio from raw EDID data.
3126 *
3127 * @param edid the edid structure
3128 * @param edid_length length of the edid structure
3129 * @return The preferred aspect ratio.
3130 */
3131EAPI Ecore_X_Randr_Edid_Aspect_Ratio
3132ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid,
3133 unsigned long edid_length);
3134
3135/*
3136 * @brief Get the supported aspect ratios from raw EDID data.
3137 *
3138 * @param edid the edid structure
3139 * @param edid_length length of the edid structure
3140 * @return The supported aspect ratios.
3141 */
3142EAPI Ecore_X_Randr_Edid_Aspect_Ratio
3143ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid,
3144 unsigned long edid_length);
3145
3146/*
3147 * @brief Get the supported colorschemes from raw EDID data.
3148 *
3149 * @param edid the edid structure
3150 * @param edid_length length of the edid structure
3151 * @return The supported colorschemes.
3152 */
3153EAPI Ecore_X_Randr_Edid_Display_Colorscheme
3154ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid,
3155 unsigned long edid_length);
3156
3157/*
3158 * @brief Get the display type from raw EDID data.
3159 *
3160 * @param edid the edid structure
3161 * @param edid_length length of the edid structure
3162 * @return EINA_TRUE, if the display is a digital one. Else EINA_FALSE.
3163 */
3164EAPI Eina_Bool
3165ecore_x_randr_edid_display_type_digital_get(unsigned char *edid,
3166 unsigned long edid_length);
3167
3168/*
3169 * @brief Get the display interface type from raw EDID data.
3170 *
3171 * @param edid the edid structure
3172 * @param edid_length length of the edid structure
3173 * @return The interface type.
3174 */
3175EAPI Ecore_X_Randr_Edid_Display_Interface_Type
3176ecore_x_randr_edid_display_interface_type_get(unsigned char *edid,
3177 unsigned long edid_length);
3178
3179/* ecore_x_randr_12.c */
3180
3181EAPI Eina_Bool
3182ecore_x_randr_output_backlight_available(void);
3183EAPI void
3184ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root,
3185 double level);
3186EAPI double
3187ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
3188 Ecore_X_Randr_Output output);
3189EAPI Eina_Bool
3190ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
3191 Ecore_X_Randr_Output output,
3192 double level);
3193EAPI Ecore_X_Randr_Output
3194 ecore_x_randr_primary_output_get(Ecore_X_Window root);
3195EAPI void
3196 ecore_x_randr_primary_output_set(Ecore_X_Window root,
3197 Ecore_X_Randr_Output output);
3198EAPI Ecore_X_Render_Subpixel_Order
3199ecore_x_randr_output_subpixel_order_get(Ecore_X_Window root,
3200 Ecore_X_Randr_Output output);
3201EAPI unsigned char *
3202ecore_x_randr_output_edid_get(Ecore_X_Window root,
3203 Ecore_X_Randr_Output output,
3204 unsigned long *length);
3205EAPI Ecore_X_Randr_Output *
3206ecore_x_randr_output_wired_clones_get(Ecore_X_Window root,
3207 Ecore_X_Randr_Output output,
3208 int *num);
3209EAPI Ecore_X_Randr_Output **
3210ecore_x_randr_output_compatibility_list_get(Ecore_X_Window root,
3211 Ecore_X_Randr_Output output,
3212 int *num);
3213EAPI Ecore_X_Randr_Signal_Format *
3214ecore_x_randr_output_signal_formats_get(Ecore_X_Window root,
3215 Ecore_X_Randr_Output output,
3216 int *num);
3217EAPI Eina_Bool
3218ecore_x_randr_output_signal_format_set(Ecore_X_Window root,
3219 Ecore_X_Randr_Output output,
3220 Ecore_X_Randr_Signal_Format *signal);
3221EAPI Ecore_X_Randr_Signal_Property *
3222ecore_x_randr_output_signal_properties_get(Ecore_X_Window root,
3223 Ecore_X_Randr_Output output,
3224 int *num);
3225EAPI int
3226ecore_x_randr_output_connector_number_get(Ecore_X_Window root,
3227 Ecore_X_Randr_Output output);
3228EAPI Ecore_X_Randr_Connector_Type
3229ecore_x_randr_output_connector_type_get(Ecore_X_Window root,
3230 Ecore_X_Randr_Output output);
3231EAPI Eina_Rectangle *
3232ecore_x_randr_crtc_panning_area_get(Ecore_X_Window root,
3233 Ecore_X_Randr_Crtc crtc,
3234 int *x,
3235 int *y,
3236 int *w,
3237 int *h);
3238EAPI Eina_Bool
3239ecore_x_randr_crtc_panning_area_set(Ecore_X_Window root,
3240 Ecore_X_Randr_Crtc crtc,
3241 int x,
3242 const int y,
3243 const int w,
3244 const int h);
3245EAPI Eina_Rectangle *
3246ecore_x_randr_crtc_tracking_area_get(Ecore_X_Window root,
3247 Ecore_X_Randr_Crtc crtc,
3248 int *x,
3249 int *y,
3250 int *w,
3251 int *h);
3252EAPI Eina_Bool
3253ecore_x_randr_crtc_tracking_area_set(Ecore_X_Window root,
3254 Ecore_X_Randr_Crtc crtc,
3255 int x,
3256 const int y,
3257 const int w,
3258 const int h);
3259EAPI Eina_Rectangle *
3260ecore_x_randr_crtc_border_area_get(Ecore_X_Window root,
3261 Ecore_X_Randr_Crtc crtc);
3262EAPI Eina_Bool
3263ecore_x_randr_crtc_border_area_set(Ecore_X_Window root,
3264 Ecore_X_Randr_Crtc crtc,
3265 int left,
3266 const int top,
3267 const int right,
3268 const int bottom);
3269
3270/* XRender Support (horrendously incomplete) */
3271typedef Ecore_X_ID Ecore_X_Picture;
3272
3273/* XFixes Extension Support */
3274typedef Ecore_X_ID Ecore_X_Region;
3275
3276typedef enum _Ecore_X_Region_Type
3277{
3278 ECORE_X_REGION_BOUNDING,
3279 ECORE_X_REGION_CLIP
3280} Ecore_X_Region_Type;
3281
3282EAPI Ecore_X_Region
3283ecore_x_region_new(Ecore_X_Rectangle *rects,
3284 int num);
3285EAPI Ecore_X_Region
3286 ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap);
3287EAPI Ecore_X_Region
3288 ecore_x_region_new_from_window(Ecore_X_Window win,
3289 Ecore_X_Region_Type type);
3290EAPI Ecore_X_Region
3291 ecore_x_region_new_from_gc(Ecore_X_GC gc);
3292EAPI Ecore_X_Region
3293 ecore_x_region_new_from_picture(Ecore_X_Picture picture);
3294EAPI void
3295 ecore_x_region_free(Ecore_X_Region region);
3296EAPI void
3297 ecore_x_region_set(Ecore_X_Region region,
3298 Ecore_X_Rectangle *rects,
3299 int num);
3300EAPI void
3301ecore_x_region_copy(Ecore_X_Region dest,
3302 Ecore_X_Region source);
3303EAPI void
3304ecore_x_region_combine(Ecore_X_Region dest,
3305 Ecore_X_Region source1,
3306 Ecore_X_Region source2);
3307EAPI void
3308ecore_x_region_intersect(Ecore_X_Region dest,
3309 Ecore_X_Region source1,
3310 Ecore_X_Region source2);
3311EAPI void
3312ecore_x_region_subtract(Ecore_X_Region dest,
3313 Ecore_X_Region source1,
3314 Ecore_X_Region source2);
3315EAPI void
3316ecore_x_region_invert(Ecore_X_Region dest,
3317 Ecore_X_Rectangle *bounds,
3318 Ecore_X_Region source);
3319EAPI void
3320ecore_x_region_translate(Ecore_X_Region region,
3321 int dx,
3322 int dy);
3323EAPI void
3324ecore_x_region_extents(Ecore_X_Region dest,
3325 Ecore_X_Region source);
3326EAPI Ecore_X_Rectangle *
3327ecore_x_region_fetch(Ecore_X_Region region,
3328 int *num,
3329 Ecore_X_Rectangle *bounds);
3330EAPI void
3331ecore_x_region_expand(Ecore_X_Region dest,
3332 Ecore_X_Region source,
3333 unsigned int left,
3334 unsigned int right,
3335 unsigned int top,
3336 unsigned int bottom);
3337EAPI void
3338ecore_x_region_gc_clip_set(Ecore_X_Region region,
3339 Ecore_X_GC gc,
3340 int x_origin,
3341 int y_origin);
3342EAPI void
3343ecore_x_region_window_shape_set(Ecore_X_Region region,
3344 Ecore_X_Window win,
3345 Ecore_X_Shape_Type type,
3346 int x_offset,
3347 int y_offset);
3348EAPI void
3349ecore_x_region_picture_clip_set(Ecore_X_Region region,
3350 Ecore_X_Picture picture,
3351 int x_origin,
3352 int y_origin);
3353
3354/**
3355 * xfixes selection notification request.
3356 *
3357 * This lets you choose which selections you want to get notifications for.
3358 * @param selection the selection atom.
3359 * @return EINA_TRUE on success, EINA_FALSE otherwise.
3360 * @since 1.1.0
3361 */
3362EAPI Eina_Bool
3363ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection);
3364
3365/* XComposite Extension Support */
3366EAPI Eina_Bool
3367 ecore_x_composite_query(void);
3368EAPI void
3369 ecore_x_composite_redirect_window(Ecore_X_Window win,
3370 Ecore_X_Composite_Update_Type type);
3371EAPI void
3372ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
3373 Ecore_X_Composite_Update_Type type);
3374EAPI void
3375ecore_x_composite_unredirect_window(Ecore_X_Window win,
3376 Ecore_X_Composite_Update_Type type);
3377EAPI void
3378ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
3379 Ecore_X_Composite_Update_Type type);
3380EAPI Ecore_X_Pixmap
3381 ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win);
3382EAPI void
3383 ecore_x_composite_window_events_disable(Ecore_X_Window win);
3384EAPI void
3385 ecore_x_composite_window_events_enable(Ecore_X_Window win);
3386EAPI Ecore_X_Window
3387 ecore_x_composite_render_window_enable(Ecore_X_Window root);
3388EAPI void
3389 ecore_x_composite_render_window_disable(Ecore_X_Window root);
3390
3391/* XDamage Extension Support */
3392typedef Ecore_X_ID Ecore_X_Damage;
3393
3394typedef enum _Ecore_X_Damage_Report_Level
3395{
3396 ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES,
3397 ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES,
3398 ECORE_X_DAMAGE_REPORT_BOUNDING_BOX,
3399 ECORE_X_DAMAGE_REPORT_NON_EMPTY
3400} Ecore_X_Damage_Report_Level;
3401
3402struct _Ecore_X_Event_Damage
3403{
3404 Ecore_X_Damage_Report_Level level;
3405 Ecore_X_Drawable drawable;
3406 Ecore_X_Damage damage;
3407 int more;
3408 Ecore_X_Time time;
3409 Ecore_X_Rectangle area;
3410 Ecore_X_Rectangle geometry;
3411};
3412
3413typedef struct _Ecore_X_Event_Damage Ecore_X_Event_Damage;
3414
3415EAPI Eina_Bool
3416 ecore_x_damage_query(void);
3417EAPI Ecore_X_Damage
3418 ecore_x_damage_new(Ecore_X_Drawable d,
3419 Ecore_X_Damage_Report_Level level);
3420EAPI void
3421 ecore_x_damage_free(Ecore_X_Damage damage);
3422EAPI void
3423 ecore_x_damage_subtract(Ecore_X_Damage damage,
3424 Ecore_X_Region repair,
3425 Ecore_X_Region parts);
3426
3427EAPI Eina_Bool
3428 ecore_x_screen_is_composited(int screen);
3429EAPI void
3430 ecore_x_screen_is_composited_set(int screen,
3431 Ecore_X_Window win);
3432
3433EAPI Eina_Bool
3434 ecore_x_dpms_query(void);
3435EAPI Eina_Bool
3436 ecore_x_dpms_capable_get(void);
3437EAPI Eina_Bool
3438 ecore_x_dpms_enabled_get(void);
3439EAPI void
3440 ecore_x_dpms_enabled_set(int enabled);
3441EAPI void
3442 ecore_x_dpms_timeouts_get(unsigned int *standby,
3443 unsigned int *suspend,
3444 unsigned int *off);
3445EAPI Eina_Bool
3446ecore_x_dpms_timeouts_set(unsigned int standby,
3447 unsigned int suspend,
3448 unsigned int off);
3449EAPI unsigned int
3450 ecore_x_dpms_timeout_standby_get(void);
3451EAPI unsigned int
3452 ecore_x_dpms_timeout_suspend_get(void);
3453EAPI unsigned int
3454 ecore_x_dpms_timeout_off_get(void);
3455EAPI void
3456 ecore_x_dpms_timeout_standby_set(unsigned int new_timeout);
3457EAPI void
3458 ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout);
3459EAPI void
3460 ecore_x_dpms_timeout_off_set(unsigned int new_timeout);
3461
3462EAPI Eina_Bool
3463 ecore_x_test_fake_key_down(const char *key);
3464EAPI Eina_Bool
3465 ecore_x_test_fake_key_up(const char *key);
3466EAPI Eina_Bool
3467 ecore_x_test_fake_key_press(const char *key);
3468EAPI const char *
3469 ecore_x_keysym_string_get(int keysym);
3470
3471/**
3472 * Given a keyname, return the keycode representing that key
3473 *
3474 * @since 1.2.0
3475 */
3476EAPI int ecore_x_keysym_keycode_get(const char *keyname);
3477
3478typedef struct _Ecore_X_Image Ecore_X_Image;
3479
3480EAPI Ecore_X_Image *
3481ecore_x_image_new(int w,
3482 int h,
3483 Ecore_X_Visual vis,
3484 int depth);
3485EAPI void
3486 ecore_x_image_free(Ecore_X_Image *im);
3487EAPI Eina_Bool
3488 ecore_x_image_get(Ecore_X_Image *im,
3489 Ecore_X_Drawable draw,
3490 int x,
3491 int y,
3492 int sx,
3493 int sy,
3494 int w,
3495 int h);
3496EAPI void
3497ecore_x_image_put(Ecore_X_Image *im,
3498 Ecore_X_Drawable draw,
3499 Ecore_X_GC gc,
3500 int x,
3501 int y,
3502 int sx,
3503 int sy,
3504 int w,
3505 int h);
3506EAPI void *
3507ecore_x_image_data_get(Ecore_X_Image *im,
3508 int *bpl,
3509 int *rows,
3510 int *bpp);
3511EAPI Eina_Bool
3512ecore_x_image_is_argb32_get(Ecore_X_Image *im);
3513
3514EAPI Eina_Bool
3515ecore_x_image_to_argb_convert(void *src,
3516 int sbpp,
3517 int sbpl,
3518 Ecore_X_Colormap c,
3519 Ecore_X_Visual v,
3520 int x,
3521 int y,
3522 int w,
3523 int h,
3524 unsigned int *dst,
3525 int dbpl,
3526 int dx,
3527 int dy);
3528
3529EAPI Eina_Bool
3530ecore_x_input_multi_select(Ecore_X_Window win);
3531
3532EAPI Eina_Bool
3533ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win);
3534
3535typedef enum _Ecore_X_Gesture_Event_Mask
3536{
3537 ECORE_X_GESTURE_EVENT_MASK_NONE = 0L,
3538 ECORE_X_GESTURE_EVENT_MASK_FLICK = (1L << 0),
3539 ECORE_X_GESTURE_EVENT_MASK_PAN = (1L << 1),
3540 ECORE_X_GESTURE_EVENT_MASK_PINCHROTATION = (1L << 2),
3541 ECORE_X_GESTURE_EVENT_MASK_TAP = (1L << 3),
3542 ECORE_X_GESTURE_EVENT_MASK_TAPNHOLD = (1L << 4),
3543 ECORE_X_GESTURE_EVENT_MASK_HOLD = (1L << 5),
3544 ECORE_X_GESTURE_EVENT_MASK_GROUP = (1L << 6)
3545} Ecore_X_Gesture_Event_Mask;
3546
3547typedef enum _Ecore_X_Gesture_Event_Type
3548{
3549 ECORE_X_GESTURE_EVENT_FLICK,
3550 ECORE_X_GESTURE_EVENT_PAN,
3551 ECORE_X_GESTURE_EVENT_PINCHROTATION,
3552 ECORE_X_GESTURE_EVENT_TAP,
3553 ECORE_X_GESTURE_EVENT_TAPNHOLD,
3554 ECORE_X_GESTURE_EVENT_HOLD,
3555 ECORE_X_GESTURE_EVENT_GROUP
3556} Ecore_X_Gesture_Event_Type;
3557
3558typedef enum _Ecore_X_Gesture_Event_Subtype
3559{
3560 ECORE_X_GESTURE_END,
3561 ECORE_X_GESTURE_BEGIN,
3562 ECORE_X_GESTURE_UPDATE,
3563 ECORE_X_GESTURE_DONE
3564} Ecore_X_Gesture_Event_Subtype;
3565
3566typedef enum _Ecore_X_Gesture_Group_Subtype
3567{
3568 ECORE_X_GESTURE_GROUP_REMOVED,
3569 ECORE_X_GESTURE_GROUP_ADDED,
3570 ECORE_X_GESTURE_GROUP_CURRENT
3571} Ecore_X_Gesture_Group_Subtype;
3572
3573typedef enum _Ecore_X_Gesture_Direction
3574{
3575 ECORE_X_GESTURE_NORTHWARD,
3576 ECORE_X_GESTURE_NORTHEASTWARD,
3577 ECORE_X_GESTURE_EASTWARD,
3578 ECORE_X_GESTURE_SOUTHEASTWARD,
3579 ECORE_X_GESTURE_SOUTHWARD,
3580 ECORE_X_GESTURE_SOUTHWESTWARD,
3581 ECORE_X_GESTURE_WESTWARD,
3582 ECORE_X_GESTURE_NORTHWESTWARD
3583} Ecore_X_Gesture_Direction;
3584
3585struct _Ecore_X_Event_Gesture_Notify_Flick
3586{
3587 Ecore_X_Window win;
3588 Ecore_X_Time time;
3589 Ecore_X_Gesture_Event_Subtype subtype;
3590 int num_fingers;
3591 int distance;
3592 Ecore_X_Time duration;
3593 Ecore_X_Gesture_Direction direction;
3594 double angle;
3595};
3596
3597struct _Ecore_X_Event_Gesture_Notify_Pan
3598{
3599 Ecore_X_Window win;
3600 Ecore_X_Time time;
3601 Ecore_X_Gesture_Event_Subtype subtype;
3602 int num_fingers;
3603 int dx;
3604 int dy;
3605 int distance;
3606 Ecore_X_Time duration;
3607 Ecore_X_Gesture_Direction direction;
3608};
3609
3610struct _Ecore_X_Event_Gesture_Notify_PinchRotation
3611{
3612 Ecore_X_Window win;
3613 Ecore_X_Time time;
3614 Ecore_X_Gesture_Event_Subtype subtype;
3615 int num_fingers;
3616 int distance;
3617 int cx;
3618 int cy;
3619 double zoom;
3620 double angle;
3621};
3622
3623struct _Ecore_X_Event_Gesture_Notify_Tap
3624{
3625 Ecore_X_Window win;
3626 Ecore_X_Time time;
3627 Ecore_X_Gesture_Event_Subtype subtype;
3628 int num_fingers;
3629 int cx;
3630 int cy;
3631 int tap_repeat;
3632 Ecore_X_Time interval;
3633};
3634
3635struct _Ecore_X_Event_Gesture_Notify_TapNHold
3636{
3637 Ecore_X_Window win;
3638 Ecore_X_Time time;
3639 Ecore_X_Gesture_Event_Subtype subtype;
3640 int num_fingers;
3641 int cx;
3642 int cy;
3643 Ecore_X_Time interval;
3644 Ecore_X_Time hold_time;
3645};
3646
3647struct _Ecore_X_Event_Gesture_Notify_Hold
3648{
3649 Ecore_X_Window win;
3650 Ecore_X_Time time;
3651 Ecore_X_Gesture_Event_Subtype subtype;
3652 int num_fingers;
3653 int cx;
3654 int cy;
3655 Ecore_X_Time hold_time;
3656};
3657
3658struct _Ecore_X_Event_Gesture_Notify_Group
3659{
3660 Ecore_X_Window win;
3661 Ecore_X_Time time;
3662 Ecore_X_Gesture_Group_Subtype subtype;
3663 int num_groups;
3664 int group_id;
3665};
3666
3667EAPI Eina_Bool
3668ecore_x_gesture_supported(void);
3669
3670EAPI Eina_Bool
3671ecore_x_gesture_events_select(Ecore_X_Window win,
3672 Ecore_X_Gesture_Event_Mask mask);
3673
3674EAPI Ecore_X_Gesture_Event_Mask
3675ecore_x_gesture_events_selected_get(Ecore_X_Window win);
3676
3677EAPI Eina_Bool
3678ecore_x_gesture_event_grab(Ecore_X_Window win,
3679 Ecore_X_Gesture_Event_Type type,
3680 int num_fingers);
3681
3682EAPI Eina_Bool
3683ecore_x_gesture_event_ungrab(Ecore_X_Window win,
3684 Ecore_X_Gesture_Event_Type type,
3685 int num_fingers);
3686
3687EAPI void
3688ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
3689 Ecore_X_Illume_Indicator_State state);
3690EAPI Ecore_X_Illume_Indicator_State
3691ecore_x_e_illume_indicator_state_get(Ecore_X_Window win);
3692EAPI void
3693ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
3694 Ecore_X_Illume_Indicator_State state);
3695
3696EAPI void
3697ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
3698 Ecore_X_Illume_Indicator_Opacity_Mode mode);
3699
3700EAPI Ecore_X_Illume_Indicator_Opacity_Mode
3701ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win);
3702
3703EAPI void
3704ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
3705 Ecore_X_Illume_Indicator_Opacity_Mode mode);
3706
3707#ifdef __cplusplus
3708}
3709#endif // ifdef __cplusplus
3710
3711#include <Ecore_X_Atoms.h>
3712#include <Ecore_X_Cursor.h>
3713
3714#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
deleted file mode 100644
index 1341716..0000000
--- a/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h
+++ /dev/null
@@ -1,269 +0,0 @@
1#ifndef _ECORE_X_ATOMS_H
2#define _ECORE_X_ATOMS_H
3
4/**
5 * @file
6 * @brief Ecore X atoms
7 */
8
9/* generic atoms */
10EAPI extern Ecore_X_Atom ECORE_X_ATOM_ATOM;
11EAPI extern Ecore_X_Atom ECORE_X_ATOM_CARDINAL;
12EAPI extern Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT;
13EAPI extern Ecore_X_Atom ECORE_X_ATOM_FILE_NAME;
14EAPI extern Ecore_X_Atom ECORE_X_ATOM_STRING;
15EAPI extern Ecore_X_Atom ECORE_X_ATOM_TEXT;
16EAPI extern Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING;
17EAPI extern Ecore_X_Atom ECORE_X_ATOM_WINDOW;
18EAPI extern Ecore_X_Atom ECORE_X_ATOM_PIXMAP;
19EAPI extern Ecore_X_Atom ECORE_X_ATOM_VISUALID;
20
21/* dnd atoms */
22EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND;
23EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND;
24EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE;
25EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER;
26EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST;
27EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION;
28EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY;
29EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE;
30EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE;
31EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK;
32EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST;
33EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK;
34EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION;
35EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY;
36EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS;
37EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE;
38EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_DROP;
39EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED;
40
41/* dnd atoms that need to be exposed to the application interface */
42EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_COPY;
43EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_MOVE;
44EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_LINK;
45EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_ASK;
46EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE;
47
48/* old E atom */
49EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE;
50
51/* old Gnome atom */
52EAPI extern Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER;
53
54/* ICCCM: client properties */
55EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_NAME;
56EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME;
57EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS;
58EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS;
59EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_HINTS;
60EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CLASS;
61EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR;
62EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS;
63EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS;
64EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND;
65EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE;
66
67/* ICCCM: window manager properties */
68EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_STATE;
69EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE;
70
71/* ICCCM: WM_STATEproperty */
72EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE;
73
74/* ICCCM: WM_PROTOCOLS properties */
75EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS;
76EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF;
77EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW;
78
79/* ICCCM: WM_COLORMAP properties */
80EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY;
81
82/* ICCCM: session management properties */
83EAPI extern Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID;
84EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER;
85EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE;
86
87/* Motif WM atom */
88EAPI extern Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS;
89
90EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED;
91EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST;
92EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING;
93EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS;
94EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY;
95EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT;
96EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP;
97EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES;
98EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW;
99EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA;
100EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK;
101EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS;
102EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT;
103EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP;
104
105/* pager */
106EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW;
107EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW;
108EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE;
109EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW;
110
111EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS;
112EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME;
113EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME;
114EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME;
115EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME;
116EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP;
117
118/* window type */
119EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE;
120EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
121EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
122EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
123EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
124EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
125EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
126EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
127EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
128EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
129EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU;
130EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP;
131EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION;
132EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO;
133EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND;
134
135/* state */
136EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE;
137EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL;
138EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY;
139EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
140EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
141EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED;
142EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
143EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
144EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
145EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
146EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE;
147EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW;
148EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
149
150/* allowed actions */
151EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS;
152EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE;
153EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
154EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
155EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE;
156EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK;
157EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
158EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
159EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
160EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
161EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
162EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
163EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_BELOW;
164
165EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT;
166EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL;
167EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY;
168EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON;
169EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID;
170EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS;
171EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME;
172EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID;
173EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS;
174EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING;
175EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
176EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER;
177EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY;
178EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW;
179EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE;
180EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN;
181EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO;
182EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS;
183EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY;
184EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY;
185EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD;
186EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
187EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
188EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
189
190/* currently E specific virtual keyboard extension, aim to submit to netwm spec
191 * later */
192
193EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD;
194EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE;
195EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
196EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
197EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
198EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
199EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
200EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
201EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
202EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
203EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
204EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
205EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
206EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
207EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
208EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
209EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
210
211/* Illume specific atoms */
212EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE;
213EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE_LIST;
214EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CONFORMANT;
215EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE;
216EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_SINGLE;
217EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP;
218EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
219EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_BACK;
220EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD;
221EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_HOME;
222EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_NEW;
223EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_DEL;
224EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLOSE;
225EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG;
226EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED;
227EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_START;
228EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_END;
229EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY;
230EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY;
231EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY;
232EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL;
233EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE;
234EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE;
235EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
236EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
237EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR;
238EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR;
239EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE;
240EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE;
241EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE;
242EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
243EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
244EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE;
245EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
246EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
247EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
248EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE;
249EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE;
250EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE;
251EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE;
252EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
253EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
254EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY;
255
256EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER;
257EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
258EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED;
259EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_BEGIN;
260EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_END;
261EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_CANCEL;
262EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_FLUSH;
263EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_DUMP;
264EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP;
265
266EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_PARENT;
267EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_POSITION;
268
269#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
deleted file mode 100644
index 807541e..0000000
--- a/libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef _ECORE_X_CURSOR_H
2#define _ECORE_X_CURSOR_H
3
4/**
5 * @file
6 * @brief Defines the various cursor types for the X Windows system.
7 */
8
9#define ECORE_X_CURSOR_X 0
10#define ECORE_X_CURSOR_ARROW 2
11#define ECORE_X_CURSOR_BASED_ARROW_DOWN 4
12#define ECORE_X_CURSOR_UP 6
13#define ECORE_X_CURSOR_BOAT 8
14#define ECORE_X_CURSOR_BOGOSITY 10
15#define ECORE_X_CURSOR_BOTTOM_LEFT_CORNER 12
16#define ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER 14
17#define ECORE_X_CURSOR_BOTTOM_SIDE 16
18#define ECORE_X_CURSOR_BOTTOM_TEE 18
19#define ECORE_X_CURSOR_BOX_SPIRAL 20
20#define ECORE_X_CURSOR_CENTER_PTR 22
21#define ECORE_X_CURSOR_CIRCLE 24
22#define ECORE_X_CURSOR_CLOCK 26
23#define ECORE_X_CURSOR_COFFEE_MUG 28
24#define ECORE_X_CURSOR_CROSS 30
25#define ECORE_X_CURSOR_CROSS_REVERSE 32
26#define ECORE_X_CURSOR_CROSSHAIR 34
27#define ECORE_X_CURSOR_DIAMOND_CROSS 36
28#define ECORE_X_CURSOR_DOT 38
29#define ECORE_X_CURSOR_DOT_BOX_MASK 40
30#define ECORE_X_CURSOR_DOUBLE_ARROW 42
31#define ECORE_X_CURSOR_DRAFT_LARGE 44
32#define ECORE_X_CURSOR_DRAFT_SMALL 46
33#define ECORE_X_CURSOR_DRAPED_BOX 48
34#define ECORE_X_CURSOR_EXCHANGE 50
35#define ECORE_X_CURSOR_FLEUR 52
36#define ECORE_X_CURSOR_GOBBLER 54
37#define ECORE_X_CURSOR_GUMBY 56
38#define ECORE_X_CURSOR_HAND1 58
39#define ECORE_X_CURSOR_HAND2 60
40#define ECORE_X_CURSOR_HEART 62
41#define ECORE_X_CURSOR_ICON 64
42#define ECORE_X_CURSOR_IRON_CROSS 66
43#define ECORE_X_CURSOR_LEFT_PTR 68
44#define ECORE_X_CURSOR_LEFT_SIDE 70
45#define ECORE_X_CURSOR_LEFT_TEE 72
46#define ECORE_X_CURSOR_LEFTBUTTON 74
47#define ECORE_X_CURSOR_LL_ANGLE 76
48#define ECORE_X_CURSOR_LR_ANGLE 78
49#define ECORE_X_CURSOR_MAN 80
50#define ECORE_X_CURSOR_MIDDLEBUTTON 82
51#define ECORE_X_CURSOR_MOUSE 84
52#define ECORE_X_CURSOR_PENCIL 86
53#define ECORE_X_CURSOR_PIRATE 88
54#define ECORE_X_CURSOR_PLUS 90
55#define ECORE_X_CURSOR_QUESTION_ARROW 92
56#define ECORE_X_CURSOR_RIGHT_PTR 94
57#define ECORE_X_CURSOR_RIGHT_SIDE 96
58#define ECORE_X_CURSOR_RIGHT_TEE 98
59#define ECORE_X_CURSOR_RIGHTBUTTON 100
60#define ECORE_X_CURSOR_RTL_LOGO 102
61#define ECORE_X_CURSOR_SAILBOAT 104
62#define ECORE_X_CURSOR_SB_DOWN_ARROW 106
63#define ECORE_X_CURSOR_SB_H_DOUBLE_ARROW 108
64#define ECORE_X_CURSOR_SB_LEFT_ARROW 110
65#define ECORE_X_CURSOR_SB_RIGHT_ARROW 112
66#define ECORE_X_CURSOR_SB_UP_ARROW 114
67#define ECORE_X_CURSOR_SB_V_DOUBLE_ARROW 116
68#define ECORE_X_CURSOR_SHUTTLE 118
69#define ECORE_X_CURSOR_SIZING 120
70#define ECORE_X_CURSOR_SPIDER 122
71#define ECORE_X_CURSOR_SPRAYCAN 124
72#define ECORE_X_CURSOR_STAR 126
73#define ECORE_X_CURSOR_TARGET 128
74#define ECORE_X_CURSOR_TCROSS 130
75#define ECORE_X_CURSOR_TOP_LEFT_ARROW 132
76#define ECORE_X_CURSOR_TOP_LEFT_CORNER 134
77#define ECORE_X_CURSOR_TOP_RIGHT_CORNER 136
78#define ECORE_X_CURSOR_TOP_SIDE 138
79#define ECORE_X_CURSOR_TOP_TEE 140
80#define ECORE_X_CURSOR_TREK 142
81#define ECORE_X_CURSOR_UL_ANGLE 144
82#define ECORE_X_CURSOR_UMBRELLA 146
83#define ECORE_X_CURSOR_UR_ANGLE 148
84#define ECORE_X_CURSOR_WATCH 150
85#define ECORE_X_CURSOR_XTERM 152
86
87#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
deleted file mode 100644
index b14fc7d..0000000
--- a/libraries/ecore/src/lib/ecore_x/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3SUBDIRS = xlib xcb
4
5if BUILD_ECORE_X_XCB
6DEP = xcb/libecore_x_xcb.la
7else
8DEP = xlib/libecore_x_xlib.la
9endif
10
11AM_CPPFLAGS = \
12-I$(top_srcdir)/src/lib/ecore \
13-I$(top_builddir)/src/lib/ecore \
14@EINA_CFLAGS@
15
16lib_LTLIBRARIES = libecore_x.la
17
18libecore_x_la_SOURCES =
19
20libecore_x_la_LIBADD = $(DEP) @EINA_LIBS@
21libecore_x_la_LDFLAGS = -version-info @version_info@ @release_info@
22libecore_x_la_DEPENDENCIES = $(DEP)
23
24includes_HEADERS = \
25Ecore_X.h \
26Ecore_X_Atoms.h \
27Ecore_X_Cursor.h
28includesdir = $(includedir)/ecore-@VMAJ@
29
30EXTRA_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
deleted file mode 100644
index fb446ef..0000000
--- a/libraries/ecore/src/lib/ecore_x/Makefile.in
+++ /dev/null
@@ -1,948 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38subdir = src/lib/ecore_x
39DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
40 $(srcdir)/Makefile.in
41ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
42am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
43 $(top_srcdir)/m4/ac_path_generic.m4 \
44 $(top_srcdir)/m4/check_x_extension.m4 \
45 $(top_srcdir)/m4/ecore_check_module.m4 \
46 $(top_srcdir)/m4/ecore_check_options.m4 \
47 $(top_srcdir)/m4/efl_compiler_flag.m4 \
48 $(top_srcdir)/m4/efl_doxygen.m4 \
49 $(top_srcdir)/m4/efl_examples.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4)
61mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES =
65am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
66am__vpath_adj = case $$p in \
67 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
68 *) f=$$p;; \
69 esac;
70am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
71am__install_max = 40
72am__nobase_strip_setup = \
73 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
74am__nobase_strip = \
75 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
76am__nobase_list = $(am__nobase_strip_setup); \
77 for p in $$list; do echo "$$p $$p"; done | \
78 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
79 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
80 if (++n[$$2] == $(am__install_max)) \
81 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
82 END { for (dir in files) print dir, files[dir] }'
83am__base_list = \
84 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
87LTLIBRARIES = $(lib_LTLIBRARIES)
88am_libecore_x_la_OBJECTS =
89libecore_x_la_OBJECTS = $(am_libecore_x_la_OBJECTS)
90AM_V_lt = $(am__v_lt_$(V))
91am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
92am__v_lt_0 = --silent
93libecore_x_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
94 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
95 $(libecore_x_la_LDFLAGS) $(LDFLAGS) -o $@
96DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
97COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
98 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
99LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
100 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
101 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
102 $(AM_CFLAGS) $(CFLAGS)
103AM_V_CC = $(am__v_CC_$(V))
104am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
105am__v_CC_0 = @echo " CC " $@;
106AM_V_at = $(am__v_at_$(V))
107am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
108am__v_at_0 = @
109CCLD = $(CC)
110LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
111 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
112 $(AM_LDFLAGS) $(LDFLAGS) -o $@
113AM_V_CCLD = $(am__v_CCLD_$(V))
114am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
115am__v_CCLD_0 = @echo " CCLD " $@;
116AM_V_GEN = $(am__v_GEN_$(V))
117am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
118am__v_GEN_0 = @echo " GEN " $@;
119SOURCES = $(libecore_x_la_SOURCES)
120DIST_SOURCES = $(libecore_x_la_SOURCES)
121RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
122 html-recursive info-recursive install-data-recursive \
123 install-dvi-recursive install-exec-recursive \
124 install-html-recursive install-info-recursive \
125 install-pdf-recursive install-ps-recursive install-recursive \
126 installcheck-recursive installdirs-recursive pdf-recursive \
127 ps-recursive uninstall-recursive
128HEADERS = $(includes_HEADERS)
129RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
130 distclean-recursive maintainer-clean-recursive
131AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
132 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
133 distdir
134ETAGS = etags
135CTAGS = ctags
136DIST_SUBDIRS = $(SUBDIRS)
137DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
138am__relativize = \
139 dir0=`pwd`; \
140 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
141 sed_rest='s,^[^/]*/*,,'; \
142 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
143 sed_butlast='s,/*[^/]*$$,,'; \
144 while test -n "$$dir1"; do \
145 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
146 if test "$$first" != "."; then \
147 if test "$$first" = ".."; then \
148 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
149 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
150 else \
151 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
152 if test "$$first2" = "$$first"; then \
153 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
154 else \
155 dir2="../$$dir2"; \
156 fi; \
157 dir0="$$dir0"/"$$first"; \
158 fi; \
159 fi; \
160 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
161 done; \
162 reldir="$$dir2"
163ACLOCAL = @ACLOCAL@
164ALLOCA = @ALLOCA@
165AMTAR = @AMTAR@
166AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
167AR = @AR@
168AS = @AS@
169AUTOCONF = @AUTOCONF@
170AUTOHEADER = @AUTOHEADER@
171AUTOMAKE = @AUTOMAKE@
172AWK = @AWK@
173CARES_CFLAGS = @CARES_CFLAGS@
174CARES_LIBS = @CARES_LIBS@
175CC = @CC@
176CCDEPMODE = @CCDEPMODE@
177CFLAGS = @CFLAGS@
178CHECK_CFLAGS = @CHECK_CFLAGS@
179CHECK_LIBS = @CHECK_LIBS@
180CPP = @CPP@
181CPPFLAGS = @CPPFLAGS@
182CURL_CFLAGS = @CURL_CFLAGS@
183CURL_LIBS = @CURL_LIBS@
184CXX = @CXX@
185CXXCPP = @CXXCPP@
186CXXDEPMODE = @CXXDEPMODE@
187CXXFLAGS = @CXXFLAGS@
188CYGPATH_W = @CYGPATH_W@
189DEFS = @DEFS@
190DEPDIR = @DEPDIR@
191DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
192DIRECTFB_LIBS = @DIRECTFB_LIBS@
193DLLTOOL = @DLLTOOL@
194DSYMUTIL = @DSYMUTIL@
195DUMPBIN = @DUMPBIN@
196ECHO_C = @ECHO_C@
197ECHO_N = @ECHO_N@
198ECHO_T = @ECHO_T@
199ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
200ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
201EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
202EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
203EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
204EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
205EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
206EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
207EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
208EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
209EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
210EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
211EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
212EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
213EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
214EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
215EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
216EGREP = @EGREP@
217EINA_CFLAGS = @EINA_CFLAGS@
218EINA_LIBS = @EINA_LIBS@
219ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
220ESCAPE_LIBS = @ESCAPE_LIBS@
221EVAS_CFLAGS = @EVAS_CFLAGS@
222EVAS_LIBS = @EVAS_LIBS@
223EVIL_CFLAGS = @EVIL_CFLAGS@
224EVIL_LIBS = @EVIL_LIBS@
225EXEEXT = @EXEEXT@
226EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
227EXOTIC_LIBS = @EXOTIC_LIBS@
228FGREP = @FGREP@
229GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
230GLIB_CFLAGS = @GLIB_CFLAGS@
231GLIB_LIBS = @GLIB_LIBS@
232GMSGFMT = @GMSGFMT@
233GMSGFMT_015 = @GMSGFMT_015@
234GREP = @GREP@
235INSTALL = @INSTALL@
236INSTALL_DATA = @INSTALL_DATA@
237INSTALL_PROGRAM = @INSTALL_PROGRAM@
238INSTALL_SCRIPT = @INSTALL_SCRIPT@
239INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
240INTLLIBS = @INTLLIBS@
241INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
242KEYSYMDEFS = @KEYSYMDEFS@
243LD = @LD@
244LDFLAGS = @LDFLAGS@
245LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
246LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
247LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
248LIBICONV = @LIBICONV@
249LIBINTL = @LIBINTL@
250LIBOBJS = @LIBOBJS@
251LIBS = @LIBS@
252LIBTOOL = @LIBTOOL@
253LIPO = @LIPO@
254LN_S = @LN_S@
255LTLIBICONV = @LTLIBICONV@
256LTLIBINTL = @LTLIBINTL@
257LTLIBOBJS = @LTLIBOBJS@
258MAKEINFO = @MAKEINFO@
259MKDIR_P = @MKDIR_P@
260MSGFMT = @MSGFMT@
261MSGFMT_015 = @MSGFMT_015@
262MSGMERGE = @MSGMERGE@
263NM = @NM@
264NMEDIT = @NMEDIT@
265OBJC = @OBJC@
266OBJCDEPMODE = @OBJCDEPMODE@
267OBJCFLAGS = @OBJCFLAGS@
268OBJDUMP = @OBJDUMP@
269OBJEXT = @OBJEXT@
270OTOOL = @OTOOL@
271OTOOL64 = @OTOOL64@
272PACKAGE = @PACKAGE@
273PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
274PACKAGE_NAME = @PACKAGE_NAME@
275PACKAGE_STRING = @PACKAGE_STRING@
276PACKAGE_TARNAME = @PACKAGE_TARNAME@
277PACKAGE_URL = @PACKAGE_URL@
278PACKAGE_VERSION = @PACKAGE_VERSION@
279PATH_SEPARATOR = @PATH_SEPARATOR@
280PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
281PIXMAN_LIBS = @PIXMAN_LIBS@
282PKG_CONFIG = @PKG_CONFIG@
283PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
284PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
285POSUB = @POSUB@
286RANLIB = @RANLIB@
287SCIM_CFLAGS = @SCIM_CFLAGS@
288SCIM_LIBS = @SCIM_LIBS@
289SDL_CFLAGS = @SDL_CFLAGS@
290SDL_CONFIG = @SDL_CONFIG@
291SDL_LIBS = @SDL_LIBS@
292SED = @SED@
293SET_MAKE = @SET_MAKE@
294SHELL = @SHELL@
295SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
296SSL_CFLAGS = @SSL_CFLAGS@
297SSL_LIBS = @SSL_LIBS@
298STRIP = @STRIP@
299TLS2_CFLAGS = @TLS2_CFLAGS@
300TLS2_LIBS = @TLS2_LIBS@
301TLS_CFLAGS = @TLS_CFLAGS@
302TLS_LIBS = @TLS_LIBS@
303TSLIB_CFLAGS = @TSLIB_CFLAGS@
304TSLIB_LIBS = @TSLIB_LIBS@
305USE_NLS = @USE_NLS@
306VERSION = @VERSION@
307VMAJ = @VMAJ@
308WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
309WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
310WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
311WAYLAND_LIBS = @WAYLAND_LIBS@
312WIN32_CFLAGS = @WIN32_CFLAGS@
313WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
314WIN32_LIBS = @WIN32_LIBS@
315XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
316XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
317XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
318XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
319XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
320XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
321XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
322XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
323XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
324XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
325XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
326XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
327XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
328XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
329XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
330XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
331XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
332XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
333XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
334XCB_X11_LIBS = @XCB_X11_LIBS@
335XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
336XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
337XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
338XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
339XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
340XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
341XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
342XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
343XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
344XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
345XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
346XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
347XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
348XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
349XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
350XDAMAGE_LIBS = @XDAMAGE_LIBS@
351XDPMS_CFLAGS = @XDPMS_CFLAGS@
352XDPMS_LIBS = @XDPMS_LIBS@
353XFIXES_CFLAGS = @XFIXES_CFLAGS@
354XFIXES_LIBS = @XFIXES_LIBS@
355XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
356XGESTURE_LIBS = @XGESTURE_LIBS@
357XGETTEXT = @XGETTEXT@
358XGETTEXT_015 = @XGETTEXT_015@
359XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
360XI2_CFLAGS = @XI2_CFLAGS@
361XI2_LIBS = @XI2_LIBS@
362XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
363XINERAMA_LIBS = @XINERAMA_LIBS@
364XKB_CFLAGS = @XKB_CFLAGS@
365XKB_LIBS = @XKB_LIBS@
366XMKMF = @XMKMF@
367XPRINT_CFLAGS = @XPRINT_CFLAGS@
368XPRINT_LIBS = @XPRINT_LIBS@
369XRANDR_CFLAGS = @XRANDR_CFLAGS@
370XRANDR_LIBS = @XRANDR_LIBS@
371XRENDER_CFLAGS = @XRENDER_CFLAGS@
372XRENDER_LIBS = @XRENDER_LIBS@
373XSS_CFLAGS = @XSS_CFLAGS@
374XSS_LIBS = @XSS_LIBS@
375XTEST_CFLAGS = @XTEST_CFLAGS@
376XTEST_LIBS = @XTEST_LIBS@
377X_CFLAGS = @X_CFLAGS@
378X_EXTRA_LIBS = @X_EXTRA_LIBS@
379X_LIBS = @X_LIBS@
380X_PRE_LIBS = @X_PRE_LIBS@
381Xcursor_cflags = @Xcursor_cflags@
382Xcursor_libs = @Xcursor_libs@
383abs_builddir = @abs_builddir@
384abs_srcdir = @abs_srcdir@
385abs_top_builddir = @abs_top_builddir@
386abs_top_srcdir = @abs_top_srcdir@
387ac_ct_CC = @ac_ct_CC@
388ac_ct_CXX = @ac_ct_CXX@
389ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
390ac_ct_OBJC = @ac_ct_OBJC@
391am__include = @am__include@
392am__leading_dot = @am__leading_dot@
393am__quote = @am__quote@
394am__tar = @am__tar@
395am__untar = @am__untar@
396bindir = @bindir@
397build = @build@
398build_alias = @build_alias@
399build_cpu = @build_cpu@
400build_os = @build_os@
401build_vendor = @build_vendor@
402builddir = @builddir@
403cocoa_ldflags = @cocoa_ldflags@
404datadir = @datadir@
405datarootdir = @datarootdir@
406dlopen_libs = @dlopen_libs@
407docdir = @docdir@
408dvidir = @dvidir@
409ecore_cocoa_cflags = @ecore_cocoa_cflags@
410ecore_cocoa_libs = @ecore_cocoa_libs@
411ecore_con_cflags = @ecore_con_cflags@
412ecore_con_libs = @ecore_con_libs@
413ecore_directfb_cflags = @ecore_directfb_cflags@
414ecore_directfb_libs = @ecore_directfb_libs@
415ecore_evas_cflags = @ecore_evas_cflags@
416ecore_evas_libs = @ecore_evas_libs@
417ecore_fb_cflags = @ecore_fb_cflags@
418ecore_fb_libs = @ecore_fb_libs@
419ecore_file_cflags = @ecore_file_cflags@
420ecore_file_libs = @ecore_file_libs@
421ecore_imf_cflags = @ecore_imf_cflags@
422ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
423ecore_imf_evas_libs = @ecore_imf_evas_libs@
424ecore_imf_libs = @ecore_imf_libs@
425ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
426ecore_imf_scim_libs = @ecore_imf_scim_libs@
427ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
428ecore_imf_xim_libs = @ecore_imf_xim_libs@
429ecore_input_cflags = @ecore_input_cflags@
430ecore_input_evas_cflags = @ecore_input_evas_cflags@
431ecore_input_evas_libs = @ecore_input_evas_libs@
432ecore_input_libs = @ecore_input_libs@
433ecore_ipc_cflags = @ecore_ipc_cflags@
434ecore_ipc_libs = @ecore_ipc_libs@
435ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
436ecore_psl1ght_libs = @ecore_psl1ght_libs@
437ecore_sdl_cflags = @ecore_sdl_cflags@
438ecore_sdl_libs = @ecore_sdl_libs@
439ecore_wayland_cflags = @ecore_wayland_cflags@
440ecore_wayland_libs = @ecore_wayland_libs@
441ecore_win32_cflags = @ecore_win32_cflags@
442ecore_win32_libs = @ecore_win32_libs@
443ecore_wince_cflags = @ecore_wince_cflags@
444ecore_wince_libs = @ecore_wince_libs@
445ecore_x_cflags = @ecore_x_cflags@
446ecore_x_libs = @ecore_x_libs@
447ecore_x_libs_private = @ecore_x_libs_private@
448efl_doxygen = @efl_doxygen@
449efl_have_doxygen = @efl_have_doxygen@
450exec_prefix = @exec_prefix@
451have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
452host = @host@
453host_alias = @host_alias@
454host_cpu = @host_cpu@
455host_os = @host_os@
456host_vendor = @host_vendor@
457htmldir = @htmldir@
458includedir = @includedir@
459infodir = @infodir@
460install_sh = @install_sh@
461libdir = @libdir@
462libexecdir = @libexecdir@
463localedir = @localedir@
464localstatedir = @localstatedir@
465lt_ECHO = @lt_ECHO@
466lt_enable_auto_import = @lt_enable_auto_import@
467mandir = @mandir@
468mkdir_p = @mkdir_p@
469oldincludedir = @oldincludedir@
470pdfdir = @pdfdir@
471pkgconfig_requires_private = @pkgconfig_requires_private@
472prefix = @prefix@
473program_transform_name = @program_transform_name@
474psdir = @psdir@
475release_info = @release_info@
476requirements_ecore = @requirements_ecore@
477requirements_ecore_cocoa = @requirements_ecore_cocoa@
478requirements_ecore_con = @requirements_ecore_con@
479requirements_ecore_directfb = @requirements_ecore_directfb@
480requirements_ecore_evas = @requirements_ecore_evas@
481requirements_ecore_fb = @requirements_ecore_fb@
482requirements_ecore_file = @requirements_ecore_file@
483requirements_ecore_imf = @requirements_ecore_imf@
484requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
485requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
486requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
487requirements_ecore_input = @requirements_ecore_input@
488requirements_ecore_input_evas = @requirements_ecore_input_evas@
489requirements_ecore_ipc = @requirements_ecore_ipc@
490requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
491requirements_ecore_sdl = @requirements_ecore_sdl@
492requirements_ecore_wayland = @requirements_ecore_wayland@
493requirements_ecore_win32 = @requirements_ecore_win32@
494requirements_ecore_wince = @requirements_ecore_wince@
495requirements_ecore_x = @requirements_ecore_x@
496rt_libs = @rt_libs@
497sbindir = @sbindir@
498sharedstatedir = @sharedstatedir@
499srcdir = @srcdir@
500sysconfdir = @sysconfdir@
501target_alias = @target_alias@
502top_build_prefix = @top_build_prefix@
503top_builddir = @top_builddir@
504top_srcdir = @top_srcdir@
505version_info = @version_info@
506x_cflags = @x_cflags@
507x_includes = @x_includes@
508x_libs = @x_libs@
509MAINTAINERCLEANFILES = Makefile.in
510SUBDIRS = xlib xcb
511@BUILD_ECORE_X_XCB_FALSE@DEP = xlib/libecore_x_xlib.la
512@BUILD_ECORE_X_XCB_TRUE@DEP = xcb/libecore_x_xcb.la
513AM_CPPFLAGS = \
514-I$(top_srcdir)/src/lib/ecore \
515-I$(top_builddir)/src/lib/ecore \
516@EINA_CFLAGS@
517
518lib_LTLIBRARIES = libecore_x.la
519libecore_x_la_SOURCES =
520libecore_x_la_LIBADD = $(DEP) @EINA_LIBS@
521libecore_x_la_LDFLAGS = -version-info @version_info@ @release_info@
522libecore_x_la_DEPENDENCIES = $(DEP)
523includes_HEADERS = \
524Ecore_X.h \
525Ecore_X_Atoms.h \
526Ecore_X_Cursor.h
527
528includesdir = $(includedir)/ecore-@VMAJ@
529EXTRA_DIST = ecore_x_atoms_decl.h
530all: all-recursive
531
532.SUFFIXES:
533$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
534 @for dep in $?; do \
535 case '$(am__configure_deps)' in \
536 *$$dep*) \
537 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
538 && { if test -f $@; then exit 0; else break; fi; }; \
539 exit 1;; \
540 esac; \
541 done; \
542 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/Makefile'; \
543 $(am__cd) $(top_srcdir) && \
544 $(AUTOMAKE) --gnu src/lib/ecore_x/Makefile
545.PRECIOUS: Makefile
546Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
547 @case '$?' in \
548 *config.status*) \
549 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
550 *) \
551 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
552 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
553 esac;
554
555$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
556 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
557
558$(top_srcdir)/configure: $(am__configure_deps)
559 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
560$(ACLOCAL_M4): $(am__aclocal_m4_deps)
561 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
562$(am__aclocal_m4_deps):
563install-libLTLIBRARIES: $(lib_LTLIBRARIES)
564 @$(NORMAL_INSTALL)
565 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
566 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
567 list2=; for p in $$list; do \
568 if test -f $$p; then \
569 list2="$$list2 $$p"; \
570 else :; fi; \
571 done; \
572 test -z "$$list2" || { \
573 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
574 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
575 }
576
577uninstall-libLTLIBRARIES:
578 @$(NORMAL_UNINSTALL)
579 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
580 for p in $$list; do \
581 $(am__strip_dir) \
582 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
583 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
584 done
585
586clean-libLTLIBRARIES:
587 -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
588 @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
589 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
590 test "$$dir" != "$$p" || dir=.; \
591 echo "rm -f \"$${dir}/so_locations\""; \
592 rm -f "$${dir}/so_locations"; \
593 done
594libecore_x.la: $(libecore_x_la_OBJECTS) $(libecore_x_la_DEPENDENCIES)
595 $(AM_V_CCLD)$(libecore_x_la_LINK) -rpath $(libdir) $(libecore_x_la_OBJECTS) $(libecore_x_la_LIBADD) $(LIBS)
596
597mostlyclean-compile:
598 -rm -f *.$(OBJEXT)
599
600distclean-compile:
601 -rm -f *.tab.c
602
603mostlyclean-libtool:
604 -rm -f *.lo
605
606clean-libtool:
607 -rm -rf .libs _libs
608install-includesHEADERS: $(includes_HEADERS)
609 @$(NORMAL_INSTALL)
610 test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
611 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
612 for p in $$list; do \
613 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
614 echo "$$d$$p"; \
615 done | $(am__base_list) | \
616 while read files; do \
617 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
618 $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
619 done
620
621uninstall-includesHEADERS:
622 @$(NORMAL_UNINSTALL)
623 @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \
624 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
625 test -n "$$files" || exit 0; \
626 echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \
627 cd "$(DESTDIR)$(includesdir)" && rm -f $$files
628
629# This directory's subdirectories are mostly independent; you can cd
630# into them and run `make' without going through this Makefile.
631# To change the values of `make' variables: instead of editing Makefiles,
632# (1) if the variable is set in `config.status', edit `config.status'
633# (which will cause the Makefiles to be regenerated when you run `make');
634# (2) otherwise, pass the desired values on the `make' command line.
635$(RECURSIVE_TARGETS):
636 @fail= failcom='exit 1'; \
637 for f in x $$MAKEFLAGS; do \
638 case $$f in \
639 *=* | --[!k]*);; \
640 *k*) failcom='fail=yes';; \
641 esac; \
642 done; \
643 dot_seen=no; \
644 target=`echo $@ | sed s/-recursive//`; \
645 list='$(SUBDIRS)'; for subdir in $$list; do \
646 echo "Making $$target in $$subdir"; \
647 if test "$$subdir" = "."; then \
648 dot_seen=yes; \
649 local_target="$$target-am"; \
650 else \
651 local_target="$$target"; \
652 fi; \
653 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
654 || eval $$failcom; \
655 done; \
656 if test "$$dot_seen" = "no"; then \
657 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
658 fi; test -z "$$fail"
659
660$(RECURSIVE_CLEAN_TARGETS):
661 @fail= failcom='exit 1'; \
662 for f in x $$MAKEFLAGS; do \
663 case $$f in \
664 *=* | --[!k]*);; \
665 *k*) failcom='fail=yes';; \
666 esac; \
667 done; \
668 dot_seen=no; \
669 case "$@" in \
670 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
671 *) list='$(SUBDIRS)' ;; \
672 esac; \
673 rev=''; for subdir in $$list; do \
674 if test "$$subdir" = "."; then :; else \
675 rev="$$subdir $$rev"; \
676 fi; \
677 done; \
678 rev="$$rev ."; \
679 target=`echo $@ | sed s/-recursive//`; \
680 for subdir in $$rev; do \
681 echo "Making $$target in $$subdir"; \
682 if test "$$subdir" = "."; then \
683 local_target="$$target-am"; \
684 else \
685 local_target="$$target"; \
686 fi; \
687 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
688 || eval $$failcom; \
689 done && test -z "$$fail"
690tags-recursive:
691 list='$(SUBDIRS)'; for subdir in $$list; do \
692 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
693 done
694ctags-recursive:
695 list='$(SUBDIRS)'; for subdir in $$list; do \
696 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
697 done
698
699ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
700 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
701 unique=`for i in $$list; do \
702 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
703 done | \
704 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
705 END { if (nonempty) { for (i in files) print i; }; }'`; \
706 mkid -fID $$unique
707tags: TAGS
708
709TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
710 $(TAGS_FILES) $(LISP)
711 set x; \
712 here=`pwd`; \
713 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
714 include_option=--etags-include; \
715 empty_fix=.; \
716 else \
717 include_option=--include; \
718 empty_fix=; \
719 fi; \
720 list='$(SUBDIRS)'; for subdir in $$list; do \
721 if test "$$subdir" = .; then :; else \
722 test ! -f $$subdir/TAGS || \
723 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
724 fi; \
725 done; \
726 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
727 unique=`for i in $$list; do \
728 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
729 done | \
730 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
731 END { if (nonempty) { for (i in files) print i; }; }'`; \
732 shift; \
733 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
734 test -n "$$unique" || unique=$$empty_fix; \
735 if test $$# -gt 0; then \
736 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
737 "$$@" $$unique; \
738 else \
739 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
740 $$unique; \
741 fi; \
742 fi
743ctags: CTAGS
744CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
745 $(TAGS_FILES) $(LISP)
746 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
747 unique=`for i in $$list; do \
748 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
749 done | \
750 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
751 END { if (nonempty) { for (i in files) print i; }; }'`; \
752 test -z "$(CTAGS_ARGS)$$unique" \
753 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
754 $$unique
755
756GTAGS:
757 here=`$(am__cd) $(top_builddir) && pwd` \
758 && $(am__cd) $(top_srcdir) \
759 && gtags -i $(GTAGS_ARGS) "$$here"
760
761distclean-tags:
762 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
763
764distdir: $(DISTFILES)
765 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
766 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
767 list='$(DISTFILES)'; \
768 dist_files=`for file in $$list; do echo $$file; done | \
769 sed -e "s|^$$srcdirstrip/||;t" \
770 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
771 case $$dist_files in \
772 */*) $(MKDIR_P) `echo "$$dist_files" | \
773 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
774 sort -u` ;; \
775 esac; \
776 for file in $$dist_files; do \
777 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
778 if test -d $$d/$$file; then \
779 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
780 if test -d "$(distdir)/$$file"; then \
781 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
782 fi; \
783 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
784 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
785 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
786 fi; \
787 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
788 else \
789 test -f "$(distdir)/$$file" \
790 || cp -p $$d/$$file "$(distdir)/$$file" \
791 || exit 1; \
792 fi; \
793 done
794 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
795 if test "$$subdir" = .; then :; else \
796 test -d "$(distdir)/$$subdir" \
797 || $(MKDIR_P) "$(distdir)/$$subdir" \
798 || exit 1; \
799 fi; \
800 done
801 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
802 if test "$$subdir" = .; then :; else \
803 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
804 $(am__relativize); \
805 new_distdir=$$reldir; \
806 dir1=$$subdir; dir2="$(top_distdir)"; \
807 $(am__relativize); \
808 new_top_distdir=$$reldir; \
809 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
810 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
811 ($(am__cd) $$subdir && \
812 $(MAKE) $(AM_MAKEFLAGS) \
813 top_distdir="$$new_top_distdir" \
814 distdir="$$new_distdir" \
815 am__remove_distdir=: \
816 am__skip_length_check=: \
817 am__skip_mode_fix=: \
818 distdir) \
819 || exit 1; \
820 fi; \
821 done
822check-am: all-am
823check: check-recursive
824all-am: Makefile $(LTLIBRARIES) $(HEADERS)
825installdirs: installdirs-recursive
826installdirs-am:
827 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \
828 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
829 done
830install: install-recursive
831install-exec: install-exec-recursive
832install-data: install-data-recursive
833uninstall: uninstall-recursive
834
835install-am: all-am
836 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
837
838installcheck: installcheck-recursive
839install-strip:
840 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
841 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
842 `test -z '$(STRIP)' || \
843 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
844mostlyclean-generic:
845
846clean-generic:
847
848distclean-generic:
849 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
850 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
851
852maintainer-clean-generic:
853 @echo "This command is intended for maintainers to use"
854 @echo "it deletes files that may require special tools to rebuild."
855 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
856clean: clean-recursive
857
858clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
859 mostlyclean-am
860
861distclean: distclean-recursive
862 -rm -f Makefile
863distclean-am: clean-am distclean-compile distclean-generic \
864 distclean-tags
865
866dvi: dvi-recursive
867
868dvi-am:
869
870html: html-recursive
871
872html-am:
873
874info: info-recursive
875
876info-am:
877
878install-data-am: install-includesHEADERS
879
880install-dvi: install-dvi-recursive
881
882install-dvi-am:
883
884install-exec-am: install-libLTLIBRARIES
885
886install-html: install-html-recursive
887
888install-html-am:
889
890install-info: install-info-recursive
891
892install-info-am:
893
894install-man:
895
896install-pdf: install-pdf-recursive
897
898install-pdf-am:
899
900install-ps: install-ps-recursive
901
902install-ps-am:
903
904installcheck-am:
905
906maintainer-clean: maintainer-clean-recursive
907 -rm -f Makefile
908maintainer-clean-am: distclean-am maintainer-clean-generic
909
910mostlyclean: mostlyclean-recursive
911
912mostlyclean-am: mostlyclean-compile mostlyclean-generic \
913 mostlyclean-libtool
914
915pdf: pdf-recursive
916
917pdf-am:
918
919ps: ps-recursive
920
921ps-am:
922
923uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES
924
925.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
926 install-am install-strip tags-recursive
927
928.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
929 all all-am check check-am clean clean-generic \
930 clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \
931 distclean distclean-compile distclean-generic \
932 distclean-libtool distclean-tags distdir dvi dvi-am html \
933 html-am info info-am install install-am install-data \
934 install-data-am install-dvi install-dvi-am install-exec \
935 install-exec-am install-html install-html-am \
936 install-includesHEADERS install-info install-info-am \
937 install-libLTLIBRARIES install-man install-pdf install-pdf-am \
938 install-ps install-ps-am install-strip installcheck \
939 installcheck-am installdirs installdirs-am maintainer-clean \
940 maintainer-clean-generic mostlyclean mostlyclean-compile \
941 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
942 tags tags-recursive uninstall uninstall-am \
943 uninstall-includesHEADERS uninstall-libLTLIBRARIES
944
945
946# Tell versions [3.59,3.63) of GNU make to not export all variables.
947# Otherwise a system limit (for SysV at least) may be exceeded.
948.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
deleted file mode 100644
index 8952df3..0000000
--- a/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h
+++ /dev/null
@@ -1,295 +0,0 @@
1/* generic atoms */
2EAPI Ecore_X_Atom ECORE_X_ATOM_ATOM = 0;
3EAPI Ecore_X_Atom ECORE_X_ATOM_CARDINAL = 0;
4EAPI Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0;
5EAPI Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0;
6EAPI Ecore_X_Atom ECORE_X_ATOM_STRING = 0;
7EAPI Ecore_X_Atom ECORE_X_ATOM_TEXT = 0;
8EAPI Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0;
9EAPI Ecore_X_Atom ECORE_X_ATOM_WINDOW = 0;
10EAPI Ecore_X_Atom ECORE_X_ATOM_PIXMAP = 0;
11EAPI Ecore_X_Atom ECORE_X_ATOM_VISUALID = 0;
12
13/* dnd atoms */
14EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0;
15EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0;
16EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0;
17EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0;
18EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0;
19EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0;
20EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0;
21EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0;
22EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0;
23EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0;
24EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0;
25EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0;
26EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0;
27EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0;
28EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0;
29EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0;
30EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0;
31EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0;
32
33/* dnd atoms that need to be exposed to the application interface */
34EAPI Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0;
35EAPI Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0;
36EAPI Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0;
37EAPI Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0;
38EAPI Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0;
39
40/* old E atom */
41EAPI Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE = 0;
42
43/* old Gnome atom */
44EAPI Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0;
45
46/* ICCCM atoms */
47
48/* ICCCM: client properties */
49EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NAME = 0;
50EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME = 0;
51EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS = 0;
52EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS = 0;
53EAPI Ecore_X_Atom ECORE_X_ATOM_WM_HINTS = 0;
54EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLASS = 0;
55EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR = 0;
56EAPI Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS = 0;
57EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS = 0;
58EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND = 0; /* obsolete */
59EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE = 0; /* obsolete */
60
61/* ICCCM: window manager properties */
62EAPI Ecore_X_Atom ECORE_X_ATOM_WM_STATE = 0;
63EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE = 0;
64
65/* ICCCM: WM_STATE property */
66EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE = 0;
67
68/* ICCCM: WM_PROTOCOLS properties */
69EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS = 0;
70EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF = 0;
71EAPI Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW = 0;
72
73/* ICCCM: WM_COLORMAP properties */
74EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY = 0;
75
76/* ICCCM: session management properties */
77EAPI Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID = 0;
78EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER = 0;
79EAPI Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE = 0;
80
81/* Motif WM atom */
82EAPI Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS = 0;
83
84/* NetWM 1.3 atoms (http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html) */
85
86/*
87 * NetWM: Root Window Properties and related messages (complete)
88 */
89
90EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0;
91EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0;
92EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0;
93EAPI Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0;
94EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0;
95EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0;
96EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0;
97EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0;
98EAPI Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0;
99EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0;
100EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0;
101EAPI Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0;
102EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0;
103EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0;
104
105/*
106 * NetWM: Other Root Window Messages (complete)
107 */
108
109/* pager */
110EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0;
111EAPI Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0;
112EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0;
113EAPI Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0;
114
115EAPI Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0;
116
117/*
118 * NetWM: Application Window Properties (complete)
119 */
120
121EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0;
122EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0;
123EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0;
124EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0;
125EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0;
126
127/* window type */
128EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0;
129EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0;
130EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0;
131EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0;
132EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0;
133EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0;
134EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0;
135EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0;
136EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0;
137EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = 0;
138EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU = 0;
139EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP = 0;
140EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION = 0;
141EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO = 0;
142EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND = 0;
143
144/* state */
145EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0;
146EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0;
147EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0;
148EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0;
149EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0;
150EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0;
151EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0;
152EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0;
153EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0;
154EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0;
155EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0;
156EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0;
157EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0;
158
159/* allowed actions */
160EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0;
161EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0;
162EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0;
163EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0;
164EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0;
165EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0;
166EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0;
167EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0;
168EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0;
169EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0;
170EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0;
171EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_ABOVE = 0;
172EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_BELOW = 0;
173
174EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0;
175EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0;
176EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0;
177EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0;
178EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0;
179EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0;
180EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0;
181EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID = 0;
182EAPI Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0;
183
184/*
185 * NetWM: Window Manager Protocols (complete)
186 */
187
188EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0;
189EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0;
190EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = 0;
191
192/*
193 * NetWM: Not in the spec
194 */
195
196EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0;
197EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW = 0;
198EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE = 0;
199
200/*
201 * Startup Notification (http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt)
202 */
203
204EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN = 0;
205EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO = 0;
206
207/* selection atoms */
208EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS = 0;
209EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0;
210EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0;
211EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0;
212EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0;
213EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0;
214EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0;
215
216/* currently E specific virtual keyboard extension, aim to submit to netwm spec
217 * later */
218
219EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD = 0;
220EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE = 0;
221EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON = 0;
222EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF = 0;
223EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA = 0;
224EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC = 0;
225EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN = 0;
226EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER = 0;
227EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX = 0;
228EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL = 0;
229EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD = 0;
230EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP = 0;
231EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST = 0;
232EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE = 0;
233EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL = 0;
234EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD = 0;
235EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME = 0;
236
237/* currently E specific illume extension */
238EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE = 0;
239EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE_LIST = 0;
240EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CONFORMANT = 0;
241EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE = 0;
242EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_SINGLE = 0;
243EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP = 0;
244EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT = 0;
245EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_BACK = 0;
246EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD = 0;
247EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_HOME = 0;
248EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLOSE = 0;
249EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_NEW = 0;
250EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_DEL = 0;
251EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG = 0;
252EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED = 0;
253EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_START = 0;
254EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_END = 0;
255EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY = 0;
256EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY = 0;
257EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY = 0;
258EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL = 0;
259EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE = 0;
260EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE = 0;
261EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON = 0;
262EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF = 0;
263EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR = 0;
264EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0;
265EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0;
266EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0;
267EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE = 0;
268EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_ON = 0;
269EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF = 0;
270EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE = 0;
271EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE= 0;
272EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT = 0;
273EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT = 0;
274EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE = 0;
275EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE = 0;
276EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE = 0;
277EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE = 0;
278EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY = 0;
279EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON = 0;
280EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF = 0;
281
282EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0;
283EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE = 0;
284EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED = 0;
285EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_BEGIN = 0;
286EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_END = 0;
287EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_CANCEL = 0;
288
289EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_FLUSH = 0;
290EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_DUMP = 0;
291EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP = 0;
292
293/* currently Emotion and E17 specific extension */
294EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_PARENT = 0;
295EAPI 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
deleted file mode 100644
index 366ebfd..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.am
+++ /dev/null
@@ -1,99 +0,0 @@
1
2MAINTAINERCLEANFILES = Makefile.in ecore_xcb_keysym_table.h
3
4if BUILD_ECORE_X_XCB
5
6AM_CPPFLAGS = \
7 @XCB_DAMAGE_CFLAGS@ \
8 @XCB_COMPOSITE_CFLAGS@ \
9 @XCB_DPMS_CFLAGS@ \
10 @XCB_RANDR_CFLAGS@ \
11 @XCB_RENDER_CFLAGS@ \
12 @XCB_SCREENSAVER_CFLAGS@ \
13 @XCB_SHAPE_CFLAGS@ \
14 @XCB_SYNC_CFLAGS@ \
15 @XCB_XFIXES_CFLAGS@ \
16 @XCB_XINERAMA_CFLAGS@ \
17 @XCB_XPRINT_CFLAGS@ \
18 @XCB_XTEST_CFLAGS@ \
19 @XCB_XINPUT_CFLAGS@ \
20 @XCB_XGESTURE_CFLAGS@ \
21 @XCB_CURSOR_CFLAGS@ \
22 @ECORE_XCB_CFLAGS@ \
23 @PIXMAN_CFLAGS@ \
24 -I$(top_srcdir)/src/lib/ecore \
25 -I$(top_srcdir)/src/lib/ecore_x \
26 -I$(top_srcdir)/src/lib/ecore_input \
27 -I$(top_builddir)/src/lib/ecore \
28 -I$(top_builddir)/src/lib/ecore_x \
29 -I$(top_builddir)/src/lib/ecore_input \
30 @EINA_CFLAGS@
31
32noinst_LTLIBRARIES = libecore_x_xcb.la
33
34libecore_x_xcb_la_SOURCES = \
35 ecore_xcb.c \
36 ecore_xcb_atoms.c \
37 ecore_xcb_extensions.c \
38 ecore_xcb_shape.c \
39 ecore_xcb_screensaver.c \
40 ecore_xcb_sync.c \
41 ecore_xcb_render.c \
42 ecore_xcb_randr.c \
43 ecore_xcb_xfixes.c \
44 ecore_xcb_composite.c \
45 ecore_xcb_cursor.c \
46 ecore_xcb_damage.c \
47 ecore_xcb_dnd.c \
48 ecore_xcb_dpms.c \
49 ecore_xcb_drawable.c \
50 ecore_xcb_e.c \
51 ecore_xcb_gc.c \
52 ecore_xcb_image.c \
53 ecore_xcb_input.c \
54 ecore_xcb_gesture.c \
55 ecore_xcb_mwm.c \
56 ecore_xcb_pixmap.c \
57 ecore_xcb_region.c \
58 ecore_xcb_selection.c \
59 ecore_xcb_textlist.c \
60 ecore_xcb_events.c \
61 ecore_xcb_keymap.c \
62 ecore_xcb_netwm.c \
63 ecore_xcb_icccm.c \
64 ecore_xcb_window.c \
65 ecore_xcb_window_prop.c \
66 ecore_xcb_window_shape.c \
67 ecore_xcb_window_shadow.c \
68 ecore_xcb_xinerama.c \
69 ecore_xcb_error.c \
70 ecore_xcb_xtest.c \
71 ecore_xcb_vsync.c \
72 ecore_xcb_xdefaults.c
73
74libecore_x_xcb_la_LIBADD = \
75 @XCB_DAMAGE_LIBS@ \
76 @XCB_COMPOSITE_LIBS@ \
77 @XCB_DPMS_LIBS@ \
78 @XCB_RANDR_LIBS@ \
79 @XCB_RENDER_LIBS@ \
80 @XCB_SCREENSAVER_LIBS@ \
81 @XCB_SHAPE_LIBS@ \
82 @XCB_SYNC_LIBS@ \
83 @XCB_XFIXES_LIBS@ \
84 @XCB_XINERAMA_LIBS@ \
85 @XCB_XPRINT_LIBS@ \
86 @XCB_XTEST_LIBS@ \
87 @XCB_XINPUT_LIBS@ \
88 @XCB_XGESTURE_LIBS@ \
89 @XCB_CURSOR_LIBS@ \
90 @ECORE_XCB_LIBS@ \
91 @PIXMAN_LIBS@ \
92 $(top_builddir)/src/lib/ecore/libecore.la \
93 $(top_builddir)/src/lib/ecore_input/libecore_input.la \
94 @EINA_LIBS@ \
95 @dlopen_libs@
96
97endif
98
99EXTRA_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
deleted file mode 100644
index ff2227c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in
+++ /dev/null
@@ -1,905 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibdir = $(libdir)/@PACKAGE@
22pkglibexecdir = $(libexecdir)/@PACKAGE@
23am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24install_sh_DATA = $(install_sh) -c -m 644
25install_sh_PROGRAM = $(install_sh) -c
26install_sh_SCRIPT = $(install_sh) -c
27INSTALL_HEADER = $(INSTALL_DATA)
28transform = $(program_transform_name)
29NORMAL_INSTALL = :
30PRE_INSTALL = :
31POST_INSTALL = :
32NORMAL_UNINSTALL = :
33PRE_UNINSTALL = :
34POST_UNINSTALL = :
35build_triplet = @build@
36host_triplet = @host@
37subdir = src/lib/ecore_x/xcb
38DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
39ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
41 $(top_srcdir)/m4/ac_path_generic.m4 \
42 $(top_srcdir)/m4/check_x_extension.m4 \
43 $(top_srcdir)/m4/ecore_check_module.m4 \
44 $(top_srcdir)/m4/ecore_check_options.m4 \
45 $(top_srcdir)/m4/efl_compiler_flag.m4 \
46 $(top_srcdir)/m4/efl_doxygen.m4 \
47 $(top_srcdir)/m4/efl_examples.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
58 $(ACLOCAL_M4)
59mkinstalldirs = $(install_sh) -d
60CONFIG_HEADER = $(top_builddir)/config.h
61CONFIG_CLEAN_FILES =
62CONFIG_CLEAN_VPATH_FILES =
63LTLIBRARIES = $(noinst_LTLIBRARIES)
64@BUILD_ECORE_X_XCB_TRUE@libecore_x_xcb_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la \
65@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la
66am__libecore_x_xcb_la_SOURCES_DIST = ecore_xcb.c ecore_xcb_atoms.c \
67 ecore_xcb_extensions.c ecore_xcb_shape.c \
68 ecore_xcb_screensaver.c ecore_xcb_sync.c ecore_xcb_render.c \
69 ecore_xcb_randr.c ecore_xcb_xfixes.c ecore_xcb_composite.c \
70 ecore_xcb_cursor.c ecore_xcb_damage.c ecore_xcb_dnd.c \
71 ecore_xcb_dpms.c ecore_xcb_drawable.c ecore_xcb_e.c \
72 ecore_xcb_gc.c ecore_xcb_image.c ecore_xcb_input.c \
73 ecore_xcb_gesture.c ecore_xcb_mwm.c ecore_xcb_pixmap.c \
74 ecore_xcb_region.c ecore_xcb_selection.c ecore_xcb_textlist.c \
75 ecore_xcb_events.c ecore_xcb_keymap.c ecore_xcb_netwm.c \
76 ecore_xcb_icccm.c ecore_xcb_window.c ecore_xcb_window_prop.c \
77 ecore_xcb_window_shape.c ecore_xcb_window_shadow.c \
78 ecore_xcb_xinerama.c ecore_xcb_error.c ecore_xcb_xtest.c \
79 ecore_xcb_vsync.c ecore_xcb_xdefaults.c
80@BUILD_ECORE_X_XCB_TRUE@am_libecore_x_xcb_la_OBJECTS = ecore_xcb.lo \
81@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_atoms.lo \
82@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_extensions.lo \
83@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_shape.lo \
84@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_screensaver.lo \
85@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_sync.lo ecore_xcb_render.lo \
86@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_randr.lo ecore_xcb_xfixes.lo \
87@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_composite.lo \
88@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_cursor.lo \
89@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_damage.lo ecore_xcb_dnd.lo \
90@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_dpms.lo \
91@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_drawable.lo ecore_xcb_e.lo \
92@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gc.lo ecore_xcb_image.lo \
93@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_input.lo \
94@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gesture.lo ecore_xcb_mwm.lo \
95@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_pixmap.lo \
96@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_region.lo \
97@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_selection.lo \
98@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_textlist.lo \
99@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_events.lo \
100@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_keymap.lo ecore_xcb_netwm.lo \
101@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_icccm.lo ecore_xcb_window.lo \
102@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_prop.lo \
103@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shape.lo \
104@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shadow.lo \
105@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xinerama.lo \
106@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_error.lo ecore_xcb_xtest.lo \
107@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_vsync.lo \
108@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xdefaults.lo
109libecore_x_xcb_la_OBJECTS = $(am_libecore_x_xcb_la_OBJECTS)
110AM_V_lt = $(am__v_lt_$(V))
111am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
112am__v_lt_0 = --silent
113@BUILD_ECORE_X_XCB_TRUE@am_libecore_x_xcb_la_rpath =
114DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
115depcomp = $(SHELL) $(top_srcdir)/depcomp
116am__depfiles_maybe = depfiles
117am__mv = mv -f
118COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
119 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
120LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
121 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
122 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
123 $(AM_CFLAGS) $(CFLAGS)
124AM_V_CC = $(am__v_CC_$(V))
125am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
126am__v_CC_0 = @echo " CC " $@;
127AM_V_at = $(am__v_at_$(V))
128am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
129am__v_at_0 = @
130CCLD = $(CC)
131LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
132 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
133 $(AM_LDFLAGS) $(LDFLAGS) -o $@
134AM_V_CCLD = $(am__v_CCLD_$(V))
135am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
136am__v_CCLD_0 = @echo " CCLD " $@;
137AM_V_GEN = $(am__v_GEN_$(V))
138am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
139am__v_GEN_0 = @echo " GEN " $@;
140SOURCES = $(libecore_x_xcb_la_SOURCES)
141DIST_SOURCES = $(am__libecore_x_xcb_la_SOURCES_DIST)
142ETAGS = etags
143CTAGS = ctags
144DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
145ACLOCAL = @ACLOCAL@
146ALLOCA = @ALLOCA@
147AMTAR = @AMTAR@
148AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
149AR = @AR@
150AS = @AS@
151AUTOCONF = @AUTOCONF@
152AUTOHEADER = @AUTOHEADER@
153AUTOMAKE = @AUTOMAKE@
154AWK = @AWK@
155CARES_CFLAGS = @CARES_CFLAGS@
156CARES_LIBS = @CARES_LIBS@
157CC = @CC@
158CCDEPMODE = @CCDEPMODE@
159CFLAGS = @CFLAGS@
160CHECK_CFLAGS = @CHECK_CFLAGS@
161CHECK_LIBS = @CHECK_LIBS@
162CPP = @CPP@
163CPPFLAGS = @CPPFLAGS@
164CURL_CFLAGS = @CURL_CFLAGS@
165CURL_LIBS = @CURL_LIBS@
166CXX = @CXX@
167CXXCPP = @CXXCPP@
168CXXDEPMODE = @CXXDEPMODE@
169CXXFLAGS = @CXXFLAGS@
170CYGPATH_W = @CYGPATH_W@
171DEFS = @DEFS@
172DEPDIR = @DEPDIR@
173DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
174DIRECTFB_LIBS = @DIRECTFB_LIBS@
175DLLTOOL = @DLLTOOL@
176DSYMUTIL = @DSYMUTIL@
177DUMPBIN = @DUMPBIN@
178ECHO_C = @ECHO_C@
179ECHO_N = @ECHO_N@
180ECHO_T = @ECHO_T@
181ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
182ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
183EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
184EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
185EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
186EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
187EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
188EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
189EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
190EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
191EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
192EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
193EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
194EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
195EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
196EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
197EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
198EGREP = @EGREP@
199EINA_CFLAGS = @EINA_CFLAGS@
200EINA_LIBS = @EINA_LIBS@
201ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
202ESCAPE_LIBS = @ESCAPE_LIBS@
203EVAS_CFLAGS = @EVAS_CFLAGS@
204EVAS_LIBS = @EVAS_LIBS@
205EVIL_CFLAGS = @EVIL_CFLAGS@
206EVIL_LIBS = @EVIL_LIBS@
207EXEEXT = @EXEEXT@
208EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
209EXOTIC_LIBS = @EXOTIC_LIBS@
210FGREP = @FGREP@
211GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
212GLIB_CFLAGS = @GLIB_CFLAGS@
213GLIB_LIBS = @GLIB_LIBS@
214GMSGFMT = @GMSGFMT@
215GMSGFMT_015 = @GMSGFMT_015@
216GREP = @GREP@
217INSTALL = @INSTALL@
218INSTALL_DATA = @INSTALL_DATA@
219INSTALL_PROGRAM = @INSTALL_PROGRAM@
220INSTALL_SCRIPT = @INSTALL_SCRIPT@
221INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
222INTLLIBS = @INTLLIBS@
223INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
224KEYSYMDEFS = @KEYSYMDEFS@
225LD = @LD@
226LDFLAGS = @LDFLAGS@
227LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
228LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
229LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
230LIBICONV = @LIBICONV@
231LIBINTL = @LIBINTL@
232LIBOBJS = @LIBOBJS@
233LIBS = @LIBS@
234LIBTOOL = @LIBTOOL@
235LIPO = @LIPO@
236LN_S = @LN_S@
237LTLIBICONV = @LTLIBICONV@
238LTLIBINTL = @LTLIBINTL@
239LTLIBOBJS = @LTLIBOBJS@
240MAKEINFO = @MAKEINFO@
241MKDIR_P = @MKDIR_P@
242MSGFMT = @MSGFMT@
243MSGFMT_015 = @MSGFMT_015@
244MSGMERGE = @MSGMERGE@
245NM = @NM@
246NMEDIT = @NMEDIT@
247OBJC = @OBJC@
248OBJCDEPMODE = @OBJCDEPMODE@
249OBJCFLAGS = @OBJCFLAGS@
250OBJDUMP = @OBJDUMP@
251OBJEXT = @OBJEXT@
252OTOOL = @OTOOL@
253OTOOL64 = @OTOOL64@
254PACKAGE = @PACKAGE@
255PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
256PACKAGE_NAME = @PACKAGE_NAME@
257PACKAGE_STRING = @PACKAGE_STRING@
258PACKAGE_TARNAME = @PACKAGE_TARNAME@
259PACKAGE_URL = @PACKAGE_URL@
260PACKAGE_VERSION = @PACKAGE_VERSION@
261PATH_SEPARATOR = @PATH_SEPARATOR@
262PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
263PIXMAN_LIBS = @PIXMAN_LIBS@
264PKG_CONFIG = @PKG_CONFIG@
265PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
266PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
267POSUB = @POSUB@
268RANLIB = @RANLIB@
269SCIM_CFLAGS = @SCIM_CFLAGS@
270SCIM_LIBS = @SCIM_LIBS@
271SDL_CFLAGS = @SDL_CFLAGS@
272SDL_CONFIG = @SDL_CONFIG@
273SDL_LIBS = @SDL_LIBS@
274SED = @SED@
275SET_MAKE = @SET_MAKE@
276SHELL = @SHELL@
277SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
278SSL_CFLAGS = @SSL_CFLAGS@
279SSL_LIBS = @SSL_LIBS@
280STRIP = @STRIP@
281TLS2_CFLAGS = @TLS2_CFLAGS@
282TLS2_LIBS = @TLS2_LIBS@
283TLS_CFLAGS = @TLS_CFLAGS@
284TLS_LIBS = @TLS_LIBS@
285TSLIB_CFLAGS = @TSLIB_CFLAGS@
286TSLIB_LIBS = @TSLIB_LIBS@
287USE_NLS = @USE_NLS@
288VERSION = @VERSION@
289VMAJ = @VMAJ@
290WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
291WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
292WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
293WAYLAND_LIBS = @WAYLAND_LIBS@
294WIN32_CFLAGS = @WIN32_CFLAGS@
295WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
296WIN32_LIBS = @WIN32_LIBS@
297XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
298XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
299XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
300XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
301XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
302XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
303XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
304XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
305XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
306XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
307XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
308XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
309XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
310XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
311XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
312XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
313XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
314XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
315XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
316XCB_X11_LIBS = @XCB_X11_LIBS@
317XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
318XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
319XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
320XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
321XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
322XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
323XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
324XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
325XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
326XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
327XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
328XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
329XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
330XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
331XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
332XDAMAGE_LIBS = @XDAMAGE_LIBS@
333XDPMS_CFLAGS = @XDPMS_CFLAGS@
334XDPMS_LIBS = @XDPMS_LIBS@
335XFIXES_CFLAGS = @XFIXES_CFLAGS@
336XFIXES_LIBS = @XFIXES_LIBS@
337XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
338XGESTURE_LIBS = @XGESTURE_LIBS@
339XGETTEXT = @XGETTEXT@
340XGETTEXT_015 = @XGETTEXT_015@
341XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
342XI2_CFLAGS = @XI2_CFLAGS@
343XI2_LIBS = @XI2_LIBS@
344XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
345XINERAMA_LIBS = @XINERAMA_LIBS@
346XKB_CFLAGS = @XKB_CFLAGS@
347XKB_LIBS = @XKB_LIBS@
348XMKMF = @XMKMF@
349XPRINT_CFLAGS = @XPRINT_CFLAGS@
350XPRINT_LIBS = @XPRINT_LIBS@
351XRANDR_CFLAGS = @XRANDR_CFLAGS@
352XRANDR_LIBS = @XRANDR_LIBS@
353XRENDER_CFLAGS = @XRENDER_CFLAGS@
354XRENDER_LIBS = @XRENDER_LIBS@
355XSS_CFLAGS = @XSS_CFLAGS@
356XSS_LIBS = @XSS_LIBS@
357XTEST_CFLAGS = @XTEST_CFLAGS@
358XTEST_LIBS = @XTEST_LIBS@
359X_CFLAGS = @X_CFLAGS@
360X_EXTRA_LIBS = @X_EXTRA_LIBS@
361X_LIBS = @X_LIBS@
362X_PRE_LIBS = @X_PRE_LIBS@
363Xcursor_cflags = @Xcursor_cflags@
364Xcursor_libs = @Xcursor_libs@
365abs_builddir = @abs_builddir@
366abs_srcdir = @abs_srcdir@
367abs_top_builddir = @abs_top_builddir@
368abs_top_srcdir = @abs_top_srcdir@
369ac_ct_CC = @ac_ct_CC@
370ac_ct_CXX = @ac_ct_CXX@
371ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
372ac_ct_OBJC = @ac_ct_OBJC@
373am__include = @am__include@
374am__leading_dot = @am__leading_dot@
375am__quote = @am__quote@
376am__tar = @am__tar@
377am__untar = @am__untar@
378bindir = @bindir@
379build = @build@
380build_alias = @build_alias@
381build_cpu = @build_cpu@
382build_os = @build_os@
383build_vendor = @build_vendor@
384builddir = @builddir@
385cocoa_ldflags = @cocoa_ldflags@
386datadir = @datadir@
387datarootdir = @datarootdir@
388dlopen_libs = @dlopen_libs@
389docdir = @docdir@
390dvidir = @dvidir@
391ecore_cocoa_cflags = @ecore_cocoa_cflags@
392ecore_cocoa_libs = @ecore_cocoa_libs@
393ecore_con_cflags = @ecore_con_cflags@
394ecore_con_libs = @ecore_con_libs@
395ecore_directfb_cflags = @ecore_directfb_cflags@
396ecore_directfb_libs = @ecore_directfb_libs@
397ecore_evas_cflags = @ecore_evas_cflags@
398ecore_evas_libs = @ecore_evas_libs@
399ecore_fb_cflags = @ecore_fb_cflags@
400ecore_fb_libs = @ecore_fb_libs@
401ecore_file_cflags = @ecore_file_cflags@
402ecore_file_libs = @ecore_file_libs@
403ecore_imf_cflags = @ecore_imf_cflags@
404ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
405ecore_imf_evas_libs = @ecore_imf_evas_libs@
406ecore_imf_libs = @ecore_imf_libs@
407ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
408ecore_imf_scim_libs = @ecore_imf_scim_libs@
409ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
410ecore_imf_xim_libs = @ecore_imf_xim_libs@
411ecore_input_cflags = @ecore_input_cflags@
412ecore_input_evas_cflags = @ecore_input_evas_cflags@
413ecore_input_evas_libs = @ecore_input_evas_libs@
414ecore_input_libs = @ecore_input_libs@
415ecore_ipc_cflags = @ecore_ipc_cflags@
416ecore_ipc_libs = @ecore_ipc_libs@
417ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
418ecore_psl1ght_libs = @ecore_psl1ght_libs@
419ecore_sdl_cflags = @ecore_sdl_cflags@
420ecore_sdl_libs = @ecore_sdl_libs@
421ecore_wayland_cflags = @ecore_wayland_cflags@
422ecore_wayland_libs = @ecore_wayland_libs@
423ecore_win32_cflags = @ecore_win32_cflags@
424ecore_win32_libs = @ecore_win32_libs@
425ecore_wince_cflags = @ecore_wince_cflags@
426ecore_wince_libs = @ecore_wince_libs@
427ecore_x_cflags = @ecore_x_cflags@
428ecore_x_libs = @ecore_x_libs@
429ecore_x_libs_private = @ecore_x_libs_private@
430efl_doxygen = @efl_doxygen@
431efl_have_doxygen = @efl_have_doxygen@
432exec_prefix = @exec_prefix@
433have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
434host = @host@
435host_alias = @host_alias@
436host_cpu = @host_cpu@
437host_os = @host_os@
438host_vendor = @host_vendor@
439htmldir = @htmldir@
440includedir = @includedir@
441infodir = @infodir@
442install_sh = @install_sh@
443libdir = @libdir@
444libexecdir = @libexecdir@
445localedir = @localedir@
446localstatedir = @localstatedir@
447lt_ECHO = @lt_ECHO@
448lt_enable_auto_import = @lt_enable_auto_import@
449mandir = @mandir@
450mkdir_p = @mkdir_p@
451oldincludedir = @oldincludedir@
452pdfdir = @pdfdir@
453pkgconfig_requires_private = @pkgconfig_requires_private@
454prefix = @prefix@
455program_transform_name = @program_transform_name@
456psdir = @psdir@
457release_info = @release_info@
458requirements_ecore = @requirements_ecore@
459requirements_ecore_cocoa = @requirements_ecore_cocoa@
460requirements_ecore_con = @requirements_ecore_con@
461requirements_ecore_directfb = @requirements_ecore_directfb@
462requirements_ecore_evas = @requirements_ecore_evas@
463requirements_ecore_fb = @requirements_ecore_fb@
464requirements_ecore_file = @requirements_ecore_file@
465requirements_ecore_imf = @requirements_ecore_imf@
466requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
467requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
468requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
469requirements_ecore_input = @requirements_ecore_input@
470requirements_ecore_input_evas = @requirements_ecore_input_evas@
471requirements_ecore_ipc = @requirements_ecore_ipc@
472requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
473requirements_ecore_sdl = @requirements_ecore_sdl@
474requirements_ecore_wayland = @requirements_ecore_wayland@
475requirements_ecore_win32 = @requirements_ecore_win32@
476requirements_ecore_wince = @requirements_ecore_wince@
477requirements_ecore_x = @requirements_ecore_x@
478rt_libs = @rt_libs@
479sbindir = @sbindir@
480sharedstatedir = @sharedstatedir@
481srcdir = @srcdir@
482sysconfdir = @sysconfdir@
483target_alias = @target_alias@
484top_build_prefix = @top_build_prefix@
485top_builddir = @top_builddir@
486top_srcdir = @top_srcdir@
487version_info = @version_info@
488x_cflags = @x_cflags@
489x_includes = @x_includes@
490x_libs = @x_libs@
491MAINTAINERCLEANFILES = Makefile.in ecore_xcb_keysym_table.h
492@BUILD_ECORE_X_XCB_TRUE@AM_CPPFLAGS = \
493@BUILD_ECORE_X_XCB_TRUE@ @XCB_DAMAGE_CFLAGS@ \
494@BUILD_ECORE_X_XCB_TRUE@ @XCB_COMPOSITE_CFLAGS@ \
495@BUILD_ECORE_X_XCB_TRUE@ @XCB_DPMS_CFLAGS@ \
496@BUILD_ECORE_X_XCB_TRUE@ @XCB_RANDR_CFLAGS@ \
497@BUILD_ECORE_X_XCB_TRUE@ @XCB_RENDER_CFLAGS@ \
498@BUILD_ECORE_X_XCB_TRUE@ @XCB_SCREENSAVER_CFLAGS@ \
499@BUILD_ECORE_X_XCB_TRUE@ @XCB_SHAPE_CFLAGS@ \
500@BUILD_ECORE_X_XCB_TRUE@ @XCB_SYNC_CFLAGS@ \
501@BUILD_ECORE_X_XCB_TRUE@ @XCB_XFIXES_CFLAGS@ \
502@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINERAMA_CFLAGS@ \
503@BUILD_ECORE_X_XCB_TRUE@ @XCB_XPRINT_CFLAGS@ \
504@BUILD_ECORE_X_XCB_TRUE@ @XCB_XTEST_CFLAGS@ \
505@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINPUT_CFLAGS@ \
506@BUILD_ECORE_X_XCB_TRUE@ @XCB_XGESTURE_CFLAGS@ \
507@BUILD_ECORE_X_XCB_TRUE@ @XCB_CURSOR_CFLAGS@ \
508@BUILD_ECORE_X_XCB_TRUE@ @ECORE_XCB_CFLAGS@ \
509@BUILD_ECORE_X_XCB_TRUE@ @PIXMAN_CFLAGS@ \
510@BUILD_ECORE_X_XCB_TRUE@ -I$(top_srcdir)/src/lib/ecore \
511@BUILD_ECORE_X_XCB_TRUE@ -I$(top_srcdir)/src/lib/ecore_x \
512@BUILD_ECORE_X_XCB_TRUE@ -I$(top_srcdir)/src/lib/ecore_input \
513@BUILD_ECORE_X_XCB_TRUE@ -I$(top_builddir)/src/lib/ecore \
514@BUILD_ECORE_X_XCB_TRUE@ -I$(top_builddir)/src/lib/ecore_x \
515@BUILD_ECORE_X_XCB_TRUE@ -I$(top_builddir)/src/lib/ecore_input \
516@BUILD_ECORE_X_XCB_TRUE@ @EINA_CFLAGS@
517
518@BUILD_ECORE_X_XCB_TRUE@noinst_LTLIBRARIES = libecore_x_xcb.la
519@BUILD_ECORE_X_XCB_TRUE@libecore_x_xcb_la_SOURCES = \
520@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb.c \
521@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_atoms.c \
522@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_extensions.c \
523@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_shape.c \
524@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_screensaver.c \
525@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_sync.c \
526@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_render.c \
527@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_randr.c \
528@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xfixes.c \
529@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_composite.c \
530@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_cursor.c \
531@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_damage.c \
532@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_dnd.c \
533@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_dpms.c \
534@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_drawable.c \
535@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_e.c \
536@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gc.c \
537@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_image.c \
538@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_input.c \
539@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gesture.c \
540@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_mwm.c \
541@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_pixmap.c \
542@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_region.c \
543@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_selection.c \
544@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_textlist.c \
545@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_events.c \
546@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_keymap.c \
547@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_netwm.c \
548@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_icccm.c \
549@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window.c \
550@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_prop.c \
551@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shape.c \
552@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shadow.c \
553@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xinerama.c \
554@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_error.c \
555@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xtest.c \
556@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_vsync.c \
557@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xdefaults.c
558
559@BUILD_ECORE_X_XCB_TRUE@libecore_x_xcb_la_LIBADD = \
560@BUILD_ECORE_X_XCB_TRUE@ @XCB_DAMAGE_LIBS@ \
561@BUILD_ECORE_X_XCB_TRUE@ @XCB_COMPOSITE_LIBS@ \
562@BUILD_ECORE_X_XCB_TRUE@ @XCB_DPMS_LIBS@ \
563@BUILD_ECORE_X_XCB_TRUE@ @XCB_RANDR_LIBS@ \
564@BUILD_ECORE_X_XCB_TRUE@ @XCB_RENDER_LIBS@ \
565@BUILD_ECORE_X_XCB_TRUE@ @XCB_SCREENSAVER_LIBS@ \
566@BUILD_ECORE_X_XCB_TRUE@ @XCB_SHAPE_LIBS@ \
567@BUILD_ECORE_X_XCB_TRUE@ @XCB_SYNC_LIBS@ \
568@BUILD_ECORE_X_XCB_TRUE@ @XCB_XFIXES_LIBS@ \
569@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINERAMA_LIBS@ \
570@BUILD_ECORE_X_XCB_TRUE@ @XCB_XPRINT_LIBS@ \
571@BUILD_ECORE_X_XCB_TRUE@ @XCB_XTEST_LIBS@ \
572@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINPUT_LIBS@ \
573@BUILD_ECORE_X_XCB_TRUE@ @XCB_XGESTURE_LIBS@ \
574@BUILD_ECORE_X_XCB_TRUE@ @XCB_CURSOR_LIBS@ \
575@BUILD_ECORE_X_XCB_TRUE@ @ECORE_XCB_LIBS@ \
576@BUILD_ECORE_X_XCB_TRUE@ @PIXMAN_LIBS@ \
577@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/lib/ecore/libecore.la \
578@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la \
579@BUILD_ECORE_X_XCB_TRUE@ @EINA_LIBS@ \
580@BUILD_ECORE_X_XCB_TRUE@ @dlopen_libs@
581
582EXTRA_DIST = ecore_xcb_private.h
583all: all-am
584
585.SUFFIXES:
586.SUFFIXES: .c .lo .o .obj
587$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
588 @for dep in $?; do \
589 case '$(am__configure_deps)' in \
590 *$$dep*) \
591 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
592 && { if test -f $@; then exit 0; else break; fi; }; \
593 exit 1;; \
594 esac; \
595 done; \
596 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/xcb/Makefile'; \
597 $(am__cd) $(top_srcdir) && \
598 $(AUTOMAKE) --gnu src/lib/ecore_x/xcb/Makefile
599.PRECIOUS: Makefile
600Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
601 @case '$?' in \
602 *config.status*) \
603 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
604 *) \
605 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
606 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
607 esac;
608
609$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
610 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
611
612$(top_srcdir)/configure: $(am__configure_deps)
613 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
614$(ACLOCAL_M4): $(am__aclocal_m4_deps)
615 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
616$(am__aclocal_m4_deps):
617
618clean-noinstLTLIBRARIES:
619 -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
620 @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
621 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
622 test "$$dir" != "$$p" || dir=.; \
623 echo "rm -f \"$${dir}/so_locations\""; \
624 rm -f "$${dir}/so_locations"; \
625 done
626libecore_x_xcb.la: $(libecore_x_xcb_la_OBJECTS) $(libecore_x_xcb_la_DEPENDENCIES)
627 $(AM_V_CCLD)$(LINK) $(am_libecore_x_xcb_la_rpath) $(libecore_x_xcb_la_OBJECTS) $(libecore_x_xcb_la_LIBADD) $(LIBS)
628
629mostlyclean-compile:
630 -rm -f *.$(OBJEXT)
631
632distclean-compile:
633 -rm -f *.tab.c
634
635@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb.Plo@am__quote@
636@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_atoms.Plo@am__quote@
637@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_composite.Plo@am__quote@
638@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_cursor.Plo@am__quote@
639@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_damage.Plo@am__quote@
640@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_dnd.Plo@am__quote@
641@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_dpms.Plo@am__quote@
642@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_drawable.Plo@am__quote@
643@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_e.Plo@am__quote@
644@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_error.Plo@am__quote@
645@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_events.Plo@am__quote@
646@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_extensions.Plo@am__quote@
647@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_gc.Plo@am__quote@
648@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_gesture.Plo@am__quote@
649@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_icccm.Plo@am__quote@
650@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_image.Plo@am__quote@
651@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_input.Plo@am__quote@
652@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_keymap.Plo@am__quote@
653@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_mwm.Plo@am__quote@
654@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_netwm.Plo@am__quote@
655@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_pixmap.Plo@am__quote@
656@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_randr.Plo@am__quote@
657@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_region.Plo@am__quote@
658@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_render.Plo@am__quote@
659@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_screensaver.Plo@am__quote@
660@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_selection.Plo@am__quote@
661@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_shape.Plo@am__quote@
662@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_sync.Plo@am__quote@
663@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_textlist.Plo@am__quote@
664@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_vsync.Plo@am__quote@
665@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window.Plo@am__quote@
666@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window_prop.Plo@am__quote@
667@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window_shadow.Plo@am__quote@
668@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window_shape.Plo@am__quote@
669@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xdefaults.Plo@am__quote@
670@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xfixes.Plo@am__quote@
671@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xinerama.Plo@am__quote@
672@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xtest.Plo@am__quote@
673
674.c.o:
675@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
676@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
677@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
678@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
679@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
680@am__fastdepCC_FALSE@ $(COMPILE) -c $<
681
682.c.obj:
683@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
684@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
685@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
686@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
687@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
688@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
689
690.c.lo:
691@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
692@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
693@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
694@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
695@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
696@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
697
698mostlyclean-libtool:
699 -rm -f *.lo
700
701clean-libtool:
702 -rm -rf .libs _libs
703
704ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
705 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
706 unique=`for i in $$list; do \
707 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
708 done | \
709 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
710 END { if (nonempty) { for (i in files) print i; }; }'`; \
711 mkid -fID $$unique
712tags: TAGS
713
714TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
715 $(TAGS_FILES) $(LISP)
716 set x; \
717 here=`pwd`; \
718 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
719 unique=`for i in $$list; do \
720 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
721 done | \
722 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
723 END { if (nonempty) { for (i in files) print i; }; }'`; \
724 shift; \
725 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
726 test -n "$$unique" || unique=$$empty_fix; \
727 if test $$# -gt 0; then \
728 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
729 "$$@" $$unique; \
730 else \
731 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
732 $$unique; \
733 fi; \
734 fi
735ctags: CTAGS
736CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
737 $(TAGS_FILES) $(LISP)
738 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
739 unique=`for i in $$list; do \
740 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
741 done | \
742 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
743 END { if (nonempty) { for (i in files) print i; }; }'`; \
744 test -z "$(CTAGS_ARGS)$$unique" \
745 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
746 $$unique
747
748GTAGS:
749 here=`$(am__cd) $(top_builddir) && pwd` \
750 && $(am__cd) $(top_srcdir) \
751 && gtags -i $(GTAGS_ARGS) "$$here"
752
753distclean-tags:
754 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
755
756distdir: $(DISTFILES)
757 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
758 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
759 list='$(DISTFILES)'; \
760 dist_files=`for file in $$list; do echo $$file; done | \
761 sed -e "s|^$$srcdirstrip/||;t" \
762 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
763 case $$dist_files in \
764 */*) $(MKDIR_P) `echo "$$dist_files" | \
765 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
766 sort -u` ;; \
767 esac; \
768 for file in $$dist_files; do \
769 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
770 if test -d $$d/$$file; then \
771 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
772 if test -d "$(distdir)/$$file"; then \
773 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
774 fi; \
775 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
776 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
777 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
778 fi; \
779 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
780 else \
781 test -f "$(distdir)/$$file" \
782 || cp -p $$d/$$file "$(distdir)/$$file" \
783 || exit 1; \
784 fi; \
785 done
786check-am: all-am
787check: check-am
788all-am: Makefile $(LTLIBRARIES)
789installdirs:
790install: install-am
791install-exec: install-exec-am
792install-data: install-data-am
793uninstall: uninstall-am
794
795install-am: all-am
796 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
797
798installcheck: installcheck-am
799install-strip:
800 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
801 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
802 `test -z '$(STRIP)' || \
803 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
804mostlyclean-generic:
805
806clean-generic:
807
808distclean-generic:
809 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
810 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
811
812maintainer-clean-generic:
813 @echo "This command is intended for maintainers to use"
814 @echo "it deletes files that may require special tools to rebuild."
815 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
816clean: clean-am
817
818clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
819 mostlyclean-am
820
821distclean: distclean-am
822 -rm -rf ./$(DEPDIR)
823 -rm -f Makefile
824distclean-am: clean-am distclean-compile distclean-generic \
825 distclean-tags
826
827dvi: dvi-am
828
829dvi-am:
830
831html: html-am
832
833html-am:
834
835info: info-am
836
837info-am:
838
839install-data-am:
840
841install-dvi: install-dvi-am
842
843install-dvi-am:
844
845install-exec-am:
846
847install-html: install-html-am
848
849install-html-am:
850
851install-info: install-info-am
852
853install-info-am:
854
855install-man:
856
857install-pdf: install-pdf-am
858
859install-pdf-am:
860
861install-ps: install-ps-am
862
863install-ps-am:
864
865installcheck-am:
866
867maintainer-clean: maintainer-clean-am
868 -rm -rf ./$(DEPDIR)
869 -rm -f Makefile
870maintainer-clean-am: distclean-am maintainer-clean-generic
871
872mostlyclean: mostlyclean-am
873
874mostlyclean-am: mostlyclean-compile mostlyclean-generic \
875 mostlyclean-libtool
876
877pdf: pdf-am
878
879pdf-am:
880
881ps: ps-am
882
883ps-am:
884
885uninstall-am:
886
887.MAKE: install-am install-strip
888
889.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
890 clean-libtool clean-noinstLTLIBRARIES ctags distclean \
891 distclean-compile distclean-generic distclean-libtool \
892 distclean-tags distdir dvi dvi-am html html-am info info-am \
893 install install-am install-data install-data-am install-dvi \
894 install-dvi-am install-exec install-exec-am install-html \
895 install-html-am install-info install-info-am install-man \
896 install-pdf install-pdf-am install-ps install-ps-am \
897 install-strip installcheck installcheck-am installdirs \
898 maintainer-clean maintainer-clean-generic mostlyclean \
899 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
900 pdf pdf-am ps ps-am tags uninstall uninstall-am
901
902
903# Tell versions [3.59,3.63) of GNU make to not export all variables.
904# Otherwise a system limit (for SysV at least) may be exceeded.
905.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
deleted file mode 100644
index ca7e798..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c
+++ /dev/null
@@ -1,1470 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <X11/Xlib-xcb.h>
3#include <dlfcn.h>
4
5/* local function prototypes */
6static int _ecore_xcb_shutdown(Eina_Bool close_display);
7static Eina_Bool _ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr __UNUSED__);
8static Eina_Bool _ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr __UNUSED__);
9static Eina_Bool _ecore_xcb_idle_enter(void *data __UNUSED__);
10
11/* local variables */
12static int _ecore_xcb_init_count = 0;
13static int _ecore_xcb_grab_count = 0;
14static Ecore_Fd_Handler *_ecore_xcb_fd_handler = NULL;
15static xcb_generic_event_t *_ecore_xcb_event_buffered = NULL;
16static Ecore_Idle_Enterer *_ecore_xcb_idle_enterer = NULL;
17
18/* external variables */
19int _ecore_xcb_log_dom = -1;
20Ecore_X_Display *_ecore_xcb_display = NULL;
21Ecore_X_Connection *_ecore_xcb_conn = NULL;
22Ecore_X_Screen *_ecore_xcb_screen = NULL;
23Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM];
24double _ecore_xcb_double_click_time = 0.25;
25
26/**
27 * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions
28 *
29 * Functions that start and shut down the Ecore X Library.
30 */
31
32/**
33 * Initialize the X display connection to the given display.
34 *
35 * @param name Display target name. If @c NULL, the default display is
36 * assumed.
37 * @return The number of times the library has been initialized without
38 * being shut down. 0 is returned if an error occurs.
39 * @ingroup Ecore_X_Init_Group
40 */
41EAPI int
42ecore_x_init(const char *name)
43{
44 char *gl = NULL;
45 uint32_t mask, list[1];
46
47 /* check if we have initialized already */
48 if (++_ecore_xcb_init_count != 1)
49 return _ecore_xcb_init_count;
50
51 LOGFN(__FILE__, __LINE__, __FUNCTION__);
52
53 /* try to initialize eina */
54 if (!eina_init()) return --_ecore_xcb_init_count;
55
56 /* setup ecore_xcb log domain */
57 _ecore_xcb_log_dom =
58 eina_log_domain_register("ecore_x", ECORE_XCB_DEFAULT_LOG_COLOR);
59 if (_ecore_xcb_log_dom < 0)
60 {
61 EINA_LOG_ERR("Cannot create Ecore Xcb log domain");
62 eina_shutdown();
63 return --_ecore_xcb_init_count;
64 }
65
66 /* try to initialize ecore */
67 if (!ecore_init())
68 {
69 /* unregister log domain */
70 eina_log_domain_unregister(_ecore_xcb_log_dom);
71 _ecore_xcb_log_dom = -1;
72 eina_shutdown();
73 return --_ecore_xcb_init_count;
74 }
75
76 /* try to initialize ecore_event */
77 if (!ecore_event_init())
78 {
79 /* unregister log domain */
80 eina_log_domain_unregister(_ecore_xcb_log_dom);
81 _ecore_xcb_log_dom = -1;
82 ecore_shutdown();
83 eina_shutdown();
84 return --_ecore_xcb_init_count;
85 }
86
87 /* NB: XLib has XInitThreads */
88
89 /* check for env var which says we are not going to use GL @ all
90 *
91 * NB: This is done because if someone wants a 'pure' xcb implementation
92 * of ecore_x, all they need do is export this variable in the environment
93 * and ecore_x will not use xlib stuff at all.
94 *
95 * The upside is you can get pure xcb-based ecore_x (w/ all the speed), but
96 * there is a down-side here in that you cannot get OpenGL without XLib :(
97 */
98 if ((gl = getenv("ECORE_X_NO_XLIB")))
99 {
100 /* we found the env var that says 'Yes, we are not ever gonna try
101 * OpenGL so it is safe to not use XLib at all' */
102
103 /* try to connect to the display server */
104 _ecore_xcb_conn = xcb_connect(name, NULL);
105 }
106 else
107 {
108 /* env var was not specified, so we will assume that the user
109 * may want opengl @ some point. connect this way for opengl to work */
110 void *libxcb, *libxlib;
111 Display *(*_real_display)(const char *display);
112 xcb_connection_t *(*_real_connection)(Display * dpy);
113 void (*_real_queue)(Display *dpy, enum XEventQueueOwner owner);
114 int (*_real_close)(Display *dpy);
115#ifdef EVAS_FRAME_QUEUING
116 Status (*_real_threads)(void);
117#endif
118
119 /* want to dlopen here to avoid actual library linkage */
120 libxlib = dlopen("libX11.so", (RTLD_LAZY | RTLD_GLOBAL));
121 if (!libxlib)
122 libxlib = dlopen("libX11.so.6", (RTLD_LAZY | RTLD_GLOBAL));
123 if (!libxlib)
124 libxlib = dlopen("libX11.so.6.3.0", (RTLD_LAZY | RTLD_GLOBAL));
125 if (!libxlib)
126 {
127 ERR("Could not dlsym to libX11");
128 /* unregister log domain */
129 eina_log_domain_unregister(_ecore_xcb_log_dom);
130 _ecore_xcb_log_dom = -1;
131 ecore_event_shutdown();
132 ecore_shutdown();
133 eina_shutdown();
134 return --_ecore_xcb_init_count;
135 }
136
137 libxcb = dlopen("libX11-xcb.so", (RTLD_LAZY | RTLD_GLOBAL));
138 if (!libxcb)
139 libxcb = dlopen("libX11-xcb.so.1", (RTLD_LAZY | RTLD_GLOBAL));
140 if (!libxcb)
141 libxcb = dlopen("libX11-xcb.so.1.0.0", (RTLD_LAZY | RTLD_GLOBAL));
142 if (!libxcb)
143 {
144 ERR("Could not dlsym to libX11-xcb");
145 /* unregister log domain */
146 eina_log_domain_unregister(_ecore_xcb_log_dom);
147 _ecore_xcb_log_dom = -1;
148 ecore_event_shutdown();
149 ecore_shutdown();
150 eina_shutdown();
151 return --_ecore_xcb_init_count;
152 }
153
154 _real_display = dlsym(libxlib, "XOpenDisplay");
155 _real_close = dlsym(libxlib, "XCloseDisplay");
156 _real_connection = dlsym(libxcb, "XGetXCBConnection");
157 _real_queue = dlsym(libxcb, "XSetEventQueueOwner");
158#ifdef EVAS_FRAME_QUEUING
159 _real_threads = dlsym(libxlib, "XInitThreads");
160#endif
161
162 if (_real_display)
163 {
164#ifdef EVAS_FRAME_QUEUING
165 if (_real_threads) _real_threads();
166#endif
167 _ecore_xcb_display = _real_display(name);
168 if (!_ecore_xcb_display)
169 {
170 ERR("Could not open Display via XLib");
171 /* unregister log domain */
172 eina_log_domain_unregister(_ecore_xcb_log_dom);
173 _ecore_xcb_log_dom = -1;
174 ecore_event_shutdown();
175 ecore_shutdown();
176 eina_shutdown();
177 return --_ecore_xcb_init_count;
178 }
179 if (_real_connection)
180 _ecore_xcb_conn = _real_connection(_ecore_xcb_display);
181 if (!_ecore_xcb_conn)
182 {
183 ERR("Could not get XCB Connection from XLib");
184
185 if (_real_close) _real_close(_ecore_xcb_display);
186
187 /* unregister log domain */
188 eina_log_domain_unregister(_ecore_xcb_log_dom);
189 _ecore_xcb_log_dom = -1;
190 ecore_event_shutdown();
191 ecore_shutdown();
192 eina_shutdown();
193 return --_ecore_xcb_init_count;
194 }
195 if (_real_queue)
196 _real_queue(_ecore_xcb_display, XCBOwnsEventQueue);
197 }
198 }
199
200 if (xcb_connection_has_error(_ecore_xcb_conn))
201 {
202 CRIT("XCB Connection has error");
203 eina_log_domain_unregister(_ecore_xcb_log_dom);
204 _ecore_xcb_log_dom = -1;
205 ecore_event_shutdown();
206 ecore_shutdown();
207 eina_shutdown();
208 return --_ecore_xcb_init_count;
209 }
210
211 /* grab the default screen */
212 _ecore_xcb_screen =
213 xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data;
214
215 /* NB: This method of init/finalize extensions first, then atoms
216 * Does end up being 2 round trips to X, BUT if we do extensions init then
217 * atoms init first, and call the 'finalize' functions later, we end up
218 * being slower, so it's a trade-off. This current method clocks in
219 * around 0.003 for fetching atoms VS 0.010 for init both then finalize */
220
221 /* prefetch extension data */
222 _ecore_xcb_extensions_init();
223
224 /* finalize extensions */
225 _ecore_xcb_extensions_finalize();
226
227 /* set keyboard autorepeat */
228 mask = XCB_KB_AUTO_REPEAT_MODE;
229 list[0] = XCB_AUTO_REPEAT_MODE_ON;
230 xcb_change_keyboard_control(_ecore_xcb_conn, mask, list);
231
232 /* setup xcb events */
233 _ecore_xcb_events_init();
234
235 /* setup xcb keymasks */
236 _ecore_xcb_keymap_init();
237
238 /* finalize xcb keymasks */
239 _ecore_xcb_keymap_finalize();
240
241 /* setup ecore fd handler */
242 _ecore_xcb_fd_handler =
243 ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn),
244 ECORE_FD_READ, _ecore_xcb_fd_handle,
245 _ecore_xcb_conn, _ecore_xcb_fd_handle_buff,
246 _ecore_xcb_conn);
247
248 if (!_ecore_xcb_fd_handler)
249 return _ecore_xcb_shutdown(EINA_TRUE);
250
251 /* prefetch atoms */
252 _ecore_xcb_atoms_init();
253
254 /* finalize atoms */
255 _ecore_xcb_atoms_finalize();
256
257 /* icccm_init: dummy function */
258 ecore_x_icccm_init();
259
260 /* setup netwm */
261 ecore_x_netwm_init();
262
263 /* old e hints init: dummy function */
264 ecore_x_e_init();
265
266 _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] =
267 ECORE_X_ATOM_WM_DELETE_WINDOW;
268 _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] =
269 ECORE_X_ATOM_WM_TAKE_FOCUS;
270 _ecore_xcb_atoms_wm_protocol[ECORE_X_NET_WM_PROTOCOL_PING] =
271 ECORE_X_ATOM_NET_WM_PING;
272 _ecore_xcb_atoms_wm_protocol[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] =
273 ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
274
275 /* setup selection */
276 _ecore_xcb_selection_init();
277
278 /* setup dnd */
279 _ecore_xcb_dnd_init();
280
281 _ecore_xcb_idle_enterer =
282 ecore_idle_enterer_add(_ecore_xcb_idle_enter, NULL);
283
284 return _ecore_xcb_init_count;
285}
286
287/**
288 * Shuts down the Ecore X library.
289 *
290 * In shutting down the library, the X display connection is terminated
291 * and any event handlers for it are removed.
292 *
293 * @return The number of times the library has been initialized without
294 * being shut down.
295 * @ingroup Ecore_X_Init_Group
296 */
297EAPI int
298ecore_x_shutdown(void)
299{
300 return _ecore_xcb_shutdown(EINA_TRUE);
301}
302
303/**
304 * Shuts down the Ecore X library.
305 *
306 * As ecore_x_shutdown, except do not close Display, only connection.
307 *
308 * @ingroup Ecore_X_Init_Group
309 */
310EAPI int
311ecore_x_disconnect(void)
312{
313 return _ecore_xcb_shutdown(EINA_FALSE);
314}
315
316/**
317 * @defgroup Ecore_X_Flush_Group X Synchronization Functions
318 *
319 * Functions that ensure that all commands that have been issued by the
320 * Ecore X library have been sent to the server.
321 */
322
323/**
324 * Sends all X commands in the X Display buffer.
325 * @ingroup Ecore_X_Flush_Group
326 */
327EAPI void
328ecore_x_flush(void)
329{
330// LOGFN(__FILE__, __LINE__, __FUNCTION__);
331
332 CHECK_XCB_CONN;
333 xcb_flush(_ecore_xcb_conn);
334}
335
336/**
337 * Retrieves the Ecore_X_Screen handle used for the current X connection.
338 * @return The current default screen.
339 * @ingroup Ecore_X_Display_Attr_Group
340 */
341EAPI Ecore_X_Screen *
342ecore_x_default_screen_get(void)
343{
344 LOGFN(__FILE__, __LINE__, __FUNCTION__);
345
346 return (Ecore_X_Screen *)_ecore_xcb_screen;
347}
348
349EAPI Ecore_X_Connection *
350ecore_x_connection_get(void)
351{
352 LOGFN(__FILE__, __LINE__, __FUNCTION__);
353
354 CHECK_XCB_CONN;
355 return (Ecore_X_Connection *)_ecore_xcb_conn;
356}
357
358/**
359 * Return the last event time
360 */
361EAPI Ecore_X_Time
362ecore_x_current_time_get(void)
363{
364 return _ecore_xcb_events_last_time_get();
365}
366
367/**
368 * Flushes the command buffer and waits until all requests have been
369 * processed by the server.
370 * @ingroup Ecore_X_Flush_Group
371 */
372EAPI void
373ecore_x_sync(void)
374{
375 LOGFN(__FILE__, __LINE__, __FUNCTION__);
376
377 CHECK_XCB_CONN;
378 free(xcb_get_input_focus_reply(_ecore_xcb_conn,
379 xcb_get_input_focus_unchecked(_ecore_xcb_conn),
380 NULL));
381}
382
383EAPI void
384ecore_x_grab(void)
385{
386 LOGFN(__FILE__, __LINE__, __FUNCTION__);
387
388 CHECK_XCB_CONN;
389 _ecore_xcb_grab_count++;
390 if (_ecore_xcb_grab_count == 1)
391 xcb_grab_server(_ecore_xcb_conn);
392}
393
394EAPI void
395ecore_x_ungrab(void)
396{
397 LOGFN(__FILE__, __LINE__, __FUNCTION__);
398
399 CHECK_XCB_CONN;
400 _ecore_xcb_grab_count--;
401 if (_ecore_xcb_grab_count < 0) _ecore_xcb_grab_count = 0;
402 if (_ecore_xcb_grab_count == 0)
403 xcb_ungrab_server(_ecore_xcb_conn);
404}
405
406/**
407 * Send client message with given type and format 32.
408 *
409 * @param win The window the message is sent to.
410 * @param type The client message type.
411 * @param d0 The client message data item 1
412 * @param d1 The client message data item 2
413 * @param d2 The client message data item 3
414 * @param d3 The client message data item 4
415 * @param d4 The client message data item 5
416 *
417 * @return EINA_TRUE on success EINA_FALSE otherwise.
418 */
419EAPI Eina_Bool
420ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type,
421 Ecore_X_Event_Mask mask,
422 long d0, long d1, long d2, long d3, long d4)
423{
424 xcb_client_message_event_t ev;
425 xcb_void_cookie_t cookie;
426 xcb_generic_error_t *err;
427
428 LOGFN(__FILE__, __LINE__, __FUNCTION__);
429 CHECK_XCB_CONN;
430
431 memset(&ev, 0, sizeof(xcb_client_message_event_t));
432
433 ev.response_type = XCB_CLIENT_MESSAGE;
434 ev.format = 32;
435 ev.window = win;
436 ev.type = type;
437 ev.data.data32[0] = (uint32_t)d0;
438 ev.data.data32[1] = (uint32_t)d1;
439 ev.data.data32[2] = (uint32_t)d2;
440 ev.data.data32[3] = (uint32_t)d3;
441 ev.data.data32[4] = (uint32_t)d4;
442
443 cookie = xcb_send_event(_ecore_xcb_conn, 0, win, mask, (const char *)&ev);
444
445 err = xcb_request_check(_ecore_xcb_conn, cookie);
446 if (err)
447 {
448 DBG("Problem Sending Event");
449 DBG("\tType: %d", type);
450 DBG("\tWin: %d", win);
451 _ecore_xcb_error_handle(err);
452 free(err);
453 return EINA_FALSE;
454 }
455
456 return EINA_TRUE;
457}
458
459/**
460 * Send client message with given type and format 8.
461 *
462 * @param win The window the message is sent to.
463 * @param type The client message type.
464 * @param data Data to be sent.
465 * @param len Number of data bytes, max 20.
466 *
467 * @return EINA_TRUE on success EINA_FALSE otherwise.
468 */
469EAPI Eina_Bool
470ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type,
471 const void *data, int len)
472{
473 xcb_client_message_event_t ev;
474 xcb_void_cookie_t cookie;
475 xcb_generic_error_t *err;
476
477 LOGFN(__FILE__, __LINE__, __FUNCTION__);
478 CHECK_XCB_CONN;
479
480 memset(&ev, 0, sizeof(xcb_client_message_event_t));
481
482 ev.response_type = XCB_CLIENT_MESSAGE;
483 ev.format = 8;
484 ev.window = win;
485 ev.type = type;
486 if (len > 20) len = 20;
487 memcpy(ev.data.data8, data, len);
488 memset(ev.data.data8 + len, 0, 20 - len);
489
490 cookie = xcb_send_event(_ecore_xcb_conn, 0, win,
491 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
492
493 err = xcb_request_check(_ecore_xcb_conn, cookie);
494 if (err)
495 {
496 DBG("Problem Sending Event");
497 DBG("\tType: %d", type);
498 DBG("\tWin: %d", win);
499 _ecore_xcb_error_handle(err);
500 free(err);
501 return EINA_FALSE;
502 }
503
504 return EINA_TRUE;
505}
506
507EAPI Eina_Bool
508ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b)
509{
510 xcb_translate_coordinates_cookie_t cookie;
511 xcb_translate_coordinates_reply_t *reply;
512 xcb_button_press_event_t ev;
513 xcb_void_cookie_t vcookie;
514 xcb_generic_error_t *err;
515 Ecore_X_Window root = 0;
516
517 LOGFN(__FILE__, __LINE__, __FUNCTION__);
518 CHECK_XCB_CONN;
519
520 root = ecore_x_window_root_get(win);
521 cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y);
522 reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
523 if (!reply) return EINA_FALSE;
524
525 memset(&ev, 0, sizeof(xcb_button_press_event_t));
526
527 ev.response_type = XCB_BUTTON_PRESS;
528 ev.event = win;
529 ev.child = win;
530 ev.root = root;
531 ev.event_x = x;
532 ev.event_y = y;
533 ev.same_screen = 1;
534 ev.state = 1 << b;
535 ev.detail = b; // xcb uses detail for button
536 ev.root_x = reply->dst_x;
537 ev.root_y = reply->dst_y;
538 ev.time = ecore_x_current_time_get();
539 free(reply);
540
541 vcookie = xcb_send_event(_ecore_xcb_conn, 1, win,
542 XCB_EVENT_MASK_BUTTON_PRESS, (const char *)&ev);
543
544 err = xcb_request_check(_ecore_xcb_conn, vcookie);
545 if (err)
546 {
547 _ecore_xcb_error_handle(err);
548 free(err);
549 return EINA_FALSE;
550 }
551
552 return EINA_TRUE;
553}
554
555EAPI Eina_Bool
556ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b)
557{
558 xcb_translate_coordinates_cookie_t cookie;
559 xcb_translate_coordinates_reply_t *reply;
560 xcb_button_release_event_t ev;
561 xcb_void_cookie_t vcookie;
562 xcb_generic_error_t *err;
563 Ecore_X_Window root = 0;
564
565 LOGFN(__FILE__, __LINE__, __FUNCTION__);
566 CHECK_XCB_CONN;
567
568 root = ecore_x_window_root_get(win);
569 cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y);
570 reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
571 if (!reply) return EINA_FALSE;
572
573 memset(&ev, 0, sizeof(xcb_button_release_event_t));
574
575 ev.response_type = XCB_BUTTON_RELEASE;
576 ev.event = win;
577 ev.child = win;
578 ev.root = root;
579 ev.event_x = x;
580 ev.event_y = y;
581 ev.same_screen = 1;
582 ev.state = 0;
583 ev.root_x = reply->dst_x;
584 ev.root_y = reply->dst_y;
585 ev.detail = b; // xcb uses detail for button
586 ev.time = ecore_x_current_time_get();
587 free(reply);
588
589 vcookie = xcb_send_event(_ecore_xcb_conn, 1, win,
590 XCB_EVENT_MASK_BUTTON_RELEASE, (const char *)&ev);
591
592 err = xcb_request_check(_ecore_xcb_conn, vcookie);
593 if (err)
594 {
595 _ecore_xcb_error_handle(err);
596 free(err);
597 return EINA_FALSE;
598 }
599
600 return EINA_TRUE;
601}
602
603EAPI Eina_Bool
604ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y)
605{
606 xcb_translate_coordinates_cookie_t cookie;
607 xcb_translate_coordinates_reply_t *reply;
608 xcb_motion_notify_event_t ev;
609 xcb_void_cookie_t vcookie;
610 xcb_generic_error_t *err;
611 Ecore_X_Window root = 0;
612
613 LOGFN(__FILE__, __LINE__, __FUNCTION__);
614 CHECK_XCB_CONN;
615
616 root = ecore_x_window_root_get(win);
617 cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y);
618 reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
619 if (!reply) return EINA_FALSE;
620
621 memset(&ev, 0, sizeof(xcb_motion_notify_event_t));
622
623 ev.response_type = XCB_MOTION_NOTIFY;
624 ev.event = win;
625 ev.child = win;
626 ev.root = root;
627 ev.event_x = x;
628 ev.event_y = y;
629 ev.same_screen = 1;
630 ev.state = 0;
631 ev.detail = 0; // xcb uses 'detail' for is_hint
632 ev.root_x = reply->dst_x;
633 ev.root_y = reply->dst_y;
634 ev.time = ecore_x_current_time_get();
635 free(reply);
636
637 vcookie = xcb_send_event(_ecore_xcb_conn, 1, win,
638 XCB_EVENT_MASK_POINTER_MOTION, (const char *)&ev);
639
640 err = xcb_request_check(_ecore_xcb_conn, vcookie);
641 if (err)
642 {
643 _ecore_xcb_error_handle(err);
644 free(err);
645 return EINA_FALSE;
646 }
647
648 return EINA_TRUE;
649}
650
651EAPI Eina_Bool
652ecore_x_keyboard_grab(Ecore_X_Window win)
653{
654 xcb_grab_keyboard_cookie_t cookie;
655 xcb_grab_keyboard_reply_t *reply;
656
657 LOGFN(__FILE__, __LINE__, __FUNCTION__);
658 CHECK_XCB_CONN;
659
660 cookie =
661 xcb_grab_keyboard_unchecked(_ecore_xcb_conn, 0, win, XCB_CURRENT_TIME,
662 XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
663 reply = xcb_grab_keyboard_reply(_ecore_xcb_conn, cookie, NULL);
664 if (!reply) return EINA_FALSE;
665 free(reply);
666 return EINA_TRUE;
667}
668
669EAPI void
670ecore_x_keyboard_ungrab(void)
671{
672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
673 CHECK_XCB_CONN;
674
675 xcb_ungrab_keyboard(_ecore_xcb_conn, XCB_CURRENT_TIME);
676}
677
678EAPI void
679ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y)
680{
681 xcb_query_pointer_cookie_t cookie;
682 xcb_query_pointer_reply_t *reply;
683
684// LOGFN(__FILE__, __LINE__, __FUNCTION__);
685 CHECK_XCB_CONN;
686
687// if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
688
689 if (x) *x = -1;
690 if (y) *y = -1;
691
692 cookie = xcb_query_pointer_unchecked(_ecore_xcb_conn, win);
693 reply = xcb_query_pointer_reply(_ecore_xcb_conn, cookie, NULL);
694 if (!reply) return;
695 if (x) *x = reply->win_x;
696 if (y) *y = reply->win_y;
697 free(reply);
698}
699
700EAPI Eina_Bool
701ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold)
702{
703 xcb_void_cookie_t vcookie;
704 xcb_generic_error_t *err;
705
706 LOGFN(__FILE__, __LINE__, __FUNCTION__);
707 CHECK_XCB_CONN;
708
709 vcookie =
710 xcb_change_pointer_control(_ecore_xcb_conn,
711 accel_num, accel_denom, threshold, 1, 1);
712 err = xcb_request_check(_ecore_xcb_conn, vcookie);
713 if (err)
714 {
715 _ecore_xcb_error_handle(err);
716 free(err);
717 return EINA_FALSE;
718 }
719
720 return EINA_TRUE;
721}
722
723EAPI Eina_Bool
724ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold)
725{
726 xcb_get_pointer_control_cookie_t cookie;
727 xcb_get_pointer_control_reply_t *reply;
728
729 LOGFN(__FILE__, __LINE__, __FUNCTION__);
730 CHECK_XCB_CONN;
731
732 if (accel_num) *accel_num = 0;
733 if (accel_denom) *accel_denom = 0;
734 if (threshold) *threshold = 0;
735
736 cookie = xcb_get_pointer_control_unchecked(_ecore_xcb_conn);
737 reply = xcb_get_pointer_control_reply(_ecore_xcb_conn, cookie, NULL);
738 if (!reply) return EINA_FALSE;
739
740 if (accel_num) *accel_num = reply->acceleration_numerator;
741 if (accel_denom) *accel_denom = reply->acceleration_denominator;
742 if (threshold) *threshold = reply->threshold;
743 free(reply);
744
745 return EINA_TRUE;
746}
747
748EAPI Eina_Bool
749ecore_x_pointer_mapping_set(unsigned char *map, int nmap)
750{
751 xcb_set_pointer_mapping_cookie_t cookie;
752 xcb_set_pointer_mapping_reply_t *reply;
753 Eina_Bool ret = EINA_FALSE;
754
755 LOGFN(__FILE__, __LINE__, __FUNCTION__);
756 CHECK_XCB_CONN;
757
758 cookie = xcb_set_pointer_mapping_unchecked(_ecore_xcb_conn, nmap, map);
759 reply = xcb_set_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL);
760 if (!reply) return EINA_FALSE;
761 ret =
762 (reply->status == XCB_MAPPING_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE;
763
764 free(reply);
765 return ret;
766}
767
768EAPI Eina_Bool
769ecore_x_pointer_mapping_get(unsigned char *map, int nmap)
770{
771 xcb_get_pointer_mapping_cookie_t cookie;
772 xcb_get_pointer_mapping_reply_t *reply;
773
774 LOGFN(__FILE__, __LINE__, __FUNCTION__);
775 CHECK_XCB_CONN;
776
777 if (map) *map = 0;
778 nmap = 0;
779
780 cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn);
781 reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL);
782 if (!reply) return EINA_FALSE;
783
784 nmap = xcb_get_pointer_mapping_map_length(reply);
785 if (nmap <= 0)
786 {
787 free(reply);
788 return EINA_FALSE;
789 }
790
791 if (map)
792 {
793 uint8_t *tmp;
794 int i = 0;
795
796 tmp = xcb_get_pointer_mapping_map(reply);
797 for (i = 0; i < nmap; i++)
798 map[i] = tmp[i];
799 }
800
801 free(reply);
802 return EINA_TRUE;
803}
804
805EAPI Eina_Bool
806ecore_x_pointer_grab(Ecore_X_Window win)
807{
808 xcb_grab_pointer_cookie_t cookie;
809 xcb_grab_pointer_reply_t *reply;
810 uint16_t mask;
811 Eina_Bool ret = EINA_FALSE;
812
813 LOGFN(__FILE__, __LINE__, __FUNCTION__);
814 CHECK_XCB_CONN;
815
816 mask = (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
817 XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
818 XCB_EVENT_MASK_POINTER_MOTION);
819
820 cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, win, mask,
821 XCB_GRAB_MODE_ASYNC,
822 XCB_GRAB_MODE_ASYNC,
823 XCB_NONE, XCB_NONE, XCB_CURRENT_TIME);
824 reply = xcb_grab_pointer_reply(_ecore_xcb_conn, cookie, NULL);
825 if (!reply) return EINA_FALSE;
826
827 ret = (reply->status == XCB_GRAB_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE;
828
829 free(reply);
830 return ret;
831}
832
833EAPI Eina_Bool
834ecore_x_pointer_confine_grab(Ecore_X_Window win)
835{
836 xcb_grab_pointer_cookie_t cookie;
837 xcb_grab_pointer_reply_t *reply;
838 uint16_t mask;
839 Eina_Bool ret = EINA_FALSE;
840
841 LOGFN(__FILE__, __LINE__, __FUNCTION__);
842 CHECK_XCB_CONN;
843
844 mask = (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
845 XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
846 XCB_EVENT_MASK_POINTER_MOTION);
847
848 cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, win, mask,
849 XCB_GRAB_MODE_ASYNC,
850 XCB_GRAB_MODE_ASYNC,
851 win, XCB_NONE, XCB_CURRENT_TIME);
852 reply = xcb_grab_pointer_reply(_ecore_xcb_conn, cookie, NULL);
853 if (!reply) return EINA_FALSE;
854
855 ret = (reply->status == XCB_GRAB_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE;
856
857 free(reply);
858 return ret;
859}
860
861EAPI void
862ecore_x_pointer_ungrab(void)
863{
864 LOGFN(__FILE__, __LINE__, __FUNCTION__);
865 CHECK_XCB_CONN;
866
867 xcb_ungrab_pointer(_ecore_xcb_conn, XCB_CURRENT_TIME);
868}
869
870EAPI Eina_Bool
871ecore_x_pointer_warp(Ecore_X_Window win, int x, int y)
872{
873 xcb_void_cookie_t vcookie;
874 xcb_generic_error_t *err;
875
876 LOGFN(__FILE__, __LINE__, __FUNCTION__);
877 CHECK_XCB_CONN;
878
879 vcookie =
880 xcb_warp_pointer_checked(_ecore_xcb_conn, XCB_NONE, win, 0, 0, 0, 0, x, y);
881 err = xcb_request_check(_ecore_xcb_conn, vcookie);
882 if (err)
883 {
884 _ecore_xcb_error_handle(err);
885 free(err);
886 return EINA_FALSE;
887 }
888
889 return EINA_TRUE;
890}
891
892/**
893 * Invoke the standard system beep to alert users
894 *
895 * @param percent The volume at which the bell rings. Must be in the range
896 * [-100,+100]. If percent >= 0, the final volume will be:
897 * base - [(base * percent) / 100] + percent
898 * Otherwise, it's calculated as:
899 * base + [(base * percent) / 100]
900 * where @c base is the bell's base volume as set by XChangeKeyboardControl(3).
901 *
902 * @returns EINA_TRUE on success, EINA_FALSE otherwise.
903 */
904EAPI Eina_Bool
905ecore_x_bell(int percent)
906{
907 xcb_void_cookie_t cookie;
908 xcb_generic_error_t *err;
909
910 CHECK_XCB_CONN;
911
912 // FIXME: Use unchecked version after development is ironed out
913 cookie = xcb_bell_checked(_ecore_xcb_conn, percent);
914 err = xcb_request_check(_ecore_xcb_conn, cookie);
915 if (err)
916 {
917 _ecore_xcb_error_handle(err);
918 free(err);
919 return EINA_FALSE;
920 }
921
922 return EINA_TRUE;
923}
924
925EAPI void
926ecore_x_display_size_get(Ecore_X_Display *dsp __UNUSED__, int *w, int *h)
927{
928 xcb_screen_t *screen;
929
930 LOGFN(__FILE__, __LINE__, __FUNCTION__);
931 CHECK_XCB_CONN;
932
933 /* grab the default screen */
934 screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data;
935 if (w) *w = screen->width_in_pixels;
936 if (h) *h = screen->height_in_pixels;
937}
938
939EAPI unsigned long
940ecore_x_display_black_pixel_get(Ecore_X_Display *dsp __UNUSED__)
941{
942 xcb_screen_t *screen;
943
944 LOGFN(__FILE__, __LINE__, __FUNCTION__);
945 CHECK_XCB_CONN;
946
947 /* grab the default screen */
948 screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data;
949 return screen->black_pixel;
950}
951
952EAPI unsigned long
953ecore_x_display_white_pixel_get(Ecore_X_Display *dsp __UNUSED__)
954{
955 xcb_screen_t *screen;
956
957 LOGFN(__FILE__, __LINE__, __FUNCTION__);
958 CHECK_XCB_CONN;
959
960 /* grab the default screen */
961 screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data;
962 return screen->white_pixel;
963}
964
965EAPI void
966ecore_x_pointer_last_xy_get(int *x, int *y)
967{
968 LOGFN(__FILE__, __LINE__, __FUNCTION__);
969
970 if (x) *x = _ecore_xcb_event_last_root_x;
971 if (y) *y = _ecore_xcb_event_last_root_y;
972}
973
974EAPI void
975ecore_x_focus_reset(void)
976{
977 LOGFN(__FILE__, __LINE__, __FUNCTION__);
978 CHECK_XCB_CONN;
979
980 xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT,
981 ((xcb_screen_t *)_ecore_xcb_screen)->root,
982 XCB_CURRENT_TIME);
983// ecore_x_flush();
984}
985
986EAPI void
987ecore_x_events_allow_all(void)
988{
989 LOGFN(__FILE__, __LINE__, __FUNCTION__);
990 CHECK_XCB_CONN;
991
992 xcb_allow_events(_ecore_xcb_conn, XCB_ALLOW_ASYNC_BOTH, XCB_CURRENT_TIME);
993// ecore_x_flush();
994}
995
996/**
997 * Kill a specific client
998 *
999 * You can kill a specific client owning window @p win
1000 *
1001 * @param win Window of the client to be killed
1002 */
1003EAPI void
1004ecore_x_kill(Ecore_X_Window win)
1005{
1006 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1007 CHECK_XCB_CONN;
1008
1009 xcb_kill_client(_ecore_xcb_conn, win);
1010// ecore_x_flush();
1011}
1012
1013/**
1014 * Kill all clients with subwindows under a given window.
1015 *
1016 * You can kill all clients connected to the X server by using
1017 * @ref ecore_x_window_root_list to get a list of root windows, and
1018 * then passing each root window to this function.
1019 *
1020 * @param root The window whose children will be killed.
1021 */
1022EAPI void
1023ecore_x_killall(Ecore_X_Window root)
1024{
1025 int screens = 0, i = 0;
1026
1027 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1028 CHECK_XCB_CONN;
1029
1030 ecore_x_grab();
1031
1032 screens = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem;
1033
1034 /* Traverse window tree starting from root, and drag each
1035 * before the firing squad */
1036 for (i = 0; i < screens; ++i)
1037 {
1038 xcb_query_tree_cookie_t cookie;
1039 xcb_query_tree_reply_t *reply;
1040
1041 cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, root);
1042 reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
1043 if (reply)
1044 {
1045 xcb_window_t *wins = NULL;
1046 int tree_c_len, j = 0;
1047
1048 wins = xcb_query_tree_children(reply);
1049 tree_c_len = xcb_query_tree_children_length(reply);
1050 for (j = 0; j < tree_c_len; j++)
1051 xcb_kill_client(_ecore_xcb_conn, wins[j]);
1052 free(reply);
1053 }
1054 }
1055
1056 ecore_x_ungrab();
1057 ecore_x_sync(); // needed
1058}
1059
1060/**
1061 * Return the screen DPI
1062 *
1063 * This is a simplistic call to get DPI. It does not account for differing
1064 * DPI in the x amd y axes nor does it account for multihead or xinerama and
1065 * xrander where different parts of the screen may have differen DPI etc.
1066 *
1067 * @return the general screen DPI (dots/pixels per inch).
1068 */
1069EAPI int
1070ecore_x_dpi_get(void)
1071{
1072 uint16_t mw = 0, w = 0;
1073
1074 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1075
1076 mw = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_millimeters;
1077 if (mw <= 0) return 75;
1078 w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
1079 return (((w * 254) / mw) + 5) / 10;
1080}
1081
1082/**
1083 * @defgroup Ecore_X_Display_Attr_Group X Display Attributes
1084 *
1085 * Functions that set and retrieve X display attributes.
1086 */
1087
1088/**
1089 * Retrieves the Ecore_X_Display handle used for the current X connection.
1090 * @return The current X display.
1091 * @ingroup Ecore_X_Display_Attr_Group
1092 */
1093EAPI Ecore_X_Display *
1094ecore_x_display_get(void)
1095{
1096 char *gl = NULL;
1097
1098 CHECK_XCB_CONN;
1099
1100 /* if we have the 'dont use xlib' env var, then we are not using
1101 * XLib and thus cannot return a real XDisplay.
1102 *
1103 * NB: This may break EFL in some places and needs lots of testing !!! */
1104 if ((gl = getenv("ECORE_X_NO_XLIB")))
1105 return (Ecore_X_Display *)_ecore_xcb_conn;
1106 else /* we can safely return an XDisplay var */
1107 return (Ecore_X_Display *)_ecore_xcb_display;
1108}
1109
1110/**
1111 * Retrieves the X display file descriptor.
1112 * @return The current X display file descriptor.
1113 * @ingroup Ecore_X_Display_Attr_Group
1114 */
1115EAPI int
1116ecore_x_fd_get(void)
1117{
1118 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1119 CHECK_XCB_CONN;
1120 return xcb_get_file_descriptor(_ecore_xcb_conn);
1121}
1122
1123EAPI void
1124ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, int type, void *event),
1125 void *data)
1126{
1127 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1128
1129 _ecore_xcb_window_grab_replay_func = func;
1130 _ecore_xcb_window_grab_replay_data = data;
1131}
1132
1133/**
1134 * Retrieves the size of an Ecore_X_Screen.
1135 * @param screen the handle to the screen to query.
1136 * @param w where to return the width. May be NULL. Returns 0 on errors.
1137 * @param h where to return the height. May be NULL. Returns 0 on errors.
1138 * @ingroup Ecore_X_Display_Attr_Group
1139 * @see ecore_x_default_screen_get()
1140 *
1141 * @since 1.1
1142 */
1143EAPI void
1144ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
1145{
1146 xcb_screen_t *s;
1147
1148 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1149
1150 if (w) *w = 0;
1151 if (h) *h = 0;
1152 if (!(s = (xcb_screen_t *)screen)) return;
1153 if (w) *w = s->width_in_pixels;
1154 if (h) *h = s->height_in_pixels;
1155}
1156
1157/**
1158 * Retrieves the count of screens.
1159 *
1160 * @return The count of screens.
1161 * @ingroup Ecore_X_Display_Attr_Group
1162 *
1163 * @since 1.1
1164 */
1165EAPI int
1166ecore_x_screen_count_get(void)
1167{
1168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1169 CHECK_XCB_CONN;
1170
1171 return xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn));
1172}
1173
1174/**
1175 * Retrieves the index number of the given screen.
1176 *
1177 * @return The index number of the screen.
1178 * @ingroup Ecore_X_Display_Attr_Group
1179 *
1180 * @since 1.1
1181 */
1182EAPI int
1183ecore_x_screen_index_get(const Ecore_X_Screen *screen)
1184{
1185 xcb_screen_iterator_t iter;
1186 int i = 0;
1187
1188 CHECK_XCB_CONN;
1189
1190 iter =
1191 xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
1192 for (; iter.rem; xcb_screen_next(&iter))
1193 {
1194 if (iter.data == (xcb_screen_t *)screen)
1195 return i;
1196 i++;
1197 }
1198
1199 return 0;
1200}
1201
1202/**
1203 * Retrieves the screen based on index number.
1204 *
1205 * @return The Ecore_X_Screen at this index.
1206 * @ingroup Ecore_X_Display_Attr_Group
1207 *
1208 * @since 1.1
1209 */
1210EAPI Ecore_X_Screen *
1211ecore_x_screen_get(int index)
1212{
1213 xcb_screen_iterator_t iter;
1214 int i = 0;
1215
1216 CHECK_XCB_CONN;
1217
1218 iter =
1219 xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
1220 for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
1221 if (i == index) return iter.data;
1222
1223 return NULL;
1224}
1225
1226EAPI unsigned int
1227ecore_x_visual_id_get(Ecore_X_Visual visual)
1228{
1229 return ((xcb_visualtype_t *)visual)->visual_id;
1230}
1231
1232/**
1233 * Retrieve the default Visual.
1234 *
1235 * @param disp The Display to get the Default Visual from
1236 * @param screen The Screen.
1237 *
1238 * @return The default visual.
1239 * @since 1.1.0
1240 */
1241EAPI Ecore_X_Visual
1242ecore_x_default_visual_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen)
1243{
1244 xcb_screen_t *s;
1245 xcb_depth_iterator_t diter;
1246 xcb_visualtype_iterator_t viter;
1247
1248 CHECK_XCB_CONN;
1249
1250 s = (xcb_screen_t *)screen;
1251 diter = xcb_screen_allowed_depths_iterator(s);
1252 for (; diter.rem; xcb_depth_next(&diter))
1253 {
1254 viter = xcb_depth_visuals_iterator(diter.data);
1255 for (; viter.rem; xcb_visualtype_next(&viter))
1256 {
1257 if (viter.data->visual_id == s->root_visual)
1258 return viter.data;
1259 }
1260 }
1261 return 0;
1262}
1263
1264/**
1265 * Retrieve the default Colormap.
1266 *
1267 * @param disp The Display to get the Default Colormap from
1268 * @param screen The Screen.
1269 *
1270 * @return The default colormap.
1271 * @since 1.1.0
1272 */
1273EAPI Ecore_X_Colormap
1274ecore_x_default_colormap_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen)
1275{
1276 xcb_screen_t *s;
1277
1278 s = (xcb_screen_t *)screen;
1279 return s->default_colormap;
1280}
1281
1282/**
1283 * Retrieve the default depth.
1284 *
1285 * @param disp The Display to get the Default Depth from
1286 * @param screen The Screen.
1287 *
1288 * @return The default depth.
1289 * @since 1.1.0
1290 */
1291EAPI int
1292ecore_x_default_depth_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen)
1293{
1294 xcb_screen_t *s;
1295
1296 s = (xcb_screen_t *)screen;
1297 return s->root_depth;
1298}
1299
1300/**
1301 * Sets the timeout for a double and triple clicks to be flagged.
1302 *
1303 * This sets the time between clicks before the double_click flag is
1304 * set in a button down event. If 3 clicks occur within double this
1305 * time, the triple_click flag is also set.
1306 *
1307 * @param t The time in seconds
1308 * @ingroup Ecore_X_Display_Attr_Group
1309 */
1310EAPI void
1311ecore_x_double_click_time_set(double t)
1312{
1313 if (t < 0.0) t = 0.0;
1314 _ecore_xcb_double_click_time = t;
1315}
1316
1317/**
1318 * Retrieves the double and triple click flag timeout.
1319 *
1320 * See @ref ecore_x_double_click_time_set for more information.
1321 *
1322 * @return The timeout for double clicks in seconds.
1323 * @ingroup Ecore_X_Display_Attr_Group
1324 */
1325EAPI double
1326ecore_x_double_click_time_get(void)
1327{
1328 return _ecore_xcb_double_click_time;
1329}
1330
1331/* local function prototypes */
1332static int
1333_ecore_xcb_shutdown(Eina_Bool close_display)
1334{
1335 if (--_ecore_xcb_init_count != 0)
1336 return _ecore_xcb_init_count;
1337
1338 if (!_ecore_xcb_conn)
1339 return _ecore_xcb_init_count;
1340
1341 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1342 CHECK_XCB_CONN;
1343
1344 ecore_idle_enterer_del(_ecore_xcb_idle_enterer);
1345 _ecore_xcb_idle_enterer = NULL;
1346
1347 if (_ecore_xcb_fd_handler)
1348 ecore_main_fd_handler_del(_ecore_xcb_fd_handler);
1349
1350 /* disconnect from display server */
1351 if (close_display)
1352 xcb_disconnect(_ecore_xcb_conn);
1353 else
1354 {
1355 close(xcb_get_file_descriptor(_ecore_xcb_conn));
1356 _ecore_xcb_conn = NULL;
1357 }
1358
1359 /* shutdown events */
1360 _ecore_xcb_events_shutdown();
1361
1362 /* shutdown input extension */
1363 _ecore_xcb_input_shutdown();
1364
1365 /* shutdown gesture extension */
1366 _ecore_xcb_gesture_shutdown();
1367
1368 /* shutdown selection */
1369 _ecore_xcb_selection_shutdown();
1370
1371 /* shutdown dnd */
1372 _ecore_xcb_dnd_shutdown();
1373
1374 /* shutdown netwm */
1375 ecore_x_netwm_shutdown();
1376
1377 /* shutdown keymap */
1378 _ecore_xcb_keymap_shutdown();
1379
1380 /* shutdown ecore_event */
1381 ecore_event_shutdown();
1382
1383 /* shutdown ecore */
1384 ecore_shutdown();
1385
1386 /* unregister log domain */
1387 eina_log_domain_unregister(_ecore_xcb_log_dom);
1388 _ecore_xcb_log_dom = -1;
1389
1390 /* shutdown eina */
1391 eina_shutdown();
1392
1393 return _ecore_xcb_init_count;
1394}
1395
1396static Eina_Bool
1397_ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr __UNUSED__)
1398{
1399 xcb_connection_t *conn;
1400 xcb_generic_event_t *ev = NULL;
1401
1402 conn = (xcb_connection_t *)data;
1403
1404 if (_ecore_xcb_event_buffered)
1405 {
1406 _ecore_xcb_events_handle(_ecore_xcb_event_buffered);
1407 free(_ecore_xcb_event_buffered);
1408 _ecore_xcb_event_buffered = NULL;
1409 }
1410
1411// xcb_flush(conn);
1412
1413 while ((ev = xcb_poll_for_event(conn)))
1414 {
1415 /* NB: Ecore Xlib uses filterevent for xim, but xcb does not support
1416 * xim, so no need for it here */
1417
1418 /* check for errors first */
1419 if (xcb_connection_has_error(conn))
1420 {
1421 xcb_generic_error_t *err;
1422
1423 err = (xcb_generic_error_t *)ev;
1424 _ecore_xcb_io_error_handle(err);
1425 }
1426 else
1427 {
1428 /* FIXME: Filter event for XIM */
1429 _ecore_xcb_events_handle(ev);
1430 free(ev);
1431 }
1432 }
1433
1434 return ECORE_CALLBACK_RENEW;
1435}
1436
1437static Eina_Bool
1438_ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr __UNUSED__)
1439{
1440 xcb_connection_t *conn;
1441 xcb_generic_event_t *ev = NULL;
1442
1443 conn = (xcb_connection_t *)data;
1444 ev = xcb_poll_for_event(conn);
1445 if (ev)
1446 {
1447 /* check for errors first */
1448 if (xcb_connection_has_error(conn))
1449 {
1450 xcb_generic_error_t *err;
1451
1452 err = (xcb_generic_error_t *)ev;
1453 _ecore_xcb_io_error_handle(err);
1454 return ECORE_CALLBACK_CANCEL;
1455 }
1456 _ecore_xcb_event_buffered = ev;
1457 return ECORE_CALLBACK_RENEW;
1458 }
1459 return ECORE_CALLBACK_CANCEL;
1460}
1461
1462static Eina_Bool
1463_ecore_xcb_idle_enter(void *data __UNUSED__)
1464{
1465 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1466 CHECK_XCB_CONN;
1467
1468 xcb_flush(_ecore_xcb_conn);
1469 return ECORE_CALLBACK_RENEW;
1470}
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
deleted file mode 100644
index ec2daaf..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
+++ /dev/null
@@ -1,421 +0,0 @@
1#include "ecore_xcb_private.h"
2#include "ecore_x_atoms_decl.h"
3
4/* NB: Increment if you add new atoms */
5#define ECORE_X_ATOMS_COUNT 199
6
7typedef struct _Xcb_Atom Xcb_Atom;
8struct _Xcb_Atom
9{
10 const char *name;
11 Ecore_X_Atom *atom;
12};
13
14/* local function prototypes */
15
16/* local variables */
17static xcb_intern_atom_cookie_t cookies[ECORE_X_ATOMS_COUNT];
18static Xcb_Atom atoms[] =
19{
20 { "ATOM", &ECORE_X_ATOM_ATOM },
21 { "CARDINAL", &ECORE_X_ATOM_CARDINAL },
22 { "COMPOUND_TEXT", &ECORE_X_ATOM_COMPOUND_TEXT },
23 { "FILE_NAME", &ECORE_X_ATOM_FILE_NAME },
24 { "STRING", &ECORE_X_ATOM_STRING },
25 { "TEXT", &ECORE_X_ATOM_TEXT },
26 { "UTF8_STRING", &ECORE_X_ATOM_UTF8_STRING },
27 { "WINDOW", &ECORE_X_ATOM_WINDOW },
28 { "PIXMAP", &ECORE_X_ATOM_PIXMAP },
29 { "VISUALID", &ECORE_X_ATOM_VISUALID },
30
31 { "JXSelectionWindowProperty", &ECORE_X_ATOM_SELECTION_PROP_XDND },
32 { "XdndSelection", &ECORE_X_ATOM_SELECTION_XDND },
33 { "XdndAware", &ECORE_X_ATOM_XDND_AWARE },
34 { "XdndEnter", &ECORE_X_ATOM_XDND_ENTER },
35 { "XdndTypeList", &ECORE_X_ATOM_XDND_TYPE_LIST },
36 { "XdndPosition", &ECORE_X_ATOM_XDND_POSITION },
37 { "XdndActionCopy", &ECORE_X_ATOM_XDND_ACTION_COPY },
38 { "XdndActionMove", &ECORE_X_ATOM_XDND_ACTION_MOVE },
39 { "XdndActionPrivate", &ECORE_X_ATOM_XDND_ACTION_PRIVATE },
40 { "XdndActionAsk", &ECORE_X_ATOM_XDND_ACTION_ASK },
41 { "XdndActionList", &ECORE_X_ATOM_XDND_ACTION_LIST },
42 { "XdndActionLink", &ECORE_X_ATOM_XDND_ACTION_LINK },
43 { "XdndActionDescription", &ECORE_X_ATOM_XDND_ACTION_DESCRIPTION },
44 { "XdndProxy", &ECORE_X_ATOM_XDND_PROXY },
45 { "XdndStatus", &ECORE_X_ATOM_XDND_STATUS },
46 { "XdndLeave", &ECORE_X_ATOM_XDND_LEAVE },
47 { "XdndDrop", &ECORE_X_ATOM_XDND_DROP },
48 { "XdndFinished", &ECORE_X_ATOM_XDND_FINISHED },
49
50 { "XdndActionCopy", &ECORE_X_DND_ACTION_COPY },
51 { "XdndActionMove", &ECORE_X_DND_ACTION_MOVE },
52 { "XdndActionLink", &ECORE_X_DND_ACTION_LINK },
53 { "XdndActionAsk", &ECORE_X_DND_ACTION_ASK },
54 { "XdndActionPrivate", &ECORE_X_DND_ACTION_PRIVATE },
55
56 { "_E_FRAME_SIZE", &ECORE_X_ATOM_E_FRAME_SIZE },
57
58 { "_WIN_LAYER", &ECORE_X_ATOM_WIN_LAYER },
59
60 { "WM_NAME", &ECORE_X_ATOM_WM_NAME },
61 { "WM_ICON_NAME", &ECORE_X_ATOM_WM_ICON_NAME },
62 { "WM_NORMAL_HINTS", &ECORE_X_ATOM_WM_NORMAL_HINTS },
63 { "WM_SIZE_HINTS", &ECORE_X_ATOM_WM_SIZE_HINTS },
64 { "WM_HINTS", &ECORE_X_ATOM_WM_HINTS },
65 { "WM_CLASS", &ECORE_X_ATOM_WM_CLASS },
66 { "WM_TRANSIENT_FOR", &ECORE_X_ATOM_WM_TRANSIENT_FOR },
67 { "WM_PROTOCOLS", &ECORE_X_ATOM_WM_PROTOCOLS },
68 { "WM_COLORMAP_WINDOWS", &ECORE_X_ATOM_WM_COLORMAP_WINDOWS },
69 { "WM_COMMAND", &ECORE_X_ATOM_WM_COMMAND },
70 { "WM_CLIENT_MACHINE", &ECORE_X_ATOM_WM_CLIENT_MACHINE },
71
72 { "WM_STATE", &ECORE_X_ATOM_WM_STATE },
73 { "WM_ICON_SIZE", &ECORE_X_ATOM_WM_ICON_SIZE },
74
75 { "WM_CHANGE_STATE", &ECORE_X_ATOM_WM_CHANGE_STATE },
76
77 { "WM_TAKE_FOCUS", &ECORE_X_ATOM_WM_TAKE_FOCUS },
78 { "WM_SAVE_YOURSELF", &ECORE_X_ATOM_WM_SAVE_YOURSELF },
79 { "WM_DELETE_WINDOW", &ECORE_X_ATOM_WM_DELETE_WINDOW },
80
81 { "WM_COLORMAP_NOTIFY", &ECORE_X_ATOM_WM_COLORMAP_NOTIFY },
82
83 { "SM_CLIENT_ID", &ECORE_X_ATOM_SM_CLIENT_ID },
84 { "WM_CLIENT_LEADER", &ECORE_X_ATOM_WM_CLIENT_LEADER },
85 { "WM_WINDOW_ROLE", &ECORE_X_ATOM_WM_WINDOW_ROLE },
86
87 { "_MOTIF_WM_HINTS", &ECORE_X_ATOM_MOTIF_WM_HINTS },
88
89 { "_NET_SUPPORTED", &ECORE_X_ATOM_NET_SUPPORTED },
90 { "_NET_CLIENT_LIST", &ECORE_X_ATOM_NET_CLIENT_LIST },
91 { "_NET_CLIENT_LIST_STACKING", &ECORE_X_ATOM_NET_CLIENT_LIST_STACKING },
92 { "_NET_NUMBER_OF_DESKTOPS", &ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS },
93 { "_NET_DESKTOP_GEOMETRY", &ECORE_X_ATOM_NET_DESKTOP_GEOMETRY },
94 { "_NET_DESKTOP_VIEWPORT", &ECORE_X_ATOM_NET_DESKTOP_VIEWPORT },
95 { "_NET_CURRENT_DESKTOP", &ECORE_X_ATOM_NET_CURRENT_DESKTOP },
96 { "_NET_DESKTOP_NAMES", &ECORE_X_ATOM_NET_DESKTOP_NAMES },
97 { "_NET_ACTIVE_WINDOW", &ECORE_X_ATOM_NET_ACTIVE_WINDOW },
98 { "_NET_WORKAREA", &ECORE_X_ATOM_NET_WORKAREA },
99 { "_NET_SUPPORTING_WM_CHECK", &ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK },
100 { "_NET_VIRTUAL_ROOTS", &ECORE_X_ATOM_NET_VIRTUAL_ROOTS },
101 { "_NET_DESKTOP_LAYOUT", &ECORE_X_ATOM_NET_DESKTOP_LAYOUT },
102 { "_NET_SHOWING_DESKTOP", &ECORE_X_ATOM_NET_SHOWING_DESKTOP },
103
104 { "_NET_CLOSE_WINDOW", &ECORE_X_ATOM_NET_CLOSE_WINDOW },
105 { "_NET_MOVERESIZE_WINDOW", &ECORE_X_ATOM_NET_MOVERESIZE_WINDOW },
106 { "_NET_WM_MOVERESIZE", &ECORE_X_ATOM_NET_WM_MOVERESIZE },
107 { "_NET_RESTACK_WINDOW", &ECORE_X_ATOM_NET_RESTACK_WINDOW },
108
109 { "_NET_REQUEST_FRAME_EXTENTS", &ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS },
110
111 { "_NET_WM_NAME", &ECORE_X_ATOM_NET_WM_NAME },
112 { "_NET_WM_VISIBLE_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_NAME },
113 { "_NET_WM_ICON_NAME", &ECORE_X_ATOM_NET_WM_ICON_NAME },
114 { "_NET_WM_VISIBLE_ICON_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME },
115 { "_NET_WM_DESKTOP", &ECORE_X_ATOM_NET_WM_DESKTOP },
116
117 { "_NET_WM_WINDOW_TYPE", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE },
118 { "_NET_WM_WINDOW_TYPE_DESKTOP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP },
119 { "_NET_WM_WINDOW_TYPE_DOCK", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK },
120 { "_NET_WM_WINDOW_TYPE_TOOLBAR", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR },
121 { "_NET_WM_WINDOW_TYPE_MENU", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU },
122 { "_NET_WM_WINDOW_TYPE_UTILITY", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY },
123 { "_NET_WM_WINDOW_TYPE_SPLASH", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH },
124 { "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG },
125 { "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL },
126 { "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
127 &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU },
128 { "_NET_WM_WINDOW_TYPE_POPUP_MENU",
129 &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU },
130 { "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP },
131 { "_NET_WM_WINDOW_TYPE_NOTIFICATION",
132 &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION },
133 { "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO },
134 { "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND },
135
136 { "_NET_WM_STATE", &ECORE_X_ATOM_NET_WM_STATE },
137 { "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL },
138 { "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY },
139 { "_NET_WM_STATE_MAXIMIZED_VERT",
140 &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT },
141 { "_NET_WM_STATE_MAXIMIZED_HORZ",
142 &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ },
143 { "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED },
144 { "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR },
145 { "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER },
146 { "_NET_WM_STATE_HIDDEN", &ECORE_X_ATOM_NET_WM_STATE_HIDDEN },
147 { "_NET_WM_STATE_FULLSCREEN", &ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN },
148 { "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE },
149 { "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW },
150 { "_NET_WM_STATE_DEMANDS_ATTENTION",
151 &ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION },
152
153 { "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS },
154 { "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE },
155 { "_NET_WM_ACTION_RESIZE", &ECORE_X_ATOM_NET_WM_ACTION_RESIZE },
156 { "_NET_WM_ACTION_MINIMIZE", &ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE },
157 { "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE },
158 { "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK },
159 { "_NET_WM_ACTION_MAXIMIZE_HORZ",
160 &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ },
161 { "_NET_WM_ACTION_MAXIMIZE_VERT",
162 &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT },
163 { "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN },
164 { "_NET_WM_ACTION_CHANGE_DESKTOP",
165 &ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP },
166 { "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE },
167 { "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE },
168 { "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW },
169
170 { "_NET_WM_STRUT", &ECORE_X_ATOM_NET_WM_STRUT },
171 { "_NET_WM_STRUT_PARTIAL", &ECORE_X_ATOM_NET_WM_STRUT_PARTIAL },
172 { "_NET_WM_ICON_GEOMETRY", &ECORE_X_ATOM_NET_WM_ICON_GEOMETRY },
173 { "_NET_WM_ICON", &ECORE_X_ATOM_NET_WM_ICON },
174 { "_NET_WM_PID", &ECORE_X_ATOM_NET_WM_PID },
175 { "_NET_WM_HANDLED_ICONS", &ECORE_X_ATOM_NET_WM_HANDLED_ICONS },
176 { "_NET_WM_USER_TIME", &ECORE_X_ATOM_NET_WM_USER_TIME },
177 { "_NET_STARTUP_ID", &ECORE_X_ATOM_NET_STARTUP_ID },
178 { "_NET_FRAME_EXTENTS", &ECORE_X_ATOM_NET_FRAME_EXTENTS },
179
180 { "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING },
181 { "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST },
182 { "_NET_WM_SYNC_REQUEST_COUNTER",
183 &ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER },
184
185 { "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY },
186 { "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW },
187 { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE },
188
189 { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS },
190 { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD },
191 { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY },
192 { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY },
193 { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY },
194 { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY },
195 { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD },
196
197 { "_E_VIRTUAL_KEYBOARD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD },
198 { "_E_VIRTUAL_KEYBOARD_STATE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE },
199 { "_E_VIRTUAL_KEYBOARD_ON", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON },
200 { "_E_VIRTUAL_KEYBOARD_OFF", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF },
201 { "_E_VIRTUAL_KEYBOARD_ALPHA", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA },
202 { "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC },
203 { "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN },
204 { "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER",
205 &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER },
206 { "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX },
207 { "_E_VIRTUAL_KEYBOARD_TERMINAL",
208 &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL },
209 { "_E_VIRTUAL_KEYBOARD_PASSWORD",
210 &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD },
211 { "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP },
212 { "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST },
213 { "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE },
214 { "_E_VIRTUAL_KEYBOARD_URL", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL },
215 { "_E_VIRTUAL_KEYBOARD_KEYPAD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD },
216 { "_E_VIRTUAL_KEYBOARD_J2ME", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME },
217
218 { "_E_ILLUME_ZONE", &ECORE_X_ATOM_E_ILLUME_ZONE },
219 { "_E_ILLUME_ZONE_LIST", &ECORE_X_ATOM_E_ILLUME_ZONE_LIST },
220 { "_E_ILLUME_CONFORMANT", &ECORE_X_ATOM_E_ILLUME_CONFORMANT },
221 { "_E_ILLUME_MODE", &ECORE_X_ATOM_E_ILLUME_MODE },
222 { "_E_ILLUME_MODE_SINGLE", &ECORE_X_ATOM_E_ILLUME_MODE_SINGLE },
223 { "_E_ILLUME_MODE_DUAL_TOP", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP },
224 { "_E_ILLUME_MODE_DUAL_LEFT", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT },
225 { "_E_ILLUME_FOCUS_BACK", &ECORE_X_ATOM_E_ILLUME_FOCUS_BACK },
226 { "_E_ILLUME_FOCUS_FORWARD", &ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD },
227 { "_E_ILLUME_FOCUS_HOME", &ECORE_X_ATOM_E_ILLUME_FOCUS_HOME },
228 { "_E_ILLUME_CLOSE", &ECORE_X_ATOM_E_ILLUME_CLOSE },
229 { "_E_ILLUME_HOME_NEW", &ECORE_X_ATOM_E_ILLUME_HOME_NEW },
230 { "_E_ILLUME_HOME_DEL", &ECORE_X_ATOM_E_ILLUME_HOME_DEL },
231 { "_E_ILLUME_DRAG", &ECORE_X_ATOM_E_ILLUME_DRAG },
232 { "_E_ILLUME_DRAG_LOCKED", &ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED },
233 { "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START },
234 { "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END },
235 { "_E_ILLUME_INDICATOR_GEOMETRY",
236 &ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY },
237 { "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY },
238 { "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY },
239 { "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL },
240 { "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE },
241 { "_E_ILLUME_QUICKPANEL_STATE_TOGGLE",
242 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE },
243 { "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON },
244 { "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF },
245 { "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR",
246 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR },
247 { "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR",
248 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR },
249 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
250 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
251 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
252 { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
253 { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON },
254 { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF },
255 { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE },
256 { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE },
257 { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT },
258 { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT },
259 { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
260 { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
261 { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
262 { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE },
263 { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON },
264 { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF },
265 { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY },
266 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
267 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
268 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED },
269 { "_E_COMP_SYNC_BEGIN", &ECORE_X_ATOM_E_COMP_SYNC_BEGIN },
270 { "_E_COMP_SYNC_END", &ECORE_X_ATOM_E_COMP_SYNC_END },
271 { "_E_COMP_SYNC_CANCEL", &ECORE_X_ATOM_E_COMP_SYNC_CANCEL },
272
273 { "_E_COMP_FLUSH", &ECORE_X_ATOM_E_COMP_FLUSH },
274 { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP },
275 { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP },
276 { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT },
277 { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }
278};
279
280void
281_ecore_xcb_atoms_init(void)
282{
283 int i = 0, num = 0;
284
285 LOGFN(__FILE__, __LINE__, __FUNCTION__);
286 CHECK_XCB_CONN;
287
288 num = (sizeof(atoms) / sizeof(Xcb_Atom));
289 for (i = 0; i < num; i++)
290 {
291 cookies[i] =
292 xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
293 strlen(atoms[i].name), atoms[i].name);
294 }
295}
296
297void
298_ecore_xcb_atoms_finalize(void)
299{
300 int i = 0, num = 0;
301
302 LOGFN(__FILE__, __LINE__, __FUNCTION__);
303 CHECK_XCB_CONN;
304
305 num = (sizeof(atoms) / sizeof(Xcb_Atom));
306 for (i = 0; i < num; i++)
307 {
308 xcb_intern_atom_reply_t *reply = NULL;
309
310 if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0)))
311 continue;
312 *(atoms[i].atom) = reply->atom;
313 free(reply);
314 }
315}
316
317/**
318 * @defgroup Ecore_X_Atom_Group XCB Atom Functions
319 *
320 * Functions that operate on atoms
321 */
322
323/**
324 * Retrieves the atom value associated to a name.
325 *
326 * @param name Unused.
327 * @return Associated atom value.
328 *
329 * Retrieves the atom value associated to a name. The reply is the
330 * returned value of the function ecore_xcb_intern_atom_reply(). If
331 * @p reply is @c NULL, the NULL atom is returned. Otherwise, the atom
332 * associated to the name is returned.
333 *
334 * To use this function, you must call before, and in order,
335 * ecore_x_atom_get_prefetch(), which sends the InternAtom request,
336 * then ecore_x_atom_get_fetch(), which gets the reply.
337 *
338 * @ingroup Ecore_X_Atom_Group
339 */
340EAPI Ecore_X_Atom
341ecore_x_atom_get(const char *name)
342{
343 xcb_intern_atom_cookie_t cookie;
344 xcb_intern_atom_reply_t *reply;
345 Ecore_X_Atom a;
346
347 LOGFN(__FILE__, __LINE__, __FUNCTION__);
348 CHECK_XCB_CONN;
349
350 cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name);
351 reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
352 if (!reply) return XCB_ATOM_NONE;
353 a = reply->atom;
354 free(reply);
355 return a;
356}
357
358/**
359 * Retrieves the name of the given atom.
360 *
361 * @param atom
362 * @return The name of the atom.
363 *
364 * @ingroup Ecore_X_Atom_Group
365 */
366EAPI char *
367ecore_x_atom_name_get(Ecore_X_Atom atom)
368{
369 xcb_get_atom_name_cookie_t cookie;
370 xcb_get_atom_name_reply_t *reply;
371 char *name;
372 int len = 0;
373
374 LOGFN(__FILE__, __LINE__, __FUNCTION__);
375 CHECK_XCB_CONN;
376
377 cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom);
378 reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
379 if (!reply) return NULL;
380 len = xcb_get_atom_name_name_length(reply);
381 name = (char *)malloc(sizeof(char) * (len + 1));
382 if (!name)
383 {
384 free(reply);
385 return NULL;
386 }
387 memcpy(name, xcb_get_atom_name_name(reply), len);
388 name[len] = '\0';
389
390 free(reply);
391 return name;
392}
393
394EAPI void
395ecore_x_atoms_get(const char **names,
396 int num,
397 Ecore_X_Atom *atoms)
398{
399 xcb_intern_atom_cookie_t cookies[num];
400 int i = 0;
401
402 LOGFN(__FILE__, __LINE__, __FUNCTION__);
403 CHECK_XCB_CONN;
404
405 for (i = 0; i < num; i++)
406 {
407 cookies[i] =
408 xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
409 strlen(names[i]), names[i]);
410 }
411 for (i = 0; i < num; i++)
412 {
413 xcb_intern_atom_reply_t *reply = NULL;
414
415 if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0)))
416 continue;
417 atoms[i] = reply->atom;
418 free(reply);
419 }
420}
421
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
deleted file mode 100644
index f247b34..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_composite.c
+++ /dev/null
@@ -1,289 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_COMPOSITE
3# include <xcb/composite.h>
4#endif
5
6/* local variables */
7static Eina_Bool _composite_avail = EINA_FALSE;
8
9void
10_ecore_xcb_composite_init(void)
11{
12 LOGFN(__FILE__, __LINE__, __FUNCTION__);
13
14#ifdef ECORE_XCB_COMPOSITE
15 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_composite_id);
16#endif
17}
18
19void
20_ecore_xcb_composite_finalize(void)
21{
22#ifdef ECORE_XCB_COMPOSITE
23 const xcb_query_extension_reply_t *ext_reply;
24#endif
25
26 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27
28#ifdef ECORE_XCB_COMPOSITE
29 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_composite_id);
30 if ((ext_reply) && (ext_reply->present))
31 {
32 xcb_composite_query_version_cookie_t cookie;
33 xcb_composite_query_version_reply_t *reply;
34
35 cookie =
36 xcb_composite_query_version_unchecked(_ecore_xcb_conn,
37 XCB_COMPOSITE_MAJOR_VERSION,
38 XCB_COMPOSITE_MINOR_VERSION);
39 reply =
40 xcb_composite_query_version_reply(_ecore_xcb_conn, cookie, NULL);
41 if (reply)
42 {
43// if ((reply->major_version >= XCB_COMPOSITE_MAJOR_VERSION) &&
44 if (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION)
45 {
46# ifdef ECORE_XCB_RENDER
47 if (_ecore_xcb_render_avail_get())
48 {
49# ifdef ECORE_XCB_XFIXES
50 if (_ecore_xcb_xfixes_avail_get())
51 _composite_avail = EINA_TRUE;
52# endif
53 }
54# endif
55 }
56
57 free(reply);
58 }
59 }
60#endif
61}
62
63/**
64 * @defgroup Ecore_X_Composite_Group X Composite Extension Functions
65 *
66 * Functions related to the X Composite Extension
67 */
68
69/**
70 * Return whether the Composite Extension is available
71 *
72 * @return EINA_TRUE is the Composite Extension is available, EINA_FALSE if not
73 *
74 * @ingroup Ecore_X_Composite_Group
75 */
76EAPI Eina_Bool
77ecore_x_composite_query(void)
78{
79 LOGFN(__FILE__, __LINE__, __FUNCTION__);
80 return _composite_avail;
81}
82
83EAPI void
84ecore_x_composite_redirect_window(Ecore_X_Window win,
85 Ecore_X_Composite_Update_Type type)
86{
87 LOGFN(__FILE__, __LINE__, __FUNCTION__);
88 CHECK_XCB_CONN;
89
90 if (!_composite_avail) return;
91
92#ifdef ECORE_XCB_COMPOSITE
93 uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
94
95 switch (type)
96 {
97 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
98 update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
99 break;
100
101 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
102 update = XCB_COMPOSITE_REDIRECT_MANUAL;
103 break;
104 }
105 xcb_composite_redirect_window(_ecore_xcb_conn, win, update);
106// ecore_x_flush();
107#endif
108}
109
110EAPI void
111ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
112 Ecore_X_Composite_Update_Type type)
113{
114 LOGFN(__FILE__, __LINE__, __FUNCTION__);
115 CHECK_XCB_CONN;
116
117 if (!_composite_avail) return;
118
119#ifdef ECORE_XCB_COMPOSITE
120 uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
121
122 switch (type)
123 {
124 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
125 update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
126 break;
127
128 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
129 update = XCB_COMPOSITE_REDIRECT_MANUAL;
130 break;
131 }
132 xcb_composite_redirect_subwindows(_ecore_xcb_conn, win, update);
133// ecore_x_flush();
134#endif
135}
136
137EAPI void
138ecore_x_composite_unredirect_window(Ecore_X_Window win,
139 Ecore_X_Composite_Update_Type type)
140{
141 LOGFN(__FILE__, __LINE__, __FUNCTION__);
142 CHECK_XCB_CONN;
143
144 if (!_composite_avail) return;
145
146#ifdef ECORE_XCB_COMPOSITE
147 uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
148
149 switch (type)
150 {
151 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
152 update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
153 break;
154
155 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
156 update = XCB_COMPOSITE_REDIRECT_MANUAL;
157 break;
158 }
159 xcb_composite_unredirect_window(_ecore_xcb_conn, win, update);
160// ecore_x_flush();
161#endif
162}
163
164EAPI void
165ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
166 Ecore_X_Composite_Update_Type type)
167{
168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
169 CHECK_XCB_CONN;
170
171 if (!_composite_avail) return;
172
173#ifdef ECORE_XCB_COMPOSITE
174 uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
175
176 switch (type)
177 {
178 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
179 update = XCB_COMPOSITE_REDIRECT_AUTOMATIC;
180 break;
181
182 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
183 update = XCB_COMPOSITE_REDIRECT_MANUAL;
184 break;
185 }
186 xcb_composite_unredirect_subwindows(_ecore_xcb_conn, win, update);
187// ecore_x_flush();
188#endif
189}
190
191EAPI Ecore_X_Pixmap
192ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
193{
194#ifdef ECORE_XCB_COMPOSITE
195 Ecore_X_Pixmap pmap = XCB_NONE;
196#endif
197
198 LOGFN(__FILE__, __LINE__, __FUNCTION__);
199 CHECK_XCB_CONN;
200
201 if (!_composite_avail) return XCB_NONE;
202
203#ifdef ECORE_XCB_COMPOSITE
204 pmap = xcb_generate_id(_ecore_xcb_conn);
205 xcb_composite_name_window_pixmap(_ecore_xcb_conn, win, pmap);
206// ecore_x_flush();
207#endif
208
209 return pmap;
210}
211
212EAPI void
213ecore_x_composite_window_events_disable(Ecore_X_Window win)
214{
215 LOGFN(__FILE__, __LINE__, __FUNCTION__);
216 CHECK_XCB_CONN;
217
218 if (!_composite_avail) return;
219
220#ifdef ECORE_XCB_SHAPE
221 ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1);
222// ecore_x_flush();
223#else
224 return;
225 win = 0;
226#endif
227}
228
229EAPI void
230ecore_x_composite_window_events_enable(Ecore_X_Window win)
231{
232 LOGFN(__FILE__, __LINE__, __FUNCTION__);
233 CHECK_XCB_CONN;
234
235 if (!_composite_avail) return;
236
237#ifdef ECORE_XCB_SHAPE
238 ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535);
239// ecore_x_flush();
240#else
241 return;
242 win = 0;
243#endif
244}
245
246EAPI Ecore_X_Window
247ecore_x_composite_render_window_enable(Ecore_X_Window root)
248{
249 Ecore_X_Window win = 0;
250#ifdef ECORE_XCB_COMPOSITE
251 xcb_composite_get_overlay_window_cookie_t cookie;
252 xcb_composite_get_overlay_window_reply_t *reply;
253#endif
254
255 LOGFN(__FILE__, __LINE__, __FUNCTION__);
256 CHECK_XCB_CONN;
257
258 if (!_composite_avail) return 0;
259
260#ifdef ECORE_XCB_COMPOSITE
261 cookie = xcb_composite_get_overlay_window_unchecked(_ecore_xcb_conn, root);
262 reply =
263 xcb_composite_get_overlay_window_reply(_ecore_xcb_conn, cookie, NULL);
264 if (!reply) return win;
265
266 win = reply->overlay_win;
267 free(reply);
268
269 ecore_x_composite_window_events_disable(win);
270// ecore_x_flush();
271#endif
272
273 return win;
274}
275
276EAPI void
277ecore_x_composite_render_window_disable(Ecore_X_Window win)
278{
279 LOGFN(__FILE__, __LINE__, __FUNCTION__);
280 CHECK_XCB_CONN;
281
282 if (!_composite_avail) return;
283
284#ifdef ECORE_XCB_COMPOSITE
285 xcb_composite_release_overlay_window(_ecore_xcb_conn, win);
286// ecore_x_flush();
287#endif
288}
289
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
deleted file mode 100644
index 755df04..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c
+++ /dev/null
@@ -1,400 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_CURSOR
3# include <xcb/render.h>
4# include <xcb/xcb_renderutil.h>
5#endif
6
7/* local function prototypes */
8#ifdef ECORE_XCB_CURSOR
9static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format_get(void);
10#endif
11static void _ecore_xcb_cursor_default_size_get(void);
12static void _ecore_xcb_cursor_dpi_size_get(void);
13static void _ecore_xcb_cursor_guess_size(void);
14#ifdef ECORE_XCB_CURSOR
15static Ecore_X_Cursor _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img,
16 int hot_x,
17 int hot_y);
18#endif
19static void _ecore_xcb_cursor_image_destroy(xcb_image_t *img);
20
21/* local variables */
22static int _ecore_xcb_cursor_size = 0;
23static Eina_Bool _ecore_xcb_cursor = EINA_FALSE;
24#ifdef ECORE_XCB_CURSOR
25static uint32_t _ecore_xcb_cursor_format_id = 0;
26// static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format = NULL;
27#endif
28
29void
30_ecore_xcb_cursor_init(void)
31{
32 LOGFN(__FILE__, __LINE__, __FUNCTION__);
33 /* NB: No-op */
34}
35
36void
37_ecore_xcb_cursor_finalize(void)
38{
39 LOGFN(__FILE__, __LINE__, __FUNCTION__);
40
41#ifdef ECORE_XCB_CURSOR
42 _ecore_xcb_cursor = _ecore_xcb_render_argb_get();
43
44 /* find render pict format */
45 if (_ecore_xcb_cursor_format_id <= 0)
46 _ecore_xcb_cursor_format_id = _ecore_xcb_cursor_format_get()->id;
47#endif
48
49 /* try to grab cursor size from XDefaults */
50 _ecore_xcb_cursor_default_size_get();
51
52 /* if that failed, try to get it from Xft Dpi setting */
53 if (_ecore_xcb_cursor_size == 0)
54 _ecore_xcb_cursor_dpi_size_get();
55
56 /* if that failed, try to guess from display size */
57 if (_ecore_xcb_cursor_size == 0)
58 _ecore_xcb_cursor_guess_size();
59
60 /* NB: Would normally add theme stuff here, but E cursor does not support
61 * xcursor themes. Delay parsing that stuff out until such time if/when the
62 * user selects to use X Cursor, rather than E cursor */
63}
64
65EAPI Eina_Bool
66ecore_x_cursor_color_supported_get(void)
67{
68 LOGFN(__FILE__, __LINE__, __FUNCTION__);
69
70 return _ecore_xcb_cursor;
71}
72
73EAPI Ecore_X_Cursor
74ecore_x_cursor_new(Ecore_X_Window win,
75 int *pixels,
76 int w,
77 int h,
78 int hot_x,
79 int hot_y)
80{
81 Ecore_X_Cursor cursor = 0;
82 xcb_image_t *img;
83
84// LOGFN(__FILE__, __LINE__, __FUNCTION__);
85 CHECK_XCB_CONN;
86
87#ifdef ECORE_XCB_CURSOR
88 if (_ecore_xcb_cursor)
89 {
90 img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
91 32, NULL, (w * h * sizeof(int)),
92 (uint8_t *)pixels);
93 cursor = _ecore_xcb_cursor_image_load_cursor(img, hot_x, hot_y);
94 _ecore_xcb_cursor_image_destroy(img);
95 return cursor;
96 }
97 else
98#endif
99 {
100 Ecore_X_GC gc;
101 xcb_pixmap_t pmap, mask;
102 uint32_t *pix;
103 uint8_t fr = 0x00, fg = 0x00, fb = 0x00;
104 uint8_t br = 0xff, bg = 0xff, bb = 0xff;
105 uint32_t brightest = 0, darkest = 255 * 3;
106 uint16_t x, y;
107 const uint32_t dither[2][2] =
108 {
109 {0, 2},
110 {3, 1}
111 };
112
113 img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
114 1, NULL, ~0, NULL);
115 if (img->data) free(img->data);
116 img->data = malloc(img->size);
117
118 pmap = xcb_generate_id(_ecore_xcb_conn);
119 xcb_create_pixmap(_ecore_xcb_conn, 1, pmap, win, w, h);
120 mask = xcb_generate_id(_ecore_xcb_conn);
121 xcb_create_pixmap(_ecore_xcb_conn, 1, mask, win, w, h);
122
123 pix = (uint32_t *)pixels;
124 for (y = 0; y < h; y++)
125 {
126 for (x = 0; x < w; x++)
127 {
128 uint8_t r, g, b, a;
129
130 a = (pix[0] >> 24) & 0xff;
131 r = (pix[0] >> 16) & 0xff;
132 g = (pix[0] >> 8) & 0xff;
133 b = (pix[0]) & 0xff;
134 if (a > 0)
135 {
136 if ((uint32_t)(r + g + b) > brightest)
137 {
138 brightest = r + g + b;
139 br = r;
140 bg = g;
141 bb = b;
142 }
143
144 if ((uint32_t)(r + g + b) < darkest)
145 {
146 darkest = r + g + b;
147 fr = r;
148 fg = g;
149 fb = b;
150 }
151 }
152 pix++;
153 }
154 }
155
156 pix = (uint32_t *)pixels;
157 for (y = 0; y < h; y++)
158 {
159 for (x = 0; x < w; x++)
160 {
161 uint32_t v;
162 uint8_t r, g, b;
163 int32_t d1, d2;
164
165 r = (pix[0] >> 16) & 0xff;
166 g = (pix[0] >> 8) & 0xff;
167 b = (pix[0]) & 0xff;
168 d1 =
169 ((r - fr) * (r - fr)) +
170 ((g - fg) * (g - fg)) +
171 ((b - fb) * (b - fb));
172 d2 =
173 ((r - br) * (r - br)) +
174 ((g - bg) * (g - bg)) +
175 ((b - bb) * (b - bb));
176 if (d1 + d2)
177 {
178 v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
179 if (v > dither[x & 0x1][y & 0x1])
180 v = 1;
181 else
182 v = 0;
183 }
184 else
185 v = 0;
186
187 xcb_image_put_pixel(img, x, y, v);
188 pix++;
189 }
190 }
191
192 gc = ecore_x_gc_new(pmap, 0, NULL);
193 xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, w, h,
194 0, 0, 0, img->depth, img->size, img->data);
195 ecore_x_gc_free(gc);
196
197 pix = (uint32_t *)pixels;
198 for (y = 0; y < h; y++)
199 {
200 for (x = 0; x < w; x++)
201 {
202 uint32_t v;
203
204 v = (((pix[0] >> 24) & 0xff) * 5) / 256;
205 if (v > dither[x & 0x1][y & 0x1])
206 v = 1;
207 else
208 v = 0;
209
210 xcb_image_put_pixel(img, x, y, v);
211 pix++;
212 }
213 }
214
215 gc = ecore_x_gc_new(mask, 0, NULL);
216 xcb_put_image(_ecore_xcb_conn, img->format, mask, gc, w, h,
217 0, 0, 0, img->depth, img->size, img->data);
218 ecore_x_gc_free(gc);
219
220 if (img->data) free(img->data);
221 _ecore_xcb_cursor_image_destroy(img);
222
223 cursor = xcb_generate_id(_ecore_xcb_conn);
224 xcb_create_cursor(_ecore_xcb_conn, cursor, pmap, mask,
225 fr << 8 | fr, fg << 8 | fg, fb << 8 | fb,
226 br << 8 | br, bg << 8 | bg, bb << 8 | bb,
227 hot_x, hot_y);
228
229 xcb_free_pixmap(_ecore_xcb_conn, pmap);
230 xcb_free_pixmap(_ecore_xcb_conn, mask);
231
232 return cursor;
233 }
234
235 return 0;
236}
237
238EAPI void
239ecore_x_cursor_free(Ecore_X_Cursor c)
240{
241// LOGFN(__FILE__, __LINE__, __FUNCTION__);
242 CHECK_XCB_CONN;
243
244 xcb_free_cursor(_ecore_xcb_conn, c);
245}
246
247/*
248 * Returns the cursor for the given shape.
249 * Note that the return value must not be freed with
250 * ecore_x_cursor_free()!
251 */
252EAPI Ecore_X_Cursor
253ecore_x_cursor_shape_get(int shape)
254{
255 Ecore_X_Cursor cursor = 0;
256 xcb_font_t font;
257
258 LOGFN(__FILE__, __LINE__, __FUNCTION__);
259 CHECK_XCB_CONN;
260
261 font = xcb_generate_id(_ecore_xcb_conn);
262 xcb_open_font(_ecore_xcb_conn, font, strlen("cursor"), "cursor");
263
264 cursor = xcb_generate_id(_ecore_xcb_conn);
265 /* FIXME: Add request check ?? */
266 xcb_create_glyph_cursor(_ecore_xcb_conn, cursor, font, font,
267 shape, shape + 1, 0, 0, 0, 65535, 65535, 65535);
268
269 xcb_close_font(_ecore_xcb_conn, font);
270 return cursor;
271}
272
273EAPI void
274ecore_x_cursor_size_set(int size)
275{
276 LOGFN(__FILE__, __LINE__, __FUNCTION__);
277
278 _ecore_xcb_cursor_size = size;
279 /* NB: May need to adjust size of current cursors here */
280}
281
282EAPI int
283ecore_x_cursor_size_get(void)
284{
285 LOGFN(__FILE__, __LINE__, __FUNCTION__);
286
287 return _ecore_xcb_cursor_size;
288}
289
290/* local functions */
291#ifdef ECORE_XCB_CURSOR
292static xcb_render_pictforminfo_t *
293_ecore_xcb_cursor_format_get(void)
294{
295 const xcb_render_query_pict_formats_reply_t *reply;
296 xcb_render_pictforminfo_t *ret = NULL;
297
298 CHECK_XCB_CONN;
299
300 reply = xcb_render_util_query_formats(_ecore_xcb_conn);
301 if (reply)
302 ret = xcb_render_util_find_standard_format(reply,
303 XCB_PICT_STANDARD_ARGB_32);
304
305 return ret;
306}
307
308#endif
309
310static void
311_ecore_xcb_cursor_default_size_get(void)
312{
313 char *s = NULL;
314 int v = 0;
315
316 LOGFN(__FILE__, __LINE__, __FUNCTION__);
317
318 s = getenv("XCURSOR_SIZE");
319 if (!s)
320 {
321 _ecore_xcb_xdefaults_init();
322 v = _ecore_xcb_xdefaults_int_get("Xcursor", "size");
323 _ecore_xcb_xdefaults_shutdown();
324 }
325 else
326 v = atoi(s);
327 if (v) _ecore_xcb_cursor_size = ((v * 16) / 72);
328}
329
330static void
331_ecore_xcb_cursor_dpi_size_get(void)
332{
333 int v = 0;
334
335 LOGFN(__FILE__, __LINE__, __FUNCTION__);
336
337 _ecore_xcb_xdefaults_init();
338 v = _ecore_xcb_xdefaults_int_get("Xft", "dpi");
339 if (v) _ecore_xcb_cursor_size = ((v * 16) / 72);
340 _ecore_xcb_xdefaults_shutdown();
341}
342
343static void
344_ecore_xcb_cursor_guess_size(void)
345{
346 int w = 0, h = 0, s = 0;
347
348 LOGFN(__FILE__, __LINE__, __FUNCTION__);
349
350 ecore_x_screen_size_get(_ecore_xcb_screen, &w, &h);
351 if (h < w) s = h;
352 else s = w;
353 _ecore_xcb_cursor_size = (s / 48);
354}
355
356#ifdef ECORE_XCB_CURSOR
357static Ecore_X_Cursor
358_ecore_xcb_cursor_image_load_cursor(xcb_image_t *img,
359 int hot_x,
360 int hot_y)
361{
362 Ecore_X_Cursor cursor = 0;
363 Ecore_X_GC gc;
364 xcb_pixmap_t pmap;
365 xcb_render_picture_t pict;
366
367 CHECK_XCB_CONN;
368
369 pmap = xcb_generate_id(_ecore_xcb_conn);
370 xcb_create_pixmap(_ecore_xcb_conn, img->depth, pmap,
371 ((xcb_screen_t *)_ecore_xcb_screen)->root,
372 img->width, img->height);
373
374 gc = ecore_x_gc_new(pmap, 0, NULL);
375 xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc,
376 img->width, img->height, 0, 0, 0, img->depth,
377 img->size, img->data);
378 ecore_x_gc_free(gc);
379
380 pict = xcb_generate_id(_ecore_xcb_conn);
381 xcb_render_create_picture(_ecore_xcb_conn, pict, pmap,
382 _ecore_xcb_cursor_format_id, 0, NULL);
383 xcb_free_pixmap(_ecore_xcb_conn, pmap);
384
385 cursor = xcb_generate_id(_ecore_xcb_conn);
386 xcb_render_create_cursor(_ecore_xcb_conn, cursor, pict, hot_x, hot_y);
387 xcb_render_free_picture(_ecore_xcb_conn, pict);
388
389 return cursor;
390}
391
392#endif
393
394static void
395_ecore_xcb_cursor_image_destroy(xcb_image_t *img)
396{
397 CHECK_XCB_CONN;
398 if (img) xcb_image_destroy(img);
399}
400
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
deleted file mode 100644
index bbab308..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c
+++ /dev/null
@@ -1,155 +0,0 @@
1#include "ecore_xcb_private.h"
2# ifdef ECORE_XCB_DAMAGE
3# include <xcb/damage.h>
4# endif
5
6/* local variables */
7static Eina_Bool _damage_avail = EINA_FALSE;
8
9/* external variables */
10int _ecore_xcb_event_damage = -1;
11
12void
13_ecore_xcb_damage_init(void)
14{
15 LOGFN(__FILE__, __LINE__, __FUNCTION__);
16
17#ifdef ECORE_XCB_DAMAGE
18 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_damage_id);
19#endif
20}
21
22void
23_ecore_xcb_damage_finalize(void)
24{
25#ifdef ECORE_XCB_DAMAGE
26 const xcb_query_extension_reply_t *ext_reply;
27#endif
28
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30
31#ifdef ECORE_XCB_DAMAGE
32 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_damage_id);
33 if ((ext_reply) && (ext_reply->present))
34 {
35 xcb_damage_query_version_cookie_t cookie;
36 xcb_damage_query_version_reply_t *reply;
37
38 cookie =
39 xcb_damage_query_version_unchecked(_ecore_xcb_conn,
40 XCB_DAMAGE_MAJOR_VERSION,
41 XCB_DAMAGE_MINOR_VERSION);
42 reply = xcb_damage_query_version_reply(_ecore_xcb_conn, cookie, NULL);
43 if (reply)
44 {
45 _damage_avail = EINA_TRUE;
46 free(reply);
47 }
48
49 if (_damage_avail)
50 _ecore_xcb_event_damage = ext_reply->first_event;
51 }
52#endif
53}
54
55/**
56 * @defgroup Ecore_X_Damage_Group X Damage Extension Functions
57 *
58 * Functions related to the X Damage Extension.
59 */
60
61EAPI Eina_Bool
62ecore_x_damage_query(void)
63{
64 return _damage_avail;
65}
66
67/**
68 * Create a damage object
69 *
70 * @param drawable The drawable to monitor
71 * @param level The level of the damage report
72 * @return The damage object
73 *
74 * Creates a damage object to monitor changes to @p drawable,
75 * with the level @p level.
76 *
77 * @ingroup Ecore_X_Damage_Group
78 */
79EAPI Ecore_X_Damage
80ecore_x_damage_new(Ecore_X_Drawable drawable,
81 Ecore_X_Damage_Report_Level level)
82{
83 Ecore_X_Damage damage = 0;
84
85 LOGFN(__FILE__, __LINE__, __FUNCTION__);
86 CHECK_XCB_CONN;
87
88 if (!_damage_avail) return 0;
89
90#ifdef ECORE_XCB_DAMAGE
91 damage = xcb_generate_id(_ecore_xcb_conn);
92 xcb_damage_create(_ecore_xcb_conn, damage, drawable, level);
93// ecore_x_flush();
94#endif
95
96 return damage;
97}
98
99/**
100 * Destroy a damage object
101 *
102 * @param damage The damage object to destroy
103 *
104 * Destroys the damage object @p damage
105 *
106 * @ingroup Ecore_X_Damage_Group
107 */
108EAPI void
109ecore_x_damage_free(Ecore_X_Damage damage)
110{
111 LOGFN(__FILE__, __LINE__, __FUNCTION__);
112 CHECK_XCB_CONN;
113
114 if (!_damage_avail) return;
115
116#ifdef ECORE_XCB_DAMAGE
117 xcb_damage_destroy(_ecore_xcb_conn, damage);
118// ecore_x_flush();
119#endif
120}
121
122/**
123 * Synchronously modifies the region
124 *
125 * @param damage The damage object to destroy
126 * @param repair The repair region
127 * @param parts The parts region
128 *
129 * Synchronously modifies the regions in the following manner:
130 * If @p repair is @c XCB_NONE:
131 * 1) parts = damage
132 * 2) damage = <empty>
133 * Otherwise:
134 * 1) parts = damage INTERSECT repair
135 * 2) damage = damage - parts
136 * 3) Generate DamageNotify for remaining damage areas
137 *
138 * @ingroup Ecore_X_Damage_Group
139 */
140EAPI void
141ecore_x_damage_subtract(Ecore_X_Damage damage,
142 Ecore_X_Region repair,
143 Ecore_X_Region parts)
144{
145 LOGFN(__FILE__, __LINE__, __FUNCTION__);
146 CHECK_XCB_CONN;
147
148 if (!_damage_avail) return;
149
150#ifdef ECORE_XCB_DAMAGE
151 xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
152// ecore_x_flush();
153#endif
154}
155
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
deleted file mode 100644
index 177e61d..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c
+++ /dev/null
@@ -1,688 +0,0 @@
1#include "ecore_xcb_private.h"
2
3#ifndef MIN
4# define MIN(a, b) (((a) < (b)) ? (a) : (b))
5#endif
6
7/* local structures */
8typedef struct _Version_Cache_Item
9{
10 Ecore_X_Window win;
11 int ver;
12} Version_Cache_Item;
13
14/* local function prototypes */
15static Eina_Bool _ecore_xcb_dnd_converter_copy(char *target __UNUSED__,
16 void *data,
17 int size,
18 void **data_ret,
19 int *size_ret,
20 Ecore_X_Atom *tprop __UNUSED__,
21 int *count __UNUSED__);
22
23/* local variables */
24static int _ecore_xcb_dnd_init_count = 0;
25static Ecore_X_DND_Source *_source = NULL;
26static Ecore_X_DND_Target *_target = NULL;
27static Version_Cache_Item *_version_cache = NULL;
28static int _version_cache_num = 0, _version_cache_alloc = 0;
29static void (*_posupdatecb)(void *,
30 Ecore_X_Xdnd_Position *);
31static void *_posupdatedata;
32
33/* external variables */
34EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
35EAPI int ECORE_X_EVENT_XDND_POSITION = 0;
36EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
37EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
38EAPI int ECORE_X_EVENT_XDND_DROP = 0;
39EAPI int ECORE_X_EVENT_XDND_FINISHED = 0;
40
41void
42_ecore_xcb_dnd_init(void)
43{
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45
46 if (!_ecore_xcb_dnd_init_count)
47 {
48 _source = calloc(1, sizeof(Ecore_X_DND_Source));
49 if (!_source) return;
50 _source->version = ECORE_X_DND_VERSION;
51 _source->win = XCB_NONE;
52 _source->dest = XCB_NONE;
53 _source->state = ECORE_X_DND_SOURCE_IDLE;
54 _source->prev.window = 0;
55
56 _target = calloc(1, sizeof(Ecore_X_DND_Target));
57 if (!_target)
58 {
59 free(_source);
60 _source = NULL;
61 return;
62 }
63 _target->win = XCB_NONE;
64 _target->source = XCB_NONE;
65 _target->state = ECORE_X_DND_TARGET_IDLE;
66
67 ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
68 ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
69 ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
70 ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
71 ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
72 ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
73 }
74 _ecore_xcb_dnd_init_count++;
75}
76
77void
78_ecore_xcb_dnd_shutdown(void)
79{
80 LOGFN(__FILE__, __LINE__, __FUNCTION__);
81
82 _ecore_xcb_dnd_init_count--;
83 if (_ecore_xcb_dnd_init_count > 0) return;
84 if (_source) free(_source);
85 _source = NULL;
86 if (_target) free(_target);
87 _target = NULL;
88 _ecore_xcb_dnd_init_count = 0;
89}
90
91EAPI void
92ecore_x_dnd_send_status(Eina_Bool will_accept,
93 Eina_Bool suppress,
94 Ecore_X_Rectangle rect,
95 Ecore_X_Atom action)
96{
97 xcb_client_message_event_t ev;
98
99 LOGFN(__FILE__, __LINE__, __FUNCTION__);
100 CHECK_XCB_CONN;
101
102 if (_target->state == ECORE_X_DND_TARGET_IDLE) return;
103
104 memset(&ev, 0, sizeof(xcb_client_message_event_t));
105
106 _target->will_accept = will_accept;
107
108 ev.response_type = XCB_CLIENT_MESSAGE;
109 ev.type = ECORE_X_ATOM_XDND_STATUS;
110 ev.format = 32;
111 ev.window = _target->source;
112 ev.data.data32[0] = _target->win;
113 ev.data.data32[1] = 0;
114 if (will_accept) ev.data.data32[1] |= 0x1UL;
115 if (!suppress) ev.data.data32[1] |= 0x2UL;
116
117 ev.data.data32[2] = rect.x;
118 ev.data.data32[2] <<= 16;
119 ev.data.data32[2] |= rect.y;
120 ev.data.data32[3] = rect.width;
121 ev.data.data32[3] <<= 16;
122 ev.data.data32[3] |= rect.height;
123
124 if (will_accept)
125 ev.data.data32[4] = action;
126 else
127 ev.data.data32[4] = XCB_NONE;
128 _target->accepted_action = action;
129
130 xcb_send_event(_ecore_xcb_conn, 0, _target->source,
131 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
132// ecore_x_flush();
133}
134
135EAPI Eina_Bool
136ecore_x_dnd_drop(void)
137{
138 xcb_client_message_event_t ev;
139 Eina_Bool status = EINA_FALSE;
140
141 LOGFN(__FILE__, __LINE__, __FUNCTION__);
142 CHECK_XCB_CONN;
143
144 memset(&ev, 0, sizeof(xcb_client_message_event_t));
145
146 if (_source->dest)
147 {
148 ev.response_type = XCB_CLIENT_MESSAGE;
149 ev.format = 32;
150 ev.window = _source->dest;
151
152 if (_source->will_accept)
153 {
154 ev.type = ECORE_X_ATOM_XDND_DROP;
155 ev.data.data32[0] = _source->win;
156 ev.data.data32[1] = 0;
157 ev.data.data32[2] = _source->time;
158
159 xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
160 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
161// ecore_x_flush();
162 _source->state = ECORE_X_DND_SOURCE_DROPPED;
163 status = EINA_TRUE;
164 }
165 else
166 {
167 ev.type = ECORE_X_ATOM_XDND_LEAVE;
168 ev.data.data32[0] = _source->win;
169 ev.data.data32[1] = 0;
170
171 xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
172 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
173// ecore_x_flush();
174 _source->state = ECORE_X_DND_SOURCE_IDLE;
175 }
176 }
177 else
178 {
179 ecore_x_selection_xdnd_clear();
180 _source->state = ECORE_X_DND_SOURCE_IDLE;
181 }
182
183 ecore_x_window_ignore_set(_source->win, 0);
184 _source->prev.window = 0;
185
186 return status;
187}
188
189EAPI void
190ecore_x_dnd_aware_set(Ecore_X_Window win,
191 Eina_Bool on)
192{
193 Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
194
195 LOGFN(__FILE__, __LINE__, __FUNCTION__);
196
197 if (on)
198 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
199 ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
200 else
201 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
202}
203
204EAPI int
205ecore_x_dnd_version_get(Ecore_X_Window win)
206{
207 unsigned char *data;
208 int num = 0;
209 Version_Cache_Item *t;
210
211 LOGFN(__FILE__, __LINE__, __FUNCTION__);
212
213 if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
214 {
215 if (_version_cache)
216 {
217 int i = 0;
218
219 for (i = 0; i < _version_cache_num; i++)
220 {
221 if (_version_cache[i].win == win)
222 return _version_cache[i].ver;
223 }
224 }
225 }
226
227 if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE,
228 ECORE_X_ATOM_ATOM, 32, &data, &num))
229 {
230 int version = 0;
231
232 version = (int)*data;
233 free(data);
234 if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
235 {
236 _version_cache_num++;
237 if (_version_cache_num > _version_cache_alloc)
238 _version_cache_alloc += 16;
239 t = realloc(_version_cache,
240 _version_cache_alloc * sizeof(Version_Cache_Item));
241 if (!t) return 0;
242 _version_cache = t;
243 _version_cache[_version_cache_num - 1].win = win;
244 _version_cache[_version_cache_num - 1].ver = version;
245 }
246 return version;
247 }
248
249 if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
250 {
251 _version_cache_num++;
252 if (_version_cache_num > _version_cache_alloc)
253 _version_cache_alloc += 16;
254 t = realloc(_version_cache,
255 _version_cache_alloc * sizeof(Version_Cache_Item));
256 if (!t) return 0;
257 _version_cache = t;
258 _version_cache[_version_cache_num - 1].win = win;
259 _version_cache[_version_cache_num - 1].ver = 0;
260 }
261
262 return 0;
263}
264
265EAPI Eina_Bool
266ecore_x_dnd_type_isset(Ecore_X_Window win,
267 const char *type)
268{
269 int num = 0, i = 0;
270 Eina_Bool ret = EINA_FALSE;
271 unsigned char *data;
272 Ecore_X_Atom *atoms, atom;
273
274 LOGFN(__FILE__, __LINE__, __FUNCTION__);
275 CHECK_XCB_CONN;
276
277 if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
278 ECORE_X_ATOM_ATOM, 32, &data, &num))
279 return ret;
280
281 atom = ecore_x_atom_get(type);
282 atoms = (Ecore_X_Atom *)data;
283 for (i = 0; i < num; ++i)
284 {
285 if (atom == atoms[i])
286 {
287 ret = EINA_TRUE;
288 break;
289 }
290 }
291
292 free(data);
293 return ret;
294}
295
296EAPI void
297ecore_x_dnd_type_set(Ecore_X_Window win,
298 const char *type,
299 Eina_Bool on)
300{
301 Ecore_X_Atom atom, *oldset = NULL, *newset = NULL;
302 int i = 0, j = 0, num = 0;
303 unsigned char *data = NULL, *old_data = NULL;
304
305 LOGFN(__FILE__, __LINE__, __FUNCTION__);
306 CHECK_XCB_CONN;
307
308 atom = ecore_x_atom_get(type);
309 ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
310 ECORE_X_ATOM_ATOM, 32, &old_data, &num);
311 oldset = (Ecore_X_Atom *)old_data;
312 if (on)
313 {
314 if (ecore_x_dnd_type_isset(win, type))
315 {
316 free(old_data);
317 return;
318 }
319 newset = calloc(num + 1, sizeof(Ecore_X_Atom));
320 if (!newset) return;
321 data = (unsigned char *)newset;
322 for (i = 0; i < num; i++)
323 newset[i + 1] = oldset[i];
324 newset[0] = atom;
325 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
326 ECORE_X_ATOM_ATOM, 32, data, num + 1);
327 }
328 else
329 {
330 if (!ecore_x_dnd_type_isset(win, type))
331 {
332 free(old_data);
333 return;
334 }
335 newset = calloc(num - 1, sizeof(Ecore_X_Atom));
336 if (!newset)
337 {
338 free(old_data);
339 return;
340 }
341 data = (unsigned char *)newset;
342 for (i = 0; i < num; i++)
343 if (oldset[i] != atom)
344 newset[j++] = oldset[i];
345 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
346 ECORE_X_ATOM_ATOM, 32, data, num - 1);
347 }
348 free(oldset);
349 free(newset);
350}
351
352EAPI void
353ecore_x_dnd_types_set(Ecore_X_Window win,
354 const char **types,
355 unsigned int num_types)
356{
357 Ecore_X_Atom *newset = NULL;
358 unsigned int i;
359 unsigned char *data = NULL;
360
361 LOGFN(__FILE__, __LINE__, __FUNCTION__);
362 CHECK_XCB_CONN;
363
364 if (!num_types)
365 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
366 else
367 {
368 newset = calloc(num_types, sizeof(Ecore_X_Atom));
369 if (!newset) return;
370
371 data = (unsigned char *)newset;
372 for (i = 0; i < num_types; i++)
373 {
374 newset[i] = ecore_x_atom_get(types[i]);
375 ecore_x_selection_converter_atom_add(newset[i],
376 _ecore_xcb_dnd_converter_copy);
377 }
378 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
379 ECORE_X_ATOM_ATOM, 32, data,
380 num_types);
381 free(newset);
382 }
383}
384
385EAPI void
386ecore_x_dnd_actions_set(Ecore_X_Window win,
387 Ecore_X_Atom *actions,
388 unsigned int num_actions)
389{
390 unsigned int i;
391 unsigned char *data = NULL;
392
393 LOGFN(__FILE__, __LINE__, __FUNCTION__);
394 CHECK_XCB_CONN;
395
396 if (!num_actions)
397 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
398 else
399 {
400 data = (unsigned char *)actions;
401 for (i = 0; i < num_actions; i++)
402 ecore_x_selection_converter_atom_add(actions[i],
403 _ecore_xcb_dnd_converter_copy);
404 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST,
405 ECORE_X_ATOM_ATOM, 32, data,
406 num_actions);
407 }
408}
409
410/**
411 * The DND position update cb is called Ecore_X sends a DND position to a
412 * client.
413 *
414 * It essentially mirrors some of the data sent in the position message.
415 * Generally this cb should be set just before position update is called.
416 * Please note well you need to look after your own data pointer if someone
417 * trashes you position update cb set.
418 *
419 * It is considered good form to clear this when the dnd event finishes.
420 *
421 * @param cb Callback to updated each time ecore_x sends a position update.
422 * @param data User data.
423 */
424EAPI void
425ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data),
426 const void *data)
427{
428 _posupdatecb = cb;
429 _posupdatedata = (void *)data;
430}
431
432EAPI Eina_Bool
433ecore_x_dnd_begin(Ecore_X_Window source,
434 unsigned char *data,
435 int size)
436{
437 LOGFN(__FILE__, __LINE__, __FUNCTION__);
438
439 if (!ecore_x_dnd_version_get(source)) return EINA_FALSE;
440
441 /* Take ownership of XdndSelection */
442 if (!ecore_x_selection_xdnd_set(source, data, size)) return EINA_FALSE;
443
444 if (_version_cache)
445 {
446 free(_version_cache);
447 _version_cache = NULL;
448 _version_cache_num = 0;
449 _version_cache_alloc = 0;
450 }
451
452 ecore_x_window_shadow_tree_flush();
453
454 _source->win = source;
455 ecore_x_window_ignore_set(_source->win, 1);
456 _source->state = ECORE_X_DND_SOURCE_DRAGGING;
457 _source->time = _ecore_xcb_events_last_time_get();
458 _source->prev.window = 0;
459
460 /* Default Accepted Action: move */
461 _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE;
462 _source->accepted_action = XCB_NONE;
463 _source->dest = XCB_NONE;
464
465 return EINA_TRUE;
466}
467
468EAPI void
469ecore_x_dnd_send_finished(void)
470{
471 xcb_client_message_event_t ev;
472
473 LOGFN(__FILE__, __LINE__, __FUNCTION__);
474 CHECK_XCB_CONN;
475
476 if (_target->state == ECORE_X_DND_TARGET_IDLE) return;
477
478 memset(&ev, 0, sizeof(xcb_client_message_event_t));
479
480 ev.response_type = XCB_CLIENT_MESSAGE;
481 ev.format = 32;
482 ev.type = ECORE_X_ATOM_XDND_FINISHED;
483 ev.window = _target->source;
484 ev.data.data32[0] = _target->win;
485 ev.data.data32[1] = 0;
486 ev.data.data32[2] = 0;
487 if (_target->will_accept)
488 {
489 ev.data.data32[1] |= 0x1UL;
490 ev.data.data32[2] = _target->accepted_action;
491 }
492
493 xcb_send_event(_ecore_xcb_conn, 0, _target->source,
494 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
495// ecore_x_flush();
496 _target->state = ECORE_X_DND_TARGET_IDLE;
497}
498
499EAPI void
500ecore_x_dnd_source_action_set(Ecore_X_Atom action)
501{
502 LOGFN(__FILE__, __LINE__, __FUNCTION__);
503
504 _source->action = action;
505 if (_source->prev.window)
506 _ecore_xcb_dnd_drag(_source->prev.window,
507 _source->prev.x, _source->prev.y);
508}
509
510Ecore_X_DND_Source *
511_ecore_xcb_dnd_source_get(void)
512{
513 return _source;
514}
515
516Ecore_X_DND_Target *
517_ecore_xcb_dnd_target_get(void)
518{
519 return _target;
520}
521
522void
523_ecore_xcb_dnd_drag(Ecore_X_Window root,
524 int x,
525 int y)
526{
527 xcb_client_message_event_t ev;
528 Ecore_X_Window win, *skip;
529 Ecore_X_Xdnd_Position pos;
530 int num = 0;
531
532 if (_source->state != ECORE_X_DND_SOURCE_DRAGGING) return;
533
534 LOGFN(__FILE__, __LINE__, __FUNCTION__);
535 CHECK_XCB_CONN;
536
537 memset(&ev, 0, sizeof(xcb_client_message_event_t));
538
539 ev.response_type = XCB_CLIENT_MESSAGE;
540 ev.format = 32;
541
542 skip = ecore_x_window_ignore_list(&num);
543 win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, skip, num);
544 while ((win) && !(ecore_x_dnd_version_get(win)))
545 win = ecore_x_window_shadow_parent_get(root, win);
546
547 if ((_source->dest) && (win != _source->dest))
548 {
549 ev.window = _source->dest;
550 ev.type = ECORE_X_ATOM_XDND_LEAVE;
551 ev.data.data32[0] = _source->win;
552 ev.data.data32[1] = 0;
553
554 xcb_send_event(_ecore_xcb_conn, 0, _source->dest,
555 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
556// ecore_x_flush();
557 _source->suppress = 0;
558 }
559
560 if (win)
561 {
562 int x1, x2, y1, y2;
563
564 _source->version = MIN(ECORE_X_DND_VERSION,
565 ecore_x_dnd_version_get(win));
566 if (win != _source->dest)
567 {
568 int i = 0;
569 unsigned char *data;
570 Ecore_X_Atom *types;
571
572 ecore_x_window_prop_property_get(_source->win,
573 ECORE_X_ATOM_XDND_TYPE_LIST,
574 ECORE_X_ATOM_ATOM, 32,
575 &data, &num);
576 types = (Ecore_X_Atom *)data;
577 ev.window = win;
578 ev.type = ECORE_X_ATOM_XDND_ENTER;
579 ev.data.data32[0] = _source->win;
580 ev.data.data32[1] = 0;
581 if (num > 3)
582 ev.data.data32[1] |= 0x1UL;
583 else
584 ev.data.data32[1] &= 0xfffffffeUL;
585 ev.data.data32[1] |= ((unsigned long)_source->version) << 24;
586
587 for (i = 2; i < 5; i++)
588 ev.data.data32[i] = 0;
589 for (i = 0; i < MIN(num, 3); ++i)
590 ev.data.data32[i + 2] = types[i];
591 free(data);
592
593 xcb_send_event(_ecore_xcb_conn, 0, win,
594 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
595// ecore_x_flush();
596 _source->await_status = 0;
597 _source->will_accept = 0;
598 }
599
600 x1 = _source->rectangle.x;
601 x2 = _source->rectangle.x + _source->rectangle.width;
602 y1 = _source->rectangle.y;
603 y2 = _source->rectangle.y + _source->rectangle.height;
604
605 if ((!_source->await_status) || (!_source->suppress) ||
606 ((x < x1) || (x > x2) || (y < y1) || (y > y2)))
607 {
608 ev.window = win;
609 ev.type = ECORE_X_ATOM_XDND_POSITION;
610 ev.data.data32[0] = _source->win;
611 ev.data.data32[1] = 0;
612 ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
613 ev.data.data32[3] = _source->time;
614 ev.data.data32[4] = _source->action;
615
616 xcb_send_event(_ecore_xcb_conn, 0, win,
617 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
618// ecore_x_flush();
619 _source->await_status = 1;
620 }
621 }
622
623 if (_posupdatecb)
624 {
625 pos.position.x = x;
626 pos.position.y = y;
627 pos.win = win;
628 pos.prev = _source->dest;
629 _posupdatecb(_posupdatedata, &pos);
630 }
631
632 _source->prev.x = x;
633 _source->prev.y = y;
634 _source->prev.window = root;
635 _source->dest = win;
636}
637
638EAPI Ecore_X_Atom
639ecore_x_dnd_source_action_get(void)
640{
641 return _source->action;
642}
643
644/* local functions */
645static Eina_Bool
646_ecore_xcb_dnd_converter_copy(char *target __UNUSED__,
647 void *data,
648 int size,
649 void **data_ret,
650 int *size_ret,
651 Ecore_X_Atom *tprop __UNUSED__,
652 int *count __UNUSED__)
653{
654 Ecore_Xcb_Textproperty text_prop;
655 Ecore_Xcb_Encoding_Style style = XcbTextStyle;
656 char *mystr;
657
658 LOGFN(__FILE__, __LINE__, __FUNCTION__);
659
660 if ((!data) || (!size)) return EINA_FALSE;
661
662 mystr = calloc(1, size + 1);
663 if (!mystr) return EINA_FALSE;
664
665 memcpy(mystr, data, size);
666 if (_ecore_xcb_mb_textlist_to_textproperty(&mystr, 1, style, &text_prop))
667 {
668 int len;
669
670 len = strlen((char *)text_prop.value) + 1;
671 if (!(*data_ret = malloc(len)))
672 {
673 free(mystr);
674 return EINA_FALSE;
675 }
676 memcpy(*data_ret, text_prop.value, len);
677 *size_ret = len;
678 free(text_prop.value);
679 free(mystr);
680 return EINA_TRUE;
681 }
682 else
683 {
684 free(mystr);
685 return EINA_FALSE;
686 }
687}
688
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
deleted file mode 100644
index 324717c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c
+++ /dev/null
@@ -1,318 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_DAMAGE
3# include <xcb/dpms.h>
4#endif
5
6/* local variables */
7static Eina_Bool _dpms_avail = EINA_FALSE;
8
9void
10_ecore_xcb_dpms_init(void)
11{
12 LOGFN(__FILE__, __LINE__, __FUNCTION__);
13
14#ifdef ECORE_XCB_DPMS
15 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_dpms_id);
16#endif
17}
18
19void
20_ecore_xcb_dpms_finalize(void)
21{
22#ifdef ECORE_XCB_DPMS
23 const xcb_query_extension_reply_t *ext_reply;
24#endif
25
26 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27
28#ifdef ECORE_XCB_DPMS
29 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_dpms_id);
30 if ((ext_reply) && (ext_reply->present))
31 {
32 xcb_dpms_get_version_cookie_t cookie;
33 xcb_dpms_get_version_reply_t *reply;
34
35 cookie =
36 xcb_dpms_get_version_unchecked(_ecore_xcb_conn,
37 XCB_DPMS_MAJOR_VERSION,
38 XCB_DPMS_MINOR_VERSION);
39 reply = xcb_dpms_get_version_reply(_ecore_xcb_conn, cookie, NULL);
40 if (reply)
41 {
42 if (reply->server_major_version >= 1)
43 _dpms_avail = EINA_TRUE;
44 free(reply);
45 }
46 }
47#endif
48}
49
50/**
51 * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
52 *
53 * Functions related to the X DPMS Extension
54 */
55
56/**
57 * Checks if the DPMS extension is available or not.
58 *
59 * @return @c EINA_TRUE if the DPMS extension is available,
60 * @c EINA_FALSE otherwise.
61 *
62 * Return EINA_TRUE if the X server supports the DPMS Extension version 1.0,
63 * EINA_FALSE otherwise.
64 *
65 * @ingroup Ecore_X_DPMS_Group
66 */
67EAPI Eina_Bool
68ecore_x_dpms_query(void)
69{
70// LOGFN(__FILE__, __LINE__, __FUNCTION__);
71
72 return _dpms_avail;
73}
74
75/**
76 * Checks if the X server is capable of DPMS.
77 * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
78 * @ingroup Ecore_X_DPMS_Group
79 */
80EAPI Eina_Bool
81ecore_x_dpms_capable_get(void)
82{
83 Eina_Bool ret = EINA_FALSE;
84#ifdef ECORE_XCB_DPMS
85 xcb_dpms_capable_cookie_t cookie;
86 xcb_dpms_capable_reply_t *reply;
87#endif
88
89 LOGFN(__FILE__, __LINE__, __FUNCTION__);
90 CHECK_XCB_CONN;
91
92 if (!_dpms_avail) return EINA_FALSE;
93
94#ifdef ECORE_XCB_DPMS
95 cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn);
96 reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL);
97 if (reply)
98 {
99 ret = reply->capable;
100 free(reply);
101 }
102#endif
103
104 return ret;
105}
106
107/**
108 * Checks the DPMS state of the display.
109 * @return @c EINA_TRUE if DPMS is enabled, @c EINA_FALSE otherwise.
110 * @ingroup Ecore_X_DPMS_Group
111 */
112EAPI Eina_Bool
113ecore_x_dpms_enabled_get(void)
114{
115 Eina_Bool ret = EINA_FALSE;
116#ifdef ECORE_XCB_DPMS
117 xcb_dpms_info_cookie_t cookie;
118 xcb_dpms_info_reply_t *reply;
119#endif
120
121 LOGFN(__FILE__, __LINE__, __FUNCTION__);
122 CHECK_XCB_CONN;
123
124 if (!_dpms_avail) return EINA_FALSE;
125
126#ifdef ECORE_XCB_DPMS
127 cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn);
128 reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL);
129 if (!reply) return EINA_FALSE;
130 if (reply->state) ret = EINA_TRUE;
131 free(reply);
132#endif
133
134 return ret;
135}
136
137/**
138 * Sets the DPMS state of the display.
139 * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
140 * @ingroup Ecore_X_DPMS_Group
141 */
142EAPI void
143ecore_x_dpms_enabled_set(int enabled)
144{
145 LOGFN(__FILE__, __LINE__, __FUNCTION__);
146 CHECK_XCB_CONN;
147
148 if (!_dpms_avail) return;
149
150#ifdef ECORE_XCB_DPMS
151 if (enabled)
152 xcb_dpms_enable(_ecore_xcb_conn);
153 else
154 xcb_dpms_disable(_ecore_xcb_conn);
155#endif
156}
157
158/**
159 * Gets the timeouts. The values are in unit of seconds.
160 * @param standby Amount of time of inactivity before standby mode will be invoked.
161 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
162 * @param off Amount of time of inactivity before the monitor is shut off.
163 * @ingroup Ecore_X_DPMS_Group
164 */
165EAPI void
166ecore_x_dpms_timeouts_get(unsigned int *standby,
167 unsigned int *suspend,
168 unsigned int *off)
169{
170#ifdef ECORE_XCB_DPMS
171 xcb_dpms_get_timeouts_cookie_t cookie;
172 xcb_dpms_get_timeouts_reply_t *reply;
173#endif
174
175 LOGFN(__FILE__, __LINE__, __FUNCTION__);
176 CHECK_XCB_CONN;
177
178 if (standby) *standby = 0;
179 if (suspend) *suspend = 0;
180 if (off) *off = 0;
181
182 if (!_dpms_avail) return;
183
184#ifdef ECORE_XCB_DPMS
185 cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn);
186 reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL);
187 if (!reply) return;
188 if (standby) *standby = reply->standby_timeout;
189 if (suspend) *suspend = reply->suspend_timeout;
190 if (off) *off = reply->off_timeout;
191 free(reply);
192#endif
193}
194
195/**
196 * Sets the timeouts. The values are in unit of seconds.
197 * @param standby Amount of time of inactivity before standby mode will be invoked.
198 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
199 * @param off Amount of time of inactivity before the monitor is shut off.
200 * @ingroup Ecore_X_DPMS_Group
201 */
202EAPI Eina_Bool
203ecore_x_dpms_timeouts_set(unsigned int standby,
204 unsigned int suspend,
205 unsigned int off)
206{
207 LOGFN(__FILE__, __LINE__, __FUNCTION__);
208 CHECK_XCB_CONN;
209
210 if (!_dpms_avail) return EINA_FALSE;
211
212#ifdef ECORE_XCB_DPMS
213 // FIXME: Add request check
214 xcb_dpms_set_timeouts(_ecore_xcb_conn, standby, suspend, off);
215 return EINA_TRUE;
216#endif
217
218 return EINA_FALSE;
219}
220
221/**
222 * Returns the amount of time of inactivity before standby mode is invoked.
223 * @return The standby timeout value.
224 * @ingroup Ecore_X_DPMS_Group
225 */
226EAPI unsigned int
227ecore_x_dpms_timeout_standby_get(void)
228{
229 unsigned int standby = 0;
230
231 LOGFN(__FILE__, __LINE__, __FUNCTION__);
232
233 ecore_x_dpms_timeouts_get(&standby, NULL, NULL);
234 return standby;
235}
236
237/**
238 * Returns the amount of time of inactivity before the second level of
239 * power saving is invoked.
240 * @return The suspend timeout value.
241 * @ingroup Ecore_X_DPMS_Group
242 */
243EAPI unsigned int
244ecore_x_dpms_timeout_suspend_get(void)
245{
246 unsigned int suspend = 0;
247
248 LOGFN(__FILE__, __LINE__, __FUNCTION__);
249
250 ecore_x_dpms_timeouts_get(NULL, &suspend, NULL);
251 return suspend;
252}
253
254/**
255 * Returns the amount of time of inactivity before the third and final
256 * level of power saving is invoked.
257 * @return The off timeout value.
258 * @ingroup Ecore_X_DPMS_Group
259 */
260EAPI unsigned int
261ecore_x_dpms_timeout_off_get(void)
262{
263 unsigned int off = 0;
264
265 LOGFN(__FILE__, __LINE__, __FUNCTION__);
266
267 ecore_x_dpms_timeouts_get(NULL, NULL, &off);
268 return off;
269}
270
271/**
272 * Sets the standby timeout (in unit of seconds).
273 * @param new_timeout Amount of time of inactivity before standby mode will be invoked.
274 * @ingroup Ecore_X_DPMS_Group
275 */
276EAPI void
277ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
278{
279 unsigned int standby = 0, suspend = 0, off = 0;
280
281 LOGFN(__FILE__, __LINE__, __FUNCTION__);
282
283 ecore_x_dpms_timeouts_get(&standby, &suspend, &off);
284 ecore_x_dpms_timeouts_set(new_timeout, suspend, off);
285}
286
287/**
288 * Sets the suspend timeout (in unit of seconds).
289 * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode.
290 * @ingroup Ecore_X_DPMS_Group
291 */
292EAPI void
293ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
294{
295 unsigned int standby = 0, suspend = 0, off = 0;
296
297 LOGFN(__FILE__, __LINE__, __FUNCTION__);
298
299 ecore_x_dpms_timeouts_get(&standby, &suspend, &off);
300 ecore_x_dpms_timeouts_set(standby, new_timeout, off);
301}
302
303/**
304 * Sets the off timeout (in unit of seconds).
305 * @param new_timeout Amount of time of inactivity before the monitor is shut off.
306 * @ingroup Ecore_X_DPMS_Group
307 */
308EAPI void
309ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
310{
311 unsigned int standby = 0, suspend = 0, off = 0;
312
313 LOGFN(__FILE__, __LINE__, __FUNCTION__);
314
315 ecore_x_dpms_timeouts_get(&standby, &suspend, &off);
316 ecore_x_dpms_timeouts_set(standby, suspend, new_timeout);
317}
318
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
deleted file mode 100644
index 4e9a356..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c
+++ /dev/null
@@ -1,123 +0,0 @@
1#include "ecore_xcb_private.h"
2
3/**
4 * @defgroup Ecore_X_Drawable_Group X Drawable Functions
5 *
6 * Functions that operate on drawables.
7 */
8
9/**
10 * Fill the specified rectangle on a drawable.
11 * @param d The given drawable.
12 * @param gc The graphic context that controls the fill rules.
13 * @param x The X coordinate of the top-left corner of the rectangle.
14 * @param y The Y coordinate of the top-left corner of the rectangle.
15 * @param width The width of the rectangle.
16 * @param height The height of the rectangle.
17 */
18EAPI void
19ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw,
20 Ecore_X_GC gc,
21 int x,
22 int y,
23 int w,
24 int h)
25{
26 xcb_rectangle_t rect;
27
28 LOGFN(__FILE__, __LINE__, __FUNCTION__);
29 CHECK_XCB_CONN;
30
31 rect.x = x;
32 rect.y = y;
33 rect.width = w;
34 rect.height = h;
35 xcb_poly_fill_rectangle(_ecore_xcb_conn, draw, gc, 1,
36 (const xcb_rectangle_t *)&rect);
37// ecore_x_flush();
38}
39
40/**
41 * Retrieves the geometry of the given drawable.
42 * @param d The given drawable.
43 * @param x Pointer to an integer into which the X position is to be stored.
44 * @param y Pointer to an integer into which the Y position is to be stored.
45 * @param w Pointer to an integer into which the width is to be stored.
46 * @param h Pointer to an integer into which the height is to be stored.
47 * @ingroup Ecore_X_Drawable_Group
48 */
49EAPI void
50ecore_x_drawable_geometry_get(Ecore_X_Drawable draw,
51 int *x,
52 int *y,
53 int *w,
54 int *h)
55{
56 xcb_get_geometry_cookie_t cookie;
57 xcb_get_geometry_reply_t *reply;
58
59 LOGFN(__FILE__, __LINE__, __FUNCTION__);
60 CHECK_XCB_CONN;
61
62 if (x) *x = 0;
63 if (y) *y = 0;
64 if (w) *w = 0;
65 if (h) *h = 0;
66 cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, draw);
67 reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
68 if (!reply) return;
69 if (x) *x = reply->x;
70 if (y) *y = reply->y;
71 if (w) *w = (int)reply->width;
72 if (h) *h = (int)reply->height;
73 free(reply);
74}
75
76/**
77 * Retrieves the width of the border of the given drawable.
78 * @param d The given drawable.
79 * @return The border width of the given drawable.
80 * @ingroup Ecore_X_Drawable_Group
81 */
82EAPI int
83ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
84{
85 xcb_get_geometry_cookie_t cookie;
86 xcb_get_geometry_reply_t *reply;
87 int ret = 0;
88
89 LOGFN(__FILE__, __LINE__, __FUNCTION__);
90 CHECK_XCB_CONN;
91
92 cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, d);
93 reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
94 if (!reply) return 0;
95 ret = (int)reply->border_width;
96 free(reply);
97 return ret;
98}
99
100/**
101 * Retrieves the depth of the given drawable.
102 * @param d The given drawable.
103 * @return The depth of the given drawable.
104 * @ingroup Ecore_X_Drawable_Group
105 */
106EAPI int
107ecore_x_drawable_depth_get(Ecore_X_Drawable d)
108{
109 xcb_get_geometry_cookie_t cookie;
110 xcb_get_geometry_reply_t *reply;
111 int ret = 0;
112
113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
114 CHECK_XCB_CONN;
115
116 cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, d);
117 reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
118 if (!reply) return 0;
119 ret = (int)reply->depth;
120 free(reply);
121 return ret;
122}
123
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
deleted file mode 100644
index 60bfc9c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c
+++ /dev/null
@@ -1,1307 +0,0 @@
1#include "ecore_xcb_private.h"
2
3/* local function prototypes */
4static Ecore_X_Atom _ecore_xcb_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state);
5static Ecore_X_Virtual_Keyboard_State _ecore_xcb_e_vkbd_state_get(Ecore_X_Atom atom);
6static Ecore_X_Atom _ecore_xcb_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state);
7static Ecore_X_Illume_Quickpanel_State _ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom);
8static Ecore_X_Atom _ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode);
9static Ecore_X_Illume_Mode _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom);
10static Ecore_X_Atom _ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state);
11static Ecore_X_Illume_Indicator_State _ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom);
12
13EAPI void
14ecore_x_e_init(void)
15{
16}
17
18EAPI void
19ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
20 Ecore_X_Window win)
21{
22 xcb_client_message_event_t ev;
23
24 LOGFN(__FILE__, __LINE__, __FUNCTION__);
25 CHECK_XCB_CONN;
26
27 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
28
29 memset(&ev, 0, sizeof(xcb_client_message_event_t));
30
31 ev.response_type = XCB_CLIENT_MESSAGE;
32 ev.format = 32;
33 ev.window = win;
34 ev.type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
35 ev.data.data32[0] = win;
36 ev.data.data32[1] = 0;
37 ev.data.data32[2] = 0;
38 ev.data.data32[3] = 0;
39 ev.data.data32[4] = 0;
40
41 xcb_send_event(_ecore_xcb_conn, 0, root,
42 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
43 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
44// ecore_x_flush();
45}
46
47EAPI void
48ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
49 Ecore_X_Window win,
50 int w,
51 int h)
52{
53 xcb_client_message_event_t ev;
54
55 LOGFN(__FILE__, __LINE__, __FUNCTION__);
56 CHECK_XCB_CONN;
57
58 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
59
60 memset(&ev, 0, sizeof(xcb_client_message_event_t));
61
62 ev.response_type = XCB_CLIENT_MESSAGE;
63 ev.format = 32;
64 ev.window = win;
65 ev.type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
66 ev.data.data32[0] = win;
67 ev.data.data32[1] = 1;
68 ev.data.data32[2] = w;
69 ev.data.data32[3] = h;
70 ev.data.data32[4] = 0;
71
72 xcb_send_event(_ecore_xcb_conn, 0, root,
73 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
74 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
75// ecore_x_flush();
76}
77
78EAPI void
79ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
80 Ecore_X_Sync_Counter counter)
81{
82 LOGFN(__FILE__, __LINE__, __FUNCTION__);
83
84 if (counter)
85 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
86 ECORE_X_ATOM_CARDINAL, &counter, 1);
87 else
88 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER);
89}
90
91EAPI Ecore_X_Sync_Counter
92ecore_x_e_comp_sync_counter_get(Ecore_X_Window win)
93{
94 Ecore_X_Sync_Counter counter = 0;
95 int ret = 0;
96
97 LOGFN(__FILE__, __LINE__, __FUNCTION__);
98
99 ret = ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
100 ECORE_X_ATOM_CARDINAL, &counter, 1);
101 if (ret != 1) return 0;
102 return counter;
103}
104
105EAPI Eina_Bool
106ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
107{
108 Ecore_X_Window win, win2;
109 int ret = 0;
110
111 LOGFN(__FILE__, __LINE__, __FUNCTION__);
112
113 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
114 ret =
115 ecore_x_window_prop_xid_get(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
116 ECORE_X_ATOM_WINDOW, &win, 1);
117 if ((ret == 1) && (win))
118 {
119 ret =
120 ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
121 ECORE_X_ATOM_WINDOW, &win2, 1);
122 if ((ret == 1) && (win2 == win))
123 return EINA_TRUE;
124 }
125 return EINA_FALSE;
126}
127
128EAPI void
129ecore_x_e_comp_sync_supported_set(Ecore_X_Window root,
130 Eina_Bool enabled)
131{
132 Ecore_X_Window win;
133
134 LOGFN(__FILE__, __LINE__, __FUNCTION__);
135
136 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
137 if (enabled)
138 {
139 win = ecore_x_window_new(root, 1, 2, 3, 4);
140 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
141 ECORE_X_ATOM_WINDOW, &win, 1);
142 ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
143 ECORE_X_ATOM_WINDOW, &win, 1);
144 }
145 else
146 {
147 int ret = 0;
148
149 ret = ecore_x_window_prop_xid_get(root,
150 ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
151 ECORE_X_ATOM_WINDOW, &win, 1);
152 if ((ret == 1) && (win))
153 {
154 ecore_x_window_prop_property_del(root,
155 ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED);
156 ecore_x_window_free(win);
157 }
158 }
159}
160
161EAPI void
162ecore_x_e_comp_sync_begin_send(Ecore_X_Window win)
163{
164 xcb_client_message_event_t ev;
165
166 LOGFN(__FILE__, __LINE__, __FUNCTION__);
167 CHECK_XCB_CONN;
168
169 memset(&ev, 0, sizeof(xcb_client_message_event_t));
170
171 ev.response_type = XCB_CLIENT_MESSAGE;
172 ev.format = 32;
173 ev.window = win;
174 ev.type = ECORE_X_ATOM_E_COMP_SYNC_BEGIN;
175 ev.data.data32[0] = win;
176 ev.data.data32[1] = 0;
177 ev.data.data32[2] = 0;
178 ev.data.data32[3] = 0;
179 ev.data.data32[4] = 0;
180
181 xcb_send_event(_ecore_xcb_conn, 0, win,
182 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
183// ecore_x_flush();
184}
185
186EAPI void
187ecore_x_e_comp_sync_end_send(Ecore_X_Window win)
188{
189 xcb_client_message_event_t ev;
190
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
192 CHECK_XCB_CONN;
193
194 memset(&ev, 0, sizeof(xcb_client_message_event_t));
195
196 ev.response_type = XCB_CLIENT_MESSAGE;
197 ev.format = 32;
198 ev.window = win;
199 ev.type = ECORE_X_ATOM_E_COMP_SYNC_END;
200 ev.data.data32[0] = win;
201 ev.data.data32[1] = 0;
202 ev.data.data32[2] = 0;
203 ev.data.data32[3] = 0;
204 ev.data.data32[4] = 0;
205
206 xcb_send_event(_ecore_xcb_conn, 0, win,
207 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
208// ecore_x_flush();
209}
210
211EAPI void
212ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win)
213{
214 xcb_client_message_event_t ev;
215
216 LOGFN(__FILE__, __LINE__, __FUNCTION__);
217 CHECK_XCB_CONN;
218
219 memset(&ev, 0, sizeof(xcb_client_message_event_t));
220
221 ev.response_type = XCB_CLIENT_MESSAGE;
222 ev.format = 32;
223 ev.window = win;
224 ev.type = ECORE_X_ATOM_E_COMP_SYNC_CANCEL;
225 ev.data.data32[0] = win;
226 ev.data.data32[1] = 0;
227 ev.data.data32[2] = 0;
228 ev.data.data32[3] = 0;
229 ev.data.data32[4] = 0;
230
231 xcb_send_event(_ecore_xcb_conn, 0, win,
232 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
233// ecore_x_flush();
234}
235
236EAPI void
237ecore_x_e_comp_flush_send(Ecore_X_Window win)
238{
239 xcb_client_message_event_t ev;
240
241 LOGFN(__FILE__, __LINE__, __FUNCTION__);
242 CHECK_XCB_CONN;
243
244 memset(&ev, 0, sizeof(xcb_client_message_event_t));
245
246 ev.response_type = XCB_CLIENT_MESSAGE;
247 ev.format = 32;
248 ev.window = win;
249 ev.type = ECORE_X_ATOM_E_COMP_FLUSH;
250 ev.data.data32[0] = win;
251 ev.data.data32[1] = 0;
252 ev.data.data32[2] = 0;
253 ev.data.data32[3] = 0;
254 ev.data.data32[4] = 0;
255
256 xcb_send_event(_ecore_xcb_conn, 0, win,
257 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
258// ecore_x_flush();
259}
260
261EAPI void
262ecore_x_e_comp_dump_send(Ecore_X_Window win)
263{
264 xcb_client_message_event_t ev;
265
266 LOGFN(__FILE__, __LINE__, __FUNCTION__);
267 CHECK_XCB_CONN;
268
269 memset(&ev, 0, sizeof(xcb_client_message_event_t));
270
271 ev.response_type = XCB_CLIENT_MESSAGE;
272 ev.format = 32;
273 ev.window = win;
274 ev.type = ECORE_X_ATOM_E_COMP_DUMP;
275 ev.data.data32[0] = win;
276 ev.data.data32[1] = 0;
277 ev.data.data32[2] = 0;
278 ev.data.data32[3] = 0;
279 ev.data.data32[4] = 0;
280
281 xcb_send_event(_ecore_xcb_conn, 0, win,
282 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
283// ecore_x_flush();
284}
285
286EAPI void
287ecore_x_e_comp_pixmap_set(Ecore_X_Window win,
288 Ecore_X_Pixmap pixmap)
289{
290 LOGFN(__FILE__, __LINE__, __FUNCTION__);
291
292 if (pixmap)
293 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP,
294 ECORE_X_ATOM_PIXMAP, &pixmap, 1);
295 else
296 ecore_x_window_prop_property_del(win, pixmap);
297}
298
299EAPI Ecore_X_Pixmap
300ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
301{
302 Ecore_X_Pixmap pixmap = 0;
303 int ret = 0;
304
305 LOGFN(__FILE__, __LINE__, __FUNCTION__);
306
307 ret = ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_PIXMAP,
308 ECORE_X_ATOM_PIXMAP, &pixmap, 1);
309 if (ret != 1) return 0;
310 return pixmap;
311}
312
313EAPI void
314ecore_x_e_frame_size_set(Ecore_X_Window win,
315 int fl,
316 int fr,
317 int ft,
318 int fb)
319{
320 uint32_t frames[4];
321
322 LOGFN(__FILE__, __LINE__, __FUNCTION__);
323
324 frames[0] = fl;
325 frames[1] = fr;
326 frames[2] = ft;
327 frames[3] = fb;
328 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4);
329}
330
331EAPI Ecore_X_Virtual_Keyboard_State
332ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win)
333{
334 Ecore_X_Atom atom = 0;
335
336 LOGFN(__FILE__, __LINE__, __FUNCTION__);
337
338 if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
339 &atom, 1))
340 return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
341
342 return _ecore_xcb_e_vkbd_state_get(atom);
343}
344
345EAPI void
346ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win,
347 Ecore_X_Virtual_Keyboard_State state)
348{
349 Ecore_X_Atom atom = 0;
350
351 LOGFN(__FILE__, __LINE__, __FUNCTION__);
352
353 atom = _ecore_xcb_e_vkbd_atom_get(state);
354 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
355 &atom, 1);
356}
357
358EAPI void
359ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win,
360 Ecore_X_Virtual_Keyboard_State state)
361{
362 LOGFN(__FILE__, __LINE__, __FUNCTION__);
363
364 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
365 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
366 _ecore_xcb_e_vkbd_atom_get(state),
367 0, 0, 0, 0);
368}
369
370EAPI void
371ecore_x_e_virtual_keyboard_set(Ecore_X_Window win,
372 unsigned int is_keyboard)
373{
374 LOGFN(__FILE__, __LINE__, __FUNCTION__);
375
376 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
377 &is_keyboard, 1);
378}
379
380EAPI Eina_Bool
381ecore_x_e_virtual_keyboard_get(Ecore_X_Window win)
382{
383 unsigned int val = 0;
384
385 LOGFN(__FILE__, __LINE__, __FUNCTION__);
386
387 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
388 &val, 1))
389 return EINA_FALSE;
390
391 return val ? EINA_TRUE : EINA_FALSE;
392}
393
394EAPI int
395ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win)
396{
397 unsigned int val = 0;
398
399 LOGFN(__FILE__, __LINE__, __FUNCTION__);
400
401 if (!ecore_x_window_prop_card32_get(win,
402 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
403 &val, 1))
404 return 0;
405
406 return val;
407}
408
409EAPI void
410ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win,
411 unsigned int priority)
412{
413 LOGFN(__FILE__, __LINE__, __FUNCTION__);
414
415 ecore_x_window_prop_card32_set(win,
416 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
417 &priority, 1);
418}
419
420EAPI int
421ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win)
422{
423 unsigned int val = 0;
424
425 LOGFN(__FILE__, __LINE__, __FUNCTION__);
426
427 if (!ecore_x_window_prop_card32_get(win,
428 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
429 &val, 1))
430 return 0;
431
432 return val;
433}
434
435EAPI void
436ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win,
437 unsigned int priority)
438{
439 LOGFN(__FILE__, __LINE__, __FUNCTION__);
440
441 ecore_x_window_prop_card32_set(win,
442 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
443 &priority, 1);
444}
445
446EAPI void
447ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win,
448 unsigned int zone)
449{
450 LOGFN(__FILE__, __LINE__, __FUNCTION__);
451
452 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
453 &zone, 1);
454}
455
456EAPI int
457ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win)
458{
459 unsigned int val = 0;
460
461 LOGFN(__FILE__, __LINE__, __FUNCTION__);
462
463 if (!ecore_x_window_prop_card32_get(win,
464 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
465 &val, 1))
466 return 0;
467
468 return val;
469}
470
471EAPI void
472ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win)
473{
474 LOGFN(__FILE__, __LINE__, __FUNCTION__);
475
476 ecore_x_client_message32_send(win,
477 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE,
478 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
479 1, 0, 0, 0, 0);
480}
481
482EAPI Eina_Bool
483ecore_x_e_illume_conformant_get(Ecore_X_Window win)
484{
485 unsigned int val = 0;
486
487 LOGFN(__FILE__, __LINE__, __FUNCTION__);
488
489 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
490 &val, 1))
491 return EINA_FALSE;
492
493 return val ? EINA_TRUE : EINA_FALSE;
494}
495
496EAPI void
497ecore_x_e_illume_conformant_set(Ecore_X_Window win,
498 unsigned int is_conformant)
499{
500 LOGFN(__FILE__, __LINE__, __FUNCTION__);
501
502 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
503 &is_conformant, 1);
504}
505
506EAPI void
507ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win,
508 int x,
509 int y,
510 int w,
511 int h)
512{
513 unsigned int geom[4];
514
515 LOGFN(__FILE__, __LINE__, __FUNCTION__);
516
517 geom[0] = x;
518 geom[1] = y;
519 geom[2] = w;
520 geom[3] = h;
521 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
522 geom, 4);
523}
524
525EAPI Eina_Bool
526ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win,
527 int *x,
528 int *y,
529 int *w,
530 int *h)
531{
532 unsigned int geom[4];
533
534 LOGFN(__FILE__, __LINE__, __FUNCTION__);
535
536 if (x) *x = 0;
537 if (y) *y = 0;
538 if (w) *w = 0;
539 if (h) *h = 0;
540
541 if (ecore_x_window_prop_card32_get(win,
542 ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
543 geom, 4) != 4)
544 return EINA_FALSE;
545
546 if (x) *x = geom[0];
547 if (y) *y = geom[1];
548 if (w) *w = geom[2];
549 if (h) *h = geom[3];
550
551 return EINA_TRUE;
552}
553
554EAPI void
555ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win,
556 int x,
557 int y,
558 int w,
559 int h)
560{
561 unsigned int geom[4];
562
563 LOGFN(__FILE__, __LINE__, __FUNCTION__);
564
565 geom[0] = x;
566 geom[1] = y;
567 geom[2] = w;
568 geom[3] = h;
569 ecore_x_window_prop_card32_set(win,
570 ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
571 geom, 4);
572}
573
574EAPI Eina_Bool
575ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win,
576 int *x,
577 int *y,
578 int *w,
579 int *h)
580{
581 unsigned int geom[4];
582
583 LOGFN(__FILE__, __LINE__, __FUNCTION__);
584
585 if (x) *x = 0;
586 if (y) *y = 0;
587 if (w) *w = 0;
588 if (h) *h = 0;
589
590 if (ecore_x_window_prop_card32_get(win,
591 ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
592 geom, 4) != 4)
593 return EINA_FALSE;
594
595 if (x) *x = geom[0];
596 if (y) *y = geom[1];
597 if (w) *w = geom[2];
598 if (h) *h = geom[3];
599
600 return EINA_TRUE;
601}
602
603EAPI void
604ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win,
605 int x,
606 int y,
607 int w,
608 int h)
609{
610 unsigned int geom[4];
611
612 LOGFN(__FILE__, __LINE__, __FUNCTION__);
613
614 geom[0] = x;
615 geom[1] = y;
616 geom[2] = w;
617 geom[3] = h;
618 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
619 geom, 4);
620}
621
622EAPI Eina_Bool
623ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win,
624 int *x,
625 int *y,
626 int *w,
627 int *h)
628{
629 unsigned int geom[4];
630
631 LOGFN(__FILE__, __LINE__, __FUNCTION__);
632
633 if (x) *x = 0;
634 if (y) *y = 0;
635 if (w) *w = 0;
636 if (h) *h = 0;
637
638 if (ecore_x_window_prop_card32_get(win,
639 ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
640 geom, 4) != 4)
641 return EINA_FALSE;
642
643 if (x) *x = geom[0];
644 if (y) *y = geom[1];
645 if (w) *w = geom[2];
646 if (h) *h = geom[3];
647
648 return EINA_TRUE;
649}
650
651EAPI void
652ecore_x_e_illume_quickpanel_set(Ecore_X_Window win,
653 unsigned int is_quickpanel)
654{
655 LOGFN(__FILE__, __LINE__, __FUNCTION__);
656
657 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
658 &is_quickpanel, 1);
659}
660
661EAPI Eina_Bool
662ecore_x_e_illume_quickpanel_get(Ecore_X_Window win)
663{
664 unsigned int val = 0;
665
666 LOGFN(__FILE__, __LINE__, __FUNCTION__);
667
668 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
669 &val, 1))
670 return EINA_FALSE;
671
672 return val ? EINA_TRUE : EINA_FALSE;
673}
674
675EAPI void
676ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win,
677 Ecore_X_Illume_Quickpanel_State state)
678{
679 Ecore_X_Atom atom = 0;
680
681 LOGFN(__FILE__, __LINE__, __FUNCTION__);
682
683 atom = _ecore_xcb_e_quickpanel_atom_get(state);
684 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
685 &atom, 1);
686}
687
688EAPI Ecore_X_Illume_Quickpanel_State
689ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win)
690{
691 Ecore_X_Atom atom = 0;
692
693 LOGFN(__FILE__, __LINE__, __FUNCTION__);
694
695 if (!ecore_x_window_prop_atom_get(win,
696 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
697 &atom, 1))
698 return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
699
700 return _ecore_xcb_e_quickpanel_state_get(atom);
701}
702
703EAPI void
704ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win,
705 Ecore_X_Illume_Quickpanel_State state)
706{
707 LOGFN(__FILE__, __LINE__, __FUNCTION__);
708 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
709 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
710 _ecore_xcb_e_quickpanel_atom_get(state),
711 0, 0, 0, 0);
712}
713
714EAPI void
715ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win)
716{
717 LOGFN(__FILE__, __LINE__, __FUNCTION__);
718 ecore_x_client_message32_send(win,
719 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE,
720 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
721 0, 0, 0, 0, 0);
722}
723
724static Ecore_X_Atom
725_ecore_xcb_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state)
726{
727 switch (state)
728 {
729 case ECORE_X_ILLUME_CLIPBOARD_STATE_ON:
730 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
731 case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF:
732 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
733 default:
734 break;
735 }
736 return 0;
737}
738
739static Ecore_X_Illume_Clipboard_State
740_ecore_xcb_e_clipboard_state_get(Ecore_X_Atom atom)
741{
742 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON)
743 return ECORE_X_ILLUME_CLIPBOARD_STATE_ON;
744
745 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF)
746 return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF;
747
748 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
749}
750
751EAPI void
752ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
753 Ecore_X_Illume_Clipboard_State state)
754{
755 Ecore_X_Atom atom = 0;
756
757 LOGFN(__FILE__, __LINE__, __FUNCTION__);
758 atom = _ecore_xcb_e_clipboard_atom_get(state);
759
760 ecore_x_window_prop_atom_set(win,
761 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
762 &atom, 1);
763}
764
765EAPI Ecore_X_Illume_Clipboard_State
766ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win)
767{
768 Ecore_X_Atom atom = 0;
769
770 LOGFN(__FILE__, __LINE__, __FUNCTION__);
771
772 if (!ecore_x_window_prop_atom_get(win,
773 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
774 &atom, 1))
775 return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN;
776 return _ecore_xcb_e_clipboard_state_get(atom);
777}
778
779EAPI void
780ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
781 int x, int y, int w, int h)
782{
783 unsigned int geom[4];
784
785 LOGFN(__FILE__, __LINE__, __FUNCTION__);
786 geom[0] = x;
787 geom[1] = y;
788 geom[2] = w;
789 geom[3] = h;
790 ecore_x_window_prop_card32_set(win,
791 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
792 geom, 4);
793}
794
795EAPI Eina_Bool
796ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
797 int *x, int *y, int *w, int *h)
798{
799 int ret = 0;
800 unsigned int geom[4];
801
802 LOGFN(__FILE__, __LINE__, __FUNCTION__);
803 ret =
804 ecore_x_window_prop_card32_get(win,
805 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
806 geom, 4);
807 if (ret != 4) return EINA_FALSE;
808
809 if (x) *x = geom[0];
810 if (y) *y = geom[1];
811 if (w) *w = geom[2];
812 if (h) *h = geom[3];
813
814 return EINA_TRUE;
815}
816
817EAPI void
818ecore_x_e_illume_mode_set(Ecore_X_Window win,
819 Ecore_X_Illume_Mode mode)
820{
821 Ecore_X_Atom atom = 0;
822
823 LOGFN(__FILE__, __LINE__, __FUNCTION__);
824
825 atom = _ecore_xcb_e_illume_atom_get(mode);
826 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1);
827}
828
829EAPI Ecore_X_Illume_Mode
830ecore_x_e_illume_mode_get(Ecore_X_Window win)
831{
832 Ecore_X_Atom atom = 0;
833
834 LOGFN(__FILE__, __LINE__, __FUNCTION__);
835
836 if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1))
837 return ECORE_X_ILLUME_MODE_UNKNOWN;
838
839 return _ecore_xcb_e_illume_mode_get(atom);
840}
841
842EAPI void
843ecore_x_e_illume_mode_send(Ecore_X_Window win,
844 Ecore_X_Illume_Mode mode)
845{
846 LOGFN(__FILE__, __LINE__, __FUNCTION__);
847
848 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE,
849 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
850 _ecore_xcb_e_illume_atom_get(mode),
851 0, 0, 0, 0);
852}
853
854EAPI void
855ecore_x_e_illume_focus_back_send(Ecore_X_Window win)
856{
857 LOGFN(__FILE__, __LINE__, __FUNCTION__);
858
859 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK,
860 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
861 1, 0, 0, 0, 0);
862}
863
864EAPI void
865ecore_x_e_illume_focus_forward_send(Ecore_X_Window win)
866{
867 LOGFN(__FILE__, __LINE__, __FUNCTION__);
868
869 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD,
870 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
871 1, 0, 0, 0, 0);
872}
873
874EAPI void
875ecore_x_e_illume_focus_home_send(Ecore_X_Window win)
876{
877 LOGFN(__FILE__, __LINE__, __FUNCTION__);
878
879 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME,
880 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
881 1, 0, 0, 0, 0);
882}
883
884EAPI void
885ecore_x_e_illume_close_send(Ecore_X_Window win)
886{
887 LOGFN(__FILE__, __LINE__, __FUNCTION__);
888
889 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE,
890 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
891 1, 0, 0, 0, 0);
892}
893
894EAPI void
895ecore_x_e_illume_home_new_send(Ecore_X_Window win)
896{
897 LOGFN(__FILE__, __LINE__, __FUNCTION__);
898
899 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW,
900 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
901 1, 0, 0, 0, 0);
902}
903
904EAPI void
905ecore_x_e_illume_home_del_send(Ecore_X_Window win)
906{
907 LOGFN(__FILE__, __LINE__, __FUNCTION__);
908
909 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL,
910 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
911 1, 0, 0, 0, 0);
912}
913
914EAPI void
915ecore_x_e_illume_drag_set(Ecore_X_Window win,
916 unsigned int drag)
917{
918 LOGFN(__FILE__, __LINE__, __FUNCTION__);
919
920 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1);
921}
922
923EAPI void
924ecore_x_e_illume_drag_locked_set(Ecore_X_Window win,
925 unsigned int is_locked)
926{
927 LOGFN(__FILE__, __LINE__, __FUNCTION__);
928
929 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
930 &is_locked, 1);
931}
932
933EAPI Eina_Bool
934ecore_x_e_illume_drag_locked_get(Ecore_X_Window win)
935{
936 unsigned int val = 0;
937
938 LOGFN(__FILE__, __LINE__, __FUNCTION__);
939
940 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
941 &val, 1))
942 return EINA_FALSE;
943
944 return val ? EINA_TRUE : EINA_FALSE;
945}
946
947EAPI Eina_Bool
948ecore_x_e_illume_drag_get(Ecore_X_Window win)
949{
950 unsigned int val = 0;
951
952 LOGFN(__FILE__, __LINE__, __FUNCTION__);
953
954 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG, &val, 1))
955 return EINA_FALSE;
956
957 return val ? EINA_TRUE : EINA_FALSE;
958}
959
960EAPI void
961ecore_x_e_illume_drag_start_send(Ecore_X_Window win)
962{
963 LOGFN(__FILE__, __LINE__, __FUNCTION__);
964 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START,
965 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
966 1, 0, 0, 0, 0);
967}
968
969EAPI void
970ecore_x_e_illume_drag_end_send(Ecore_X_Window win)
971{
972 LOGFN(__FILE__, __LINE__, __FUNCTION__);
973 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END,
974 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
975 1, 0, 0, 0, 0);
976}
977
978EAPI void
979ecore_x_e_illume_zone_set(Ecore_X_Window win,
980 Ecore_X_Window zone)
981{
982 LOGFN(__FILE__, __LINE__, __FUNCTION__);
983
984 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE, &zone, 1);
985}
986
987EAPI Ecore_X_Window
988ecore_x_e_illume_zone_get(Ecore_X_Window win)
989{
990 Ecore_X_Window zone;
991
992 LOGFN(__FILE__, __LINE__, __FUNCTION__);
993
994 if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE,
995 &zone, 1))
996 return 0;
997
998 return zone;
999}
1000
1001EAPI void
1002ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
1003 Ecore_X_Window *zones,
1004 unsigned int num)
1005{
1006 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1007
1008 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST,
1009 zones, num);
1010}
1011
1012/* local functions */
1013static Ecore_X_Atom
1014_ecore_xcb_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state)
1015{
1016 switch (state)
1017 {
1018 case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF:
1019 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
1020
1021 case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON:
1022 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
1023
1024 case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA:
1025 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
1026
1027 case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC:
1028 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
1029
1030 case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN:
1031 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
1032
1033 case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER:
1034 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
1035
1036 case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX:
1037 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
1038
1039 case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL:
1040 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
1041
1042 case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD:
1043 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
1044
1045 case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP:
1046 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
1047
1048 case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST:
1049 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
1050
1051 case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE:
1052 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
1053
1054 case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL:
1055 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
1056
1057 case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD:
1058 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
1059
1060 case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME:
1061 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
1062
1063 default:
1064 break;
1065 }
1066 return 0;
1067}
1068
1069static Ecore_X_Virtual_Keyboard_State
1070_ecore_xcb_e_vkbd_state_get(Ecore_X_Atom atom)
1071{
1072 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON)
1073 return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
1074 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF)
1075 return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
1076 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA)
1077 return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA;
1078 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC)
1079 return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC;
1080 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN)
1081 return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN;
1082 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER)
1083 return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER;
1084 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX)
1085 return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX;
1086 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL)
1087 return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL;
1088 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD)
1089 return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD;
1090 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP)
1091 return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP;
1092 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST)
1093 return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST;
1094 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE)
1095 return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE;
1096 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL)
1097 return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL;
1098 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD)
1099 return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD;
1100 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME)
1101 return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME;
1102
1103 return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
1104}
1105
1106static Ecore_X_Atom
1107_ecore_xcb_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state)
1108{
1109 switch (state)
1110 {
1111 case ECORE_X_ILLUME_QUICKPANEL_STATE_ON:
1112 return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
1113
1114 case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF:
1115 return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
1116
1117 default:
1118 break;
1119 }
1120 return 0;
1121}
1122
1123static Ecore_X_Illume_Quickpanel_State
1124_ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom)
1125{
1126 if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
1127 return ECORE_X_ILLUME_QUICKPANEL_STATE_ON;
1128 if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
1129 return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF;
1130
1131 return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
1132}
1133
1134static Ecore_X_Atom
1135_ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode)
1136{
1137 switch (mode)
1138 {
1139 case ECORE_X_ILLUME_MODE_SINGLE:
1140 return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE;
1141
1142 case ECORE_X_ILLUME_MODE_DUAL_TOP:
1143 return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP;
1144
1145 case ECORE_X_ILLUME_MODE_DUAL_LEFT:
1146 return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
1147
1148 default:
1149 break;
1150 }
1151 return ECORE_X_ILLUME_MODE_UNKNOWN;
1152}
1153
1154static Ecore_X_Illume_Mode
1155_ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom)
1156{
1157 if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
1158 return ECORE_X_ILLUME_MODE_SINGLE;
1159 if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
1160 return ECORE_X_ILLUME_MODE_DUAL_TOP;
1161 if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
1162 return ECORE_X_ILLUME_MODE_DUAL_LEFT;
1163
1164 return ECORE_X_ILLUME_MODE_UNKNOWN;
1165}
1166
1167static Ecore_X_Atom
1168_ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state)
1169{
1170 switch (state)
1171 {
1172 case ECORE_X_ILLUME_INDICATOR_STATE_ON:
1173 return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
1174
1175 case ECORE_X_ILLUME_INDICATOR_STATE_OFF:
1176 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
1177
1178 default:
1179 break;
1180 }
1181 return 0;
1182}
1183
1184static Ecore_X_Illume_Indicator_State
1185_ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom)
1186{
1187 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON)
1188 return ECORE_X_ILLUME_INDICATOR_STATE_ON;
1189 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF)
1190 return ECORE_X_ILLUME_INDICATOR_STATE_OFF;
1191
1192 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1193}
1194
1195EAPI void
1196ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
1197 Ecore_X_Illume_Indicator_State state)
1198{
1199 Ecore_X_Atom atom = 0;
1200
1201 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1202
1203 atom = _ecore_xcb_e_indicator_atom_get(state);
1204 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1205 &atom, 1);
1206}
1207
1208EAPI Ecore_X_Illume_Indicator_State
1209ecore_x_e_illume_indicator_state_get(Ecore_X_Window win)
1210{
1211 Ecore_X_Atom atom = 0;
1212
1213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1214
1215 if (!ecore_x_window_prop_atom_get(win,
1216 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1217 &atom, 1))
1218 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1219
1220 return _ecore_xcb_e_indicator_state_get(atom);
1221}
1222
1223EAPI void
1224ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
1225 Ecore_X_Illume_Indicator_State state)
1226{
1227 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1228 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1229 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1230 _ecore_xcb_e_indicator_atom_get(state),
1231 0, 0, 0, 0);
1232}
1233
1234static Ecore_X_Atom
1235_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode)
1236{
1237 switch (mode)
1238 {
1239 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1240 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
1241
1242 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1243 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
1244
1245 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1246 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
1247
1248 default:
1249 break;
1250 }
1251 return 0;
1252}
1253
1254static Ecore_X_Illume_Indicator_Opacity_Mode
1255_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom)
1256{
1257 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE)
1258 return ECORE_X_ILLUME_INDICATOR_OPAQUE;
1259
1260 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT)
1261 return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1262
1263 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT)
1264 return ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1265
1266 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1267}
1268
1269EAPI void
1270ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
1271 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1272{
1273 Ecore_X_Atom atom = 0;
1274
1275 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1276 atom = _ecore_x_e_indicator_opacity_atom_get(mode);
1277 ecore_x_window_prop_atom_set(win,
1278 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1279 &atom, 1);
1280}
1281
1282EAPI Ecore_X_Illume_Indicator_Opacity_Mode
1283ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win)
1284{
1285 Ecore_X_Atom atom;
1286
1287 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1288 if (!ecore_x_window_prop_atom_get(win,
1289 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1290 &atom, 1))
1291 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1292
1293 return _ecore_x_e_indicator_opacity_get(atom);
1294}
1295
1296EAPI void
1297ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
1298 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1299{
1300 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1301 ecore_x_client_message32_send(win,
1302 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1303 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1304 _ecore_x_e_indicator_opacity_atom_get(mode),
1305 0, 0, 0, 0);
1306}
1307
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
deleted file mode 100644
index fc32926..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c
+++ /dev/null
@@ -1,123 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <xcb/xcb_event.h>
3
4/* local variables */
5static void (*_error_func)(void *data) = NULL;
6static void *_error_data = NULL;
7static void (*_io_error_func)(void *data) = NULL;
8static void *_io_error_data = NULL;
9static int _error_request_code = 0;
10static int _error_code = 0;
11static Ecore_X_ID _error_resource_id = 0;
12
13/**
14 * Set the error handler.
15 * @param func The error handler function
16 * @param data The data to be passed to the handler function
17 *
18 * Set the X error handler function
19 */
20EAPI void
21ecore_x_error_handler_set(void (*func)(void *data),
22 const void *data)
23{
24 _error_func = func;
25 _error_data = (void *)data;
26}
27
28/**
29 * Set the I/O error handler.
30 * @param func The I/O error handler function
31 * @param data The data to be passed to the handler function
32 *
33 * Set the X I/O error handler function
34 */
35EAPI void
36ecore_x_io_error_handler_set(void (*func)(void *data),
37 const void *data)
38{
39 _io_error_func = func;
40 _io_error_data = (void *)data;
41}
42
43/**
44 * Get the request code that caused the error.
45 * @return The request code causing the X error
46 *
47 * Return the X request code that caused the last X error
48 */
49EAPI int
50ecore_x_error_request_get(void)
51{
52 return _error_request_code;
53}
54
55/**
56 * Get the error code from the error.
57 * @return The error code from the X error
58 *
59 * Return the error code from the last X error
60 */
61EAPI int
62ecore_x_error_code_get(void)
63{
64 return _error_code;
65}
66
67/**
68 * Get the resource id that caused the error.
69 * @return The resource id causing the X error
70 *
71 * Return the X resource id that caused the last X error
72 */
73EAPI Ecore_X_ID
74ecore_x_error_resource_id_get(void)
75{
76 return _error_resource_id;
77}
78
79int
80_ecore_xcb_error_handle(xcb_generic_error_t *err)
81{
82 WRN("Got Error:");
83 WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code));
84 WRN("\tError: %s", xcb_event_get_error_label(err->error_code));
85
86#ifdef OLD_XCB_VERSION
87 if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
88 WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
89 else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW)
90 WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
91#else
92 if (err->error_code == XCB_VALUE)
93 WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value);
94 else if (err->error_code == XCB_WINDOW)
95 WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value);
96#endif
97
98 _error_request_code = err->sequence;
99 _error_code = err->error_code;
100 _error_resource_id = err->resource_id;
101 if (_error_func)
102 _error_func(_error_data);
103
104 return 0;
105}
106
107int
108_ecore_xcb_io_error_handle(xcb_generic_error_t *err)
109{
110 CRIT("IO Error:");
111 if (err)
112 {
113 CRIT("\tRequest: %d", err->sequence);
114 CRIT("\tCode: %d", err->error_code);
115 }
116 if (_io_error_func)
117 _io_error_func(_io_error_data);
118 else
119 exit(-1);
120
121 return 0;
122}
123
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
deleted file mode 100644
index 8a18140..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c
+++ /dev/null
@@ -1,2805 +0,0 @@
1#include "ecore_xcb_private.h"
2//#include "Ecore_X_Atoms.h"
3#include <langinfo.h>
4#include <xcb/xcb_icccm.h>
5#include <xcb/xcb_event.h>
6# ifdef ECORE_XCB_DAMAGE
7# include <xcb/damage.h>
8# endif
9# ifdef ECORE_XCB_RANDR
10# include <xcb/randr.h>
11# endif
12# ifdef ECORE_XCB_SCREENSAVER
13# include <xcb/screensaver.h>
14# endif
15# ifdef ECORE_XCB_SYNC
16# include <xcb/sync.h>
17# endif
18# ifdef ECORE_XCB_XFIXES
19# include <xcb/xfixes.h>
20# endif
21# ifdef ECORE_XCB_XGESTURE
22# include <xcb/gesture.h>
23# endif
24
25#ifndef CODESET
26# define CODESET "INVALID"
27#endif
28
29typedef struct _Ecore_X_Mouse_Down_Info
30{
31 EINA_INLIST;
32 int dev;
33 Ecore_X_Time last_time;
34 Ecore_X_Time last_last_time;
35 Ecore_X_Window last_win;
36 Ecore_X_Window last_last_win;
37 Ecore_X_Window last_event_win;
38 Ecore_X_Window last_last_event_win;
39 Eina_Bool did_double : 1;
40 Eina_Bool did_triple : 1;
41} Ecore_X_Mouse_Down_Info;
42
43/* local function prototypes */
44static void _ecore_xcb_event_handle_any_event(xcb_generic_event_t *event);
45static void _ecore_xcb_event_handle_key_press(xcb_generic_event_t *event);
46static void _ecore_xcb_event_handle_key_release(xcb_generic_event_t *event);
47static void _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event);
48static void _ecore_xcb_event_handle_button_release(xcb_generic_event_t *event);
49static void _ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event);
50static void _ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event);
51static void _ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event);
52static void _ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event);
53static void _ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event);
54static void _ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event);
55static void _ecore_xcb_event_handle_expose(xcb_generic_event_t *event);
56static void _ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event);
57static void _ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event);
58static void _ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event);
59static void _ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event);
60static void _ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event);
61static void _ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event);
62static void _ecore_xcb_event_handle_map_request(xcb_generic_event_t *event);
63static void _ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event);
64static void _ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event);
65static void _ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event);
66static void _ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event);
67static void _ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event);
68static void _ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event);
69static void _ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event);
70static void _ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event);
71static void _ecore_xcb_event_handle_selection_clear(xcb_generic_event_t *event);
72static void _ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event);
73static void _ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event);
74static void _ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event);
75static void _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event);
76static void _ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event);
77static void _ecore_xcb_event_handle_damage_notify(xcb_generic_event_t *event);
78static void _ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event);
79static void _ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event);
80static void _ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event);
81static void _ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event);
82static void _ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event);
83static void _ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event);
84#ifdef ECORE_XCB_XGESTURE
85static void _ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event);
86static void _ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event);
87static void _ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event);
88static void _ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event);
89static void _ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event);
90static void _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event);
91static void _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event);
92#endif
93#ifdef ECORE_XCB_SHAPE
94static void _ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event);
95#endif
96static void _ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event);
97static void _ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event);
98static void _ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event __UNUSED__);
99static void _ecore_xcb_event_handle_xfixes_cursor_notify(xcb_generic_event_t *event);
100static void _ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event);
101static void _ecore_xcb_event_handle_input_event(xcb_generic_event_t *event);
102
103static void _ecore_xcb_event_key_press(xcb_generic_event_t *event);
104static void _ecore_xcb_event_key_release(xcb_generic_event_t *event);
105static void _ecore_xcb_event_mouse_move_free(void *data __UNUSED__,
106 void *event);
107static Ecore_X_Event_Mode _ecore_xcb_event_mode_get(uint8_t mode);
108static Ecore_X_Event_Detail _ecore_xcb_event_detail_get(uint8_t detail);
109static void _ecore_xcb_event_xdnd_enter_free(void *data __UNUSED__,
110 void *event);
111static void _ecore_xcb_event_selection_notify_free(void *data __UNUSED__,
112 void *event);
113static void _ecore_xcb_event_generic_event_free(void *data,
114 void *event);
115static void _ecore_xcb_event_mouse_down_info_clear(void);
116static Ecore_X_Mouse_Down_Info *_ecore_xcb_event_mouse_down_info_get(int dev);
117
118/* local variables */
119static Eina_Bool _ecore_xcb_event_last_mouse_move = EINA_FALSE;
120//static Ecore_Event *_ecore_xcb_event_last_mouse_move_event = NULL;
121static Eina_Inlist *_ecore_xcb_mouse_down_info_list = NULL;
122static Ecore_X_Time _ecore_xcb_event_last_time;
123static Ecore_X_Window _ecore_xcb_event_last_window = 0;
124
125/* public variables */
126int16_t _ecore_xcb_event_last_root_x = 0;
127int16_t _ecore_xcb_event_last_root_y = 0;
128
129EAPI int ECORE_X_EVENT_ANY = 0;
130EAPI int ECORE_X_EVENT_MOUSE_IN = 0;
131EAPI int ECORE_X_EVENT_MOUSE_OUT = 0;
132EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0;
133EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
134EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0;
135EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0;
136EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0;
137EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0;
138EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0;
139EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0;
140EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0;
141EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0;
142EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0;
143EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0;
144EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0;
145EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0;
146EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0;
147EAPI int ECORE_X_EVENT_WINDOW_STACK = 0;
148EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0;
149EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0;
150EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0;
151EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0;
152EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0;
153EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0;
154EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0;
155EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0;
156EAPI int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = 0;
157EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0;
158EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0;
159EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0;
160EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = 0;
161EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN = 0;
162EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = 0;
163EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP = 0;
164EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = 0;
165EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = 0;
166EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = 0;
167EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0;
168EAPI int ECORE_X_EVENT_SYNC_ALARM = 0;
169EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0;
170EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0;
171EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0;
172EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0;
173EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0;
174EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0;
175EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0;
176EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
177EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0;
178EAPI int ECORE_X_EVENT_PING = 0;
179EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0;
180EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0;
181EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0;
182EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0;
183EAPI int ECORE_X_EVENT_GENERIC = 0;
184
185void
186_ecore_xcb_events_init(void)
187{
188 LOGFN(__FILE__, __LINE__, __FUNCTION__);
189
190 if (!ECORE_X_EVENT_ANY)
191 {
192 ECORE_X_EVENT_ANY = ecore_event_type_new();
193 ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new();
194 ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new();
195 ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
196 ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
197 ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new();
198 ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
199 ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new();
200 ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new();
201 ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new();
202 ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new();
203 ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new();
204 ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new();
205 ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new();
206 ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
207 ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new();
208 ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new();
209 ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new();
210 ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new();
211 ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new();
212 ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new();
213 ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new();
214 ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new();
215 ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new();
216 ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new();
217 ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new();
218 ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new();
219 ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new();
220 ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new();
221 ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new();
222 ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new();
223 ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new();
224 ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new();
225 ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new();
226 ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new();
227 ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new();
228 ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new();
229 ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new();
230 ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new();
231 ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
232 ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new();
233 ECORE_X_EVENT_RANDR_CRTC_CHANGE = ecore_event_type_new();
234 ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = ecore_event_type_new();
235 ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = ecore_event_type_new();
236 ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new();
237 ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
238 ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
239 ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new();
240 ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new();
241 ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new();
242 ECORE_X_EVENT_PING = ecore_event_type_new();
243 ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new();
244 ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new();
245 ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new();
246 ECORE_X_EVENT_GENERIC = ecore_event_type_new();
247 }
248}
249
250void
251_ecore_xcb_events_shutdown(void)
252{
253 LOGFN(__FILE__, __LINE__, __FUNCTION__);
254
255 _ecore_xcb_event_mouse_down_info_clear();
256
257 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
258// if (_ecore_xcb_event_last_mouse_move_event)
259// {
260// ecore_event_del(_ecore_xcb_event_last_mouse_move_event);
261// _ecore_xcb_event_last_mouse_move_event = NULL;
262// }
263}
264
265void
266_ecore_xcb_events_handle(xcb_generic_event_t *ev)
267{
268 uint8_t response = 0;
269
270// LOGFN(__FILE__, __LINE__, __FUNCTION__);
271 CHECK_XCB_CONN;
272
273 /* strip highest bit (set if event is generated) */
274 response = (ev->response_type & ~0x80);
275 if (response == 0)
276 {
277 xcb_generic_error_t *err;
278
279 err = (xcb_generic_error_t *)ev;
280
281 /* NB: There is no way to check access of destroyed windows,
282 * so trap those cases and ignore. We also ignore BadValue from
283 * xcb_grab/ungrab_button (happens when we are using any_mod)
284 * and a few others */
285#ifdef OLD_XCB_VERSION
286 if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) return;
287 else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH)
288 {
289 if ((err->major_code == XCB_SET_INPUT_FOCUS) ||
290 (err->major_code == XCB_CONFIGURE_WINDOW))
291 return;
292 }
293 else if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE)
294 {
295 if ((err->major_code == XCB_KILL_CLIENT) ||
296 (err->major_code == XCB_GRAB_BUTTON) ||
297 (err->major_code == XCB_UNGRAB_BUTTON))
298 return;
299 }
300#else
301 if (err->error_code == XCB_WINDOW) return;
302 else if (err->error_code == XCB_MATCH)
303 {
304 if ((err->major_code == XCB_SET_INPUT_FOCUS) ||
305 (err->major_code == XCB_CONFIGURE_WINDOW))
306 return;
307 }
308 else if (err->error_code == XCB_VALUE)
309 {
310 if ((err->major_code == XCB_KILL_CLIENT) ||
311 (err->major_code == XCB_GRAB_BUTTON) ||
312 (err->major_code == XCB_UNGRAB_BUTTON))
313 return;
314 }
315#endif
316 WRN("Got Event Error:");
317 WRN("\tMajor Code: %d", err->major_code);
318 WRN("\tMinor Code: %d", err->minor_code);
319 WRN("\tRequest: %s", xcb_event_get_request_label(err->major_code));
320 WRN("\tError: %s", xcb_event_get_error_label(err->error_code));
321 if (err->error_code == 2) // bad value
322 WRN("\tValue: %d", ((xcb_value_error_t *)err)->bad_value);
323 else if (err->error_code == 8) // bad match
324 WRN("\tMatch: %d", ((xcb_match_error_t *)err)->bad_value);
325
326 if (err->major_code == XCB_SEND_EVENT)
327 {
328 WRN("\tSend Event Error");
329 WRN("\t\tSeq: %d", ev->sequence);
330 WRN("\t\tFull Seq: %d", ev->full_sequence);
331 WRN("\t\tType: %d", ev->response_type);
332 }
333 /* if (err->major_code == 148) */
334 /* { */
335 /* printf("GOT 148 Error\n"); */
336 /* } */
337 return;
338 }
339
340 /* FIXME: Filter event for xim when xcb supports xim */
341
342 _ecore_xcb_event_handle_any_event(ev);
343
344 if (response == XCB_KEY_PRESS)
345 _ecore_xcb_event_handle_key_press(ev);
346 else if (response == XCB_KEY_RELEASE)
347 _ecore_xcb_event_handle_key_release(ev);
348 else if (response == XCB_BUTTON_PRESS)
349 _ecore_xcb_event_handle_button_press(ev);
350 else if (response == XCB_BUTTON_RELEASE)
351 _ecore_xcb_event_handle_button_release(ev);
352 else if (response == XCB_MOTION_NOTIFY)
353 _ecore_xcb_event_handle_motion_notify(ev);
354 else if (response == XCB_ENTER_NOTIFY)
355 _ecore_xcb_event_handle_enter_notify(ev);
356 else if (response == XCB_LEAVE_NOTIFY)
357 _ecore_xcb_event_handle_leave_notify(ev);
358 else if (response == XCB_KEYMAP_NOTIFY)
359 _ecore_xcb_event_handle_keymap_notify(ev);
360 else if (response == XCB_FOCUS_IN)
361 _ecore_xcb_event_handle_focus_in(ev);
362 else if (response == XCB_FOCUS_OUT)
363 _ecore_xcb_event_handle_focus_out(ev);
364 else if (response == XCB_EXPOSE)
365 _ecore_xcb_event_handle_expose(ev);
366 else if (response == XCB_GRAPHICS_EXPOSURE)
367 _ecore_xcb_event_handle_graphics_exposure(ev);
368 else if (response == XCB_VISIBILITY_NOTIFY)
369 _ecore_xcb_event_handle_visibility_notify(ev);
370 else if (response == XCB_CREATE_NOTIFY)
371 _ecore_xcb_event_handle_create_notify(ev);
372 else if (response == XCB_DESTROY_NOTIFY)
373 _ecore_xcb_event_handle_destroy_notify(ev);
374 else if (response == XCB_MAP_NOTIFY)
375 _ecore_xcb_event_handle_map_notify(ev);
376 else if (response == XCB_UNMAP_NOTIFY)
377 _ecore_xcb_event_handle_unmap_notify(ev);
378 else if (response == XCB_MAP_REQUEST)
379 _ecore_xcb_event_handle_map_request(ev);
380 else if (response == XCB_REPARENT_NOTIFY)
381 _ecore_xcb_event_handle_reparent_notify(ev);
382 else if (response == XCB_CONFIGURE_NOTIFY)
383 _ecore_xcb_event_handle_configure_notify(ev);
384 else if (response == XCB_CONFIGURE_REQUEST)
385 _ecore_xcb_event_handle_configure_request(ev);
386 else if (response == XCB_GRAVITY_NOTIFY)
387 _ecore_xcb_event_handle_gravity_notify(ev);
388 else if (response == XCB_RESIZE_REQUEST)
389 _ecore_xcb_event_handle_resize_request(ev);
390 else if (response == XCB_CIRCULATE_NOTIFY)
391 _ecore_xcb_event_handle_circulate_notify(ev);
392 else if (response == XCB_CIRCULATE_REQUEST)
393 _ecore_xcb_event_handle_circulate_request(ev);
394 else if (response == XCB_PROPERTY_NOTIFY)
395 _ecore_xcb_event_handle_property_notify(ev);
396 else if (response == XCB_SELECTION_CLEAR)
397 _ecore_xcb_event_handle_selection_clear(ev);
398 else if (response == XCB_SELECTION_REQUEST)
399 _ecore_xcb_event_handle_selection_request(ev);
400 else if (response == XCB_SELECTION_NOTIFY)
401 _ecore_xcb_event_handle_selection_notify(ev);
402 else if (response == XCB_COLORMAP_NOTIFY)
403 _ecore_xcb_event_handle_colormap_notify(ev);
404 else if (response == XCB_CLIENT_MESSAGE)
405 _ecore_xcb_event_handle_client_message(ev);
406 else if (response == XCB_MAPPING_NOTIFY)
407 _ecore_xcb_event_handle_mapping_notify(ev);
408 else if (response == 35) /* GenericEvent == 35 */
409 _ecore_xcb_event_handle_generic_event(ev);
410#ifdef ECORE_XCB_DAMAGE
411 else if ((_ecore_xcb_event_damage >= 0) &&
412 (response == (_ecore_xcb_event_damage + XCB_DAMAGE_NOTIFY)))
413 _ecore_xcb_event_handle_damage_notify(ev);
414#endif
415#ifdef ECORE_XCB_RANDR
416 else if ((_ecore_xcb_event_randr >= 0) &&
417 (response ==
418 _ecore_xcb_event_randr + XCB_RANDR_SCREEN_CHANGE_NOTIFY))
419 _ecore_xcb_event_handle_randr_change(ev);
420 else if ((_ecore_xcb_event_randr >= 0) &&
421 (response == (_ecore_xcb_event_randr + XCB_RANDR_NOTIFY)))
422 _ecore_xcb_event_handle_randr_notify(ev);
423#endif
424#ifdef ECORE_XCB_SCREENSAVER
425 else if ((_ecore_xcb_event_screensaver >= 0) &&
426 (response ==
427 _ecore_xcb_event_screensaver + XCB_SCREENSAVER_NOTIFY))
428 _ecore_xcb_event_handle_screensaver_notify(ev);
429#endif
430#ifdef ECORE_XCB_XGESTURE
431 else if ((_ecore_xcb_event_gesture >= 0) &&
432 (response ==
433 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_FLICK))
434 _ecore_xcb_event_handle_gesture_notify_flick(ev);
435 else if ((_ecore_xcb_event_gesture >= 0) &&
436 (response ==
437 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PAN))
438 _ecore_xcb_event_handle_gesture_notify_pan(ev);
439 else if ((_ecore_xcb_event_gesture >= 0) &&
440 (response ==
441 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PINCH_ROTATION))
442 _ecore_xcb_event_handle_gesture_notify_pinchrotation(ev);
443 else if ((_ecore_xcb_event_gesture >= 0) &&
444 (response ==
445 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP))
446 _ecore_xcb_event_handle_gesture_notify_tap(ev);
447 else if ((_ecore_xcb_event_gesture >= 0) &&
448 (response ==
449 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP_N_HOLD))
450 _ecore_xcb_event_handle_gesture_notify_tapnhold(ev);
451 else if ((_ecore_xcb_event_gesture >= 0) &&
452 (response ==
453 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_HOLD))
454 _ecore_xcb_event_handle_gesture_notify_hold(ev);
455 else if ((_ecore_xcb_event_gesture >= 0) &&
456 (response ==
457 _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_GROUP))
458 _ecore_xcb_event_handle_gesture_notify_group(ev);
459#endif
460#ifdef ECORE_XCB_SHAPE
461 else if ((_ecore_xcb_event_shape >= 0) &&
462 (response == (_ecore_xcb_event_shape + XCB_SHAPE_NOTIFY)))
463 _ecore_xcb_event_handle_shape_change(ev);
464#endif
465#ifdef ECORE_XCB_SYNC
466 else if ((_ecore_xcb_event_sync >= 0) &&
467 (response == (_ecore_xcb_event_sync + XCB_SYNC_COUNTER_NOTIFY)))
468 _ecore_xcb_event_handle_sync_counter(ev);
469 else if ((_ecore_xcb_event_sync >= 0) &&
470 (response == (_ecore_xcb_event_sync + XCB_SYNC_ALARM_NOTIFY)))
471 _ecore_xcb_event_handle_sync_alarm(ev);
472#endif
473#ifdef ECORE_XCB_XFIXES
474 else if ((_ecore_xcb_event_xfixes >= 0) &&
475 (response ==
476 _ecore_xcb_event_xfixes + XCB_XFIXES_SELECTION_NOTIFY))
477 _ecore_xcb_event_handle_xfixes_selection_notify(ev);
478 else if ((_ecore_xcb_event_xfixes >= 0) &&
479 (response == (_ecore_xcb_event_xfixes + XCB_XFIXES_CURSOR_NOTIFY)))
480 _ecore_xcb_event_handle_xfixes_cursor_notify(ev);
481#endif
482}
483
484Ecore_X_Time
485_ecore_xcb_events_last_time_get(void)
486{
487 LOGFN(__FILE__, __LINE__, __FUNCTION__);
488
489 return _ecore_xcb_event_last_time;
490}
491
492EAPI void
493ecore_x_event_mask_set(Ecore_X_Window win,
494 Ecore_X_Event_Mask mask)
495{
496 xcb_get_window_attributes_cookie_t cookie;
497 xcb_get_window_attributes_reply_t *reply;
498 uint32_t list;
499
500 LOGFN(__FILE__, __LINE__, __FUNCTION__);
501 CHECK_XCB_CONN;
502
503 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
504 cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win);
505 reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
506 if (!reply) return;
507
508 list = (mask | reply->your_event_mask);
509 free(reply);
510 xcb_change_window_attributes(_ecore_xcb_conn, win,
511 XCB_CW_EVENT_MASK, &list);
512// ecore_x_flush();
513}
514
515EAPI void
516ecore_x_event_mask_unset(Ecore_X_Window win,
517 Ecore_X_Event_Mask mask)
518{
519 xcb_get_window_attributes_cookie_t cookie;
520 xcb_get_window_attributes_reply_t *reply;
521 uint32_t list;
522
523 LOGFN(__FILE__, __LINE__, __FUNCTION__);
524 CHECK_XCB_CONN;
525
526 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
527 cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win);
528 reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
529 if (!reply) return;
530
531 list = (reply->your_event_mask & ~mask);
532 free(reply);
533 xcb_change_window_attributes(_ecore_xcb_conn, win,
534 XCB_CW_EVENT_MASK, &list);
535// ecore_x_flush();
536}
537
538unsigned int
539_ecore_xcb_events_modifiers_get(unsigned int state)
540{
541 unsigned int modifiers = 0;
542
543 LOGFN(__FILE__, __LINE__, __FUNCTION__);
544
545 if (state & ECORE_X_MODIFIER_SHIFT)
546 modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
547 if (state & ECORE_X_MODIFIER_CTRL)
548 modifiers |= ECORE_EVENT_MODIFIER_CTRL;
549 if (state & ECORE_X_MODIFIER_ALT)
550 modifiers |= ECORE_EVENT_MODIFIER_ALT;
551 if (state & ECORE_X_MODIFIER_WIN)
552 modifiers |= ECORE_EVENT_MODIFIER_WIN;
553 if (state & ECORE_X_LOCK_SCROLL)
554 modifiers |= ECORE_EVENT_LOCK_SCROLL;
555 if (state & ECORE_X_LOCK_CAPS)
556 modifiers |= ECORE_EVENT_LOCK_CAPS;
557 if (state & ECORE_X_LOCK_NUM)
558 modifiers |= ECORE_EVENT_LOCK_NUM;
559 if (state & ECORE_X_LOCK_SHIFT)
560 modifiers |= ECORE_EVENT_LOCK_SHIFT;
561
562 return modifiers;
563}
564
565/* local functions */
566static void
567_ecore_xcb_event_handle_any_event(xcb_generic_event_t *event)
568{
569 xcb_generic_event_t *ev;
570
571// LOGFN(__FILE__, __LINE__, __FUNCTION__);
572
573 ev = malloc(sizeof(xcb_generic_event_t));
574 if (!ev) return;
575
576 memcpy(ev, event, sizeof(xcb_generic_event_t));
577 ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
578}
579
580static void
581_ecore_xcb_event_handle_key_press(xcb_generic_event_t *event)
582{
583 _ecore_xcb_event_key_press(event);
584}
585
586static void
587_ecore_xcb_event_handle_key_release(xcb_generic_event_t *event)
588{
589 _ecore_xcb_event_key_release(event);
590}
591
592static void
593_ecore_xcb_event_handle_button_press(xcb_generic_event_t *event)
594{
595 xcb_button_press_event_t *ev;
596
597 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
598
599 ev = (xcb_button_press_event_t *)event;
600 if ((ev->detail > 3) && (ev->detail < 8))
601 {
602 Ecore_Event_Mouse_Wheel *e;
603
604 if (!(e = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
605
606 e->timestamp = ev->time;
607 e->modifiers = _ecore_xcb_events_modifiers_get(ev->state);
608 switch (ev->detail)
609 {
610 case 4:
611 e->direction = 0;
612 e->z = -1;
613 break;
614
615 case 5:
616 e->direction = 0;
617 e->z = 1;
618 break;
619
620 case 6:
621 e->direction = 1;
622 e->z = -1;
623 break;
624
625 case 7:
626 e->direction = 1;
627 e->z = 1;
628 break;
629
630 default:
631 e->direction = 0;
632 e->z = 0;
633 break;
634 }
635 e->x = ev->event_x;
636 e->y = ev->event_y;
637 e->root.x = ev->root_x;
638 e->root.y = ev->root_y;
639 if (ev->child)
640 e->window = ev->child;
641 else
642 e->window = ev->event;
643
644 e->event_window = ev->event;
645 e->same_screen = ev->same_screen;
646 e->root_window = ev->root;
647
648 _ecore_xcb_event_last_time = e->timestamp;
649 _ecore_xcb_event_last_window = e->window;
650 _ecore_xcb_event_last_root_x = e->root.x;
651 _ecore_xcb_event_last_root_y = e->root.y;
652
653 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
654
655 _ecore_xcb_window_grab_allow_events(ev->event, ev->child,
656 ECORE_EVENT_MOUSE_WHEEL,
657 e, ev->time);
658 }
659 else
660 {
661 Ecore_Event_Mouse_Button *e;
662 unsigned int child_win = 0;
663
664 child_win = (ev->child ? ev->child : ev->event);
665
666 _ecore_xcb_event_mouse_move(ev->time, ev->state,
667 ev->event_x, ev->event_y,
668 ev->root_x, ev->root_y,
669 ev->event, child_win,
670 ev->root, ev->same_screen,
671 0, 1, 1, 1.0, 0.0,
672 ev->event_x, ev->event_y,
673 ev->root_x, ev->root_y);
674
675 e = _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
676 ev->time,
677 ev->state, ev->detail,
678 ev->event_x, ev->event_y,
679 ev->root_x, ev->root_y, ev->event,
680 child_win,
681 ev->root, ev->same_screen,
682 0, 1, 1, 1.0, 0.0,
683 ev->event_x, ev->event_y,
684 ev->root_x, ev->root_y);
685 if (e)
686 _ecore_xcb_window_grab_allow_events(ev->event, ev->child,
687 ECORE_EVENT_MOUSE_BUTTON_DOWN,
688 e, ev->time);
689 }
690}
691
692static void
693_ecore_xcb_event_handle_button_release(xcb_generic_event_t *event)
694{
695 xcb_button_release_event_t *ev;
696
697 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
698 ev = (xcb_button_release_event_t *)event;
699 if ((ev->detail <= 3) || (ev->detail > 7))
700 {
701 _ecore_xcb_event_mouse_move(ev->time, ev->state,
702 ev->event_x, ev->event_y,
703 ev->root_x, ev->root_y,
704 ev->event,
705 (ev->child ? ev->child : ev->event),
706 ev->root, ev->same_screen,
707 0, 1, 1, 1.0, 0.0,
708 ev->event_x, ev->event_y,
709 ev->root_x, ev->root_y);
710
711 _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, ev->time,
712 ev->state, ev->detail,
713 ev->event_x, ev->event_y, ev->root_x,
714 ev->root_y, ev->event,
715 (ev->child ? ev->child : ev->event),
716 ev->root, ev->same_screen,
717 0, 1, 1, 1.0, 0.0,
718 ev->event_x, ev->event_y,
719 ev->root_x, ev->root_y);
720 }
721}
722
723static void
724_ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event)
725{
726 xcb_motion_notify_event_t *ev;
727
728 ev = (xcb_motion_notify_event_t *)event;
729
730 /* if (_ecore_xcb_event_last_mouse_move_event) */
731 /* { */
732 /* ecore_event_del(_ecore_xcb_event_last_mouse_move_event); */
733 /* _ecore_xcb_event_last_mouse_move = EINA_FALSE; */
734 /* _ecore_xcb_event_last_mouse_move_event = NULL; */
735 /* } */
736
737 _ecore_xcb_event_mouse_move(ev->time, ev->state,
738 ev->event_x, ev->event_y,
739 ev->root_x, ev->root_y,
740 ev->event,
741 (ev->child ? ev->child : ev->event),
742 ev->root, ev->same_screen,
743 0, 1, 1, 1.0, 0.0,
744 ev->event_x, ev->event_y,
745 ev->root_x, ev->root_y);
746 _ecore_xcb_event_last_mouse_move = EINA_TRUE;
747
748 _ecore_xcb_dnd_drag(ev->root, ev->root_x, ev->root_y);
749}
750
751static void
752_ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event)
753{
754 xcb_enter_notify_event_t *ev;
755 Ecore_X_Event_Mouse_In *e;
756
757 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
758 ev = (xcb_enter_notify_event_t *)event;
759
760 _ecore_xcb_event_mouse_move(ev->time, ev->state,
761 ev->event_x, ev->event_y,
762 ev->root_x, ev->root_y,
763 ev->event,
764 (ev->child ? ev->child : ev->event),
765 ev->root, ev->same_screen_focus,
766 0, 1, 1, 1.0, 0.0,
767 ev->event_x, ev->event_y,
768 ev->root_x, ev->root_y);
769
770 if (!(e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)))) return;
771
772 e->modifiers = _ecore_xcb_events_modifiers_get(ev->state);
773 e->x = ev->event_x;
774 e->y = ev->event_y;
775 e->root.x = ev->root_x;
776 e->root.y = ev->root_y;
777 if (ev->child)
778 e->win = ev->child;
779 else
780 e->win = ev->event;
781 e->event_win = ev->event;
782 e->same_screen = ev->same_screen_focus;
783 e->root_win = ev->root;
784 e->mode = _ecore_xcb_event_mode_get(ev->mode);
785 e->detail = _ecore_xcb_event_detail_get(ev->detail);
786 e->time = ev->time;
787 _ecore_xcb_event_last_time = e->time;
788
789 ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
790}
791
792static void
793_ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event)
794{
795 xcb_leave_notify_event_t *ev;
796 Ecore_X_Event_Mouse_Out *e;
797
798 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
799 ev = (xcb_enter_notify_event_t *)event;
800
801 _ecore_xcb_event_mouse_move(ev->time, ev->state,
802 ev->event_x, ev->event_y,
803 ev->root_x, ev->root_y,
804 ev->event,
805 (ev->child ? ev->child : ev->event),
806 ev->root, ev->same_screen_focus,
807 0, 1, 1, 1.0, 0.0,
808 ev->event_x, ev->event_y,
809 ev->root_x, ev->root_y);
810
811 if (!(e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)))) return;
812
813 e->modifiers = _ecore_xcb_events_modifiers_get(ev->state);
814 e->x = ev->event_x;
815 e->y = ev->event_y;
816 e->root.x = ev->root_x;
817 e->root.y = ev->root_y;
818 if (ev->child)
819 e->win = ev->child;
820 else
821 e->win = ev->event;
822 e->event_win = ev->event;
823 e->same_screen = ev->same_screen_focus;
824 e->root_win = ev->root;
825 e->mode = _ecore_xcb_event_mode_get(ev->mode);
826 e->detail = _ecore_xcb_event_detail_get(ev->detail);
827
828 e->time = ev->time;
829 _ecore_xcb_event_last_time = e->time;
830 _ecore_xcb_event_last_window = e->win;
831 _ecore_xcb_event_last_root_x = e->root.x;
832 _ecore_xcb_event_last_root_y = e->root.y;
833
834 ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL);
835}
836
837static void
838_ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event __UNUSED__)
839{
840// LOGFN(__FILE__, __LINE__, __FUNCTION__);
841
842 // FIXME: handle this event type
843 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
844}
845
846static void
847_ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event)
848{
849 xcb_focus_in_event_t *ev;
850 Ecore_X_Event_Window_Focus_In *e;
851
852 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
853 ev = (xcb_focus_in_event_t *)event;
854 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)))) return;
855
856 e->win = ev->event;
857 e->mode = _ecore_xcb_event_mode_get(ev->mode);
858 e->detail = _ecore_xcb_event_detail_get(ev->detail);
859
860 e->time = _ecore_xcb_event_last_time;
861 _ecore_xcb_event_last_time = e->time;
862
863 ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
864}
865
866static void
867_ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event)
868{
869 xcb_focus_out_event_t *ev;
870 Ecore_X_Event_Window_Focus_Out *e;
871
872 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
873 ev = (xcb_focus_out_event_t *)event;
874 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)))) return;
875
876 e->win = ev->event;
877 e->mode = _ecore_xcb_event_mode_get(ev->mode);
878 e->detail = _ecore_xcb_event_detail_get(ev->detail);
879
880 e->time = _ecore_xcb_event_last_time;
881 _ecore_xcb_event_last_time = e->time;
882
883 ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
884}
885
886static void
887_ecore_xcb_event_handle_expose(xcb_generic_event_t *event)
888{
889 xcb_expose_event_t *ev;
890 Ecore_X_Event_Window_Damage *e;
891
892 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
893 ev = (xcb_expose_event_t *)event;
894 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return;
895
896 e->win = ev->window;
897 e->time = _ecore_xcb_event_last_time;
898 e->x = ev->x;
899 e->y = ev->y;
900 e->w = ev->width;
901 e->h = ev->height;
902 e->count = ev->count;
903
904 ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
905}
906
907static void
908_ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event)
909{
910 xcb_graphics_exposure_event_t *ev;
911 Ecore_X_Event_Window_Damage *e;
912
913 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
914 ev = (xcb_graphics_exposure_event_t *)event;
915 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return;
916
917 e->win = ev->drawable;
918 e->x = ev->x;
919 e->y = ev->y;
920 e->w = ev->width;
921 e->h = ev->height;
922 e->count = ev->count;
923 e->time = _ecore_xcb_event_last_time;
924
925 ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
926}
927
928static void
929_ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event)
930{
931 xcb_visibility_notify_event_t *ev;
932 Ecore_X_Event_Window_Visibility_Change *e;
933
934 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
935 ev = (xcb_visibility_notify_event_t *)event;
936 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change))))
937 return;
938
939 e->win = ev->window;
940 e->time = _ecore_xcb_event_last_time;
941 if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED)
942 e->fully_obscured = 1;
943 else
944 e->fully_obscured = 0;
945
946 ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
947}
948
949static void
950_ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event)
951{
952 xcb_create_notify_event_t *ev;
953 Ecore_X_Event_Window_Create *e;
954
955 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
956 ev = (xcb_create_notify_event_t *)event;
957 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Create)))) return;
958
959 e->win = ev->window;
960 e->parent = ev->parent;
961 if (ev->override_redirect)
962 e->override = 1;
963 else
964 e->override = 0;
965 e->x = ev->x;
966 e->y = ev->y;
967 e->w = ev->width;
968 e->h = ev->height;
969 e->border = ev->border_width;
970 e->time = _ecore_xcb_event_last_time;
971
972 ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
973}
974
975static void
976_ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event)
977{
978 xcb_destroy_notify_event_t *ev;
979 Ecore_X_Event_Window_Destroy *e;
980
981 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
982 ev = (xcb_destroy_notify_event_t *)event;
983 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)))) return;
984
985 e->win = ev->window;
986 e->event_win = ev->event;
987 if (e->win == _ecore_xcb_event_last_window)
988 _ecore_xcb_event_last_window = 0;
989 e->time = _ecore_xcb_event_last_time;
990
991 ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
992}
993
994static void
995_ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event)
996{
997 xcb_map_notify_event_t *ev;
998 Ecore_X_Event_Window_Show *e;
999
1000 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1001 ev = (xcb_map_notify_event_t *)event;
1002 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show)))) return;
1003
1004 e->win = ev->window;
1005 e->event_win = ev->event;
1006 e->time = _ecore_xcb_event_last_time;
1007
1008 ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
1009}
1010
1011static void
1012_ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event)
1013{
1014 xcb_unmap_notify_event_t *ev;
1015 Ecore_X_Event_Window_Hide *e;
1016
1017 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1018 ev = (xcb_unmap_notify_event_t *)event;
1019 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)))) return;
1020
1021 e->win = ev->window;
1022 e->event_win = ev->event;
1023 e->time = _ecore_xcb_event_last_time;
1024
1025 ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
1026}
1027
1028static void
1029_ecore_xcb_event_handle_map_request(xcb_generic_event_t *event)
1030{
1031 xcb_map_request_event_t *ev;
1032 Ecore_X_Event_Window_Show_Request *e;
1033
1034 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1035 ev = (xcb_map_request_event_t *)event;
1036 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)))) return;
1037
1038 e->win = ev->window;
1039 e->parent = ev->parent;
1040 e->time = _ecore_xcb_event_last_time;
1041
1042 ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
1043}
1044
1045static void
1046_ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event)
1047{
1048 xcb_reparent_notify_event_t *ev;
1049 Ecore_X_Event_Window_Reparent *e;
1050
1051 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1052 ev = (xcb_reparent_notify_event_t *)event;
1053 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)))) return;
1054
1055 e->win = ev->window;
1056 e->event_win = ev->event;
1057 e->parent = ev->parent;
1058 e->time = _ecore_xcb_event_last_time;
1059
1060 ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
1061}
1062
1063static void
1064_ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event)
1065{
1066 xcb_configure_notify_event_t *ev;
1067 Ecore_X_Event_Window_Configure *e;
1068
1069 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1070 ev = (xcb_configure_notify_event_t *)event;
1071 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)))) return;
1072
1073 e->win = ev->window;
1074 e->event_win = ev->event;
1075 e->abovewin = ev->above_sibling;
1076 e->x = ev->x;
1077 e->y = ev->y;
1078 e->w = ev->width;
1079 e->h = ev->height;
1080 e->border = ev->border_width;
1081 e->override = ev->override_redirect;
1082 /* send_event is bit 7 (0x80) of response_type */
1083 e->from_wm = ((ev->response_type & 0x80) ? 1 : 0);
1084 e->time = _ecore_xcb_event_last_time;
1085
1086 ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
1087}
1088
1089static void
1090_ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event)
1091{
1092 xcb_configure_request_event_t *ev;
1093 Ecore_X_Event_Window_Configure_Request *e;
1094
1095 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1096 ev = (xcb_configure_request_event_t *)event;
1097 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request))))
1098 return;
1099
1100 e->win = ev->window;
1101 e->parent_win = ev->parent;
1102 e->abovewin = ev->sibling;
1103 e->x = ev->x;
1104 e->y = ev->y;
1105 e->w = ev->width;
1106 e->h = ev->height;
1107 e->border = ev->border_width;
1108 e->value_mask = ev->value_mask;
1109 switch (ev->stack_mode)
1110 {
1111 case XCB_STACK_MODE_ABOVE:
1112 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1113 break;
1114
1115 case XCB_STACK_MODE_BELOW:
1116 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1117 break;
1118
1119 case XCB_STACK_MODE_TOP_IF:
1120 e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
1121 break;
1122
1123 case XCB_STACK_MODE_BOTTOM_IF:
1124 e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
1125 break;
1126
1127 case XCB_STACK_MODE_OPPOSITE:
1128 e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
1129 break;
1130 }
1131 e->time = _ecore_xcb_event_last_time;
1132
1133 ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
1134}
1135
1136static void
1137_ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event __UNUSED__)
1138{
1139/*
1140 xcb_gravity_notify_event_t *ev;
1141 Ecore_X_Event_Window_Gravity *e;
1142
1143 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1144 ev = (xcb_gravity_notify_event_t *)event;
1145 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Gravity)))) return;
1146
1147 e->win = ev->window;
1148 e->event_win = ev->event;
1149 e->time = _ecore_xcb_event_last_time;
1150
1151 ecore_event_add(ECORE_X_EVENT_WINDOW_GRAVITY, e, NULL, NULL);
1152 */
1153}
1154
1155static void
1156_ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event)
1157{
1158 xcb_resize_request_event_t *ev;
1159 Ecore_X_Event_Window_Resize_Request *e;
1160
1161 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1162 ev = (xcb_resize_request_event_t *)event;
1163 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)))) return;
1164
1165 e->win = ev->window;
1166 e->w = ev->width;
1167 e->h = ev->height;
1168 e->time = _ecore_xcb_event_last_time;
1169
1170 ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
1171}
1172
1173static void
1174_ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event)
1175{
1176 xcb_circulate_notify_event_t *ev;
1177 Ecore_X_Event_Window_Stack *e;
1178
1179 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1180 ev = (xcb_circulate_notify_event_t *)event;
1181 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)))) return;
1182
1183 e->win = ev->window;
1184 e->event_win = ev->event;
1185 if (ev->place == XCB_PLACE_ON_TOP)
1186 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1187 else
1188 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1189 e->time = _ecore_xcb_event_last_time;
1190
1191 ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
1192}
1193
1194static void
1195_ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event)
1196{
1197 xcb_circulate_request_event_t *ev;
1198 Ecore_X_Event_Window_Stack_Request *e;
1199
1200 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1201 ev = (xcb_circulate_request_event_t *)event;
1202 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)))) return;
1203
1204 e->win = ev->window;
1205 e->parent = ev->event;
1206 if (ev->place == XCB_PLACE_ON_TOP)
1207 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1208 else
1209 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1210 e->time = _ecore_xcb_event_last_time;
1211
1212 ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
1213}
1214
1215static void
1216_ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event)
1217{
1218 xcb_property_notify_event_t *ev;
1219 Ecore_X_Event_Window_Property *e;
1220
1221 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1222 ev = (xcb_property_notify_event_t *)event;
1223 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Property)))) return;
1224
1225 e->win = ev->window;
1226 e->atom = ev->atom;
1227 e->time = ev->time;
1228 _ecore_xcb_event_last_time = e->time;
1229
1230 ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL);
1231}
1232
1233static void
1234_ecore_xcb_event_handle_selection_clear(xcb_generic_event_t *event)
1235{
1236 xcb_selection_clear_event_t *ev;
1237 Ecore_X_Event_Selection_Clear *e;
1238 Ecore_X_Atom sel;
1239
1240 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1241
1242 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1243 ev = (xcb_selection_clear_event_t *)event;
1244 if (!(e = malloc(sizeof(Ecore_X_Event_Selection_Clear)))) return;
1245
1246 e->win = ev->owner;
1247 e->atom = sel = ev->selection;
1248 if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
1249 e->selection = ECORE_X_SELECTION_PRIMARY;
1250 else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
1251 e->selection = ECORE_X_SELECTION_SECONDARY;
1252 else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
1253 e->selection = ECORE_X_SELECTION_CLIPBOARD;
1254 else
1255 e->selection = ECORE_X_SELECTION_OTHER;
1256 e->time = ev->time;
1257
1258 ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
1259}
1260
1261static void
1262_ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event)
1263{
1264 xcb_selection_request_event_t *ev;
1265 Ecore_X_Event_Selection_Request *e;
1266 Ecore_X_Selection_Intern *sd;
1267
1268 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1269
1270 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1271 ev = (xcb_selection_request_event_t *)event;
1272 if (!(e = malloc(sizeof(Ecore_X_Event_Selection_Request)))) return;
1273
1274 e->owner = ev->owner;
1275 e->requestor = ev->requestor;
1276 e->selection = ev->selection;
1277 e->target = ev->target;
1278 e->property = ev->property;
1279 e->time = ev->time;
1280
1281 ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL);
1282
1283 if ((sd = _ecore_xcb_selection_get(ev->selection)) &&
1284 (sd->win == ev->owner))
1285 {
1286 Ecore_X_Selection_Intern *si;
1287
1288 si = _ecore_xcb_selection_get(ev->selection);
1289 if (si->data)
1290 {
1291 Ecore_X_Atom property = XCB_NONE, type;
1292 void *data = NULL;
1293 int len = 0, typesize = 0;
1294
1295 type = ev->target;
1296 typesize = 8;
1297 len = sd->length;
1298
1299 if (!ecore_x_selection_convert(ev->selection, ev->target,
1300 &data, &len, &type, &typesize))
1301 property = XCB_NONE;
1302 else if (data)
1303 {
1304 ecore_x_window_prop_property_set(ev->requestor, ev->property,
1305 type, typesize, data, len);
1306 property = ev->property;
1307 free(data);
1308 }
1309 ecore_x_selection_notify_send(ev->requestor, ev->selection,
1310 ev->target, property, ev->time);
1311 }
1312 }
1313}
1314
1315static void
1316_ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event)
1317{
1318 xcb_selection_notify_event_t *ev;
1319 Ecore_X_Event_Selection_Notify *e;
1320 unsigned char *data = NULL;
1321 Ecore_X_Atom selection;
1322 int num = 0, format = 0;
1323
1324 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1325
1326 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1327 ev = (xcb_selection_notify_event_t *)event;
1328 selection = ev->selection;
1329 if (ev->target == ECORE_X_ATOM_SELECTION_TARGETS)
1330 {
1331 format =
1332 ecore_x_window_prop_property_get(ev->requestor, ev->property,
1333 XCB_ATOM_ATOM, 32, &data, &num);
1334 if (!format) return;
1335 }
1336 else
1337 {
1338 format =
1339 ecore_x_window_prop_property_get(ev->requestor, ev->property,
1340 XCB_GET_PROPERTY_TYPE_ANY, 8,
1341 &data, &num);
1342 if (!format) return;
1343 }
1344
1345 e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
1346 if (!e) return;
1347 e->win = ev->requestor;
1348 e->time = ev->time;
1349 e->atom = selection;
1350 e->target = _ecore_xcb_selection_target_get(ev->target);
1351
1352 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
1353 e->selection = ECORE_X_SELECTION_PRIMARY;
1354 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
1355 e->selection = ECORE_X_SELECTION_SECONDARY;
1356 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
1357 e->selection = ECORE_X_SELECTION_XDND;
1358 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
1359 e->selection = ECORE_X_SELECTION_CLIPBOARD;
1360 else
1361 e->selection = ECORE_X_SELECTION_OTHER;
1362
1363 e->data = _ecore_xcb_selection_parse(e->target, data, num, format);
1364
1365 ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,
1366 _ecore_xcb_event_selection_notify_free, NULL);
1367}
1368
1369static void
1370_ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event)
1371{
1372 xcb_colormap_notify_event_t *ev;
1373 Ecore_X_Event_Window_Colormap *e;
1374
1375 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1376 ev = (xcb_colormap_notify_event_t *)event;
1377 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)))) return;
1378
1379 e->win = ev->window;
1380 e->cmap = ev->colormap;
1381 if (ev->state == XCB_COLORMAP_STATE_INSTALLED)
1382 e->installed = 1;
1383 else
1384 e->installed = 0;
1385 e->time = _ecore_xcb_event_last_time;
1386
1387 ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
1388}
1389
1390static void
1391_ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
1392{
1393 xcb_client_message_event_t *ev;
1394
1395 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1396 ev = (xcb_client_message_event_t *)event;
1397
1398 /* Special client message event handling here. need to put LOTS of if */
1399 /* checks here and generate synthetic events per special message known */
1400 /* otherwise generate generic client message event. this would handle*/
1401 /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */
1402
1403 if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS) && (ev->format == 32) &&
1404 (ev->data.data32[0] == ECORE_X_ATOM_WM_DELETE_WINDOW))
1405 {
1406 Ecore_X_Event_Window_Delete_Request *e;
1407
1408 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request))))
1409 return;
1410 e->win = ev->window;
1411 e->time = _ecore_xcb_event_last_time;
1412 ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
1413 }
1414 else if ((ev->type == ECORE_X_ATOM_NET_WM_MOVERESIZE) &&
1415 (ev->format == 32) && (ev->data.data32[2] < 9))
1416 {
1417 Ecore_X_Event_Window_Move_Resize_Request *e;
1418
1419 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request))))
1420 return;
1421 e->win = ev->window;
1422 e->x = ev->data.data32[0];
1423 e->y = ev->data.data32[1];
1424 e->direction = ev->data.data32[2];
1425 e->button = ev->data.data32[3];
1426 e->source = ev->data.data32[4];
1427 ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
1428 }
1429 else if (ev->type == ECORE_X_ATOM_XDND_ENTER)
1430 {
1431 Ecore_X_Event_Xdnd_Enter *e;
1432 Ecore_X_DND_Target *target;
1433
1434 DBG("Got Xdnd Enter Event");
1435 if (!(e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)))) return;
1436 target = _ecore_xcb_dnd_target_get();
1437 target->state = ECORE_X_DND_TARGET_ENTERED;
1438 target->source = ev->data.data32[0];
1439 target->win = ev->window;
1440 target->version = (int)(ev->data.data32[1] >> 24);
1441 if (target->version > ECORE_X_DND_VERSION)
1442 {
1443 WRN("DND: Requested version %d but we only support up to %d",
1444 target->version, ECORE_X_DND_VERSION);
1445 free(e);
1446 return;
1447 }
1448 if (ev->data.data32[1] & 0x1UL)
1449 {
1450 unsigned char *data;
1451 Ecore_X_Atom *types;
1452 int num_ret = 0;
1453
1454 if (!ecore_x_window_prop_property_get(target->source,
1455 ECORE_X_ATOM_XDND_TYPE_LIST,
1456 ECORE_X_ATOM_ATOM, 32,
1457 &data, &num_ret))
1458 {
1459 WRN("DND: Could not fetch data type list from source window");
1460 free(e);
1461 return;
1462 }
1463 types = (Ecore_X_Atom *)data;
1464 e->types = calloc(num_ret, sizeof(char *));
1465 if (e->types)
1466 {
1467 int i = 0;
1468
1469 for (i = 0; i < num_ret; i++)
1470 e->types[i] = ecore_x_atom_name_get(types[i]);
1471 }
1472 e->num_types = num_ret;
1473 }
1474 else
1475 {
1476 int i = 0;
1477
1478 e->types = calloc(3, sizeof(char *));
1479 if (e->types)
1480 {
1481 while ((i < 3) && (ev->data.data32[i + 2]))
1482 {
1483 e->types[i] =
1484 ecore_x_atom_name_get(ev->data.data32[i + 2]);
1485 i++;
1486 }
1487 }
1488 e->num_types = i;
1489 }
1490
1491 e->win = target->win;
1492 e->source = target->source;
1493 ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e,
1494 _ecore_xcb_event_xdnd_enter_free, NULL);
1495 }
1496 else if (ev->type == ECORE_X_ATOM_XDND_POSITION)
1497 {
1498 Ecore_X_Event_Xdnd_Position *e;
1499 Ecore_X_DND_Target *target;
1500
1501 DBG("Got Xdnd Position Event");
1502 target = _ecore_xcb_dnd_target_get();
1503 if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
1504 (target->win != ev->window)) return;
1505 target->pos.x = ev->data.data32[2] >> 16;
1506 target->pos.y = ev->data.data32[2] & 0xFFFFUL;
1507 target->action = ev->data.data32[4];
1508 target->time = (target->version >= 1) ?
1509 (Ecore_X_Time)ev->data.data32[3] : XCB_CURRENT_TIME;
1510
1511 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
1512 if (!e) return;
1513 e->win = target->win;
1514 e->source = target->source;
1515 e->position.x = target->pos.x;
1516 e->position.y = target->pos.y;
1517 e->action = target->action;
1518 ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
1519 }
1520 else if (ev->type == ECORE_X_ATOM_XDND_STATUS)
1521 {
1522 Ecore_X_Event_Xdnd_Status *e;
1523 Ecore_X_DND_Source *source;
1524
1525 DBG("Got Xdnd Status Event");
1526 source = _ecore_xcb_dnd_source_get();
1527 if ((source->win != ev->window) ||
1528 (source->dest != (Ecore_X_Window)ev->data.data32[0]))
1529 return;
1530
1531 source->await_status = 0;
1532 source->will_accept = ev->data.data32[1] & 0x1UL;
1533 source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1;
1534 source->rectangle.x = ev->data.data32[2] >> 16;
1535 source->rectangle.y = ev->data.data32[2] & 0xFFFFUL;
1536 source->rectangle.width = ev->data.data32[3] >> 16;
1537 source->rectangle.height = ev->data.data32[3] & 0xFFFFUL;
1538 source->accepted_action = ev->data.data32[4];
1539
1540 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
1541 if (!e) return;
1542 e->win = source->win;
1543 e->target = source->dest;
1544 e->will_accept = source->will_accept;
1545 e->rectangle.x = source->rectangle.x;
1546 e->rectangle.y = source->rectangle.y;
1547 e->rectangle.width = source->rectangle.width;
1548 e->rectangle.height = source->rectangle.height;
1549 e->action = source->accepted_action;
1550
1551 ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
1552 }
1553 else if (ev->type == ECORE_X_ATOM_XDND_LEAVE)
1554 {
1555 Ecore_X_Event_Xdnd_Leave *e;
1556 Ecore_X_DND_Target *target;
1557
1558 DBG("Got Xdnd Leave Event");
1559 target = _ecore_xcb_dnd_target_get();
1560 if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
1561 (target->win != ev->window))
1562 return;
1563 target->state = ECORE_X_DND_TARGET_IDLE;
1564 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
1565 if (!e) return;
1566 e->win = ev->window;
1567 e->source = (Ecore_X_Window)ev->data.data32[0];
1568 ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
1569 }
1570 else if (ev->type == ECORE_X_ATOM_XDND_DROP)
1571 {
1572 Ecore_X_Event_Xdnd_Drop *e;
1573 Ecore_X_DND_Target *target;
1574
1575 DBG("Got Xdnd Drop Event");
1576 target = _ecore_xcb_dnd_target_get();
1577 if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
1578 (target->win != ev->window))
1579 return;
1580 target->time = (target->version >= 1) ?
1581 (Ecore_X_Time)ev->data.data32[2] : _ecore_xcb_event_last_time;
1582
1583 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
1584 if (!e) return;
1585 e->win = target->win;
1586 e->source = target->source;
1587 e->action = target->action;
1588 e->position.x = target->pos.x;
1589 e->position.y = target->pos.y;
1590 ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
1591 }
1592 else if (ev->type == ECORE_X_ATOM_XDND_FINISHED)
1593 {
1594 Ecore_X_Event_Xdnd_Finished *e;
1595 Ecore_X_DND_Source *source;
1596 Eina_Bool completed = EINA_TRUE;
1597
1598 DBG("Got Xdnd Finished Event");
1599 source = _ecore_xcb_dnd_source_get();
1600 if ((source->win != ev->window) ||
1601 (source->dest != (Ecore_X_Window)ev->data.data32[0]))
1602 return;
1603 if ((source->version < 5) || (ev->data.data32[1] & 0x1UL))
1604 {
1605 ecore_x_selection_xdnd_clear();
1606 source->state = ECORE_X_DND_SOURCE_IDLE;
1607 }
1608 else if (source->version >= 5)
1609 {
1610 completed = EINA_FALSE;
1611 source->state = ECORE_X_DND_SOURCE_CONVERTING;
1612 /* FIXME: Probably need to add a timer to switch back to idle
1613 * and discard the selection data */
1614 }
1615
1616 if (!(e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished))))
1617 return;
1618 e->win = source->win;
1619 e->target = source->dest;
1620 e->completed = completed;
1621 if (source->version >= 5)
1622 {
1623 source->accepted_action = ev->data.data32[2];
1624 e->action = source->accepted_action;
1625 }
1626 else
1627 {
1628 source->accepted_action = 0;
1629 e->action = source->action;
1630 }
1631 ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
1632 }
1633 else if (ev->type == ECORE_X_ATOM_NET_WM_STATE)
1634 {
1635 Ecore_X_Event_Window_State_Request *e;
1636
1637 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request))))
1638 return;
1639 e->win = ev->window;
1640 if (ev->data.data32[0] == 0)
1641 e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
1642 else if (ev->data.data32[0] == 1)
1643 e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
1644 else if (ev->data.data32[0] == 2)
1645 e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
1646 else
1647 {
1648 free(e);
1649 return;
1650 }
1651 e->state[0] = _ecore_xcb_netwm_window_state_get(ev->data.data32[1]);
1652 if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
1653 {
1654 /* FIXME */
1655 }
1656 e->state[1] = _ecore_xcb_netwm_window_state_get(ev->data.data32[2]);
1657 if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
1658 {
1659 /* FIXME */
1660 }
1661 e->source = ev->data.data32[3];
1662 ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
1663 }
1664#ifdef OLD_XCB_VERSION
1665 else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) &&
1666 (ev->format == 32) && (ev->data.data32[0] == XCB_WM_STATE_ICONIC))
1667#else
1668 else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && (ev->format == 32) &&
1669 (ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC))
1670#endif
1671 {
1672 Ecore_X_Event_Window_State_Request *e;
1673
1674 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request))))
1675 return;
1676 e->win = ev->window;
1677 e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
1678 e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
1679 ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
1680 }
1681 else if ((ev->type == ECORE_X_ATOM_NET_WM_DESKTOP) && (ev->format == 32))
1682 {
1683 Ecore_X_Event_Desktop_Change *e;
1684
1685 if (!(e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change))))
1686 return;
1687 e->win = ev->window;
1688 e->desk = ev->data.data32[0];
1689 e->source = ev->data.data32[1];
1690 ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
1691 }
1692 else if (ev->type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS)
1693 {
1694 Ecore_X_Event_Frame_Extents_Request *e;
1695
1696 if (!(e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request))))
1697 return;
1698 e->win = ev->window;
1699 ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
1700 }
1701 else if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS) &&
1702 ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING) &&
1703 (ev->format == 32))
1704 {
1705 Ecore_X_Event_Ping *e;
1706 Ecore_X_Window root = 0;
1707 int count = 0;
1708
1709 if (!(e = calloc(1, sizeof(Ecore_X_Event_Ping)))) return;
1710 e->win = ev->window;
1711 e->time = ev->data.data32[1];
1712 e->event_win = ev->data.data32[2];
1713 ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
1714
1715 CHECK_XCB_CONN;
1716
1717 count = xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn));
1718 if (count > 1)
1719 root = ecore_x_window_root_get(e->win);
1720 else
1721 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1722
1723 if (ev->window != root)
1724 {
1725 ev->window = root;
1726 xcb_send_event(_ecore_xcb_conn, 0, root,
1727 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
1728 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY),
1729 (const char *)&ev);
1730// ecore_x_flush();
1731 }
1732 }
1733 else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
1734 (ev->format == 8))
1735 {
1736 _ecore_xcb_netwm_startup_info_begin(ev->window, ev->data.data8[0]);
1737 }
1738 else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO) && (ev->format == 8))
1739 {
1740 _ecore_xcb_netwm_startup_info(ev->window, ev->data.data8[0]);
1741 }
1742 else if ((ev->type == 27777) && (ev->data.data32[0] == 0x7162534) &&
1743 (ev->format == 32)) // && (ev->window = _private_window))
1744 {
1745 if (ev->data.data32[1] == 0x10000001)
1746 _ecore_xcb_window_button_grab_remove(ev->data.data32[2]);
1747 else if (ev->data.data32[1] == 0x10000002)
1748 _ecore_xcb_window_key_grab_remove(ev->data.data32[2]);
1749 }
1750 else
1751 {
1752 Ecore_X_Event_Client_Message *e;
1753 int i = 0;
1754
1755 if (!(e = calloc(1, sizeof(Ecore_X_Event_Client_Message))))
1756 return;
1757
1758 e->win = ev->window;
1759 e->message_type = ev->type;
1760 e->format = ev->format;
1761 for (i = 0; i < 5; i++)
1762 e->data.l[i] = ev->data.data32[i];
1763 ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
1764 }
1765}
1766
1767static void
1768_ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event)
1769{
1770 xcb_mapping_notify_event_t *ev;
1771 Ecore_X_Event_Mapping_Change *e;
1772
1773 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1774
1775 ev = (xcb_mapping_notify_event_t *)event;
1776 if (!(e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)))) return;
1777
1778 _ecore_xcb_keymap_refresh(ev);
1779 _ecore_xcb_modifiers_get();
1780
1781 switch (ev->request)
1782 {
1783 case XCB_MAPPING_MODIFIER:
1784 e->type = ECORE_X_MAPPING_MODIFIER;
1785 break;
1786
1787 case XCB_MAPPING_KEYBOARD:
1788 e->type = ECORE_X_MAPPING_KEYBOARD;
1789 break;
1790
1791 case XCB_MAPPING_POINTER:
1792 default:
1793 e->type = ECORE_X_MAPPING_MOUSE;
1794 break;
1795 }
1796 e->keycode = ev->first_keycode;
1797 e->num = ev->count;
1798
1799 ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL);
1800}
1801
1802static void
1803_ecore_xcb_event_handle_damage_notify(xcb_generic_event_t *event)
1804{
1805#ifdef ECORE_XCB_DAMAGE
1806 xcb_damage_notify_event_t *ev;
1807 Ecore_X_Event_Damage *e;
1808#endif
1809
1810 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1811
1812 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1813#ifdef ECORE_XCB_DAMAGE
1814 ev = (xcb_damage_notify_event_t *)event;
1815 if (!(e = calloc(1, sizeof(Ecore_X_Event_Damage)))) return;
1816
1817 e->level = ev->level;
1818 e->drawable = ev->drawable;
1819 e->damage = ev->damage;
1820 e->time = ev->timestamp;
1821 e->area.x = ev->area.x;
1822 e->area.y = ev->area.y;
1823 e->area.width = ev->area.width;
1824 e->area.height = ev->area.height;
1825 e->geometry.x = ev->geometry.x;
1826 e->geometry.y = ev->geometry.y;
1827 e->geometry.width = ev->geometry.width;
1828 e->geometry.height = ev->geometry.height;
1829
1830 ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);
1831#endif
1832}
1833
1834static void
1835_ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event)
1836{
1837#ifdef ECORE_XCB_RANDR
1838 xcb_randr_screen_change_notify_event_t *ev;
1839 Ecore_X_Event_Screen_Change *e;
1840#endif
1841
1842 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1843#ifdef ECORE_XCB_RANDR
1844 ev = (xcb_randr_screen_change_notify_event_t *)event;
1845 if (!(e = calloc(1, sizeof(Ecore_X_Event_Screen_Change)))) return;
1846
1847 e->win = ev->request_window;
1848 e->root = ev->root;
1849 e->size.width = ev->width;
1850 e->size.height = ev->height;
1851 e->time = ev->timestamp;
1852 e->config_time = ev->config_timestamp;
1853 e->size.width_mm = ev->mwidth;
1854 e->size.height_mm = ev->mheight;
1855 e->orientation = ev->rotation;
1856 e->subpixel_order = ev->subpixel_order;
1857
1858 ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL);
1859#endif
1860}
1861
1862static void
1863_ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event)
1864{
1865#ifdef ECORE_XCB_RANDR
1866 xcb_randr_notify_event_t *ev;
1867#endif
1868
1869 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1870#ifdef ECORE_XCB_RANDR
1871 ev = (xcb_randr_notify_event_t *)event;
1872 switch (ev->subCode)
1873 {
1874 case XCB_RANDR_NOTIFY_CRTC_CHANGE:
1875 _ecore_xcb_event_handle_randr_crtc_change(event);
1876 break;
1877
1878 case XCB_RANDR_NOTIFY_OUTPUT_CHANGE:
1879 _ecore_xcb_event_handle_randr_output_change(event);
1880 break;
1881
1882 case XCB_RANDR_NOTIFY_OUTPUT_PROPERTY:
1883 _ecore_xcb_event_handle_randr_output_property_change(event);
1884 break;
1885
1886 default:
1887 break;
1888 }
1889#endif
1890}
1891
1892static void
1893_ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event)
1894{
1895#ifdef ECORE_XCB_RANDR
1896 xcb_randr_notify_event_t *ev;
1897 Ecore_X_Event_Randr_Crtc_Change *e;
1898#endif
1899
1900#ifdef ECORE_XCB_RANDR
1901 ev = (xcb_randr_notify_event_t *)event;
1902 if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change))))
1903 return;
1904
1905 e->win = ev->u.cc.window;
1906 e->crtc = ev->u.cc.crtc;
1907 e->mode = ev->u.cc.mode;
1908 e->orientation = ev->u.cc.rotation;
1909 e->geo.x = ev->u.cc.x;
1910 e->geo.y = ev->u.cc.y;
1911 e->geo.w = ev->u.cc.width;
1912 e->geo.h = ev->u.cc.height;
1913
1914 ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL);
1915#endif
1916}
1917
1918static void
1919_ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event)
1920{
1921#ifdef ECORE_XCB_RANDR
1922 xcb_randr_notify_event_t *ev;
1923 Ecore_X_Event_Randr_Output_Change *e;
1924#endif
1925
1926#ifdef ECORE_XCB_RANDR
1927 ev = (xcb_randr_notify_event_t *)event;
1928 if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change))))
1929 return;
1930
1931 e->win = ev->u.oc.window;
1932 e->output = ev->u.oc.output;
1933 e->crtc = ev->u.oc.crtc;
1934 e->mode = ev->u.oc.mode;
1935 e->orientation = ev->u.oc.rotation;
1936 e->connection = ev->u.oc.connection;
1937 e->subpixel_order = ev->u.oc.subpixel_order;
1938
1939 ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL);
1940#endif
1941}
1942
1943static void
1944_ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event)
1945{
1946#ifdef ECORE_XCB_RANDR
1947 xcb_randr_notify_event_t *ev;
1948 Ecore_X_Event_Randr_Output_Property_Notify *e;
1949#endif
1950
1951#ifdef ECORE_XCB_RANDR
1952 ev = (xcb_randr_notify_event_t *)event;
1953 if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify))))
1954 return;
1955
1956 e->win = ev->u.op.window;
1957 e->output = ev->u.op.output;
1958 e->property = ev->u.op.atom;
1959 e->time = ev->u.op.timestamp;
1960 if (ev->u.op.status == XCB_PROPERTY_NEW_VALUE)
1961 e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD;
1962 else
1963 e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL;
1964
1965 ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL);
1966#endif
1967}
1968
1969static void
1970_ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event)
1971{
1972#ifdef ECORE_XCB_SCREENSAVER
1973 xcb_screensaver_notify_event_t *ev;
1974 Ecore_X_Event_Screensaver_Notify *e;
1975#endif
1976
1977 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
1978#ifdef ECORE_XCB_SCREENSAVER
1979 ev = (xcb_screensaver_notify_event_t *)event;
1980 if (!(e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify)))) return;
1981
1982 e->win = ev->window;
1983 e->on = EINA_FALSE;
1984 if (ev->state == XCB_SCREENSAVER_STATE_ON) e->on = EINA_TRUE;
1985 e->time = ev->time;
1986
1987 ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
1988#endif
1989}
1990
1991#ifdef ECORE_XCB_XGESTURE
1992static void
1993_ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event)
1994{
1995 xcb_gesture_notify_flick_event_t *ev;
1996 Ecore_X_Event_Gesture_Notify_Flick *e;
1997
1998 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1999 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2000 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2001
2002 ev = (xcb_gesture_notify_flick_event_t *)event;
2003 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)))) return;
2004
2005 e->win = ev->window;
2006 e->time = ev->time;
2007 e->subtype = ev->kind;
2008 e->num_fingers = ev->num_finger;
2009 e->distance = ev->distance;
2010 e->duration = ev->duration;
2011 e->direction = ev->direction;
2012 e->angle = XFixedToDouble(ev->angle);
2013
2014 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL);
2015}
2016
2017static void
2018_ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event)
2019{
2020 xcb_gesture_notify_pan_event_t *ev;
2021 Ecore_X_Event_Gesture_Notify_Pan *e;
2022
2023 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2024 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2025 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2026
2027 ev = (xcb_gesture_notify_pan_event_t *)event;
2028 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)))) return;
2029
2030 e->win = ev->window;
2031 e->time = ev->time;
2032 e->subtype = ev->kind;
2033 e->num_fingers = ev->num_finger;
2034 e->dx = ev->dx;
2035 e->dy = ev->dy;
2036 e->distance = ev->distance;
2037 e->duration = ev->duration;
2038 e->direction = ev->direction;
2039
2040 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL);
2041}
2042
2043static void
2044_ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event)
2045{
2046 xcb_gesture_notify_pinch_rotation_event_t *ev;
2047 Ecore_X_Event_Gesture_Notify_PinchRotation *e;
2048
2049 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2050 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2051 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2052
2053 ev = (xcb_gesture_notify_pinch_rotation_event_t *)event;
2054 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)))) return;
2055
2056 e->win = ev->window;
2057 e->time = ev->time;
2058 e->subtype = ev->kind;
2059 e->num_fingers = ev->num_finger;
2060 e->distance = ev->distance;
2061 e->cx = ev->cx;
2062 e->cy = ev->cy;
2063 e->zoom = XFixedToDouble(ev->zoom);
2064 e->angle = XFixedToDouble(ev->angle);
2065
2066 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL);
2067}
2068
2069static void
2070_ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event)
2071{
2072 xcb_gesture_notify_tap_event_t *ev;
2073 Ecore_X_Event_Gesture_Notify_Tap *e;
2074
2075 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2076 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2077 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2078
2079 ev = (xcb_gesture_notify_tap_event_t *)event;
2080 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)))) return;
2081
2082 e->win = ev->window;
2083 e->time = ev->time;
2084 e->subtype = ev->kind;
2085 e->num_fingers = ev->num_finger;
2086 e->cx = ev->cx;
2087 e->cy = ev->cy;
2088 e->tap_repeat = ev->tap_repeat;
2089 e->interval = ev->interval;
2090
2091 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL);
2092}
2093
2094static void
2095_ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event)
2096{
2097 xcb_gesture_notify_tap_n_hold_event_t *ev;
2098 Ecore_X_Event_Gesture_Notify_TapNHold *e;
2099
2100 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2101 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2102 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2103
2104 ev = (xcb_gesture_notify_tap_n_hold_event_t *)event;
2105 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)))) return;
2106
2107 e->win = ev->window;
2108 e->time = ev->time;
2109 e->subtype = ev->kind;
2110 e->num_fingers = ev->num_finger;
2111 e->cx = ev->cx;
2112 e->cy = ev->cy;
2113 e->interval = ev->interval;
2114 e->hold_time = ev->holdtime;
2115
2116 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL);
2117}
2118
2119static void
2120 _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event)
2121{
2122 xcb_gesture_notify_hold_event_t *ev;
2123 Ecore_X_Event_Gesture_Notify_Hold *e;
2124
2125 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2126 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2127 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2128
2129 ev = (xcb_gesture_notify_hold_event_t *)event;
2130 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)))) return;
2131
2132 e->win = ev->window;
2133 e->time = ev->time;
2134 e->subtype = ev->kind;
2135 e->num_fingers = ev->num_finger;
2136 e->cx = ev->cx;
2137 e->cy = ev->cy;
2138 e->hold_time = ev->holdtime;
2139
2140 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL);
2141}
2142
2143static void
2144 _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event)
2145{
2146 xcb_gesture_notify_group_event_t *ev;
2147 Ecore_X_Event_Gesture_Notify_Group *e;
2148
2149 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2150 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2151 fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
2152
2153 ev = (xcb_gesture_notify_group_event_t *)event;
2154 if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)))) return;
2155
2156 e->win = ev->window;
2157 e->time = ev->time;
2158 e->subtype = ev->kind;
2159 e->num_groups = ev->num_group;
2160 e->group_id = ev->groupid;
2161
2162 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL);
2163}
2164#endif
2165
2166#ifdef ECORE_XCB_SHAPE
2167static void
2168_ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event)
2169{
2170 xcb_shape_notify_event_t *ev;
2171 Ecore_X_Event_Window_Shape *e;
2172
2173 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2174 ev = (xcb_shape_notify_event_t *)event;
2175 if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)))) return;
2176
2177 e->win = ev->affected_window;
2178 e->time = ev->server_time;
2179 switch (ev->shape_kind)
2180 {
2181 case XCB_SHAPE_SK_BOUNDING:
2182 e->type = ECORE_X_SHAPE_BOUNDING;
2183 break;
2184
2185 case XCB_SHAPE_SK_CLIP:
2186 e->type = ECORE_X_SHAPE_CLIP;
2187 break;
2188
2189 case XCB_SHAPE_SK_INPUT:
2190 e->type = ECORE_X_SHAPE_INPUT;
2191 break;
2192
2193 default:
2194 break;
2195 }
2196 e->x = ev->extents_x;
2197 e->y = ev->extents_y;
2198 e->w = ev->extents_width;
2199 e->h = ev->extents_height;
2200 e->shaped = ev->shaped;
2201
2202 ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
2203}
2204
2205#endif
2206
2207static void
2208_ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event)
2209{
2210#ifdef ECORE_XCB_SYNC
2211 xcb_sync_counter_notify_event_t *ev;
2212 Ecore_X_Event_Sync_Counter *e;
2213#endif
2214
2215 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2216
2217#ifdef ECORE_XCB_SYNC
2218 ev = (xcb_sync_counter_notify_event_t *)event;
2219 if (!(e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)))) return;
2220
2221 e->time = ev->timestamp;
2222
2223 ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
2224#endif
2225}
2226
2227static void
2228_ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event)
2229{
2230#ifdef ECORE_XCB_SYNC
2231 xcb_sync_alarm_notify_event_t *ev;
2232 Ecore_X_Event_Sync_Alarm *e;
2233#endif
2234
2235 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2236#ifdef ECORE_XCB_SYNC
2237 ev = (xcb_sync_alarm_notify_event_t *)event;
2238 if (!(e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)))) return;
2239
2240 e->time = ev->timestamp;
2241 e->alarm = ev->alarm;
2242
2243 ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
2244#endif
2245}
2246
2247static void
2248_ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event)
2249{
2250#ifdef ECORE_XCB_XFIXES
2251 Ecore_X_Event_Fixes_Selection_Notify *e;
2252 Ecore_X_Atom sel;
2253 xcb_xfixes_selection_notify_event_t *ev;
2254#endif
2255
2256 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2257#ifdef ECORE_XCB_XFIXES
2258 ev = (xcb_xfixes_selection_notify_event_t *)event;
2259
2260 if (!(e = calloc(1, sizeof(*e)))) return;
2261
2262 e->win = ev->window;
2263 e->owner = ev->owner;
2264 e->time = ev->timestamp;
2265 e->selection_time = ev->selection_timestamp;
2266 e->atom = sel = ev->selection;
2267 if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
2268 e->selection = ECORE_X_SELECTION_PRIMARY;
2269 else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
2270 e->selection = ECORE_X_SELECTION_SECONDARY;
2271 else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
2272 e->selection = ECORE_X_SELECTION_CLIPBOARD;
2273 else
2274 e->selection = ECORE_X_SELECTION_OTHER;
2275 e->reason = ev->subtype;
2276
2277 ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL);
2278#endif
2279}
2280
2281static void
2282_ecore_xcb_event_handle_xfixes_cursor_notify(xcb_generic_event_t *event __UNUSED__)
2283{
2284 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2285// FIXME: TBD
2286}
2287
2288static void
2289_ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event)
2290{
2291 xcb_ge_event_t *ev;
2292 Ecore_X_Event_Generic *e;
2293
2294 ev = (xcb_ge_event_t *)event;
2295
2296 /* pad0 *IS* extension - bug in xcb */
2297 if (ev->pad0 == _ecore_xcb_event_input)
2298 {
2299 _ecore_xcb_event_handle_input_event(event);
2300// FIXME: should we generate generic events as WELL as input events?
2301// return;
2302 }
2303
2304 if (!(e = calloc(1, sizeof(Ecore_X_Event_Generic))))
2305 return;
2306
2307 DBG("Handle Generic Event: %d", ev->event_type);
2308
2309 e->cookie = ev->sequence;
2310 /* NB: These are bugs in xcb ge_event structure. The struct should have a
2311 * field for extension & data, but does not.
2312 *
2313 * XCB people have been notified of this issue */
2314 e->extension = ev->pad0;
2315 /* e->data = ev->pad1; */
2316 if (ev->length > 0)
2317 {
2318 int len = ev->length * sizeof(int);
2319 e->data = malloc(len);
2320 if (e->data) memcpy(e->data, &(event[1]), len);
2321 }
2322
2323 e->evtype = ev->event_type;
2324
2325 ecore_event_add(ECORE_X_EVENT_GENERIC, e,
2326 _ecore_xcb_event_generic_event_free, e->data);
2327}
2328
2329static void
2330_ecore_xcb_event_handle_input_event(xcb_generic_event_t *event)
2331{
2332 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2333
2334 _ecore_xcb_input_handle_event(event);
2335}
2336
2337static void
2338_ecore_xcb_event_key_press(xcb_generic_event_t *event)
2339{
2340 Ecore_Event_Key *e;
2341 xcb_keysym_t sym = XCB_NO_SYMBOL;
2342 xcb_keycode_t keycode = 0;
2343 xcb_key_press_event_t *xevent;
2344 char *keyname = NULL, *key = NULL;
2345 char *compose = NULL;
2346 char compose_buffer[256];
2347 int val = 0;
2348
2349 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2350
2351 xevent = (xcb_key_press_event_t *)event;
2352 keycode = xevent->detail;
2353
2354 sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, xevent->state);
2355 keyname = _ecore_xcb_keymap_keysym_to_string(sym);
2356 if (!keyname)
2357 {
2358 char buff[256];
2359
2360 snprintf(buff, sizeof(buff), "Keycode-%i", keycode);
2361 keyname = buff;
2362 }
2363
2364 val =
2365 _ecore_xcb_keymap_lookup_string(keycode, xevent->state, compose_buffer,
2366 sizeof(compose_buffer), &sym);
2367 if (val > 0)
2368 {
2369 compose_buffer[val] = 0;
2370 compose =
2371 eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
2372 if (!compose)
2373 ERR("Ecore_X cannot convert input key string '%s' to UTF-8. "
2374 "Is Eina built with iconv support?", compose_buffer);
2375 }
2376
2377 key = _ecore_xcb_keymap_keysym_to_string(sym);
2378 if (!key) key = keyname;
2379
2380 e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
2381 (compose ? strlen(compose) : 0) + 3);
2382 if (e)
2383 {
2384 e->keyname = (char *)(e + 1);
2385 e->key = e->keyname + strlen(keyname) + 1;
2386
2387 e->compose = NULL;
2388 if (compose) e->compose = (e->key + strlen(key) + 1);
2389 e->string = e->compose;
2390
2391 strcpy((char *)e->keyname, keyname);
2392 strcpy((char *)e->key, key);
2393 if (compose) strcpy((char *)e->compose, compose);
2394
2395 e->modifiers = _ecore_xcb_events_modifiers_get(xevent->state);
2396 e->timestamp = xevent->time;
2397 e->window = xevent->child ? xevent->child : xevent->event;
2398 e->event_window = xevent->event;
2399 e->same_screen = xevent->same_screen;
2400 e->root_window = xevent->root;
2401
2402 DBG("Sending Key Down Event: %s", e->keyname);
2403 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
2404 }
2405 _ecore_xcb_event_last_time = xevent->time;
2406}
2407
2408static void
2409_ecore_xcb_event_key_release(xcb_generic_event_t *event)
2410{
2411 Ecore_Event_Key *e;
2412 xcb_keysym_t sym = XCB_NO_SYMBOL;
2413 xcb_keycode_t keycode = 0;
2414 xcb_key_release_event_t *xevent;
2415 char *keyname = NULL, *key = NULL;
2416 char *compose = NULL;
2417 char compose_buffer[256];
2418 int val = 0;
2419
2420 _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2421
2422 xevent = (xcb_key_release_event_t *)event;
2423 keycode = xevent->detail;
2424
2425 sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, xevent->state);
2426 keyname = _ecore_xcb_keymap_keysym_to_string(sym);
2427 if (!keyname)
2428 {
2429 char buff[256];
2430
2431 snprintf(buff, sizeof(buff), "Keycode-%i", keycode);
2432 keyname = buff;
2433 }
2434
2435 val =
2436 _ecore_xcb_keymap_lookup_string(keycode, xevent->state, compose_buffer,
2437 sizeof(compose_buffer), &sym);
2438 if (val > 0)
2439 {
2440 compose_buffer[val] = 0;
2441 compose =
2442 eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
2443// tmp = compose;
2444 }
2445
2446 key = _ecore_xcb_keymap_keysym_to_string(sym);
2447 if (!key) key = keyname;
2448
2449 e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
2450 (compose ? strlen(compose) : 0) + 3);
2451 if (e)
2452 {
2453 e->keyname = (char *)(e + 1);
2454 e->key = e->keyname + strlen(keyname) + 1;
2455
2456 e->compose = NULL;
2457 if (compose) e->compose = (e->key + strlen(key) + 1);
2458 e->string = e->compose;
2459
2460 strcpy((char *)e->keyname, keyname);
2461 strcpy((char *)e->key, key);
2462 if (compose) strcpy((char *)e->compose, compose);
2463
2464 e->modifiers = _ecore_xcb_events_modifiers_get(xevent->state);
2465 e->timestamp = xevent->time;
2466 e->window = xevent->child ? xevent->child : xevent->event;
2467 e->event_window = xevent->event;
2468 e->same_screen = xevent->same_screen;
2469 e->root_window = xevent->root;
2470
2471 ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
2472 }
2473 _ecore_xcb_event_last_time = xevent->time;
2474}
2475
2476void
2477_ecore_xcb_event_mouse_move(uint16_t timestamp,
2478 uint16_t modifiers,
2479 int16_t x,
2480 int16_t y,
2481 int16_t root_x,
2482 int16_t root_y,
2483 xcb_window_t event_win,
2484 xcb_window_t win,
2485 xcb_window_t root_win,
2486 uint8_t same_screen,
2487 int dev,
2488 double radx,
2489 double rady,
2490 double pressure,
2491 double angle,
2492 int16_t mx,
2493 int16_t my,
2494 int16_t mrx,
2495 int16_t mry)
2496{
2497 Ecore_Event_Mouse_Move *e;
2498 Ecore_Event *event;
2499
2500 if (!(e = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
2501
2502 e->window = win;
2503 e->root_window = root_win;
2504 e->timestamp = timestamp;
2505 e->same_screen = same_screen;
2506 e->event_window = event_win;
2507 e->modifiers = _ecore_xcb_events_modifiers_get(modifiers);
2508 e->x = x;
2509 e->y = y;
2510 e->root.x = root_x;
2511 e->root.y = root_y;
2512 e->multi.device = dev;
2513 e->multi.radius = ((radx + rady) / 2);
2514 e->multi.radius_x = radx;
2515 e->multi.radius_y = rady;
2516 e->multi.pressure = pressure;
2517 e->multi.angle = angle;
2518 e->multi.x = mx;
2519 e->multi.y = my;
2520 e->multi.root.x = mrx;
2521 e->multi.root.y = mry;
2522
2523 event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e,
2524 _ecore_xcb_event_mouse_move_free, NULL);
2525
2526 _ecore_xcb_event_last_time = e->timestamp;
2527 _ecore_xcb_event_last_window = e->window;
2528 _ecore_xcb_event_last_root_x = root_x;
2529 _ecore_xcb_event_last_root_y = root_y;
2530// _ecore_xcb_event_last_mouse_move_event = event;
2531}
2532
2533static void
2534_ecore_xcb_event_mouse_move_free(void *data __UNUSED__,
2535 void *event)
2536{
2537 Ecore_Event_Mouse_Move *ev;
2538
2539 ev = event;
2540// if (_ecore_xcb_event_last_mouse_move_event)
2541// {
2542// _ecore_xcb_event_last_mouse_move = EINA_FALSE;
2543// _ecore_xcb_event_last_mouse_move_event = NULL;
2544// }
2545 if (ev) free(ev);
2546}
2547
2548Ecore_Event_Mouse_Button *
2549_ecore_xcb_event_mouse_button(int event,
2550 uint16_t timestamp,
2551 uint16_t modifiers,
2552 xcb_button_t buttons,
2553 int16_t x,
2554 int16_t y,
2555 int16_t root_x,
2556 int16_t root_y,
2557 xcb_window_t event_win,
2558 xcb_window_t win,
2559 xcb_window_t root_win,
2560 uint8_t same_screen,
2561 int dev,
2562 double radx,
2563 double rady,
2564 double pressure,
2565 double angle,
2566 int16_t mx,
2567 int16_t my,
2568 int16_t mrx,
2569 int16_t mry)
2570{
2571 Ecore_Event_Mouse_Button *e;
2572 Ecore_X_Mouse_Down_Info *info = NULL;
2573
2574 if (!(e = malloc(sizeof(Ecore_Event_Mouse_Button)))) return NULL;
2575
2576 e->window = win;
2577 e->root_window = root_win;
2578 e->timestamp = timestamp;
2579 e->same_screen = same_screen;
2580 e->event_window = event_win;
2581 e->buttons = buttons;
2582 e->modifiers = _ecore_xcb_events_modifiers_get(modifiers);
2583 e->double_click = 0;
2584 e->triple_click = 0;
2585 e->x = x;
2586 e->y = y;
2587 e->root.x = root_x;
2588 e->root.y = root_y;
2589
2590 if ((info = _ecore_xcb_event_mouse_down_info_get(dev)))
2591 {
2592 if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
2593 (info->did_triple))
2594 {
2595 info->last_win = 0;
2596 info->last_last_win = 0;
2597 info->last_event_win = 0;
2598 info->last_time = 0;
2599 info->last_last_time = 0;
2600 }
2601 if (event_win == win)
2602 {
2603 if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
2604 {
2605 if (((int)(timestamp - info->last_time) <=
2606 (int)(1000 * _ecore_xcb_double_click_time)) &&
2607 (win == info->last_win) &&
2608 (event_win == info->last_event_win))
2609 {
2610 e->double_click = 1;
2611 info->did_double = EINA_TRUE;
2612 }
2613 else
2614 {
2615 info->did_double = EINA_FALSE;
2616 info->did_triple = EINA_FALSE;
2617 }
2618 if (((int)(timestamp - info->last_last_time) <=
2619 (int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
2620 (win == info->last_win) &&
2621 (win == info->last_last_win) &&
2622 (event_win == info->last_event_win) &&
2623 (event_win == info->last_last_event_win))
2624 {
2625 e->triple_click = 1;
2626 info->did_triple = EINA_TRUE;
2627 }
2628 else
2629 info->did_triple = EINA_FALSE;
2630 }
2631 else
2632 {
2633 if (info->did_double) e->double_click = 1;
2634 if (info->did_triple) e->triple_click = 1;
2635 }
2636 }
2637 }
2638
2639 /* NB: Comment out right now because _ecore_xcb_mouse_up_count is
2640 * only used here...nowhere else in the code */
2641
2642 /* if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && */
2643 /* (!e->double_click) && (!e->triple_click)) */
2644 /* _ecore_xcb_mouse_up_count = 0; */
2645
2646 e->multi.device = dev;
2647 e->multi.radius = ((radx + rady) / 2);
2648 e->multi.radius_x = radx;
2649 e->multi.radius_y = rady;
2650 e->multi.pressure = pressure;
2651 e->multi.angle = angle;
2652 e->multi.x = mx;
2653 e->multi.y = my;
2654 e->multi.root.x = mrx;
2655 e->multi.root.y = mry;
2656
2657 _ecore_xcb_event_last_time = e->timestamp;
2658 _ecore_xcb_event_last_window = e->window;
2659 _ecore_xcb_event_last_root_x = root_x;
2660 _ecore_xcb_event_last_root_y = root_y;
2661
2662 ecore_event_add(event, e, NULL, NULL);
2663
2664 if ((info) && (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
2665 (win == event_win) && (!info->did_triple))
2666 {
2667 info->last_last_win = info->last_win;
2668 info->last_win = win;
2669 info->last_last_event_win = info->last_event_win;
2670 info->last_event_win = event_win;
2671 info->last_last_time = info->last_time;
2672 info->last_time = timestamp;
2673 }
2674
2675 return e;
2676}
2677
2678static Ecore_X_Event_Mode
2679_ecore_xcb_event_mode_get(uint8_t mode)
2680{
2681 switch (mode)
2682 {
2683 case XCB_NOTIFY_MODE_NORMAL:
2684 return ECORE_X_EVENT_MODE_NORMAL;
2685
2686 case XCB_NOTIFY_MODE_WHILE_GRABBED:
2687 return ECORE_X_EVENT_MODE_WHILE_GRABBED;
2688
2689 case XCB_NOTIFY_MODE_GRAB:
2690 return ECORE_X_EVENT_MODE_GRAB;
2691
2692 case XCB_NOTIFY_MODE_UNGRAB:
2693 return ECORE_X_EVENT_MODE_UNGRAB;
2694
2695 default:
2696 return ECORE_X_EVENT_MODE_NORMAL;
2697 }
2698}
2699
2700static Ecore_X_Event_Detail
2701_ecore_xcb_event_detail_get(uint8_t detail)
2702{
2703 switch (detail)
2704 {
2705 case XCB_NOTIFY_DETAIL_ANCESTOR:
2706 return ECORE_X_EVENT_DETAIL_ANCESTOR;
2707
2708 case XCB_NOTIFY_DETAIL_VIRTUAL:
2709 return ECORE_X_EVENT_DETAIL_VIRTUAL;
2710
2711 case XCB_NOTIFY_DETAIL_INFERIOR:
2712 return ECORE_X_EVENT_DETAIL_INFERIOR;
2713
2714 case XCB_NOTIFY_DETAIL_NONLINEAR:
2715 return ECORE_X_EVENT_DETAIL_NON_LINEAR;
2716
2717 case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
2718 return ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
2719
2720 case XCB_NOTIFY_DETAIL_POINTER:
2721 return ECORE_X_EVENT_DETAIL_POINTER;
2722
2723 case XCB_NOTIFY_DETAIL_POINTER_ROOT:
2724 return ECORE_X_EVENT_DETAIL_POINTER_ROOT;
2725
2726 case XCB_NOTIFY_DETAIL_NONE:
2727 default:
2728 return ECORE_X_EVENT_DETAIL_ANCESTOR;
2729 }
2730}
2731
2732static void
2733_ecore_xcb_event_xdnd_enter_free(void *data __UNUSED__,
2734 void *event)
2735{
2736 Ecore_X_Event_Xdnd_Enter *e;
2737 int i = 0;
2738
2739 e = event;
2740 for (i = 0; i < e->num_types; i++)
2741 free(e->types[i]);
2742 free(e->types);
2743 free(e);
2744}
2745
2746static void
2747_ecore_xcb_event_selection_notify_free(void *data __UNUSED__,
2748 void *event)
2749{
2750 Ecore_X_Event_Selection_Notify *e;
2751 Ecore_X_Selection_Data *sel;
2752
2753 e = event;
2754 if (!(sel = e->data)) return;
2755 if (sel->free) sel->free(sel);
2756 free(e->target);
2757 free(e);
2758}
2759
2760static void
2761_ecore_xcb_event_generic_event_free(void *data,
2762 void *event)
2763{
2764 Ecore_X_Event_Generic *e;
2765
2766 e = (Ecore_X_Event_Generic *)event;
2767 if (e->data) free(data);
2768 free(e);
2769}
2770
2771static void
2772_ecore_xcb_event_mouse_down_info_clear(void)
2773{
2774 Eina_Inlist *l;
2775 Ecore_X_Mouse_Down_Info *info = NULL;
2776
2777 l = _ecore_xcb_mouse_down_info_list;
2778 while (l)
2779 {
2780 info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info);
2781 l = eina_inlist_remove(l, l);
2782 free(info);
2783 }
2784 _ecore_xcb_mouse_down_info_list = NULL;
2785}
2786
2787static Ecore_X_Mouse_Down_Info *
2788_ecore_xcb_event_mouse_down_info_get(int dev)
2789{
2790 Eina_Inlist *l;
2791 Ecore_X_Mouse_Down_Info *info = NULL;
2792
2793 l = _ecore_xcb_mouse_down_info_list;
2794 EINA_INLIST_FOREACH(l, info)
2795 if (info->dev == dev) return info;
2796
2797 if (!(info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)))) return NULL;
2798
2799 info->dev = dev;
2800 l = eina_inlist_append(l, (Eina_Inlist *)info);
2801 _ecore_xcb_mouse_down_info_list = l;
2802
2803 return info;
2804}
2805
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
deleted file mode 100644
index 40c10ac..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_extensions.c
+++ /dev/null
@@ -1,148 +0,0 @@
1#include "ecore_xcb_private.h"
2
3void
4_ecore_xcb_extensions_init(void)
5{
6 LOGFN(__FILE__, __LINE__, __FUNCTION__);
7
8 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_big_requests_id);
9 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shm_id);
10
11#ifdef ECORE_XCB_SHAPE
12 _ecore_xcb_shape_init();
13#endif
14
15#ifdef ECORE_XCB_SCREENSAVER
16 _ecore_xcb_screensaver_init();
17#endif
18
19#ifdef ECORE_XCB_SYNC
20 _ecore_xcb_sync_init();
21#endif
22
23#ifdef ECORE_XCB_RANDR
24 _ecore_xcb_randr_init();
25#endif
26
27#ifdef ECORE_XCB_XFIXES
28 _ecore_xcb_xfixes_init();
29#endif
30
31#ifdef ECORE_XCB_DAMAGE
32 _ecore_xcb_damage_init();
33#endif
34
35#ifdef ECORE_XCB_RENDER
36 _ecore_xcb_render_init();
37#endif
38
39#ifdef ECORE_XCB_COMPOSITE
40 _ecore_xcb_composite_init();
41#endif
42
43#ifdef ECORE_XCB_DPMS
44 _ecore_xcb_dpms_init();
45#endif
46
47#ifdef ECORE_XCB_DPMS
48 _ecore_xcb_dpms_init();
49#endif
50
51#ifdef ECORE_XCB_CURSOR
52 _ecore_xcb_cursor_init();
53#endif
54
55#ifdef ECORE_XCB_XINERAMA
56 _ecore_xcb_xinerama_init();
57#endif
58
59#ifdef ECORE_XCB_XINPUT
60 _ecore_xcb_input_init();
61#endif
62
63#ifdef ECORE_XCB_GESTURE
64 _ecore_xcb_gesture_init();
65#endif
66
67/* #ifdef ECORE_XCB_DRI */
68/* _ecore_xcb_dri_init(); */
69/* #endif */
70
71#ifdef ECORE_XCB_XTEST
72 _ecore_xcb_xtest_init();
73#endif
74
75 xcb_prefetch_maximum_request_length(_ecore_xcb_conn);
76}
77
78void
79_ecore_xcb_extensions_finalize(void)
80{
81 LOGFN(__FILE__, __LINE__, __FUNCTION__);
82
83 xcb_get_extension_data(_ecore_xcb_conn, &xcb_big_requests_id);
84 xcb_get_extension_data(_ecore_xcb_conn, &xcb_shm_id);
85
86#ifdef ECORE_XCB_SHAPE
87 _ecore_xcb_shape_finalize();
88#endif
89
90#ifdef ECORE_XCB_SCREENSAVER
91 _ecore_xcb_screensaver_finalize();
92#endif
93
94#ifdef ECORE_XCB_SYNC
95 _ecore_xcb_sync_finalize();
96#endif
97
98#ifdef ECORE_XCB_RANDR
99 _ecore_xcb_randr_finalize();
100#endif
101
102#ifdef ECORE_XCB_XFIXES
103 _ecore_xcb_xfixes_finalize();
104#endif
105
106#ifdef ECORE_XCB_DAMAGE
107 _ecore_xcb_damage_finalize();
108#endif
109
110#ifdef ECORE_XCB_RENDER
111 _ecore_xcb_render_finalize();
112#endif
113
114#ifdef ECORE_XCB_COMPOSITE
115 _ecore_xcb_composite_finalize();
116#endif
117
118#ifdef ECORE_XCB_DPMS
119 _ecore_xcb_dpms_finalize();
120#endif
121
122#ifdef ECORE_XCB_CURSOR
123 _ecore_xcb_cursor_finalize();
124#endif
125
126#ifdef ECORE_XCB_XINERAMA
127 _ecore_xcb_xinerama_finalize();
128#endif
129
130#ifdef ECORE_XCB_XINPUT
131 _ecore_xcb_input_finalize();
132#endif
133
134#ifdef ECORE_XCB_GESTURE
135 _ecore_xcb_gesture_finalize();
136#endif
137
138/* #ifdef ECORE_XCB_DRI */
139/* _ecore_xcb_dri_finalize(); */
140/* #endif */
141
142#ifdef ECORE_XCB_XTEST
143 _ecore_xcb_xtest_finalize();
144#endif
145
146 xcb_get_maximum_request_length(_ecore_xcb_conn);
147}
148
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
deleted file mode 100644
index d811b54..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c
+++ /dev/null
@@ -1,173 +0,0 @@
1#include "ecore_xcb_private.h"
2
3/**
4 * Creates a new default graphics context associated with the given
5 * drawable.
6 * @param draw Drawable to create graphics context with. If @c 0 is
7 * given instead, the default root window is used.
8 * @param value_mask Bitmask values.
9 * @param value_list List of values. The order of values must be the
10 * same than the corresponding bitmaks.
11 * @return The new default graphics context.
12 */
13EAPI Ecore_X_GC
14ecore_x_gc_new(Ecore_X_Drawable drawable,
15 Ecore_X_GC_Value_Mask value_mask,
16 const unsigned int *value_list)
17{
18 xcb_gcontext_t gc;
19 uint32_t vmask = 0;
20 int i = 0, mask = 0;
21
22 LOGFN(__FILE__, __LINE__, __FUNCTION__);
23 CHECK_XCB_CONN;
24
25 if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
26
27 for (i = 0, mask = 1; i <= 22; i++, mask <<= 1)
28 {
29 switch (mask & value_mask)
30 {
31 case ECORE_X_GC_VALUE_MASK_FUNCTION:
32 vmask |= XCB_GC_FUNCTION;
33 break;
34
35 case ECORE_X_GC_VALUE_MASK_PLANE_MASK:
36 vmask |= XCB_GC_PLANE_MASK;
37 break;
38
39 case ECORE_X_GC_VALUE_MASK_FOREGROUND:
40 vmask |= XCB_GC_FOREGROUND;
41 break;
42
43 case ECORE_X_GC_VALUE_MASK_BACKGROUND:
44 vmask |= XCB_GC_BACKGROUND;
45 break;
46
47 case ECORE_X_GC_VALUE_MASK_LINE_WIDTH:
48 vmask |= XCB_GC_LINE_WIDTH;
49 break;
50
51 case ECORE_X_GC_VALUE_MASK_LINE_STYLE:
52 vmask |= XCB_GC_LINE_STYLE;
53 break;
54
55 case ECORE_X_GC_VALUE_MASK_CAP_STYLE:
56 vmask |= XCB_GC_CAP_STYLE;
57 break;
58
59 case ECORE_X_GC_VALUE_MASK_JOIN_STYLE:
60 vmask |= XCB_GC_JOIN_STYLE;
61 break;
62
63 case ECORE_X_GC_VALUE_MASK_FILL_STYLE:
64 vmask |= XCB_GC_FILL_STYLE;
65 break;
66
67 case ECORE_X_GC_VALUE_MASK_FILL_RULE:
68 vmask |= XCB_GC_FILL_RULE;
69 break;
70
71 case ECORE_X_GC_VALUE_MASK_TILE:
72 vmask |= XCB_GC_TILE;
73 break;
74
75 case ECORE_X_GC_VALUE_MASK_STIPPLE:
76 vmask |= XCB_GC_STIPPLE;
77 break;
78
79 case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X:
80 vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_X;
81 break;
82
83 case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y:
84 vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_Y;
85 break;
86
87 case ECORE_X_GC_VALUE_MASK_FONT:
88 vmask |= XCB_GC_FONT;
89 break;
90
91 case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE:
92 vmask |= XCB_GC_SUBWINDOW_MODE;
93 break;
94
95 case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES:
96 vmask |= XCB_GC_GRAPHICS_EXPOSURES;
97 break;
98
99 case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X:
100 vmask |= XCB_GC_CLIP_ORIGIN_X;
101 break;
102
103 case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y:
104 vmask |= XCB_GC_CLIP_ORIGIN_Y;
105 break;
106
107 case ECORE_X_GC_VALUE_MASK_CLIP_MASK:
108 vmask |= XCB_GC_CLIP_MASK;
109 break;
110
111 case ECORE_X_GC_VALUE_MASK_DASH_OFFSET:
112 vmask |= XCB_GC_DASH_OFFSET;
113 break;
114
115 case ECORE_X_GC_VALUE_MASK_DASH_LIST:
116 vmask |= XCB_GC_DASH_LIST;
117 break;
118
119 case ECORE_X_GC_VALUE_MASK_ARC_MODE:
120 vmask |= XCB_GC_ARC_MODE;
121 break;
122 }
123 }
124
125 gc = xcb_generate_id(_ecore_xcb_conn);
126 xcb_create_gc(_ecore_xcb_conn, gc, drawable, vmask, value_list);
127
128// ecore_x_flush();
129 return gc;
130}
131
132/**
133 * Deletes and frees the given graphics context.
134 * @param gc The given graphics context.
135 */
136EAPI void
137ecore_x_gc_free(Ecore_X_GC gc)
138{
139 LOGFN(__FILE__, __LINE__, __FUNCTION__);
140 CHECK_XCB_CONN;
141
142 xcb_free_gc(_ecore_xcb_conn, gc);
143// ecore_x_flush();
144}
145
146EAPI void
147ecore_x_gc_foreground_set(Ecore_X_GC gc,
148 unsigned long foreground)
149{
150 uint32_t list;
151
152 LOGFN(__FILE__, __LINE__, __FUNCTION__);
153 CHECK_XCB_CONN;
154
155 list = foreground;
156 xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_FOREGROUND, &list);
157// ecore_x_flush();
158}
159
160EAPI void
161ecore_x_gc_background_set(Ecore_X_GC gc,
162 unsigned long background)
163{
164 uint32_t list;
165
166 LOGFN(__FILE__, __LINE__, __FUNCTION__);
167 CHECK_XCB_CONN;
168
169 list = background;
170 xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_BACKGROUND, &list);
171// ecore_x_flush();
172}
173
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
deleted file mode 100644
index 263dade..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c
+++ /dev/null
@@ -1,203 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_XGESTURE
3# include <xcb/gesture.h>
4# include <xcb/xcb_event.h>
5#endif
6
7/* local variables */
8static Eina_Bool _gesture_available = EINA_FALSE;
9
10/* external variables */
11int _ecore_xcb_event_gesture = -1;
12
13void
14_ecore_xcb_gesture_init(void)
15{
16 LOGFN(__FILE__, __LINE__, __FUNCTION__);
17
18#ifdef ECORE_XCB_XGESTURE
19 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_gesture_id);
20#endif
21}
22
23void
24_ecore_xcb_gesture_finalize(void)
25{
26#ifdef ECORE_XCB_XGESTURE
27 xcb_gesture_query_version_cookie_t cookie;
28 xcb_gesture_query_version_reply_t *reply;
29#endif
30
31 LOGFN(__FILE__, __LINE__, __FUNCTION__);
32
33#ifdef ECORE_XCB_XGESTURE
34 cookie =
35 xcb_gesture_query_version_unchecked(_ecore_xcb_conn);
36 reply =
37 xcb_gesture_query_version_reply(_ecore_xcb_conn, cookie, NULL);
38 if (reply)
39 {
40 _gesture_available = EINA_TRUE;
41 free(reply);
42 }
43
44 if (_gesture_available)
45 {
46 const xcb_query_extension_reply_t *ext_reply;
47
48 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_gesture_id);
49 if (ext_reply)
50 _ecore_xcb_event_gesture = ext_reply->first_event;
51 }
52#endif
53}
54
55void
56_ecore_xcb_gesture_shutdown(void)
57{
58 LOGFN(__FILE__, __LINE__, __FUNCTION__);
59}
60
61EAPI Eina_Bool
62ecore_x_gesture_supported(void)
63{
64 return _gesture_available;
65}
66
67#ifdef ECORE_XCB_XGESTURE
68EAPI Eina_Bool
69ecore_x_gesture_events_select(Ecore_X_Window win,
70 Ecore_X_Gesture_Event_Mask mask)
71#else
72EAPI Eina_Bool
73ecore_x_gesture_events_select(Ecore_X_Window win __UNUSED__,
74 Ecore_X_Gesture_Event_Mask mask __UNUSED__)
75#endif
76
77{
78#ifdef ECORE_XCB_XGESTURE
79 if (!_gesture_available) return EINA_FALSE;
80
81 LOGFN(__FILE__, __LINE__, __FUNCTION__);
82 CHECK_XCB_CONN
83
84 xcb_gesture_select_events(_ecore_xcb_conn, win, mask);
85
86 return EINA_TRUE;
87#else
88 return EINA_FALSE;
89#endif
90}
91
92#ifdef ECORE_XCB_XGESTURE
93EAPI Ecore_X_Gesture_Event_Mask
94ecore_x_gesture_events_selected_get(Ecore_X_Window win)
95#else
96EAPI Ecore_X_Gesture_Event_Mask
97ecore_x_gesture_events_selected_get(Ecore_X_Window win __UNUSED__)
98#endif
99{
100#ifdef ECORE_XCB_XGESTURE
101 xcb_gesture_get_selected_events_cookie_t ecookie;
102 xcb_gesture_get_selected_events_reply_t *ereply;
103 Ecore_X_Gesture_Event_Mask mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
104
105 if (!_gesture_available) return mask;
106
107 LOGFN(__FILE__, __LINE__, __FUNCTION__);
108 CHECK_XCB_CONN
109
110 ecookie = xcb_gesture_get_selected_events(_ecore_xcb_conn, win);
111 ereply =
112 xcb_gesture_get_selected_events_reply(_ecore_xcb_conn, ecookie, NULL);
113 if (ereply)
114 {
115 mask = ereply->mask;
116 free(ereply);
117 }
118
119 return mask;
120#else
121 return ECORE_X_GESTURE_EVENT_MASK_NONE;
122#endif
123}
124
125#ifdef ECORE_XCB_XGESTURE
126EAPI Eina_Bool
127ecore_x_gesture_event_grab(Ecore_X_Window win,
128 Ecore_X_Gesture_Event_Type type,
129 int num_fingers)
130#else
131EAPI Eina_Bool
132ecore_x_gesture_event_grab(Ecore_X_Window win __UNUSED__,
133 Ecore_X_Gesture_Event_Type type __UNUSED__,
134 int num_fingers __UNUSED__)
135#endif
136{
137#ifdef ECORE_XCB_XGESTURE
138 Eina_Bool status = EINA_TRUE;
139 xcb_gesture_grab_event_cookie_t ecookie;
140 xcb_gesture_grab_event_reply_t *ereply;
141
142 if (!_gesture_available) return EINA_FALSE;
143
144 LOGFN(__FILE__, __LINE__, __FUNCTION__);
145 CHECK_XCB_CONN
146
147 ecookie =
148 xcb_gesture_grab_event(_ecore_xcb_conn, win, type, num_fingers, 0L);
149 ereply = xcb_gesture_grab_event_reply(_ecore_xcb_conn, ecookie, NULL);
150
151 if (ereply)
152 {
153 if (ereply->status) status = EINA_FALSE;
154 free(ereply);
155 }
156 else
157 status = EINA_FALSE;
158
159 return status;
160#else
161 return EINA_FALSE;
162#endif
163}
164
165#ifdef ECORE_XCB_XGESTURE
166EAPI Eina_Bool
167ecore_x_gesture_event_ungrab(Ecore_X_Window win,
168 Ecore_X_Gesture_Event_Type type,
169 int num_fingers)
170#else
171EAPI Eina_Bool
172ecore_x_gesture_event_ungrab(Ecore_X_Window win __UNUSED__,
173 Ecore_X_Gesture_Event_Type type __UNUSED__,
174 int num_fingers __UNUSED__)
175#endif
176{
177#ifdef ECORE_XCB_XGESTURE
178 Eina_Bool status = EINA_TRUE;
179 xcb_gesture_ungrab_event_cookie_t ecookie;
180 xcb_gesture_ungrab_event_reply_t *ereply;
181
182 if (!_gesture_available) return EINA_FALSE;
183
184 LOGFN(__FILE__, __LINE__, __FUNCTION__);
185 CHECK_XCB_CONN
186
187 ecookie =
188 xcb_gesture_ungrab_event(_ecore_xcb_conn, win, type, num_fingers, 0L);
189 ereply = xcb_gesture_ungrab_event_reply(_ecore_xcb_conn, ecookie, NULL);
190
191 if (ereply)
192 {
193 if (ereply->status) status = EINA_FALSE;
194 free(ereply);
195 }
196 else
197 status = EINA_FALSE;
198
199 return status;
200#else
201 return EINA_FALSE;
202#endif
203}
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
deleted file mode 100644
index 8dea861..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c
+++ /dev/null
@@ -1,1569 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <xcb/xcb_icccm.h>
3
4EAPI void
5ecore_x_icccm_init(void)
6{
7}
8
9/**
10 * Sets the WM_COMMAND property for @a win.
11 *
12 * @param win The window.
13 * @param argc Number of arguments.
14 * @param argv Arguments.
15 */
16EAPI void
17ecore_x_icccm_command_set(Ecore_X_Window win,
18 int argc,
19 char **argv)
20{
21 void *buf;
22 char *b;
23 int nbytes, i;
24
25 LOGFN(__FILE__, __LINE__, __FUNCTION__);
26 CHECK_XCB_CONN;
27
28 for (i = 0, nbytes = 0; i < argc; i++)
29 if (argv[i]) nbytes += strlen(argv[i]) + 1;
30
31 buf = malloc(sizeof(char) * nbytes);
32 if (!buf) return;
33
34 b = (char *)buf;
35 for (i = 0; i < argc; i++)
36 {
37 if (argv[i])
38 {
39 strcpy(b, argv[i]);
40 b += strlen(argv[i]) + 1;
41 }
42 else
43 *b++ = '\0';
44 }
45 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
46 ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8,
47 nbytes, buf);
48 free(buf);
49}
50
51/**
52 * Get the WM_COMMAND property for @a win.
53 *
54 * Return the command of a window. String must be free'd when done with.
55 *
56 * @param win The window.
57 * @param argc Number of arguments.
58 * @param argv Arguments.
59 */
60EAPI void
61ecore_x_icccm_command_get(Ecore_X_Window win,
62 int *argc,
63 char ***argv)
64{
65 xcb_get_property_cookie_t cookie;
66 xcb_get_property_reply_t *reply;
67 int len = 0;
68 char **v, *data, *cp, *start;
69 int c = 0, i = 0, j = 0;
70
71 LOGFN(__FILE__, __LINE__, __FUNCTION__);
72 CHECK_XCB_CONN;
73
74 if (argc) *argc = 0;
75 if (argv) *argv = NULL;
76
77 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
78 ECORE_X_ATOM_WM_COMMAND,
79 XCB_GET_PROPERTY_TYPE_ANY,
80 0, 1000000L);
81 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
82 if (!reply) return;
83
84 if ((reply->type != ECORE_X_ATOM_STRING) || (reply->format != 8))
85 {
86 free(reply);
87 return;
88 }
89
90 len = reply->value_len;
91 if (len < 1)
92 {
93 free(reply);
94 return;
95 }
96
97 data = (char *)xcb_get_property_value(reply);
98 if (len && (data[len - 1] == '\0'))
99 len--;
100
101 c = 1;
102 for (cp = (char *)data, i = len; i > 0; cp++, i--)
103 if (*cp == '\0') c++;
104
105 v = (char **)malloc((c + 1) * sizeof(char *));
106 if (!v)
107 {
108 free(reply);
109 return;
110 }
111
112 start = (char *)malloc((len + 1) * sizeof(char));
113 if (!start)
114 {
115 free(reply);
116 free(v);
117 return;
118 }
119
120 memcpy(start, (char *)data, len);
121 start[len] = '\0';
122 for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--)
123 {
124 if (*cp == '\0')
125 {
126 v[j] = start;
127 start = (cp + 1);
128 j++;
129 }
130 }
131
132 if (c < 1)
133 {
134 free(reply);
135 free(v);
136 return;
137 }
138
139 if (argc) *argc = c;
140
141 if (argv)
142 {
143 (*argv) = malloc(c * sizeof(char *));
144 if (!*argv)
145 {
146 free(reply);
147 free(v);
148 if (argc) *argc = 0;
149 return;
150 }
151
152 for (i = 0; i < c; i++)
153 {
154 if (v[i])
155 (*argv)[i] = strdup(v[i]);
156 else
157 (*argv)[i] = strdup("");
158 }
159 }
160
161 free(reply);
162 free(v);
163}
164
165EAPI char *
166ecore_x_icccm_title_get(Ecore_X_Window win)
167{
168 xcb_get_property_cookie_t cookie;
169#ifdef OLD_XCB_VERSION
170 xcb_get_text_property_reply_t prop;
171#else
172 xcb_icccm_get_text_property_reply_t prop;
173#endif
174 uint8_t ret = 0;
175 char *title = NULL;
176
177 LOGFN(__FILE__, __LINE__, __FUNCTION__);
178 CHECK_XCB_CONN;
179
180 if (!win) return NULL;
181#ifdef OLD_XCB_VERSION
182 cookie = xcb_get_wm_name_unchecked(_ecore_xcb_conn, win);
183 ret = xcb_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
184#else
185 cookie = xcb_icccm_get_wm_name_unchecked(_ecore_xcb_conn, win);
186 ret = xcb_icccm_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
187#endif
188 if (ret == 0) return NULL;
189 if (prop.name_len < 1)
190 {
191#ifdef OLD_XCB_VERSION
192 xcb_get_text_property_reply_wipe(&prop);
193#else
194 xcb_icccm_get_text_property_reply_wipe(&prop);
195#endif
196 return NULL;
197 }
198
199 if (!(title = malloc((prop.name_len + 1) * sizeof(char *))))
200 {
201#ifdef OLD_XCB_VERSION
202 xcb_get_text_property_reply_wipe(&prop);
203#else
204 xcb_icccm_get_text_property_reply_wipe(&prop);
205#endif
206 return NULL;
207 }
208 memcpy(title, prop.name, sizeof(char *) * prop.name_len);
209 title[prop.name_len] = '\0';
210
211 if (prop.encoding != ECORE_X_ATOM_UTF8_STRING)
212 {
213 Ecore_Xcb_Textproperty tp;
214 int count = 0;
215 char **list = NULL;
216 Eina_Bool ret = EINA_FALSE;
217
218 tp.value = strdup(title);
219 tp.nitems = prop.name_len;
220 tp.encoding = prop.encoding;
221#ifdef HAVE_ICONV
222 ret = _ecore_xcb_utf8_textproperty_to_textlist(&tp, &list, &count);
223#else
224 ret = _ecore_xcb_mb_textproperty_to_textlist(&tp, &list, &count);
225#endif
226 if (ret)
227 {
228 if (count > 0)
229 title = strdup(list[0]);
230
231 if (list) free(list);
232 }
233 }
234
235#ifdef OLD_XCB_VERSION
236 xcb_get_text_property_reply_wipe(&prop);
237#else
238 xcb_icccm_get_text_property_reply_wipe(&prop);
239#endif
240 return title;
241}
242
243EAPI void
244ecore_x_icccm_title_set(Ecore_X_Window win,
245 const char *title)
246{
247 Ecore_Xcb_Textproperty prop;
248 char *list[1];
249 Eina_Bool ret = EINA_FALSE;
250
251 LOGFN(__FILE__, __LINE__, __FUNCTION__);
252 CHECK_XCB_CONN;
253
254 if (!title) return;
255
256 prop.value = NULL;
257 list[0] = strdup(title);
258
259#ifdef HAVE_ICONV
260 ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle,
261 &prop);
262#else
263 ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle,
264 &prop);
265#endif
266
267 if (ret)
268 {
269#ifdef OLD_XCB_VERSION
270 xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
271 strlen(prop.value), prop.value);
272#else
273 xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
274 strlen(prop.value), prop.value);
275#endif
276 if (prop.value) free(prop.value);
277 }
278 else
279#ifdef OLD_XCB_VERSION
280 xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
281 strlen(title), title);
282#else
283 xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8,
284 strlen(title), title);
285#endif
286 free(list[0]);
287}
288
289/**
290 * Get a window name & class.
291 * @param win The window
292 * @param n The name string
293 * @param c The class string
294 *
295 * Get a window name * class
296 */
297EAPI void
298ecore_x_icccm_name_class_get(Ecore_X_Window win,
299 char **name,
300 char **class)
301{
302 xcb_get_property_cookie_t cookie;
303#ifdef OLD_XCB_VERSION
304 xcb_get_wm_class_reply_t prop;
305#else
306 xcb_icccm_get_wm_class_reply_t prop;
307#endif
308 uint8_t ret = 0;
309
310 LOGFN(__FILE__, __LINE__, __FUNCTION__);
311 CHECK_XCB_CONN;
312
313 if (name) *name = NULL;
314 if (class) *class = NULL;
315
316#ifdef OLD_XCB_VERSION
317 cookie = xcb_get_wm_class_unchecked(_ecore_xcb_conn, win);
318 ret = xcb_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL);
319#else
320 cookie = xcb_icccm_get_wm_class_unchecked(_ecore_xcb_conn, win);
321 ret = xcb_icccm_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL);
322#endif
323 if (ret == 0) return;
324
325 if (name) *name = strdup(prop.instance_name);
326 if (class) *class = strdup(prop.class_name);
327
328#ifdef OLD_XCB_VERSION
329 xcb_get_wm_class_reply_wipe(&prop);
330#else
331 xcb_icccm_get_wm_class_reply_wipe(&prop);
332#endif
333}
334
335/**
336 * Set a window name & class.
337 * @param win The window
338 * @param n The name string
339 * @param c The class string
340 *
341 * Set a window name * class
342 */
343EAPI void
344ecore_x_icccm_name_class_set(Ecore_X_Window win,
345 const char *name,
346 const char *class)
347{
348 char *class_string, *s;
349 int length_name, length_class;
350
351 LOGFN(__FILE__, __LINE__, __FUNCTION__);
352 CHECK_XCB_CONN;
353
354 length_name = strlen(name);
355 length_class = strlen(class);
356 class_string =
357 (char *)malloc(sizeof(char) * (length_name + length_class + 2));
358 if (!class_string) return;
359
360 s = class_string;
361 if (length_name)
362 {
363 strcpy(s, name);
364 s += length_name + 1;
365 }
366 else
367 *s++ = '\0';
368
369 if (length_class)
370 strcpy(s, class);
371 else
372 *s = '\0';
373
374 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
375 ECORE_X_ATOM_WM_CLASS, ECORE_X_ATOM_STRING, 8,
376 length_name + length_class + 2, (void *)class_string);
377 free(class_string);
378}
379
380/**
381 * Specify that a window is transient for another top-level window and should be handled accordingly.
382 * @param win the transient window
383 * @param forwin the toplevel window
384 */
385EAPI void
386ecore_x_icccm_transient_for_set(Ecore_X_Window win,
387 Ecore_X_Window forwindow)
388{
389 LOGFN(__FILE__, __LINE__, __FUNCTION__);
390 CHECK_XCB_CONN;
391
392 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
393 ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32,
394 1, (void *)&forwindow);
395}
396
397/**
398 * Remove the transient_for setting from a window.
399 * @param win The window
400 */
401EAPI void
402ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
403{
404 LOGFN(__FILE__, __LINE__, __FUNCTION__);
405
406 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
407}
408
409/**
410 * Get the window this window is transient for, if any.
411 * @param win The window to check
412 * @return The window ID of the top-level window, or 0 if the property does not exist.
413 */
414EAPI Ecore_X_Window
415ecore_x_icccm_transient_for_get(Ecore_X_Window win)
416{
417 Ecore_X_Window forwin = 0;
418 xcb_get_property_cookie_t cookie;
419
420 LOGFN(__FILE__, __LINE__, __FUNCTION__);
421 CHECK_XCB_CONN;
422
423#ifdef OLD_XCB_VERSION
424 cookie = xcb_get_wm_transient_for_unchecked(_ecore_xcb_conn, win);
425 xcb_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL);
426#else
427 cookie = xcb_icccm_get_wm_transient_for_unchecked(_ecore_xcb_conn, win);
428 xcb_icccm_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL);
429#endif
430
431 return forwin;
432}
433
434/**
435 * Get the window role.
436 * @param win The window
437 * @return The window's role string.
438 */
439EAPI char *
440ecore_x_icccm_window_role_get(Ecore_X_Window win)
441{
442 LOGFN(__FILE__, __LINE__, __FUNCTION__);
443
444 return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
445}
446
447/**
448 * Set the window role hint.
449 * @param win The window
450 * @param role The role string
451 */
452EAPI void
453ecore_x_icccm_window_role_set(Ecore_X_Window win,
454 const char *role)
455{
456 LOGFN(__FILE__, __LINE__, __FUNCTION__);
457
458 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE, role);
459}
460
461/**
462 * Get the window's client leader.
463 * @param win The window
464 * @return The window's client leader window, or 0 if unset
465 */
466EAPI Ecore_X_Window
467ecore_x_icccm_client_leader_get(Ecore_X_Window win)
468{
469 Ecore_X_Window leader;
470
471 LOGFN(__FILE__, __LINE__, __FUNCTION__);
472
473 if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
474 &leader, 1) > 0)
475 return leader;
476
477 return 0;
478}
479
480/**
481 * Set the window's client leader.
482 * @param win The window
483 * @param l The client leader window
484 *
485 * All non-transient top-level windows created by an app other than
486 * the main window must have this property set to the app's main window.
487 */
488EAPI void
489ecore_x_icccm_client_leader_set(Ecore_X_Window win,
490 Ecore_X_Window leader)
491{
492 LOGFN(__FILE__, __LINE__, __FUNCTION__);
493
494 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
495 &leader, 1);
496}
497
498EAPI Ecore_X_Window_State_Hint
499ecore_x_icccm_state_get(Ecore_X_Window win)
500{
501 xcb_get_property_cookie_t cookie;
502 xcb_get_property_reply_t *reply;
503 Ecore_X_Window_State_Hint hint = ECORE_X_WINDOW_STATE_HINT_NONE;
504 uint8_t *prop;
505
506 LOGFN(__FILE__, __LINE__, __FUNCTION__);
507 CHECK_XCB_CONN;
508
509 cookie =
510 xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
511 ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE,
512 0L, 0x7fffffff);
513 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
514 if (!reply) return hint;
515 if ((reply->type == 0) || (reply->format != 8) || (reply->value_len != 2))
516 {
517 free(reply);
518 return hint;
519 }
520
521 prop = (uint8_t *)xcb_get_property_value(reply);
522#ifdef OLD_XCB_VERSION
523 switch (prop[0])
524 {
525 case XCB_WM_STATE_WITHDRAWN:
526 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
527 break;
528
529 case XCB_WM_STATE_NORMAL:
530 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
531 break;
532
533 case XCB_WM_STATE_ICONIC:
534 hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
535 break;
536
537 default:
538 break;
539 }
540#else
541 switch (prop[0])
542 {
543 case XCB_ICCCM_WM_STATE_WITHDRAWN:
544 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
545 break;
546
547 case XCB_ICCCM_WM_STATE_NORMAL:
548 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
549 break;
550
551 case XCB_ICCCM_WM_STATE_ICONIC:
552 hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
553 break;
554
555 default:
556 break;
557 }
558#endif
559
560 free(reply);
561 return hint;
562}
563
564EAPI void
565ecore_x_icccm_state_set(Ecore_X_Window win,
566 Ecore_X_Window_State_Hint state)
567{
568#ifdef OLD_XCB_VERSION
569 xcb_wm_hints_t hints;
570#else
571 xcb_icccm_wm_hints_t hints;
572#endif
573
574 LOGFN(__FILE__, __LINE__, __FUNCTION__);
575 CHECK_XCB_CONN;
576
577#ifdef OLD_XCB_VERSION
578 xcb_wm_hints_set_none(&hints);
579
580 hints.flags = XCB_WM_HINT_STATE;
581
582 if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
583 xcb_wm_hints_set_withdrawn(&hints);
584 else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
585 xcb_wm_hints_set_normal(&hints);
586 else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
587 xcb_wm_hints_set_iconic(&hints);
588
589 xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
590#else
591 xcb_icccm_wm_hints_set_none(&hints);
592
593 hints.flags = XCB_ICCCM_WM_HINT_STATE;
594
595 if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
596 xcb_icccm_wm_hints_set_withdrawn(&hints);
597 else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
598 xcb_icccm_wm_hints_set_normal(&hints);
599 else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
600 xcb_icccm_wm_hints_set_iconic(&hints);
601
602 xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
603#endif
604}
605
606EAPI void
607ecore_x_icccm_delete_window_send(Ecore_X_Window win,
608 Ecore_X_Time t)
609{
610 LOGFN(__FILE__, __LINE__, __FUNCTION__);
611 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
612 ECORE_X_EVENT_MASK_NONE,
613 ECORE_X_ATOM_WM_DELETE_WINDOW, t, 0, 0, 0);
614}
615
616EAPI void
617ecore_x_icccm_hints_set(Ecore_X_Window win,
618 Eina_Bool accepts_focus,
619 Ecore_X_Window_State_Hint initial_state,
620 Ecore_X_Pixmap icon_pixmap,
621 Ecore_X_Pixmap icon_mask,
622 Ecore_X_Window icon_window,
623 Ecore_X_Window window_group,
624 Eina_Bool is_urgent)
625{
626#ifdef OLD_XCB_VERSION
627 xcb_wm_hints_t hints;
628#else
629 xcb_icccm_wm_hints_t hints;
630#endif
631
632 LOGFN(__FILE__, __LINE__, __FUNCTION__);
633 CHECK_XCB_CONN;
634
635#ifdef OLD_XCB_VERSION
636 xcb_wm_hints_set_none(&hints);
637 xcb_wm_hints_set_input(&hints, accepts_focus);
638
639 if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
640 xcb_wm_hints_set_withdrawn(&hints);
641 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
642 xcb_wm_hints_set_normal(&hints);
643 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
644 xcb_wm_hints_set_iconic(&hints);
645
646 if (icon_pixmap != 0) xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
647 if (icon_mask != 0) xcb_wm_hints_set_icon_mask(&hints, icon_mask);
648 if (icon_window != 0) xcb_wm_hints_set_icon_window(&hints, icon_window);
649 if (window_group != 0) xcb_wm_hints_set_window_group(&hints, window_group);
650 if (is_urgent) xcb_wm_hints_set_urgency(&hints);
651
652 xcb_set_wm_hints(_ecore_xcb_conn, win, &hints);
653#else
654 xcb_icccm_wm_hints_set_none(&hints);
655 xcb_icccm_wm_hints_set_input(&hints, accepts_focus);
656
657 if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
658 xcb_icccm_wm_hints_set_withdrawn(&hints);
659 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
660 xcb_icccm_wm_hints_set_normal(&hints);
661 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
662 xcb_icccm_wm_hints_set_iconic(&hints);
663
664 if (icon_pixmap != 0)
665 xcb_icccm_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
666 if (icon_mask != 0)
667 xcb_icccm_wm_hints_set_icon_mask(&hints, icon_mask);
668 if (icon_window != 0)
669 xcb_icccm_wm_hints_set_icon_window(&hints, icon_window);
670 if (window_group != 0)
671 xcb_icccm_wm_hints_set_window_group(&hints, window_group);
672 if (is_urgent)
673 xcb_icccm_wm_hints_set_urgency(&hints);
674
675 xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints);
676#endif
677}
678
679EAPI Eina_Bool
680ecore_x_icccm_hints_get(Ecore_X_Window win,
681 Eina_Bool *accepts_focus,
682 Ecore_X_Window_State_Hint *initial_state,
683 Ecore_X_Pixmap *icon_pixmap,
684 Ecore_X_Pixmap *icon_mask,
685 Ecore_X_Window *icon_window,
686 Ecore_X_Window *window_group,
687 Eina_Bool *is_urgent)
688{
689 xcb_get_property_cookie_t cookie;
690#ifdef OLD_XCB_VERSION
691 xcb_wm_hints_t hints;
692#else
693 xcb_icccm_wm_hints_t hints;
694#endif
695 uint8_t ret = 0;
696
697 LOGFN(__FILE__, __LINE__, __FUNCTION__);
698 CHECK_XCB_CONN;
699
700 if (accepts_focus) *accepts_focus = EINA_TRUE;
701 if (initial_state) *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
702 if (icon_pixmap) *icon_pixmap = 0;
703 if (icon_mask) *icon_mask = 0;
704 if (icon_window) *icon_window = 0;
705 if (window_group) *window_group = 0;
706 if (is_urgent) *is_urgent = EINA_FALSE;
707
708#ifdef OLD_XCB_VERSION
709 xcb_wm_hints_set_none(&hints);
710 cookie = xcb_get_wm_hints_unchecked(_ecore_xcb_conn, win);
711 ret = xcb_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
712#else
713 xcb_icccm_wm_hints_set_none(&hints);
714 cookie = xcb_icccm_get_wm_hints_unchecked(_ecore_xcb_conn, win);
715 ret = xcb_icccm_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
716#endif
717 if (!ret) return EINA_FALSE;
718
719#ifdef OLD_XCB_VERSION
720 if ((hints.flags & XCB_WM_HINT_INPUT) && (accepts_focus))
721#else
722 if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && (accepts_focus))
723#endif
724 {
725 if (hints.input)
726 *accepts_focus = EINA_TRUE;
727 else
728 *accepts_focus = EINA_FALSE;
729 }
730
731#ifdef OLD_XCB_VERSION
732 if ((hints.flags & XCB_WM_HINT_STATE) && (initial_state))
733 {
734 if (hints.initial_state == XCB_WM_STATE_WITHDRAWN)
735 *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
736 else if (hints.initial_state == XCB_WM_STATE_NORMAL)
737 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
738 else if (hints.initial_state == XCB_WM_STATE_ICONIC)
739 *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
740 }
741
742 if ((hints.flags & XCB_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
743 *icon_pixmap = hints.icon_pixmap;
744
745 if ((hints.flags & XCB_WM_HINT_ICON_MASK) && (icon_mask))
746 *icon_mask = hints.icon_mask;
747
748 if ((hints.flags & XCB_WM_HINT_ICON_WINDOW) && (icon_window))
749 *icon_window = hints.icon_window;
750
751 if ((hints.flags & XCB_WM_HINT_WINDOW_GROUP) && (window_group))
752 *window_group = hints.window_group;
753
754 if ((hints.flags & XCB_WM_HINT_X_URGENCY) && (is_urgent))
755 *is_urgent = EINA_TRUE;
756#else
757 if ((hints.flags & XCB_ICCCM_WM_HINT_STATE) && (initial_state))
758 {
759 if (hints.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN)
760 *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
761 else if (hints.initial_state == XCB_ICCCM_WM_STATE_NORMAL)
762 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
763 else if (hints.initial_state == XCB_ICCCM_WM_STATE_ICONIC)
764 *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
765 }
766
767 if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
768 *icon_pixmap = hints.icon_pixmap;
769
770 if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_MASK) && (icon_mask))
771 *icon_mask = hints.icon_mask;
772
773 if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_WINDOW) && (icon_window))
774 *icon_window = hints.icon_window;
775
776 if ((hints.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) && (window_group))
777 *window_group = hints.window_group;
778
779 if ((hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY) && (is_urgent))
780 *is_urgent = EINA_TRUE;
781#endif
782
783 return EINA_TRUE;
784}
785
786/**
787 * Get a window icon name.
788 * @param win The window
789 * @return The windows icon name string
790 *
791 * Return the icon name of a window. String must be free'd when done with.
792 */
793EAPI char *
794ecore_x_icccm_icon_name_get(Ecore_X_Window win)
795{
796 xcb_get_property_cookie_t cookie;
797#ifdef OLD_XCB_VERSION
798 xcb_get_text_property_reply_t prop;
799#else
800 xcb_icccm_get_text_property_reply_t prop;
801#endif
802 uint8_t ret = 0;
803 char *tmp = NULL;
804
805 LOGFN(__FILE__, __LINE__, __FUNCTION__);
806 CHECK_XCB_CONN;
807
808 if (!win) return NULL;
809
810#ifdef OLD_XCB_VERSION
811 cookie = xcb_get_wm_icon_name_unchecked(_ecore_xcb_conn, win);
812 ret = xcb_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
813#else
814 cookie = xcb_icccm_get_wm_icon_name_unchecked(_ecore_xcb_conn, win);
815 ret = xcb_icccm_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL);
816#endif
817 if (ret == 0) return NULL;
818
819 if (prop.name_len < 1)
820 {
821#ifdef OLD_XCB_VERSION
822 xcb_get_text_property_reply_wipe(&prop);
823#else
824 xcb_icccm_get_text_property_reply_wipe(&prop);
825#endif
826 return NULL;
827 }
828
829 if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *))))
830 {
831#ifdef OLD_XCB_VERSION
832 xcb_get_text_property_reply_wipe(&prop);
833#else
834 xcb_icccm_get_text_property_reply_wipe(&prop);
835#endif
836 return NULL;
837 }
838 memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
839 tmp[prop.name_len] = '\0';
840
841 if (prop.encoding != ECORE_X_ATOM_UTF8_STRING)
842 {
843 Ecore_Xcb_Textproperty tp;
844 int count = 0;
845 char **list = NULL;
846 Eina_Bool ret = EINA_FALSE;
847
848 tp.value = strdup(tmp);
849 tp.nitems = prop.name_len;
850 tp.encoding = prop.encoding;
851#ifdef HAVE_ICONV
852 ret = _ecore_xcb_utf8_textproperty_to_textlist(&tp, &list, &count);
853#else
854 ret = _ecore_xcb_mb_textproperty_to_textlist(&tp, &list, &count);
855#endif
856 if (ret)
857 {
858 if (count > 0)
859 tmp = strdup(list[0]);
860
861 if (list) free(list);
862 }
863 }
864
865#ifdef OLD_XCB_VERSION
866 xcb_get_text_property_reply_wipe(&prop);
867#else
868 xcb_icccm_get_text_property_reply_wipe(&prop);
869#endif
870 return tmp;
871}
872
873/**
874 * Set a window icon name.
875 * @param win The window
876 * @param t The icon name string
877 *
878 * Set a window icon name
879 */
880EAPI void
881ecore_x_icccm_icon_name_set(Ecore_X_Window win,
882 const char *name)
883{
884 Ecore_Xcb_Textproperty prop;
885 char *list[1];
886 Eina_Bool ret = EINA_FALSE;
887
888 LOGFN(__FILE__, __LINE__, __FUNCTION__);
889 CHECK_XCB_CONN;
890
891 if ((!win) || (!name)) return;
892
893 prop.value = NULL;
894 list[0] = strdup(name);
895
896#ifdef HAVE_ICONV
897 ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle,
898 &prop);
899#else
900 ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle,
901 &prop);
902#endif
903
904 if (ret)
905 {
906#ifdef OLD_XCB_VERSION
907 xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
908 strlen(prop.value), prop.value);
909#else
910 xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
911 8, strlen(prop.value), prop.value);
912#endif
913 if (prop.value) free(prop.value);
914 }
915 else
916#ifdef OLD_XCB_VERSION
917 xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
918 strlen(name), name);
919#else
920 xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING,
921 8, strlen(name), name);
922#endif
923
924 free(list[0]);
925}
926
927EAPI void
928ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
929 Ecore_X_Window root)
930{
931 xcb_client_message_event_t ev;
932
933 LOGFN(__FILE__, __LINE__, __FUNCTION__);
934 CHECK_XCB_CONN;
935
936 if (!win) return;
937 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
938
939 memset(&ev, 0, sizeof(xcb_client_message_event_t));
940
941 ev.response_type = XCB_CLIENT_MESSAGE;
942 ev.format = 32;
943 ev.window = win;
944 ev.type = ECORE_X_ATOM_WM_CHANGE_STATE;
945#ifdef OLD_XCB_VERSION
946 ev.data.data32[0] = XCB_WM_STATE_ICONIC;
947#else
948 ev.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC;
949#endif
950
951 xcb_send_event(_ecore_xcb_conn, 0, root,
952 (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
953 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT),
954 (const char *)&ev);
955// ecore_x_flush();
956}
957
958/**
959 * Set or unset a wm protocol property.
960 * @param win The Window
961 * @param protocol The protocol to enable/disable
962 * @param on On/Off
963 */
964EAPI void
965ecore_x_icccm_protocol_set(Ecore_X_Window win,
966 Ecore_X_WM_Protocol protocol,
967 Eina_Bool on)
968{
969 Ecore_X_Atom proto;
970 xcb_get_property_cookie_t cookie;
971#ifdef OLD_XCB_VERSION
972 xcb_get_wm_protocols_reply_t protos;
973#else
974 xcb_icccm_get_wm_protocols_reply_t protos;
975#endif
976 int i = 0, count = 0, set = 0;
977
978 LOGFN(__FILE__, __LINE__, __FUNCTION__);
979 CHECK_XCB_CONN;
980
981 if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return;
982 proto = _ecore_xcb_atoms_wm_protocol[protocol];
983#ifdef OLD_XCB_VERSION
984 cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
985 if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL))
986#else
987 cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
988 if (!xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL))
989#endif
990 count = 0;
991 else
992 count = protos.atoms_len;
993
994 for (i = 0; i < count; i++)
995 {
996 if (protos.atoms[i] == proto)
997 {
998 set = 1;
999 break;
1000 }
1001 }
1002
1003 if (on)
1004 {
1005 if (!set)
1006 {
1007 Ecore_X_Atom *atoms = NULL;
1008
1009 atoms = malloc((count + 1) * sizeof(Ecore_X_Atom));
1010 if (atoms)
1011 {
1012 for (i = 0; i < count; i++)
1013 atoms[i] = protos.atoms[i];
1014 atoms[count] = proto;
1015#ifdef OLD_XCB_VERSION
1016 xcb_set_wm_protocols(_ecore_xcb_conn,
1017 ECORE_X_ATOM_WM_PROTOCOLS,
1018 win, count, atoms);
1019#else
1020 xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
1021 ECORE_X_ATOM_WM_PROTOCOLS,
1022 count, atoms);
1023#endif
1024 free(atoms);
1025 }
1026 }
1027 }
1028 else
1029 {
1030 if (set)
1031 {
1032 for (i = 0; i < count; i++)
1033 {
1034 if (protos.atoms[i] == proto)
1035 {
1036 int j = 0;
1037
1038 for (j = (i + 1); j < count; j++)
1039 protos.atoms[j - 1] = protos.atoms[j];
1040 if (count > 1)
1041#ifdef OLD_XCB_VERSION
1042 xcb_set_wm_protocols(_ecore_xcb_conn,
1043 ECORE_X_ATOM_WM_PROTOCOLS,
1044 win, count - 1, protos.atoms);
1045#else
1046 xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
1047 ECORE_X_ATOM_WM_PROTOCOLS,
1048 count - 1, protos.atoms);
1049#endif
1050 else
1051 ecore_x_window_prop_property_del(win,
1052 ECORE_X_ATOM_WM_PROTOCOLS);
1053 break;
1054 }
1055 }
1056 }
1057 }
1058
1059#ifdef OLD_XCB_VERSION
1060 xcb_get_wm_protocols_reply_wipe(&protos);
1061#else
1062 xcb_icccm_get_wm_protocols_reply_wipe(&protos);
1063#endif
1064}
1065
1066/**
1067 * Determines whether a protocol is set for a window.
1068 * @param win The Window
1069 * @param protocol The protocol to query
1070 * @return 1 if the protocol is set, else 0.
1071 */
1072EAPI Eina_Bool
1073ecore_x_icccm_protocol_isset(Ecore_X_Window win,
1074 Ecore_X_WM_Protocol protocol)
1075{
1076 Ecore_X_Atom proto;
1077 Eina_Bool ret = EINA_FALSE;
1078 xcb_get_property_cookie_t cookie;
1079#ifdef OLD_XCB_VERSION
1080 xcb_get_wm_protocols_reply_t reply;
1081#else
1082 xcb_icccm_get_wm_protocols_reply_t reply;
1083#endif
1084 uint8_t val = 0;
1085 unsigned int i = 0;
1086
1087 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1088 CHECK_XCB_CONN;
1089
1090 if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE;
1091
1092 proto = _ecore_xcb_atoms_wm_protocol[protocol];
1093#ifdef OLD_XCB_VERSION
1094 cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
1095 val = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL);
1096#else
1097 cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto);
1098 val = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL);
1099#endif
1100 if (!val) return EINA_FALSE;
1101
1102 for (i = 0; i < reply.atoms_len; i++)
1103 if (reply.atoms[i] == proto)
1104 {
1105 ret = EINA_TRUE;
1106 break;
1107 }
1108
1109#ifdef OLD_XCB_VERSION
1110 xcb_get_wm_protocols_reply_wipe(&reply);
1111#else
1112 xcb_icccm_get_wm_protocols_reply_wipe(&reply);
1113#endif
1114
1115 return ret;
1116}
1117
1118/**
1119 * Set protocol atoms explicitly
1120 * @param win The Window
1121 * @param protos An array of protocol atoms
1122 * @param num the number of members of the array
1123 */
1124EAPI void
1125ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
1126 Ecore_X_Atom *protos,
1127 int num)
1128{
1129 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1130 CHECK_XCB_CONN;
1131
1132 if (num > 0)
1133#ifdef OLD_XCB_VERSION
1134 xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS,
1135 win, num, protos);
1136#else
1137 xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win,
1138 ECORE_X_ATOM_WM_PROTOCOLS, num, protos);
1139#endif
1140 else
1141 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS);
1142}
1143
1144EAPI Eina_Bool
1145ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
1146 Eina_Bool *request_pos,
1147 Ecore_X_Gravity *gravity,
1148 int *min_w,
1149 int *min_h,
1150 int *max_w,
1151 int *max_h,
1152 int *base_w,
1153 int *base_h,
1154 int *step_x,
1155 int *step_y,
1156 double *min_aspect,
1157 double *max_aspect)
1158{
1159 xcb_size_hints_t hints;
1160 xcb_get_property_cookie_t cookie;
1161 uint8_t ret = 0;
1162 int32_t minw = 0, minh = 0;
1163 int32_t maxw = 32767, maxh = 32767;
1164 int32_t basew = -1, baseh = -1;
1165 int32_t stepx = -1, stepy = -1;
1166 double mina = 0.0, maxa = 0.0;
1167
1168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1169 CHECK_XCB_CONN;
1170
1171 if (request_pos) *request_pos = EINA_FALSE;
1172 if (gravity) *gravity = ECORE_X_GRAVITY_NW;
1173 if (min_w) *min_w = minw;
1174 if (min_h) *min_h = minh;
1175 if (max_w) *max_w = maxw;
1176 if (max_h) *max_h = maxh;
1177 if (base_w) *base_w = basew;
1178 if (base_h) *base_h = baseh;
1179 if (step_x) *step_x = stepx;
1180 if (step_y) *step_y = stepy;
1181 if (min_aspect) *min_aspect = mina;
1182 if (max_aspect) *max_aspect = maxa;
1183
1184#ifdef OLD_XCB_VERSION
1185 cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
1186 ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
1187#else
1188 cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
1189 ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
1190 &hints, NULL);
1191#endif
1192 if (!ret) return EINA_FALSE;
1193
1194#ifdef OLD_XCB_VERSION
1195 if ((hints.flags & XCB_SIZE_HINT_US_POSITION) ||
1196 (hints.flags & XCB_SIZE_HINT_P_POSITION))
1197#else
1198 if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) ||
1199 (hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION))
1200#endif
1201 {
1202 if (request_pos) *request_pos = EINA_TRUE;
1203 }
1204
1205#ifdef OLD_XCB_VERSION
1206 if (hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY)
1207#else
1208 if (hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
1209#endif
1210 {
1211 if (gravity) *gravity = hints.win_gravity;
1212 }
1213
1214#ifdef OLD_XCB_VERSION
1215 if (hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
1216#else
1217 if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
1218#endif
1219 {
1220 minw = hints.min_width;
1221 minh = hints.min_height;
1222 }
1223
1224#ifdef OLD_XCB_VERSION
1225 if (hints.flags & XCB_SIZE_HINT_P_MAX_SIZE)
1226#else
1227 if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
1228#endif
1229 {
1230 maxw = hints.max_width;
1231 maxh = hints.max_height;
1232 if (maxw < minw) maxw = minw;
1233 if (maxh < minh) maxh = minh;
1234 }
1235
1236#ifdef OLD_XCB_VERSION
1237 if (hints.flags & XCB_SIZE_HINT_BASE_SIZE)
1238#else
1239 if (hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE)
1240#endif
1241 {
1242 basew = hints.base_width;
1243 baseh = hints.base_height;
1244 if (basew > minw) minw = basew;
1245 if (baseh > minh) minh = baseh;
1246 }
1247
1248#ifdef OLD_XCB_VERSION
1249 if (hints.flags & XCB_SIZE_HINT_P_RESIZE_INC)
1250#else
1251 if (hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)
1252#endif
1253 {
1254 stepx = hints.width_inc;
1255 stepy = hints.height_inc;
1256 if (stepx < 1) stepx = 1;
1257 if (stepy < 1) stepy = 1;
1258 }
1259
1260#ifdef OLD_XCB_VERSION
1261 if (hints.flags & XCB_SIZE_HINT_P_ASPECT)
1262#else
1263 if (hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT)
1264#endif
1265 {
1266 if (hints.min_aspect_den > 0)
1267 mina = ((double)hints.min_aspect_num) / ((double)hints.min_aspect_den);
1268
1269 if (hints.max_aspect_den > 0)
1270 maxa = ((double)hints.max_aspect_num) / ((double)hints.max_aspect_den);
1271 }
1272
1273 if (min_w) *min_w = minw;
1274 if (min_h) *min_h = minh;
1275 if (max_w) *max_w = maxw;
1276 if (max_h) *max_h = maxh;
1277 if (base_w) *base_w = basew;
1278 if (base_h) *base_h = baseh;
1279 if (step_x) *step_x = stepx;
1280 if (step_y) *step_y = stepy;
1281 if (min_aspect) *min_aspect = mina;
1282 if (max_aspect) *max_aspect = maxa;
1283
1284 return EINA_TRUE;
1285}
1286
1287EAPI void
1288ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
1289 Eina_Bool request_pos,
1290 Ecore_X_Gravity gravity,
1291 int min_w,
1292 int min_h,
1293 int max_w,
1294 int max_h,
1295 int base_w,
1296 int base_h,
1297 int step_x,
1298 int step_y,
1299 double min_aspect,
1300 double max_aspect)
1301{
1302 xcb_get_property_cookie_t cookie;
1303 xcb_size_hints_t hints;
1304 uint8_t ret = 0;
1305
1306 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1307 CHECK_XCB_CONN;
1308
1309#ifdef OLD_XCB_VERSION
1310 cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
1311 ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL);
1312#else
1313 cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win);
1314 ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie,
1315 &hints, NULL);
1316#endif
1317 if (!ret) memset(&hints, 0, sizeof(xcb_size_hints_t));
1318
1319 hints.flags = 0;
1320
1321#ifdef OLD_XCB_VERSION
1322 if (request_pos)
1323 hints.flags |= XCB_SIZE_HINT_US_POSITION;
1324
1325 if (gravity != ECORE_X_GRAVITY_NW)
1326 xcb_size_hints_set_win_gravity(&hints, gravity);
1327 if ((min_w > 0) || (min_h > 0))
1328 xcb_size_hints_set_min_size(&hints, min_w, min_h);
1329 if ((max_w > 0) || (max_h > 0))
1330 xcb_size_hints_set_max_size(&hints, max_w, max_h);
1331 if ((base_w > 0) || (base_h > 0))
1332 xcb_size_hints_set_base_size(&hints, base_w, base_h);
1333 if ((step_x > 1) || (step_y > 1))
1334 xcb_size_hints_set_resize_inc(&hints, step_x, step_y);
1335 if ((min_aspect > 0.0) || (max_aspect > 0.0))
1336 xcb_size_hints_set_aspect(&hints,
1337 (int32_t)(min_aspect * 10000), 10000,
1338 (int32_t)(max_aspect * 10000), 10000);
1339
1340 xcb_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
1341#else
1342 if (request_pos)
1343 hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION;
1344
1345 if (gravity != ECORE_X_GRAVITY_NW)
1346 xcb_icccm_size_hints_set_win_gravity(&hints, gravity);
1347 if ((min_w > 0) || (min_h > 0))
1348 xcb_icccm_size_hints_set_min_size(&hints, min_w, min_h);
1349 if ((max_w > 0) || (max_h > 0))
1350 xcb_icccm_size_hints_set_max_size(&hints, max_w, max_h);
1351 if ((base_w > 0) || (base_h > 0))
1352 xcb_icccm_size_hints_set_base_size(&hints, base_w, base_h);
1353 if ((step_x > 1) || (step_y > 1))
1354 xcb_icccm_size_hints_set_resize_inc(&hints, step_x, step_y);
1355 if ((min_aspect > 0.0) || (max_aspect > 0.0))
1356 xcb_icccm_size_hints_set_aspect(&hints,
1357 (int32_t)(min_aspect * 10000), 10000,
1358 (int32_t)(max_aspect * 10000), 10000);
1359
1360 xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints);
1361#endif
1362}
1363
1364EAPI void
1365ecore_x_icccm_move_resize_send(Ecore_X_Window win,
1366 int x,
1367 int y,
1368 int w,
1369 int h)
1370{
1371 xcb_configure_notify_event_t ev;
1372
1373 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1374 CHECK_XCB_CONN;
1375
1376 if (!win) return;
1377
1378 memset(&ev, 0, sizeof(xcb_configure_notify_event_t));
1379
1380 ev.response_type = XCB_CONFIGURE_NOTIFY;
1381 ev.event = win;
1382 ev.window = win;
1383 ev.above_sibling = XCB_NONE;
1384 ev.x = x;
1385 ev.y = y;
1386 ev.width = w;
1387 ev.height = h;
1388 ev.border_width = 0;
1389 ev.override_redirect = 0;
1390
1391 xcb_send_event(_ecore_xcb_conn, 0, win,
1392 XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&ev);
1393// ecore_x_flush();
1394}
1395
1396/**
1397 * Get a window client machine string.
1398 * @param win The window
1399 * @return The windows client machine string
1400 *
1401 * Return the client machine of a window. String must be free'd when done with.
1402 */
1403EAPI char *
1404ecore_x_icccm_client_machine_get(Ecore_X_Window win)
1405{
1406 xcb_get_property_cookie_t cookie;
1407#ifdef OLD_XCB_VERSION
1408 xcb_get_text_property_reply_t prop;
1409#else
1410 xcb_icccm_get_text_property_reply_t prop;
1411#endif
1412 uint8_t ret = 0;
1413 char *tmp = NULL;
1414
1415 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1416 CHECK_XCB_CONN;
1417
1418#ifdef OLD_XCB_VERSION
1419 cookie = xcb_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
1420 ret = xcb_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, &prop, NULL);
1421#else
1422 cookie = xcb_icccm_get_wm_client_machine_unchecked(_ecore_xcb_conn, win);
1423 ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie,
1424 &prop, NULL);
1425#endif
1426 if (ret == 0) return NULL;
1427
1428 tmp = malloc((prop.name_len + 1) * sizeof(char *));
1429 if (!tmp)
1430 {
1431#ifdef OLD_XCB_VERSION
1432 xcb_get_text_property_reply_wipe(&prop);
1433#else
1434 xcb_icccm_get_text_property_reply_wipe(&prop);
1435#endif
1436 return NULL;
1437 }
1438 memcpy(tmp, prop.name, sizeof(char *) * prop.name_len);
1439 tmp[prop.name_len] = '\0';
1440
1441#ifdef OLD_XCB_VERSION
1442 xcb_get_text_property_reply_wipe(&prop);
1443#else
1444 xcb_icccm_get_text_property_reply_wipe(&prop);
1445#endif
1446
1447 return tmp;
1448}
1449
1450EAPI void
1451ecore_x_icccm_take_focus_send(Ecore_X_Window win,
1452 Ecore_X_Time t)
1453{
1454 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1455 CHECK_XCB_CONN;
1456
1457 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
1458 XCB_EVENT_MASK_NO_EVENT,
1459 ECORE_X_ATOM_WM_TAKE_FOCUS, t, 0, 0, 0);
1460}
1461
1462EAPI void
1463ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
1464 Ecore_X_Time t)
1465{
1466 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1467 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
1468 XCB_EVENT_MASK_NO_EVENT,
1469 ECORE_X_ATOM_WM_SAVE_YOURSELF, t, 0, 0, 0);
1470}
1471
1472/**
1473 * Add a subwindow to the list of windows that need a different colormap installed.
1474 * @param win The toplevel window
1475 * @param subwin The subwindow to be added to the colormap windows list
1476 */
1477EAPI void
1478ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
1479 Ecore_X_Window subwin)
1480{
1481 int num = 0, i = 0;
1482 unsigned char *odata = NULL, *data = NULL;
1483 Ecore_X_Window *newset = NULL, *oldset = NULL;
1484
1485 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1486
1487 if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1488 ECORE_X_ATOM_WINDOW, 32, &odata, &num))
1489 {
1490 if (!(newset = calloc(1, sizeof(Ecore_X_Window)))) return;
1491 newset[0] = subwin;
1492 num = 1;
1493 data = (unsigned char *)newset;
1494 }
1495 else
1496 {
1497 if (!(newset = calloc(num + 1, sizeof(Ecore_X_Window)))) return;
1498 oldset = (Ecore_X_Window *)odata;
1499 for (i = 0; i < num; i++)
1500 {
1501 if (oldset[i] == subwin)
1502 {
1503 if (odata) free(odata);
1504 odata = NULL;
1505 free(newset);
1506 return;
1507 }
1508 newset[i] = oldset[i];
1509 }
1510 newset[num++] = subwin;
1511 if (odata) free(odata);
1512 data = (unsigned char *)newset;
1513 }
1514 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1515 ECORE_X_ATOM_WINDOW, 32, data, num);
1516 free(newset);
1517}
1518
1519/**
1520 * Remove a window from the list of colormap windows.
1521 * @param win The toplevel window
1522 * @param subwin The window to be removed from the colormap window list.
1523 */
1524EAPI void
1525ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
1526 Ecore_X_Window subwin)
1527{
1528 int num = 0, i = 0, j = 0, k = 0;
1529 unsigned char *odata = NULL, *data = NULL;
1530 Ecore_X_Window *newset = NULL, *oldset = NULL;
1531
1532 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1533
1534 if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1535 ECORE_X_ATOM_WINDOW, 32, &odata, &num))
1536 return;
1537
1538 oldset = (Ecore_X_Window *)odata;
1539 for (i = 0; i < num; i++)
1540 {
1541 if (oldset[i] == subwin)
1542 {
1543 if (num == 1)
1544 {
1545 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
1546 if (odata) free(odata);
1547 odata = NULL;
1548 return;
1549 }
1550 else
1551 {
1552 newset = calloc(num - 1, sizeof(Ecore_X_Window));
1553 data = (unsigned char *)newset;
1554 for (j = 0; j < num; ++j)
1555 if (oldset[j] != subwin)
1556 newset[k++] = oldset[j];
1557
1558 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1559 ECORE_X_ATOM_WINDOW, 32, data, k);
1560 if (odata) free(odata);
1561 odata = NULL;
1562 free(newset);
1563 return;
1564 }
1565 }
1566 }
1567 if (odata) free(odata);
1568}
1569
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
deleted file mode 100644
index 6789b94..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c
+++ /dev/null
@@ -1,740 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <sys/ipc.h>
3#include <sys/shm.h>
4#include <xcb/xcb_event.h>
5#include <xcb/shm.h>
6
7struct _Ecore_X_Image
8{
9 xcb_shm_segment_info_t shminfo;
10 xcb_image_t *xim;
11 Ecore_X_Visual vis;
12 int depth, w, h;
13 int bpl, bpp, rows;
14 unsigned char *data;
15 Eina_Bool shm : 1;
16};
17
18/* local function prototypes */
19static void _ecore_xcb_image_shm_check(void);
20static void _ecore_xcb_image_shm_create(Ecore_X_Image *im);
21static xcb_format_t *_ecore_xcb_image_find_format(const xcb_setup_t *setup,
22 uint8_t depth);
23
24/* local variables */
25static int _ecore_xcb_image_shm_can = -1;
26
27EAPI Ecore_X_Image *
28ecore_x_image_new(int w,
29 int h,
30 Ecore_X_Visual vis,
31 int depth)
32{
33 Ecore_X_Image *im;
34
35 LOGFN(__FILE__, __LINE__, __FUNCTION__);
36
37 if (!(im = calloc(1, sizeof(Ecore_X_Image)))) return NULL;
38 im->w = w;
39 im->h = h;
40 im->vis = vis;
41 im->depth = depth;
42 _ecore_xcb_image_shm_check();
43 im->shm = _ecore_xcb_image_shm_can;
44 return im;
45}
46
47EAPI void
48ecore_x_image_free(Ecore_X_Image *im)
49{
50 LOGFN(__FILE__, __LINE__, __FUNCTION__);
51 CHECK_XCB_CONN;
52
53 if (!im) return;
54 if (im->shm)
55 {
56 if (im->xim)
57 {
58 xcb_shm_detach(_ecore_xcb_conn, im->shminfo.shmseg);
59 xcb_image_destroy(im->xim);
60 shmdt(im->shminfo.shmaddr);
61 shmctl(im->shminfo.shmid, IPC_RMID, 0);
62 }
63 }
64 else if (im->xim)
65 {
66 if (im->xim->data) free(im->xim->data);
67 im->xim->data = NULL;
68 xcb_image_destroy(im->xim);
69 }
70
71 free(im);
72// ecore_x_flush();
73}
74
75EAPI Eina_Bool
76ecore_x_image_get(Ecore_X_Image *im,
77 Ecore_X_Drawable draw,
78 int x,
79 int y,
80 int sx,
81 int sy,
82 int w,
83 int h)
84{
85 Eina_Bool ret = EINA_TRUE;
86
87 LOGFN(__FILE__, __LINE__, __FUNCTION__);
88 CHECK_XCB_CONN;
89
90 if (im->shm)
91 {
92 if (!im->xim) _ecore_xcb_image_shm_create(im);
93 if (!im->xim) return EINA_FALSE;
94
95 if ((sx == 0) && (w == im->w))
96 {
97 im->xim->data = (uint8_t *)im->data + (im->xim->stride * sy) +
98 (sx * im->bpp);
99 im->xim->width = w;
100 im->xim->height = h;
101
102 ecore_x_grab();
103 if (!xcb_image_shm_get(_ecore_xcb_conn, draw, im->xim,
104 im->shminfo, x, y, 0xffffffff))
105 {
106 DBG("\tImage Shm Get Failed");
107 ret = EINA_FALSE;
108 }
109 ecore_x_ungrab();
110 ecore_x_sync(); // needed
111 }
112 else
113 {
114 Ecore_X_Image *tim;
115
116 tim = ecore_x_image_new(w, h, im->vis, im->depth);
117 if (tim)
118 {
119 ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h);
120 if (ret)
121 {
122 unsigned char *spixels, *pixels;
123 int sbpp = 0, sbpl = 0, srows = 0;
124 int bpp = 0, bpl = 0, rows = 0;
125
126 spixels =
127 ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp);
128 pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
129 if ((spixels) && (pixels))
130 {
131 unsigned char *p, *sp;
132 int r = 0;
133
134 p = (pixels + (sy * bpl) + (sx * bpp));
135 sp = spixels;
136 for (r = srows; r > 0; r--)
137 {
138 memcpy(p, sp, sbpl);
139 p += bpl;
140 sp += sbpl;
141 }
142 }
143 }
144 ecore_x_image_free(tim);
145 }
146 }
147 }
148 else
149 {
150 ret = EINA_FALSE;
151 ecore_x_grab();
152 im->xim =
153 xcb_image_get(_ecore_xcb_conn, draw, x, y, w, h,
154 0xffffffff, XCB_IMAGE_FORMAT_Z_PIXMAP);
155 if (!im->xim) ret = EINA_FALSE;
156 ecore_x_ungrab();
157 ecore_x_sync(); // needed
158
159 if (im->xim)
160 {
161 im->data = (unsigned char *)im->xim->data;
162 im->bpl = im->xim->stride;
163 im->rows = im->xim->height;
164 if (im->xim->bpp <= 8)
165 im->bpp = 1;
166 else if (im->xim->bpp <= 16)
167 im->bpp = 2;
168 else
169 im->bpp = 4;
170 }
171 }
172
173 return ret;
174}
175
176EAPI void *
177ecore_x_image_data_get(Ecore_X_Image *im,
178 int *bpl,
179 int *rows,
180 int *bpp)
181{
182 LOGFN(__FILE__, __LINE__, __FUNCTION__);
183
184 if (!im) return NULL;
185 if (!im->xim) _ecore_xcb_image_shm_create(im);
186 if (!im->xim) return NULL;
187
188 if (bpl) *bpl = im->bpl;
189 if (rows) *rows = im->rows;
190 if (bpp) *bpp = im->bpp;
191
192 return im->data;
193}
194
195EAPI void
196ecore_x_image_put(Ecore_X_Image *im,
197 Ecore_X_Drawable draw,
198 Ecore_X_GC gc,
199 int x,
200 int y,
201 int sx,
202 int sy,
203 int w,
204 int h)
205{
206 Ecore_X_GC tgc = 0;
207
208 LOGFN(__FILE__, __LINE__, __FUNCTION__);
209 CHECK_XCB_CONN;
210
211 if (!gc)
212 {
213 uint32_t mask, values[1];
214
215 tgc = xcb_generate_id(_ecore_xcb_conn);
216 mask = XCB_GC_SUBWINDOW_MODE;
217 values[0] = XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS;
218 xcb_create_gc(_ecore_xcb_conn, tgc, draw, mask, values);
219 gc = tgc;
220 }
221 if (!im->xim) _ecore_xcb_image_shm_create(im);
222 if (im->xim)
223 {
224 if (im->shm)
225 xcb_shm_put_image(_ecore_xcb_conn, draw, gc, im->xim->width,
226 im->xim->height, sx, sy, w, h, x, y,
227 im->xim->depth, im->xim->format, 0,
228 im->shminfo.shmseg,
229 im->xim->data - im->shminfo.shmaddr);
230// xcb_image_shm_put(_ecore_xcb_conn, draw, gc, im->xim,
231// im->shminfo, sx, sy, x, y, w, h, 0);
232 else
233 xcb_image_put(_ecore_xcb_conn, draw, gc, im->xim, sx, sy, 0);
234 }
235 if (tgc) ecore_x_gc_free(tgc);
236 ecore_x_sync();
237}
238
239EAPI Eina_Bool
240ecore_x_image_is_argb32_get(Ecore_X_Image *im)
241{
242 xcb_visualtype_t *vis;
243
244 LOGFN(__FILE__, __LINE__, __FUNCTION__);
245 CHECK_XCB_CONN;
246
247 vis = (xcb_visualtype_t *)im->vis;
248 if (!im->xim) _ecore_xcb_image_shm_create(im);
249
250 if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
251 (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) &&
252 (im->depth >= 24) && (vis->red_mask == 0xff0000) &&
253 (vis->green_mask == 0x00ff00) && (vis->blue_mask == 0x0000ff))
254 {
255#ifdef WORDS_BIGENDIAN
256 if (im->xim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
257 return EINA_TRUE;
258#else
259 if (im->xim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
260 return EINA_TRUE;
261#endif
262 }
263
264 return EINA_FALSE;
265}
266
267EAPI Eina_Bool
268ecore_x_image_to_argb_convert(void *src,
269 int sbpp,
270 int sbpl,
271 Ecore_X_Colormap c,
272 Ecore_X_Visual v,
273 int x,
274 int y,
275 int w,
276 int h,
277 unsigned int *dst,
278 int dbpl,
279 int dx,
280 int dy)
281{
282 xcb_visualtype_t *vis;
283 uint32_t *cols;
284 int n = 0, nret = 0, i, row, mode = 0;
285 unsigned int pal[256], r, g, b;
286 enum
287 {
288 rgbnone = 0,
289 rgb565,
290 bgr565,
291 rgbx555,
292 argbx888,
293 abgrx888,
294 rgba888x,
295 bgra888x,
296 argbx666
297 };
298
299 LOGFN(__FILE__, __LINE__, __FUNCTION__);
300 CHECK_XCB_CONN;
301
302 sbpp *= 8;
303
304 vis = (xcb_visualtype_t *)v;
305 n = vis->colormap_entries;
306 if ((n <= 256) &&
307 ((vis->_class == XCB_VISUAL_CLASS_PSEUDO_COLOR) ||
308 (vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) ||
309 (vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) ||
310 (vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY)))
311 {
312 xcb_query_colors_cookie_t cookie;
313 xcb_query_colors_reply_t *reply;
314
315 if (!c)
316 {
317 c = (xcb_colormap_t)((xcb_screen_t *)
318 _ecore_xcb_screen)->default_colormap;
319 }
320
321 cols = alloca(n * sizeof(uint32_t));
322 for (i = 0; i < n; i++)
323 cols[i] = i;
324
325 cookie = xcb_query_colors_unchecked(_ecore_xcb_conn, c, n, cols);
326 reply = xcb_query_colors_reply(_ecore_xcb_conn, cookie, NULL);
327 if (reply)
328 {
329 xcb_rgb_iterator_t iter;
330 xcb_rgb_t *ret;
331
332 iter = xcb_query_colors_colors_iterator(reply);
333 ret = xcb_query_colors_colors(reply);
334 if (ret)
335 {
336 for (i = 0; iter.rem; xcb_rgb_next(&iter), i++)
337 {
338 pal[i] = 0xff000000 |
339 ((iter.data->red >> 8) << 16) |
340 ((iter.data->green >> 8) << 8) |
341 ((iter.data->blue >> 8));
342 }
343 nret = n;
344 }
345 free(reply);
346 }
347 }
348 else if ((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) ||
349 (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR))
350 {
351 if ((vis->red_mask == 0x00ff0000) &&
352 (vis->green_mask == 0x0000ff00) &&
353 (vis->blue_mask == 0x000000ff))
354 mode = argbx888;
355 else if ((vis->red_mask == 0x000000ff) &&
356 (vis->green_mask == 0x0000ff00) &&
357 (vis->blue_mask == 0x00ff0000))
358 mode = abgrx888;
359 else if ((vis->red_mask == 0xff000000) &&
360 (vis->green_mask == 0x00ff0000) &&
361 (vis->blue_mask == 0x0000ff00))
362 mode = rgba888x;
363 else if ((vis->red_mask == 0x0000ff00) &&
364 (vis->green_mask == 0x00ff0000) &&
365 (vis->blue_mask == 0xff000000))
366 mode = bgra888x;
367 else if ((vis->red_mask == 0x0003f000) &&
368 (vis->green_mask == 0x00000fc0) &&
369 (vis->blue_mask == 0x0000003f))
370 mode = argbx666;
371 else if ((vis->red_mask == 0x0000f800) &&
372 (vis->green_mask == 0x000007e0) &&
373 (vis->blue_mask == 0x0000001f))
374 mode = rgb565;
375 else if ((vis->red_mask == 0x0000001f) &&
376 (vis->green_mask == 0x000007e0) &&
377 (vis->blue_mask == 0x0000f800))
378 mode = bgr565;
379 else if ((vis->red_mask == 0x00007c00) &&
380 (vis->green_mask == 0x000003e0) &&
381 (vis->blue_mask == 0x0000001f))
382 mode = rgbx555;
383 else
384 return EINA_FALSE;
385 }
386 for (row = 0; row < h; row++)
387 {
388 unsigned char *s8;
389 unsigned short *s16;
390 unsigned int *s32, *dp, *de;
391
392 dp = ((unsigned int *)(((unsigned char *)dst) +
393 ((dy + row) * dbpl))) + dx;
394 de = dp + w;
395 switch (sbpp)
396 {
397 case 8:
398 s8 = ((unsigned char *)(((unsigned char *)src) +
399 ((y + row) * sbpl))) + x;
400 if (nret > 0)
401 {
402 while (dp < de)
403 {
404 *dp = pal[*s8];
405 s8++; dp++;
406 }
407 }
408 else
409 return EINA_FALSE;
410 break;
411
412 case 16:
413 s16 = ((unsigned short *)(((unsigned char *)src) +
414 ((y + row) * sbpl))) + x;
415 switch (mode)
416 {
417 case rgb565:
418 while (dp < de)
419 {
420 r = (*s16 & 0xf800) << 8;
421 g = (*s16 & 0x07e0) << 5;
422 b = (*s16 & 0x001f) << 3;
423 r |= (r >> 5) & 0xff0000;
424 g |= (g >> 6) & 0x00ff00;
425 b |= (b >> 5);
426 *dp = 0xff000000 | r | g | b;
427 s16++; dp++;
428 }
429 break;
430
431 case bgr565:
432 while (dp < de)
433 {
434 r = (*s16 & 0x001f) << 19;
435 g = (*s16 & 0x07e0) << 5;
436 b = (*s16 & 0xf800) >> 8;
437 r |= (r >> 5) & 0xff0000;
438 g |= (g >> 6) & 0x00ff00;
439 b |= (b >> 5);
440 *dp = 0xff000000 | r | g | b;
441 s16++; dp++;
442 }
443 break;
444
445 case rgbx555:
446 while (dp < de)
447 {
448 r = (*s16 & 0x7c00) << 9;
449 g = (*s16 & 0x03e0) << 6;
450 b = (*s16 & 0x001f) << 3;
451 r |= (r >> 5) & 0xff0000;
452 g |= (g >> 5) & 0x00ff00;
453 b |= (b >> 5);
454 *dp = 0xff000000 | r | g | b;
455 s16++; dp++;
456 }
457 break;
458
459 default:
460 return EINA_FALSE;
461 break;
462 }
463 break;
464
465 case 24:
466 case 32:
467 s32 = ((unsigned int *)(((unsigned char *)src) +
468 ((y + row) * sbpl))) + x;
469 switch (mode)
470 {
471 case argbx888:
472 while (dp < de)
473 {
474 *dp = 0xff000000 | *s32;
475 s32++; dp++;
476 }
477 break;
478
479 case abgrx888:
480 while (dp < de)
481 {
482 r = *s32 & 0x000000ff;
483 g = *s32 & 0x0000ff00;
484 b = *s32 & 0x00ff0000;
485 *dp = 0xff000000 | (r << 16) | (g) | (b >> 16);
486 s32++; dp++;
487 }
488 break;
489
490 case rgba888x:
491 while (dp < de)
492 {
493 *dp = 0xff000000 | (*s32 >> 8);
494 s32++; dp++;
495 }
496 break;
497
498 case bgra888x:
499 while (dp < de)
500 {
501 r = *s32 & 0x0000ff00;
502 g = *s32 & 0x00ff0000;
503 b = *s32 & 0xff000000;
504 *dp = 0xff000000 | (r << 8) | (g >> 8) | (b >> 24);
505 s32++; dp++;
506 }
507 break;
508
509 case argbx666:
510 while (dp < de)
511 {
512 r = (*s32 & 0x3f000) << 6;
513 g = (*s32 & 0x00fc0) << 4;
514 b = (*s32 & 0x0003f) << 2;
515 r |= (r >> 6) & 0xff0000;
516 g |= (g >> 6) & 0x00ff00;
517 b |= (b >> 6);
518 *dp = 0xff000000 | r | g | b;
519 s32++; dp++;
520 }
521 break;
522
523 default:
524 return EINA_FALSE;
525 break;
526 }
527 break;
528 break;
529
530 default:
531 return EINA_FALSE;
532 break;
533 }
534 }
535 return EINA_TRUE;
536}
537
538/* local functions */
539static void
540_ecore_xcb_image_shm_check(void)
541{
542// xcb_shm_query_version_reply_t *reply;
543 xcb_shm_segment_info_t shminfo;
544 xcb_shm_get_image_cookie_t cookie;
545 xcb_shm_get_image_reply_t *ireply;
546 xcb_image_t *img = 0;
547 uint8_t depth = 0;
548
549 if (_ecore_xcb_image_shm_can != -1) return;
550 CHECK_XCB_CONN;
551
552 /* reply = */
553 /* xcb_shm_query_version_reply(_ecore_xcb_conn, */
554 /* xcb_shm_query_version(_ecore_xcb_conn), NULL); */
555 /* if (!reply) */
556 /* { */
557 /* _ecore_xcb_image_shm_can = 0; */
558 /* return; */
559 /* } */
560
561 /* if ((reply->major_version < 1) || */
562 /* ((reply->major_version == 1) && (reply->minor_version == 0))) */
563 /* { */
564 /* _ecore_xcb_image_shm_can = 0; */
565 /* free(reply); */
566 /* return; */
567 /* } */
568
569 /* free(reply); */
570
571 depth = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
572
573 ecore_x_sync(); // needed
574
575 img = _ecore_xcb_image_create_native(1, 1, XCB_IMAGE_FORMAT_Z_PIXMAP,
576 depth, NULL, ~0, NULL);
577 if (!img)
578 {
579 _ecore_xcb_image_shm_can = 0;
580 return;
581 }
582
583 shminfo.shmid =
584 shmget(IPC_PRIVATE, img->stride * img->height, (IPC_CREAT | 0666));
585 if (shminfo.shmid == (uint32_t)-1)
586 {
587 xcb_image_destroy(img);
588 _ecore_xcb_image_shm_can = 0;
589 return;
590 }
591
592 shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
593 img->data = shminfo.shmaddr;
594 if (img->data == (uint8_t *)-1)
595 {
596 xcb_image_destroy(img);
597 _ecore_xcb_image_shm_can = 0;
598 return;
599 }
600
601 shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn);
602 xcb_shm_attach(_ecore_xcb_conn, shminfo.shmseg, shminfo.shmid, 0);
603
604 cookie =
605 xcb_shm_get_image(_ecore_xcb_conn,
606 ((xcb_screen_t *)_ecore_xcb_screen)->root,
607 0, 0, img->width, img->height,
608 0xffffffff, img->format,
609 shminfo.shmseg, img->data - shminfo.shmaddr);
610
611 ecore_x_sync(); // needed
612
613 ireply = xcb_shm_get_image_reply(_ecore_xcb_conn, cookie, NULL);
614 if (ireply)
615 {
616 _ecore_xcb_image_shm_can = 1;
617 free(ireply);
618 }
619 else
620 _ecore_xcb_image_shm_can = 0;
621
622 xcb_shm_detach(_ecore_xcb_conn, shminfo.shmseg);
623 xcb_image_destroy(img);
624 shmdt(shminfo.shmaddr);
625 shmctl(shminfo.shmid, IPC_RMID, 0);
626}
627
628static void
629_ecore_xcb_image_shm_create(Ecore_X_Image *im)
630{
631 CHECK_XCB_CONN;
632
633 im->xim =
634 _ecore_xcb_image_create_native(im->w, im->h, XCB_IMAGE_FORMAT_Z_PIXMAP,
635 im->depth, NULL, ~0, NULL);
636 if (!im->xim) return;
637
638 im->shminfo.shmid = shmget(IPC_PRIVATE, im->xim->size, (IPC_CREAT | 0666));
639 if (im->shminfo.shmid == (uint32_t)-1)
640 {
641 xcb_image_destroy(im->xim);
642 return;
643 }
644
645 im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0);
646 im->xim->data = im->shminfo.shmaddr;
647 if ((!im->xim->data) || (im->xim->data == (uint8_t *)-1))
648 {
649 DBG("Shm Create No Image Data");
650 xcb_image_destroy(im->xim);
651 shmdt(im->shminfo.shmaddr);
652 shmctl(im->shminfo.shmid, IPC_RMID, 0);
653 return;
654 }
655
656 im->shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn);
657 xcb_shm_attach(_ecore_xcb_conn, im->shminfo.shmseg, im->shminfo.shmid, 0);
658
659 im->data = (unsigned char *)im->xim->data;
660 im->bpl = im->xim->stride;
661 im->rows = im->xim->height;
662 if (im->xim->bpp <= 8)
663 im->bpp = 1;
664 else if (im->xim->bpp <= 16)
665 im->bpp = 2;
666 else
667 im->bpp = 4;
668}
669
670xcb_image_t *
671_ecore_xcb_image_create_native(int w,
672 int h,
673 xcb_image_format_t format,
674 uint8_t depth,
675 void *base,
676 uint32_t bytes,
677 uint8_t *data)
678{
679 static uint8_t dpth = 0;
680 static xcb_format_t *fmt = NULL;
681 const xcb_setup_t *setup;
682 xcb_image_format_t xif;
683
684 CHECK_XCB_CONN;
685
686 /* NB: We cannot use xcb_image_create_native as it only creates images
687 * using MSB_FIRST, so this routine recreates that function and uses
688 * the endian-ness of the server setup */
689 setup = xcb_get_setup(_ecore_xcb_conn);
690 xif = format;
691
692 if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1))
693 xif = XCB_IMAGE_FORMAT_XY_PIXMAP;
694
695 if (dpth != depth)
696 {
697 dpth = depth;
698 fmt = _ecore_xcb_image_find_format(setup, depth);
699 if (!fmt) return 0;
700 }
701
702 switch (xif)
703 {
704 case XCB_IMAGE_FORMAT_XY_BITMAP:
705 if (depth != 1) return 0;
706
707 case XCB_IMAGE_FORMAT_XY_PIXMAP:
708 case XCB_IMAGE_FORMAT_Z_PIXMAP:
709 return xcb_image_create(w, h, xif,
710 fmt->scanline_pad,
711 fmt->depth, fmt->bits_per_pixel,
712 setup->bitmap_format_scanline_unit,
713 setup->image_byte_order,
714 setup->bitmap_format_bit_order,
715 base, bytes, data);
716
717 default:
718 break;
719 }
720
721 return 0;
722}
723
724static xcb_format_t *
725_ecore_xcb_image_find_format(const xcb_setup_t *setup,
726 uint8_t depth)
727{
728 xcb_format_t *fmt, *fmtend;
729
730 CHECK_XCB_CONN;
731
732 fmt = xcb_setup_pixmap_formats(setup);
733 fmtend = fmt + xcb_setup_pixmap_formats_length(setup);
734 for (; fmt != fmtend; ++fmt)
735 if (fmt->depth == depth)
736 return fmt;
737
738 return 0;
739}
740
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
deleted file mode 100644
index c0338c2..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c
+++ /dev/null
@@ -1,274 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_XINPUT
3# include <xcb/xinput.h>
4# include <xcb/xcb_event.h>
5#endif
6
7/* FIXME: this is a guess. can't find defines for touch events in xcb libs
8 * online */
9/* these are not yet defined in xcb support for xi2 - so manually create */
10#ifndef XCB_INPUT_DEVICE_TOUCH_BEGIN
11#define XCB_INPUT_DEVICE_TOUCH_BEGIN 18
12#endif
13#ifndef XCB_INPUT_DEVICE_TOUCH_END
14#define XCB_INPUT_DEVICE_TOUCH_END 19
15#endif
16#ifndef XCB_INPUT_DEVICE_TOUCH_UPDATE
17#define XCB_INPUT_DEVICE_TOUCH_UPDATE 21
18#endif
19
20#ifndef XCB_INPUT_POINTER_EMULATED_MASK
21#define XCB_INPUT_POINTER_EMULATED_MASK (1 << 16)
22#endif
23
24/* local variables */
25static Eina_Bool _input_avail = EINA_FALSE;
26
27/* external variables */
28int _ecore_xcb_event_input = 0;
29
30void
31_ecore_xcb_input_init(void)
32{
33 LOGFN(__FILE__, __LINE__, __FUNCTION__);
34
35#ifdef ECORE_XCB_XINPUT
36 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_input_id);
37#endif
38}
39
40void
41_ecore_xcb_input_finalize(void)
42{
43#ifdef ECORE_XCB_XINPUT
44 xcb_input_get_extension_version_cookie_t cookie;
45 xcb_input_get_extension_version_reply_t *reply;
46 char buff[128];
47#endif
48
49 LOGFN(__FILE__, __LINE__, __FUNCTION__);
50
51#ifdef ECORE_XCB_XINPUT
52 cookie =
53 xcb_input_get_extension_version_unchecked(_ecore_xcb_conn, 127, buff);
54 reply =
55 xcb_input_get_extension_version_reply(_ecore_xcb_conn, cookie, NULL);
56 if (reply)
57 {
58 _input_avail = EINA_TRUE;
59 free(reply);
60 }
61
62 if (_input_avail)
63 {
64 const xcb_query_extension_reply_t *ext_reply;
65
66 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_input_id);
67 if (ext_reply)
68 _ecore_xcb_event_input = ext_reply->first_event;
69 }
70#endif
71}
72
73void
74_ecore_xcb_input_shutdown(void)
75{
76 LOGFN(__FILE__, __LINE__, __FUNCTION__);
77}
78
79void
80#ifdef ECORE_XCB_XINPUT
81_ecore_xcb_input_handle_event(xcb_generic_event_t *event)
82#else
83_ecore_xcb_input_handle_event(xcb_generic_event_t * event __UNUSED__)
84#endif
85{
86#ifdef ECORE_XCB_XINPUT
87 xcb_ge_event_t *ev;
88#endif
89
90 LOGFN(__FILE__, __LINE__, __FUNCTION__);
91 CHECK_XCB_CONN;
92
93 /* FIXME: look at xlib ecore_x_xi2.c to copy logic in when i can find an
94 * xcb-input lib to test with */
95#ifdef ECORE_XCB_XINPUT
96 ev = (xcb_ge_event_t *)event;
97 switch (ev->event_type)
98 {
99 case XCB_INPUT_DEVICE_MOTION_NOTIFY:
100 {
101 xcb_input_device_motion_notify_event_t *de;
102 unsigned int child_win = 0;
103
104 de = (xcb_input_device_motion_notify_event_t *)ev->pad1;
105 child_win = (de->child ? de->child : de->event);
106 _ecore_xcb_event_mouse_move(de->time, de->state, de->event_x,
107 de->event_y, de->root_x, de->root_y,
108 de->event, child_win, de->root,
109 de->same_screen, de->device_id,
110 1, 1, 1.0, 0.0,
111 de->event_x, de->event_y,
112 de->root_x, de->root_y);
113 }
114 break;
115
116 case XCB_INPUT_DEVICE_BUTTON_PRESS:
117 {
118 xcb_input_device_button_press_event_t *de;
119 unsigned int child_win = 0;
120
121 de = (xcb_input_device_button_press_event_t *)ev->pad1;
122 child_win = (de->child ? de->child : de->event);
123 _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
124 de->time, de->state, de->detail,
125 de->event_x, de->event_y,
126 de->root_x, de->root_y, de->event,
127 child_win, de->root,
128 de->same_screen, de->device_id,
129 1, 1, 1.0, 0.0,
130 de->event_x, de->event_y,
131 de->root_x, de->root_y);
132 }
133 break;
134
135 case XCB_INPUT_DEVICE_BUTTON_RELEASE:
136 {
137 xcb_input_device_button_release_event_t *de;
138 unsigned int child_win = 0;
139
140 de = (xcb_input_device_button_release_event_t *)ev->pad1;
141 child_win = (de->child ? de->child : de->event);
142 _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
143 de->time, de->state, de->detail,
144 de->event_x, de->event_y,
145 de->root_x, de->root_y, de->event,
146 child_win, de->root,
147 de->same_screen, de->device_id,
148 1, 1, 1.0, 0.0,
149 de->event_x, de->event_y,
150 de->root_x, de->root_y);
151 }
152 break;
153
154 case XCB_INPUT_DEVICE_TOUCH_UPDATE:
155 {
156 xcb_input_device_motion_notify_event_t *de;
157 unsigned int child_win = 0;
158
159 de = (xcb_input_device_motion_notify_event_t *)ev->pad1;
160 child_win = (de->child ? de->child : de->event);
161 _ecore_xcb_event_mouse_move(de->time, de->state, de->event_x,
162 de->event_y, de->root_x, de->root_y,
163 de->event, child_win, de->root,
164 de->same_screen, de->device_id,
165 1, 1, 1.0, 0.0,
166 de->event_x, de->event_y,
167 de->root_x, de->root_y);
168 }
169 break;
170
171 case XCB_INPUT_DEVICE_TOUCH_BEGIN:
172 {
173 xcb_input_device_button_press_event_t *de;
174 unsigned int child_win = 0;
175
176 de = (xcb_input_device_button_press_event_t *)ev->pad1;
177 child_win = (de->child ? de->child : de->event);
178 _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
179 de->time, de->state, de->detail,
180 de->event_x, de->event_y,
181 de->root_x, de->root_y, de->event,
182 child_win, de->root,
183 de->same_screen, de->device_id,
184 1, 1, 1.0, 0.0,
185 de->event_x, de->event_y,
186 de->root_x, de->root_y);
187 }
188 break;
189
190 case XCB_INPUT_DEVICE_TOUCH_END:
191 {
192 xcb_input_device_button_release_event_t *de;
193 unsigned int child_win = 0;
194
195 de = (xcb_input_device_button_release_event_t *)ev->pad1;
196 child_win = (de->child ? de->child : de->event);
197 _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
198 de->time, de->state, de->detail,
199 de->event_x, de->event_y,
200 de->root_x, de->root_y, de->event,
201 child_win, de->root,
202 de->same_screen, de->device_id,
203 1, 1, 1.0, 0.0,
204 de->event_x, de->event_y,
205 de->root_x, de->root_y);
206 }
207 break;
208
209 default:
210 break;
211 }
212#endif
213}
214
215EAPI Eina_Bool
216ecore_x_input_multi_select(Ecore_X_Window win)
217{
218 Eina_Bool find = EINA_FALSE;
219#ifdef ECORE_XCB_XINPUT
220 xcb_input_list_input_devices_cookie_t dcookie;
221 xcb_input_list_input_devices_reply_t *dreply;
222 xcb_input_device_info_iterator_t diter;
223#endif
224
225 LOGFN(__FILE__, __LINE__, __FUNCTION__);
226 CHECK_XCB_CONN;
227
228 if (!_input_avail) return EINA_FALSE;
229
230 /* FIXME: i can't seemingly test this! no xcb input lib so can't look and
231 * test and look at types etc. - look at xlib code and copy logic over
232 * when we can */
233#ifdef ECORE_XCB_XINPUT
234 dcookie = xcb_input_list_input_devices_unchecked(_ecore_xcb_conn);
235 dreply =
236 xcb_input_list_input_devices_reply(_ecore_xcb_conn, dcookie, NULL);
237 if (!dreply) return EINA_FALSE;
238
239 diter = xcb_input_list_input_devices_devices_iterator(dreply);
240 while (diter.rem)
241 {
242 xcb_input_device_info_t *dev;
243 const xcb_input_event_class_t iclass[] =
244 {
245 XCB_INPUT_DEVICE_BUTTON_PRESS,
246 XCB_INPUT_DEVICE_BUTTON_RELEASE,
247 XCB_INPUT_DEVICE_MOTION_NOTIFY,
248 XCB_INPUT_DEVICE_TOUCH_BEGIN,
249 XCB_INPUT_DEVICE_TOUCH_END,
250 XCB_INPUT_DEVICE_TOUCH_UPDATE
251 };
252
253 dev = diter.data;
254 if (dev->device_use == XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE)
255 {
256 DBG("Device %d", dev->device_id);
257 DBG("\tType: %d", dev->device_type);
258 DBG("\tNum Classes: %d", dev->num_class_info);
259 DBG("\tUse: %d", dev->device_use);
260
261 xcb_input_select_extension_event(_ecore_xcb_conn, win,
262 sizeof(iclass) / sizeof(xcb_input_event_class_t),
263 iclass);
264 find = EINA_TRUE;
265 }
266 xcb_input_device_info_next(&diter);
267 }
268 free(dreply);
269#endif
270
271 return find;
272 win = 0;
273}
274
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
deleted file mode 100644
index b1c7528..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c
+++ /dev/null
@@ -1,490 +0,0 @@
1#include "ecore_xcb_private.h"
2#define NEED_KEYSYM_TABLE
3#define NEED_VTABLE
4#include "ecore_xcb_keysym_table.h"
5#include <xcb/xcb_keysyms.h>
6#include <X11/keysym.h>
7
8/* local function prototypes */
9static int _ecore_xcb_keymap_mask_get(void *reply,
10 xcb_keysym_t sym);
11static xcb_keysym_t _ecore_xcb_keymap_string_to_keysym(const char *str);
12static int _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode,
13 unsigned int modifiers,
14 unsigned int *modifiers_return,
15 xcb_keysym_t *keysym_return);
16static int _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym,
17 unsigned int modifiers,
18 char *buffer,
19 int bytes);
20
21/* local variables */
22static xcb_key_symbols_t *_ecore_xcb_keysyms;
23static int _ecore_xcb_mode_switch = 0;
24
25/* public variables */
26EAPI int ECORE_X_MODIFIER_SHIFT = 0;
27EAPI int ECORE_X_MODIFIER_CTRL = 0;
28EAPI int ECORE_X_MODIFIER_ALT = 0;
29EAPI int ECORE_X_MODIFIER_WIN = 0;
30EAPI int ECORE_X_LOCK_SCROLL = 0;
31EAPI int ECORE_X_LOCK_NUM = 0;
32EAPI int ECORE_X_LOCK_CAPS = 0;
33EAPI int ECORE_X_LOCK_SHIFT = 0;
34
35void
36_ecore_xcb_keymap_init(void)
37{
38 LOGFN(__FILE__, __LINE__, __FUNCTION__);
39
40 _ecore_xcb_keysyms = xcb_key_symbols_alloc(_ecore_xcb_conn);
41}
42
43void
44_ecore_xcb_keymap_finalize(void)
45{
46 xcb_get_modifier_mapping_cookie_t cookie;
47 xcb_get_modifier_mapping_reply_t *reply;
48
49 LOGFN(__FILE__, __LINE__, __FUNCTION__);
50 CHECK_XCB_CONN;
51
52 cookie = xcb_get_modifier_mapping_unchecked(_ecore_xcb_conn);
53 reply = xcb_get_modifier_mapping_reply(_ecore_xcb_conn, cookie, NULL);
54 if (!reply)
55 {
56 xcb_key_symbols_free(_ecore_xcb_keysyms);
57 return;
58 }
59
60 _ecore_xcb_mode_switch = _ecore_xcb_keymap_mask_get(reply, XK_Mode_switch);
61
62 ECORE_X_MODIFIER_SHIFT = _ecore_xcb_keymap_mask_get(reply, XK_Shift_L);
63 ECORE_X_MODIFIER_CTRL = _ecore_xcb_keymap_mask_get(reply, XK_Control_L);
64
65 ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Alt_L);
66 if (!ECORE_X_MODIFIER_ALT)
67 ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Meta_L);
68 if (!ECORE_X_MODIFIER_ALT)
69 ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Super_L);
70
71 ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Super_L);
72 if (!ECORE_X_MODIFIER_WIN)
73 ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Mode_switch);
74 if (!ECORE_X_MODIFIER_WIN)
75 ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Meta_L);
76
77 if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT)
78 ECORE_X_MODIFIER_WIN = 0;
79 if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL)
80 ECORE_X_MODIFIER_ALT = 0;
81
82 ECORE_X_LOCK_SCROLL = _ecore_xcb_keymap_mask_get(reply, XK_Scroll_Lock);
83 ECORE_X_LOCK_NUM = _ecore_xcb_keymap_mask_get(reply, XK_Num_Lock);
84 ECORE_X_LOCK_CAPS = _ecore_xcb_keymap_mask_get(reply, XK_Caps_Lock);
85 ECORE_X_LOCK_SHIFT = _ecore_xcb_keymap_mask_get(reply, XK_Shift_Lock);
86}
87
88void
89_ecore_xcb_modifiers_get(void)
90{
91 _ecore_xcb_keymap_finalize();
92}
93
94void
95_ecore_xcb_keymap_shutdown(void)
96{
97 LOGFN(__FILE__, __LINE__, __FUNCTION__);
98
99 if (_ecore_xcb_keysyms) xcb_key_symbols_free(_ecore_xcb_keysyms);
100}
101
102void
103_ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event)
104{
105 CHECK_XCB_CONN;
106 xcb_refresh_keyboard_mapping(_ecore_xcb_keysyms, event);
107}
108
109xcb_keysym_t
110_ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode,
111 int col)
112{
113 xcb_keysym_t key0, key1;
114
115 CHECK_XCB_CONN;
116 if (col & _ecore_xcb_mode_switch)
117 {
118 key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 4);
119 key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 5);
120 }
121 else
122 {
123 key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 0);
124 key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 1);
125 }
126
127 if (key1 == XCB_NO_SYMBOL)
128 key1 = key0;
129
130 if ((col & ECORE_X_LOCK_NUM) &&
131 ((xcb_is_keypad_key(key1)) || (xcb_is_private_keypad_key(key1))))
132 {
133 if ((col & XCB_MOD_MASK_SHIFT) ||
134 ((col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_SHIFT)))
135 return key0;
136 else
137 return key1;
138 }
139 else if (!(col & XCB_MOD_MASK_SHIFT) && !(col & XCB_MOD_MASK_LOCK))
140 return key0;
141 else if (!(col & XCB_MOD_MASK_SHIFT) &&
142 (col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_CAPS)))
143 return key1;
144 else if ((col & XCB_MOD_MASK_SHIFT) &&
145 (col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_CAPS))
146 return key0;
147 else if ((col & XCB_MOD_MASK_SHIFT) ||
148 (col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_SHIFT)))
149 return key1;
150
151 return XCB_NO_SYMBOL;
152}
153
154xcb_keycode_t *
155_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym)
156{
157 CHECK_XCB_CONN;
158 return xcb_key_symbols_get_keycode(_ecore_xcb_keysyms, keysym);
159}
160
161char *
162_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym)
163{
164 int i = 0, n = 0, h = 0, idx = 0;
165 const unsigned char *entry;
166 unsigned char val1, val2, val3, val4;
167
168 CHECK_XCB_CONN;
169 if (!keysym) return NULL;
170 if (keysym == XK_VoidSymbol) keysym = 0;
171 if (keysym <= 0x1fffffff)
172 {
173 val1 = (keysym >> 24);
174 val2 = ((keysym >> 16) & 0xff);
175 val3 = ((keysym >> 8) & 0xff);
176 val4 = (keysym & 0xff);
177 i = keysym % VTABLESIZE;
178 h = i + 1;
179 n = VMAXHASH;
180 while ((idx = hashKeysym[i]))
181 {
182 entry = &_ecore_xcb_keytable[idx];
183 if ((entry[0] == val1) && (entry[1] == val2) &&
184 (entry[2] == val3) && (entry[3] == val4))
185 return (char *)entry + 4;
186 if (!--n) break;
187 i += h;
188 if (i >= VTABLESIZE) i -= VTABLESIZE;
189 }
190 }
191
192 if ((keysym >= 0x01000100) && (keysym <= 0x0110ffff))
193 {
194 xcb_keysym_t val;
195 char *s = NULL;
196 int i = 0;
197
198 val = (keysym & 0xffffff);
199 if (val & 0xff0000)
200 i = 10;
201 else
202 i = 6;
203
204 if (!(s = malloc(i))) return NULL;
205 i--;
206 s[i--] = '\0';
207 for (; i; i--)
208 {
209 val1 = (val & 0xf);
210 val >>= 4;
211 if (val1 < 10)
212 s[i] = '0' + val1;
213 else
214 s[i] = 'A' + val1 - 10;
215 }
216 s[i] = 'U';
217 return s;
218 }
219
220 return NULL;
221}
222
223xcb_keycode_t
224_ecore_xcb_keymap_string_to_keycode(const char *key)
225{
226 if (!strncmp(key, "Keycode-", 8))
227 return atoi(key + 8);
228 else
229 {
230 xcb_keysym_t keysym = XCB_NO_SYMBOL;
231 xcb_keycode_t *keycodes, keycode = 0;
232 int i = 0;
233
234 CHECK_XCB_CONN;
235
236 keysym = _ecore_xcb_keymap_string_to_keysym(key);
237 if (keysym == XCB_NO_SYMBOL) return XCB_NO_SYMBOL;
238
239 keycodes = _ecore_xcb_keymap_keysym_to_keycode(keysym);
240 if (!keycodes) return XCB_NO_SYMBOL;
241
242 while (keycodes[i] != XCB_NO_SYMBOL)
243 {
244 if (keycodes[i] != 0)
245 {
246 keycode = keycodes[i];
247 break;
248 }
249 i++;
250 }
251 return keycode;
252 }
253}
254
255int
256_ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode,
257 int state,
258 char *buffer,
259 int bytes,
260 xcb_keysym_t *sym)
261{
262 unsigned int modifiers = 0;
263 xcb_keysym_t keysym;
264
265 CHECK_XCB_CONN;
266 if (!_ecore_xcb_keymap_translate_key(keycode, state, &modifiers, &keysym))
267 return 0;
268
269 if (sym) *sym = keysym;
270
271 return _ecore_xcb_keymap_translate_keysym(keysym, state, buffer, bytes);
272}
273
274EAPI const char *
275ecore_x_keysym_string_get(int keysym)
276{
277 LOGFN(__FILE__, __LINE__, __FUNCTION__);
278
279 return _ecore_xcb_keymap_keysym_to_string(keysym);
280}
281
282EAPI int
283ecore_x_keysym_keycode_get(const char *keyname)
284{
285 LOGFN(__FILE__, __LINE__, __FUNCTION__);
286
287 return _ecore_xcb_keymap_string_to_keycode(keyname);
288}
289
290/* local functions */
291static int
292_ecore_xcb_keymap_mask_get(void *reply,
293 xcb_keysym_t sym)
294{
295 xcb_get_modifier_mapping_reply_t *rep;
296 xcb_keysym_t sym2;
297 int mask = 0;
298 const int masks[8] =
299 {
300 XCB_MOD_MASK_SHIFT, XCB_MOD_MASK_LOCK, XCB_MOD_MASK_CONTROL,
301 XCB_MOD_MASK_1, XCB_MOD_MASK_2, XCB_MOD_MASK_3, XCB_MOD_MASK_4,
302 XCB_MOD_MASK_5
303 };
304
305 LOGFN(__FILE__, __LINE__, __FUNCTION__);
306 CHECK_XCB_CONN;
307
308 rep = (xcb_get_modifier_mapping_reply_t *)reply;
309 if ((rep) && (rep->keycodes_per_modifier > 0))
310 {
311 int i = 0;
312 xcb_keycode_t *modmap;
313
314 modmap = xcb_get_modifier_mapping_keycodes(rep);
315 for (i = 0; i < (8 * rep->keycodes_per_modifier); i++)
316 {
317 int j = 0;
318
319 for (j = 0; j < 8; j++)
320 {
321 sym2 =
322 xcb_key_symbols_get_keysym(_ecore_xcb_keysyms,
323 modmap[i], j);
324 if (sym2 != 0) break;
325 }
326 if (sym2 == sym)
327 {
328 mask = masks[i / rep->keycodes_per_modifier];
329 break;
330 }
331 }
332 }
333
334 return mask;
335}
336
337static xcb_keysym_t
338_ecore_xcb_keymap_string_to_keysym(const char *str)
339{
340 int i = 0, n = 0, h = 0;
341 unsigned long sig = 0;
342 const char *p = NULL;
343 int c = 0, idx = 0;
344 const unsigned char *entry;
345 unsigned char sig1, sig2;
346 long unsigned int val;
347
348 p = str;
349 while ((c = *p++))
350 sig = (sig << 1) + c;
351
352 i = (sig % KTABLESIZE);
353 h = i + 1;
354 sig1 = (sig >> 8) & 0xff;
355 sig2 = sig & 0xff;
356 n = KMAXHASH;
357
358 while ((idx = hashString[i]))
359 {
360 entry = &_ecore_xcb_keytable[idx];
361 if ((entry[0] == sig1) && (entry[1] == sig2) &&
362 !strcmp(str, (char *)entry + 6))
363 {
364 val = ((entry[2] << 24) | (entry[3] << 16) |
365 (entry[4] << 8) | (entry[5]));
366 if (!val) val = 0xffffff;
367 return val;
368 }
369 if (!--n) break;
370 i += h;
371 if (i >= KTABLESIZE) i -= KTABLESIZE;
372 }
373
374 if (*str == 'U')
375 {
376 val = 0;
377 for (p = &str[1]; *p; p++)
378 {
379 c = *p;
380 if (('0' <= c) && (c <= '9'))
381 val = (val << 4) + c - '0';
382 else if (('a' <= c) && (c <= 'f'))
383 val = (val << 4) + c - 'a' + 10;
384 else if (('A' <= c) && (c <= 'F'))
385 val = (val << 4) + c - 'A' + 10;
386 else
387 return XCB_NO_SYMBOL;
388 if (val > 0x10ffff) return XCB_NO_SYMBOL;
389 }
390 if ((val < 0x20) || ((val > 0x7e) && (val < 0xa0)))
391 return XCB_NO_SYMBOL;
392 if (val < 0x100) return val;
393 return val | 0x01000000;
394 }
395
396 if ((strlen(str) > 2) && (str[0] == '0') && (str[1] == 'x'))
397 {
398 char *tmp = NULL;
399
400 val = strtoul(str, &tmp, 16);
401 if ((val == ULONG_MAX) || ((tmp) && (*tmp != '\0')))
402 return XCB_NO_SYMBOL;
403 else
404 return val;
405 }
406
407 if (!strncmp(str, "XF86_", 5))
408 {
409 long unsigned int ret;
410 char *tmp;
411
412 tmp = strdup(str);
413 if (!tmp) return XCB_NO_SYMBOL;
414 memmove(&tmp[4], &tmp[5], strlen(str) - 5 + 1);
415 ret = _ecore_xcb_keymap_string_to_keysym(tmp);
416 free(tmp);
417 return ret;
418 }
419
420 return XCB_NO_SYMBOL;
421}
422
423static int
424_ecore_xcb_keymap_translate_key(xcb_keycode_t keycode,
425 unsigned int modifiers,
426 unsigned int *modifiers_return,
427 xcb_keysym_t *keysym_return)
428{
429 xcb_keysym_t sym;
430
431 if (!_ecore_xcb_keysyms) return 0;
432
433 sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, modifiers);
434
435 if (modifiers_return)
436 *modifiers_return = ((XCB_MOD_MASK_SHIFT | XCB_MOD_MASK_LOCK) |
437 _ecore_xcb_mode_switch | ECORE_X_LOCK_NUM);
438 if (keysym_return)
439 *keysym_return = sym;
440
441 return 1;
442}
443
444static int
445_ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym,
446 unsigned int modifiers,
447 char *buffer,
448 int bytes)
449{
450 unsigned long hbytes = 0;
451 unsigned char c;
452
453 if (!keysym) return 0;
454 hbytes = (keysym >> 8);
455
456 if (!(bytes &&
457 ((hbytes == 0) ||
458 ((hbytes == 0xFF) &&
459 (((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) ||
460 (keysym == XK_Return) || (keysym == XK_Escape) ||
461 (keysym == XK_KP_Space) || (keysym == XK_KP_Tab) ||
462 (keysym == XK_KP_Enter) ||
463 ((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) ||
464 (keysym == XK_KP_Equal) || (keysym == XK_Delete))))))
465 return 0;
466
467 if (keysym == XK_KP_Space)
468 c = (XK_space & 0x7F);
469 else if (hbytes == 0xFF)
470 c = (keysym & 0x7F);
471 else
472 c = (keysym & 0xFF);
473
474 if (modifiers & ECORE_X_MODIFIER_CTRL)
475 {
476 if (((c >= '@') && (c < '\177')) || c == ' ')
477 c &= 0x1F;
478 else if (c == '2')
479 c = '\000';
480 else if ((c >= '3') && (c <= '7'))
481 c -= ('3' - '\033');
482 else if (c == '8')
483 c = '\177';
484 else if (c == '/')
485 c = '_' & 0x1F;
486 }
487 buffer[0] = c;
488 return 1;
489}
490
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
deleted file mode 100644
index 6c95331..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c
+++ /dev/null
@@ -1,104 +0,0 @@
1#include "ecore_xcb_private.h"
2//#include "Ecore_X_Atoms.h"
3
4#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
5#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
6#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
7#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
8
9typedef struct _mwmhints
10{
11 uint32_t flags;
12 uint32_t functions;
13 uint32_t decorations;
14 int32_t inputmode;
15 uint32_t status;
16} MWMHints;
17
18/**
19 * @defgroup Ecore_X_MWM_Group MWM related functions.
20 *
21 * Functions related to MWM.
22 */
23
24/**
25 * Sets the borderless flag of a window using MWM.
26 *
27 * @param win The window.
28 * @param borderless The borderless flag.
29 *
30 * @ingroup Ecore_X_MWM_Group
31 */
32EAPI void
33ecore_x_mwm_borderless_set(Ecore_X_Window win,
34 Eina_Bool borderless)
35{
36 uint32_t data[5] = { 0, 0, 0, 0, 0 };
37
38 LOGFN(__FILE__, __LINE__, __FUNCTION__);
39
40 data[0] = 2;
41 data[2] = !borderless;
42
43 ecore_x_window_prop_property_set(win,
44 ECORE_X_ATOM_MOTIF_WM_HINTS,
45 ECORE_X_ATOM_MOTIF_WM_HINTS, 32,
46 (void *)data, 5);
47}
48
49EAPI Eina_Bool
50ecore_x_mwm_hints_get(Ecore_X_Window win,
51 Ecore_X_MWM_Hint_Func *fhint,
52 Ecore_X_MWM_Hint_Decor *dhint,
53 Ecore_X_MWM_Hint_Input *ihint)
54{
55 xcb_get_property_cookie_t cookie;
56 xcb_get_property_reply_t *reply;
57 MWMHints *mwmhints = NULL;
58 int ret = EINA_FALSE;
59
60 LOGFN(__FILE__, __LINE__, __FUNCTION__);
61 CHECK_XCB_CONN;
62
63 cookie =
64 xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
65 ECORE_X_ATOM_MOTIF_WM_HINTS,
66 ECORE_X_ATOM_MOTIF_WM_HINTS, 0, UINT_MAX);
67 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
68 if (!reply) return EINA_FALSE;
69 if ((reply->format != 32) || (reply->value_len == 0))
70 {
71 free(reply);
72 return EINA_FALSE;
73 }
74
75 mwmhints = xcb_get_property_value(reply);
76 if (reply->value_len >= 4)
77 {
78 if (dhint)
79 {
80 if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
81 *dhint = mwmhints->decorations;
82 else
83 *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
84 }
85 if (fhint)
86 {
87 if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
88 *fhint = mwmhints->functions;
89 else
90 *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
91 }
92 if (ihint)
93 {
94 if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
95 *ihint = mwmhints->inputmode;
96 else
97 *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
98 }
99 ret = EINA_TRUE;
100 }
101 free(reply);
102 return ret;
103}
104
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
deleted file mode 100644
index b1e0622..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c
+++ /dev/null
@@ -1,1575 +0,0 @@
1#include "ecore_xcb_private.h"
2
3/* local function prototypes */
4/* static void _ecore_xcb_netwm_startup_info_free(void *data); */
5static Ecore_X_Atom _ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type);
6static Ecore_X_Window_Type _ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom);
7static Ecore_X_Atom _ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state);
8static Ecore_X_Atom _ecore_xcb_netwm_action_atom_get(Ecore_X_Action action);
9
10/* local variables */
11//static Eina_Hash *_startup_info = NULL;
12
13/* local structures */
14typedef struct _Ecore_Xcb_Startup_Info Ecore_Xcb_Startup_Info;
15struct _Ecore_Xcb_Startup_Info
16{
17 Ecore_X_Window win;
18 int init, size;
19 char *buffer;
20 int length;
21
22 /* sequence info fields */
23 char *id, *name;
24 int screen;
25 char *bin, *icon;
26 int desktop, timestamp;
27 char *description, *wmclass;
28 int silent;
29};
30
31EAPI void
32ecore_x_netwm_init(void)
33{
34 LOGFN(__FILE__, __LINE__, __FUNCTION__);
35
36// _startup_info =
37// eina_hash_string_superfast_new(_ecore_xcb_netwm_startup_info_free);
38}
39
40EAPI void
41ecore_x_netwm_shutdown(void)
42{
43 LOGFN(__FILE__, __LINE__, __FUNCTION__);
44
45// if (_startup_info) eina_hash_free(_startup_info);
46// _startup_info = NULL;
47}
48
49EAPI Eina_Bool
50ecore_x_netwm_pid_get(Ecore_X_Window win,
51 int *pid)
52{
53 uint32_t tmp;
54
55 LOGFN(__FILE__, __LINE__, __FUNCTION__);
56
57 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1))
58 return EINA_FALSE;
59
60 if (pid) *pid = tmp;
61
62 return EINA_TRUE;
63}
64
65EAPI void
66ecore_x_netwm_pid_set(Ecore_X_Window win,
67 int pid)
68{
69 unsigned int tmp;
70
71 LOGFN(__FILE__, __LINE__, __FUNCTION__);
72
73 tmp = pid;
74 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1);
75}
76
77EAPI Eina_Bool
78ecore_x_netwm_window_type_get(Ecore_X_Window win,
79 Ecore_X_Window_Type *type)
80{
81 Ecore_X_Atom *atoms;
82 int num = 0;
83
84 LOGFN(__FILE__, __LINE__, __FUNCTION__);
85
86 if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL;
87
88 num =
89 ecore_x_window_prop_atom_list_get(win,
90 ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atoms);
91 if ((type) && (num >= 1) && (atoms))
92 *type = _ecore_xcb_netwm_window_type_type_get(atoms[0]);
93
94 if (atoms) free(atoms);
95
96 if (num >= 1) return EINA_TRUE;
97 return EINA_FALSE;
98}
99
100EAPI void
101ecore_x_netwm_window_type_set(Ecore_X_Window win,
102 Ecore_X_Window_Type type)
103{
104 Ecore_X_Atom atom;
105
106 LOGFN(__FILE__, __LINE__, __FUNCTION__);
107
108 atom = _ecore_xcb_netwm_window_type_atom_get(type);
109 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atom, 1);
110}
111
112EAPI int
113ecore_x_netwm_window_types_get(Ecore_X_Window win,
114 Ecore_X_Window_Type **types)
115{
116 int num = 0, i = 0;
117 Ecore_X_Atom *atoms = NULL;
118 Ecore_X_Window_Type *atoms2 = NULL;
119
120 LOGFN(__FILE__, __LINE__, __FUNCTION__);
121
122 if (types) *types = NULL;
123 num =
124 ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
125 &atoms);
126 if ((num <= 0) || (!atoms))
127 {
128 if (atoms) free(atoms);
129 return 0;
130 }
131
132 atoms2 = malloc(num * sizeof(Ecore_X_Window_Type));
133 if (!atoms2)
134 {
135 if (atoms) free(atoms);
136 return 0;
137 }
138
139 for (i = 0; i < num; i++)
140 atoms2[i] = _ecore_xcb_netwm_window_type_type_get(atoms[i]);
141 if (atoms) free(atoms);
142
143 if (types)
144 *types = atoms2;
145 else
146 free(atoms2);
147
148 return num;
149}
150
151EAPI int
152ecore_x_netwm_name_get(Ecore_X_Window win,
153 char **name)
154{
155 LOGFN(__FILE__, __LINE__, __FUNCTION__);
156
157 if (name)
158 *name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_NAME);
159 return 1;
160}
161
162EAPI void
163ecore_x_netwm_name_set(Ecore_X_Window win,
164 const char *name)
165{
166 LOGFN(__FILE__, __LINE__, __FUNCTION__);
167
168 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_NAME, name);
169}
170
171EAPI void
172ecore_x_netwm_opacity_set(Ecore_X_Window win,
173 unsigned int opacity)
174{
175 LOGFN(__FILE__, __LINE__, __FUNCTION__);
176
177 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
178 &opacity, 1);
179}
180
181EAPI Eina_Bool
182ecore_x_netwm_opacity_get(Ecore_X_Window win,
183 unsigned int *opacity)
184{
185 unsigned int tmp = 0;
186
187 LOGFN(__FILE__, __LINE__, __FUNCTION__);
188
189 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
190 &tmp, 1))
191 return EINA_FALSE;
192
193 if (opacity) *opacity = tmp;
194
195 return EINA_TRUE;
196}
197
198EAPI void
199ecore_x_netwm_wm_identify(Ecore_X_Window root,
200 Ecore_X_Window check,
201 const char *wm_name)
202{
203 LOGFN(__FILE__, __LINE__, __FUNCTION__);
204
205 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
206 &check, 1);
207 ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
208 &check, 1);
209 ecore_x_window_prop_string_set(check, ECORE_X_ATOM_NET_WM_NAME, wm_name);
210 ecore_x_window_prop_string_set(root, ECORE_X_ATOM_NET_WM_NAME, wm_name);
211}
212
213EAPI void
214ecore_x_netwm_supported_set(Ecore_X_Window root,
215 Ecore_X_Atom *supported,
216 int num)
217{
218 LOGFN(__FILE__, __LINE__, __FUNCTION__);
219
220 ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED,
221 supported, num);
222}
223
224EAPI Eina_Bool
225ecore_x_netwm_supported_get(Ecore_X_Window root,
226 Ecore_X_Atom **supported,
227 int *num)
228{
229 int num_ret = 0;
230
231 LOGFN(__FILE__, __LINE__, __FUNCTION__);
232
233 if (num) *num = 0;
234 if (supported) *supported = NULL;
235
236 num_ret =
237 ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED,
238 supported);
239 if (num_ret <= 0) return EINA_FALSE;
240 if (num) *num = num_ret;
241
242 return EINA_TRUE;
243}
244
245EAPI void
246ecore_x_netwm_desk_count_set(Ecore_X_Window root,
247 unsigned int n_desks)
248{
249 LOGFN(__FILE__, __LINE__, __FUNCTION__);
250
251 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
252 &n_desks, 1);
253}
254
255EAPI void
256ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
257 Ecore_X_Window *vroots,
258 unsigned int n_desks)
259{
260 LOGFN(__FILE__, __LINE__, __FUNCTION__);
261
262 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS,
263 vroots, n_desks);
264}
265
266EAPI void
267ecore_x_netwm_desk_names_set(Ecore_X_Window root,
268 const char **names,
269 unsigned int n_desks)
270{
271 char ss[32], *buf = NULL, *t = NULL;
272 const char *s;
273 uint32_t len = 0, i, l;
274
275 LOGFN(__FILE__, __LINE__, __FUNCTION__);
276 CHECK_XCB_CONN;
277
278 for (i = 0; i < n_desks; i++)
279 {
280 s = ((names) ? names[i] : NULL);
281 if (!s)
282 {
283 /* Default to "Desk-<number>" */
284 sprintf(ss, "Desk-%d", i);
285 s = ss;
286 }
287
288 l = strlen(s) + 1;
289 t = realloc(buf, len + 1);
290 if (t)
291 {
292 buf = t;
293 memcpy(buf + len, s, l);
294 }
295 len += l;
296 }
297
298 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, root,
299 ECORE_X_ATOM_NET_DESKTOP_NAMES,
300 ECORE_X_ATOM_UTF8_STRING, 8, len, (const void *)buf);
301// ecore_x_flush();
302 free(buf);
303}
304
305EAPI void
306ecore_x_netwm_desk_size_set(Ecore_X_Window root,
307 unsigned int width,
308 unsigned int height)
309{
310 uint32_t size[2];
311
312 LOGFN(__FILE__, __LINE__, __FUNCTION__);
313
314 size[0] = width;
315 size[1] = height;
316 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY,
317 size, 2);
318}
319
320EAPI void
321ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
322 unsigned int *origins,
323 unsigned int n_desks)
324{
325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
326
327 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
328 origins, (2 * n_desks));
329}
330
331EAPI void
332ecore_x_netwm_desk_layout_set(Ecore_X_Window root,
333 int orientation,
334 int columns,
335 int rows,
336 int starting_corner)
337{
338 unsigned int layout[4];
339
340 LOGFN(__FILE__, __LINE__, __FUNCTION__);
341
342 layout[0] = orientation;
343 layout[1] = columns;
344 layout[2] = rows;
345 layout[3] = starting_corner;
346 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT,
347 layout, 4);
348}
349
350EAPI void
351ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
352 unsigned int *areas,
353 unsigned int n_desks)
354{
355 LOGFN(__FILE__, __LINE__, __FUNCTION__);
356
357 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas,
358 4 * n_desks);
359}
360
361EAPI unsigned int *
362ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks)
363{
364 int ret;
365 unsigned int *areas = NULL;
366
367 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
368
369 ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA,
370 &areas);
371 if (!areas)
372 {
373 if (n_desks) *n_desks = 0;
374 return 0;
375 }
376 if (n_desks) *n_desks = ret / 4;
377 return areas;
378}
379
380EAPI void
381ecore_x_netwm_desk_current_set(Ecore_X_Window root,
382 unsigned int desk)
383{
384 LOGFN(__FILE__, __LINE__, __FUNCTION__);
385
386 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP,
387 &desk, 1);
388}
389
390EAPI void
391ecore_x_netwm_showing_desktop_set(Ecore_X_Window root,
392 Eina_Bool on)
393{
394 unsigned int val = 0;
395
396 LOGFN(__FILE__, __LINE__, __FUNCTION__);
397
398 val = ((on) ? 1 : 0);
399 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP,
400 &val, 1);
401}
402
403EAPI int
404ecore_x_netwm_startup_id_get(Ecore_X_Window win,
405 char **id)
406{
407 LOGFN(__FILE__, __LINE__, __FUNCTION__);
408
409 if (id)
410 {
411 *id =
412 ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_STARTUP_ID);
413 }
414
415 return 1;
416}
417
418EAPI void
419ecore_x_netwm_startup_id_set(Ecore_X_Window win,
420 const char *id)
421{
422 LOGFN(__FILE__, __LINE__, __FUNCTION__);
423
424 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id);
425}
426
427EAPI void
428ecore_x_netwm_state_request_send(Ecore_X_Window win,
429 Ecore_X_Window root,
430 Ecore_X_Window_State s1,
431 Ecore_X_Window_State s2,
432 Eina_Bool set)
433{
434 xcb_client_message_event_t ev;
435
436 LOGFN(__FILE__, __LINE__, __FUNCTION__);
437 CHECK_XCB_CONN;
438
439 if (!win) return;
440 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
441
442 ev.response_type = XCB_CLIENT_MESSAGE;
443 ev.format = 32;
444 ev.window = win;
445 ev.type = ECORE_X_ATOM_NET_WM_STATE;
446 ev.data.data32[0] = !!set;
447 ev.data.data32[1] = _ecore_xcb_netwm_window_state_atom_get(s1);
448 ev.data.data32[2] = _ecore_xcb_netwm_window_state_atom_get(s2);
449 /* 1 == normal client, if used in a pager this should be 2 */
450 ev.data.data32[3] = 1;
451 ev.data.data32[4] = 0;
452
453 xcb_send_event(_ecore_xcb_conn, 0, root,
454 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
455 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
456// ecore_x_flush();
457}
458
459EAPI void
460ecore_x_netwm_window_state_set(Ecore_X_Window win,
461 Ecore_X_Window_State *state,
462 unsigned int num)
463{
464 Ecore_X_Atom *set;
465 unsigned int i = 0;
466
467 LOGFN(__FILE__, __LINE__, __FUNCTION__);
468
469 if (!num)
470 {
471 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE);
472 return;
473 }
474
475 set = malloc(num * sizeof(Ecore_X_Atom));
476 if (!set) return;
477
478 for (i = 0; i < num; i++)
479 set[i] = _ecore_xcb_netwm_window_state_atom_get(state[i]);
480
481 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num);
482 free(set);
483}
484
485EAPI Eina_Bool
486ecore_x_netwm_window_state_get(Ecore_X_Window win,
487 Ecore_X_Window_State **state,
488 unsigned int *num)
489{
490 Ecore_X_Atom *atoms;
491 int ret = 0;
492
493 LOGFN(__FILE__, __LINE__, __FUNCTION__);
494
495 if (num) *num = 0;
496 if (state) *state = NULL;
497
498 ret =
499 ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE, &atoms);
500
501 if (ret <= 0) return EINA_FALSE;
502
503 if (state)
504 {
505 *state = malloc(ret * sizeof(Ecore_X_Window_State));
506 if (*state)
507 {
508 int i = 0;
509
510 for (i = 0; i < ret; i++)
511 (*state)[i] = _ecore_xcb_netwm_window_state_get(atoms[i]);
512 if (num) *num = ret;
513 }
514 }
515
516 free(atoms);
517
518 return EINA_TRUE;
519}
520
521EAPI void
522ecore_x_netwm_client_active_set(Ecore_X_Window root,
523 Ecore_X_Window win)
524{
525 LOGFN(__FILE__, __LINE__, __FUNCTION__);
526
527 ecore_x_window_prop_window_set(root,
528 ECORE_X_ATOM_NET_ACTIVE_WINDOW, &win, 1);
529}
530
531EAPI void
532ecore_x_netwm_client_active_request(Ecore_X_Window root,
533 Ecore_X_Window win,
534 int type,
535 Ecore_X_Window current_win)
536{
537 xcb_client_message_event_t ev;
538
539 LOGFN(__FILE__, __LINE__, __FUNCTION__);
540 CHECK_XCB_CONN;
541
542 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
543
544 ev.response_type = XCB_CLIENT_MESSAGE;
545 ev.format = 32;
546 ev.window = win;
547 ev.type = ECORE_X_ATOM_NET_ACTIVE_WINDOW;
548 ev.data.data32[0] = type;
549 ev.data.data32[1] = XCB_CURRENT_TIME;
550 ev.data.data32[2] = current_win;
551 ev.data.data32[3] = 0;
552 ev.data.data32[4] = 0;
553
554 xcb_send_event(_ecore_xcb_conn, 0, root,
555 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
556 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
557// ecore_x_flush();
558}
559
560EAPI void
561ecore_x_netwm_client_list_set(Ecore_X_Window root,
562 Ecore_X_Window *p_clients,
563 unsigned int n_clients)
564{
565 LOGFN(__FILE__, __LINE__, __FUNCTION__);
566
567 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST,
568 p_clients, n_clients);
569}
570
571EAPI void
572ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
573 Ecore_X_Window *p_clients,
574 unsigned int n_clients)
575{
576 LOGFN(__FILE__, __LINE__, __FUNCTION__);
577
578 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
579 p_clients, n_clients);
580}
581
582EAPI Eina_Bool
583ecore_x_screen_is_composited(int screen)
584{
585 char buff[32];
586 xcb_get_selection_owner_cookie_t ocookie;
587 xcb_get_selection_owner_reply_t *oreply;
588 Ecore_X_Window win;
589 static Ecore_X_Atom atom = XCB_NONE;
590
591 LOGFN(__FILE__, __LINE__, __FUNCTION__);
592 CHECK_XCB_CONN;
593
594 snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen);
595
596 if (atom == XCB_NONE)
597 {
598 xcb_intern_atom_cookie_t acookie;
599 xcb_intern_atom_reply_t *areply;
600
601 acookie =
602 xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff);
603 areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
604 if (!areply) return EINA_FALSE;
605 atom = areply->atom;
606 free(areply);
607 }
608 if (atom == XCB_NONE) return EINA_FALSE;
609
610 ocookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom);
611 oreply = xcb_get_selection_owner_reply(_ecore_xcb_conn, ocookie, NULL);
612 if (!oreply) return EINA_FALSE;
613 win = oreply->owner;
614 free(oreply);
615
616 return (win != XCB_NONE) ? EINA_TRUE : EINA_FALSE;
617}
618
619EAPI void
620ecore_x_screen_is_composited_set(int screen,
621 Ecore_X_Window win)
622{
623 static Ecore_X_Atom atom = XCB_NONE;
624 char buff[32];
625
626 LOGFN(__FILE__, __LINE__, __FUNCTION__);
627 CHECK_XCB_CONN;
628
629 snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen);
630 if (atom == XCB_NONE)
631 {
632 xcb_intern_atom_cookie_t acookie;
633 xcb_intern_atom_reply_t *areply;
634
635 acookie =
636 xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff);
637 areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
638 if (!areply) return;
639 atom = areply->atom;
640 free(areply);
641 }
642 if (atom == XCB_NONE) return;
643 xcb_set_selection_owner(_ecore_xcb_conn, win, atom,
644 _ecore_xcb_events_last_time_get());
645}
646
647EAPI void
648ecore_x_netwm_ping_send(Ecore_X_Window win)
649{
650 xcb_client_message_event_t ev;
651
652 LOGFN(__FILE__, __LINE__, __FUNCTION__);
653 CHECK_XCB_CONN;
654
655 if (!win) return;
656
657 ev.response_type = XCB_CLIENT_MESSAGE;
658 ev.format = 32;
659 ev.window = win;
660 ev.type = ECORE_X_ATOM_WM_PROTOCOLS;
661 ev.data.data32[0] = ECORE_X_ATOM_NET_WM_PING;
662 ev.data.data32[1] = ecore_x_current_time_get();
663 ev.data.data32[2] = win;
664 ev.data.data32[3] = 0;
665 ev.data.data32[4] = 0;
666
667 xcb_send_event(_ecore_xcb_conn, 0, win,
668 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
669// ecore_x_flush();
670}
671
672EAPI void
673ecore_x_netwm_frame_size_set(Ecore_X_Window win,
674 int fl,
675 int fr,
676 int ft,
677 int fb)
678{
679 uint32_t frames[4];
680
681 LOGFN(__FILE__, __LINE__, __FUNCTION__);
682
683 frames[0] = fl;
684 frames[1] = fr;
685 frames[2] = ft;
686 frames[3] = fb;
687 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS,
688 frames, 4);
689}
690
691EAPI Eina_Bool
692ecore_x_netwm_frame_size_get(Ecore_X_Window win,
693 int *fl,
694 int *fr,
695 int *ft,
696 int *fb)
697{
698 int ret = 0;
699 unsigned int frames[4];
700
701 LOGFN(__FILE__, __LINE__, __FUNCTION__);
702
703 ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_FRAME_EXTENTS,
704 frames, 4);
705 if (ret != 4) return EINA_FALSE;
706
707 if (fl) *fl = frames[0];
708 if (fr) *fr = frames[1];
709 if (ft) *ft = frames[2];
710 if (fb) *fb = frames[3];
711
712 return EINA_TRUE;
713}
714
715EAPI void
716ecore_x_netwm_sync_request_send(Ecore_X_Window win,
717 unsigned int serial)
718{
719 xcb_client_message_event_t ev;
720
721 LOGFN(__FILE__, __LINE__, __FUNCTION__);
722 CHECK_XCB_CONN;
723
724 if (!win) return;
725
726 /* FIXME: Maybe need XSyncIntToValue ?? */
727 memset(&ev, 0, sizeof(xcb_client_message_event_t));
728
729 ev.response_type = XCB_CLIENT_MESSAGE;
730 ev.format = 32;
731 ev.window = win;
732 ev.type = ECORE_X_ATOM_WM_PROTOCOLS;
733 ev.data.data32[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
734 ev.data.data32[1] = _ecore_xcb_events_last_time_get();
735 ev.data.data32[2] = serial;
736 ev.data.data32[3] = 0;
737 ev.data.data32[4] = 0;
738
739 xcb_send_event(_ecore_xcb_conn, 0, win,
740 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
741// ecore_x_flush();
742}
743
744EAPI void
745ecore_x_netwm_desktop_set(Ecore_X_Window win,
746 unsigned int desk)
747{
748 LOGFN(__FILE__, __LINE__, __FUNCTION__);
749
750 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
751}
752
753EAPI Eina_Bool
754ecore_x_netwm_desktop_get(Ecore_X_Window win,
755 unsigned int *desk)
756{
757 unsigned int tmp = 0;
758
759 LOGFN(__FILE__, __LINE__, __FUNCTION__);
760
761 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
762 &tmp, 1))
763 return EINA_FALSE;
764
765 if (desk) *desk = tmp;
766
767 return EINA_TRUE;
768}
769
770EAPI void
771ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
772 Ecore_X_Window root,
773 unsigned int desktop)
774{
775 xcb_client_message_event_t ev;
776
777 LOGFN(__FILE__, __LINE__, __FUNCTION__);
778 CHECK_XCB_CONN;
779
780 if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
781
782 memset(&ev, 0, sizeof(xcb_client_message_event_t));
783
784 ev.response_type = XCB_CLIENT_MESSAGE;
785 ev.format = 32;
786 ev.window = win;
787 ev.type = ECORE_X_ATOM_NET_WM_DESKTOP;
788 ev.data.data32[0] = desktop;
789
790 xcb_send_event(_ecore_xcb_conn, 0, root,
791 (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
792 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev);
793// ecore_x_flush();
794}
795
796EAPI void
797ecore_x_netwm_handled_icons_set(Ecore_X_Window win)
798{
799 LOGFN(__FILE__, __LINE__, __FUNCTION__);
800
801 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
802 NULL, 0);
803}
804
805EAPI Eina_Bool
806ecore_x_netwm_handled_icons_get(Ecore_X_Window win)
807{
808 LOGFN(__FILE__, __LINE__, __FUNCTION__);
809
810 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
811 NULL, 0))
812 return EINA_FALSE;
813
814 return EINA_TRUE;
815}
816
817EAPI int
818ecore_x_netwm_icon_name_get(Ecore_X_Window win,
819 char **name)
820{
821 LOGFN(__FILE__, __LINE__, __FUNCTION__);
822
823 if (name)
824 {
825 *name =
826 ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_ICON_NAME);
827 }
828
829 return 1;
830}
831
832EAPI void
833ecore_x_netwm_icon_name_set(Ecore_X_Window win,
834 const char *name)
835{
836 LOGFN(__FILE__, __LINE__, __FUNCTION__);
837
838 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name);
839}
840
841EAPI void
842ecore_x_netwm_icons_set(Ecore_X_Window win,
843 Ecore_X_Icon *icon,
844 int num)
845{
846 unsigned int *data, *p, *p2;
847 unsigned int i, size, x, y;
848
849 LOGFN(__FILE__, __LINE__, __FUNCTION__);
850 size = 0;
851 for (i = 0; i < (unsigned int)num; i++)
852 {
853 size += 2 + (icon[i].width * icon[i].height);
854 }
855 data = malloc(size * sizeof(unsigned int));
856 if (!data) return;
857 p = data;
858 for (i = 0; i < (unsigned int)num; i++)
859 {
860 p[0] = icon[i].width;
861 p[1] = icon[i].height;
862 p += 2;
863 p2 = icon[i].data;
864 for (y = 0; y < icon[i].height; y++)
865 {
866 for (x = 0; x < icon[i].width; x++)
867 {
868 unsigned int r, g, b, a;
869
870 a = (*p2 >> 24) & 0xff;
871 r = (*p2 >> 16) & 0xff;
872 g = (*p2 >> 8 ) & 0xff;
873 b = (*p2 ) & 0xff;
874 if ((a > 0) && (a < 255))
875 {
876 r = (r * 255) / a;
877 g = (g * 255) / a;
878 b = (b * 255) / a;
879 }
880 *p = (a << 24) | (r << 16) | (g << 8) | b;
881 p++;
882 p2++;
883 }
884 }
885 }
886 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
887 data, size);
888 free(data);
889}
890
891EAPI Eina_Bool
892ecore_x_netwm_icons_get(Ecore_X_Window win,
893 Ecore_X_Icon **icon,
894 int *num)
895{
896 int num_ret = 0;
897 unsigned int i = 0, len = 0, icons = 0;
898 unsigned int *data, *p, *src;
899
900 LOGFN(__FILE__, __LINE__, __FUNCTION__);
901
902 if (num) *num = 0;
903 if (icon) *icon = NULL;
904
905 num_ret =
906 ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON, &data);
907
908 if ((num_ret <= 0) || (!data))
909 {
910 if (data) free(data);
911 return EINA_FALSE;
912 }
913 if (num_ret < 2)
914 {
915 if (data) free(data);
916 return EINA_FALSE;
917 }
918
919 icons = 0;
920 p = data;
921 while (p)
922 {
923 len = (p[0] * p[1]);
924 p += (len + 2);
925 if ((p - data) > num_ret)
926 {
927 if (data) free(data);
928 return EINA_FALSE;
929 }
930 icons++;
931 if ((p - data) == num_ret) p = NULL;
932 }
933 if (num) *num = icons;
934 if (!icon)
935 {
936 if (data) free(data);
937 return EINA_TRUE;
938 }
939
940 *icon = malloc(icons * sizeof(Ecore_X_Icon));
941 if (!(*icon))
942 {
943 if (data) free(data);
944 return EINA_FALSE;
945 }
946
947 /* Fetch the icons */
948 p = data;
949 for (i = 0; i < icons; i++)
950 {
951 unsigned int *ps, *pd, *pe;
952
953 len = p[0] * p[1];
954 ((*icon)[i]).width = p[0];
955 ((*icon)[i]).height = p[1];
956 src = &(p[2]);
957 ((*icon)[i]).data = malloc(len * sizeof(unsigned int));
958 if (!((*icon)[i]).data)
959 {
960 while (i)
961 free(((*icon)[--i]).data);
962 free(*icon);
963 free(data);
964 return EINA_FALSE;
965 }
966
967 pd = ((*icon)[i]).data;
968 ps = src;
969 pe = ps + len;
970 for (; ps < pe; ps++)
971 {
972 unsigned int r, g, b, a;
973
974 a = (*ps >> 24) & 0xff;
975 r = (((*ps >> 16) & 0xff) * a) / 255;
976 g = (((*ps >> 8) & 0xff) * a) / 255;
977 b = (((*ps) & 0xff) * a) / 255;
978 *pd = (a << 24) | (r << 16) | (g << 8) | (b);
979 pd++;
980 }
981 p += (len + 2);
982 }
983
984 if (data) free(data);
985 return EINA_TRUE;
986}
987
988EAPI void
989ecore_x_netwm_icon_geometry_set(Ecore_X_Window win,
990 int x,
991 int y,
992 int w,
993 int h)
994{
995 unsigned int geom[4];
996
997 LOGFN(__FILE__, __LINE__, __FUNCTION__);
998
999 geom[0] = x;
1000 geom[1] = y;
1001 geom[2] = w;
1002 geom[3] = h;
1003 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
1004 geom, 4);
1005}
1006
1007EAPI Eina_Bool
1008ecore_x_netwm_icon_geometry_get(Ecore_X_Window win,
1009 int *x,
1010 int *y,
1011 int *w,
1012 int *h)
1013{
1014 int ret = 0;
1015 unsigned int geom[4];
1016
1017 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1018
1019 ret =
1020 ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
1021 geom, 4);
1022 if (ret != 4) return EINA_FALSE;
1023 if (x) *x = geom[0];
1024 if (y) *y = geom[1];
1025 if (w) *w = geom[2];
1026 if (h) *h = geom[3];
1027
1028 return EINA_TRUE;
1029}
1030
1031EAPI void
1032ecore_x_netwm_strut_set(Ecore_X_Window win,
1033 int l,
1034 int r,
1035 int t,
1036 int b)
1037{
1038 unsigned int strut[4];
1039
1040 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1041
1042 strut[0] = l;
1043 strut[1] = r;
1044 strut[2] = t;
1045 strut[3] = b;
1046 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
1047}
1048
1049EAPI Eina_Bool
1050ecore_x_netwm_strut_get(Ecore_X_Window win,
1051 int *l,
1052 int *r,
1053 int *t,
1054 int *b)
1055{
1056 unsigned int strut[4];
1057 int ret = 0;
1058
1059 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1060
1061 ret =
1062 ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
1063 if (ret != 4) return EINA_FALSE;
1064
1065 if (l) *l = strut[0];
1066 if (r) *r = strut[1];
1067 if (t) *t = strut[2];
1068 if (b) *b = strut[3];
1069
1070 return EINA_TRUE;
1071}
1072
1073EAPI void
1074ecore_x_netwm_strut_partial_set(Ecore_X_Window win,
1075 int left,
1076 int right,
1077 int top,
1078 int bottom,
1079 int left_start_y,
1080 int left_end_y,
1081 int right_start_y,
1082 int right_end_y,
1083 int top_start_x,
1084 int top_end_x,
1085 int bottom_start_x,
1086 int bottom_end_x)
1087{
1088 unsigned int strut[12];
1089
1090 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1091
1092 strut[0] = left;
1093 strut[1] = right;
1094 strut[2] = top;
1095 strut[3] = bottom;
1096 strut[4] = left_start_y;
1097 strut[5] = left_end_y;
1098 strut[6] = right_start_y;
1099 strut[7] = right_end_y;
1100 strut[8] = top_start_x;
1101 strut[9] = top_end_x;
1102 strut[10] = bottom_start_x;
1103 strut[11] = bottom_end_x;
1104 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
1105 strut, 12);
1106}
1107
1108EAPI Eina_Bool
1109ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
1110 int *left,
1111 int *right,
1112 int *top,
1113 int *bottom,
1114 int *left_start_y,
1115 int *left_end_y,
1116 int *right_start_y,
1117 int *right_end_y,
1118 int *top_start_x,
1119 int *top_end_x,
1120 int *bottom_start_x,
1121 int *bottom_end_x)
1122{
1123 unsigned int strut[12];
1124 int ret = 0;
1125
1126 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1127
1128 ret =
1129 ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
1130 strut, 12);
1131 if (ret != 12) return EINA_FALSE;
1132
1133 if (left) *left = strut[0];
1134 if (right) *right = strut[1];
1135 if (top) *top = strut[2];
1136 if (bottom) *bottom = strut[3];
1137 if (left_start_y) *left_start_y = strut[4];
1138 if (left_end_y) *left_end_y = strut[5];
1139 if (right_start_y) *right_start_y = strut[6];
1140 if (right_end_y) *right_end_y = strut[7];
1141 if (top_start_x) *top_start_x = strut[8];
1142 if (top_end_x) *top_end_x = strut[9];
1143 if (bottom_start_x) *bottom_start_x = strut[10];
1144 if (bottom_end_x) *bottom_end_x = strut[11];
1145
1146 return EINA_TRUE;
1147}
1148
1149EAPI void
1150ecore_x_netwm_user_time_set(Ecore_X_Window win,
1151 unsigned int t)
1152{
1153 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1154
1155 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, &t, 1);
1156}
1157
1158EAPI Eina_Bool
1159ecore_x_netwm_user_time_get(Ecore_X_Window win,
1160 unsigned int *t)
1161{
1162 unsigned int tmp;
1163
1164 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1165
1166 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME,
1167 &tmp, 1))
1168 return EINA_FALSE;
1169
1170 if (t) *t = tmp;
1171
1172 return EINA_TRUE;
1173}
1174
1175EAPI void
1176ecore_x_netwm_visible_name_set(Ecore_X_Window win,
1177 const char *name)
1178{
1179 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1180
1181 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
1182 name);
1183}
1184
1185EAPI int
1186ecore_x_netwm_visible_name_get(Ecore_X_Window win,
1187 char **name)
1188{
1189 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1190
1191 if (name)
1192 *name = ecore_x_window_prop_string_get(win,
1193 ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
1194 return 1;
1195}
1196
1197EAPI void
1198ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win,
1199 const char *name)
1200{
1201 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1202
1203 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
1204 name);
1205}
1206
1207EAPI int
1208ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win,
1209 char **name)
1210{
1211 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1212
1213 if (name)
1214 {
1215 *name =
1216 ecore_x_window_prop_string_get(win,
1217 ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
1218 }
1219
1220 return 1;
1221}
1222
1223EAPI Eina_Bool
1224ecore_x_netwm_sync_counter_get(Ecore_X_Window win,
1225 Ecore_X_Sync_Counter *counter)
1226{
1227 unsigned int tmp;
1228
1229 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1230
1231 if (!ecore_x_window_prop_card32_get(win,
1232 ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
1233 &tmp, 1))
1234 return EINA_FALSE;
1235
1236 if (counter) *counter = tmp;
1237
1238 return EINA_TRUE;
1239}
1240
1241EAPI Eina_Bool
1242ecore_x_netwm_allowed_action_isset(Ecore_X_Window win,
1243 Ecore_X_Action action)
1244{
1245 int num = 0, i = 0;
1246 Ecore_X_Atom *atoms, atom;
1247 Eina_Bool ret = EINA_FALSE;
1248
1249 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1250
1251 num =
1252 ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
1253 &atoms);
1254 if (num <= 0) return EINA_FALSE;
1255
1256 atom = _ecore_xcb_netwm_action_atom_get(action);
1257 for (i = 0; i < num; i++)
1258 {
1259 if (atoms[i] == atom)
1260 {
1261 ret = EINA_TRUE;
1262 break;
1263 }
1264 }
1265
1266 if (atoms) free(atoms);
1267 return ret;
1268}
1269
1270EAPI Eina_Bool
1271ecore_x_netwm_allowed_action_get(Ecore_X_Window win,
1272 Ecore_X_Action **action,
1273 unsigned int *num)
1274{
1275 Ecore_X_Atom *atoms;
1276 int num_ret = 0;
1277
1278 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1279
1280 if (num) *num = 0;
1281 if (action) *action = NULL;
1282
1283 num_ret =
1284 ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
1285 &atoms);
1286 if (num_ret <= 0) return EINA_FALSE;
1287 if (action)
1288 {
1289 *action = malloc(num_ret * sizeof(Ecore_X_Action));
1290 if (*action)
1291 {
1292 int i = 0;
1293
1294 for (i = 0; i < num_ret; i++)
1295 (*action)[i] = _ecore_xcb_netwm_action_atom_get(atoms[i]);
1296 }
1297 if (num) *num = num_ret;
1298 }
1299 free(atoms);
1300 return EINA_TRUE;
1301}
1302
1303EAPI void
1304ecore_x_netwm_allowed_action_set(Ecore_X_Window win,
1305 Ecore_X_Action *action,
1306 unsigned int num)
1307{
1308 Ecore_X_Atom *set;
1309 unsigned int i = 0;
1310
1311 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1312
1313 if (!num)
1314 {
1315 ecore_x_window_prop_property_del(win,
1316 ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
1317 return;
1318 }
1319
1320 set = malloc(num * sizeof(Ecore_X_Atom));
1321 if (!set) return;
1322
1323 for (i = 0; i < num; i++)
1324 set[i] = _ecore_xcb_netwm_action_atom_get(action[i]);
1325
1326 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
1327 set, num);
1328 free(set);
1329}
1330
1331/* local functions */
1332int
1333_ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__,
1334 uint8_t data __UNUSED__)
1335{
1336 // TODO: TBD
1337 return 1;
1338}
1339
1340int
1341_ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__,
1342 uint8_t data __UNUSED__)
1343{
1344 // TODO: TBD
1345 return 1;
1346}
1347
1348/* static void */
1349/* _ecore_xcb_netwm_startup_info_free(void *data) */
1350/* { */
1351/* Ecore_Xcb_Startup_Info *info; */
1352
1353/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
1354
1355/* if (!(info = data)) return; */
1356/* if (info->buffer) free(info->buffer); */
1357/* if (info->id) free(info->id); */
1358/* if (info->name) free(info->name); */
1359/* if (info->bin) free(info->bin); */
1360/* if (info->icon) free(info->icon); */
1361/* if (info->description) free(info->description); */
1362/* if (info->wmclass) free(info->wmclass); */
1363/* free(info); */
1364/* } */
1365
1366static Ecore_X_Atom
1367_ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type)
1368{
1369 switch (type)
1370 {
1371 case ECORE_X_WINDOW_TYPE_DESKTOP:
1372 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
1373
1374 case ECORE_X_WINDOW_TYPE_DOCK:
1375 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
1376
1377 case ECORE_X_WINDOW_TYPE_TOOLBAR:
1378 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
1379
1380 case ECORE_X_WINDOW_TYPE_MENU:
1381 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
1382
1383 case ECORE_X_WINDOW_TYPE_UTILITY:
1384 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
1385
1386 case ECORE_X_WINDOW_TYPE_SPLASH:
1387 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
1388
1389 case ECORE_X_WINDOW_TYPE_DIALOG:
1390 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
1391
1392 case ECORE_X_WINDOW_TYPE_NORMAL:
1393 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
1394
1395 case ECORE_X_WINDOW_TYPE_DROPDOWN_MENU:
1396 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
1397
1398 case ECORE_X_WINDOW_TYPE_POPUP_MENU:
1399 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU;
1400
1401 case ECORE_X_WINDOW_TYPE_TOOLTIP:
1402 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP;
1403
1404 case ECORE_X_WINDOW_TYPE_NOTIFICATION:
1405 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION;
1406
1407 case ECORE_X_WINDOW_TYPE_COMBO:
1408 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO;
1409
1410 case ECORE_X_WINDOW_TYPE_DND:
1411 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND;
1412
1413 default:
1414 return 0;
1415 }
1416}
1417
1418static Ecore_X_Window_Type
1419_ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom)
1420{
1421 if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP)
1422 return ECORE_X_WINDOW_TYPE_DESKTOP;
1423 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
1424 return ECORE_X_WINDOW_TYPE_DOCK;
1425 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR)
1426 return ECORE_X_WINDOW_TYPE_TOOLBAR;
1427 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
1428 return ECORE_X_WINDOW_TYPE_MENU;
1429 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY)
1430 return ECORE_X_WINDOW_TYPE_UTILITY;
1431 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
1432 return ECORE_X_WINDOW_TYPE_SPLASH;
1433 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG)
1434 return ECORE_X_WINDOW_TYPE_DIALOG;
1435 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
1436 return ECORE_X_WINDOW_TYPE_NORMAL;
1437 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
1438 return ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
1439 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU)
1440 return ECORE_X_WINDOW_TYPE_POPUP_MENU;
1441 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP)
1442 return ECORE_X_WINDOW_TYPE_TOOLTIP;
1443 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION)
1444 return ECORE_X_WINDOW_TYPE_NOTIFICATION;
1445 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO)
1446 return ECORE_X_WINDOW_TYPE_COMBO;
1447 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND)
1448 return ECORE_X_WINDOW_TYPE_DND;
1449 else
1450 return ECORE_X_WINDOW_TYPE_UNKNOWN;
1451}
1452
1453static Ecore_X_Atom
1454_ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state)
1455{
1456 switch (state)
1457 {
1458 case ECORE_X_WINDOW_STATE_MODAL:
1459 return ECORE_X_ATOM_NET_WM_STATE_MODAL;
1460
1461 case ECORE_X_WINDOW_STATE_STICKY:
1462 return ECORE_X_ATOM_NET_WM_STATE_STICKY;
1463
1464 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
1465 return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
1466
1467 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
1468 return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
1469
1470 case ECORE_X_WINDOW_STATE_SHADED:
1471 return ECORE_X_ATOM_NET_WM_STATE_SHADED;
1472
1473 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
1474 return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
1475
1476 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
1477 return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
1478
1479 case ECORE_X_WINDOW_STATE_HIDDEN:
1480 return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
1481
1482 case ECORE_X_WINDOW_STATE_FULLSCREEN:
1483 return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
1484
1485 case ECORE_X_WINDOW_STATE_ABOVE:
1486 return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
1487
1488 case ECORE_X_WINDOW_STATE_BELOW:
1489 return ECORE_X_ATOM_NET_WM_STATE_BELOW;
1490
1491 case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
1492 return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
1493
1494 default:
1495 return 0;
1496 }
1497}
1498
1499Ecore_X_Window_State
1500_ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom)
1501{
1502 if (atom == ECORE_X_ATOM_NET_WM_STATE_MODAL)
1503 return ECORE_X_WINDOW_STATE_MODAL;
1504 else if (atom == ECORE_X_ATOM_NET_WM_STATE_STICKY)
1505 return ECORE_X_WINDOW_STATE_STICKY;
1506 else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
1507 return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
1508 else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
1509 return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
1510 else if (atom == ECORE_X_ATOM_NET_WM_STATE_SHADED)
1511 return ECORE_X_WINDOW_STATE_SHADED;
1512 else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
1513 return ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
1514 else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
1515 return ECORE_X_WINDOW_STATE_SKIP_PAGER;
1516 else if (atom == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
1517 return ECORE_X_WINDOW_STATE_HIDDEN;
1518 else if (atom == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
1519 return ECORE_X_WINDOW_STATE_FULLSCREEN;
1520 else if (atom == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
1521 return ECORE_X_WINDOW_STATE_ABOVE;
1522 else if (atom == ECORE_X_ATOM_NET_WM_STATE_BELOW)
1523 return ECORE_X_WINDOW_STATE_BELOW;
1524 else if (atom == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
1525 return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
1526 else
1527 return ECORE_X_WINDOW_STATE_UNKNOWN;
1528}
1529
1530static Ecore_X_Atom
1531_ecore_xcb_netwm_action_atom_get(Ecore_X_Action action)
1532{
1533 switch (action)
1534 {
1535 case ECORE_X_ACTION_MOVE:
1536 return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
1537
1538 case ECORE_X_ACTION_RESIZE:
1539 return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
1540
1541 case ECORE_X_ACTION_MINIMIZE:
1542 return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
1543
1544 case ECORE_X_ACTION_SHADE:
1545 return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
1546
1547 case ECORE_X_ACTION_STICK:
1548 return ECORE_X_ATOM_NET_WM_ACTION_STICK;
1549
1550 case ECORE_X_ACTION_MAXIMIZE_HORZ:
1551 return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
1552
1553 case ECORE_X_ACTION_MAXIMIZE_VERT:
1554 return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
1555
1556 case ECORE_X_ACTION_FULLSCREEN:
1557 return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
1558
1559 case ECORE_X_ACTION_CHANGE_DESKTOP:
1560 return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
1561
1562 case ECORE_X_ACTION_CLOSE:
1563 return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
1564
1565 case ECORE_X_ACTION_ABOVE:
1566 return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
1567
1568 case ECORE_X_ACTION_BELOW:
1569 return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
1570
1571 default:
1572 return 0;
1573 }
1574}
1575
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
deleted file mode 100644
index f9bf525..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c
+++ /dev/null
@@ -1,128 +0,0 @@
1#include "ecore_xcb_private.h"
2
3/**
4 * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
5 *
6 * Functions that operate on pixmaps.
7 */
8
9/**
10 * Creates a new pixmap.
11 * @param win Window used to determine which screen of the display the
12 * pixmap should be created on. If 0, the default root window
13 * is used.
14 * @param w Width of the new pixmap.
15 * @param h Height of the new pixmap.
16 * @param dep Depth of the pixmap. If 0, the default depth of the default
17 * screen is used.
18 * @return New pixmap.
19 * @ingroup Ecore_X_Pixmap_Group
20 */
21EAPI Ecore_X_Pixmap
22ecore_x_pixmap_new(Ecore_X_Window win,
23 int w,
24 int h,
25 int dep)
26{
27 Ecore_X_Pixmap pmap;
28
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30 CHECK_XCB_CONN;
31
32 if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
33 if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
34
35 pmap = xcb_generate_id(_ecore_xcb_conn);
36 xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
37
38// ecore_x_flush();
39 return pmap;
40}
41
42/**
43 * Deletes the reference to the given pixmap.
44 *
45 * If no other clients have a reference to the given pixmap, the server
46 * will destroy it.
47 *
48 * @param pmap The given pixmap.
49 * @ingroup Ecore_X_Pixmap_Group
50 */
51EAPI void
52ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
53{
54 LOGFN(__FILE__, __LINE__, __FUNCTION__);
55 CHECK_XCB_CONN;
56
57 xcb_free_pixmap(_ecore_xcb_conn, pmap);
58// ecore_x_flush();
59}
60
61/**
62 * Pastes a rectangular area of the given pixmap onto the given drawable.
63 * @param pmap The given pixmap.
64 * @param dest The given drawable.
65 * @param gc The graphics context which governs which operation will
66 * be used to paste the area onto the drawable.
67 * @param sx The X position of the area on the pixmap.
68 * @param sy The Y position of the area on the pixmap.
69 * @param w The width of the area.
70 * @param h The height of the area.
71 * @param dx The X position at which to paste the area on @p dest.
72 * @param dy The Y position at which to paste the area on @p dest.
73 * @ingroup Ecore_X_Pixmap_Group
74 */
75EAPI void
76ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
77 Ecore_X_Drawable dest,
78 Ecore_X_GC gc,
79 int sx,
80 int sy,
81 int w,
82 int h,
83 int dx,
84 int dy)
85{
86 LOGFN(__FILE__, __LINE__, __FUNCTION__);
87 CHECK_XCB_CONN;
88
89 xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
90// ecore_x_flush();
91}
92
93/**
94 * Retrieves the size of the given pixmap.
95 * @param pmap The given pixmap.
96 * @param x Pointer to an integer in which to store the X position.
97 * @param y Pointer to an integer in which to store the Y position.
98 * @param w Pointer to an integer in which to store the width.
99 * @param h Pointer to an integer in which to store the height.
100 * @ingroup Ecore_X_Pixmap_Group
101 */
102EAPI void
103ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
104 int *x,
105 int *y,
106 int *w,
107 int *h)
108{
109 LOGFN(__FILE__, __LINE__, __FUNCTION__);
110
111 if (pmap)
112 ecore_x_drawable_geometry_get(pmap, x, y, w, h);
113}
114
115/**
116 * Retrieves the depth of the given pixmap.
117 * @param pmap The given pixmap.
118 * @return The depth of the pixmap.
119 * @ingroup Ecore_X_Pixmap_Group
120 */
121EAPI int
122ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
123{
124 LOGFN(__FILE__, __LINE__, __FUNCTION__);
125
126 return ecore_x_drawable_depth_get(pmap);
127}
128
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
deleted file mode 100644
index cf8f3e5..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h
+++ /dev/null
@@ -1,451 +0,0 @@
1#ifndef __ECORE_XCB_PRIVATE_H__
2# define __ECORE_XCB_PRIVATE_H__
3
4//# define LOGFNS 1
5
6# ifdef HAVE_CONFIG_H
7# include "config.h"
8# endif
9
10# include <unistd.h> // included for close & gethostname functions
11
12/* generic xcb includes */
13# include <xcb/xcb.h>
14# include <xcb/bigreq.h>
15# include <xcb/shm.h>
16# include <xcb/xcb_image.h>
17
18/* EFL includes */
19# include "Ecore.h"
20# include "Ecore_Input.h"
21# include "Ecore_X.h"
22
23/* logging */
24extern int _ecore_xcb_log_dom;
25
26# ifdef ECORE_XCB_DEFAULT_LOG_COLOR
27# undef ECORE_XCB_DEFAULT_LOG_COLOR
28# endif
29# define ECORE_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
30
31# ifdef ERR
32# undef ERR
33# endif
34# define ERR(...) EINA_LOG_DOM_ERR(_ecore_xcb_log_dom, __VA_ARGS__)
35
36# ifdef DBG
37# undef DBG
38# endif
39# define DBG(...) EINA_LOG_DOM_DBG(_ecore_xcb_log_dom, __VA_ARGS__)
40
41# ifdef INF
42# undef INF
43# endif
44# define INF(...) EINA_LOG_DOM_INFO(_ecore_xcb_log_dom, __VA_ARGS__)
45
46# ifdef WRN
47# undef WRN
48# endif
49# define WRN(...) EINA_LOG_DOM_WARN(_ecore_xcb_log_dom, __VA_ARGS__)
50
51# ifdef CRIT
52# undef CRIT
53# endif
54# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__)
55
56# ifdef LOGFNS
57# include <stdio.h>
58# define LOGFN(fl, ln, fn) printf("-ECORE-XCB: %25s: %5i - %s\n", fl, ln, fn);
59# else
60# define LOGFN(fl, ln, fn)
61# endif
62
63# ifndef MAXHOSTNAMELEN
64# define MAXHOSTNAMELEN 256
65# endif
66
67# ifndef MIN
68# define MIN(x, y) (((x) > (y)) ? (y) : (x))
69# endif
70
71# ifndef MAX
72# define MAX(a, b) ((a < b) ? b : a)
73# endif
74
75#define CHECK_XCB_CONN \
76 { \
77 if (xcb_connection_has_error(_ecore_xcb_conn)) \
78 { \
79 DBG("XCB Connection Has Error !!"); \
80 _ecore_xcb_io_error_handle(NULL); \
81 } \
82 }
83
84/* enums */
85typedef enum _Ecore_Xcb_Encoding_Style Ecore_Xcb_Encoding_Style;
86
87enum _Ecore_Xcb_Encoding_Style
88{
89 XcbStringStyle,
90 XcbCompoundTextStyle,
91 XcbTextStyle,
92 XcbStdICCTextStyle,
93 XcbUTF8StringStyle
94};
95
96/* structures */
97typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source;
98typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target;
99typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
100typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
101typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
102typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty;
103
104struct _Ecore_X_DND_Source
105{
106 int version;
107 Ecore_X_Window win, dest;
108
109 enum
110 {
111 ECORE_X_DND_SOURCE_IDLE,
112 ECORE_X_DND_SOURCE_DRAGGING,
113 ECORE_X_DND_SOURCE_DROPPED,
114 ECORE_X_DND_SOURCE_CONVERTING
115 } state;
116
117 struct
118 {
119 short x, y;
120 unsigned short width, height;
121 } rectangle;
122
123 struct
124 {
125 Ecore_X_Window window;
126 int x, y;
127 } prev;
128
129 Ecore_X_Time time;
130
131 Ecore_X_Atom action, accepted_action;
132
133 int will_accept, suppress;
134 int await_status;
135};
136
137struct _Ecore_X_DND_Target
138{
139 int version;
140 Ecore_X_Window win, source;
141
142 enum
143 {
144 ECORE_X_DND_TARGET_IDLE,
145 ECORE_X_DND_TARGET_ENTERED
146 } state;
147
148 struct
149 {
150 int x, y;
151 } pos;
152
153 Ecore_X_Time time;
154
155 Ecore_X_Atom action, accepted_action;
156 int will_accept;
157};
158
159struct _Ecore_X_Selection_Intern
160{
161 Ecore_X_Window win;
162 Ecore_X_Atom selection;
163 unsigned char *data;
164 int length;
165 Ecore_X_Time time;
166};
167
168struct _Ecore_X_Selection_Converter
169{
170 Ecore_X_Atom target;
171 Eina_Bool (*convert)(char *target,
172 void *data,
173 int size,
174 void **data_ret,
175 int *size_ret,
176 Ecore_X_Atom *type,
177 int *size_type);
178 Ecore_X_Selection_Converter *next;
179};
180
181struct _Ecore_X_Selection_Parser
182{
183 char *target;
184 void *(*parse)(const char *target, void *data, int size, int format);
185 Ecore_X_Selection_Parser *next;
186};
187
188struct _Ecore_Xcb_Textproperty
189{
190 char *value;
191 Ecore_X_Atom encoding;
192 unsigned int format, nitems;
193};
194
195/* external variables */
196extern Ecore_X_Connection *_ecore_xcb_conn;
197extern Ecore_X_Screen *_ecore_xcb_screen;
198extern double _ecore_xcb_double_click_time;
199extern int16_t _ecore_xcb_event_last_root_x;
200extern int16_t _ecore_xcb_event_last_root_y;
201
202/* external variables for extension events */
203extern int _ecore_xcb_event_damage;
204extern int _ecore_xcb_event_randr;
205extern int _ecore_xcb_event_screensaver;
206extern int _ecore_xcb_event_shape;
207extern int _ecore_xcb_event_sync;
208extern int _ecore_xcb_event_xfixes;
209extern int _ecore_xcb_event_input;
210extern int _ecore_xcb_event_gesture;
211
212extern int ECORE_X_MODIFIER_SHIFT;
213extern int ECORE_X_MODIFIER_CTRL;
214extern int ECORE_X_MODIFIER_ALT;
215extern int ECORE_X_MODIFIER_WIN;
216extern int ECORE_X_LOCK_SCROLL;
217extern int ECORE_X_LOCK_NUM;
218extern int ECORE_X_LOCK_CAPS;
219extern int ECORE_X_LOCK_SHIFT;
220
221extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM];
222
223extern int _ecore_xcb_button_grabs_num;
224extern int _ecore_xcb_key_grabs_num;
225extern Ecore_X_Window *_ecore_xcb_button_grabs;
226extern Ecore_X_Window *_ecore_xcb_key_grabs;
227extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data,
228 int type,
229 void *event);
230extern void *_ecore_xcb_window_grab_replay_data;
231
232/* private function prototypes */
233void _ecore_xcb_error_handler_init(void);
234void _ecore_xcb_error_handler_shutdown(void);
235
236void _ecore_xcb_atoms_init(void);
237void _ecore_xcb_atoms_finalize(void);
238
239void _ecore_xcb_extensions_init(void);
240void _ecore_xcb_extensions_finalize(void);
241
242void _ecore_xcb_shape_init(void);
243void _ecore_xcb_shape_finalize(void);
244
245void _ecore_xcb_screensaver_init(void);
246void _ecore_xcb_screensaver_finalize(void);
247
248void _ecore_xcb_sync_init(void);
249void _ecore_xcb_sync_finalize(void);
250void _ecore_xcb_sync_magic_send(int val,
251 Ecore_X_Window win);
252
253void _ecore_xcb_render_init(void);
254void _ecore_xcb_render_finalize(void);
255Eina_Bool _ecore_xcb_render_argb_get(void);
256Eina_Bool _ecore_xcb_render_anim_get(void);
257Eina_Bool _ecore_xcb_render_avail_get(void);
258
259Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual);
260uint32_t _ecore_xcb_render_find_visual_id(int type,
261 Eina_Bool check_alpha);
262Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id);
263
264void _ecore_xcb_randr_init(void);
265void _ecore_xcb_randr_finalize(void);
266
267void _ecore_xcb_gesture_init(void);
268void _ecore_xcb_gesture_finalize(void);
269void _ecore_xcb_gesture_shutdown(void);
270
271void _ecore_xcb_xfixes_init(void);
272void _ecore_xcb_xfixes_finalize(void);
273Eina_Bool _ecore_xcb_xfixes_avail_get(void);
274
275void _ecore_xcb_damage_init(void);
276void _ecore_xcb_damage_finalize(void);
277
278void _ecore_xcb_composite_init(void);
279void _ecore_xcb_composite_finalize(void);
280
281void _ecore_xcb_dpms_init(void);
282void _ecore_xcb_dpms_finalize(void);
283
284void _ecore_xcb_cursor_init(void);
285void _ecore_xcb_cursor_finalize(void);
286
287void _ecore_xcb_xinerama_init(void);
288void _ecore_xcb_xinerama_finalize(void);
289
290void _ecore_xcb_dnd_init(void);
291void _ecore_xcb_dnd_shutdown(void);
292Ecore_X_DND_Source *_ecore_xcb_dnd_source_get(void);
293Ecore_X_DND_Target *_ecore_xcb_dnd_target_get(void);
294void _ecore_xcb_dnd_drag(Ecore_X_Window root,
295 int x,
296 int y);
297
298void _ecore_xcb_selection_init(void);
299void _ecore_xcb_selection_shutdown(void);
300void *_ecore_xcb_selection_parse(const char *target,
301 void *data,
302 int size,
303 int format);
304char *_ecore_xcb_selection_target_get(Ecore_X_Atom target);
305Ecore_X_Selection_Intern *_ecore_xcb_selection_get(Ecore_X_Atom selection);
306
307# ifdef HAVE_ICONV
308Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list,
309 int count,
310 Ecore_Xcb_Encoding_Style style,
311 Ecore_Xcb_Textproperty *ret);
312# endif
313Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list,
314 int count,
315 Ecore_Xcb_Encoding_Style style,
316 Ecore_Xcb_Textproperty *ret);
317Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type,
318 char **list,
319 int count,
320 Ecore_Xcb_Encoding_Style style,
321 Ecore_Xcb_Textproperty *ret);
322
323# ifdef HAVE_ICONV
324Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
325 char ***list_ret,
326 int *count_ret);
327# endif
328Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
329 char ***list_ret,
330 int *count_ret);
331Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
332 const char *type,
333 char ***list_ret,
334 int *count_ret);
335
336void _ecore_xcb_events_init(void);
337void _ecore_xcb_events_shutdown(void);
338void _ecore_xcb_events_handle(xcb_generic_event_t *ev);
339Ecore_X_Time _ecore_xcb_events_last_time_get(void);
340unsigned int _ecore_xcb_events_modifiers_get(unsigned int state);
341void _ecore_xcb_event_mouse_move(uint16_t timestamp,
342 uint16_t modifiers,
343 int16_t x,
344 int16_t y,
345 int16_t root_x,
346 int16_t root_y,
347 xcb_window_t event_win,
348 xcb_window_t win,
349 xcb_window_t root_win,
350 uint8_t same_screen,
351 int dev,
352 double radx,
353 double rady,
354 double pressure,
355 double angle,
356 int16_t mx,
357 int16_t my,
358 int16_t mrx,
359 int16_t mry);
360Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event,
361 uint16_t timestamp,
362 uint16_t modifiers,
363 xcb_button_t buttons,
364 int16_t x,
365 int16_t y,
366 int16_t root_x,
367 int16_t root_y,
368 xcb_window_t event_win,
369 xcb_window_t win,
370 xcb_window_t root_win,
371 uint8_t same_screen,
372 int dev,
373 double radx,
374 double rady,
375 double pressure,
376 double angle,
377 int16_t mx,
378 int16_t my,
379 int16_t mrx,
380 int16_t mry);
381
382void _ecore_xcb_keymap_init(void);
383void _ecore_xcb_keymap_finalize(void);
384void _ecore_xcb_keymap_shutdown(void);
385void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event);
386xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode,
387 int col);
388xcb_keycode_t *_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym);
389char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym);
390xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key);
391int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode,
392 int state,
393 char *buffer,
394 int bytes,
395 xcb_keysym_t *sym);
396
397void _ecore_xcb_input_init(void);
398void _ecore_xcb_input_finalize(void);
399void _ecore_xcb_input_shutdown(void);
400# ifdef ECORE_XCB_XINPUT
401void _ecore_xcb_input_handle_event(xcb_generic_event_t *event);
402# else
403void _ecore_xcb_input_handle_event(xcb_generic_event_t *event __UNUSED__);
404# endif
405
406void _ecore_xcb_dri_init(void);
407void _ecore_xcb_dri_finalize(void);
408
409void _ecore_xcb_xtest_init(void);
410void _ecore_xcb_xtest_finalize(void);
411
412Ecore_X_Window _ecore_xcb_window_root_of_screen_get(int screen);
413void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win,
414 Ecore_X_Atom atom,
415 const char *str);
416Ecore_X_Visual _ecore_xcb_window_visual_get(Ecore_X_Window win);
417void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win);
418void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win);
419void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win,
420 Ecore_X_Window child_win,
421 int type,
422 void *event,
423 Ecore_X_Time timestamp);
424
425int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__,
426 uint8_t data __UNUSED__);
427int _ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__,
428 uint8_t data __UNUSED__);
429Ecore_X_Window_State _ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom);
430
431int _ecore_xcb_error_handle(xcb_generic_error_t *err);
432int _ecore_xcb_io_error_handle(xcb_generic_error_t *err);
433
434xcb_image_t *_ecore_xcb_image_create_native(int w,
435 int h,
436 xcb_image_format_t format,
437 uint8_t depth,
438 void *base,
439 uint32_t bytes,
440 uint8_t *data);
441
442void _ecore_xcb_xdefaults_init(void);
443void _ecore_xcb_xdefaults_shutdown(void);
444char *_ecore_xcb_xdefaults_string_get(const char *prog,
445 const char *param);
446int _ecore_xcb_xdefaults_int_get(const char *prog,
447 const char *param);
448
449void _ecore_xcb_modifiers_get(void);
450
451#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
deleted file mode 100644
index 81a7c3f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c
+++ /dev/null
@@ -1,3699 +0,0 @@
1/* TODO: List of missing functions
2 *
3 * ecore_x_randr_crtc_clone_set
4 * ecore_x_randr_output_crtc_set
5 * ecore_x_randr_edid_version_get
6 * ecore_x_randr_edid_info_has_valid_checksum
7 * ecore_x_randr_edid_manufacturer_name_get
8 * ecore_x_randr_edid_display_ascii_get
9 * ecore_x_randr_edid_display_serial_get
10 * ecore_x_randr_edid_model_get
11 * ecore_x_randr_edid_manufacturer_serial_number_get
12 * ecore_x_randr_edid_manufacturer_model_get
13 * ecore_x_randr_edid_dpms_available_get
14 * ecore_x_randr_edid_dpms_standby_available_get
15 * ecore_x_randr_edid_dpms_suspend_available_get
16 * ecore_x_randr_edid_dpms_off_available_get
17 * ecore_x_randr_edid_display_aspect_ratio_preferred_get
18 * ecore_x_randr_edid_display_aspect_ratios_get
19 * ecore_x_randr_edid_display_colorscheme_get
20 * ecore_x_randr_edid_display_type_digital_get
21 * ecore_x_randr_edid_display_interface_type_get
22 * ecore_x_randr_screen_backlight_level_set
23 * ecore_x_randr_output_subpixel_order_get
24 * ecore_x_randr_output_wired_clones_get
25 * ecore_x_randr_output_compatibility_list_get
26 * ecore_x_randr_output_signal_formats_get
27 * ecore_x_randr_output_signal_format_set
28 * ecore_x_randr_output_signal_properties_get
29 * ecore_x_randr_output_connector_number_get
30 * ecore_x_randr_output_connector_type_get
31 * ecore_x_randr_crtc_panning_area_get
32 * ecore_x_randr_crtc_panning_area_set
33 * ecore_x_randr_crtc_tracking_area_get
34 * ecore_x_randr_crtc_tracking_area_set
35 * ecore_x_randr_crtc_border_area_get
36 * ecore_x_randr_crtc_border_area_set
37 */
38
39#include "ecore_xcb_private.h"
40# ifdef ECORE_XCB_RANDR
41# include <xcb/randr.h>
42# endif
43
44#define Ecore_X_Randr_None 0
45#define Ecore_X_Randr_Unset -1
46
47#define RANDR_1_1 ((1 << 16) | 1)
48#define RANDR_1_2 ((1 << 16) | 2)
49#define RANDR_1_3 ((1 << 16) | 3)
50
51#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) return ret
52#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) return ret
53#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) return ret
54
55#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3)
56#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12
57#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13
58#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36
59#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3
60#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5
61#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13
62
63#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
64 for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18)
65
66#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \
67 _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
68 if ((block[0] == 0) && (block[1] == 0))
69
70/* local function prototypes */
71static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root,
72 Ecore_X_Randr_Output output);
73static Eina_Bool _ecore_xcb_randr_crtc_validate(Ecore_X_Window root,
74 Ecore_X_Randr_Crtc crtc);
75static Eina_Bool _ecore_xcb_randr_root_validate(Ecore_X_Window root);
76static int _ecore_xcb_randr_root_to_screen(Ecore_X_Window root);
77static xcb_randr_get_screen_resources_reply_t *_ecore_xcb_randr_12_get_resources(Ecore_X_Window win);
78static xcb_randr_get_screen_resources_current_reply_t *_ecore_xcb_randr_13_get_resources(Ecore_X_Window win);
79static xcb_timestamp_t _ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win);
80static xcb_timestamp_t _ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win);
81
82static Ecore_X_Randr_Mode *_ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root,
83 Ecore_X_Randr_Output output,
84 int *num,
85 int *npreferred);
86static Ecore_X_Randr_Mode *_ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root,
87 Ecore_X_Randr_Output output,
88 int *num,
89 int *npreferred);
90static Ecore_X_Randr_Mode_Info *_ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root,
91 Ecore_X_Randr_Mode mode);
92static Ecore_X_Randr_Mode_Info *_ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root,
93 Ecore_X_Randr_Mode mode);
94static Ecore_X_Randr_Mode_Info **_ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root,
95 int *num);
96static Ecore_X_Randr_Mode_Info **_ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root,
97 int *num);
98static void _ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root,
99 Ecore_X_Randr_Mode mode,
100 int *w,
101 int *h);
102static void _ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root,
103 Ecore_X_Randr_Mode mode,
104 int *w,
105 int *h);
106static Ecore_X_Randr_Output *_ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root,
107 Ecore_X_Randr_Output output,
108 int *num);
109static Ecore_X_Randr_Output *_ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root,
110 Ecore_X_Randr_Output output,
111 int *num);
112static Ecore_X_Randr_Crtc *_ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root,
113 Ecore_X_Randr_Output output,
114 int *num);
115static Ecore_X_Randr_Crtc *_ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root,
116 Ecore_X_Randr_Output output,
117 int *num);
118static char *_ecore_xcb_randr_12_output_name_get(Ecore_X_Window root,
119 Ecore_X_Randr_Output output,
120 int *len);
121static char *_ecore_xcb_randr_13_output_name_get(Ecore_X_Window root,
122 Ecore_X_Randr_Output output,
123 int *len);
124static Ecore_X_Randr_Connection_Status _ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root,
125 Ecore_X_Randr_Output output);
126static Ecore_X_Randr_Connection_Status _ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root,
127 Ecore_X_Randr_Output output);
128static Ecore_X_Randr_Output *_ecore_xcb_randr_12_outputs_get(Ecore_X_Window root,
129 int *num);
130static Ecore_X_Randr_Output *_ecore_xcb_randr_13_outputs_get(Ecore_X_Window root,
131 int *num);
132static Ecore_X_Randr_Crtc _ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root,
133 Ecore_X_Randr_Output output);
134static Ecore_X_Randr_Crtc _ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root,
135 Ecore_X_Randr_Output output);
136
137/* local variables */
138static Eina_Bool _randr_avail = EINA_FALSE;
139static int _randr_version = -1;
140
141/* external variables */
142int _ecore_xcb_event_randr = -1;
143
144void
145_ecore_xcb_randr_init(void)
146{
147 LOGFN(__FILE__, __LINE__, __FUNCTION__);
148
149#ifdef ECORE_XCB_RANDR
150 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_randr_id);
151#endif
152}
153
154void
155_ecore_xcb_randr_finalize(void)
156{
157#ifdef ECORE_XCB_RANDR
158 const xcb_query_extension_reply_t *ext_reply;
159#endif
160
161 LOGFN(__FILE__, __LINE__, __FUNCTION__);
162
163#ifdef ECORE_XCB_RANDR
164 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_randr_id);
165 if ((ext_reply) && (ext_reply->present))
166 {
167 xcb_randr_query_version_cookie_t cookie;
168 xcb_randr_query_version_reply_t *reply;
169
170 cookie =
171 xcb_randr_query_version_unchecked(_ecore_xcb_conn,
172 XCB_RANDR_MAJOR_VERSION,
173 XCB_RANDR_MINOR_VERSION);
174 reply = xcb_randr_query_version_reply(_ecore_xcb_conn, cookie, NULL);
175 if (reply)
176 {
177 if ((reply->major_version >= XCB_RANDR_MAJOR_VERSION) &&
178 (reply->minor_version >= XCB_RANDR_MINOR_VERSION))
179 _randr_avail = EINA_TRUE;
180
181 _randr_version =
182 ((reply->major_version << 16) | reply->minor_version);
183
184 free(reply);
185 }
186
187 if (_randr_avail)
188 _ecore_xcb_event_randr = ext_reply->first_event;
189 }
190#endif
191}
192
193static Eina_Bool
194_ecore_xcb_randr_root_validate(Ecore_X_Window root)
195{
196#ifdef ECORE_XCB_RANDR
197 Ecore_X_Randr_Screen scr = -1;
198# define RANDR_VALIDATE_ROOT(screen, root) \
199 ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
200#endif
201
202 LOGFN(__FILE__, __LINE__, __FUNCTION__);
203
204#ifdef ECORE_XCB_RANDR
205 if ((root) && RANDR_VALIDATE_ROOT(scr, root))
206 return EINA_TRUE;
207#endif
208
209 return EINA_FALSE;
210}
211
212static int
213_ecore_xcb_randr_root_to_screen(Ecore_X_Window root)
214{
215 int count = 0, num = 0;
216
217 CHECK_XCB_CONN;
218
219 count = xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn));
220 for (num = 0; num < count; num++)
221 if (_ecore_xcb_window_root_of_screen_get(num) == root)
222 return num;
223
224 return -1;
225}
226
227/* public functions */
228
229/*
230 * @brief query whether randr is available or not
231 * @return EINA_TRUE, if extension is available, else EINA_FALSE
232 */
233EAPI Eina_Bool
234ecore_x_randr_query(void)
235{
236 return _randr_avail;
237}
238
239/*
240 * @return version of the RandRR extension supported by the server or,
241 * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1).
242 * bit version information: 31 MAJOR 16 | 15 MINOR 0
243 */
244EAPI int
245ecore_x_randr_version_get(void)
246{
247 return _randr_version;
248}
249
250/*
251 * @param root window which's primary output will be queried
252 */
253EAPI Ecore_X_Randr_Orientation
254ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root)
255{
256 int ret = Ecore_X_Randr_None;
257#ifdef ECORE_XCB_RANDR
258 xcb_randr_get_screen_info_cookie_t cookie;
259 xcb_randr_get_screen_info_reply_t *reply;
260#endif
261
262 LOGFN(__FILE__, __LINE__, __FUNCTION__);
263 CHECK_XCB_CONN;
264
265#ifdef ECORE_XCB_RANDR
266 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
267 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
268 if (reply)
269 {
270 ret = reply->rotations;
271 free(reply);
272 }
273#endif
274
275 return ret;
276}
277
278/*
279 * @param root window which's primary output will be queried
280 * @return the current orientation of the root window's screen primary output
281 */
282EAPI Ecore_X_Randr_Orientation
283ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root)
284{
285 int ret = Ecore_X_Randr_None;
286#ifdef ECORE_XCB_RANDR
287 xcb_randr_get_screen_info_cookie_t cookie;
288 xcb_randr_get_screen_info_reply_t *reply;
289#endif
290
291 LOGFN(__FILE__, __LINE__, __FUNCTION__);
292 CHECK_XCB_CONN;
293
294#ifdef ECORE_XCB_RANDR
295 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
296 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
297 if (reply)
298 {
299 ret = reply->rotation;
300 free(reply);
301 }
302#endif
303
304 return ret;
305}
306
307/*
308 * @brief sets a given screen's primary output's orientation
309 * @param root window which's screen's primary output will be queried
310 * @param orientation orientation which should be set for the root window's screen primary output
311 * @return EINA_TRUE if the primary output's orientation could be successfully altered
312 */
313EAPI Eina_Bool
314ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root,
315 Ecore_X_Randr_Orientation orientation)
316{
317 int ret = EINA_FALSE;
318#ifdef ECORE_XCB_RANDR
319 xcb_randr_get_screen_info_cookie_t cookie;
320 xcb_randr_get_screen_info_reply_t *reply;
321#endif
322
323 LOGFN(__FILE__, __LINE__, __FUNCTION__);
324 CHECK_XCB_CONN;
325
326#ifdef ECORE_XCB_RANDR
327 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
328 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
329 if (reply)
330 {
331 xcb_randr_set_screen_config_cookie_t scookie;
332 xcb_randr_set_screen_config_reply_t *sreply;
333
334 scookie =
335 xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
336 XCB_CURRENT_TIME,
337 reply->config_timestamp,
338 reply->sizeID, orientation,
339 reply->rate);
340 sreply =
341 xcb_randr_set_screen_config_reply(_ecore_xcb_conn, scookie, NULL);
342 if (!sreply)
343 ret = EINA_FALSE;
344 else
345 {
346 ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ?
347 EINA_TRUE : EINA_FALSE;
348 free(sreply);
349 }
350 free(reply);
351 }
352#endif
353
354 return ret;
355}
356
357/*
358 * @brief gets a screen's primary output's possible sizes
359 * @param root window which's primary output will be queried
360 * @param num number of sizes reported as supported by the screen's primary output
361 * @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL
362 */
363EAPI Ecore_X_Randr_Screen_Size_MM *
364ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
365 int *num)
366{
367#ifdef ECORE_XCB_RANDR
368 xcb_randr_get_screen_info_cookie_t cookie;
369 xcb_randr_get_screen_info_reply_t *reply;
370 Ecore_X_Randr_Screen_Size_MM *ret = NULL;
371#endif
372
373 LOGFN(__FILE__, __LINE__, __FUNCTION__);
374 CHECK_XCB_CONN;
375
376#ifdef ECORE_XCB_RANDR
377 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
378 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
379 if (reply)
380 {
381 int len = 0, i = 0;
382 xcb_randr_screen_size_t *sizes;
383
384 len = xcb_randr_get_screen_info_sizes_length(reply);
385 sizes = xcb_randr_get_screen_info_sizes(reply);
386 if ((!sizes) || (len <= 0))
387 {
388 free(reply);
389 return NULL;
390 }
391 if (num) *num = len;
392 ret = calloc(len, sizeof(Ecore_X_Randr_Screen_Size_MM));
393 if (!ret)
394 {
395 free(reply);
396 return NULL;
397 }
398 for (i = 0; i < len; i++)
399 {
400 ret[i].width = sizes[i].width;
401 ret[i].height = sizes[i].height;
402 ret[i].width_mm = sizes[i].mwidth;
403 ret[i].height_mm = sizes[i].mheight;
404 }
405
406 free(reply);
407 }
408
409 return ret;
410#else
411 return NULL;
412#endif
413}
414
415/*
416 * @brief get the current set size of a given screen's primary output
417 * @param root window which's primary output will be queried
418 * @param w the current size's width
419 * @param h the current size's height
420 * @param w_mm the current size's width in mm
421 * @param h_mm the current size's height in mm
422 * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set()
423 */
424EAPI void
425ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root,
426 int *w,
427 int *h,
428 int *w_mm,
429 int *h_mm,
430 int *size_index)
431{
432#ifdef ECORE_XCB_RANDR
433 xcb_randr_get_screen_info_cookie_t cookie;
434 xcb_randr_get_screen_info_reply_t *reply;
435#endif
436
437 LOGFN(__FILE__, __LINE__, __FUNCTION__);
438 CHECK_XCB_CONN;
439
440#ifdef ECORE_XCB_RANDR
441 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
442 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
443 if (reply)
444 {
445 int len = 0, idx = 0;
446 xcb_randr_screen_size_t *sizes;
447
448 len = xcb_randr_get_screen_info_sizes_length(reply);
449 sizes = xcb_randr_get_screen_info_sizes(reply);
450 if ((!sizes) || (len <= 0))
451 {
452 free(reply);
453 return;
454 }
455 idx = reply->sizeID;
456 if ((idx < len) && (idx >= 0))
457 {
458 if (w) *w = sizes[idx].width;
459 if (h) *h = sizes[idx].height;
460 if (w_mm) *w_mm = sizes[idx].mwidth;
461 if (h_mm) *h_mm = sizes[idx].mheight;
462 if (size_index) *size_index = idx;
463 }
464
465 free(reply);
466 }
467#endif
468}
469
470/*
471 * @brief sets a given screen's primary output size, but disables all other outputs at the same time
472 * @param root window which's primary output will be queried
473 * @param size_index within the list of sizes reported as supported by the root window's screen primary output
474 * @return EINA_TRUE on success, EINA_FALSE on failure due to e.g. invalid times
475 */
476EAPI Eina_Bool
477ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
478 int size_index)
479{
480 Eina_Bool ret = EINA_FALSE;
481#ifdef ECORE_XCB_RANDR
482 xcb_randr_get_screen_info_cookie_t cookie;
483 xcb_randr_get_screen_info_reply_t *reply;
484#endif
485
486 LOGFN(__FILE__, __LINE__, __FUNCTION__);
487 CHECK_XCB_CONN;
488
489#ifdef ECORE_XCB_RANDR
490 if (!((size_index >= 0) && (_ecore_xcb_randr_root_validate(root))))
491 return EINA_FALSE;
492
493 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
494 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
495 if (reply)
496 {
497 int len = 0;
498
499 len = xcb_randr_get_screen_info_sizes_length(reply);
500 if (len <= 0)
501 {
502 free(reply);
503 return EINA_FALSE;
504 }
505 if ((size_index < len) && (size_index >= 0))
506 {
507 xcb_randr_set_screen_config_cookie_t scookie;
508 xcb_randr_set_screen_config_reply_t *sreply;
509
510 scookie =
511 xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
512 XCB_CURRENT_TIME,
513 reply->config_timestamp,
514 size_index,
515 reply->rotation,
516 reply->rate);
517 sreply =
518 xcb_randr_set_screen_config_reply(_ecore_xcb_conn,
519 scookie, NULL);
520 if (!sreply)
521 ret = EINA_FALSE;
522 else
523 {
524 ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ?
525 EINA_TRUE : EINA_FALSE;
526 free(sreply);
527 }
528 }
529
530 free(reply);
531 }
532#endif
533 return ret;
534}
535
536/*
537 * @param root window which's primary output will be queried
538 * @return currently used refresh rate or - if request failed or RandRR is not available - 0.0
539 */
540EAPI Ecore_X_Randr_Refresh_Rate
541ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root)
542{
543#ifdef ECORE_XCB_RANDR
544 xcb_randr_get_screen_info_cookie_t cookie;
545 xcb_randr_get_screen_info_reply_t *reply;
546 Ecore_X_Randr_Refresh_Rate ret = 0.0;
547#endif
548
549 LOGFN(__FILE__, __LINE__, __FUNCTION__);
550 CHECK_XCB_CONN;
551
552#ifdef ECORE_XCB_RANDR
553 if (!_ecore_xcb_randr_root_validate(root)) return ret;
554
555 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
556 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
557 if (reply)
558 {
559 ret = reply->rate;
560 free(reply);
561 }
562
563 return ret;
564#else
565 return 0.0;
566#endif
567}
568
569/*
570 * @param root window which's primary output will be queried
571 * @param size_index referencing the size to query valid refresh rates for
572 * @return currently used refresh rate or - if request failed or RandRR is not available - NULL
573 */
574EAPI Ecore_X_Randr_Refresh_Rate *
575ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
576 int size_index,
577 int *num)
578{
579#ifdef ECORE_XCB_RANDR
580 xcb_randr_get_screen_info_cookie_t cookie;
581 xcb_randr_get_screen_info_reply_t *reply;
582 Ecore_X_Randr_Refresh_Rate *ret = NULL;
583#endif
584
585 LOGFN(__FILE__, __LINE__, __FUNCTION__);
586 CHECK_XCB_CONN;
587
588#ifdef ECORE_XCB_RANDR
589 if (!_ecore_xcb_randr_root_validate(root)) return ret;
590
591 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
592 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
593 if (reply)
594 {
595 int len = 0;
596
597 len = xcb_randr_get_screen_info_rates_length(reply);
598 if (num) *num = len;
599
600 ret = malloc(sizeof(Ecore_X_Randr_Refresh_Rate) * len);
601 if (ret)
602 {
603 xcb_randr_refresh_rates_iterator_t iter;
604 int i = 0;
605
606 iter = xcb_randr_get_screen_info_rates_iterator(reply);
607 while (i++ < size_index)
608 xcb_randr_refresh_rates_next(&iter);
609
610 memcpy(ret, xcb_randr_refresh_rates_rates(iter.data),
611 sizeof(Ecore_X_Randr_Refresh_Rate) * len);
612 }
613 free(reply);
614 }
615
616 return ret;
617#else
618 return NULL;
619#endif
620}
621
622/*
623 * @brief sets the current primary output's refresh rate
624 * @param root window which's primary output will be queried
625 * @param size_index referencing the size to be set
626 * @param rate the refresh rate to be set
627 * @return EINA_TRUE on success else EINA_FALSE
628 */
629EAPI Eina_Bool
630ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root,
631 int size_index,
632 Ecore_X_Randr_Refresh_Rate rate)
633{
634 Eina_Bool ret = EINA_FALSE;
635#ifdef ECORE_XCB_RANDR
636 xcb_randr_get_screen_info_cookie_t cookie;
637 xcb_randr_get_screen_info_reply_t *reply;
638#endif
639
640 LOGFN(__FILE__, __LINE__, __FUNCTION__);
641 CHECK_XCB_CONN;
642
643#ifdef ECORE_XCB_RANDR
644 if (_randr_version < RANDR_1_1) return EINA_FALSE;
645
646 cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root);
647 reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
648 if (reply)
649 {
650 xcb_randr_set_screen_config_cookie_t scookie;
651 xcb_randr_set_screen_config_reply_t *sreply;
652
653 scookie =
654 xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
655 XCB_CURRENT_TIME,
656 reply->config_timestamp,
657 size_index,
658 reply->rotation, rate);
659 sreply =
660 xcb_randr_set_screen_config_reply(_ecore_xcb_conn,
661 scookie, NULL);
662 if (!sreply)
663 ret = EINA_FALSE;
664 else
665 {
666 ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ?
667 EINA_TRUE : EINA_FALSE;
668 free(sreply);
669 }
670 free(reply);
671 }
672#endif
673
674 return ret;
675}
676
677/*
678 * @brief free detailed mode information. The pointer handed in will be set to
679 * NULL after freeing the memory.
680 * @param mode_info the mode information that should be freed
681 */
682EAPI void
683ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info)
684{
685 LOGFN(__FILE__, __LINE__, __FUNCTION__);
686 CHECK_XCB_CONN;
687
688 RANDR_CHECK_1_2_RET();
689
690 if (!mode_info) return;
691
692 if (mode_info->name) free(mode_info->name);
693 free(mode_info);
694 mode_info = NULL;
695}
696
697/*
698 * @param root window which's screen should be queried
699 * @return Ecore_X_Randr_Ouptut_Id or - if query failed or none is set - Ecore_X_Randr_None
700 */
701EAPI Ecore_X_Randr_Output
702ecore_x_randr_primary_output_get(Ecore_X_Window root)
703{
704 Ecore_X_Randr_Output ret = Ecore_X_Randr_None;
705#ifdef ECORE_XCB_RANDR
706 xcb_randr_get_output_primary_cookie_t cookie;
707 xcb_randr_get_output_primary_reply_t *reply;
708#endif
709
710 LOGFN(__FILE__, __LINE__, __FUNCTION__);
711 CHECK_XCB_CONN;
712
713#ifdef ECORE_XCB_RANDR
714 RANDR_CHECK_1_3_RET(Ecore_X_Randr_None);
715
716 if (!_ecore_xcb_randr_root_validate(root))
717 return Ecore_X_Randr_None;
718
719 cookie = xcb_randr_get_output_primary_unchecked(_ecore_xcb_conn, root);
720 reply = xcb_randr_get_output_primary_reply(_ecore_xcb_conn, cookie, NULL);
721 if (reply)
722 {
723 ret = reply->output;
724 free(reply);
725 }
726#endif
727 return ret;
728}
729
730/*
731 * @param root window which's screen should be queried
732 * @param output that should be set as given root window's screen primary output
733 */
734EAPI void
735ecore_x_randr_primary_output_set(Ecore_X_Window root,
736 Ecore_X_Randr_Output output)
737{
738 LOGFN(__FILE__, __LINE__, __FUNCTION__);
739 CHECK_XCB_CONN;
740
741#ifdef ECORE_XCB_RANDR
742 RANDR_CHECK_1_3_RET();
743
744 if ((output) && (_ecore_xcb_randr_root_validate(root)))
745 xcb_randr_set_output_primary(_ecore_xcb_conn, root, output);
746#endif
747}
748
749EAPI Ecore_X_Randr_Mode *
750ecore_x_randr_output_modes_get(Ecore_X_Window root,
751 Ecore_X_Randr_Output output,
752 int *num,
753 int *npreferred)
754{
755 Ecore_X_Randr_Mode *modes = NULL;
756
757 LOGFN(__FILE__, __LINE__, __FUNCTION__);
758 CHECK_XCB_CONN;
759
760#ifdef ECORE_XCB_RANDR
761 RANDR_CHECK_1_2_RET(NULL);
762
763 if (_randr_version >= RANDR_1_3)
764 {
765 modes =
766 _ecore_xcb_randr_13_output_modes_get(root, output, num, npreferred);
767 }
768 else if (_randr_version == RANDR_1_2)
769 {
770 modes =
771 _ecore_xcb_randr_12_output_modes_get(root, output, num, npreferred);
772 }
773#endif
774
775 return modes;
776}
777
778EAPI Eina_Bool
779ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, Ecore_X_Randr_Mode mode)
780{
781 LOGFN(__FILE__, __LINE__, __FUNCTION__);
782 CHECK_XCB_CONN;
783
784#ifdef ECORE_XCB_RANDR
785 RANDR_CHECK_1_2_RET(EINA_FALSE);
786
787 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
788 return EINA_FALSE;
789
790 xcb_randr_add_output_mode(_ecore_xcb_conn, output, mode);
791 return EINA_TRUE;
792#endif
793 return EINA_FALSE;
794}
795
796/*
797 * @brief get detailed information for a given mode id
798 * @param root window which's screen's ressources are queried
799 * @param mode the XID which identifies the mode of interest
800 * @return mode's detailed information
801 */
802EAPI Ecore_X_Randr_Mode_Info *
803ecore_x_randr_mode_info_get(Ecore_X_Window root,
804 Ecore_X_Randr_Mode mode)
805{
806 Ecore_X_Randr_Mode_Info *ret = NULL;
807
808 LOGFN(__FILE__, __LINE__, __FUNCTION__);
809 CHECK_XCB_CONN;
810
811#ifdef ECORE_XCB_RANDR
812 RANDR_CHECK_1_2_RET(NULL);
813
814 if (!_ecore_xcb_randr_root_validate(root)) return NULL;
815
816 if (_randr_version >= RANDR_1_3)
817 ret = _ecore_xcb_randr_13_mode_info_get(root, mode);
818 else if (_randr_version == RANDR_1_2)
819 ret = _ecore_xcb_randr_12_mode_info_get(root, mode);
820#endif
821 return ret;
822}
823
824/*
825 * @brief add a mode to a display
826 * @param root window to which's screen's ressources are added
827 * @param mode_info
828 * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode
829 * adding failed.
830 * @since 1.2.0
831 */
832EAPI Ecore_X_Randr_Mode
833ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info)
834{
835#ifdef ECORE_XCB_RANDR
836 Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
837 xcb_randr_create_mode_cookie_t cookie;
838 xcb_randr_create_mode_reply_t *reply;
839 xcb_randr_mode_info_t info;
840 int namelen = 0;
841#endif
842
843 LOGFN(__FILE__, __LINE__, __FUNCTION__);
844 CHECK_XCB_CONN;
845
846#ifdef ECORE_XCB_RANDR
847 RANDR_CHECK_1_2_RET(EINA_FALSE);
848
849 if (!mode_info) return Ecore_X_Randr_None;
850 if (!_ecore_xcb_randr_root_validate(root)) return Ecore_X_Randr_None;
851
852 namelen = strlen(mode_info->name);
853
854 memset(&info, 0, sizeof(info));
855 info.width = mode_info->width;
856 info.height = mode_info->height;
857 info.dot_clock = mode_info->dotClock;
858 info.hsync_start = mode_info->hSyncStart;
859 info.hsync_end = mode_info->hSyncEnd;
860 info.htotal = mode_info->hTotal;
861 info.hskew = mode_info->hSkew;
862 info.vsync_start = mode_info->vSyncStart;
863 info.vsync_end = mode_info->vSyncEnd;
864 info.vtotal = mode_info->vTotal;
865 info.mode_flags = mode_info->modeFlags;
866 info.name_len = namelen;
867
868 cookie =
869 xcb_randr_create_mode_unchecked(_ecore_xcb_conn, root, info,
870 namelen, mode_info->name);
871 reply = xcb_randr_create_mode_reply(_ecore_xcb_conn, cookie, NULL);
872 if (reply)
873 {
874 mode = mode_info->xid;
875 free(reply);
876 }
877#endif
878 return mode;
879}
880
881/*
882 * @brief get detailed information for all modes related to a root window's screen
883 * @param root window which's screen's ressources are queried
884 * @param num number of modes returned
885 * @return modes' information
886 */
887EAPI Ecore_X_Randr_Mode_Info **
888ecore_x_randr_modes_info_get(Ecore_X_Window root,
889 int *num)
890{
891 Ecore_X_Randr_Mode_Info **ret = NULL;
892
893 LOGFN(__FILE__, __LINE__, __FUNCTION__);
894 CHECK_XCB_CONN;
895
896 if (num) *num = 0;
897
898#ifdef ECORE_XCB_RANDR
899 RANDR_CHECK_1_2_RET(NULL);
900
901 if (!_ecore_xcb_randr_root_validate(root)) return NULL;
902
903 if (_randr_version >= RANDR_1_3)
904 ret = _ecore_xcb_randr_13_modes_info_get(root, num);
905 else if (_randr_version == RANDR_1_2)
906 ret = _ecore_xcb_randr_12_modes_info_get(root, num);
907#endif
908 return ret;
909}
910
911/**
912 * @brief gets the width and hight of a given mode
913 * @param mode the mode which's size is to be looked up
914 * @param w width of given mode in px
915 * @param h height of given mode in px
916 */
917EAPI void
918ecore_x_randr_mode_size_get(Ecore_X_Window root,
919 Ecore_X_Randr_Mode mode,
920 int *w,
921 int *h)
922{
923 LOGFN(__FILE__, __LINE__, __FUNCTION__);
924 CHECK_XCB_CONN;
925
926#ifdef ECORE_XCB_RANDR
927 RANDR_CHECK_1_2_RET();
928
929 if (mode == Ecore_X_Randr_None) return;
930
931 if (_randr_version >= RANDR_1_3)
932 _ecore_xcb_randr_13_mode_size_get(root, mode, w, h);
933 else if (_randr_version == RANDR_1_2)
934 _ecore_xcb_randr_12_mode_size_get(root, mode, w, h);
935#endif
936}
937
938/**
939 * @brief gets the EDID information of an attached output if available.
940 * Note that this information is not to be compared using ordinary string
941 * comparison functions, since it includes 0-bytes.
942 * @param root window this information should be queried from
943 * @param output the XID of the output
944 * @param length length of the byte-array. If NULL, request will fail.
945 */
946EAPI unsigned char *
947ecore_x_randr_output_edid_get(Ecore_X_Window root,
948 Ecore_X_Randr_Output output,
949 unsigned long *length)
950{
951 unsigned char *ret = NULL;
952#ifdef ECORE_XCB_RANDR
953 xcb_randr_get_output_property_cookie_t cookie;
954 xcb_randr_get_output_property_reply_t *reply;
955 Ecore_X_Atom atom;
956#endif
957
958 LOGFN(__FILE__, __LINE__, __FUNCTION__);
959 CHECK_XCB_CONN;
960
961#ifdef ECORE_XCB_RANDR
962 RANDR_CHECK_1_2_RET(NULL);
963
964 if ((!length) || (!_ecore_xcb_randr_output_validate(root, output)))
965 return NULL;
966
967 atom = ecore_x_atom_get("EDID");
968 cookie =
969 xcb_randr_get_output_property_unchecked(_ecore_xcb_conn, output, atom,
970 XCB_GET_PROPERTY_TYPE_ANY,
971 0, 100, 0, 0);
972 reply =
973 xcb_randr_get_output_property_reply(_ecore_xcb_conn, cookie, NULL);
974 if (reply)
975 {
976 if ((reply->type == XCB_ATOM_INTEGER) && (reply->format == 8))
977 {
978 if (length) *length = reply->num_items;
979 if ((ret = malloc(reply->num_items * sizeof(unsigned char))))
980 {
981 memcpy(ret, xcb_randr_get_output_property_data(reply),
982 (reply->num_items * sizeof(unsigned char)));
983 }
984 }
985 free(reply);
986 }
987#endif
988 return ret;
989}
990
991/**
992 * @brief gets the the outputs which might be used simultenously on the same
993 * CRTC.
994 * @param root window that this information should be queried for.
995 * @param output the output which's clones we concern
996 * @param num number of possible clones
997 */
998EAPI Ecore_X_Randr_Output *
999ecore_x_randr_output_clones_get(Ecore_X_Window root,
1000 Ecore_X_Randr_Output output,
1001 int *num)
1002{
1003 Ecore_X_Randr_Output *outputs = NULL;
1004
1005 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1006 CHECK_XCB_CONN;
1007
1008#ifdef ECORE_XCB_RANDR
1009 RANDR_CHECK_1_2_RET(NULL);
1010
1011 if (output == Ecore_X_Randr_None) return NULL;
1012
1013 if (_randr_version >= RANDR_1_3)
1014 outputs = _ecore_xcb_randr_13_output_clones_get(root, output, num);
1015 else if (_randr_version == RANDR_1_2)
1016 outputs = _ecore_xcb_randr_12_output_clones_get(root, output, num);
1017#endif
1018 return outputs;
1019}
1020
1021EAPI Ecore_X_Randr_Crtc *
1022ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root,
1023 Ecore_X_Randr_Output output,
1024 int *num)
1025{
1026 Ecore_X_Randr_Crtc *crtcs = NULL;
1027
1028 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1029 CHECK_XCB_CONN;
1030
1031#ifdef ECORE_XCB_RANDR
1032 RANDR_CHECK_1_2_RET(NULL);
1033
1034 if (output == Ecore_X_Randr_None) return NULL;
1035
1036 if (_randr_version >= RANDR_1_3)
1037 crtcs = _ecore_xcb_randr_13_output_possible_crtcs_get(root, output, num);
1038 else if (_randr_version == RANDR_1_2)
1039 crtcs = _ecore_xcb_randr_12_output_possible_crtcs_get(root, output, num);
1040#endif
1041 return crtcs;
1042}
1043
1044/**
1045 * @brief gets the given output's name as reported by X
1046 * @param root the window which's screen will be queried
1047 * @param len length of returned c-string.
1048 * @return name of the output as reported by X
1049 */
1050EAPI char *
1051ecore_x_randr_output_name_get(Ecore_X_Window root,
1052 Ecore_X_Randr_Output output,
1053 int *len)
1054{
1055 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1056 CHECK_XCB_CONN;
1057
1058#ifdef ECORE_XCB_RANDR
1059 RANDR_CHECK_1_2_RET(NULL);
1060
1061 if (output == Ecore_X_Randr_None) return NULL;
1062
1063 if (_randr_version >= RANDR_1_3)
1064 return _ecore_xcb_randr_13_output_name_get(root, output, len);
1065 else if (_randr_version == RANDR_1_2)
1066 return _ecore_xcb_randr_12_output_name_get(root, output, len);
1067#endif
1068
1069 return NULL;
1070}
1071
1072EAPI Ecore_X_Randr_Connection_Status
1073ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
1074 Ecore_X_Randr_Output output)
1075{
1076 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1077 CHECK_XCB_CONN;
1078
1079#ifdef ECORE_XCB_RANDR
1080 RANDR_CHECK_1_2_RET(ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN);
1081
1082 if (output == Ecore_X_Randr_None)
1083 return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
1084
1085 if (_randr_version >= RANDR_1_3)
1086 return _ecore_xcb_randr_13_output_connection_status_get(root, output);
1087 else if (_randr_version == RANDR_1_2)
1088 return _ecore_xcb_randr_12_output_connection_status_get(root, output);
1089#endif
1090
1091 return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
1092}
1093
1094EAPI Ecore_X_Randr_Output *
1095ecore_x_randr_outputs_get(Ecore_X_Window root,
1096 int *num)
1097{
1098 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1099 CHECK_XCB_CONN;
1100
1101#ifdef ECORE_XCB_RANDR
1102 RANDR_CHECK_1_2_RET(NULL);
1103
1104 if (_randr_version >= RANDR_1_3)
1105 return _ecore_xcb_randr_13_outputs_get(root, num);
1106 else if (_randr_version == RANDR_1_2)
1107 return _ecore_xcb_randr_12_outputs_get(root, num);
1108#endif
1109
1110 return NULL;
1111}
1112
1113EAPI Ecore_X_Randr_Crtc
1114ecore_x_randr_output_crtc_get(Ecore_X_Window root,
1115 Ecore_X_Randr_Output output)
1116{
1117 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1118 CHECK_XCB_CONN;
1119
1120#ifdef ECORE_XCB_RANDR
1121 RANDR_CHECK_1_2_RET(Ecore_X_Randr_None);
1122
1123 if (output == Ecore_X_Randr_None) return Ecore_X_Randr_None;
1124
1125 if (_randr_version >= RANDR_1_3)
1126 return _ecore_xcb_randr_13_output_crtc_get(root, output);
1127 else if (_randr_version == RANDR_1_2)
1128 return _ecore_xcb_randr_12_output_crtc_get(root, output);
1129#endif
1130
1131 return Ecore_X_Randr_None;
1132}
1133
1134EAPI void
1135ecore_x_randr_output_size_mm_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *w_mm, int *h_mm)
1136{
1137#ifdef ECORE_XCB_RANDR
1138 xcb_randr_get_output_info_cookie_t ocookie;
1139 xcb_randr_get_output_info_reply_t *oreply;
1140 xcb_timestamp_t timestamp = 0;
1141#endif
1142
1143 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1144 CHECK_XCB_CONN;
1145
1146 if (w_mm) *w_mm = 0;
1147 if (h_mm) *h_mm = 0;
1148
1149#ifdef ECORE_XCB_RANDR
1150 RANDR_CHECK_1_2_RET();
1151
1152 if ((output != Ecore_X_Randr_None) && (_randr_version >= RANDR_1_3))
1153 {
1154 xcb_randr_get_screen_resources_current_reply_t *reply;
1155
1156 reply = _ecore_xcb_randr_13_get_resources(root);
1157 timestamp = reply->config_timestamp;
1158 free(reply);
1159 }
1160 else if ((output != Ecore_X_Randr_None) && (_randr_version == RANDR_1_2))
1161 {
1162 xcb_randr_get_screen_resources_reply_t *reply;
1163
1164 reply = _ecore_xcb_randr_12_get_resources(root);
1165 timestamp = reply->config_timestamp;
1166 free(reply);
1167 }
1168
1169 ocookie =
1170 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, timestamp);
1171 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL);
1172 if (oreply)
1173 {
1174 if (w_mm) *w_mm = oreply->mm_width;
1175 if (h_mm) *h_mm = oreply->mm_height;
1176 free(oreply);
1177 }
1178#endif
1179}
1180
1181/**
1182 * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is
1183 * auto enabled in it's preferred mode, when it was disabled before.
1184 * @param root the root window which's default display will be queried
1185 * @param crtc the CRTC which's configuration should be altered
1186 * @param outputs an array of outputs, that should display this CRTC's content.
1187 * @param noutputs number of outputs in the array of outputs.
1188 * If set to Ecore_X_Randr_Unset, current outputs and number of outputs will be used.
1189 * If set to Ecore_X_Randr_None, CRTC will be disabled
1190 * @param x new x coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current x
1191 * corrdinate will be assumed.
1192 * @param y new y coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current y
1193 * corrdinate will be assumed.
1194 * @param mode the new mode to be set. If Ecore_X_Randr_None is passed, the
1195 * CRTC will be disabled. If Ecore_X_Randr_Unset is passed, the current mode is assumed.
1196 * @param orientation the new orientation to be set. If Ecore_X_Randr_Unset is used,
1197 * the current mode is assumed.
1198 * @return EINA_TRUE if the configuration alteration was successful, else
1199 * EINA_FALSE
1200 */
1201EAPI Eina_Bool
1202ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
1203 Ecore_X_Randr_Crtc crtc,
1204 Ecore_X_Randr_Output *outputs,
1205 int num,
1206 int x,
1207 int y,
1208 Ecore_X_Randr_Mode mode,
1209 Ecore_X_Randr_Orientation orientation)
1210{
1211 Eina_Bool ret = EINA_FALSE;
1212#ifdef ECORE_XCB_RANDR
1213 xcb_timestamp_t stamp = 0;
1214 xcb_randr_get_crtc_info_cookie_t ccookie;
1215 xcb_randr_get_crtc_info_reply_t *creply;
1216#endif
1217
1218 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1219 CHECK_XCB_CONN;
1220
1221#ifdef ECORE_XCB_RANDR
1222 RANDR_CHECK_1_2_RET(EINA_FALSE);
1223
1224 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret;
1225
1226 if (_randr_version >= RANDR_1_3)
1227 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1228 else if (_randr_version == RANDR_1_2)
1229 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1230
1231 ccookie =
1232 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1233 creply =
1234 xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ccookie, NULL);
1235 if (creply)
1236 {
1237 xcb_randr_set_crtc_config_cookie_t scookie;
1238 xcb_randr_set_crtc_config_reply_t *sreply;
1239
1240 if ((mode == Ecore_X_Randr_None) ||
1241 (num == Ecore_X_Randr_None))
1242 {
1243 outputs = NULL;
1244 num = 0;
1245 }
1246 else if (num == (int)Ecore_X_Randr_Unset)
1247 {
1248 outputs = xcb_randr_get_crtc_info_outputs(creply);
1249 num = creply->num_outputs;
1250 }
1251 if ((int)mode == Ecore_X_Randr_Unset) mode = creply->mode;
1252 if (x < 0) x = creply->x;
1253 if (y < 0) y = creply->y;
1254 if ((int)orientation == Ecore_X_Randr_Unset)
1255 orientation = creply->rotation;
1256
1257 scookie =
1258 xcb_randr_set_crtc_config_unchecked(_ecore_xcb_conn,
1259 crtc, XCB_CURRENT_TIME, stamp,
1260 x, y, mode, orientation,
1261 num, outputs);
1262 sreply =
1263 xcb_randr_set_crtc_config_reply(_ecore_xcb_conn, scookie, NULL);
1264 if (sreply)
1265 {
1266 ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ?
1267 EINA_TRUE : EINA_FALSE;
1268 free(sreply);
1269 }
1270 free(creply);
1271 }
1272#endif
1273
1274 return ret;
1275}
1276
1277/**
1278 * @brief sets a mode for a CRTC and the outputs attached to it
1279 * @param root the window's screen to be queried
1280 * @param crtc the CRTC which shall be set
1281 * @param outputs array of outputs which have to be compatible with the mode. If
1282 * NULL CRTC will be disabled.
1283 * @param noutputs number of outputs in array to be used. Use
1284 * Ecore_X_Randr_Unset (or -1) to use currently used outputs.
1285 * @param mode XID of the mode to be set. If set to 0 the CRTC will be disabled.
1286 * If set to -1 the call will fail.
1287 * @return EINA_TRUE if mode setting was successful. Else EINA_FALSE
1288 */
1289EAPI Eina_Bool
1290ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
1291 Ecore_X_Randr_Crtc crtc,
1292 Ecore_X_Randr_Output *outputs,
1293 int num,
1294 Ecore_X_Randr_Mode mode)
1295{
1296 Eina_Bool ret = EINA_FALSE;
1297
1298 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1299 CHECK_XCB_CONN;
1300
1301#ifdef ECORE_XCB_RANDR
1302 RANDR_CHECK_1_2_RET(EINA_FALSE);
1303
1304 if ((int)mode == Ecore_X_Randr_Unset) return ret;
1305 ret =
1306 ecore_x_randr_crtc_settings_set(root, crtc, outputs, num,
1307 Ecore_X_Randr_Unset, Ecore_X_Randr_Unset,
1308 mode, Ecore_X_Randr_Unset);
1309#endif
1310
1311 return ret;
1312}
1313
1314/**
1315 * @brief Get the current set mode of a given CRTC
1316 * @param root the window's screen to be queried
1317 * @param crtc the CRTC which's should be queried
1318 * @return currently set mode or - in case parameters are invalid -
1319 * Ecore_X_Randr_Unset
1320 */
1321EAPI Ecore_X_Randr_Mode
1322ecore_x_randr_crtc_mode_get(Ecore_X_Window root,
1323 Ecore_X_Randr_Crtc crtc)
1324{
1325 Ecore_X_Randr_Mode ret = Ecore_X_Randr_Unset;
1326#ifdef ECORE_XCB_RANDR
1327 xcb_timestamp_t stamp = 0;
1328 xcb_randr_get_crtc_info_cookie_t ocookie;
1329 xcb_randr_get_crtc_info_reply_t *oreply;
1330#endif
1331
1332 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1333 CHECK_XCB_CONN;
1334
1335#ifdef ECORE_XCB_RANDR
1336 RANDR_CHECK_1_2_RET(Ecore_X_Randr_Unset);
1337
1338 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret;
1339
1340 if (_randr_version >= RANDR_1_3)
1341 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1342 else if (_randr_version == RANDR_1_2)
1343 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1344
1345 ocookie =
1346 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1347 oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL);
1348 if (oreply)
1349 {
1350 ret = oreply->mode;
1351 free(oreply);
1352 }
1353#endif
1354
1355 return ret;
1356}
1357
1358EAPI Ecore_X_Randr_Orientation
1359ecore_x_randr_crtc_orientation_get(Ecore_X_Window root,
1360 Ecore_X_Randr_Crtc crtc)
1361{
1362 Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None;
1363#ifdef ECORE_XCB_RANDR
1364 xcb_timestamp_t stamp = 0;
1365 xcb_randr_get_crtc_info_cookie_t ocookie;
1366 xcb_randr_get_crtc_info_reply_t *oreply;
1367#endif
1368
1369 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1370 CHECK_XCB_CONN;
1371
1372#ifdef ECORE_XCB_RANDR
1373 RANDR_CHECK_1_2_RET(Ecore_X_Randr_None);
1374
1375 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret;
1376
1377 if (_randr_version >= RANDR_1_3)
1378 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1379 else if (_randr_version == RANDR_1_2)
1380 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1381
1382 ocookie =
1383 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1384 oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL);
1385 if (oreply)
1386 {
1387 ret = oreply->rotation;
1388 free(oreply);
1389 }
1390#endif
1391
1392 return ret;
1393}
1394
1395EAPI Eina_Bool
1396ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
1397 Ecore_X_Randr_Crtc crtc,
1398 Ecore_X_Randr_Orientation orientation)
1399{
1400 Eina_Bool ret = EINA_FALSE;
1401
1402 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1403 CHECK_XCB_CONN;
1404
1405#ifdef ECORE_XCB_RANDR
1406 RANDR_CHECK_1_2_RET(EINA_FALSE);
1407
1408 if (orientation != Ecore_X_Randr_None)
1409 {
1410 ret =
1411 ecore_x_randr_crtc_settings_set(root, crtc, NULL,
1412 Ecore_X_Randr_Unset, Ecore_X_Randr_Unset,
1413 Ecore_X_Randr_Unset, Ecore_X_Randr_Unset,
1414 orientation);
1415 }
1416#endif
1417 return ret;
1418}
1419
1420EAPI Ecore_X_Randr_Orientation
1421ecore_x_randr_crtc_orientations_get(Ecore_X_Window root,
1422 Ecore_X_Randr_Crtc crtc)
1423{
1424 Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None;
1425#ifdef ECORE_XCB_RANDR
1426 xcb_timestamp_t stamp = 0;
1427 xcb_randr_get_crtc_info_cookie_t ocookie;
1428 xcb_randr_get_crtc_info_reply_t *oreply;
1429#endif
1430
1431 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1432 CHECK_XCB_CONN;
1433
1434#ifdef ECORE_XCB_RANDR
1435 RANDR_CHECK_1_2_RET(Ecore_X_Randr_None);
1436
1437 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret;
1438
1439 if (_randr_version >= RANDR_1_3)
1440 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1441 else if (_randr_version == RANDR_1_2)
1442 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1443
1444 ocookie =
1445 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1446 oreply =
1447 xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL);
1448 if (oreply)
1449 {
1450 ret = oreply->rotations;
1451 free(oreply);
1452 }
1453#endif
1454
1455 return ret;
1456}
1457
1458/*
1459 * @brief get a CRTC's possible outputs.
1460 * @param root the root window which's screen will be queried
1461 * @param num number of possible outputs referenced by given CRTC
1462 */
1463EAPI Ecore_X_Randr_Output *
1464ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root,
1465 Ecore_X_Randr_Crtc crtc,
1466 int *num)
1467{
1468 Ecore_X_Randr_Output *ret = NULL;
1469#ifdef ECORE_XCB_RANDR
1470 xcb_timestamp_t stamp = 0;
1471 xcb_randr_get_crtc_info_cookie_t ocookie;
1472 xcb_randr_get_crtc_info_reply_t *oreply;
1473#endif
1474
1475 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1476 CHECK_XCB_CONN;
1477
1478#ifdef ECORE_XCB_RANDR
1479 RANDR_CHECK_1_2_RET(NULL);
1480
1481 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret;
1482
1483 if (_randr_version >= RANDR_1_3)
1484 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1485 else if (_randr_version == RANDR_1_2)
1486 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1487
1488 ocookie =
1489 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1490 oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL);
1491 if (oreply)
1492 {
1493 if (num) *num = oreply->num_possible_outputs;
1494 ret = malloc(sizeof(Ecore_X_Randr_Output) *
1495 oreply->num_possible_outputs);
1496 if (ret)
1497 {
1498 memcpy(ret, xcb_randr_get_crtc_info_possible(oreply),
1499 sizeof(Ecore_X_Randr_Output) *
1500 oreply->num_possible_outputs);
1501 }
1502 free(oreply);
1503 }
1504#endif
1505
1506 return ret;
1507}
1508
1509/*
1510 * @brief get all known CRTCs related to a root window's screen
1511 * @param root window which's screen's ressources are queried
1512 * @param num number of CRTCs returned
1513 * @return CRTC IDs
1514 */
1515EAPI Ecore_X_Randr_Crtc *
1516ecore_x_randr_crtcs_get(Ecore_X_Window root,
1517 int *num)
1518{
1519 Ecore_X_Randr_Crtc *ret = NULL;
1520
1521 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1522 CHECK_XCB_CONN;
1523
1524#ifdef ECORE_XCB_RANDR
1525 RANDR_CHECK_1_2_RET(NULL);
1526
1527 if (_randr_version >= RANDR_1_3)
1528 {
1529 xcb_randr_get_screen_resources_current_reply_t *reply;
1530
1531 reply = _ecore_xcb_randr_13_get_resources(root);
1532 if (reply)
1533 {
1534 if (num) *num = reply->num_crtcs;
1535 ret = malloc(sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs);
1536 if (ret)
1537 memcpy(ret, xcb_randr_get_screen_resources_current_crtcs(reply),
1538 sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs);
1539 free(reply);
1540 }
1541 }
1542 else if (_randr_version == RANDR_1_2)
1543 {
1544 xcb_randr_get_screen_resources_reply_t *reply;
1545
1546 reply = _ecore_xcb_randr_12_get_resources(root);
1547 if (reply)
1548 {
1549 if (num) *num = reply->num_crtcs;
1550 ret = malloc(sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs);
1551 if (ret)
1552 memcpy(ret, xcb_randr_get_screen_resources_crtcs(reply),
1553 sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs);
1554 free(reply);
1555 }
1556 }
1557#endif
1558
1559 return ret;
1560}
1561
1562/*
1563 * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead.
1564 * @brief get the CRTCs, which display a certain window
1565 * @param window window the displaying CRTCs shall be found for
1566 * @param num the number of CRTCs displaying the window
1567 * @return array of CRTCs that display a certain window. NULL if no CRTCs
1568 * was found that displays the specified window.
1569 */
1570EAPI Ecore_X_Randr_Crtc *
1571ecore_x_randr_current_crtc_get(Ecore_X_Window window,
1572 int *num)
1573{
1574 return ecore_x_randr_window_crtcs_get(window, num);
1575}
1576
1577/*
1578 * @brief get the CRTCs, which display a certain window
1579 * @param window window the displaying crtcs shall be found for
1580 * @param num the number of crtcs displaying the window
1581 * @return array of crtcs that display a certain window. NULL if no crtcs
1582 * was found that displays the specified window.
1583 * @since 1.2.0
1584 */
1585EAPI Ecore_X_Randr_Crtc *
1586ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
1587 int *num)
1588{
1589#ifdef ECORE_XCB_RANDR
1590 Ecore_X_Window root;
1591 Eina_Rectangle w_geo, c_geo;
1592 Ecore_X_Randr_Crtc *crtcs, *ret = NULL;
1593 Ecore_X_Randr_Mode mode;
1594 int ncrtcs, i, nret = 0;
1595 xcb_translate_coordinates_cookie_t cookie;
1596 xcb_translate_coordinates_reply_t *trans;
1597#endif
1598
1599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1600 CHECK_XCB_CONN;
1601
1602#ifdef ECORE_XCB_RANDR
1603 RANDR_CHECK_1_2_RET(NULL);
1604
1605 ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h);
1606
1607 root = ecore_x_window_root_get(window);
1608 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
1609 if (!crtcs) return NULL;
1610
1611 /* now get window RELATIVE to root window - thats what matters. */
1612 cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
1613 trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
1614 w_geo.x = trans->dst_x;
1615 w_geo.y = trans->dst_y;
1616 free(trans);
1617
1618 for (i = 0, nret = 0; i < ncrtcs; i++)
1619 {
1620 /* if crtc is not enabled, don't bother about it any further */
1621 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
1622 if (mode == Ecore_X_Randr_None) continue;
1623
1624 ecore_x_randr_crtc_geometry_get(root, crtcs[i], &c_geo.x, &c_geo.y,
1625 &c_geo.w, &c_geo.h);
1626 if (eina_rectangles_intersect(&w_geo, &c_geo))
1627 {
1628 ret = realloc(ret, (++nret *
1629 sizeof(Ecore_X_Randr_Output)));
1630 ret[nret] = crtcs[i];
1631 }
1632 }
1633 free(crtcs);
1634
1635 if (num) *num = nret;
1636 return ret;
1637
1638#endif
1639 if (num) *num = 0;
1640 return NULL;
1641}
1642
1643/*
1644 * @brief get a CRTC's outputs.
1645 * @param root the root window which's screen will be queried
1646 * @param num number of outputs referenced by given CRTC
1647 */
1648EAPI Ecore_X_Randr_Output *
1649ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
1650 Ecore_X_Randr_Crtc crtc,
1651 int *num)
1652{
1653 Ecore_X_Randr_Output *ret = NULL;
1654#ifdef ECORE_XCB_RANDR
1655 xcb_timestamp_t stamp = 0;
1656 xcb_randr_get_crtc_info_cookie_t ocookie;
1657 xcb_randr_get_crtc_info_reply_t *oreply;
1658#endif
1659
1660 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1661 CHECK_XCB_CONN;
1662
1663#ifdef ECORE_XCB_RANDR
1664 RANDR_CHECK_1_2_RET(NULL);
1665
1666 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret;
1667
1668 if (_randr_version >= RANDR_1_3)
1669 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1670 else if (_randr_version == RANDR_1_2)
1671 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1672
1673 ocookie =
1674 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1675 oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL);
1676 if (oreply)
1677 {
1678 if (num) *num = oreply->num_outputs;
1679 ret = malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_outputs);
1680 if (ret)
1681 memcpy(ret, xcb_randr_get_crtc_info_outputs(oreply),
1682 sizeof(Ecore_X_Randr_Output) * oreply->num_outputs);
1683 free(oreply);
1684 }
1685#endif
1686
1687 return ret;
1688}
1689
1690EAPI void
1691ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
1692 Ecore_X_Randr_Crtc crtc,
1693 int *x,
1694 int *y,
1695 int *w,
1696 int *h)
1697{
1698#ifdef ECORE_XCB_RANDR
1699 xcb_timestamp_t stamp = 0;
1700 xcb_randr_get_crtc_info_cookie_t ocookie;
1701 xcb_randr_get_crtc_info_reply_t *oreply;
1702#endif
1703
1704 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1705 CHECK_XCB_CONN;
1706
1707#ifdef ECORE_XCB_RANDR
1708 RANDR_CHECK_1_2_RET();
1709
1710 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return;
1711
1712 if (_randr_version >= RANDR_1_3)
1713 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
1714 else if (_randr_version == RANDR_1_2)
1715 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
1716
1717 ocookie =
1718 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp);
1719 oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL);
1720 if (oreply)
1721 {
1722 if (x) *x = oreply->x;
1723 if (y) *y = oreply->y;
1724 if (w) *w = oreply->width;
1725 if (h) *h = oreply->height;
1726 free(oreply);
1727 }
1728#endif
1729}
1730
1731/**
1732 * @brief sets a CRTC relative to another one.
1733 * @param crtc1 the CRTC to be positioned.
1734 * @param crtc2 the CRTC the position should be relative to
1735 * @param policy the relation between the crtcs
1736 * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's
1737 * borders
1738 * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if
1739 * repositioning failed or if position of new crtc would be out of given screen's min/max bounds.
1740 */
1741EAPI Eina_Bool
1742ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
1743 Ecore_X_Randr_Crtc crtc1,
1744 Ecore_X_Randr_Crtc crtc2,
1745 Ecore_X_Randr_Output_Policy policy,
1746 Ecore_X_Randr_Relative_Alignment alignment)
1747{
1748#ifdef ECORE_XCB_RANDR
1749 Eina_Rectangle r1, r2;
1750 int w_max = 0, h_max = 0, cw = 0, ch = 0, xn = -1, yn = -1;
1751#endif
1752
1753 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1754 CHECK_XCB_CONN;
1755
1756#ifdef ECORE_XCB_RANDR
1757 RANDR_CHECK_1_2_RET(EINA_FALSE);
1758
1759 if ((ecore_x_randr_crtc_mode_get(root, crtc1) == 0) ||
1760 (ecore_x_randr_crtc_mode_get(root, crtc2) == 0))
1761 return EINA_FALSE;
1762
1763 if ((!_ecore_xcb_randr_crtc_validate(root, crtc1) ||
1764 (!(crtc1 != crtc2) && (!_ecore_xcb_randr_crtc_validate(root, crtc2)))))
1765 return EINA_FALSE;
1766
1767 ecore_x_randr_crtc_geometry_get(root, crtc1, &r1.x, &r1.y, &r1.w, &r1.h);
1768 ecore_x_randr_crtc_geometry_get(root, crtc2, &r2.x, &r2.y, &r2.w, &r2.h);
1769 ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max);
1770 ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL);
1771
1772 switch (policy)
1773 {
1774 case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT:
1775 xn = (r2.x + r2.w);
1776 if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE)
1777 yn = -1;
1778 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL)
1779 yn = ((int)(((double)r2.h / 2.0) + (double)r2.y - ((double)r1.h / 2.0)));
1780 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR)
1781 yn = ((int)((double)ch / 2.0) - ((double)r1.h / 2.0));
1782 break;
1783
1784 case ECORE_X_RANDR_OUTPUT_POLICY_LEFT:
1785 xn = (r2.x - r1.w);
1786 if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE)
1787 yn = -1;
1788 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL)
1789 yn = ((int)(((double)r2.h / 2.0) + (double)r2.y - ((double)r1.h / 2.0)));
1790 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR)
1791 yn = ((int)((double)ch / 2.0) - ((double)r1.h / 2.0));
1792 break;
1793
1794 case ECORE_X_RANDR_OUTPUT_POLICY_BELOW:
1795 yn = (r2.y + r2.h);
1796 if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE)
1797 xn = -1;
1798 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL)
1799 xn = ((int)((((double)r2.x + (double)r2.w) / 2.0) - ((double)r1.w / 2.0)));
1800 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR)
1801 xn = ((int)((double)cw / 2.0));
1802 break;
1803
1804 case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE:
1805 yn = (r2.y - r1.h);
1806 if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE)
1807 xn = -1;
1808 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL)
1809 xn = ((int)((((double)r2.x + (double)r2.w) / 2.0) - ((double)r1.w / 2.0)));
1810 else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR)
1811 xn = ((int)((double)cw / 2.0));
1812 break;
1813
1814 case ECORE_X_RANDR_OUTPUT_POLICY_CLONE:
1815 return ecore_x_randr_crtc_pos_set(root, crtc1, r2.x, r2.y);
1816 break;
1817
1818 case ECORE_X_RANDR_OUTPUT_POLICY_NONE:
1819 break;
1820 }
1821
1822 if ((xn == r1.x) && (yn == r1.x)) return EINA_TRUE;
1823 if (((yn + r1.h) > h_max) || ((xn + r1.w) > w_max))
1824 return EINA_FALSE;
1825
1826 return ecore_x_randr_crtc_pos_set(root, crtc1, xn, yn);
1827#endif
1828
1829 return EINA_FALSE;
1830}
1831
1832EAPI Eina_Bool
1833ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root,
1834 const Ecore_X_Randr_Crtc *not_moved,
1835 int num,
1836 int dx,
1837 int dy)
1838{
1839 Eina_Bool ret = EINA_FALSE;
1840#ifdef ECORE_XCB_RANDR
1841 Ecore_X_Randr_Crtc *crtcs = NULL, *move = NULL;
1842 int i = 0, j = 0, k = 0, n = 0, total = 0;
1843#endif
1844
1845 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1846 CHECK_XCB_CONN;
1847
1848#ifdef ECORE_XCB_RANDR
1849 if ((num <= 0) || (!not_moved) || (!_ecore_xcb_randr_root_validate(root)))
1850 return EINA_FALSE;
1851
1852 crtcs = ecore_x_randr_crtcs_get(root, &total);
1853 n = (total - num);
1854 move = malloc(sizeof(Ecore_X_Randr_Crtc) * n);
1855 if (move)
1856 {
1857 for (i = 0, k = 0; (i < total) && (k < n); i++)
1858 {
1859 for (j = 0; j < num; j++)
1860 if (crtcs[i] == not_moved[j]) break;
1861 if (j == num)
1862 move[k++] = crtcs[i];
1863 }
1864 ret = ecore_x_randr_move_crtcs(root, move, n, dx, dy);
1865 free(move);
1866 free(crtcs);
1867 }
1868#endif
1869
1870 return ret;
1871}
1872
1873EAPI void
1874ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
1875 Ecore_X_Randr_Crtc crtc,
1876 int *x,
1877 int *y)
1878{
1879 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1880 CHECK_XCB_CONN;
1881
1882#ifdef ECORE_XCB_RANDR
1883 RANDR_CHECK_1_2_RET();
1884
1885 ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL);
1886#endif
1887}
1888
1889/*
1890 * @brief sets the position of given CRTC within root window's screen
1891 * @param root the window's screen to be queried
1892 * @param crtc the CRTC which's position within the mentioned screen is to be altered
1893 * @param x position on the x-axis (0 == left) of the screen. if x < 0 current value will be kept.
1894 * @param y position on the y-ayis (0 == top) of the screen. if y < 0, current value will be kept.
1895 * @return EINA_TRUE if position could be successfully be altered.
1896 */
1897EAPI Eina_Bool
1898ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
1899 Ecore_X_Randr_Crtc crtc,
1900 int x,
1901 int y)
1902{
1903 Eina_Bool ret = EINA_FALSE;
1904#ifdef ECORE_XCB_RANDR
1905 int w = 0, h = 0, nw = 0, nh = 0;
1906 Eina_Rectangle rect;
1907#endif
1908
1909 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1910 CHECK_XCB_CONN;
1911
1912#ifdef ECORE_XCB_RANDR
1913 RANDR_CHECK_1_2_RET(EINA_FALSE);
1914
1915 ecore_x_randr_crtc_geometry_get(root, crtc,
1916 &rect.x, &rect.y, &rect.w, &rect.h);
1917 ecore_x_randr_screen_current_size_get(root, &w, &h, NULL, NULL);
1918 if (x < 0) x = rect.x;
1919 if (y < 0) y = rect.y;
1920 if ((x + rect.w) > w)
1921 nw = (x + rect.w);
1922 if ((y + rect.h) > h)
1923 nh = (y + rect.h);
1924
1925 if ((nw != 0) || (nh != 0))
1926 {
1927 if (!ecore_x_randr_screen_current_size_set(root, nw, nh, 0, 0))
1928 return EINA_FALSE;
1929 }
1930
1931 ret = ecore_x_randr_crtc_settings_set(root, crtc, NULL, -1, x, y, -1, -1);
1932#endif
1933
1934 return ret;
1935}
1936
1937EAPI void
1938ecore_x_randr_crtc_size_get(Ecore_X_Window root,
1939 Ecore_X_Randr_Crtc crtc,
1940 int *w,
1941 int *h)
1942{
1943 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1944 CHECK_XCB_CONN;
1945
1946#ifdef ECORE_XCB_RANDR
1947 RANDR_CHECK_1_2_RET();
1948 ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h);
1949#endif
1950}
1951
1952EAPI Ecore_X_Randr_Refresh_Rate
1953ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
1954 Ecore_X_Randr_Crtc crtc,
1955 Ecore_X_Randr_Mode mode)
1956{
1957 Ecore_X_Randr_Refresh_Rate ret = 0.0;
1958
1959 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1960 CHECK_XCB_CONN;
1961
1962#ifdef ECORE_XCB_RANDR
1963 RANDR_CHECK_1_2_RET(0.0);
1964
1965 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return 0.0;
1966
1967 if (_randr_version >= RANDR_1_3)
1968 {
1969 xcb_randr_get_screen_resources_current_reply_t *reply;
1970
1971 reply = _ecore_xcb_randr_13_get_resources(root);
1972 if (reply)
1973 {
1974 xcb_randr_mode_info_iterator_t miter;
1975
1976 miter =
1977 xcb_randr_get_screen_resources_current_modes_iterator(reply);
1978 while (miter.rem)
1979 {
1980 xcb_randr_mode_info_t *minfo;
1981
1982 minfo = miter.data;
1983 if (minfo->id == mode)
1984 {
1985 if ((minfo->htotal) && (minfo->vtotal))
1986 {
1987 ret = ((double)minfo->dot_clock /
1988 ((double)minfo->htotal *
1989 (double)minfo->vtotal));
1990 }
1991 break;
1992 }
1993 xcb_randr_mode_info_next(&miter);
1994 }
1995 free(reply);
1996 }
1997 }
1998 else if (_randr_version == RANDR_1_2)
1999 {
2000 xcb_randr_get_screen_resources_reply_t *reply;
2001
2002 reply = _ecore_xcb_randr_12_get_resources(root);
2003 if (reply)
2004 {
2005 xcb_randr_mode_info_iterator_t miter;
2006
2007 miter = xcb_randr_get_screen_resources_modes_iterator(reply);
2008 while (miter.rem)
2009 {
2010 xcb_randr_mode_info_t *minfo;
2011
2012 minfo = miter.data;
2013 if (minfo->id == mode)
2014 {
2015 if ((minfo->htotal) && (minfo->vtotal))
2016 {
2017 ret = ((double)minfo->dot_clock /
2018 ((double)minfo->htotal *
2019 (double)minfo->vtotal));
2020 }
2021 break;
2022 }
2023 xcb_randr_mode_info_next(&miter);
2024 }
2025 free(reply);
2026 }
2027 }
2028#endif
2029 return ret;
2030}
2031
2032/*
2033 * @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.
2034 * @param root window which's screen's resources are used
2035 * @param crtcs list of CRTCs to be moved
2036 * @param ncrtc number of CRTCs in array
2037 * @param dx amount of pixels the CRTCs should be moved in x direction
2038 * @param dy amount of pixels the CRTCs should be moved in y direction
2039 * @return EINA_TRUE if all crtcs could be moved successfully.
2040 */
2041EAPI Eina_Bool
2042ecore_x_randr_move_crtcs(Ecore_X_Window root,
2043 const Ecore_X_Randr_Crtc *crtcs,
2044 int num,
2045 int dx,
2046 int dy)
2047{
2048 Eina_Bool ret = EINA_TRUE;
2049#ifdef ECORE_XCB_RANDR
2050 xcb_timestamp_t stamp = 0;
2051 xcb_randr_get_crtc_info_reply_t *oreply[num];
2052 int i = 0, cw = 0, ch = 0;
2053 int mw = 0, mh = 0, nw = 0, nh = 0;
2054#endif
2055
2056 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2057 CHECK_XCB_CONN;
2058
2059#ifdef ECORE_XCB_RANDR
2060 RANDR_CHECK_1_2_RET(EINA_FALSE);
2061
2062 if (!_ecore_xcb_randr_root_validate(root)) return EINA_FALSE;
2063
2064 if (_randr_version >= RANDR_1_3)
2065 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
2066 else if (_randr_version == RANDR_1_2)
2067 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
2068
2069 ecore_x_randr_screen_size_range_get(root, NULL, NULL, &mw, &mh);
2070 ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL);
2071 nw = cw;
2072 nh = ch;
2073
2074 for (i = 0; i < num; i++)
2075 {
2076 xcb_randr_get_crtc_info_cookie_t ocookie;
2077
2078 ocookie =
2079 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtcs[i],
2080 stamp);
2081 oreply[i] = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn,
2082 ocookie, NULL);
2083 if (oreply[i])
2084 {
2085 if (((oreply[i]->x + dx) < 0) ||
2086 ((oreply[i]->y + dy) < 0) ||
2087 ((oreply[i]->x + oreply[i]->width + dx) > mw) ||
2088 ((oreply[i]->y + oreply[i]->height + dy) > mh))
2089 {
2090 continue;
2091 }
2092 nw = MAX((int)(oreply[i]->x + oreply[i]->width + dx), nw);
2093 nh = MAX((int)(oreply[i]->y + oreply[i]->height + dy), nh);
2094 }
2095 }
2096
2097 if ((nw > cw) || (nh > ch))
2098 {
2099 if (!ecore_x_randr_screen_current_size_set(root, nw, nh, -1, -1))
2100 {
2101 for (i = 0; i < num; i++)
2102 if (oreply[i]) free(oreply[i]);
2103
2104 return EINA_FALSE;
2105 }
2106 }
2107
2108 for (i = 0; ((i < num) && (oreply[i])); i++)
2109 {
2110 if (!oreply[i]) continue;
2111 if (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, -1,
2112 (oreply[i]->x + dx),
2113 (oreply[i]->y + dy),
2114 oreply[i]->mode,
2115 oreply[i]->rotation))
2116 {
2117 ret = EINA_FALSE;
2118 break;
2119 }
2120 }
2121
2122 if (i < num)
2123 {
2124 while (i-- >= 0)
2125 {
2126 if (oreply[i])
2127 ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, -1,
2128 (oreply[i]->x - dx),
2129 (oreply[i]->y - dy),
2130 oreply[i]->mode,
2131 oreply[i]->rotation);
2132 }
2133 }
2134
2135 for (i = 0; i < num; i++)
2136 if (oreply[i]) free(oreply[i]);
2137#endif
2138
2139 return ret;
2140}
2141
2142/**
2143 * @brief enable event selection. This enables basic interaction with
2144 * output/crtc events and requires RRandR >= 1.2.
2145 * @param win select this window's properties for RandRR events
2146 * @param on enable/disable selecting
2147 */
2148EAPI void
2149ecore_x_randr_events_select(Ecore_X_Window win,
2150 Eina_Bool on)
2151{
2152#ifdef ECORE_XCB_RANDR
2153 uint16_t mask = 0;
2154#endif
2155
2156 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2157 CHECK_XCB_CONN;
2158
2159#ifdef ECORE_XCB_RANDR
2160 if (on)
2161 {
2162 mask = XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE;
2163 if (_randr_version >= ((1 << 16) | 2))
2164 {
2165 mask |= (XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE |
2166 XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE |
2167 XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY);
2168 }
2169 }
2170
2171 xcb_randr_select_input(_ecore_xcb_conn, win, mask);
2172#endif
2173}
2174
2175/**
2176 * @brief removes unused screen space. The most upper left CRTC is set to 0x0
2177 * and all other CRTCs dx,dy respectively.
2178 * @param root the window's screen which will be reset.
2179 */
2180EAPI void
2181ecore_x_randr_screen_reset(Ecore_X_Window root)
2182{
2183#ifdef ECORE_XCB_RANDR
2184 xcb_timestamp_t stamp = 0;
2185 Ecore_X_Randr_Crtc *crtcs = NULL;
2186 int total = 0, i = 0, w = 0, h = 0;
2187 int dx = 100000, dy = 100000, num = 0;
2188#endif
2189
2190 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2191 CHECK_XCB_CONN;
2192
2193#ifdef ECORE_XCB_RANDR
2194 if (!_ecore_xcb_randr_root_validate(root)) return;
2195 crtcs = ecore_x_randr_crtcs_get(root, &total);
2196
2197 if (_randr_version >= RANDR_1_3)
2198 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
2199 else if (_randr_version == RANDR_1_2)
2200 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
2201
2202 /* I hate declaring variables inside code like this, but we need the
2203 * value of 'total' before we can */
2204 Ecore_X_Randr_Crtc enabled[total];
2205
2206 for (i = 0; i < total; i++)
2207 {
2208 xcb_randr_get_crtc_info_cookie_t ocookie;
2209 xcb_randr_get_crtc_info_reply_t *oreply;
2210
2211 ocookie =
2212 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtcs[i], stamp);
2213 oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn,
2214 ocookie, NULL);
2215 if (!oreply) continue;
2216 if ((oreply->mode <= 0) || (oreply->num_outputs == 0))
2217 {
2218 free(oreply);
2219 continue;
2220 }
2221
2222 enabled[num++] = crtcs[i];
2223 if ((int)(oreply->x + oreply->width) > w)
2224 w = (oreply->x + oreply->width);
2225 if ((int)(oreply->y + oreply->height) > h)
2226 h = (oreply->y + oreply->height);
2227
2228 if (oreply->x < dx) dx = oreply->x;
2229 if (oreply->y < dy) dy = oreply->y;
2230
2231 free(oreply);
2232 }
2233 free(crtcs);
2234
2235 if ((dx > 0) || (dy > 0))
2236 {
2237 if (ecore_x_randr_move_crtcs(root, enabled, num, -dx, -dy))
2238 {
2239 w -= dx;
2240 h -= dy;
2241 }
2242 }
2243
2244 ecore_x_randr_screen_current_size_set(root, w, h, -1, -1);
2245#endif
2246}
2247
2248/*
2249 * @param root window which's screen will be queried
2250 * @param wmin minimum width the screen can be set to
2251 * @param hmin minimum height the screen can be set to
2252 * @param wmax maximum width the screen can be set to
2253 * @param hmax maximum height the screen can be set to
2254 */
2255EAPI void
2256ecore_x_randr_screen_size_range_get(Ecore_X_Window root,
2257 int *minw,
2258 int *minh,
2259 int *maxw,
2260 int *maxh)
2261{
2262#ifdef ECORE_XCB_RANDR
2263 xcb_randr_get_screen_size_range_cookie_t cookie;
2264 xcb_randr_get_screen_size_range_reply_t *reply;
2265#endif
2266
2267 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2268 CHECK_XCB_CONN;
2269
2270#ifdef ECORE_XCB_RANDR
2271 RANDR_CHECK_1_2_RET();
2272
2273 cookie = xcb_randr_get_screen_size_range_unchecked(_ecore_xcb_conn, root);
2274 reply = xcb_randr_get_screen_size_range_reply(_ecore_xcb_conn, cookie, NULL);
2275 if (reply)
2276 {
2277 if (minw) *minw = reply->min_width;
2278 if (minh) *minh = reply->min_height;
2279 if (maxw) *maxw = reply->max_width;
2280 if (maxh) *maxh = reply->max_height;
2281 free(reply);
2282 }
2283#endif
2284}
2285
2286/*
2287 * @param w width of screen in px
2288 * @param h height of screen in px
2289 */
2290EAPI void
2291ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
2292 int *w,
2293 int *h,
2294 int *w_mm,
2295 int *h_mm)
2296{
2297#ifdef ECORE_XCB_RANDR
2298 Ecore_X_Randr_Screen scr = 0;
2299 xcb_screen_t *s;
2300# define RANDR_VALIDATE_ROOT(screen, root) \
2301 ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
2302#endif
2303
2304 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2305 CHECK_XCB_CONN;
2306
2307#ifdef ECORE_XCB_RANDR
2308 RANDR_CHECK_1_2_RET();
2309
2310 if (!RANDR_VALIDATE_ROOT(scr, root)) return;
2311
2312 s = ecore_x_screen_get(scr);
2313 if (w) *w = s->width_in_pixels;
2314 if (h) *h = s->height_in_pixels;
2315 if (w_mm) *w_mm = s->width_in_millimeters;
2316 if (h_mm) *h_mm = s->height_in_millimeters;
2317#endif
2318}
2319
2320/*
2321 * @param root window which's screen's size should be set. If invalid (e.g. NULL) no action is taken.
2322 * @param w width in px the screen should be set to. If out of valid boundaries, current value is assumed.
2323 * @param h height in px the screen should be set to. If out of valid boundaries, current value is assumed.
2324 * @param w_mm width in mm the screen should be set to. If 0, current aspect is assumed.
2325 * @param h_mm height in mm the screen should be set to. If 0, current aspect is assumed.
2326 * @return EINA_TRUE if request was successfully sent or screen is already in
2327 * requested size, EINA_FALSE if parameters are invalid
2328 */
2329EAPI Eina_Bool
2330ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
2331 int w,
2332 int h,
2333 int w_mm,
2334 int h_mm)
2335{
2336 Eina_Bool ret = EINA_TRUE;
2337#ifdef ECORE_XCB_RANDR
2338 Ecore_X_Randr_Screen scr;
2339 int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0;
2340 int mw = 0, mh = 0, xw = 0, xh = 0;
2341# define RANDR_VALIDATE_ROOT(screen, root) \
2342 ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1)
2343#endif
2344
2345 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2346 CHECK_XCB_CONN;
2347
2348#ifdef ECORE_XCB_RANDR
2349 RANDR_CHECK_1_2_RET(EINA_FALSE);
2350
2351 if (!RANDR_VALIDATE_ROOT(scr, root)) return EINA_FALSE;
2352 ecore_x_randr_screen_current_size_get(root, &wc, &hc, &w_mm_c, &h_mm_c);
2353 if ((w == wc) && (h == hc) && (w_mm == w_mm_c) && (h_mm == h_mm_c))
2354 return EINA_TRUE;
2355 ecore_x_randr_screen_size_range_get(root, &mw, &mh, &xw, &xh);
2356 if (((w != 1) && ((w < mw) || (w > xw))) ||
2357 ((h != -1) && ((h < mh) || (h > xh)))) return EINA_FALSE;
2358
2359 if (w <= 0)
2360 w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
2361 if (h <= 0)
2362 h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
2363
2364 /* NB: Hmmmm, xlib version divides w_mm by width ... that seems wrong */
2365 if (w_mm <= 0)
2366 w_mm = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_millimeters;
2367 if (h_mm <= 0)
2368 h_mm = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_millimeters;
2369
2370 xcb_randr_set_screen_size(_ecore_xcb_conn, root, w, h, w_mm, h_mm);
2371#endif
2372
2373 return ret;
2374}
2375
2376/*
2377 * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead.
2378 * @brief get the outputs, which display a certain window
2379 * @param window window the displaying outputs shall be found for
2380 * @param num the number of outputs displaying the window
2381 * @return array of outputs that display a certain window. NULL if no outputs
2382 * was found that displays the specified window.
2383 */
2384
2385Ecore_X_Randr_Output *
2386ecore_x_randr_current_output_get(Ecore_X_Window window,
2387 int *num)
2388{
2389 return ecore_x_randr_window_outputs_get(window, num);
2390}
2391
2392/*
2393 * @brief get the outputs, which display a certain window
2394 * @param window window the displaying outputs shall be found for
2395 * @param num the number of outputs displaying the window
2396 * @return array of outputs that display a certain window. NULL if no outputs
2397 * was found that displays the specified window.
2398 */
2399EAPI Ecore_X_Randr_Output *
2400ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2401 int *num)
2402{
2403#ifdef ECORE_XCB_RANDR
2404 Ecore_X_Window root;
2405 Ecore_X_Randr_Crtc *crtcs;
2406 Ecore_X_Randr_Output *outputs, *ret = NULL;
2407 int ncrtcs, noutputs, i, nret = 0;
2408#endif
2409
2410 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2411 CHECK_XCB_CONN;
2412
2413 if (num) *num = 0;
2414
2415#ifdef ECORE_XCB_RANDR
2416 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
2417
2418 root = ecore_x_window_root_get(window);
2419 if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
2420 goto _ecore_x_randr_current_output_get_fail;
2421
2422 for (i = 0, nret = 0; i < ncrtcs; i++)
2423 {
2424
2425 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
2426 &noutputs);
2427 if (!outputs)
2428 goto _ecore_x_randr_current_output_get_fail_free;
2429 nret += noutputs;
2430 ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
2431 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2432 free(outputs);
2433 }
2434 free(crtcs);
2435
2436 if (num)
2437 *num = nret;
2438
2439 return ret;
2440
2441_ecore_x_randr_current_output_get_fail_free:
2442 free(outputs);
2443 free(crtcs);
2444 free(ret);
2445_ecore_x_randr_current_output_get_fail:
2446#endif
2447 if (num) *num = 0;
2448 return NULL;
2449}
2450
2451/*
2452 * @brief get the backlight level of the given output
2453 * @param root window which's screen should be queried
2454 * @param output from which the backlight level should be retrieved
2455 * @return the backlight level
2456 */
2457EAPI double
2458ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
2459 Ecore_X_Randr_Output output)
2460{
2461#ifdef ECORE_XCB_RANDR
2462 Ecore_X_Atom _backlight;
2463 xcb_intern_atom_cookie_t acookie;
2464 xcb_intern_atom_reply_t *areply;
2465 xcb_randr_get_output_property_cookie_t cookie;
2466 xcb_randr_get_output_property_reply_t *reply;
2467 xcb_randr_query_output_property_cookie_t qcookie;
2468 xcb_randr_query_output_property_reply_t *qreply;
2469 double dvalue;
2470 long value, max, min;
2471#endif
2472
2473 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2474 CHECK_XCB_CONN;
2475
2476#ifdef ECORE_XCB_RANDR
2477 RANDR_CHECK_1_2_RET(-1);
2478
2479 acookie =
2480 xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
2481 strlen("Backlight"), "Backlight");
2482 areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
2483
2484 if (!areply)
2485 {
2486 ERR("Backlight property is not suppported on this server or driver");
2487 return -1;
2488 }
2489 else
2490 {
2491 _backlight = areply->atom;
2492 free(areply);
2493 }
2494
2495 if (!_ecore_xcb_randr_output_validate(root, output))
2496 {
2497 ERR("Invalid output");
2498 return -1;
2499 }
2500
2501 cookie =
2502 xcb_randr_get_output_property_unchecked(_ecore_xcb_conn,
2503 output, _backlight,
2504 XCB_ATOM_NONE, 0, 4, 0, 0);
2505 reply =
2506 xcb_randr_get_output_property_reply(_ecore_xcb_conn, cookie, NULL);
2507 if (!reply)
2508 {
2509 WRN("Backlight not supported on this output");
2510 return -1;
2511 }
2512
2513 if ((reply->format != 32) || (reply->num_items != 1) ||
2514 (reply->type != XCB_ATOM_INTEGER))
2515 {
2516 free(reply);
2517 return -1;
2518 }
2519
2520 value = *((long *)xcb_randr_get_output_property_data(reply));
2521 free (reply);
2522
2523 /* I have the current value of the backlight */
2524 /* Now retrieve the min and max intensities of the output */
2525 qcookie =
2526 xcb_randr_query_output_property_unchecked(_ecore_xcb_conn,
2527 output, _backlight);
2528 qreply =
2529 xcb_randr_query_output_property_reply(_ecore_xcb_conn, qcookie, NULL);
2530 if (qreply)
2531 {
2532 dvalue = -1;
2533 if ((qreply->range) &&
2534 (xcb_randr_query_output_property_valid_values_length(qreply) == 2))
2535 {
2536 int32_t *vals;
2537
2538 vals = xcb_randr_query_output_property_valid_values(qreply);
2539 /* finally convert the current value in the interval [0..1] */
2540 min = vals[0];
2541 max = vals[1];
2542 dvalue = ((double)(value - min)) / ((double)(max - min));
2543 }
2544 free(qreply);
2545 return dvalue;
2546 }
2547#endif
2548 return -1;
2549}
2550
2551/*
2552 * @brief set the backlight level of a given output
2553 * @param root window which's screen should be queried
2554 * @param output that should be set
2555 * @param level for which the backlight should be set
2556 * @return EINA_TRUE in case of success
2557 */
2558EAPI Eina_Bool
2559ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
2560 Ecore_X_Randr_Output output,
2561 double level)
2562{
2563#ifdef ECORE_XCB_RANDR
2564 Ecore_X_Atom _backlight;
2565 xcb_intern_atom_cookie_t acookie;
2566 xcb_intern_atom_reply_t *areply;
2567 xcb_randr_query_output_property_cookie_t qcookie;
2568 xcb_randr_query_output_property_reply_t *qreply;
2569#endif
2570
2571 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2572 CHECK_XCB_CONN;
2573
2574#ifdef ECORE_XCB_RANDR
2575 RANDR_CHECK_1_2_RET(EINA_FALSE);
2576
2577 if ((level < 0) || (level > 1))
2578 {
2579 ERR("Backlight level should be between 0 and 1");
2580 return EINA_FALSE;
2581 }
2582
2583 if (!_ecore_xcb_randr_output_validate(root, output))
2584 {
2585 ERR("Wrong output value");
2586 return EINA_FALSE;
2587 }
2588
2589 acookie =
2590 xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
2591 strlen("Backlight"), "Backlight");
2592 areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
2593 if (!areply)
2594 {
2595 WRN("Backlight property is not suppported on this server or driver");
2596 return EINA_FALSE;
2597 }
2598 else
2599 {
2600 _backlight = areply->atom;
2601 free(areply);
2602 }
2603
2604 qcookie =
2605 xcb_randr_query_output_property_unchecked(_ecore_xcb_conn,
2606 output, _backlight);
2607 qreply =
2608 xcb_randr_query_output_property_reply(_ecore_xcb_conn, qcookie, NULL);
2609 if (qreply)
2610 {
2611 if ((qreply->range) && (qreply->length == 2))
2612 {
2613 int32_t *vals;
2614 double min, max, tmp;
2615 long n;
2616
2617 vals = xcb_randr_query_output_property_valid_values(qreply);
2618 min = vals[0];
2619 max = vals[1];
2620 tmp = (level * (max - min)) + min;
2621 n = tmp;
2622 if (n > max) n = max;
2623 if (n < min) n = min;
2624 xcb_randr_change_output_property(_ecore_xcb_conn, output,
2625 _backlight, XCB_ATOM_INTEGER,
2626 32, XCB_PROP_MODE_REPLACE,
2627 1, (unsigned char *)&n);
2628 ecore_x_flush(); // needed
2629 }
2630
2631 free(qreply);
2632 return EINA_TRUE;
2633 }
2634#endif
2635 return EINA_FALSE;
2636}
2637
2638/*
2639 * @brief check if a backlight is available
2640 * @return whether a blacklight is available
2641 */
2642EAPI Eina_Bool
2643ecore_x_randr_output_backlight_available(void)
2644{
2645#ifdef ECORE_XCB_RANDR
2646 Ecore_X_Atom _backlight;
2647 xcb_intern_atom_cookie_t acookie;
2648 xcb_intern_atom_reply_t *areply;
2649#endif
2650
2651 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2652 CHECK_XCB_CONN;
2653
2654#ifdef ECORE_XCB_RANDR
2655 RANDR_CHECK_1_2_RET(EINA_FALSE);
2656
2657 acookie =
2658 xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
2659 strlen("Backlight"), "Backlight");
2660 areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
2661
2662 if (!areply)
2663 {
2664 ERR("Backlight property is not suppported on this server or driver");
2665 return EINA_FALSE;
2666 }
2667 else
2668 {
2669 _backlight = areply->atom;
2670 free(areply);
2671 return EINA_TRUE;
2672 }
2673#endif
2674 return EINA_FALSE;
2675}
2676
2677EAPI int
2678ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length)
2679{
2680 if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) &&
2681 (ecore_x_randr_edid_has_valid_header(edid, edid_length)))
2682 return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) |
2683 edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR];
2684 return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
2685}
2686
2687EAPI char *
2688ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_length)
2689{
2690 unsigned char *block = NULL;
2691 int version = 0;
2692
2693 version = ecore_x_randr_edid_version_get(edid, edid_length);
2694 if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
2695
2696 _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
2697 {
2698 if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc)
2699 {
2700 char *name, *p;
2701 const char *edid_name;
2702
2703 edid_name = (const char *)block +
2704 _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
2705 name =
2706 malloc(sizeof(char) *
2707 _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
2708 if (!name) return NULL;
2709
2710 strncpy(name, edid_name,
2711 (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
2712 name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
2713 for (p = name; *p; p++)
2714 if ((*p < ' ') || (*p > '~')) *p = 0;
2715
2716 return name;
2717 }
2718 }
2719 return NULL;
2720}
2721
2722EAPI Eina_Bool
2723ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_length)
2724{
2725 const unsigned char header[] =
2726 {
2727 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
2728 };
2729
2730 if ((!edid) || (edid_length < 8)) return EINA_FALSE;
2731 if (!memcmp(edid, header, 8)) return EINA_TRUE;
2732 return EINA_FALSE;
2733}
2734
2735/* local functions */
2736static Eina_Bool
2737_ecore_xcb_randr_output_validate(Ecore_X_Window root,
2738 Ecore_X_Randr_Output output)
2739{
2740 Eina_Bool ret = EINA_FALSE;
2741
2742 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2743 CHECK_XCB_CONN;
2744
2745#ifdef ECORE_XCB_RANDR
2746 RANDR_CHECK_1_2_RET(EINA_FALSE);
2747
2748 if ((output) && (_ecore_xcb_randr_root_validate(root)))
2749 {
2750 if (_randr_version >= RANDR_1_3)
2751 {
2752 xcb_randr_get_screen_resources_current_reply_t *reply;
2753
2754 reply = _ecore_xcb_randr_13_get_resources(root);
2755 if (reply)
2756 {
2757 int len = 0, i = 0;
2758 xcb_randr_output_t *outputs;
2759
2760 len =
2761 xcb_randr_get_screen_resources_current_outputs_length(reply);
2762 outputs =
2763 xcb_randr_get_screen_resources_current_outputs(reply);
2764 for (i = 0; i < len; i++)
2765 {
2766 if (outputs[i] == output)
2767 {
2768 ret = EINA_TRUE;
2769 break;
2770 }
2771 }
2772 free(reply);
2773 }
2774 }
2775 else if (_randr_version == RANDR_1_2)
2776 {
2777 xcb_randr_get_screen_resources_reply_t *reply;
2778
2779 reply = _ecore_xcb_randr_12_get_resources(root);
2780 if (reply)
2781 {
2782 int len = 0, i = 0;
2783 xcb_randr_output_t *outputs;
2784
2785 len = xcb_randr_get_screen_resources_outputs_length(reply);
2786 outputs = xcb_randr_get_screen_resources_outputs(reply);
2787 for (i = 0; i < len; i++)
2788 {
2789 if (outputs[i] == output)
2790 {
2791 ret = EINA_TRUE;
2792 break;
2793 }
2794 }
2795 free(reply);
2796 }
2797 }
2798 }
2799#endif
2800 return ret;
2801}
2802
2803/**
2804 * @brief validates a CRTC for a given root window's screen.
2805 * @param root the window which's default display will be queried
2806 * @param crtc the CRTC to be validated.
2807 * @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned.
2808 */
2809static Eina_Bool
2810_ecore_xcb_randr_crtc_validate(Ecore_X_Window root,
2811 Ecore_X_Randr_Crtc crtc)
2812{
2813 Eina_Bool ret = EINA_FALSE;
2814
2815 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2816 CHECK_XCB_CONN;
2817
2818#ifdef ECORE_XCB_RANDR
2819 RANDR_CHECK_1_2_RET(EINA_FALSE);
2820
2821 if (((int)crtc == Ecore_X_Randr_None) || ((int)crtc == Ecore_X_Randr_Unset))
2822 return ret;
2823
2824 if ((crtc) && (_ecore_xcb_randr_root_validate(root)))
2825 {
2826 if (_randr_version >= RANDR_1_3)
2827 {
2828 xcb_randr_get_screen_resources_current_reply_t *reply;
2829
2830 reply = _ecore_xcb_randr_13_get_resources(root);
2831 if (reply)
2832 {
2833 int i = 0;
2834 xcb_randr_crtc_t *crtcs;
2835
2836 crtcs = xcb_randr_get_screen_resources_current_crtcs(reply);
2837 for (i = 0; i < reply->num_crtcs; i++)
2838 {
2839 if (crtcs[i] == crtc)
2840 {
2841 ret = EINA_TRUE;
2842 break;
2843 }
2844 }
2845 free(reply);
2846 }
2847 }
2848 else if (_randr_version == RANDR_1_2)
2849 {
2850 xcb_randr_get_screen_resources_reply_t *reply;
2851
2852 reply = _ecore_xcb_randr_12_get_resources(root);
2853 if (reply)
2854 {
2855 int i = 0;
2856 xcb_randr_crtc_t *crtcs;
2857
2858 crtcs = xcb_randr_get_screen_resources_crtcs(reply);
2859 for (i = 0; i < reply->num_crtcs; i++)
2860 {
2861 if (crtcs[i] == crtc)
2862 {
2863 ret = EINA_TRUE;
2864 break;
2865 }
2866 }
2867 free(reply);
2868 }
2869 }
2870 }
2871#endif
2872
2873 return ret;
2874}
2875
2876static Ecore_X_Randr_Mode *
2877_ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root,
2878 Ecore_X_Randr_Output output,
2879 int *num,
2880 int *npreferred)
2881{
2882 Ecore_X_Randr_Mode *modes = NULL;
2883 xcb_randr_get_screen_resources_reply_t *reply;
2884
2885 reply = _ecore_xcb_randr_12_get_resources(root);
2886 if (reply)
2887 {
2888 xcb_randr_get_output_info_cookie_t ocookie;
2889 xcb_randr_get_output_info_reply_t *oreply;
2890
2891 ocookie =
2892 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
2893 reply->config_timestamp);
2894 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
2895 ocookie, NULL);
2896 if (oreply)
2897 {
2898 if (num) *num = oreply->num_modes;
2899 if (npreferred) *npreferred = oreply->num_preferred;
2900
2901 modes = malloc(sizeof(Ecore_X_Randr_Mode) *
2902 oreply->num_modes);
2903 if (modes)
2904 {
2905 xcb_randr_mode_t *rmodes;
2906 int len = 0;
2907
2908 len = xcb_randr_get_output_info_modes_length(oreply);
2909 rmodes = xcb_randr_get_output_info_modes(oreply);
2910 memcpy(modes, rmodes, sizeof(Ecore_X_Randr_Mode) * len);
2911 }
2912 free(oreply);
2913 }
2914 free(reply);
2915 }
2916
2917 return modes;
2918}
2919
2920static Ecore_X_Randr_Mode *
2921_ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root,
2922 Ecore_X_Randr_Output output,
2923 int *num,
2924 int *npreferred)
2925{
2926 Ecore_X_Randr_Mode *modes = NULL;
2927 xcb_timestamp_t stamp = 0;
2928 xcb_randr_get_output_info_cookie_t ocookie;
2929 xcb_randr_get_output_info_reply_t *oreply;
2930
2931 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
2932
2933 ocookie =
2934 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, stamp);
2935 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL);
2936 if (oreply)
2937 {
2938 if (num) *num = oreply->num_modes;
2939 if (npreferred) *npreferred = oreply->num_preferred;
2940
2941 modes = malloc(sizeof(Ecore_X_Randr_Mode) * oreply->num_modes);
2942 if (modes)
2943 {
2944 xcb_randr_mode_t *rmodes;
2945 int len = 0;
2946
2947 len = xcb_randr_get_output_info_modes_length(oreply);
2948 rmodes = xcb_randr_get_output_info_modes(oreply);
2949 memcpy(modes, rmodes, sizeof(Ecore_X_Randr_Mode) * len);
2950 }
2951 free(oreply);
2952 }
2953
2954 return modes;
2955}
2956
2957static Ecore_X_Randr_Mode_Info *
2958_ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root,
2959 Ecore_X_Randr_Mode mode)
2960{
2961 Ecore_X_Randr_Mode_Info *ret = NULL;
2962 xcb_randr_get_screen_resources_reply_t *reply;
2963
2964 reply = _ecore_xcb_randr_12_get_resources(root);
2965 if (reply)
2966 {
2967 if ((ret = malloc(sizeof(Ecore_X_Randr_Mode_Info))))
2968 {
2969 uint8_t *nbuf;
2970 xcb_randr_mode_info_iterator_t miter;
2971
2972 nbuf = xcb_randr_get_screen_resources_names(reply);
2973 miter = xcb_randr_get_screen_resources_modes_iterator(reply);
2974 while (miter.rem)
2975 {
2976 xcb_randr_mode_info_t *minfo;
2977
2978 minfo = miter.data;
2979 nbuf += minfo->name_len;
2980
2981 if (minfo->id == mode)
2982 {
2983 ret->xid = minfo->id;
2984 ret->width = minfo->width;
2985 ret->height = minfo->height;
2986 ret->dotClock = minfo->dot_clock;
2987 ret->hSyncStart = minfo->hsync_start;
2988 ret->hSyncEnd = minfo->hsync_end;
2989 ret->hTotal = minfo->htotal;
2990 ret->vSyncStart = minfo->vsync_start;
2991 ret->vSyncEnd = minfo->vsync_end;
2992 ret->vTotal = minfo->vtotal;
2993 ret->modeFlags = minfo->mode_flags;
2994
2995 ret->name = NULL;
2996 ret->nameLength = minfo->name_len;
2997 if (ret->nameLength > 0)
2998 {
2999 ret->name = malloc(ret->nameLength + 1);
3000 if (ret->name)
3001 memcpy(ret->name, nbuf, ret->nameLength + 1);
3002 }
3003
3004 break;
3005 }
3006 xcb_randr_mode_info_next(&miter);
3007 }
3008 }
3009
3010 free(reply);
3011 }
3012 return ret;
3013}
3014
3015static Ecore_X_Randr_Mode_Info *
3016_ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root,
3017 Ecore_X_Randr_Mode mode)
3018{
3019 Ecore_X_Randr_Mode_Info *ret = NULL;
3020 xcb_randr_get_screen_resources_current_reply_t *reply;
3021
3022 reply = _ecore_xcb_randr_13_get_resources(root);
3023 if (reply)
3024 {
3025 if ((ret = malloc(sizeof(Ecore_X_Randr_Mode_Info))))
3026 {
3027 uint8_t *nbuf;
3028 xcb_randr_mode_info_iterator_t miter;
3029
3030 nbuf = xcb_randr_get_screen_resources_current_names(reply);
3031 miter =
3032 xcb_randr_get_screen_resources_current_modes_iterator(reply);
3033 while (miter.rem)
3034 {
3035 xcb_randr_mode_info_t *minfo;
3036
3037 minfo = miter.data;
3038 nbuf += minfo->name_len;
3039
3040 if (minfo->id == mode)
3041 {
3042 ret->xid = minfo->id;
3043 ret->width = minfo->width;
3044 ret->height = minfo->height;
3045 ret->dotClock = minfo->dot_clock;
3046 ret->hSyncStart = minfo->hsync_start;
3047 ret->hSyncEnd = minfo->hsync_end;
3048 ret->hTotal = minfo->htotal;
3049 ret->vSyncStart = minfo->vsync_start;
3050 ret->vSyncEnd = minfo->vsync_end;
3051 ret->vTotal = minfo->vtotal;
3052 ret->modeFlags = minfo->mode_flags;
3053
3054 ret->name = NULL;
3055 ret->nameLength = minfo->name_len;
3056 if (ret->nameLength > 0)
3057 {
3058 ret->name = malloc(ret->nameLength + 1);
3059 if (ret->name)
3060 memcpy(ret->name, nbuf, ret->nameLength + 1);
3061 }
3062
3063 break;
3064 }
3065 xcb_randr_mode_info_next(&miter);
3066 }
3067 }
3068
3069 free(reply);
3070 }
3071 return ret;
3072}
3073
3074static Ecore_X_Randr_Mode_Info **
3075_ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root,
3076 int *num)
3077{
3078 Ecore_X_Randr_Mode_Info **ret = NULL;
3079 xcb_randr_get_screen_resources_reply_t *reply;
3080
3081 reply = _ecore_xcb_randr_12_get_resources(root);
3082 if (reply)
3083 {
3084 if (num) *num = reply->num_modes;
3085 ret = malloc(sizeof(Ecore_X_Randr_Mode_Info *) * reply->num_modes);
3086 if (ret)
3087 {
3088 xcb_randr_mode_info_iterator_t miter;
3089 int i = 0;
3090 uint8_t *nbuf;
3091
3092 nbuf = xcb_randr_get_screen_resources_names(reply);
3093 miter = xcb_randr_get_screen_resources_modes_iterator(reply);
3094 while (miter.rem)
3095 {
3096 xcb_randr_mode_info_t *minfo;
3097
3098 minfo = miter.data;
3099 nbuf += minfo->name_len;
3100 if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info))))
3101 {
3102 ret[i]->xid = minfo->id;
3103 ret[i]->width = minfo->width;
3104 ret[i]->height = minfo->height;
3105 ret[i]->dotClock = minfo->dot_clock;
3106 ret[i]->hSyncStart = minfo->hsync_start;
3107 ret[i]->hSyncEnd = minfo->hsync_end;
3108 ret[i]->hTotal = minfo->htotal;
3109 ret[i]->vSyncStart = minfo->vsync_start;
3110 ret[i]->vSyncEnd = minfo->vsync_end;
3111 ret[i]->vTotal = minfo->vtotal;
3112 ret[i]->modeFlags = minfo->mode_flags;
3113
3114 ret[i]->name = NULL;
3115 ret[i]->nameLength = minfo->name_len;
3116 if (ret[i]->nameLength > 0)
3117 {
3118 ret[i]->name = malloc(ret[i]->nameLength + 1);
3119 if (ret[i]->name)
3120 memcpy(ret[i]->name, nbuf,
3121 ret[i]->nameLength + 1);
3122 }
3123 }
3124 else
3125 {
3126 while (i > 0)
3127 free(ret[--i]);
3128 free(ret);
3129 ret = NULL;
3130 break;
3131 }
3132 i++;
3133 xcb_randr_mode_info_next(&miter);
3134 }
3135 }
3136 free(reply);
3137 }
3138 return ret;
3139}
3140
3141static Ecore_X_Randr_Mode_Info **
3142_ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root,
3143 int *num)
3144{
3145 Ecore_X_Randr_Mode_Info **ret = NULL;
3146 xcb_randr_get_screen_resources_current_reply_t *reply;
3147
3148 reply = _ecore_xcb_randr_13_get_resources(root);
3149 if (reply)
3150 {
3151 if (num) *num = reply->num_modes;
3152 ret = malloc(sizeof(Ecore_X_Randr_Mode_Info *) * reply->num_modes);
3153 if (ret)
3154 {
3155 xcb_randr_mode_info_iterator_t miter;
3156 int i = 0;
3157 uint8_t *nbuf;
3158
3159 nbuf = xcb_randr_get_screen_resources_current_names(reply);
3160 miter =
3161 xcb_randr_get_screen_resources_current_modes_iterator(reply);
3162 while (miter.rem)
3163 {
3164 xcb_randr_mode_info_t *minfo;
3165
3166 minfo = miter.data;
3167 nbuf += minfo->name_len;
3168 if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info))))
3169 {
3170 ret[i]->xid = minfo->id;
3171 ret[i]->width = minfo->width;
3172 ret[i]->height = minfo->height;
3173 ret[i]->dotClock = minfo->dot_clock;
3174 ret[i]->hSyncStart = minfo->hsync_start;
3175 ret[i]->hSyncEnd = minfo->hsync_end;
3176 ret[i]->hTotal = minfo->htotal;
3177 ret[i]->vSyncStart = minfo->vsync_start;
3178 ret[i]->vSyncEnd = minfo->vsync_end;
3179 ret[i]->vTotal = minfo->vtotal;
3180 ret[i]->modeFlags = minfo->mode_flags;
3181
3182 ret[i]->name = NULL;
3183 ret[i]->nameLength = minfo->name_len;
3184 if (ret[i]->nameLength > 0)
3185 {
3186 ret[i]->name = malloc(ret[i]->nameLength + 1);
3187 if (ret[i]->name)
3188 memcpy(ret[i]->name, nbuf,
3189 ret[i]->nameLength + 1);
3190 }
3191 }
3192 else
3193 {
3194 while (i > 0)
3195 free(ret[--i]);
3196 free(ret);
3197 ret = NULL;
3198 break;
3199 }
3200 i++;
3201 xcb_randr_mode_info_next(&miter);
3202 }
3203 }
3204 free(reply);
3205 }
3206 return ret;
3207}
3208
3209static void
3210_ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root,
3211 Ecore_X_Randr_Mode mode,
3212 int *w,
3213 int *h)
3214{
3215 xcb_randr_get_screen_resources_reply_t *reply;
3216
3217 reply = _ecore_xcb_randr_12_get_resources(root);
3218 if (reply)
3219 {
3220 xcb_randr_mode_info_iterator_t miter;
3221
3222 miter = xcb_randr_get_screen_resources_modes_iterator(reply);
3223 while (miter.rem)
3224 {
3225 xcb_randr_mode_info_t *minfo;
3226
3227 minfo = miter.data;
3228 if (minfo->id == mode)
3229 {
3230 if (w) *w = minfo->width;
3231 if (h) *h = minfo->height;
3232 break;
3233 }
3234 xcb_randr_mode_info_next(&miter);
3235 }
3236 free(reply);
3237 }
3238}
3239
3240static void
3241_ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root,
3242 Ecore_X_Randr_Mode mode,
3243 int *w,
3244 int *h)
3245{
3246 xcb_randr_get_screen_resources_current_reply_t *reply;
3247
3248 reply = _ecore_xcb_randr_13_get_resources(root);
3249 if (reply)
3250 {
3251 xcb_randr_mode_info_iterator_t miter;
3252
3253 miter = xcb_randr_get_screen_resources_current_modes_iterator(reply);
3254 while (miter.rem)
3255 {
3256 xcb_randr_mode_info_t *minfo;
3257
3258 minfo = miter.data;
3259 if (minfo->id == mode)
3260 {
3261 if (w) *w = minfo->width;
3262 if (h) *h = minfo->height;
3263 break;
3264 }
3265 xcb_randr_mode_info_next(&miter);
3266 }
3267 free(reply);
3268 }
3269}
3270
3271static Ecore_X_Randr_Output *
3272_ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root,
3273 Ecore_X_Randr_Output output,
3274 int *num)
3275{
3276 Ecore_X_Randr_Output *outputs = NULL;
3277 xcb_randr_get_screen_resources_reply_t *reply;
3278
3279 reply = _ecore_xcb_randr_12_get_resources(root);
3280 if (reply)
3281 {
3282 xcb_randr_get_output_info_cookie_t ocookie;
3283 xcb_randr_get_output_info_reply_t *oreply;
3284
3285 ocookie =
3286 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3287 reply->config_timestamp);
3288 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3289 ocookie, NULL);
3290 if (oreply)
3291 {
3292 if (num) *num = oreply->num_clones;
3293
3294 outputs =
3295 malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_clones);
3296 if (outputs)
3297 {
3298 memcpy(outputs, xcb_randr_get_output_info_clones(oreply),
3299 sizeof(Ecore_X_Randr_Output) * oreply->num_clones);
3300 }
3301 free(oreply);
3302 }
3303 free(reply);
3304 }
3305 return outputs;
3306}
3307
3308static Ecore_X_Randr_Output *
3309_ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root,
3310 Ecore_X_Randr_Output output,
3311 int *num)
3312{
3313 Ecore_X_Randr_Output *outputs = NULL;
3314 xcb_randr_get_screen_resources_current_reply_t *reply;
3315
3316 reply = _ecore_xcb_randr_13_get_resources(root);
3317 if (reply)
3318 {
3319 xcb_randr_get_output_info_cookie_t ocookie;
3320 xcb_randr_get_output_info_reply_t *oreply;
3321
3322 ocookie =
3323 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3324 reply->config_timestamp);
3325 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3326 ocookie, NULL);
3327 if (oreply)
3328 {
3329 if (num) *num = oreply->num_clones;
3330
3331 outputs =
3332 malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_clones);
3333 if (outputs)
3334 {
3335 memcpy(outputs, xcb_randr_get_output_info_clones(oreply),
3336 sizeof(Ecore_X_Randr_Output) * oreply->num_clones);
3337 }
3338 free(oreply);
3339 }
3340 free(reply);
3341 }
3342 return outputs;
3343}
3344
3345static Ecore_X_Randr_Crtc *
3346_ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root,
3347 Ecore_X_Randr_Output output,
3348 int *num)
3349{
3350 Ecore_X_Randr_Crtc *crtcs = NULL;
3351 xcb_randr_get_screen_resources_reply_t *reply;
3352
3353 reply = _ecore_xcb_randr_12_get_resources(root);
3354 if (reply)
3355 {
3356 xcb_randr_get_output_info_cookie_t ocookie;
3357 xcb_randr_get_output_info_reply_t *oreply;
3358
3359 ocookie =
3360 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3361 reply->config_timestamp);
3362 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3363 ocookie, NULL);
3364 if (oreply)
3365 {
3366 if (num) *num = oreply->num_crtcs;
3367
3368 crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs);
3369 if (crtcs)
3370 {
3371 memcpy(crtcs, xcb_randr_get_output_info_crtcs(oreply),
3372 sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs);
3373 }
3374 free(oreply);
3375 }
3376 free(reply);
3377 }
3378 return crtcs;
3379}
3380
3381static Ecore_X_Randr_Crtc *
3382_ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root,
3383 Ecore_X_Randr_Output output,
3384 int *num)
3385{
3386 Ecore_X_Randr_Crtc *crtcs = NULL;
3387 xcb_randr_get_screen_resources_current_reply_t *reply;
3388
3389 reply = _ecore_xcb_randr_13_get_resources(root);
3390 if (reply)
3391 {
3392 xcb_randr_get_output_info_cookie_t ocookie;
3393 xcb_randr_get_output_info_reply_t *oreply;
3394
3395 ocookie =
3396 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3397 reply->config_timestamp);
3398 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3399 ocookie, NULL);
3400 if (oreply)
3401 {
3402 if (num) *num = oreply->num_crtcs;
3403
3404 crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs);
3405 if (crtcs)
3406 {
3407 memcpy(crtcs, xcb_randr_get_output_info_crtcs(oreply),
3408 sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs);
3409 }
3410 free(oreply);
3411 }
3412 free(reply);
3413 }
3414 return crtcs;
3415}
3416
3417static char *
3418_ecore_xcb_randr_12_output_name_get(Ecore_X_Window root,
3419 Ecore_X_Randr_Output output,
3420 int *len)
3421{
3422 char *ret = NULL;
3423 xcb_randr_get_screen_resources_reply_t *reply;
3424
3425 reply = _ecore_xcb_randr_12_get_resources(root);
3426 if (reply)
3427 {
3428 xcb_randr_get_output_info_cookie_t ocookie;
3429 xcb_randr_get_output_info_reply_t *oreply;
3430
3431 ocookie =
3432 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3433 reply->config_timestamp);
3434 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3435 ocookie, NULL);
3436 if (oreply)
3437 {
3438 uint8_t *nbuf;
3439
3440 nbuf = xcb_randr_get_output_info_name(oreply);
3441 nbuf += oreply->name_len;
3442
3443 if (len) *len = oreply->name_len;
3444 if (oreply->name_len > 0)
3445 {
3446 ret = malloc(oreply->name_len + 1);
3447 if (ret)
3448 memcpy(ret, nbuf, oreply->name_len + 1);
3449 }
3450
3451 free(oreply);
3452 }
3453 free(reply);
3454 }
3455 return ret;
3456}
3457
3458static char *
3459_ecore_xcb_randr_13_output_name_get(Ecore_X_Window root,
3460 Ecore_X_Randr_Output output,
3461 int *len)
3462{
3463 char *ret = NULL;
3464 xcb_randr_get_screen_resources_current_reply_t *reply;
3465
3466 reply = _ecore_xcb_randr_13_get_resources(root);
3467 if (reply)
3468 {
3469 xcb_randr_get_output_info_cookie_t ocookie;
3470 xcb_randr_get_output_info_reply_t *oreply;
3471
3472 ocookie =
3473 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3474 reply->config_timestamp);
3475 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3476 ocookie, NULL);
3477 if (oreply)
3478 {
3479 uint8_t *nbuf;
3480
3481 nbuf = xcb_randr_get_output_info_name(oreply);
3482 nbuf += oreply->name_len;
3483
3484 if (len) *len = oreply->name_len;
3485 if (oreply->name_len > 0)
3486 {
3487 ret = malloc(oreply->name_len + 1);
3488 if (ret)
3489 memcpy(ret, nbuf, oreply->name_len + 1);
3490 }
3491
3492 free(oreply);
3493 }
3494 free(reply);
3495 }
3496 return ret;
3497}
3498
3499static Ecore_X_Randr_Connection_Status
3500_ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root,
3501 Ecore_X_Randr_Output output)
3502{
3503 Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
3504 xcb_randr_get_screen_resources_reply_t *reply;
3505
3506 reply = _ecore_xcb_randr_12_get_resources(root);
3507 if (reply)
3508 {
3509 xcb_randr_get_output_info_cookie_t ocookie;
3510 xcb_randr_get_output_info_reply_t *oreply;
3511
3512 ocookie =
3513 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3514 reply->config_timestamp);
3515 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3516 ocookie, NULL);
3517 if (oreply)
3518 {
3519 ret = oreply->connection;
3520 free(oreply);
3521 }
3522 free(reply);
3523 }
3524 return ret;
3525}
3526
3527static Ecore_X_Randr_Connection_Status
3528_ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root,
3529 Ecore_X_Randr_Output output)
3530{
3531 Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
3532 xcb_randr_get_screen_resources_current_reply_t *reply;
3533
3534 reply = _ecore_xcb_randr_13_get_resources(root);
3535 if (reply)
3536 {
3537 xcb_randr_get_output_info_cookie_t ocookie;
3538 xcb_randr_get_output_info_reply_t *oreply;
3539
3540 ocookie =
3541 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3542 reply->config_timestamp);
3543 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3544 ocookie, NULL);
3545 if (oreply)
3546 {
3547 ret = oreply->connection;
3548 free(oreply);
3549 }
3550 free(reply);
3551 }
3552 return ret;
3553}
3554
3555static Ecore_X_Randr_Output *
3556_ecore_xcb_randr_12_outputs_get(Ecore_X_Window root,
3557 int *num)
3558{
3559 Ecore_X_Randr_Output *ret = NULL;
3560 xcb_randr_get_screen_resources_reply_t *reply;
3561
3562 reply = _ecore_xcb_randr_12_get_resources(root);
3563 if (reply)
3564 {
3565 if (num) *num = reply->num_outputs;
3566 ret = malloc(sizeof(Ecore_X_Randr_Output) * reply->num_outputs);
3567 if (ret)
3568 memcpy(ret, xcb_randr_get_screen_resources_outputs(reply),
3569 sizeof(Ecore_X_Randr_Output) * reply->num_outputs);
3570 free(reply);
3571 }
3572 return ret;
3573}
3574
3575static Ecore_X_Randr_Output *
3576_ecore_xcb_randr_13_outputs_get(Ecore_X_Window root,
3577 int *num)
3578{
3579 Ecore_X_Randr_Output *ret = NULL;
3580 xcb_randr_get_screen_resources_current_reply_t *reply;
3581
3582 reply = _ecore_xcb_randr_13_get_resources(root);
3583 if (reply)
3584 {
3585 if (num) *num = reply->num_outputs;
3586 ret = malloc(sizeof(Ecore_X_Randr_Output) * reply->num_outputs);
3587 if (ret)
3588 memcpy(ret, xcb_randr_get_screen_resources_current_outputs(reply),
3589 sizeof(Ecore_X_Randr_Output) * reply->num_outputs);
3590 free(reply);
3591 }
3592 return ret;
3593}
3594
3595static Ecore_X_Randr_Crtc
3596_ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root,
3597 Ecore_X_Randr_Output output)
3598{
3599 Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None;
3600 xcb_randr_get_screen_resources_reply_t *reply;
3601
3602 reply = _ecore_xcb_randr_12_get_resources(root);
3603 if (reply)
3604 {
3605 xcb_randr_get_output_info_cookie_t ocookie;
3606 xcb_randr_get_output_info_reply_t *oreply;
3607
3608 ocookie =
3609 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3610 reply->config_timestamp);
3611 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3612 ocookie, NULL);
3613 if (oreply)
3614 {
3615 ret = oreply->crtc;
3616 free(oreply);
3617 }
3618 free(reply);
3619 }
3620 return ret;
3621}
3622
3623static Ecore_X_Randr_Crtc
3624_ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root,
3625 Ecore_X_Randr_Output output)
3626{
3627 Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None;
3628 xcb_randr_get_screen_resources_current_reply_t *reply;
3629
3630 reply = _ecore_xcb_randr_13_get_resources(root);
3631 if (reply)
3632 {
3633 xcb_randr_get_output_info_cookie_t ocookie;
3634 xcb_randr_get_output_info_reply_t *oreply;
3635
3636 ocookie =
3637 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output,
3638 reply->config_timestamp);
3639 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn,
3640 ocookie, NULL);
3641 if (oreply)
3642 {
3643 ret = oreply->crtc;
3644 free(oreply);
3645 }
3646 free(reply);
3647 }
3648 return ret;
3649}
3650
3651static xcb_randr_get_screen_resources_reply_t *
3652_ecore_xcb_randr_12_get_resources(Ecore_X_Window win)
3653{
3654 xcb_randr_get_screen_resources_cookie_t cookie;
3655 xcb_randr_get_screen_resources_reply_t *reply;
3656
3657 cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, win);
3658 reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL);
3659 return reply;
3660}
3661
3662static xcb_randr_get_screen_resources_current_reply_t *
3663_ecore_xcb_randr_13_get_resources(Ecore_X_Window win)
3664{
3665 xcb_randr_get_screen_resources_current_cookie_t cookie;
3666 xcb_randr_get_screen_resources_current_reply_t *reply;
3667
3668 cookie =
3669 xcb_randr_get_screen_resources_current_unchecked(_ecore_xcb_conn, win);
3670 reply =
3671 xcb_randr_get_screen_resources_current_reply(_ecore_xcb_conn,
3672 cookie, NULL);
3673 return reply;
3674}
3675
3676static xcb_timestamp_t
3677_ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win)
3678{
3679 xcb_timestamp_t stamp = 0;
3680 xcb_randr_get_screen_resources_reply_t *reply;
3681
3682 reply = _ecore_xcb_randr_12_get_resources(win);
3683 stamp = reply->config_timestamp;
3684 free(reply);
3685 return stamp;
3686}
3687
3688static xcb_timestamp_t
3689_ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win)
3690{
3691 xcb_timestamp_t stamp = 0;
3692 xcb_randr_get_screen_resources_current_reply_t *reply;
3693
3694 reply = _ecore_xcb_randr_13_get_resources(win);
3695 stamp = reply->config_timestamp;
3696 free(reply);
3697 return stamp;
3698}
3699
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
deleted file mode 100644
index a221d8f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c
+++ /dev/null
@@ -1,159 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <pixman.h>
3
4/*
5 * [ ] XPolygonRegion
6 * [ ] XShrinkRegion
7 * [ ] XClipBox
8 * [ ] XXorRegion
9 */
10
11EAPI Ecore_X_XRegion *
12ecore_x_xregion_new()
13{
14 pixman_region16_t *region;
15
16 region = (pixman_region16_t *)malloc(sizeof(pixman_region16_t));
17 if (!region) return NULL;
18
19 pixman_region_init(region);
20
21 return (Ecore_X_XRegion *)region;
22}
23
24EAPI void
25ecore_x_xregion_free(Ecore_X_XRegion *region)
26{
27 if (!region) return;
28
29 pixman_region_fini(region);
30 free(region);
31}
32
33EAPI Eina_Bool
34ecore_x_xregion_set(Ecore_X_XRegion *region,
35 Ecore_X_GC gc)
36{
37 xcb_rectangle_t *rects;
38 pixman_box16_t *boxes;
39 int num = 0, i = 0;
40
41 CHECK_XCB_CONN;
42
43 if (!region) return EINA_FALSE;
44
45 boxes = pixman_region_rectangles((pixman_region16_t *)region, &num);
46 if ((!boxes) || (num == 0)) return EINA_FALSE;
47
48 rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num);
49 if (!rects) return EINA_FALSE;
50
51 for (i = 0; i < num; i++)
52 {
53 rects[i].x = boxes[i].x1;
54 rects[i].y = boxes[i].y1;
55 rects[i].width = boxes[i].x2 - boxes[i].x1 + 1;
56 rects[i].height = boxes[i].y2 - boxes[i].y1 + 1;
57 }
58
59 xcb_set_clip_rectangles(_ecore_xcb_conn, XCB_CLIP_ORDERING_YX_BANDED,
60 gc, 0, 0, num, rects);
61
62// ecore_x_flush();
63 return EINA_TRUE;
64}
65
66EAPI void
67ecore_x_xregion_translate(Ecore_X_XRegion *region,
68 int x,
69 int y)
70{
71 if (!region) return;
72
73 pixman_region_translate((pixman_region16_t *)region, x, y);
74}
75
76EAPI Eina_Bool
77ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
78 Ecore_X_XRegion *r1,
79 Ecore_X_XRegion *r2)
80{
81 return pixman_region_intersect((pixman_region16_t *)dst,
82 (pixman_region16_t *)r1,
83 (pixman_region16_t *)r2);
84}
85
86EAPI Eina_Bool
87ecore_x_xregion_union(Ecore_X_XRegion *dst,
88 Ecore_X_XRegion *r1,
89 Ecore_X_XRegion *r2)
90{
91 return pixman_region_union((pixman_region16_t *)dst,
92 (pixman_region16_t *)r1,
93 (pixman_region16_t *)r2);
94}
95
96EAPI Eina_Bool
97ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
98 Ecore_X_XRegion *src,
99 Ecore_X_Rectangle *rect)
100{
101 return pixman_region_union_rect((pixman_region16_t *)dst,
102 (pixman_region16_t *)src,
103 rect->x, rect->y, rect->width, rect->height);
104}
105
106EAPI Eina_Bool
107ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
108 Ecore_X_XRegion *rm,
109 Ecore_X_XRegion *rs)
110{
111 return pixman_region_subtract((pixman_region16_t *)dst,
112 (pixman_region16_t *)rm,
113 (pixman_region16_t *)rs);
114}
115
116EAPI Eina_Bool
117ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
118{
119 if (!region) return EINA_TRUE;
120
121 return !pixman_region_not_empty((pixman_region16_t *)region);
122}
123
124EAPI Eina_Bool
125ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
126 Ecore_X_XRegion *r2)
127{
128 if ((!r1) || (!r2)) return EINA_FALSE;
129
130 return pixman_region_equal((pixman_region16_t *)r1,
131 (pixman_region16_t *)r2);
132}
133
134EAPI Eina_Bool
135ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
136 int x,
137 int y)
138{
139 if (!region) return EINA_FALSE;
140
141 return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL);
142}
143
144EAPI Eina_Bool
145ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
146 Ecore_X_Rectangle *rect)
147{
148 pixman_box16_t box;
149
150 if ((!region) || (!rect)) return EINA_FALSE;
151
152 box.x1 = rect->x;
153 box.y1 = rect->y;
154 box.x2 = rect->x + rect->width - 1;
155 box.y2 = rect->y + rect->height - 1;
156
157 return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
158}
159
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
deleted file mode 100644
index f36b4d2..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c
+++ /dev/null
@@ -1,225 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <ctype.h> // for isupper/tolower
3#ifdef ECORE_XCB_RENDER
4# include <xcb/render.h>
5# include <xcb/xcb_renderutil.h>
6#endif
7
8/* local function prototypes */
9static Eina_Bool _ecore_xcb_render_parse_boolean(char *v);
10
11/* local variables */
12static Eina_Bool _render_avail = EINA_FALSE;
13static Eina_Bool _render_argb = EINA_FALSE;
14static Eina_Bool _render_anim = EINA_FALSE;
15
16void
17_ecore_xcb_render_init(void)
18{
19 LOGFN(__FILE__, __LINE__, __FUNCTION__);
20
21#ifdef ECORE_XCB_RENDER
22 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_render_id);
23#endif
24}
25
26void
27_ecore_xcb_render_finalize(void)
28{
29#ifdef ECORE_XCB_RENDER
30 const xcb_query_extension_reply_t *ext_reply;
31#endif
32
33 LOGFN(__FILE__, __LINE__, __FUNCTION__);
34
35#ifdef ECORE_XCB_RENDER
36 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_render_id);
37 if ((ext_reply) && (ext_reply->present))
38 {
39 xcb_render_query_version_cookie_t cookie;
40 xcb_render_query_version_reply_t *reply;
41
42 cookie =
43 xcb_render_query_version_unchecked(_ecore_xcb_conn,
44 XCB_RENDER_MAJOR_VERSION,
45 XCB_RENDER_MINOR_VERSION);
46 reply = xcb_render_query_version_reply(_ecore_xcb_conn, cookie, NULL);
47 if (reply)
48 {
49// if ((reply->major_version >= XCB_RENDER_MAJOR_VERSION) &&
50 if (reply->minor_version >= XCB_RENDER_MINOR_VERSION)
51 {
52 char *v = NULL;
53
54 _render_avail = EINA_TRUE;
55 _ecore_xcb_xdefaults_init();
56 if ((reply->major_version > 0) || (reply->minor_version >= 5))
57 {
58 _render_argb = EINA_TRUE;
59 v = getenv("XCURSOR_CORE");
60 if (!v)
61 v = _ecore_xcb_xdefaults_string_get("Xcursor", "core");
62 if ((v) && (_ecore_xcb_render_parse_boolean(v)))
63 _render_argb = EINA_FALSE;
64 }
65 if ((_render_argb) &&
66 ((reply->major_version > 0) || (reply->minor_version >= 8)))
67 {
68 _render_anim = EINA_TRUE;
69 v = getenv("XCURSOR_ANIM");
70 if (!v)
71 v = _ecore_xcb_xdefaults_string_get("Xcursor", "anim");
72 if ((v) && (_ecore_xcb_render_parse_boolean(v)))
73 _render_anim = EINA_FALSE;
74 }
75 _ecore_xcb_xdefaults_shutdown();
76 }
77 }
78 free(reply);
79 }
80#endif
81}
82
83Eina_Bool
84_ecore_xcb_render_avail_get(void)
85{
86 return _render_avail;
87}
88
89Eina_Bool
90_ecore_xcb_render_argb_get(void)
91{
92 return _render_argb;
93}
94
95Eina_Bool
96_ecore_xcb_render_anim_get(void)
97{
98 return _render_anim;
99}
100
101Eina_Bool
102_ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual)
103{
104 Eina_Bool ret = EINA_FALSE;
105#ifdef ECORE_XCB_RENDER
106 const xcb_render_query_pict_formats_reply_t *reply;
107 xcb_render_pictvisual_t *vis;
108#endif
109
110 LOGFN(__FILE__, __LINE__, __FUNCTION__);
111 CHECK_XCB_CONN;
112
113 if (!visual) return EINA_FALSE;
114 if (!_render_avail) return EINA_FALSE;
115
116#ifdef ECORE_XCB_RENDER
117 reply = xcb_render_util_query_formats(_ecore_xcb_conn);
118 if (!reply) return EINA_FALSE;
119
120 vis =
121 xcb_render_util_find_visual_format(reply,
122 ((xcb_visualtype_t *)visual)->visual_id);
123 if (vis)
124 {
125 xcb_render_pictforminfo_t temp;
126 xcb_render_pictforminfo_t *format;
127
128 temp.id = vis->format;
129 format =
130 xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, &temp, 0);
131
132 if ((format->type == XCB_RENDER_PICT_TYPE_DIRECT) &&
133 (format->direct.alpha_mask))
134 ret = EINA_TRUE;
135 }
136
137#endif
138
139 return ret;
140}
141
142uint32_t
143_ecore_xcb_render_find_visual_id(int type,
144 Eina_Bool check_alpha)
145{
146#ifdef ECORE_XCB_RENDER
147 const xcb_render_query_pict_formats_reply_t *reply;
148 xcb_render_pictvisual_t *visual = NULL;
149 xcb_render_pictscreen_iterator_t screens;
150 xcb_render_pictdepth_iterator_t depths;
151 xcb_render_pictvisual_iterator_t visuals;
152#endif
153
154 LOGFN(__FILE__, __LINE__, __FUNCTION__);
155 CHECK_XCB_CONN;
156
157 if (!_render_avail) return 0;
158
159#ifdef ECORE_XCB_RENDER
160 reply = xcb_render_util_query_formats(_ecore_xcb_conn);
161 if (!reply) return 0;
162
163 for (screens = xcb_render_query_pict_formats_screens_iterator(reply);
164 screens.rem; xcb_render_pictscreen_next(&screens))
165 {
166 for (depths = xcb_render_pictscreen_depths_iterator(screens.data);
167 depths.rem; xcb_render_pictdepth_next(&depths))
168 {
169 for (visuals = xcb_render_pictdepth_visuals_iterator(depths.data);
170 visuals.rem; xcb_render_pictvisual_next(&visuals))
171 {
172 xcb_render_pictforminfo_t temp;
173 xcb_render_pictforminfo_t *format;
174
175 visual = visuals.data;
176 temp.id = visual->format;
177
178 format =
179 xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID,
180 &temp, 0);
181 if (!format) continue;
182 if (format->type == type)
183 {
184 if (check_alpha)
185 {
186 if (format->direct.alpha_mask)
187 return visual->visual;
188 }
189 else
190 return visual->visual;
191 }
192 }
193 }
194 }
195#endif
196
197 return 0;
198}
199
200/* local function prototypes */
201static Eina_Bool
202_ecore_xcb_render_parse_boolean(char *v)
203{
204 char c;
205
206 c = *v;
207 if (isupper((int)c))
208 c = tolower(c);
209 if ((c == 't') || (c == 'y') || (c == '1'))
210 return EINA_TRUE;
211 if ((c == 'f') || (c == 'n') || (c == '0'))
212 return EINA_FALSE;
213 if (c == 'o')
214 {
215 char d;
216
217 d = v[1];
218 if (isupper((int)d))
219 d = tolower(d);
220 if (d == 'n') return EINA_TRUE;
221 if (d == 'f') return EINA_FALSE;
222 }
223 return EINA_FALSE;
224}
225
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
deleted file mode 100644
index cb7249f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c
+++ /dev/null
@@ -1,338 +0,0 @@
1#include "ecore_xcb_private.h"
2# ifdef ECORE_XCB_SCREENSAVER
3# include <xcb/screensaver.h>
4# endif
5
6/* local variables */
7static Eina_Bool _screensaver_avail = EINA_FALSE;
8
9/* external variables */
10int _ecore_xcb_event_screensaver = -1;
11
12void
13_ecore_xcb_screensaver_init(void)
14{
15 LOGFN(__FILE__, __LINE__, __FUNCTION__);
16
17#ifdef ECORE_XCB_SCREENSAVER
18 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_screensaver_id);
19#endif
20}
21
22void
23_ecore_xcb_screensaver_finalize(void)
24{
25#ifdef ECORE_XCB_SCREENSAVER
26 const xcb_query_extension_reply_t *ext_reply;
27#endif
28
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30
31#ifdef ECORE_XCB_SCREENSAVER
32 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_screensaver_id);
33 if ((ext_reply) && (ext_reply->present))
34 {
35 xcb_screensaver_query_version_cookie_t cookie;
36 xcb_screensaver_query_version_reply_t *reply;
37
38 cookie =
39 xcb_screensaver_query_version_unchecked(_ecore_xcb_conn,
40 XCB_SCREENSAVER_MAJOR_VERSION,
41 XCB_SCREENSAVER_MINOR_VERSION);
42 reply =
43 xcb_screensaver_query_version_reply(_ecore_xcb_conn, cookie, NULL);
44 if (reply)
45 {
46 if ((reply->server_major_version >= XCB_SCREENSAVER_MAJOR_VERSION) &&
47 (reply->server_minor_version >= XCB_SCREENSAVER_MINOR_VERSION))
48 _screensaver_avail = EINA_TRUE;
49
50 free(reply);
51 }
52
53 if (_screensaver_avail)
54 _ecore_xcb_event_screensaver = ext_reply->first_event;
55 }
56#endif
57}
58
59EAPI int
60ecore_x_screensaver_idle_time_get(void)
61{
62 int ret = 0;
63#ifdef ECORE_XCB_SCREENSAVER
64 xcb_screensaver_query_info_cookie_t cookie;
65 xcb_screensaver_query_info_reply_t *reply;
66 Ecore_X_Window root;
67#endif
68
69 LOGFN(__FILE__, __LINE__, __FUNCTION__);
70 CHECK_XCB_CONN;
71
72 if (!_screensaver_avail) return 0;
73
74#ifdef ECORE_XCB_SCREENSAVER
75 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
76 cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, root);
77 reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL);
78 if (!reply) return 0;
79 ret = (reply->ms_until_server / 1000);
80 free(reply);
81#endif
82
83 return ret;
84}
85
86EAPI void
87ecore_x_screensaver_set(int timeout,
88 int interval,
89 int prefer_blanking,
90 int allow_exposures)
91{
92 LOGFN(__FILE__, __LINE__, __FUNCTION__);
93 CHECK_XCB_CONN;
94
95 if (!_screensaver_avail) return;
96
97#ifdef ECORE_XCB_SCREENSAVER
98 xcb_set_screen_saver(_ecore_xcb_conn,
99 timeout, interval, prefer_blanking, allow_exposures);
100#endif
101}
102
103EAPI void
104ecore_x_screensaver_timeout_set(int timeout)
105{
106#ifdef ECORE_XCB_SCREENSAVER
107 xcb_get_screen_saver_cookie_t cookie;
108 xcb_get_screen_saver_reply_t *reply;
109 uint16_t pint;
110 uint8_t pblank, pexpo;
111#endif
112
113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
114 CHECK_XCB_CONN;
115
116 if (!_screensaver_avail) return;
117
118#ifdef ECORE_XCB_SCREENSAVER
119 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
120 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
121 if (!reply) return;
122 pint = reply->interval;
123 pblank = reply->prefer_blanking;
124 pexpo = reply->allow_exposures;
125 free(reply);
126 xcb_set_screen_saver(_ecore_xcb_conn, timeout, pint, pblank, pexpo);
127#endif
128}
129
130EAPI int
131ecore_x_screensaver_timeout_get(void)
132{
133 int timeout = 0;
134#ifdef ECORE_XCB_SCREENSAVER
135 xcb_get_screen_saver_cookie_t cookie;
136 xcb_get_screen_saver_reply_t *reply;
137#endif
138
139 LOGFN(__FILE__, __LINE__, __FUNCTION__);
140 CHECK_XCB_CONN;
141
142 if (!_screensaver_avail) return 0;
143
144#ifdef ECORE_XCB_SCREENSAVER
145 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
146 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
147 if (!reply) return 0;
148 timeout = reply->timeout;
149 free(reply);
150#endif
151
152 return timeout;
153}
154
155EAPI void
156ecore_x_screensaver_blank_set(int blank)
157{
158#ifdef ECORE_XCB_SCREENSAVER
159 xcb_get_screen_saver_cookie_t cookie;
160 xcb_get_screen_saver_reply_t *reply;
161 uint16_t pint, pto;
162 uint8_t pexpo;
163#endif
164
165 LOGFN(__FILE__, __LINE__, __FUNCTION__);
166 CHECK_XCB_CONN;
167
168 if (!_screensaver_avail) return;
169
170#ifdef ECORE_XCB_SCREENSAVER
171 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
172 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
173 if (!reply) return;
174 pto = reply->timeout;
175 pint = reply->interval;
176 pexpo = reply->allow_exposures;
177 free(reply);
178 xcb_set_screen_saver(_ecore_xcb_conn, pto, pint, blank, pexpo);
179#endif
180}
181
182EAPI int
183ecore_x_screensaver_blank_get(void)
184{
185 int blank = 0;
186#ifdef ECORE_XCB_SCREENSAVER
187 xcb_get_screen_saver_cookie_t cookie;
188 xcb_get_screen_saver_reply_t *reply;
189#endif
190
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
192 CHECK_XCB_CONN;
193
194 if (!_screensaver_avail) return 0;
195
196#ifdef ECORE_XCB_SCREENSAVER
197 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
198 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
199 if (!reply) return 0;
200 blank = reply->prefer_blanking;
201 free(reply);
202#endif
203
204 return blank;
205}
206
207EAPI void
208ecore_x_screensaver_expose_set(int expose)
209{
210#ifdef ECORE_XCB_SCREENSAVER
211 xcb_get_screen_saver_cookie_t cookie;
212 xcb_get_screen_saver_reply_t *reply;
213 uint16_t pint, pto;
214 uint8_t pblank;
215#endif
216
217 LOGFN(__FILE__, __LINE__, __FUNCTION__);
218 CHECK_XCB_CONN;
219
220 if (!_screensaver_avail) return;
221
222#ifdef ECORE_XCB_SCREENSAVER
223 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
224 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
225 if (!reply) return;
226 pto = reply->timeout;
227 pint = reply->interval;
228 pblank = reply->prefer_blanking;
229 free(reply);
230 xcb_set_screen_saver(_ecore_xcb_conn, pto, pint, pblank, expose);
231#endif
232}
233
234EAPI int
235ecore_x_screensaver_expose_get(void)
236{
237 int expose = 0;
238#ifdef ECORE_XCB_SCREENSAVER
239 xcb_get_screen_saver_cookie_t cookie;
240 xcb_get_screen_saver_reply_t *reply;
241#endif
242
243 LOGFN(__FILE__, __LINE__, __FUNCTION__);
244 CHECK_XCB_CONN;
245
246 if (!_screensaver_avail) return 0;
247
248#ifdef ECORE_XCB_SCREENSAVER
249 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
250 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
251 if (!reply) return 0;
252 expose = reply->allow_exposures;
253 free(reply);
254#endif
255
256 return expose;
257}
258
259EAPI void
260ecore_x_screensaver_interval_set(int interval)
261{
262#ifdef ECORE_XCB_SCREENSAVER
263 xcb_get_screen_saver_cookie_t cookie;
264 xcb_get_screen_saver_reply_t *reply;
265 uint16_t pto;
266 uint8_t pblank, pexpose;
267#endif
268
269 LOGFN(__FILE__, __LINE__, __FUNCTION__);
270 CHECK_XCB_CONN;
271
272 if (!_screensaver_avail) return;
273
274#ifdef ECORE_XCB_SCREENSAVER
275 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
276 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
277 if (!reply) return;
278 pto = reply->timeout;
279 pblank = reply->prefer_blanking;
280 pexpose = reply->allow_exposures;
281 free(reply);
282 xcb_set_screen_saver(_ecore_xcb_conn, pto, interval, pblank, pexpose);
283#endif
284}
285
286EAPI int
287ecore_x_screensaver_interval_get(void)
288{
289 int interval = 0;
290#ifdef ECORE_XCB_SCREENSAVER
291 xcb_get_screen_saver_cookie_t cookie;
292 xcb_get_screen_saver_reply_t *reply;
293#endif
294
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
296 CHECK_XCB_CONN;
297
298 if (!_screensaver_avail) return 0;
299
300#ifdef ECORE_XCB_SCREENSAVER
301 cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
302 reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
303 if (!reply) return 0;
304 interval = reply->interval;
305 free(reply);
306#endif
307
308 return interval;
309}
310
311EAPI void
312ecore_x_screensaver_event_listen_set(Eina_Bool on)
313{
314#ifdef ECORE_XCB_SCREENSAVER
315 Ecore_X_Window root;
316#endif
317
318 LOGFN(__FILE__, __LINE__, __FUNCTION__);
319 CHECK_XCB_CONN;
320
321 if (!_screensaver_avail) return;
322
323#ifdef ECORE_XCB_SCREENSAVER
324 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
325 if (on)
326 xcb_screensaver_select_input(_ecore_xcb_conn, root,
327 XCB_SCREENSAVER_EVENT_NOTIFY_MASK);
328 else
329 xcb_screensaver_select_input(_ecore_xcb_conn, root, 0);
330#endif
331}
332
333EAPI Eina_Bool
334ecore_x_screensaver_event_available_get(void)
335{
336 return _screensaver_avail;
337}
338
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
deleted file mode 100644
index 7b994bd..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c
+++ /dev/null
@@ -1,1039 +0,0 @@
1#include "ecore_xcb_private.h"
2//#include "Ecore_X_Atoms.h"
3
4#define ECORE_XCB_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
5
6/* local function prototypes */
7static Eina_Bool _ecore_xcb_selection_converter_text(char *target,
8 void *data,
9 int size,
10 void **data_ret,
11 int *size_ret,
12 Ecore_X_Atom *type,
13 int *size_type);
14static void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
15 void *data,
16 int size,
17 int format __UNUSED__);
18static void *_ecore_xcb_selection_parser_files(const char *target,
19 void *data,
20 int size,
21 int format __UNUSED__);
22static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
23 void *data,
24 int size,
25 int format __UNUSED__);
26
27//static int _ecore_xcb_selection_data_free(void *data);
28static int _ecore_xcb_selection_data_text_free(void *data);
29static int _ecore_xcb_selection_data_targets_free(void *data);
30static int _ecore_xcb_selection_data_files_free(void *data);
31static int _ecore_xcb_selection_data_default_free(void *data);
32static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win,
33 const void *data,
34 int size,
35 Ecore_X_Atom selection);
36static void _ecore_xcb_selection_request(Ecore_X_Window win,
37 Ecore_X_Atom selection,
38 const char *target);
39static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target);
40
41/* local variables */
42static Ecore_X_Selection_Intern _selections[4];
43static Ecore_X_Selection_Converter *_converters = NULL;
44static Ecore_X_Selection_Parser *_parsers = NULL;
45
46/* local functions */
47void
48_ecore_xcb_selection_init(void)
49{
50 LOGFN(__FILE__, __LINE__, __FUNCTION__);
51
52 memset(_selections, 0, sizeof(_selections));
53
54 /* init converters */
55 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
56 _ecore_xcb_selection_converter_text);
57 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
58 _ecore_xcb_selection_converter_text);
59 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
60 _ecore_xcb_selection_converter_text);
61 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
62 _ecore_xcb_selection_converter_text);
63
64 /* init parsers */
65 ecore_x_selection_parser_add("text/plain",
66 _ecore_xcb_selection_parser_text);
67 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
68 _ecore_xcb_selection_parser_text);
69 ecore_x_selection_parser_add("text/uri-list",
70 _ecore_xcb_selection_parser_files);
71 ecore_x_selection_parser_add("_NETSCAPE_URL",
72 _ecore_xcb_selection_parser_files);
73 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
74 _ecore_xcb_selection_parser_targets);
75}
76
77void
78_ecore_xcb_selection_shutdown(void)
79{
80 Ecore_X_Selection_Converter *cnv;
81 Ecore_X_Selection_Parser *prs;
82
83 LOGFN(__FILE__, __LINE__, __FUNCTION__);
84
85 /* free selection converters */
86 cnv = _converters;
87 while (cnv)
88 {
89 Ecore_X_Selection_Converter *tmp;
90
91 tmp = cnv->next;
92 free(cnv);
93 cnv = tmp;
94 }
95 _converters = NULL;
96
97 /* free parsers */
98 prs = _parsers;
99 while (prs)
100 {
101 Ecore_X_Selection_Parser *tmp;
102
103 tmp = prs;
104 prs = prs->next;
105 free(tmp->target);
106 free(tmp);
107 }
108 _parsers = NULL;
109}
110
111/* public functions */
112EAPI void
113ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
114 Eina_Bool (*func)(char *target,
115 void *data,
116 int size,
117 void **data_ret,
118 int *size_ret,
119 Ecore_X_Atom *type,
120 int *size_type))
121{
122 Ecore_X_Selection_Converter *cnv;
123
124 LOGFN(__FILE__, __LINE__, __FUNCTION__);
125
126 cnv = _converters;
127 if (_converters)
128 {
129 while (1)
130 {
131 if (cnv->target == target)
132 {
133 cnv->convert = func;
134 return;
135 }
136 if (cnv->next)
137 cnv = cnv->next;
138 else
139 break;
140 }
141 cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
142 if (!cnv->next) return;
143 cnv = cnv->next;
144 }
145 else
146 {
147 _converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
148 if (!_converters) return;
149 cnv = _converters;
150 }
151 cnv->target = target;
152 cnv->convert = func;
153}
154
155EAPI void
156ecore_x_selection_converter_add(char *target,
157 Eina_Bool (*func)(char *target,
158 void *data,
159 int size,
160 void **date_ret,
161 int *size_ret,
162 Ecore_X_Atom *atom_ret,
163 int *ret))
164{
165 Ecore_X_Atom atarget;
166
167 LOGFN(__FILE__, __LINE__, __FUNCTION__);
168
169 if ((!func) || (!target)) return;
170 atarget = _ecore_xcb_selection_target_atom_get(target);
171 ecore_x_selection_converter_atom_add(atarget, func);
172}
173
174EAPI void
175ecore_x_selection_converter_del(char *target)
176{
177 Ecore_X_Atom atarget;
178
179 LOGFN(__FILE__, __LINE__, __FUNCTION__);
180
181 if (!target) return;
182 atarget = _ecore_xcb_selection_target_atom_get(target);
183 ecore_x_selection_converter_atom_del(atarget);
184}
185
186EAPI void
187ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
188{
189 Ecore_X_Selection_Converter *conv, *pconv = NULL;
190
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
192
193 conv = _converters;
194 while (conv)
195 {
196 if (conv->target == target)
197 {
198 if (pconv)
199 pconv->next = conv->next;
200 else
201 _converters = conv->next;
202 free(conv);
203 return;
204 }
205 pconv = conv;
206 conv = conv->next;
207 }
208}
209
210EAPI void
211ecore_x_selection_parser_add(const char *target,
212 void *(*func)(const char *target, void *data, int size, int format))
213{
214 Ecore_X_Selection_Parser *prs;
215
216 LOGFN(__FILE__, __LINE__, __FUNCTION__);
217
218 if (!target) return;
219 prs = _parsers;
220 if (prs)
221 {
222 while (prs->next)
223 {
224 if (!strcmp(prs->target, target))
225 {
226 prs->parse = func;
227 return;
228 }
229 prs = prs->next;
230 }
231 prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
232 prs = prs->next;
233 }
234 else
235 {
236 _parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
237 prs = _parsers;
238 }
239 prs->target = strdup(target);
240 prs->parse = func;
241}
242
243EAPI void
244ecore_x_selection_parser_del(const char *target)
245{
246 Ecore_X_Selection_Parser *prs, *pprs = NULL;
247
248 LOGFN(__FILE__, __LINE__, __FUNCTION__);
249
250 if (!target) return;
251
252 prs = _parsers;
253 while (prs)
254 {
255 if (!strcmp(prs->target, target))
256 {
257 if (pprs)
258 pprs->next = prs->next;
259 else
260 _parsers = prs->next;
261 free(prs->target);
262 free(prs);
263 return;
264 }
265 pprs = prs;
266 prs = prs->next;
267 }
268}
269
270/**
271 * Claim ownership of the PRIMARY selection and set its data.
272 * @param w The window to which this selection belongs
273 * @param data The data associated with the selection
274 * @param size The size of the data buffer in bytes
275 * @return Returns 1 if the ownership of the selection was successfully
276 * claimed, or 0 if unsuccessful.
277 */
278EAPI Eina_Bool
279ecore_x_selection_primary_set(Ecore_X_Window win,
280 const void *data,
281 int size)
282{
283 LOGFN(__FILE__, __LINE__, __FUNCTION__);
284
285 return _ecore_xcb_selection_set(win, data, size,
286 ECORE_X_ATOM_SELECTION_PRIMARY);
287}
288
289/**
290 * Release ownership of the primary selection
291 * @return Returns 1 if the selection was successfully cleared,
292 * or 0 if unsuccessful.
293 */
294EAPI Eina_Bool
295ecore_x_selection_primary_clear(void)
296{
297 LOGFN(__FILE__, __LINE__, __FUNCTION__);
298
299 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
300 ECORE_X_ATOM_SELECTION_PRIMARY);
301}
302
303EAPI void
304ecore_x_selection_primary_request(Ecore_X_Window win,
305 const char *target)
306{
307 LOGFN(__FILE__, __LINE__, __FUNCTION__);
308
309 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_PRIMARY, target);
310}
311
312/**
313 * Claim ownership of the SECONDARY selection and set its data.
314 * @param w The window to which this selection belongs
315 * @param data The data associated with the selection
316 * @param size The size of the data buffer in bytes
317 * @return Returns 1 if the ownership of the selection was successfully
318 * claimed, or 0 if unsuccessful.
319 */
320EAPI Eina_Bool
321ecore_x_selection_secondary_set(Ecore_X_Window win,
322 const void *data,
323 int size)
324{
325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
326
327 return _ecore_xcb_selection_set(win, data, size,
328 ECORE_X_ATOM_SELECTION_SECONDARY);
329}
330
331/**
332 * Release ownership of the secondary selection
333 * @return Returns 1 if the selection was successfully cleared,
334 * or 0 if unsuccessful.
335 */
336EAPI Eina_Bool
337ecore_x_selection_secondary_clear(void)
338{
339 LOGFN(__FILE__, __LINE__, __FUNCTION__);
340
341 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
342 ECORE_X_ATOM_SELECTION_SECONDARY);
343}
344
345EAPI void
346ecore_x_selection_secondary_request(Ecore_X_Window win,
347 const char *target)
348{
349 LOGFN(__FILE__, __LINE__, __FUNCTION__);
350
351 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_SECONDARY, target);
352}
353
354/**
355 * Claim ownership of the XDND selection and set its data.
356 * @param w The window to which this selection belongs
357 * @param data The data associated with the selection
358 * @param size The size of the data buffer in bytes
359 * @return Returns 1 if the ownership of the selection was successfully
360 * claimed, or 0 if unsuccessful.
361 */
362EAPI Eina_Bool
363ecore_x_selection_xdnd_set(Ecore_X_Window win,
364 const void *data,
365 int size)
366{
367 LOGFN(__FILE__, __LINE__, __FUNCTION__);
368
369 return _ecore_xcb_selection_set(win, data, size,
370 ECORE_X_ATOM_SELECTION_XDND);
371}
372
373/**
374 * Release ownership of the XDND selection
375 * @return Returns 1 if the selection was successfully cleared,
376 * or 0 if unsuccessful.
377 */
378EAPI Eina_Bool
379ecore_x_selection_xdnd_clear(void)
380{
381 LOGFN(__FILE__, __LINE__, __FUNCTION__);
382
383 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
384 ECORE_X_ATOM_SELECTION_XDND);
385}
386
387EAPI void
388ecore_x_selection_xdnd_request(Ecore_X_Window win,
389 const char *target)
390{
391 Ecore_X_Atom atom;
392 Ecore_X_DND_Target *_target;
393
394 LOGFN(__FILE__, __LINE__, __FUNCTION__);
395 CHECK_XCB_CONN;
396
397 _target = _ecore_xcb_dnd_target_get();
398 atom = _ecore_xcb_selection_target_atom_get(target);
399
400 xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND,
401 atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time);
402}
403
404/**
405 * Claim ownership of the CLIPBOARD selection and set its data.
406 * @param w The window to which this selection belongs
407 * @param data The data associated with the selection
408 * @param size The size of the data buffer in bytes
409 * @return Returns 1 if the ownership of the selection was successfully
410 * claimed, or 0 if unsuccessful.
411 *
412 * Get the converted data from a previous CLIPBOARD selection
413 * request. The buffer must be freed when done with.
414 */
415EAPI Eina_Bool
416ecore_x_selection_clipboard_set(Ecore_X_Window win,
417 const void *data,
418 int size)
419{
420 LOGFN(__FILE__, __LINE__, __FUNCTION__);
421
422 return _ecore_xcb_selection_set(win, data, size,
423 ECORE_X_ATOM_SELECTION_CLIPBOARD);
424}
425
426/**
427 * Release ownership of the clipboard selection
428 * @return Returns 1 if the selection was successfully cleared,
429 * or 0 if unsuccessful.
430 */
431EAPI Eina_Bool
432ecore_x_selection_clipboard_clear(void)
433{
434 LOGFN(__FILE__, __LINE__, __FUNCTION__);
435
436 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
437 ECORE_X_ATOM_SELECTION_CLIPBOARD);
438}
439
440EAPI void
441ecore_x_selection_clipboard_request(Ecore_X_Window win,
442 const char *target)
443{
444 LOGFN(__FILE__, __LINE__, __FUNCTION__);
445
446 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
447}
448
449EAPI Eina_Bool
450ecore_x_selection_convert(Ecore_X_Atom selection,
451 Ecore_X_Atom target,
452 void **data_ret,
453 int *size,
454 Ecore_X_Atom *targtype,
455 int *typesize)
456{
457 Ecore_X_Selection_Intern *sel;
458 Ecore_X_Selection_Converter *cnv;
459 void *data;
460 char *tgt_str;
461
462 LOGFN(__FILE__, __LINE__, __FUNCTION__);
463
464 sel = _ecore_xcb_selection_get(selection);
465 tgt_str = _ecore_xcb_selection_target_get(target);
466
467 for (cnv = _converters; cnv; cnv = cnv->next)
468 {
469 if (cnv->target == target)
470 {
471 int r = 0;
472
473 r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
474 targtype, typesize);
475 free(tgt_str);
476 if (r)
477 {
478 if (data_ret) *data_ret = data;
479 return r;
480 }
481 else
482 return EINA_FALSE;
483 }
484 }
485
486 return EINA_FALSE;
487}
488
489EAPI Eina_Bool
490ecore_x_selection_notify_send(Ecore_X_Window requestor,
491 Ecore_X_Atom selection,
492 Ecore_X_Atom target,
493 Ecore_X_Atom property,
494 Ecore_X_Time tim)
495{
496 xcb_selection_notify_event_t ev;
497
498 LOGFN(__FILE__, __LINE__, __FUNCTION__);
499 CHECK_XCB_CONN;
500
501 memset(&ev, 0, sizeof(xcb_selection_notify_event_t));
502
503 ev.response_type = XCB_SELECTION_NOTIFY;
504 ev.requestor = requestor;
505 ev.selection = selection;
506 ev.target = target;
507 ev.property = property;
508 ev.time = tim;
509
510 xcb_send_event(_ecore_xcb_conn, 0, requestor,
511 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
512// ecore_x_flush();
513
514 return EINA_TRUE;
515}
516
517EAPI void
518ecore_x_selection_owner_set(Ecore_X_Window win,
519 Ecore_X_Atom atom,
520 Ecore_X_Time tim)
521{
522 LOGFN(__FILE__, __LINE__, __FUNCTION__);
523 CHECK_XCB_CONN;
524
525 xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim);
526}
527
528EAPI Ecore_X_Window
529ecore_x_selection_owner_get(Ecore_X_Atom atom)
530{
531 xcb_get_selection_owner_cookie_t cookie;
532 xcb_get_selection_owner_reply_t *reply;
533 Ecore_X_Window ret;
534
535 LOGFN(__FILE__, __LINE__, __FUNCTION__);
536 CHECK_XCB_CONN;
537
538 cookie = xcb_get_selection_owner(_ecore_xcb_conn, atom);
539 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
540 if (!reply) return 0;
541 ret = reply->owner;
542 free(reply);
543 return ret;
544}
545
546void *
547_ecore_xcb_selection_parse(const char *target,
548 void *data,
549 int size,
550 int format)
551{
552 Ecore_X_Selection_Parser *prs;
553 Ecore_X_Selection_Data *sel;
554
555 for (prs = _parsers; prs; prs = prs->next)
556 {
557 if (!strcmp(prs->target, target))
558 {
559 sel = prs->parse(target, data, size, format);
560 if (sel) return sel;
561 }
562 }
563
564 sel = calloc(1, sizeof(Ecore_X_Selection_Data));
565 if (!sel) return NULL;
566 sel->free = _ecore_xcb_selection_data_default_free;
567 sel->length = size;
568 sel->format = format;
569 sel->data = data;
570
571 return sel;
572}
573
574Ecore_X_Selection_Intern *
575_ecore_xcb_selection_get(Ecore_X_Atom selection)
576{
577 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
578 return &_selections[0];
579 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
580 return &_selections[1];
581 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
582 return &_selections[2];
583 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
584 return &_selections[3];
585 else
586 return NULL;
587}
588
589/* local functions */
590static Eina_Bool
591_ecore_xcb_selection_set(Ecore_X_Window win,
592 const void *data,
593 int size,
594 Ecore_X_Atom selection)
595{
596 xcb_get_selection_owner_cookie_t cookie;
597 xcb_get_selection_owner_reply_t *reply;
598 int in = 0;
599
600 LOGFN(__FILE__, __LINE__, __FUNCTION__);
601 CHECK_XCB_CONN;
602
603 xcb_set_selection_owner(_ecore_xcb_conn, win, selection, XCB_CURRENT_TIME);
604
605 cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection);
606 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
607 if (!reply) return EINA_FALSE;
608
609 if (reply->owner != win)
610 {
611 free(reply);
612 return EINA_FALSE;
613 }
614 free(reply);
615
616 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
617 in = 0;
618 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
619 in = 1;
620 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
621 in = 2;
622 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
623 in = 3;
624 else
625 return EINA_FALSE;
626
627 if (data)
628 {
629 unsigned char *buff = NULL;
630
631 _selections[in].win = win;
632 _selections[in].selection = selection;
633 _selections[in].length = size;
634 _selections[in].time = _ecore_xcb_events_last_time_get();
635
636 buff = malloc(size);
637 if (!buff) return EINA_FALSE;
638 memcpy(buff, data, size);
639 _selections[in].data = buff;
640 }
641 else if (_selections[in].data)
642 {
643 free(_selections[in].data);
644 memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Data));
645 }
646
647 return EINA_TRUE;
648}
649
650static void
651_ecore_xcb_selection_request(Ecore_X_Window win,
652 Ecore_X_Atom selection,
653 const char *target)
654{
655 Ecore_X_Atom atarget, prop;
656
657 LOGFN(__FILE__, __LINE__, __FUNCTION__);
658 CHECK_XCB_CONN;
659
660 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
661 prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
662 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
663 prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
664 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
665 prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
666 else
667 return;
668
669 atarget = _ecore_xcb_selection_target_atom_get(target);
670
671 xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
672 XCB_CURRENT_TIME);
673}
674
675static Eina_Bool
676_ecore_xcb_selection_converter_text(char *target,
677 void *data,
678 int size,
679 void **data_ret,
680 int *size_ret,
681 Ecore_X_Atom *type __UNUSED__,
682 int *size_type __UNUSED__)
683{
684 Ecore_Xcb_Encoding_Style style;
685 Ecore_Xcb_Textproperty ret;
686 char *str;
687
688 LOGFN(__FILE__, __LINE__, __FUNCTION__);
689 CHECK_XCB_CONN;
690
691 if ((!data) || (!size)) return EINA_FALSE;
692
693 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
694 style = XcbTextStyle;
695 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
696 style = XcbCompoundTextStyle;
697 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
698 style = XcbStringStyle;
699 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
700 style = XcbUTF8StringStyle;
701 else
702 return EINA_FALSE;
703
704 str = alloca(size + 1);
705 memcpy(str, data, size);
706 str[size] = '\0';
707
708#ifdef HAVE_ICONV
709 if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
710 {
711 int size = 0;
712
713 size = (strlen((char *)ret.value) + 1);
714 *data_ret = malloc(size);
715 if (!*data_ret) return EINA_FALSE;
716 memcpy(*data_ret, ret.value, size);
717 *size_ret = size;
718 if (ret.value) free(ret.value);
719 return EINA_TRUE;
720 }
721#else
722 if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret))
723 {
724 int size = 0;
725
726 size = (strlen((char *)ret.value) + 1);
727 *data_ret = malloc(size);
728 if (!*data_ret) return EINA_FALSE;
729 memcpy(*data_ret, ret.value, size);
730 *size_ret = size;
731 if (ret.value) free(ret.value);
732 return EINA_TRUE;
733 }
734#endif
735 else
736 return EINA_TRUE;
737
738 return EINA_FALSE;
739}
740
741static void *
742_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
743 void *data,
744 int size,
745 int format __UNUSED__)
746{
747 Ecore_X_Selection_Data_Text *sel;
748 unsigned char *_data;
749 void *t;
750
751 LOGFN(__FILE__, __LINE__, __FUNCTION__);
752
753 if (!(_data = data)) return NULL;
754
755 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
756 if (!sel) return NULL;
757
758 if (_data[size - 1])
759 {
760 size++;
761 t = realloc(_data, size);
762 if (!t)
763 {
764 free(sel);
765 return NULL;
766 }
767 _data = t;
768 _data[size - 1] = 0;
769 }
770 sel->text = (char *)_data;
771 ECORE_XCB_SELECTION_DATA(sel)->length = size;
772 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
773 ECORE_XCB_SELECTION_DATA(sel)->data = _data;
774 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_text_free;
775 return sel;
776}
777
778static void *
779_ecore_xcb_selection_parser_files(const char *target,
780 void *data,
781 int size,
782 int format __UNUSED__)
783{
784 Ecore_X_Selection_Data_Files *sel;
785 char *_data, *tmp, *t, **t2;
786 int i = 0, is = 0;
787
788 LOGFN(__FILE__, __LINE__, __FUNCTION__);
789
790 if ((strcmp(target, "text/uri-list")) &&
791 (strcmp(target, "_NETSCAPE_URL"))) return NULL;
792
793 if (!(_data = data)) return NULL;
794
795 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
796 if (!sel) return NULL;
797
798 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free;
799
800 if (_data[size - 1])
801 {
802 size++;
803 t = realloc(_data, size);
804 if (!t)
805 {
806 free(sel);
807 return NULL;
808 }
809 _data = t;
810 _data[size - 1] = 0;
811 }
812
813 tmp = malloc(size);
814 if (!tmp)
815 {
816 free(sel);
817 return NULL;
818 }
819
820 while ((is < size) && (_data[is]))
821 {
822 if ((i == 0) && (_data[is] == '#'))
823 {
824 for (; ((_data[is]) && (_data[is] != '\n')); is++) ;
825 }
826 else
827 {
828 if ((_data[is] != '\r') && (_data[is] != '\n'))
829 tmp[i++] = _data[is++];
830 else
831 {
832 while ((_data[is] == '\r') || (_data[is] == '\n'))
833 is++;
834 tmp[i] = 0;
835 sel->num_files++;
836 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
837 if (t2)
838 {
839 sel->files = t2;
840 sel->files[sel->num_files - 1] = strdup(tmp);
841 }
842 tmp[0] = 0;
843 i = 0;
844 }
845 }
846 }
847 if (i > 0)
848 {
849 tmp[i] = 0;
850 sel->num_files++;
851 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
852 if (t2)
853 {
854 sel->files = t2;
855 sel->files[sel->num_files - 1] = strdup(tmp);
856 }
857 }
858 if (tmp) free(tmp);
859 if (_data) free(_data);
860
861 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;
862 ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files;
863
864 return ECORE_XCB_SELECTION_DATA(sel);
865}
866
867static void *
868_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
869 void *data,
870 int size,
871 int format __UNUSED__)
872{
873 Ecore_X_Selection_Data_Targets *sel;
874 unsigned long *targets;
875 int i = 0;
876
877 LOGFN(__FILE__, __LINE__, __FUNCTION__);
878 CHECK_XCB_CONN;
879
880 if (!(targets = (unsigned long *)data)) return NULL;
881
882 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
883 if (!sel) return NULL;
884
885 sel->num_targets = (size - 2);
886 sel->targets = malloc((size - 2) * sizeof(char *));
887 if (!sel->targets)
888 {
889 free(sel);
890 return NULL;
891 }
892
893 for (i = 2; i < size; i++)
894 {
895 xcb_get_atom_name_cookie_t cookie;
896 xcb_get_atom_name_reply_t *reply;
897 char *name = NULL;
898 int len = 0;
899
900 cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]);
901 reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
902 if (reply)
903 {
904 len = xcb_get_atom_name_name_length(reply);
905 name = (char *)malloc(sizeof(char) * (len + 1));
906 if (name)
907 {
908 memcpy(name, xcb_get_atom_name_name(reply), len);
909 name[len] = '\0';
910 sel->targets[i - 2] = name;
911 }
912 free(reply);
913 }
914 }
915
916 ECORE_XCB_SELECTION_DATA(sel)->free =
917 _ecore_xcb_selection_data_targets_free;
918 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
919 ECORE_XCB_SELECTION_DATA(sel)->length = size;
920 ECORE_XCB_SELECTION_DATA(sel)->data = data;
921
922 return sel;
923}
924
925/*
926 static int
927 _ecore_xcb_selection_data_free(void *data)
928 {
929 Ecore_X_Selection_Data *sel;
930
931 LOGFN(__FILE__, __LINE__, __FUNCTION__);
932
933 if (!(sel = data)) return 0;
934 if (sel->data) free(sel->data);
935 free(sel);
936 return 1;
937 }
938 */
939
940static int
941_ecore_xcb_selection_data_text_free(void *data)
942{
943 Ecore_X_Selection_Data_Text *sel;
944
945 LOGFN(__FILE__, __LINE__, __FUNCTION__);
946
947 if (!(sel = data)) return 0;
948 if (sel->text) free(sel->text);
949 free(sel);
950 return 1;
951}
952
953static int
954_ecore_xcb_selection_data_targets_free(void *data)
955{
956 Ecore_X_Selection_Data_Targets *sel;
957
958 LOGFN(__FILE__, __LINE__, __FUNCTION__);
959
960 if (!(sel = data)) return 0;
961 if (sel->targets)
962 {
963 int i = 0;
964
965 for (i = 0; i < sel->num_targets; i++)
966 if (sel->targets[i]) free(sel->targets[i]);
967 if (sel->targets) free(sel->targets);
968 }
969 free(sel);
970 return 1;
971}
972
973static int
974_ecore_xcb_selection_data_files_free(void *data)
975{
976 Ecore_X_Selection_Data_Files *sel;
977
978 LOGFN(__FILE__, __LINE__, __FUNCTION__);
979
980 if (!(sel = data)) return 0;
981 if (sel->files)
982 {
983 int i = 0;
984
985 for (i = 0; i < sel->num_files; i++)
986 if (sel->files[i]) free(sel->files[i]);
987 if (sel->files) free(sel->files);
988 }
989 free(sel);
990 return 0;
991}
992
993static int
994_ecore_xcb_selection_data_default_free(void *data)
995{
996 Ecore_X_Selection_Data *sel;
997
998 if (!(sel = data)) return 1;
999 free(sel->data);
1000 free(sel);
1001 return 1;
1002}
1003
1004static Ecore_X_Atom
1005_ecore_xcb_selection_target_atom_get(const char *target)
1006{
1007 Ecore_X_Atom x_target;
1008
1009 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
1010 x_target = ECORE_X_ATOM_TEXT;
1011 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
1012 x_target = ECORE_X_ATOM_COMPOUND_TEXT;
1013 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
1014 x_target = ECORE_X_ATOM_STRING;
1015 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
1016 x_target = ECORE_X_ATOM_UTF8_STRING;
1017 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
1018 x_target = ECORE_X_ATOM_FILE_NAME;
1019 else
1020 x_target = ecore_x_atom_get(target);
1021
1022 return x_target;
1023}
1024
1025char *
1026_ecore_xcb_selection_target_get(Ecore_X_Atom target)
1027{
1028 if (target == ECORE_X_ATOM_FILE_NAME)
1029 return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
1030 else if (target == ECORE_X_ATOM_STRING)
1031 return strdup(ECORE_X_SELECTION_TARGET_STRING);
1032 else if (target == ECORE_X_ATOM_UTF8_STRING)
1033 return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
1034 else if (target == ECORE_X_ATOM_TEXT)
1035 return strdup(ECORE_X_SELECTION_TARGET_TEXT);
1036 else
1037 return ecore_x_atom_name_get(target);
1038}
1039
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
deleted file mode 100644
index 913f199..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c
+++ /dev/null
@@ -1,50 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_SHAPE
3# include <xcb/shape.h>
4#endif
5
6/* external variables */
7int _ecore_xcb_event_shape = -1;
8
9void
10_ecore_xcb_shape_init(void)
11{
12 LOGFN(__FILE__, __LINE__, __FUNCTION__);
13
14#ifdef ECORE_XCB_SHAPE
15 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shape_id);
16#endif
17}
18
19void
20_ecore_xcb_shape_finalize(void)
21{
22#ifdef ECORE_XCB_SHAPE
23 const xcb_query_extension_reply_t *ext_reply;
24#endif
25
26 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27
28#ifdef ECORE_XCB_SHAPE
29 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id);
30 if ((ext_reply) && (ext_reply->present))
31 {
32 xcb_shape_query_version_cookie_t cookie;
33 xcb_shape_query_version_reply_t *reply;
34 Eina_Bool _shape_avail;
35
36 _shape_avail = EINA_FALSE;
37 cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
38 reply = xcb_shape_query_version_reply(_ecore_xcb_conn, cookie, NULL);
39 if (reply)
40 {
41 _shape_avail = EINA_TRUE;
42 free(reply);
43 }
44
45 if (_shape_avail)
46 _ecore_xcb_event_shape = ext_reply->first_event;
47 }
48#endif
49}
50
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
deleted file mode 100644
index 75f4e4f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c
+++ /dev/null
@@ -1,338 +0,0 @@
1#include "ecore_xcb_private.h"
2# ifdef ECORE_XCB_SYNC
3# include <xcb/sync.h>
4# endif
5
6/* local variables */
7static Eina_Bool _sync_avail = EINA_FALSE;
8
9/* external variables */
10int _ecore_xcb_event_sync = -1;
11
12void
13_ecore_xcb_sync_init(void)
14{
15 LOGFN(__FILE__, __LINE__, __FUNCTION__);
16
17#ifdef ECORE_XCB_SYNC
18 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_sync_id);
19#endif
20}
21
22void
23_ecore_xcb_sync_finalize(void)
24{
25#ifdef ECORE_XCB_SYNC
26 const xcb_query_extension_reply_t *ext_reply;
27#endif
28
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30
31#ifdef ECORE_XCB_SYNC
32 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_sync_id);
33 if ((ext_reply) && (ext_reply->present))
34 {
35 xcb_sync_initialize_cookie_t cookie;
36 xcb_sync_initialize_reply_t *reply;
37
38 cookie =
39 xcb_sync_initialize_unchecked(_ecore_xcb_conn,
40 XCB_SYNC_MAJOR_VERSION,
41 XCB_SYNC_MINOR_VERSION);
42 reply = xcb_sync_initialize_reply(_ecore_xcb_conn, cookie, NULL);
43 if (reply)
44 {
45 if (reply->major_version >= 3) _sync_avail = EINA_TRUE;
46 free(reply);
47 }
48
49 if (_sync_avail)
50 _ecore_xcb_event_sync = ext_reply->first_event;
51 }
52#endif
53}
54
55void
56_ecore_xcb_sync_magic_send(int val,
57 Ecore_X_Window win)
58{
59 xcb_client_message_event_t ev;
60
61 LOGFN(__FILE__, __LINE__, __FUNCTION__);
62
63 memset(&ev, 0, sizeof(xcb_client_message_event_t));
64 ev.response_type = XCB_CLIENT_MESSAGE;
65 ev.format = 32;
66 ev.window = win;
67 ev.type = 27777;
68 ev.data.data32[0] = 0x7162534;
69 ev.data.data32[1] = (0x10000000 + val);
70 ev.data.data32[2] = win;
71
72 xcb_send_event(_ecore_xcb_conn, 0, win, XCB_EVENT_MASK_NO_EVENT,
73 (const char *)&ev);
74// ecore_x_flush();
75}
76
77/* public functions */
78EAPI Ecore_X_Sync_Alarm
79ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
80{
81#ifdef ECORE_XCB_SYNC
82 uint32_t list[6], mask;
83 xcb_sync_int64_t init;
84 Ecore_X_Sync_Alarm alarm;
85#endif
86
87 LOGFN(__FILE__, __LINE__, __FUNCTION__);
88 CHECK_XCB_CONN;
89
90 if ((!_sync_avail) || (!counter)) return 0;
91
92#ifdef ECORE_XCB_SYNC
93 init.lo = 0;
94 init.hi = 0;
95 xcb_sync_set_counter(_ecore_xcb_conn, counter, init);
96
97 mask = (XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
98 XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
99 XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS);
100 list[0] = counter;
101 list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE;
102 list[2] = 1;
103 list[3] = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON;
104 list[4] = 1;
105 list[5] = 1;
106 alarm = xcb_generate_id(_ecore_xcb_conn);
107
108 xcb_sync_create_alarm(_ecore_xcb_conn, alarm, mask, list);
109 ecore_x_sync(); // needed
110
111 return alarm;
112#endif
113 return 0;
114}
115
116EAPI Eina_Bool
117ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
118{
119 LOGFN(__FILE__, __LINE__, __FUNCTION__);
120 CHECK_XCB_CONN;
121
122 if ((!_sync_avail) || (!alarm)) return EINA_FALSE;
123
124#ifdef ECORE_XCB_SYNC
125 xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm);
126// ecore_x_flush();
127 return EINA_TRUE;
128#endif
129
130 return EINA_FALSE;
131}
132
133EAPI Eina_Bool
134ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
135 unsigned int *val)
136{
137#ifdef ECORE_XCB_SYNC
138 xcb_sync_query_counter_cookie_t cookie;
139 xcb_sync_query_counter_reply_t *reply;
140#endif
141
142 LOGFN(__FILE__, __LINE__, __FUNCTION__);
143 CHECK_XCB_CONN;
144
145 if ((!_sync_avail) || (!counter)) return EINA_FALSE;
146
147#ifdef ECORE_XCB_SYNC
148 cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
149 reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
150 if (reply)
151 {
152 if (val) *val = (unsigned int)reply->counter_value.lo;
153 free(reply);
154 return EINA_TRUE;
155 }
156#endif
157 return EINA_FALSE;
158}
159
160EAPI void
161ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
162 int by)
163{
164#ifdef ECORE_XCB_SYNC
165 xcb_sync_int64_t v;
166#endif
167
168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
169 CHECK_XCB_CONN;
170
171 if ((!_sync_avail) || (!counter)) return;
172
173#ifdef ECORE_XCB_SYNC
174 v.hi = (by < 0) ? ~0 : 0;
175 v.lo = by;
176
177 xcb_sync_change_counter(_ecore_xcb_conn, counter, v);
178// ecore_x_flush();
179#endif
180}
181
182EAPI void
183ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
184 int val)
185{
186#ifdef ECORE_XCB_SYNC
187 xcb_sync_query_counter_cookie_t cookie;
188 xcb_sync_query_counter_reply_t *reply;
189 xcb_sync_int64_t v1, v2;
190 xcb_sync_waitcondition_t cond;
191#endif
192
193 LOGFN(__FILE__, __LINE__, __FUNCTION__);
194 CHECK_XCB_CONN;
195
196 if ((!_sync_avail) || (!counter)) return;
197
198#ifdef ECORE_XCB_SYNC
199 cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
200 reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
201 if (!reply) return;
202 v1 = reply->counter_value;
203 free(reply);
204
205 v1.hi = (val < 0) ? ~0 : 0;
206 v1.lo = val;
207 v2.hi = ((val + 1) < 0) ? ~0 : 0;
208 v2.lo = (val + 1);
209
210 cond.trigger.counter = counter;
211 cond.trigger.wait_type = XCB_SYNC_VALUETYPE_ABSOLUTE;
212 cond.trigger.wait_value = v1;
213 cond.trigger.test_type = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON;
214 cond.event_threshold = v2;
215
216 xcb_sync_await(_ecore_xcb_conn, 1, &cond);
217// ecore_x_flush();
218#endif
219}
220
221EAPI Ecore_X_Sync_Counter
222ecore_x_sync_counter_new(int val)
223{
224#ifdef ECORE_XCB_SYNC
225 xcb_sync_counter_t counter;
226 xcb_sync_int64_t v;
227#endif
228
229 LOGFN(__FILE__, __LINE__, __FUNCTION__);
230 CHECK_XCB_CONN;
231
232 if (!_sync_avail) return 0;
233
234#ifdef ECORE_XCB_SYNC
235 v.hi = (val < 0) ? ~0 : 0;
236 v.lo = val;
237
238 counter = xcb_generate_id(_ecore_xcb_conn);
239 xcb_sync_create_counter(_ecore_xcb_conn, counter, v);
240// ecore_x_flush();
241
242 return counter;
243#endif
244
245 return 0;
246}
247
248EAPI void
249ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
250{
251 LOGFN(__FILE__, __LINE__, __FUNCTION__);
252 CHECK_XCB_CONN;
253
254 if ((!_sync_avail) || (!counter)) return;
255
256#ifdef ECORE_XCB_SYNC
257 xcb_sync_destroy_counter(_ecore_xcb_conn, counter);
258// ecore_x_flush();
259#endif
260}
261
262EAPI void
263ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
264 int val)
265{
266#ifdef ECORE_XCB_SYNC
267 xcb_sync_int64_t v;
268#endif
269
270 LOGFN(__FILE__, __LINE__, __FUNCTION__);
271 CHECK_XCB_CONN;
272
273 if ((!_sync_avail) || (!counter)) return;
274
275#ifdef ECORE_XCB_SYNC
276 v.hi = (val < 0) ? ~0 : 0;
277 v.lo = val;
278
279 xcb_sync_set_counter(_ecore_xcb_conn, counter, v);
280// ecore_x_flush();
281#endif
282}
283
284EAPI void
285ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
286 int val_hi,
287 unsigned int val_lo)
288{
289#ifdef ECORE_XCB_SYNC
290 xcb_sync_int64_t v;
291#endif
292
293 LOGFN(__FILE__, __LINE__, __FUNCTION__);
294 CHECK_XCB_CONN;
295
296 if ((!_sync_avail) || (!counter)) return;
297
298#ifdef ECORE_XCB_SYNC
299 v.hi = val_hi;
300 v.lo = val_lo;
301
302 xcb_sync_set_counter(_ecore_xcb_conn, counter, v);
303// ecore_x_flush();
304#endif
305}
306
307EAPI Eina_Bool
308ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
309 int *val_hi,
310 unsigned int *val_lo)
311{
312#ifdef ECORE_XCB_SYNC
313 xcb_sync_query_counter_cookie_t cookie;
314 xcb_sync_query_counter_reply_t *reply;
315 xcb_sync_int64_t value;
316#endif
317
318 LOGFN(__FILE__, __LINE__, __FUNCTION__);
319 CHECK_XCB_CONN;
320
321 if ((!_sync_avail) || (!counter)) return EINA_FALSE;
322
323#ifdef ECORE_XCB_SYNC
324 cookie =
325 xcb_sync_query_counter_unchecked(_ecore_xcb_conn,
326 (xcb_sync_counter_t)counter);
327 reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
328 if (!reply) return EINA_FALSE;
329 value = reply->counter_value;
330 free(reply);
331 if (val_hi) *val_hi = (int)value.hi;
332 if (val_lo) *val_lo = (unsigned int)value.lo;
333 return EINA_TRUE;
334#endif
335
336 return EINA_FALSE;
337}
338
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
deleted file mode 100644
index 2a5c854..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c
+++ /dev/null
@@ -1,509 +0,0 @@
1#include "ecore_xcb_private.h"
2//#include "Ecore_X_Atoms.h"
3#include <langinfo.h>
4#ifdef HAVE_ICONV
5# include <iconv.h>
6#endif
7#ifndef CODESET
8# define CODESET "INVALID"
9#endif
10
11static int _ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide,
12 void *list,
13 int count);
14static int _ecore_xcb_textlist_get_wc_len(wchar_t *wstr);
15static void *_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide,
16 int count,
17 int nitems);
18static void _ecore_xcb_textlist_copy_list(Eina_Bool is_wide,
19 void *text,
20 char **list,
21 int count);
22static wchar_t *_ecore_xcb_textlist_copy_wchar(wchar_t *str1,
23 wchar_t *str2);
24static int _ecore_xcb_textlist_len_wchar(wchar_t *str);
25
26#ifdef HAVE_ICONV
27Eina_Bool
28_ecore_xcb_utf8_textlist_to_textproperty(char **list,
29 int count,
30 Ecore_Xcb_Encoding_Style style,
31 Ecore_Xcb_Textproperty *ret)
32{
33 LOGFN(__FILE__, __LINE__, __FUNCTION__);
34
35 return _ecore_xcb_textlist_to_textproperty("utf8string", list, count,
36 style, ret);
37}
38
39#endif
40
41Eina_Bool
42_ecore_xcb_mb_textlist_to_textproperty(char **list,
43 int count,
44 Ecore_Xcb_Encoding_Style style,
45 Ecore_Xcb_Textproperty *ret)
46{
47 LOGFN(__FILE__, __LINE__, __FUNCTION__);
48
49 return _ecore_xcb_textlist_to_textproperty("multiByte", list, count,
50 style, ret);
51}
52
53/* NB: This Function May Not Be Correct !!!
54 * (as I do not know text conversion, locales, etc, etc very well)
55 *
56 * Portions were ripped from libX11 XTextListToTextProperty
57 */
58Eina_Bool
59_ecore_xcb_textlist_to_textproperty(const char *type,
60 char **list,
61 int count,
62 Ecore_Xcb_Encoding_Style style,
63 Ecore_Xcb_Textproperty *ret)
64{
65 Eina_Bool is_wide = EINA_FALSE;
66 Ecore_X_Atom encoding;
67 int len = 0, nitems = 0, i = 0;
68 size_t from_left = 0, to_left = 0;
69 int unconv_num = 0, val = 0;
70 char *buff, *to, *value, *from;
71 const char *to_type, *from_type;
72 char **mb = NULL;
73 wchar_t **wc = NULL;
74#ifdef HAVE_ICONV
75 iconv_t conv;
76#endif
77
78 LOGFN(__FILE__, __LINE__, __FUNCTION__);
79
80 if (!strcmp("wideChar", type)) is_wide = EINA_TRUE;
81 len = _ecore_xcb_textlist_get_buffer_size(is_wide, list, count);
82 if (!(buff = (char *)malloc(len * sizeof(char)))) return EINA_FALSE;
83 from_type = nl_langinfo(CODESET);
84 switch (style)
85 {
86 case XcbStringStyle:
87 case XcbStdICCTextStyle:
88 encoding = ECORE_X_ATOM_STRING;
89 to_type = nl_langinfo(CODESET);
90// to_type = "string";
91 break;
92
93 case XcbUTF8StringStyle:
94 encoding = ECORE_X_ATOM_UTF8_STRING;
95 to_type = "UTF-8";
96 break;
97
98 case XcbCompoundTextStyle:
99 encoding = ECORE_X_ATOM_COMPOUND_TEXT;
100 to_type = nl_langinfo(CODESET);
101// to_type = "compoundText";
102 break;
103
104 case XcbTextStyle:
105 encoding = ECORE_X_ATOM_TEXT;
106 to_type = nl_langinfo(CODESET);
107// to_type = "multiByte";
108 if (!is_wide)
109 {
110 nitems = 0;
111 mb = (char **)list;
112 to = buff;
113 for (i = 0; ((i < count) && (len > 0)); i++)
114 {
115 if (*mb) strcpy(to, *mb);
116 else *to = '\0';
117 from_left = (*mb ? strlen(*mb) : 0) + 1;
118 nitems += from_left;
119 to += from_left;
120 mb++;
121 }
122 unconv_num = 0;
123 goto done;
124 }
125 break;
126
127 default:
128 free(buff);
129 return EINA_FALSE;
130 break;
131 }
132
133 if (count < 1)
134 {
135 nitems = 0;
136 goto done;
137 }
138
139retry:
140#ifdef HAVE_ICONV
141 conv = iconv_open(to_type, from_type);
142#endif
143
144 if (is_wide)
145 wc = (wchar_t **)list;
146 else
147 mb = (char **)list;
148
149 to = buff;
150 to_left = len;
151 unconv_num = 0;
152 for (i = 1; to_left > 0; i++)
153 {
154 if (is_wide)
155 {
156 from = (char *)*wc;
157 from_left = _ecore_xcb_textlist_get_wc_len(*wc);
158 wc++;
159 }
160 else
161 {
162 from = *mb;
163 from_left = (*mb ? strlen(*mb) : 0);
164 mb++;
165 }
166
167#ifdef HAVE_ICONV
168 val = iconv(conv, &from, &from_left, &to, &to_left);
169#endif
170 if (val < 0) continue;
171 if ((val > 0) && (style == XcbStdICCTextStyle) &&
172 (encoding == ECORE_X_ATOM_STRING))
173 {
174#ifdef HAVE_ICONV
175 iconv_close(conv);
176#endif
177 encoding = ECORE_X_ATOM_COMPOUND_TEXT;
178 goto retry;
179 }
180
181 unconv_num += val;
182 *to++ = '\0';
183 to_left--;
184 if (i >= count) break;
185 }
186
187#ifdef HAVE_ICONV
188 iconv_close(conv);
189#endif
190 nitems = (to - buff);
191
192done:
193 if (nitems <= 0) nitems = 1;
194 if (!(value = (char *)malloc(nitems * sizeof(char))))
195 {
196 free(buff);
197 return EINA_FALSE;
198 }
199 if (nitems == 1)
200 *value = 0;
201 else
202 memcpy(value, buff, nitems);
203 nitems--;
204 free(buff);
205
206 ret->value = value;
207 ret->encoding = encoding;
208 ret->format = 8;
209 ret->nitems = nitems;
210
211 return EINA_TRUE;
212}
213
214#ifdef HAVE_ICONV
215Eina_Bool
216_ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
217 char ***list_ret,
218 int *count_ret)
219{
220 LOGFN(__FILE__, __LINE__, __FUNCTION__);
221
222 return _ecore_xcb_textproperty_to_textlist(text_prop, "utf8String",
223 list_ret, count_ret);
224}
225
226#endif
227
228Eina_Bool
229_ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
230 char ***list_ret,
231 int *count_ret)
232{
233 LOGFN(__FILE__, __LINE__, __FUNCTION__);
234
235 return _ecore_xcb_textproperty_to_textlist(text_prop, "multiByte",
236 list_ret, count_ret);
237}
238
239Eina_Bool
240_ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
241 const char *type,
242 char ***list_ret,
243 int *count_ret)
244{
245 Eina_Bool is_wide = EINA_FALSE;
246 Eina_Bool do_strcpy = EINA_FALSE;
247 const char *from_type;
248 char *buff, *to, *from;
249 char *lptr, *sptr;
250 int nitems = 0, len = 0, num = 0, ret = 0;
251 size_t from_left = 0, to_left = 0;
252#ifdef HAVE_ICONV
253 iconv_t conv = 0;
254#endif
255
256 *list_ret = NULL;
257 *count_ret = 0;
258 if (!strcmp("wideChar", type)) is_wide = EINA_TRUE;
259
260 nitems = text_prop->nitems;
261 if (nitems <= 0) return EINA_TRUE;
262
263 if (text_prop->format != 8) return EINA_FALSE;
264
265 from_type = nl_langinfo(CODESET);
266 if (text_prop->encoding == ECORE_X_ATOM_UTF8_STRING)
267 from_type = "UTF-8";
268
269 if (is_wide)
270 len = (text_prop->nitems + 1) * sizeof(wchar_t);
271 else
272 {
273 if (!strcmp(type, "utf8String"))
274 len = text_prop->nitems * 6 + 1;
275 else
276 len = text_prop->nitems * MB_CUR_MAX + 1;
277 }
278
279 buff = (char *)malloc(len * sizeof(char));
280 if (!buff) return EINA_FALSE;
281
282 to = buff;
283 to_left = len;
284
285 if (!strcmp(from_type, type))
286 do_strcpy = EINA_TRUE;
287 else
288 {
289#ifdef HAVE_ICONV
290 conv = iconv_open(type, from_type);
291#endif
292 if (!conv)
293 {
294 free(buff);
295 return EINA_FALSE;
296 }
297 }
298
299 lptr = sptr = text_prop->value;
300 num = *count_ret = 0;
301 while (1)
302 {
303 if ((nitems == 0) || (*sptr == 0))
304 {
305 from = lptr;
306 from_left = sptr - lptr;
307 lptr = sptr;
308 if (do_strcpy)
309 {
310 int l = 0;
311
312 l = MIN(from_left, to_left);
313 strncpy(to, from, l);
314 from += len;
315 to += len;
316 from_left -= l;
317 to_left -= l;
318 ret = 0;
319 }
320 else
321 ret = iconv(conv, &from, &from_left, &to, &to_left);
322
323 if (ret < 0) continue;
324 num += ret;
325 (*count_ret)++;
326 if (nitems == 0) break;
327 lptr = ++sptr;
328 if (is_wide)
329 {
330 *((wchar_t *)to) = (wchar_t)0;
331 to += sizeof(wchar_t);
332 to_left -= sizeof(wchar_t);
333 }
334 else
335 {
336 *((char *)to) = '\0';
337 to++;
338 to_left--;
339 }
340 }
341 else
342 sptr++;
343
344 nitems--;
345 }
346
347#if HAVE_ICONV
348 if (!do_strcpy) iconv_close(conv);
349#endif
350
351 if (is_wide)
352 {
353 *((wchar_t *)to) = (wchar_t)0;
354 to_left -= sizeof(wchar_t);
355 }
356 else
357 {
358 *((char *)to) = '\0';
359 to_left--;
360 }
361
362 *list_ret =
363 _ecore_xcb_textlist_alloc_list(is_wide, *count_ret, (len - to_left));
364 if (*list_ret)
365 _ecore_xcb_textlist_copy_list(is_wide, buff, *list_ret, *count_ret);
366
367 free(buff);
368
369 return EINA_TRUE;
370}
371
372static int
373_ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide,
374 void *list,
375 int count)
376{
377 int len = 0;
378 char **mb;
379 wchar_t **wc;
380
381 if (!list) return 0;
382 if (is_wide)
383 {
384 wc = (wchar_t **)list;
385 for (; count-- > 0; wc++)
386 if (*wc) len += _ecore_xcb_textlist_get_wc_len(*wc) + 1;
387 len *= 5;
388 }
389 else
390 {
391 mb = (char **)list;
392 for (; count-- > 0; mb++)
393 if (*mb) len += strlen(*mb) + 1;
394 len *= 3;
395 }
396 len = (len / 2048 + 1) * 2048;
397 return len;
398}
399
400static int
401_ecore_xcb_textlist_get_wc_len(wchar_t *wstr)
402{
403 wchar_t *ptr;
404
405 ptr = wstr;
406 while (*ptr)
407 ptr++;
408
409 return ptr - wstr;
410}
411
412static void *
413_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide,
414 int count,
415 int nitems)
416{
417 if (is_wide)
418 {
419 wchar_t **list;
420
421 list = (wchar_t **)malloc(count * sizeof(wchar_t *));
422 if (!list) return NULL;
423 *list = (wchar_t *)malloc(nitems * sizeof(wchar_t));
424 if (!*list)
425 {
426 free(list);
427 return NULL;
428 }
429 return *list;
430 }
431 else
432 {
433 char **list;
434
435 list = (char **)malloc(count * sizeof(char *));
436 if (!list) return NULL;
437 *list = (char *)malloc(nitems * sizeof(char));
438 if (!*list)
439 {
440 free(list);
441 return NULL;
442 }
443 return *list;
444 }
445}
446
447static void
448_ecore_xcb_textlist_copy_list(Eina_Bool is_wide,
449 void *text,
450 char **list,
451 int count)
452{
453 int len = 0;
454
455 if (is_wide)
456 {
457 wchar_t *txt, *str, **wlist;
458
459 txt = (wchar_t *)text;
460 wlist = (wchar_t **)list;
461 for (str = *wlist; count > 0; count--, wlist++)
462 {
463 _ecore_xcb_textlist_copy_wchar(str, txt);
464 *wlist = str;
465 len = (_ecore_xcb_textlist_len_wchar(str) + 1);
466 str += len;
467 txt += len;
468 }
469 }
470 else
471 {
472 char *txt, *str, **slist;
473
474 txt = (char *)text;
475 slist = (char **)list;
476 for (str = *slist; count > 0; count--, slist++)
477 {
478 strcpy(str, txt);
479 *slist = str;
480 len = strlen(str) + 1;
481 str += len;
482 txt += len;
483 }
484 }
485}
486
487static wchar_t *
488_ecore_xcb_textlist_copy_wchar(wchar_t *str1,
489 wchar_t *str2)
490{
491 wchar_t *tmp;
492
493 tmp = str1;
494 while ((*str1++ = *str2++))
495 ;
496 return tmp;
497}
498
499static int
500_ecore_xcb_textlist_len_wchar(wchar_t *str)
501{
502 wchar_t *ptr;
503
504 ptr = str;
505 while (*ptr)
506 ptr++;
507 return ptr - str;
508}
509
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
deleted file mode 100644
index 47efefc..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c
+++ /dev/null
@@ -1,375 +0,0 @@
1#include "ecore_xcb_private.h"
2# include <fcntl.h>
3# include <dlfcn.h>
4# include <X11/Xlib-xcb.h>
5
6#define ECORE_XCB_VSYNC_DRI2 1
7#define DRM_EVENT_CONTEXT_VERSION 2
8
9#ifdef ECORE_XCB_VSYNC_DRI2
10
11/* relevant header bits of dri/drm inlined here to avoid needing external */
12/* headers to build drm */
13typedef unsigned int drm_magic_t;
14
15typedef enum
16{
17 DRM_VBLANK_ABSOLUTE = 0x00000000,
18 DRM_VBLANK_RELATIVE = 0x00000001,
19 DRM_VBLANK_EVENT = 0x04000000,
20 DRM_VBLANK_FLIP = 0x08000000,
21 DRM_VBLANK_NEXTONMISS = 0x10000000,
22 DRM_VBLANK_SECONDARY = 0x20000000,
23 DRM_VBLANK_SIGNAL = 0x40000000
24} drmVBlankSeqType;
25
26typedef struct _drmVBlankReq
27{
28 drmVBlankSeqType type;
29 unsigned int sequence;
30 unsigned long signal;
31} drmVBlankReq;
32
33typedef struct _drmVBlankReply
34{
35 drmVBlankSeqType type;
36 unsigned int sequence;
37 long tval_sec, tval_usec;
38} drmVBlankReply;
39
40typedef union _drmVBlank
41{
42 drmVBlankReq request;
43 drmVBlankReply reply;
44} drmVBlank;
45
46typedef struct _drmEventContext
47{
48 int version;
49 void (*vblank_handler)(int fd,
50 unsigned int sequence,
51 unsigned int tv_sec,
52 unsigned int tv_usec,
53 void *user_data);
54 void (*page_flip_handler)(int fd,
55 unsigned int sequence,
56 unsigned int tv_sec,
57 unsigned int tv_usec,
58 void *user_data);
59} drmEventContext;
60
61static int (*sym_drmClose)(int fd) = NULL;
62static int (*sym_drmGetMagic)(int fd,
63 drm_magic_t *magic) = NULL;
64static int (*sym_drmWaitVBlank)(int fd,
65 drmVBlank *vbl) = NULL;
66static int (*sym_drmHandleEvent)(int fd,
67 drmEventContext *evctx) = NULL;
68
69/* dri */
70static Bool (*sym_DRI2QueryExtension)(Display *display,
71 int *eventBase,
72 int *errorBase) = NULL;
73static Bool (*sym_DRI2QueryVersion)(Display *display,
74 int *major,
75 int *minor) = NULL;
76static Bool (*sym_DRI2Connect)(Display *display,
77 XID window,
78 char **driverName,
79 char **deviceName) = NULL;
80static Bool (*sym_DRI2Authenticate)(Display *display,
81 XID window,
82 drm_magic_t magic) = NULL;
83
84/* local function prototypes */
85static Eina_Bool _ecore_xcb_dri_link(void);
86static Eina_Bool _ecore_xcb_dri_start(void);
87static void _ecore_xcb_dri_shutdown(void);
88
89static Eina_Bool _ecore_xcb_dri_cb(void *data __UNUSED__,
90 Ecore_Fd_Handler *fdh __UNUSED__);
91static void _ecore_xcb_dri_tick_begin(void *data __UNUSED__);
92static void _ecore_xcb_dri_tick_end(void *data __UNUSED__);
93static void _ecore_xcb_dri_tick_schedule(void);
94static void _ecore_xcb_dri_vblank_handler(int fd __UNUSED__,
95 unsigned int frame __UNUSED__,
96 unsigned int sec __UNUSED__,
97 unsigned int usec __UNUSED__,
98 void *data __UNUSED__);
99
100/* local variables */
101static Ecore_X_Window _vsync_root = 0;
102static int _drm_fd = -1;
103static Ecore_Fd_Handler *_drm_fdh = NULL;
104static unsigned int _drm_magic = 0;
105static Eina_Bool _drm_event_busy = EINA_FALSE;
106static void *_drm_lib = NULL;
107static void *_dri_lib = NULL;
108static drmEventContext _drm_evctx;
109#endif
110
111void
112_ecore_xcb_dri_init(void)
113{
114 LOGFN(__FILE__, __LINE__, __FUNCTION__);
115}
116
117void
118_ecore_xcb_dri_finalize(void)
119{
120 LOGFN(__FILE__, __LINE__, __FUNCTION__);
121}
122
123EAPI Eina_Bool
124ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
125{
126#ifdef ECORE_XCB_VSYNC_DRI2
127 Ecore_X_Window root;
128#endif
129
130 LOGFN(__FILE__, __LINE__, __FUNCTION__);
131 CHECK_XCB_CONN;
132
133#ifdef ECORE_XCB_VSYNC_DRI2
134 root = ecore_x_window_root_get(win);
135 if (root != _vsync_root)
136 {
137 _vsync_root = root;
138 if (_vsync_root)
139 {
140 if (!_ecore_xcb_dri_link())
141 {
142 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
143 return EINA_FALSE;
144 }
145 _ecore_xcb_dri_shutdown();
146 if (!_ecore_xcb_dri_start())
147 {
148 _vsync_root = 0;
149 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
150 return EINA_FALSE;
151 }
152 ecore_animator_custom_source_tick_begin_callback_set
153 (_ecore_xcb_dri_tick_begin, NULL);
154 ecore_animator_custom_source_tick_end_callback_set
155 (_ecore_xcb_dri_tick_end, NULL);
156 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
157 }
158 else
159 {
160 if (_drm_fd >= 0)
161 {
162 _ecore_xcb_dri_shutdown();
163 ecore_animator_custom_source_tick_begin_callback_set
164 (NULL, NULL);
165 ecore_animator_custom_source_tick_end_callback_set
166 (NULL, NULL);
167 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
168 }
169 }
170 }
171 return EINA_TRUE;
172#else
173 return EINA_FALSE;
174 win = 0;
175#endif
176}
177
178/* local functions */
179#ifdef ECORE_XCB_VSYNC_DRI2
180static Eina_Bool
181_ecore_xcb_dri_link(void)
182{
183 const char *_drm_libs[] =
184 {
185 "libdrm.so.2",
186 "libdrm.so.1",
187 "libdrm.so.0",
188 "libdrm.so",
189 NULL,
190 };
191 const char *_dri_libs[] =
192 {
193 "libdri2.so.2",
194 "libdri2.so.1",
195 "libdri2.so.0",
196 "libdri2.so",
197 "libGL.so.4",
198 "libGL.so.3",
199 "libGL.so.2",
200 "libGL.so.1",
201 "libGL.so.0",
202 "libGL.so",
203 NULL,
204 };
205 int i = 0, fail = 0;
206
207 LOGFN(__FILE__, __LINE__, __FUNCTION__);
208
209# define SYM(lib, xx) \
210 do { \
211 sym_## xx = dlsym(lib, #xx); \
212 if (!(sym_## xx)) { \
213 fprintf(stderr, "%s\n", dlerror()); \
214 fail = 1; \
215 } \
216 } while (0);
217
218 if (_drm_lib) return EINA_TRUE;
219
220 for (i = 0; _drm_libs[i]; i++)
221 {
222 _drm_lib = dlopen(_drm_libs[i], (RTLD_LOCAL | RTLD_LAZY));
223 if (_drm_lib)
224 {
225 fail = 0;
226 SYM(_drm_lib, drmClose);
227 SYM(_drm_lib, drmGetMagic);
228 SYM(_drm_lib, drmWaitVBlank);
229 SYM(_drm_lib, drmHandleEvent);
230 if (fail)
231 {
232 dlclose(_drm_lib);
233 _drm_lib = NULL;
234 }
235 else
236 break;
237 }
238 }
239 if (!_drm_lib) return EINA_FALSE;
240 for (i = 0; _dri_libs[i]; i++)
241 {
242 if ((_dri_lib = dlopen(_dri_libs[i], (RTLD_LOCAL | RTLD_LAZY))))
243 {
244 fail = 0;
245 SYM(_dri_lib, DRI2QueryExtension);
246 SYM(_dri_lib, DRI2QueryVersion);
247 SYM(_dri_lib, DRI2Connect);
248 SYM(_dri_lib, DRI2Authenticate);
249 if (fail)
250 {
251 dlclose(_dri_lib);
252 _dri_lib = NULL;
253 }
254 else
255 break;
256 }
257 }
258 if (!_dri_lib)
259 {
260 dlclose(_drm_lib);
261 _drm_lib = NULL;
262 return EINA_FALSE;
263 }
264
265 return EINA_TRUE;
266}
267
268static Eina_Bool
269_ecore_xcb_dri_start(void)
270{
271 Ecore_X_Display *disp;
272 int _dri2_event = 0, _dri2_error = 0;
273 int _dri2_major = 0, _dri2_minor = 0;
274 char *device = NULL, *driver = NULL;
275
276 disp = ecore_x_display_get();
277 if (!sym_DRI2QueryExtension(disp, &_dri2_event, &_dri2_error))
278 return 0;
279 if (!sym_DRI2QueryVersion(disp, &_dri2_major, &_dri2_minor))
280 return 0;
281 if (_dri2_major < 2) return 0;
282 if (!sym_DRI2Connect(disp, _vsync_root, &driver, &device))
283 return 0;
284
285 _drm_fd = open(device, O_RDWR);
286 if (_drm_fd < 0) return 0;
287
288 sym_drmGetMagic(_drm_fd, &_drm_magic);
289 if (!sym_DRI2Authenticate(disp, _vsync_root, _drm_magic))
290 {
291 close(_drm_fd);
292 _drm_fd = -1;
293 return EINA_FALSE;
294 }
295
296 memset(&_drm_evctx, 0, sizeof(_drm_evctx));
297 _drm_evctx.version = DRM_EVENT_CONTEXT_VERSION;
298 _drm_evctx.vblank_handler = _ecore_xcb_dri_vblank_handler;
299 _drm_evctx.page_flip_handler = NULL;
300
301 _drm_fdh = ecore_main_fd_handler_add(_drm_fd, ECORE_FD_READ,
302 _ecore_xcb_dri_cb, NULL, NULL, NULL);
303 if (!_drm_fdh)
304 {
305 close(_drm_fd);
306 _drm_fd = -1;
307 return EINA_FALSE;
308 }
309
310 return EINA_TRUE;
311}
312
313static void
314_ecore_xcb_dri_shutdown(void)
315{
316 if (_drm_fd >= 0)
317 {
318 close(_drm_fd);
319 _drm_fd = -1;
320 }
321 if (_drm_fdh)
322 {
323 ecore_main_fd_handler_del(_drm_fdh);
324 _drm_fdh = NULL;
325 }
326}
327
328static Eina_Bool
329_ecore_xcb_dri_cb(void *data __UNUSED__,
330 Ecore_Fd_Handler *fdh __UNUSED__)
331{
332 sym_drmHandleEvent(_drm_fd, &_drm_evctx);
333 return ECORE_CALLBACK_RENEW;
334}
335
336static void
337_ecore_xcb_dri_tick_begin(void *data __UNUSED__)
338{
339 _drm_event_busy = EINA_TRUE;
340 _ecore_xcb_dri_tick_schedule();
341}
342
343static void
344_ecore_xcb_dri_tick_end(void *data __UNUSED__)
345{
346 _drm_event_busy = EINA_FALSE;
347}
348
349static void
350_ecore_xcb_dri_tick_schedule(void)
351{
352 drmVBlank vbl;
353
354 LOGFN(__FILE__, __LINE__, __FUNCTION__);
355 CHECK_XCB_CONN;
356
357 vbl.request.type = (DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT);
358 vbl.request.sequence = 1;
359 vbl.request.signal = 0;
360
361 sym_drmWaitVBlank(_drm_fd, &vbl);
362}
363
364static void
365_ecore_xcb_dri_vblank_handler(int fd __UNUSED__,
366 unsigned int frame __UNUSED__,
367 unsigned int sec __UNUSED__,
368 unsigned int usec __UNUSED__,
369 void *data __UNUSED__)
370{
371 ecore_animator_custom_tick();
372 if (_drm_event_busy) _ecore_xcb_dri_tick_schedule();
373}
374
375#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
deleted file mode 100644
index 3458729..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c
+++ /dev/null
@@ -1,2234 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_RENDER
3# include <xcb/render.h>
4#endif
5#ifdef ECORE_XCB_SHAPE
6# include <xcb/shape.h>
7#endif
8#ifdef ECORE_XCB_XPRINT
9#include <xcb/xprint.h>
10#endif
11
12/* local function prototypes */
13static Ecore_X_Window _ecore_xcb_window_argb_internal_new(Ecore_X_Window parent,
14 int x,
15 int y,
16 int w,
17 int h,
18 uint8_t override_redirect,
19 uint8_t save_under);
20static Ecore_X_Window _ecore_xcb_window_at_xy_get(Ecore_X_Window base,
21 int bx,
22 int by,
23 int x,
24 int y,
25 Ecore_X_Window *skip,
26 int skip_num);
27static int _ecore_xcb_window_modifiers_get(unsigned int state);
28static xcb_visualtype_t *_ecore_xcb_window_find_visual_by_id(xcb_visualid_t id);
29#ifdef ECORE_XCB_XPRINT
30static xcb_screen_t *_ecore_xcb_window_screen_of_display(int screen);
31#endif
32
33/* local variables */
34static int ignore_num = 0;
35static Ecore_X_Window *ignore_list = NULL;
36
37/* external variables */
38int _ecore_xcb_button_grabs_num = 0;
39int _ecore_xcb_key_grabs_num = 0;
40Ecore_X_Window *_ecore_xcb_button_grabs = NULL;
41Ecore_X_Window *_ecore_xcb_key_grabs = NULL;
42Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data,
43 int type,
44 void *event);
45void *_ecore_xcb_window_grab_replay_data;
46
47/**
48 * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions
49 *
50 * Functions that can be used to create an X window.
51 */
52
53/**
54 * Creates a new window.
55 * @param parent The parent window to use. If @p parent is @c 0, the root
56 * window of the default display is used.
57 * @param x X position.
58 * @param y Y position.
59 * @param w Width.
60 * @param h Height.
61 * @return The new window handle.
62 * @ingroup Ecore_X_Window_Create_Group
63 */
64EAPI Ecore_X_Window
65ecore_x_window_new(Ecore_X_Window parent,
66 int x,
67 int y,
68 int w,
69 int h)
70{
71 Ecore_X_Window win;
72 uint32_t mask, mask_list[9];
73
74 LOGFN(__FILE__, __LINE__, __FUNCTION__);
75 CHECK_XCB_CONN;
76
77 if (parent == 0)
78 parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
79
80 /* NB: Order here is very important due to xcb_cw_t enum */
81 mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
82 XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE |
83 XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK |
84 XCB_CW_DONT_PROPAGATE);
85
86 mask_list[0] = XCB_BACK_PIXMAP_NONE;
87 mask_list[1] = 0;
88 mask_list[2] = XCB_GRAVITY_NORTH_WEST;
89 mask_list[3] = XCB_GRAVITY_NORTH_WEST;
90 mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
91 mask_list[5] = 0;
92 mask_list[6] = 0;
93 mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
94 XCB_EVENT_MASK_BUTTON_PRESS |
95 XCB_EVENT_MASK_BUTTON_RELEASE |
96 XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
97 XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
98 XCB_EVENT_MASK_VISIBILITY_CHANGE |
99 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
100 XCB_EVENT_MASK_FOCUS_CHANGE |
101 XCB_EVENT_MASK_PROPERTY_CHANGE |
102 XCB_EVENT_MASK_COLOR_MAP_CHANGE);
103 mask_list[8] = XCB_EVENT_MASK_NO_EVENT;
104
105 win = xcb_generate_id(_ecore_xcb_conn);
106 xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT,
107 win, parent, x, y, w, h, 0,
108 XCB_WINDOW_CLASS_INPUT_OUTPUT,
109 XCB_COPY_FROM_PARENT, mask, mask_list);
110
111 if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
112 ecore_x_window_defaults_set(win);
113
114 return win;
115}
116
117/**
118 * Creates a window with the override redirect attribute set to @c True.
119 * @param parent The parent window to use. If @p parent is @c 0, the root
120 * window of the default display is used.
121 * @param x X position.
122 * @param y Y position.
123 * @param w Width.
124 * @param h Height.
125 * @return The new window handle.
126 * @ingroup Ecore_X_Window_Create_Group
127 */
128EAPI Ecore_X_Window
129ecore_x_window_override_new(Ecore_X_Window parent,
130 int x,
131 int y,
132 int w,
133 int h)
134{
135 Ecore_X_Window win;
136 uint32_t mask, mask_list[9];
137
138 LOGFN(__FILE__, __LINE__, __FUNCTION__);
139 CHECK_XCB_CONN;
140
141 if (parent == 0)
142 parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
143
144 /* NB: Order here is very important due to xcb_cw_t enum */
145 mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
146 XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE |
147 XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK |
148 XCB_CW_DONT_PROPAGATE);
149
150 mask_list[0] = XCB_BACK_PIXMAP_NONE;
151 mask_list[1] = 0;
152 mask_list[2] = XCB_GRAVITY_NORTH_WEST;
153 mask_list[3] = XCB_GRAVITY_NORTH_WEST;
154 mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
155 mask_list[5] = 1;
156 mask_list[6] = 0;
157 mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
158 XCB_EVENT_MASK_BUTTON_PRESS |
159 XCB_EVENT_MASK_BUTTON_RELEASE |
160 XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
161 XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
162 XCB_EVENT_MASK_VISIBILITY_CHANGE |
163 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
164 XCB_EVENT_MASK_FOCUS_CHANGE |
165 XCB_EVENT_MASK_PROPERTY_CHANGE |
166 XCB_EVENT_MASK_COLOR_MAP_CHANGE);
167 mask_list[8] = XCB_EVENT_MASK_NO_EVENT;
168
169 win = xcb_generate_id(_ecore_xcb_conn);
170 xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT,
171 win, parent, x, y, w, h, 0,
172 XCB_WINDOW_CLASS_INPUT_OUTPUT,
173 XCB_COPY_FROM_PARENT, mask, mask_list);
174
175 return win;
176}
177
178/**
179 * Creates a new input window.
180 * @param parent The parent window to use. If @p parent is @c 0, the root
181 * window of the default display is used.
182 * @param x X position.
183 * @param y Y position.
184 * @param w Width.
185 * @param h Height.
186 * @return The new window.
187 * @ingroup Ecore_X_Window_Create_Group
188 */
189EAPI Ecore_X_Window
190ecore_x_window_input_new(Ecore_X_Window parent,
191 int x,
192 int y,
193 int w,
194 int h)
195{
196 Ecore_X_Window win;
197 uint32_t mask, mask_list[3];
198
199 LOGFN(__FILE__, __LINE__, __FUNCTION__)
200 CHECK_XCB_CONN;
201
202 if (parent == 0)
203 parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
204
205 /* NB: Order here is very important due to xcb_cw_t enum */
206 mask = (XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK |
207 XCB_CW_DONT_PROPAGATE);
208
209 mask_list[0] = 1;
210 mask_list[1] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
211 XCB_EVENT_MASK_BUTTON_PRESS |
212 XCB_EVENT_MASK_BUTTON_RELEASE |
213 XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
214 XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
215 XCB_EVENT_MASK_VISIBILITY_CHANGE |
216 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
217 XCB_EVENT_MASK_FOCUS_CHANGE |
218 XCB_EVENT_MASK_PROPERTY_CHANGE |
219 XCB_EVENT_MASK_COLOR_MAP_CHANGE);
220 mask_list[2] = XCB_EVENT_MASK_NO_EVENT;
221
222 win = xcb_generate_id(_ecore_xcb_conn);
223 xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT,
224 win, parent, x, y, w, h, 0,
225 XCB_WINDOW_CLASS_INPUT_ONLY,
226 XCB_COPY_FROM_PARENT, mask, mask_list);
227
228 return win;
229}
230
231/**
232 * Creates a new window.
233 * @param parent The parent window to use. If @p parent is @c 0, the root
234 * window of the default display is used.
235 * @param x X position.
236 * @param y Y position.
237 * @param w Width.
238 * @param h Height.
239 * @return The new window handle.
240 * @ingroup Ecore_X_Window_Create_Group
241 */
242EAPI Ecore_X_Window
243ecore_x_window_manager_argb_new(Ecore_X_Window parent,
244 int x,
245 int y,
246 int w,
247 int h)
248{
249 Ecore_X_Window win = 0;
250
251 LOGFN(__FILE__, __LINE__, __FUNCTION__);
252
253 win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 1, 0);
254
255 return win;
256}
257
258/**
259 * Creates a new window.
260 * @param parent The parent window to use. If @p parent is @c 0, the root
261 * window of the default display is used.
262 * @param x X position.
263 * @param y Y position.
264 * @param w Width.
265 * @param h Height.
266 * @return The new window handle.
267 * @ingroup Ecore_X_Window_Create_Group
268 */
269EAPI Ecore_X_Window
270ecore_x_window_argb_new(Ecore_X_Window parent,
271 int x,
272 int y,
273 int w,
274 int h)
275{
276 Ecore_X_Window win = 0;
277
278 LOGFN(__FILE__, __LINE__, __FUNCTION__);
279
280 win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 0, 0);
281
282 return win;
283}
284
285/**
286 * Creates a window with the override redirect attribute set to @c True.
287 * @param parent The parent window to use. If @p parent is @c 0, the root
288 * window of the default display is used.
289 * @param x X position.
290 * @param y Y position.
291 * @param w Width.
292 * @param h Height.
293 * @return The new window handle.
294 * @ingroup Ecore_X_Window_Create_Group
295 */
296EAPI Ecore_X_Window
297ecore_x_window_override_argb_new(Ecore_X_Window parent,
298 int x,
299 int y,
300 int w,
301 int h)
302{
303 Ecore_X_Window win = 0;
304
305 LOGFN(__FILE__, __LINE__, __FUNCTION__);
306
307 win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 1, 0);
308
309 return win;
310}
311
312/**
313 * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
314 *
315 * Functions to destroy X windows.
316 */
317
318/**
319 * Deletes the given window.
320 * @param win The given window.
321 * @ingroup Ecore_X_Window_Destroy_Group
322 */
323EAPI void
324ecore_x_window_free(Ecore_X_Window win)
325{
326 LOGFN(__FILE__, __LINE__, __FUNCTION__);
327 CHECK_XCB_CONN;
328
329 if (win)
330 {
331 /* xcb_destroy_notify_event_t ev; */
332 /* Ecore_X_Window root; */
333
334 /* if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1) */
335 /* root = ((xcb_screen_t *)_ecore_xcb_screen)->root; */
336 /* else */
337 /* { */
338 /* xcb_get_geometry_cookie_t cookie; */
339 /* xcb_get_geometry_reply_t *reply; */
340
341 /* cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); */
342 /* reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); */
343 /* if (!reply) return; */
344 /* root = reply->root; */
345 /* free(reply); */
346 /* } */
347
348 /* memset(&ev, 0, sizeof(xcb_destroy_notify_event_t)); */
349
350 /* ev.response_type = XCB_DESTROY_NOTIFY; */
351 /* ev.window = win; */
352 /* ev.event = root; */
353
354 /* xcb_send_event(_ecore_xcb_conn, 0, root, */
355 /* XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | */
356 /* XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, */
357 /* (const char *)&ev); */
358
359 xcb_destroy_window(_ecore_xcb_conn, win);
360// ecore_x_flush();
361 }
362}
363
364/**
365 * Sends a delete request to the given window.
366 * @param win The given window.
367 * @ingroup Ecore_X_Window_Destroy_Group
368 */
369EAPI void
370ecore_x_window_delete_request_send(Ecore_X_Window win)
371{
372 LOGFN(__FILE__, __LINE__, __FUNCTION__);
373
374 if (!win) return;
375 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
376 XCB_EVENT_MASK_NO_EVENT,
377 ECORE_X_ATOM_WM_DELETE_WINDOW,
378 XCB_CURRENT_TIME, 0, 0, 0);
379}
380
381EAPI void
382ecore_x_window_configure(Ecore_X_Window win,
383 Ecore_X_Window_Configure_Mask mask,
384 int x,
385 int y,
386 int w,
387 int h,
388 int border_width,
389 Ecore_X_Window sibling,
390 int stack_mode)
391{
392 uint16_t vmask = 0;
393 uint32_t vlist[7];
394 unsigned int i = 0;
395
396 LOGFN(__FILE__, __LINE__, __FUNCTION__);
397 CHECK_XCB_CONN;
398
399 if (!win) return;
400
401 if (mask & XCB_CONFIG_WINDOW_X)
402 {
403 vmask |= XCB_CONFIG_WINDOW_X;
404 vlist[i++] = x;
405 }
406 if (mask & XCB_CONFIG_WINDOW_Y)
407 {
408 vmask |= XCB_CONFIG_WINDOW_Y;
409 vlist[i++] = y;
410 }
411 if (mask & XCB_CONFIG_WINDOW_WIDTH)
412 {
413 vmask |= XCB_CONFIG_WINDOW_WIDTH;
414 vlist[i++] = w;
415 }
416 if (mask & XCB_CONFIG_WINDOW_HEIGHT)
417 {
418 vmask |= XCB_CONFIG_WINDOW_HEIGHT;
419 vlist[i++] = h;
420 }
421 if (mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
422 {
423 vmask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
424 vlist[i++] = border_width;
425 }
426 if (mask & XCB_CONFIG_WINDOW_SIBLING)
427 {
428 vmask |= XCB_CONFIG_WINDOW_SIBLING;
429 vlist[i++] = sibling;
430 }
431 if (mask & XCB_CONFIG_WINDOW_STACK_MODE)
432 {
433 vmask |= XCB_CONFIG_WINDOW_STACK_MODE;
434 vlist[i++] = stack_mode;
435 }
436
437 xcb_configure_window(_ecore_xcb_conn, win, vmask,
438 (const uint32_t *)&vlist);
439// ecore_x_flush();
440}
441
442/**
443 * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
444 *
445 * Functions that change or retrieve the geometry of X windows.
446 */
447
448/**
449 * Moves a window to the position @p x, @p y.
450 *
451 * The position is relative to the upper left hand corner of the
452 * parent window.
453 *
454 * @param win The window to move.
455 * @param x X position.
456 * @param y Y position.
457 * @ingroup Ecore_X_Window_Geometry_Group
458 */
459EAPI void
460ecore_x_window_move(Ecore_X_Window win,
461 int x,
462 int y)
463{
464 uint32_t list[2], mask;
465
466 LOGFN(__FILE__, __LINE__, __FUNCTION__);
467 CHECK_XCB_CONN;
468
469 if (!win) return;
470
471 mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y);
472 list[0] = x;
473 list[1] = y;
474
475 xcb_configure_window(_ecore_xcb_conn, win, mask,
476 (const uint32_t *)&list);
477// ecore_x_flush();
478}
479
480/**
481 * Resizes a window.
482 * @param win The window to resize.
483 * @param w New width of the window.
484 * @param h New height of the window.
485 * @ingroup Ecore_X_Window_Geometry_Group
486 */
487EAPI void
488ecore_x_window_resize(Ecore_X_Window win,
489 int w,
490 int h)
491{
492 uint32_t list[2], mask;
493
494 LOGFN(__FILE__, __LINE__, __FUNCTION__);
495 CHECK_XCB_CONN;
496
497 if (!win) return;
498 if (w < 1) w = 1;
499 if (h < 1) h = 1;
500
501 mask = (XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT);
502 list[0] = w;
503 list[1] = h;
504
505 xcb_configure_window(_ecore_xcb_conn, win, mask,
506 (const uint32_t *)&list);
507// ecore_x_flush();
508}
509
510/**
511 * Moves and resizes a window.
512 * @param win The window to move and resize.
513 * @param x New X position of the window.
514 * @param y New Y position of the window.
515 * @param w New width of the window.
516 * @param h New height of the window.
517 * @ingroup Ecore_X_Window_Geometry_Group
518 */
519EAPI void
520ecore_x_window_move_resize(Ecore_X_Window win,
521 int x,
522 int y,
523 int w,
524 int h)
525{
526 uint32_t list[4], mask;
527
528 LOGFN(__FILE__, __LINE__, __FUNCTION__);
529 CHECK_XCB_CONN;
530
531 if (!win) return;
532 if (w < 1) w = 1;
533 if (h < 1) h = 1;
534
535 mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
536 XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT);
537 list[0] = x;
538 list[1] = y;
539 list[2] = w;
540 list[3] = h;
541
542 xcb_configure_window(_ecore_xcb_conn, win, mask,
543 (const uint32_t *)&list);
544// ecore_x_flush();
545}
546
547/**
548 * Retrieves the width of the border of the given window.
549 * @param win The given window.
550 * @return Width of the border of @p win.
551 * @ingroup Ecore_X_Window_Geometry_Group
552 */
553EAPI int
554ecore_x_window_border_width_get(Ecore_X_Window win)
555{
556 LOGFN(__FILE__, __LINE__, __FUNCTION__);
557
558 if (!win) return 0;
559 return ecore_x_drawable_border_width_get(win);
560}
561
562/**
563 * Sets the width of the border of the given window.
564 * @param win The given window.
565 * @param width The new border width.
566 * @ingroup Ecore_X_Window_Geometry_Group
567 */
568EAPI void
569ecore_x_window_border_width_set(Ecore_X_Window win,
570 int border_width)
571{
572 uint32_t list;
573
574 LOGFN(__FILE__, __LINE__, __FUNCTION__);
575 CHECK_XCB_CONN;
576
577 if (!win) return;
578
579 list = border_width;
580
581 xcb_configure_window(_ecore_xcb_conn, win,
582 XCB_CONFIG_WINDOW_BORDER_WIDTH, &list);
583// ecore_x_flush();
584}
585
586/**
587 * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions
588 *
589 * Functions that change the Z order of X windows.
590 */
591
592/**
593 * Raises the given window.
594 * @param win The window to raise.
595 * @ingroup Ecore_X_Window_Z_Order_Group
596 */
597EAPI void
598ecore_x_window_raise(Ecore_X_Window win)
599{
600 uint32_t list[] = { XCB_STACK_MODE_ABOVE };
601
602 LOGFN(__FILE__, __LINE__, __FUNCTION__);
603 CHECK_XCB_CONN;
604
605 xcb_configure_window(_ecore_xcb_conn, win,
606 XCB_CONFIG_WINDOW_STACK_MODE, list);
607// ecore_x_flush();
608}
609
610/**
611 * Lowers the given window.
612 * @param win The window to lower.
613 * @ingroup Ecore_X_Window_Z_Order_Group
614 */
615EAPI void
616ecore_x_window_lower(Ecore_X_Window win)
617{
618 uint32_t list[] = { XCB_STACK_MODE_BELOW };
619
620 LOGFN(__FILE__, __LINE__, __FUNCTION__);
621 CHECK_XCB_CONN;
622
623 xcb_configure_window(_ecore_xcb_conn, win,
624 XCB_CONFIG_WINDOW_STACK_MODE, list);
625// ecore_x_flush();
626}
627
628/**
629 * Retrieves the depth of the given window.
630 * @param win The given window.
631 * @return Depth of the window.
632 */
633EAPI int
634ecore_x_window_depth_get(Ecore_X_Window win)
635{
636 LOGFN(__FILE__, __LINE__, __FUNCTION__);
637
638 return ecore_x_drawable_depth_get(win);
639}
640
641/**
642 * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions
643 *
644 * Functions that set window properties.
645 */
646
647/**
648 * Sets the default properties for the given window.
649 *
650 * The default properties set for the window are @c WM_CLIENT_MACHINE and
651 * @c _NET_WM_PID.
652 *
653 * @param win The given window.
654 * @ingroup Ecore_X_Window_Properties_Group
655 */
656EAPI void
657ecore_x_window_defaults_set(Ecore_X_Window win)
658{
659 char buff[MAXHOSTNAMELEN], **argv;
660 int argc;
661 pid_t pid;
662
663 LOGFN(__FILE__, __LINE__, __FUNCTION__);
664 CHECK_XCB_CONN;
665
666 gethostname(buff, MAXHOSTNAMELEN);
667 buff[MAXHOSTNAMELEN - 1] = '\0';
668
669 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
670 ECORE_X_ATOM_WM_CLIENT_MACHINE, ECORE_X_ATOM_STRING,
671 8, strlen(buff), buff);
672
673 pid = getpid();
674 ecore_x_netwm_pid_set(win, pid);
675 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
676 ecore_app_args_get(&argc, &argv);
677 ecore_x_icccm_command_set(win, argc, argv);
678}
679
680/**
681 * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
682 *
683 * Functions to access and change the visibility of X windows.
684 */
685
686/**
687 * Shows a window.
688 *
689 * Synonymous to "mapping" a window in X Window System terminology.
690 *
691 * @param win The window to show.
692 * @ingroup Ecore_X_Window_Visibility
693 */
694EAPI void
695ecore_x_window_show(Ecore_X_Window win)
696{
697 LOGFN(__FILE__, __LINE__, __FUNCTION__);
698 CHECK_XCB_CONN;
699
700 if (win)
701 xcb_map_window(_ecore_xcb_conn, win);
702}
703
704/**
705 * Hides a window.
706 *
707 * Synonymous to "unmapping" a window in X Window System terminology.
708 *
709 * @param win The window to hide.
710 * @ingroup Ecore_X_Window_Visibility
711 */
712EAPI void
713ecore_x_window_hide(Ecore_X_Window win)
714{
715 LOGFN(__FILE__, __LINE__, __FUNCTION__);
716 CHECK_XCB_CONN;
717
718 if (win)
719 {
720 xcb_unmap_notify_event_t ev;
721 Ecore_X_Window root;
722
723 if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1)
724 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
725 else
726 {
727 xcb_get_geometry_cookie_t cookie;
728 xcb_get_geometry_reply_t *reply;
729
730 cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win);
731 reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
732 if (!reply) return;
733 root = reply->root;
734 free(reply);
735 }
736
737 memset(&ev, 0, sizeof(xcb_unmap_notify_event_t));
738
739 ev.response_type = XCB_UNMAP_NOTIFY;
740 ev.window = win;
741 ev.event = root;
742 ev.from_configure = 0;
743
744 xcb_send_event(_ecore_xcb_conn, 0, root,
745 (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
746 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT),
747 (const char *)&ev);
748
749 xcb_unmap_window(_ecore_xcb_conn, win);
750// ecore_x_flush();
751 }
752}
753
754/**
755 * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions
756 *
757 * Functions that give the focus to an X Window.
758 */
759
760/**
761 * Sets the focus to the window @p win.
762 * @param win The window to focus.
763 * @ingroup Ecore_X_Window_Focus_Functions
764 */
765EAPI void
766ecore_x_window_focus(Ecore_X_Window win)
767{
768 LOGFN(__FILE__, __LINE__, __FUNCTION__);
769 CHECK_XCB_CONN;
770
771 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
772
773 xcb_set_input_focus(_ecore_xcb_conn,
774 XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME);
775// ecore_x_flush();
776}
777
778/**
779 * Sets the focus to the given window at a specific time.
780 * @param win The window to focus.
781 * @param t When to set the focus to the window.
782 * @ingroup Ecore_X_Window_Focus_Functions
783 */
784EAPI void
785ecore_x_window_focus_at_time(Ecore_X_Window win,
786 Ecore_X_Time time __UNUSED__)
787{
788 LOGFN(__FILE__, __LINE__, __FUNCTION__);
789 CHECK_XCB_CONN;
790
791 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
792 xcb_set_input_focus(_ecore_xcb_conn,
793 XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME);
794// ecore_x_flush();
795}
796
797/**
798 * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions
799 *
800 * Functions that retrieve or changes the parent window of a window.
801 */
802
803/**
804 * Moves a window to within another window at a given position.
805 * @param win The window to reparent.
806 * @param new_parent The new parent window.
807 * @param x X position within new parent window.
808 * @param y Y position within new parent window.
809 * @ingroup Ecore_X_Window_Parent_Group
810 */
811EAPI void
812ecore_x_window_reparent(Ecore_X_Window win,
813 Ecore_X_Window parent,
814 int x,
815 int y)
816{
817 LOGFN(__FILE__, __LINE__, __FUNCTION__);
818 CHECK_XCB_CONN;
819
820 if (parent == 0)
821 parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
822
823 xcb_reparent_window(_ecore_xcb_conn, win, parent, x, y);
824// ecore_x_flush();
825}
826
827EAPI void
828ecore_x_window_pixmap_set(Ecore_X_Window win,
829 Ecore_X_Pixmap pixmap)
830{
831 uint32_t list;
832
833 LOGFN(__FILE__, __LINE__, __FUNCTION__);
834 CHECK_XCB_CONN;
835
836 list = pixmap;
837
838 xcb_change_window_attributes(_ecore_xcb_conn, win,
839 XCB_CW_BACK_PIXMAP, &list);
840// ecore_x_flush();
841}
842
843/**
844 * Sets the background color of the given window.
845 * @param win The given window
846 * @param r red value (0...65536, 16 bits)
847 * @param g green value (0...65536, 16 bits)
848 * @param b blue value (0...65536, 16 bits)
849 */
850EAPI void
851ecore_x_window_background_color_set(Ecore_X_Window win,
852 unsigned short red,
853 unsigned short green,
854 unsigned short blue)
855{
856 xcb_alloc_color_cookie_t cookie;
857 xcb_alloc_color_reply_t *reply;
858 uint32_t list;
859
860 LOGFN(__FILE__, __LINE__, __FUNCTION__);
861 CHECK_XCB_CONN;
862
863 cookie =
864 xcb_alloc_color_unchecked(_ecore_xcb_conn,
865 ((xcb_screen_t *)_ecore_xcb_screen)->default_colormap,
866 red, green, blue);
867 reply = xcb_alloc_color_reply(_ecore_xcb_conn, cookie, NULL);
868 if (!reply) return;
869 list = reply->pixel;
870 free(reply);
871
872 xcb_change_window_attributes(_ecore_xcb_conn, win,
873 XCB_CW_BACK_PIXEL, &list);
874// ecore_x_flush();
875}
876
877EAPI void
878ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
879 Ecore_X_Gravity gravity)
880{
881 uint32_t list;
882
883 LOGFN(__FILE__, __LINE__, __FUNCTION__);
884 CHECK_XCB_CONN;
885
886 list = gravity;
887
888 xcb_change_window_attributes(_ecore_xcb_conn, win,
889 XCB_CW_BIT_GRAVITY, &list);
890// ecore_x_flush();
891}
892
893EAPI void
894ecore_x_window_gravity_set(Ecore_X_Window win,
895 Ecore_X_Gravity gravity)
896{
897 uint32_t list;
898
899 LOGFN(__FILE__, __LINE__, __FUNCTION__);
900 CHECK_XCB_CONN;
901
902 list = gravity;
903
904 xcb_change_window_attributes(_ecore_xcb_conn, win,
905 XCB_CW_WIN_GRAVITY, &list);
906// ecore_x_flush();
907}
908
909EAPI void
910ecore_x_window_override_set(Ecore_X_Window win,
911 Eina_Bool override)
912{
913 uint32_t list;
914
915 LOGFN(__FILE__, __LINE__, __FUNCTION__);
916 CHECK_XCB_CONN;
917
918 list = override;
919
920 xcb_change_window_attributes(_ecore_xcb_conn, win,
921 XCB_CW_OVERRIDE_REDIRECT, &list);
922// ecore_x_flush();
923}
924
925/**
926 * To be documented.
927 *
928 * FIXME: To be fixed.
929 */
930EAPI void
931ecore_x_window_cursor_show(Ecore_X_Window win,
932 Eina_Bool show)
933{
934 uint32_t list = 0;
935
936 LOGFN(__FILE__, __LINE__, __FUNCTION__);
937 CHECK_XCB_CONN;
938
939 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
940
941 if (!show)
942 {
943 Ecore_X_Cursor cursor;
944 Ecore_X_Pixmap p, m;
945 Ecore_X_GC gc;
946 xcb_point_t point;
947
948 p = xcb_generate_id(_ecore_xcb_conn);
949 xcb_create_pixmap(_ecore_xcb_conn, 1, p, win, 1, 1);
950 m = xcb_generate_id(_ecore_xcb_conn);
951 xcb_create_pixmap(_ecore_xcb_conn, 1, m, win, 1, 1);
952 gc = xcb_generate_id(_ecore_xcb_conn);
953 xcb_create_gc(_ecore_xcb_conn, gc, win, 0, NULL);
954 xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_FOREGROUND, &list);
955 point.x = 0;
956 point.y = 0;
957 xcb_poly_point(_ecore_xcb_conn, XCB_COORD_MODE_ORIGIN,
958 win, gc, 1, &point);
959 xcb_free_gc(_ecore_xcb_conn, gc);
960
961 cursor = xcb_generate_id(_ecore_xcb_conn);
962 xcb_create_cursor(_ecore_xcb_conn, cursor,
963 p, m, 0, 0, 0, 0, 0, 0, 0, 0);
964 list = cursor;
965
966 xcb_change_window_attributes(_ecore_xcb_conn, win,
967 XCB_CW_CURSOR, &list);
968
969 xcb_free_cursor(_ecore_xcb_conn, cursor);
970 xcb_free_pixmap(_ecore_xcb_conn, m);
971 xcb_free_pixmap(_ecore_xcb_conn, p);
972 }
973 else
974 {
975 xcb_change_window_attributes(_ecore_xcb_conn, win,
976 XCB_CW_CURSOR, &list);
977 }
978// ecore_x_flush();
979}
980
981EAPI void
982ecore_x_window_cursor_set(Ecore_X_Window win,
983 Ecore_X_Cursor cursor)
984{
985 uint32_t list;
986
987 LOGFN(__FILE__, __LINE__, __FUNCTION__);
988 CHECK_XCB_CONN;
989
990 list = cursor;
991
992 xcb_change_window_attributes(_ecore_xcb_conn, win, XCB_CW_CURSOR, &list);
993// ecore_x_flush();
994}
995
996EAPI void
997ecore_x_window_container_manage(Ecore_X_Window win)
998{
999 uint32_t list;
1000
1001 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1002 CHECK_XCB_CONN;
1003
1004 list = (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
1005 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY);
1006
1007 xcb_change_window_attributes(_ecore_xcb_conn, win,
1008 XCB_CW_EVENT_MASK, &list);
1009// ecore_x_flush();
1010}
1011
1012EAPI void
1013ecore_x_window_client_manage(Ecore_X_Window win)
1014{
1015 uint32_t list;
1016
1017 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1018 CHECK_XCB_CONN;
1019
1020 list = (XCB_EVENT_MASK_VISIBILITY_CHANGE |
1021 XCB_EVENT_MASK_FOCUS_CHANGE |
1022 XCB_EVENT_MASK_PROPERTY_CHANGE |
1023 XCB_EVENT_MASK_COLOR_MAP_CHANGE |
1024 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
1025 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY);
1026
1027 xcb_change_window_attributes(_ecore_xcb_conn, win,
1028 XCB_CW_EVENT_MASK, &list);
1029
1030#ifdef ECORE_XCB_SHAPE
1031 xcb_shape_select_input(_ecore_xcb_conn, win, EINA_TRUE);
1032#endif
1033// ecore_x_flush();
1034}
1035
1036EAPI void
1037ecore_x_window_sniff(Ecore_X_Window win)
1038{
1039 uint32_t list;
1040
1041 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1042 CHECK_XCB_CONN;
1043
1044 list = (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
1045 XCB_EVENT_MASK_PROPERTY_CHANGE);
1046
1047 xcb_change_window_attributes(_ecore_xcb_conn, win,
1048 XCB_CW_EVENT_MASK, &list);
1049// ecore_x_flush();
1050}
1051
1052EAPI void
1053ecore_x_window_client_sniff(Ecore_X_Window win)
1054{
1055 uint32_t list;
1056
1057 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1058 CHECK_XCB_CONN;
1059
1060 list = (XCB_EVENT_MASK_VISIBILITY_CHANGE |
1061 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
1062 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
1063 XCB_EVENT_MASK_FOCUS_CHANGE |
1064 XCB_EVENT_MASK_PROPERTY_CHANGE |
1065 XCB_EVENT_MASK_COLOR_MAP_CHANGE);
1066
1067 xcb_change_window_attributes(_ecore_xcb_conn, win,
1068 XCB_CW_EVENT_MASK, &list);
1069#ifdef ECORE_XCB_SHAPE
1070 xcb_shape_select_input(_ecore_xcb_conn, win, EINA_TRUE);
1071#endif
1072// ecore_x_flush();
1073}
1074
1075EAPI void
1076ecore_x_window_area_clear(Ecore_X_Window win,
1077 int x,
1078 int y,
1079 int w,
1080 int h)
1081{
1082 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1083 CHECK_XCB_CONN;
1084
1085 xcb_clear_area(_ecore_xcb_conn, 0, win, x, y, w, h);
1086// ecore_x_flush();
1087}
1088
1089EAPI void
1090ecore_x_window_area_expose(Ecore_X_Window win,
1091 int x,
1092 int y,
1093 int w,
1094 int h)
1095{
1096 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1097 CHECK_XCB_CONN;
1098
1099 xcb_clear_area(_ecore_xcb_conn, 1, win, x, y, w, h);
1100// ecore_x_flush();
1101}
1102
1103EAPI void
1104ecore_x_window_save_set_add(Ecore_X_Window win)
1105{
1106 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1107 CHECK_XCB_CONN;
1108
1109 xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_INSERT, win);
1110}
1111
1112EAPI void
1113ecore_x_window_save_set_del(Ecore_X_Window win)
1114{
1115 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1116 CHECK_XCB_CONN;
1117
1118 xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_DELETE, win);
1119}
1120
1121/**
1122 * gets the window that has focus.
1123 * @return The window that has focus.
1124 * @ingroup Ecore_X_Window_Focus_Functions
1125 */
1126EAPI Ecore_X_Window
1127ecore_x_window_focus_get(void)
1128{
1129 xcb_get_input_focus_cookie_t cookie;
1130 xcb_get_input_focus_reply_t *reply;
1131 Ecore_X_Window focus = 0;
1132
1133 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1134 CHECK_XCB_CONN;
1135
1136 cookie = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
1137 reply = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie, NULL);
1138 if (!reply) return 0;
1139 focus = reply->focus;
1140 free(reply);
1141 return focus;
1142}
1143
1144EAPI int
1145ecore_x_window_argb_get(Ecore_X_Window win)
1146{
1147 uint8_t ret = 0;
1148#ifdef ECORE_XCB_RENDER
1149 Ecore_X_Visual visual;
1150#endif
1151
1152 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1153 CHECK_XCB_CONN;
1154
1155// if (!win) return ret;
1156
1157#ifdef ECORE_XCB_RENDER
1158 /* grab the window's visual */
1159 visual = _ecore_xcb_window_visual_get(win);
1160
1161 /* check if this visual supports alpha */
1162 ret = _ecore_xcb_render_visual_supports_alpha(visual);
1163#endif
1164
1165 return ret;
1166}
1167
1168EAPI Eina_Bool
1169ecore_x_window_manage(Ecore_X_Window win)
1170{
1171 xcb_get_window_attributes_cookie_t cookie;
1172 xcb_get_window_attributes_reply_t *reply;
1173 xcb_void_cookie_t change_cookie;
1174 xcb_generic_error_t *err;
1175 uint32_t list;
1176
1177 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1178 CHECK_XCB_CONN;
1179
1180 cookie = xcb_get_window_attributes(_ecore_xcb_conn, win);
1181 reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
1182 if (!reply) return EINA_FALSE;
1183
1184 ecore_x_sync(); // needed
1185
1186 list = (XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
1187 XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_RESIZE_REDIRECT |
1188 XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
1189 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
1190 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
1191 XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
1192 reply->your_event_mask);
1193 free(reply);
1194
1195 change_cookie = xcb_change_window_attributes(_ecore_xcb_conn, win,
1196 XCB_CW_EVENT_MASK, &list);
1197
1198 ecore_x_sync(); // needed
1199
1200 err = xcb_request_check(_ecore_xcb_conn, change_cookie);
1201 if (err)
1202 {
1203 _ecore_xcb_error_handle(err);
1204 free(err);
1205 return EINA_FALSE;
1206 }
1207
1208 return EINA_TRUE;
1209}
1210
1211EAPI Eina_Bool
1212ecore_x_window_attributes_get(Ecore_X_Window win,
1213 Ecore_X_Window_Attributes *att_ret)
1214{
1215 xcb_get_window_attributes_cookie_t cookie;
1216 xcb_get_window_attributes_reply_t *reply;
1217 xcb_get_geometry_cookie_t gcookie;
1218 xcb_get_geometry_reply_t *greply;
1219
1220 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1221 CHECK_XCB_CONN;
1222
1223 cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win);
1224 reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
1225 if (!reply) return EINA_FALSE;
1226
1227 memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes));
1228
1229 if (reply->map_state != XCB_MAP_STATE_UNMAPPED)
1230 att_ret->visible = EINA_TRUE;
1231
1232 if (reply->map_state == XCB_MAP_STATE_VIEWABLE)
1233 att_ret->viewable = EINA_TRUE;
1234
1235 if (reply->override_redirect)
1236 att_ret->override = EINA_TRUE;
1237
1238 if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY)
1239 att_ret->input_only = EINA_TRUE;
1240
1241 if (reply->save_under)
1242 att_ret->save_under = EINA_TRUE;
1243
1244 att_ret->event_mask.mine = reply->your_event_mask;
1245 att_ret->event_mask.all = reply->all_event_masks;
1246 att_ret->event_mask.no_propagate = reply->do_not_propagate_mask;
1247 att_ret->window_gravity = reply->win_gravity;
1248 att_ret->pixel_gravity = reply->bit_gravity;
1249 att_ret->colormap = reply->colormap;
1250 att_ret->visual = _ecore_xcb_window_find_visual_by_id(reply->visual);
1251
1252 free(reply);
1253
1254 gcookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win);
1255 greply = xcb_get_geometry_reply(_ecore_xcb_conn, gcookie, NULL);
1256 if (!greply) return EINA_TRUE;
1257
1258 /* xcb_translate_coordinates_reply_t *trans; */
1259 /* xcb_query_tree_cookie_t tcookie; */
1260 /* xcb_query_tree_reply_t *treply; */
1261
1262 /* tcookie = xcb_query_tree(_ecore_xcb_conn, win); */
1263 /* treply = xcb_query_tree_reply(_ecore_xcb_conn, tcookie, NULL); */
1264
1265 /* trans = */
1266 /* xcb_translate_coordinates_reply(_ecore_xcb_conn, */
1267 /* xcb_translate_coordinates(_ecore_xcb_conn, */
1268 /* win, treply->parent, greply->x, greply->y), NULL); */
1269 /* free(treply); */
1270
1271 att_ret->root = greply->root;
1272 att_ret->depth = greply->depth;
1273// att_ret->x = trans->dst_x;
1274// att_ret->y = trans->dst_y;
1275 att_ret->x = greply->x;
1276 att_ret->y = greply->y;
1277 att_ret->w = greply->width;
1278 att_ret->h = greply->height;
1279 att_ret->border = greply->border_width;
1280
1281// free(trans);
1282
1283 free(greply);
1284 return EINA_TRUE;
1285}
1286
1287/**
1288 * Retrieves the size of the given window.
1289 * @param win The given window.
1290 * @param w Pointer to an integer into which the width is to be stored.
1291 * @param h Pointer to an integer into which the height is to be stored.
1292 * @ingroup Ecore_X_Window_Geometry_Group
1293 */
1294EAPI void
1295ecore_x_window_size_get(Ecore_X_Window win,
1296 int *width,
1297 int *height)
1298{
1299 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1300 CHECK_XCB_CONN;
1301
1302 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1303 ecore_x_drawable_geometry_get(win, NULL, NULL, width, height);
1304}
1305
1306/**
1307 * Set if a window should be ignored.
1308 * @param win The given window.
1309 * @param ignore if to ignore
1310 */
1311EAPI void
1312ecore_x_window_ignore_set(Ecore_X_Window win,
1313 int ignore)
1314{
1315 int i = 0, j = 0, count = 0;
1316
1317 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1318 CHECK_XCB_CONN;
1319
1320 if (ignore)
1321 {
1322 if (ignore_list)
1323 {
1324 for (i = 0; i < ignore_num; i++)
1325 if (win == ignore_list[i]) return;
1326
1327 ignore_list =
1328 realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
1329 if (!ignore_list) return;
1330
1331 ignore_list[ignore_num++] = win;
1332 }
1333 else
1334 {
1335 ignore_num = 0;
1336 ignore_list = malloc(sizeof(Ecore_X_Window));
1337 if (!ignore_list) return;
1338 ignore_list[ignore_num++] = win;
1339 }
1340 }
1341 else
1342 {
1343 if (!ignore_list) return;
1344 for (count = ignore_num, i = 0, j = 0; i < count; i++)
1345 {
1346 if (win != ignore_list[i])
1347 ignore_list[j++] = ignore_list[i];
1348 else
1349 ignore_num--;
1350 }
1351 if (ignore_num <= 0)
1352 {
1353 free(ignore_list);
1354 ignore_list = NULL;
1355 return;
1356 }
1357
1358 ignore_list =
1359 realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
1360 }
1361}
1362
1363/**
1364 * Get the ignore list
1365 * @param num number of windows in the list
1366 * @return list of windows to ignore
1367 */
1368EAPI Ecore_X_Window *
1369ecore_x_window_ignore_list(int *num)
1370{
1371 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1372
1373 if (num) *num = ignore_num;
1374 return ignore_list;
1375}
1376
1377/**
1378 * Get a list of all the root windows on the server.
1379 *
1380 * @note The returned array will need to be freed after use.
1381 * @param num_ret Pointer to integer to put number of windows returned in.
1382 * @return An array of all the root windows. @c NULL is returned if memory
1383 * could not be allocated for the list, or if @p num_ret is @c NULL.
1384 */
1385EAPI Ecore_X_Window *
1386ecore_x_window_root_list(int *num_ret)
1387{
1388 xcb_screen_iterator_t iter;
1389 uint8_t i, num;
1390 Ecore_X_Window *roots = NULL;
1391#ifdef ECORE_XCB_XPRINT
1392 const xcb_query_extension_reply_t *ext_reply;
1393#endif
1394
1395 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1396 CHECK_XCB_CONN;
1397
1398 if (!num_ret) return NULL;
1399 if (num_ret) *num_ret = 0;
1400
1401 /* if (xcb_connection_has_error(_ecore_xcb_conn)) */
1402 /* { */
1403 /* DBG("XCB Connection Has Error !!!"); */
1404 /* return NULL; */
1405 /* } */
1406
1407 num = ecore_x_screen_count_get();
1408
1409#ifdef ECORE_XCB_XPRINT
1410 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_x_print_id);
1411 if ((ext_reply) && (ext_reply->present))
1412 {
1413 xcb_x_print_print_query_screens_cookie_t cookie;
1414 xcb_x_print_print_query_screens_reply_t *reply;
1415
1416 cookie = xcb_x_print_print_query_screens_unchecked(_ecore_xcb_conn);
1417 reply =
1418 xcb_x_print_print_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
1419 if (reply)
1420 {
1421 xcb_window_t *screens;
1422 int psnum = 0, overlap = 0, j = 0, k = 0;
1423
1424 psnum = xcb_x_print_print_query_screens_roots_length(reply);
1425 screens = xcb_x_print_print_query_screens_roots(reply);
1426 for (i = 0; i < num; i++)
1427 {
1428 for (j = 0; j < psnum; j++)
1429 {
1430 xcb_screen_t *s;
1431
1432 if ((s = _ecore_xcb_window_screen_of_display(i)))
1433 {
1434 if (s->root == screens[j])
1435 overlap++;
1436 }
1437 }
1438 }
1439 if (!(roots = malloc((num - overlap)
1440 * sizeof(Ecore_X_Window)))) return NULL;
1441 for (i = 0; i < num; i++)
1442 {
1443 Eina_Bool is_print = EINA_FALSE;
1444
1445 for (j = 0; j < psnum; j++)
1446 {
1447 xcb_screen_t *s;
1448
1449 if ((s = _ecore_xcb_window_screen_of_display(i)))
1450 {
1451 if (s->root == screens[j])
1452 {
1453 is_print = EINA_TRUE;
1454 break;
1455 }
1456 }
1457 }
1458 if (!is_print)
1459 {
1460 xcb_screen_t *s;
1461
1462 if ((s = _ecore_xcb_window_screen_of_display(i)))
1463 {
1464 roots[k] = s->root;
1465 k++;
1466 }
1467 }
1468 }
1469 if (num_ret) *num_ret = k;
1470 free(reply);
1471 }
1472 else
1473 {
1474 /* Fallback to default method */
1475 iter =
1476 xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
1477 if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL;
1478 if (num_ret) *num_ret = num;
1479 for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
1480 roots[i] = iter.data->root;
1481 }
1482 }
1483 else
1484 {
1485 /* Fallback to default method */
1486 iter =
1487 xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
1488 if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL;
1489 if (num_ret) *num_ret = num;
1490 for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
1491 roots[i] = iter.data->root;
1492 }
1493#else
1494 iter =
1495 xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
1496 if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL;
1497 if (num_ret) *num_ret = num;
1498 for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
1499 roots[i] = iter.data->root;
1500#endif
1501
1502 return roots;
1503}
1504
1505EAPI Ecore_X_Window *
1506ecore_x_window_children_get(Ecore_X_Window win,
1507 int *num)
1508{
1509 xcb_query_tree_cookie_t cookie;
1510 xcb_query_tree_reply_t *reply;
1511 Ecore_X_Window *windows = NULL;
1512
1513 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1514 CHECK_XCB_CONN;
1515
1516 if (num) *num = 0;
1517 cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, win);
1518 reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
1519 if (!reply) return NULL;
1520
1521 if (num) *num = reply->children_len;
1522 if (reply->children_len > 0)
1523 {
1524 windows = malloc(sizeof(Ecore_X_Window) * reply->children_len);
1525 if (windows)
1526 {
1527 unsigned int i = 0;
1528 xcb_window_t *w;
1529
1530 w = xcb_query_tree_children(reply);
1531 for (i = 0; i < reply->children_len; i++)
1532 windows[i] = w[i];
1533 }
1534 }
1535
1536 free(reply);
1537 return windows;
1538}
1539
1540/**
1541 * Retrieves the root window a given window is on.
1542 * @param win The window to get the root window of
1543 * @return The root window of @p win
1544 * @ingroup Ecore_X_Window_Geometry_Group
1545 */
1546EAPI Ecore_X_Window
1547ecore_x_window_root_get(Ecore_X_Window win)
1548{
1549 xcb_get_geometry_cookie_t gcookie;
1550 xcb_get_geometry_reply_t *greply;
1551 Ecore_X_Window window = 0;
1552
1553 /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
1554 CHECK_XCB_CONN;
1555
1556 gcookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win);
1557 greply = xcb_get_geometry_reply(_ecore_xcb_conn, gcookie, NULL);
1558 if (!greply) return 0;
1559 window = greply->root;
1560 free(greply);
1561
1562 return window;
1563}
1564
1565EAPI Ecore_X_Window
1566ecore_x_window_root_first_get(void)
1567{
1568 return ((xcb_screen_t *)_ecore_xcb_screen)->root;
1569}
1570
1571/**
1572 * Retrieves the geometry of the given window.
1573 *
1574 * Note that the x & y coordingates are relative to your parent. In
1575 * particular for reparenting window managers - relative to you window border.
1576 * If you want screen coordinates either walk the window tree to the root,
1577 * else for ecore_evas applications see ecore_evas_geometry_get(). Elementary
1578 * applications can use elm_win_screen_position_get().
1579 *
1580 * @param win The given window.
1581 * @param x Pointer to an integer in which the X position is to be stored.
1582 * @param y Pointer to an integer in which the Y position is to be stored.
1583 * @param w Pointer to an integer in which the width is to be stored.
1584 * @param h Pointer to an integer in which the height is to be stored.
1585 * @ingroup Ecore_X_Window_Geometry_Group
1586 */
1587EAPI void
1588ecore_x_window_geometry_get(Ecore_X_Window win,
1589 int *x,
1590 int *y,
1591 int *w,
1592 int *h)
1593{
1594 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1595 CHECK_XCB_CONN;
1596
1597 if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1598 ecore_x_drawable_geometry_get(win, x, y, w, h);
1599}
1600
1601/**
1602 * Retrieves the top, visible window at the given location.
1603 * @param x The given X position.
1604 * @param y The given Y position.
1605 * @return The window at that position.
1606 * @ingroup Ecore_X_Window_Geometry_Group
1607 */
1608EAPI Ecore_X_Window
1609ecore_x_window_at_xy_get(int x,
1610 int y)
1611{
1612 Ecore_X_Window root, win = 0;
1613
1614 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1615 CHECK_XCB_CONN;
1616
1617 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1618
1619 ecore_x_grab();
1620 win = _ecore_xcb_window_at_xy_get(root, 0, 0, x, y, NULL, 0);
1621 ecore_x_ungrab();
1622
1623 return win ? win : root;
1624}
1625
1626/**
1627 * Retrieves the top, visible window at the given location,
1628 * but skips the windows in the list.
1629 * @param x The given X position.
1630 * @param y The given Y position.
1631 * @return The window at that position.
1632 * @ingroup Ecore_X_Window_Geometry_Group
1633 */
1634EAPI Ecore_X_Window
1635ecore_x_window_at_xy_with_skip_get(int x,
1636 int y,
1637 Ecore_X_Window *skip,
1638 int skip_num)
1639{
1640 Ecore_X_Window root, win = 0;
1641
1642 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1643 CHECK_XCB_CONN;
1644
1645 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1646
1647 ecore_x_grab();
1648 win = _ecore_xcb_window_at_xy_get(root, 0, 0, x, y, skip, skip_num);
1649 ecore_x_ungrab();
1650
1651 return win ? win : root;
1652}
1653
1654EAPI Ecore_X_Window
1655ecore_x_window_at_xy_begin_get(Ecore_X_Window begin,
1656 int x,
1657 int y)
1658{
1659 Ecore_X_Window win = 0;
1660
1661 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1662 CHECK_XCB_CONN;
1663
1664 ecore_x_grab();
1665 win = _ecore_xcb_window_at_xy_get(begin, 0, 0, x, y, NULL, 0);
1666 ecore_x_ungrab();
1667
1668 return win ? win : begin;
1669}
1670
1671/**
1672 * Retrieves the parent window of the given window.
1673 * @param win The given window.
1674 * @return The parent window of @p win.
1675 * @ingroup Ecore_X_Window_Parent_Group
1676 */
1677EAPI Ecore_X_Window
1678ecore_x_window_parent_get(Ecore_X_Window win)
1679{
1680 xcb_query_tree_cookie_t cookie;
1681 xcb_query_tree_reply_t *reply;
1682 Ecore_X_Window window = 0;
1683
1684 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1685 CHECK_XCB_CONN;
1686
1687// if (!win) return 0;
1688 cookie = xcb_query_tree(_ecore_xcb_conn, win);
1689 reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
1690 if (!reply) return 0;
1691 window = reply->parent;
1692 free(reply);
1693
1694 return window;
1695}
1696
1697/**
1698 * Finds out whether the given window is currently visible.
1699 * @param win The given window.
1700 * @return 1 if the window is visible, otherwise 0.
1701 * @ingroup Ecore_X_Window_Visibility_Group
1702 */
1703EAPI int
1704ecore_x_window_visible_get(Ecore_X_Window win)
1705{
1706 xcb_get_window_attributes_cookie_t cookie;
1707 xcb_get_window_attributes_reply_t *reply;
1708 int ret = EINA_FALSE;
1709
1710 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1711 CHECK_XCB_CONN;
1712
1713 cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win);
1714 reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
1715 if (!reply) return EINA_FALSE;
1716
1717 if (reply->map_state == XCB_MAP_STATE_VIEWABLE)
1718 ret = EINA_TRUE;
1719
1720 free(reply);
1721 return ret;
1722}
1723
1724EAPI void
1725ecore_x_window_button_grab(Ecore_X_Window win,
1726 int button,
1727 Ecore_X_Event_Mask mask,
1728 int mod,
1729 int any_mod)
1730{
1731 int i = 0;
1732 uint16_t m, locks[8], ev;
1733 uint8_t b;
1734 Ecore_X_Window *t;
1735
1736 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1737 CHECK_XCB_CONN;
1738
1739 b = button;
1740 if (b == 0)
1741 b = XCB_BUTTON_INDEX_ANY;
1742
1743 m = _ecore_xcb_window_modifiers_get(mod);
1744 if (any_mod) m = XCB_MOD_MASK_ANY;
1745
1746 locks[0] = 0;
1747 locks[1] = ECORE_X_LOCK_CAPS;
1748 locks[2] = ECORE_X_LOCK_NUM;
1749 locks[3] = ECORE_X_LOCK_SCROLL;
1750 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1751 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1752 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1753 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1754
1755 ev = mask;
1756 for (i = 0; i < 8; i++)
1757 xcb_grab_button(_ecore_xcb_conn, 0, win, ev,
1758 XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC,
1759 XCB_NONE, XCB_NONE, b, m | locks[i]);
1760
1761 _ecore_xcb_button_grabs_num++;
1762 t = realloc(_ecore_xcb_button_grabs,
1763 _ecore_xcb_button_grabs_num * sizeof(Ecore_X_Window));
1764 if (!t) return;
1765
1766 _ecore_xcb_button_grabs = t;
1767 _ecore_xcb_button_grabs[_ecore_xcb_button_grabs_num - 1] = win;
1768}
1769
1770EAPI void
1771ecore_x_window_button_ungrab(Ecore_X_Window win,
1772 int button,
1773 int mod,
1774 int any_mod)
1775{
1776 int i = 0;
1777 uint16_t m = 0, locks[8];
1778 uint8_t b;
1779
1780 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1781 CHECK_XCB_CONN;
1782
1783 b = button;
1784 if (b == 0) b = XCB_BUTTON_INDEX_ANY;
1785
1786 m = _ecore_xcb_window_modifiers_get(mod);
1787 if (any_mod) m = XCB_MOD_MASK_ANY;
1788
1789 locks[0] = 0;
1790 locks[1] = ECORE_X_LOCK_CAPS;
1791 locks[2] = ECORE_X_LOCK_NUM;
1792 locks[3] = ECORE_X_LOCK_SCROLL;
1793 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1794 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1795 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1796 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1797
1798 for (i = 0; i < 8; i++)
1799 xcb_ungrab_button(_ecore_xcb_conn, b, win, m | locks[i]);
1800
1801 _ecore_xcb_sync_magic_send(1, win);
1802}
1803
1804EAPI void
1805ecore_x_window_key_grab(Ecore_X_Window win,
1806 const char *key,
1807 int mod,
1808 int any_mod)
1809{
1810 xcb_keycode_t keycode = XCB_NO_SYMBOL;
1811 uint16_t m = 0, locks[8];
1812 int i = 0;
1813 Ecore_X_Window *t;
1814
1815 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1816 CHECK_XCB_CONN;
1817
1818 keycode = _ecore_xcb_keymap_string_to_keycode(key);
1819 if (keycode == XCB_NO_SYMBOL) return;
1820
1821 m = _ecore_xcb_window_modifiers_get(mod);
1822 if (any_mod) m = XCB_MOD_MASK_ANY;
1823
1824 locks[0] = 0;
1825 locks[1] = ECORE_X_LOCK_CAPS;
1826 locks[2] = ECORE_X_LOCK_NUM;
1827 locks[3] = ECORE_X_LOCK_SCROLL;
1828 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1829 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1830 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1831 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1832
1833 for (i = 0; i < 8; i++)
1834 xcb_grab_key(_ecore_xcb_conn, 0, win, m | locks[i],
1835 keycode, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
1836 _ecore_xcb_key_grabs_num++;
1837 t = realloc(_ecore_xcb_key_grabs,
1838 _ecore_xcb_key_grabs_num * sizeof(Ecore_X_Window));
1839 if (!t) return;
1840 _ecore_xcb_key_grabs = t;
1841 _ecore_xcb_key_grabs[_ecore_xcb_key_grabs_num - 1] = win;
1842}
1843
1844EAPI void
1845ecore_x_window_key_ungrab(Ecore_X_Window win,
1846 const char *key,
1847 int mod,
1848 int any_mod)
1849{
1850 xcb_keycode_t keycode = XCB_NO_SYMBOL;
1851 uint16_t m = 0, locks[8];
1852 int i = 0;
1853
1854 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1855 CHECK_XCB_CONN;
1856
1857 keycode = _ecore_xcb_keymap_string_to_keycode(key);
1858 if (keycode == XCB_NO_SYMBOL) return;
1859
1860 m = _ecore_xcb_window_modifiers_get(mod);
1861 if (any_mod) m = XCB_MOD_MASK_ANY;
1862
1863 locks[0] = 0;
1864 locks[1] = ECORE_X_LOCK_CAPS;
1865 locks[2] = ECORE_X_LOCK_NUM;
1866 locks[3] = ECORE_X_LOCK_SCROLL;
1867 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1868 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1869 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1870 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1871
1872 for (i = 0; i < 8; i++)
1873 xcb_ungrab_key(_ecore_xcb_conn, keycode, win, m | locks[i]);
1874
1875 _ecore_xcb_sync_magic_send(2, win);
1876}
1877
1878/* local functions */
1879Ecore_X_Window
1880_ecore_xcb_window_root_of_screen_get(int screen)
1881{
1882 xcb_screen_iterator_t iter;
1883
1884 CHECK_XCB_CONN;
1885 iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
1886 for (; iter.rem; --screen, xcb_screen_next(&iter))
1887 if (screen == 0)
1888 {
1889 xcb_screen_t *s;
1890
1891 if ((s = iter.data))
1892 return s->root;
1893 }
1894 return 0;
1895}
1896
1897static Ecore_X_Window
1898_ecore_xcb_window_argb_internal_new(Ecore_X_Window parent,
1899 int x,
1900 int y,
1901 int w,
1902 int h,
1903 uint8_t override_redirect,
1904 uint8_t save_under)
1905{
1906 Ecore_X_Window win = 0;
1907#ifdef ECORE_XCB_RENDER
1908 uint32_t value_list[10];
1909 uint32_t value_mask;
1910 uint32_t vis;
1911 Ecore_X_Colormap colormap;
1912#endif
1913
1914 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1915 CHECK_XCB_CONN;
1916
1917#ifdef ECORE_XCB_RENDER
1918 if (parent == 0)
1919 parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
1920
1921 vis =
1922 _ecore_xcb_render_find_visual_id(XCB_RENDER_PICT_TYPE_DIRECT, EINA_TRUE);
1923
1924 colormap = xcb_generate_id(_ecore_xcb_conn);
1925 xcb_create_colormap(_ecore_xcb_conn, XCB_COLORMAP_ALLOC_NONE,
1926 colormap, parent, vis);
1927
1928 value_mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
1929 XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE |
1930 XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER |
1931 XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE | XCB_CW_COLORMAP);
1932
1933 value_list[0] = XCB_BACK_PIXMAP_NONE;
1934 value_list[1] = 0;
1935 value_list[2] = XCB_GRAVITY_NORTH_WEST;
1936 value_list[3] = XCB_GRAVITY_NORTH_WEST;
1937 value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
1938 value_list[5] = override_redirect;
1939 value_list[6] = save_under;
1940 value_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
1941 XCB_EVENT_MASK_BUTTON_PRESS |
1942 XCB_EVENT_MASK_BUTTON_RELEASE |
1943 XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
1944 XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
1945 XCB_EVENT_MASK_VISIBILITY_CHANGE |
1946 XCB_EVENT_MASK_STRUCTURE_NOTIFY |
1947 XCB_EVENT_MASK_FOCUS_CHANGE |
1948 XCB_EVENT_MASK_PROPERTY_CHANGE |
1949 XCB_EVENT_MASK_COLOR_MAP_CHANGE);
1950 value_list[8] = XCB_EVENT_MASK_NO_EVENT;
1951 value_list[9] = colormap;
1952
1953 win = xcb_generate_id(_ecore_xcb_conn);
1954 xcb_create_window(_ecore_xcb_conn, 32, win, parent, x, y, w, h, 0,
1955 XCB_WINDOW_CLASS_INPUT_OUTPUT, vis, value_mask,
1956 value_list);
1957
1958 xcb_free_colormap(_ecore_xcb_conn, colormap);
1959
1960 if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
1961 ecore_x_window_defaults_set(win);
1962#endif
1963
1964 return win;
1965}
1966
1967static Ecore_X_Window
1968_ecore_xcb_window_at_xy_get(Ecore_X_Window base,
1969 int bx,
1970 int by,
1971 int x,
1972 int y,
1973 Ecore_X_Window *skip,
1974 int skip_num)
1975{
1976 xcb_query_tree_cookie_t cookie;
1977 xcb_query_tree_reply_t *reply;
1978 Ecore_X_Window *windows = NULL;
1979 int wx, wy, ww, wh, num, i = 0;
1980 Eina_Bool skipit = EINA_FALSE;
1981
1982 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1983 CHECK_XCB_CONN;
1984
1985 if (!ecore_x_window_visible_get(base)) return 0;
1986
1987 ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh);
1988 wx += bx;
1989 wy += by;
1990
1991 if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh))))
1992 return 0;
1993
1994 cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, base);
1995 reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
1996 if (!reply) return 0;
1997
1998 num = reply->children_len;
1999 windows = xcb_query_tree_children(reply);
2000
2001 for (i = (num - 1); i >= 0; --i)
2002 {
2003 skipit = EINA_FALSE;
2004
2005 if (skip)
2006 {
2007 int j = 0;
2008
2009 for (j = 0; j < skip_num; j++)
2010 {
2011 if (windows[i] == skip[j])
2012 {
2013 skipit = EINA_TRUE;
2014 goto onward;
2015 }
2016 }
2017 }
2018onward:
2019 if (!skipit)
2020 {
2021 Ecore_X_Window child = 0;
2022
2023 child =
2024 _ecore_xcb_window_at_xy_get(windows[i],
2025 wx, wy, x, y, skip, skip_num);
2026 if (child)
2027 {
2028 if (reply) free(reply);
2029 return child;
2030 }
2031 }
2032 }
2033
2034 if (reply) free(reply);
2035 return base;
2036}
2037
2038Ecore_X_Visual
2039_ecore_xcb_window_visual_get(Ecore_X_Window win)
2040{
2041 xcb_get_window_attributes_cookie_t cookie;
2042 xcb_get_window_attributes_reply_t *reply;
2043 Ecore_X_Visual visual = 0;
2044
2045 CHECK_XCB_CONN;
2046
2047 cookie = xcb_get_window_attributes(_ecore_xcb_conn, win);
2048 reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
2049 if (!reply) return 0;
2050 visual = _ecore_xcb_window_find_visual_by_id(reply->visual);
2051 free(reply);
2052
2053 return visual;
2054}
2055
2056void
2057_ecore_xcb_window_button_grab_remove(Ecore_X_Window win)
2058{
2059 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2060 CHECK_XCB_CONN;
2061
2062 if (_ecore_xcb_button_grabs_num > 0)
2063 {
2064 int i = 0, shuffle = 0;
2065
2066 for (i = 0; i < _ecore_xcb_button_grabs_num; i++)
2067 {
2068 if (shuffle)
2069 _ecore_xcb_button_grabs[i - 1] = _ecore_xcb_button_grabs[i];
2070
2071 if ((!shuffle) && (_ecore_xcb_button_grabs[i] == win))
2072 shuffle = 1;
2073 }
2074
2075 if (shuffle)
2076 {
2077 Ecore_X_Window *t;
2078
2079 _ecore_xcb_button_grabs_num--;
2080 if (_ecore_xcb_button_grabs_num <= 0)
2081 {
2082 free(_ecore_xcb_button_grabs);
2083 _ecore_xcb_button_grabs = NULL;
2084 return;
2085 }
2086
2087 t = realloc(_ecore_xcb_button_grabs,
2088 _ecore_xcb_button_grabs_num * sizeof(Ecore_X_Window));
2089 if (!t) return;
2090 _ecore_xcb_button_grabs = t;
2091 }
2092 }
2093}
2094
2095void
2096_ecore_xcb_window_key_grab_remove(Ecore_X_Window win)
2097{
2098 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2099 CHECK_XCB_CONN;
2100
2101 if (_ecore_xcb_key_grabs_num > 0)
2102 {
2103 int i = 0, shuffle = 0;
2104
2105 for (i = 0; i < _ecore_xcb_key_grabs_num; i++)
2106 {
2107 if (shuffle)
2108 _ecore_xcb_key_grabs[i - 1] = _ecore_xcb_key_grabs[i];
2109
2110 if ((!shuffle) && (_ecore_xcb_key_grabs[i] == win))
2111 shuffle = 1;
2112 }
2113
2114 if (shuffle)
2115 {
2116 Ecore_X_Window *t;
2117
2118 _ecore_xcb_key_grabs_num--;
2119 if (_ecore_xcb_key_grabs_num <= 0)
2120 {
2121 free(_ecore_xcb_key_grabs);
2122 _ecore_xcb_key_grabs = NULL;
2123 return;
2124 }
2125
2126 t = realloc(_ecore_xcb_key_grabs,
2127 _ecore_xcb_key_grabs_num * sizeof(Ecore_X_Window));
2128 if (!t) return;
2129 _ecore_xcb_key_grabs = t;
2130 }
2131 }
2132}
2133
2134void
2135_ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win,
2136 Ecore_X_Window child_win,
2137 int type,
2138 void *event,
2139 Ecore_X_Time timestamp)
2140{
2141 int i = 0;
2142
2143 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2144 CHECK_XCB_CONN;
2145
2146 for (i = 0; i < _ecore_xcb_button_grabs_num; i++)
2147 {
2148 if ((_ecore_xcb_button_grabs[i] == event_win) ||
2149 (_ecore_xcb_button_grabs[i] == child_win))
2150 {
2151 Eina_Bool replay = EINA_FALSE;
2152
2153 if (_ecore_xcb_window_grab_replay_func)
2154 {
2155 replay =
2156 _ecore_xcb_window_grab_replay_func(_ecore_xcb_window_grab_replay_data,
2157 type, event);
2158 }
2159 if (replay)
2160 {
2161 xcb_allow_events(_ecore_xcb_conn,
2162 XCB_ALLOW_REPLAY_POINTER, timestamp);
2163 }
2164 else
2165 {
2166 xcb_allow_events(_ecore_xcb_conn,
2167 XCB_ALLOW_ASYNC_POINTER, timestamp);
2168 }
2169 break;
2170 }
2171 }
2172}
2173
2174static int
2175_ecore_xcb_window_modifiers_get(unsigned int state)
2176{
2177 int xmodifiers = 0;
2178
2179 if (state & ECORE_EVENT_MODIFIER_SHIFT)
2180 xmodifiers |= ECORE_X_MODIFIER_SHIFT;
2181 if (state & ECORE_EVENT_MODIFIER_CTRL)
2182 xmodifiers |= ECORE_X_MODIFIER_CTRL;
2183 if (state & ECORE_EVENT_MODIFIER_ALT)
2184 xmodifiers |= ECORE_X_MODIFIER_ALT;
2185 if (state & ECORE_EVENT_MODIFIER_WIN)
2186 xmodifiers |= ECORE_X_MODIFIER_WIN;
2187 if (state & ECORE_EVENT_LOCK_SCROLL)
2188 xmodifiers |= ECORE_X_LOCK_SCROLL;
2189 if (state & ECORE_EVENT_LOCK_NUM)
2190 xmodifiers |= ECORE_X_LOCK_NUM;
2191 if (state & ECORE_EVENT_LOCK_CAPS)
2192 xmodifiers |= ECORE_X_LOCK_CAPS;
2193 if (state & ECORE_EVENT_LOCK_SHIFT)
2194 xmodifiers |= ECORE_X_LOCK_SHIFT;
2195
2196 return xmodifiers;
2197}
2198
2199static xcb_visualtype_t *
2200_ecore_xcb_window_find_visual_by_id(xcb_visualid_t id)
2201{
2202 xcb_depth_iterator_t diter;
2203 xcb_visualtype_iterator_t viter;
2204
2205 CHECK_XCB_CONN;
2206 diter = xcb_screen_allowed_depths_iterator(_ecore_xcb_screen);
2207 for (; diter.rem; xcb_depth_next(&diter))
2208 {
2209 viter = xcb_depth_visuals_iterator(diter.data);
2210 for (; viter.rem; xcb_visualtype_next(&viter))
2211 {
2212 if (viter.data->visual_id == id)
2213 return viter.data;
2214 }
2215 }
2216 return 0;
2217}
2218
2219#ifdef ECORE_XCB_XPRINT
2220static xcb_screen_t *
2221_ecore_xcb_window_screen_of_display(int screen)
2222{
2223 xcb_screen_iterator_t iter;
2224
2225 CHECK_XCB_CONN;
2226 iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
2227 for (; iter.rem; --screen, xcb_screen_next(&iter))
2228 if (screen == 0)
2229 return iter.data;
2230
2231 return NULL;
2232}
2233
2234#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
deleted file mode 100644
index e00fdc1..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c
+++ /dev/null
@@ -1,720 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <xcb/xcb_icccm.h>
3
4EAPI int
5ecore_x_window_prop_card32_get(Ecore_X_Window win,
6 Ecore_X_Atom atom,
7 unsigned int *val,
8 unsigned int len)
9{
10 xcb_get_property_cookie_t cookie;
11 xcb_get_property_reply_t *reply;
12 int num = 0;
13
14 LOGFN(__FILE__, __LINE__, __FUNCTION__);
15 CHECK_XCB_CONN;
16
17 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom,
18 ECORE_X_ATOM_CARDINAL, 0, 0x7fffffff);
19 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
20 if (!reply) return -1;
21
22 if ((reply->type != ECORE_X_ATOM_CARDINAL) || (reply->format != 32))
23 num = -1;
24 else if (reply->value_len == 0)
25 num = 0;
26 else
27 {
28 if (reply->value_len < len)
29 len = reply->value_len;
30
31 if (val)
32 {
33 unsigned int i = 0;
34 unsigned char *v;
35
36 v = xcb_get_property_value(reply);
37 for (i = 0; i < len; i++)
38 val[i] = ((uint32_t *)v)[i];
39 num = len;
40 }
41 }
42
43 if (reply) free(reply);
44 return num;
45}
46
47EAPI void
48ecore_x_window_prop_card32_set(Ecore_X_Window win,
49 Ecore_X_Atom atom,
50 unsigned int *val,
51 unsigned int num)
52{
53 LOGFN(__FILE__, __LINE__, __FUNCTION__);
54 CHECK_XCB_CONN;
55
56#if SIZEOF_INT == SIZEOF_LONG
57 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
58 ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)val);
59// ecore_x_flush();
60#else
61 long *v2;
62 unsigned int i;
63
64 v2 = malloc(num * sizeof(long));
65 if (!v2) return;
66 for (i = 0; i < num; i++)
67 v2[i] = val[i];
68
69 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
70 ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)v2);
71 free(v2);
72// ecore_x_flush();
73#endif
74}
75
76EAPI int
77ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
78 Ecore_X_Atom atom,
79 unsigned int **list)
80{
81 xcb_get_property_cookie_t cookie;
82 xcb_get_property_reply_t *reply;
83 int num = -1;
84
85 LOGFN(__FILE__, __LINE__, __FUNCTION__);
86 CHECK_XCB_CONN;
87
88 if (list) *list = NULL;
89
90 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom,
91 XCB_ATOM_CARDINAL, 0, 0x7fffffff);
92 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
93 if (!reply) return -1;
94
95 if ((reply->type != XCB_ATOM_CARDINAL) || (reply->format != 32))
96 num = -1;
97 else if ((reply->value_len == 0) || (!xcb_get_property_value(reply)))
98 num = 0;
99 else
100 {
101 num = reply->value_len;
102 if (list)
103 {
104 unsigned int *val;
105 void *data;
106 int i = 0;
107
108 val = malloc(num * sizeof(unsigned int));
109 if (!val)
110 {
111 free(reply);
112 return -1;
113 }
114 data = xcb_get_property_value(reply);
115 for (i = 0; i < num; i++)
116 val[i] = ((uint32_t *)data)[i];
117 *list = val;
118 }
119 }
120
121 free(reply);
122 return num;
123}
124
125EAPI int
126ecore_x_window_prop_atom_get(Ecore_X_Window win,
127 Ecore_X_Atom atom,
128 Ecore_X_Atom *list,
129 unsigned int len)
130{
131 LOGFN(__FILE__, __LINE__, __FUNCTION__);
132
133 return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len);
134}
135
136EAPI void
137ecore_x_window_prop_atom_set(Ecore_X_Window win,
138 Ecore_X_Atom atom,
139 Ecore_X_Atom *list,
140 unsigned int num)
141{
142 LOGFN(__FILE__, __LINE__, __FUNCTION__);
143
144 /* xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, */
145 /* ECORE_X_ATOM_ATOM, 32, num, list); */
146 ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num);
147}
148
149EAPI void
150ecore_x_window_prop_xid_set(Ecore_X_Window win,
151 Ecore_X_Atom atom,
152 Ecore_X_Atom type,
153 Ecore_X_ID *xids,
154 unsigned int num)
155{
156 LOGFN(__FILE__, __LINE__, __FUNCTION__);
157 CHECK_XCB_CONN;
158
159#if SIZEOF_INT == SIZEOF_LONG
160 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
161 type, 32, num, (unsigned char *)xids);
162// ecore_x_flush();
163#else
164 long *v2;
165 unsigned int i;
166
167 v2 = malloc(num * sizeof(long));
168 if (!v2) return;
169 for (i = 0; i < num; i++)
170 v2[i] = xids[i];
171
172 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom,
173 type, 32, num, (unsigned char *)v2);
174 free(v2);
175// ecore_x_flush();
176#endif
177}
178
179EAPI int
180ecore_x_window_prop_xid_get(Ecore_X_Window win,
181 Ecore_X_Atom atom,
182 Ecore_X_Atom type,
183 Ecore_X_ID *xids,
184 unsigned int len)
185{
186 xcb_get_property_cookie_t cookie;
187 xcb_get_property_reply_t *reply;
188 int num = 0;
189
190 LOGFN(__FILE__, __LINE__, __FUNCTION__);
191 CHECK_XCB_CONN;
192
193 num = len;
194 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type,
195 0, 0x7fffffff);
196 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
197 if (!reply) return -1;
198
199 if ((reply->type != type) || (reply->format != 32))
200 num = -1;
201 else if (reply->value_len == 0)
202 num = 0;
203 else
204 {
205 unsigned int i = 0;
206 unsigned char *v;
207
208 if (reply->value_len < len)
209 len = reply->value_len;
210
211 v = xcb_get_property_value(reply);
212 for (i = 0; i < len; i++)
213 xids[i] = ((uint32_t *)v)[i];
214
215 num = len;
216 }
217
218 if (reply) free(reply);
219 return num;
220}
221
222EAPI void
223ecore_x_window_prop_string_set(Ecore_X_Window win,
224 Ecore_X_Atom type,
225 const char *str)
226{
227 LOGFN(__FILE__, __LINE__, __FUNCTION__);
228 CHECK_XCB_CONN;
229
230 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, type,
231 ECORE_X_ATOM_UTF8_STRING, 8, strlen(str), str);
232// ecore_x_flush();
233}
234
235EAPI char *
236ecore_x_window_prop_string_get(Ecore_X_Window win,
237 Ecore_X_Atom type)
238{
239 xcb_get_property_cookie_t cookie;
240 xcb_get_property_reply_t *reply;
241 char *str = NULL;
242 int len = 0;
243
244 LOGFN(__FILE__, __LINE__, __FUNCTION__);
245 CHECK_XCB_CONN;
246
247 cookie =
248 xcb_get_property_unchecked(_ecore_xcb_conn, 0,
249 win ? win : ((xcb_screen_t *)_ecore_xcb_screen)->root,
250 type, XCB_GET_PROPERTY_TYPE_ANY, 0, 1000000L);
251 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
252 if (!reply) return NULL;
253
254 len = ((reply->value_len * reply->format) / 8);
255 str = (char *)malloc((len + 1) * sizeof(char));
256 memcpy(str, xcb_get_property_value(reply), len);
257 str[len] = '\0';
258
259 if (reply->type != ECORE_X_ATOM_UTF8_STRING)
260 {
261 Ecore_Xcb_Textproperty prop;
262 int count = 0;
263 char **list = NULL;
264 Eina_Bool ret = EINA_FALSE;
265
266 prop.value = strdup(str);
267 prop.nitems = len;
268 prop.encoding = reply->type;
269
270#ifdef HAVE_ICONV
271 ret = _ecore_xcb_utf8_textproperty_to_textlist(&prop, &list, &count);
272#else
273 ret = _ecore_xcb_mb_textproperty_to_textlist(&prop, &list, &count);
274#endif
275 if (ret)
276 {
277 if (count > 0)
278 str = strdup(list[0]);
279 else
280 str = strdup((char *)prop.value);
281
282 if (list) free(list);
283 }
284 else
285 str = strdup((char *)prop.value);
286 }
287
288 free(reply);
289 return str;
290}
291
292EAPI int
293ecore_x_window_prop_window_get(Ecore_X_Window win,
294 Ecore_X_Atom atom,
295 Ecore_X_Window *list,
296 unsigned int len)
297{
298 LOGFN(__FILE__, __LINE__, __FUNCTION__);
299
300 return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len);
301}
302
303EAPI void
304ecore_x_window_prop_window_set(Ecore_X_Window win,
305 Ecore_X_Atom atom,
306 Ecore_X_Window *list,
307 unsigned int num)
308{
309 LOGFN(__FILE__, __LINE__, __FUNCTION__);
310
311 ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num);
312}
313
314EAPI int
315ecore_x_window_prop_window_list_get(Ecore_X_Window win,
316 Ecore_X_Atom atom,
317 Ecore_X_Window **plst)
318{
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320
321 return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plst);
322}
323
324EAPI Ecore_X_Atom
325ecore_x_window_prop_any_type(void)
326{
327 return XCB_ATOM_ANY;
328}
329
330EAPI void
331ecore_x_window_prop_property_del(Ecore_X_Window win,
332 Ecore_X_Atom property)
333{
334 LOGFN(__FILE__, __LINE__, __FUNCTION__);
335 CHECK_XCB_CONN;
336
337 xcb_delete_property(_ecore_xcb_conn, win, property);
338}
339
340EAPI void
341ecore_x_window_prop_property_set(Ecore_X_Window win,
342 Ecore_X_Atom property,
343 Ecore_X_Atom type,
344 int size,
345 void *data,
346 int num)
347{
348 LOGFN(__FILE__, __LINE__, __FUNCTION__);
349 CHECK_XCB_CONN;
350
351 if (win == 0)
352 win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
353
354 if (size != 32)
355 {
356 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
357 property, type, size, num, (unsigned char *)data);
358// ecore_x_flush();
359 }
360 else
361 {
362 uint32_t *dat;
363 int i = 0, *ptr;
364
365 dat = malloc(sizeof(uint32_t) * num);
366 if (dat)
367 {
368 for (ptr = (int *)data, i = 0; i < num; i++)
369 dat[i] = ptr[i];
370 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
371 property, type, size, num,
372 (unsigned char *)dat);
373 free(dat);
374// ecore_x_flush();
375 }
376 }
377}
378
379EAPI int
380ecore_x_window_prop_property_get(Ecore_X_Window win,
381 Ecore_X_Atom property,
382 Ecore_X_Atom type,
383 int size,
384 unsigned char **data,
385 int *num)
386{
387 xcb_get_property_cookie_t cookie;
388 xcb_get_property_reply_t *reply;
389 int format = 0;
390 unsigned int i = 0;
391 void *value;
392
393 LOGFN(__FILE__, __LINE__, __FUNCTION__);
394 CHECK_XCB_CONN;
395
396 if (num) *num = 0;
397
398 if (data)
399 *data = NULL;
400 else
401 return 0;
402
403 if (win == 0)
404 win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
405
406 cookie =
407 xcb_get_property_unchecked(_ecore_xcb_conn, 0, win,
408 property, type, 0, UINT_MAX);
409 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
410 if (!reply) return 0;
411 if ((reply->format != size) || (reply->value_len == 0))
412 {
413 free(reply);
414 return 0;
415 }
416
417 if (!(*data = malloc(reply->value_len * reply->format / 8)))
418 {
419 free(reply);
420 return 0;
421 }
422
423 value = xcb_get_property_value(reply);
424 switch (reply->format)
425 {
426 case 8:
427 for (i = 0; i < reply->value_len; i++)
428 (*data)[i] = ((unsigned char *)value)[i];
429 break;
430
431 case 16:
432 for (i = 0; i < reply->value_len; i++)
433 ((unsigned short *)*data)[i] = ((unsigned short *)value)[i];
434 break;
435
436 case 32:
437 for (i = 0; i < reply->value_len; i++)
438 ((unsigned int *)*data)[i] = ((uint32_t *)value)[i];
439 break;
440 }
441
442 if (num) *num = reply->value_len;
443 format = reply->format;
444 free(reply);
445 return format;
446}
447
448EAPI int
449ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
450 Ecore_X_Atom atom,
451 Ecore_X_Atom **list)
452{
453 LOGFN(__FILE__, __LINE__, __FUNCTION__);
454
455 return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, list);
456}
457
458EAPI void
459ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
460 Ecore_X_Atom atom,
461 Ecore_X_Atom item,
462 int op)
463{
464 LOGFN(__FILE__, __LINE__, __FUNCTION__);
465 ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op);
466}
467
468EAPI int
469ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
470 Ecore_X_Atom atom,
471 Ecore_X_Atom type,
472 Ecore_X_ID **xids)
473{
474 xcb_get_property_cookie_t cookie;
475 xcb_get_property_reply_t *reply;
476 int num = -1;
477
478 LOGFN(__FILE__, __LINE__, __FUNCTION__);
479 CHECK_XCB_CONN;
480
481 if (xids) *xids = NULL;
482
483 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type,
484 0, 0x7fffffff);
485 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
486 if (!reply) return -1;
487
488 if ((reply->type != type) || (reply->format != 32))
489 num = -1;
490 else if ((reply->value_len == 0) || (!xcb_get_property_value(reply)))
491 num = 0;
492 else
493 {
494 Ecore_X_Atom *alst;
495 void *val;
496
497 num = xcb_get_property_value_length(reply);
498 val = xcb_get_property_value(reply);
499 alst = malloc(num * sizeof(Ecore_X_ID));
500 if (alst)
501 {
502 int i = 0;
503
504 for (i = 0; i < num; i++)
505 alst[i] = ((uint32_t *)val)[i];
506 *xids = alst;
507 }
508 }
509
510 free(reply);
511 return num;
512}
513
514EAPI void
515ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
516 Ecore_X_Atom atom,
517 Ecore_X_Atom type,
518 Ecore_X_ID item,
519 int op)
520{
521 Ecore_X_ID *lst;
522 int i = 0, num = 0;
523
524 LOGFN(__FILE__, __LINE__, __FUNCTION__);
525 CHECK_XCB_CONN;
526
527 num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
528 if (num < 0) return;
529
530 for (i = 0; i < num; i++)
531 {
532 if (lst[i] == item) break;
533 }
534
535 if (i < num)
536 {
537 if (op == ECORE_X_PROP_LIST_ADD)
538 goto done;
539 num--;
540 for (; i < num; i++)
541 lst[i] = lst[i + 1];
542 }
543 else
544 {
545 if (op == ECORE_X_PROP_LIST_REMOVE)
546 goto done;
547 num++;
548 lst = realloc(lst, num * sizeof(Ecore_X_ID));
549 lst[i] = item;
550 }
551 ecore_x_window_prop_xid_set(win, atom, type, lst, num);
552
553done:
554 if (lst) free(lst);
555}
556
557EAPI Eina_Bool
558ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
559 Ecore_X_WM_Protocol protocol)
560{
561 Eina_Bool ret = EINA_FALSE;
562 Ecore_X_Atom proto;
563#ifdef OLD_XCB_VERSION
564 xcb_get_wm_protocols_reply_t protos;
565#else
566 xcb_icccm_get_wm_protocols_reply_t protos;
567#endif
568 xcb_get_property_cookie_t cookie;
569 uint8_t reply;
570 uint32_t count = 0, i = 0;
571
572 LOGFN(__FILE__, __LINE__, __FUNCTION__);
573 CHECK_XCB_CONN;
574
575 if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE;
576
577 proto = _ecore_xcb_atoms_wm_protocol[protocol];
578#ifdef OLD_XCB_VERSION
579 cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
580 ECORE_X_ATOM_WM_PROTOCOLS);
581 reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL);
582#else
583 cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
584 ECORE_X_ATOM_WM_PROTOCOLS);
585 reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
586 &protos, NULL);
587#endif
588 if (!reply) return EINA_FALSE;
589
590 count = protos.atoms_len;
591 for (i = 0; i < count; i++)
592 {
593 if (protos.atoms[i] == proto)
594 {
595 ret = EINA_TRUE;
596 break;
597 }
598 }
599
600#ifdef OLD_XCB_VERSION
601 xcb_get_wm_protocols_reply_wipe(&protos);
602#else
603 xcb_icccm_get_wm_protocols_reply_wipe(&protos);
604#endif
605 return ret;
606}
607
608EAPI Ecore_X_WM_Protocol *
609ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
610 int *num_ret)
611{
612#ifdef OLD_XCB_VERSION
613 xcb_get_wm_protocols_reply_t protos;
614#else
615 xcb_icccm_get_wm_protocols_reply_t protos;
616#endif
617 xcb_get_property_cookie_t cookie;
618 uint8_t reply;
619 uint32_t count = 0, i = 0;
620 Ecore_X_WM_Protocol *prot_ret = NULL;
621
622 LOGFN(__FILE__, __LINE__, __FUNCTION__);
623 CHECK_XCB_CONN;
624
625 if (!num_ret) return NULL;
626
627 *num_ret = 0;
628
629#ifdef OLD_XCB_VERSION
630 cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
631 ECORE_X_ATOM_WM_PROTOCOLS);
632 reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL);
633#else
634 cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win,
635 ECORE_X_ATOM_WM_PROTOCOLS);
636 reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie,
637 &protos, NULL);
638#endif
639 if (!reply) return NULL;
640
641 count = protos.atoms_len;
642 if (count <= 0)
643 {
644#ifdef OLD_XCB_VERSION
645 xcb_get_wm_protocols_reply_wipe(&protos);
646#else
647 xcb_icccm_get_wm_protocols_reply_wipe(&protos);
648#endif
649 return NULL;
650 }
651
652 prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol));
653 if (!prot_ret)
654 {
655#ifdef OLD_XCB_VERSION
656 xcb_get_wm_protocols_reply_wipe(&protos);
657#else
658 xcb_icccm_get_wm_protocols_reply_wipe(&protos);
659#endif
660 return NULL;
661 }
662
663 for (i = 0; i < count; i++)
664 {
665 Ecore_X_WM_Protocol j;
666
667 prot_ret[i] = -1;
668 for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
669 {
670 if (_ecore_xcb_atoms_wm_protocol[j] == protos.atoms[i])
671 prot_ret[i] = j;
672 }
673 }
674
675 if (num_ret) *num_ret = count;
676
677#ifdef OLD_XCB_VERSION
678 xcb_get_wm_protocols_reply_wipe(&protos);
679#else
680 xcb_icccm_get_wm_protocols_reply_wipe(&protos);
681#endif
682 return prot_ret;
683}
684
685EAPI Ecore_X_Atom *
686ecore_x_window_prop_list(Ecore_X_Window win,
687 int *num)
688{
689 xcb_list_properties_cookie_t cookie;
690 xcb_list_properties_reply_t *reply;
691 xcb_atom_t *atm;
692 Ecore_X_Atom *atoms;
693 int i = 0;
694
695 LOGFN(__FILE__, __LINE__, __FUNCTION__);
696 CHECK_XCB_CONN;
697
698 if (num) *num = 0;
699
700 cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, win);
701 reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL);
702 if (!reply) return NULL;
703
704 atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom));
705 if (!atoms)
706 {
707 free(reply);
708 return NULL;
709 }
710
711 atm = xcb_list_properties_atoms(reply);
712 for (i = 0; i < reply->atoms_len; i++)
713 atoms[i] = atm[i];
714
715 if (num) *num = reply->atoms_len;
716 free(reply);
717
718 return atoms;
719}
720
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
deleted file mode 100644
index 4f24d62..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c
+++ /dev/null
@@ -1,408 +0,0 @@
1#include "ecore_xcb_private.h"
2
3typedef struct _Shadow Shadow;
4struct _Shadow
5{
6 Shadow *parent, **children;
7 Ecore_X_Window win;
8 int children_num;
9 short x, y;
10 unsigned short w, h;
11};
12
13static Eina_Bool _inside_rects(Shadow *s,
14 int x,
15 int y,
16 int bx,
17 int by,
18 Ecore_X_Rectangle *rects,
19 int num);
20
21//static int shadow_count = 0;
22static Shadow **shadow_base = NULL;
23static int shadow_num = 0;
24
25/* FIXME: round trips */
26static Shadow *
27_ecore_x_window_tree_walk(Ecore_X_Window window)
28{
29 Shadow *s, **sl;
30 xcb_get_window_attributes_reply_t *reply_attr;
31 xcb_get_geometry_reply_t *reply_geom;
32 xcb_query_tree_reply_t *reply_tree;
33 xcb_get_window_attributes_cookie_t cookie_attr;
34 xcb_get_geometry_cookie_t cookie_geom;
35 xcb_query_tree_cookie_t cookie_tree;
36 int i, j;
37
38 CHECK_XCB_CONN;
39
40 cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
41 reply_attr = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie_attr, NULL);
42 if (!reply_attr) return NULL;
43 if (reply_attr->map_state != XCB_MAP_STATE_VIEWABLE)
44 {
45 free(reply_attr);
46 return NULL;
47 }
48
49 free(reply_attr);
50
51 cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
52 reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
53 if (!reply_geom) return NULL;
54
55 if (!(s = calloc(1, sizeof(Shadow))))
56 {
57 free(reply_geom);
58 return NULL;
59 }
60
61 s->win = window;
62 s->x = reply_geom->x;
63 s->y = reply_geom->y;
64 s->w = reply_geom->width;
65 s->h = reply_geom->height;
66
67 free(reply_geom);
68
69 cookie_tree = xcb_query_tree_unchecked(_ecore_xcb_conn, window);
70 reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
71 if (reply_tree)
72 {
73 xcb_window_t *list;
74 int num;
75
76 num = xcb_query_tree_children_length(reply_tree);
77 list = xcb_query_tree_children(reply_tree);
78
79 s->children = calloc(1, sizeof(Shadow *) * num);
80 if (s->children)
81 {
82 s->children_num = num;
83 for (i = 0; i < num; i++)
84 {
85 s->children[i] = _ecore_x_window_tree_walk(list[i]);
86 if (s->children[i])
87 s->children[i]->parent = s;
88 }
89 /* compress list down */
90 j = 0;
91 for (i = 0; i < num; i++)
92 {
93 if (s->children[i])
94 {
95 s->children[j] = s->children[i];
96 j++;
97 }
98 }
99 if (j == 0)
100 {
101 free(s->children);
102 s->children = NULL;
103 s->children_num = 0;
104 }
105 else
106 {
107 s->children_num = j;
108 sl = realloc(s->children, sizeof(Shadow *) * j);
109 if (sl) s->children = sl;
110 }
111 }
112
113 free(reply_tree);
114 }
115
116 return s;
117}
118
119static void
120_ecore_x_window_tree_shadow_free1(Shadow *s)
121{
122 int i = 0;
123
124 if (!s) return;
125 if (s->children)
126 {
127 for (i = 0; i < s->children_num; i++)
128 {
129 if (s->children[i])
130 _ecore_x_window_tree_shadow_free1(s->children[i]);
131 }
132 free(s->children);
133 }
134
135 free(s);
136}
137
138static void
139_ecore_x_window_tree_shadow_free(void)
140{
141 int i = 0;
142
143 if (!shadow_base) return;
144
145 for (i = 0; i < shadow_num; i++)
146 {
147 if (!shadow_base[i]) continue;
148 _ecore_x_window_tree_shadow_free1(shadow_base[i]);
149 }
150 free(shadow_base);
151 shadow_base = NULL;
152 shadow_num = 0;
153}
154
155static void
156_ecore_x_window_tree_shadow_populate(void)
157{
158 Ecore_X_Window *roots = NULL;
159 int i = 0, num = 0;
160
161 if ((roots = ecore_x_window_root_list(&num)))
162 {
163 shadow_base = calloc(1, sizeof(Shadow *) * num);
164 if (shadow_base)
165 {
166 shadow_num = num;
167 for (i = 0; i < num; i++)
168 shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
169 }
170
171 free(roots);
172 }
173}
174
175/*
176 static void
177 _ecore_x_window_tree_shadow_start(void)
178 {
179 shadow_count++;
180 if (shadow_count > 1) return;
181 _ecore_x_window_tree_shadow_populate();
182 }
183
184 static void
185 _ecore_x_window_tree_shadow_stop(void)
186 {
187 shadow_count--;
188 if (shadow_count != 0) return;
189 _ecore_x_window_tree_shadow_free();
190 }
191 */
192
193Shadow *
194_ecore_x_window_shadow_tree_find_shadow(Shadow *s,
195 Ecore_X_Window win)
196{
197 Shadow *ss;
198 int i = 0;
199
200 if (s->win == win) return s;
201
202 if (s->children)
203 {
204 for (i = 0; i < s->children_num; i++)
205 {
206 if (!s->children[i]) continue;
207
208 if ((ss =
209 _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
210 return ss;
211 }
212 }
213
214 return NULL;
215}
216
217Shadow *
218_ecore_x_window_shadow_tree_find(Ecore_X_Window base)
219{
220 Shadow *s;
221 int i = 0;
222
223 for (i = 0; i < shadow_num; i++)
224 {
225 if (!shadow_base[i]) continue;
226
227 if ((s =
228 _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
229 return s;
230 }
231 return NULL;
232}
233
234static Ecore_X_Window
235_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s,
236 int bx,
237 int by,
238 int x,
239 int y,
240 Ecore_X_Window *skip,
241 int skip_num)
242{
243 Ecore_X_Window child;
244 Ecore_X_Rectangle *rects;
245 int i = 0, j = 0, wx = 0, wy = 0, num = 0;
246
247 wx = s->x + bx;
248 wy = s->y + by;
249 if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h))))
250 return 0;
251
252 rects = ecore_x_window_shape_rectangles_get(s->win, &num);
253 if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0;
254 num = 0;
255 rects = ecore_x_window_shape_input_rectangles_get(s->win, &num);
256 if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0;
257
258 if (s->children)
259 {
260 int skipit = 0;
261
262 for (i = s->children_num - 1; i >= 0; --i)
263 {
264 if (!s->children[i]) continue;
265
266 skipit = 0;
267 if (skip)
268 {
269 for (j = 0; j < skip_num; j++)
270 {
271 if (s->children[i]->win == skip[j])
272 {
273 skipit = 1;
274 goto onward;
275 }
276 }
277 }
278onward:
279 if (!skipit)
280 {
281 if ((child =
282 _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
283 return child;
284 }
285 }
286 }
287
288 return s->win;
289}
290
291static Ecore_X_Window
292_ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base,
293 int bx,
294 int by,
295 int x,
296 int y,
297 Ecore_X_Window *skip,
298 int skip_num)
299{
300 Shadow *s;
301
302 if (!shadow_base)
303 {
304 _ecore_x_window_tree_shadow_populate();
305 if (!shadow_base) return 0;
306 }
307
308 s = _ecore_x_window_shadow_tree_find(base);
309 if (!s) return 0;
310
311 return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num);
312}
313
314static Eina_Bool
315_inside_rects(Shadow *s,
316 int x,
317 int y,
318 int bx,
319 int by,
320 Ecore_X_Rectangle *rects,
321 int num)
322{
323 Eina_Bool inside = EINA_FALSE;
324 int i = 0;
325
326 if (!rects) return EINA_FALSE;
327 for (i = 0; i < num; i++)
328 {
329 if ((x >= s->x + bx + rects[i].x) &&
330 (y >= s->y + by + rects[i].y) &&
331 (x < (int)(s->x + bx + rects[i].x + rects[i].width)) &&
332 (y < (int)(s->y + by + rects[i].y + rects[i].height)))
333 {
334 inside = EINA_TRUE;
335 break;
336 }
337 }
338 free(rects);
339 return inside;
340}
341
342/**
343 * Retrieves the top, visible window at the given location,
344 * but skips the windows in the list. This uses a shadow tree built from the
345 * window tree that is only updated the first time
346 * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time
347 * it is called after a ecore_x_window_shadow_tree_flush()
348 * @param base The base window to start searching from (normally root).
349 * @param x The given X position.
350 * @param y The given Y position.
351 * @return The window at that position.
352 * @ingroup Ecore_X_Window_Geometry_Group
353 */
354EAPI Ecore_X_Window
355ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base,
356 int x,
357 int y,
358 Ecore_X_Window *skip,
359 int skip_num)
360{
361 return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num);
362}
363
364/**
365 * Retrieves the parent window a given window has. This uses the shadow window
366 * tree.
367 * @param root The root window of @p win - if 0, this will be automatically determined with extra processing overhead
368 * @param win The window to get the parent window of
369 * @return The parent window of @p win
370 * @ingroup Ecore_X_Window_Geometry_Group
371 */
372EAPI Ecore_X_Window
373ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__,
374 Ecore_X_Window win)
375{
376 Shadow *s;
377 int i = 0;
378
379 if (!shadow_base)
380 {
381 _ecore_x_window_tree_shadow_populate();
382 if (!shadow_base) return 0;
383 }
384
385 for (i = 0; i < shadow_num; i++)
386 {
387 if (!shadow_base[i]) continue;
388
389 s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
390 if (s)
391 {
392 if (!s->parent) return 0;
393 return s->parent->win;
394 }
395 }
396 return 0;
397}
398
399/**
400 * Flushes the window shadow tree so nothing is stored.
401 * @ingroup Ecore_X_Window_Geometry_Group
402 */
403EAPI void
404ecore_x_window_shadow_tree_flush(void)
405{
406 _ecore_x_window_tree_shadow_free();
407}
408
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
deleted file mode 100644
index 6206a51..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c
+++ /dev/null
@@ -1,790 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_SHAPE
3# include <xcb/shape.h>
4#endif
5
6/**
7 * @defgroup Ecore_X_Window_Shape X Window Shape Functions
8 *
9 * These functions use the shape extension of the X server to change
10 * shape of given windows.
11 */
12
13/**
14 * Sets the input shape of the given window to that given by the pixmap @p mask.
15 * @param win The given window.
16 * @param mask A 1-bit depth pixmap that provides the new input shape of the
17 * window.
18 * @ingroup Ecore_X_Window_Shape
19 */
20EAPI void
21ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
22 Ecore_X_Pixmap mask)
23{
24 LOGFN(__FILE__, __LINE__, __FUNCTION__);
25 CHECK_XCB_CONN;
26
27#ifdef ECORE_XCB_SHAPE
28 xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
29 win, 0, 0, mask);
30// ecore_x_flush();
31#else
32 return;
33 win = 0;
34 mask = 0;
35#endif
36}
37
38/**
39 * Sets the shape of the given window to that given by the pixmap @p mask.
40 * @param win The given window.
41 * @param mask A 2-bit depth pixmap that provides the new shape of the
42 * window.
43 * @ingroup Ecore_X_Window_Shape
44 */
45EAPI void
46ecore_x_window_shape_mask_set(Ecore_X_Window win,
47 Ecore_X_Pixmap mask)
48{
49 LOGFN(__FILE__, __LINE__, __FUNCTION__);
50 CHECK_XCB_CONN;
51
52#ifdef ECORE_XCB_SHAPE
53 xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
54 win, 0, 0, mask);
55// ecore_x_flush();
56#else
57 return;
58 win = 0;
59 mask = 0;
60#endif
61}
62
63EAPI void
64ecore_x_window_shape_window_set(Ecore_X_Window win,
65 Ecore_X_Window shape_win)
66{
67 LOGFN(__FILE__, __LINE__, __FUNCTION__);
68 CHECK_XCB_CONN;
69
70#ifdef ECORE_XCB_SHAPE
71 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
72 XCB_SHAPE_SK_BOUNDING, win, 0, 0, shape_win);
73// ecore_x_flush();
74#else
75 return;
76 win = 0;
77 shape_win = 0;
78#endif
79}
80
81EAPI void
82ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
83 Ecore_X_Window shape_win,
84 int x,
85 int y)
86{
87 LOGFN(__FILE__, __LINE__, __FUNCTION__);
88 CHECK_XCB_CONN;
89
90#ifdef ECORE_XCB_SHAPE
91 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
92 XCB_SHAPE_SK_BOUNDING, win, x, y, shape_win);
93// ecore_x_flush();
94#else
95 return;
96 win = 0;
97 shape_win = 0;
98 x = 0;
99 y = 0;
100#endif
101}
102
103EAPI void
104ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
105 int x,
106 int y,
107 int w,
108 int h)
109{
110#ifdef ECORE_XCB_SHAPE
111 xcb_rectangle_t rect;
112#endif
113
114 LOGFN(__FILE__, __LINE__, __FUNCTION__);
115 CHECK_XCB_CONN;
116
117#ifdef ECORE_XCB_SHAPE
118 rect.x = x;
119 rect.y = y;
120 rect.width = w;
121 rect.height = h;
122 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
123 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
124 win, 0, 0, 1, &rect);
125// ecore_x_flush();
126#else
127 return;
128 win = 0;
129 x = 0;
130 y = 0;
131 w = 0;
132 h = 0;
133#endif
134}
135
136EAPI void
137ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
138 Ecore_X_Rectangle *rects,
139 int num)
140{
141#ifdef ECORE_XCB_SHAPE
142 xcb_rectangle_t *rect = NULL;
143#endif
144
145 LOGFN(__FILE__, __LINE__, __FUNCTION__);
146 CHECK_XCB_CONN;
147
148 if (!rects) return;
149
150#ifdef ECORE_XCB_SHAPE
151 if (num > 0)
152 {
153 int i = 0;
154
155 if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
156 return;
157
158 for (i = 0; i < num; i++)
159 {
160 rect[i].x = rects[i].x;
161 rect[i].y = rects[i].y;
162 rect[i].width = rects[i].width;
163 rect[i].height = rects[i].height;
164 }
165 }
166 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
167 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
168 win, 0, 0, num, (xcb_rectangle_t *)rect);
169
170 if (rect) free(rect);
171// ecore_x_flush();
172#else
173 return;
174 win = 0;
175 num = 0;
176 rects = NULL;
177#endif
178}
179
180EAPI void
181ecore_x_window_shape_window_add(Ecore_X_Window win,
182 Ecore_X_Window shape_win)
183{
184 LOGFN(__FILE__, __LINE__, __FUNCTION__);
185 CHECK_XCB_CONN;
186
187#ifdef ECORE_XCB_SHAPE
188 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
189 XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
190 win, 0, 0, shape_win);
191// ecore_x_flush();
192#else
193 return;
194 win = 0;
195 shape_win = 0;
196#endif
197}
198
199EAPI void
200ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
201 Ecore_X_Window shape_win,
202 int x,
203 int y)
204{
205 LOGFN(__FILE__, __LINE__, __FUNCTION__);
206 CHECK_XCB_CONN;
207
208#ifdef ECORE_XCB_SHAPE
209 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
210 XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
211 win, x, y, shape_win);
212// ecore_x_flush();
213#else
214 return;
215 win = 0;
216 shape_win = 0;
217 x = 0;
218 y = 0;
219#endif
220}
221
222EAPI void
223ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
224 int x,
225 int y,
226 int w,
227 int h)
228{
229#ifdef ECORE_XCB_SHAPE
230 xcb_rectangle_t rect;
231#endif
232
233 LOGFN(__FILE__, __LINE__, __FUNCTION__);
234 CHECK_XCB_CONN;
235
236#ifdef ECORE_XCB_SHAPE
237 rect.x = x;
238 rect.y = y;
239 rect.width = w;
240 rect.height = h;
241 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
242 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
243 win, 0, 0, 1, &rect);
244// ecore_x_flush();
245#else
246 return;
247 win = 0;
248 x = 0;
249 y = 0;
250 w = 0;
251 h = 0;
252#endif
253}
254
255EAPI void
256ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
257 int x,
258 int y,
259 int w,
260 int h)
261{
262#ifdef ECORE_XCB_SHAPE
263 xcb_rectangle_t rect;
264#endif
265
266 LOGFN(__FILE__, __LINE__, __FUNCTION__);
267 CHECK_XCB_CONN;
268
269#ifdef ECORE_XCB_SHAPE
270 rect.x = x;
271 rect.y = y;
272 rect.width = w;
273 rect.height = h;
274 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
275 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
276 win, 0, 0, 1, &rect);
277// ecore_x_flush();
278#else
279 return;
280 win = 0;
281 x = 0;
282 y = 0;
283 w = 0;
284 h = 0;
285#endif
286}
287
288EAPI void
289ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
290 int x,
291 int y,
292 int w,
293 int h)
294{
295#ifdef ECORE_XCB_SHAPE
296 xcb_rectangle_t rect;
297#endif
298
299 LOGFN(__FILE__, __LINE__, __FUNCTION__);
300 CHECK_XCB_CONN;
301
302#ifdef ECORE_XCB_SHAPE
303 rect.x = x;
304 rect.y = y;
305 rect.width = w;
306 rect.height = h;
307 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
308 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
309 win, 0, 0, 1, &rect);
310// ecore_x_flush();
311#else
312 return;
313 win = 0;
314 x = 0;
315 y = 0;
316 w = 0;
317 h = 0;
318#endif
319}
320
321EAPI void
322ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
323 Ecore_X_Rectangle *rects,
324 int num)
325{
326#ifdef ECORE_XCB_SHAPE
327 xcb_rectangle_t *rect = NULL;
328#endif
329
330 LOGFN(__FILE__, __LINE__, __FUNCTION__);
331 CHECK_XCB_CONN;
332
333#ifdef ECORE_XCB_SHAPE
334 if (num > 0)
335 {
336 int i = 0;
337
338 if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
339 return;
340
341 for (i = 0; i < num; i++)
342 {
343 rect[i].x = rects[i].x;
344 rect[i].y = rects[i].y;
345 rect[i].width = rects[i].width;
346 rect[i].height = rects[i].height;
347 }
348 }
349
350 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
351 XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
352 win, 0, 0, num, (xcb_rectangle_t *)&rect);
353
354 if (rect) free(rect);
355// ecore_x_flush();
356#else
357 return;
358 win = 0;
359 num = 0;
360 rects = NULL;
361#endif
362}
363
364EAPI Ecore_X_Rectangle *
365ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
366 int *num_ret)
367{
368 Ecore_X_Rectangle *rects = NULL;
369#ifdef ECORE_XCB_SHAPE
370 xcb_shape_get_rectangles_cookie_t cookie;
371 xcb_shape_get_rectangles_reply_t *reply;
372 xcb_rectangle_t *r;
373 unsigned int i = 0;
374#endif
375
376 LOGFN(__FILE__, __LINE__, __FUNCTION__);
377 CHECK_XCB_CONN;
378
379 if (num_ret) *num_ret = 0;
380
381#ifdef ECORE_XCB_SHAPE
382 cookie =
383 xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_BOUNDING);
384 reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
385 if (!reply) return NULL;
386 if (num_ret) *num_ret = reply->rectangles_len;
387
388 if (reply->rectangles_len < 1)
389 {
390 free(reply);
391 if (num_ret) *num_ret = 0;
392 return NULL;
393 }
394
395 rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len);
396 if (!rects)
397 {
398 free(reply);
399 if (num_ret) *num_ret = 0;
400 return NULL;
401 }
402 r = xcb_shape_get_rectangles_rectangles(reply);
403 for (i = 0; i < reply->rectangles_len; i++)
404 {
405 rects[i].x = r[i].x;
406 rects[i].y = r[i].y;
407 rects[i].width = r[i].width;
408 rects[i].height = r[i].height;
409 }
410
411 free(reply);
412
413 return rects;
414#else
415 return rects;
416 win = 0;
417#endif
418}
419
420EAPI void
421ecore_x_window_shape_events_select(Ecore_X_Window win,
422 Eina_Bool on)
423{
424 LOGFN(__FILE__, __LINE__, __FUNCTION__);
425 CHECK_XCB_CONN;
426
427#ifdef ECORE_XCB_SHAPE
428 xcb_shape_select_input(_ecore_xcb_conn, win, on);
429// ecore_x_flush();
430#else
431 return;
432 win = 0;
433 on = 0;
434#endif
435}
436
437EAPI Ecore_X_Rectangle *
438ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
439 int *num_ret)
440{
441 Ecore_X_Rectangle *rects = NULL;
442#ifdef ECORE_XCB_SHAPE
443 xcb_shape_get_rectangles_cookie_t cookie;
444 xcb_shape_get_rectangles_reply_t *reply;
445 xcb_rectangle_t *r;
446 unsigned int i = 0;
447#endif
448
449 LOGFN(__FILE__, __LINE__, __FUNCTION__);
450 CHECK_XCB_CONN;
451
452 if (num_ret) *num_ret = 0;
453
454#ifdef ECORE_XCB_SHAPE
455 cookie =
456 xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_INPUT);
457 reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
458 if (!reply) return NULL;
459 if (num_ret) *num_ret = reply->rectangles_len;
460
461 if (reply->rectangles_len < 1)
462 {
463 free(reply);
464 if (num_ret) *num_ret = 0;
465 return NULL;
466 }
467
468 rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len);
469 if (!rects)
470 {
471 free(reply);
472 if (num_ret) *num_ret = 0;
473 return NULL;
474 }
475 r = xcb_shape_get_rectangles_rectangles(reply);
476 for (i = 0; i < reply->rectangles_len; i++)
477 {
478 rects[i].x = r[i].x;
479 rects[i].y = r[i].y;
480 rects[i].width = r[i].width;
481 rects[i].height = r[i].height;
482 }
483
484 free(reply);
485
486 return rects;
487#else
488 xcb_get_geometry_cookie_t cookie;
489 xcb_get_geometry_reply_t *reply;
490
491 if (!(rects = malloc(sizeof(Ecore_X_Rectangle))))
492 return NULL;
493
494 /* get geometry */
495 cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win);
496 reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
497 if (reply)
498 {
499 rects[0].x = reply->x;
500 rects[0].y = reply->y;
501 rects[0].width = reply->width;
502 rects[0].height = reply->height;
503 free(reply);
504 }
505 if (num_ret) *num_ret = 1;
506 return rects;
507#endif
508}
509
510EAPI void
511ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
512 Ecore_X_Rectangle *rects,
513 int num)
514{
515#ifdef ECORE_XCB_SHAPE
516 xcb_rectangle_t *rect = NULL;
517#endif
518
519 LOGFN(__FILE__, __LINE__, __FUNCTION__);
520 CHECK_XCB_CONN;
521
522 if (!rects) return;
523
524#ifdef ECORE_XCB_SHAPE
525 if (num > 0)
526 {
527 int i = 0;
528
529 if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
530 return;
531
532 for (i = 0; i < num; i++)
533 {
534 rect[i].x = rects[i].x;
535 rect[i].y = rects[i].y;
536 rect[i].width = rects[i].width;
537 rect[i].height = rects[i].height;
538 }
539 }
540 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
541 XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
542 win, 0, 0, num, (xcb_rectangle_t *)rect);
543
544 if (rect) free(rect);
545// ecore_x_flush();
546#else
547 return;
548 win = 0;
549 num = 0;
550 rects = NULL;
551#endif
552}
553
554EAPI void
555ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
556 int x,
557 int y,
558 int w,
559 int h)
560{
561#ifdef ECORE_XCB_SHAPE
562 xcb_rectangle_t rect;
563#endif
564
565 LOGFN(__FILE__, __LINE__, __FUNCTION__);
566 CHECK_XCB_CONN;
567
568#ifdef ECORE_XCB_SHAPE
569 rect.x = x;
570 rect.y = y;
571 rect.width = w;
572 rect.height = h;
573 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
574 XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
575 win, 0, 0, 1, &rect);
576// ecore_x_flush();
577#else
578 return;
579 win = 0;
580 x = 0;
581 y = 0;
582 w = 0;
583 h = 0;
584#endif
585}
586
587EAPI void
588ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
589 int x,
590 int y,
591 int w,
592 int h)
593{
594#ifdef ECORE_XCB_SHAPE
595 xcb_rectangle_t rect;
596#endif
597
598 LOGFN(__FILE__, __LINE__, __FUNCTION__);
599 CHECK_XCB_CONN;
600
601#ifdef ECORE_XCB_SHAPE
602 rect.x = x;
603 rect.y = y;
604 rect.width = w;
605 rect.height = h;
606 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
607 XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
608 win, 0, 0, 1, &rect);
609// ecore_x_flush();
610#else
611 return;
612 win = 0;
613 x = 0;
614 y = 0;
615 w = 0;
616 h = 0;
617#endif
618}
619
620EAPI void
621ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
622 int x,
623 int y,
624 int w,
625 int h)
626{
627#ifdef ECORE_XCB_SHAPE
628 xcb_rectangle_t rect;
629#endif
630
631 LOGFN(__FILE__, __LINE__, __FUNCTION__);
632 CHECK_XCB_CONN;
633
634#ifdef ECORE_XCB_SHAPE
635 rect.x = x;
636 rect.y = y;
637 rect.width = w;
638 rect.height = h;
639 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
640 XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
641 win, 0, 0, 1, &rect);
642// ecore_x_flush();
643#else
644 return;
645 win = 0;
646 x = 0;
647 y = 0;
648 w = 0;
649 h = 0;
650#endif
651}
652
653EAPI void
654ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
655 Ecore_X_Window shape_win,
656 int x,
657 int y)
658{
659 LOGFN(__FILE__, __LINE__, __FUNCTION__);
660 CHECK_XCB_CONN;
661
662#ifdef ECORE_XCB_SHAPE
663 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
664 XCB_SHAPE_SK_INPUT, win, x, y, shape_win);
665// ecore_x_flush();
666#else
667 return;
668 win = 0;
669 shape_win = 0;
670 x = 0;
671 y = 0;
672#endif
673}
674
675EAPI void
676ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
677 Ecore_X_Window shape_win,
678 int x,
679 int y)
680{
681 LOGFN(__FILE__, __LINE__, __FUNCTION__);
682 CHECK_XCB_CONN;
683
684#ifdef ECORE_XCB_SHAPE
685 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_INPUT,
686 XCB_SHAPE_SK_INPUT, win, x, y, shape_win);
687// ecore_x_flush();
688#else
689 return;
690 win = 0;
691 shape_win = 0;
692 x = 0;
693 y = 0;
694#endif
695}
696
697EAPI void
698ecore_x_window_shape_input_window_set(Ecore_X_Window win,
699 Ecore_X_Window shape_win)
700{
701 LOGFN(__FILE__, __LINE__, __FUNCTION__);
702 CHECK_XCB_CONN;
703
704#ifdef ECORE_XCB_SHAPE
705 xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
706 XCB_SHAPE_SK_INPUT, win, 0, 0, shape_win);
707// ecore_x_flush();
708#else
709 return;
710 win = 0;
711 shape_win = 0;
712#endif
713}
714
715EAPI void
716ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
717 int x,
718 int y,
719 int w,
720 int h)
721{
722#ifdef ECORE_XCB_SHAPE
723 xcb_rectangle_t rect;
724#endif
725
726 LOGFN(__FILE__, __LINE__, __FUNCTION__);
727 CHECK_XCB_CONN;
728
729#ifdef ECORE_XCB_SHAPE
730 rect.x = x;
731 rect.y = y;
732 rect.width = w;
733 rect.height = h;
734 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
735 XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
736 win, 0, 0, 1, &rect);
737// ecore_x_flush();
738#else
739 return;
740 win = 0;
741 x = 0;
742 y = 0;
743 w = 0;
744 h = 0;
745#endif
746}
747
748EAPI void
749ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
750 Ecore_X_Rectangle *rects,
751 int num)
752{
753#ifdef ECORE_XCB_SHAPE
754 xcb_rectangle_t *rect = NULL;
755#endif
756
757 LOGFN(__FILE__, __LINE__, __FUNCTION__);
758 CHECK_XCB_CONN;
759
760#ifdef ECORE_XCB_SHAPE
761 if (num > 0)
762 {
763 int i = 0;
764
765 if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
766 return;
767
768 for (i = 0; i < num; i++)
769 {
770 rect[i].x = rects[i].x;
771 rect[i].y = rects[i].y;
772 rect[i].width = rects[i].width;
773 rect[i].height = rects[i].height;
774 }
775 }
776
777 xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
778 XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
779 win, 0, 0, num, (xcb_rectangle_t *)&rect);
780
781 if (rect) free(rect);
782// ecore_x_flush();
783#else
784 return;
785 win = 0;
786 num = 0;
787 rects = NULL;
788#endif
789}
790
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
deleted file mode 100644
index e0e5610..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c
+++ /dev/null
@@ -1,116 +0,0 @@
1#include "ecore_xcb_private.h"
2#include <fnmatch.h>
3
4/* local function prototypes */
5static Eina_Bool _ecore_xcb_xdefaults_glob_match(const char *str,
6 const char *glob);
7
8/* local variables */
9static Eina_File *_ecore_xcb_xdefaults_file = NULL;
10static char *_ecore_xcb_xdefaults_data = NULL;
11
12void
13_ecore_xcb_xdefaults_init(void)
14{
15 char buff[PATH_MAX];
16
17 LOGFN(__FILE__, __LINE__, __FUNCTION__);
18
19 snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME"));
20 if ((_ecore_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE)))
21 {
22 eina_mmap_safety_enabled_set(EINA_TRUE);
23
24 _ecore_xcb_xdefaults_data =
25 eina_file_map_all(_ecore_xcb_xdefaults_file, EINA_FILE_SEQUENTIAL);
26 }
27}
28
29void
30_ecore_xcb_xdefaults_shutdown(void)
31{
32 LOGFN(__FILE__, __LINE__, __FUNCTION__);
33
34 if (!_ecore_xcb_xdefaults_file) return;
35 if (_ecore_xcb_xdefaults_data)
36 eina_file_map_free(_ecore_xcb_xdefaults_file, _ecore_xcb_xdefaults_data);
37 if (_ecore_xcb_xdefaults_file) eina_file_close(_ecore_xcb_xdefaults_file);
38}
39
40char *
41_ecore_xcb_xdefaults_string_get(const char *prog,
42 const char *param)
43{
44 char buff[1024], ret[1024];
45 char *str = NULL;
46 char **ea = NULL;
47 unsigned int count = 0, i = 0;
48
49 if ((!_ecore_xcb_xdefaults_data) || (!_ecore_xcb_xdefaults_file))
50 return NULL;
51
52 snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param);
53
54 str = _ecore_xcb_xdefaults_data;
55 ea = eina_str_split_full(str, "\n", -1, &count);
56 for (i = 0; i < count; i++)
57 {
58 if (_ecore_xcb_xdefaults_glob_match(ea[i], buff))
59 sscanf(ea[i], "%*[^:]:%*[ ]%s", ret);
60 }
61 if ((ea) && (ea[0]))
62 {
63 free(ea[0]);
64 free(ea);
65 }
66
67 return strdup(ret);
68}
69
70int
71_ecore_xcb_xdefaults_int_get(const char *prog,
72 const char *param)
73{
74 char buff[1024];
75 char *str = NULL;
76 char **ea = NULL;
77 unsigned int count = 0, i = 0;
78 int ret = -1;
79
80 if ((!_ecore_xcb_xdefaults_data) || (!_ecore_xcb_xdefaults_file))
81 return 0;
82
83 snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param);
84
85 str = _ecore_xcb_xdefaults_data;
86 ea = eina_str_split_full(str, "\n", -1, &count);
87 for (i = 0; i < count; i++)
88 {
89 if (_ecore_xcb_xdefaults_glob_match(ea[i], buff))
90 sscanf(ea[i], "%*[^:]:%*[ ]%d", &ret);
91 }
92 if ((ea) && (ea[0]))
93 {
94 free(ea[0]);
95 free(ea);
96 }
97
98 return ret;
99}
100
101/* local functions */
102static Eina_Bool
103_ecore_xcb_xdefaults_glob_match(const char *str,
104 const char *glob)
105{
106 if ((!str) || (!glob)) return EINA_FALSE;
107 if (glob[0] == 0)
108 {
109 if (str[0] == 0) return EINA_TRUE;
110 return EINA_FALSE;
111 }
112 if (!strcmp(glob, "*")) return EINA_TRUE;
113 if (!fnmatch(glob, str, 0)) return EINA_TRUE;
114 return EINA_FALSE;
115}
116
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
deleted file mode 100644
index bbca2a5..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c
+++ /dev/null
@@ -1,750 +0,0 @@
1#include "ecore_xcb_private.h"
2# ifdef ECORE_XCB_XFIXES
3# include <xcb/xfixes.h>
4# endif
5
6/* local function prototypes */
7static xcb_rectangle_t *_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects,
8 int num);
9static Ecore_X_Rectangle *_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects,
10 int num);
11
12/* local variables */
13static Eina_Bool _xfixes_avail = EINA_FALSE;
14
15/* external variables */
16int _ecore_xcb_event_xfixes = -1;
17
18void
19_ecore_xcb_xfixes_init(void)
20{
21 LOGFN(__FILE__, __LINE__, __FUNCTION__);
22
23#ifdef ECORE_XCB_XFIXES
24 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xfixes_id);
25#endif
26}
27
28void
29_ecore_xcb_xfixes_finalize(void)
30{
31#ifdef ECORE_XCB_XFIXES
32 const xcb_query_extension_reply_t *ext_reply;
33#endif
34
35 LOGFN(__FILE__, __LINE__, __FUNCTION__);
36
37#ifdef ECORE_XCB_XFIXES
38 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xfixes_id);
39 if ((ext_reply) && (ext_reply->present))
40 {
41 xcb_xfixes_query_version_cookie_t cookie;
42 xcb_xfixes_query_version_reply_t *reply;
43
44 cookie =
45 xcb_xfixes_query_version_unchecked(_ecore_xcb_conn,
46 XCB_XFIXES_MAJOR_VERSION,
47 XCB_XFIXES_MINOR_VERSION);
48 reply = xcb_xfixes_query_version_reply(_ecore_xcb_conn, cookie, NULL);
49 if (reply)
50 {
51 /* NB: XFixes Extension >= 3 needed for shape stuff.
52 * for now, I am removing this check so that it matches the
53 * xlib code closer. If the extension version ends up being
54 * that important, then re-enable this */
55
56 /* if (reply->major_version >= 3) */
57 _xfixes_avail = EINA_TRUE;
58 free(reply);
59 }
60
61 if (_xfixes_avail)
62 _ecore_xcb_event_xfixes = ext_reply->first_event;
63 }
64#endif
65}
66
67EAPI Eina_Bool
68ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
69{
70#ifdef ECORE_XCB_XFIXES
71 Ecore_X_Window root = 0;
72 xcb_void_cookie_t cookie;
73 xcb_generic_error_t *err;
74 int mask = 0;
75#endif
76
77 CHECK_XCB_CONN;
78
79 if (!_xfixes_avail) return EINA_FALSE;
80
81#ifdef ECORE_XCB_XFIXES
82 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
83
84 mask = (XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER |
85 XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY |
86 XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE);
87
88 cookie =
89 xcb_xfixes_select_selection_input_checked(_ecore_xcb_conn, root,
90 selection, mask);
91 err = xcb_request_check(_ecore_xcb_conn, cookie);
92 if (err)
93 {
94 free(err);
95 return EINA_FALSE;
96 }
97
98 return EINA_TRUE;
99#endif
100 return EINA_FALSE;
101}
102
103Eina_Bool
104_ecore_xcb_xfixes_avail_get(void)
105{
106 return _xfixes_avail;
107}
108
109/**
110 * @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions
111 *
112 * Functions related to the X Fixes extension.
113 */
114
115/**
116 * Create a region from rectangles.
117 * @param rects The rectangles used to initialize the region.
118 * @param num The number of rectangles.
119 * @return The newly created region.
120 *
121 * Create a region initialized to the specified list of rectangles
122 * @p rects. The rectangles may be specified in any order, their union
123 * becomes the region.
124 * @ingroup Ecore_X_Fixes_Group
125 */
126EAPI Ecore_X_Region
127ecore_x_region_new(Ecore_X_Rectangle *rects,
128 int num)
129{
130 Ecore_X_Region region = 0;
131#ifdef ECORE_XCB_XFIXES
132 xcb_rectangle_t *xrects;
133#endif
134
135 LOGFN(__FILE__, __LINE__, __FUNCTION__);
136 CHECK_XCB_CONN;
137
138 if (!_xfixes_avail) return 0;
139
140#ifdef ECORE_XCB_XFIXES
141 xrects = _ecore_xcb_rect_to_xcb(rects, num);
142 region = xcb_generate_id(_ecore_xcb_conn);
143 xcb_xfixes_create_region(_ecore_xcb_conn, region, num, xrects);
144 free(xrects);
145// ecore_x_flush();
146#endif
147
148 return region;
149}
150
151/**
152 * Create a region from a pixmap.
153 * @param bitmap The bitmap used to initialize the region.
154 * @return The newly created region.
155 *
156 * Creates a region initialized to the set of 'one' pixels in @p bitmap
157 * (which must be of depth 1, else Match error).
158 * @ingroup Ecore_X_Fixes_Group
159 */
160EAPI Ecore_X_Region
161ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
162{
163 Ecore_X_Region region = 0;
164
165 LOGFN(__FILE__, __LINE__, __FUNCTION__);
166 CHECK_XCB_CONN;
167
168 if (!_xfixes_avail) return 0;
169
170#ifdef ECORE_XCB_XFIXES
171 region = xcb_generate_id(_ecore_xcb_conn);
172 xcb_xfixes_create_region_from_bitmap(_ecore_xcb_conn, region, bitmap);
173// ecore_x_flush();
174#endif
175
176 return region;
177}
178
179/**
180 * Create a region from a window.
181 * @param win The window used to initialize the region.
182 * @param type The type of the region.
183 * @return The newly created region.
184 *
185 * Creates a region initialized to the specified @p window region. See
186 * the Shape extension for the definition of Bounding and Clip
187 * regions.
188 * @ingroup Ecore_X_Fixes_Group
189 */
190EAPI Ecore_X_Region
191ecore_x_region_new_from_window(Ecore_X_Window win,
192 Ecore_X_Region_Type type)
193{
194 Ecore_X_Region region = 0;
195
196 LOGFN(__FILE__, __LINE__, __FUNCTION__);
197 CHECK_XCB_CONN;
198
199 if (!_xfixes_avail) return 0;
200
201#ifdef ECORE_XCB_XFIXES
202 region = xcb_generate_id(_ecore_xcb_conn);
203 xcb_xfixes_create_region_from_window(_ecore_xcb_conn, region, win, type);
204// ecore_x_flush();
205#endif
206
207 return region;
208}
209
210/**
211 * Create a region from a graphic context.
212 * @param gc The graphic context used to initialize the region.
213 * @return The newly created region.
214 *
215 * Creates a region initialized from the clip list of @p gc.
216 * @ingroup Ecore_X_Fixes_Group
217 */
218EAPI Ecore_X_Region
219ecore_x_region_new_from_gc(Ecore_X_GC gc)
220{
221 Ecore_X_Region region = 0;
222
223 LOGFN(__FILE__, __LINE__, __FUNCTION__);
224 CHECK_XCB_CONN;
225
226 if (!_xfixes_avail) return 0;
227
228#ifdef ECORE_XCB_XFIXES
229 region = xcb_generate_id(_ecore_xcb_conn);
230 xcb_xfixes_create_region_from_gc(_ecore_xcb_conn, region, gc);
231// ecore_x_flush();
232#endif
233
234 return region;
235}
236
237/**
238 * Create a region from a picture.
239 * @param picture The picture used to initialize the region.
240 * @return The newly created region.
241 *
242 * Creates a region initialized from the clip list of @p picture.
243 * @ingroup Ecore_X_Fixes_Group
244 */
245EAPI Ecore_X_Region
246ecore_x_region_new_from_picture(Ecore_X_Picture picture)
247{
248 Ecore_X_Region region = 0;
249
250 LOGFN(__FILE__, __LINE__, __FUNCTION__);
251 CHECK_XCB_CONN;
252
253 if (!_xfixes_avail) return 0;
254
255#ifdef ECORE_XCB_XFIXES
256 region = xcb_generate_id(_ecore_xcb_conn);
257 xcb_xfixes_create_region_from_picture(_ecore_xcb_conn, region, picture);
258// ecore_x_flush();
259#endif
260
261 return region;
262}
263
264/**
265 * Destroy a region.
266 * @param region The region to destroy.
267 *
268 * Destroy the specified @p region.
269 * @ingroup Ecore_X_Fixes_Group
270 */
271EAPI void
272ecore_x_region_free(Ecore_X_Region region)
273{
274 LOGFN(__FILE__, __LINE__, __FUNCTION__);
275 CHECK_XCB_CONN;
276
277 if (!_xfixes_avail) return;
278
279#ifdef ECORE_XCB_XFIXES
280 xcb_xfixes_destroy_region(_ecore_xcb_conn, region);
281// ecore_x_flush();
282#endif
283}
284
285/**
286 * Set the content of a region.
287 * @param region The region to destroy.
288 * @param rects The rectangles used to set the region.
289 * @param num The number of rectangles.
290 *
291 * Replace the current contents of @p region with the region formed
292 * by the union of the rectangles @p rects.
293 * @ingroup Ecore_X_Fixes_Group
294 */
295EAPI void
296ecore_x_region_set(Ecore_X_Region region,
297 Ecore_X_Rectangle *rects,
298 int num)
299{
300#ifdef ECORE_XCB_XFIXES
301 xcb_rectangle_t *xrects;
302#endif
303
304 LOGFN(__FILE__, __LINE__, __FUNCTION__);
305 CHECK_XCB_CONN;
306
307 if (!_xfixes_avail) return;
308
309#ifdef ECORE_XCB_XFIXES
310 xrects = _ecore_xcb_rect_to_xcb(rects, num);
311 xcb_xfixes_set_region(_ecore_xcb_conn, region, num, xrects);
312 free(xrects);
313// ecore_x_flush();
314#endif
315}
316
317/**
318 * Copy the content of a region.
319 * @param dest The destination region.
320 * @param source The source region.
321 *
322 * Replace the contents of @p dest with the contents of @p source.
323 * @ingroup Ecore_X_Fixes_Group
324 */
325EAPI void
326ecore_x_region_copy(Ecore_X_Region dest,
327 Ecore_X_Region source)
328{
329 LOGFN(__FILE__, __LINE__, __FUNCTION__);
330 CHECK_XCB_CONN;
331
332 if (!_xfixes_avail) return;
333
334 // NB: Hmmmm...this may need converting to/fro xcb_rectangle_t
335#ifdef ECORE_XCB_XFIXES
336 xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest);
337// ecore_x_flush();
338#endif
339}
340
341/**
342 * Make the union of two regions.
343 * @param dest The destination region.
344 * @param source1 The first source region.
345 * @param source2 The second source region.
346 *
347 * Replace the contents of @p dest with the union of @p source1 and
348 * @p source2.
349 * @ingroup Ecore_X_Fixes_Group
350 */
351EAPI void
352ecore_x_region_combine(Ecore_X_Region dest,
353 Ecore_X_Region source1,
354 Ecore_X_Region source2)
355{
356 LOGFN(__FILE__, __LINE__, __FUNCTION__);
357 CHECK_XCB_CONN;
358
359 if (!_xfixes_avail) return;
360
361#ifdef ECORE_XCB_XFIXES
362 xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest);
363// ecore_x_flush();
364#endif
365}
366
367/**
368 * Make the intersection of two regions.
369 * @param dest The destination region.
370 * @param source1 The first source region.
371 * @param source2 The second source region.
372 *
373 * Replace the contents of @p dest with the intersection of @p source1 and
374 * @p source2.
375 * @ingroup Ecore_X_Fixes_Group
376 */
377EAPI void
378ecore_x_region_intersect(Ecore_X_Region dest,
379 Ecore_X_Region source1,
380 Ecore_X_Region source2)
381{
382 LOGFN(__FILE__, __LINE__, __FUNCTION__);
383 CHECK_XCB_CONN;
384
385 if (!_xfixes_avail) return;
386
387#ifdef ECORE_XCB_XFIXES
388 xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest);
389// ecore_x_flush();
390#endif
391}
392
393/**
394 * Make the subtraction of two regions.
395 * @param dest The destination region.
396 * @param source1 The first source region.
397 * @param source2 The second source region.
398 *
399 * Replace the contents of @p dest with the subtraction of @p source1 by
400 * @p source2.
401 * @ingroup Ecore_X_Fixes_Group
402 */
403EAPI void
404ecore_x_region_subtract(Ecore_X_Region dest,
405 Ecore_X_Region source1,
406 Ecore_X_Region source2)
407{
408 LOGFN(__FILE__, __LINE__, __FUNCTION__);
409 CHECK_XCB_CONN;
410
411 if (!_xfixes_avail) return;
412
413#ifdef ECORE_XCB_XFIXES
414 xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest);
415// ecore_x_flush();
416#endif
417}
418
419/**
420 * Make the subtraction of regions by bounds.
421 * @param dest The destination region.
422 * @param bounds The bounds.
423 * @param source The source region.
424 *
425 * The @p source region is subtracted from the region specified by
426 * @p bounds. The result is placed in @p dest, replacing its
427 * contents.
428 * @ingroup Ecore_X_Fixes_Group
429 */
430EAPI void
431ecore_x_region_invert(Ecore_X_Region dest,
432 Ecore_X_Rectangle *bounds,
433 Ecore_X_Region source)
434{
435#ifdef ECORE_XCB_XFIXES
436 xcb_rectangle_t xrects;
437#endif
438
439 LOGFN(__FILE__, __LINE__, __FUNCTION__);
440 CHECK_XCB_CONN;
441
442 if (!_xfixes_avail) return;
443
444#ifdef ECORE_XCB_XFIXES
445 xrects.x = bounds->x;
446 xrects.y = bounds->y;
447 xrects.width = bounds->width;
448 xrects.height = bounds->height;
449
450 xcb_xfixes_invert_region(_ecore_xcb_conn, source, xrects, dest);
451// ecore_x_flush();
452#endif
453}
454
455/**
456 * Translate a region.
457 * @param region The region to translate.
458 * @param dx The horizontal translation.
459 * @param dy The vertical translation.
460 *
461 * The @p region is translated by @p dx and @p dy in place.
462 * @ingroup Ecore_X_Fixes_Group
463 */
464EAPI void
465ecore_x_region_translate(Ecore_X_Region region,
466 int dx,
467 int dy)
468{
469 LOGFN(__FILE__, __LINE__, __FUNCTION__);
470 CHECK_XCB_CONN;
471
472 if (!_xfixes_avail) return;
473
474#ifdef ECORE_XCB_XFIXES
475 xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy);
476// ecore_x_flush();
477#endif
478}
479
480/**
481 * Extent a region.
482 * @param dest The destination region.
483 * @param source The source region.
484 *
485 * The extents of the @p source region are placed in @p dest.
486 * @ingroup Ecore_X_Fixes_Group
487 */
488EAPI void
489ecore_x_region_extents(Ecore_X_Region dest,
490 Ecore_X_Region source)
491{
492 LOGFN(__FILE__, __LINE__, __FUNCTION__);
493 CHECK_XCB_CONN;
494
495 if (!_xfixes_avail) return;
496
497#ifdef ECORE_XCB_XFIXES
498 xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest);
499// ecore_x_flush();
500#endif
501}
502
503/**
504 * Return the rectangles that compose a region.
505 * @param region The region (Unused).
506 * @param num The number of returned rectangles.
507 * @param bounds The returned bounds of the region.
508 * @return The returned rectangles.
509 *
510 * The @p region passed to ecore_xcb_region_fetch_prefetch() is
511 * returned as a list of rectagles in XY-banded order.
512 *
513 * To use this function, you must call before, and in order,
514 * ecore_xcb_region_fetch_prefetch(), which sends the XFixesFetchRegion request,
515 * then ecore_xcb_region_fetch_fetch(), which gets the reply.
516 * @ingroup Ecore_X_Fixes_Group
517 */
518EAPI Ecore_X_Rectangle *
519ecore_x_region_fetch(Ecore_X_Region region,
520 int *num,
521 Ecore_X_Rectangle *bounds)
522{
523 Ecore_X_Rectangle extents = { 0, 0, 0, 0 };
524 Ecore_X_Rectangle *rects = NULL;
525#ifdef ECORE_XCB_XFIXES
526 xcb_xfixes_fetch_region_cookie_t cookie;
527 xcb_xfixes_fetch_region_reply_t *reply;
528 xcb_rectangle_t *r;
529 int n = 0;
530#endif
531
532 LOGFN(__FILE__, __LINE__, __FUNCTION__);
533 CHECK_XCB_CONN;
534
535 if (num) *num = 0;
536 if (bounds) *bounds = extents;
537 if (!_xfixes_avail) return NULL;
538
539#ifdef ECORE_XCB_XFIXES
540 cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region);
541 reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL);
542 if (!reply) return NULL;
543
544 r = xcb_xfixes_fetch_region_rectangles(reply);
545 n = xcb_xfixes_fetch_region_rectangles_length(reply);
546 rects = _ecore_xcb_rect_to_ecore(r, n);
547 if (num) *num = n;
548
549 /* rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle)); */
550 /* if (!rects) */
551 /* { */
552 /* free(reply); */
553 /* return NULL; */
554 /* } */
555
556 /* for (i = 0; i < n; i++) */
557 /* { */
558 /* rects[i].x = r[i].x; */
559 /* rects[i].y = r[i].y; */
560 /* rects[i].width = r[i].width; */
561 /* rects[i].height = r[i].height; */
562 /* } */
563
564 (*bounds).x = reply->extents.x;
565 (*bounds).y = reply->extents.y;
566 (*bounds).width = reply->extents.width;
567 (*bounds).height = reply->extents.height;
568
569 free(reply);
570#endif
571
572 return rects;
573}
574
575/**
576 * Expand a region.
577 * @param dest The destination region.
578 * @param source The source region.
579 * @param left The number of pixels to add on the left.
580 * @param right The number of pixels to add on the right.
581 * @param top The number of pixels to add at the top.
582 * @param bottom The number of pixels to add at the bottom.
583 *
584 * Put in @p dest the area specified by expanding each rectangle in
585 * the @p source region by the specified number of pixels to the
586 * @p left, @p right, @p top and @p bottom.
587 * @ingroup Ecore_X_Fixes_Group
588 */
589EAPI void
590ecore_x_region_expand(Ecore_X_Region dest,
591 Ecore_X_Region source,
592 unsigned int left,
593 unsigned int right,
594 unsigned int top,
595 unsigned int bottom)
596{
597 LOGFN(__FILE__, __LINE__, __FUNCTION__);
598 CHECK_XCB_CONN;
599
600 if (!_xfixes_avail) return;
601
602#ifdef ECORE_XCB_XFIXES
603 xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom);
604// ecore_x_flush();
605#endif
606}
607
608/**
609 * Change clip-mask in a graphic context to the specified region.
610 * @param region The region to change.
611 * @param gc The clip-mask graphic context.
612 * @param x The horizontal translation.
613 * @param y The vertical translation.
614 *
615 * Changes clip-mask in @p gc to the specified @p region and
616 * sets the clip origin with the values of @p x_origin and @p y_origin.
617 * Output will be clippped to remain contained within the region. The
618 * clip origin is interpreted relative to the origin of whatever
619 * destination drawable is specified in a graphics request. The
620 * region is interpreted relative to the clip origin. Future changes
621 * to region have no effect on the gc clip-mask.
622 * @ingroup Ecore_X_Fixes_Group
623 */
624EAPI void
625ecore_x_region_gc_clip_set(Ecore_X_Region region,
626 Ecore_X_GC gc,
627 int x,
628 int y)
629{
630 LOGFN(__FILE__, __LINE__, __FUNCTION__);
631 CHECK_XCB_CONN;
632
633 if (!_xfixes_avail) return;
634
635#ifdef ECORE_XCB_XFIXES
636 xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x, y);
637// ecore_x_flush();
638#endif
639}
640
641/**
642 * Change the shape extension of a window.
643 * @param region The region.
644 * @param dest The window whose shape is changed.
645 * @param type The kind of shape.
646 * @param x The horizontal offset.
647 * @param y The vertical offset.
648 *
649 * Set the specified Shape extension region of @p window to @p region,
650 * offset by @p x_offset and @p y_offset. Future changes to region
651 * have no effect on the window shape.
652 * @ingroup Ecore_X_Fixes_Group
653 */
654EAPI void
655ecore_x_region_window_shape_set(Ecore_X_Region region,
656 Ecore_X_Window dest,
657 Ecore_X_Shape_Type type,
658 int x,
659 int y)
660{
661 LOGFN(__FILE__, __LINE__, __FUNCTION__);
662 CHECK_XCB_CONN;
663
664 if (!_xfixes_avail) return;
665
666#ifdef ECORE_XCB_XFIXES
667 xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x, y, region);
668// ecore_x_flush();
669#endif
670}
671
672/**
673 * Change clip-mask in picture to the specified region.
674 * @param region The region.
675 * @param picture The picture.
676 * @param x The X coordinate of the origin.
677 * @param y The Y coordinate of the origin.
678 *
679 * Changes clip-mask in picture to the specified @p region
680 * and sets the clip origin. Input and output will be clipped to
681 * remain contained within the region. The clip origin is interpreted
682 * relative to the origin of the drawable associated with @p picture. The
683 * region is interpreted relative to the clip origin. Future changes
684 * to region have no effect on the picture clip-mask.
685 * @ingroup Ecore_X_Fixes_Group
686 */
687EAPI void
688ecore_x_region_picture_clip_set(Ecore_X_Region region,
689 Ecore_X_Picture picture,
690 int x,
691 int y)
692{
693 LOGFN(__FILE__, __LINE__, __FUNCTION__);
694 CHECK_XCB_CONN;
695
696 if (!_xfixes_avail) return;
697
698#ifdef ECORE_XCB_XFIXES
699 xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x, y);
700// ecore_x_flush();
701#endif
702}
703
704/* local function prototypes */
705static xcb_rectangle_t *
706_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects,
707 int num)
708{
709 xcb_rectangle_t *xrect;
710 int i = 0;
711
712 if (!num) return NULL;
713
714 xrect = malloc(sizeof(xcb_rectangle_t) * num);
715 if (!xrect) return NULL;
716
717 for (i = 0; i < num; i++)
718 {
719 xrect[i].x = rects[i].x;
720 xrect[i].y = rects[i].y;
721 xrect[i].width = rects[i].width;
722 xrect[i].height = rects[i].height;
723 }
724
725 return xrect;
726}
727
728static Ecore_X_Rectangle *
729_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects,
730 int num)
731{
732 Ecore_X_Rectangle *erect;
733 int i = 0;
734
735 if (!num) return NULL;
736
737 erect = malloc(sizeof(Ecore_X_Rectangle) * num);
738 if (!erect) return NULL;
739
740 for (i = 0; i < num; i++)
741 {
742 erect[i].x = rects[i].x;
743 erect[i].y = rects[i].y;
744 erect[i].width = rects[i].width;
745 erect[i].height = rects[i].height;
746 }
747
748 return erect;
749}
750
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
deleted file mode 100644
index 37a2339..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c
+++ /dev/null
@@ -1,139 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_XINERAMA
3# include <xcb/xinerama.h>
4#endif
5
6/* local variables */
7static Eina_Bool _xinerama_avail = EINA_FALSE;
8static Eina_Bool _xinerama_active = EINA_FALSE;
9
10void
11_ecore_xcb_xinerama_init(void)
12{
13 LOGFN(__FILE__, __LINE__, __FUNCTION__);
14
15#ifdef ECORE_XCB_XINERAMA
16 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xinerama_id);
17#endif
18}
19
20void
21_ecore_xcb_xinerama_finalize(void)
22{
23#ifdef ECORE_XCB_XINERAMA
24 const xcb_query_extension_reply_t *ext_reply;
25#endif
26
27 LOGFN(__FILE__, __LINE__, __FUNCTION__);
28
29#ifdef ECORE_XCB_XINERAMA
30 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xinerama_id);
31 if ((ext_reply) && (ext_reply->present))
32 {
33 xcb_xinerama_query_version_cookie_t cookie;
34 xcb_xinerama_query_version_reply_t *reply;
35
36 cookie =
37 xcb_xinerama_query_version_unchecked(_ecore_xcb_conn,
38 XCB_XINERAMA_MAJOR_VERSION,
39 XCB_XINERAMA_MINOR_VERSION);
40 reply =
41 xcb_xinerama_query_version_reply(_ecore_xcb_conn, cookie, NULL);
42 if (reply)
43 {
44 _xinerama_avail = EINA_TRUE;
45 // NB: Do we need to compare version numbers here ?
46 free(reply);
47 }
48
49 if (_xinerama_avail)
50 {
51 xcb_xinerama_is_active_cookie_t acookie;
52 xcb_xinerama_is_active_reply_t *areply;
53
54 acookie = xcb_xinerama_is_active_unchecked(_ecore_xcb_conn);
55 areply =
56 xcb_xinerama_is_active_reply(_ecore_xcb_conn, acookie, NULL);
57 if (areply)
58 {
59 _xinerama_active = areply->state;
60 free(areply);
61 }
62 }
63 }
64#endif
65}
66
67EAPI int
68ecore_x_xinerama_screen_count_get(void)
69{
70 int count = 0;
71#ifdef ECORE_XCB_XINERAMA
72 xcb_xinerama_query_screens_cookie_t cookie;
73 xcb_xinerama_query_screens_reply_t *reply;
74#endif
75
76 LOGFN(__FILE__, __LINE__, __FUNCTION__);
77 CHECK_XCB_CONN;
78
79 if (!_xinerama_avail) return 0;
80
81#ifdef ECORE_XCB_XINERAMA
82 cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
83 reply =
84 xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
85 if (!reply) return 0;
86 count = reply->number;
87#endif
88
89 return count;
90}
91
92EAPI Eina_Bool
93ecore_x_xinerama_screen_geometry_get(int screen,
94 int *x,
95 int *y,
96 int *w,
97 int *h)
98{
99#ifdef ECORE_XCB_XINERAMA
100 xcb_xinerama_query_screens_cookie_t cookie;
101 xcb_xinerama_query_screens_reply_t *reply;
102 xcb_xinerama_screen_info_t *info;
103#endif
104
105 LOGFN(__FILE__, __LINE__, __FUNCTION__);
106 CHECK_XCB_CONN;
107
108 if (x) *x = 0;
109 if (y) *y = 0;
110 if (w) *w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
111 if (h) *h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
112
113 if (!_xinerama_avail) return EINA_FALSE;
114
115#ifdef ECORE_XCB_XINERAMA
116 cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
117 reply =
118 xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
119 if (!reply) return EINA_FALSE;
120
121 info = xcb_xinerama_query_screens_screen_info(reply);
122 if (!info)
123 {
124 free(reply);
125 return EINA_FALSE;
126 }
127
128 if (x) *x = info[screen].x_org;
129 if (y) *y = info[screen].y_org;
130 if (w) *w = info[screen].width;
131 if (h) *h = info[screen].height;
132
133 free(reply);
134 return EINA_TRUE;
135#endif
136
137 return EINA_FALSE;
138}
139
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
deleted file mode 100644
index b664dc9..0000000
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c
+++ /dev/null
@@ -1,215 +0,0 @@
1#include "ecore_xcb_private.h"
2#ifdef ECORE_XCB_XTEST
3# include <xcb/xtest.h>
4# include <X11/keysym.h>
5#endif
6
7/* local variables */
8static Eina_Bool _test_avail = EINA_FALSE;
9
10void
11_ecore_xcb_xtest_init(void)
12{
13 LOGFN(__FILE__, __LINE__, __FUNCTION__);
14
15#ifdef ECORE_XCB_XTEST
16 xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_test_id);
17#endif
18}
19
20void
21_ecore_xcb_xtest_finalize(void)
22{
23#ifdef ECORE_XCB_XTEST
24 const xcb_query_extension_reply_t *ext_reply;
25#endif
26
27 LOGFN(__FILE__, __LINE__, __FUNCTION__);
28
29#ifdef ECORE_XCB_XTEST
30 ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_test_id);
31 if ((ext_reply) && (ext_reply->present))
32 _test_avail = EINA_TRUE;
33#endif
34}
35
36EAPI Eina_Bool
37#ifdef ECORE_XCB_XTEST
38ecore_x_test_fake_key_down(const char *key)
39#else
40ecore_x_test_fake_key_down(const char *key __UNUSED__)
41#endif
42{
43#ifdef ECORE_XCB_XTEST
44 xcb_keycode_t keycode = 0;
45 xcb_void_cookie_t cookie;
46 xcb_generic_error_t *err;
47#endif
48
49 LOGFN(__FILE__, __LINE__, __FUNCTION__);
50 CHECK_XCB_CONN;
51
52 if (!_test_avail) return EINA_FALSE;
53
54#ifdef ECORE_XCB_XTEST
55 keycode = _ecore_xcb_keymap_string_to_keycode(key);
56 if (keycode == XCB_NO_SYMBOL) return EINA_FALSE;
57
58 cookie =
59 xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
60 keycode, XCB_CURRENT_TIME,
61 ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
62 err = xcb_request_check(_ecore_xcb_conn, cookie);
63 if (err)
64 {
65 free(err);
66 return EINA_FALSE;
67 }
68 return EINA_TRUE;
69#endif
70
71 return EINA_FALSE;
72}
73
74EAPI Eina_Bool
75#ifdef ECORE_XCB_XTEST
76ecore_x_test_fake_key_up(const char *key)
77#else
78ecore_x_test_fake_key_up(const char *key __UNUSED__)
79#endif
80{
81#ifdef ECORE_XCB_XTEST
82 xcb_keycode_t keycode = 0;
83 xcb_void_cookie_t cookie;
84 xcb_generic_error_t *err;
85#endif
86
87 LOGFN(__FILE__, __LINE__, __FUNCTION__);
88 CHECK_XCB_CONN;
89
90 if (!_test_avail) return EINA_FALSE;
91
92#ifdef ECORE_XCB_XTEST
93 keycode = _ecore_xcb_keymap_string_to_keycode(key);
94 if (keycode == XCB_NO_SYMBOL) return EINA_FALSE;
95
96 cookie =
97 xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
98 keycode, XCB_CURRENT_TIME,
99 ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
100 err = xcb_request_check(_ecore_xcb_conn, cookie);
101 if (err)
102 {
103 free(err);
104 return EINA_FALSE;
105 }
106 return EINA_TRUE;
107#endif
108
109 return EINA_FALSE;
110}
111
112EAPI Eina_Bool
113#ifdef ECORE_XCB_XTEST
114ecore_x_test_fake_key_press(const char *key)
115#else
116ecore_x_test_fake_key_press(const char *key __UNUSED__)
117#endif
118{
119#ifdef ECORE_XCB_XTEST
120 xcb_keycode_t keycode = 0;
121 xcb_keysym_t keysym = 0;
122 xcb_keycode_t shift_code = 0;
123 xcb_void_cookie_t cookie;
124 xcb_generic_error_t *err;
125 Eina_Bool shift = EINA_FALSE;
126#endif
127
128 LOGFN(__FILE__, __LINE__, __FUNCTION__);
129 CHECK_XCB_CONN;
130
131 if (!_test_avail) return EINA_FALSE;
132
133#ifdef ECORE_XCB_XTEST
134 keycode = _ecore_xcb_keymap_string_to_keycode(key);
135 keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 0);
136 if (keysym == XCB_NO_SYMBOL)
137 {
138 keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 1);
139 if (keysym != XCB_NO_SYMBOL)
140 shift = EINA_TRUE;
141 }
142
143 if (shift)
144 {
145 xcb_keycode_t *keycodes;
146 int i = 0;
147
148 keycodes = _ecore_xcb_keymap_keysym_to_keycode(XK_Shift_L);
149 while (keycodes[i] != XCB_NO_SYMBOL)
150 {
151 if (keycodes[i] != 0)
152 {
153 shift_code = keycodes[i];
154 break;
155 }
156 i++;
157 }
158 }
159
160 if (shift)
161 {
162 cookie =
163 xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
164 shift_code, XCB_CURRENT_TIME,
165 ((xcb_screen_t *)_ecore_xcb_screen)->root,
166 0, 0, 0);
167 err = xcb_request_check(_ecore_xcb_conn, cookie);
168 if (err)
169 {
170 free(err);
171 return EINA_FALSE;
172 }
173 }
174
175 cookie =
176 xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS,
177 keycode, XCB_CURRENT_TIME,
178 ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
179 err = xcb_request_check(_ecore_xcb_conn, cookie);
180 if (err)
181 {
182 free(err);
183 return EINA_FALSE;
184 }
185 cookie =
186 xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
187 keycode, XCB_CURRENT_TIME,
188 ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0);
189 err = xcb_request_check(_ecore_xcb_conn, cookie);
190 if (err)
191 {
192 free(err);
193 return EINA_FALSE;
194 }
195
196 if (shift)
197 {
198 cookie =
199 xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE,
200 shift_code, XCB_CURRENT_TIME,
201 ((xcb_screen_t *)_ecore_xcb_screen)->root,
202 0, 0, 0);
203 err = xcb_request_check(_ecore_xcb_conn, cookie);
204 if (err)
205 {
206 free(err);
207 return EINA_FALSE;
208 }
209 }
210
211 return EINA_TRUE;
212#endif
213
214 return EINA_FALSE;
215}
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am
deleted file mode 100644
index 3c7364c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am
+++ /dev/null
@@ -1,94 +0,0 @@
1
2MAINTAINERCLEANFILES = Makefile.in
3
4if BUILD_ECORE_X_XLIB
5
6AM_CPPFLAGS = \
7@Xcursor_cflags@ \
8@XKB_CFLAGS@ \
9@XDAMAGE_CFLAGS@ \
10@XCOMPOSITE_CFLAGS@ \
11@XGESTURE_CFLAGS@ \
12@XDPMS_CFLAGS@ \
13@XFIXES_CFLAGS@ \
14@XI2_CFLAGS@ \
15@XINERAMA_CFLAGS@ \
16@XPRINT_CFLAGS@ \
17@XRANDR_CFLAGS@ \
18@XRENDER_CFLAGS@ \
19@XSS_CFLAGS@ \
20@XTEST_CFLAGS@ \
21@x_cflags@ \
22-I$(top_srcdir)/src/lib/ecore \
23-I$(top_srcdir)/src/lib/ecore_x \
24-I$(top_srcdir)/src/lib/ecore_input \
25-I$(top_builddir)/src/lib/ecore \
26-I$(top_builddir)/src/lib/ecore_x \
27-I$(top_builddir)/src/lib/ecore_input \
28@EVAS_CFLAGS@ \
29@EINA_CFLAGS@
30
31noinst_LTLIBRARIES = libecore_x_xlib.la
32
33libecore_x_xlib_la_SOURCES = \
34ecore_x.c \
35ecore_x_dnd.c \
36ecore_x_sync.c \
37ecore_x_randr.c \
38ecore_x_randr_11.c \
39ecore_x_randr_12.c \
40ecore_x_randr_12_edid.c \
41ecore_x_randr_13.c \
42ecore_x_fixes.c \
43ecore_x_damage.c \
44ecore_x_composite.c \
45ecore_x_error.c \
46ecore_x_events.c \
47ecore_x_icccm.c \
48ecore_x_netwm.c \
49ecore_x_mwm.c \
50ecore_x_e.c \
51ecore_x_selection.c \
52ecore_x_window.c \
53ecore_x_window_prop.c \
54ecore_x_window_shape.c \
55ecore_x_pixmap.c \
56ecore_x_gc.c \
57ecore_x_xinerama.c \
58ecore_x_screensaver.c \
59ecore_x_dpms.c \
60ecore_x_drawable.c \
61ecore_x_cursor.c \
62ecore_x_test.c \
63ecore_x_atoms.c \
64ecore_x_region.c \
65ecore_x_image.c \
66ecore_x_xi2.c \
67ecore_x_vsync.c \
68ecore_x_randr.h \
69ecore_x_gesture.c
70
71libecore_x_xlib_la_LIBADD = \
72@Xcursor_libs@ \
73@XKB_LIBS@ \
74@XDAMAGE_LIBS@ \
75@XCOMPOSITE_LIBS@ \
76@XGESTURE_LIBS@ \
77@XDPMS_LIBS@ \
78@XFIXES_LIBS@ \
79@XI2_LIBS@ \
80@XINERAMA_LIBS@ \
81@XPRINT_LIBS@ \
82@XRANDR_LIBS@ \
83@XRENDER_LIBS@ \
84@XSS_LIBS@ \
85@XTEST_LIBS@ \
86@x_libs@ \
87$(top_builddir)/src/lib/ecore/libecore.la \
88$(top_builddir)/src/lib/ecore_input/libecore_input.la \
89@EINA_LIBS@ \
90@dlopen_libs@
91
92endif
93
94EXTRA_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
deleted file mode 100644
index cada69a..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
+++ /dev/null
@@ -1,888 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibdir = $(libdir)/@PACKAGE@
22pkglibexecdir = $(libexecdir)/@PACKAGE@
23am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24install_sh_DATA = $(install_sh) -c -m 644
25install_sh_PROGRAM = $(install_sh) -c
26install_sh_SCRIPT = $(install_sh) -c
27INSTALL_HEADER = $(INSTALL_DATA)
28transform = $(program_transform_name)
29NORMAL_INSTALL = :
30PRE_INSTALL = :
31POST_INSTALL = :
32NORMAL_UNINSTALL = :
33PRE_UNINSTALL = :
34POST_UNINSTALL = :
35build_triplet = @build@
36host_triplet = @host@
37subdir = src/lib/ecore_x/xlib
38DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
39ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
41 $(top_srcdir)/m4/ac_path_generic.m4 \
42 $(top_srcdir)/m4/check_x_extension.m4 \
43 $(top_srcdir)/m4/ecore_check_module.m4 \
44 $(top_srcdir)/m4/ecore_check_options.m4 \
45 $(top_srcdir)/m4/efl_compiler_flag.m4 \
46 $(top_srcdir)/m4/efl_doxygen.m4 \
47 $(top_srcdir)/m4/efl_examples.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
58 $(ACLOCAL_M4)
59mkinstalldirs = $(install_sh) -d
60CONFIG_HEADER = $(top_builddir)/config.h
61CONFIG_CLEAN_FILES =
62CONFIG_CLEAN_VPATH_FILES =
63LTLIBRARIES = $(noinst_LTLIBRARIES)
64@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la \
65@BUILD_ECORE_X_XLIB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la
66am__libecore_x_xlib_la_SOURCES_DIST = ecore_x.c ecore_x_dnd.c \
67 ecore_x_sync.c ecore_x_randr.c ecore_x_randr_11.c \
68 ecore_x_randr_12.c ecore_x_randr_12_edid.c ecore_x_randr_13.c \
69 ecore_x_fixes.c ecore_x_damage.c ecore_x_composite.c \
70 ecore_x_error.c ecore_x_events.c ecore_x_icccm.c \
71 ecore_x_netwm.c ecore_x_mwm.c ecore_x_e.c ecore_x_selection.c \
72 ecore_x_window.c ecore_x_window_prop.c ecore_x_window_shape.c \
73 ecore_x_pixmap.c ecore_x_gc.c ecore_x_xinerama.c \
74 ecore_x_screensaver.c ecore_x_dpms.c ecore_x_drawable.c \
75 ecore_x_cursor.c ecore_x_test.c ecore_x_atoms.c \
76 ecore_x_region.c ecore_x_image.c ecore_x_xi2.c ecore_x_vsync.c \
77 ecore_x_randr.h ecore_x_gesture.c
78@BUILD_ECORE_X_XLIB_TRUE@am_libecore_x_xlib_la_OBJECTS = ecore_x.lo \
79@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_dnd.lo ecore_x_sync.lo \
80@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr.lo ecore_x_randr_11.lo \
81@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_12.lo \
82@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_12_edid.lo \
83@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_13.lo ecore_x_fixes.lo \
84@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_damage.lo \
85@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_composite.lo ecore_x_error.lo \
86@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_events.lo ecore_x_icccm.lo \
87@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_netwm.lo ecore_x_mwm.lo \
88@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_e.lo ecore_x_selection.lo \
89@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window.lo \
90@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window_prop.lo \
91@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window_shape.lo \
92@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_pixmap.lo ecore_x_gc.lo \
93@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_xinerama.lo \
94@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_screensaver.lo \
95@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_dpms.lo ecore_x_drawable.lo \
96@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_cursor.lo ecore_x_test.lo \
97@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_atoms.lo ecore_x_region.lo \
98@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_image.lo ecore_x_xi2.lo \
99@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_vsync.lo ecore_x_gesture.lo
100libecore_x_xlib_la_OBJECTS = $(am_libecore_x_xlib_la_OBJECTS)
101AM_V_lt = $(am__v_lt_$(V))
102am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
103am__v_lt_0 = --silent
104@BUILD_ECORE_X_XLIB_TRUE@am_libecore_x_xlib_la_rpath =
105DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
106depcomp = $(SHELL) $(top_srcdir)/depcomp
107am__depfiles_maybe = depfiles
108am__mv = mv -f
109COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
110 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
111LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
112 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
113 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
114 $(AM_CFLAGS) $(CFLAGS)
115AM_V_CC = $(am__v_CC_$(V))
116am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
117am__v_CC_0 = @echo " CC " $@;
118AM_V_at = $(am__v_at_$(V))
119am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
120am__v_at_0 = @
121CCLD = $(CC)
122LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
123 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
124 $(AM_LDFLAGS) $(LDFLAGS) -o $@
125AM_V_CCLD = $(am__v_CCLD_$(V))
126am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
127am__v_CCLD_0 = @echo " CCLD " $@;
128AM_V_GEN = $(am__v_GEN_$(V))
129am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
130am__v_GEN_0 = @echo " GEN " $@;
131SOURCES = $(libecore_x_xlib_la_SOURCES)
132DIST_SOURCES = $(am__libecore_x_xlib_la_SOURCES_DIST)
133ETAGS = etags
134CTAGS = ctags
135DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
136ACLOCAL = @ACLOCAL@
137ALLOCA = @ALLOCA@
138AMTAR = @AMTAR@
139AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
140AR = @AR@
141AS = @AS@
142AUTOCONF = @AUTOCONF@
143AUTOHEADER = @AUTOHEADER@
144AUTOMAKE = @AUTOMAKE@
145AWK = @AWK@
146CARES_CFLAGS = @CARES_CFLAGS@
147CARES_LIBS = @CARES_LIBS@
148CC = @CC@
149CCDEPMODE = @CCDEPMODE@
150CFLAGS = @CFLAGS@
151CHECK_CFLAGS = @CHECK_CFLAGS@
152CHECK_LIBS = @CHECK_LIBS@
153CPP = @CPP@
154CPPFLAGS = @CPPFLAGS@
155CURL_CFLAGS = @CURL_CFLAGS@
156CURL_LIBS = @CURL_LIBS@
157CXX = @CXX@
158CXXCPP = @CXXCPP@
159CXXDEPMODE = @CXXDEPMODE@
160CXXFLAGS = @CXXFLAGS@
161CYGPATH_W = @CYGPATH_W@
162DEFS = @DEFS@
163DEPDIR = @DEPDIR@
164DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
165DIRECTFB_LIBS = @DIRECTFB_LIBS@
166DLLTOOL = @DLLTOOL@
167DSYMUTIL = @DSYMUTIL@
168DUMPBIN = @DUMPBIN@
169ECHO_C = @ECHO_C@
170ECHO_N = @ECHO_N@
171ECHO_T = @ECHO_T@
172ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
173ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
174EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
175EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
176EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
177EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
178EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
179EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
180EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
181EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
182EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
183EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
184EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
185EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
186EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
187EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
188EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
189EGREP = @EGREP@
190EINA_CFLAGS = @EINA_CFLAGS@
191EINA_LIBS = @EINA_LIBS@
192ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
193ESCAPE_LIBS = @ESCAPE_LIBS@
194EVAS_CFLAGS = @EVAS_CFLAGS@
195EVAS_LIBS = @EVAS_LIBS@
196EVIL_CFLAGS = @EVIL_CFLAGS@
197EVIL_LIBS = @EVIL_LIBS@
198EXEEXT = @EXEEXT@
199EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
200EXOTIC_LIBS = @EXOTIC_LIBS@
201FGREP = @FGREP@
202GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
203GLIB_CFLAGS = @GLIB_CFLAGS@
204GLIB_LIBS = @GLIB_LIBS@
205GMSGFMT = @GMSGFMT@
206GMSGFMT_015 = @GMSGFMT_015@
207GREP = @GREP@
208INSTALL = @INSTALL@
209INSTALL_DATA = @INSTALL_DATA@
210INSTALL_PROGRAM = @INSTALL_PROGRAM@
211INSTALL_SCRIPT = @INSTALL_SCRIPT@
212INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
213INTLLIBS = @INTLLIBS@
214INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
215KEYSYMDEFS = @KEYSYMDEFS@
216LD = @LD@
217LDFLAGS = @LDFLAGS@
218LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
219LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
220LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
221LIBICONV = @LIBICONV@
222LIBINTL = @LIBINTL@
223LIBOBJS = @LIBOBJS@
224LIBS = @LIBS@
225LIBTOOL = @LIBTOOL@
226LIPO = @LIPO@
227LN_S = @LN_S@
228LTLIBICONV = @LTLIBICONV@
229LTLIBINTL = @LTLIBINTL@
230LTLIBOBJS = @LTLIBOBJS@
231MAKEINFO = @MAKEINFO@
232MKDIR_P = @MKDIR_P@
233MSGFMT = @MSGFMT@
234MSGFMT_015 = @MSGFMT_015@
235MSGMERGE = @MSGMERGE@
236NM = @NM@
237NMEDIT = @NMEDIT@
238OBJC = @OBJC@
239OBJCDEPMODE = @OBJCDEPMODE@
240OBJCFLAGS = @OBJCFLAGS@
241OBJDUMP = @OBJDUMP@
242OBJEXT = @OBJEXT@
243OTOOL = @OTOOL@
244OTOOL64 = @OTOOL64@
245PACKAGE = @PACKAGE@
246PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
247PACKAGE_NAME = @PACKAGE_NAME@
248PACKAGE_STRING = @PACKAGE_STRING@
249PACKAGE_TARNAME = @PACKAGE_TARNAME@
250PACKAGE_URL = @PACKAGE_URL@
251PACKAGE_VERSION = @PACKAGE_VERSION@
252PATH_SEPARATOR = @PATH_SEPARATOR@
253PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
254PIXMAN_LIBS = @PIXMAN_LIBS@
255PKG_CONFIG = @PKG_CONFIG@
256PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
257PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
258POSUB = @POSUB@
259RANLIB = @RANLIB@
260SCIM_CFLAGS = @SCIM_CFLAGS@
261SCIM_LIBS = @SCIM_LIBS@
262SDL_CFLAGS = @SDL_CFLAGS@
263SDL_CONFIG = @SDL_CONFIG@
264SDL_LIBS = @SDL_LIBS@
265SED = @SED@
266SET_MAKE = @SET_MAKE@
267SHELL = @SHELL@
268SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
269SSL_CFLAGS = @SSL_CFLAGS@
270SSL_LIBS = @SSL_LIBS@
271STRIP = @STRIP@
272TLS2_CFLAGS = @TLS2_CFLAGS@
273TLS2_LIBS = @TLS2_LIBS@
274TLS_CFLAGS = @TLS_CFLAGS@
275TLS_LIBS = @TLS_LIBS@
276TSLIB_CFLAGS = @TSLIB_CFLAGS@
277TSLIB_LIBS = @TSLIB_LIBS@
278USE_NLS = @USE_NLS@
279VERSION = @VERSION@
280VMAJ = @VMAJ@
281WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
282WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
283WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
284WAYLAND_LIBS = @WAYLAND_LIBS@
285WIN32_CFLAGS = @WIN32_CFLAGS@
286WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
287WIN32_LIBS = @WIN32_LIBS@
288XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
289XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
290XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
291XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
292XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
293XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
294XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
295XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
296XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
297XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
298XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
299XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
300XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
301XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
302XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
303XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
304XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
305XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
306XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
307XCB_X11_LIBS = @XCB_X11_LIBS@
308XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
309XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
310XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
311XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
312XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
313XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
314XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
315XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
316XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
317XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
318XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
319XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
320XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
321XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
322XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
323XDAMAGE_LIBS = @XDAMAGE_LIBS@
324XDPMS_CFLAGS = @XDPMS_CFLAGS@
325XDPMS_LIBS = @XDPMS_LIBS@
326XFIXES_CFLAGS = @XFIXES_CFLAGS@
327XFIXES_LIBS = @XFIXES_LIBS@
328XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
329XGESTURE_LIBS = @XGESTURE_LIBS@
330XGETTEXT = @XGETTEXT@
331XGETTEXT_015 = @XGETTEXT_015@
332XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
333XI2_CFLAGS = @XI2_CFLAGS@
334XI2_LIBS = @XI2_LIBS@
335XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
336XINERAMA_LIBS = @XINERAMA_LIBS@
337XKB_CFLAGS = @XKB_CFLAGS@
338XKB_LIBS = @XKB_LIBS@
339XMKMF = @XMKMF@
340XPRINT_CFLAGS = @XPRINT_CFLAGS@
341XPRINT_LIBS = @XPRINT_LIBS@
342XRANDR_CFLAGS = @XRANDR_CFLAGS@
343XRANDR_LIBS = @XRANDR_LIBS@
344XRENDER_CFLAGS = @XRENDER_CFLAGS@
345XRENDER_LIBS = @XRENDER_LIBS@
346XSS_CFLAGS = @XSS_CFLAGS@
347XSS_LIBS = @XSS_LIBS@
348XTEST_CFLAGS = @XTEST_CFLAGS@
349XTEST_LIBS = @XTEST_LIBS@
350X_CFLAGS = @X_CFLAGS@
351X_EXTRA_LIBS = @X_EXTRA_LIBS@
352X_LIBS = @X_LIBS@
353X_PRE_LIBS = @X_PRE_LIBS@
354Xcursor_cflags = @Xcursor_cflags@
355Xcursor_libs = @Xcursor_libs@
356abs_builddir = @abs_builddir@
357abs_srcdir = @abs_srcdir@
358abs_top_builddir = @abs_top_builddir@
359abs_top_srcdir = @abs_top_srcdir@
360ac_ct_CC = @ac_ct_CC@
361ac_ct_CXX = @ac_ct_CXX@
362ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
363ac_ct_OBJC = @ac_ct_OBJC@
364am__include = @am__include@
365am__leading_dot = @am__leading_dot@
366am__quote = @am__quote@
367am__tar = @am__tar@
368am__untar = @am__untar@
369bindir = @bindir@
370build = @build@
371build_alias = @build_alias@
372build_cpu = @build_cpu@
373build_os = @build_os@
374build_vendor = @build_vendor@
375builddir = @builddir@
376cocoa_ldflags = @cocoa_ldflags@
377datadir = @datadir@
378datarootdir = @datarootdir@
379dlopen_libs = @dlopen_libs@
380docdir = @docdir@
381dvidir = @dvidir@
382ecore_cocoa_cflags = @ecore_cocoa_cflags@
383ecore_cocoa_libs = @ecore_cocoa_libs@
384ecore_con_cflags = @ecore_con_cflags@
385ecore_con_libs = @ecore_con_libs@
386ecore_directfb_cflags = @ecore_directfb_cflags@
387ecore_directfb_libs = @ecore_directfb_libs@
388ecore_evas_cflags = @ecore_evas_cflags@
389ecore_evas_libs = @ecore_evas_libs@
390ecore_fb_cflags = @ecore_fb_cflags@
391ecore_fb_libs = @ecore_fb_libs@
392ecore_file_cflags = @ecore_file_cflags@
393ecore_file_libs = @ecore_file_libs@
394ecore_imf_cflags = @ecore_imf_cflags@
395ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
396ecore_imf_evas_libs = @ecore_imf_evas_libs@
397ecore_imf_libs = @ecore_imf_libs@
398ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
399ecore_imf_scim_libs = @ecore_imf_scim_libs@
400ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
401ecore_imf_xim_libs = @ecore_imf_xim_libs@
402ecore_input_cflags = @ecore_input_cflags@
403ecore_input_evas_cflags = @ecore_input_evas_cflags@
404ecore_input_evas_libs = @ecore_input_evas_libs@
405ecore_input_libs = @ecore_input_libs@
406ecore_ipc_cflags = @ecore_ipc_cflags@
407ecore_ipc_libs = @ecore_ipc_libs@
408ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
409ecore_psl1ght_libs = @ecore_psl1ght_libs@
410ecore_sdl_cflags = @ecore_sdl_cflags@
411ecore_sdl_libs = @ecore_sdl_libs@
412ecore_wayland_cflags = @ecore_wayland_cflags@
413ecore_wayland_libs = @ecore_wayland_libs@
414ecore_win32_cflags = @ecore_win32_cflags@
415ecore_win32_libs = @ecore_win32_libs@
416ecore_wince_cflags = @ecore_wince_cflags@
417ecore_wince_libs = @ecore_wince_libs@
418ecore_x_cflags = @ecore_x_cflags@
419ecore_x_libs = @ecore_x_libs@
420ecore_x_libs_private = @ecore_x_libs_private@
421efl_doxygen = @efl_doxygen@
422efl_have_doxygen = @efl_have_doxygen@
423exec_prefix = @exec_prefix@
424have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
425host = @host@
426host_alias = @host_alias@
427host_cpu = @host_cpu@
428host_os = @host_os@
429host_vendor = @host_vendor@
430htmldir = @htmldir@
431includedir = @includedir@
432infodir = @infodir@
433install_sh = @install_sh@
434libdir = @libdir@
435libexecdir = @libexecdir@
436localedir = @localedir@
437localstatedir = @localstatedir@
438lt_ECHO = @lt_ECHO@
439lt_enable_auto_import = @lt_enable_auto_import@
440mandir = @mandir@
441mkdir_p = @mkdir_p@
442oldincludedir = @oldincludedir@
443pdfdir = @pdfdir@
444pkgconfig_requires_private = @pkgconfig_requires_private@
445prefix = @prefix@
446program_transform_name = @program_transform_name@
447psdir = @psdir@
448release_info = @release_info@
449requirements_ecore = @requirements_ecore@
450requirements_ecore_cocoa = @requirements_ecore_cocoa@
451requirements_ecore_con = @requirements_ecore_con@
452requirements_ecore_directfb = @requirements_ecore_directfb@
453requirements_ecore_evas = @requirements_ecore_evas@
454requirements_ecore_fb = @requirements_ecore_fb@
455requirements_ecore_file = @requirements_ecore_file@
456requirements_ecore_imf = @requirements_ecore_imf@
457requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
458requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
459requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
460requirements_ecore_input = @requirements_ecore_input@
461requirements_ecore_input_evas = @requirements_ecore_input_evas@
462requirements_ecore_ipc = @requirements_ecore_ipc@
463requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
464requirements_ecore_sdl = @requirements_ecore_sdl@
465requirements_ecore_wayland = @requirements_ecore_wayland@
466requirements_ecore_win32 = @requirements_ecore_win32@
467requirements_ecore_wince = @requirements_ecore_wince@
468requirements_ecore_x = @requirements_ecore_x@
469rt_libs = @rt_libs@
470sbindir = @sbindir@
471sharedstatedir = @sharedstatedir@
472srcdir = @srcdir@
473sysconfdir = @sysconfdir@
474target_alias = @target_alias@
475top_build_prefix = @top_build_prefix@
476top_builddir = @top_builddir@
477top_srcdir = @top_srcdir@
478version_info = @version_info@
479x_cflags = @x_cflags@
480x_includes = @x_includes@
481x_libs = @x_libs@
482MAINTAINERCLEANFILES = Makefile.in
483@BUILD_ECORE_X_XLIB_TRUE@AM_CPPFLAGS = \
484@BUILD_ECORE_X_XLIB_TRUE@@Xcursor_cflags@ \
485@BUILD_ECORE_X_XLIB_TRUE@@XKB_CFLAGS@ \
486@BUILD_ECORE_X_XLIB_TRUE@@XDAMAGE_CFLAGS@ \
487@BUILD_ECORE_X_XLIB_TRUE@@XCOMPOSITE_CFLAGS@ \
488@BUILD_ECORE_X_XLIB_TRUE@@XGESTURE_CFLAGS@ \
489@BUILD_ECORE_X_XLIB_TRUE@@XDPMS_CFLAGS@ \
490@BUILD_ECORE_X_XLIB_TRUE@@XFIXES_CFLAGS@ \
491@BUILD_ECORE_X_XLIB_TRUE@@XI2_CFLAGS@ \
492@BUILD_ECORE_X_XLIB_TRUE@@XINERAMA_CFLAGS@ \
493@BUILD_ECORE_X_XLIB_TRUE@@XPRINT_CFLAGS@ \
494@BUILD_ECORE_X_XLIB_TRUE@@XRANDR_CFLAGS@ \
495@BUILD_ECORE_X_XLIB_TRUE@@XRENDER_CFLAGS@ \
496@BUILD_ECORE_X_XLIB_TRUE@@XSS_CFLAGS@ \
497@BUILD_ECORE_X_XLIB_TRUE@@XTEST_CFLAGS@ \
498@BUILD_ECORE_X_XLIB_TRUE@@x_cflags@ \
499@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore \
500@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore_x \
501@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore_input \
502@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore \
503@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore_x \
504@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore_input \
505@BUILD_ECORE_X_XLIB_TRUE@@EVAS_CFLAGS@ \
506@BUILD_ECORE_X_XLIB_TRUE@@EINA_CFLAGS@
507
508@BUILD_ECORE_X_XLIB_TRUE@noinst_LTLIBRARIES = libecore_x_xlib.la
509@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_SOURCES = \
510@BUILD_ECORE_X_XLIB_TRUE@ecore_x.c \
511@BUILD_ECORE_X_XLIB_TRUE@ecore_x_dnd.c \
512@BUILD_ECORE_X_XLIB_TRUE@ecore_x_sync.c \
513@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr.c \
514@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_11.c \
515@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_12.c \
516@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_12_edid.c \
517@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_13.c \
518@BUILD_ECORE_X_XLIB_TRUE@ecore_x_fixes.c \
519@BUILD_ECORE_X_XLIB_TRUE@ecore_x_damage.c \
520@BUILD_ECORE_X_XLIB_TRUE@ecore_x_composite.c \
521@BUILD_ECORE_X_XLIB_TRUE@ecore_x_error.c \
522@BUILD_ECORE_X_XLIB_TRUE@ecore_x_events.c \
523@BUILD_ECORE_X_XLIB_TRUE@ecore_x_icccm.c \
524@BUILD_ECORE_X_XLIB_TRUE@ecore_x_netwm.c \
525@BUILD_ECORE_X_XLIB_TRUE@ecore_x_mwm.c \
526@BUILD_ECORE_X_XLIB_TRUE@ecore_x_e.c \
527@BUILD_ECORE_X_XLIB_TRUE@ecore_x_selection.c \
528@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window.c \
529@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window_prop.c \
530@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window_shape.c \
531@BUILD_ECORE_X_XLIB_TRUE@ecore_x_pixmap.c \
532@BUILD_ECORE_X_XLIB_TRUE@ecore_x_gc.c \
533@BUILD_ECORE_X_XLIB_TRUE@ecore_x_xinerama.c \
534@BUILD_ECORE_X_XLIB_TRUE@ecore_x_screensaver.c \
535@BUILD_ECORE_X_XLIB_TRUE@ecore_x_dpms.c \
536@BUILD_ECORE_X_XLIB_TRUE@ecore_x_drawable.c \
537@BUILD_ECORE_X_XLIB_TRUE@ecore_x_cursor.c \
538@BUILD_ECORE_X_XLIB_TRUE@ecore_x_test.c \
539@BUILD_ECORE_X_XLIB_TRUE@ecore_x_atoms.c \
540@BUILD_ECORE_X_XLIB_TRUE@ecore_x_region.c \
541@BUILD_ECORE_X_XLIB_TRUE@ecore_x_image.c \
542@BUILD_ECORE_X_XLIB_TRUE@ecore_x_xi2.c \
543@BUILD_ECORE_X_XLIB_TRUE@ecore_x_vsync.c \
544@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr.h \
545@BUILD_ECORE_X_XLIB_TRUE@ecore_x_gesture.c
546
547@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_LIBADD = \
548@BUILD_ECORE_X_XLIB_TRUE@@Xcursor_libs@ \
549@BUILD_ECORE_X_XLIB_TRUE@@XKB_LIBS@ \
550@BUILD_ECORE_X_XLIB_TRUE@@XDAMAGE_LIBS@ \
551@BUILD_ECORE_X_XLIB_TRUE@@XCOMPOSITE_LIBS@ \
552@BUILD_ECORE_X_XLIB_TRUE@@XGESTURE_LIBS@ \
553@BUILD_ECORE_X_XLIB_TRUE@@XDPMS_LIBS@ \
554@BUILD_ECORE_X_XLIB_TRUE@@XFIXES_LIBS@ \
555@BUILD_ECORE_X_XLIB_TRUE@@XI2_LIBS@ \
556@BUILD_ECORE_X_XLIB_TRUE@@XINERAMA_LIBS@ \
557@BUILD_ECORE_X_XLIB_TRUE@@XPRINT_LIBS@ \
558@BUILD_ECORE_X_XLIB_TRUE@@XRANDR_LIBS@ \
559@BUILD_ECORE_X_XLIB_TRUE@@XRENDER_LIBS@ \
560@BUILD_ECORE_X_XLIB_TRUE@@XSS_LIBS@ \
561@BUILD_ECORE_X_XLIB_TRUE@@XTEST_LIBS@ \
562@BUILD_ECORE_X_XLIB_TRUE@@x_libs@ \
563@BUILD_ECORE_X_XLIB_TRUE@$(top_builddir)/src/lib/ecore/libecore.la \
564@BUILD_ECORE_X_XLIB_TRUE@$(top_builddir)/src/lib/ecore_input/libecore_input.la \
565@BUILD_ECORE_X_XLIB_TRUE@@EINA_LIBS@ \
566@BUILD_ECORE_X_XLIB_TRUE@@dlopen_libs@
567
568EXTRA_DIST = ecore_x_private.h
569all: all-am
570
571.SUFFIXES:
572.SUFFIXES: .c .lo .o .obj
573$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
574 @for dep in $?; do \
575 case '$(am__configure_deps)' in \
576 *$$dep*) \
577 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
578 && { if test -f $@; then exit 0; else break; fi; }; \
579 exit 1;; \
580 esac; \
581 done; \
582 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/xlib/Makefile'; \
583 $(am__cd) $(top_srcdir) && \
584 $(AUTOMAKE) --gnu src/lib/ecore_x/xlib/Makefile
585.PRECIOUS: Makefile
586Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
587 @case '$?' in \
588 *config.status*) \
589 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
590 *) \
591 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
592 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
593 esac;
594
595$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
596 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
597
598$(top_srcdir)/configure: $(am__configure_deps)
599 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
600$(ACLOCAL_M4): $(am__aclocal_m4_deps)
601 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
602$(am__aclocal_m4_deps):
603
604clean-noinstLTLIBRARIES:
605 -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
606 @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
607 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
608 test "$$dir" != "$$p" || dir=.; \
609 echo "rm -f \"$${dir}/so_locations\""; \
610 rm -f "$${dir}/so_locations"; \
611 done
612libecore_x_xlib.la: $(libecore_x_xlib_la_OBJECTS) $(libecore_x_xlib_la_DEPENDENCIES)
613 $(AM_V_CCLD)$(LINK) $(am_libecore_x_xlib_la_rpath) $(libecore_x_xlib_la_OBJECTS) $(libecore_x_xlib_la_LIBADD) $(LIBS)
614
615mostlyclean-compile:
616 -rm -f *.$(OBJEXT)
617
618distclean-compile:
619 -rm -f *.tab.c
620
621@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x.Plo@am__quote@
622@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_atoms.Plo@am__quote@
623@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_composite.Plo@am__quote@
624@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_cursor.Plo@am__quote@
625@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_damage.Plo@am__quote@
626@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_dnd.Plo@am__quote@
627@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_dpms.Plo@am__quote@
628@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_drawable.Plo@am__quote@
629@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_e.Plo@am__quote@
630@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_error.Plo@am__quote@
631@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_events.Plo@am__quote@
632@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_fixes.Plo@am__quote@
633@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_gc.Plo@am__quote@
634@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_gesture.Plo@am__quote@
635@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_icccm.Plo@am__quote@
636@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_image.Plo@am__quote@
637@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_mwm.Plo@am__quote@
638@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_netwm.Plo@am__quote@
639@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_pixmap.Plo@am__quote@
640@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr.Plo@am__quote@
641@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_11.Plo@am__quote@
642@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_12.Plo@am__quote@
643@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_12_edid.Plo@am__quote@
644@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_13.Plo@am__quote@
645@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_region.Plo@am__quote@
646@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_screensaver.Plo@am__quote@
647@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_selection.Plo@am__quote@
648@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_sync.Plo@am__quote@
649@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_test.Plo@am__quote@
650@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_vsync.Plo@am__quote@
651@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window.Plo@am__quote@
652@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window_prop.Plo@am__quote@
653@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window_shape.Plo@am__quote@
654@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_xi2.Plo@am__quote@
655@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_xinerama.Plo@am__quote@
656
657.c.o:
658@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
659@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
660@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
661@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
662@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
663@am__fastdepCC_FALSE@ $(COMPILE) -c $<
664
665.c.obj:
666@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
667@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
668@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
669@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
670@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
671@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
672
673.c.lo:
674@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
675@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
676@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
677@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
678@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
679@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
680
681mostlyclean-libtool:
682 -rm -f *.lo
683
684clean-libtool:
685 -rm -rf .libs _libs
686
687ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
688 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
689 unique=`for i in $$list; do \
690 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
691 done | \
692 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
693 END { if (nonempty) { for (i in files) print i; }; }'`; \
694 mkid -fID $$unique
695tags: TAGS
696
697TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
698 $(TAGS_FILES) $(LISP)
699 set x; \
700 here=`pwd`; \
701 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
702 unique=`for i in $$list; do \
703 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
704 done | \
705 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
706 END { if (nonempty) { for (i in files) print i; }; }'`; \
707 shift; \
708 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
709 test -n "$$unique" || unique=$$empty_fix; \
710 if test $$# -gt 0; then \
711 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
712 "$$@" $$unique; \
713 else \
714 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
715 $$unique; \
716 fi; \
717 fi
718ctags: CTAGS
719CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
720 $(TAGS_FILES) $(LISP)
721 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
722 unique=`for i in $$list; do \
723 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
724 done | \
725 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
726 END { if (nonempty) { for (i in files) print i; }; }'`; \
727 test -z "$(CTAGS_ARGS)$$unique" \
728 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
729 $$unique
730
731GTAGS:
732 here=`$(am__cd) $(top_builddir) && pwd` \
733 && $(am__cd) $(top_srcdir) \
734 && gtags -i $(GTAGS_ARGS) "$$here"
735
736distclean-tags:
737 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
738
739distdir: $(DISTFILES)
740 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
741 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
742 list='$(DISTFILES)'; \
743 dist_files=`for file in $$list; do echo $$file; done | \
744 sed -e "s|^$$srcdirstrip/||;t" \
745 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
746 case $$dist_files in \
747 */*) $(MKDIR_P) `echo "$$dist_files" | \
748 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
749 sort -u` ;; \
750 esac; \
751 for file in $$dist_files; do \
752 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
753 if test -d $$d/$$file; then \
754 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
755 if test -d "$(distdir)/$$file"; then \
756 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
757 fi; \
758 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
759 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
760 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
761 fi; \
762 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
763 else \
764 test -f "$(distdir)/$$file" \
765 || cp -p $$d/$$file "$(distdir)/$$file" \
766 || exit 1; \
767 fi; \
768 done
769check-am: all-am
770check: check-am
771all-am: Makefile $(LTLIBRARIES)
772installdirs:
773install: install-am
774install-exec: install-exec-am
775install-data: install-data-am
776uninstall: uninstall-am
777
778install-am: all-am
779 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
780
781installcheck: installcheck-am
782install-strip:
783 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
784 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
785 `test -z '$(STRIP)' || \
786 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
787mostlyclean-generic:
788
789clean-generic:
790
791distclean-generic:
792 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
793 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
794
795maintainer-clean-generic:
796 @echo "This command is intended for maintainers to use"
797 @echo "it deletes files that may require special tools to rebuild."
798 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
799clean: clean-am
800
801clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
802 mostlyclean-am
803
804distclean: distclean-am
805 -rm -rf ./$(DEPDIR)
806 -rm -f Makefile
807distclean-am: clean-am distclean-compile distclean-generic \
808 distclean-tags
809
810dvi: dvi-am
811
812dvi-am:
813
814html: html-am
815
816html-am:
817
818info: info-am
819
820info-am:
821
822install-data-am:
823
824install-dvi: install-dvi-am
825
826install-dvi-am:
827
828install-exec-am:
829
830install-html: install-html-am
831
832install-html-am:
833
834install-info: install-info-am
835
836install-info-am:
837
838install-man:
839
840install-pdf: install-pdf-am
841
842install-pdf-am:
843
844install-ps: install-ps-am
845
846install-ps-am:
847
848installcheck-am:
849
850maintainer-clean: maintainer-clean-am
851 -rm -rf ./$(DEPDIR)
852 -rm -f Makefile
853maintainer-clean-am: distclean-am maintainer-clean-generic
854
855mostlyclean: mostlyclean-am
856
857mostlyclean-am: mostlyclean-compile mostlyclean-generic \
858 mostlyclean-libtool
859
860pdf: pdf-am
861
862pdf-am:
863
864ps: ps-am
865
866ps-am:
867
868uninstall-am:
869
870.MAKE: install-am install-strip
871
872.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
873 clean-libtool clean-noinstLTLIBRARIES ctags distclean \
874 distclean-compile distclean-generic distclean-libtool \
875 distclean-tags distdir dvi dvi-am html html-am info info-am \
876 install install-am install-data install-data-am install-dvi \
877 install-dvi-am install-exec install-exec-am install-html \
878 install-html-am install-info install-info-am install-man \
879 install-pdf install-pdf-am install-ps install-ps-am \
880 install-strip installcheck installcheck-am installdirs \
881 maintainer-clean maintainer-clean-generic mostlyclean \
882 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
883 pdf pdf-am ps ps-am tags uninstall uninstall-am
884
885
886# Tell versions [3.59,3.63) of GNU make to not export all variables.
887# Otherwise a system limit (for SysV at least) may be exceeded.
888.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
deleted file mode 100644
index 6d275bc..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c
+++ /dev/null
@@ -1,2098 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <string.h>
7#include <unistd.h>
8
9//#define LOGRT 1
10
11#ifdef LOGRT
12#include <dlfcn.h>
13#endif /* ifdef LOGRT */
14
15#include "Ecore.h"
16#include "ecore_private.h"
17#include "ecore_x_private.h"
18#include "Ecore_X.h"
19#include "Ecore_X_Atoms.h"
20#include "Ecore_Input.h"
21
22static Eina_Bool _ecore_x_fd_handler(void *data,
23 Ecore_Fd_Handler *fd_handler);
24static Eina_Bool _ecore_x_fd_handler_buf(void *data,
25 Ecore_Fd_Handler *fd_handler);
26static int _ecore_x_key_mask_get(KeySym sym);
27static int _ecore_x_event_modifier(unsigned int state);
28
29static Ecore_Fd_Handler *_ecore_x_fd_handler_handle = NULL;
30
31static const int AnyXEvent = 0; /* 0 can be used as there are no event types
32 * with index 0 and 1 as they are used for
33 * errors
34 */
35
36static int _ecore_x_event_shape_id = 0;
37static int _ecore_x_event_screensaver_id = 0;
38static int _ecore_x_event_sync_id = 0;
39int _ecore_xlib_log_dom = -1;
40
41#ifdef ECORE_XRANDR
42static int _ecore_x_event_randr_id = 0;
43#endif /* ifdef ECORE_XRANDR */
44#ifdef ECORE_XFIXES
45static int _ecore_x_event_fixes_selection_id = 0;
46#endif /* ifdef ECORE_XFIXES */
47#ifdef ECORE_XDAMAGE
48static int _ecore_x_event_damage_id = 0;
49#endif /* ifdef ECORE_XDAMAGE */
50#ifdef ECORE_XGESTURE
51static int _ecore_x_event_gesture_id = 0;
52#endif /* ifdef ECORE_XGESTURE */
53static int _ecore_x_event_handlers_num = 0;
54static void (**_ecore_x_event_handlers) (XEvent * event) = NULL;
55
56static int _ecore_x_init_count = 0;
57static int _ecore_x_grab_count = 0;
58
59Display *_ecore_x_disp = NULL;
60double _ecore_x_double_click_time = 0.25;
61Time _ecore_x_event_last_time = 0;
62Window _ecore_x_event_last_win = 0;
63int _ecore_x_event_last_root_x = 0;
64int _ecore_x_event_last_root_y = 0;
65Eina_Bool _ecore_x_xcursor = EINA_FALSE;
66
67Ecore_X_Window _ecore_x_private_win = 0;
68
69Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
70
71EAPI int ECORE_X_EVENT_ANY = 0;
72EAPI int ECORE_X_EVENT_MOUSE_IN = 0;
73EAPI int ECORE_X_EVENT_MOUSE_OUT = 0;
74EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0;
75EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
76EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0;
77EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0;
78EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0;
79EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0;
80EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0;
81EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0;
82EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0;
83EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0;
84EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0;
85EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0;
86EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0;
87EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0;
88EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0;
89EAPI int ECORE_X_EVENT_WINDOW_STACK = 0;
90EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0;
91EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0;
92EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0;
93EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0;
94EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0;
95EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0;
96EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0;
97EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0;
98EAPI int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = 0;
99EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0;
100EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0;
101EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0;
102EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK;
103EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN;
104EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION;
105EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP;
106EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD;
107EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD;
108EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP;
109EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0;
110EAPI int ECORE_X_EVENT_SYNC_ALARM = 0;
111EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0;
112EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0;
113EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0;
114EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0;
115EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0;
116EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0;
117EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0;
118EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
119EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0;
120EAPI int ECORE_X_EVENT_PING = 0;
121EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0;
122
123EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0;
124EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0;
125EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0;
126
127EAPI int ECORE_X_EVENT_GENERIC = 0;
128
129int ECORE_X_MODIFIER_SHIFT = 0;
130int ECORE_X_MODIFIER_CTRL = 0;
131int ECORE_X_MODIFIER_ALT = 0;
132int ECORE_X_MODIFIER_WIN = 0;
133
134EAPI int ECORE_X_LOCK_SCROLL = 0;
135EAPI int ECORE_X_LOCK_NUM = 0;
136EAPI int ECORE_X_LOCK_CAPS = 0;
137EAPI int ECORE_X_LOCK_SHIFT = 0;
138
139#ifdef LOGRT
140static double t0 = 0.0;
141static Status (*_logrt_real_reply)(Display *disp,
142 void *rep,
143 int extra,
144 Bool discard) = NULL;
145static void
146_logrt_init(void)
147{
148 void *lib;
149
150 lib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
151 if (!lib)
152 lib = dlopen("libX11.so.6", RTLD_GLOBAL | RTLD_LAZY);
153
154 if (!lib)
155 lib = dlopen("libX11.so.6.3", RTLD_GLOBAL | RTLD_LAZY);
156
157 if (!lib)
158 lib = dlopen("libX11.so.6.3.0", RTLD_GLOBAL | RTLD_LAZY);
159
160 _logrt_real_reply = dlsym(lib, "_XReply");
161 t0 = ecore_time_get();
162}
163
164Status
165_XReply(Display *disp,
166 void *rep,
167 int extra,
168 Bool discard)
169{
170 void *bt[128];
171 int i, n;
172 char **sym;
173
174 n = backtrace(bt, 128);
175 if (n > 0)
176 {
177 sym = backtrace_symbols(bt, n);
178 printf("ROUNDTRIP: %4.4f :", ecore_time_get() - t0);
179 if (sym)
180 {
181 for (i = n - 1; i > 0; i--)
182 {
183 char *fname = strchr(sym[i], '(');
184 if (fname)
185 {
186 char *tsym = alloca(strlen(fname) + 1);
187 char *end;
188 strcpy(tsym, fname + 1);
189 end = strchr(tsym, '+');
190 if (end)
191 {
192 *end = 0;
193 printf("%s", tsym);
194 }
195 else
196 printf("???");
197 }
198 else
199 printf("???");
200
201 if (i > 1)
202 printf(" > ");
203 }
204 printf("\n");
205 }
206 }
207
208 // fixme: logme
209 return _logrt_real_reply(disp, rep, extra, discard);
210}
211
212#endif /* ifdef LOGRT */
213
214void
215_ecore_x_modifiers_get(void)
216{
217 /* everything has these... unless its like a pda... :) */
218 ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
219 ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L);
220
221 /* apple's xdarwin has no alt!!!! */
222 ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L);
223 if (!ECORE_X_MODIFIER_ALT)
224 ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L);
225
226 if (!ECORE_X_MODIFIER_ALT)
227 ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L);
228
229 /* the windows key... a valid modifier :) */
230 ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L);
231 if (!ECORE_X_MODIFIER_WIN)
232 ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch);
233
234 if (!ECORE_X_MODIFIER_WIN)
235 ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L);
236
237 if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT)
238 ECORE_X_MODIFIER_WIN = 0;
239
240 if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL)
241 ECORE_X_MODIFIER_ALT = 0;
242
243 ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock);
244 ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock);
245 ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock);
246 ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock);
247}
248
249/**
250 * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions
251 *
252 * Functions that start and shut down the Ecore X Library.
253 */
254
255/**
256 * Initialize the X display connection to the given display.
257 *
258 * @param name Display target name. If @c NULL, the default display is
259 * assumed.
260 * @return The number of times the library has been initialized without
261 * being shut down. 0 is returned if an error occurs.
262 * @ingroup Ecore_X_Init_Group
263 */
264EAPI int
265ecore_x_init(const char *name)
266{
267 int shape_base = 0;
268 int shape_err_base = 0;
269#ifdef ECORE_XSS
270 int screensaver_base = 0;
271 int screensaver_err_base = 0;
272#endif /* ifdef ECORE_XSS */
273 int sync_base = 0;
274 int sync_err_base = 0;
275#ifdef ECORE_XRANDR
276 int randr_base = 0;
277 int randr_err_base = 0;
278#endif /* ifdef ECORE_XRANDR */
279#ifdef ECORE_XFIXES
280 int fixes_base = 0;
281 int fixes_err_base = 0;
282#endif /* ifdef ECORE_XFIXES */
283#ifdef ECORE_XDAMAGE
284 int damage_base = 0;
285 int damage_err_base = 0;
286#endif /* ifdef ECORE_XDAMAGE */
287#ifdef ECORE_XGESTURE
288 int gesture_base = 0;
289 int gesture_err_base = 0;
290#endif /* ifdef ECORE_XGESTURE */
291
292 if (++_ecore_x_init_count != 1)
293 return _ecore_x_init_count;
294
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
296#ifdef LOGRT
297 _logrt_init();
298#endif /* ifdef LOGRT */
299
300 eina_init();
301 _ecore_xlib_log_dom = eina_log_domain_register
302 ("ecore_x", ECORE_XLIB_DEFAULT_LOG_COLOR);
303 if (_ecore_xlib_log_dom < 0)
304 {
305 EINA_LOG_ERR(
306 "Impossible to create a log domain for the Ecore Xlib module.");
307 return --_ecore_x_init_count;
308 }
309
310 if (!ecore_init())
311 goto shutdown_eina;
312 if (!ecore_event_init())
313 goto shutdown_ecore;
314
315#ifdef EVAS_FRAME_QUEUING
316 XInitThreads();
317#endif /* ifdef EVAS_FRAME_QUEUING */
318 _ecore_x_disp = XOpenDisplay((char *)name);
319 if (!_ecore_x_disp)
320 goto shutdown_ecore_event;
321
322 _ecore_x_error_handler_init();
323 _ecore_x_event_handlers_num = LASTEvent;
324
325#define ECORE_X_EVENT_HANDLERS_GROW(ext_base, ext_num_events) \
326 do { \
327 if (_ecore_x_event_handlers_num < (ext_base + ext_num_events)) { \
328 _ecore_x_event_handlers_num = (ext_base + ext_num_events); } \
329 } while (0)
330
331 if (XShapeQueryExtension(_ecore_x_disp, &shape_base, &shape_err_base))
332 _ecore_x_event_shape_id = shape_base;
333
334 ECORE_X_EVENT_HANDLERS_GROW(shape_base, ShapeNumberEvents);
335
336#ifdef ECORE_XSS
337 if (XScreenSaverQueryExtension(_ecore_x_disp, &screensaver_base,
338 &screensaver_err_base))
339 _ecore_x_event_screensaver_id = screensaver_base;
340
341 ECORE_X_EVENT_HANDLERS_GROW(screensaver_base, ScreenSaverNumberEvents);
342#endif /* ifdef ECORE_XSS */
343
344 if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base))
345 {
346 int major, minor;
347
348 _ecore_x_event_sync_id = sync_base;
349 if (!XSyncInitialize(_ecore_x_disp, &major, &minor))
350 _ecore_x_event_sync_id = 0;
351 }
352
353 ECORE_X_EVENT_HANDLERS_GROW(sync_base, XSyncNumberEvents);
354
355#ifdef ECORE_XRANDR
356 if (XRRQueryExtension(_ecore_x_disp, &randr_base, &randr_err_base))
357 _ecore_x_event_randr_id = randr_base;
358
359 ECORE_X_EVENT_HANDLERS_GROW(randr_base, RRNumberEvents);
360#endif /* ifdef ECORE_XRANDR */
361
362#ifdef ECORE_XFIXES
363 if (XFixesQueryExtension(_ecore_x_disp, &fixes_base, &fixes_err_base))
364 _ecore_x_event_fixes_selection_id = fixes_base;
365
366 ECORE_X_EVENT_HANDLERS_GROW(fixes_base, XFixesNumberEvents);
367#endif /* ifdef ECORE_XFIXES */
368
369#ifdef ECORE_XDAMAGE
370 if (XDamageQueryExtension(_ecore_x_disp, &damage_base, &damage_err_base))
371 _ecore_x_event_damage_id = damage_base;
372
373 ECORE_X_EVENT_HANDLERS_GROW(damage_base, XDamageNumberEvents);
374#endif /* ifdef ECORE_XDAMAGE */
375
376#ifdef ECORE_XGESTURE
377 if (XGestureQueryExtension(_ecore_x_disp, &gesture_base, &gesture_err_base))
378 _ecore_x_event_gesture_id = gesture_base;
379
380 ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents);
381#endif /* ifdef ECORE_XGESTURE */
382
383 _ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *));
384 if (!_ecore_x_event_handlers)
385 goto close_display;
386
387#ifdef ECORE_XCURSOR
388 _ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE;
389#endif /* ifdef ECORE_XCURSOR */
390 _ecore_x_event_handlers[AnyXEvent] = _ecore_x_event_handle_any_event;
391 _ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press;
392 _ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release;
393 _ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press;
394 _ecore_x_event_handlers[ButtonRelease] =
395 _ecore_x_event_handle_button_release;
396 _ecore_x_event_handlers[MotionNotify] = _ecore_x_event_handle_motion_notify;
397 _ecore_x_event_handlers[EnterNotify] = _ecore_x_event_handle_enter_notify;
398 _ecore_x_event_handlers[LeaveNotify] = _ecore_x_event_handle_leave_notify;
399 _ecore_x_event_handlers[FocusIn] = _ecore_x_event_handle_focus_in;
400 _ecore_x_event_handlers[FocusOut] = _ecore_x_event_handle_focus_out;
401 _ecore_x_event_handlers[KeymapNotify] = _ecore_x_event_handle_keymap_notify;
402 _ecore_x_event_handlers[Expose] = _ecore_x_event_handle_expose;
403 _ecore_x_event_handlers[GraphicsExpose] =
404 _ecore_x_event_handle_graphics_expose;
405 _ecore_x_event_handlers[VisibilityNotify] =
406 _ecore_x_event_handle_visibility_notify;
407 _ecore_x_event_handlers[CreateNotify] = _ecore_x_event_handle_create_notify;
408 _ecore_x_event_handlers[DestroyNotify] =
409 _ecore_x_event_handle_destroy_notify;
410 _ecore_x_event_handlers[UnmapNotify] = _ecore_x_event_handle_unmap_notify;
411 _ecore_x_event_handlers[MapNotify] = _ecore_x_event_handle_map_notify;
412 _ecore_x_event_handlers[MapRequest] = _ecore_x_event_handle_map_request;
413 _ecore_x_event_handlers[ReparentNotify] =
414 _ecore_x_event_handle_reparent_notify;
415 _ecore_x_event_handlers[ConfigureNotify] =
416 _ecore_x_event_handle_configure_notify;
417 _ecore_x_event_handlers[ConfigureRequest] =
418 _ecore_x_event_handle_configure_request;
419 _ecore_x_event_handlers[GravityNotify] =
420 _ecore_x_event_handle_gravity_notify;
421 _ecore_x_event_handlers[ResizeRequest] =
422 _ecore_x_event_handle_resize_request;
423 _ecore_x_event_handlers[CirculateNotify] =
424 _ecore_x_event_handle_circulate_notify;
425 _ecore_x_event_handlers[CirculateRequest] =
426 _ecore_x_event_handle_circulate_request;
427 _ecore_x_event_handlers[PropertyNotify] =
428 _ecore_x_event_handle_property_notify;
429 _ecore_x_event_handlers[SelectionClear] =
430 _ecore_x_event_handle_selection_clear;
431 _ecore_x_event_handlers[SelectionRequest] =
432 _ecore_x_event_handle_selection_request;
433 _ecore_x_event_handlers[SelectionNotify] =
434 _ecore_x_event_handle_selection_notify;
435 _ecore_x_event_handlers[ColormapNotify] =
436 _ecore_x_event_handle_colormap_notify;
437 _ecore_x_event_handlers[ClientMessage] =
438 _ecore_x_event_handle_client_message;
439 _ecore_x_event_handlers[MappingNotify] =
440 _ecore_x_event_handle_mapping_notify;
441#ifdef GenericEvent
442 _ecore_x_event_handlers[GenericEvent] = _ecore_x_event_handle_generic_event;
443#endif /* ifdef GenericEvent */
444
445 if (_ecore_x_event_shape_id)
446 _ecore_x_event_handlers[_ecore_x_event_shape_id] =
447 _ecore_x_event_handle_shape_change;
448
449 if (_ecore_x_event_screensaver_id)
450 _ecore_x_event_handlers[_ecore_x_event_screensaver_id] =
451 _ecore_x_event_handle_screensaver_notify;
452
453 if (_ecore_x_event_sync_id)
454 {
455 _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncCounterNotify] =
456 _ecore_x_event_handle_sync_counter;
457 _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncAlarmNotify] =
458 _ecore_x_event_handle_sync_alarm;
459 }
460
461#ifdef ECORE_XRANDR
462 if (_ecore_x_event_randr_id)
463 {
464 _ecore_x_event_handlers[_ecore_x_event_randr_id +
465 RRScreenChangeNotify] =
466 _ecore_x_event_handle_randr_change;
467 _ecore_x_event_handlers[_ecore_x_event_randr_id +
468 RRNotify] = _ecore_x_event_handle_randr_notify;
469 }
470
471#endif /* ifdef ECORE_XRANDR */
472#ifdef ECORE_XFIXES
473 if (_ecore_x_event_fixes_selection_id)
474 _ecore_x_event_handlers[_ecore_x_event_fixes_selection_id] =
475 _ecore_x_event_handle_fixes_selection_notify;
476
477#endif /* ifdef ECORE_XFIXES */
478#ifdef ECORE_XDAMAGE
479 if (_ecore_x_event_damage_id)
480 _ecore_x_event_handlers[_ecore_x_event_damage_id] =
481 _ecore_x_event_handle_damage_notify;
482
483#endif /* ifdef ECORE_XDAMAGE */
484#ifdef ECORE_XKB
485 // set x autorepeat detection to on. that means instead of
486 // press-release-press-release-press-release
487 // you get
488 // press-press-press-press-press-release
489 do
490 {
491 Bool works = 0;
492 XkbSetDetectableAutoRepeat(_ecore_x_disp, 1, &works);
493 }
494 while (0);
495#endif /* ifdef ECORE_XKB */
496
497#ifdef ECORE_XGESTURE
498 if (_ecore_x_event_gesture_id)
499 {
500 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] =
501 _ecore_x_event_handle_gesture_notify_flick;
502 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] =
503 _ecore_x_event_handle_gesture_notify_pan;
504 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] =
505 _ecore_x_event_handle_gesture_notify_pinchrotation;
506 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] =
507 _ecore_x_event_handle_gesture_notify_tap;
508 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] =
509 _ecore_x_event_handle_gesture_notify_tapnhold;
510 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] =
511 _ecore_x_event_handle_gesture_notify_hold;
512 _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] =
513 _ecore_x_event_handle_gesture_notify_group;
514 }
515
516#endif /* ifdef ECORE_XGESTURE */
517
518 if (!ECORE_X_EVENT_ANY)
519 {
520 ECORE_X_EVENT_ANY = ecore_event_type_new();
521 ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new();
522 ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new();
523 ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
524 ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
525 ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new();
526 ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
527 ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new();
528 ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new();
529 ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new();
530 ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new();
531 ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new();
532 ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new();
533 ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new();
534 ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
535 ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new();
536 ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new();
537 ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new();
538 ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new();
539 ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new();
540 ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new();
541 ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new();
542 ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new();
543 ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new();
544 ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new();
545 ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new();
546 ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new();
547 ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new();
548 ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new();
549 ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new();
550 ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new();
551 ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new();
552 ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new();
553 ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new();
554 ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new();
555 ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new();
556 ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new();
557 ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new();
558 ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
559 ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new();
560 ECORE_X_EVENT_RANDR_CRTC_CHANGE = ecore_event_type_new();
561 ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = ecore_event_type_new();
562 ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = ecore_event_type_new();
563 ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new();
564
565 ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
566
567 ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
568 ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new();
569 ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new();
570 ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new();
571 ECORE_X_EVENT_PING = ecore_event_type_new();
572
573 ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new();
574 ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new();
575 ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new();
576
577 ECORE_X_EVENT_GENERIC = ecore_event_type_new();
578 }
579
580 _ecore_x_modifiers_get();
581
582 _ecore_x_fd_handler_handle =
583 ecore_main_fd_handler_add(ConnectionNumber(_ecore_x_disp),
584 ECORE_FD_READ,
585 _ecore_x_fd_handler, _ecore_x_disp,
586 _ecore_x_fd_handler_buf, _ecore_x_disp);
587 if (!_ecore_x_fd_handler_handle)
588 goto free_event_handlers;
589
590 _ecore_x_atoms_init();
591
592 /* Set up the ICCCM hints */
593 ecore_x_icccm_init();
594
595 /* Set up the _NET_... hints */
596 ecore_x_netwm_init();
597
598 /* old e hints init */
599 ecore_x_e_init();
600
601 /* This is just to be anal about naming conventions */
602
603 _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] =
604 ECORE_X_ATOM_WM_DELETE_WINDOW;
605 _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] =
606 ECORE_X_ATOM_WM_TAKE_FOCUS;
607 _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_PING] =
608 ECORE_X_ATOM_NET_WM_PING;
609 _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] =
610 ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
611
612 _ecore_x_selection_data_init();
613 _ecore_x_dnd_init();
614 _ecore_x_fixes_init();
615 _ecore_x_damage_init();
616 _ecore_x_composite_init();
617 _ecore_x_dpms_init();
618 _ecore_x_randr_init();
619 _ecore_x_gesture_init();
620 _ecore_x_input_init();
621 _ecore_x_events_init();
622
623 _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
624
625 return _ecore_x_init_count;
626
627free_event_handlers:
628 free(_ecore_x_event_handlers);
629 _ecore_x_event_handlers = NULL;
630close_display:
631 XCloseDisplay(_ecore_x_disp);
632 _ecore_x_fd_handler_handle = NULL;
633 _ecore_x_disp = NULL;
634shutdown_ecore_event:
635 ecore_event_shutdown();
636shutdown_ecore:
637 ecore_shutdown();
638shutdown_eina:
639 eina_log_domain_unregister(_ecore_xlib_log_dom);
640 _ecore_xlib_log_dom = -1;
641 eina_shutdown();
642
643 return --_ecore_x_init_count;
644}
645
646static int
647_ecore_x_shutdown(int close_display)
648{
649 if (--_ecore_x_init_count != 0)
650 return _ecore_x_init_count;
651
652 if (!_ecore_x_disp)
653 return _ecore_x_init_count;
654
655 LOGFN(__FILE__, __LINE__, __FUNCTION__);
656
657 ecore_main_fd_handler_del(_ecore_x_fd_handler_handle);
658 if (close_display)
659 XCloseDisplay(_ecore_x_disp);
660 else
661 {
662 close(ConnectionNumber(_ecore_x_disp));
663 // FIXME: may have to clean up x display internal here
664// getting segv here? hmmm. odd. disable
665// XFree(_ecore_x_disp);
666 }
667
668 free(_ecore_x_event_handlers);
669 _ecore_x_fd_handler_handle = NULL;
670 _ecore_x_disp = NULL;
671 _ecore_x_event_handlers = NULL;
672 _ecore_x_events_shutdown();
673 _ecore_x_input_shutdown();
674 _ecore_x_selection_shutdown();
675 _ecore_x_dnd_shutdown();
676 ecore_x_netwm_shutdown();
677
678 ecore_event_shutdown();
679 ecore_shutdown();
680
681 eina_log_domain_unregister(_ecore_xlib_log_dom);
682 _ecore_xlib_log_dom = -1;
683 eina_shutdown();
684
685 return _ecore_x_init_count;
686}
687
688/**
689 * Shuts down the Ecore X library.
690 *
691 * In shutting down the library, the X display connection is terminated
692 * and any event handlers for it are removed.
693 *
694 * @return The number of times the library has been initialized without
695 * being shut down.
696 * @ingroup Ecore_X_Init_Group
697 */
698EAPI int
699ecore_x_shutdown(void)
700{
701 return _ecore_x_shutdown(1);
702}
703
704/**
705 * Shuts down the Ecore X library.
706 *
707 * As ecore_x_shutdown, except do not close Display, only connection.
708 *
709 * @ingroup Ecore_X_Init_Group
710 */
711EAPI int
712ecore_x_disconnect(void)
713{
714 return _ecore_x_shutdown(0);
715}
716
717/**
718 * @defgroup Ecore_X_Display_Attr_Group X Display Attributes
719 *
720 * Functions that set and retrieve X display attributes.
721 */
722
723/**
724 * Retrieves the Ecore_X_Display handle used for the current X connection.
725 * @return The current X display.
726 * @ingroup Ecore_X_Display_Attr_Group
727 */
728EAPI Ecore_X_Display *
729ecore_x_display_get(void)
730{
731 return (Ecore_X_Display *)_ecore_x_disp;
732}
733
734/**
735 * Retrieves the X display file descriptor.
736 * @return The current X display file descriptor.
737 * @ingroup Ecore_X_Display_Attr_Group
738 */
739EAPI int
740ecore_x_fd_get(void)
741{
742 LOGFN(__FILE__, __LINE__, __FUNCTION__);
743 return ConnectionNumber(_ecore_x_disp);
744}
745
746/**
747 * Retrieves the Ecore_X_Screen handle used for the current X connection.
748 * @return The current default screen.
749 * @ingroup Ecore_X_Display_Attr_Group
750 */
751EAPI Ecore_X_Screen *
752ecore_x_default_screen_get(void)
753{
754 LOGFN(__FILE__, __LINE__, __FUNCTION__);
755 return (Ecore_X_Screen *)DefaultScreenOfDisplay(_ecore_x_disp);
756}
757
758/**
759 * Retrieves the size of an Ecore_X_Screen.
760 * @param screen the handle to the screen to query.
761 * @param w where to return the width. May be NULL. Returns 0 on errors.
762 * @param h where to return the height. May be NULL. Returns 0 on errors.
763 * @ingroup Ecore_X_Display_Attr_Group
764 * @see ecore_x_default_screen_get()
765 *
766 * @since 1.1
767 */
768EAPI void
769ecore_x_screen_size_get(const Ecore_X_Screen *screen,
770 int *w,
771 int *h)
772{
773 Screen *s = (Screen *)screen;
774 LOGFN(__FILE__, __LINE__, __FUNCTION__);
775 if (w) *w = 0;
776 if (h) *h = 0;
777 if (!s) return;
778 if (w) *w = s->width;
779 if (h) *h = s->height;
780}
781
782/**
783 * Retrieves the number of screens.
784 *
785 * @return The count of the number of screens.
786 * @ingroup Ecore_X_Display_Attr_Group
787 *
788 * @since 1.1
789 */
790EAPI int
791ecore_x_screen_count_get(void)
792{
793 LOGFN(__FILE__, __LINE__, __FUNCTION__);
794
795 return ScreenCount(_ecore_x_disp);
796}
797
798/**
799 * Retrieves the index number of the given screen.
800 *
801 * @return The index number of the screen.
802 * @ingroup Ecore_X_Display_Attr_Group
803 *
804 * @since 1.1
805 */
806EAPI int
807ecore_x_screen_index_get(const Ecore_X_Screen *screen)
808{
809 return XScreenNumberOfScreen((Screen *)screen);
810}
811
812/**
813 * Retrieves the screen based on index number.
814 *
815 * @return The Ecore_X_Screen at this index.
816 * @ingroup Ecore_X_Display_Attr_Group
817 *
818 * @since 1.1
819 */
820EAPI Ecore_X_Screen *
821ecore_x_screen_get(int idx)
822{
823 return XScreenOfDisplay(_ecore_x_disp, idx);
824}
825
826/**
827 * Sets the timeout for a double and triple clicks to be flagged.
828 *
829 * This sets the time between clicks before the double_click flag is
830 * set in a button down event. If 3 clicks occur within double this
831 * time, the triple_click flag is also set.
832 *
833 * @param t The time in seconds
834 * @ingroup Ecore_X_Display_Attr_Group
835 */
836EAPI void
837ecore_x_double_click_time_set(double t)
838{
839 if (t < 0.0)
840 t = 0.0;
841
842 _ecore_x_double_click_time = t;
843}
844
845/**
846 * Retrieves the double and triple click flag timeout.
847 *
848 * See @ref ecore_x_double_click_time_set for more information.
849 *
850 * @return The timeout for double clicks in seconds.
851 * @ingroup Ecore_X_Display_Attr_Group
852 */
853EAPI double
854ecore_x_double_click_time_get(void)
855{
856 return _ecore_x_double_click_time;
857}
858
859/**
860 * @defgroup Ecore_X_Flush_Group X Synchronization Functions
861 *
862 * Functions that ensure that all commands that have been issued by the
863 * Ecore X library have been sent to the server.
864 */
865
866/**
867 * Sends all X commands in the X Display buffer.
868 * @ingroup Ecore_X_Flush_Group
869 */
870EAPI void
871ecore_x_flush(void)
872{
873 LOGFN(__FILE__, __LINE__, __FUNCTION__);
874 XFlush(_ecore_x_disp);
875}
876
877/**
878 * Flushes the command buffer and waits until all requests have been
879 * processed by the server.
880 * @ingroup Ecore_X_Flush_Group
881 */
882EAPI void
883ecore_x_sync(void)
884{
885 LOGFN(__FILE__, __LINE__, __FUNCTION__);
886 XSync(_ecore_x_disp, False);
887}
888
889/**
890 * Kill all clients with subwindows under a given window.
891 *
892 * You can kill all clients connected to the X server by using
893 * @ref ecore_x_window_root_list to get a list of root windows, and
894 * then passing each root window to this function.
895 *
896 * @param root The window whose children will be killed.
897 */
898EAPI void
899ecore_x_killall(Ecore_X_Window root)
900{
901 unsigned int j;
902 Window root_r;
903 Window parent_r;
904 Window *children_r = NULL;
905 unsigned int num_children = 0;
906
907 LOGFN(__FILE__, __LINE__, __FUNCTION__);
908 XGrabServer(_ecore_x_disp);
909 /* Tranverse window tree starting from root, and drag each
910 * before the firing squad */
911 while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r,
912 &children_r, &num_children) && (num_children > 0))
913 {
914 for (j = 0; j < num_children; ++j)
915 {
916 XKillClient(_ecore_x_disp, children_r[j]);
917 }
918
919 XFree(children_r);
920 }
921 XUngrabServer(_ecore_x_disp);
922 XSync(_ecore_x_disp, False);
923}
924
925/**
926 * Kill a specific client
927 *
928 * You can kill a specific client owning window @p win
929 *
930 * @param win Window of the client to be killed
931 */
932EAPI void
933ecore_x_kill(Ecore_X_Window win)
934{
935 LOGFN(__FILE__, __LINE__, __FUNCTION__);
936 XKillClient(_ecore_x_disp, win);
937}
938
939/**
940 * Return the last event time
941 */
942EAPI Ecore_X_Time
943ecore_x_current_time_get(void)
944{
945 return _ecore_x_event_last_time;
946}
947
948/**
949 * Return the screen DPI
950 *
951 * This is a simplistic call to get DPI. It does not account for differing
952 * DPI in the x amd y axes nor does it accoutn for multihead or xinerama and
953 * xrander where different parts of the screen may have differen DPI etc.
954 *
955 * @return the general screen DPI (dots/pixels per inch).
956 */
957EAPI int
958ecore_x_dpi_get(void)
959{
960 Screen *s;
961
962 LOGFN(__FILE__, __LINE__, __FUNCTION__);
963 s = DefaultScreenOfDisplay(_ecore_x_disp);
964 if (s->mwidth <= 0)
965 return 75;
966
967 return (((s->width * 254) / s->mwidth) + 5) / 10;
968}
969
970/**
971 * Invoke the standard system beep to alert users
972 *
973 * @param percent The volume at which the bell rings. Must be in the range
974 * [-100,+100]. If percent >= 0, the final volume will be:
975 * base - [(base * percent) / 100] + percent
976 * Otherwise, it's calculated as:
977 * base + [(base * percent) / 100]
978 * where @c base is the bell's base volume as set by XChangeKeyboardControl(3).
979 *
980 * @returns EINA_TRUE on success, EINA_FALSE otherwise.
981 */
982EAPI Eina_Bool
983ecore_x_bell(int percent)
984{
985 int ret;
986
987 ret = XBell(_ecore_x_disp, percent);
988 if (ret == BadValue)
989 return EINA_FALSE;
990
991 return EINA_TRUE;
992}
993
994static Eina_Bool
995_ecore_x_fd_handler(void *data,
996 Ecore_Fd_Handler *fd_handler __UNUSED__)
997{
998 Display *d;
999
1000 d = data;
1001 while (XPending(d))
1002 {
1003 XEvent ev;
1004
1005 XNextEvent(d, &ev);
1006
1007#ifdef ENABLE_XIM
1008 /* Filter event for XIM */
1009 if (XFilterEvent(&ev, ev.xkey.window))
1010 continue;
1011
1012#endif /* ifdef ENABLE_XIM */
1013
1014 if ((ev.type >= 0) && (ev.type < _ecore_x_event_handlers_num))
1015 {
1016 if (_ecore_x_event_handlers[AnyXEvent])
1017 _ecore_x_event_handlers[AnyXEvent] (&ev);
1018
1019 if (_ecore_x_event_handlers[ev.type])
1020 _ecore_x_event_handlers[ev.type] (&ev);
1021 }
1022 }
1023 return ECORE_CALLBACK_RENEW;
1024}
1025
1026static Eina_Bool
1027_ecore_x_fd_handler_buf(void *data,
1028 Ecore_Fd_Handler *fd_handler __UNUSED__)
1029{
1030 Display *d;
1031
1032 d = data;
1033 if (XPending(d))
1034 return ECORE_CALLBACK_RENEW;
1035
1036 return ECORE_CALLBACK_CANCEL;
1037}
1038
1039static int
1040_ecore_x_key_mask_get(KeySym sym)
1041{
1042 XModifierKeymap *mod;
1043 KeySym sym2;
1044 int i, j;
1045 const int masks[8] =
1046 {
1047 ShiftMask, LockMask, ControlMask,
1048 Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
1049 };
1050
1051 mod = XGetModifierMapping(_ecore_x_disp);
1052 if ((mod) && (mod->max_keypermod > 0))
1053 for (i = 0; i < (8 * mod->max_keypermod); i++)
1054 {
1055 for (j = 0; j < 8; j++)
1056 {
1057 sym2 = XKeycodeToKeysym(_ecore_x_disp, mod->modifiermap[i], j);
1058 if (sym2 != 0)
1059 break;
1060 }
1061 if (sym2 == sym)
1062 {
1063 int mask;
1064
1065 mask = masks[i / mod->max_keypermod];
1066 if (mod->modifiermap)
1067 XFree(mod->modifiermap);
1068
1069 XFree(mod);
1070 return mask;
1071 }
1072 }
1073
1074 if (mod)
1075 {
1076 if (mod->modifiermap)
1077 XFree(mod->modifiermap);
1078
1079 XFree(mod);
1080 }
1081
1082 return 0;
1083}
1084
1085/*****************************************************************************/
1086/*****************************************************************************/
1087/*****************************************************************************/
1088/* FIXME: these funcs need categorising */
1089/*****************************************************************************/
1090
1091/**
1092 * Get a list of all the root windows on the server.
1093 *
1094 * @note The returned array will need to be freed after use.
1095 * @param num_ret Pointer to integer to put number of windows returned in.
1096 * @return An array of all the root windows. @c NULL is returned if memory
1097 * could not be allocated for the list, or if @p num_ret is @c NULL.
1098 */
1099EAPI Ecore_X_Window *
1100ecore_x_window_root_list(int *num_ret)
1101{
1102 int num, i;
1103 Ecore_X_Window *roots;
1104#ifdef ECORE_XPRINT
1105 int xp_base, xp_err_base;
1106#endif /* ifdef ECORE_XPRINT */
1107
1108 if (!num_ret)
1109 return NULL;
1110
1111 *num_ret = 0;
1112
1113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1114#ifdef ECORE_XPRINT
1115 num = ScreenCount(_ecore_x_disp);
1116 if (XpQueryExtension(_ecore_x_disp, &xp_base, &xp_err_base))
1117 {
1118 Screen **ps = NULL;
1119 int psnum = 0;
1120
1121 ps = XpQueryScreens(_ecore_x_disp, &psnum);
1122 if (ps)
1123 {
1124 int overlap, j;
1125
1126 overlap = 0;
1127 for (i = 0; i < num; i++)
1128 {
1129 for (j = 0; j < psnum; j++)
1130 {
1131 if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j])
1132 overlap++;
1133 }
1134 }
1135 roots = malloc(MAX((num - overlap) * sizeof(Window), 1));
1136 if (roots)
1137 {
1138 int k;
1139
1140 k = 0;
1141 for (i = 0; i < num; i++)
1142 {
1143 int is_print;
1144
1145 is_print = 0;
1146 for (j = 0; j < psnum; j++)
1147 {
1148 if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j])
1149 {
1150 is_print = 1;
1151 break;
1152 }
1153 }
1154 if (!is_print)
1155 {
1156 roots[k] = RootWindow(_ecore_x_disp, i);
1157 k++;
1158 }
1159 }
1160 *num_ret = k;
1161 }
1162
1163 XFree(ps);
1164 }
1165 else
1166 {
1167 roots = malloc(num * sizeof(Window));
1168 if (!roots)
1169 return NULL;
1170
1171 *num_ret = num;
1172 for (i = 0; i < num; i++)
1173 roots[i] = RootWindow(_ecore_x_disp, i);
1174 }
1175 }
1176 else
1177 {
1178 roots = malloc(num * sizeof(Window));
1179 if (!roots)
1180 return NULL;
1181
1182 *num_ret = num;
1183 for (i = 0; i < num; i++)
1184 roots[i] = RootWindow(_ecore_x_disp, i);
1185 }
1186
1187#else /* ifdef ECORE_XPRINT */
1188 num = ScreenCount(_ecore_x_disp);
1189 roots = malloc(num * sizeof(Window));
1190 if (!roots)
1191 return NULL;
1192
1193 *num_ret = num;
1194 for (i = 0; i < num; i++)
1195 roots[i] = RootWindow(_ecore_x_disp, i);
1196#endif /* ifdef ECORE_XPRINT */
1197 return roots;
1198}
1199
1200EAPI Ecore_X_Window
1201ecore_x_window_root_first_get(void)
1202{
1203 return RootWindow(_ecore_x_disp, 0);
1204/*
1205 int num;
1206 Ecore_X_Window root, *roots = NULL;
1207
1208 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1209 roots = ecore_x_window_root_list(&num);
1210 if (!(roots)) return 0;
1211
1212 if (num > 0)
1213 root = roots[0];
1214 else
1215 root = 0;
1216
1217 free(roots);
1218 return root;
1219 */
1220}
1221
1222static void _ecore_x_window_manage_error(void *data);
1223
1224static int _ecore_x_window_manage_failed = 0;
1225static void
1226_ecore_x_window_manage_error(void *data __UNUSED__)
1227{
1228 if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) &&
1229 (ecore_x_error_code_get() == BadAccess))
1230 _ecore_x_window_manage_failed = 1;
1231}
1232
1233EAPI Eina_Bool
1234ecore_x_window_manage(Ecore_X_Window win)
1235{
1236 XWindowAttributes att;
1237
1238 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1239 if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True)
1240 return EINA_FALSE;
1241
1242 ecore_x_sync();
1243 _ecore_x_window_manage_failed = 0;
1244 ecore_x_error_handler_set(_ecore_x_window_manage_error, NULL);
1245 XSelectInput(_ecore_x_disp, win,
1246 EnterWindowMask |
1247 LeaveWindowMask |
1248 PropertyChangeMask |
1249 ResizeRedirectMask |
1250 SubstructureRedirectMask |
1251 SubstructureNotifyMask |
1252 StructureNotifyMask |
1253 KeyPressMask |
1254 KeyReleaseMask |
1255 att.your_event_mask);
1256 ecore_x_sync();
1257 ecore_x_error_handler_set(NULL, NULL);
1258 if (_ecore_x_window_manage_failed)
1259 {
1260 _ecore_x_window_manage_failed = 0;
1261 return EINA_FALSE;
1262 }
1263
1264 return EINA_TRUE;
1265}
1266
1267EAPI void
1268ecore_x_window_container_manage(Ecore_X_Window win)
1269{
1270 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1271 XSelectInput(_ecore_x_disp, win,
1272 SubstructureRedirectMask |
1273 SubstructureNotifyMask);
1274}
1275
1276EAPI void
1277ecore_x_window_client_manage(Ecore_X_Window win)
1278{
1279 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1280 XSelectInput(_ecore_x_disp, win,
1281 PropertyChangeMask |
1282// ResizeRedirectMask |
1283 FocusChangeMask |
1284 ColormapChangeMask |
1285 VisibilityChangeMask |
1286 StructureNotifyMask |
1287 SubstructureNotifyMask
1288 );
1289 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
1290}
1291
1292EAPI void
1293ecore_x_window_sniff(Ecore_X_Window win)
1294{
1295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1296 XSelectInput(_ecore_x_disp, win,
1297 PropertyChangeMask |
1298 SubstructureNotifyMask);
1299}
1300
1301EAPI void
1302ecore_x_window_client_sniff(Ecore_X_Window win)
1303{
1304 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1305 XSelectInput(_ecore_x_disp, win,
1306 PropertyChangeMask |
1307 FocusChangeMask |
1308 ColormapChangeMask |
1309 VisibilityChangeMask |
1310 StructureNotifyMask |
1311 SubstructureNotifyMask);
1312 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
1313}
1314
1315EAPI Eina_Bool
1316ecore_x_window_attributes_get(Ecore_X_Window win,
1317 Ecore_X_Window_Attributes *att_ret)
1318{
1319 XWindowAttributes att;
1320
1321 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1322 if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
1323 return EINA_FALSE;
1324
1325 memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes));
1326 att_ret->root = att.root;
1327 att_ret->x = att.x;
1328 att_ret->y = att.y;
1329 att_ret->w = att.width;
1330 att_ret->h = att.height;
1331 att_ret->border = att.border_width;
1332 att_ret->depth = att.depth;
1333 if (att.map_state != IsUnmapped)
1334 att_ret->visible = 1;
1335
1336 if (att.map_state == IsViewable)
1337 att_ret->viewable = 1;
1338
1339 if (att.override_redirect)
1340 att_ret->override = 1;
1341
1342 if (att.class == InputOnly)
1343 att_ret->input_only = 1;
1344
1345 if (att.save_under)
1346 att_ret->save_under = 1;
1347
1348 att_ret->event_mask.mine = att.your_event_mask;
1349 att_ret->event_mask.all = att.all_event_masks;
1350 att_ret->event_mask.no_propagate = att.do_not_propagate_mask;
1351 att_ret->window_gravity = att.win_gravity;
1352 att_ret->pixel_gravity = att.bit_gravity;
1353 att_ret->colormap = att.colormap;
1354 att_ret->visual = att.visual;
1355 return EINA_TRUE;
1356}
1357
1358EAPI void
1359ecore_x_window_save_set_add(Ecore_X_Window win)
1360{
1361 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1362 XAddToSaveSet(_ecore_x_disp, win);
1363}
1364
1365EAPI void
1366ecore_x_window_save_set_del(Ecore_X_Window win)
1367{
1368 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1369 XRemoveFromSaveSet(_ecore_x_disp, win);
1370}
1371
1372EAPI Ecore_X_Window *
1373ecore_x_window_children_get(Ecore_X_Window win,
1374 int *num)
1375{
1376 Ecore_X_Window *windows = NULL;
1377 Window root_ret = 0, parent_ret = 0, *children_ret = NULL;
1378 unsigned int children_ret_num = 0;
1379
1380 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1381 if (!XQueryTree(_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret,
1382 &children_ret_num))
1383 return NULL;
1384
1385 if (children_ret)
1386 {
1387 windows = malloc(children_ret_num * sizeof(Ecore_X_Window));
1388 if (windows)
1389 {
1390 unsigned int i;
1391
1392 for (i = 0; i < children_ret_num; i++)
1393 windows[i] = children_ret[i];
1394 *num = children_ret_num;
1395 }
1396
1397 XFree(children_ret);
1398 }
1399
1400 return windows;
1401}
1402
1403EAPI Eina_Bool
1404ecore_x_pointer_control_set(int accel_num,
1405 int accel_denom,
1406 int threshold)
1407{
1408 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1409 return XChangePointerControl(_ecore_x_disp, 1, 1,
1410 accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE;
1411}
1412
1413EAPI Eina_Bool
1414ecore_x_pointer_control_get(int *accel_num,
1415 int *accel_denom,
1416 int *threshold)
1417{
1418 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1419 return XGetPointerControl(_ecore_x_disp,
1420 accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE;
1421}
1422
1423EAPI Eina_Bool
1424ecore_x_pointer_mapping_set(unsigned char *map,
1425 int nmap)
1426{
1427 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1428 return XSetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE;
1429}
1430
1431EAPI Eina_Bool
1432ecore_x_pointer_mapping_get(unsigned char *map,
1433 int nmap)
1434{
1435 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1436 return XGetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE;
1437}
1438
1439EAPI Eina_Bool
1440ecore_x_pointer_grab(Ecore_X_Window win)
1441{
1442 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1443 if (XGrabPointer(_ecore_x_disp, win, False,
1444 ButtonPressMask | ButtonReleaseMask |
1445 EnterWindowMask | LeaveWindowMask | PointerMotionMask,
1446 GrabModeAsync, GrabModeAsync,
1447 None, None, CurrentTime) == GrabSuccess)
1448 return EINA_TRUE;
1449
1450 return EINA_FALSE;
1451}
1452
1453EAPI Eina_Bool
1454ecore_x_pointer_confine_grab(Ecore_X_Window win)
1455{
1456 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1457 if (XGrabPointer(_ecore_x_disp, win, False,
1458 ButtonPressMask | ButtonReleaseMask |
1459 EnterWindowMask | LeaveWindowMask | PointerMotionMask,
1460 GrabModeAsync, GrabModeAsync,
1461 win, None, CurrentTime) == GrabSuccess)
1462 return EINA_TRUE;
1463
1464 return EINA_FALSE;
1465}
1466
1467EAPI void
1468ecore_x_pointer_ungrab(void)
1469{
1470 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1471 XUngrabPointer(_ecore_x_disp, CurrentTime);
1472}
1473
1474EAPI Eina_Bool
1475ecore_x_pointer_warp(Ecore_X_Window win,
1476 int x,
1477 int y)
1478{
1479 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1480 return XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y) ? EINA_TRUE : EINA_FALSE;
1481}
1482
1483EAPI Eina_Bool
1484ecore_x_keyboard_grab(Ecore_X_Window win)
1485{
1486 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1487 if (XGrabKeyboard(_ecore_x_disp, win, False,
1488 GrabModeAsync, GrabModeAsync,
1489 CurrentTime) == GrabSuccess)
1490 return EINA_TRUE;
1491
1492 return EINA_FALSE;
1493}
1494
1495EAPI void
1496ecore_x_keyboard_ungrab(void)
1497{
1498 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1499 XUngrabKeyboard(_ecore_x_disp, CurrentTime);
1500}
1501
1502EAPI void
1503ecore_x_grab(void)
1504{
1505 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1506 _ecore_x_grab_count++;
1507 if (_ecore_x_grab_count == 1)
1508 XGrabServer(_ecore_x_disp);
1509}
1510
1511EAPI void
1512ecore_x_ungrab(void)
1513{
1514 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1515 _ecore_x_grab_count--;
1516 if (_ecore_x_grab_count < 0)
1517 _ecore_x_grab_count = 0;
1518
1519 if (_ecore_x_grab_count == 0)
1520 XUngrabServer(_ecore_x_disp);
1521}
1522
1523int _ecore_window_grabs_num = 0;
1524Window *_ecore_window_grabs = NULL;
1525Eina_Bool (*_ecore_window_grab_replay_func)(void *data,
1526 int event_type,
1527 void *event);
1528void *_ecore_window_grab_replay_data;
1529
1530EAPI void
1531ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
1532 int event_type,
1533 void *event),
1534 void *data)
1535{
1536 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1537 _ecore_window_grab_replay_func = func;
1538 _ecore_window_grab_replay_data = data;
1539}
1540
1541EAPI void
1542ecore_x_window_button_grab(Ecore_X_Window win,
1543 int button,
1544 Ecore_X_Event_Mask event_mask,
1545 int mod,
1546 int any_mod)
1547{
1548 unsigned int b;
1549 unsigned int m;
1550 unsigned int locks[8];
1551 int i, ev;
1552 Window *t;
1553
1554 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1555 b = button;
1556 if (b == 0)
1557 b = AnyButton;
1558
1559 m = _ecore_x_event_modifier(mod);
1560 if (any_mod)
1561 m = AnyModifier;
1562
1563 locks[0] = 0;
1564 locks[1] = ECORE_X_LOCK_CAPS;
1565 locks[2] = ECORE_X_LOCK_NUM;
1566 locks[3] = ECORE_X_LOCK_SCROLL;
1567 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1568 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1569 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1570 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1571 ev = event_mask;
1572 for (i = 0; i < 8; i++)
1573 XGrabButton(_ecore_x_disp, b, m | locks[i],
1574 win, False, ev, GrabModeSync, GrabModeAsync, None, None);
1575 _ecore_window_grabs_num++;
1576 t = realloc(_ecore_window_grabs,
1577 _ecore_window_grabs_num * sizeof(Window));
1578 if (!t) return;
1579 _ecore_window_grabs = t;
1580 _ecore_window_grabs[_ecore_window_grabs_num - 1] = win;
1581}
1582
1583void
1584_ecore_x_sync_magic_send(int val,
1585 Ecore_X_Window swin)
1586{
1587 XEvent xev;
1588
1589 xev.xclient.type = ClientMessage;
1590 xev.xclient.serial = 0;
1591 xev.xclient.send_event = True;
1592 xev.xclient.display = _ecore_x_disp;
1593 xev.xclient.window = _ecore_x_private_win;
1594 xev.xclient.format = 32;
1595 xev.xclient.message_type = 27777;
1596 xev.xclient.data.l[0] = 0x7162534;
1597 xev.xclient.data.l[1] = 0x10000000 + val;
1598 xev.xclient.data.l[2] = swin;
1599 XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev);
1600}
1601
1602void
1603_ecore_x_window_grab_remove(Ecore_X_Window win)
1604{
1605 int i, shuffle = 0;
1606 Window *t;
1607
1608 if (_ecore_window_grabs_num > 0)
1609 {
1610 for (i = 0; i < _ecore_window_grabs_num; i++)
1611 {
1612 if (shuffle)
1613 _ecore_window_grabs[i - 1] = _ecore_window_grabs[i];
1614
1615 if ((!shuffle) && (_ecore_window_grabs[i] == win))
1616 shuffle = 1;
1617 }
1618 if (shuffle)
1619 {
1620 _ecore_window_grabs_num--;
1621 if (_ecore_window_grabs_num <= 0)
1622 {
1623 free(_ecore_window_grabs);
1624 _ecore_window_grabs = NULL;
1625 return;
1626 }
1627 t = realloc(_ecore_window_grabs,
1628 _ecore_window_grabs_num *
1629 sizeof(Window));
1630 if (!t) return;
1631 _ecore_window_grabs = t;
1632 }
1633 }
1634}
1635
1636EAPI void
1637ecore_x_window_button_ungrab(Ecore_X_Window win,
1638 int button,
1639 int mod,
1640 int any_mod)
1641{
1642 unsigned int b;
1643 unsigned int m;
1644 unsigned int locks[8];
1645 int i;
1646
1647 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1648 b = button;
1649 if (b == 0)
1650 b = AnyButton;
1651
1652 m = _ecore_x_event_modifier(mod);
1653 if (any_mod)
1654 m = AnyModifier;
1655
1656 locks[0] = 0;
1657 locks[1] = ECORE_X_LOCK_CAPS;
1658 locks[2] = ECORE_X_LOCK_NUM;
1659 locks[3] = ECORE_X_LOCK_SCROLL;
1660 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1661 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1662 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1663 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1664 for (i = 0; i < 8; i++)
1665 XUngrabButton(_ecore_x_disp, b, m | locks[i], win);
1666 _ecore_x_sync_magic_send(1, win);
1667}
1668
1669int _ecore_key_grabs_num = 0;
1670Window *_ecore_key_grabs = NULL;
1671
1672EAPI void
1673ecore_x_window_key_grab(Ecore_X_Window win,
1674 const char *key,
1675 int mod,
1676 int any_mod)
1677{
1678 KeyCode keycode = 0;
1679 KeySym keysym;
1680 unsigned int m;
1681 unsigned int locks[8];
1682 int i;
1683 Window *t;
1684
1685 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1686 if (!strncmp(key, "Keycode-", 8))
1687 keycode = atoi(key + 8);
1688 else
1689 {
1690 keysym = XStringToKeysym(key);
1691 if (keysym == NoSymbol)
1692 return;
1693
1694 keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
1695 }
1696
1697 if (keycode == 0)
1698 return;
1699
1700 m = _ecore_x_event_modifier(mod);
1701 if (any_mod)
1702 m = AnyModifier;
1703
1704 locks[0] = 0;
1705 locks[1] = ECORE_X_LOCK_CAPS;
1706 locks[2] = ECORE_X_LOCK_NUM;
1707 locks[3] = ECORE_X_LOCK_SCROLL;
1708 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1709 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1710 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1711 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1712 for (i = 0; i < 8; i++)
1713 XGrabKey(_ecore_x_disp, keycode, m | locks[i],
1714 win, False, GrabModeSync, GrabModeAsync);
1715 _ecore_key_grabs_num++;
1716 t = realloc(_ecore_key_grabs,
1717 _ecore_key_grabs_num * sizeof(Window));
1718 if (!t) return;
1719 _ecore_key_grabs = t;
1720 _ecore_key_grabs[_ecore_key_grabs_num - 1] = win;
1721}
1722
1723void
1724_ecore_x_key_grab_remove(Ecore_X_Window win)
1725{
1726 int i, shuffle = 0;
1727 Window *t;
1728
1729 if (_ecore_key_grabs_num > 0)
1730 {
1731 for (i = 0; i < _ecore_key_grabs_num; i++)
1732 {
1733 if (shuffle)
1734 _ecore_key_grabs[i - 1] = _ecore_key_grabs[i];
1735
1736 if ((!shuffle) && (_ecore_key_grabs[i] == win))
1737 shuffle = 1;
1738 }
1739 if (shuffle)
1740 {
1741 _ecore_key_grabs_num--;
1742 if (_ecore_key_grabs_num <= 0)
1743 {
1744 free(_ecore_key_grabs);
1745 _ecore_key_grabs = NULL;
1746 return;
1747 }
1748 t = realloc(_ecore_key_grabs,
1749 _ecore_key_grabs_num * sizeof(Window));
1750 if (!t) return;
1751 _ecore_key_grabs = t;
1752 }
1753 }
1754}
1755
1756EAPI void
1757ecore_x_window_key_ungrab(Ecore_X_Window win,
1758 const char *key,
1759 int mod,
1760 int any_mod)
1761{
1762 KeyCode keycode = 0;
1763 KeySym keysym;
1764 unsigned int m;
1765 unsigned int locks[8];
1766 int i;
1767
1768 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1769 if (!strncmp(key, "Keycode-", 8))
1770 keycode = atoi(key + 8);
1771 else
1772 {
1773 keysym = XStringToKeysym(key);
1774 if (keysym == NoSymbol)
1775 return;
1776
1777 keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
1778 }
1779
1780 if (keycode == 0)
1781 return;
1782
1783 m = _ecore_x_event_modifier(mod);
1784 if (any_mod)
1785 m = AnyModifier;
1786
1787 locks[0] = 0;
1788 locks[1] = ECORE_X_LOCK_CAPS;
1789 locks[2] = ECORE_X_LOCK_NUM;
1790 locks[3] = ECORE_X_LOCK_SCROLL;
1791 locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
1792 locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
1793 locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1794 locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
1795 for (i = 0; i < 8; i++)
1796 XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win);
1797 _ecore_x_sync_magic_send(2, win);
1798}
1799
1800/**
1801 * Send client message with given type and format 32.
1802 *
1803 * @param win The window the message is sent to.
1804 * @param type The client message type.
1805 * @param d0 The client message data item 1
1806 * @param d1 The client message data item 2
1807 * @param d2 The client message data item 3
1808 * @param d3 The client message data item 4
1809 * @param d4 The client message data item 5
1810 *
1811 * @return EINA_TRUE on success EINA_FALSE otherwise.
1812 */
1813EAPI Eina_Bool
1814ecore_x_client_message32_send(Ecore_X_Window win,
1815 Ecore_X_Atom type,
1816 Ecore_X_Event_Mask mask,
1817 long d0,
1818 long d1,
1819 long d2,
1820 long d3,
1821 long d4)
1822{
1823 XEvent xev;
1824
1825 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1826 xev.xclient.window = win;
1827 xev.xclient.type = ClientMessage;
1828 xev.xclient.message_type = type;
1829 xev.xclient.format = 32;
1830 xev.xclient.data.l[0] = d0;
1831 xev.xclient.data.l[1] = d1;
1832 xev.xclient.data.l[2] = d2;
1833 xev.xclient.data.l[3] = d3;
1834 xev.xclient.data.l[4] = d4;
1835
1836 return XSendEvent(_ecore_x_disp, win, False, mask, &xev) ? EINA_TRUE : EINA_FALSE;
1837}
1838
1839/**
1840 * Send client message with given type and format 8.
1841 *
1842 * @param win The window the message is sent to.
1843 * @param type The client message type.
1844 * @param data Data to be sent.
1845 * @param len Number of data bytes, max 20.
1846 *
1847 * @return EINA_TRUE on success EINA_FALSE otherwise.
1848 */
1849EAPI Eina_Bool
1850ecore_x_client_message8_send(Ecore_X_Window win,
1851 Ecore_X_Atom type,
1852 const void *data,
1853 int len)
1854{
1855 XEvent xev;
1856
1857 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1858 xev.xclient.window = win;
1859 xev.xclient.type = ClientMessage;
1860 xev.xclient.message_type = type;
1861 xev.xclient.format = 8;
1862 if (len > 20)
1863 len = 20;
1864
1865 memcpy(xev.xclient.data.b, data, len);
1866 memset(xev.xclient.data.b + len, 0, 20 - len);
1867
1868 return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev) ? EINA_TRUE : EINA_FALSE;
1869}
1870
1871EAPI Eina_Bool
1872ecore_x_mouse_move_send(Ecore_X_Window win,
1873 int x,
1874 int y)
1875{
1876 XEvent xev;
1877 XWindowAttributes att;
1878 Window tw;
1879 int rx, ry;
1880
1881 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1882 XGetWindowAttributes(_ecore_x_disp, win, &att);
1883 XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw);
1884 xev.xmotion.type = MotionNotify;
1885 xev.xmotion.window = win;
1886 xev.xmotion.root = att.root;
1887 xev.xmotion.subwindow = win;
1888 xev.xmotion.time = _ecore_x_event_last_time;
1889 xev.xmotion.x = x;
1890 xev.xmotion.y = y;
1891 xev.xmotion.x_root = rx;
1892 xev.xmotion.y_root = ry;
1893 xev.xmotion.state = 0;
1894 xev.xmotion.is_hint = 0;
1895 xev.xmotion.same_screen = 1;
1896 return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev) ? EINA_TRUE : EINA_FALSE;
1897}
1898
1899EAPI Eina_Bool
1900ecore_x_mouse_down_send(Ecore_X_Window win,
1901 int x,
1902 int y,
1903 int b)
1904{
1905 XEvent xev;
1906 XWindowAttributes att;
1907 Window tw;
1908 int rx, ry;
1909
1910 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1911 XGetWindowAttributes(_ecore_x_disp, win, &att);
1912 XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw);
1913 xev.xbutton.type = ButtonPress;
1914 xev.xbutton.window = win;
1915 xev.xbutton.root = att.root;
1916 xev.xbutton.subwindow = win;
1917 xev.xbutton.time = _ecore_x_event_last_time;
1918 xev.xbutton.x = x;
1919 xev.xbutton.y = y;
1920 xev.xbutton.x_root = rx;
1921 xev.xbutton.y_root = ry;
1922 xev.xbutton.state = 1 << b;
1923 xev.xbutton.button = b;
1924 xev.xbutton.same_screen = 1;
1925 return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev) ? EINA_TRUE : EINA_FALSE;
1926}
1927
1928EAPI Eina_Bool
1929ecore_x_mouse_up_send(Ecore_X_Window win,
1930 int x,
1931 int y,
1932 int b)
1933{
1934 XEvent xev;
1935 XWindowAttributes att;
1936 Window tw;
1937 int rx, ry;
1938
1939 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1940 XGetWindowAttributes(_ecore_x_disp, win, &att);
1941 XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw);
1942 xev.xbutton.type = ButtonRelease;
1943 xev.xbutton.window = win;
1944 xev.xbutton.root = att.root;
1945 xev.xbutton.subwindow = win;
1946 xev.xbutton.time = _ecore_x_event_last_time;
1947 xev.xbutton.x = x;
1948 xev.xbutton.y = y;
1949 xev.xbutton.x_root = rx;
1950 xev.xbutton.y_root = ry;
1951 xev.xbutton.state = 0;
1952 xev.xbutton.button = b;
1953 xev.xbutton.same_screen = 1;
1954 return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE;
1955}
1956
1957EAPI void
1958ecore_x_focus_reset(void)
1959{
1960 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1961 XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime);
1962}
1963
1964EAPI void
1965ecore_x_events_allow_all(void)
1966{
1967 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1968 XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime);
1969}
1970
1971EAPI void
1972ecore_x_pointer_last_xy_get(int *x,
1973 int *y)
1974{
1975 if (x)
1976 *x = _ecore_x_event_last_root_x;
1977
1978 if (y)
1979 *y = _ecore_x_event_last_root_y;
1980}
1981
1982EAPI void
1983ecore_x_pointer_xy_get(Ecore_X_Window win,
1984 int *x,
1985 int *y)
1986{
1987 Window rwin, cwin;
1988 int rx, ry, wx, wy, ret;
1989 unsigned int mask;
1990
1991 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1992 ret = XQueryPointer(_ecore_x_disp, win, &rwin, &cwin,
1993 &rx, &ry, &wx, &wy, &mask);
1994 if (!ret)
1995 wx = wy = -1;
1996
1997 if (x) *x = wx;
1998 if (y) *y = wy;
1999}
2000
2001/**
2002 * Retrieve the Visual ID from a given Visual.
2003 *
2004 * @param visual The Visual to get the ID for.
2005 *
2006 * @return The visual id.
2007 * @since 1.1.0
2008 */
2009EAPI unsigned int
2010ecore_x_visual_id_get(Ecore_X_Visual visual)
2011{
2012 return XVisualIDFromVisual(visual);
2013}
2014
2015/**
2016 * Retrieve the default Visual.
2017 *
2018 * @param disp The Display to get the Default Visual from
2019 * @param screen The Screen.
2020 *
2021 * @return The default visual.
2022 * @since 1.1.0
2023 */
2024EAPI Ecore_X_Visual
2025ecore_x_default_visual_get(Ecore_X_Display *disp,
2026 Ecore_X_Screen *screen)
2027{
2028 return DefaultVisual(disp, ecore_x_screen_index_get(screen));
2029}
2030
2031/**
2032 * Retrieve the default Colormap.
2033 *
2034 * @param disp The Display to get the Default Colormap from
2035 * @param screen The Screen.
2036 *
2037 * @return The default colormap.
2038 * @since 1.1.0
2039 */
2040EAPI Ecore_X_Colormap
2041ecore_x_default_colormap_get(Ecore_X_Display *disp,
2042 Ecore_X_Screen *screen)
2043{
2044 return DefaultColormap(disp, ecore_x_screen_index_get(screen));
2045}
2046
2047/**
2048 * Retrieve the default depth.
2049 *
2050 * @param disp The Display to get the Default Depth from
2051 * @param screen The Screen.
2052 *
2053 * @return The default depth.
2054 * @since 1.1.0
2055 */
2056EAPI int
2057ecore_x_default_depth_get(Ecore_X_Display *disp,
2058 Ecore_X_Screen *screen)
2059{
2060 return DefaultDepth(disp, ecore_x_screen_index_get(screen));
2061}
2062
2063/*****************************************************************************/
2064/*****************************************************************************/
2065/*****************************************************************************/
2066
2067static int
2068_ecore_x_event_modifier(unsigned int state)
2069{
2070 int xmodifiers = 0;
2071
2072 if (state & ECORE_EVENT_MODIFIER_SHIFT)
2073 xmodifiers |= ECORE_X_MODIFIER_SHIFT;
2074
2075 if (state & ECORE_EVENT_MODIFIER_CTRL)
2076 xmodifiers |= ECORE_X_MODIFIER_CTRL;
2077
2078 if (state & ECORE_EVENT_MODIFIER_ALT)
2079 xmodifiers |= ECORE_X_MODIFIER_ALT;
2080
2081 if (state & ECORE_EVENT_MODIFIER_WIN)
2082 xmodifiers |= ECORE_X_MODIFIER_WIN;
2083
2084 if (state & ECORE_EVENT_LOCK_SCROLL)
2085 xmodifiers |= ECORE_X_LOCK_SCROLL;
2086
2087 if (state & ECORE_EVENT_LOCK_NUM)
2088 xmodifiers |= ECORE_X_LOCK_NUM;
2089
2090 if (state & ECORE_EVENT_LOCK_CAPS)
2091 xmodifiers |= ECORE_X_LOCK_CAPS;
2092
2093 if (state & ECORE_EVENT_LOCK_SHIFT)
2094 xmodifiers |= ECORE_X_LOCK_SHIFT;
2095
2096 return xmodifiers;
2097}
2098
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
deleted file mode 100644
index 7a8bffa..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
+++ /dev/null
@@ -1,367 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#ifdef HAVE_ALLOCA_H
6# include <alloca.h>
7#elif defined __GNUC__
8# define alloca __builtin_alloca
9#elif defined _AIX
10# define alloca __alloca
11#elif defined _MSC_VER
12# include <malloc.h>
13# define alloca _alloca
14#else /* ifdef HAVE_ALLOCA_H */
15# include <stddef.h>
16# ifdef __cplusplus
17extern "C"
18# endif /* ifdef __cplusplus */
19void *alloca(size_t);
20#endif /* ifdef HAVE_ALLOCA_H */
21
22#include <string.h>
23
24#include "Ecore.h"
25#include "ecore_x_private.h"
26#include "Ecore_X.h"
27#include "Ecore_X_Atoms.h"
28
29#include "ecore_x_atoms_decl.h"
30
31typedef struct
32{
33 const char *name;
34 Ecore_X_Atom *atom;
35} Atom_Item;
36
37void
38_ecore_x_atoms_init(void)
39{
40 const Atom_Item items[] =
41 {
42 { "ATOM", &ECORE_X_ATOM_ATOM },
43 { "CARDINAL", &ECORE_X_ATOM_CARDINAL },
44 { "COMPOUND_TEXT", &ECORE_X_ATOM_COMPOUND_TEXT },
45 { "FILE_NAME", &ECORE_X_ATOM_FILE_NAME },
46 { "STRING", &ECORE_X_ATOM_STRING },
47 { "TEXT", &ECORE_X_ATOM_TEXT },
48 { "UTF8_STRING", &ECORE_X_ATOM_UTF8_STRING },
49 { "WINDOW", &ECORE_X_ATOM_WINDOW },
50 { "PIXMAP", &ECORE_X_ATOM_PIXMAP },
51
52 { "JXSelectionWindowProperty", &ECORE_X_ATOM_SELECTION_PROP_XDND },
53 { "XdndSelection", &ECORE_X_ATOM_SELECTION_XDND },
54 { "XdndAware", &ECORE_X_ATOM_XDND_AWARE },
55 { "XdndEnter", &ECORE_X_ATOM_XDND_ENTER },
56 { "XdndTypeList", &ECORE_X_ATOM_XDND_TYPE_LIST },
57 { "XdndPosition", &ECORE_X_ATOM_XDND_POSITION },
58 { "XdndActionCopy", &ECORE_X_ATOM_XDND_ACTION_COPY },
59 { "XdndActionMove", &ECORE_X_ATOM_XDND_ACTION_MOVE },
60 { "XdndActionPrivate", &ECORE_X_ATOM_XDND_ACTION_PRIVATE },
61 { "XdndActionAsk", &ECORE_X_ATOM_XDND_ACTION_ASK },
62 { "XdndActionList", &ECORE_X_ATOM_XDND_ACTION_LIST },
63 { "XdndActionLink", &ECORE_X_ATOM_XDND_ACTION_LINK },
64 { "XdndActionDescription", &ECORE_X_ATOM_XDND_ACTION_DESCRIPTION },
65 { "XdndProxy", &ECORE_X_ATOM_XDND_PROXY },
66 { "XdndStatus", &ECORE_X_ATOM_XDND_STATUS },
67 { "XdndLeave", &ECORE_X_ATOM_XDND_LEAVE },
68 { "XdndDrop", &ECORE_X_ATOM_XDND_DROP },
69 { "XdndFinished", &ECORE_X_ATOM_XDND_FINISHED },
70
71 { "XdndActionCopy", &ECORE_X_DND_ACTION_COPY },
72 { "XdndActionMove", &ECORE_X_DND_ACTION_MOVE },
73 { "XdndActionLink", &ECORE_X_DND_ACTION_LINK },
74 { "XdndActionAsk", &ECORE_X_DND_ACTION_ASK },
75 { "XdndActionPrivate", &ECORE_X_DND_ACTION_PRIVATE },
76
77 { "_E_FRAME_SIZE", &ECORE_X_ATOM_E_FRAME_SIZE },
78
79 { "_WIN_LAYER", &ECORE_X_ATOM_WIN_LAYER },
80
81 { "WM_NAME", &ECORE_X_ATOM_WM_NAME },
82 { "WM_ICON_NAME", &ECORE_X_ATOM_WM_ICON_NAME },
83 { "WM_NORMAL_HINTS", &ECORE_X_ATOM_WM_NORMAL_HINTS },
84 { "WM_SIZE_HINTS", &ECORE_X_ATOM_WM_SIZE_HINTS },
85 { "WM_HINTS", &ECORE_X_ATOM_WM_HINTS },
86 { "WM_CLASS", &ECORE_X_ATOM_WM_CLASS },
87 { "WM_TRANSIENT_FOR", &ECORE_X_ATOM_WM_TRANSIENT_FOR },
88 { "WM_PROTOCOLS", &ECORE_X_ATOM_WM_PROTOCOLS },
89 { "WM_COLORMAP_WINDOWS", &ECORE_X_ATOM_WM_COLORMAP_WINDOWS },
90 { "WM_COMMAND", &ECORE_X_ATOM_WM_COMMAND },
91 { "WM_CLIENT_MACHINE", &ECORE_X_ATOM_WM_CLIENT_MACHINE },
92
93 { "WM_STATE", &ECORE_X_ATOM_WM_STATE },
94 { "WM_ICON_SIZE", &ECORE_X_ATOM_WM_ICON_SIZE },
95
96 { "WM_CHANGE_STATE", &ECORE_X_ATOM_WM_CHANGE_STATE },
97
98 { "WM_TAKE_FOCUS", &ECORE_X_ATOM_WM_TAKE_FOCUS },
99 { "WM_SAVE_YOURSELF", &ECORE_X_ATOM_WM_SAVE_YOURSELF },
100 { "WM_DELETE_WINDOW", &ECORE_X_ATOM_WM_DELETE_WINDOW },
101
102 { "WM_COLORMAP_NOTIFY", &ECORE_X_ATOM_WM_COLORMAP_NOTIFY },
103
104 { "SM_CLIENT_ID", &ECORE_X_ATOM_SM_CLIENT_ID },
105 { "WM_CLIENT_LEADER", &ECORE_X_ATOM_WM_CLIENT_LEADER },
106 { "WM_WINDOW_ROLE", &ECORE_X_ATOM_WM_WINDOW_ROLE },
107
108 { "_MOTIF_WM_HINTS", &ECORE_X_ATOM_MOTIF_WM_HINTS },
109
110 { "_NET_SUPPORTED", &ECORE_X_ATOM_NET_SUPPORTED },
111 { "_NET_CLIENT_LIST", &ECORE_X_ATOM_NET_CLIENT_LIST },
112 { "_NET_CLIENT_LIST_STACKING", &ECORE_X_ATOM_NET_CLIENT_LIST_STACKING },
113 { "_NET_NUMBER_OF_DESKTOPS", &ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS },
114 { "_NET_DESKTOP_GEOMETRY", &ECORE_X_ATOM_NET_DESKTOP_GEOMETRY },
115 { "_NET_DESKTOP_VIEWPORT", &ECORE_X_ATOM_NET_DESKTOP_VIEWPORT },
116 { "_NET_CURRENT_DESKTOP", &ECORE_X_ATOM_NET_CURRENT_DESKTOP },
117 { "_NET_DESKTOP_NAMES", &ECORE_X_ATOM_NET_DESKTOP_NAMES },
118 { "_NET_ACTIVE_WINDOW", &ECORE_X_ATOM_NET_ACTIVE_WINDOW },
119 { "_NET_WORKAREA", &ECORE_X_ATOM_NET_WORKAREA },
120 { "_NET_SUPPORTING_WM_CHECK", &ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK },
121 { "_NET_VIRTUAL_ROOTS", &ECORE_X_ATOM_NET_VIRTUAL_ROOTS },
122 { "_NET_DESKTOP_LAYOUT", &ECORE_X_ATOM_NET_DESKTOP_LAYOUT },
123 { "_NET_SHOWING_DESKTOP", &ECORE_X_ATOM_NET_SHOWING_DESKTOP },
124
125 { "_NET_CLOSE_WINDOW", &ECORE_X_ATOM_NET_CLOSE_WINDOW },
126 { "_NET_MOVERESIZE_WINDOW", &ECORE_X_ATOM_NET_MOVERESIZE_WINDOW },
127 { "_NET_WM_MOVERESIZE", &ECORE_X_ATOM_NET_WM_MOVERESIZE },
128 { "_NET_RESTACK_WINDOW", &ECORE_X_ATOM_NET_RESTACK_WINDOW },
129
130 { "_NET_REQUEST_FRAME_EXTENTS", &ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS },
131
132 { "_NET_WM_NAME", &ECORE_X_ATOM_NET_WM_NAME },
133 { "_NET_WM_VISIBLE_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_NAME },
134 { "_NET_WM_ICON_NAME", &ECORE_X_ATOM_NET_WM_ICON_NAME },
135 { "_NET_WM_VISIBLE_ICON_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME },
136 { "_NET_WM_DESKTOP", &ECORE_X_ATOM_NET_WM_DESKTOP },
137
138 { "_NET_WM_WINDOW_TYPE", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE },
139 { "_NET_WM_WINDOW_TYPE_DESKTOP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP },
140 { "_NET_WM_WINDOW_TYPE_DOCK", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK },
141 { "_NET_WM_WINDOW_TYPE_TOOLBAR", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR },
142 { "_NET_WM_WINDOW_TYPE_MENU", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU },
143 { "_NET_WM_WINDOW_TYPE_UTILITY", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY },
144 { "_NET_WM_WINDOW_TYPE_SPLASH", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH },
145 { "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG },
146 { "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL },
147 { "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
148 &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU },
149 { "_NET_WM_WINDOW_TYPE_POPUP_MENU",
150 &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU },
151 { "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP },
152 { "_NET_WM_WINDOW_TYPE_NOTIFICATION",
153 &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION },
154 { "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO },
155 { "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND },
156
157 { "_NET_WM_STATE", &ECORE_X_ATOM_NET_WM_STATE },
158 { "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL },
159 { "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY },
160 { "_NET_WM_STATE_MAXIMIZED_VERT",
161 &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT },
162 { "_NET_WM_STATE_MAXIMIZED_HORZ",
163 &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ },
164 { "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED },
165 { "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR },
166 { "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER },
167 { "_NET_WM_STATE_HIDDEN", &ECORE_X_ATOM_NET_WM_STATE_HIDDEN },
168 { "_NET_WM_STATE_FULLSCREEN", &ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN },
169 { "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE },
170 { "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW },
171 { "_NET_WM_STATE_DEMANDS_ATTENTION",
172 &ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION },
173
174 { "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS },
175 { "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE },
176 { "_NET_WM_ACTION_RESIZE", &ECORE_X_ATOM_NET_WM_ACTION_RESIZE },
177 { "_NET_WM_ACTION_MINIMIZE", &ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE },
178 { "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE },
179 { "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK },
180 { "_NET_WM_ACTION_MAXIMIZE_HORZ",
181 &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ },
182 { "_NET_WM_ACTION_MAXIMIZE_VERT",
183 &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT },
184 { "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN },
185 { "_NET_WM_ACTION_CHANGE_DESKTOP",
186 &ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP },
187 { "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE },
188 { "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE },
189 { "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW },
190
191 { "_NET_WM_STRUT", &ECORE_X_ATOM_NET_WM_STRUT },
192 { "_NET_WM_STRUT_PARTIAL", &ECORE_X_ATOM_NET_WM_STRUT_PARTIAL },
193 { "_NET_WM_ICON_GEOMETRY", &ECORE_X_ATOM_NET_WM_ICON_GEOMETRY },
194 { "_NET_WM_ICON", &ECORE_X_ATOM_NET_WM_ICON },
195 { "_NET_WM_PID", &ECORE_X_ATOM_NET_WM_PID },
196 { "_NET_WM_HANDLED_ICONS", &ECORE_X_ATOM_NET_WM_HANDLED_ICONS },
197 { "_NET_WM_USER_TIME", &ECORE_X_ATOM_NET_WM_USER_TIME },
198 { "_NET_STARTUP_ID", &ECORE_X_ATOM_NET_STARTUP_ID },
199 { "_NET_FRAME_EXTENTS", &ECORE_X_ATOM_NET_FRAME_EXTENTS },
200
201 { "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING },
202 { "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST },
203 { "_NET_WM_SYNC_REQUEST_COUNTER",
204 &ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER },
205
206 { "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY },
207 { "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW },
208 { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE },
209
210 { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS },
211 { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD },
212 { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY },
213 { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY },
214 { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY },
215 { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY },
216 { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD },
217
218 { "_E_VIRTUAL_KEYBOARD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD },
219 { "_E_VIRTUAL_KEYBOARD_STATE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE },
220 { "_E_VIRTUAL_KEYBOARD_ON", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON },
221 { "_E_VIRTUAL_KEYBOARD_OFF", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF },
222 { "_E_VIRTUAL_KEYBOARD_ALPHA", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA },
223 { "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC },
224 { "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN },
225 { "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER",
226 &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER },
227 { "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX },
228 { "_E_VIRTUAL_KEYBOARD_TERMINAL",
229 &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL },
230 { "_E_VIRTUAL_KEYBOARD_PASSWORD",
231 &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD },
232 { "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP },
233 { "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST },
234 { "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE },
235 { "_E_VIRTUAL_KEYBOARD_URL", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL },
236 { "_E_VIRTUAL_KEYBOARD_KEYPAD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD },
237 { "_E_VIRTUAL_KEYBOARD_J2ME", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME },
238
239 { "_E_ILLUME_ZONE", &ECORE_X_ATOM_E_ILLUME_ZONE },
240 { "_E_ILLUME_ZONE_LIST", &ECORE_X_ATOM_E_ILLUME_ZONE_LIST },
241 { "_E_ILLUME_CONFORMANT", &ECORE_X_ATOM_E_ILLUME_CONFORMANT },
242 { "_E_ILLUME_MODE", &ECORE_X_ATOM_E_ILLUME_MODE },
243 { "_E_ILLUME_MODE_SINGLE", &ECORE_X_ATOM_E_ILLUME_MODE_SINGLE },
244 { "_E_ILLUME_MODE_DUAL_TOP", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP },
245 { "_E_ILLUME_MODE_DUAL_LEFT", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT },
246 { "_E_ILLUME_FOCUS_BACK", &ECORE_X_ATOM_E_ILLUME_FOCUS_BACK },
247 { "_E_ILLUME_FOCUS_FORWARD", &ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD },
248 { "_E_ILLUME_FOCUS_HOME", &ECORE_X_ATOM_E_ILLUME_FOCUS_HOME },
249 { "_E_ILLUME_CLOSE", &ECORE_X_ATOM_E_ILLUME_CLOSE },
250 { "_E_ILLUME_HOME_NEW", &ECORE_X_ATOM_E_ILLUME_HOME_NEW },
251 { "_E_ILLUME_HOME_DEL", &ECORE_X_ATOM_E_ILLUME_HOME_DEL },
252 { "_E_ILLUME_DRAG", &ECORE_X_ATOM_E_ILLUME_DRAG },
253 { "_E_ILLUME_DRAG_LOCKED", &ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED },
254 { "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START },
255 { "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END },
256 { "_E_ILLUME_INDICATOR_GEOMETRY",
257 &ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY },
258 { "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY },
259 { "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY },
260 { "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL },
261 { "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE },
262 { "_E_ILLUME_QUICKPANEL_STATE_TOGGLE",
263 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE },
264 { "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON },
265 { "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF },
266 { "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR",
267 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR },
268 { "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR",
269 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR },
270 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
271 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
272 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
273 { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
274 { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON },
275 { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF },
276 { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE },
277 { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE },
278 { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT },
279 { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT },
280 { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
281 { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
282 { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
283 { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE },
284 { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON },
285 { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF },
286 { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY },
287 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
288 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
289 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED },
290 { "_E_COMP_SYNC_BEGIN", &ECORE_X_ATOM_E_COMP_SYNC_BEGIN },
291 { "_E_COMP_SYNC_END", &ECORE_X_ATOM_E_COMP_SYNC_END },
292 { "_E_COMP_SYNC_CANCEL", &ECORE_X_ATOM_E_COMP_SYNC_CANCEL },
293
294 { "_E_COMP_FLUSH", &ECORE_X_ATOM_E_COMP_FLUSH },
295 { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP },
296 { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP },
297 { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT },
298 { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }
299 };
300 Atom *atoms;
301 char **names;
302 int i, num;
303
304 num = sizeof(items) / sizeof(Atom_Item);
305 atoms = alloca(num * sizeof(Atom));
306 names = alloca(num * sizeof(char *));
307 for (i = 0; i < num; i++)
308 names[i] = (char *)items[i].name;
309 XInternAtoms(_ecore_x_disp, names, num, False, atoms);
310 for (i = 0; i < num; i++)
311 *(items[i].atom) = atoms[i];
312}
313
314/**
315 * Retrieves the atom value associated with the given name.
316 * @param name The given name.
317 * @return Associated atom value.
318 */
319EAPI Ecore_X_Atom
320ecore_x_atom_get(const char *name)
321{
322 if (!_ecore_x_disp)
323 return 0;
324
325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
326 return XInternAtom(_ecore_x_disp, name, False);
327}
328
329EAPI void
330ecore_x_atoms_get(const char **names,
331 int num,
332 Ecore_X_Atom *atoms)
333{
334 Atom *atoms_int;
335 int i;
336
337 if (!_ecore_x_disp)
338 return;
339
340 LOGFN(__FILE__, __LINE__, __FUNCTION__);
341 atoms_int = alloca(num * sizeof(Atom));
342 XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
343 for (i = 0; i < num; i++)
344 atoms[i] = atoms_int[i];
345}
346
347EAPI char *
348ecore_x_atom_name_get(Ecore_X_Atom atom)
349{
350 char *name;
351 char *xname;
352
353 if (!_ecore_x_disp)
354 return NULL;
355
356 LOGFN(__FILE__, __LINE__, __FUNCTION__);
357
358 xname = XGetAtomName(_ecore_x_disp, atom);
359 if (!xname)
360 return NULL;
361
362 name = strdup(xname);
363 XFree(xname);
364
365 return name;
366}
367
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
deleted file mode 100644
index b919db9..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c
+++ /dev/null
@@ -1,176 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6#include "Ecore_X.h"
7
8static Eina_Bool _composite_available = EINA_FALSE;
9
10void
11_ecore_x_composite_init(void)
12{
13 _composite_available = EINA_FALSE;
14
15#ifdef ECORE_XCOMPOSITE
16 int major, minor;
17
18 if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor))
19 {
20# ifdef ECORE_XRENDER
21 if (XRenderQueryExtension(_ecore_x_disp, &major, &minor))
22 {
23# ifdef ECORE_XFIXES
24 if (XFixesQueryVersion(_ecore_x_disp, &major, &minor))
25 {
26 _composite_available = EINA_TRUE;
27 }
28# endif
29 }
30# endif
31 }
32#endif
33}
34
35EAPI Eina_Bool
36ecore_x_composite_query(void)
37{
38 LOGFN(__FILE__, __LINE__, __FUNCTION__);
39 return _composite_available;
40}
41
42EAPI void
43ecore_x_composite_redirect_window(Ecore_X_Window win,
44 Ecore_X_Composite_Update_Type type)
45{
46#ifdef ECORE_XCOMPOSITE
47 int update = CompositeRedirectAutomatic;
48
49 LOGFN(__FILE__, __LINE__, __FUNCTION__);
50 switch (type)
51 {
52 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
53 update = CompositeRedirectAutomatic;
54 break;
55
56 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
57 update = CompositeRedirectManual;
58 break;
59 }
60 XCompositeRedirectWindow(_ecore_x_disp, win, update);
61#endif /* ifdef ECORE_XCOMPOSITE */
62}
63
64EAPI void
65ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
66 Ecore_X_Composite_Update_Type type)
67{
68#ifdef ECORE_XCOMPOSITE
69 int update = CompositeRedirectAutomatic;
70
71 LOGFN(__FILE__, __LINE__, __FUNCTION__);
72 switch (type)
73 {
74 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
75 update = CompositeRedirectAutomatic;
76 break;
77
78 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
79 update = CompositeRedirectManual;
80 break;
81 }
82 XCompositeRedirectSubwindows(_ecore_x_disp, win, update);
83#endif /* ifdef ECORE_XCOMPOSITE */
84}
85
86EAPI void
87ecore_x_composite_unredirect_window(Ecore_X_Window win,
88 Ecore_X_Composite_Update_Type type)
89{
90#ifdef ECORE_XCOMPOSITE
91 int update = CompositeRedirectAutomatic;
92
93 LOGFN(__FILE__, __LINE__, __FUNCTION__);
94 switch (type)
95 {
96 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
97 update = CompositeRedirectAutomatic;
98 break;
99
100 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
101 update = CompositeRedirectManual;
102 break;
103 }
104 XCompositeUnredirectWindow(_ecore_x_disp, win, update);
105#endif /* ifdef ECORE_XCOMPOSITE */
106}
107
108EAPI void
109ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
110 Ecore_X_Composite_Update_Type type)
111{
112#ifdef ECORE_XCOMPOSITE
113 int update = CompositeRedirectAutomatic;
114
115 LOGFN(__FILE__, __LINE__, __FUNCTION__);
116 switch (type)
117 {
118 case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
119 update = CompositeRedirectAutomatic;
120 break;
121
122 case ECORE_X_COMPOSITE_UPDATE_MANUAL:
123 update = CompositeRedirectManual;
124 break;
125 }
126 XCompositeUnredirectSubwindows(_ecore_x_disp, win, update);
127#endif /* ifdef ECORE_XCOMPOSITE */
128}
129
130EAPI Ecore_X_Pixmap
131ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
132{
133 Ecore_X_Pixmap pixmap = None;
134#ifdef ECORE_XCOMPOSITE
135 LOGFN(__FILE__, __LINE__, __FUNCTION__);
136 pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win);
137#endif /* ifdef ECORE_XCOMPOSITE */
138 return pixmap;
139}
140
141EAPI void
142ecore_x_composite_window_events_disable(Ecore_X_Window win)
143{
144#ifdef ECORE_XCOMPOSITE
145 ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1);
146#endif /* ifdef ECORE_XCOMPOSITE */
147}
148
149EAPI void
150ecore_x_composite_window_events_enable(Ecore_X_Window win)
151{
152#ifdef ECORE_XCOMPOSITE
153 ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535);
154#endif /* ifdef ECORE_XCOMPOSITE */
155}
156
157EAPI Ecore_X_Window
158ecore_x_composite_render_window_enable(Ecore_X_Window root)
159{
160 Ecore_X_Window win = 0;
161#ifdef ECORE_XCOMPOSITE
162 win = XCompositeGetOverlayWindow(_ecore_x_disp, root);
163 ecore_x_composite_window_events_disable(win);
164#endif /* ifdef ECORE_XCOMPOSITE */
165 return win;
166}
167
168EAPI void
169ecore_x_composite_render_window_disable(Ecore_X_Window root)
170{
171#ifdef ECORE_XCOMPOSITE
172 LOGFN(__FILE__, __LINE__, __FUNCTION__);
173 XCompositeReleaseOverlayWindow(_ecore_x_disp, root);
174#endif /* ifdef ECORE_XCOMPOSITE */
175}
176
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
deleted file mode 100644
index a968c56..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c
+++ /dev/null
@@ -1,246 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6
7#include "ecore_x_private.h"
8
9EAPI Eina_Bool
10ecore_x_cursor_color_supported_get(void)
11{
12 return _ecore_x_xcursor;
13}
14
15EAPI Ecore_X_Cursor
16ecore_x_cursor_new(Ecore_X_Window win,
17 int *pixels,
18 int w,
19 int h,
20 int hot_x,
21 int hot_y)
22{
23#ifdef ECORE_XCURSOR
24 LOGFN(__FILE__, __LINE__, __FUNCTION__);
25 if (_ecore_x_xcursor)
26 {
27 Cursor c;
28 XcursorImage *xci;
29
30 xci = XcursorImageCreate(w, h);
31 if (xci)
32 {
33 int i;
34
35 xci->xhot = hot_x;
36 xci->yhot = hot_y;
37 xci->delay = 0;
38 for (i = 0; i < (w * h); i++)
39 {
40// int r, g, b, a;
41//
42// a = (pixels[i] >> 24) & 0xff;
43// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff;
44// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff;
45// b = (((pixels[i] ) & 0xff) * a) / 0xff;
46 xci->pixels[i] = pixels[i];
47// (a << 24) | (r << 16) | (g << 8) | (b);
48 }
49 c = XcursorImageLoadCursor(_ecore_x_disp, xci);
50 XcursorImageDestroy(xci);
51 return c;
52 }
53 }
54 else
55#endif /* ifdef ECORE_XCURSOR */
56 {
57 XColor c1, c2;
58 Cursor c;
59 Pixmap pmap, mask;
60 GC gc;
61 XGCValues gcv;
62 XImage *xim;
63 unsigned int *pix;
64 int fr, fg, fb, br, bg, bb;
65 int brightest = 0;
66 int darkest = 255 * 3;
67 int x, y;
68 const int dither[2][2] =
69 {
70 {0, 2},
71 {3, 1}
72 };
73
74 pmap = XCreatePixmap(_ecore_x_disp, win, w, h, 1);
75 mask = XCreatePixmap(_ecore_x_disp, win, w, h, 1);
76 xim = XCreateImage(_ecore_x_disp,
77 DefaultVisual(_ecore_x_disp, 0),
78 1, ZPixmap, 0, NULL, w, h, 32, 0);
79 xim->data = malloc(xim->bytes_per_line * xim->height);
80
81 fr = 0x00; fg = 0x00; fb = 0x00;
82 br = 0xff; bg = 0xff; bb = 0xff;
83 pix = (unsigned int *)pixels;
84 for (y = 0; y < h; y++)
85 {
86 for (x = 0; x < w; x++)
87 {
88 int r, g, b, a;
89
90 a = (pix[0] >> 24) & 0xff;
91 r = (pix[0] >> 16) & 0xff;
92 g = (pix[0] >> 8) & 0xff;
93 b = (pix[0]) & 0xff;
94 if (a > 0)
95 {
96 if ((r + g + b) > brightest)
97 {
98 brightest = r + g + b;
99 br = r;
100 bg = g;
101 bb = b;
102 }
103
104 if ((r + g + b) < darkest)
105 {
106 darkest = r + g + b;
107 fr = r;
108 fg = g;
109 fb = b;
110 }
111 }
112
113 pix++;
114 }
115 }
116
117 pix = (unsigned int *)pixels;
118 for (y = 0; y < h; y++)
119 {
120 for (x = 0; x < w; x++)
121 {
122 int v;
123 int r, g, b;
124 int d1, d2;
125
126 r = (pix[0] >> 16) & 0xff;
127 g = (pix[0] >> 8) & 0xff;
128 b = (pix[0]) & 0xff;
129 d1 =
130 ((r - fr) * (r - fr)) +
131 ((g - fg) * (g - fg)) +
132 ((b - fb) * (b - fb));
133 d2 =
134 ((r - br) * (r - br)) +
135 ((g - bg) * (g - bg)) +
136 ((b - bb) * (b - bb));
137 if (d1 + d2)
138 {
139 v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
140 if (v > dither[x & 0x1][y & 0x1])
141 v = 1;
142 else
143 v = 0;
144 }
145 else
146 v = 0;
147
148 XPutPixel(xim, x, y, v);
149 pix++;
150 }
151 }
152 gc = XCreateGC(_ecore_x_disp, pmap, 0, &gcv);
153 XPutImage(_ecore_x_disp, pmap, gc, xim, 0, 0, 0, 0, w, h);
154 XFreeGC(_ecore_x_disp, gc);
155
156 pix = (unsigned int *)pixels;
157 for (y = 0; y < h; y++)
158 {
159 for (x = 0; x < w; x++)
160 {
161 int v;
162
163 v = (((pix[0] >> 24) & 0xff) * 5) / 256;
164 if (v > dither[x & 0x1][y & 0x1])
165 v = 1;
166 else
167 v = 0;
168
169 XPutPixel(xim, x, y, v);
170 pix++;
171 }
172 }
173 gc = XCreateGC(_ecore_x_disp, mask, 0, &gcv);
174 XPutImage(_ecore_x_disp, mask, gc, xim, 0, 0, 0, 0, w, h);
175 XFreeGC(_ecore_x_disp, gc);
176
177 free(xim->data);
178 xim->data = NULL;
179 XDestroyImage(xim);
180
181 c1.pixel = 0;
182 c1.red = fr << 8 | fr;
183 c1.green = fg << 8 | fg;
184 c1.blue = fb << 8 | fb;
185 c1.flags = DoRed | DoGreen | DoBlue;
186
187 c2.pixel = 0;
188 c2.red = br << 8 | br;
189 c2.green = bg << 8 | bg;
190 c2.blue = bb << 8 | bb;
191 c2.flags = DoRed | DoGreen | DoBlue;
192
193 c = XCreatePixmapCursor(_ecore_x_disp,
194 pmap, mask,
195 &c1, &c2,
196 hot_x, hot_y);
197 XFreePixmap(_ecore_x_disp, pmap);
198 XFreePixmap(_ecore_x_disp, mask);
199 return c;
200 }
201
202 return 0;
203}
204
205EAPI void
206ecore_x_cursor_free(Ecore_X_Cursor c)
207{
208 LOGFN(__FILE__, __LINE__, __FUNCTION__);
209 XFreeCursor(_ecore_x_disp, c);
210}
211
212/*
213 * Returns the cursor for the given shape.
214 * Note that the return value must not be freed with
215 * ecore_x_cursor_free()!
216 */
217EAPI Ecore_X_Cursor
218ecore_x_cursor_shape_get(int shape)
219{
220 LOGFN(__FILE__, __LINE__, __FUNCTION__);
221 /* Shapes are defined in Ecore_X_Cursor.h */
222 return XCreateFontCursor(_ecore_x_disp, shape);
223}
224
225EAPI void
226ecore_x_cursor_size_set(int size)
227{
228#ifdef ECORE_XCURSOR
229 LOGFN(__FILE__, __LINE__, __FUNCTION__);
230 XcursorSetDefaultSize(_ecore_x_disp, size);
231#else /* ifdef ECORE_XCURSOR */
232 size = 0;
233#endif /* ifdef ECORE_XCURSOR */
234}
235
236EAPI int
237ecore_x_cursor_size_get(void)
238{
239#ifdef ECORE_XCURSOR
240 LOGFN(__FILE__, __LINE__, __FUNCTION__);
241 return XcursorGetDefaultSize(_ecore_x_disp);
242#else /* ifdef ECORE_XCURSOR */
243 return 0;
244#endif /* ifdef ECORE_XCURSOR */
245}
246
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
deleted file mode 100644
index b094f85..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c
+++ /dev/null
@@ -1,71 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6#include "Ecore_X.h"
7
8static Eina_Bool _damage_available = EINA_FALSE;
9#ifdef ECORE_XDAMAGE
10static int _damage_major, _damage_minor;
11#endif /* ifdef ECORE_XDAMAGE */
12
13void
14_ecore_x_damage_init(void)
15{
16#ifdef ECORE_XDAMAGE
17 _damage_major = 1;
18 _damage_minor = 0;
19
20 LOGFN(__FILE__, __LINE__, __FUNCTION__);
21 if (XDamageQueryVersion(_ecore_x_disp, &_damage_major, &_damage_minor))
22 _damage_available = EINA_TRUE;
23 else
24 _damage_available = EINA_FALSE;
25
26#else /* ifdef ECORE_XDAMAGE */
27 _damage_available = EINA_FALSE;
28#endif /* ifdef ECORE_XDAMAGE */
29}
30
31EAPI Eina_Bool
32ecore_x_damage_query(void)
33{
34 return _damage_available;
35}
36
37EAPI Ecore_X_Damage
38ecore_x_damage_new(Ecore_X_Drawable d,
39 Ecore_X_Damage_Report_Level level)
40{
41#ifdef ECORE_XDAMAGE
42 Ecore_X_Damage damage;
43
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45 damage = XDamageCreate(_ecore_x_disp, d, level);
46 return damage;
47#else /* ifdef ECORE_XDAMAGE */
48 return 0;
49#endif /* ifdef ECORE_XDAMAGE */
50}
51
52EAPI void
53ecore_x_damage_free(Ecore_X_Damage damage)
54{
55#ifdef ECORE_XDAMAGE
56 LOGFN(__FILE__, __LINE__, __FUNCTION__);
57 XDamageDestroy(_ecore_x_disp, damage);
58#endif /* ifdef ECORE_XDAMAGE */
59}
60
61EAPI void
62ecore_x_damage_subtract(Ecore_X_Damage damage,
63 Ecore_X_Region repair,
64 Ecore_X_Region parts)
65{
66#ifdef ECORE_XDAMAGE
67 LOGFN(__FILE__, __LINE__, __FUNCTION__);
68 XDamageSubtract(_ecore_x_disp, damage, repair, parts);
69#endif /* ifdef ECORE_XDAMAGE */
70}
71
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
deleted file mode 100644
index 372470a..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c
+++ /dev/null
@@ -1,706 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <string.h>
7
8#include "Ecore.h"
9#include "ecore_x_private.h"
10#include "Ecore_X.h"
11#include "Ecore_X_Atoms.h"
12
13EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
14EAPI int ECORE_X_EVENT_XDND_POSITION = 0;
15EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
16EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
17EAPI int ECORE_X_EVENT_XDND_DROP = 0;
18EAPI int ECORE_X_EVENT_XDND_FINISHED = 0;
19
20static Ecore_X_DND_Source *_source = NULL;
21static Ecore_X_DND_Target *_target = NULL;
22static int _ecore_x_dnd_init_count = 0;
23
24typedef struct _Version_Cache_Item
25{
26 Ecore_X_Window win;
27 int ver;
28} Version_Cache_Item;
29static Version_Cache_Item *_version_cache = NULL;
30static int _version_cache_num = 0, _version_cache_alloc = 0;
31static void (*_posupdatecb)(void *,
32 Ecore_X_Xdnd_Position *);
33static void *_posupdatedata;
34
35void
36_ecore_x_dnd_init(void)
37{
38 if (!_ecore_x_dnd_init_count)
39 {
40 _source = calloc(1, sizeof(Ecore_X_DND_Source));
41 if (!_source) return;
42 _source->version = ECORE_X_DND_VERSION;
43 _source->win = None;
44 _source->dest = None;
45 _source->state = ECORE_X_DND_SOURCE_IDLE;
46 _source->prev.window = 0;
47
48 _target = calloc(1, sizeof(Ecore_X_DND_Target));
49 if (!_target)
50 {
51 free(_source);
52 _source = NULL;
53 return;
54 }
55 _target->win = None;
56 _target->source = None;
57 _target->state = ECORE_X_DND_TARGET_IDLE;
58
59 ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
60 ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
61 ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
62 ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
63 ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
64 ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
65 }
66
67 _ecore_x_dnd_init_count++;
68}
69
70void
71_ecore_x_dnd_shutdown(void)
72{
73 _ecore_x_dnd_init_count--;
74 if (_ecore_x_dnd_init_count > 0)
75 return;
76
77 if (_source)
78 free(_source);
79
80 _source = NULL;
81
82 if (_target)
83 free(_target);
84
85 _target = NULL;
86
87 _ecore_x_dnd_init_count = 0;
88}
89
90static Eina_Bool
91_ecore_x_dnd_converter_copy(char *target __UNUSED__,
92 void *data,
93 int size,
94 void **data_ret,
95 int *size_ret,
96 Ecore_X_Atom *tprop __UNUSED__,
97 int *count __UNUSED__)
98{
99 XTextProperty text_prop;
100 char *mystr;
101 XICCEncodingStyle style = XTextStyle;
102
103 if (!data || !size)
104 return EINA_FALSE;
105
106 mystr = calloc(1, size + 1);
107 if (!mystr)
108 return EINA_FALSE;
109
110 memcpy(mystr, data, size);
111
112 if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style,
113 &text_prop) == Success)
114 {
115 int bufsize = strlen((char *)text_prop.value) + 1;
116 *data_ret = malloc(bufsize);
117 if (!*data_ret)
118 {
119 free(mystr);
120 return EINA_FALSE;
121 }
122 memcpy(*data_ret, text_prop.value, bufsize);
123 *size_ret = bufsize;
124 XFree(text_prop.value);
125 free(mystr);
126 return EINA_TRUE;
127 }
128 else
129 {
130 free(mystr);
131 return EINA_FALSE;
132 }
133}
134
135EAPI void
136ecore_x_dnd_aware_set(Ecore_X_Window win,
137 Eina_Bool on)
138{
139 Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
140
141 LOGFN(__FILE__, __LINE__, __FUNCTION__);
142 if (on)
143 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
144 XA_ATOM, 32, &prop_data, 1);
145 else
146 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
147}
148
149EAPI int
150ecore_x_dnd_version_get(Ecore_X_Window win)
151{
152 unsigned char *prop_data;
153 int num;
154 Version_Cache_Item *t;
155
156 LOGFN(__FILE__, __LINE__, __FUNCTION__);
157 // this looks hacky - and it is, but we need a way of caching info about
158 // a window while dragging, because we literally query this every mouse
159 // move and going to and from x multiple times per move is EXPENSIVE
160 // and slows things down, puts lots of load on x etc.
161 if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
162 if (_version_cache)
163 {
164 int i;
165
166 for (i = 0; i < _version_cache_num; i++)
167 {
168 if (_version_cache[i].win == win)
169 return _version_cache[i].ver;
170 }
171 }
172
173 if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE,
174 XA_ATOM, 32, &prop_data, &num))
175 {
176 int version = (int)*prop_data;
177 free(prop_data);
178 if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
179 {
180 _version_cache_num++;
181 if (_version_cache_num > _version_cache_alloc)
182 _version_cache_alloc += 16;
183
184 t = realloc(_version_cache,
185 _version_cache_alloc *
186 sizeof(Version_Cache_Item));
187 if (!t) return 0;
188 _version_cache = t;
189 _version_cache[_version_cache_num - 1].win = win;
190 _version_cache[_version_cache_num - 1].ver = version;
191 }
192
193 return version;
194 }
195
196 if (_source->state == ECORE_X_DND_SOURCE_DRAGGING)
197 {
198 _version_cache_num++;
199 if (_version_cache_num > _version_cache_alloc)
200 _version_cache_alloc += 16;
201
202 t = realloc(_version_cache, _version_cache_alloc *
203 sizeof(Version_Cache_Item));
204 if (!t) return 0;
205 _version_cache = t;
206 _version_cache[_version_cache_num - 1].win = win;
207 _version_cache[_version_cache_num - 1].ver = 0;
208 }
209
210 return 0;
211}
212
213EAPI Eina_Bool
214ecore_x_dnd_type_isset(Ecore_X_Window win,
215 const char *type)
216{
217 int num, i, ret = EINA_FALSE;
218 unsigned char *data;
219 Ecore_X_Atom *atoms, atom;
220
221 LOGFN(__FILE__, __LINE__, __FUNCTION__);
222 if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
223 XA_ATOM, 32, &data, &num))
224 return ret;
225
226 atom = ecore_x_atom_get(type);
227 atoms = (Ecore_X_Atom *)data;
228
229 for (i = 0; i < num; ++i)
230 {
231 if (atom == atoms[i])
232 {
233 ret = EINA_TRUE;
234 break;
235 }
236 }
237
238 XFree(data);
239 return ret;
240}
241
242EAPI void
243ecore_x_dnd_type_set(Ecore_X_Window win,
244 const char *type,
245 Eina_Bool on)
246{
247 Ecore_X_Atom atom;
248 Ecore_X_Atom *oldset = NULL, *newset = NULL;
249 int i, j = 0, num = 0;
250 unsigned char *data = NULL;
251 unsigned char *old_data = NULL;
252
253 LOGFN(__FILE__, __LINE__, __FUNCTION__);
254 atom = ecore_x_atom_get(type);
255 ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST,
256 XA_ATOM, 32, &old_data, &num);
257 oldset = (Ecore_X_Atom *)old_data;
258
259 LOGFN(__FILE__, __LINE__, __FUNCTION__);
260 if (on)
261 {
262 if (ecore_x_dnd_type_isset(win, type))
263 {
264 XFree(old_data);
265 return;
266 }
267
268 newset = calloc(num + 1, sizeof(Ecore_X_Atom));
269 if (!newset)
270 return;
271
272 data = (unsigned char *)newset;
273
274 for (i = 0; i < num; i++)
275 newset[i + 1] = oldset[i];
276 /* prepend the new type */
277 newset[0] = atom;
278
279 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
280 XA_ATOM, 32, data, num + 1);
281 }
282 else
283 {
284 if (!ecore_x_dnd_type_isset(win, type))
285 {
286 XFree(old_data);
287 return;
288 }
289
290 newset = calloc(num - 1, sizeof(Ecore_X_Atom));
291 if (!newset)
292 {
293 XFree(old_data);
294 return;
295 }
296
297 data = (unsigned char *)newset;
298 for (i = 0; i < num; i++)
299 if (oldset[i] != atom)
300 newset[j++] = oldset[i];
301
302 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
303 XA_ATOM, 32, data, num - 1);
304 }
305
306 XFree(oldset);
307 free(newset);
308}
309
310EAPI void
311ecore_x_dnd_types_set(Ecore_X_Window win,
312 const char **types,
313 unsigned int num_types)
314{
315 Ecore_X_Atom *newset = NULL;
316 unsigned int i;
317 unsigned char *data = NULL;
318
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320 if (!num_types)
321 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST);
322 else
323 {
324 newset = calloc(num_types, sizeof(Ecore_X_Atom));
325 if (!newset)
326 return;
327
328 data = (unsigned char *)newset;
329 for (i = 0; i < num_types; i++)
330 {
331 newset[i] = ecore_x_atom_get(types[i]);
332 ecore_x_selection_converter_atom_add(newset[i],
333 _ecore_x_dnd_converter_copy);
334 }
335 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST,
336 XA_ATOM, 32, data, num_types);
337 free(newset);
338 }
339}
340
341EAPI void
342ecore_x_dnd_actions_set(Ecore_X_Window win,
343 Ecore_X_Atom *actions,
344 unsigned int num_actions)
345{
346 unsigned int i;
347 unsigned char *data = NULL;
348
349 LOGFN(__FILE__, __LINE__, __FUNCTION__);
350 if (!num_actions)
351 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST);
352 else
353 {
354 data = (unsigned char *)actions;
355 for (i = 0; i < num_actions; i++)
356 {
357 ecore_x_selection_converter_atom_add(actions[i],
358 _ecore_x_dnd_converter_copy);
359 }
360 ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST,
361 XA_ATOM, 32, data, num_actions);
362 }
363}
364
365/**
366 * The DND position update cb is called Ecore_X sends a DND position to a
367 * client.
368 *
369 * It essentially mirrors some of the data sent in the position message.
370 * Generally this cb should be set just before position update is called.
371 * Please note well you need to look after your own data pointer if someone
372 * trashes you position update cb set.
373 *
374 * It is considered good form to clear this when the dnd event finishes.
375 *
376 * @param cb Callback to updated each time ecore_x sends a position update.
377 * @param data User data.
378 */
379EAPI void
380ecore_x_dnd_callback_pos_update_set(
381 void (*cb)(void *,
382 Ecore_X_Xdnd_Position *data),
383 const void *data)
384{
385 _posupdatecb = cb;
386 _posupdatedata = (void *)data; /* Discard the const early */
387}
388
389Ecore_X_DND_Source *
390_ecore_x_dnd_source_get(void)
391{
392 return _source;
393}
394
395Ecore_X_DND_Target *
396_ecore_x_dnd_target_get(void)
397{
398 return _target;
399}
400
401EAPI Eina_Bool
402ecore_x_dnd_begin(Ecore_X_Window source,
403 unsigned char *data,
404 int size)
405{
406 LOGFN(__FILE__, __LINE__, __FUNCTION__);
407 if (!ecore_x_dnd_version_get(source))
408 return EINA_FALSE;
409
410 /* Take ownership of XdndSelection */
411 if (!ecore_x_selection_xdnd_set(source, data, size))
412 return EINA_FALSE;
413
414 if (_version_cache)
415 {
416 free(_version_cache);
417 _version_cache = NULL;
418 _version_cache_num = 0;
419 _version_cache_alloc = 0;
420 }
421
422 ecore_x_window_shadow_tree_flush();
423
424 _source->win = source;
425 ecore_x_window_ignore_set(_source->win, 1);
426 _source->state = ECORE_X_DND_SOURCE_DRAGGING;
427 _source->time = _ecore_x_event_last_time;
428 _source->prev.window = 0;
429
430 /* Default Accepted Action: move */
431 _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE;
432 _source->accepted_action = None;
433 _source->dest = None;
434
435 return EINA_TRUE;
436}
437
438EAPI Eina_Bool
439ecore_x_dnd_drop(void)
440{
441 XEvent xev;
442 int status = EINA_FALSE;
443
444 LOGFN(__FILE__, __LINE__, __FUNCTION__);
445 if (_source->dest)
446 {
447 xev.xany.type = ClientMessage;
448 xev.xany.display = _ecore_x_disp;
449 xev.xclient.format = 32;
450 xev.xclient.window = _source->dest;
451
452 if (_source->will_accept)
453 {
454 xev.xclient.message_type = ECORE_X_ATOM_XDND_DROP;
455 xev.xclient.data.l[0] = _source->win;
456 xev.xclient.data.l[1] = 0;
457 xev.xclient.data.l[2] = _source->time;
458 XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev);
459 _source->state = ECORE_X_DND_SOURCE_DROPPED;
460 status = EINA_TRUE;
461 }
462 else
463 {
464 xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE;
465 xev.xclient.data.l[0] = _source->win;
466 xev.xclient.data.l[1] = 0;
467 XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev);
468 _source->state = ECORE_X_DND_SOURCE_IDLE;
469 }
470 }
471 else
472 {
473 /* Dropping on nothing */
474 ecore_x_selection_xdnd_clear();
475 _source->state = ECORE_X_DND_SOURCE_IDLE;
476 }
477
478 ecore_x_window_ignore_set(_source->win, 0);
479
480 _source->prev.window = 0;
481
482 return status;
483}
484
485EAPI void
486ecore_x_dnd_send_status(Eina_Bool will_accept,
487 Eina_Bool suppress,
488 Ecore_X_Rectangle rectangle,
489 Ecore_X_Atom action)
490{
491 XEvent xev;
492
493 if (_target->state == ECORE_X_DND_TARGET_IDLE)
494 return;
495
496 LOGFN(__FILE__, __LINE__, __FUNCTION__);
497 memset(&xev, 0, sizeof(XEvent));
498
499 _target->will_accept = will_accept;
500
501 xev.xclient.type = ClientMessage;
502 xev.xclient.display = _ecore_x_disp;
503 xev.xclient.message_type = ECORE_X_ATOM_XDND_STATUS;
504 xev.xclient.format = 32;
505 xev.xclient.window = _target->source;
506
507 xev.xclient.data.l[0] = _target->win;
508 xev.xclient.data.l[1] = 0;
509 if (will_accept)
510 xev.xclient.data.l[1] |= 0x1UL;
511
512 if (!suppress)
513 xev.xclient.data.l[1] |= 0x2UL;
514
515 /* Set rectangle information */
516 xev.xclient.data.l[2] = rectangle.x;
517 xev.xclient.data.l[2] <<= 16;
518 xev.xclient.data.l[2] |= rectangle.y;
519 xev.xclient.data.l[3] = rectangle.width;
520 xev.xclient.data.l[3] <<= 16;
521 xev.xclient.data.l[3] |= rectangle.height;
522
523 if (will_accept)
524 {
525 xev.xclient.data.l[4] = action;
526 _target->accepted_action = action;
527 }
528 else
529 {
530 xev.xclient.data.l[4] = None;
531 _target->accepted_action = action;
532 }
533
534 XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
535}
536
537EAPI void
538ecore_x_dnd_send_finished(void)
539{
540 XEvent xev;
541
542 if (_target->state == ECORE_X_DND_TARGET_IDLE)
543 return;
544
545 LOGFN(__FILE__, __LINE__, __FUNCTION__);
546 xev.xany.type = ClientMessage;
547 xev.xany.display = _ecore_x_disp;
548 xev.xclient.message_type = ECORE_X_ATOM_XDND_FINISHED;
549 xev.xclient.format = 32;
550 xev.xclient.window = _target->source;
551
552 xev.xclient.data.l[0] = _target->win;
553 xev.xclient.data.l[1] = 0;
554 xev.xclient.data.l[2] = 0;
555 if (_target->will_accept)
556 {
557 xev.xclient.data.l[1] |= 0x1UL;
558 xev.xclient.data.l[2] = _target->accepted_action;
559 }
560
561 XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
562
563 _target->state = ECORE_X_DND_TARGET_IDLE;
564}
565
566EAPI void
567ecore_x_dnd_source_action_set(Ecore_X_Atom action)
568{
569 _source->action = action;
570 if (_source->prev.window)
571 _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
572}
573
574EAPI Ecore_X_Atom
575ecore_x_dnd_source_action_get(void)
576{
577 return _source->action;
578}
579
580void
581_ecore_x_dnd_drag(Ecore_X_Window root,
582 int x,
583 int y)
584{
585 XEvent xev;
586 Ecore_X_Window win;
587 Ecore_X_Window *skip;
588 Ecore_X_Xdnd_Position pos;
589 int num;
590
591 if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
592 return;
593
594 /* Preinitialize XEvent struct */
595 memset(&xev, 0, sizeof(XEvent));
596 xev.xany.type = ClientMessage;
597 xev.xany.display = _ecore_x_disp;
598 xev.xclient.format = 32;
599
600 /* Attempt to find a DND-capable window under the cursor */
601 skip = ecore_x_window_ignore_list(&num);
602// WARNING - this function is HEAVY. it goes to and from x a LOT walking the
603// window tree - use the SHADOW version - makes a 1-off tree copy, then uses
604// that instead.
605// win = ecore_x_window_at_xy_with_skip_get(x, y, skip, num);
606 win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, skip, num);
607
608// NOTE: This now uses the shadow version to find parent windows
609// while ((win) && !(ecore_x_dnd_version_get(win)))
610// win = ecore_x_window_parent_get(win);
611 while ((win) && !(ecore_x_dnd_version_get(win)))
612 win = ecore_x_window_shadow_parent_get(root, win);
613
614 /* Send XdndLeave to current destination window if we have left it */
615 if ((_source->dest) && (win != _source->dest))
616 {
617 xev.xclient.window = _source->dest;
618 xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE;
619 xev.xclient.data.l[0] = _source->win;
620 xev.xclient.data.l[1] = 0;
621
622 XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev);
623 _source->suppress = 0;
624 }
625
626 if (win)
627 {
628 int x1, x2, y1, y2;
629
630 _source->version = MIN(ECORE_X_DND_VERSION,
631 ecore_x_dnd_version_get(win));
632 if (win != _source->dest)
633 {
634 int i;
635 unsigned char *data;
636 Ecore_X_Atom *types;
637
638 ecore_x_window_prop_property_get(_source->win,
639 ECORE_X_ATOM_XDND_TYPE_LIST,
640 XA_ATOM,
641 32,
642 &data,
643 &num);
644 types = (Ecore_X_Atom *)data;
645
646 /* Entered new window, send XdndEnter */
647 xev.xclient.window = win;
648 xev.xclient.message_type = ECORE_X_ATOM_XDND_ENTER;
649 xev.xclient.data.l[0] = _source->win;
650 xev.xclient.data.l[1] = 0;
651 if (num > 3)
652 xev.xclient.data.l[1] |= 0x1UL;
653 else
654 xev.xclient.data.l[1] &= 0xfffffffeUL;
655
656 xev.xclient.data.l[1] |= ((unsigned long)_source->version) << 24;
657
658 for (i = 2; i < 5; i++)
659 xev.xclient.data.l[i] = 0;
660 for (i = 0; i < MIN(num, 3); ++i)
661 xev.xclient.data.l[i + 2] = types[i];
662 XFree(data);
663 XSendEvent(_ecore_x_disp, win, False, 0, &xev);
664 _source->await_status = 0;
665 _source->will_accept = 0;
666 }
667
668 /* Determine if we're still in the rectangle from the last status */
669 x1 = _source->rectangle.x;
670 x2 = _source->rectangle.x + _source->rectangle.width;
671 y1 = _source->rectangle.y;
672 y2 = _source->rectangle.y + _source->rectangle.height;
673
674 if ((!_source->await_status) ||
675 (!_source->suppress) ||
676 ((x < x1) || (x > x2) || (y < y1) || (y > y2)))
677 {
678 xev.xclient.window = win;
679 xev.xclient.message_type = ECORE_X_ATOM_XDND_POSITION;
680 xev.xclient.data.l[0] = _source->win;
681 xev.xclient.data.l[1] = 0; /* Reserved */
682 xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
683 xev.xclient.data.l[3] = _source->time; /* Version 1 */
684 xev.xclient.data.l[4] = _source->action; /* Version 2, Needs to be pre-set */
685 XSendEvent(_ecore_x_disp, win, False, 0, &xev);
686
687 _source->await_status = 1;
688 }
689 }
690
691 if (_posupdatecb)
692 {
693 pos.position.x = x;
694 pos.position.y = y;
695 pos.win = win;
696 pos.prev = _source->dest;
697 _posupdatecb(_posupdatedata, &pos);
698 }
699
700 _source->prev.x = x;
701 _source->prev.y = y;
702 _source->prev.window = root;
703 _source->dest = win;
704}
705
706/* 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
deleted file mode 100644
index 23349f4..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c
+++ /dev/null
@@ -1,247 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6
7static Eina_Bool _dpms_available = EINA_FALSE;
8
9void
10_ecore_x_dpms_init(void)
11{
12#ifdef ECORE_XDPMS
13 int _dpms_major, _dpms_minor;
14
15 _dpms_major = 1;
16 _dpms_minor = 0;
17
18 if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
19 _dpms_available = EINA_TRUE;
20 else
21 _dpms_available = EINA_FALSE;
22
23#else /* ifdef ECORE_XDPMS */
24 _dpms_available = EINA_FALSE;
25#endif /* ifdef ECORE_XDPMS */
26}
27
28/**
29 * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
30 *
31 * Functions related to the X DPMS extension.
32 */
33
34/**
35 * Checks if the X DPMS extension is available on the server.
36 * @return @c 1 if the X DPMS extension is available, @c 0 otherwise.
37 * @ingroup Ecore_X_DPMS_Group
38 */
39EAPI Eina_Bool
40ecore_x_dpms_query(void)
41{
42 return _dpms_available;
43}
44
45/**
46 * Checks if the X server is capable of DPMS.
47 * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
48 * @ingroup Ecore_X_DPMS_Group
49 */
50EAPI Eina_Bool
51ecore_x_dpms_capable_get(void)
52{
53#ifdef ECORE_XDPMS
54 LOGFN(__FILE__, __LINE__, __FUNCTION__);
55 return DPMSCapable(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE;
56#else /* ifdef ECORE_XDPMS */
57 return EINA_FALSE;
58#endif /* ifdef ECORE_XDPMS */
59}
60
61/**
62 * Checks the DPMS state of the display.
63 * @return @c 1 if DPMS is enabled, @c 0 otherwise.
64 * @ingroup Ecore_X_DPMS_Group
65 */
66EAPI Eina_Bool
67ecore_x_dpms_enabled_get(void)
68{
69#ifdef ECORE_XDPMS
70 unsigned char state;
71 unsigned short power_lvl;
72
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 DPMSInfo(_ecore_x_disp, &power_lvl, &state);
75 return state ? EINA_TRUE : EINA_FALSE;
76#else /* ifdef ECORE_XDPMS */
77 return EINA_FALSE;
78#endif /* ifdef ECORE_XDPMS */
79}
80
81/**
82 * Sets the DPMS state of the display.
83 * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
84 * @ingroup Ecore_X_DPMS_Group
85 */
86EAPI void
87ecore_x_dpms_enabled_set(int enabled)
88{
89#ifdef ECORE_XDPMS
90 LOGFN(__FILE__, __LINE__, __FUNCTION__);
91 if (enabled)
92 DPMSEnable(_ecore_x_disp);
93 else
94 DPMSDisable(_ecore_x_disp);
95
96#endif /* ifdef ECORE_XDPMS */
97}
98
99/**
100 * Gets the timeouts. The values are in unit of seconds.
101 * @param standby Amount of time of inactivity before standby mode will be invoked.
102 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
103 * @param off Amount of time of inactivity before the monitor is shut off.
104 * @ingroup Ecore_X_DPMS_Group
105 */
106EAPI void
107ecore_x_dpms_timeouts_get(unsigned int *standby,
108 unsigned int *suspend,
109 unsigned int *off)
110{
111#ifdef ECORE_XDPMS
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
114 (unsigned short *)suspend, (unsigned short *)off);
115#endif /* ifdef ECORE_XDPMS */
116}
117
118/**
119 * Sets the timeouts. The values are in unit of seconds.
120 * @param standby Amount of time of inactivity before standby mode will be invoked.
121 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
122 * @param off Amount of time of inactivity before the monitor is shut off.
123 * @ingroup Ecore_X_DPMS_Group
124 */
125EAPI Eina_Bool
126ecore_x_dpms_timeouts_set(unsigned int standby,
127 unsigned int suspend,
128 unsigned int off)
129{
130#ifdef ECORE_XDPMS
131 LOGFN(__FILE__, __LINE__, __FUNCTION__);
132 return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off) ? EINA_TRUE : EINA_FALSE;
133#else /* ifdef ECORE_XDPMS */
134 return EINA_FALSE;
135#endif /* ifdef ECORE_XDPMS */
136}
137
138/**
139 * Returns the amount of time of inactivity before standby mode is invoked.
140 * @return The standby timeout value.
141 * @ingroup Ecore_X_DPMS_Group
142 */
143EAPI unsigned int
144ecore_x_dpms_timeout_standby_get(void)
145{
146#ifdef ECORE_XDPMS
147 unsigned short standby, suspend, off;
148
149 LOGFN(__FILE__, __LINE__, __FUNCTION__);
150 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
151 return standby;
152#else /* ifdef ECORE_XDPMS */
153 return 0;
154#endif /* ifdef ECORE_XDPMS */
155}
156
157/**
158 * Returns the amount of time of inactivity before the second level of
159 * power saving is invoked.
160 * @return The suspend timeout value.
161 * @ingroup Ecore_X_DPMS_Group
162 */
163EAPI unsigned int
164ecore_x_dpms_timeout_suspend_get(void)
165{
166#ifdef ECORE_XDPMS
167 unsigned short standby, suspend, off;
168
169 LOGFN(__FILE__, __LINE__, __FUNCTION__);
170 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
171 return suspend;
172#else /* ifdef ECORE_XDPMS */
173 return 0;
174#endif /* ifdef ECORE_XDPMS */
175}
176
177/**
178 * Returns the amount of time of inactivity before the third and final
179 * level of power saving is invoked.
180 * @return The off timeout value.
181 * @ingroup Ecore_X_DPMS_Group
182 */
183EAPI unsigned int
184ecore_x_dpms_timeout_off_get(void)
185{
186#ifdef ECORE_XDPMS
187 unsigned short standby, suspend, off;
188
189 LOGFN(__FILE__, __LINE__, __FUNCTION__);
190 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
191 return off;
192#else /* ifdef ECORE_XDPMS */
193 return 0;
194#endif /* ifdef ECORE_XDPMS */
195}
196
197/**
198 * Sets the standby timeout (in unit of seconds).
199 * @param new_timeout Amount of time of inactivity before standby mode will be invoked.
200 * @ingroup Ecore_X_DPMS_Group
201 */
202EAPI void
203ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
204{
205#ifdef ECORE_XDPMS
206 unsigned short standby, suspend, off;
207
208 LOGFN(__FILE__, __LINE__, __FUNCTION__);
209 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
210 DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
211#endif /* ifdef ECORE_XDPMS */
212}
213
214/**
215 * Sets the suspend timeout (in unit of seconds).
216 * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode.
217 * @ingroup Ecore_X_DPMS_Group
218 */
219EAPI void
220ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
221{
222#ifdef ECORE_XDPMS
223 unsigned short standby, suspend, off;
224
225 LOGFN(__FILE__, __LINE__, __FUNCTION__);
226 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
227 DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
228#endif /* ifdef ECORE_XDPMS */
229}
230
231/**
232 * Sets the off timeout (in unit of seconds).
233 * @param new_timeout Amount of time of inactivity before the monitor is shut off.
234 * @ingroup Ecore_X_DPMS_Group
235 */
236EAPI void
237ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
238{
239#ifdef ECORE_XDPMS
240 unsigned short standby, suspend, off;
241
242 LOGFN(__FILE__, __LINE__, __FUNCTION__);
243 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
244 DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);
245#endif /* ifdef ECORE_XDPMS */
246}
247
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
deleted file mode 100644
index d1b4111..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c
+++ /dev/null
@@ -1,118 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6
7/**
8 * @defgroup Ecore_X_Drawable_Group X Drawable Functions
9 *
10 * Functions that operate on drawables.
11 */
12
13/**
14 * Retrieves the geometry of the given drawable.
15 * @param d The given drawable.
16 * @param x Pointer to an integer into which the X position is to be stored.
17 * @param y Pointer to an integer into which the Y position is to be stored.
18 * @param w Pointer to an integer into which the width is to be stored.
19 * @param h Pointer to an integer into which the height is to be stored.
20 * @ingroup Ecore_X_Drawable_Group
21 */
22EAPI void
23ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
24 int *x,
25 int *y,
26 int *w,
27 int *h)
28{
29 Window dummy_win;
30 int ret_x, ret_y;
31 unsigned int ret_w, ret_h, dummy_border, dummy_depth;
32
33 LOGFN(__FILE__, __LINE__, __FUNCTION__);
34 if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &ret_x, &ret_y,
35 &ret_w, &ret_h, &dummy_border, &dummy_depth))
36 {
37 ret_x = 0;
38 ret_y = 0;
39 ret_w = 0;
40 ret_h = 0;
41 }
42
43 if (x)
44 *x = ret_x;
45
46 if (y)
47 *y = ret_y;
48
49 if (w)
50 *w = (int)ret_w;
51
52 if (h)
53 *h = (int)ret_h;
54}
55
56/**
57 * Retrieves the width of the border of the given drawable.
58 * @param d The given drawable.
59 * @return The border width of the given drawable.
60 * @ingroup Ecore_X_Drawable_Group
61 */
62EAPI int
63ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
64{
65 Window dummy_win;
66 int dummy_x, dummy_y;
67 unsigned int dummy_w, dummy_h, border_ret, dummy_depth;
68
69 LOGFN(__FILE__, __LINE__, __FUNCTION__);
70 if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
71 &dummy_w, &dummy_h, &border_ret, &dummy_depth))
72 border_ret = 0;
73
74 return (int)border_ret;
75}
76
77/**
78 * Retrieves the depth of the given drawable.
79 * @param d The given drawable.
80 * @return The depth of the given drawable.
81 * @ingroup Ecore_X_Drawable_Group
82 */
83EAPI int
84ecore_x_drawable_depth_get(Ecore_X_Drawable d)
85{
86 Window dummy_win;
87 int dummy_x, dummy_y;
88 unsigned int dummy_w, dummy_h, dummy_border, depth_ret;
89
90 LOGFN(__FILE__, __LINE__, __FUNCTION__);
91 if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
92 &dummy_w, &dummy_h, &dummy_border, &depth_ret))
93 depth_ret = 0;
94
95 return (int)depth_ret;
96}
97
98/**
99 * Fill the specified rectangle on a drawable.
100 * @param d The given drawable.
101 * @param gc The graphic context that controls the fill rules.
102 * @param x The X coordinate of the top-left corner of the rectangle.
103 * @param y The Y coordinate of the top-left corner of the rectangle.
104 * @param width The width of the rectangle.
105 * @param height The height of the rectangle.
106 */
107EAPI void
108ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
109 Ecore_X_GC gc,
110 int x,
111 int y,
112 int width,
113 int height)
114{
115 LOGFN(__FILE__, __LINE__, __FUNCTION__);
116 XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height);
117}
118
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
deleted file mode 100644
index 4bd5218..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
+++ /dev/null
@@ -1,1293 +0,0 @@
1/*
2 * OLD E hints
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif /* ifdef HAVE_CONFIG_H */
8
9#include "Ecore.h"
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12#include "Ecore_X_Atoms.h"
13
14EAPI void
15ecore_x_e_init(void)
16{
17}
18
19EAPI void
20ecore_x_e_frame_size_set(Ecore_X_Window win,
21 int fl,
22 int fr,
23 int ft,
24 int fb)
25{
26 unsigned int frames[4];
27
28 LOGFN(__FILE__, __LINE__, __FUNCTION__);
29 frames[0] = fl;
30 frames[1] = fr;
31 frames[2] = ft;
32 frames[3] = fb;
33 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4);
34}
35
36EAPI void
37ecore_x_e_virtual_keyboard_set(Ecore_X_Window win,
38 unsigned int is_keyboard)
39{
40 LOGFN(__FILE__, __LINE__, __FUNCTION__);
41 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
42 &is_keyboard, 1);
43}
44
45EAPI Eina_Bool
46ecore_x_e_virtual_keyboard_get(Ecore_X_Window win)
47{
48 unsigned int val;
49
50 LOGFN(__FILE__, __LINE__, __FUNCTION__);
51 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
52 &val, 1))
53 return EINA_FALSE;
54
55 return val ? EINA_TRUE : EINA_FALSE;
56}
57
58static Ecore_X_Virtual_Keyboard_State
59_ecore_x_e_vkbd_state_get(Ecore_X_Atom atom)
60{
61 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON)
62 return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON;
63
64 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF)
65 return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF;
66
67 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA)
68 return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA;
69
70 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC)
71 return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC;
72
73 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN)
74 return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN;
75
76 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER)
77 return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER;
78
79 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX)
80 return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX;
81
82 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL)
83 return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL;
84
85 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD)
86 return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD;
87
88 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP)
89 return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP;
90
91 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST)
92 return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST;
93
94 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE)
95 return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE;
96
97 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL)
98 return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL;
99
100 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD)
101 return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD;
102
103 if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME)
104 return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME;
105
106 return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
107}
108
109static Ecore_X_Atom
110_ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state)
111{
112 switch (state)
113 {
114 case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF:
115 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
116
117 case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON:
118 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
119
120 case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA:
121 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
122
123 case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC:
124 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
125
126 case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN:
127 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
128
129 case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER:
130 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
131
132 case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX:
133 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
134
135 case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL:
136 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
137
138 case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD:
139 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
140
141 case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP:
142 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
143
144 case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST:
145 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
146
147 case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE:
148 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
149
150 case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL:
151 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
152
153 case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD:
154 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
155
156 case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME:
157 return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
158
159 default: break;
160 }
161 return 0;
162}
163
164EAPI void
165ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win,
166 Ecore_X_Virtual_Keyboard_State state)
167{
168 Ecore_X_Atom atom = 0;
169
170 LOGFN(__FILE__, __LINE__, __FUNCTION__);
171 atom = _ecore_x_e_vkbd_atom_get(state);
172 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
173 &atom, 1);
174}
175
176EAPI Ecore_X_Virtual_Keyboard_State
177ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win)
178{
179 Ecore_X_Atom atom;
180
181 LOGFN(__FILE__, __LINE__, __FUNCTION__);
182 if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
183 &atom, 1))
184 return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
185
186 return _ecore_x_e_vkbd_state_get(atom);
187}
188
189EAPI void
190ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win,
191 Ecore_X_Virtual_Keyboard_State state)
192{
193 LOGFN(__FILE__, __LINE__, __FUNCTION__);
194 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
195 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
196 _ecore_x_e_vkbd_atom_get(state),
197 0, 0, 0, 0);
198}
199
200static Ecore_X_Atom
201_ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode)
202{
203 switch (mode)
204 {
205 case ECORE_X_ILLUME_MODE_SINGLE:
206 return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE;
207
208 case ECORE_X_ILLUME_MODE_DUAL_TOP:
209 return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP;
210
211 case ECORE_X_ILLUME_MODE_DUAL_LEFT:
212 return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
213
214 default:
215 break;
216 }
217 return ECORE_X_ILLUME_MODE_UNKNOWN;
218}
219
220static Ecore_X_Illume_Mode
221_ecore_x_e_illume_mode_get(Ecore_X_Atom atom)
222{
223 if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
224 return ECORE_X_ILLUME_MODE_SINGLE;
225
226 if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
227 return ECORE_X_ILLUME_MODE_DUAL_TOP;
228
229 if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT)
230 return ECORE_X_ILLUME_MODE_DUAL_LEFT;
231
232 return ECORE_X_ILLUME_MODE_UNKNOWN;
233}
234
235EAPI void
236ecore_x_e_illume_zone_set(Ecore_X_Window win,
237 Ecore_X_Window zone)
238{
239 LOGFN(__FILE__, __LINE__, __FUNCTION__);
240 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE,
241 &zone, 1);
242}
243
244EAPI Ecore_X_Window
245ecore_x_e_illume_zone_get(Ecore_X_Window win)
246{
247 Ecore_X_Window zone;
248
249 LOGFN(__FILE__, __LINE__, __FUNCTION__);
250 if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE,
251 &zone, 1))
252 return 0;
253
254 return zone;
255}
256
257EAPI void
258ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
259 Ecore_X_Window *zones,
260 unsigned int n_zones)
261{
262 LOGFN(__FILE__, __LINE__, __FUNCTION__);
263 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST,
264 zones, n_zones);
265}
266
267EAPI void
268ecore_x_e_illume_conformant_set(Ecore_X_Window win,
269 unsigned int is_conformant)
270{
271 LOGFN(__FILE__, __LINE__, __FUNCTION__);
272 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
273 &is_conformant, 1);
274}
275
276EAPI Eina_Bool
277ecore_x_e_illume_conformant_get(Ecore_X_Window win)
278{
279 unsigned int val = 0;
280
281 LOGFN(__FILE__, __LINE__, __FUNCTION__);
282 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
283 &val, 1))
284 return EINA_FALSE;
285
286 return val ? EINA_TRUE : EINA_FALSE;
287}
288
289EAPI void
290ecore_x_e_illume_mode_set(Ecore_X_Window win,
291 Ecore_X_Illume_Mode mode)
292{
293 Ecore_X_Atom atom = 0;
294
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
296 atom = _ecore_x_e_illume_atom_get(mode);
297 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE,
298 &atom, 1);
299}
300
301EAPI Ecore_X_Illume_Mode
302ecore_x_e_illume_mode_get(Ecore_X_Window win)
303{
304 Ecore_X_Atom atom = 0;
305
306 LOGFN(__FILE__, __LINE__, __FUNCTION__);
307 if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1))
308 return ECORE_X_ILLUME_MODE_UNKNOWN;
309
310 return _ecore_x_e_illume_mode_get(atom);
311}
312
313EAPI void
314ecore_x_e_illume_mode_send(Ecore_X_Window win,
315 Ecore_X_Illume_Mode mode)
316{
317 LOGFN(__FILE__, __LINE__, __FUNCTION__);
318 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE,
319 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
320 _ecore_x_e_illume_atom_get(mode),
321 0, 0, 0, 0);
322}
323
324EAPI void
325ecore_x_e_illume_focus_back_send(Ecore_X_Window win)
326{
327 LOGFN(__FILE__, __LINE__, __FUNCTION__);
328 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK,
329 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
330 1, 0, 0, 0, 0);
331}
332
333EAPI void
334ecore_x_e_illume_focus_forward_send(Ecore_X_Window win)
335{
336 LOGFN(__FILE__, __LINE__, __FUNCTION__);
337 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD,
338 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
339 1, 0, 0, 0, 0);
340}
341
342EAPI void
343ecore_x_e_illume_focus_home_send(Ecore_X_Window win)
344{
345 LOGFN(__FILE__, __LINE__, __FUNCTION__);
346 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME,
347 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
348 1, 0, 0, 0, 0);
349}
350
351EAPI void
352ecore_x_e_illume_close_send(Ecore_X_Window win)
353{
354 LOGFN(__FILE__, __LINE__, __FUNCTION__);
355 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE,
356 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
357 1, 0, 0, 0, 0);
358}
359
360EAPI void
361ecore_x_e_illume_home_new_send(Ecore_X_Window win)
362{
363 LOGFN(__FILE__, __LINE__, __FUNCTION__);
364 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW,
365 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
366 1, 0, 0, 0, 0);
367}
368
369EAPI void
370ecore_x_e_illume_home_del_send(Ecore_X_Window win)
371{
372 LOGFN(__FILE__, __LINE__, __FUNCTION__);
373 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL,
374 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
375 1, 0, 0, 0, 0);
376}
377
378EAPI void
379ecore_x_e_illume_drag_set(Ecore_X_Window win,
380 unsigned int drag)
381{
382 LOGFN(__FILE__, __LINE__, __FUNCTION__);
383 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1);
384}
385
386EAPI Eina_Bool
387ecore_x_e_illume_drag_get(Ecore_X_Window win)
388{
389 unsigned int val = 0;
390
391 LOGFN(__FILE__, __LINE__, __FUNCTION__);
392 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG, &val, 1))
393 return EINA_FALSE;
394
395 return val ? EINA_TRUE : EINA_FALSE;
396}
397
398EAPI void
399ecore_x_e_illume_drag_locked_set(Ecore_X_Window win,
400 unsigned int is_locked)
401{
402 LOGFN(__FILE__, __LINE__, __FUNCTION__);
403 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
404 &is_locked, 1);
405}
406
407EAPI Eina_Bool
408ecore_x_e_illume_drag_locked_get(Ecore_X_Window win)
409{
410 unsigned int val = 0;
411
412 LOGFN(__FILE__, __LINE__, __FUNCTION__);
413 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
414 &val, 1))
415 return EINA_FALSE;
416
417 return val ? EINA_TRUE : EINA_FALSE;
418}
419
420EAPI void
421ecore_x_e_illume_drag_start_send(Ecore_X_Window win)
422{
423 LOGFN(__FILE__, __LINE__, __FUNCTION__);
424 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START,
425 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
426 1, 0, 0, 0, 0);
427}
428
429EAPI void
430ecore_x_e_illume_drag_end_send(Ecore_X_Window win)
431{
432 LOGFN(__FILE__, __LINE__, __FUNCTION__);
433 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END,
434 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
435 1, 0, 0, 0, 0);
436}
437
438EAPI void
439ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win,
440 int x,
441 int y,
442 int w,
443 int h)
444{
445 unsigned int geom[4];
446
447 LOGFN(__FILE__, __LINE__, __FUNCTION__);
448 geom[0] = x;
449 geom[1] = y;
450 geom[2] = w;
451 geom[3] = h;
452 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
453 geom, 4);
454}
455
456EAPI Eina_Bool
457ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win,
458 int *x,
459 int *y,
460 int *w,
461 int *h)
462{
463 int ret = 0;
464 unsigned int geom[4];
465
466 LOGFN(__FILE__, __LINE__, __FUNCTION__);
467 ret =
468 ecore_x_window_prop_card32_get(win,
469 ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
470 geom, 4);
471 if (ret != 4)
472 return EINA_FALSE;
473
474 if (x)
475 *x = geom[0];
476
477 if (y)
478 *y = geom[1];
479
480 if (w)
481 *w = geom[2];
482
483 if (h)
484 *h = geom[3];
485
486 return EINA_TRUE;
487}
488
489EAPI void
490ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win,
491 int x,
492 int y,
493 int w,
494 int h)
495{
496 unsigned int geom[4];
497
498 LOGFN(__FILE__, __LINE__, __FUNCTION__);
499 geom[0] = x;
500 geom[1] = y;
501 geom[2] = w;
502 geom[3] = h;
503 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
504 geom, 4);
505}
506
507EAPI Eina_Bool
508ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win,
509 int *x,
510 int *y,
511 int *w,
512 int *h)
513{
514 int ret = 0;
515 unsigned int geom[4];
516
517 LOGFN(__FILE__, __LINE__, __FUNCTION__);
518 ret =
519 ecore_x_window_prop_card32_get(win,
520 ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
521 geom, 4);
522 if (ret != 4)
523 return EINA_FALSE;
524
525 if (x)
526 *x = geom[0];
527
528 if (y)
529 *y = geom[1];
530
531 if (w)
532 *w = geom[2];
533
534 if (h)
535 *h = geom[3];
536
537 return EINA_TRUE;
538}
539
540EAPI void
541ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win,
542 int x,
543 int y,
544 int w,
545 int h)
546{
547 unsigned int geom[4];
548
549 LOGFN(__FILE__, __LINE__, __FUNCTION__);
550 geom[0] = x;
551 geom[1] = y;
552 geom[2] = w;
553 geom[3] = h;
554 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
555 geom, 4);
556}
557
558EAPI Eina_Bool
559ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win,
560 int *x,
561 int *y,
562 int *w,
563 int *h)
564{
565 int ret = 0;
566 unsigned int geom[4];
567
568 LOGFN(__FILE__, __LINE__, __FUNCTION__);
569 ret =
570 ecore_x_window_prop_card32_get(win,
571 ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
572 geom, 4);
573 if (ret != 4)
574 return EINA_FALSE;
575
576 if (x)
577 *x = geom[0];
578
579 if (y)
580 *y = geom[1];
581
582 if (w)
583 *w = geom[2];
584
585 if (h)
586 *h = geom[3];
587
588 return EINA_TRUE;
589}
590
591static Ecore_X_Atom
592_ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state)
593{
594 switch (state)
595 {
596 case ECORE_X_ILLUME_QUICKPANEL_STATE_ON:
597 return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
598
599 case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF:
600 return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
601
602 default:
603 break;
604 }
605 return 0;
606}
607
608static Ecore_X_Illume_Quickpanel_State
609_ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom)
610{
611 if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
612 return ECORE_X_ILLUME_QUICKPANEL_STATE_ON;
613
614 if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
615 return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF;
616
617 return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
618}
619
620EAPI void
621ecore_x_e_illume_quickpanel_set(Ecore_X_Window win,
622 unsigned int is_quickpanel)
623{
624 LOGFN(__FILE__, __LINE__, __FUNCTION__);
625 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
626 &is_quickpanel, 1);
627}
628
629EAPI Eina_Bool
630ecore_x_e_illume_quickpanel_get(Ecore_X_Window win)
631{
632 unsigned int val = 0;
633
634 LOGFN(__FILE__, __LINE__, __FUNCTION__);
635 if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
636 &val, 1))
637 return EINA_FALSE;
638
639 return val ? EINA_TRUE : EINA_FALSE;
640}
641
642EAPI void
643ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win,
644 Ecore_X_Illume_Quickpanel_State state)
645{
646 Ecore_X_Atom atom = 0;
647
648 LOGFN(__FILE__, __LINE__, __FUNCTION__);
649 atom = _ecore_x_e_quickpanel_atom_get(state);
650 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
651 &atom, 1);
652}
653
654EAPI Ecore_X_Illume_Quickpanel_State
655ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win)
656{
657 Ecore_X_Atom atom;
658
659 LOGFN(__FILE__, __LINE__, __FUNCTION__);
660 if (!ecore_x_window_prop_atom_get(win,
661 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
662 &atom, 1))
663 return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
664
665 return _ecore_x_e_quickpanel_state_get(atom);
666}
667
668EAPI void
669ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win,
670 Ecore_X_Illume_Quickpanel_State state)
671{
672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
673 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
674 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
675 _ecore_x_e_quickpanel_atom_get(state),
676 0, 0, 0, 0);
677}
678
679EAPI void
680ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win)
681{
682 LOGFN(__FILE__, __LINE__, __FUNCTION__);
683 ecore_x_client_message32_send(win,
684 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE,
685 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
686 0, 0, 0, 0, 0);
687}
688
689EAPI void
690ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win,
691 unsigned int priority)
692{
693 LOGFN(__FILE__, __LINE__, __FUNCTION__);
694 ecore_x_window_prop_card32_set(win,
695 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
696 &priority, 1);
697}
698
699EAPI int
700ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win)
701{
702 unsigned int val = 0;
703
704 LOGFN(__FILE__, __LINE__, __FUNCTION__);
705 if (!ecore_x_window_prop_card32_get(win,
706 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
707 &val, 1))
708 return 0;
709
710 return val;
711}
712
713EAPI void
714ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win,
715 unsigned int priority)
716{
717 LOGFN(__FILE__, __LINE__, __FUNCTION__);
718 ecore_x_window_prop_card32_set(win,
719 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
720 &priority, 1);
721}
722
723EAPI int
724ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win)
725{
726 unsigned int val = 0;
727
728 LOGFN(__FILE__, __LINE__, __FUNCTION__);
729 if (!ecore_x_window_prop_card32_get(win,
730 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
731 &val, 1))
732 return 0;
733
734 return val;
735}
736
737EAPI void
738ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win,
739 unsigned int zone)
740{
741 LOGFN(__FILE__, __LINE__, __FUNCTION__);
742 ecore_x_window_prop_card32_set(win,
743 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
744 &zone, 1);
745}
746
747EAPI int
748ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win)
749{
750 unsigned int val = 0;
751
752 LOGFN(__FILE__, __LINE__, __FUNCTION__);
753 if (!ecore_x_window_prop_card32_get(win,
754 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
755 &val, 1))
756 return 0;
757
758 return val;
759}
760
761EAPI void
762ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win)
763{
764 LOGFN(__FILE__, __LINE__, __FUNCTION__);
765 ecore_x_client_message32_send(win,
766 ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE,
767 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
768 1, 0, 0, 0, 0);
769}
770
771static Ecore_X_Atom
772_ecore_x_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state)
773{
774 switch (state)
775 {
776 case ECORE_X_ILLUME_CLIPBOARD_STATE_ON:
777 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
778 case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF:
779 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
780 default:
781 break;
782 }
783 return 0;
784}
785
786static Ecore_X_Illume_Clipboard_State
787_ecore_x_e_clipboard_state_get(Ecore_X_Atom atom)
788{
789 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON)
790 return ECORE_X_ILLUME_CLIPBOARD_STATE_ON;
791
792 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF)
793 return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF;
794
795 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
796}
797
798EAPI void
799ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
800 Ecore_X_Illume_Clipboard_State state)
801{
802 Ecore_X_Atom atom = 0;
803
804 LOGFN(__FILE__, __LINE__, __FUNCTION__);
805 atom = _ecore_x_e_clipboard_atom_get(state);
806
807 ecore_x_window_prop_atom_set(win,
808 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
809 &atom, 1);
810}
811
812EAPI Ecore_X_Illume_Clipboard_State
813ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win)
814{
815 Ecore_X_Atom atom = 0;
816
817 LOGFN(__FILE__, __LINE__, __FUNCTION__);
818
819 if (!ecore_x_window_prop_atom_get(win,
820 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
821 &atom, 1))
822 return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN;
823 return _ecore_x_e_clipboard_state_get(atom);
824}
825
826EAPI void
827ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
828 int x, int y, int w, int h)
829{
830 unsigned int geom[4];
831
832 LOGFN(__FILE__, __LINE__, __FUNCTION__);
833 geom[0] = x;
834 geom[1] = y;
835 geom[2] = w;
836 geom[3] = h;
837 ecore_x_window_prop_card32_set(win,
838 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
839 geom, 4);
840}
841
842EAPI Eina_Bool
843ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
844 int *x, int *y, int *w, int *h)
845{
846 int ret = 0;
847 unsigned int geom[4];
848
849 LOGFN(__FILE__, __LINE__, __FUNCTION__);
850 ret =
851 ecore_x_window_prop_card32_get(win,
852 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
853 geom, 4);
854 if (ret != 4) return EINA_FALSE;
855
856 if (x) *x = geom[0];
857 if (y) *y = geom[1];
858 if (w) *w = geom[2];
859 if (h) *h = geom[3];
860
861 return EINA_TRUE;
862}
863
864EAPI void
865ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
866 Ecore_X_Sync_Counter counter)
867{
868 LOGFN(__FILE__, __LINE__, __FUNCTION__);
869 if (counter)
870 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
871 ECORE_X_ATOM_CARDINAL, &counter, 1);
872 else
873 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER);
874}
875
876EAPI Ecore_X_Sync_Counter
877ecore_x_e_comp_sync_counter_get(Ecore_X_Window win)
878{
879 int ret = 0;
880 Ecore_X_Sync_Counter counter = 0;
881
882 LOGFN(__FILE__, __LINE__, __FUNCTION__);
883 ret =
884 ecore_x_window_prop_xid_get(win,
885 ECORE_X_ATOM_E_COMP_SYNC_COUNTER,
886 ECORE_X_ATOM_CARDINAL,
887 &counter, 1);
888 if (ret != 1)
889 return 0;
890
891 return counter;
892}
893
894EAPI void
895ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
896 Ecore_X_Window win)
897{
898 XEvent xev;
899
900 LOGFN(__FILE__, __LINE__, __FUNCTION__);
901 if (!root)
902 root = DefaultRootWindow(_ecore_x_disp);
903
904 xev.xclient.type = ClientMessage;
905 xev.xclient.display = _ecore_x_disp;
906 xev.xclient.window = win;
907 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
908 xev.xclient.format = 32;
909 xev.xclient.data.l[0] = win;
910 xev.xclient.data.l[1] = 0; // version
911 xev.xclient.data.l[2] = 0; // later
912 xev.xclient.data.l[3] = 0; // later
913 xev.xclient.data.l[4] = 0; // later
914
915 XSendEvent(_ecore_x_disp, root, False,
916 SubstructureRedirectMask | SubstructureNotifyMask,
917 &xev);
918}
919
920EAPI void
921ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
922 Ecore_X_Window win,
923 int w,
924 int h)
925{
926 XEvent xev;
927
928 LOGFN(__FILE__, __LINE__, __FUNCTION__);
929 if (!root)
930 root = DefaultRootWindow(_ecore_x_disp);
931
932 xev.xclient.type = ClientMessage;
933 xev.xclient.display = _ecore_x_disp;
934 xev.xclient.window = win;
935 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
936 xev.xclient.format = 32;
937 xev.xclient.data.l[0] = win;
938 xev.xclient.data.l[1] = 1; // version
939 xev.xclient.data.l[2] = w; // win width at draw time
940 xev.xclient.data.l[3] = h; // win height at draw time
941 xev.xclient.data.l[4] = 0; // later
942
943 XSendEvent(_ecore_x_disp, root, False,
944 SubstructureRedirectMask | SubstructureNotifyMask,
945 &xev);
946}
947
948EAPI void
949ecore_x_e_comp_sync_supported_set(Ecore_X_Window root,
950 Eina_Bool enabled)
951{
952 Ecore_X_Window win;
953
954 if (!root)
955 root = DefaultRootWindow(_ecore_x_disp);
956
957 LOGFN(__FILE__, __LINE__, __FUNCTION__);
958 if (enabled)
959 {
960 win = ecore_x_window_new(root, 1, 2, 3, 4);
961 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
962 ECORE_X_ATOM_WINDOW, &win, 1);
963 ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
964 ECORE_X_ATOM_WINDOW, &win, 1);
965 }
966 else
967 {
968 int ret;
969
970 ret =
971 ecore_x_window_prop_xid_get(root,
972 ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
973 ECORE_X_ATOM_WINDOW,
974 &win, 1);
975 if ((ret == 1) && (win))
976 {
977 ecore_x_window_prop_property_del(
978 root,
979 ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED);
980 ecore_x_window_free(win);
981 }
982 }
983}
984
985EAPI Eina_Bool
986ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
987{
988 Ecore_X_Window win, win2;
989 int ret;
990
991 LOGFN(__FILE__, __LINE__, __FUNCTION__);
992 if (!root)
993 root = DefaultRootWindow(_ecore_x_disp);
994
995 ret =
996 ecore_x_window_prop_xid_get(root,
997 ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
998 ECORE_X_ATOM_WINDOW,
999 &win, 1);
1000 if ((ret == 1) && (win))
1001 {
1002 ret =
1003 ecore_x_window_prop_xid_get(win,
1004 ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED,
1005 ECORE_X_ATOM_WINDOW,
1006 &win2, 1);
1007 if ((ret == 1) && (win2 == win))
1008 return EINA_TRUE;
1009 }
1010
1011 return EINA_FALSE;
1012}
1013
1014EAPI void
1015ecore_x_e_comp_sync_begin_send(Ecore_X_Window win)
1016{
1017 XEvent xev;
1018
1019 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1020 xev.xclient.type = ClientMessage;
1021 xev.xclient.display = _ecore_x_disp;
1022 xev.xclient.window = win;
1023 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_BEGIN;
1024 xev.xclient.format = 32;
1025 xev.xclient.data.l[0] = win;
1026 xev.xclient.data.l[1] = 0; // later
1027 xev.xclient.data.l[2] = 0; // later
1028 xev.xclient.data.l[3] = 0; // later
1029 xev.xclient.data.l[4] = 0; // later
1030
1031 XSendEvent(_ecore_x_disp, win, False,
1032 NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
1033 &xev);
1034}
1035
1036EAPI void
1037ecore_x_e_comp_sync_end_send(Ecore_X_Window win)
1038{
1039 XEvent xev;
1040
1041 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1042 xev.xclient.type = ClientMessage;
1043 xev.xclient.display = _ecore_x_disp;
1044 xev.xclient.window = win;
1045 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_END;
1046 xev.xclient.format = 32;
1047 xev.xclient.data.l[0] = win;
1048 xev.xclient.data.l[1] = 0; // later
1049 xev.xclient.data.l[2] = 0; // later
1050 xev.xclient.data.l[3] = 0; // later
1051 xev.xclient.data.l[4] = 0; // later
1052
1053 XSendEvent(_ecore_x_disp, win, False,
1054 NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
1055 &xev);
1056}
1057
1058EAPI void
1059ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win)
1060{
1061 XEvent xev;
1062
1063 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1064 xev.xclient.type = ClientMessage;
1065 xev.xclient.display = _ecore_x_disp;
1066 xev.xclient.window = win;
1067 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_CANCEL;
1068 xev.xclient.format = 32;
1069 xev.xclient.data.l[0] = win;
1070 xev.xclient.data.l[1] = 0; // later
1071 xev.xclient.data.l[2] = 0; // later
1072 xev.xclient.data.l[3] = 0; // later
1073 xev.xclient.data.l[4] = 0; // later
1074
1075 XSendEvent(_ecore_x_disp, win, False,
1076 NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
1077 &xev);
1078}
1079
1080EAPI void
1081ecore_x_e_comp_flush_send(Ecore_X_Window win)
1082{
1083 XEvent xev;
1084
1085 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1086 xev.xclient.type = ClientMessage;
1087 xev.xclient.display = _ecore_x_disp;
1088 xev.xclient.window = win;
1089 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_FLUSH;
1090 xev.xclient.format = 32;
1091 xev.xclient.data.l[0] = win;
1092 xev.xclient.data.l[1] = 0; // later
1093 xev.xclient.data.l[2] = 0; // later
1094 xev.xclient.data.l[3] = 0; // later
1095 xev.xclient.data.l[4] = 0; // later
1096
1097 XSendEvent(_ecore_x_disp, win, False,
1098 NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
1099 &xev);
1100}
1101
1102EAPI void
1103ecore_x_e_comp_dump_send(Ecore_X_Window win)
1104{
1105 XEvent xev;
1106
1107 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1108 xev.xclient.type = ClientMessage;
1109 xev.xclient.display = _ecore_x_disp;
1110 xev.xclient.window = win;
1111 xev.xclient.message_type = ECORE_X_ATOM_E_COMP_DUMP;
1112 xev.xclient.format = 32;
1113 xev.xclient.data.l[0] = win;
1114 xev.xclient.data.l[1] = 0; // later
1115 xev.xclient.data.l[2] = 0; // later
1116 xev.xclient.data.l[3] = 0; // later
1117 xev.xclient.data.l[4] = 0; // later
1118
1119 XSendEvent(_ecore_x_disp, win, False,
1120 NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
1121 &xev);
1122}
1123
1124EAPI void
1125ecore_x_e_comp_pixmap_set(Ecore_X_Window win,
1126 Ecore_X_Pixmap pixmap)
1127{
1128 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1129 if (pixmap)
1130 ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP,
1131 ECORE_X_ATOM_PIXMAP, &pixmap, 1);
1132 else
1133 ecore_x_window_prop_property_del(win, pixmap);
1134}
1135
1136EAPI Ecore_X_Pixmap
1137ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
1138{
1139 int ret = 0;
1140 Ecore_X_Pixmap pixmap = 0;
1141
1142 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1143 ret =
1144 ecore_x_window_prop_xid_get(win,
1145 ECORE_X_ATOM_E_COMP_PIXMAP,
1146 ECORE_X_ATOM_PIXMAP,
1147 &pixmap, 1);
1148 if (ret != 1)
1149 return 0;
1150
1151 return pixmap;
1152}
1153
1154static Ecore_X_Atom
1155_ecore_x_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state)
1156{
1157 switch (state)
1158 {
1159 case ECORE_X_ILLUME_INDICATOR_STATE_ON:
1160 return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
1161
1162 case ECORE_X_ILLUME_INDICATOR_STATE_OFF:
1163 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
1164
1165 default:
1166 break;
1167 }
1168 return 0;
1169}
1170
1171static Ecore_X_Illume_Indicator_State
1172_ecore_x_e_indicator_state_get(Ecore_X_Atom atom)
1173{
1174 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON)
1175 return ECORE_X_ILLUME_INDICATOR_STATE_ON;
1176
1177 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF)
1178 return ECORE_X_ILLUME_INDICATOR_STATE_OFF;
1179
1180 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1181}
1182
1183EAPI void
1184ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
1185 Ecore_X_Illume_Indicator_State state)
1186{
1187 Ecore_X_Atom atom = 0;
1188
1189 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1190 atom = _ecore_x_e_indicator_atom_get(state);
1191 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1192 &atom, 1);
1193}
1194
1195EAPI Ecore_X_Illume_Indicator_State
1196ecore_x_e_illume_indicator_state_get(Ecore_X_Window win)
1197{
1198 Ecore_X_Atom atom;
1199
1200 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1201 if (!ecore_x_window_prop_atom_get(win,
1202 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1203 &atom, 1))
1204 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1205
1206 return _ecore_x_e_indicator_state_get(atom);
1207}
1208
1209EAPI void
1210ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
1211 Ecore_X_Illume_Indicator_State state)
1212{
1213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1214 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1215 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1216 _ecore_x_e_indicator_atom_get(state),
1217 0, 0, 0, 0);
1218}
1219
1220static Ecore_X_Atom
1221_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode)
1222{
1223 switch (mode)
1224 {
1225 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1226 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
1227
1228 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1229 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
1230
1231 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1232 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
1233
1234 default:
1235 break;
1236 }
1237 return 0;
1238}
1239
1240static Ecore_X_Illume_Indicator_Opacity_Mode
1241_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom)
1242{
1243 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE)
1244 return ECORE_X_ILLUME_INDICATOR_OPAQUE;
1245
1246 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT)
1247 return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1248
1249 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT)
1250 return ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1251
1252 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1253}
1254
1255EAPI void
1256ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
1257 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1258{
1259 Ecore_X_Atom atom = 0;
1260
1261 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1262 atom = _ecore_x_e_indicator_opacity_atom_get(mode);
1263 ecore_x_window_prop_atom_set(win,
1264 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1265 &atom, 1);
1266}
1267
1268EAPI Ecore_X_Illume_Indicator_Opacity_Mode
1269ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win)
1270{
1271 Ecore_X_Atom atom;
1272
1273 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1274 if (!ecore_x_window_prop_atom_get(win,
1275 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1276 &atom, 1))
1277 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1278
1279 return _ecore_x_e_indicator_opacity_get(atom);
1280}
1281
1282EAPI void
1283ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
1284 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1285{
1286 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1287 ecore_x_client_message32_send(win,
1288 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1289 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1290 _ecore_x_e_indicator_opacity_atom_get(mode),
1291 0, 0, 0, 0);
1292}
1293
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
deleted file mode 100644
index 11e9f20..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_private.h"
9#include "ecore_x_private.h"
10#include "Ecore_X.h"
11
12static int _ecore_x_error_handle(Display *d,
13 XErrorEvent *ev);
14static int _ecore_x_io_error_handle(Display *d);
15
16static void (*_error_func)(void *data) = NULL;
17static void *_error_data = NULL;
18static void (*_io_error_func)(void *data) = NULL;
19static void *_io_error_data = NULL;
20static int _error_request_code = 0;
21static int _error_code = 0;
22static Ecore_X_ID _error_resource_id = 0;
23
24/**
25 * Set the error handler.
26 * @param func The error handler function
27 * @param data The data to be passed to the handler function
28 *
29 * Set the X error handler function
30 */
31EAPI void
32ecore_x_error_handler_set(void (*func)(void *data),
33 const void *data)
34{
35 _error_func = func;
36 _error_data = (void *)data;
37}
38
39/**
40 * Set the I/O error handler.
41 * @param func The I/O error handler function
42 * @param data The data to be passed to the handler function
43 *
44 * Set the X I/O error handler function
45 */
46EAPI void
47ecore_x_io_error_handler_set(void (*func)(void *data),
48 const void *data)
49{
50 _io_error_func = func;
51 _io_error_data = (void *)data;
52}
53
54/**
55 * Get the request code that caused the error.
56 * @return The request code causing the X error
57 *
58 * Return the X request code that caused the last X error
59 */
60EAPI int
61ecore_x_error_request_get(void)
62{
63 return _error_request_code;
64}
65
66/**
67 * Get the error code from the error.
68 * @return The error code from the X error
69 *
70 * Return the error code from the last X error
71 */
72EAPI int
73ecore_x_error_code_get(void)
74{
75 return _error_code;
76}
77
78/**
79 * Get the resource id that caused the error.
80 * @return The resource id causing the X error
81 *
82 * Return the X resource id that caused the last X error
83 */
84EAPI Ecore_X_ID
85ecore_x_error_resource_id_get(void)
86{
87 return _error_resource_id;
88}
89
90void
91_ecore_x_error_handler_init(void)
92{
93 XSetErrorHandler((XErrorHandler)_ecore_x_error_handle);
94 XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle);
95}
96
97static int
98_ecore_x_error_handle(Display *d,
99 XErrorEvent *ev)
100{
101 if (d == _ecore_x_disp)
102 {
103 _error_request_code = ev->request_code;
104 _error_code = ev->error_code;
105 _error_resource_id = ev->resourceid;
106 if (_error_func)
107 _error_func(_error_data);
108 }
109 return 0;
110}
111
112static int
113_ecore_x_io_error_handle(Display *d)
114{
115 if (d == _ecore_x_disp)
116 {
117 if (_io_error_func)
118 _io_error_func(_io_error_data);
119 else
120 exit(-1);
121 }
122
123 return 0;
124}
125
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
deleted file mode 100644
index 0b06a79..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c
+++ /dev/null
@@ -1,2487 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <string.h>
8
9#include <langinfo.h>
10
11#include "Ecore.h"
12#include "ecore_private.h"
13#include "ecore_x_private.h"
14#include "Ecore_X.h"
15#include "Ecore_X_Atoms.h"
16
17/** OpenBSD does not define CODESET
18 * FIXME ??
19 */
20
21#ifndef CODESET
22#define CODESET "INVALID"
23#endif /* ifndef CODESET */
24
25typedef struct _Ecore_X_Mouse_Down_Info
26{
27 EINA_INLIST;
28 int dev;
29 Window last_win;
30 Window last_last_win;
31 Window last_event_win;
32 Window last_last_event_win;
33 Time last_time;
34 Time last_last_time;
35 Eina_Bool did_double : 1;
36 Eina_Bool did_triple : 1;
37} Ecore_X_Mouse_Down_Info;
38
39static int _ecore_x_last_event_mouse_move = 0;
40static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
41static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL;
42
43static void
44_ecore_x_mouse_down_info_clear(void)
45{
46 Eina_Inlist *l = _ecore_x_mouse_down_info_list;
47 Ecore_X_Mouse_Down_Info *info = NULL;
48 while (l)
49 {
50 info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info);
51 l = eina_inlist_remove(l, l);
52 free(info);
53 }
54 _ecore_x_mouse_down_info_list = NULL;
55}
56
57void
58_ecore_x_events_init(void)
59{
60 //Actually, Nothing to do.
61}
62
63void
64_ecore_x_events_shutdown(void)
65{
66 _ecore_x_mouse_down_info_clear();
67}
68
69static Ecore_X_Mouse_Down_Info *
70_ecore_x_mouse_down_info_get(int dev)
71{
72 Eina_Inlist *l = _ecore_x_mouse_down_info_list;
73 Ecore_X_Mouse_Down_Info *info = NULL;
74
75 //Return the exist info
76 EINA_INLIST_FOREACH(l, info)
77 if (info->dev == dev) return info;
78
79 //New Device. Add it.
80 info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info));
81 if (!info) return NULL;
82
83 info->dev = dev;
84 l = eina_inlist_append(l, (Eina_Inlist *)info);
85 _ecore_x_mouse_down_info_list = l;
86 return info;
87}
88
89static void
90_ecore_x_event_free_mouse_move(void *data __UNUSED__,
91 void *ev)
92{
93 Ecore_Event_Mouse_Move *e;
94
95 e = ev;
96 if (_ecore_x_last_event_mouse_move)
97 {
98 _ecore_x_last_event_mouse_move_event = NULL;
99 _ecore_x_last_event_mouse_move = 0;
100 }
101
102 free(e);
103}
104
105EAPI void
106ecore_x_event_mask_set(Ecore_X_Window w,
107 Ecore_X_Event_Mask mask)
108{
109 XWindowAttributes attr;
110 XSetWindowAttributes s_attr;
111
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 if (!w)
114 w = DefaultRootWindow(_ecore_x_disp);
115
116 memset(&attr, 0, sizeof(XWindowAttributes));
117 XGetWindowAttributes(_ecore_x_disp, w, &attr);
118 s_attr.event_mask = mask | attr.your_event_mask;
119 XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
120}
121
122EAPI void
123ecore_x_event_mask_unset(Ecore_X_Window w,
124 Ecore_X_Event_Mask mask)
125{
126 XWindowAttributes attr;
127 XSetWindowAttributes s_attr;
128
129 LOGFN(__FILE__, __LINE__, __FUNCTION__);
130 if (!w)
131 w = DefaultRootWindow(_ecore_x_disp);
132
133 memset(&attr, 0, sizeof(XWindowAttributes));
134 XGetWindowAttributes(_ecore_x_disp, w, &attr);
135 s_attr.event_mask = attr.your_event_mask & ~mask;
136 XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
137}
138
139static void
140_ecore_x_event_free_xdnd_enter(void *data __UNUSED__,
141 void *ev)
142{
143 Ecore_X_Event_Xdnd_Enter *e;
144 int i;
145
146 e = ev;
147 for (i = 0; i < e->num_types; i++)
148 XFree(e->types[i]);
149 free(e->types);
150 free(e);
151}
152
153static void
154_ecore_x_event_free_selection_notify(void *data __UNUSED__,
155 void *ev)
156{
157 Ecore_X_Event_Selection_Notify *e;
158 Ecore_X_Selection_Data *sel;
159
160 e = ev;
161 sel = e->data;
162 if (sel->free)
163 sel->free(sel);
164
165 free(e->target);
166 free(e);
167}
168
169static unsigned int
170_ecore_x_event_modifiers(unsigned int state)
171{
172 unsigned int modifiers = 0;
173
174 if (state & ECORE_X_MODIFIER_SHIFT)
175 modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
176
177 if (state & ECORE_X_MODIFIER_CTRL)
178 modifiers |= ECORE_EVENT_MODIFIER_CTRL;
179
180 if (state & ECORE_X_MODIFIER_ALT)
181 modifiers |= ECORE_EVENT_MODIFIER_ALT;
182
183 if (state & ECORE_X_MODIFIER_WIN)
184 modifiers |= ECORE_EVENT_MODIFIER_WIN;
185
186 if (state & ECORE_X_LOCK_SCROLL)
187 modifiers |= ECORE_EVENT_LOCK_SCROLL;
188
189 if (state & ECORE_X_LOCK_NUM)
190 modifiers |= ECORE_EVENT_LOCK_NUM;
191
192 if (state & ECORE_X_LOCK_CAPS)
193 modifiers |= ECORE_EVENT_LOCK_CAPS;
194
195 if (state & ECORE_X_LOCK_SHIFT)
196 modifiers |= ECORE_EVENT_LOCK_SHIFT;
197
198 return modifiers;
199}
200
201void
202_ecore_mouse_move(unsigned int timestamp,
203 unsigned int xmodifiers,
204 int x,
205 int y,
206 int x_root,
207 int y_root,
208 unsigned int event_window,
209 unsigned int window,
210 unsigned int root_win,
211 int same_screen,
212 int dev,
213 double radx,
214 double rady,
215 double pressure,
216 double angle,
217 double mx,
218 double my,
219 double mrx,
220 double mry)
221{
222 Ecore_Event_Mouse_Move *e;
223 Ecore_Event *event;
224
225 e = malloc(sizeof(Ecore_Event_Mouse_Move));
226 if (!e)
227 return;
228
229 e->window = window;
230 e->root_window = root_win;
231 e->timestamp = timestamp;
232 e->same_screen = same_screen;
233 e->event_window = event_window;
234
235 e->modifiers = _ecore_x_event_modifiers(xmodifiers);
236 e->x = x;
237 e->y = y;
238 e->root.x = x_root;
239 e->root.y = y_root;
240
241 e->multi.device = dev;
242 e->multi.radius = (radx + rady) / 2;
243 e->multi.radius_x = radx;
244 e->multi.radius_y = rady;
245 e->multi.pressure = pressure;
246 e->multi.angle = angle;
247 e->multi.x = mx;
248 e->multi.y = my;
249 e->multi.root.x = mrx;
250 e->multi.root.y = mry;
251
252 event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE,
253 e,
254 _ecore_x_event_free_mouse_move,
255 NULL);
256
257 _ecore_x_event_last_time = timestamp;
258 _ecore_x_event_last_win = window;
259 _ecore_x_event_last_root_x = x_root;
260 _ecore_x_event_last_root_y = y_root;
261
262 _ecore_x_last_event_mouse_move_event = event;
263}
264
265static void
266_ecore_key_press(int event,
267 XKeyEvent *xevent)
268{
269 Ecore_Event_Key *e;
270 char *compose = NULL;
271 char *tmp = NULL;
272 char *keyname;
273 char *key;
274 char keyname_buffer[256];
275 char compose_buffer[256];
276 KeySym sym;
277 XComposeStatus status;
278 int val;
279
280 _ecore_x_last_event_mouse_move = 0;
281 keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
282 xevent->keycode, 0));
283 if (!keyname)
284 {
285 snprintf(keyname_buffer,
286 sizeof(keyname_buffer),
287 "Keycode-%i",
288 xevent->keycode);
289 keyname = keyname_buffer;
290 }
291
292 sym = 0;
293 key = NULL;
294 compose = NULL;
295 val = XLookupString(xevent,
296 compose_buffer,
297 sizeof(compose_buffer),
298 &sym,
299 &status);
300 if (val > 0)
301 {
302 compose_buffer[val] = 0;
303 compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8",
304 compose_buffer);
305 if (!compose)
306 ERR("Ecore_X cannot convert input key string '%s' to UTF-8. "
307 "Is Eina built with iconv support?", compose_buffer);
308 tmp = compose;
309 }
310
311 key = XKeysymToString(sym);
312 if (!key)
313 key = keyname;
314
315 e =
316 malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
317 (compose ? strlen(compose) : 0) + 3);
318 if (!e)
319 goto on_error;
320
321 e->keyname = (char *)(e + 1);
322 e->key = e->keyname + strlen(keyname) + 1;
323 e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
324 e->string = e->compose;
325
326 strcpy((char *)e->keyname, keyname);
327 strcpy((char *)e->key, key);
328 if (compose)
329 strcpy((char *)e->compose, compose);
330
331 e->modifiers = _ecore_x_event_modifiers(xevent->state);
332
333 e->timestamp = xevent->time;
334 e->window = xevent->subwindow ? xevent->subwindow : xevent->window;
335 e->event_window = xevent->window;
336 e->same_screen = xevent->same_screen;
337 e->root_window = xevent->root;
338
339 ecore_event_add(event, e, NULL, NULL);
340
341 _ecore_x_event_last_time = e->timestamp;
342
343on_error:
344 if (tmp)
345 free(tmp);
346}
347
348Ecore_Event_Mouse_Button *
349_ecore_mouse_button(int event,
350 unsigned int timestamp,
351 unsigned int xmodifiers,
352 unsigned int buttons,
353 int x,
354 int y,
355 int x_root,
356 int y_root,
357 unsigned int event_window,
358 unsigned int window,
359 unsigned int root_win,
360 int same_screen,
361 int dev,
362 double radx,
363 double rady,
364 double pressure,
365 double angle,
366 double mx,
367 double my,
368 double mrx,
369 double mry)
370{
371 Ecore_Event_Mouse_Button *e;
372
373 e = malloc(sizeof(Ecore_Event_Mouse_Button));
374 if (!e)
375 return NULL;
376
377 e->window = window;
378 e->root_window = root_win;
379 e->timestamp = timestamp;
380 e->same_screen = same_screen;
381 e->event_window = event_window;
382
383 e->buttons = buttons;
384 e->modifiers = _ecore_x_event_modifiers(xmodifiers);
385 e->double_click = 0;
386 e->triple_click = 0;
387 e->x = x;
388 e->y = y;
389 e->root.x = x_root;
390 e->root.y = y_root;
391
392 Ecore_X_Mouse_Down_Info *down_info = _ecore_x_mouse_down_info_get(dev);
393
394 if (down_info)
395 {
396 if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
397 down_info->did_triple)
398 {
399 down_info->last_win = 0;
400 down_info->last_last_win = 0;
401 down_info->last_event_win = 0;
402 down_info->last_last_event_win = 0;
403 down_info->last_time = 0;
404 down_info->last_last_time = 0;
405 }
406 if (event_window == window)
407 {
408 if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
409 {
410 //Check Double Clicked
411 if (((int)(timestamp - down_info->last_time) <=
412 (int)(1000 * _ecore_x_double_click_time)) &&
413 (window == down_info->last_win) &&
414 (event_window == down_info->last_event_win))
415 {
416 e->double_click = 1;
417 down_info->did_double = EINA_TRUE;
418 }
419 else
420 {
421 down_info->did_double = EINA_FALSE;
422 down_info->did_triple = EINA_FALSE;
423 }
424
425 //Check Triple Clicked
426 if (((int)(timestamp - down_info->last_last_time) <=
427 (int)(2 * 1000 * _ecore_x_double_click_time)) &&
428 (window == down_info->last_win) &&
429 (window == down_info->last_last_win) &&
430 (event_window == down_info->last_event_win) &&
431 (event_window == down_info->last_last_event_win)
432 )
433 {
434 e->triple_click = 1;
435 down_info->did_triple = EINA_TRUE;
436 }
437 else
438 {
439 down_info->did_triple = EINA_FALSE;
440 }
441 }
442 else
443 {
444 if (down_info->did_double)
445 e->double_click = 1;
446 if (down_info->did_triple)
447 e->triple_click = 1;
448 }
449 }
450 }
451
452 /* NB: Block commented out as _ecore_x_mouse_up_count appears to have
453 * no use. The variable is also commented out above. This code block is
454 * the only place that this variable is used, and appears to serve no
455 * purpose. - dh
456 if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
457 && !e->double_click
458 && !e->triple_click)
459 _ecore_x_mouse_up_count = 0;
460 */
461
462 e->multi.device = dev;
463 e->multi.radius = (radx + rady) / 2;
464 e->multi.radius_x = radx;
465 e->multi.radius_y = rady;
466 e->multi.pressure = pressure;
467 e->multi.angle = angle;
468 e->multi.x = mx;
469 e->multi.y = my;
470 e->multi.root.x = mrx;
471 e->multi.root.y = mry;
472
473 _ecore_x_event_last_time = e->timestamp;
474 _ecore_x_event_last_win = e->window;
475 _ecore_x_event_last_root_x = x_root;
476 _ecore_x_event_last_root_y = y_root;
477
478 ecore_event_add(event, e, NULL, NULL);
479
480 if ((down_info) &&
481 (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
482 (window == event_window) &&
483 (!down_info->did_triple))
484 {
485 down_info->last_last_win = down_info->last_win;
486 down_info->last_win = window;
487 down_info->last_last_event_win = down_info->last_event_win;
488 down_info->last_event_win = event_window;
489 down_info->last_last_time = down_info->last_time;
490 down_info->last_time = timestamp;
491 }
492
493 return e;
494}
495
496void
497_ecore_x_event_handle_any_event(XEvent *xevent)
498{
499 XEvent *ev = malloc(sizeof(XEvent));
500 if (!ev) return;
501 memcpy(ev, xevent, sizeof(XEvent));
502 ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
503}
504
505void
506_ecore_x_event_handle_key_press(XEvent *xevent)
507{
508 _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent);
509}
510
511void
512_ecore_x_event_handle_key_release(XEvent *xevent)
513{
514 _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent);
515}
516
517void
518_ecore_x_event_handle_button_press(XEvent *xevent)
519{
520 int i;
521
522 _ecore_x_last_event_mouse_move = 0;
523 if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8))
524 {
525 Ecore_Event_Mouse_Wheel *e;
526
527 e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
528 if (!e)
529 return;
530
531 e->timestamp = xevent->xbutton.time;
532 e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state);
533 switch (xevent->xbutton.button)
534 {
535 case 4: e->direction = 0; e->z = -1; break;
536
537 case 5: e->direction = 0; e->z = 1; break;
538
539 case 6: e->direction = 1; e->z = -1; break;
540
541 case 7: e->direction = 1; e->z = 1; break;
542
543 default: e->direction = 0; e->z = 0; break;
544 }
545
546 e->x = xevent->xbutton.x;
547 e->y = xevent->xbutton.y;
548 e->root.x = xevent->xbutton.x_root;
549 e->root.y = xevent->xbutton.y_root;
550
551 if (xevent->xbutton.subwindow)
552 e->window = xevent->xbutton.subwindow;
553 else
554 e->window = xevent->xbutton.window;
555
556 e->event_window = xevent->xbutton.window;
557 e->same_screen = xevent->xbutton.same_screen;
558 e->root_window = xevent->xbutton.root;
559
560 _ecore_x_event_last_time = e->timestamp;
561 _ecore_x_event_last_win = e->window;
562 _ecore_x_event_last_root_x = xevent->xbutton.x_root;
563 _ecore_x_event_last_root_y = xevent->xbutton.y_root;
564 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
565
566 for (i = 0; i < _ecore_window_grabs_num; i++)
567 {
568 if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
569 (_ecore_window_grabs[i] == xevent->xbutton.subwindow))
570 {
571 Eina_Bool replay = EINA_FALSE;
572
573 if (_ecore_window_grab_replay_func)
574 replay = _ecore_window_grab_replay_func(
575 _ecore_window_grab_replay_data,
576 ECORE_EVENT_MOUSE_WHEEL,
577 e);
578
579 if (replay)
580 XAllowEvents(xevent->xbutton.display,
581 ReplayPointer, xevent->xbutton.time);
582 else
583 XAllowEvents(xevent->xbutton.display,
584 AsyncPointer, xevent->xbutton.time);
585
586 break;
587 }
588 }
589 }
590 else
591 {
592 {
593 _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
594 xevent->xbutton.x, xevent->xbutton.y,
595 xevent->xbutton.x_root, xevent->xbutton.y_root,
596 xevent->xbutton.window,
597 (xevent->xbutton.subwindow ? xevent->xbutton.
598 subwindow : xevent->xbutton.window),
599 xevent->xbutton.root,
600 xevent->xbutton.same_screen,
601 0, 1, 1,
602 1.0, // pressure
603 0.0, // angle
604 xevent->xbutton.x, xevent->xbutton.y,
605 xevent->xbutton.x_root, xevent->xbutton.y_root);
606 }
607 {
608 Ecore_Event_Mouse_Button *e;
609 int event_window;
610 int window;
611
612 window =
613 (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->
614 xbutton.window);
615 event_window = xevent->xbutton.window;
616
617 e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
618 xevent->xbutton.time,
619 xevent->xbutton.state,
620 xevent->xbutton.button,
621 xevent->xbutton.x,
622 xevent->xbutton.y,
623 xevent->xbutton.x_root,
624 xevent->xbutton.y_root,
625 event_window,
626 window,
627 xevent->xbutton.root,
628 xevent->xbutton.same_screen,
629 0,
630 1,
631 1,
632 1.0,
633// pressure
634 0.0,
635// angle
636 xevent->xbutton.x,
637 xevent->xbutton.y,
638 xevent->xbutton.x_root,
639 xevent->xbutton.y_root);
640 if (e)
641 for (i = 0; i < _ecore_window_grabs_num; i++)
642 {
643 if ((_ecore_window_grabs[i] == xevent->xbutton.window) ||
644 (_ecore_window_grabs[i] == xevent->xbutton.subwindow))
645 {
646 Eina_Bool replay = EINA_FALSE;
647
648 if (_ecore_window_grab_replay_func)
649 replay = _ecore_window_grab_replay_func(
650 _ecore_window_grab_replay_data,
651 ECORE_EVENT_MOUSE_BUTTON_DOWN,
652 e);
653
654 if (replay)
655 XAllowEvents(xevent->xbutton.display,
656 ReplayPointer, xevent->xbutton.time);
657 else
658 XAllowEvents(xevent->xbutton.display,
659 AsyncPointer, xevent->xbutton.time);
660
661 break;
662 }
663 }
664 }
665 }
666}
667
668void
669_ecore_x_event_handle_button_release(XEvent *xevent)
670{
671 _ecore_x_last_event_mouse_move = 0;
672 /* filter out wheel buttons */
673 if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7))
674 {
675 _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
676 xevent->xbutton.x, xevent->xbutton.y,
677 xevent->xbutton.x_root, xevent->xbutton.y_root,
678 xevent->xbutton.window,
679 (xevent->xbutton.subwindow ? xevent->xbutton.
680 subwindow : xevent->xbutton.window),
681 xevent->xbutton.root,
682 xevent->xbutton.same_screen,
683 0, 1, 1,
684 1.0, // pressure
685 0.0, // angle
686 xevent->xbutton.x, xevent->xbutton.y,
687 xevent->xbutton.x_root, xevent->xbutton.y_root);
688
689 _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
690 xevent->xbutton.time, xevent->xbutton.state,
691 xevent->xbutton.button,
692 xevent->xbutton.x, xevent->xbutton.y,
693 xevent->xbutton.x_root, xevent->xbutton.y_root,
694 xevent->xbutton.window,
695 (xevent->xbutton.subwindow ? xevent->xbutton.
696 subwindow : xevent->xbutton.window),
697 xevent->xbutton.root,
698 xevent->xbutton.same_screen,
699 0, 1, 1,
700 1.0, // pressure
701 0.0, // angle
702 xevent->xbutton.x, xevent->xbutton.y,
703 xevent->xbutton.x_root, xevent->xbutton.y_root);
704 }
705}
706
707void
708_ecore_x_event_handle_motion_notify(XEvent *xevent)
709{
710/*
711 if (_ecore_x_last_event_mouse_move)
712 {
713 ecore_event_del(_ecore_x_last_event_mouse_move_event);
714 _ecore_x_last_event_mouse_move = 0;
715 _ecore_x_last_event_mouse_move_event = NULL;
716 }
717 */
718 _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state,
719 xevent->xmotion.x, xevent->xmotion.y,
720 xevent->xmotion.x_root, xevent->xmotion.y_root,
721 xevent->xmotion.window,
722 (xevent->xmotion.subwindow ? xevent->xmotion.subwindow :
723 xevent->xmotion.window),
724 xevent->xmotion.root,
725 xevent->xmotion.same_screen,
726 0, 1, 1,
727 1.0, // pressure
728 0.0, // angle
729 xevent->xmotion.x, xevent->xmotion.y,
730 xevent->xmotion.x_root, xevent->xmotion.y_root);
731
732 _ecore_x_last_event_mouse_move = 1;
733
734 /* Xdnd handling */
735 _ecore_x_dnd_drag(xevent->xmotion.root,
736 xevent->xmotion.x_root,
737 xevent->xmotion.y_root);
738}
739
740void
741_ecore_x_event_handle_enter_notify(XEvent *xevent)
742{
743 _ecore_x_last_event_mouse_move = 0;
744 {
745 _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state,
746 xevent->xcrossing.x, xevent->xcrossing.y,
747 xevent->xcrossing.x_root, xevent->xcrossing.y_root,
748 xevent->xcrossing.window,
749 (xevent->xcrossing.subwindow ? xevent->xcrossing.
750 subwindow : xevent->xcrossing.window),
751 xevent->xcrossing.root,
752 xevent->xcrossing.same_screen,
753 0, 1, 1,
754 1.0, // pressure
755 0.0, // angle
756 xevent->xcrossing.x, xevent->xcrossing.y,
757 xevent->xcrossing.x_root, xevent->xcrossing.y_root);
758 }
759 {
760 Ecore_X_Event_Mouse_In *e;
761
762 e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
763 if (!e)
764 return;
765
766 e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
767 e->x = xevent->xcrossing.x;
768 e->y = xevent->xcrossing.y;
769 e->root.x = xevent->xcrossing.x_root;
770 e->root.y = xevent->xcrossing.y_root;
771 if (xevent->xcrossing.subwindow)
772 e->win = xevent->xcrossing.subwindow;
773 else
774 e->win = xevent->xcrossing.window;
775
776 e->same_screen = xevent->xcrossing.same_screen;
777 e->root_win = xevent->xcrossing.root;
778 e->event_win = xevent->xcrossing.window;
779
780 if (xevent->xcrossing.mode == NotifyNormal)
781 e->mode = ECORE_X_EVENT_MODE_NORMAL;
782 else if (xevent->xcrossing.mode == NotifyGrab)
783 e->mode = ECORE_X_EVENT_MODE_GRAB;
784 else if (xevent->xcrossing.mode == NotifyUngrab)
785 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
786
787 if (xevent->xcrossing.detail == NotifyAncestor)
788 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
789 else if (xevent->xcrossing.detail == NotifyVirtual)
790 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
791 else if (xevent->xcrossing.detail == NotifyInferior)
792 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
793 else if (xevent->xcrossing.detail == NotifyNonlinear)
794 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
795 else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
796 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
797
798 e->time = xevent->xcrossing.time;
799 _ecore_x_event_last_time = e->time;
800 ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
801 }
802}
803
804void
805_ecore_x_event_handle_leave_notify(XEvent *xevent)
806{
807 _ecore_x_last_event_mouse_move = 0;
808 {
809 _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state,
810 xevent->xcrossing.x, xevent->xcrossing.y,
811 xevent->xcrossing.x_root, xevent->xcrossing.y_root,
812 xevent->xcrossing.window,
813 (xevent->xcrossing.subwindow ? xevent->xcrossing.
814 subwindow : xevent->xcrossing.window),
815 xevent->xcrossing.root,
816 xevent->xcrossing.same_screen,
817 0, 1, 1,
818 1.0, // pressure
819 0.0, // angle
820 xevent->xcrossing.x, xevent->xcrossing.y,
821 xevent->xcrossing.x_root, xevent->xcrossing.y_root);
822 }
823 {
824 Ecore_X_Event_Mouse_Out *e;
825
826 e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
827 if (!e)
828 return;
829
830 e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
831 e->x = xevent->xcrossing.x;
832 e->y = xevent->xcrossing.y;
833 e->root.x = xevent->xcrossing.x_root;
834 e->root.y = xevent->xcrossing.y_root;
835 if (xevent->xcrossing.subwindow)
836 e->win = xevent->xcrossing.subwindow;
837 else
838 e->win = xevent->xcrossing.window;
839
840 e->same_screen = xevent->xcrossing.same_screen;
841 e->root_win = xevent->xcrossing.root;
842 e->event_win = xevent->xcrossing.window;
843
844 if (xevent->xcrossing.mode == NotifyNormal)
845 e->mode = ECORE_X_EVENT_MODE_NORMAL;
846 else if (xevent->xcrossing.mode == NotifyGrab)
847 e->mode = ECORE_X_EVENT_MODE_GRAB;
848 else if (xevent->xcrossing.mode == NotifyUngrab)
849 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
850
851 if (xevent->xcrossing.detail == NotifyAncestor)
852 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
853 else if (xevent->xcrossing.detail == NotifyVirtual)
854 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
855 else if (xevent->xcrossing.detail == NotifyInferior)
856 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
857 else if (xevent->xcrossing.detail == NotifyNonlinear)
858 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
859 else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
860 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
861
862 e->time = xevent->xcrossing.time;
863 _ecore_x_event_last_time = e->time;
864 _ecore_x_event_last_win = e->win;
865 _ecore_x_event_last_root_x = e->root.x;
866 _ecore_x_event_last_root_y = e->root.y;
867 ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL);
868 }
869}
870
871void
872_ecore_x_event_handle_focus_in(XEvent *xevent)
873{
874 Ecore_X_Event_Window_Focus_In *e;
875
876 _ecore_x_last_event_mouse_move = 0;
877
878 e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
879 if (!e)
880 return;
881
882 e->win = xevent->xfocus.window;
883
884 if (xevent->xfocus.mode == NotifyNormal)
885 e->mode = ECORE_X_EVENT_MODE_NORMAL;
886 else if (xevent->xfocus.mode == NotifyWhileGrabbed)
887 e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
888 else if (xevent->xfocus.mode == NotifyGrab)
889 e->mode = ECORE_X_EVENT_MODE_GRAB;
890 else if (xevent->xfocus.mode == NotifyUngrab)
891 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
892
893 if (xevent->xfocus.detail == NotifyAncestor)
894 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
895 else if (xevent->xfocus.detail == NotifyVirtual)
896 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
897 else if (xevent->xfocus.detail == NotifyInferior)
898 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
899 else if (xevent->xfocus.detail == NotifyNonlinear)
900 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
901 else if (xevent->xfocus.detail == NotifyNonlinearVirtual)
902 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
903 else if (xevent->xfocus.detail == NotifyPointer)
904 e->detail = ECORE_X_EVENT_DETAIL_POINTER;
905 else if (xevent->xfocus.detail == NotifyPointerRoot)
906 e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
907 else if (xevent->xfocus.detail == NotifyDetailNone)
908 e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
909
910 e->time = _ecore_x_event_last_time;
911 _ecore_x_event_last_time = e->time;
912 ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
913}
914
915void
916_ecore_x_event_handle_focus_out(XEvent *xevent)
917{
918 Ecore_X_Event_Window_Focus_Out *e;
919
920 _ecore_x_last_event_mouse_move = 0;
921
922 e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
923 if (!e)
924 return;
925
926 e->win = xevent->xfocus.window;
927
928 if (xevent->xfocus.mode == NotifyNormal)
929 e->mode = ECORE_X_EVENT_MODE_NORMAL;
930 else if (xevent->xfocus.mode == NotifyWhileGrabbed)
931 e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
932 else if (xevent->xfocus.mode == NotifyGrab)
933 e->mode = ECORE_X_EVENT_MODE_GRAB;
934 else if (xevent->xfocus.mode == NotifyUngrab)
935 e->mode = ECORE_X_EVENT_MODE_UNGRAB;
936
937 if (xevent->xfocus.detail == NotifyAncestor)
938 e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
939 else if (xevent->xfocus.detail == NotifyVirtual)
940 e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
941 else if (xevent->xfocus.detail == NotifyInferior)
942 e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
943 else if (xevent->xfocus.detail == NotifyNonlinear)
944 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
945 else if (xevent->xfocus.detail == NotifyNonlinearVirtual)
946 e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
947 else if (xevent->xfocus.detail == NotifyPointer)
948 e->detail = ECORE_X_EVENT_DETAIL_POINTER;
949 else if (xevent->xfocus.detail == NotifyPointerRoot)
950 e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
951 else if (xevent->xfocus.detail == NotifyDetailNone)
952 e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
953
954 e->time = _ecore_x_event_last_time;
955 _ecore_x_event_last_time = e->time;
956 ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
957}
958
959void
960_ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__)
961{
962 _ecore_x_last_event_mouse_move = 0;
963 /* FIXME: handle this event type */
964}
965
966void
967_ecore_x_event_handle_expose(XEvent *xevent)
968{
969 Ecore_X_Event_Window_Damage *e;
970
971 _ecore_x_last_event_mouse_move = 0;
972 e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
973 if (!e)
974 return;
975
976 e->win = xevent->xexpose.window;
977 e->time = _ecore_x_event_last_time;
978 e->x = xevent->xexpose.x;
979 e->y = xevent->xexpose.y;
980 e->w = xevent->xexpose.width;
981 e->h = xevent->xexpose.height;
982 e->count = xevent->xexpose.count;
983 ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
984}
985
986void
987_ecore_x_event_handle_graphics_expose(XEvent *xevent)
988{
989 Ecore_X_Event_Window_Damage *e;
990
991 _ecore_x_last_event_mouse_move = 0;
992 e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
993 if (!e)
994 return;
995
996 e->win = xevent->xgraphicsexpose.drawable;
997 e->time = _ecore_x_event_last_time;
998 e->x = xevent->xgraphicsexpose.x;
999 e->y = xevent->xgraphicsexpose.y;
1000 e->w = xevent->xgraphicsexpose.width;
1001 e->h = xevent->xgraphicsexpose.height;
1002 e->count = xevent->xgraphicsexpose.count;
1003 ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
1004}
1005
1006void
1007_ecore_x_event_handle_visibility_notify(XEvent *xevent)
1008{
1009 _ecore_x_last_event_mouse_move = 0;
1010// if (xevent->xvisibility.state != VisibilityPartiallyObscured)
1011 {
1012 Ecore_X_Event_Window_Visibility_Change *e;
1013
1014 e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
1015 if (!e)
1016 return;
1017
1018 e->win = xevent->xvisibility.window;
1019 e->time = _ecore_x_event_last_time;
1020 if (xevent->xvisibility.state == VisibilityFullyObscured)
1021 e->fully_obscured = 1;
1022 else
1023 e->fully_obscured = 0;
1024
1025 ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
1026 }
1027}
1028
1029void
1030_ecore_x_event_handle_create_notify(XEvent *xevent)
1031{
1032 Ecore_X_Event_Window_Create *e;
1033
1034 _ecore_x_last_event_mouse_move = 0;
1035 e = calloc(1, sizeof(Ecore_X_Event_Window_Create));
1036 if (!e)
1037 return;
1038
1039 e->win = xevent->xcreatewindow.window;
1040 e->parent = xevent->xcreatewindow.parent;
1041 if (xevent->xcreatewindow.override_redirect)
1042 e->override = 1;
1043 else
1044 e->override = 0;
1045
1046 e->x = xevent->xcreatewindow.x;
1047 e->y = xevent->xcreatewindow.y;
1048 e->w = xevent->xcreatewindow.width;
1049 e->h = xevent->xcreatewindow.height;
1050 e->border = xevent->xcreatewindow.border_width;
1051 e->time = _ecore_x_event_last_time;
1052 ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
1053}
1054
1055void
1056_ecore_x_event_handle_destroy_notify(XEvent *xevent)
1057{
1058 Ecore_X_Event_Window_Destroy *e;
1059
1060 _ecore_x_last_event_mouse_move = 0;
1061 e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy));
1062 if (!e)
1063 return;
1064
1065 e->win = xevent->xdestroywindow.window;
1066 e->event_win = xevent->xdestroywindow.event;
1067 e->time = _ecore_x_event_last_time;
1068 if (e->win == _ecore_x_event_last_win)
1069 _ecore_x_event_last_win = 0;
1070
1071 ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
1072}
1073
1074void
1075_ecore_x_event_handle_unmap_notify(XEvent *xevent)
1076{
1077 Ecore_X_Event_Window_Hide *e;
1078
1079 _ecore_x_last_event_mouse_move = 0;
1080 e = calloc(1, sizeof(Ecore_X_Event_Window_Hide));
1081 if (!e)
1082 return;
1083
1084 e->win = xevent->xunmap.window;
1085 e->event_win = xevent->xunmap.event;
1086 e->time = _ecore_x_event_last_time;
1087 ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
1088}
1089
1090void
1091_ecore_x_event_handle_map_notify(XEvent *xevent)
1092{
1093 Ecore_X_Event_Window_Show *e;
1094
1095 _ecore_x_last_event_mouse_move = 0;
1096 e = calloc(1, sizeof(Ecore_X_Event_Window_Show));
1097 if (!e)
1098 return;
1099
1100 e->win = xevent->xmap.window;
1101 e->event_win = xevent->xmap.event;
1102 e->time = _ecore_x_event_last_time;
1103 ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
1104}
1105
1106void
1107_ecore_x_event_handle_map_request(XEvent *xevent)
1108{
1109 Ecore_X_Event_Window_Show_Request *e;
1110
1111 _ecore_x_last_event_mouse_move = 0;
1112 e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request));
1113 if (!e)
1114 return;
1115
1116 e->win = xevent->xmaprequest.window;
1117 e->time = _ecore_x_event_last_time;
1118 e->parent = xevent->xmaprequest.parent;
1119 ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
1120}
1121
1122void
1123_ecore_x_event_handle_reparent_notify(XEvent *xevent)
1124{
1125 Ecore_X_Event_Window_Reparent *e;
1126
1127 _ecore_x_last_event_mouse_move = 0;
1128 e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent));
1129 if (!e)
1130 return;
1131
1132 e->win = xevent->xreparent.window;
1133 e->event_win = xevent->xreparent.event;
1134 e->parent = xevent->xreparent.parent;
1135 e->time = _ecore_x_event_last_time;
1136 ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
1137}
1138
1139void
1140_ecore_x_event_handle_configure_notify(XEvent *xevent)
1141{
1142 Ecore_X_Event_Window_Configure *e;
1143
1144 _ecore_x_last_event_mouse_move = 0;
1145 e = calloc(1, sizeof(Ecore_X_Event_Window_Configure));
1146 if (!e)
1147 return;
1148
1149 e->win = xevent->xconfigure.window;
1150 e->event_win = xevent->xconfigure.event;
1151 e->abovewin = xevent->xconfigure.above;
1152 e->x = xevent->xconfigure.x;
1153 e->y = xevent->xconfigure.y;
1154 e->w = xevent->xconfigure.width;
1155 e->h = xevent->xconfigure.height;
1156 e->border = xevent->xconfigure.border_width;
1157 e->override = xevent->xconfigure.override_redirect;
1158 e->from_wm = xevent->xconfigure.send_event;
1159 e->time = _ecore_x_event_last_time;
1160 ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
1161}
1162
1163void
1164_ecore_x_event_handle_configure_request(XEvent *xevent)
1165{
1166 Ecore_X_Event_Window_Configure_Request *e;
1167
1168 _ecore_x_last_event_mouse_move = 0;
1169 e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request));
1170 if (!e)
1171 return;
1172
1173 e->win = xevent->xconfigurerequest.window;
1174 e->parent_win = xevent->xconfigurerequest.parent;
1175 e->abovewin = xevent->xconfigurerequest.above;
1176 e->x = xevent->xconfigurerequest.x;
1177 e->y = xevent->xconfigurerequest.y;
1178 e->w = xevent->xconfigurerequest.width;
1179 e->h = xevent->xconfigurerequest.height;
1180 e->border = xevent->xconfigurerequest.border_width;
1181 e->value_mask = xevent->xconfigurerequest.value_mask;
1182 e->time = _ecore_x_event_last_time;
1183
1184 if (xevent->xconfigurerequest.detail == Above)
1185 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1186 else if (xevent->xconfigurerequest.detail == Below)
1187 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1188 else if (xevent->xconfigurerequest.detail == TopIf)
1189 e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
1190 else if (xevent->xconfigurerequest.detail == BottomIf)
1191 e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
1192 else if (xevent->xconfigurerequest.detail == Opposite)
1193 e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
1194
1195 ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
1196}
1197
1198void
1199_ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__)
1200{
1201 _ecore_x_last_event_mouse_move = 0;
1202 /* FIXME: handle this event type */
1203}
1204
1205void
1206_ecore_x_event_handle_resize_request(XEvent *xevent)
1207{
1208 Ecore_X_Event_Window_Resize_Request *e;
1209
1210 _ecore_x_last_event_mouse_move = 0;
1211 e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request));
1212 if (!e)
1213 return;
1214
1215 e->win = xevent->xresizerequest.window;
1216 e->w = xevent->xresizerequest.width;
1217 e->h = xevent->xresizerequest.height;
1218 e->time = _ecore_x_event_last_time;
1219 ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
1220}
1221
1222void
1223_ecore_x_event_handle_circulate_notify(XEvent *xevent)
1224{
1225 Ecore_X_Event_Window_Stack *e;
1226
1227 _ecore_x_last_event_mouse_move = 0;
1228 e = calloc(1, sizeof(Ecore_X_Event_Window_Stack));
1229 if (!e)
1230 return;
1231
1232 e->win = xevent->xcirculate.window;
1233 e->event_win = xevent->xcirculate.event;
1234 if (xevent->xcirculate.place == PlaceOnTop)
1235 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1236 else
1237 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1238
1239 e->time = _ecore_x_event_last_time;
1240 ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
1241}
1242
1243void
1244_ecore_x_event_handle_circulate_request(XEvent *xevent)
1245{
1246 Ecore_X_Event_Window_Stack_Request *e;
1247
1248 _ecore_x_last_event_mouse_move = 0;
1249 e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request));
1250 if (!e)
1251 return;
1252
1253 e->win = xevent->xcirculaterequest.window;
1254 e->parent = xevent->xcirculaterequest.parent;
1255 if (xevent->xcirculaterequest.place == PlaceOnTop)
1256 e->detail = ECORE_X_WINDOW_STACK_ABOVE;
1257 else
1258 e->detail = ECORE_X_WINDOW_STACK_BELOW;
1259
1260 e->time = _ecore_x_event_last_time;
1261 ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
1262}
1263
1264void
1265_ecore_x_event_handle_property_notify(XEvent *xevent)
1266{
1267 _ecore_x_last_event_mouse_move = 0;
1268 {
1269 Ecore_X_Event_Window_Property *e;
1270
1271 e = calloc(1, sizeof(Ecore_X_Event_Window_Property));
1272 if (!e)
1273 return;
1274
1275 e->win = xevent->xproperty.window;
1276 e->atom = xevent->xproperty.atom;
1277 e->time = xevent->xproperty.time;
1278 _ecore_x_event_last_time = e->time;
1279 ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL);
1280 }
1281}
1282
1283void
1284_ecore_x_event_handle_selection_clear(XEvent *xevent)
1285{
1286// Ecore_X_Selection_Intern *d;
1287 Ecore_X_Event_Selection_Clear *e;
1288 Ecore_X_Atom sel;
1289
1290 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1291 _ecore_x_last_event_mouse_move = 0;
1292/* errr..... why? paranoia.
1293 d = _ecore_x_selection_get(xevent->xselectionclear.selection);
1294 if (d && (xevent->xselectionclear.time > d->time))
1295 {
1296 _ecore_x_selection_set(None, NULL, 0,
1297 xevent->xselectionclear.selection);
1298 }
1299 */
1300/* Generate event for app cleanup */
1301 e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
1302 e->win = xevent->xselectionclear.window;
1303 e->time = xevent->xselectionclear.time;
1304 e->atom = sel = xevent->xselectionclear.selection;
1305 if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
1306 e->selection = ECORE_X_SELECTION_PRIMARY;
1307 else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
1308 e->selection = ECORE_X_SELECTION_SECONDARY;
1309 else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
1310 e->selection = ECORE_X_SELECTION_CLIPBOARD;
1311 else
1312 e->selection = ECORE_X_SELECTION_OTHER;
1313
1314 ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
1315}
1316
1317void
1318_ecore_x_event_handle_selection_request(XEvent *xevent)
1319{
1320 Ecore_X_Event_Selection_Request *e;
1321 Ecore_X_Selection_Intern *sd;
1322 void *data = NULL;
1323 int len;
1324 int typesize;
1325
1326 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1327 _ecore_x_last_event_mouse_move = 0;
1328 /*
1329 * Generate a selection request event.
1330 */
1331 e = malloc(sizeof(Ecore_X_Event_Selection_Request));
1332 e->owner = xevent->xselectionrequest.owner;
1333 e->requestor = xevent->xselectionrequest.requestor;
1334 e->time = xevent->xselectionrequest.time;
1335 e->selection = xevent->xselectionrequest.selection;
1336 e->target = xevent->xselectionrequest.target;
1337 e->property = xevent->xselectionrequest.property;
1338 ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL);
1339
1340 if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) &&
1341 (sd->win == xevent->xselectionrequest.owner))
1342 {
1343 Ecore_X_Selection_Intern *si;
1344
1345 si = _ecore_x_selection_get(xevent->xselectionrequest.selection);
1346 if (si->data)
1347 {
1348 Ecore_X_Atom property = None;
1349 Ecore_X_Atom type;
1350
1351 /* Set up defaults for strings first */
1352 type = xevent->xselectionrequest.target;
1353 typesize = 8;
1354 len = sd->length;
1355
1356 if (!ecore_x_selection_convert(xevent->xselectionrequest.selection,
1357 xevent->xselectionrequest.target,
1358 &data, &len, &type, &typesize))
1359 /* Refuse selection, conversion to requested target failed */
1360 property = None;
1361 else if (data)
1362 {
1363 /* FIXME: This does not properly handle large data transfers */
1364 ecore_x_window_prop_property_set(
1365 xevent->xselectionrequest.requestor,
1366 xevent->xselectionrequest.
1367 property,
1368 type,
1369 typesize,
1370 data,
1371 len);
1372 property = xevent->xselectionrequest.property;
1373 free(data);
1374 }
1375
1376 ecore_x_selection_notify_send(xevent->xselectionrequest.requestor,
1377 xevent->xselectionrequest.selection,
1378 xevent->xselectionrequest.target,
1379 property,
1380 xevent->xselectionrequest.time);
1381 }
1382 }
1383}
1384
1385void
1386_ecore_x_event_handle_selection_notify(XEvent *xevent)
1387{
1388 Ecore_X_Event_Selection_Notify *e;
1389 unsigned char *data = NULL;
1390 Ecore_X_Atom selection;
1391 int num_ret, format;
1392
1393 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1394 _ecore_x_last_event_mouse_move = 0;
1395 selection = xevent->xselection.selection;
1396
1397 if (xevent->xselection.target == ECORE_X_ATOM_SELECTION_TARGETS)
1398 {
1399 format = ecore_x_window_prop_property_get(xevent->xselection.requestor,
1400 xevent->xselection.property,
1401 XA_ATOM, 32, &data, &num_ret);
1402 if (!format)
1403 return;
1404 }
1405 else
1406 {
1407 format = ecore_x_window_prop_property_get(xevent->xselection.requestor,
1408 xevent->xselection.property,
1409 AnyPropertyType, 8, &data,
1410 &num_ret);
1411 if (!format)
1412 return;
1413 }
1414
1415 e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
1416 if (!e)
1417 return;
1418
1419 e->win = xevent->xselection.requestor;
1420 e->time = xevent->xselection.time;
1421 e->atom = selection;
1422 e->target = _ecore_x_selection_target_get(xevent->xselection.target);
1423
1424 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
1425 e->selection = ECORE_X_SELECTION_PRIMARY;
1426 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
1427 e->selection = ECORE_X_SELECTION_SECONDARY;
1428 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
1429 e->selection = ECORE_X_SELECTION_XDND;
1430 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
1431 e->selection = ECORE_X_SELECTION_CLIPBOARD;
1432 else
1433 e->selection = ECORE_X_SELECTION_OTHER;
1434
1435 e->data = _ecore_x_selection_parse(e->target, data, num_ret, format);
1436
1437 ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,
1438 _ecore_x_event_free_selection_notify, NULL);
1439}
1440
1441void
1442_ecore_x_event_handle_colormap_notify(XEvent *xevent)
1443{
1444 Ecore_X_Event_Window_Colormap *e;
1445
1446 _ecore_x_last_event_mouse_move = 0;
1447 e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap));
1448 if (!e)
1449 return;
1450
1451 e->win = xevent->xcolormap.window;
1452 e->cmap = xevent->xcolormap.colormap;
1453 e->time = _ecore_x_event_last_time;
1454 if (xevent->xcolormap.state == ColormapInstalled)
1455 e->installed = EINA_TRUE;
1456 else
1457 e->installed = EINA_FALSE;
1458
1459 ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
1460}
1461
1462void
1463_ecore_x_event_handle_client_message(XEvent *xevent)
1464{
1465 _ecore_x_last_event_mouse_move = 0;
1466 /* Special client message event handling here. need to put LOTS of if */
1467 /* checks here and generate synthetic events per special message known */
1468 /* otherwise generate generic client message event. this would handle*/
1469 /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */
1470 if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) &&
1471 (xevent->xclient.format == 32) &&
1472 (xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW))
1473 {
1474 Ecore_X_Event_Window_Delete_Request *e;
1475
1476 e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
1477 if (!e)
1478 return;
1479
1480 e->win = xevent->xclient.window;
1481 e->time = _ecore_x_event_last_time;
1482 ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
1483 }
1484 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE) &&
1485 (xevent->xclient.format == 32) &&
1486/* Ignore move and resize with keyboard */
1487 (xevent->xclient.data.l[2] < 9))
1488 {
1489 Ecore_X_Event_Window_Move_Resize_Request *e;
1490
1491 e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request));
1492 if (!e)
1493 return;
1494
1495 e->win = xevent->xclient.window;
1496 e->x = xevent->xclient.data.l[0];
1497 e->y = xevent->xclient.data.l[1];
1498 e->direction = xevent->xclient.data.l[2];
1499 e->button = xevent->xclient.data.l[3];
1500 e->source = xevent->xclient.data.l[4];
1501 ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
1502 }
1503 /* Xdnd Client Message Handling Begin */
1504 /* Message Type: XdndEnter target */
1505 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER)
1506 {
1507 Ecore_X_Event_Xdnd_Enter *e;
1508 Ecore_X_DND_Target *target;
1509
1510 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
1511 if (!e) return;
1512
1513 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1514
1515 target = _ecore_x_dnd_target_get();
1516 target->state = ECORE_X_DND_TARGET_ENTERED;
1517 target->source = xevent->xclient.data.l[0];
1518 target->win = xevent->xclient.window;
1519 target->version = (int)(xevent->xclient.data.l[1] >> 24);
1520 if (target->version > ECORE_X_DND_VERSION)
1521 {
1522 WRN("DND: Requested version %d, we only support up to %d",
1523 target->version, ECORE_X_DND_VERSION);
1524 free(e);
1525 return;
1526 }
1527
1528 if (xevent->xclient.data.l[1] & 0x1UL)
1529 {
1530 /* source supports more than 3 types, fetch property */
1531 unsigned char *data;
1532 Ecore_X_Atom *types;
1533 int i, num_ret;
1534
1535 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1536 if (!(ecore_x_window_prop_property_get(target->source,
1537 ECORE_X_ATOM_XDND_TYPE_LIST,
1538 XA_ATOM,
1539 32, &data, &num_ret)))
1540 {
1541 WRN(
1542 "DND: Could not fetch data type list from source window, aborting.");
1543 free(e);
1544 return;
1545 }
1546
1547 types = (Ecore_X_Atom *)data;
1548 e->types = calloc(num_ret, sizeof(char *));
1549 if (e->types)
1550 {
1551 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1552 for (i = 0; i < num_ret; i++)
1553 e->types[i] = XGetAtomName(_ecore_x_disp, types[i]);
1554 }
1555
1556 e->num_types = num_ret;
1557 }
1558 else
1559 {
1560 int i = 0;
1561
1562 e->types = calloc(3, sizeof(char *));
1563 if (e->types)
1564 {
1565 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1566 while ((i < 3) && (xevent->xclient.data.l[i + 2]))
1567 {
1568 e->types[i] = XGetAtomName(_ecore_x_disp,
1569 xevent->xclient.data.l[i + 2]);
1570 i++;
1571 }
1572 }
1573
1574 e->num_types = i;
1575 }
1576
1577 e->win = target->win;
1578 e->source = target->source;
1579 ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e,
1580 _ecore_x_event_free_xdnd_enter, NULL);
1581 }
1582 /* Message Type: XdndPosition target */
1583 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION)
1584 {
1585 Ecore_X_Event_Xdnd_Position *e;
1586 Ecore_X_DND_Target *target;
1587
1588 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1589
1590 target = _ecore_x_dnd_target_get();
1591 if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) ||
1592 (target->win != xevent->xclient.window))
1593 return;
1594
1595 target->pos.x = xevent->xclient.data.l[2] >> 16;
1596 target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL;
1597 target->action = xevent->xclient.data.l[4]; /* Version 2 */
1598
1599 target->time = (target->version >= 1) ?
1600 (Time)xevent->xclient.data.l[3] : CurrentTime;
1601
1602 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
1603 if (!e) return;
1604
1605 e->win = target->win;
1606 e->source = target->source;
1607 e->position.x = target->pos.x;
1608 e->position.y = target->pos.y;
1609 e->action = target->action;
1610 ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
1611 }
1612 /* Message Type: XdndStatus source */
1613 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS)
1614 {
1615 Ecore_X_Event_Xdnd_Status *e;
1616 Ecore_X_DND_Source *source;
1617
1618 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1619
1620 source = _ecore_x_dnd_source_get();
1621 /* Make sure source/target match */
1622 if ((source->win != xevent->xclient.window) ||
1623 (source->dest != (Window)xevent->xclient.data.l[0]))
1624 return;
1625
1626 source->await_status = 0;
1627
1628 source->will_accept = xevent->xclient.data.l[1] & 0x1UL;
1629 source->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1;
1630
1631 source->rectangle.x = xevent->xclient.data.l[2] >> 16;
1632 source->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL;
1633 source->rectangle.width = xevent->xclient.data.l[3] >> 16;
1634 source->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL;
1635
1636 source->accepted_action = xevent->xclient.data.l[4];
1637
1638 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
1639 if (!e) return;
1640
1641 e->win = source->win;
1642 e->target = source->dest;
1643 e->will_accept = source->will_accept;
1644 e->rectangle.x = source->rectangle.x;
1645 e->rectangle.y = source->rectangle.y;
1646 e->rectangle.width = source->rectangle.width;
1647 e->rectangle.height = source->rectangle.height;
1648 e->action = source->accepted_action;
1649
1650 ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
1651 }
1652 /* Message Type: XdndLeave target */
1653 /* Pretend the whole thing never happened, sort of */
1654 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE)
1655 {
1656 Ecore_X_Event_Xdnd_Leave *e;
1657 Ecore_X_DND_Target *target;
1658
1659 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1660
1661 target = _ecore_x_dnd_target_get();
1662 if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) ||
1663 (target->win != xevent->xclient.window))
1664 return;
1665
1666 target->state = ECORE_X_DND_TARGET_IDLE;
1667
1668 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
1669 if (!e) return;
1670
1671 e->win = xevent->xclient.window;
1672 e->source = (Window)xevent->xclient.data.l[0];
1673 ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
1674 }
1675 /* Message Type: XdndDrop target */
1676 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP)
1677 {
1678 Ecore_X_Event_Xdnd_Drop *e;
1679 Ecore_X_DND_Target *target;
1680
1681 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1682
1683 target = _ecore_x_dnd_target_get();
1684 /* Match source/target */
1685 if ((target->source != (Window)xevent->xclient.data.l[0]) ||
1686 (target->win != xevent->xclient.window))
1687 return;
1688
1689 target->time = (target->version >= 1) ?
1690 (Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time;
1691
1692 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
1693 if (!e) return;
1694
1695 e->win = target->win;
1696 e->source = target->source;
1697 e->action = target->action;
1698 e->position.x = target->pos.x;
1699 e->position.y = target->pos.y;
1700 ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
1701 }
1702 /* Message Type: XdndFinished source */
1703 else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED)
1704 {
1705 Ecore_X_Event_Xdnd_Finished *e;
1706 Ecore_X_DND_Source *source;
1707 Eina_Bool completed = EINA_TRUE;
1708
1709 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1710
1711 source = _ecore_x_dnd_source_get();
1712 /* Match source/target */
1713 if ((source->win != xevent->xclient.window) ||
1714 (source->dest != (Window)xevent->xclient.data.l[0]))
1715 return;
1716
1717 if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL))
1718 {
1719 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1720 /* Target successfully performed drop action */
1721 ecore_x_selection_xdnd_clear();
1722 source->state = ECORE_X_DND_SOURCE_IDLE;
1723 }
1724 else if (source->version >= 5)
1725 {
1726 completed = EINA_FALSE;
1727 source->state = ECORE_X_DND_SOURCE_CONVERTING;
1728
1729 /* FIXME: Probably need to add a timer to switch back to idle
1730 * and discard the selection data */
1731 }
1732
1733 e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
1734 if (!e) return;
1735
1736 e->win = source->win;
1737 e->target = source->dest;
1738 e->completed = completed;
1739 if (source->version >= 5)
1740 {
1741 source->accepted_action = xevent->xclient.data.l[2];
1742 e->action = source->accepted_action;
1743 }
1744 else
1745 {
1746 source->accepted_action = 0;
1747 e->action = source->action;
1748 }
1749
1750 ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
1751 }
1752 else if (xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_STATE)
1753 {
1754 Ecore_X_Event_Window_State_Request *e;
1755
1756 e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
1757 if (!e) return;
1758
1759 e->win = xevent->xclient.window;
1760 if (xevent->xclient.data.l[0] == 0)
1761 e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
1762 else if (xevent->xclient.data.l[0] == 1)
1763 e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
1764 else if (xevent->xclient.data.l[0] == 2)
1765 e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
1766 else
1767 {
1768 free(e);
1769 return;
1770 }
1771
1772 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1773 e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]);
1774 if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
1775 {
1776// char *name;
1777 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1778
1779// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]);
1780// if (name) ERR("Unknown state: %s", name);
1781// XFree(name);
1782 }
1783 e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]);
1784 if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
1785 {
1786// char *name;
1787 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1788
1789// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]);
1790// if (name) ERR("Unknown state: %s", name);
1791// XFree(name);
1792 }
1793
1794 e->source = xevent->xclient.data.l[3];
1795
1796 ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
1797 }
1798 else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_CHANGE_STATE)
1799 && (xevent->xclient.format == 32)
1800 && (xevent->xclient.data.l[0] == IconicState))
1801 {
1802 Ecore_X_Event_Window_State_Request *e;
1803
1804 e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
1805 if (!e)
1806 return;
1807
1808 e->win = xevent->xclient.window;
1809 e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
1810 e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
1811
1812 ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
1813 }
1814 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_DESKTOP)
1815 && (xevent->xclient.format == 32))
1816 {
1817 Ecore_X_Event_Desktop_Change *e;
1818
1819 e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
1820 if (!e)
1821 return;
1822
1823 e->win = xevent->xclient.window;
1824 e->desk = xevent->xclient.data.l[0];
1825 e->source = xevent->xclient.data.l[1];
1826
1827 ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
1828 }
1829 else if ((xevent->xclient.message_type ==
1830 ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS))
1831 {
1832 Ecore_X_Event_Frame_Extents_Request *e;
1833
1834 e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
1835 if (!e)
1836 return;
1837
1838 e->win = xevent->xclient.window;
1839
1840 ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
1841 }
1842 else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS)
1843 && ((Ecore_X_Atom)xevent->xclient.data.l[0] ==
1844 ECORE_X_ATOM_NET_WM_PING)
1845 && (xevent->xclient.format == 32))
1846 {
1847 Ecore_X_Event_Ping *e;
1848 Ecore_X_Window root = 0;
1849
1850 e = calloc(1, sizeof(Ecore_X_Event_Ping));
1851 if (!e)
1852 return;
1853
1854 e->win = xevent->xclient.window;
1855 e->time = xevent->xclient.data.l[1];
1856 e->event_win = xevent->xclient.data.l[2];
1857
1858 /* send a reply anyway - we are alive... eventloop at least */
1859 ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
1860 if (ScreenCount(_ecore_x_disp) > 1)
1861 {
1862 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1863 root = ecore_x_window_root_get(e->win);
1864 }
1865 else
1866 root = DefaultRootWindow(_ecore_x_disp);
1867
1868 if (xevent->xclient.window != root)
1869 {
1870 xevent->xclient.window = root;
1871 XSendEvent(_ecore_x_disp, root, False,
1872 SubstructureRedirectMask | SubstructureNotifyMask,
1873 xevent);
1874 }
1875 }
1876 else if ((xevent->xclient.message_type ==
1877 ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
1878 (xevent->xclient.format == 8))
1879 _ecore_x_netwm_startup_info_begin(xevent->xclient.window,
1880 xevent->xclient.data.b);
1881 else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO) &&
1882 (xevent->xclient.format == 8))
1883 _ecore_x_netwm_startup_info(xevent->xclient.window,
1884 xevent->xclient.data.b);
1885 else if ((xevent->xclient.message_type == 27777)
1886 && (xevent->xclient.data.l[0] == 0x7162534)
1887 && (xevent->xclient.format == 32)
1888 && (xevent->xclient.window == _ecore_x_private_win))
1889 {
1890 /* a grab sync marker */
1891 if (xevent->xclient.data.l[1] == 0x10000001)
1892 _ecore_x_window_grab_remove(xevent->xclient.data.l[2]);
1893 else if (xevent->xclient.data.l[1] == 0x10000002)
1894 _ecore_x_key_grab_remove(xevent->xclient.data.l[2]);
1895 }
1896 else
1897 {
1898 Ecore_X_Event_Client_Message *e;
1899 int i;
1900
1901 e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
1902 if (!e)
1903 return;
1904
1905 e->win = xevent->xclient.window;
1906 e->message_type = xevent->xclient.message_type;
1907 e->format = xevent->xclient.format;
1908 for (i = 0; i < 5; i++)
1909 e->data.l[i] = xevent->xclient.data.l[i];
1910
1911 ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
1912 }
1913}
1914
1915void
1916_ecore_x_event_handle_mapping_notify(XEvent *xevent)
1917{
1918 Ecore_X_Event_Mapping_Change *e;
1919
1920 _ecore_x_last_event_mouse_move = 0;
1921 XRefreshKeyboardMapping((XMappingEvent *)xevent);
1922 _ecore_x_modifiers_get();
1923 e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change));
1924 if (!e) return;
1925 switch (xevent->xmapping.request)
1926 {
1927 case MappingModifier:
1928 e->type = ECORE_X_MAPPING_MODIFIER;
1929 break;
1930
1931 case MappingKeyboard:
1932 e->type = ECORE_X_MAPPING_KEYBOARD;
1933 break;
1934
1935 case MappingPointer:
1936 default:
1937 e->type = ECORE_X_MAPPING_MOUSE;
1938 break;
1939 }
1940 e->keycode = xevent->xmapping.first_keycode;
1941 e->num = xevent->xmapping.count;
1942 ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL);
1943}
1944
1945void
1946_ecore_x_event_handle_shape_change(XEvent *xevent)
1947{
1948 XShapeEvent *shape_event;
1949 Ecore_X_Event_Window_Shape *e;
1950
1951 _ecore_x_last_event_mouse_move = 0;
1952 shape_event = (XShapeEvent *)xevent;
1953 e = calloc(1, sizeof(Ecore_X_Event_Window_Shape));
1954 if (!e)
1955 return;
1956
1957 e->win = shape_event->window;
1958 e->time = shape_event->time;
1959 switch (shape_event->kind)
1960 {
1961 case ShapeBounding:
1962 e->type = ECORE_X_SHAPE_BOUNDING;
1963 break;
1964
1965 case ShapeClip:
1966 e->type = ECORE_X_SHAPE_CLIP;
1967 break;
1968
1969 case ShapeInput:
1970 e->type = ECORE_X_SHAPE_INPUT;
1971 break;
1972
1973 default:
1974 break;
1975 }
1976 e->x = shape_event->x;
1977 e->y = shape_event->y;
1978 e->w = shape_event->width;
1979 e->h = shape_event->height;
1980 e->shaped = shape_event->shaped;
1981 ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
1982}
1983
1984void
1985_ecore_x_event_handle_screensaver_notify(XEvent *xevent)
1986{
1987#ifdef ECORE_XSS
1988 XScreenSaverNotifyEvent *screensaver_event;
1989 Ecore_X_Event_Screensaver_Notify *e;
1990
1991 _ecore_x_last_event_mouse_move = 0;
1992 screensaver_event = (XScreenSaverNotifyEvent *)xevent;
1993 e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify));
1994 if (!e)
1995 return;
1996
1997 e->win = screensaver_event->window;
1998 if (screensaver_event->state == ScreenSaverOn)
1999 e->on = EINA_TRUE;
2000 else
2001 e->on = EINA_FALSE;
2002
2003 e->time = screensaver_event->time;
2004 ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
2005#else /* ifdef ECORE_XSS */
2006 xevent = NULL;
2007#endif /* ifdef ECORE_XSS */
2008}
2009
2010void
2011_ecore_x_event_handle_sync_counter(XEvent *xevent)
2012{
2013 XSyncCounterNotifyEvent *sync_counter_event;
2014 Ecore_X_Event_Sync_Counter *e;
2015
2016 _ecore_x_last_event_mouse_move = 0;
2017 sync_counter_event = (XSyncCounterNotifyEvent *)xevent;
2018 e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter));
2019 if (!e)
2020 return;
2021
2022 e->time = sync_counter_event->time;
2023 ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
2024}
2025
2026void
2027_ecore_x_event_handle_sync_alarm(XEvent *xevent)
2028{
2029 XSyncAlarmNotifyEvent *sync_alarm_event;
2030 Ecore_X_Event_Sync_Alarm *e;
2031
2032 _ecore_x_last_event_mouse_move = 0;
2033 sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent;
2034
2035 e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm));
2036 if (!e)
2037 return;
2038
2039 e->time = sync_alarm_event->time;
2040 e->alarm = sync_alarm_event->alarm;
2041 ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
2042}
2043
2044#ifdef ECORE_XRANDR
2045void
2046_ecore_x_event_handle_randr_change(XEvent *xevent)
2047{
2048 XRRScreenChangeNotifyEvent *randr_event;
2049 Ecore_X_Event_Screen_Change *e;
2050
2051 _ecore_x_last_event_mouse_move = 0;
2052 randr_event = (XRRScreenChangeNotifyEvent *)xevent;
2053 if (!XRRUpdateConfiguration(xevent))
2054 ERR("Can't update RR config!");
2055
2056 e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
2057 if (!e)
2058 return;
2059
2060 e->win = randr_event->window;
2061 e->root = randr_event->root;
2062 e->size.width = randr_event->width;
2063 e->size.height = randr_event->height;
2064 e->time = randr_event->timestamp;
2065 e->config_time = randr_event->config_timestamp;
2066 e->size.width_mm = randr_event->mwidth;
2067 e->size.height_mm = randr_event->mheight;
2068 e->orientation = randr_event->rotation;
2069 e->subpixel_order = randr_event->subpixel_order;
2070 ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL);
2071}
2072
2073static void
2074_ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent)
2075{
2076 const XRRCrtcChangeNotifyEvent *randr_event;
2077 Ecore_X_Event_Randr_Crtc_Change *e;
2078
2079 randr_event = (const XRRCrtcChangeNotifyEvent *)xevent;
2080
2081 e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change));
2082 if (!e)
2083 return;
2084
2085 e->win = randr_event->window;
2086 e->crtc = randr_event->crtc;
2087 e->mode = randr_event->mode;
2088 e->orientation = randr_event->rotation;
2089 e->geo.x = randr_event->x;
2090 e->geo.y = randr_event->y;
2091 e->geo.w = randr_event->width;
2092 e->geo.h = randr_event->height;
2093 ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL);
2094}
2095
2096static void
2097_ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent)
2098{
2099 const XRROutputChangeNotifyEvent *randr_event;
2100 Ecore_X_Event_Randr_Output_Change *e;
2101
2102 randr_event = (const XRROutputChangeNotifyEvent *)xevent;
2103
2104 e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change));
2105 if (!e)
2106 return;
2107
2108 e->win = randr_event->window;
2109 e->output = randr_event->output;
2110 e->crtc = randr_event->crtc;
2111 e->mode = randr_event->mode;
2112 e->orientation = randr_event->rotation;
2113 e->connection = randr_event->connection;
2114 e->subpixel_order = randr_event->subpixel_order;
2115 ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL);
2116}
2117
2118static void
2119_ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent)
2120{
2121 const XRROutputPropertyNotifyEvent *randr_event;
2122 Ecore_X_Event_Randr_Output_Property_Notify *e;
2123
2124 randr_event = (const XRROutputPropertyNotifyEvent *)xevent;
2125
2126 e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify));
2127 if (!e)
2128 return;
2129
2130 e->win = randr_event->window;
2131 e->output = randr_event->output;
2132 e->property = randr_event->property;
2133 e->time = randr_event->timestamp;
2134 if (randr_event->state == PropertyNewValue)
2135 e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD;
2136 else
2137 e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL;
2138 ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL);
2139}
2140
2141void
2142_ecore_x_event_handle_randr_notify(XEvent *xevent)
2143{
2144 const XRRNotifyEvent *randr_event;
2145
2146 _ecore_x_last_event_mouse_move = 0;
2147 randr_event = (const XRRNotifyEvent *)xevent;
2148 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2149 switch (randr_event->subtype)
2150 {
2151 case RRNotify_CrtcChange:
2152 _ecore_x_event_handle_randr_notify_crtc_change(randr_event);
2153 break;
2154
2155 case RRNotify_OutputChange:
2156 _ecore_x_event_handle_randr_notify_output_change(randr_event);
2157 break;
2158
2159 case RRNotify_OutputProperty:
2160 _ecore_x_event_handle_randr_notify_output_property(randr_event);
2161 break;
2162
2163 default:
2164 ERR("Unknown XRandR RRNotify subtype: %d.",
2165 randr_event->subtype);
2166 break;
2167 }
2168}
2169
2170#endif /* ifdef ECORE_XRANDR */
2171
2172#ifdef ECORE_XFIXES
2173void
2174_ecore_x_event_handle_fixes_selection_notify(XEvent *event)
2175{
2176 XFixesSelectionNotifyEvent *notify_event =
2177 (XFixesSelectionNotifyEvent *)event;
2178 Ecore_X_Event_Fixes_Selection_Notify *e;
2179 Ecore_X_Atom sel;
2180
2181 _ecore_x_last_event_mouse_move = 0;
2182 /* Nothing here yet */
2183
2184 e = calloc(1, sizeof(*e));
2185 if (!e)
2186 return;
2187
2188 e->win = notify_event->window;
2189 e->owner = notify_event->owner;
2190 e->time = notify_event->timestamp;
2191 e->selection_time = notify_event->selection_timestamp;
2192 e->atom = sel = notify_event->selection;
2193 if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
2194 e->selection = ECORE_X_SELECTION_PRIMARY;
2195 else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
2196 e->selection = ECORE_X_SELECTION_SECONDARY;
2197 else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
2198 e->selection = ECORE_X_SELECTION_CLIPBOARD;
2199 else
2200 e->selection = ECORE_X_SELECTION_OTHER;
2201 e->reason = notify_event->subtype;
2202
2203 ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL);
2204}
2205
2206#endif /* ifdef ECORE_XFIXES */
2207
2208#ifdef ECORE_XDAMAGE
2209void
2210_ecore_x_event_handle_damage_notify(XEvent *event)
2211{
2212 XDamageNotifyEvent *damage_event;
2213 Ecore_X_Event_Damage *e;
2214
2215 _ecore_x_last_event_mouse_move = 0;
2216 damage_event = (XDamageNotifyEvent *)event;
2217
2218 e = calloc(1, sizeof(Ecore_X_Event_Damage));
2219 if (!e)
2220 return;
2221
2222 e->level = damage_event->level;
2223 e->drawable = damage_event->drawable;
2224 e->damage = damage_event->damage;
2225 e->more = damage_event->more;
2226 e->time = damage_event->timestamp;
2227 e->area.x = damage_event->area.x;
2228 e->area.y = damage_event->area.y;
2229 e->area.width = damage_event->area.width;
2230 e->area.height = damage_event->area.height;
2231 e->geometry.x = damage_event->geometry.x;
2232 e->geometry.y = damage_event->geometry.y;
2233 e->geometry.width = damage_event->geometry.width;
2234 e->geometry.height = damage_event->geometry.height;
2235
2236 ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);
2237}
2238
2239#endif /* ifdef ECORE_XDAMAGE */
2240
2241static void
2242_ecore_x_event_free_generic_event(void *data,
2243 void *ev)
2244{
2245#ifdef ECORE_XI2
2246 Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic *)ev;
2247
2248 if (data)
2249 {
2250 if (e->data)
2251 XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data);
2252 free(data);
2253 }
2254 free(e);
2255#else
2256 return;
2257 data = NULL; ev = NULL;
2258#endif /* ifdef ECORE_XI2 */
2259}
2260
2261void
2262_ecore_x_event_handle_generic_event(XEvent *event)
2263{
2264#ifdef ECORE_XI2
2265 XGenericEvent *generic_event;
2266 Ecore_X_Event_Generic *e;
2267 XGenericEventCookie *data;
2268
2269 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2270 generic_event = (XGenericEvent *)event;
2271
2272 e = calloc(1, sizeof(Ecore_X_Event_Generic));
2273 if (!e)
2274 return;
2275
2276 if (XGetEventData(_ecore_x_disp, &(event->xcookie)))
2277 {
2278 e->cookie = event->xcookie.cookie;
2279 e->data = event->xcookie.data;
2280 }
2281 else
2282 {
2283 e->cookie = 0;
2284 e->data = NULL;
2285 }
2286
2287 e->extension = generic_event->extension;
2288 e->evtype = generic_event->evtype;
2289
2290 if (e->extension == _ecore_x_xi2_opcode)
2291 _ecore_x_input_handler(event);
2292
2293 data = malloc(sizeof(XGenericEventCookie));
2294 if (data) memcpy(data, &(event->xcookie), sizeof(XGenericEventCookie));
2295 ecore_event_add(ECORE_X_EVENT_GENERIC,
2296 e,
2297 _ecore_x_event_free_generic_event,
2298 data);
2299#else
2300 return;
2301 event = NULL;
2302#endif /* ifdef ECORE_XI2 */
2303}
2304
2305#ifdef ECORE_XGESTURE
2306void
2307_ecore_x_event_handle_gesture_notify_flick(XEvent *xevent)
2308{
2309 XGestureNotifyFlickEvent *xfe;
2310 Ecore_X_Event_Gesture_Notify_Flick *e;
2311
2312 _ecore_x_last_event_mouse_move = 0;
2313 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2314
2315 xfe = (XGestureNotifyFlickEvent *)xevent;
2316 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick));
2317 if (!e)
2318 return;
2319
2320 e->win = xfe->window;
2321 e->time = xfe->time;
2322 e->subtype = xfe->kind;
2323 e->num_fingers = xfe->num_finger;
2324 e->distance = xfe->distance;
2325 e->duration = xfe->duration;
2326 e->direction = xfe->direction;
2327 e->angle = XFixedToDouble(xfe->angle);
2328
2329 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL);
2330}
2331
2332void
2333_ecore_x_event_handle_gesture_notify_pan(XEvent *xevent)
2334{
2335 XGestureNotifyPanEvent *xpe;
2336 Ecore_X_Event_Gesture_Notify_Pan *e;
2337
2338 _ecore_x_last_event_mouse_move = 0;
2339 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2340
2341 xpe = (XGestureNotifyPanEvent *)xevent;
2342 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan));
2343 if (!e)
2344 return;
2345
2346 e->win = xpe->window;
2347 e->time = xpe->time;
2348 e->subtype = xpe->kind;
2349 e->num_fingers = xpe->num_finger;
2350 e->dx = xpe->dx;
2351 e->dy = xpe->dy;
2352 e->distance = xpe->distance;
2353 e->duration = xpe->duration;
2354 e->direction = xpe->direction;
2355
2356 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL);
2357}
2358
2359void
2360_ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent)
2361{
2362 XGestureNotifyPinchRotationEvent *xpre;
2363 Ecore_X_Event_Gesture_Notify_PinchRotation *e;
2364
2365 _ecore_x_last_event_mouse_move = 0;
2366 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2367
2368 xpre = (XGestureNotifyPinchRotationEvent *)xevent;
2369 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation));
2370 if (!e)
2371 return;
2372
2373 e->win = xpre->window;
2374 e->time = xpre->time;
2375 e->subtype = xpre->kind;
2376 e->num_fingers = xpre->num_finger;
2377 e->distance = xpre->distance;
2378 e->cx = xpre->cx;
2379 e->cy = xpre->cy;
2380 e->zoom = XFixedToDouble(xpre->zoom);
2381 e->angle = XFixedToDouble(xpre->angle);
2382
2383 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL);
2384}
2385
2386void
2387_ecore_x_event_handle_gesture_notify_tap(XEvent *xevent)
2388{
2389 XGestureNotifyTapEvent *xte;
2390 Ecore_X_Event_Gesture_Notify_Tap *e;
2391
2392 _ecore_x_last_event_mouse_move = 0;
2393 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2394
2395 xte = (XGestureNotifyTapEvent *)xevent;
2396 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap));
2397 if (!e)
2398 return;
2399
2400 e->win = xte->window;
2401 e->time = xte->time;
2402 e->subtype = xte->kind;
2403 e->num_fingers = xte->num_finger;
2404 e->cx = xte->cx;
2405 e->cy = xte->cy;
2406 e->tap_repeat = xte->tap_repeat;
2407 e->interval = xte->interval;
2408
2409 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL);
2410}
2411
2412void
2413_ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent)
2414{
2415 XGestureNotifyTapNHoldEvent *xthe;
2416 Ecore_X_Event_Gesture_Notify_TapNHold *e;
2417
2418 _ecore_x_last_event_mouse_move = 0;
2419 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2420
2421 xthe = (XGestureNotifyTapNHoldEvent *)xevent;
2422 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold));
2423 if (!e)
2424 return;
2425
2426 e->win = xthe->window;
2427 e->time = xthe->time;
2428 e->subtype = xthe->kind;
2429 e->num_fingers = xthe->num_finger;
2430 e->cx = xthe->cx;
2431 e->cy = xthe->cy;
2432 e->interval = xthe->interval;
2433 e->hold_time = xthe->holdtime;
2434
2435 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL);
2436}
2437
2438void
2439_ecore_x_event_handle_gesture_notify_hold(XEvent *xevent)
2440{
2441 XGestureNotifyHoldEvent *xhe;
2442 Ecore_X_Event_Gesture_Notify_Hold *e;
2443
2444 _ecore_x_last_event_mouse_move = 0;
2445 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2446
2447 xhe = (XGestureNotifyHoldEvent *)xevent;
2448 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold));
2449 if (!e)
2450 return;
2451
2452 e->win = xhe->window;
2453 e->time = xhe->time;
2454 e->subtype = xhe->kind;
2455 e->num_fingers = xhe->num_finger;
2456 e->cx = xhe->cx;
2457 e->cy = xhe->cy;
2458 e->hold_time = xhe->holdtime;
2459
2460 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL);
2461}
2462
2463void
2464_ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
2465{
2466 XGestureNotifyGroupEvent *xge;
2467 Ecore_X_Event_Gesture_Notify_Group *e;
2468
2469 _ecore_x_last_event_mouse_move = 0;
2470 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2471
2472 xge = (XGestureNotifyGroupEvent *)xevent;
2473 e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group));
2474 if (!e)
2475 return;
2476
2477 e->win = xge->window;
2478 e->time = xge->time;
2479 e->subtype = xge->kind;
2480 e->num_groups = xge->num_group;
2481 e->group_id = xge->groupid;
2482
2483 ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL);
2484}
2485
2486#endif /* ifdef ECORE_XGESTURE */
2487
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
deleted file mode 100644
index da0a6c3..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c
+++ /dev/null
@@ -1,365 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6
7#include "ecore_x_private.h"
8#include "Ecore_X.h"
9
10static int _fixes_available;
11#ifdef ECORE_XFIXES
12static int _fixes_major, _fixes_minor;
13#endif /* ifdef ECORE_XFIXES */
14
15void
16_ecore_x_fixes_init(void)
17{
18#ifdef ECORE_XFIXES
19 _fixes_major = 3;
20 _fixes_minor = 0;
21
22 LOGFN(__FILE__, __LINE__, __FUNCTION__);
23 if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor))
24 {
25 _fixes_available = 1;
26
27 ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new();
28 }
29 else
30 _fixes_available = 0;
31
32#else /* ifdef ECORE_XFIXES */
33 _fixes_available = 0;
34#endif /* ifdef ECORE_XFIXES */
35}
36
37#ifdef ECORE_XFIXES
38/* I don't know what to call this function. */
39static XRectangle *
40_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects,
41 int num)
42{
43 XRectangle *xrect;
44 int i;
45
46 if (num == 0)
47 return NULL;
48
49 xrect = malloc(sizeof(XRectangle) * num);
50 if (!xrect)
51 return NULL;
52
53 for (i = 0; i < num; i++)
54 {
55 xrect[i].x = rects[i].x;
56 xrect[i].y = rects[i].y;
57 xrect[i].width = rects[i].width;
58 xrect[i].height = rects[i].height;
59 }
60 return xrect;
61}
62
63static Ecore_X_Rectangle *
64_ecore_x_rectangle_x_to_ecore(XRectangle *xrect,
65 int num)
66{
67 Ecore_X_Rectangle *rects;
68 int i;
69
70 if (num == 0)
71 return NULL;
72
73 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
74 if (!rects)
75 return NULL;
76
77 for (i = 0; i < num; i++)
78 {
79 rects[i].x = xrect[i].x;
80 rects[i].y = xrect[i].y;
81 rects[i].width = xrect[i].width;
82 rects[i].height = xrect[i].height;
83 }
84 return rects;
85}
86
87#endif /* ifdef ECORE_XFIXES */
88
89EAPI Eina_Bool
90ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
91{
92#ifdef ECORE_XFIXES
93 if (_fixes_available)
94 {
95 XFixesSelectSelectionInput (_ecore_x_disp,
96 DefaultRootWindow(_ecore_x_disp),
97 selection,
98 XFixesSetSelectionOwnerNotifyMask |
99 XFixesSelectionWindowDestroyNotifyMask |
100 XFixesSelectionClientCloseNotifyMask);
101 return EINA_TRUE;
102 }
103#endif
104 return EINA_FALSE;
105}
106
107EAPI Ecore_X_Region
108ecore_x_region_new(Ecore_X_Rectangle *rects,
109 int num)
110{
111#ifdef ECORE_XFIXES
112 Ecore_X_Region region;
113 XRectangle *xrect;
114
115 LOGFN(__FILE__, __LINE__, __FUNCTION__);
116 xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
117 region = XFixesCreateRegion(_ecore_x_disp, xrect, num);
118 free(xrect);
119 return region;
120#else /* ifdef ECORE_XFIXES */
121 return 0;
122#endif /* ifdef ECORE_XFIXES */
123}
124
125EAPI Ecore_X_Region
126ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
127{
128#ifdef ECORE_XFIXES
129 Ecore_X_Region region;
130
131 LOGFN(__FILE__, __LINE__, __FUNCTION__);
132 region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap);
133 return region;
134#else /* ifdef ECORE_XFIXES */
135 return 0;
136#endif /* ifdef ECORE_XFIXES */
137}
138
139EAPI Ecore_X_Region
140ecore_x_region_new_from_window(Ecore_X_Window win,
141 Ecore_X_Region_Type type)
142{
143#ifdef ECORE_XFIXES
144 Ecore_X_Region region;
145
146 LOGFN(__FILE__, __LINE__, __FUNCTION__);
147 region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type);
148 return region;
149#else /* ifdef ECORE_XFIXES */
150 return 0;
151#endif /* ifdef ECORE_XFIXES */
152}
153
154EAPI Ecore_X_Region
155ecore_x_region_new_from_gc(Ecore_X_GC gc)
156{
157#ifdef ECORE_XFIXES
158 Ecore_X_Region region;
159
160 LOGFN(__FILE__, __LINE__, __FUNCTION__);
161 region = XFixesCreateRegionFromGC(_ecore_x_disp, gc);
162 return region;
163#else /* ifdef ECORE_XFIXES */
164 return 0;
165#endif /* ifdef ECORE_XFIXES */
166}
167
168EAPI Ecore_X_Region
169ecore_x_region_new_from_picture(Ecore_X_Picture picture)
170{
171#ifdef ECORE_XFIXES
172 Ecore_X_Region region;
173
174 LOGFN(__FILE__, __LINE__, __FUNCTION__);
175 region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture);
176 return region;
177#else /* ifdef ECORE_XFIXES */
178 return 0;
179#endif /* ifdef ECORE_XFIXES */
180}
181
182EAPI void
183ecore_x_region_free(Ecore_X_Region region)
184{
185#ifdef ECORE_XFIXES
186 LOGFN(__FILE__, __LINE__, __FUNCTION__);
187 XFixesDestroyRegion(_ecore_x_disp, region);
188#endif /* ifdef ECORE_XFIXES */
189}
190
191EAPI void
192ecore_x_region_set(Ecore_X_Region region,
193 Ecore_X_Rectangle *rects,
194 int num)
195{
196#ifdef ECORE_XFIXES
197 XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
198 LOGFN(__FILE__, __LINE__, __FUNCTION__);
199 XFixesSetRegion(_ecore_x_disp, region, xrect, num);
200#endif /* ifdef ECORE_XFIXES */
201}
202
203EAPI void
204ecore_x_region_copy(Ecore_X_Region dest,
205 Ecore_X_Region source)
206{
207#ifdef ECORE_XFIXES
208 LOGFN(__FILE__, __LINE__, __FUNCTION__);
209 XFixesCopyRegion(_ecore_x_disp, dest, source);
210#endif /* ifdef ECORE_XFIXES */
211}
212
213EAPI void
214ecore_x_region_combine(Ecore_X_Region dest,
215 Ecore_X_Region source1,
216 Ecore_X_Region source2)
217{
218#ifdef ECORE_XFIXES
219 LOGFN(__FILE__, __LINE__, __FUNCTION__);
220 XFixesUnionRegion(_ecore_x_disp, dest, source1, source2);
221#endif /* ifdef ECORE_XFIXES */
222}
223
224EAPI void
225ecore_x_region_intersect(Ecore_X_Region dest,
226 Ecore_X_Region source1,
227 Ecore_X_Region source2)
228{
229#ifdef ECORE_XFIXES
230 LOGFN(__FILE__, __LINE__, __FUNCTION__);
231 XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2);
232#endif /* ifdef ECORE_XFIXES */
233}
234
235EAPI void
236ecore_x_region_subtract(Ecore_X_Region dest,
237 Ecore_X_Region source1,
238 Ecore_X_Region source2)
239{
240#ifdef ECORE_XFIXES
241 LOGFN(__FILE__, __LINE__, __FUNCTION__);
242 XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2);
243#endif /* ifdef ECORE_XFIXES */
244}
245
246EAPI void
247ecore_x_region_invert(Ecore_X_Region dest,
248 Ecore_X_Rectangle *bounds,
249 Ecore_X_Region source)
250{
251#ifdef ECORE_XFIXES
252 XRectangle *xbound;
253 int num = 0;
254
255 LOGFN(__FILE__, __LINE__, __FUNCTION__);
256 while (bounds + num)
257 num++;
258 xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
259
260 XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
261#endif /* ifdef ECORE_XFIXES */
262}
263
264EAPI void
265ecore_x_region_translate(Ecore_X_Region region,
266 int dx,
267 int dy)
268{
269#ifdef ECORE_XFIXES
270 LOGFN(__FILE__, __LINE__, __FUNCTION__);
271 XFixesTranslateRegion(_ecore_x_disp, region, dx, dy);
272#endif /* ifdef ECORE_XFIXES */
273}
274
275EAPI void
276ecore_x_region_extents(Ecore_X_Region dest,
277 Ecore_X_Region source)
278{
279#ifdef ECORE_XFIXES
280 LOGFN(__FILE__, __LINE__, __FUNCTION__);
281 XFixesRegionExtents(_ecore_x_disp, dest, source);
282#endif /* ifdef ECORE_XFIXES */
283}
284
285EAPI Ecore_X_Rectangle *
286ecore_x_region_fetch(Ecore_X_Region region,
287 int *num,
288 Ecore_X_Rectangle *bounds){
289#ifdef ECORE_XFIXES
290 Ecore_X_Rectangle *rects;
291 XRectangle *xrect, xbound;
292
293 LOGFN(__FILE__, __LINE__, __FUNCTION__);
294 xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound);
295 rects = _ecore_x_rectangle_x_to_ecore(xrect, *num);
296 (*bounds).x = xbound.x;
297 (*bounds).y = xbound.y;
298 (*bounds).width = xbound.width;
299 (*bounds).height = xbound.height;
300 return rects;
301#else /* ifdef ECORE_XFIXES */
302 return NULL;
303#endif /* ifdef ECORE_XFIXES */
304}
305
306EAPI void
307ecore_x_region_expand(Ecore_X_Region dest,
308 Ecore_X_Region source,
309 unsigned int left,
310 unsigned int right,
311 unsigned int top,
312 unsigned int bottom)
313{
314#ifdef ECORE_XFIXES
315 LOGFN(__FILE__, __LINE__, __FUNCTION__);
316 XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom);
317#endif /* ifdef ECORE_XFIXES */
318}
319
320EAPI void
321ecore_x_region_gc_clip_set(Ecore_X_Region region,
322 Ecore_X_GC gc,
323 int x_origin,
324 int y_origin)
325{
326#ifdef ECORE_XFIXES
327 LOGFN(__FILE__, __LINE__, __FUNCTION__);
328 XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region);
329#endif /* ifdef ECORE_XFIXES */
330}
331
332EAPI void
333ecore_x_region_window_shape_set(Ecore_X_Region region,
334 Ecore_X_Window win,
335 Ecore_X_Shape_Type type,
336 int x_offset,
337 int y_offset)
338{
339#ifdef ECORE_XFIXES
340 LOGFN(__FILE__, __LINE__, __FUNCTION__);
341 XFixesSetWindowShapeRegion(_ecore_x_disp,
342 win,
343 type,
344 x_offset,
345 y_offset,
346 region);
347#endif /* ifdef ECORE_XFIXES */
348}
349
350EAPI void
351ecore_x_region_picture_clip_set(Ecore_X_Region region,
352 Ecore_X_Picture picture,
353 int x_origin,
354 int y_origin)
355{
356#ifdef ECORE_XFIXES
357 LOGFN(__FILE__, __LINE__, __FUNCTION__);
358 XFixesSetPictureClipRegion(_ecore_x_disp,
359 picture,
360 x_origin,
361 y_origin,
362 region);
363#endif /* ifdef ECORE_XFIXES */
364}
365
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
deleted file mode 100644
index 5396366..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c
+++ /dev/null
@@ -1,171 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <string.h>
6
7#include "Ecore.h"
8#include "ecore_x_private.h"
9#include "Ecore_X.h"
10
11/**
12 * Creates a new default graphics context associated with the given
13 * drawable.
14 * @param draw Drawable to create graphics context with. If @c 0 is
15 * given instead, the default root window is used.
16 * @param value_mask Bitmask values.
17 * @param value_list List of values. The order of values must be the
18 * same than the corresponding bitmaks.
19 * @return The new default graphics context.
20 */
21EAPI Ecore_X_GC
22ecore_x_gc_new(Ecore_X_Drawable draw,
23 Ecore_X_GC_Value_Mask value_mask,
24 const unsigned int *value_list)
25{
26 XGCValues gcv;
27 int mask;
28 int idx;
29 int i;
30
31 LOGFN(__FILE__, __LINE__, __FUNCTION__);
32 if (!draw)
33 draw = DefaultRootWindow(_ecore_x_disp);
34
35 memset(&gcv, 0, sizeof (gcv));
36
37 for (i = 0, idx = 0, mask = 1; i <= 22; i++, mask <<= 1)
38 {
39 switch (mask & value_mask)
40 {
41 case ECORE_X_GC_VALUE_MASK_FUNCTION:
42 gcv.function = value_list[idx];
43 idx++;
44 break;
45
46 case ECORE_X_GC_VALUE_MASK_PLANE_MASK:
47 gcv.plane_mask = value_list[idx];
48 idx++;
49 break;
50
51 case ECORE_X_GC_VALUE_MASK_FOREGROUND:
52 gcv.foreground = value_list[idx];
53 idx++;
54 break;
55
56 case ECORE_X_GC_VALUE_MASK_BACKGROUND:
57 gcv.background = value_list[idx];
58 idx++;
59 break;
60
61 case ECORE_X_GC_VALUE_MASK_LINE_WIDTH:
62 gcv.line_width = value_list[idx];
63 idx++;
64 break;
65
66 case ECORE_X_GC_VALUE_MASK_LINE_STYLE:
67 gcv.line_style = value_list[idx];
68 idx++;
69 break;
70
71 case ECORE_X_GC_VALUE_MASK_CAP_STYLE:
72 gcv.cap_style = value_list[idx];
73 idx++;
74 break;
75
76 case ECORE_X_GC_VALUE_MASK_JOIN_STYLE:
77 gcv.join_style = value_list[idx];
78 idx++;
79 break;
80
81 case ECORE_X_GC_VALUE_MASK_FILL_STYLE:
82 gcv.fill_style = value_list[idx];
83 idx++;
84 break;
85
86 case ECORE_X_GC_VALUE_MASK_FILL_RULE:
87 gcv.fill_rule = value_list[idx];
88 idx++;
89 break;
90
91 case ECORE_X_GC_VALUE_MASK_TILE:
92 gcv.tile = value_list[idx];
93 idx++;
94 break;
95
96 case ECORE_X_GC_VALUE_MASK_STIPPLE:
97 gcv.stipple = value_list[idx];
98 idx++;
99 break;
100
101 case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X:
102 gcv.ts_x_origin = value_list[idx];
103 idx++;
104 break;
105
106 case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y:
107 gcv.ts_y_origin = value_list[idx];
108 idx++;
109 break;
110
111 case ECORE_X_GC_VALUE_MASK_FONT:
112 gcv.font = value_list[idx];
113 idx++;
114 break;
115
116 case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE:
117 gcv.subwindow_mode = value_list[idx];
118 idx++;
119 break;
120
121 case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES:
122 gcv.graphics_exposures = value_list[idx];
123 idx++;
124 break;
125
126 case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X:
127 gcv.clip_x_origin = value_list[idx];
128 idx++;
129 break;
130
131 case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y:
132 gcv.clip_y_origin = value_list[idx];
133 idx++;
134 break;
135
136 case ECORE_X_GC_VALUE_MASK_CLIP_MASK:
137 gcv.clip_mask = value_list[idx];
138 idx++;
139 break;
140
141 case ECORE_X_GC_VALUE_MASK_DASH_OFFSET:
142 gcv.dash_offset = value_list[idx];
143 idx++;
144 break;
145
146 case ECORE_X_GC_VALUE_MASK_DASH_LIST:
147 gcv.dashes = value_list[idx];
148 idx++;
149 break;
150
151 case ECORE_X_GC_VALUE_MASK_ARC_MODE:
152 gcv.arc_mode = value_list[idx];
153 idx++;
154 break;
155 }
156 }
157
158 return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv);
159}
160
161/**
162 * Deletes and frees the given graphics context.
163 * @param gc The given graphics context.
164 */
165EAPI void
166ecore_x_gc_free(Ecore_X_GC gc)
167{
168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
169 XFreeGC(_ecore_x_disp, gc);
170}
171
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
deleted file mode 100644
index e89421b..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c
+++ /dev/null
@@ -1,136 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6
7static Eina_Bool _gesture_available = EINA_FALSE;
8
9#ifdef ECORE_XGESTURE
10static int _gesture_major, _gesture_minor, _gesture_patch;
11int _gesture_version;
12#endif /* ifdef ECORE_XGESTURE */
13
14void
15_ecore_x_gesture_init(void)
16{
17#ifdef ECORE_XGESTURE
18 _gesture_major = 0;
19 _gesture_minor = 0;
20 _gesture_patch = 0;
21 _gesture_version = 0;
22
23 if (XGestureQueryVersion(_ecore_x_disp, &_gesture_major, &_gesture_minor, &_gesture_patch))
24 {
25 _gesture_version = (_gesture_major << 16) | _gesture_minor;
26 _gesture_available = EINA_TRUE;
27 }
28 else
29 _gesture_available = EINA_FALSE;
30#else /* ifdef ECORE_XGESTURE */
31 _gesture_available = EINA_FALSE;
32#endif /* ifdef ECORE_XGESTURE */
33}
34
35/*
36 * @brief query whether gesture is available or not
37 * @return EINA_TRUE, if extension is available, else EINA_FALSE
38 */
39EAPI Eina_Bool
40ecore_x_gesture_supported(void)
41{
42 return _gesture_available;
43}
44
45EAPI Eina_Bool
46ecore_x_gesture_events_select(Ecore_X_Window win,
47 Ecore_X_Gesture_Event_Mask mask)
48{
49#ifdef ECORE_XGESTURE
50 if (!_gesture_available)
51 return EINA_FALSE;
52
53 LOGFN(__FILE__, __LINE__, __FUNCTION__);
54 XGestureSelectEvents(_ecore_x_disp, win, mask);
55
56 return EINA_TRUE;
57#else /* ifdef ECORE_XGESTURE */
58 return EINA_FALSE;
59 win = 0;
60 mask = 0;
61#endif /* ifdef ECORE_XGESTURE */
62}
63
64EAPI Ecore_X_Gesture_Event_Mask
65ecore_x_gesture_events_selected_get(Ecore_X_Window win)
66{
67#ifdef ECORE_XGESTURE
68 Ecore_X_Gesture_Event_Mask mask;
69
70 if (!_gesture_available)
71 return ECORE_X_GESTURE_EVENT_MASK_NONE;
72
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask))
75 {
76 mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
77 return mask;
78 }
79
80 return mask;
81#else /* ifdef ECORE_XGESTURE */
82 return ECORE_X_GESTURE_EVENT_MASK_NONE;
83 win = 0;
84#endif /* ifdef ECORE_XGESTURE */
85}
86
87EAPI Eina_Bool
88ecore_x_gesture_event_grab(Ecore_X_Window win,
89 Ecore_X_Gesture_Event_Type type,
90 int num_fingers)
91{
92#ifdef ECORE_XGESTURE
93 if (!_gesture_available)
94 return EINA_FALSE;
95
96 LOGFN(__FILE__, __LINE__, __FUNCTION__);
97 if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
98 {
99 return EINA_FALSE;
100 }
101
102 return EINA_TRUE;
103#else /* ifdef ECORE_XGESTURE */
104 return EINA_FALSE;
105 win = 0;
106 type = 0;
107 num_fingers = 0;
108#endif /* ifdef ECORE_XGESTURE */
109}
110
111EAPI Eina_Bool
112ecore_x_gesture_event_ungrab(Ecore_X_Window win,
113 Ecore_X_Gesture_Event_Type type,
114 int num_fingers)
115{
116#ifdef ECORE_XGESTURE
117 Ecore_X_Gesture_Event_Mask mask;
118
119 if (!_gesture_available)
120 return EINA_FALSE;
121
122 LOGFN(__FILE__, __LINE__, __FUNCTION__);
123 if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
124 {
125 return EINA_FALSE;
126 }
127
128 return EINA_TRUE;
129#else /* ifdef ECORE_XGESTURE */
130 return EINA_FALSE;
131 win = 0;
132 type = 0;
133 num_fingers = 0;
134#endif /* ifdef ECORE_XGESTURE */
135}
136
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
deleted file mode 100644
index 8d6ea1f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c
+++ /dev/null
@@ -1,1214 +0,0 @@
1/*
2 * Various ICCCM related functions.
3 *
4 * This is ALL the code involving anything ICCCM related. for both WM and
5 * client.
6 */
7
8#ifdef HAVE_CONFIG_H
9# include <config.h>
10#endif /* ifdef HAVE_CONFIG_H */
11
12#include <stdlib.h>
13#include <string.h>
14
15#include "Ecore.h"
16#include "ecore_x_private.h"
17#include "Ecore_X.h"
18#include "Ecore_X_Atoms.h"
19
20EAPI void
21ecore_x_icccm_init(void)
22{
23 LOGFN(__FILE__, __LINE__, __FUNCTION__);
24}
25
26EAPI void
27ecore_x_icccm_state_set(Ecore_X_Window win,
28 Ecore_X_Window_State_Hint state)
29{
30 unsigned long c[2];
31
32 LOGFN(__FILE__, __LINE__, __FUNCTION__);
33 if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
34 c[0] = WithdrawnState;
35 else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
36 c[0] = NormalState;
37 else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
38 c[0] = IconicState;
39
40 c[1] = None;
41 XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
42 ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
43 (unsigned char *)c, 2);
44}
45
46EAPI Ecore_X_Window_State_Hint
47ecore_x_icccm_state_get(Ecore_X_Window win)
48{
49 unsigned char *prop_ret = NULL;
50 Atom type_ret;
51 unsigned long bytes_after, num_ret;
52 int format_ret;
53 Ecore_X_Window_State_Hint hint;
54
55 LOGFN(__FILE__, __LINE__, __FUNCTION__);
56 hint = ECORE_X_WINDOW_STATE_HINT_NONE;
57 XGetWindowProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
58 0, 0x7fffffff, False, ECORE_X_ATOM_WM_STATE,
59 &type_ret, &format_ret, &num_ret, &bytes_after,
60 &prop_ret);
61 if ((prop_ret) && (num_ret == 2))
62 {
63 if (prop_ret[0] == WithdrawnState)
64 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
65 else if (prop_ret[0] == NormalState)
66 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
67 else if (prop_ret[0] == IconicState)
68 hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
69 }
70
71 if (prop_ret)
72 XFree(prop_ret);
73
74 return hint;
75}
76
77EAPI void
78ecore_x_icccm_delete_window_send(Ecore_X_Window win,
79 Ecore_X_Time t)
80{
81 LOGFN(__FILE__, __LINE__, __FUNCTION__);
82 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
83 ECORE_X_EVENT_MASK_NONE,
84 ECORE_X_ATOM_WM_DELETE_WINDOW,
85 t, 0, 0, 0);
86}
87
88EAPI void
89ecore_x_icccm_take_focus_send(Ecore_X_Window win,
90 Ecore_X_Time t)
91{
92 LOGFN(__FILE__, __LINE__, __FUNCTION__);
93 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
94 ECORE_X_EVENT_MASK_NONE,
95 ECORE_X_ATOM_WM_TAKE_FOCUS,
96 t, 0, 0, 0);
97}
98
99EAPI void
100ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
101 Ecore_X_Time t)
102{
103 LOGFN(__FILE__, __LINE__, __FUNCTION__);
104 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
105 ECORE_X_EVENT_MASK_NONE,
106 ECORE_X_ATOM_WM_SAVE_YOURSELF,
107 t, 0, 0, 0);
108}
109
110EAPI void
111ecore_x_icccm_move_resize_send(Ecore_X_Window win,
112 int x,
113 int y,
114 int w,
115 int h)
116{
117 XEvent ev;
118
119 LOGFN(__FILE__, __LINE__, __FUNCTION__);
120 ev.type = ConfigureNotify;
121 ev.xconfigure.display = _ecore_x_disp;
122 ev.xconfigure.event = win;
123 ev.xconfigure.window = win;
124 ev.xconfigure.x = x;
125 ev.xconfigure.y = y;
126 ev.xconfigure.width = w;
127 ev.xconfigure.height = h;
128 ev.xconfigure.border_width = 0;
129 ev.xconfigure.above = None;
130 ev.xconfigure.override_redirect = False;
131 XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
132}
133
134EAPI void
135ecore_x_icccm_hints_set(Ecore_X_Window win,
136 Eina_Bool accepts_focus,
137 Ecore_X_Window_State_Hint initial_state,
138 Ecore_X_Pixmap icon_pixmap,
139 Ecore_X_Pixmap icon_mask,
140 Ecore_X_Window icon_window,
141 Ecore_X_Window window_group,
142 Eina_Bool is_urgent)
143{
144 XWMHints *hints;
145
146 hints = XAllocWMHints();
147 if (!hints)
148 return;
149
150 LOGFN(__FILE__, __LINE__, __FUNCTION__);
151 hints->flags = InputHint | StateHint;
152 hints->input = accepts_focus;
153 if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
154 hints->initial_state = WithdrawnState;
155 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
156 hints->initial_state = NormalState;
157 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
158 hints->initial_state = IconicState;
159
160 if (icon_pixmap != 0)
161 {
162 hints->icon_pixmap = icon_pixmap;
163 hints->flags |= IconPixmapHint;
164 }
165
166 if (icon_mask != 0)
167 {
168 hints->icon_mask = icon_mask;
169 hints->flags |= IconMaskHint;
170 }
171
172 if (icon_window != 0)
173 {
174 hints->icon_window = icon_window;
175 hints->flags |= IconWindowHint;
176 }
177
178 if (window_group != 0)
179 {
180 hints->window_group = window_group;
181 hints->flags |= WindowGroupHint;
182 }
183
184 if (is_urgent)
185 hints->flags |= XUrgencyHint;
186
187 XSetWMHints(_ecore_x_disp, win, hints);
188 XFree(hints);
189}
190
191EAPI Eina_Bool
192ecore_x_icccm_hints_get(Ecore_X_Window win,
193 Eina_Bool *accepts_focus,
194 Ecore_X_Window_State_Hint *initial_state,
195 Ecore_X_Pixmap *icon_pixmap,
196 Ecore_X_Pixmap *icon_mask,
197 Ecore_X_Window *icon_window,
198 Ecore_X_Window *window_group,
199 Eina_Bool *is_urgent)
200{
201 XWMHints *hints;
202
203 LOGFN(__FILE__, __LINE__, __FUNCTION__);
204 if (accepts_focus)
205 *accepts_focus = EINA_TRUE;
206
207 if (initial_state)
208 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
209
210 if (icon_pixmap)
211 *icon_pixmap = 0;
212
213 if (icon_mask)
214 *icon_mask = 0;
215
216 if (icon_window)
217 *icon_window = 0;
218
219 if (window_group)
220 *window_group = 0;
221
222 if (is_urgent)
223 *is_urgent = EINA_FALSE;
224
225 hints = XGetWMHints(_ecore_x_disp, win);
226 if (hints)
227 {
228 if ((hints->flags & InputHint) && (accepts_focus))
229 {
230 if (hints->input)
231 *accepts_focus = EINA_TRUE;
232 else
233 *accepts_focus = EINA_FALSE;
234 }
235
236 if ((hints->flags & StateHint) && (initial_state))
237 {
238 if (hints->initial_state == WithdrawnState)
239 *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
240 else if (hints->initial_state == NormalState)
241 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
242 else if (hints->initial_state == IconicState)
243 *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
244 }
245
246 if ((hints->flags & IconPixmapHint) && (icon_pixmap))
247 *icon_pixmap = hints->icon_pixmap;
248
249 if ((hints->flags & IconMaskHint) && (icon_mask))
250 *icon_mask = hints->icon_mask;
251
252 if ((hints->flags & IconWindowHint) && (icon_window))
253 *icon_window = hints->icon_window;
254
255 if ((hints->flags & WindowGroupHint) && (window_group))
256 *window_group = hints->window_group;
257
258 if ((hints->flags & XUrgencyHint) && (is_urgent))
259 *is_urgent = EINA_TRUE;
260
261 XFree(hints);
262 return EINA_TRUE;
263 }
264
265 return EINA_FALSE;
266}
267
268EAPI void
269ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
270 Eina_Bool request_pos,
271 Ecore_X_Gravity gravity,
272 int min_w,
273 int min_h,
274 int max_w,
275 int max_h,
276 int base_w,
277 int base_h,
278 int step_x,
279 int step_y,
280 double min_aspect,
281 double max_aspect)
282{
283 XSizeHints hint;
284 long mask;
285
286 LOGFN(__FILE__, __LINE__, __FUNCTION__);
287 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
288 memset(&hint, 0, sizeof(XSizeHints));
289
290 hint.flags = 0;
291 if (request_pos)
292 hint.flags |= USPosition;
293
294 if (gravity != ECORE_X_GRAVITY_NW)
295 {
296 hint.flags |= PWinGravity;
297 hint.win_gravity = gravity;
298 }
299
300 if ((min_w > 0) || (min_h > 0))
301 {
302 hint.flags |= PMinSize;
303 hint.min_width = min_w;
304 hint.min_height = min_h;
305 }
306
307 if ((max_w > 0) || (max_h > 0))
308 {
309 hint.flags |= PMaxSize;
310 hint.max_width = max_w;
311 hint.max_height = max_h;
312 }
313
314 if ((base_w > 0) || (base_h > 0))
315 {
316 hint.flags |= PBaseSize;
317 hint.base_width = base_w;
318 hint.base_height = base_h;
319 }
320
321 if ((step_x > 1) || (step_y > 1))
322 {
323 hint.flags |= PResizeInc;
324 hint.width_inc = step_x;
325 hint.height_inc = step_y;
326 }
327
328 if ((min_aspect > 0.0) || (max_aspect > 0.0))
329 {
330 hint.flags |= PAspect;
331 hint.min_aspect.x = min_aspect * 10000;
332 hint.min_aspect.y = 10000;
333 hint.max_aspect.x = max_aspect * 10000;
334 hint.max_aspect.y = 10000;
335 }
336
337 XSetWMNormalHints(_ecore_x_disp, win, &hint);
338}
339
340EAPI Eina_Bool
341ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
342 Eina_Bool *request_pos,
343 Ecore_X_Gravity *gravity,
344 int *min_w,
345 int *min_h,
346 int *max_w,
347 int *max_h,
348 int *base_w,
349 int *base_h,
350 int *step_x,
351 int *step_y,
352 double *min_aspect,
353 double *max_aspect)
354{
355 XSizeHints hint;
356 long mask;
357
358 int minw = 0, minh = 0;
359 int maxw = 32767, maxh = 32767;
360 int basew = -1, baseh = -1;
361 int stepx = -1, stepy = -1;
362 double mina = 0.0, maxa = 0.0;
363
364 LOGFN(__FILE__, __LINE__, __FUNCTION__);
365 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
366 return EINA_FALSE;
367
368 if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
369 {
370 if (request_pos)
371 *request_pos = EINA_TRUE;
372 }
373 else if (request_pos)
374 *request_pos = EINA_FALSE;
375
376 if (hint.flags & PWinGravity)
377 {
378 if (gravity)
379 *gravity = hint.win_gravity;
380 }
381 else if (gravity)
382 *gravity = ECORE_X_GRAVITY_NW;
383
384 if (hint.flags & PMinSize)
385 {
386 minw = hint.min_width;
387 minh = hint.min_height;
388 }
389
390 if (hint.flags & PMaxSize)
391 {
392 maxw = hint.max_width;
393 maxh = hint.max_height;
394 if (maxw < minw)
395 maxw = minw;
396
397 if (maxh < minh)
398 maxh = minh;
399 }
400
401 if (hint.flags & PBaseSize)
402 {
403 basew = hint.base_width;
404 baseh = hint.base_height;
405 if (basew > minw)
406 minw = basew;
407
408 if (baseh > minh)
409 minh = baseh;
410 }
411
412 if (hint.flags & PResizeInc)
413 {
414 stepx = hint.width_inc;
415 stepy = hint.height_inc;
416 if (stepx < 1)
417 stepx = 1;
418
419 if (stepy < 1)
420 stepy = 1;
421 }
422
423 if (hint.flags & PAspect)
424 {
425 if (hint.min_aspect.y > 0)
426 mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
427
428 if (hint.max_aspect.y > 0)
429 maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
430 }
431
432 if (min_w)
433 *min_w = minw;
434
435 if (min_h)
436 *min_h = minh;
437
438 if (max_w)
439 *max_w = maxw;
440
441 if (max_h)
442 *max_h = maxh;
443
444 if (base_w)
445 *base_w = basew;
446
447 if (base_h)
448 *base_h = baseh;
449
450 if (step_x)
451 *step_x = stepx;
452
453 if (step_y)
454 *step_y = stepy;
455
456 if (min_aspect)
457 *min_aspect = mina;
458
459 if (max_aspect)
460 *max_aspect = maxa;
461
462 return EINA_TRUE;
463}
464
465EAPI void
466ecore_x_icccm_title_set(Ecore_X_Window win,
467 const char *t)
468{
469 char *list[1];
470 XTextProperty xprop;
471 int ret;
472
473 if (!t)
474 return;
475
476 LOGFN(__FILE__, __LINE__, __FUNCTION__);
477 xprop.value = NULL;
478#ifdef X_HAVE_UTF8_STRING
479 list[0] = strdup(t);
480 ret =
481 Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
482 &xprop);
483#else /* ifdef X_HAVE_UTF8_STRING */
484 list[0] = strdup(t);
485 ret =
486 XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
487 &xprop);
488#endif /* ifdef X_HAVE_UTF8_STRING */
489 if (ret >= Success)
490 {
491 XSetWMName(_ecore_x_disp, win, &xprop);
492 if (xprop.value)
493 XFree(xprop.value);
494 }
495 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
496 {
497 XSetWMName(_ecore_x_disp, win, &xprop);
498 if (xprop.value)
499 XFree(xprop.value);
500 }
501
502 free(list[0]);
503}
504
505EAPI char *
506ecore_x_icccm_title_get(Ecore_X_Window win)
507{
508 XTextProperty xprop;
509
510 LOGFN(__FILE__, __LINE__, __FUNCTION__);
511 xprop.value = NULL;
512 if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success)
513 {
514 if (xprop.value)
515 {
516 char **list = NULL;
517 char *t = NULL;
518 int num = 0;
519 int ret;
520
521 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
522 t = strdup((char *)xprop.value);
523 else
524 {
525 /* convert to utf8 */
526#ifdef X_HAVE_UTF8_STRING
527 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
528 &list, &num);
529#else /* ifdef X_HAVE_UTF8_STRING */
530 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
531 &list, &num);
532#endif /* ifdef X_HAVE_UTF8_STRING */
533
534 if ((ret == XLocaleNotSupported) ||
535 (ret == XNoMemory) || (ret == XConverterNotFound))
536 t = strdup((char *)xprop.value);
537 else if ((ret >= Success) && (num > 0))
538 t = strdup(list[0]);
539
540 if (list)
541 XFreeStringList(list);
542 }
543
544 if (xprop.value)
545 XFree(xprop.value);
546
547 return t;
548 }
549 }
550
551 return NULL;
552}
553
554/**
555 * Set protocol atoms explicitly
556 * @param win The Window
557 * @param protos An array of protocol atoms
558 * @param num the number of members of the array
559 */
560EAPI void
561ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
562 Ecore_X_Atom *protos,
563 int num)
564{
565 LOGFN(__FILE__, __LINE__, __FUNCTION__);
566 if (num > 0)
567 XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
568 else
569 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
570}
571
572/**
573 * Set or unset a wm protocol property.
574 * @param win The Window
575 * @param protocol The protocol to enable/disable
576 * @param on On/Off
577 */
578EAPI void
579ecore_x_icccm_protocol_set(Ecore_X_Window win,
580 Ecore_X_WM_Protocol protocol,
581 Eina_Bool on)
582{
583 Atom *protos = NULL;
584 Atom proto;
585 int protos_count = 0;
586 int already_set = 0;
587 int i;
588
589 /* Check for invalid values */
590 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
591 return;
592
593 LOGFN(__FILE__, __LINE__, __FUNCTION__);
594 proto = _ecore_x_atoms_wm_protocols[protocol];
595
596 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
597 {
598 protos = NULL;
599 protos_count = 0;
600 }
601
602 for (i = 0; i < protos_count; i++)
603 {
604 if (protos[i] == proto)
605 {
606 already_set = 1;
607 break;
608 }
609 }
610
611 if (on)
612 {
613 Atom *new_protos = NULL;
614
615 if (already_set)
616 goto leave;
617
618 new_protos = malloc((protos_count + 1) * sizeof(Atom));
619 if (!new_protos)
620 goto leave;
621
622 for (i = 0; i < protos_count; i++)
623 new_protos[i] = protos[i];
624 new_protos[protos_count] = proto;
625 XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
626 free(new_protos);
627 }
628 else
629 {
630 if (!already_set)
631 goto leave;
632
633 for (i = 0; i < protos_count; i++)
634 {
635 if (protos[i] == proto)
636 {
637 int j;
638
639 for (j = i + 1; j < protos_count; j++)
640 protos[j - 1] = protos[j];
641 if (protos_count > 1)
642 XSetWMProtocols(_ecore_x_disp, win, protos,
643 protos_count - 1);
644 else
645 XDeleteProperty(_ecore_x_disp, win,
646 ECORE_X_ATOM_WM_PROTOCOLS);
647
648 goto leave;
649 }
650 }
651 }
652
653leave:
654 if (protos)
655 XFree(protos);
656}
657
658/**
659 * Determines whether a protocol is set for a window.
660 * @param win The Window
661 * @param protocol The protocol to query
662 * @return 1 if the protocol is set, else 0.
663 */
664EAPI Eina_Bool
665ecore_x_icccm_protocol_isset(Ecore_X_Window win,
666 Ecore_X_WM_Protocol protocol)
667{
668 Atom proto, *protos = NULL;
669 int i, protos_count = 0;
670 Eina_Bool ret = EINA_FALSE;
671
672 /* check for invalid values */
673 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
674 return EINA_FALSE;
675
676 LOGFN(__FILE__, __LINE__, __FUNCTION__);
677 proto = _ecore_x_atoms_wm_protocols[protocol];
678
679 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
680 return EINA_FALSE;
681
682 for (i = 0; i < protos_count; i++)
683 if (protos[i] == proto)
684 {
685 ret = EINA_TRUE;
686 break;
687 }
688
689 if (protos)
690 XFree(protos);
691
692 return ret;
693}
694
695/**
696 * Set a window name & class.
697 * @param win The window
698 * @param n The name string
699 * @param c The class string
700 *
701 * Set a window name * class
702 */
703EAPI void
704ecore_x_icccm_name_class_set(Ecore_X_Window win,
705 const char *n,
706 const char *c)
707{
708 XClassHint *xch;
709
710 xch = XAllocClassHint();
711 if (!xch)
712 return;
713
714 LOGFN(__FILE__, __LINE__, __FUNCTION__);
715 xch->res_name = (char *)n;
716 xch->res_class = (char *)c;
717 XSetClassHint(_ecore_x_disp, win, xch);
718 XFree(xch);
719}
720
721/**
722 * Get a window name & class.
723 * @param win The window
724 * @param n The name string
725 * @param c The class string
726 *
727 * Get a window name * class
728 */
729EAPI void
730ecore_x_icccm_name_class_get(Ecore_X_Window win,
731 char **n,
732 char **c)
733{
734 XClassHint xch;
735
736 LOGFN(__FILE__, __LINE__, __FUNCTION__);
737 if (n)
738 *n = NULL;
739
740 if (c)
741 *c = NULL;
742
743 xch.res_name = NULL;
744 xch.res_class = NULL;
745 if (XGetClassHint(_ecore_x_disp, win, &xch))
746 {
747 if (n)
748 if (xch.res_name)
749 *n = strdup(xch.res_name);
750
751 if (c)
752 if (xch.res_class)
753 *c = strdup(xch.res_class);
754
755 XFree(xch.res_name);
756 XFree(xch.res_class);
757 }
758}
759
760/**
761 * Get a window client machine string.
762 * @param win The window
763 * @return The windows client machine string
764 *
765 * Return the client machine of a window. String must be free'd when done with.
766 */
767EAPI char *
768ecore_x_icccm_client_machine_get(Ecore_X_Window win)
769{
770 char *name;
771
772 LOGFN(__FILE__, __LINE__, __FUNCTION__);
773 name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
774 return name;
775}
776
777/**
778 * Sets the WM_COMMAND property for @a win.
779 *
780 * @param win The window.
781 * @param argc Number of arguments.
782 * @param argv Arguments.
783 */
784EAPI void
785ecore_x_icccm_command_set(Ecore_X_Window win,
786 int argc,
787 char **argv)
788{
789 LOGFN(__FILE__, __LINE__, __FUNCTION__);
790 XSetCommand(_ecore_x_disp, win, argv, argc);
791}
792
793/**
794 * Get the WM_COMMAND property for @a win.
795 *
796 * Return the command of a window. String must be free'd when done with.
797 *
798 * @param win The window.
799 * @param argc Number of arguments.
800 * @param argv Arguments.
801 */
802EAPI void
803ecore_x_icccm_command_get(Ecore_X_Window win,
804 int *argc,
805 char ***argv)
806{
807 int i, c;
808 char **v;
809
810 if (argc)
811 *argc = 0;
812
813 if (argv)
814 *argv = NULL;
815
816 LOGFN(__FILE__, __LINE__, __FUNCTION__);
817 if (!XGetCommand(_ecore_x_disp, win, &v, &c))
818 return;
819
820 if (c < 1)
821 {
822 if (v)
823 XFreeStringList(v);
824
825 return;
826 }
827
828 if (argc)
829 *argc = c;
830
831 if (argv)
832 {
833 (*argv) = malloc(c * sizeof(char *));
834 if (!*argv)
835 {
836 XFreeStringList(v);
837 if (argc)
838 *argc = 0;
839
840 return;
841 }
842
843 for (i = 0; i < c; i++)
844 {
845 if (v[i])
846 (*argv)[i] = strdup(v[i]);
847 else
848 (*argv)[i] = strdup("");
849 }
850 }
851
852 XFreeStringList(v);
853}
854
855/**
856 * Set a window icon name.
857 * @param win The window
858 * @param t The icon name string
859 *
860 * Set a window icon name
861 */
862EAPI void
863ecore_x_icccm_icon_name_set(Ecore_X_Window win,
864 const char *t)
865{
866 char *list[1];
867 XTextProperty xprop;
868 int ret;
869
870 LOGFN(__FILE__, __LINE__, __FUNCTION__);
871 xprop.value = NULL;
872#ifdef X_HAVE_UTF8_STRING
873 list[0] = strdup(t);
874 ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1,
875 XUTF8StringStyle, &xprop);
876#else /* ifdef X_HAVE_UTF8_STRING */
877 list[0] = strdup(t);
878 ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1,
879 XStdICCTextStyle, &xprop);
880#endif /* ifdef X_HAVE_UTF8_STRING */
881 if (ret >= Success)
882 {
883 XSetWMIconName(_ecore_x_disp, win, &xprop);
884 if (xprop.value)
885 XFree(xprop.value);
886 }
887 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
888 {
889 XSetWMIconName(_ecore_x_disp, win, &xprop);
890 if (xprop.value)
891 XFree(xprop.value);
892 }
893
894 free(list[0]);
895}
896
897/**
898 * Get a window icon name.
899 * @param win The window
900 * @return The windows icon name string
901 *
902 * Return the icon name of a window. String must be free'd when done with.
903 */
904EAPI char *
905ecore_x_icccm_icon_name_get(Ecore_X_Window win)
906{
907 XTextProperty xprop;
908
909 LOGFN(__FILE__, __LINE__, __FUNCTION__);
910 xprop.value = NULL;
911 if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success)
912 {
913 if (xprop.value)
914 {
915 char **list = NULL;
916 char *t = NULL;
917 int num = 0;
918 int ret;
919
920 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
921 t = strdup((char *)xprop.value);
922 else
923 {
924 /* convert to utf8 */
925#ifdef X_HAVE_UTF8_STRING
926 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
927 &list, &num);
928#else /* ifdef X_HAVE_UTF8_STRING */
929 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
930 &list, &num);
931#endif /* ifdef X_HAVE_UTF8_STRING */
932
933 if ((ret == XLocaleNotSupported) ||
934 (ret == XNoMemory) || (ret == XConverterNotFound))
935 t = strdup((char *)xprop.value);
936 else if (ret >= Success)
937 {
938 if ((num >= 1) && (list))
939 t = strdup(list[0]);
940
941 if (list)
942 XFreeStringList(list);
943 }
944 }
945
946 if (xprop.value)
947 XFree(xprop.value);
948
949 return t;
950 }
951 }
952
953 return NULL;
954}
955
956/**
957 * Add a subwindow to the list of windows that need a different colormap installed.
958 * @param win The toplevel window
959 * @param subwin The subwindow to be added to the colormap windows list
960 */
961EAPI void
962ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
963 Ecore_X_Window subwin)
964{
965 int num = 0, i;
966 unsigned char *old_data = NULL;
967 unsigned char *data = NULL;
968 Window *oldset = NULL;
969 Window *newset = NULL;
970
971 LOGFN(__FILE__, __LINE__, __FUNCTION__);
972 if (!ecore_x_window_prop_property_get(win,
973 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
974 XA_WINDOW, 32, &old_data, &num))
975 {
976 newset = calloc(1, sizeof(Window));
977 if (!newset)
978 return;
979
980 newset[0] = subwin;
981 num = 1;
982 data = (unsigned char *)newset;
983 }
984 else
985 {
986 newset = calloc(num + 1, sizeof(Window));
987 oldset = (Window *)old_data;
988 if (!newset)
989 return;
990
991 for (i = 0; i < num; ++i)
992 {
993 if (oldset[i] == subwin)
994 {
995 if (old_data)
996 XFree(old_data);
997
998 old_data = NULL;
999 free(newset);
1000 return;
1001 }
1002
1003 newset[i] = oldset[i];
1004 }
1005
1006 newset[num++] = subwin;
1007 if (old_data)
1008 XFree(old_data);
1009
1010 data = (unsigned char *)newset;
1011 }
1012
1013 ecore_x_window_prop_property_set(win,
1014 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1015 XA_WINDOW, 32, data, num);
1016 free(newset);
1017}
1018
1019/**
1020 * Remove a window from the list of colormap windows.
1021 * @param win The toplevel window
1022 * @param subwin The window to be removed from the colormap window list.
1023 */
1024EAPI void
1025ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
1026 Ecore_X_Window subwin)
1027{
1028 int num = 0, i, j, k = 0;
1029 unsigned char *old_data = NULL;
1030 unsigned char *data = NULL;
1031 Window *oldset = NULL;
1032 Window *newset = NULL;
1033
1034 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1035 if (!ecore_x_window_prop_property_get(win,
1036 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1037 XA_WINDOW, 32, &old_data, &num))
1038 return;
1039
1040 oldset = (Window *)old_data;
1041 for (i = 0; i < num; i++)
1042 {
1043 if (oldset[i] == subwin)
1044 {
1045 if (num == 1)
1046 {
1047 XDeleteProperty(_ecore_x_disp,
1048 win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
1049 if (old_data)
1050 XFree(old_data);
1051
1052 old_data = NULL;
1053 return;
1054 }
1055 else
1056 {
1057 newset = calloc(num - 1, sizeof(Window));
1058 data = (unsigned char *)newset;
1059 for (j = 0; j < num; ++j)
1060 if (oldset[j] != subwin)
1061 newset[k++] = oldset[j];
1062
1063 ecore_x_window_prop_property_set(
1064 win,
1065 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1066 XA_WINDOW,
1067 32,
1068 data,
1069 k);
1070 if (old_data)
1071 XFree(old_data);
1072
1073 old_data = NULL;
1074 free(newset);
1075 return;
1076 }
1077 }
1078 }
1079
1080 if (old_data)
1081 XFree(old_data);
1082}
1083
1084/**
1085 * Specify that a window is transient for another top-level window and should be handled accordingly.
1086 * @param win the transient window
1087 * @param forwin the toplevel window
1088 */
1089EAPI void
1090ecore_x_icccm_transient_for_set(Ecore_X_Window win,
1091 Ecore_X_Window forwin)
1092{
1093 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1094 XSetTransientForHint(_ecore_x_disp, win, forwin);
1095}
1096
1097/**
1098 * Remove the transient_for setting from a window.
1099 * @param win The window
1100 */
1101EAPI void
1102ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
1103{
1104 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1105 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
1106}
1107
1108/**
1109 * Get the window this window is transient for, if any.
1110 * @param win The window to check
1111 * @return The window ID of the top-level window, or 0 if the property does not exist.
1112 */
1113EAPI Ecore_X_Window
1114ecore_x_icccm_transient_for_get(Ecore_X_Window win)
1115{
1116 Window forwin;
1117
1118 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1119 if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
1120 return (Ecore_X_Window)forwin;
1121 else
1122 return 0;
1123}
1124
1125/**
1126 * Set the window role hint.
1127 * @param win The window
1128 * @param role The role string
1129 */
1130EAPI void
1131ecore_x_icccm_window_role_set(Ecore_X_Window win,
1132 const char *role)
1133{
1134 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1135 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
1136 (char *)role);
1137}
1138
1139/**
1140 * Get the window role.
1141 * @param win The window
1142 * @return The window's role string.
1143 */
1144EAPI char *
1145ecore_x_icccm_window_role_get(Ecore_X_Window win)
1146{
1147 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1148 return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
1149}
1150
1151/**
1152 * Set the window's client leader.
1153 * @param win The window
1154 * @param l The client leader window
1155 *
1156 * All non-transient top-level windows created by an app other than
1157 * the main window must have this property set to the app's main window.
1158 */
1159EAPI void
1160ecore_x_icccm_client_leader_set(Ecore_X_Window win,
1161 Ecore_X_Window l)
1162{
1163 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1164 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1165 &l, 1);
1166}
1167
1168/**
1169 * Get the window's client leader.
1170 * @param win The window
1171 * @return The window's client leader window, or 0 if unset */
1172EAPI Ecore_X_Window
1173ecore_x_icccm_client_leader_get(Ecore_X_Window win)
1174{
1175 Ecore_X_Window l;
1176
1177 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1178 if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1179 &l, 1) > 0)
1180 return l;
1181
1182 return 0;
1183}
1184
1185EAPI void
1186ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
1187 Ecore_X_Window root)
1188{
1189 XEvent xev;
1190
1191 if (!win)
1192 return;
1193
1194 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1195 if (!root)
1196 root = DefaultRootWindow(_ecore_x_disp);
1197
1198 xev.xclient.type = ClientMessage;
1199 xev.xclient.serial = 0;
1200 xev.xclient.send_event = True;
1201 xev.xclient.display = _ecore_x_disp;
1202 xev.xclient.window = win;
1203 xev.xclient.format = 32;
1204 xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
1205 xev.xclient.data.l[0] = IconicState;
1206
1207 XSendEvent(_ecore_x_disp, root, False,
1208 SubstructureNotifyMask | SubstructureRedirectMask, &xev);
1209}
1210
1211/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
1212/* hints. each should go in their own file/section so we know which */
1213/* is which. also older kde hints too. we should try support as much */
1214/* 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
deleted file mode 100644
index b8e720c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c
+++ /dev/null
@@ -1,600 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <string.h>
7#include <sys/ipc.h>
8#include <sys/shm.h>
9
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12
13#include <X11/extensions/XShm.h>
14#include <X11/Xutil.h>
15
16static int _ecore_x_image_shm_can = -1;
17static int _ecore_x_image_err = 0;
18
19static int
20_ecore_x_image_error_handler(Display *d __UNUSED__,
21 XErrorEvent *ev __UNUSED__)
22{
23 _ecore_x_image_err = 1;
24 return 0;
25}
26
27static void
28_ecore_x_image_shm_check(void)
29{
30 XErrorHandler ph;
31 XShmSegmentInfo shminfo;
32 XImage *xim;
33
34 if (_ecore_x_image_shm_can != -1)
35 return;
36
37 XSync(_ecore_x_disp, False);
38 _ecore_x_image_err = 0;
39
40 xim = XShmCreateImage(_ecore_x_disp,
41 DefaultVisual(_ecore_x_disp,
42 DefaultScreen(_ecore_x_disp)),
43 DefaultDepth(_ecore_x_disp,
44 DefaultScreen(_ecore_x_disp)),
45 ZPixmap, NULL,
46 &shminfo, 1, 1);
47 if (!xim)
48 {
49 _ecore_x_image_shm_can = 0;
50 return;
51 }
52
53 shminfo.shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height,
54 IPC_CREAT | 0666);
55 if (shminfo.shmid == -1)
56 {
57 XDestroyImage(xim);
58 _ecore_x_image_shm_can = 0;
59 return;
60 }
61
62 shminfo.readOnly = False;
63 shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
64 xim->data = shminfo.shmaddr;
65
66 if (xim->data == (char *)-1)
67 {
68 XDestroyImage(xim);
69 _ecore_x_image_shm_can = 0;
70 return;
71 }
72
73 ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler);
74 XShmAttach(_ecore_x_disp, &shminfo);
75 XShmGetImage(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp),
76 xim, 0, 0, 0xffffffff);
77 XSync(_ecore_x_disp, False);
78 XSetErrorHandler((XErrorHandler)ph);
79 if (_ecore_x_image_err)
80 {
81 XShmDetach(_ecore_x_disp, &shminfo);
82 XDestroyImage(xim);
83 shmdt(shminfo.shmaddr);
84 shmctl(shminfo.shmid, IPC_RMID, 0);
85 _ecore_x_image_shm_can = 0;
86 return;
87 }
88
89 XShmDetach(_ecore_x_disp, &shminfo);
90 XDestroyImage(xim);
91 shmdt(shminfo.shmaddr);
92 shmctl(shminfo.shmid, IPC_RMID, 0);
93
94 _ecore_x_image_shm_can = 1;
95}
96
97struct _Ecore_X_Image
98{
99 XShmSegmentInfo shminfo;
100 Ecore_X_Visual vis;
101 XImage *xim;
102 int depth;
103 int w, h;
104 int bpl, bpp, rows;
105 unsigned char *data;
106 Eina_Bool shm : 1;
107};
108
109EAPI Ecore_X_Image *
110ecore_x_image_new(int w,
111 int h,
112 Ecore_X_Visual vis,
113 int depth)
114{
115 Ecore_X_Image *im;
116
117 im = calloc(1, sizeof(Ecore_X_Image));
118 if (!im)
119 return NULL;
120
121 LOGFN(__FILE__, __LINE__, __FUNCTION__);
122 im->w = w;
123 im->h = h;
124 im->vis = vis;
125 im->depth = depth;
126 _ecore_x_image_shm_check();
127 im->shm = _ecore_x_image_shm_can;
128 return im;
129}
130
131EAPI void
132ecore_x_image_free(Ecore_X_Image *im)
133{
134 LOGFN(__FILE__, __LINE__, __FUNCTION__);
135 if (im->shm)
136 {
137 if (im->xim)
138 {
139 XShmDetach(_ecore_x_disp, &(im->shminfo));
140 XDestroyImage(im->xim);
141 shmdt(im->shminfo.shmaddr);
142 shmctl(im->shminfo.shmid, IPC_RMID, 0);
143 }
144 }
145 else if (im->xim)
146 {
147 free(im->xim->data);
148 im->xim->data = NULL;
149 XDestroyImage(im->xim);
150 }
151
152 free(im);
153}
154
155static void
156_ecore_x_image_shm_create(Ecore_X_Image *im)
157{
158 im->xim = XShmCreateImage(_ecore_x_disp, im->vis, im->depth,
159 ZPixmap, NULL, &(im->shminfo),
160 im->w, im->h);
161 if (!im->xim)
162 return;
163
164 im->shminfo.shmid = shmget(IPC_PRIVATE,
165 im->xim->bytes_per_line * im->xim->height,
166 IPC_CREAT | 0666);
167 if (im->shminfo.shmid == -1)
168 {
169 XDestroyImage(im->xim);
170 return;
171 }
172
173 im->shminfo.readOnly = False;
174 im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0);
175 im->xim->data = im->shminfo.shmaddr;
176 if ((im->xim->data == (char *)-1) ||
177 (!im->xim->data))
178 {
179 shmdt(im->shminfo.shmaddr);
180 shmctl(im->shminfo.shmid, IPC_RMID, 0);
181 XDestroyImage(im->xim);
182 return;
183 }
184
185 XShmAttach(_ecore_x_disp, &im->shminfo);
186
187 im->data = (unsigned char *)im->xim->data;
188
189 im->bpl = im->xim->bytes_per_line;
190 im->rows = im->xim->height;
191 if (im->xim->bits_per_pixel <= 8)
192 im->bpp = 1;
193 else if (im->xim->bits_per_pixel <= 16)
194 im->bpp = 2;
195 else
196 im->bpp = 4;
197}
198
199EAPI Eina_Bool
200ecore_x_image_get(Ecore_X_Image *im,
201 Ecore_X_Drawable draw,
202 int x,
203 int y,
204 int sx,
205 int sy,
206 int w,
207 int h)
208{
209 Eina_Bool ret = EINA_TRUE;
210 XErrorHandler ph;
211
212 LOGFN(__FILE__, __LINE__, __FUNCTION__);
213 if (im->shm)
214 {
215 if (!im->xim)
216 _ecore_x_image_shm_create(im);
217
218 if (!im->xim)
219 return 0;
220
221 _ecore_x_image_err = 0;
222 // optimised path
223 ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler);
224 if ((sx == 0) && (w == im->w))
225 {
226 im->xim->data = (char *)
227 im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp);
228 im->xim->width = w;
229 im->xim->height = h;
230 XGrabServer(_ecore_x_disp);
231 if (!XShmGetImage(_ecore_x_disp, draw, im->xim, x, y, 0xffffffff))
232 ret = EINA_FALSE;
233 XUngrabServer(_ecore_x_disp);
234 ecore_x_sync();
235 }
236 // unavoidable thanks to mit-shm get api - tmp shm buf + copy into it
237 else
238 {
239 Ecore_X_Image *tim;
240 unsigned char *spixels, *sp, *pixels, *p;
241 int bpp, bpl, rows, sbpp, sbpl, srows;
242 int r;
243
244 tim = ecore_x_image_new(w, h, im->vis, im->depth);
245 if (tim)
246 {
247 ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h);
248 if (ret)
249 {
250 spixels = ecore_x_image_data_get(tim,
251 &sbpl,
252 &srows,
253 &sbpp);
254 pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
255 if ((pixels) && (spixels))
256 {
257 p = pixels + (sy * bpl) + (sx * bpp);
258 sp = spixels;
259 for (r = srows; r > 0; r--)
260 {
261 memcpy(p, sp, sbpl);
262 p += bpl;
263 sp += sbpl;
264 }
265 }
266 }
267
268 ecore_x_image_free(tim);
269 }
270 }
271
272 XSetErrorHandler((XErrorHandler)ph);
273 if (_ecore_x_image_err)
274 ret = EINA_FALSE;
275 }
276 else
277 {
278 printf("currently unimplemented ecore_x_image_get without shm\n");
279 ret = EINA_FALSE;
280 }
281
282 return ret;
283}
284
285EAPI void
286ecore_x_image_put(Ecore_X_Image *im,
287 Ecore_X_Drawable draw,
288 Ecore_X_GC gc,
289 int x,
290 int y,
291 int sx,
292 int sy,
293 int w,
294 int h)
295{
296 Ecore_X_GC tgc = 0;
297
298 LOGFN(__FILE__, __LINE__, __FUNCTION__);
299 if (!gc)
300 {
301 XGCValues gcv;
302 memset(&gcv, 0, sizeof(gcv));
303 gcv.subwindow_mode = IncludeInferiors;
304 tgc = XCreateGC(_ecore_x_disp, draw, GCSubwindowMode, &gcv);
305 gc = tgc;
306 }
307 if (!im->xim) _ecore_x_image_shm_create(im);
308 if (im->xim)
309 XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False);
310 if (tgc) ecore_x_gc_free(tgc);
311}
312
313EAPI void *
314ecore_x_image_data_get(Ecore_X_Image *im,
315 int *bpl,
316 int *rows,
317 int *bpp)
318{
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320 if (!im->xim) _ecore_x_image_shm_create(im);
321 if (!im->xim) return NULL;
322 if (bpl) *bpl = im->bpl;
323 if (rows) *rows = im->rows;
324 if (bpp) *bpp = im->bpp;
325 return im->data;
326}
327
328EAPI Eina_Bool
329ecore_x_image_is_argb32_get(Ecore_X_Image *im)
330{
331 Visual *vis = im->vis;
332 if (!im->xim) _ecore_x_image_shm_create(im);
333 if (((vis->class == TrueColor) ||
334 (vis->class == DirectColor)) &&
335 (im->depth >= 24) &&
336 (vis->red_mask == 0xff0000) &&
337 (vis->green_mask == 0x00ff00) &&
338 (vis->blue_mask == 0x0000ff))
339 {
340#ifdef WORDS_BIGENDIAN
341 if (im->xim->bitmap_bit_order == LSBFirst) return EINA_TRUE;
342#else
343 if (im->xim->bitmap_bit_order == MSBFirst) return EINA_TRUE;
344#endif
345 }
346 return EINA_FALSE;
347}
348
349EAPI Eina_Bool
350ecore_x_image_to_argb_convert(void *src,
351 int sbpp,
352 int sbpl,
353 Ecore_X_Colormap c,
354 Ecore_X_Visual v,
355 int x,
356 int y,
357 int w,
358 int h,
359 unsigned int *dst,
360 int dbpl,
361 int dx,
362 int dy)
363{
364 Visual *vis = v;
365 XColor *cols = NULL;
366 int n = 0, nret = 0, i, row;
367 unsigned int pal[256], r, g, b;
368 enum
369 {
370 rgbnone = 0,
371 rgb565,
372 bgr565,
373 rgbx555,
374 argbx888,
375 abgrx888,
376 rgba888x,
377 bgra888x,
378 argbx666
379 };
380 int mode = 0;
381
382 sbpp *= 8;
383
384 n = vis->map_entries;
385 if ((n <= 256) &&
386 ((vis->class == PseudoColor) ||
387 (vis->class == StaticColor) ||
388 (vis->class == GrayScale) ||
389 (vis->class == StaticGray)))
390 {
391 if (!c)
392 c = DefaultColormap(_ecore_x_disp,
393 DefaultScreen(_ecore_x_disp));
394 cols = alloca(n * sizeof(XColor));
395 for (i = 0; i < n; i++)
396 {
397 cols[i].pixel = i;
398 cols[i].flags = DoRed | DoGreen | DoBlue;
399 cols[i].red = 0;
400 cols[i].green = 0;
401 cols[i].blue = 0;
402 }
403 XQueryColors(_ecore_x_disp, c, cols, n);
404 for (i = 0; i < n; i++)
405 {
406 pal[i] = 0xff000000 |
407 ((cols[i].red >> 8) << 16) |
408 ((cols[i].green >> 8) << 8) |
409 ((cols[i].blue >> 8));
410 }
411 nret = n;
412 }
413 else if ((vis->class == TrueColor) ||
414 (vis->class == DirectColor))
415 {
416 if ((vis->red_mask == 0x00ff0000) &&
417 (vis->green_mask == 0x0000ff00) &&
418 (vis->blue_mask == 0x000000ff))
419 mode = argbx888;
420 else if ((vis->red_mask == 0x000000ff) &&
421 (vis->green_mask == 0x0000ff00) &&
422 (vis->blue_mask == 0x00ff0000))
423 mode = abgrx888;
424 else if ((vis->red_mask == 0xff000000) &&
425 (vis->green_mask == 0x00ff0000) &&
426 (vis->blue_mask == 0x0000ff00))
427 mode = rgba888x;
428 else if ((vis->red_mask == 0x0000ff00) &&
429 (vis->green_mask == 0x00ff0000) &&
430 (vis->blue_mask == 0xff000000))
431 mode = bgra888x;
432 else if ((vis->red_mask == 0x0003f000) &&
433 (vis->green_mask == 0x00000fc0) &&
434 (vis->blue_mask == 0x0000003f))
435 mode = argbx666;
436 else if ((vis->red_mask == 0x0000f800) &&
437 (vis->green_mask == 0x000007e0) &&
438 (vis->blue_mask == 0x0000001f))
439 mode = rgb565;
440 else if ((vis->red_mask == 0x0000001f) &&
441 (vis->green_mask == 0x000007e0) &&
442 (vis->blue_mask == 0x0000f800))
443 mode = bgr565;
444 else if ((vis->red_mask == 0x00007c00) &&
445 (vis->green_mask == 0x000003e0) &&
446 (vis->blue_mask == 0x0000001f))
447 mode = rgbx555;
448 else
449 return EINA_FALSE;
450 }
451 for (row = 0; row < h; row++)
452 {
453 unsigned char *s8;
454 unsigned short *s16;
455 unsigned int *s32;
456 unsigned int *dp, *de;
457
458 dp = ((unsigned int *)(((unsigned char *)dst) +
459 ((dy + row) * dbpl))) + dx;
460 de = dp + w;
461 switch (sbpp)
462 {
463 case 8:
464 s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + x;
465 if (nret > 0)
466 {
467 while (dp < de)
468 {
469 *dp = pal[*s8];
470 s8++; dp++;
471 }
472 }
473 else
474 return EINA_FALSE;
475 break;
476
477 case 16:
478 s16 = ((unsigned short *)(((unsigned char *)src) + ((y + row) * sbpl))) + x;
479 switch (mode)
480 {
481 case rgb565:
482 while (dp < de)
483 {
484 r = (*s16 & 0xf800) << 8;
485 g = (*s16 & 0x07e0) << 5;
486 b = (*s16 & 0x001f) << 3;
487 r |= (r >> 5) & 0xff0000;
488 g |= (g >> 6) & 0x00ff00;
489 b |= (b >> 5);
490 *dp = 0xff000000 | r | g | b;
491 s16++; dp++;
492 }
493 break;
494
495 case bgr565:
496 while (dp < de)
497 {
498 r = (*s16 & 0x001f) << 19;
499 g = (*s16 & 0x07e0) << 5;
500 b = (*s16 & 0xf800) >> 8;
501 r |= (r >> 5) & 0xff0000;
502 g |= (g >> 6) & 0x00ff00;
503 b |= (b >> 5);
504 *dp = 0xff000000 | r | g | b;
505 s16++; dp++;
506 }
507 break;
508
509 case rgbx555:
510 while (dp < de)
511 {
512 r = (*s16 & 0x7c00) << 9;
513 g = (*s16 & 0x03e0) << 6;
514 b = (*s16 & 0x001f) << 3;
515 r |= (r >> 5) & 0xff0000;
516 g |= (g >> 5) & 0x00ff00;
517 b |= (b >> 5);
518 *dp = 0xff000000 | r | g | b;
519 s16++; dp++;
520 }
521 break;
522
523 default:
524 return EINA_FALSE;
525 break;
526 }
527 break;
528
529 case 24:
530 case 32:
531 s32 = ((unsigned int *)(((unsigned char *)src) + ((y + row) * sbpl))) + x;
532 switch (mode)
533 {
534 case argbx888:
535 while (dp < de)
536 {
537 *dp = 0xff000000 | *s32;
538 s32++; dp++;
539 }
540 break;
541
542 case abgrx888:
543 while (dp < de)
544 {
545 r = *s32 & 0x000000ff;
546 g = *s32 & 0x0000ff00;
547 b = *s32 & 0x00ff0000;
548 *dp = 0xff000000 | (r << 16) | (g) | (b >> 16);
549 s32++; dp++;
550 }
551 break;
552
553 case rgba888x:
554 while (dp < de)
555 {
556 *dp = 0xff000000 | (*s32 >> 8);
557 s32++; dp++;
558 }
559 break;
560
561 case bgra888x:
562 while (dp < de)
563 {
564 r = *s32 & 0x0000ff00;
565 g = *s32 & 0x00ff0000;
566 b = *s32 & 0xff000000;
567 *dp = 0xff000000 | (r << 8) | (g >> 8) | (b >> 24);
568 s32++; dp++;
569 }
570 break;
571
572 case argbx666:
573 while (dp < de)
574 {
575 r = (*s32 & 0x3f000) << 6;
576 g = (*s32 & 0x00fc0) << 4;
577 b = (*s32 & 0x0003f) << 2;
578 r |= (r >> 6) & 0xff0000;
579 g |= (g >> 6) & 0x00ff00;
580 b |= (b >> 6);
581 *dp = 0xff000000 | r | g | b;
582 s32++; dp++;
583 }
584 break;
585
586 default:
587 return EINA_FALSE;
588 break;
589 }
590 break;
591 break;
592
593 default:
594 return EINA_FALSE;
595 break;
596 }
597 }
598 return EINA_TRUE;
599}
600
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
deleted file mode 100644
index 7812cc2..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * Various MWM related functions.
3 *
4 * This is ALL the code involving anything MWM related. for both WM and
5 * client.
6 */
7
8#ifdef HAVE_CONFIG_H
9# include <config.h>
10#endif /* ifdef HAVE_CONFIG_H */
11
12#include <stdlib.h>
13
14#include "Ecore.h"
15#include "ecore_x_private.h"
16#include "Ecore_X.h"
17#include "Ecore_X_Atoms.h"
18
19#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
20#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
21#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
22#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
23
24typedef struct _mwmhints
25{
26 CARD32 flags;
27 CARD32 functions;
28 CARD32 decorations;
29 INT32 inputmode;
30 CARD32 status;
31}
32MWMHints;
33
34EAPI Eina_Bool
35ecore_x_mwm_hints_get(Ecore_X_Window win,
36 Ecore_X_MWM_Hint_Func *fhint,
37 Ecore_X_MWM_Hint_Decor *dhint,
38 Ecore_X_MWM_Hint_Input *ihint)
39{
40 unsigned char *p = NULL;
41 MWMHints *mwmhints = NULL;
42 int num;
43 Eina_Bool ret;
44
45 LOGFN(__FILE__, __LINE__, __FUNCTION__);
46 ret = EINA_FALSE;
47 if (!ecore_x_window_prop_property_get(win,
48 ECORE_X_ATOM_MOTIF_WM_HINTS,
49 ECORE_X_ATOM_MOTIF_WM_HINTS,
50 32, &p, &num))
51 return EINA_FALSE;
52
53 mwmhints = (MWMHints *)p;
54 if (mwmhints)
55 {
56 if (num >= 4)
57 {
58 if (dhint)
59 {
60 if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
61 *dhint = mwmhints->decorations;
62 else
63 *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
64 }
65
66 if (fhint)
67 {
68 if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
69 *fhint = mwmhints->functions;
70 else
71 *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
72 }
73
74 if (ihint)
75 {
76 if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
77 *ihint = mwmhints->inputmode;
78 else
79 *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
80 }
81
82 ret = EINA_TRUE;
83 }
84
85 free(mwmhints);
86 }
87
88 return ret;
89}
90
91EAPI void
92ecore_x_mwm_borderless_set(Ecore_X_Window win,
93 Eina_Bool borderless)
94{
95 unsigned int data[5] = {0, 0, 0, 0, 0};
96
97 data[0] = 2; /* just set the decorations hint! */
98 data[2] = !borderless;
99
100 LOGFN(__FILE__, __LINE__, __FUNCTION__);
101 ecore_x_window_prop_property_set(win,
102 ECORE_X_ATOM_MOTIF_WM_HINTS,
103 ECORE_X_ATOM_MOTIF_WM_HINTS,
104 32, (void *)data, 5);
105}
106
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
deleted file mode 100644
index 3076c3c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
+++ /dev/null
@@ -1,2056 +0,0 @@
1/*
2 * _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include <stdlib.h>
10#include <stdio.h>
11#include <string.h>
12
13#include "Ecore.h"
14#include "ecore_x_private.h"
15#include "Ecore_X.h"
16
17typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
18
19struct _Ecore_X_Startup_Info
20{
21 Ecore_X_Window win;
22
23 int init;
24
25 int buffer_size;
26 char *buffer;
27
28 int length;
29
30 /* These are the sequence info fields */
31 char *id;
32 char *name;
33 int screen;
34 char *bin;
35 char *icon;
36 int desktop;
37 int timestamp;
38 char *description;
39 char *wmclass;
40 int silent;
41};
42
43static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win,
44 Ecore_X_Atom atom,
45 const char *str);
46static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win,
47 Ecore_X_Atom atom);
48#if 0 /* Unused */
49static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
50static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
51 char *data);
52#endif /* if 0 */
53static void _ecore_x_netwm_startup_info_free(void *data);
54
55/*
56 * Convenience macros
57 */
58#define _ATOM_SET_UTF8_STRING_LIST(win, atom, string, cnt) \
59 XChangeProperty(_ecore_x_disp, \
60 win, \
61 atom, \
62 ECORE_X_ATOM_UTF8_STRING, \
63 8, \
64 PropModeReplace, \
65 (unsigned char *)string, \
66 cnt)
67
68/*
69 * Local variables
70 */
71
72static Eina_Hash *startup_info = NULL;
73
74EAPI void
75ecore_x_netwm_init(void)
76{
77 LOGFN(__FILE__, __LINE__, __FUNCTION__);
78 startup_info = eina_hash_string_superfast_new(
79 _ecore_x_netwm_startup_info_free);
80}
81
82EAPI void
83ecore_x_netwm_shutdown(void)
84{
85 LOGFN(__FILE__, __LINE__, __FUNCTION__);
86 if (startup_info)
87 eina_hash_free(startup_info);
88
89 startup_info = NULL;
90}
91
92/*
93 * WM identification
94 */
95EAPI void
96ecore_x_netwm_wm_identify(Ecore_X_Window root,
97 Ecore_X_Window check,
98 const char *wm_name)
99{
100 LOGFN(__FILE__, __LINE__, __FUNCTION__);
101 ecore_x_window_prop_window_set(root,
102 ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
103 &check,
104 1);
105 ecore_x_window_prop_window_set(check,
106 ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
107 &check,
108 1);
109 _ecore_x_window_prop_string_utf8_set(check,
110 ECORE_X_ATOM_NET_WM_NAME,
111 wm_name);
112 /* This one isn't mandatory */
113 _ecore_x_window_prop_string_utf8_set(root,
114 ECORE_X_ATOM_NET_WM_NAME,
115 wm_name);
116}
117
118/*
119 * Set supported atoms
120 */
121EAPI void
122ecore_x_netwm_supported_set(Ecore_X_Window root,
123 Ecore_X_Atom *supported,
124 int num)
125{
126 LOGFN(__FILE__, __LINE__, __FUNCTION__);
127 ecore_x_window_prop_atom_set(root,
128 ECORE_X_ATOM_NET_SUPPORTED,
129 supported,
130 num);
131}
132
133EAPI Eina_Bool
134ecore_x_netwm_supported_get(Ecore_X_Window root,
135 Ecore_X_Atom **supported,
136 int *num)
137{
138 int num_ret;
139
140 if (num)
141 *num = 0;
142
143 if (supported)
144 *supported = NULL;
145
146 LOGFN(__FILE__, __LINE__, __FUNCTION__);
147 num_ret = ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED,
148 supported);
149 if (num_ret <= 0)
150 return EINA_FALSE;
151
152 if (num)
153 *num = num_ret;
154
155 return EINA_TRUE;
156}
157
158/*
159 * Desktop configuration and status
160 */
161EAPI void
162ecore_x_netwm_desk_count_set(Ecore_X_Window root,
163 unsigned int n_desks)
164{
165 LOGFN(__FILE__, __LINE__, __FUNCTION__);
166 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
167 &n_desks, 1);
168}
169
170EAPI void
171ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
172 Ecore_X_Window *vroots,
173 unsigned int n_desks)
174{
175 LOGFN(__FILE__, __LINE__, __FUNCTION__);
176 ecore_x_window_prop_window_set(root,
177 ECORE_X_ATOM_NET_VIRTUAL_ROOTS,
178 vroots,
179 n_desks);
180}
181
182EAPI void
183ecore_x_netwm_desk_names_set(Ecore_X_Window root,
184 const char **names,
185 unsigned int n_desks)
186{
187 char ss[32], *buf, *t;
188 const char *s;
189 unsigned int i;
190 int l, len;
191
192 LOGFN(__FILE__, __LINE__, __FUNCTION__);
193 buf = NULL;
194 len = 0;
195
196 for (i = 0; i < n_desks; i++)
197 {
198 s = (names) ? names[i] : NULL;
199 if (!s)
200 {
201 /* Default to "Desk-<number>" */
202 sprintf(ss, "Desk-%d", i);
203 s = ss;
204 }
205
206 l = strlen(s) + 1;
207 t = realloc(buf, len + l);
208 if (t)
209 {
210 buf = t;
211 memcpy(buf + len, s, l);
212 }
213 len += l;
214 }
215
216 _ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len);
217
218 free(buf);
219}
220
221EAPI void
222ecore_x_netwm_desk_size_set(Ecore_X_Window root,
223 unsigned int width,
224 unsigned int height)
225{
226 unsigned int size[2];
227
228 LOGFN(__FILE__, __LINE__, __FUNCTION__);
229 size[0] = width;
230 size[1] = height;
231 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size,
232 2);
233}
234
235EAPI void
236ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
237 unsigned int *origins,
238 unsigned int n_desks)
239{
240 LOGFN(__FILE__, __LINE__, __FUNCTION__);
241 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
242 origins, 2 * n_desks);
243}
244
245EAPI void
246ecore_x_netwm_desk_layout_set(Ecore_X_Window root,
247 int orientation,
248 int columns,
249 int rows,
250 int starting_corner)
251{
252 unsigned int layout[4];
253
254 LOGFN(__FILE__, __LINE__, __FUNCTION__);
255 layout[0] = orientation;
256 layout[1] = columns;
257 layout[2] = rows;
258 layout[3] = starting_corner;
259 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT,
260 layout, 4);
261}
262
263EAPI void
264ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
265 unsigned int *areas,
266 unsigned int n_desks)
267{
268 LOGFN(__FILE__, __LINE__, __FUNCTION__);
269 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas,
270 4 * n_desks);
271}
272
273EAPI unsigned int *
274ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks)
275{
276 int ret;
277 unsigned int *areas = NULL;
278
279 if (!root) root = DefaultRootWindow(_ecore_x_disp);
280
281 ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA,
282 &areas);
283 if (!areas)
284 {
285 if (n_desks) *n_desks = 0;
286 return 0;
287 }
288 if (n_desks) *n_desks = ret / 4;
289 return areas;
290}
291
292EAPI void
293ecore_x_netwm_desk_current_set(Ecore_X_Window root,
294 unsigned int desk)
295{
296 LOGFN(__FILE__, __LINE__, __FUNCTION__);
297 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, &desk,
298 1);
299}
300
301EAPI void
302ecore_x_netwm_showing_desktop_set(Ecore_X_Window root,
303 Eina_Bool on)
304{
305 unsigned int val;
306
307 LOGFN(__FILE__, __LINE__, __FUNCTION__);
308 val = (on) ? 1 : 0;
309 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val,
310 1);
311}
312
313/*
314 * Client status
315 */
316
317/* Mapping order */
318EAPI void
319ecore_x_netwm_client_list_set(Ecore_X_Window root,
320 Ecore_X_Window *p_clients,
321 unsigned int n_clients)
322{
323 LOGFN(__FILE__, __LINE__, __FUNCTION__);
324 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST,
325 p_clients, n_clients);
326}
327
328/* Stacking order */
329EAPI void
330ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
331 Ecore_X_Window *p_clients,
332 unsigned int n_clients)
333{
334 LOGFN(__FILE__, __LINE__, __FUNCTION__);
335 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
336 p_clients, n_clients);
337}
338
339EAPI void
340ecore_x_netwm_client_active_set(Ecore_X_Window root,
341 Ecore_X_Window win)
342{
343 LOGFN(__FILE__, __LINE__, __FUNCTION__);
344 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_ACTIVE_WINDOW,
345 &win, 1);
346}
347
348EAPI void
349ecore_x_netwm_client_active_request(Ecore_X_Window root,
350 Ecore_X_Window win,
351 int type,
352 Ecore_X_Window current_win)
353{
354 XEvent xev;
355
356 LOGFN(__FILE__, __LINE__, __FUNCTION__);
357 if (!root)
358 root = DefaultRootWindow(_ecore_x_disp);
359
360 xev.xclient.type = ClientMessage;
361 xev.xclient.display = _ecore_x_disp;
362 xev.xclient.window = win;
363 xev.xclient.message_type = ECORE_X_ATOM_NET_ACTIVE_WINDOW;
364 xev.xclient.format = 32;
365 xev.xclient.data.l[0] = type;
366 xev.xclient.data.l[1] = CurrentTime;
367 xev.xclient.data.l[2] = current_win;
368 xev.xclient.data.l[3] = 0;
369 xev.xclient.data.l[4] = 0;
370
371 XSendEvent(_ecore_x_disp, root, False,
372 SubstructureRedirectMask | SubstructureNotifyMask, &xev);
373}
374
375EAPI void
376ecore_x_netwm_name_set(Ecore_X_Window win,
377 const char *name)
378{
379 LOGFN(__FILE__, __LINE__, __FUNCTION__);
380 _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name);
381}
382
383EAPI int
384ecore_x_netwm_name_get(Ecore_X_Window win,
385 char **name)
386{
387 LOGFN(__FILE__, __LINE__, __FUNCTION__);
388 if (name)
389 *name = _ecore_x_window_prop_string_utf8_get(win,
390 ECORE_X_ATOM_NET_WM_NAME);
391
392 return 1;
393}
394
395EAPI void
396ecore_x_netwm_startup_id_set(Ecore_X_Window win,
397 const char *id)
398{
399 LOGFN(__FILE__, __LINE__, __FUNCTION__);
400 _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id);
401}
402
403EAPI int
404ecore_x_netwm_startup_id_get(Ecore_X_Window win,
405 char **id)
406{
407 LOGFN(__FILE__, __LINE__, __FUNCTION__);
408 if (id)
409 *id = _ecore_x_window_prop_string_utf8_get(win,
410 ECORE_X_ATOM_NET_STARTUP_ID);
411
412 return 1;
413}
414
415EAPI void
416ecore_x_netwm_visible_name_set(Ecore_X_Window win,
417 const char *name)
418{
419 LOGFN(__FILE__, __LINE__, __FUNCTION__);
420 _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
421 name);
422}
423
424EAPI int
425ecore_x_netwm_visible_name_get(Ecore_X_Window win,
426 char **name)
427{
428 LOGFN(__FILE__, __LINE__, __FUNCTION__);
429 if (name)
430 *name = _ecore_x_window_prop_string_utf8_get(
431 win,
432 ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
433
434 return 1;
435}
436
437EAPI void
438ecore_x_netwm_icon_name_set(Ecore_X_Window win,
439 const char *name)
440{
441 LOGFN(__FILE__, __LINE__, __FUNCTION__);
442 _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME,
443 name);
444}
445
446EAPI int
447ecore_x_netwm_icon_name_get(Ecore_X_Window win,
448 char **name)
449{
450 LOGFN(__FILE__, __LINE__, __FUNCTION__);
451 if (name)
452 *name = _ecore_x_window_prop_string_utf8_get(
453 win,
454 ECORE_X_ATOM_NET_WM_ICON_NAME);
455
456 return 1;
457}
458
459EAPI void
460ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win,
461 const char *name)
462{
463 LOGFN(__FILE__, __LINE__, __FUNCTION__);
464 _ecore_x_window_prop_string_utf8_set(win,
465 ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
466 name);
467}
468
469EAPI int
470ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win,
471 char **name)
472{
473 LOGFN(__FILE__, __LINE__, __FUNCTION__);
474 if (name)
475 *name = _ecore_x_window_prop_string_utf8_get(
476 win,
477 ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
478
479 return 1;
480}
481
482EAPI void
483ecore_x_netwm_desktop_set(Ecore_X_Window win,
484 unsigned int desk)
485{
486 LOGFN(__FILE__, __LINE__, __FUNCTION__);
487 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
488}
489
490EAPI Eina_Bool
491ecore_x_netwm_desktop_get(Ecore_X_Window win,
492 unsigned int *desk)
493{
494 int ret;
495 unsigned int tmp;
496
497 LOGFN(__FILE__, __LINE__, __FUNCTION__);
498 ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
499 &tmp, 1);
500
501 if (desk)
502 *desk = tmp;
503
504 return ret == 1 ? EINA_TRUE : EINA_FALSE;
505}
506
507/*
508 * _NET_WM_STRUT is deprecated
509 */
510EAPI void
511ecore_x_netwm_strut_set(Ecore_X_Window win,
512 int left,
513 int right,
514 int top,
515 int bottom)
516{
517 unsigned int strut[4];
518
519 LOGFN(__FILE__, __LINE__, __FUNCTION__);
520 strut[0] = left;
521 strut[1] = right;
522 strut[2] = top;
523 strut[3] = bottom;
524 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
525}
526
527/*
528 * _NET_WM_STRUT is deprecated
529 */
530EAPI Eina_Bool
531ecore_x_netwm_strut_get(Ecore_X_Window win,
532 int *left,
533 int *right,
534 int *top,
535 int *bottom)
536{
537 int ret = 0;
538 unsigned int strut[4];
539
540 LOGFN(__FILE__, __LINE__, __FUNCTION__);
541 ret = ecore_x_window_prop_card32_get(win,
542 ECORE_X_ATOM_NET_WM_STRUT,
543 strut,
544 4);
545 if (ret != 4)
546 return EINA_FALSE;
547
548 if (left)
549 *left = strut[0];
550
551 if (right)
552 *right = strut[1];
553
554 if (top)
555 *top = strut[2];
556
557 if (bottom)
558 *bottom = strut[3];
559
560 return EINA_TRUE;
561}
562
563EAPI void
564ecore_x_netwm_strut_partial_set(Ecore_X_Window win,
565 int left,
566 int right,
567 int top,
568 int bottom,
569 int left_start_y,
570 int left_end_y,
571 int right_start_y,
572 int right_end_y,
573 int top_start_x,
574 int top_end_x,
575 int bottom_start_x,
576 int bottom_end_x)
577{
578 unsigned int strut[12];
579
580 LOGFN(__FILE__, __LINE__, __FUNCTION__);
581 strut[0] = left;
582 strut[1] = right;
583 strut[2] = top;
584 strut[3] = bottom;
585 strut[4] = left_start_y;
586 strut[5] = left_end_y;
587 strut[6] = right_start_y;
588 strut[7] = right_end_y;
589 strut[8] = top_start_x;
590 strut[9] = top_end_x;
591 strut[10] = bottom_start_x;
592 strut[11] = bottom_end_x;
593 ecore_x_window_prop_card32_set(win,
594 ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
595 strut,
596 12);
597}
598
599EAPI Eina_Bool
600ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
601 int *left,
602 int *right,
603 int *top,
604 int *bottom,
605 int *left_start_y,
606 int *left_end_y,
607 int *right_start_y,
608 int *right_end_y,
609 int *top_start_x,
610 int *top_end_x,
611 int *bottom_start_x,
612 int *bottom_end_x)
613{
614 int ret = 0;
615 unsigned int strut[12];
616
617 LOGFN(__FILE__, __LINE__, __FUNCTION__);
618 ret = ecore_x_window_prop_card32_get(win,
619 ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
620 strut,
621 12);
622 if (ret != 12)
623 return EINA_FALSE;
624
625 if (left)
626 *left = strut[0];
627
628 if (right)
629 *right = strut[1];
630
631 if (top)
632 *top = strut[2];
633
634 if (bottom)
635 *bottom = strut[3];
636
637 if (left_start_y)
638 *left_start_y = strut[4];
639
640 if (left_end_y)
641 *left_end_y = strut[5];
642
643 if (right_start_y)
644 *right_start_y = strut[6];
645
646 if (right_end_y)
647 *right_end_y = strut[7];
648
649 if (top_start_x)
650 *top_start_x = strut[8];
651
652 if (top_end_x)
653 *top_end_x = strut[9];
654
655 if (bottom_start_x)
656 *bottom_start_x = strut[10];
657
658 if (bottom_end_x)
659 *bottom_end_x = strut[11];
660
661 return EINA_TRUE;
662}
663
664EAPI void
665ecore_x_netwm_icons_set(Ecore_X_Window win,
666 Ecore_X_Icon *icon,
667 int num)
668{
669 unsigned int *data, *p, *p2;
670 unsigned int i, size, x, y;
671
672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
673 size = 0;
674 for (i = 0; i < (unsigned int)num; i++)
675 {
676 size += 2 + (icon[i].width * icon[i].height);
677 }
678 data = malloc(size * sizeof(unsigned int));
679 if (!data) return;
680 p = data;
681 for (i = 0; i < (unsigned int)num; i++)
682 {
683 p[0] = icon[i].width;
684 p[1] = icon[i].height;
685 p += 2;
686 p2 = icon[i].data;
687 for (y = 0; y < icon[i].height; y++)
688 {
689 for (x = 0; x < icon[i].width; x++)
690 {
691 unsigned int r, g, b, a;
692
693 a = (*p2 >> 24) & 0xff;
694 r = (*p2 >> 16) & 0xff;
695 g = (*p2 >> 8 ) & 0xff;
696 b = (*p2 ) & 0xff;
697 if ((a > 0) && (a < 255))
698 {
699 // unpremul
700 r = (r * 255) / a;
701 g = (g * 255) / a;
702 b = (b * 255) / a;
703 }
704 *p = (a << 24) | (r << 16) | (g << 8) | b;
705 p++;
706 p2++;
707 }
708 }
709 }
710 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
711 data, size);
712 free(data);
713}
714
715EAPI Eina_Bool
716ecore_x_netwm_icons_get(Ecore_X_Window win,
717 Ecore_X_Icon **icon,
718 int *num)
719{
720 unsigned int *data, *p;
721 unsigned int *src;
722 unsigned int len, icons, i;
723 int num_ret;
724
725 LOGFN(__FILE__, __LINE__, __FUNCTION__);
726 if (num)
727 *num = 0;
728
729 if (icon)
730 *icon = NULL;
731
732 num_ret = ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON,
733 &data);
734 if (num_ret <= 0)
735 return EINA_FALSE;
736
737 if (!data)
738 return EINA_FALSE;
739
740 if (num_ret < 2)
741 {
742 free(data);
743 return EINA_FALSE;
744 }
745
746 /* Check how many icons there are */
747 icons = 0;
748 p = data;
749 while (p)
750 {
751 len = p[0] * p[1];
752 p += (len + 2);
753 if ((p - data) > num_ret)
754 {
755 free(data);
756 return EINA_FALSE;
757 }
758
759 icons++;
760
761 if ((p - data) == num_ret)
762 p = NULL;
763 }
764 if (num)
765 *num = icons;
766
767 /* If the user doesn't want the icons, return */
768 if (!icon)
769 {
770 free(data);
771 return EINA_TRUE;
772 }
773
774 /* Allocate memory */
775 *icon = malloc(icons * sizeof(Ecore_X_Icon));
776 if (!(*icon))
777 {
778 free(data);
779 return EINA_FALSE;
780 }
781
782 /* Fetch the icons */
783 p = data;
784 for (i = 0; i < icons; i++)
785 {
786 unsigned int *ps, *pd, *pe;
787
788 len = p[0] * p[1];
789 ((*icon)[i]).width = p[0];
790 ((*icon)[i]).height = p[1];
791 src = &(p[2]);
792 ((*icon)[i]).data = malloc(len * sizeof(unsigned int));
793 if (!((*icon)[i]).data)
794 {
795 while (i)
796 free(((*icon)[--i]).data);
797 free(*icon);
798 free(data);
799 return EINA_FALSE;
800 }
801
802 pd = ((*icon)[i]).data;
803 ps = src;
804 pe = ps + len;
805 for (; ps < pe; ps++)
806 {
807 unsigned int r, g, b, a;
808
809 a = (*ps >> 24) & 0xff;
810 r = (((*ps >> 16) & 0xff) * a) / 255;
811 g = (((*ps >> 8) & 0xff) * a) / 255;
812 b = (((*ps) & 0xff) * a) / 255;
813 *pd = (a << 24) | (r << 16) | (g << 8) | (b);
814 pd++;
815 }
816 p += (len + 2);
817 }
818
819 free(data);
820
821 return EINA_TRUE;
822}
823
824EAPI void
825ecore_x_netwm_icon_geometry_set(Ecore_X_Window win,
826 int x,
827 int y,
828 int width,
829 int height)
830{
831 unsigned int geometry[4];
832
833 LOGFN(__FILE__, __LINE__, __FUNCTION__);
834 geometry[0] = x;
835 geometry[1] = y;
836 geometry[2] = width;
837 geometry[3] = height;
838 ecore_x_window_prop_card32_set(win,
839 ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
840 geometry,
841 4);
842}
843
844EAPI Eina_Bool
845ecore_x_netwm_icon_geometry_get(Ecore_X_Window win,
846 int *x,
847 int *y,
848 int *width,
849 int *height)
850{
851 int ret;
852 unsigned int geometry[4];
853
854 LOGFN(__FILE__, __LINE__, __FUNCTION__);
855 ret = ecore_x_window_prop_card32_get(win,
856 ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
857 geometry,
858 4);
859 if (ret != 4)
860 return EINA_FALSE;
861
862 if (x)
863 *x = geometry[0];
864
865 if (y)
866 *y = geometry[1];
867
868 if (width)
869 *width = geometry[2];
870
871 if (height)
872 *height = geometry[3];
873
874 return EINA_TRUE;
875}
876
877EAPI void
878ecore_x_netwm_pid_set(Ecore_X_Window win,
879 int pid)
880{
881 unsigned int tmp;
882
883 LOGFN(__FILE__, __LINE__, __FUNCTION__);
884 tmp = pid;
885 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID,
886 &tmp, 1);
887}
888
889EAPI Eina_Bool
890ecore_x_netwm_pid_get(Ecore_X_Window win,
891 int *pid)
892{
893 int ret;
894 unsigned int tmp;
895
896 LOGFN(__FILE__, __LINE__, __FUNCTION__);
897 ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID,
898 &tmp, 1);
899 if (pid)
900 *pid = tmp;
901
902 return ret == 1 ? EINA_TRUE : EINA_FALSE;
903}
904
905EAPI void
906ecore_x_netwm_handled_icons_set(Ecore_X_Window win)
907{
908 LOGFN(__FILE__, __LINE__, __FUNCTION__);
909 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
910 NULL, 0);
911}
912
913EAPI Eina_Bool
914ecore_x_netwm_handled_icons_get(Ecore_X_Window win)
915{
916 int ret = 0;
917 LOGFN(__FILE__, __LINE__, __FUNCTION__);
918 ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
919 NULL, 0);
920 return ret == 0 ? EINA_TRUE : EINA_FALSE;
921}
922
923EAPI void
924ecore_x_netwm_user_time_set(Ecore_X_Window win,
925 unsigned int tim)
926{
927 LOGFN(__FILE__, __LINE__, __FUNCTION__);
928 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME,
929 &tim, 1);
930}
931
932EAPI Eina_Bool
933ecore_x_netwm_user_time_get(Ecore_X_Window win,
934 unsigned int *tim)
935{
936 int ret;
937 unsigned int tmp;
938
939 LOGFN(__FILE__, __LINE__, __FUNCTION__);
940 ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME,
941 &tmp, 1);
942 if (tim)
943 *tim = tmp;
944
945 return ret == 1 ? EINA_TRUE : EINA_FALSE;
946}
947
948Ecore_X_Window_State
949_ecore_x_netwm_state_get(Ecore_X_Atom a)
950{
951 if (a == ECORE_X_ATOM_NET_WM_STATE_MODAL)
952 return ECORE_X_WINDOW_STATE_MODAL;
953 else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY)
954 return ECORE_X_WINDOW_STATE_STICKY;
955 else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
956 return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
957 else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
958 return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
959 else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED)
960 return ECORE_X_WINDOW_STATE_SHADED;
961 else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
962 return ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
963 else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
964 return ECORE_X_WINDOW_STATE_SKIP_PAGER;
965 else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
966 return ECORE_X_WINDOW_STATE_HIDDEN;
967 else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
968 return ECORE_X_WINDOW_STATE_FULLSCREEN;
969 else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
970 return ECORE_X_WINDOW_STATE_ABOVE;
971 else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW)
972 return ECORE_X_WINDOW_STATE_BELOW;
973 else if (a == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
974 return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
975 else
976 return ECORE_X_WINDOW_STATE_UNKNOWN;
977}
978
979static Ecore_X_Atom
980_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
981{
982 switch (s)
983 {
984 case ECORE_X_WINDOW_STATE_MODAL:
985 return ECORE_X_ATOM_NET_WM_STATE_MODAL;
986
987 case ECORE_X_WINDOW_STATE_STICKY:
988 return ECORE_X_ATOM_NET_WM_STATE_STICKY;
989
990 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
991 return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
992
993 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
994 return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
995
996 case ECORE_X_WINDOW_STATE_SHADED:
997 return ECORE_X_ATOM_NET_WM_STATE_SHADED;
998
999 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
1000 return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
1001
1002 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
1003 return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
1004
1005 case ECORE_X_WINDOW_STATE_HIDDEN:
1006 return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
1007
1008 case ECORE_X_WINDOW_STATE_FULLSCREEN:
1009 return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
1010
1011 case ECORE_X_WINDOW_STATE_ABOVE:
1012 return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
1013
1014 case ECORE_X_WINDOW_STATE_BELOW:
1015 return ECORE_X_ATOM_NET_WM_STATE_BELOW;
1016
1017 case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
1018 return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
1019
1020 default:
1021 return 0;
1022 }
1023}
1024
1025EAPI void
1026ecore_x_netwm_window_state_set(Ecore_X_Window win,
1027 Ecore_X_Window_State *state,
1028 unsigned int num)
1029{
1030 Ecore_X_Atom *set;
1031 unsigned int i;
1032
1033 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1034 if (!num)
1035 {
1036 ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE);
1037 return;
1038 }
1039
1040 set = malloc(num * sizeof(Ecore_X_Atom));
1041 if (!set)
1042 return;
1043
1044 for (i = 0; i < num; i++)
1045 set[i] = _ecore_x_netwm_state_atom_get(state[i]);
1046
1047 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num);
1048
1049 free(set);
1050}
1051
1052EAPI Eina_Bool
1053ecore_x_netwm_window_state_get(Ecore_X_Window win,
1054 Ecore_X_Window_State **state,
1055 unsigned int *num)
1056{
1057 int num_ret, i;
1058 Ecore_X_Atom *atoms;
1059
1060 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1061 if (num)
1062 *num = 0;
1063
1064 if (state)
1065 *state = NULL;
1066
1067 num_ret = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE,
1068 &atoms);
1069 if (num_ret <= 0)
1070 return EINA_FALSE;
1071
1072 if (state)
1073 {
1074 *state = malloc(num_ret * sizeof(Ecore_X_Window_State));
1075 if (*state)
1076 for (i = 0; i < num_ret; ++i)
1077 (*state)[i] = _ecore_x_netwm_state_get(atoms[i]);
1078
1079 if (num)
1080 *num = num_ret;
1081 }
1082
1083 free(atoms);
1084 return EINA_TRUE;
1085}
1086
1087static Ecore_X_Window_Type
1088_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom)
1089{
1090 if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP)
1091 return ECORE_X_WINDOW_TYPE_DESKTOP;
1092 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
1093 return ECORE_X_WINDOW_TYPE_DOCK;
1094 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR)
1095 return ECORE_X_WINDOW_TYPE_TOOLBAR;
1096 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
1097 return ECORE_X_WINDOW_TYPE_MENU;
1098 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY)
1099 return ECORE_X_WINDOW_TYPE_UTILITY;
1100 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
1101 return ECORE_X_WINDOW_TYPE_SPLASH;
1102 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG)
1103 return ECORE_X_WINDOW_TYPE_DIALOG;
1104 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
1105 return ECORE_X_WINDOW_TYPE_NORMAL;
1106 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
1107 return ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
1108 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU)
1109 return ECORE_X_WINDOW_TYPE_POPUP_MENU;
1110 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP)
1111 return ECORE_X_WINDOW_TYPE_TOOLTIP;
1112 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION)
1113 return ECORE_X_WINDOW_TYPE_NOTIFICATION;
1114 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO)
1115 return ECORE_X_WINDOW_TYPE_COMBO;
1116 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND)
1117 return ECORE_X_WINDOW_TYPE_DND;
1118 else
1119 return ECORE_X_WINDOW_TYPE_UNKNOWN;
1120}
1121
1122static Ecore_X_Atom
1123_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
1124{
1125 switch (type)
1126 {
1127 case ECORE_X_WINDOW_TYPE_DESKTOP:
1128 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
1129
1130 case ECORE_X_WINDOW_TYPE_DOCK:
1131 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
1132
1133 case ECORE_X_WINDOW_TYPE_TOOLBAR:
1134 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
1135
1136 case ECORE_X_WINDOW_TYPE_MENU:
1137 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
1138
1139 case ECORE_X_WINDOW_TYPE_UTILITY:
1140 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
1141
1142 case ECORE_X_WINDOW_TYPE_SPLASH:
1143 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
1144
1145 case ECORE_X_WINDOW_TYPE_DIALOG:
1146 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
1147
1148 case ECORE_X_WINDOW_TYPE_NORMAL:
1149 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
1150
1151 case ECORE_X_WINDOW_TYPE_DROPDOWN_MENU:
1152 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
1153
1154 case ECORE_X_WINDOW_TYPE_POPUP_MENU:
1155 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU;
1156
1157 case ECORE_X_WINDOW_TYPE_TOOLTIP:
1158 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP;
1159
1160 case ECORE_X_WINDOW_TYPE_NOTIFICATION:
1161 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION;
1162
1163 case ECORE_X_WINDOW_TYPE_COMBO:
1164 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO;
1165
1166 case ECORE_X_WINDOW_TYPE_DND:
1167 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND;
1168
1169 default:
1170 return 0;
1171 }
1172}
1173
1174/*
1175 * FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
1176 * , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG
1177 */
1178EAPI void
1179ecore_x_netwm_window_type_set(Ecore_X_Window win,
1180 Ecore_X_Window_Type type)
1181{
1182 Ecore_X_Atom atom;
1183
1184 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1185 atom = _ecore_x_netwm_window_type_atom_get(type);
1186 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
1187 &atom, 1);
1188}
1189
1190/* FIXME: Maybe return 0 on some conditions? */
1191EAPI Eina_Bool
1192ecore_x_netwm_window_type_get(Ecore_X_Window win,
1193 Ecore_X_Window_Type *type)
1194{
1195 int num;
1196 Ecore_X_Atom *atoms = NULL;
1197
1198 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1199 if (type)
1200 *type = ECORE_X_WINDOW_TYPE_NORMAL;
1201
1202 num = ecore_x_window_prop_atom_list_get(win,
1203 ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
1204 &atoms);
1205 if ((type) && (num >= 1) && (atoms))
1206 *type = _ecore_x_netwm_window_type_type_get(atoms[0]);
1207
1208 free(atoms);
1209 if (num >= 1)
1210 return EINA_TRUE;
1211
1212 return EINA_FALSE;
1213}
1214
1215EAPI int
1216ecore_x_netwm_window_types_get(Ecore_X_Window win,
1217 Ecore_X_Window_Type **types)
1218{
1219 int num, i;
1220 Ecore_X_Atom *atoms = NULL;
1221 Ecore_X_Window_Type *atoms2 = NULL;
1222
1223 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1224 if (types)
1225 *types = NULL;
1226
1227 num = ecore_x_window_prop_atom_list_get(win,
1228 ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
1229 &atoms);
1230 if ((num <= 0) || (!atoms))
1231 {
1232 if (atoms)
1233 free(atoms);
1234
1235 return 0;
1236 }
1237
1238 atoms2 = malloc(num * sizeof(Ecore_X_Window_Type));
1239 if (!atoms2)
1240 return 0;
1241
1242 for (i = 0; i < num; i++)
1243 atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]);
1244 free(atoms);
1245 if (types)
1246 *types = atoms2;
1247 else
1248 free(atoms2);
1249
1250 return num;
1251}
1252
1253static Ecore_X_Atom
1254_ecore_x_netwm_action_atom_get(Ecore_X_Action action)
1255{
1256 switch (action)
1257 {
1258 case ECORE_X_ACTION_MOVE:
1259 return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
1260
1261 case ECORE_X_ACTION_RESIZE:
1262 return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
1263
1264 case ECORE_X_ACTION_MINIMIZE:
1265 return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
1266
1267 case ECORE_X_ACTION_SHADE:
1268 return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
1269
1270 case ECORE_X_ACTION_STICK:
1271 return ECORE_X_ATOM_NET_WM_ACTION_STICK;
1272
1273 case ECORE_X_ACTION_MAXIMIZE_HORZ:
1274 return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
1275
1276 case ECORE_X_ACTION_MAXIMIZE_VERT:
1277 return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
1278
1279 case ECORE_X_ACTION_FULLSCREEN:
1280 return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
1281
1282 case ECORE_X_ACTION_CHANGE_DESKTOP:
1283 return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
1284
1285 case ECORE_X_ACTION_CLOSE:
1286 return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
1287
1288 case ECORE_X_ACTION_ABOVE:
1289 return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
1290
1291 case ECORE_X_ACTION_BELOW:
1292 return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
1293
1294 default:
1295 return 0;
1296 }
1297}
1298
1299/* FIXME: Get complete list */
1300EAPI Eina_Bool
1301ecore_x_netwm_allowed_action_isset(Ecore_X_Window win,
1302 Ecore_X_Action action)
1303{
1304 int num, i;
1305 Ecore_X_Atom *atoms, atom;
1306 Eina_Bool ret = EINA_FALSE;
1307
1308 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1309 num = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
1310 &atoms);
1311 if (num <= 0)
1312 return ret;
1313
1314 atom = _ecore_x_netwm_action_atom_get(action);
1315
1316 for (i = 0; i < num; ++i)
1317 {
1318 if (atom == atoms[i])
1319 {
1320 ret = 1;
1321 break;
1322 }
1323 }
1324
1325 free(atoms);
1326 return ret;
1327}
1328
1329/* FIXME: Set complete list */
1330EAPI void
1331ecore_x_netwm_allowed_action_set(Ecore_X_Window win,
1332 Ecore_X_Action *action,
1333 unsigned int num)
1334{
1335 Ecore_X_Atom *set;
1336 unsigned int i;
1337
1338 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1339 if (!num)
1340 {
1341 ecore_x_window_prop_property_del(win,
1342 ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
1343 return;
1344 }
1345
1346 set = malloc(num * sizeof(Ecore_X_Atom));
1347 if (!set)
1348 return;
1349
1350 for (i = 0; i < num; i++)
1351 set[i] = _ecore_x_netwm_action_atom_get(action[i]);
1352
1353 ecore_x_window_prop_atom_set(win,
1354 ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
1355 set,
1356 num);
1357
1358 free(set);
1359}
1360
1361EAPI Eina_Bool
1362ecore_x_netwm_allowed_action_get(Ecore_X_Window win,
1363 Ecore_X_Action **action,
1364 unsigned int *num)
1365{
1366 int num_ret, i;
1367 Ecore_X_Atom *atoms;
1368
1369 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1370 if (num)
1371 *num = 0;
1372
1373 if (action)
1374 *action = NULL;
1375
1376 num_ret = ecore_x_window_prop_atom_list_get(
1377 win,
1378 ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
1379 &atoms);
1380 if (num_ret <= 0)
1381 return EINA_FALSE;
1382
1383 if (action)
1384 {
1385 *action = malloc(num_ret * sizeof(Ecore_X_Action));
1386 if (*action)
1387 for (i = 0; i < num_ret; ++i)
1388 (*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]);
1389
1390 if (num)
1391 *num = num_ret;
1392 }
1393
1394 free(atoms);
1395 return EINA_TRUE;
1396}
1397
1398EAPI void
1399ecore_x_netwm_opacity_set(Ecore_X_Window win,
1400 unsigned int opacity)
1401{
1402 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1403 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
1404 &opacity, 1);
1405}
1406
1407EAPI Eina_Bool
1408ecore_x_netwm_opacity_get(Ecore_X_Window win,
1409 unsigned int *opacity)
1410{
1411 int ret;
1412 unsigned int tmp;
1413
1414 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1415 ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
1416 &tmp, 1);
1417 if (opacity)
1418 *opacity = tmp;
1419
1420 return ret == 1 ? EINA_TRUE : EINA_FALSE;
1421}
1422
1423EAPI void
1424ecore_x_netwm_frame_size_set(Ecore_X_Window win,
1425 int fl,
1426 int fr,
1427 int ft,
1428 int fb)
1429{
1430 unsigned int frames[4];
1431
1432 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1433 frames[0] = fl;
1434 frames[1] = fr;
1435 frames[2] = ft;
1436 frames[3] = fb;
1437 ecore_x_window_prop_card32_set(win,
1438 ECORE_X_ATOM_NET_FRAME_EXTENTS,
1439 frames,
1440 4);
1441}
1442
1443EAPI Eina_Bool
1444ecore_x_netwm_frame_size_get(Ecore_X_Window win,
1445 int *fl,
1446 int *fr,
1447 int *ft,
1448 int *fb)
1449{
1450 int ret = 0;
1451 unsigned int frames[4];
1452
1453 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1454 ret = ecore_x_window_prop_card32_get(win,
1455 ECORE_X_ATOM_NET_FRAME_EXTENTS,
1456 frames,
1457 4);
1458 if (ret != 4)
1459 return EINA_FALSE;
1460
1461 if (fl)
1462 *fl = frames[0];
1463
1464 if (fr)
1465 *fr = frames[1];
1466
1467 if (ft)
1468 *ft = frames[2];
1469
1470 if (fb)
1471 *fb = frames[3];
1472
1473 return EINA_TRUE;
1474}
1475
1476EAPI Eina_Bool
1477ecore_x_netwm_sync_counter_get(Ecore_X_Window win,
1478 Ecore_X_Sync_Counter *counter)
1479{
1480 int ret;
1481 unsigned int tmp;
1482
1483 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1484 ret = ecore_x_window_prop_card32_get(
1485 win,
1486 ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
1487 &tmp,
1488 1);
1489
1490 if (counter)
1491 *counter = tmp;
1492
1493 return ret == 1 ? EINA_TRUE : EINA_FALSE;
1494}
1495
1496EAPI void
1497ecore_x_netwm_ping_send(Ecore_X_Window win)
1498{
1499 XEvent xev;
1500
1501 if (!win)
1502 return;
1503
1504 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1505 xev.xclient.type = ClientMessage;
1506 xev.xclient.display = _ecore_x_disp;
1507 xev.xclient.window = win;
1508 xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
1509 xev.xclient.format = 32;
1510 xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_PING;
1511 xev.xclient.data.l[1] = _ecore_x_event_last_time;
1512 xev.xclient.data.l[2] = win;
1513 xev.xclient.data.l[3] = 0;
1514 xev.xclient.data.l[4] = 0;
1515
1516 XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
1517}
1518
1519EAPI void
1520ecore_x_netwm_sync_request_send(Ecore_X_Window win,
1521 unsigned int serial)
1522{
1523 XSyncValue value;
1524 XEvent xev;
1525
1526 if (!win)
1527 return;
1528
1529 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1530 XSyncIntToValue(&value, (int)serial);
1531
1532 xev.xclient.type = ClientMessage;
1533 xev.xclient.display = _ecore_x_disp;
1534 xev.xclient.window = win;
1535 xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
1536 xev.xclient.format = 32;
1537 xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
1538 xev.xclient.data.l[1] = _ecore_x_event_last_time;
1539 xev.xclient.data.l[2] = XSyncValueLow32(value);
1540 xev.xclient.data.l[3] = XSyncValueHigh32(value);
1541 xev.xclient.data.l[4] = 0;
1542
1543 XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
1544}
1545
1546EAPI void
1547ecore_x_netwm_state_request_send(Ecore_X_Window win,
1548 Ecore_X_Window root,
1549 Ecore_X_Window_State s1,
1550 Ecore_X_Window_State s2,
1551 Eina_Bool set)
1552{
1553 XEvent xev;
1554
1555 if (!win)
1556 return;
1557
1558 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1559 if (!root)
1560 root = DefaultRootWindow(_ecore_x_disp);
1561
1562 xev.xclient.type = ClientMessage;
1563 xev.xclient.serial = 0;
1564 xev.xclient.send_event = True;
1565 xev.xclient.display = _ecore_x_disp;
1566 xev.xclient.window = win;
1567 xev.xclient.format = 32;
1568 xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE;
1569 xev.xclient.data.l[0] = !!set;
1570 xev.xclient.data.l[1] = _ecore_x_netwm_state_atom_get(s1);
1571 xev.xclient.data.l[2] = _ecore_x_netwm_state_atom_get(s2);
1572 /* 1 == normal client, if someone wants to use this
1573 * function in a pager, this should be 2 */
1574 xev.xclient.data.l[3] = 1;
1575 xev.xclient.data.l[4] = 0;
1576
1577 XSendEvent(_ecore_x_disp, root, False,
1578 SubstructureNotifyMask | SubstructureRedirectMask, &xev);
1579}
1580
1581EAPI void
1582ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
1583 Ecore_X_Window root,
1584 unsigned int desktop)
1585{
1586 XEvent xev;
1587
1588 if (!win)
1589 return;
1590
1591 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1592 if (!root)
1593 root = DefaultRootWindow(_ecore_x_disp);
1594
1595 xev.xclient.type = ClientMessage;
1596 xev.xclient.serial = 0;
1597 xev.xclient.send_event = True;
1598 xev.xclient.display = _ecore_x_disp;
1599 xev.xclient.window = win;
1600 xev.xclient.format = 32;
1601 xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP;
1602 xev.xclient.data.l[0] = desktop;
1603
1604 XSendEvent(_ecore_x_disp, root, False,
1605 SubstructureNotifyMask | SubstructureRedirectMask, &xev);
1606}
1607
1608int
1609_ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__,
1610 char *data __UNUSED__)
1611{
1612#if 0
1613 Ecore_X_Startup_Info *info;
1614 unsigned char *exists = 0;
1615
1616 if (!startup_info)
1617 return 0;
1618
1619 info = eina_hash_find(startup_info, (void *)win);
1620 if (info)
1621 {
1622 exists = 1;
1623 WRN("Already got info for win: 0x%x", win);
1624 _ecore_x_netwm_startup_info_free(info);
1625 }
1626
1627 info = calloc(1, sizeof(Ecore_X_Startup_Info));
1628 if (!info)
1629 return 0;
1630
1631 info->win = win;
1632 info->length = 0;
1633 info->buffer_size = 161;
1634 info->buffer = calloc(info->buffer_size, sizeof(char));
1635 if (!info->buffer)
1636 {
1637 _ecore_x_netwm_startup_info_free(info);
1638 return 0;
1639 }
1640
1641 memcpy(info->buffer, data, 20);
1642 info->length += 20;
1643 info->buffer[info->length] = 0;
1644 if (exists)
1645 eina_hash_modify(startup_info, (void *)info->win, info);
1646 else
1647 eina_hash_add(startup_info, (void *)info->win, info);
1648
1649 if (strlen(info->buffer) != 20)
1650 /* We have a '\0' in there, the message is done */
1651 _ecore_x_netwm_startup_info_process(info);
1652
1653#endif /* if 0 */
1654 return 1;
1655}
1656
1657int
1658_ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__,
1659 char *data __UNUSED__)
1660{
1661#if 0
1662 Ecore_X_Startup_Info *info;
1663 char *p;
1664
1665 if (!startup_info)
1666 return 0;
1667
1668 info = eina_hash_find(startup_info, (void *)win);
1669 if (!info)
1670 return 0;
1671
1672 if ((info->length + 20) > info->buffer_size)
1673 {
1674 info->buffer_size += 160;
1675 info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char));
1676 if (!info->buffer)
1677 {
1678 eina_hash_del(startup_info, (void *)info->win);
1679 _ecore_x_netwm_startup_info_free(info);
1680 return 0;
1681 }
1682 }
1683
1684 memcpy(info->buffer + info->length, data, 20);
1685 p = info->buffer + info->length;
1686 info->length += 20;
1687 info->buffer[info->length] = 0;
1688 if (strlen(p) != 20)
1689 /* We have a '\0' in there, the message is done */
1690 _ecore_x_netwm_startup_info_process(info);
1691
1692#endif /* if 0 */
1693 return 1;
1694}
1695
1696/*
1697 * Set UTF-8 string property
1698 */
1699static void
1700_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win,
1701 Ecore_X_Atom atom,
1702 const char *str)
1703{
1704 XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
1705 PropModeReplace, (unsigned char *)str, strlen(str));
1706}
1707
1708/*
1709 * Get UTF-8 string property
1710 */
1711static char *
1712_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win,
1713 Ecore_X_Atom atom)
1714{
1715 char *str;
1716 unsigned char *prop_ret;
1717 Atom type_ret;
1718 unsigned long bytes_after, num_ret;
1719 int format_ret;
1720
1721 str = NULL;
1722 prop_ret = NULL;
1723 XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
1724 ECORE_X_ATOM_UTF8_STRING, &type_ret,
1725 &format_ret, &num_ret, &bytes_after, &prop_ret);
1726 if (prop_ret && num_ret > 0 && format_ret == 8)
1727 {
1728 str = malloc(num_ret + 1);
1729 if (str)
1730 {
1731 memcpy(str, prop_ret, num_ret);
1732 str[num_ret] = '\0';
1733 }
1734 }
1735
1736 if (prop_ret)
1737 XFree(prop_ret);
1738
1739 return str;
1740}
1741
1742#if 0 /* Unused */
1743/*
1744 * Process startup info
1745 */
1746static int
1747_ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info)
1748{
1749 Ecore_X_Event_Startup_Sequence *e;
1750 int event;
1751 char *p;
1752
1753 p = strchr(info->buffer, ':');
1754 if (!p)
1755 {
1756 eina_hash_del(startup_info, (void *)info->win);
1757 _ecore_x_netwm_startup_info_free(info);
1758 return 0;
1759 }
1760
1761 *p = 0;
1762 if (!strcmp(info->buffer, "new"))
1763 {
1764 if (info->init)
1765 event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
1766 else
1767 event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
1768
1769 info->init = 1;
1770 }
1771 else if (!strcmp(info->buffer, "change"))
1772 event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
1773 else if (!strcmp(info->buffer, "remove"))
1774 event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
1775 else
1776 {
1777 eina_hash_del(startup_info, (void *)info->win);
1778 _ecore_x_netwm_startup_info_free(info);
1779 return 0;
1780 }
1781
1782 p++;
1783
1784 if (!_ecore_x_netwm_startup_info_parse(info, p))
1785 {
1786 eina_hash_del(startup_info, (void *)info->win);
1787 _ecore_x_netwm_startup_info_free(info);
1788 return 0;
1789 }
1790
1791 if (info->init)
1792 {
1793 e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence));
1794 if (!e)
1795 {
1796 eina_hash_del(startup_info, (void *)info->win);
1797 _ecore_x_netwm_startup_info_free(info);
1798 return 0;
1799 }
1800
1801 e->win = info->win;
1802 ecore_event_add(event, e, NULL, NULL);
1803 }
1804
1805 if (event == ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE)
1806 {
1807 eina_hash_del(startup_info, (void *)info->win);
1808 _ecore_x_netwm_startup_info_free(info);
1809 }
1810 else
1811 {
1812 /* Discard buffer */
1813 info->length = 0;
1814 info->buffer[0] = 0;
1815 }
1816
1817 return 1;
1818}
1819
1820/*
1821 * Parse startup info
1822 */
1823static int
1824_ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
1825 char *data)
1826{
1827 while (*data)
1828 {
1829 int in_quot_sing, in_quot_dbl, escaped;
1830 char *p, *pp;
1831 char *key;
1832 char value[1024];
1833
1834 /* Skip space */
1835 while (*data == ' ')
1836 data++;
1837 /* Get key */
1838 key = data;
1839 data = strchr(key, '=');
1840 if (!data)
1841 return 0;
1842
1843 *data = 0;
1844 data++;
1845
1846 /* Get value */
1847 p = data;
1848 pp = value;
1849 in_quot_dbl = 0;
1850 in_quot_sing = 0;
1851 escaped = 0;
1852 while (*p)
1853 {
1854 if ((pp - value) >= 1024)
1855 return 0;
1856
1857 if (escaped)
1858 {
1859 *pp = *p;
1860 pp++;
1861 escaped = 0;
1862 }
1863 else if (in_quot_sing)
1864 {
1865 if (*p == '\\')
1866 escaped = 1;
1867 else if (*p == '\'')
1868 in_quot_sing = 0;
1869 else
1870 {
1871 *pp = *p;
1872 pp++;
1873 }
1874 }
1875 else if (in_quot_dbl)
1876 {
1877 if (*p == '\\')
1878 escaped = 1;
1879 else if (*p == '\"')
1880 in_quot_dbl = 0;
1881 else
1882 {
1883 *pp = *p;
1884 pp++;
1885 }
1886 }
1887 else
1888 {
1889 if (*p == '\\')
1890 escaped = 1;
1891 else if (*p == '\'')
1892 in_quot_sing = 1;
1893 else if (*p == '\"')
1894 in_quot_dbl = 1;
1895 else if (*p == ' ')
1896 break;
1897 else
1898 {
1899 *pp = *p;
1900 pp++;
1901 }
1902 }
1903
1904 p++;
1905 }
1906 if ((in_quot_dbl) || (in_quot_sing))
1907 return 0;
1908
1909 data = p;
1910 *pp = 0;
1911
1912 /* Parse info */
1913 if (!strcmp(key, "ID"))
1914 {
1915 if ((info->id) && (strcmp(info->id, value)))
1916 return 0;
1917
1918 info->id = strdup(value);
1919 p = strstr(value, "_TIME");
1920 if (p)
1921 info->timestamp = atoi(p + 5);
1922 }
1923 else if (!strcmp(key, "NAME"))
1924 {
1925 if (info->name)
1926 free(info->name);
1927
1928 info->name = strdup(value);
1929 }
1930 else if (!strcmp(key, "SCREEN"))
1931 info->screen = atoi(value);
1932 else if (!strcmp(key, "BIN"))
1933 {
1934 if (info->bin)
1935 free(info->bin);
1936
1937 info->bin = strdup(value);
1938 }
1939 else if (!strcmp(key, "ICON"))
1940 {
1941 if (info->icon)
1942 free(info->icon);
1943
1944 info->icon = strdup(value);
1945 }
1946 else if (!strcmp(key, "DESKTOP"))
1947 info->desktop = atoi(value);
1948 else if (!strcmp(key, "TIMESTAMP"))
1949 {
1950 if (!info->timestamp)
1951 info->timestamp = atoi(value);
1952 }
1953 else if (!strcmp(key, "DESCRIPTION"))
1954 {
1955 if (info->description)
1956 free(info->description);
1957
1958 info->description = strdup(value);
1959 }
1960 else if (!strcmp(key, "WMCLASS"))
1961 {
1962 if (info->wmclass)
1963 free(info->wmclass);
1964
1965 info->wmclass = strdup(value);
1966 }
1967 else if (!strcmp(key, "SILENT"))
1968 info->silent = atoi(value);
1969 else
1970 ERR("Ecore X Sequence, Unknown: %s=%s", key, value);
1971 }
1972 if (!info->id)
1973 return 0;
1974
1975 return 1;
1976}
1977
1978#endif /* if 0 */
1979
1980/*
1981 * Free startup info struct
1982 */
1983static void
1984_ecore_x_netwm_startup_info_free(void *data)
1985{
1986 Ecore_X_Startup_Info *info;
1987
1988 info = data;
1989 if (!info)
1990 return;
1991
1992 if (info->buffer)
1993 free(info->buffer);
1994
1995 if (info->id)
1996 free(info->id);
1997
1998 if (info->name)
1999 free(info->name);
2000
2001 if (info->bin)
2002 free(info->bin);
2003
2004 if (info->icon)
2005 free(info->icon);
2006
2007 if (info->description)
2008 free(info->description);
2009
2010 if (info->wmclass)
2011 free(info->wmclass);
2012
2013 free(info);
2014}
2015
2016/*
2017 * Is screen composited?
2018 */
2019EAPI Eina_Bool
2020ecore_x_screen_is_composited(int screen)
2021{
2022 Ecore_X_Window win;
2023 static Ecore_X_Atom atom = None;
2024 char buf[32];
2025
2026 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2027 snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen);
2028 if (atom == None)
2029 atom = XInternAtom(_ecore_x_disp, buf, False);
2030
2031 if (atom == None)
2032 return EINA_FALSE;
2033
2034 win = XGetSelectionOwner(_ecore_x_disp, atom);
2035
2036 return (win != None) ? EINA_TRUE : EINA_FALSE;
2037}
2038
2039EAPI void
2040ecore_x_screen_is_composited_set(int screen,
2041 Ecore_X_Window win)
2042{
2043 static Ecore_X_Atom atom = None;
2044 char buf[32];
2045
2046 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2047 snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen);
2048 if (atom == None)
2049 atom = XInternAtom(_ecore_x_disp, buf, False);
2050
2051 if (atom == None)
2052 return;
2053
2054 XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time);
2055}
2056
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
deleted file mode 100644
index 7b13615..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c
+++ /dev/null
@@ -1,121 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "Ecore.h"
6#include "ecore_x_private.h"
7#include "Ecore_X.h"
8
9/**
10 * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
11 *
12 * Functions that operate on pixmaps.
13 */
14
15/**
16 * Creates a new pixmap.
17 * @param win Window used to determine which screen of the display the
18 * pixmap should be created on. If 0, the default root window
19 * is used.
20 * @param w Width of the new pixmap.
21 * @param h Height of the new pixmap.
22 * @param dep Depth of the pixmap. If 0, the default depth of the default
23 * screen is used.
24 * @return New pixmap.
25 * @ingroup Ecore_X_Pixmap_Group
26 */
27EAPI Ecore_X_Pixmap
28ecore_x_pixmap_new(Ecore_X_Window win,
29 int w,
30 int h,
31 int dep)
32{
33 LOGFN(__FILE__, __LINE__, __FUNCTION__);
34 if (win == 0)
35 win = DefaultRootWindow(_ecore_x_disp);
36
37 if (dep == 0)
38 dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
39
40 return XCreatePixmap(_ecore_x_disp, win, w, h, dep);
41}
42
43/**
44 * Deletes the reference to the given pixmap.
45 *
46 * If no other clients have a reference to the given pixmap, the server
47 * will destroy it.
48 *
49 * @param pmap The given pixmap.
50 * @ingroup Ecore_X_Pixmap_Group
51 */
52EAPI void
53ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
54{
55 LOGFN(__FILE__, __LINE__, __FUNCTION__);
56 XFreePixmap(_ecore_x_disp, pmap);
57}
58
59/**
60 * Pastes a rectangular area of the given pixmap onto the given drawable.
61 * @param pmap The given pixmap.
62 * @param dest The given drawable.
63 * @param gc The graphics context which governs which operation will
64 * be used to paste the area onto the drawable.
65 * @param sx The X position of the area on the pixmap.
66 * @param sy The Y position of the area on the pixmap.
67 * @param w The width of the area.
68 * @param h The height of the area.
69 * @param dx The X position at which to paste the area on @p dest.
70 * @param dy The Y position at which to paste the area on @p dest.
71 * @ingroup Ecore_X_Pixmap_Group
72 */
73EAPI void
74ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
75 Ecore_X_Drawable dest,
76 Ecore_X_GC gc,
77 int sx,
78 int sy,
79 int w,
80 int h,
81 int dx,
82 int dy)
83{
84 LOGFN(__FILE__, __LINE__, __FUNCTION__);
85 XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy);
86}
87
88/**
89 * Retrieves the size of the given pixmap.
90 * @param pmap The given pixmap.
91 * @param x Pointer to an integer in which to store the X position.
92 * @param y Pointer to an integer in which to store the Y position.
93 * @param w Pointer to an integer in which to store the width.
94 * @param h Pointer to an integer in which to store the height.
95 * @ingroup Ecore_X_Pixmap_Group
96 */
97EAPI void
98ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
99 int *x,
100 int *y,
101 int *w,
102 int *h)
103{
104 LOGFN(__FILE__, __LINE__, __FUNCTION__);
105 if (pmap)
106 ecore_x_drawable_geometry_get(pmap, x, y, w, h);
107}
108
109/**
110 * Retrieves the depth of the given pixmap.
111 * @param pmap The given pixmap.
112 * @return The depth of the pixmap.
113 * @ingroup Ecore_X_Pixmap_Group
114 */
115EAPI int
116ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
117{
118 LOGFN(__FILE__, __LINE__, __FUNCTION__);
119 return ecore_x_drawable_depth_get(pmap);
120}
121
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
deleted file mode 100644
index 02a01f7..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h
+++ /dev/null
@@ -1,385 +0,0 @@
1#ifndef _ECORE_X_PRIVATE_H
2#define _ECORE_X_PRIVATE_H
3
4#include <sys/param.h>
5#ifndef MAXHOSTNAMELEN
6#define MAXHOSTNAMELEN 256
7#endif /* ifndef MAXHOSTNAMELEN */
8
9#include <X11/Xlib.h>
10#include <X11/Xproto.h>
11#include <X11/Xutil.h>
12#include <X11/Xatom.h>
13#include <X11/Xresource.h>
14#include <X11/keysymdef.h>
15#include <X11/extensions/XShm.h>
16#include <X11/extensions/shape.h>
17#include <X11/extensions/sync.h>
18#include <X11/extensions/dpms.h>
19#ifdef ECORE_XCURSOR
20#include <X11/Xcursor/Xcursor.h>
21#endif /* ifdef ECORE_XCURSOR */
22#ifdef ECORE_XPRINT
23#include <X11/extensions/Print.h>
24#endif /* ifdef ECORE_XPRINT */
25#ifdef ECORE_XINERAMA
26#include <X11/extensions/Xinerama.h>
27#endif /* ifdef ECORE_XINERAMA */
28#ifdef ECORE_XRANDR
29#include <X11/extensions/Xrandr.h>
30#endif /* ifdef ECORE_XRANDR */
31#ifdef ECORE_XSS
32#include <X11/extensions/scrnsaver.h>
33#endif /* ifdef ECORE_XSS */
34#ifdef ECORE_XRENDER
35#include <X11/extensions/Xrender.h>
36#endif /* ifdef ECORE_XRENDER */
37#ifdef ECORE_XFIXES
38#include <X11/extensions/Xfixes.h>
39#endif /* ifdef ECORE_XFIXES */
40#ifdef ECORE_XCOMPOSITE
41#include <X11/extensions/Xcomposite.h>
42#endif /* ifdef ECORE_XCOMPOSITE */
43#ifdef ECORE_XDAMAGE
44#include <X11/extensions/Xdamage.h>
45#endif /* ifdef ECORE_XDAMAGE */
46#ifdef ECORE_XGESTURE
47#include <X11/extensions/gesture.h>
48#include <X11/extensions/gestureproto.h>
49#endif /* ifdef ECORE_XGESTURE */
50#ifdef ECORE_XDPMS
51#include <X11/extensions/dpms.h>
52#endif /* ifdef ECORE_XDPMS */
53#ifdef ECORE_XKB
54#include <X11/XKBlib.h>
55#endif /* ifdef ECORE_XKB */
56#ifdef ECORE_XI2
57#include <X11/extensions/XInput2.h>
58#endif /* ifdef ECORE_XI2 */
59
60#ifndef XK_MISCELLANY
61# define XK_MISCELLANY 1
62#endif
63
64#include "Ecore.h"
65#include "ecore_private.h"
66#include "Ecore_X.h"
67#include "Ecore_Input.h"
68
69extern int _ecore_xlib_log_dom;
70#ifdef ECORE_XLIB_DEFAULT_LOG_COLOR
71# undef ECORE_XLIB_DEFAULT_LOG_COLOR
72#endif /* ifdef ECORE_XLIB_DEFAULT_LOG_COLOR */
73#define ECORE_XLIB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
74
75#ifdef ERR
76# undef ERR
77#endif /* ifdef ERR */
78#define ERR(...) EINA_LOG_DOM_ERR(_ecore_xlib_log_dom, __VA_ARGS__)
79
80#ifdef DBG
81# undef DBG
82#endif /* ifdef DBG */
83#define DBG(...) EINA_LOG_DOM_DBG(_ecore_xlib_log_dom, __VA_ARGS__)
84
85#ifdef INF
86# undef INF
87#endif /* ifdef INF */
88#define INF(...) EINA_LOG_DOM_INFO(_ecore_xlib_log_dom, __VA_ARGS__)
89
90#ifdef WRN
91# undef WRN
92#endif /* ifdef WRN */
93#define WRN(...) EINA_LOG_DOM_WARN(_ecore_xlib_log_dom, __VA_ARGS__)
94
95#ifdef CRIT
96# undef CRIT
97#endif /* ifdef CRIT */
98#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xlib_log_dom, __VA_ARGS__)
99
100typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
101
102struct _Ecore_X_Selection_Intern
103{
104 Ecore_X_Window win;
105 Ecore_X_Atom selection;
106 unsigned char *data;
107 int length;
108 Time time;
109};
110
111typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
112
113struct _Ecore_X_Selection_Converter
114{
115 Ecore_X_Atom target;
116 Eina_Bool (*convert)(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *type, int *typeseize);
117 Ecore_X_Selection_Converter *next;
118};
119
120typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
121
122struct _Ecore_X_Selection_Parser
123{
124 char *target;
125 void *(*parse)(const char *target, void *data, int size, int format);
126 Ecore_X_Selection_Parser *next;
127};
128
129typedef struct _Ecore_X_DND_Source
130{
131 int version;
132 Ecore_X_Window win, dest;
133
134 enum {
135 ECORE_X_DND_SOURCE_IDLE,
136 ECORE_X_DND_SOURCE_DRAGGING,
137 ECORE_X_DND_SOURCE_DROPPED,
138 ECORE_X_DND_SOURCE_CONVERTING
139 } state;
140
141 struct
142 {
143 short x, y;
144 unsigned short width, height;
145 } rectangle;
146
147 struct
148 {
149 Ecore_X_Window window;
150 int x, y;
151 } prev;
152
153 Time time;
154
155 Ecore_X_Atom action, accepted_action;
156
157 int will_accept;
158 int suppress;
159
160 int await_status;
161} Ecore_X_DND_Source;
162
163typedef struct _Ecore_X_DND_Target
164{
165 int version;
166 Ecore_X_Window win, source;
167
168 enum {
169 ECORE_X_DND_TARGET_IDLE,
170 ECORE_X_DND_TARGET_ENTERED
171 } state;
172
173 struct
174 {
175 int x, y;
176 } pos;
177
178 Time time;
179
180 Ecore_X_Atom action, accepted_action;
181
182 int will_accept;
183} Ecore_X_DND_Target;
184
185extern int ECORE_X_MODIFIER_SHIFT;
186extern int ECORE_X_MODIFIER_CTRL;
187extern int ECORE_X_MODIFIER_ALT;
188extern int ECORE_X_MODIFIER_WIN;
189
190extern int ECORE_X_LOCK_SCROLL;
191extern int ECORE_X_LOCK_NUM;
192extern int ECORE_X_LOCK_CAPS;
193extern int ECORE_X_LOCK_SHIFT;
194
195extern Display *_ecore_x_disp;
196extern double _ecore_x_double_click_time;
197extern Time _ecore_x_event_last_time;
198extern Window _ecore_x_event_last_win;
199extern int _ecore_x_event_last_root_x;
200extern int _ecore_x_event_last_root_y;
201extern Eina_Bool _ecore_x_xcursor;
202
203extern Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
204
205extern int _ecore_window_grabs_num;
206extern Window *_ecore_window_grabs;
207extern Eina_Bool (*_ecore_window_grab_replay_func)(void *data,
208 int event_type,
209 void *event);
210extern void *_ecore_window_grab_replay_data;
211
212extern Ecore_X_Window _ecore_x_private_win;
213
214void _ecore_x_error_handler_init(void);
215void _ecore_x_event_handle_any_event(XEvent *xevent);
216void _ecore_x_event_handle_key_press(XEvent *xevent);
217void _ecore_x_event_handle_key_release(XEvent *xevent);
218void _ecore_x_event_handle_button_press(XEvent *xevent);
219void _ecore_x_event_handle_button_release(XEvent *xevent);
220void _ecore_x_event_handle_motion_notify(XEvent *xevent);
221void _ecore_x_event_handle_enter_notify(XEvent *xevent);
222void _ecore_x_event_handle_leave_notify(XEvent *xevent);
223void _ecore_x_event_handle_focus_in(XEvent *xevent);
224void _ecore_x_event_handle_focus_out(XEvent *xevent);
225void _ecore_x_event_handle_keymap_notify(XEvent *xevent);
226void _ecore_x_event_handle_expose(XEvent *xevent);
227void _ecore_x_event_handle_graphics_expose(XEvent *xevent);
228void _ecore_x_event_handle_visibility_notify(XEvent *xevent);
229void _ecore_x_event_handle_create_notify(XEvent *xevent);
230void _ecore_x_event_handle_destroy_notify(XEvent *xevent);
231void _ecore_x_event_handle_unmap_notify(XEvent *xevent);
232void _ecore_x_event_handle_map_notify(XEvent *xevent);
233void _ecore_x_event_handle_map_request(XEvent *xevent);
234void _ecore_x_event_handle_reparent_notify(XEvent *xevent);
235void _ecore_x_event_handle_configure_notify(XEvent *xevent);
236void _ecore_x_event_handle_configure_request(XEvent *xevent);
237void _ecore_x_event_handle_gravity_notify(XEvent *xevent);
238void _ecore_x_event_handle_resize_request(XEvent *xevent);
239void _ecore_x_event_handle_circulate_notify(XEvent *xevent);
240void _ecore_x_event_handle_circulate_request(XEvent *xevent);
241void _ecore_x_event_handle_property_notify(XEvent *xevent);
242void _ecore_x_event_handle_selection_clear(XEvent *xevent);
243void _ecore_x_event_handle_selection_request(XEvent *xevent);
244void _ecore_x_event_handle_selection_notify(XEvent *xevent);
245void _ecore_x_event_handle_colormap_notify(XEvent *xevent);
246void _ecore_x_event_handle_client_message(XEvent *xevent);
247void _ecore_x_event_handle_mapping_notify(XEvent *xevent);
248void _ecore_x_event_handle_shape_change(XEvent *xevent);
249void _ecore_x_event_handle_screensaver_notify(XEvent *xevent);
250#ifdef ECORE_XGESTURE
251void _ecore_x_event_handle_gesture_notify_flick(XEvent *xevent);
252void _ecore_x_event_handle_gesture_notify_pan(XEvent *xevent);
253void _ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent);
254void _ecore_x_event_handle_gesture_notify_tap(XEvent *xevent);
255void _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent);
256void _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent);
257void _ecore_x_event_handle_gesture_notify_group(XEvent *xevent);
258#endif /* ifdef ECORE_XGESTURE */
259void _ecore_x_event_handle_sync_counter(XEvent *xevent);
260void _ecore_x_event_handle_sync_alarm(XEvent *xevent);
261#ifdef ECORE_XRANDR
262void _ecore_x_event_handle_randr_change(XEvent *xevent);
263void _ecore_x_event_handle_randr_notify(XEvent *xevent);
264#endif /* ifdef ECORE_XRANDR */
265#ifdef ECORE_XFIXES
266void _ecore_x_event_handle_fixes_selection_notify(XEvent *xevent);
267#endif /* ifdef ECORE_XFIXES */
268#ifdef ECORE_XDAMAGE
269void _ecore_x_event_handle_damage_notify(XEvent *xevent);
270#endif /* ifdef ECORE_XDAMAGE */
271void _ecore_x_event_handle_generic_event(XEvent *xevent);
272
273void _ecore_x_selection_data_init(void);
274void _ecore_x_selection_shutdown(void);
275Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target);
276char *_ecore_x_selection_target_get(Ecore_X_Atom target);
277Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection);
278Eina_Bool _ecore_x_selection_set(Window w,
279 const void *data,
280 int len,
281 Ecore_X_Atom selection);
282int _ecore_x_selection_convert(Ecore_X_Atom selection,
283 Ecore_X_Atom target,
284 void **data_ret,
285 Ecore_X_Atom *targettype,
286 int *targetsize);
287void *_ecore_x_selection_parse(const char *target,
288 void *data,
289 int size,
290 int format);
291
292void _ecore_x_sync_magic_send(int val,
293 Ecore_X_Window swin);
294void _ecore_x_window_grab_remove(Ecore_X_Window win);
295void _ecore_x_key_grab_remove(Ecore_X_Window win);
296
297/* from dnd */
298void _ecore_x_dnd_init(void);
299Ecore_X_DND_Source *_ecore_x_dnd_source_get(void);
300Ecore_X_DND_Target *_ecore_x_dnd_target_get(void);
301void _ecore_x_dnd_drag(Ecore_X_Window root,
302 int x,
303 int y);
304void _ecore_x_dnd_shutdown(void);
305
306/* from netwm */
307Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
308int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win,
309 char *data);
310int _ecore_x_netwm_startup_info(Ecore_X_Window win,
311 char *data);
312
313/* Fixes * Damage * Composite * DPMS */
314void _ecore_x_fixes_init(void);
315void _ecore_x_damage_init(void);
316void _ecore_x_composite_init(void);
317void _ecore_x_dpms_init(void);
318void _ecore_x_randr_init(void);
319void _ecore_x_gesture_init(void);
320
321void _ecore_x_atoms_init(void);
322
323extern int _ecore_x_xi2_opcode;
324
325void _ecore_x_events_init(void);
326void _ecore_x_events_shutdown(void);
327
328void _ecore_x_input_init(void);
329void _ecore_x_input_shutdown(void);
330void _ecore_x_input_handler(XEvent *xevent);
331/* from sync */
332
333void _ecore_mouse_move(unsigned int timestamp,
334 unsigned int xmodifiers,
335 int x,
336 int y,
337 int x_root,
338 int y_root,
339 unsigned int event_window,
340 unsigned int window,
341 unsigned int root_win,
342 int same_screen,
343 int dev,
344 double radx,
345 double rady,
346 double pressure,
347 double angle,
348 double mx,
349 double my,
350 double mrx,
351 double mry);
352Ecore_Event_Mouse_Button *_ecore_mouse_button(int event,
353 unsigned int timestamp,
354 unsigned int xmodifiers,
355 unsigned int buttons,
356 int x,
357 int y,
358 int x_root,
359 int y_root,
360 unsigned int event_window,
361 unsigned int window,
362 unsigned int root_win,
363 int same_screen,
364 int dev,
365 double radx,
366 double rady,
367 double pressure,
368 double angle,
369 double mx,
370 double my,
371 double mrx,
372 double mry);
373
374void _ecore_x_modifiers_get(void);
375
376//#define LOGFNS 1
377
378#ifdef LOGFNS
379#include <stdio.h>
380#define LOGFN(fl, ln, fn) printf("-ECORE-X: %25s: %5i - %s\n", fl, ln, fn);
381#else /* ifdef LOGFNS */
382#define LOGFN(fl, ln, fn)
383#endif /* ifdef LOGFNS */
384
385#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
deleted file mode 100644
index d4d834f..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c
+++ /dev/null
@@ -1,102 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6#include "ecore_x_randr.h"
7
8static Eina_Bool _randr_available = EINA_FALSE;
9#ifdef ECORE_XRANDR
10static int _randr_major, _randr_minor;
11int _randr_version;
12#define RANDR_1_1 ((1 << 16) | 1)
13#define RANDR_1_2 ((1 << 16) | 2)
14#define RANDR_1_3 ((1 << 16) | 3)
15
16#define RANDR_VALIDATE_ROOT(screen, \
17 root) ((screen = \
18 XRRRootToScreen(_ecore_x_disp, \
19 root)) != -1)
20
21#define Ecore_X_Randr_Unset -1
22
23XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy,
24 Window window);
25
26#endif /* ifdef ECORE_XRANDR */
27
28void
29_ecore_x_randr_init(void)
30{
31#ifdef ECORE_XRANDR
32 _randr_major = 1;
33 _randr_minor = 3;
34 _randr_version = 0;
35
36 _ecore_x_randr_get_screen_resources = NULL;
37 if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor))
38 {
39 _randr_version = (_randr_major << 16) | _randr_minor;
40 if (_randr_version >= RANDR_1_3)
41 _ecore_x_randr_get_screen_resources = XRRGetScreenResourcesCurrent;
42 else if (_randr_version == RANDR_1_2)
43 _ecore_x_randr_get_screen_resources = XRRGetScreenResources;
44
45 _randr_available = EINA_TRUE;
46 }
47 else
48 _randr_available = EINA_FALSE;
49
50#else
51 _randr_available = EINA_FALSE;
52#endif
53}
54
55/*
56 * @brief query whether randr is available or not
57 * @return EINA_TRUE, if extension is available, else EINA_FALSE
58 */
59EAPI Eina_Bool
60ecore_x_randr_query(void)
61{
62 return _randr_available;
63}
64
65/*
66 * @return version of the RandRR extension supported by the server or,
67 * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1).
68 * bit version information: 31 MAJOR 16 | 15 MINOR 0
69 */
70EAPI int
71ecore_x_randr_version_get(void)
72{
73#ifdef ECORE_XRANDR
74 LOGFN(__FILE__, __LINE__, __FUNCTION__);
75 if (_randr_available)
76 {
77 return _randr_version;
78 }
79 else
80 {
81 return Ecore_X_Randr_Unset;
82 }
83#else
84 return -1;
85#endif
86}
87
88Eina_Bool
89_ecore_x_randr_root_validate(Ecore_X_Window root)
90{
91#ifdef ECORE_XRANDR
92 Ecore_X_Randr_Screen scr = -1;
93 if (root && RANDR_VALIDATE_ROOT(scr, root))
94 return EINA_TRUE;
95 else
96 return EINA_FALSE;
97
98#else
99 return EINA_FALSE;
100#endif
101}
102
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
deleted file mode 100644
index eca3c0c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef ECORE_X_INLINE_X
2#define ECORE_X_INLINE_X
3Eina_Bool _ecore_x_randr_root_validate(Ecore_X_Window root);
4Eina_Bool _ecore_x_randr_output_validate(Ecore_X_Window root,
5 Ecore_X_Randr_Output
6 output);
7#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
deleted file mode 100644
index 816f8d5..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c
+++ /dev/null
@@ -1,335 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif /* ifdef HAVE_CONFIG_H */
8
9#include "ecore_x_private.h"
10#include "ecore_x_randr.h"
11#include <stdio.h>
12#include <stdlib.h>
13#include <unistd.h>
14#include <string.h>
15
16#define Ecore_X_Randr_None 0
17#ifdef ECORE_XRANDR
18
19#define RANDR_1_1 ((1 << 16) | 1)
20
21#define RANDR_VALIDATE_ROOT(screen, \
22 root) ((screen = \
23 XRRRootToScreen(_ecore_x_disp, \
24 root)) != -1)
25#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) \
26 return ret
27
28extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
29 dpy,
30 Window
31 window);
32extern int _randr_version;
33#endif /* ifdef ECORE_XRANDR */
34
35/*
36 * @param root window which's primary output will be queried
37 */
38EAPI Ecore_X_Randr_Orientation
39ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root)
40{
41#ifdef ECORE_XRANDR
42 Rotation rot = Ecore_X_Randr_None, crot;
43
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45 rot =
46 XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
47 root), &crot);
48 return rot;
49#else /* ifdef ECORE_XRANDR */
50 return Ecore_X_Randr_None;
51#endif /* ifdef ECORE_XRANDR */
52}
53
54/*
55 * @param root window which's primary output will be queried
56 * @return the current orientation of the root window's screen primary output
57 */
58EAPI Ecore_X_Randr_Orientation
59ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root)
60{
61#ifdef ECORE_XRANDR
62 Rotation crot = Ecore_X_Randr_None;
63 XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
64 root), &crot);
65 return crot;
66#else /* ifdef ECORE_XRANDR */
67 return Ecore_X_Randr_None;
68#endif /* ifdef ECORE_XRANDR */
69}
70
71/*
72 * @brief sets a given screen's primary output's orientation
73 * @param root window which's screen's primary output will be queried
74 * @param orientation orientation which should be set for the root window's screen primary output
75 * @return EINA_TRUE if the primary output's orientation could be successfully altered
76 */
77EAPI Eina_Bool
78ecore_x_randr_screen_primary_output_orientation_set(
79 Ecore_X_Window root,
80 Ecore_X_Randr_Orientation
81 orientation)
82{
83#ifdef ECORE_XRANDR
84 XRRScreenConfiguration *xrr_screen_cfg = NULL;
85 int sizeid;
86 Rotation crot;
87 Eina_Bool ret = EINA_FALSE;
88 if (!(xrr_screen_cfg = XRRGetScreenInfo(_ecore_x_disp, root)))
89 return EINA_FALSE;
90
91 sizeid = XRRConfigCurrentConfiguration(xrr_screen_cfg, &crot);
92 if (!XRRSetScreenConfig(_ecore_x_disp, xrr_screen_cfg, root, sizeid,
93 orientation, CurrentTime))
94 ret = EINA_TRUE;
95
96 if (xrr_screen_cfg)
97 XRRFreeScreenConfigInfo(xrr_screen_cfg);
98
99 return ret;
100#else /* ifdef ECORE_XRANDR */
101 return EINA_FALSE;
102#endif /* ifdef ECORE_XRANDR */
103}
104
105/*
106 * @brief gets a screen's primary output's possible sizes
107 * @param root window which's primary output will be queried
108 * @param num number of sizes reported as supported by the screen's primary output
109 * @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL
110 */
111EAPI Ecore_X_Randr_Screen_Size_MM *
112ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
113 int *num)
114{
115#ifdef ECORE_XRANDR
116 Ecore_X_Randr_Screen_Size_MM *ret = NULL;
117 XRRScreenSize *sizes;
118 int i, n;
119
120 /* we don't have to free sizes, because they're hold in a cache inside X*/
121 sizes =
122 XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
123 root), &n);
124 if ((!sizes) || (n <= 0)) return NULL;
125 ret = calloc(n, sizeof(Ecore_X_Randr_Screen_Size_MM));
126 if (!ret)
127 return NULL;
128
129 if (num)
130 *num = n;
131
132 for (i = 0; i < n; i++)
133 {
134 ret[i].width = sizes[i].width;
135 ret[i].height = sizes[i].height;
136 ret[i].width_mm = sizes[i].mwidth;
137 ret[i].height_mm = sizes[i].mheight;
138 }
139 return ret;
140#else /* ifdef ECORE_XRANDR */
141 return NULL;
142#endif /* ifdef ECORE_XRANDR */
143}
144
145/*
146 * @brief get the current set size of a given screen's primary output
147 * @param root window which's primary output will be queried
148 * @param w the current size's width
149 * @param h the current size's height
150 * @param w_mm the current size's width in mm
151 * @param h_mm the current size's height in mm
152 * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set()
153 */
154EAPI void
155ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root,
156 int *w,
157 int *h,
158 int *w_mm,
159 int *h_mm,
160 int *size_index)
161{
162#ifdef ECORE_XRANDR
163 XRRScreenSize *sizes;
164 XRRScreenConfiguration *sc = NULL;
165 int idx;
166 Rotation orientation;
167 int n;
168
169 if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root)))
170 {
171 ERR("Couldn't get screen information for %d", root);
172 return;
173 }
174
175 idx = XRRConfigCurrentConfiguration(sc, &orientation);
176
177 sizes =
178 XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
179 root), &n);
180 if ((idx < n) && (idx >= 0))
181 {
182 if (w)
183 *w = sizes[idx].width;
184
185 if (h)
186 *h = sizes[idx].height;
187
188 if (w_mm)
189 *w_mm = sizes[idx].mwidth;
190
191 if (h_mm)
192 *h_mm = sizes[idx].mheight;
193
194 if (size_index)
195 *size_index = idx;
196 }
197
198 XRRFreeScreenConfigInfo(sc);
199#endif /* ifdef ECORE_XRANDR */
200}
201
202/*
203 * @brief sets a given screen's primary output size, but disables all other outputs at the same time
204 * @param root window which's primary output will be queried
205 * @param size_index within the list of sizes reported as supported by the root window's screen primary output
206 * @return EINA_TRUE on success, EINA_FALSE on failure due to e.g. invalid times
207 */
208EAPI Eina_Bool
209ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
210 int size_index)
211{
212#ifdef ECORE_XRANDR
213 XRRScreenConfiguration *sc = NULL;
214 Eina_Bool ret = EINA_FALSE;
215 int nsizes = 0;
216
217 if (size_index >= 0 && _ecore_x_randr_root_validate(root))
218 {
219 XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
220 root), &nsizes);
221
222 if (size_index < nsizes)
223 {
224 sc = XRRGetScreenInfo(_ecore_x_disp, root);
225 if (!XRRSetScreenConfig(_ecore_x_disp, sc,
226 root, size_index,
227 ECORE_X_RANDR_ORIENTATION_ROT_0, CurrentTime))
228 {
229 ret = EINA_TRUE;
230 }
231
232 if (sc)
233 XRRFreeScreenConfigInfo(sc);
234 }
235 }
236
237 return ret;
238#else /* ifdef ECORE_XRANDR */
239 return EINA_FALSE;
240#endif /* ifdef ECORE_XRANDR */
241}
242
243/*
244 * @param root window which's primary output will be queried
245 * @return currently used refresh rate or - if request failed or RandRR is not available - 0.0
246 */
247EAPI Ecore_X_Randr_Refresh_Rate
248ecore_x_randr_screen_primary_output_current_refresh_rate_get(
249 Ecore_X_Window root)
250{
251#ifdef ECORE_XRANDR
252 Ecore_X_Randr_Refresh_Rate ret = 0.0;
253 XRRScreenConfiguration *sc = NULL;
254
255 if (!_ecore_x_randr_root_validate(root) ||
256 !(sc = XRRGetScreenInfo(_ecore_x_disp, root)))
257 return ret;
258
259 ret = XRRConfigCurrentRate(sc);
260 if (sc)
261 XRRFreeScreenConfigInfo(sc);
262
263 return ret;
264#else /* ifdef ECORE_XRANDR */
265 return 0.0;
266#endif /* ifdef ECORE_XRANDR */
267}
268
269/*
270 * @param root window which's primary output will be queried
271 * @param size_index referencing the size to query valid refresh rates for
272 * @return currently used refresh rate or - if request failed or RandRR is not available - NULL
273 */
274EAPI Ecore_X_Randr_Refresh_Rate *
275ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
276 int size_index,
277 int *num)
278{
279#ifdef ECORE_XRANDR
280 Ecore_X_Randr_Refresh_Rate *ret = NULL, *rates = NULL;
281 Ecore_X_Randr_Screen scr;
282 int n;
283
284 if (num
285 && RANDR_VALIDATE_ROOT(scr, root)
286 && (rates = XRRRates(_ecore_x_disp, scr, size_index, &n)))
287 {
288 if (rates && (ret = malloc(sizeof(Ecore_X_Randr_Refresh_Rate) * n)))
289 {
290 memcpy(ret, rates, (sizeof(Ecore_X_Randr_Refresh_Rate) * n));
291 *num = n;
292 }
293 }
294
295 return ret;
296#else /* ifdef ECORE_XRANDR */
297 return NULL;
298#endif /* ifdef ECORE_XRANDR */
299}
300
301//>= 1.1
302/*
303 * @brief sets the current primary output's refresh rate
304 * @param root window which's primary output will be queried
305 * @param size_index referencing the size to be set
306 * @param rate the refresh rate to be set
307 * @return EINA_TRUE on success else EINA_FALSE
308 */
309EAPI Eina_Bool
310ecore_x_randr_screen_primary_output_refresh_rate_set(
311 Ecore_X_Window root,
312 int size_index,
313 Ecore_X_Randr_Refresh_Rate
314 rate)
315{
316#ifdef ECORE_XRANDR
317 RANDR_CHECK_1_1_RET(EINA_FALSE);
318 Eina_Bool ret = EINA_FALSE;
319 XRRScreenConfiguration *sc = NULL;
320
321 if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root)))
322 return ret;
323
324 if (!XRRSetScreenConfigAndRate(_ecore_x_disp, sc,
325 root, size_index,
326 RR_Rotate_0, rate, CurrentTime))
327 ret = EINA_TRUE;
328
329 XRRFreeScreenConfigInfo(sc);
330 return ret;
331#else /* ifdef ECORE_XRANDR */
332 return EINA_FALSE;
333#endif /* ifdef ECORE_XRANDR */
334}
335
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
deleted file mode 100644
index ec23b3c..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
+++ /dev/null
@@ -1,2360 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include "ecore_x_private.h"
10#include "ecore_x_randr.h"
11#include <stdio.h>
12#include <stdlib.h>
13#include <unistd.h>
14#include <string.h>
15
16#define Ecore_X_Randr_None (Ecore_X_Randr_Crtc)0
17#define Ecore_X_Randr_Unset (Ecore_X_Randr_Crtc) - 1
18
19#ifdef ECORE_XRANDR
20
21#define RANDR_1_2 ((1 << 16) | 2)
22
23#define RANDR_VALIDATE_ROOT(screen, root) \
24 ((screen = XRRRootToScreen(_ecore_x_disp, root)) != -1)
25
26#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) \
27 return ret
28
29#define RANDR_PROPERTY_EDID "EDID"
30#define RANDR_PROPERTY_BACKLIGHT "Backlight"
31#define RANDR_PROPERTY_SIGNAL_FORMAT "SignalFormat"
32#define RANDR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties"
33#define RANDR_PROPERTY_CONNECTOR_TYPE "ConnectorType"
34#define RANDR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber"
35#define RANDR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList"
36#define RANDR_PROPERTY_CLONE_LIST "CloneList"
37
38extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
39 dpy,
40 Window
41 window);
42extern int _randr_version;
43#endif
44
45/**
46 * @brief enable event selection. This enables basic interaction with
47 * output/crtc events and requires RRandR >= 1.2.
48 * @param win select this window's properties for RandRR events
49 * @param on enable/disable selecting
50 */
51EAPI void
52ecore_x_randr_events_select(Ecore_X_Window win,
53 Eina_Bool on)
54{
55#ifdef ECORE_XRANDR
56 int mask;
57
58 LOGFN(__FILE__, __LINE__, __FUNCTION__);
59 if (!on)
60 mask = 0;
61 else
62 {
63 mask = RRScreenChangeNotifyMask;
64 if (_randr_version >= RANDR_1_2)
65 mask |= (RRCrtcChangeNotifyMask |
66 RROutputChangeNotifyMask |
67 RROutputPropertyNotifyMask);
68 }
69
70 XRRSelectInput(_ecore_x_disp, win, mask);
71#endif
72}
73
74/**
75 * @brief validates a CRTC for a given root window's screen.
76 * @param root the window which's default display will be queried
77 * @param crtc the CRTC to be validated.
78 * @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned.
79 */
80static inline Eina_Bool
81_ecore_x_randr_crtc_validate(Ecore_X_Window root,
82 Ecore_X_Randr_Crtc crtc)
83{
84#ifdef ECORE_XRANDR
85 RANDR_CHECK_1_2_RET(EINA_FALSE);
86
87 XRRScreenResources *res = NULL;
88 int i;
89 Eina_Bool ret = EINA_FALSE;
90
91 if ((crtc == Ecore_X_Randr_None) ||
92 (crtc == Ecore_X_Randr_Unset))
93 return ret;
94
95 if (_ecore_x_randr_root_validate(root) && crtc &&
96 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
97 {
98 for (i = 0; i < res->ncrtc; i++)
99 {
100 if (res->crtcs[i] == crtc)
101 {
102 ret = EINA_TRUE;
103 break;
104 }
105 }
106 XRRFreeScreenResources(res);
107 }
108
109 return ret;
110#else
111 return EINA_FALSE;
112#endif
113}
114
115Eina_Bool
116_ecore_x_randr_output_validate(Ecore_X_Window root,
117 Ecore_X_Randr_Output output)
118{
119#ifdef ECORE_XRANDR
120 RANDR_CHECK_1_2_RET(EINA_FALSE);
121
122 Eina_Bool ret = EINA_FALSE;
123 XRRScreenResources *res = NULL;
124 int i;
125
126 if (_ecore_x_randr_root_validate(root) && output &&
127 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
128 {
129 for (i = 0; i < res->noutput; i++)
130 {
131 if (res->outputs[i] == output)
132 {
133 ret = EINA_TRUE;
134 break;
135 }
136 }
137 XRRFreeScreenResources(res);
138 }
139
140 return ret;
141#else
142 return EINA_FALSE;
143#endif
144}
145
146static inline Eina_Bool
147_ecore_x_randr_mode_validate(Ecore_X_Window root,
148 Ecore_X_Randr_Mode mode)
149{
150#ifdef ECORE_XRANDR
151 RANDR_CHECK_1_2_RET(EINA_FALSE);
152
153 Eina_Bool ret = EINA_FALSE;
154 XRRScreenResources *res = NULL;
155 int i;
156
157 if (_ecore_x_randr_root_validate(root) && mode &&
158 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
159 {
160 for (i = 0; i < res->nmode; i++)
161 {
162 if (res->modes[i].id == mode)
163 {
164 ret = EINA_TRUE;
165 break;
166 }
167 }
168 XRRFreeScreenResources(res);
169 }
170
171 return ret;
172#else
173 return EINA_FALSE;
174#endif
175}
176
177/*
178 * @param w width of screen in px
179 * @param h height of screen in px
180 */
181EAPI void
182ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
183 int *w,
184 int *h,
185 int *w_mm,
186 int *h_mm)
187{
188#ifdef ECORE_XRANDR
189 RANDR_CHECK_1_2_RET();
190 Ecore_X_Randr_Screen scr;
191
192 if (!RANDR_VALIDATE_ROOT(scr, root))
193 return;
194
195 if (w)
196 *w = DisplayWidth(_ecore_x_disp, scr);
197
198 if (h)
199 *h = DisplayHeight(_ecore_x_disp, scr);
200
201 if (w_mm)
202 *w_mm = DisplayWidthMM(_ecore_x_disp, scr);
203
204 if (h_mm)
205 *h_mm = DisplayHeightMM(_ecore_x_disp, scr);
206
207#endif
208}
209
210/*
211 * @param root window which's screen will be queried
212 * @param wmin minimum width the screen can be set to
213 * @param hmin minimum height the screen can be set to
214 * @param wmax maximum width the screen can be set to
215 * @param hmax maximum height the screen can be set to
216 */
217EAPI void
218ecore_x_randr_screen_size_range_get(Ecore_X_Window root,
219 int *wmin,
220 int *hmin,
221 int *wmax,
222 int *hmax)
223{
224#ifdef ECORE_XRANDR
225 RANDR_CHECK_1_2_RET();
226 int twmin, thmin, twmax, thmax;
227 if (XRRGetScreenSizeRange (_ecore_x_disp, root, &twmin, &thmin, &twmax,
228 &thmax))
229 {
230 if (wmin)
231 *wmin = twmin;
232
233 if (hmin)
234 *hmin = thmin;
235
236 if (wmax)
237 *wmax = twmax;
238
239 if (hmax)
240 *hmax = thmax;
241 }
242
243#endif
244}
245
246/*
247 * @param root window which's screen's size should be set. If invalid (e.g. NULL) no action is taken.
248 * @param w width in px the screen should be set to. If out of valid boundaries, current value is assumed.
249 * @param h height in px the screen should be set to. If out of valid boundaries, current value is assumed.
250 * @param w_mm width in mm the screen should be set to. If 0, current aspect is assumed.
251 * @param h_mm height in mm the screen should be set to. If 0, current aspect is assumed.
252 * @return EINA_TRUE if request was successfully sent or screen is already in
253 * requested size, EINA_FALSE if parameters are invalid
254 */
255EAPI Eina_Bool
256ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
257 int w,
258 int h,
259 int w_mm,
260 int h_mm)
261{
262#ifdef ECORE_XRANDR
263 RANDR_CHECK_1_2_RET(EINA_FALSE);
264
265 Ecore_X_Randr_Screen scr;
266 int w_c, h_c, w_mm_c, h_mm_c, twmin, thmin, twmax, thmax;
267
268 if (!RANDR_VALIDATE_ROOT(scr, root))
269 return EINA_FALSE;
270
271 ecore_x_randr_screen_current_size_get(root, &w_c, &h_c, &w_mm_c, &h_mm_c);
272 if ((w == w_c) && (h == h_c) && (w_mm_c == w_mm) && (h_mm_c == h_mm))
273 return EINA_TRUE;
274
275 ecore_x_randr_screen_size_range_get(root, &twmin, &thmin, &twmax, &thmax);
276
277 if (((w != Ecore_X_Randr_None) &&
278 ((w < twmin) ||
279 (w > twmax))) ||
280 ((h != Ecore_X_Randr_None) && ((h < thmin) || (h > thmax))))
281 return EINA_FALSE;
282
283 if (w <= 0)
284 w = DisplayWidth(_ecore_x_disp, scr);
285
286 if (h <= 0)
287 h = DisplayHeight(_ecore_x_disp, scr);
288
289 if (w_mm <= 0)
290 w_mm =
291 (int)(((double)(DisplayWidthMM(_ecore_x_disp,
292 scr) /
293 (double)DisplayWidth(_ecore_x_disp,
294 scr))) * (double)w);
295
296 if (h_mm <= 0)
297 h_mm =
298 (int)(((double)(DisplayHeightMM(_ecore_x_disp,
299 scr) /
300 (double)DisplayHeight(_ecore_x_disp,
301 scr))) * (double)h);
302
303 XRRSetScreenSize (_ecore_x_disp, root, w, h, w_mm, h_mm);
304 return EINA_TRUE;
305#else
306 return EINA_FALSE;
307#endif
308}
309
310/*
311 * @brief get detailed information for all modes related to a root window's screen
312 * @param root window which's screen's ressources are queried
313 * @param num number of modes returned
314 * @return modes' information
315 */
316EAPI Ecore_X_Randr_Mode_Info **
317ecore_x_randr_modes_info_get(Ecore_X_Window root,
318 int *num)
319{
320#ifdef ECORE_XRANDR
321 RANDR_CHECK_1_2_RET(NULL);
322 XRRScreenResources *res = NULL;
323 Ecore_X_Randr_Mode_Info **ret = NULL;
324 int i;
325
326 if (_ecore_x_randr_root_validate(root) &&
327 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
328 {
329 if ((ret =
330 (Ecore_X_Randr_Mode_Info **)malloc(sizeof(
331 Ecore_X_Randr_Mode_Info *)
332 *
333 res->nmode)))
334 {
335 for (i = 0; i < res->nmode; i++)
336 {
337 if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info))))
338 {
339 ret[i]->xid = res->modes[i].id;
340 ret[i]->width = res->modes[i].width;
341 ret[i]->height = res->modes[i].height;
342 ret[i]->dotClock = res->modes[i].dotClock;
343 ret[i]->hSyncStart = res->modes[i].hSyncStart;
344 ret[i]->hSyncEnd = res->modes[i].hSyncEnd;
345 ret[i]->hTotal = res->modes[i].hTotal;
346 ret[i]->hSkew = res->modes[i].hSkew;
347 ret[i]->vSyncStart = res->modes[i].vSyncStart;
348 ret[i]->vSyncEnd = res->modes[i].vSyncEnd;
349 ret[i]->vTotal = res->modes[i].vTotal;
350 if ((ret[i]->name = (malloc(res->modes[i].nameLength + 1))))
351 strncpy(ret[i]->name, res->modes[i].name,
352 (res->modes[i].nameLength + 1));
353 else
354 ret[i]->name = NULL;
355
356 ret[i]->nameLength = res->modes[i].nameLength;
357 ret[i]->modeFlags = res->modes[i].modeFlags;
358 }
359 else
360 {
361 while (i > 0)
362 free(ret[--i]);
363 free(ret);
364 ret = NULL;
365 break;
366 }
367 }
368 }
369
370 if (ret && num)
371 *num = res->nmode;
372
373 XRRFreeScreenResources(res);
374 }
375
376 return ret;
377#else
378 return NULL;
379#endif
380}
381
382/*
383 * @brief add a mode to a display
384 * @param root window to which's screen's ressources are added
385 * @param mode_info
386 * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode
387 * adding failed.
388 * @since 1.2.0
389 */
390EAPI Ecore_X_Randr_Mode
391ecore_x_randr_mode_info_add(Ecore_X_Window root,
392 Ecore_X_Randr_Mode_Info *mode_info)
393{
394#ifdef ECORE_XRANDR
395 RANDR_CHECK_1_2_RET(EINA_FALSE);
396 Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
397
398 if (_ecore_x_randr_root_validate(root) && mode_info)
399 mode = XRRCreateMode(_ecore_x_disp, root, (XRRModeInfo*)mode_info);
400
401 return mode;
402#else
403 return Ecore_X_Randr_None;
404#endif
405}
406
407/*
408 * @brief delete a mode from the display
409 * @param mode_info
410 * @since 1.2.0
411 */
412EAPI void
413ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode)
414{
415#ifdef ECORE_XRANDR
416 RANDR_CHECK_1_2_RET();
417
418 XRRDestroyMode(_ecore_x_disp, mode);
419#else
420 return;
421#endif
422}
423
424/*
425 * @brief get detailed information for a given mode id
426 * @param root window which's screen's ressources are queried
427 * @param mode the XID which identifies the mode of interest
428 * @return mode's detailed information
429 */
430EAPI Ecore_X_Randr_Mode_Info *
431ecore_x_randr_mode_info_get(Ecore_X_Window root,
432 Ecore_X_Randr_Mode mode)
433{
434#ifdef ECORE_XRANDR
435 RANDR_CHECK_1_2_RET(NULL);
436 XRRScreenResources *res = NULL;
437 Ecore_X_Randr_Mode_Info *ret = NULL;
438 int i;
439
440 if (_ecore_x_randr_root_validate(root) &&
441 (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
442 {
443 for (i = 0; i < res->nmode; i++)
444 {
445 if ((res->modes[i].id == mode) &&
446 (ret = malloc(sizeof(Ecore_X_Randr_Mode_Info))))
447 {
448 ret->xid = res->modes[i].id;
449 ret->width = res->modes[i].width;
450 ret->height = res->modes[i].height;
451 ret->dotClock = res->modes[i].dotClock;
452 ret->hSyncStart = res->modes[i].hSyncStart;
453 ret->hSyncEnd = res->modes[i].hSyncEnd;
454 ret->hTotal = res->modes[i].hTotal;
455 ret->hSkew = res->modes[i].hSkew;
456 ret->vSyncStart = res->modes[i].vSyncStart;
457 ret->vSyncEnd = res->modes[i].vSyncEnd;
458 ret->vTotal = res->modes[i].vTotal;
459 ret->name = NULL;
460 ret->nameLength = 0;
461 if (res->modes[i].nameLength > 0)
462 {
463 ret->nameLength = res->modes[i].nameLength;
464 ret->name = malloc(res->modes[i].nameLength + 1);
465 if (ret->name)
466 memcpy(ret->name, res->modes[i].name,
467 res->modes[i].nameLength + 1);
468 }
469 ret->modeFlags = res->modes[i].modeFlags;
470 break;
471 }
472 }
473 XRRFreeScreenResources(res);
474 }
475
476 return ret;
477#else
478 return NULL;
479#endif
480}
481
482/*
483 * @brief free detailed mode information. The pointer handed in will be set to
484 * NULL after freeing the memory.
485 * @param mode_info the mode information that should be freed
486 */
487EAPI void
488ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info)
489{
490#ifdef ECORE_XRANDR
491 RANDR_CHECK_1_2_RET();
492 if (!mode_info)
493 return;
494
495 if (mode_info->name)
496 free(mode_info->name);
497
498 free(mode_info);
499 mode_info = NULL;
500#endif
501}
502
503/*
504 * @brief get all known CRTCs related to a root window's screen
505 * @param root window which's screen's ressources are queried
506 * @param num number of CRTCs returned
507 * @return CRTC IDs
508 */
509EAPI Ecore_X_Randr_Crtc *
510ecore_x_randr_crtcs_get(Ecore_X_Window root,
511 int *num)
512{
513#ifdef ECORE_XRANDR
514 RANDR_CHECK_1_2_RET(NULL);
515 XRRScreenResources *res = NULL;
516 Ecore_X_Randr_Crtc *ret = NULL;
517
518 if (num && root &&
519 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
520 {
521 if ((ret = malloc(sizeof(Ecore_X_Randr_Crtc) * res->ncrtc)))
522 {
523 memcpy(ret, res->crtcs, (sizeof(Ecore_X_Randr_Crtc) * res->ncrtc));
524 *num = res->ncrtc;
525 }
526
527 XRRFreeScreenResources(res);
528 }
529
530 return ret;
531#else
532 return NULL;
533#endif
534}
535
536/*
537 * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead.
538 * @brief get the CRTCs, which display a certain window
539 * @param window window the displaying crtcs shall be found for
540 * @param num the number of crtcs displaying the window
541 * @return array of crtcs that display a certain window. NULL if no crtcs
542 * was found that displays the specified window.
543 */
544EAPI Ecore_X_Randr_Crtc *
545ecore_x_randr_current_crtc_get(Ecore_X_Window window,
546 int *num)
547{
548 return ecore_x_randr_window_crtcs_get(window, num);
549}
550
551/*
552 * @brief get the CRTCs, which display a certain window
553 * @param window window the displaying crtcs shall be found for
554 * @param num the number of crtcs displaying the window
555 * @return array of crtcs that display a certain window. NULL if no crtcs
556 * was found that displays the specified window.
557 * @since 1.2.0
558 */
559EAPI Ecore_X_Randr_Crtc *
560ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
561 int *num)
562{
563#ifdef ECORE_XRANDR
564 Ecore_X_Window root;
565 Eina_Rectangle w_geo, c_geo;
566 Ecore_X_Randr_Crtc *crtcs;
567 Ecore_X_Randr_Mode mode;
568 Ecore_X_Randr_Output *ret = NULL;
569 Window tw;
570 int ncrtcs, i, nret = 0, rx = 0, ry = 0;
571
572 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_window_crtcs_get_fail;
573
574 ecore_x_window_geometry_get(window,
575 &w_geo.x, &w_geo.y,
576 &w_geo.w, &w_geo.h);
577
578 root = ecore_x_window_root_get(window);
579 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
580 if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail;
581
582 /* now get window RELATIVE to root window - thats what matters. */
583 XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw);
584 w_geo.x = rx;
585 w_geo.y = ry;
586
587 for (i = 0, nret = 0; i < ncrtcs; i++)
588 {
589 /* if crtc is not enabled, don't bother about it any further */
590 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
591 if (mode == Ecore_X_Randr_None) continue;
592
593 ecore_x_randr_crtc_geometry_get(root, crtcs[i],
594 &c_geo.x, &c_geo.y,
595 &c_geo.w, &c_geo.h);
596 if (eina_rectangles_intersect(&w_geo, &c_geo))
597 {
598 ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret));
599 ret[nret] = crtcs[i];
600 }
601 }
602 free(crtcs);
603
604 if (num) *num = nret;
605 return ret;
606
607_ecore_x_randr_window_crtcs_get_fail:
608#endif
609 if (num) *num = 0;
610 return NULL;
611}
612
613EAPI Ecore_X_Randr_Output *
614ecore_x_randr_outputs_get(Ecore_X_Window root,
615 int *num)
616{
617#ifdef ECORE_XRANDR
618 RANDR_CHECK_1_2_RET(NULL);
619 XRRScreenResources *res = NULL;
620 Ecore_X_Randr_Output *ret = NULL;
621
622 if (num && root &&
623 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
624 {
625 if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * res->noutput)))
626 {
627 memcpy(ret, res->outputs,
628 (sizeof(Ecore_X_Randr_Output) * res->noutput));
629 if (num)
630 *num = res->noutput;
631 }
632
633 if (res)
634 XRRFreeScreenResources(res);
635 }
636
637 return ret;
638#else
639 return NULL;
640#endif
641}
642
643//Per Crtc
644/*
645 * @brief get a CRTC's outputs.
646 * @param root the root window which's screen will be queried
647 * @param num number of outputs referenced by given CRTC
648 */
649EAPI Ecore_X_Randr_Output *
650ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
651 Ecore_X_Randr_Crtc crtc,
652 int *num)
653{
654#ifdef ECORE_XRANDR
655 RANDR_CHECK_1_2_RET(NULL);
656 XRRScreenResources *res = NULL;
657 Ecore_X_Randr_Output *ret = NULL;
658 XRRCrtcInfo *crtc_info = NULL;
659
660 if (_ecore_x_randr_crtc_validate(root,
661 crtc) &&
662 (res =
663 _ecore_x_randr_get_screen_resources (_ecore_x_disp,
664 root)) &&
665 (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
666 {
667 if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->noutput)))
668 {
669 memcpy(ret, crtc_info->outputs,
670 (sizeof(Ecore_X_Randr_Output) * crtc_info->noutput));
671 if (num)
672 *num = crtc_info->noutput;
673 }
674
675 if (crtc_info)
676 XRRFreeCrtcInfo(crtc_info);
677
678 if (res)
679 XRRFreeScreenResources(res);
680 }
681
682 return ret;
683#else
684 return NULL;
685#endif
686}
687
688/*
689 * @brief get a CRTC's possible outputs.
690 * @param root the root window which's screen will be queried
691 * @param num number of possible outputs referenced by given CRTC
692 */
693EAPI Ecore_X_Randr_Output *
694ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root,
695 Ecore_X_Randr_Crtc crtc,
696 int *num)
697{
698#ifdef ECORE_XRANDR
699 RANDR_CHECK_1_2_RET(NULL);
700 XRRScreenResources *res = NULL;
701 Ecore_X_Randr_Output *ret = NULL;
702 XRRCrtcInfo *crtc_info = NULL;
703
704 if (_ecore_x_randr_crtc_validate(root,
705 crtc) &&
706 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
707 {
708 if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
709 {
710 if ((ret =
711 malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->npossible)))
712 {
713 memcpy(ret, crtc_info->possible,
714 (sizeof(Ecore_X_Randr_Output) * crtc_info->npossible));
715 if (num)
716 *num = res->ncrtc;
717 }
718
719 XRRFreeCrtcInfo(crtc_info);
720 }
721
722 XRRFreeScreenResources(res);
723 }
724
725 return ret;
726#else
727 return NULL;
728#endif
729}
730
731EAPI void
732ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
733 Ecore_X_Randr_Crtc crtc,
734 int *x,
735 int *y,
736 int *w,
737 int *h)
738{
739#ifdef ECORE_XRANDR
740 RANDR_CHECK_1_2_RET();
741 XRRScreenResources *res = NULL;
742 XRRCrtcInfo *crtc_info = NULL;
743
744 if (_ecore_x_randr_crtc_validate(root,
745 crtc) &&
746 (res =
747 _ecore_x_randr_get_screen_resources (_ecore_x_disp,
748 root)) &&
749 (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
750 {
751 if (x)
752 *x = crtc_info->x;
753
754 if (y)
755 *y = crtc_info->y;
756
757 if (w)
758 *w = crtc_info->width;
759
760 if (h)
761 *h = crtc_info->height;
762
763 XRRFreeCrtcInfo(crtc_info);
764 XRRFreeScreenResources(res);
765 }
766
767#endif
768}
769
770/*
771 * @brief sets the position of given CRTC within root window's screen
772 * @param root the window's screen to be queried
773 * @param crtc the CRTC which's position within the mentioned screen is to be altered
774 * @param x position on the x-axis (0 == left) of the screen. if x < 0 current value will be kept.
775 * @param y position on the y-ayis (0 == top) of the screen. if y < 0, current value will be kept.
776 * @return EINA_TRUE if position could be successfully be altered.
777 */
778EAPI Eina_Bool
779ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
780 Ecore_X_Randr_Crtc crtc,
781 int x,
782 int y)
783{
784#ifdef ECORE_XRANDR
785 RANDR_CHECK_1_2_RET(EINA_FALSE);
786 int w_c, h_c, w_new = 0, h_new = 0;
787 Eina_Rectangle crtc_geo;
788
789 ecore_x_randr_crtc_geometry_get(root,
790 crtc,
791 &crtc_geo.x,
792 &crtc_geo.y,
793 &crtc_geo.w,
794 &crtc_geo.h);
795 ecore_x_randr_screen_current_size_get(root, &w_c, &h_c, NULL, NULL);
796 if (x < 0)
797 x = crtc_geo.x;
798
799 if (y < 0)
800 y = crtc_geo.y;
801
802 if ((x + crtc_geo.w) > w_c)
803 w_new = x + crtc_geo.w;
804
805 if ((y + crtc_geo.h) > h_c)
806 h_new = y + crtc_geo.h;
807
808 if ((w_new != 0) || (h_new != 0))
809 if (!ecore_x_randr_screen_current_size_set(root, w_new, h_new, 0, 0))
810 return EINA_FALSE;
811
812 return ecore_x_randr_crtc_settings_set(root,
813 crtc,
814 NULL,
815 Ecore_X_Randr_Unset,
816 x,
817 y,
818 Ecore_X_Randr_Unset,
819 Ecore_X_Randr_Unset);
820#else
821 return EINA_FALSE;
822#endif
823}
824
825/**
826 * @brief Get the current set mode of a given CRTC
827 * @param root the window's screen to be queried
828 * @param crtc the CRTC which's should be queried
829 * @return currently set mode or - in case parameters are invalid -
830 * Ecore_X_Randr_Unset
831 */
832EAPI Ecore_X_Randr_Mode
833ecore_x_randr_crtc_mode_get(Ecore_X_Window root,
834 Ecore_X_Randr_Crtc crtc)
835{
836#ifdef ECORE_XRANDR
837 RANDR_CHECK_1_2_RET(Ecore_X_Randr_Unset);
838 XRRScreenResources *res = NULL;
839 XRRCrtcInfo *crtc_info = NULL;
840 Ecore_X_Randr_Mode ret = Ecore_X_Randr_Unset;
841 if (_ecore_x_randr_root_validate(root) &&
842 _ecore_x_randr_crtc_validate(root,
843 crtc) &&
844 (res =
845 _ecore_x_randr_get_screen_resources(_ecore_x_disp,
846 root)) &&
847 (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
848 {
849 ret = crtc_info->mode;
850 XRRFreeCrtcInfo(crtc_info);
851 XRRFreeScreenResources(res);
852 }
853
854 return ret;
855#else
856 return Ecore_X_Randr_Unset;
857#endif
858}
859
860/**
861 * @brief sets a mode for a CRTC and the outputs attached to it
862 * @param root the window's screen to be queried
863 * @param crtc the CRTC which shall be set
864 * @param outputs array of outputs which have to be compatible with the mode. If
865 * NULL CRTC will be disabled.
866 * @param noutputs number of outputs in array to be used. Use
867 * Ecore_X_Randr_Unset (or -1) to use currently used outputs.
868 * @param mode XID of the mode to be set. If set to 0 the CRTC will be disabled.
869 * If set to -1 the call will fail.
870 * @return EINA_TRUE if mode setting was successful. Else EINA_FALSE
871 */
872EAPI Eina_Bool
873ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
874 Ecore_X_Randr_Crtc crtc,
875 Ecore_X_Randr_Output *outputs,
876 int noutputs,
877 Ecore_X_Randr_Mode mode)
878{
879#ifdef ECORE_XRANDR
880 RANDR_CHECK_1_2_RET(EINA_FALSE);
881
882 if (mode == Ecore_X_Randr_Unset)
883 return EINA_FALSE;
884
885 return ecore_x_randr_crtc_settings_set(root,
886 crtc,
887 outputs,
888 noutputs,
889 Ecore_X_Randr_Unset,
890 Ecore_X_Randr_Unset,
891 mode,
892 Ecore_X_Randr_Unset);
893#else
894 return EINA_FALSE;
895#endif
896}
897
898EAPI void
899ecore_x_randr_crtc_size_get(Ecore_X_Window root,
900 Ecore_X_Randr_Crtc crtc,
901 int *w,
902 int *h)
903{
904#ifdef ECORE_XRANDR
905 RANDR_CHECK_1_2_RET();
906 ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h);
907#endif
908}
909
910EAPI Ecore_X_Randr_Refresh_Rate
911ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
912 Ecore_X_Randr_Crtc crtc,
913 Ecore_X_Randr_Mode mode)
914{
915#ifdef ECORE_XRANDR
916 RANDR_CHECK_1_2_RET(0.0);
917 XRRScreenResources *res = NULL;
918 XRRCrtcInfo *crtc_info = NULL;
919 Ecore_X_Randr_Refresh_Rate ret = 0.0;
920 int i;
921
922 if (_ecore_x_randr_crtc_validate(root,
923 crtc) &&
924 (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
925 {
926 for (i = 0; i < res->nmode; i++)
927 if (res->modes[i].id == mode)
928 {
929 if (res->modes[i].hTotal && res->modes[i].vTotal)
930 ret = ((double)res->modes[i].dotClock /
931 ((double)res->modes[i].hTotal *
932 (double)res->modes[i].vTotal));
933
934 break;
935 }
936 }
937
938 if (crtc_info)
939 XRRFreeCrtcInfo(crtc_info);
940
941 if (res)
942 XRRFreeScreenResources(res);
943
944 return ret;
945#else
946 return 0.0;
947#endif
948}
949
950EAPI Ecore_X_Randr_Orientation
951ecore_x_randr_crtc_orientations_get(Ecore_X_Window root,
952 Ecore_X_Randr_Crtc crtc)
953{
954#ifdef ECORE_XRANDR
955 RANDR_CHECK_1_2_RET(Ecore_X_Randr_None);
956 XRRCrtcInfo *crtc_info = NULL;
957 XRRScreenResources *res = NULL;
958 Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None;
959
960 if (_ecore_x_randr_crtc_validate(root,
961 crtc) &&
962 (res =
963 _ecore_x_randr_get_screen_resources (_ecore_x_disp,
964 root)) &&
965 (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
966 {
967 ret = crtc_info->rotations;
968 }
969 if (crtc_info)
970 XRRFreeCrtcInfo(crtc_info);
971
972 if (res)
973 XRRFreeScreenResources(res);
974
975 return ret;
976#else
977 return Ecore_X_Randr_None;
978#endif
979}
980
981EAPI Ecore_X_Randr_Orientation
982ecore_x_randr_crtc_orientation_get(Ecore_X_Window root,
983 Ecore_X_Randr_Crtc crtc)
984{
985#ifdef ECORE_XRANDR
986 RANDR_CHECK_1_2_RET(Ecore_X_Randr_None);
987 XRRCrtcInfo *crtc_info = NULL;
988 XRRScreenResources *res = NULL;
989 Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None;
990
991 if (_ecore_x_randr_crtc_validate(root,
992 crtc) &&
993 (res =
994 _ecore_x_randr_get_screen_resources (_ecore_x_disp,
995 root)) &&
996 (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
997 {
998 ret = crtc_info->rotation;
999 }
1000 if (crtc_info)
1001 XRRFreeCrtcInfo(crtc_info);
1002
1003 if (res)
1004 XRRFreeScreenResources(res);
1005
1006 return ret;
1007#else
1008 return Ecore_X_Randr_None;
1009#endif
1010}
1011
1012EAPI Eina_Bool
1013ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
1014 Ecore_X_Randr_Crtc crtc,
1015 Ecore_X_Randr_Orientation orientation)
1016{
1017#ifdef ECORE_XRANDR
1018 RANDR_CHECK_1_2_RET(EINA_FALSE);
1019 Eina_Bool ret = EINA_FALSE;
1020
1021 if (orientation != Ecore_X_Randr_None)
1022 {
1023 ret = ecore_x_randr_crtc_settings_set(root,
1024 crtc,
1025 NULL,
1026 Ecore_X_Randr_Unset,
1027 Ecore_X_Randr_Unset,
1028 Ecore_X_Randr_Unset,
1029 Ecore_X_Randr_Unset,
1030 orientation);
1031 }
1032
1033 return ret;
1034#else
1035 return EINA_FALSE;
1036#endif
1037}
1038
1039EAPI void
1040ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
1041 Ecore_X_Randr_Crtc crtc,
1042 int *x,
1043 int *y)
1044{
1045#ifdef ECORE_XRANDR
1046 RANDR_CHECK_1_2_RET();
1047
1048 ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL);
1049#endif
1050}
1051
1052EAPI Eina_Bool
1053ecore_x_randr_crtc_clone_set(Ecore_X_Window root,
1054 Ecore_X_Randr_Crtc original,
1055 Ecore_X_Randr_Crtc clon)
1056{
1057#ifdef ECORE_XRANDR
1058 RANDR_CHECK_1_2_RET(EINA_FALSE);
1059
1060 XRRScreenResources *res = NULL;
1061 XRRCrtcInfo *clone_crtc_info = NULL;
1062 Ecore_X_Randr_Mode original_mode = Ecore_X_Randr_None;
1063 Ecore_X_Randr_Orientation original_orientation = Ecore_X_Randr_None;
1064 Eina_Bool ret = EINA_FALSE;
1065 int x, y;
1066
1067 if (_ecore_x_randr_root_validate(root) &&
1068 _ecore_x_randr_crtc_validate(root,
1069 original) &&
1070 _ecore_x_randr_crtc_validate(root,
1071 clon) &&
1072 (res =
1073 _ecore_x_randr_get_screen_resources (_ecore_x_disp,
1074 root)) &&
1075 (clone_crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, clon)))
1076 {
1077 ecore_x_randr_crtc_geometry_get(root, original, &x, &y, NULL, NULL);
1078 original_mode = ecore_x_randr_crtc_mode_get(root, original);
1079 original_orientation = ecore_x_randr_crtc_orientation_get(root,
1080 original);
1081 ret = ecore_x_randr_crtc_settings_set(root,
1082 clon,
1083 NULL,
1084 Ecore_X_Randr_Unset,
1085 x,
1086 y,
1087 original_mode,
1088 original_orientation);
1089 XRRFreeCrtcInfo(clone_crtc_info);
1090 XRRFreeScreenResources(res);
1091 }
1092
1093 return ret;
1094#else
1095 return EINA_FALSE;
1096#endif
1097}
1098
1099/**
1100 * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is
1101 * auto enabled in it's preferred mode, when it was disabled before.
1102 * @param root the root window which's default display will be queried
1103 * @param crtc the CRTC which's configuration should be altered
1104 * @param outputs an array of outputs, that should display this CRTC's content.
1105 * @param noutputs number of outputs in the array of outputs.
1106 * If set to Ecore_X_Randr_Unset, current outputs and number of outputs will be used.
1107 * If set to Ecore_X_Randr_None, CRTC will be disabled
1108 * @param x new x coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current x
1109 * corrdinate will be assumed.
1110 * @param y new y coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current y
1111 * corrdinate will be assumed.
1112 * @param mode the new mode to be set. If Ecore_X_Randr_None is passed, the
1113 * CRTC will be disabled. If Ecore_X_Randr_Unset is passed, the current mode is assumed.
1114 * @param orientation the new orientation to be set. If Ecore_X_Randr_Unset is used,
1115 * the current mode is assumed.
1116 * @return EINA_TRUE if the configuration alteration was successful, else
1117 * EINA_FALSE
1118 */
1119EAPI Eina_Bool
1120ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
1121 Ecore_X_Randr_Crtc crtc,
1122 Ecore_X_Randr_Output *outputs,
1123 int noutputs,
1124 int x,
1125 int y,
1126 Ecore_X_Randr_Mode mode,
1127 Ecore_X_Randr_Orientation orientation)
1128{
1129#ifdef ECORE_XRANDR
1130 RANDR_CHECK_1_2_RET(EINA_FALSE);
1131 XRRScreenResources *res = NULL;
1132 XRRCrtcInfo *crtc_info = NULL;
1133 Eina_Bool ret = EINA_FALSE;
1134
1135 if (_ecore_x_randr_crtc_validate(root,
1136 crtc) &&
1137 (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
1138 {
1139 if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
1140 {
1141 if ((mode == Ecore_X_Randr_None) ||
1142 (noutputs == Ecore_X_Randr_None))
1143 {
1144 outputs = NULL;
1145 noutputs = 0;
1146 }
1147 else if (noutputs == (int)Ecore_X_Randr_Unset)
1148 {
1149 outputs = (Ecore_X_Randr_Output *)crtc_info->outputs;
1150 noutputs = crtc_info->noutput;
1151 }
1152
1153 if (mode == Ecore_X_Randr_Unset)
1154 mode = crtc_info->mode;
1155
1156 if (x < 0)
1157 x = crtc_info->x;
1158
1159 if (y < 0)
1160 y = crtc_info->y;
1161
1162 if (orientation == Ecore_X_Randr_Unset)
1163 orientation = crtc_info->rotation;
1164
1165 if (!XRRSetCrtcConfig(_ecore_x_disp, res, crtc, CurrentTime,
1166 x, y, mode, orientation, (RROutput *)outputs,
1167 noutputs))
1168 ret = EINA_TRUE;
1169
1170 XRRFreeCrtcInfo(crtc_info);
1171 }
1172
1173 XRRFreeScreenResources(res);
1174 }
1175
1176 return ret;
1177#else
1178 return EINA_FALSE;
1179#endif
1180}
1181
1182/**
1183 * @brief sets a CRTC relative to another one.
1184 * @param crtc_r1 the CRTC to be positioned.
1185 * @param crtc_r2 the CRTC the position should be relative to
1186 * @param policy the relation between the crtcs
1187 * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's
1188 * borders
1189 * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if
1190 * repositioning failed or if position of new crtc would be out of given screen's min/max bounds.
1191 */
1192EAPI Eina_Bool
1193ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
1194 Ecore_X_Randr_Crtc crtc_r1,
1195 Ecore_X_Randr_Crtc crtc_r2,
1196 Ecore_X_Randr_Output_Policy policy,
1197 Ecore_X_Randr_Relative_Alignment alignment)
1198{
1199#ifdef ECORE_XRANDR
1200 RANDR_CHECK_1_2_RET(EINA_FALSE);
1201
1202 Eina_Rectangle r1_geo, r2_geo;
1203 int w_max, h_max, cw, ch, x_n = Ecore_X_Randr_Unset, y_n =
1204 Ecore_X_Randr_Unset;
1205 /*
1206 int r1_noutputs, r2_noutputs, r1_nmodes, i, j, outputs_mode_found, mode_w, mode_h;
1207 Ecore_X_Randr_Output *r1_outputs, *r2_outputs, *r2_r1_outputs;
1208 Ecore_X_Randr_Mode *r1_modes, r2_mode, r1_mode;
1209 Eina_Bool ret;
1210 */
1211
1212 if ((ecore_x_randr_crtc_mode_get(root, crtc_r1) == Ecore_X_Randr_None)
1213 || (ecore_x_randr_crtc_mode_get(root, crtc_r2) == Ecore_X_Randr_None))
1214 return EINA_FALSE;
1215
1216 if (!_ecore_x_randr_crtc_validate(root, crtc_r1) ||
1217 (!(crtc_r1 != crtc_r2) &&
1218 !_ecore_x_randr_crtc_validate(root, crtc_r2)))
1219 return EINA_FALSE;
1220
1221 ecore_x_randr_crtc_geometry_get(root,
1222 crtc_r1,
1223 &r1_geo.x,
1224 &r1_geo.y,
1225 &r1_geo.w,
1226 &r1_geo.h);
1227 ecore_x_randr_crtc_geometry_get(root,
1228 crtc_r2,
1229 &r2_geo.x,
1230 &r2_geo.y,
1231 &r2_geo.w,
1232 &r2_geo.h);
1233 ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max);
1234 ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL);
1235
1236 switch (policy)
1237 {
1238 case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT:
1239 //set r1 right of r2
1240 x_n = r2_geo.x + r2_geo.w;
1241
1242 switch (alignment)
1243 {
1244 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE:
1245 y_n = Ecore_X_Randr_Unset;
1246 break;
1247
1248 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL:
1249 y_n =
1250 ((int)(((double)r2_geo.h /
1251 2.0) + (double)r2_geo.y - ((double)r1_geo.h / 2.0)));
1252 break;
1253
1254 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR:
1255 y_n = ((int)((double)ch / 2.0) - ((double)r1_geo.h / 2.0));
1256 break;
1257 }
1258 break;
1259
1260 case ECORE_X_RANDR_OUTPUT_POLICY_LEFT:
1261 //set r1 left of r2
1262 x_n = r2_geo.x - r1_geo.w;
1263
1264 switch (alignment)
1265 {
1266 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE:
1267 y_n = Ecore_X_Randr_Unset;
1268 break;
1269
1270 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL:
1271 y_n =
1272 ((int)(((double)r2_geo.h /
1273 2.0) + r2_geo.y - ((double)r1_geo.h / 2.0)));
1274 break;
1275
1276 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR:
1277 y_n = ((int)(((double)ch / 2.0) - ((double)r1_geo.h / 2.0)));
1278 break;
1279 }
1280 break;
1281
1282 case ECORE_X_RANDR_OUTPUT_POLICY_BELOW:
1283 //set r1 below r2
1284 y_n = r2_geo.y + r2_geo.h;
1285
1286 switch (alignment)
1287 {
1288 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE:
1289 x_n = Ecore_X_Randr_Unset;
1290 break;
1291
1292 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL:
1293 x_n =
1294 ((int)((((double)r2_geo.x +
1295 (double)r2_geo.w) / 2.0) - ((double)r1_geo.w / 2.0)));
1296 break;
1297
1298 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR:
1299 x_n = ((int)((double)cw / 2.0));
1300 break;
1301 }
1302 break;
1303
1304 case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE:
1305 y_n = r2_geo.y - r1_geo.h;
1306
1307 //set r1 above r2
1308 switch (alignment)
1309 {
1310 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE:
1311 x_n = Ecore_X_Randr_Unset;
1312 break;
1313
1314 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL:
1315 x_n =
1316 ((int)((((double)r2_geo.x +
1317 (double)r2_geo.w) / 2.0) - ((double)r1_geo.w / 2.0)));
1318 break;
1319
1320 case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR:
1321 x_n = ((int)((double)cw / 2.0));
1322 break;
1323 }
1324 break;
1325
1326 case ECORE_X_RANDR_OUTPUT_POLICY_CLONE:
1327 return ecore_x_randr_crtc_pos_set(root, crtc_r1, r2_geo.x, r2_geo.y);
1328
1329 /* entire cloning (including modesetting)
1330 //all outputs of crtc1 capable of crtc2's current mode?
1331 r2_mode = ecore_x_randr_crtc_mode_get(root, crtc_r2);
1332 if (!(r1_outputs =
1333 ecore_x_randr_crtc_outputs_get(root, crtc_r1,
1334 &r1_noutputs)) ||
1335 (r1_noutputs == 0))
1336 return EINA_FALSE;
1337
1338 for (i = 0, outputs_mode_found = 0; i < r1_noutputs; i++)
1339 {
1340 if (!(r1_modes =
1341 ecore_x_randr_output_modes_get(root, r1_outputs[i],
1342 &r1_nmodes, NULL)))
1343 {
1344 free(r1_outputs);
1345 return EINA_FALSE;
1346 }
1347
1348 for (j = 0; j < r1_nmodes; j++)
1349 {
1350 ecore_x_randr_mode_size_get(root,
1351 r1_modes[j],
1352 &mode_w,
1353 &mode_h);
1354 if ((mode_w == r2_geo.w) && (mode_h == r2_geo.h))
1355 {
1356 r1_mode = r1_modes[j];
1357 ++outputs_mode_found;
1358 free(r1_modes);
1359 r1_modes = NULL;
1360 break;
1361 }
1362 }
1363 if (r1_modes)
1364 free(r1_modes);
1365
1366 if (outputs_mode_found <= i)
1367 {
1368 //an output doesn't support the set mode, cancel!
1369 free(r1_outputs);
1370 return EINA_FALSE;
1371 }
1372 }
1373 free (r1_outputs);
1374 //CRTC 1's outputs support a mode of same geometry as CRTC 2.
1375 ret =
1376 (ecore_x_randr_crtc_mode_set(root, crtc_r1, Ecore_X_Randr_None,
1377 Ecore_X_Randr_None,
1378 r1_mode) &&
1379 ecore_x_randr_crtc_pos_set(root, crtc_r1, r2_geo.x, r2_geo.y));
1380 return ret;
1381 */
1382
1383 /* entire cloning on same CRTC
1384 //all outputs of crtc1 capable of crtc2's current mode?
1385 r2_mode = ecore_x_randr_crtc_mode_get(root, crtc_r2);
1386 if (!(r1_outputs =
1387 ecore_x_randr_crtc_outputs_get(root, crtc_r1,
1388 &r1_noutputs)) ||
1389 (r1_noutputs == 0))
1390 return EINA_FALSE;
1391
1392 for (i = 0, outputs_mode_found = 0; i < r1_noutputs; i++)
1393 {
1394 if (!(r1_modes =
1395 ecore_x_randr_output_modes_get(root, r1_outputs[i],
1396 &r1_nmodes, NULL)))
1397 {
1398 free(r1_outputs);
1399 return EINA_FALSE;
1400 }
1401
1402 for (j = 0; j < r1_nmodes; j++)
1403 {
1404 if (r1_modes[j] == r2_mode)
1405 {
1406 ++outputs_mode_found;
1407 free(r1_modes);
1408 r1_modes = NULL;
1409 break;
1410 }
1411 }
1412 if (r1_modes)
1413 free(r1_modes);
1414
1415 if (outputs_mode_found <= i)
1416 {
1417 //an output doesn't support the set mode, cancel!
1418 free(r1_outputs);
1419 return EINA_FALSE;
1420 }
1421 }
1422 //check whether crtc r2 can use all outputs of r1.
1423 if (!(r2_outputs =
1424 ecore_x_randr_crtc_possible_outputs_get(root, crtc_r2,
1425 &r2_noutputs)) ||
1426 (r2_noutputs == 0))
1427 {
1428 free(r1_outputs);
1429 return EINA_FALSE;
1430 }
1431
1432 for (i = 0; i < r1_noutputs; i++)
1433 {
1434 for (j = 0; j < r2_noutputs; )
1435 {
1436 if (r1_outputs[i] == r2_outputs[j])
1437 break;
1438
1439 j++;
1440 }
1441 if (j == r2_noutputs)
1442 {
1443 //didn't find the output!
1444 free (r1_outputs);
1445 free (r2_outputs);
1446 return EINA_FALSE;
1447 }
1448 }
1449
1450 //apparently crtc2 supports all outputs of r1
1451 //TODO: check with the compatible list of outputs (property in RR1.3)
1452 r2_r1_outputs =
1453 malloc(sizeof(Ecore_X_Randr_Output) * (r1_noutputs + r2_noutputs));
1454 for (i = 0; i < r1_noutputs; i++)
1455 {
1456 r2_r1_outputs[i] = r1_outputs[i];
1457 }
1458 free(r1_outputs);
1459 for (; i < r2_noutputs; i++)
1460 {
1461 r2_r1_outputs[i] = r2_outputs[i];
1462 }
1463 free(r2_outputs);
1464 ret =
1465 ecore_x_randr_crtc_mode_set(root, crtc_r2, r2_r1_outputs,
1466 (r1_noutputs + r1_noutputs), r2_mode);
1467 free (r2_r1_outputs);
1468 return ret;
1469 */
1470 case ECORE_X_RANDR_OUTPUT_POLICY_NONE:
1471 break;
1472 }
1473 if ((x_n == r1_geo.x) && (y_n == r1_geo.x))
1474 return EINA_TRUE;
1475
1476 //out of possible bounds?
1477 if (((y_n + r1_geo.h) > h_max) || ((x_n + r1_geo.w) > w_max))
1478 return EINA_FALSE;
1479
1480 return ecore_x_randr_crtc_pos_set(root, crtc_r1, x_n, y_n);
1481#else
1482 return EINA_FALSE;
1483#endif
1484}
1485
1486/*
1487 * @brief add given mode to given output
1488 * @param output the output the mode is added to
1489 * @param mode the mode added to the output
1490 * @return EINA_FALSE if output or mode equal Ecore_X_Randr_None, else EINA_TRUE
1491 * Additionally, if xcb backend is used, the success of the addition is reported
1492 * back directly.
1493 * @since 1.2.0
1494 */
1495EAPI Eina_Bool
1496ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
1497 Ecore_X_Randr_Mode mode)
1498{
1499#ifdef ECORE_XRANDR
1500 RANDR_CHECK_1_2_RET(EINA_FALSE);
1501
1502 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
1503 return EINA_FALSE;
1504
1505 XRRAddOutputMode(_ecore_x_disp, output, mode);
1506 return EINA_TRUE;
1507#else
1508 return EINA_FALSE;
1509#endif
1510}
1511
1512/*
1513 * @brief delete given mode from given output
1514 * @param output the output the mode is removed from
1515 * @param mode the mode removed from the output
1516 * @since 1.2.0
1517 */
1518EAPI void
1519ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
1520 Ecore_X_Randr_Mode mode)
1521{
1522#ifdef ECORE_XRANDR
1523 RANDR_CHECK_1_2_RET();
1524
1525 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
1526 return;
1527
1528 XRRDeleteOutputMode(_ecore_x_disp, output, mode);
1529#else
1530 return;
1531#endif
1532}
1533
1534EAPI Ecore_X_Randr_Mode *
1535ecore_x_randr_output_modes_get(Ecore_X_Window root,
1536 Ecore_X_Randr_Output output,
1537 int *num,
1538 int *npreferred)
1539{
1540#ifdef ECORE_XRANDR
1541 RANDR_CHECK_1_2_RET(NULL);
1542 XRRScreenResources *res = NULL;
1543 XRROutputInfo *output_info = NULL;
1544 Ecore_X_Randr_Mode *modes = NULL;
1545
1546 if ((output != Ecore_X_Randr_None)
1547 && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))
1548 && (output_info =
1549 XRRGetOutputInfo(_ecore_x_disp, res, (RROutput)output)))
1550 {
1551 if ((modes = malloc(sizeof(Ecore_X_Randr_Mode) * output_info->nmode)))
1552 {
1553 memcpy(modes, output_info->modes,
1554 (sizeof(Ecore_X_Randr_Mode) * output_info->nmode));
1555 if (num)
1556 *num = output_info->nmode;
1557
1558 if (npreferred)
1559 *npreferred = output_info->npreferred;
1560 }
1561 }
1562
1563 if (output_info)
1564 XRRFreeOutputInfo(output_info);
1565
1566 if (res)
1567 XRRFreeScreenResources(res);
1568
1569 return modes;
1570#else
1571 return NULL;
1572#endif
1573}
1574
1575EAPI Ecore_X_Randr_Crtc *
1576ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root,
1577 Ecore_X_Randr_Output output,
1578 int *num)
1579{
1580#ifdef ECORE_XRANDR
1581 RANDR_CHECK_1_2_RET(NULL);
1582 XRRScreenResources *res = NULL;
1583 XRROutputInfo *output_info = NULL;
1584 Ecore_X_Randr_Crtc *crtcs = NULL;
1585
1586 if ((output != Ecore_X_Randr_None))
1587 {
1588 if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
1589 {
1590 if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output)))
1591 {
1592 if ((crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * output_info->ncrtc)))
1593 {
1594 memcpy(crtcs, output_info->crtcs, (sizeof(Ecore_X_Randr_Crtc) * output_info->ncrtc));
1595 if (num) *num = output_info->ncrtc;
1596 }
1597 XRRFreeOutputInfo(output_info);
1598 }
1599 XRRFreeScreenResources(res);
1600 }
1601 }
1602 return crtcs;
1603#else
1604 return Ecore_X_Randr_None;
1605#endif
1606}
1607
1608/**
1609 * @brief gets the the outputs which might be used simultenously on the same
1610 * CRTC.
1611 * @param root window that this information should be queried for.
1612 * @param output the output which's clones we concern
1613 * @param num number of possible clones
1614 */
1615EAPI Ecore_X_Randr_Output *
1616ecore_x_randr_output_clones_get(Ecore_X_Window root,
1617 Ecore_X_Randr_Output output,
1618 int *num)
1619{
1620#ifdef ECORE_XRANDR
1621 RANDR_CHECK_1_2_RET(NULL);
1622 XRRScreenResources *res = NULL;
1623 XRROutputInfo *output_info = NULL;
1624 Ecore_X_Randr_Output *outputs = NULL;
1625
1626 if ((output != Ecore_X_Randr_None))
1627 {
1628 if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
1629 {
1630 if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output)))
1631 {
1632 if ((outputs = malloc(sizeof(Ecore_X_Randr_Output) * output_info->nclone)))
1633 {
1634 memcpy(outputs, output_info->clones, (sizeof(Ecore_X_Randr_Output) * output_info->nclone));
1635 if (num) *num = output_info->nclone;
1636 }
1637 XRRFreeOutputInfo(output_info);
1638 }
1639 XRRFreeScreenResources(res);
1640 }
1641 }
1642 return outputs;
1643#else
1644 return Ecore_X_Randr_None;
1645#endif
1646}
1647
1648EAPI Ecore_X_Randr_Crtc
1649ecore_x_randr_output_crtc_get(Ecore_X_Window root,
1650 Ecore_X_Randr_Output output)
1651{
1652#ifdef ECORE_XRANDR
1653 RANDR_CHECK_1_2_RET(Ecore_X_Randr_None);
1654 XRRScreenResources *res = NULL;
1655 XRROutputInfo *output_info = NULL;
1656 Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None;
1657
1658 if ((output != Ecore_X_Randr_None))
1659 {
1660 if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
1661 {
1662 if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output)))
1663 {
1664 ret = output_info->crtc;
1665 XRRFreeOutputInfo(output_info);
1666 }
1667 XRRFreeScreenResources(res);
1668 }
1669 }
1670
1671 return ret;
1672#else
1673 return Ecore_X_Randr_None;
1674#endif
1675}
1676
1677/**
1678 * @brief gets the given output's name as reported by X
1679 * @param root the window which's screen will be queried
1680 * @param len length of returned c-string.
1681 * @return name of the output as reported by X
1682 */
1683EAPI char *
1684ecore_x_randr_output_name_get(Ecore_X_Window root,
1685 Ecore_X_Randr_Output output,
1686 int *len)
1687{
1688#ifdef ECORE_XRANDR
1689 RANDR_CHECK_1_2_RET(NULL);
1690 XRRScreenResources *res = NULL;
1691 XRROutputInfo *output_info = NULL;
1692 char *ret = NULL;
1693
1694 if ((output != Ecore_X_Randr_None)
1695 && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))
1696 && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output)))
1697 {
1698 /*
1699 * Actually the below command is correct, but due to a bug in libXrandr
1700 * it doesn't work. Therefore we stick with strlen().
1701 * Replace the line below with the following once this bug is
1702 * fixed within libXrandr.
1703 *
1704 * *len = output_info->nameLen;
1705 *
1706 */
1707 if ((ret = strdup(output_info->name)) && len)
1708 *len = strlen(ret);
1709
1710 XRRFreeOutputInfo(output_info);
1711 }
1712
1713 if (res)
1714 XRRFreeScreenResources(res);
1715
1716 return ret;
1717#else
1718 return NULL;
1719#endif
1720}
1721
1722/**
1723 * @brief gets the width and hight of a given mode
1724 * @param mode the mode which's size is to be looked up
1725 * @param w width of given mode in px
1726 * @param h height of given mode in px
1727 */
1728EAPI void
1729ecore_x_randr_mode_size_get(Ecore_X_Window root,
1730 Ecore_X_Randr_Mode mode,
1731 int *w,
1732 int *h)
1733{
1734#ifdef ECORE_XRANDR
1735 RANDR_CHECK_1_2_RET();
1736 XRRScreenResources *res = NULL;
1737 int i;
1738
1739 if ((mode != Ecore_X_Randr_None)
1740 && (w || h)
1741 && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
1742 {
1743 for (i = 0; i < res->nmode; i++)
1744 {
1745 if (res->modes[i].id == mode)
1746 {
1747 if (w)
1748 *w = res->modes[i].width;
1749
1750 if (h)
1751 *h = res->modes[i].height;
1752
1753 break;
1754 }
1755 }
1756 }
1757
1758 if (res)
1759 XRRFreeScreenResources(res);
1760
1761#endif
1762}
1763
1764/**
1765 * @brief gets the EDID information of an attached output if available.
1766 * Note that this information is not to be compared using ordinary string
1767 * comparison functions, since it includes 0-bytes.
1768 * @param root window this information should be queried from
1769 * @param output the XID of the output
1770 * @param length length of the byte-array. If NULL, request will fail.
1771 */
1772EAPI unsigned char *
1773ecore_x_randr_output_edid_get(Ecore_X_Window root,
1774 Ecore_X_Randr_Output output,
1775 unsigned long *length)
1776{
1777#ifdef ECORE_XRANDR
1778 RANDR_CHECK_1_2_RET(NULL);
1779 Atom name = XInternAtom (_ecore_x_disp, RANDR_PROPERTY_EDID, False);
1780 unsigned char *prop_data, *ret = NULL;
1781 int actual_format;
1782 unsigned long nitems, bytes_after;
1783 Atom actual_type;
1784
1785 if (!length || !_ecore_x_randr_output_validate(root, output))
1786 return NULL;
1787
1788 if (XRRGetOutputProperty (_ecore_x_disp, output, name,
1789 0, 100, False, False,
1790 AnyPropertyType,
1791 &actual_type, &actual_format,
1792 &nitems, &bytes_after, &prop_data) == Success)
1793 {
1794 if (actual_type == XA_INTEGER && actual_format == 8)
1795 {
1796 if ((ret = malloc(nitems * sizeof(unsigned char))))
1797 {
1798 if (length &&
1799 (memcpy(ret, prop_data, (nitems * sizeof(unsigned char)))))
1800 *length = nitems;
1801
1802 return ret;
1803 }
1804 }
1805 }
1806
1807 return NULL;
1808#else
1809 return NULL;
1810#endif
1811}
1812
1813EAPI Ecore_X_Randr_Connection_Status
1814ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
1815 Ecore_X_Randr_Output output)
1816{
1817#ifdef ECORE_XRANDR
1818 RANDR_CHECK_1_2_RET(ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN);
1819 XRRScreenResources *res = NULL;
1820 XRROutputInfo *output_info = NULL;
1821 Ecore_X_Randr_Connection_Status ret =
1822 ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
1823
1824 if ((output != Ecore_X_Randr_None)
1825 && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))
1826 && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output)))
1827 {
1828 ret = output_info->connection;
1829 }
1830
1831 if (output_info)
1832 XRRFreeOutputInfo(output_info);
1833
1834 if (res)
1835 XRRFreeScreenResources(res);
1836
1837 return ret;
1838#else
1839 return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
1840#endif
1841}
1842
1843EAPI void
1844ecore_x_randr_output_size_mm_get(Ecore_X_Window root,
1845 Ecore_X_Randr_Output output,
1846 int *w_mm,
1847 int *h_mm)
1848{
1849#ifdef ECORE_XRANDR
1850 RANDR_CHECK_1_2_RET();
1851 XRRScreenResources *res = NULL;
1852 XRROutputInfo *output_info = NULL;
1853
1854 if ((output != Ecore_X_Randr_None)
1855 && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
1856 {
1857 if ((output_info =
1858 XRRGetOutputInfo(_ecore_x_disp, res, (RROutput)output)))
1859 {
1860 if (w_mm)
1861 *w_mm = output_info->mm_width;
1862
1863 if (h_mm)
1864 *h_mm = output_info->mm_height;
1865
1866 XRRFreeOutputInfo(output_info);
1867 }
1868
1869 XRRFreeScreenResources(res);
1870 }
1871
1872#endif
1873}
1874
1875EAPI Eina_Bool
1876ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root,
1877 const Ecore_X_Randr_Crtc *not_moved,
1878 int nnot_moved,
1879 int dx,
1880 int dy)
1881{
1882#ifdef ECORE_XRANDR
1883 Ecore_X_Randr_Crtc *crtcs_to_be_moved = NULL;
1884 XRRScreenResources *res = NULL;
1885 int i, j, k, n;
1886 Eina_Bool ret;
1887
1888 if ((nnot_moved <= 0) || (!not_moved)
1889 || !_ecore_x_randr_root_validate(root)
1890 || !(res =
1891 _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
1892 return EINA_FALSE;
1893
1894 n = (res->ncrtc - nnot_moved);
1895 if ((crtcs_to_be_moved = malloc(sizeof(Ecore_X_Randr_Crtc) * n)))
1896 {
1897 for (i = 0, k = 0; (i < res->ncrtc) && (k < n); i++)
1898 {
1899 for (j = 0; j < nnot_moved; j++)
1900 {
1901 if (res->crtcs[i] == not_moved[j])
1902 break;
1903 }
1904 if (j == nnot_moved)
1905 //crtcs[i] is not in the 'not to move'-list
1906 crtcs_to_be_moved[k++] = res->crtcs[i];
1907 }
1908 }
1909
1910 XRRFreeScreenResources(res);
1911 ret = ecore_x_randr_move_crtcs(root, crtcs_to_be_moved, n, dx, dy);
1912 free(crtcs_to_be_moved);
1913 return ret;
1914#else
1915 return EINA_FALSE;
1916#endif
1917}
1918
1919/*
1920 * @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.
1921 * @param root window which's screen's resources are used
1922 * @param crtcs list of CRTCs to be moved
1923 * @param ncrtc number of CRTCs in array
1924 * @param dx amount of pixels the CRTCs should be moved in x direction
1925 * @param dy amount of pixels the CRTCs should be moved in y direction
1926 * @return EINA_TRUE if all crtcs could be moved successfully.
1927 */
1928EAPI Eina_Bool
1929ecore_x_randr_move_crtcs(Ecore_X_Window root,
1930 const Ecore_X_Randr_Crtc *crtcs,
1931 int ncrtc,
1932 int dx,
1933 int dy)
1934{
1935#ifdef ECORE_XRANDR
1936 RANDR_CHECK_1_2_RET(EINA_FALSE);
1937 XRRScreenResources *res = NULL;
1938 XRRCrtcInfo **crtc_info = NULL;
1939 Eina_Bool ret = EINA_TRUE;
1940 int i, cw, ch, w_max, h_max, nw, nh;
1941
1942 crtc_info = alloca(sizeof(XRRCrtcInfo *) * ncrtc);
1943 memset(crtc_info, 0, sizeof(XRRCrtcInfo *) * ncrtc);
1944 if (_ecore_x_randr_root_validate(root)
1945 && (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
1946 {
1947 ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max);
1948 ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL);
1949 nw = cw;
1950 nh = ch;
1951
1952 for (i = 0;
1953 (i < ncrtc) &&
1954 (crtc_info[i] = XRRGetCrtcInfo(_ecore_x_disp, res, crtcs[i]));
1955 i++)
1956 {
1957 if (((crtc_info[i]->x + dx) < 0) ||
1958 ((int)(crtc_info[i]->x + crtc_info[i]->width + dx) > w_max)
1959 || ((crtc_info[i]->y + dy) < 0) ||
1960 ((int)(crtc_info[i]->y + crtc_info[i]->height + dy) > h_max)
1961 )
1962 goto _ecore_x_randr_move_crtcs_fail_free_crtc_info;
1963
1964 nw = MAX((int)(crtc_info[i]->x + crtc_info[i]->width + dx), nw);
1965 nh = MAX((int)(crtc_info[i]->y + crtc_info[i]->height + dy), nh);
1966 }
1967 //not out of bounds
1968
1969 //resize if necessary
1970 if (!(((nw > cw) ||
1971 (nh > ch)) ||
1972 ecore_x_randr_screen_current_size_set(root, nw, nh,
1973 Ecore_X_Randr_Unset,
1974 Ecore_X_Randr_Unset)))
1975 goto _ecore_x_randr_move_crtcs_fail_free_crtc_info;
1976
1977 //actually move all the crtcs, keep their rotation and mode.
1978 for (i = 0; (i < ncrtc) && crtc_info[i]; i++)
1979 {
1980 if ((crtc_info[i]) &&
1981 (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL,
1982 Ecore_X_Randr_Unset,
1983 (crtc_info[i]->x + dx),
1984 (crtc_info[i]->y + dy),
1985 crtc_info[i]->mode,
1986 crtc_info[i]->rotation)))
1987 {
1988 ret = EINA_FALSE;
1989 break;
1990 }
1991 }
1992 if (i < ncrtc)
1993 {
1994 //something went wrong, let's try to move the already moved crtcs
1995 //back.
1996 while ((i--) >= 0)
1997 {
1998 if (crtc_info[i])
1999 ecore_x_randr_crtc_settings_set(root,
2000 crtcs[i],
2001 NULL,
2002 Ecore_X_Randr_Unset,
2003 (crtc_info[i]->x - dx),
2004 (crtc_info[i]->y - dy),
2005 crtc_info[i]->mode,
2006 crtc_info[i]->rotation);
2007 }
2008 }
2009
2010 for (i = 0; i < ncrtc; i++)
2011 {
2012 if (crtc_info[i]) XRRFreeCrtcInfo(crtc_info[i]);
2013 }
2014 }
2015
2016 XRRFreeScreenResources(res);
2017
2018 return ret;
2019_ecore_x_randr_move_crtcs_fail_free_crtc_info:
2020 while (i-- > 0)
2021 XRRFreeCrtcInfo(crtc_info[i]);
2022 XRRFreeScreenResources(res);
2023 return EINA_FALSE;
2024#else
2025 return EINA_FALSE;
2026#endif
2027}
2028
2029/**
2030 * @brief removes unused screen space. The most upper left CRTC is set to 0x0
2031 * and all other CRTCs dx,dy respectively.
2032 * @param root the window's screen which will be reset.
2033 */
2034EAPI void
2035ecore_x_randr_screen_reset(Ecore_X_Window root)
2036{
2037#ifdef ECORE_XRANDR
2038 XRRCrtcInfo *crtc_info = NULL;
2039 XRRScreenResources *res = NULL;
2040 //the 100000 are just a random huge number.
2041 int i, dx_min = 100000, dy_min = 100000, w_n = 0, h_n = 0, nenabled_crtcs = 0;
2042
2043 if (!_ecore_x_randr_root_validate(root) ||
2044 !(res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)))
2045 return;
2046
2047 Ecore_X_Randr_Crtc enabled_crtcs[res->ncrtc];
2048
2049 for (i = 0; i < res->ncrtc; i++)
2050 {
2051 if (!(crtc_info =
2052 XRRGetCrtcInfo(_ecore_x_disp, res,
2053 res->crtcs[i])) ||
2054 (crtc_info->mode == Ecore_X_Randr_None) ||
2055 (crtc_info->mode == Ecore_X_Randr_Unset)
2056 || ((crtc_info->noutput == 0)))
2057 continue;
2058
2059 enabled_crtcs[nenabled_crtcs++] = res->crtcs[i];
2060
2061 if ((int)(crtc_info->x + crtc_info->width) > w_n)
2062 w_n = (crtc_info->x + crtc_info->width);
2063
2064 if ((int)(crtc_info->y + crtc_info->height) > h_n)
2065 h_n = (crtc_info->y + crtc_info->height);
2066
2067 if (crtc_info->x < dx_min)
2068 dx_min = crtc_info->x;
2069 if (crtc_info->y < dy_min)
2070 dy_min = crtc_info->y;
2071
2072 XRRFreeCrtcInfo(crtc_info);
2073 }
2074 if ((dx_min > 0) || (dy_min > 0))
2075 {
2076 if (ecore_x_randr_move_crtcs(root, enabled_crtcs, nenabled_crtcs, -dx_min, -dy_min))
2077 {
2078 w_n -= dx_min;
2079 h_n -= dy_min;
2080 }
2081 }
2082 ecore_x_randr_screen_current_size_set(root,
2083 w_n,
2084 h_n,
2085 Ecore_X_Randr_Unset,
2086 Ecore_X_Randr_Unset);
2087#endif
2088}
2089
2090/**
2091 * @brief set up the backlight level to the given level.
2092 * @param root the window's screen which will be set.
2093 * @param level of the backlight between 0 and 1
2094 */
2095
2096EAPI void
2097ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root,
2098 double level)
2099{
2100#ifdef ECORE_XRANDR
2101 RANDR_CHECK_1_2_RET();
2102 Atom _backlight;
2103 XRRScreenResources *resources = NULL;
2104 Ecore_X_Randr_Output output;
2105 int o;
2106
2107 if ((level < 0) || (level > 1))
2108 {
2109 ERR("Wrong value for the backlight level. It should be between 0 and 1.");
2110 return;
2111 }
2112
2113 /*
2114 * To make sure that the _backlight atomic property still exists.
2115 */
2116 _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True);
2117 if (_backlight == None)
2118 {
2119 WRN("Backlight setting is not supported on this server or driver");
2120 return;
2121 }
2122
2123 /* get the ressources */
2124 resources = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root);
2125 if (!resources) return;
2126
2127 for (o = 0; o < resources->noutput; o++)
2128 {
2129 output = resources->outputs[o];
2130 if (ecore_x_randr_output_backlight_level_get(root, output) >= 0)
2131 {
2132 ecore_x_randr_output_backlight_level_set(root, output, level);
2133 }
2134 }
2135 XRRFreeScreenResources(resources);
2136#endif
2137}
2138
2139/*
2140 * @brief check if a backlight is available
2141 * @return whether a blacklight is available
2142 */
2143
2144EAPI Eina_Bool
2145ecore_x_randr_output_backlight_available(void)
2146{
2147#ifdef ECORE_XRANDR
2148 RANDR_CHECK_1_2_RET(-1);
2149 Atom _backlight;
2150
2151 _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True);
2152
2153 return (_backlight == None) ? EINA_FALSE : EINA_TRUE;
2154
2155#endif
2156 return EINA_FALSE;
2157}
2158
2159/*
2160 * @brief get the backlight level of the given output
2161 * @param root window which's screen should be queried
2162 * @param output from which the backlight level should be retrieved
2163 * @return the backlight level
2164 */
2165
2166EAPI double
2167ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
2168 Ecore_X_Randr_Output output)
2169{
2170#ifdef ECORE_XRANDR
2171 RANDR_CHECK_1_2_RET(-1);
2172 Atom actual_type;
2173 Atom _backlight;
2174 XRRPropertyInfo *info = NULL;
2175 double dvalue;
2176 int actual_format;
2177 long value, max, min;
2178 unsigned long nitems;
2179 unsigned long bytes_after;
2180 unsigned char *prop = NULL;
2181
2182 /* set backlight variable if not already done */
2183
2184 _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True);
2185 if (_backlight == None)
2186 {
2187 ERR("Backlight property is not suppported on this server or driver");
2188 return -1;
2189 }
2190
2191 if (!_ecore_x_randr_output_validate(root, output))
2192 {
2193 ERR("Invalid output");
2194 return -1;
2195 }
2196
2197 if (XRRGetOutputProperty(_ecore_x_disp, output, _backlight,
2198 0, 4, False, False, None,
2199 &actual_type, &actual_format,
2200 &nitems, &bytes_after, &prop) != Success)
2201 {
2202 WRN("Backlight not supported on this output");
2203 return -1;
2204 }
2205
2206 if ((actual_type != XA_INTEGER) || (nitems != 1) || (actual_format != 32)) return -1;
2207
2208 value = *((long *)prop);
2209 free (prop);
2210
2211 /* I have the current value of the backlight */
2212 /* Now retrieve the min and max intensities of the output */
2213 info = XRRQueryOutputProperty(_ecore_x_disp, output, _backlight);
2214 if (info)
2215 {
2216 dvalue = -1;
2217 if ((info->range) && (info->num_values == 2))
2218 {
2219 /* finally convert the current value in the interval [0..1] */
2220 min = info->values[0];
2221 max = info->values[1];
2222 dvalue = ((double)(value - min)) / ((double)(max - min));
2223 }
2224 free(info);
2225 return dvalue;
2226 }
2227#endif
2228 return -1;
2229}
2230
2231/*
2232 * @brief set the backlight level of a given output
2233 * @param root window which's screen should be queried
2234 * @param output that should be set
2235 * @param level for which the backlight should be set
2236 * @return EINA_TRUE in case of success
2237 */
2238
2239EAPI Eina_Bool
2240ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
2241 Ecore_X_Randr_Output output,
2242 double level)
2243{
2244#ifdef ECORE_XRANDR
2245 RANDR_CHECK_1_2_RET(EINA_FALSE);
2246 Atom _backlight;
2247 XRRPropertyInfo *info = NULL;
2248 double min, max, tmp;
2249 long new;
2250
2251 if ((level < 0) || (level > 1))
2252 {
2253 ERR("Backlight level should be between 0 and 1");
2254 return EINA_FALSE;
2255 }
2256
2257 if (!_ecore_x_randr_output_validate(root, output))
2258 {
2259 ERR("Wrong output value");
2260 return EINA_FALSE;
2261 }
2262
2263 _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True);
2264 if (_backlight == None)
2265 {
2266 WRN("Backlight property is not suppported on this server or driver");
2267 return EINA_FALSE;
2268 }
2269
2270 info = XRRQueryOutputProperty(_ecore_x_disp, output, _backlight);
2271 if (info)
2272 {
2273 if ((info->range) && (info->num_values == 2))
2274 {
2275 min = info->values[0];
2276 max = info->values[1];
2277 tmp = (level * (max - min)) + min;
2278 new = tmp;
2279 if (new > max) new = max;
2280 if (new < min) new = min;
2281 XRRChangeOutputProperty(_ecore_x_disp, output, _backlight, XA_INTEGER, 32,
2282 PropModeReplace, (unsigned char *)&new, 1);
2283 XFlush(_ecore_x_disp);
2284 }
2285 free(info);
2286 return EINA_TRUE;
2287 }
2288#endif
2289 return EINA_FALSE;
2290}
2291
2292/*
2293 * @brief get the outputs, which display a certain window
2294 * @param window window the displaying outputs shall be found for
2295 * @param num the number of outputs displaying the window
2296 * @return array of outputs that display a certain window. NULL if no outputs
2297 * was found that displays the specified window.
2298 */
2299
2300EAPI Ecore_X_Randr_Output *
2301ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2302 int *num)
2303{
2304#ifdef ECORE_XRANDR
2305 Ecore_X_Window root;
2306 Ecore_X_Randr_Crtc *crtcs;
2307 Ecore_X_Randr_Output *outputs, *ret = NULL;
2308 int ncrtcs, noutputs, i, nret = 0;
2309
2310 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
2311
2312 root = ecore_x_window_root_get(window);
2313 if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
2314 goto _ecore_x_randr_current_output_get_fail;
2315
2316 for (i = 0, nret = 0; i < ncrtcs; i++)
2317 {
2318
2319 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
2320 &noutputs);
2321 if (!outputs)
2322 goto _ecore_x_randr_current_output_get_fail_free;
2323 nret += noutputs;
2324 ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
2325 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2326 free(outputs);
2327 }
2328 free(crtcs);
2329
2330 if (num)
2331 *num = nret;
2332
2333 return ret;
2334
2335_ecore_x_randr_current_output_get_fail_free:
2336 free(outputs);
2337 free(crtcs);
2338 free(ret);
2339_ecore_x_randr_current_output_get_fail:
2340#endif
2341 if (num) *num = 0;
2342 return NULL;
2343}
2344
2345/*
2346 * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead.
2347 * @brief get the outputs, which display a certain window
2348 * @param window window the displaying outputs shall be found for
2349 * @param num the number of outputs displaying the window
2350 * @return array of outputs that display a certain window. NULL if no outputs
2351 * was found that displays the specified window.
2352 */
2353
2354EAPI Ecore_X_Randr_Output *
2355ecore_x_randr_current_output_get(Ecore_X_Window window,
2356 int *num)
2357{
2358 return ecore_x_randr_window_outputs_get(window, num);
2359}
2360
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
deleted file mode 100644
index 5bda332..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c
+++ /dev/null
@@ -1,463 +0,0 @@
1/*
2 * Copyright 2006-2009 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22/* Original Author: Adam Jackson <ajax@nwnk.net> */
23/* Heavily modified by: Leif Middelschulte <leif.middelschulte@gmail.com> */
24
25#include "Ecore_X.h"
26#include <stdio.h>
27#include <stdlib.h>
28#include <unistd.h>
29#include <string.h>
30
31/* TODO:
32 * - see other TODO's within this file.
33 */
34
35#define ECORE_X_RANDR_EDID_VERSION_10 ((1 << 8) | 0)
36#define ECORE_X_RANDR_EDID_VERSION_11 ((1 << 8) | 1)
37#define ECORE_X_RANDR_EDID_VERSION_12 ((1 << 8) | 2)
38#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3)
39#define ECORE_X_RANDR_EDID_VERSION_14 ((1 << 8) | 4)
40
41#define _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER 0x08
42#define _ECORE_X_RANDR_EDID_OFFSET_TYPE 0x14
43#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12
44#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13
45#define _ECORE_X_RANDR_EDID_OFFSET_DPMS 0x18
46#define _ECORE_X_RANDR_EDID_OFFSET_COLORSPACE 0x18
47#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36
48#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3
49#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5
50#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED 15
51#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO 14
52
53#define _ECORE_X_RANDR_EDID_MASK_DIGITAL 0x80
54#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_INTERFACE 0x0f
55#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_TMDS_DFP_10 0x01
56#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS 0x18
57#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444 0x10
58#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422 0x08
59#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED 0xe0
60#define _ECORE_X_RANDR_EDID_MASK_DPMS 0xE0
61#define _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY 0x80
62#define _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND 0x40
63#define _ECORE_X_RANDR_EDID_MASK_DPMS_OFF 0x20
64#define _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE 0x0f
65#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3 0x80
66#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9 0x40
67#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10 0x20
68#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4 0x10
69#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9 0x08
70
71#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13
72
73typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred {
74 ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3 = 0x00,
75 ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9 = 0x01,
76 ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10 = 0x02,
77 ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4 = 0x03,
78 ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9 = 0x04
79} Ecore_X_Randr_Edid_Aspect_Ratio_Preferred;
80
81/* Some convenience loops */
82#define _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, extension_block_iter) \
83 for (extension_block_iter = edid; extension_block_iter < (edid + edid_length); extension_block_iter += 128)
84
85#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \
86 _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, cea_block_iter) \
87 if (cea_block_iter[0] == 0x02)
88
89/* The following macro is to be used with caution as it inherits another loop.
90 * Therefore using a 'break;' statement will lead to continuation in the
91 * inherent 'Extension block'-loop.
92 */
93#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_DETAILED_BLOCK(edid, edid_length, cea_block_iter, detailed_block_iter) \
94 _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \
95 for (detailed_block_iter = cea_block_iter + cea_block_iter[2]; detailed_block_iter + 18 < cea_block_iter + 127; detailed_block_iter += 18) \
96 if (detailed_block_iter[0])
97
98#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
99 for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18)
100
101#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \
102 _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \
103 if ((block[0] == 0) && (block[1] == 0))
104
105EAPI Eina_Bool
106ecore_x_randr_edid_has_valid_header(unsigned char *edid,
107 unsigned long edid_length)
108{
109 const unsigned char header[] =
110 { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
111 if (!edid) return EINA_FALSE;
112 if (edid_length < 8) return EINA_FALSE;
113 if (!memcmp(edid, header, 8)) return EINA_TRUE;
114 return EINA_FALSE;
115}
116
117EAPI int
118ecore_x_randr_edid_version_get(unsigned char *edid,
119 unsigned long edid_length)
120{
121 if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) &&
122 (ecore_x_randr_edid_has_valid_header(edid, edid_length)))
123 return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) |
124 edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR];
125 return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
126}
127
128EAPI int
129ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid,
130 unsigned long edid_length)
131{
132 if ((edid_length > 0x0b) &&
133 (ecore_x_randr_edid_has_valid_header(edid, edid_length)))
134 return (int)(edid[0x0a] + (edid[0x0b] << 8));
135 return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
136}
137
138EAPI int
139ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid,
140 unsigned long edid_length)
141{
142 if ((edid_length > 0x0f) &&
143 (ecore_x_randr_edid_has_valid_header(edid, edid_length)))
144 return (int)(edid[0x0c] + (edid[0x0d] << 8) +
145 (edid[0x0e] << 16) + (edid[0x0f] << 24));
146 return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
147}
148
149EAPI char *
150ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid,
151 unsigned long edid_length)
152{
153 if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) &&
154 (ecore_x_randr_edid_has_valid_header(edid, edid_length)))
155 {
156 unsigned char *x;
157 char *name;
158
159 x = (edid + _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER);
160 name = malloc(sizeof(char) * 4);
161 if (!name) return NULL;
162 name[0] = ((x[0] & 0x7c) >> 2) + '@';
163 name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xe0) >> 5) + '@';
164 name[2] = (x[1] & 0x1f) + '@';
165 name[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] = 0;
166 return name;
167 }
168 return NULL;
169}
170
171EAPI char *
172ecore_x_randr_edid_display_name_get(unsigned char *edid,
173 unsigned long edid_length)
174{
175 unsigned char *block = NULL;
176 int version = ecore_x_randr_edid_version_get(edid, edid_length);
177
178 if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
179 _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
180 {
181 if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc)
182 {
183 char *name, *p;
184 const char *edid_name;
185
186 edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
187 name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
188 if (!name) return NULL;
189 strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
190 name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
191 for (p = name; *p; p++)
192 {
193 if ((*p < ' ') || (*p > '~')) *p = 0;
194 }
195 return name;
196 }
197 }
198 return NULL;
199}
200
201EAPI Ecore_X_Randr_Edid_Aspect_Ratio
202ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid,
203 unsigned long edid_length)
204{
205 unsigned char *block = NULL;
206 int version = ecore_x_randr_edid_version_get(edid, edid_length);
207
208 if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
209 _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
210 {
211 if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) &&
212 (block[10] == 0x04))
213 {
214 Ecore_X_Randr_Edid_Aspect_Ratio_Preferred preferred_ratio =
215 (Ecore_X_Randr_Edid_Aspect_Ratio_Preferred)
216 ((block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED] &
217 _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED) >> 5);
218 switch (preferred_ratio)
219 {
220 case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3:
221 return ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3;
222
223 case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9:
224 return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9;
225
226 case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10:
227 return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10;
228
229 case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4:
230 return ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4;
231
232 case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9:
233 return ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9;
234
235 default:
236 return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
237 }
238 }
239 }
240 return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
241}
242
243EAPI Ecore_X_Randr_Edid_Aspect_Ratio
244ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid,
245 unsigned long edid_length)
246{
247 Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
248 unsigned char *block = NULL;
249 int version = ecore_x_randr_edid_version_get(edid, edid_length);
250
251 if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
252 _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
253 {
254 if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) &&
255 (block[10] == 0x04))
256 {
257 if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3)
258 ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3;
259 if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9)
260 ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9;
261 if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10)
262 ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10;
263 if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4)
264 ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4;
265 if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9)
266 ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9;
267 }
268 }
269 return ret;
270}
271
272EAPI char *
273ecore_x_randr_edid_display_ascii_get(unsigned char *edid,
274 unsigned long edid_length)
275{
276 unsigned char *block = NULL;
277 int version = ecore_x_randr_edid_version_get(edid, edid_length);
278
279 if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
280 _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
281 {
282 if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe)
283 {
284 char *ascii, *p;
285 const char *edid_ascii = (const char *)block +
286 _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
287 /*
288 * TODO: Two of these in a row, in the third and fourth slots,
289 * seems to be specified by SPWG: http://www.spwg.org/
290 */
291 ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
292 if (!ascii) return NULL;
293 strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
294 ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
295 for (p = ascii; *p; p++)
296 {
297 if ((*p < ' ') || (*p > '~')) *p = 0;
298 }
299 return ascii;
300 }
301 }
302 return NULL;
303}
304
305EAPI char *
306ecore_x_randr_edid_display_serial_get(unsigned char *edid,
307 unsigned long edid_length)
308{
309 unsigned char *block = NULL;
310 int version = ecore_x_randr_edid_version_get(edid, edid_length);
311
312 if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL;
313 _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block)
314 {
315 if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff)
316 {
317 char *serial, *p;
318 const char *edid_serial = (const char *)block +
319 _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT;
320 /*
321 * TODO: Two of these in a row, in the third and fourth slots,
322 * seems to be specified by SPWG: http://www.spwg.org/
323 */
324 serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX);
325 if (!serial) return NULL;
326 strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1));
327 serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0;
328 for (p = serial; *p; p++)
329 {
330 if ((*p < ' ') || (*p > '~')) *p = 0;
331 }
332 return serial;
333 }
334 }
335 return NULL;
336}
337
338EAPI Eina_Bool
339ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid,
340 unsigned long edid_length)
341{
342 unsigned char *cea_block_iter = NULL;
343 char sum = 0;
344 int i;
345 int version = ecore_x_randr_edid_version_get(edid, edid_length);
346
347 if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
348 if (edid_length < 128) return EINA_FALSE;
349
350 /* Check the EDID block itself */
351 for (i = 0; i < 128; i++)
352 sum += edid[i];
353 if (sum) return EINA_FALSE;
354
355 /* Check the cea extension blocks */
356 _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter)
357 {
358 for (i = 0, sum = 0; i < 128; i++)
359 sum += cea_block_iter[i];
360 }
361 if (sum) return EINA_FALSE;
362 return EINA_TRUE;
363}
364
365EAPI Eina_Bool
366ecore_x_randr_edid_dpms_available_get(unsigned char *edid,
367 unsigned long edid_length)
368{
369 int version = ecore_x_randr_edid_version_get(edid, edid_length);
370
371 if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
372 return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
373 _ECORE_X_RANDR_EDID_MASK_DPMS);
374}
375
376EAPI Eina_Bool
377ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid,
378 unsigned long edid_length)
379{
380 int version = ecore_x_randr_edid_version_get(edid, edid_length);
381
382 if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
383 if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS)
384 return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
385 _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY);
386 return EINA_FALSE;
387}
388
389EAPI Eina_Bool
390ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid,
391 unsigned long edid_length)
392{
393 int version = ecore_x_randr_edid_version_get(edid, edid_length);
394
395 if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
396 if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS)
397 return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
398 _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND);
399 return EINA_FALSE;
400}
401
402EAPI Eina_Bool
403ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid,
404 unsigned long edid_length)
405{
406 int version = ecore_x_randr_edid_version_get(edid, edid_length);
407
408 if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
409 if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS)
410 return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] &
411 _ECORE_X_RANDR_EDID_MASK_DPMS_OFF);
412 return EINA_FALSE;
413}
414
415EAPI Eina_Bool
416ecore_x_randr_edid_display_type_digital_get(unsigned char *edid,
417 unsigned long edid_length)
418{
419 int version = ecore_x_randr_edid_version_get(edid, edid_length);
420
421 if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE;
422 return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] &
423 _ECORE_X_RANDR_EDID_MASK_DIGITAL);
424}
425
426EAPI Ecore_X_Randr_Edid_Display_Colorscheme
427ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid,
428 unsigned long edid_length)
429{
430 Ecore_X_Randr_Edid_Display_Colorscheme colorscheme = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
431 int version = ecore_x_randr_edid_version_get(edid, edid_length);
432
433 if (version < ECORE_X_RANDR_EDID_VERSION_13) return colorscheme;
434 if (ecore_x_randr_edid_display_type_digital_get(edid, edid_length))
435 {
436 colorscheme = ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4;
437 if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] &
438 _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444)
439 colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4;
440 if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] &
441 _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422)
442 colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2;
443 }
444 else
445 colorscheme = edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS;
446 return colorscheme;
447}
448
449EAPI Ecore_X_Randr_Edid_Display_Interface_Type
450ecore_x_randr_edid_display_interface_type_get(unsigned char *edid,
451 unsigned long edid_length)
452{
453 Ecore_X_Randr_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
454 int version = ecore_x_randr_edid_version_get(edid, edid_length);
455
456 if (version < ECORE_X_RANDR_EDID_VERSION_13) return type;
457 type = edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] &
458 _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE;
459 if (type > ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT)
460 type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
461 return type;
462}
463
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
deleted file mode 100644
index 5d1c8e9..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9#include "ecore_x_private.h"
10#include "ecore_x_randr.h"
11#include <stdio.h>
12#include <stdlib.h>
13#include <unistd.h>
14#include <string.h>
15
16#define Ecore_X_Randr_None 0
17#define Ecore_X_Randr_Unset -1
18
19#ifdef ECORE_XRANDR
20
21#define RANDR_1_3 ((1 << 16) | 3)
22#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) \
23 return ret
24
25extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
26 dpy,
27 Window
28 window);
29extern int _randr_version;
30#endif
31
32/*
33 * @param root window which's screen should be queried
34 * @return Ecore_X_Randr_Ouptut_Id or - if query failed or none is set - Ecore_X_Randr_None
35 */
36EAPI Ecore_X_Randr_Output
37ecore_x_randr_primary_output_get(Ecore_X_Window root)
38{
39#ifdef ECORE_XRANDR
40 RANDR_CHECK_1_3_RET(Ecore_X_Randr_None);
41 if (!_ecore_x_randr_root_validate(root))
42 return Ecore_X_Randr_None;
43
44 return XRRGetOutputPrimary(_ecore_x_disp, root);
45#else
46 return Ecore_X_Randr_None;
47#endif
48}
49
50/*
51 * @param root window which's screen should be queried
52 * @param output that should be set as given root window's screen primary output
53 */
54EAPI void
55ecore_x_randr_primary_output_set(Ecore_X_Window root,
56 Ecore_X_Randr_Output output)
57{
58#ifdef ECORE_XRANDR
59 RANDR_CHECK_1_3_RET();
60
61 if (_ecore_x_randr_output_validate(root, output))
62 {
63 XRRSetOutputPrimary(_ecore_x_disp, root, output);
64 }
65
66#endif
67}
68
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
deleted file mode 100644
index 81d7eea..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c
+++ /dev/null
@@ -1,158 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6
7/*
8 * [x] XCreateRegion
9 * [ ] XPolygonRegion
10 * [x] XSetRegion
11 * [x] XDestroyRegion
12 *
13 * [x] XOffsetRegion
14 * [ ] XShrinkRegion
15 *
16 * [ ] XClipBox
17 * [x] XIntersectRegion
18 * [x] XUnionRegion
19 * [x] XUnionRectWithRegion
20 * [x] XSubtractRegion
21 * [ ] XXorRegion
22 *
23 * [x] XEmptyRegion
24 * [x] XEqualRegion
25 *
26 * [x] XPointInRegion
27 * [x] XRectInRegion
28 */
29
30EAPI Ecore_X_XRegion *
31ecore_x_xregion_new()
32{
33 LOGFN(__FILE__, __LINE__, __FUNCTION__);
34 return (Ecore_X_XRegion *)XCreateRegion();
35}
36
37EAPI void
38ecore_x_xregion_free(Ecore_X_XRegion *region)
39{
40 LOGFN(__FILE__, __LINE__, __FUNCTION__);
41 if (!region)
42 return;
43
44 XDestroyRegion((Region)region);
45}
46
47EAPI Eina_Bool
48ecore_x_xregion_set(Ecore_X_XRegion *region,
49 Ecore_X_GC gc)
50{
51 LOGFN(__FILE__, __LINE__, __FUNCTION__);
52 return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE;
53}
54
55EAPI void
56ecore_x_xregion_translate(Ecore_X_XRegion *region,
57 int x,
58 int y)
59{
60 LOGFN(__FILE__, __LINE__, __FUNCTION__);
61 if (!region)
62 return;
63
64 /* return value not used */
65 XOffsetRegion((Region)region, x, y);
66}
67
68EAPI Eina_Bool
69ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
70 Ecore_X_XRegion *r1,
71 Ecore_X_XRegion *r2)
72{
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 return XIntersectRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE;
75}
76
77EAPI Eina_Bool
78ecore_x_xregion_union(Ecore_X_XRegion *dst,
79 Ecore_X_XRegion *r1,
80 Ecore_X_XRegion *r2)
81{
82 LOGFN(__FILE__, __LINE__, __FUNCTION__);
83 return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE;
84}
85
86EAPI Eina_Bool
87ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
88 Ecore_X_XRegion *src,
89 Ecore_X_Rectangle *rect)
90{
91 XRectangle xr;
92
93 LOGFN(__FILE__, __LINE__, __FUNCTION__);
94 xr.x = rect->x;
95 xr.y = rect->y;
96 xr.width = rect->width;
97 xr.height = rect->height;
98
99 return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE;
100}
101
102EAPI Eina_Bool
103ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
104 Ecore_X_XRegion *rm,
105 Ecore_X_XRegion *rs)
106{
107 LOGFN(__FILE__, __LINE__, __FUNCTION__);
108 return XSubtractRegion((Region)rm, (Region)rs, (Region)dst) ? EINA_TRUE : EINA_FALSE;
109}
110
111EAPI Eina_Bool
112ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
113{
114 if (!region)
115 return EINA_TRUE;
116
117 LOGFN(__FILE__, __LINE__, __FUNCTION__);
118 return XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE;
119}
120
121EAPI Eina_Bool
122ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
123 Ecore_X_XRegion *r2)
124{
125 if (!r1 || !r2)
126 return EINA_FALSE;
127
128 LOGFN(__FILE__, __LINE__, __FUNCTION__);
129 return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE;
130}
131
132EAPI Eina_Bool
133ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
134 int x,
135 int y)
136{
137 if (!region)
138 return EINA_FALSE;
139
140 LOGFN(__FILE__, __LINE__, __FUNCTION__);
141 return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE;
142}
143
144EAPI Eina_Bool
145ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
146 Ecore_X_Rectangle *rect)
147{
148 if (!region || !rect)
149 return EINA_FALSE;
150
151 LOGFN(__FILE__, __LINE__, __FUNCTION__);
152 return XRectInRegion((Region)region,
153 rect->x,
154 rect->y,
155 rect->width,
156 rect->height) ? EINA_TRUE : EINA_FALSE;
157}
158
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
deleted file mode 100644
index 40dd738..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2 * Screensaver code
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif /* ifdef HAVE_CONFIG_H */
8
9#include "Ecore.h"
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12#include "Ecore_X_Atoms.h"
13
14static int _screensaver_available = -1;
15
16EAPI Eina_Bool
17ecore_x_screensaver_event_available_get(void)
18{
19 if (_screensaver_available >= 0)
20 return _screensaver_available;
21
22#ifdef ECORE_XSS
23 int _screensaver_major, _screensaver_minor;
24
25 LOGFN(__FILE__, __LINE__, __FUNCTION__);
26 _screensaver_major = 1;
27 _screensaver_minor = 0;
28
29 if (XScreenSaverQueryVersion(_ecore_x_disp, &_screensaver_major,
30 &_screensaver_minor))
31 _screensaver_available = 1;
32 else
33 _screensaver_available = 0;
34
35#else /* ifdef ECORE_XSS */
36 _screensaver_available = 0;
37#endif /* ifdef ECORE_XSS */
38 return _screensaver_available;
39}
40
41EAPI int
42ecore_x_screensaver_idle_time_get(void)
43{
44#ifdef ECORE_XSS
45 XScreenSaverInfo *xss;
46 int idle;
47
48 LOGFN(__FILE__, __LINE__, __FUNCTION__);
49 xss = XScreenSaverAllocInfo();
50 XScreenSaverQueryInfo(_ecore_x_disp,
51 RootWindow(_ecore_x_disp, DefaultScreen(
52 _ecore_x_disp)), xss);
53 idle = xss->idle / 1000;
54 XFree(xss);
55
56 return idle;
57#else
58 return 0;
59#endif /* ifdef ECORE_XSS */
60}
61
62EAPI void
63ecore_x_screensaver_set(int timeout,
64 int interval,
65 int prefer_blanking,
66 int allow_exposures)
67{
68 LOGFN(__FILE__, __LINE__, __FUNCTION__);
69 XSetScreenSaver(_ecore_x_disp,
70 timeout,
71 interval,
72 prefer_blanking,
73 allow_exposures);
74}
75
76EAPI void
77ecore_x_screensaver_timeout_set(int timeout)
78{
79 int pto, pint, pblank, pexpo;
80
81 LOGFN(__FILE__, __LINE__, __FUNCTION__);
82 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
83 XSetScreenSaver(_ecore_x_disp, timeout, pint, pblank, pexpo);
84}
85
86EAPI int
87ecore_x_screensaver_timeout_get(void)
88{
89 int pto, pint, pblank, pexpo;
90
91 LOGFN(__FILE__, __LINE__, __FUNCTION__);
92 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
93 return pto;
94}
95
96EAPI void
97ecore_x_screensaver_blank_set(int blank)
98{
99 int pto, pint, pblank, pexpo;
100
101 LOGFN(__FILE__, __LINE__, __FUNCTION__);
102 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
103 XSetScreenSaver(_ecore_x_disp, pto, pint, blank, pexpo);
104}
105
106EAPI int
107ecore_x_screensaver_blank_get(void)
108{
109 int pto, pint, pblank, pexpo;
110
111 LOGFN(__FILE__, __LINE__, __FUNCTION__);
112 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
113 return pblank;
114}
115
116EAPI void
117ecore_x_screensaver_expose_set(int expose)
118{
119 int pto, pint, pblank, pexpo;
120
121 LOGFN(__FILE__, __LINE__, __FUNCTION__);
122 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
123 XSetScreenSaver(_ecore_x_disp, pto, pint, pblank, expose);
124}
125
126EAPI int
127ecore_x_screensaver_expose_get(void)
128{
129 int pto, pint, pblank, pexpo;
130
131 LOGFN(__FILE__, __LINE__, __FUNCTION__);
132 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
133 return pexpo;
134}
135
136EAPI void
137ecore_x_screensaver_interval_set(int interval)
138{
139 int pto, pint, pblank, pexpo;
140
141 LOGFN(__FILE__, __LINE__, __FUNCTION__);
142 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
143 XSetScreenSaver(_ecore_x_disp, pto, interval, pblank, pexpo);
144}
145
146EAPI int
147ecore_x_screensaver_interval_get(void)
148{
149 int pto, pint, pblank, pexpo;
150
151 LOGFN(__FILE__, __LINE__, __FUNCTION__);
152 XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
153 return pint;
154}
155
156EAPI void
157ecore_x_screensaver_event_listen_set(Eina_Bool on)
158{
159#ifdef ECORE_XSS
160 Ecore_X_Window root;
161
162 LOGFN(__FILE__, __LINE__, __FUNCTION__);
163 root = DefaultRootWindow(_ecore_x_disp);
164 if (on)
165 XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask);
166 else
167 XScreenSaverSelectInput(_ecore_x_disp, root, 0);
168#else
169 return;
170 on = EINA_FALSE;
171#endif /* ifdef ECORE_XSS */
172}
173
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
deleted file mode 100644
index fa177c3..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c
+++ /dev/null
@@ -1,1002 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <string.h>
7
8#include "Ecore.h"
9#include "ecore_private.h"
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12#include "Ecore_X_Atoms.h"
13
14static Ecore_X_Selection_Intern selections[4];
15static Ecore_X_Selection_Converter *converters = NULL;
16static Ecore_X_Selection_Parser *parsers = NULL;
17
18static Eina_Bool _ecore_x_selection_converter_text(char *target,
19 void *data,
20 int size,
21 void **data_ret,
22 int *size_ret,
23 Ecore_X_Atom *tprop,
24 int *);
25static int _ecore_x_selection_data_default_free(void *data);
26static void *_ecore_x_selection_parser_files(const char *target,
27 void *data,
28 int size,
29 int format);
30static int _ecore_x_selection_data_files_free(void *data);
31static void *_ecore_x_selection_parser_text(const char *target,
32 void *data,
33 int size,
34 int format);
35static int _ecore_x_selection_data_text_free(void *data);
36static void *_ecore_x_selection_parser_targets(const char *target,
37 void *data,
38 int size,
39 int format);
40static int _ecore_x_selection_data_targets_free(void *data);
41
42#define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
43
44void
45_ecore_x_selection_data_init(void)
46{
47 /* Initialize global data */
48 memset(selections, 0, sizeof(selections));
49
50 /* Initialize converters */
51 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
52 _ecore_x_selection_converter_text);
53#ifdef X_HAVE_UTF8_STRING
54 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
55 _ecore_x_selection_converter_text);
56#endif /* ifdef X_HAVE_UTF8_STRING */
57 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
58 _ecore_x_selection_converter_text);
59 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
60 _ecore_x_selection_converter_text);
61
62 /* Initialize parsers */
63 ecore_x_selection_parser_add("text/plain",
64 _ecore_x_selection_parser_text);
65 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
66 _ecore_x_selection_parser_text);
67 ecore_x_selection_parser_add("text/uri-list",
68 _ecore_x_selection_parser_files);
69 ecore_x_selection_parser_add("_NETSCAPE_URL",
70 _ecore_x_selection_parser_files);
71 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
72 _ecore_x_selection_parser_targets);
73}
74
75void
76_ecore_x_selection_shutdown(void)
77{
78 Ecore_X_Selection_Converter *cnv;
79 Ecore_X_Selection_Parser *prs;
80
81 /* free the selection converters */
82 cnv = converters;
83 while (cnv)
84 {
85 Ecore_X_Selection_Converter *tmp;
86
87 tmp = cnv->next;
88 free(cnv);
89 cnv = tmp;
90 }
91 converters = NULL;
92
93 /* free the selection parsers */
94 prs = parsers;
95 while (prs)
96 {
97 Ecore_X_Selection_Parser *tmp;
98
99 tmp = prs;
100 prs = prs->next;
101 free(tmp->target);
102 free(tmp);
103 }
104 parsers = NULL;
105}
106
107Ecore_X_Selection_Intern *
108_ecore_x_selection_get(Ecore_X_Atom selection)
109{
110 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
111 return &selections[0];
112 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
113 return &selections[1];
114 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
115 return &selections[2];
116 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
117 return &selections[3];
118 else
119 return NULL;
120}
121
122Eina_Bool
123_ecore_x_selection_set(Window w,
124 const void *data,
125 int size,
126 Ecore_X_Atom selection)
127{
128 int in;
129 unsigned char *buf = NULL;
130
131 XSetSelectionOwner(_ecore_x_disp, selection, w, _ecore_x_event_last_time);
132 if (XGetSelectionOwner(_ecore_x_disp, selection) != w)
133 return EINA_FALSE;
134
135 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
136 in = 0;
137 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
138 in = 1;
139 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
140 in = 2;
141 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
142 in = 3;
143 else
144 return EINA_FALSE;
145
146 if (data)
147 {
148 selections[in].win = w;
149 selections[in].selection = selection;
150 selections[in].length = size;
151 selections[in].time = _ecore_x_event_last_time;
152
153 buf = malloc(size);
154 if (!buf) return EINA_FALSE;
155 memcpy(buf, data, size);
156 selections[in].data = buf;
157 }
158 else if (selections[in].data)
159 {
160 free(selections[in].data);
161 memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data));
162 }
163
164 return EINA_TRUE;
165}
166
167/**
168 * Claim ownership of the PRIMARY selection and set its data.
169 * @param w The window to which this selection belongs
170 * @param data The data associated with the selection
171 * @param size The size of the data buffer in bytes
172 * @return Returns 1 if the ownership of the selection was successfully
173 * claimed, or 0 if unsuccessful.
174 */
175EAPI Eina_Bool
176ecore_x_selection_primary_set(Ecore_X_Window w,
177 const void *data,
178 int size)
179{
180 LOGFN(__FILE__, __LINE__, __FUNCTION__);
181 return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY);
182}
183
184/**
185 * Release ownership of the primary selection
186 * @return Returns 1 if the selection was successfully cleared,
187 * or 0 if unsuccessful.
188 *
189 */
190EAPI Eina_Bool
191ecore_x_selection_primary_clear(void)
192{
193 LOGFN(__FILE__, __LINE__, __FUNCTION__);
194 return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY);
195}
196
197/**
198 * Claim ownership of the SECONDARY selection and set its data.
199 * @param w The window to which this selection belongs
200 * @param data The data associated with the selection
201 * @param size The size of the data buffer in bytes
202 * @return Returns 1 if the ownership of the selection was successfully
203 * claimed, or 0 if unsuccessful.
204 */
205EAPI Eina_Bool
206ecore_x_selection_secondary_set(Ecore_X_Window w,
207 const void *data,
208 int size)
209{
210 LOGFN(__FILE__, __LINE__, __FUNCTION__);
211 return _ecore_x_selection_set(w,
212 data,
213 size,
214 ECORE_X_ATOM_SELECTION_SECONDARY);
215}
216
217/**
218 * Release ownership of the secondary selection
219 * @return Returns 1 if the selection was successfully cleared,
220 * or 0 if unsuccessful.
221 *
222 */
223EAPI Eina_Bool
224ecore_x_selection_secondary_clear(void)
225{
226 LOGFN(__FILE__, __LINE__, __FUNCTION__);
227 return _ecore_x_selection_set(None,
228 NULL,
229 0,
230 ECORE_X_ATOM_SELECTION_SECONDARY);
231}
232
233/**
234 * Claim ownership of the XDND selection and set its data.
235 * @param w The window to which this selection belongs
236 * @param data The data associated with the selection
237 * @param size The size of the data buffer in bytes
238 * @return Returns 1 if the ownership of the selection was successfully
239 * claimed, or 0 if unsuccessful.
240 */
241EAPI Eina_Bool
242ecore_x_selection_xdnd_set(Ecore_X_Window w,
243 const void *data,
244 int size)
245{
246 LOGFN(__FILE__, __LINE__, __FUNCTION__);
247 return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND);
248}
249
250/**
251 * Release ownership of the XDND selection
252 * @return Returns 1 if the selection was successfully cleared,
253 * or 0 if unsuccessful.
254 *
255 */
256EAPI Eina_Bool
257ecore_x_selection_xdnd_clear(void)
258{
259 LOGFN(__FILE__, __LINE__, __FUNCTION__);
260 return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND);
261}
262
263/**
264 * Claim ownership of the CLIPBOARD selection and set its data.
265 * @param w The window to which this selection belongs
266 * @param data The data associated with the selection
267 * @param size The size of the data buffer in bytes
268 * @return Returns 1 if the ownership of the selection was successfully
269 * claimed, or 0 if unsuccessful.
270 *
271 * Get the converted data from a previous CLIPBOARD selection
272 * request. The buffer must be freed when done with.
273 */
274EAPI Eina_Bool
275ecore_x_selection_clipboard_set(Ecore_X_Window w,
276 const void *data,
277 int size)
278{
279 LOGFN(__FILE__, __LINE__, __FUNCTION__);
280 return _ecore_x_selection_set(w,
281 data,
282 size,
283 ECORE_X_ATOM_SELECTION_CLIPBOARD);
284}
285
286/**
287 * Release ownership of the clipboard selection
288 * @return Returns 1 if the selection was successfully cleared,
289 * or 0 if unsuccessful.
290 *
291 */
292EAPI Eina_Bool
293ecore_x_selection_clipboard_clear(void)
294{
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
296 return _ecore_x_selection_set(None,
297 NULL,
298 0,
299 ECORE_X_ATOM_SELECTION_CLIPBOARD);
300}
301
302Ecore_X_Atom
303_ecore_x_selection_target_atom_get(const char *target)
304{
305 Ecore_X_Atom x_target;
306
307 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
308 x_target = ECORE_X_ATOM_TEXT;
309 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
310 x_target = ECORE_X_ATOM_COMPOUND_TEXT;
311 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
312 x_target = ECORE_X_ATOM_STRING;
313 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
314 x_target = ECORE_X_ATOM_UTF8_STRING;
315 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
316 x_target = ECORE_X_ATOM_FILE_NAME;
317 else
318 x_target = ecore_x_atom_get(target);
319
320 return x_target;
321}
322
323char *
324_ecore_x_selection_target_get(Ecore_X_Atom target)
325{
326 /* FIXME: Should not return mem allocated with strdup or X mixed,
327 * one should use free to free, the other XFree */
328 if (target == ECORE_X_ATOM_FILE_NAME)
329 return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
330 else if (target == ECORE_X_ATOM_STRING)
331 return strdup(ECORE_X_SELECTION_TARGET_STRING);
332 else if (target == ECORE_X_ATOM_UTF8_STRING)
333 return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
334 else if (target == ECORE_X_ATOM_TEXT)
335 return strdup(ECORE_X_SELECTION_TARGET_TEXT);
336 else
337 return XGetAtomName(_ecore_x_disp, target);
338}
339
340static void
341_ecore_x_selection_request(Ecore_X_Window w,
342 Ecore_X_Atom selection,
343 const char *target_str)
344{
345 Ecore_X_Atom target, prop;
346
347 target = _ecore_x_selection_target_atom_get(target_str);
348
349 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
350 prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
351 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
352 prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
353 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
354 prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
355 else
356 return;
357
358 XConvertSelection(_ecore_x_disp, selection, target, prop,
359 w, CurrentTime);
360}
361
362EAPI void
363ecore_x_selection_primary_request(Ecore_X_Window w,
364 const char *target)
365{
366 LOGFN(__FILE__, __LINE__, __FUNCTION__);
367 _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target);
368}
369
370EAPI void
371ecore_x_selection_secondary_request(Ecore_X_Window w,
372 const char *target)
373{
374 LOGFN(__FILE__, __LINE__, __FUNCTION__);
375 _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target);
376}
377
378EAPI void
379ecore_x_selection_xdnd_request(Ecore_X_Window w,
380 const char *target)
381{
382 Ecore_X_Atom atom;
383 Ecore_X_DND_Target *_target;
384
385 LOGFN(__FILE__, __LINE__, __FUNCTION__);
386 _target = _ecore_x_dnd_target_get();
387 atom = _ecore_x_selection_target_atom_get(target);
388 XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom,
389 ECORE_X_ATOM_SELECTION_PROP_XDND, w,
390 _target->time);
391}
392
393EAPI void
394ecore_x_selection_clipboard_request(Ecore_X_Window w,
395 const char *target)
396{
397 LOGFN(__FILE__, __LINE__, __FUNCTION__);
398 _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
399}
400
401EAPI void
402ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
403 Eina_Bool (*func)(char *target,
404 void *data,
405 int size,
406 void **data_ret,
407 int *size_ret,
408 Ecore_X_Atom *ttype,
409 int *tsize))
410{
411 Ecore_X_Selection_Converter *cnv;
412
413 LOGFN(__FILE__, __LINE__, __FUNCTION__);
414 cnv = converters;
415 if (converters)
416 {
417 while (1)
418 {
419 if (cnv->target == target)
420 {
421 cnv->convert = func;
422 return;
423 }
424
425 if (cnv->next)
426 cnv = cnv->next;
427 else
428 break;
429 }
430
431 cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
432 if (!cnv->next) return;
433 cnv = cnv->next;
434 }
435 else
436 {
437 converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
438 if (!converters) return;
439 cnv = converters;
440 }
441
442 cnv->target = target;
443 cnv->convert = func;
444}
445
446EAPI void
447ecore_x_selection_converter_add(char *target,
448 Eina_Bool (*func)(char *target,
449 void *data,
450 int size,
451 void **data_ret,
452 int *size_ret,
453 Ecore_X_Atom *,
454 int *))
455{
456 Ecore_X_Atom x_target;
457
458 if (!func || !target)
459 return;
460
461 LOGFN(__FILE__, __LINE__, __FUNCTION__);
462 x_target = _ecore_x_selection_target_atom_get(target);
463
464 ecore_x_selection_converter_atom_add(x_target, func);
465}
466
467EAPI void
468ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
469{
470 Ecore_X_Selection_Converter *cnv, *prev_cnv;
471
472 LOGFN(__FILE__, __LINE__, __FUNCTION__);
473 prev_cnv = NULL;
474 cnv = converters;
475
476 while (cnv)
477 {
478 if (cnv->target == target)
479 {
480 if (prev_cnv)
481 prev_cnv->next = cnv->next;
482 else
483 {
484 converters = cnv->next; /* This was the first converter */
485 }
486
487 free(cnv);
488
489 return;
490 }
491
492 prev_cnv = cnv;
493 cnv = cnv->next;
494 }
495}
496
497EAPI void
498ecore_x_selection_converter_del(char *target)
499{
500 Ecore_X_Atom x_target;
501
502 if (!target)
503 return;
504
505 LOGFN(__FILE__, __LINE__, __FUNCTION__);
506 x_target = _ecore_x_selection_target_atom_get(target);
507 ecore_x_selection_converter_atom_del(x_target);
508}
509
510EAPI Eina_Bool
511ecore_x_selection_notify_send(Ecore_X_Window requestor,
512 Ecore_X_Atom selection,
513 Ecore_X_Atom target,
514 Ecore_X_Atom property,
515 Ecore_X_Time tim)
516{
517 XEvent xev;
518 XSelectionEvent xnotify;
519
520 LOGFN(__FILE__, __LINE__, __FUNCTION__);
521 xnotify.type = SelectionNotify;
522 xnotify.display = _ecore_x_disp;
523 xnotify.requestor = requestor;
524 xnotify.selection = selection;
525 xnotify.target = target;
526 xnotify.property = property;
527 xnotify.time = tim;
528 xnotify.send_event = True;
529 xnotify.serial = 0;
530
531 xev.xselection = xnotify;
532 return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE;
533}
534
535/* Locate and run conversion callback for specified selection target */
536EAPI Eina_Bool
537ecore_x_selection_convert(Ecore_X_Atom selection,
538 Ecore_X_Atom target,
539 void **data_ret,
540 int *size,
541 Ecore_X_Atom *targtype,
542 int *typesize)
543{
544 Ecore_X_Selection_Intern *sel;
545 Ecore_X_Selection_Converter *cnv;
546 void *data;
547 char *tgt_str;
548
549 LOGFN(__FILE__, __LINE__, __FUNCTION__);
550 sel = _ecore_x_selection_get(selection);
551 tgt_str = _ecore_x_selection_target_get(target);
552
553 for (cnv = converters; cnv; cnv = cnv->next)
554 {
555 if (cnv->target == target)
556 {
557 int r;
558 r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
559 targtype, typesize);
560 free(tgt_str);
561 if (r)
562 {
563 *data_ret = data;
564 return r;
565 }
566 else
567 return EINA_FALSE;
568 }
569 }
570
571 /* 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." */
572 return EINA_FALSE;
573
574 /* Default, just return the data
575 * data_ret = malloc(sel->length);
576 memcpy(*data_ret, sel->data, sel->length);
577 free(tgt_str);
578 return 1;
579 */
580}
581
582/* TODO: We need to work out a mechanism for automatic conversion to any requested
583 * locale using Ecore_Txt functions */
584/* Converter for standard non-utf8 text targets */
585static Eina_Bool
586_ecore_x_selection_converter_text(char *target,
587 void *data,
588 int size,
589 void **data_ret,
590 int *size_ret,
591 Ecore_X_Atom *targprop __UNUSED__,
592 int *s __UNUSED__)
593{
594 XTextProperty text_prop;
595 char *mystr;
596 XICCEncodingStyle style;
597
598 if (!data || !size)
599 return EINA_FALSE;
600
601 LOGFN(__FILE__, __LINE__, __FUNCTION__);
602 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
603 style = XTextStyle;
604 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
605 style = XCompoundTextStyle;
606 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
607 style = XStringStyle;
608
609#ifdef X_HAVE_UTF8_STRING
610 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
611 style = XUTF8StringStyle;
612#endif /* ifdef X_HAVE_UTF8_STRING */
613 else
614 return EINA_FALSE;
615
616 mystr = alloca(size + 1);
617 memcpy(mystr, data, size);
618 mystr[size] = '\0';
619
620#ifdef X_HAVE_UTF8_STRING
621 if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style,
622 &text_prop) == Success)
623 {
624 int bufsize = strlen((char *)text_prop.value) + 1;
625 *data_ret = malloc(bufsize);
626 if (!*data_ret)
627 {
628 return EINA_FALSE;
629 }
630 memcpy(*data_ret, text_prop.value, bufsize);
631 *size_ret = bufsize;
632 XFree(text_prop.value);
633 return EINA_TRUE;
634 }
635
636#else /* ifdef X_HAVE_UTF8_STRING */
637 if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style,
638 &text_prop) == Success)
639 {
640 int bufsize = strlen(text_prop.value) + 1;
641 *data_ret = malloc(bufsize);
642 if (!*data_ret) return EINA_FALSE;
643 memcpy(*data_ret, text_prop.value, bufsize);
644 *size_ret = bufsize;
645 XFree(text_prop.value);
646 return EINA_TRUE;
647 }
648
649#endif /* ifdef X_HAVE_UTF8_STRING */
650 else
651 {
652 return EINA_TRUE;
653 }
654}
655
656EAPI void
657ecore_x_selection_parser_add(const char *target,
658 void *(*func)(const char *target, void *data,
659 int size,
660 int format))
661{
662 Ecore_X_Selection_Parser *prs;
663
664 if (!target)
665 return;
666
667 LOGFN(__FILE__, __LINE__, __FUNCTION__);
668 prs = parsers;
669 if (parsers)
670 {
671 while (prs->next)
672 {
673 if (!strcmp(prs->target, target))
674 {
675 prs->parse = func;
676 return;
677 }
678
679 prs = prs->next;
680 }
681
682 prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
683 if (!prs->next) return;
684 prs = prs->next;
685 }
686 else
687 {
688 parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
689 if (!parsers) return;
690 prs = parsers;
691 }
692
693 prs->target = strdup(target);
694 prs->parse = func;
695}
696
697EAPI void
698ecore_x_selection_parser_del(const char *target)
699{
700 Ecore_X_Selection_Parser *prs, *prev_prs;
701
702 if (!target)
703 return;
704
705 LOGFN(__FILE__, __LINE__, __FUNCTION__);
706 prev_prs = NULL;
707 prs = parsers;
708
709 while (prs)
710 {
711 if (!strcmp(prs->target, target))
712 {
713 if (prev_prs)
714 prev_prs->next = prs->next;
715 else
716 {
717 parsers = prs->next; /* This was the first parser */
718 }
719
720 free(prs->target);
721 free(prs);
722
723 return;
724 }
725
726 prev_prs = prs;
727 prs = prs->next;
728 }
729}
730
731/**
732 * Change the owner and last-change time for the specified selection.
733 * @param win The owner of the specified atom.
734 * @param atom The selection atom
735 * @param tim Specifies the time
736 * @since 1.1.0
737 */
738EAPI void
739ecore_x_selection_owner_set(Ecore_X_Window win,
740 Ecore_X_Atom atom,
741 Ecore_X_Time tim)
742{
743 XSetSelectionOwner(_ecore_x_disp, atom, win, tim);
744}
745
746/**
747 * Return the window that currently owns the specified selection.
748 *
749 * @param atom The specified selection atom.
750 *
751 * @return The window that currently owns the specified selection.
752 * @since 1.1.0
753 */
754EAPI Ecore_X_Window
755ecore_x_selection_owner_get(Ecore_X_Atom atom)
756{
757 return XGetSelectionOwner(_ecore_x_disp, atom);
758}
759
760/* Locate and run conversion callback for specified selection target */
761void *
762_ecore_x_selection_parse(const char *target,
763 void *data,
764 int size,
765 int format)
766{
767 Ecore_X_Selection_Parser *prs;
768 Ecore_X_Selection_Data *sel;
769
770 for (prs = parsers; prs; prs = prs->next)
771 {
772 if (!strcmp(prs->target, target))
773 {
774 sel = prs->parse(target, data, size, format);
775 if (sel) return sel;
776 }
777 }
778
779 /* Default, just return the data */
780 sel = calloc(1, sizeof(Ecore_X_Selection_Data));
781 if (!sel) return NULL;
782 sel->free = _ecore_x_selection_data_default_free;
783 sel->length = size;
784 sel->format = format;
785 sel->data = data;
786 return sel;
787}
788
789static int
790_ecore_x_selection_data_default_free(void *data)
791{
792 Ecore_X_Selection_Data *sel;
793
794 sel = data;
795 free(sel->data);
796 free(sel);
797 return 1;
798}
799
800static void *
801_ecore_x_selection_parser_files(const char *target,
802 void *_data,
803 int size,
804 int format __UNUSED__)
805{
806 Ecore_X_Selection_Data_Files *sel;
807 char *t, *data = _data;
808 int i, is;
809 char *tmp;
810 char **t2;
811
812 if (strcmp(target, "text/uri-list") &&
813 strcmp(target, "_NETSCAPE_URL"))
814 return NULL;
815
816 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
817 if (!sel) return NULL;
818 ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free;
819
820 if (data[size - 1])
821 {
822 /* Isn't nul terminated */
823 size++;
824 t = realloc(data, size);
825 if (!t)
826 {
827 free(sel);
828 return NULL;
829 }
830 data = t;
831 data[size - 1] = 0;
832 }
833
834 tmp = malloc(size);
835 if (!tmp)
836 {
837 free(sel);
838 return NULL;
839 }
840 i = 0;
841 is = 0;
842 while ((is < size) && (data[is]))
843 {
844 if ((i == 0) && (data[is] == '#'))
845 for (; ((data[is]) && (data[is] != '\n')); is++) ;
846 else
847 {
848 if ((data[is] != '\r') &&
849 (data[is] != '\n'))
850 tmp[i++] = data[is++];
851 else
852 {
853 while ((data[is] == '\r') || (data[is] == '\n'))
854 is++;
855 tmp[i] = 0;
856 sel->num_files++;
857 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
858 if (t2)
859 {
860 sel->files = t2;
861 sel->files[sel->num_files - 1] = strdup(tmp);
862 }
863 tmp[0] = 0;
864 i = 0;
865 }
866 }
867 }
868 if (i > 0)
869 {
870 tmp[i] = 0;
871 sel->num_files++;
872 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
873 if (t2)
874 {
875 sel->files = t2;
876 sel->files[sel->num_files - 1] = strdup(tmp);
877 }
878 }
879
880 free(tmp);
881 free(data);
882
883 ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;
884 ECORE_X_SELECTION_DATA(sel)->length = sel->num_files;
885
886 return ECORE_X_SELECTION_DATA(sel);
887}
888
889static int
890_ecore_x_selection_data_files_free(void *data)
891{
892 Ecore_X_Selection_Data_Files *sel;
893 int i;
894
895 sel = data;
896 if (sel->files)
897 {
898 for (i = 0; i < sel->num_files; i++)
899 free(sel->files[i]);
900 free(sel->files);
901 }
902
903 free(sel);
904 return 0;
905}
906
907static void *
908_ecore_x_selection_parser_text(const char *target __UNUSED__,
909 void *_data,
910 int size,
911 int format __UNUSED__)
912{
913 Ecore_X_Selection_Data_Text *sel;
914 unsigned char *data = _data;
915 void *t;
916
917 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
918 if (!sel) return NULL;
919 if (data[size - 1])
920 {
921 /* Isn't nul terminated */
922 size++;
923 t = realloc(data, size);
924 if (!t)
925 {
926 free(sel);
927 return NULL;
928 }
929 data = t;
930 data[size - 1] = 0;
931 }
932
933 sel->text = (char *)data;
934 ECORE_X_SELECTION_DATA(sel)->length = size;
935 ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
936 ECORE_X_SELECTION_DATA(sel)->data = data;
937 ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free;
938 return sel;
939}
940
941static int
942_ecore_x_selection_data_text_free(void *data)
943{
944 Ecore_X_Selection_Data_Text *sel;
945
946 sel = data;
947 free(sel->text);
948 free(sel);
949 return 1;
950}
951
952static void *
953_ecore_x_selection_parser_targets(const char *target __UNUSED__,
954 void *data,
955 int size,
956 int format __UNUSED__)
957{
958 Ecore_X_Selection_Data_Targets *sel;
959 unsigned long *targets;
960 int i;
961
962 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
963 if (!sel) return NULL;
964 targets = (unsigned long *)data;
965
966 sel->num_targets = size - 2;
967 sel->targets = malloc((size - 2) * sizeof(char *));
968 if (!sel->targets)
969 {
970 free(sel);
971 return NULL;
972 }
973 for (i = 2; i < size; i++)
974 sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]);
975
976 ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_targets_free;
977 ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
978 ECORE_X_SELECTION_DATA(sel)->length = size;
979 ECORE_X_SELECTION_DATA(sel)->data = data;
980 return sel;
981}
982
983static int
984_ecore_x_selection_data_targets_free(void *data)
985{
986 Ecore_X_Selection_Data_Targets *sel;
987 int i;
988
989 sel = data;
990
991 if (sel->targets)
992 {
993 for (i = 0; i < sel->num_targets; i++)
994 XFree(sel->targets[i]);
995 free(sel->targets);
996 }
997
998 free(ECORE_X_SELECTION_DATA(sel)->data);
999 free(sel);
1000 return 1;
1001}
1002
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
deleted file mode 100644
index 0c7f546..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * XSync code
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif /* ifdef HAVE_CONFIG_H */
8
9#include "Ecore.h"
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12#include "Ecore_X_Atoms.h"
13
14EAPI Ecore_X_Sync_Alarm
15ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
16{
17 Ecore_X_Sync_Alarm alarm;
18 XSyncAlarmAttributes values;
19 XSyncValue init;
20
21 LOGFN(__FILE__, __LINE__, __FUNCTION__);
22 XSyncIntToValue(&init, 0);
23 XSyncSetCounter(_ecore_x_disp, counter, init);
24
25 values.trigger.counter = counter;
26 values.trigger.value_type = XSyncAbsolute;
27 XSyncIntToValue(&values.trigger.wait_value, 1);
28 values.trigger.test_type = XSyncPositiveComparison;
29
30 XSyncIntToValue(&values.delta, 1);
31
32 values.events = True;
33
34 alarm = XSyncCreateAlarm(_ecore_x_disp,
35 XSyncCACounter |
36 XSyncCAValueType |
37 XSyncCAValue |
38 XSyncCATestType |
39 XSyncCADelta |
40 XSyncCAEvents,
41 &values);
42
43 ecore_x_sync();
44 return alarm;
45}
46
47EAPI Eina_Bool
48ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
49{
50 LOGFN(__FILE__, __LINE__, __FUNCTION__);
51 return XSyncDestroyAlarm(_ecore_x_disp, alarm);
52}
53
54EAPI Eina_Bool
55ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
56 unsigned int *val)
57{
58 XSyncValue value;
59
60 LOGFN(__FILE__, __LINE__, __FUNCTION__);
61 if (XSyncQueryCounter(_ecore_x_disp, counter, &value))
62 {
63 *val = (unsigned int)XSyncValueLow32(value);
64 return EINA_TRUE;
65 }
66
67 return EINA_FALSE;
68}
69
70EAPI Ecore_X_Sync_Counter
71ecore_x_sync_counter_new(int val)
72{
73 XSyncCounter counter;
74 XSyncValue v;
75
76 LOGFN(__FILE__, __LINE__, __FUNCTION__);
77 XSyncIntToValue(&v, val);
78 counter = XSyncCreateCounter(_ecore_x_disp, v);
79 return counter;
80}
81
82EAPI void
83ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
84{
85 LOGFN(__FILE__, __LINE__, __FUNCTION__);
86 XSyncDestroyCounter(_ecore_x_disp, counter);
87}
88
89EAPI void
90ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
91 int by)
92{
93 XSyncValue v;
94
95 LOGFN(__FILE__, __LINE__, __FUNCTION__);
96 XSyncIntToValue(&v, by);
97 XSyncChangeCounter(_ecore_x_disp, counter, v);
98}
99
100EAPI void
101ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
102 int val)
103{
104 XSyncWaitCondition cond;
105 XSyncValue v, v2;
106
107 LOGFN(__FILE__, __LINE__, __FUNCTION__);
108 XSyncQueryCounter(_ecore_x_disp, counter, &v);
109 XSyncIntToValue(&v, val);
110 XSyncIntToValue(&v2, val + 1);
111 cond.trigger.counter = counter;
112 cond.trigger.value_type = XSyncAbsolute;
113 cond.trigger.wait_value = v;
114 cond.trigger.test_type = XSyncPositiveComparison;
115 cond.event_threshold = v2;
116 XSyncAwait(_ecore_x_disp, &cond, 1);
117// XSync(_ecore_x_disp, False); // dont need this
118}
119
120EAPI void
121ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
122 int val)
123{
124 XSyncValue v;
125
126 LOGFN(__FILE__, __LINE__, __FUNCTION__);
127 XSyncIntToValue(&v, val);
128 XSyncSetCounter(_ecore_x_disp, counter, v);
129}
130
131EAPI void
132ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
133 int val_hi,
134 unsigned int val_lo)
135{
136 XSyncValue v;
137
138 LOGFN(__FILE__, __LINE__, __FUNCTION__);
139 XSyncIntsToValue(&v, val_lo, val_hi);
140 XSyncSetCounter(_ecore_x_disp, counter, v);
141}
142
143EAPI Eina_Bool
144ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
145 int *val_hi,
146 unsigned int *val_lo)
147{
148 XSyncValue value;
149
150 LOGFN(__FILE__, __LINE__, __FUNCTION__);
151 if (XSyncQueryCounter(_ecore_x_disp, counter, &value))
152 {
153 *val_lo = (unsigned int)XSyncValueLow32(value);
154 *val_hi = (int)XSyncValueHigh32(value);
155 return EINA_TRUE;
156 }
157 return EINA_FALSE;
158}
159
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
deleted file mode 100644
index 23eea10..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
+++ /dev/null
@@ -1,167 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6
7#ifdef ECORE_XTEST
8# include <X11/extensions/XTest.h>
9#endif /* ifdef ECORE_XTEST */
10
11#include "ecore_x_private.h"
12#include "Ecore_X.h"
13#include <string.h>
14
15EAPI Eina_Bool
16#ifdef ECORE_XTEST
17ecore_x_test_fake_key_down(const char *key)
18#else
19ecore_x_test_fake_key_down(const char *key __UNUSED__)
20#endif
21{
22#ifdef ECORE_XTEST
23 KeyCode keycode = 0;
24 KeySym keysym;
25
26 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27 if (!strncmp(key, "Keycode-", 8))
28 keycode = atoi(key + 8);
29 else
30 {
31 keysym = XStringToKeysym(key);
32 if (keysym == NoSymbol)
33 return EINA_FALSE;
34
35 keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
36 }
37
38 if (keycode == 0)
39 return EINA_FALSE;
40
41 return XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0) ? EINA_TRUE : EINA_FALSE;
42#else /* ifdef ECORE_XTEST */
43 return EINA_FALSE;
44#endif /* ifdef ECORE_XTEST */
45}
46
47EAPI Eina_Bool
48#ifdef ECORE_XTEST
49ecore_x_test_fake_key_up(const char *key)
50#else
51ecore_x_test_fake_key_up(const char *key __UNUSED__)
52#endif
53{
54#ifdef ECORE_XTEST
55 KeyCode keycode = 0;
56 KeySym keysym;
57
58 LOGFN(__FILE__, __LINE__, __FUNCTION__);
59 if (!strncmp(key, "Keycode-", 8))
60 keycode = atoi(key + 8);
61 else
62 {
63 keysym = XStringToKeysym(key);
64 if (keysym == NoSymbol)
65 return EINA_FALSE;
66
67 keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
68 }
69
70 if (keycode == 0)
71 return EINA_FALSE;
72
73 return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0) ? EINA_TRUE : EINA_FALSE;
74#else /* ifdef ECORE_XTEST */
75 return EINA_FALSE;
76#endif /* ifdef ECORE_XTEST */
77}
78
79EAPI Eina_Bool
80#ifdef ECORE_XTEST
81ecore_x_test_fake_key_press(const char *key)
82#else
83ecore_x_test_fake_key_press(const char *key __UNUSED__)
84#endif
85{
86#ifdef ECORE_XTEST
87 KeyCode keycode = 0;
88 KeySym keysym = 0;
89 int shift = 0;
90
91 LOGFN(__FILE__, __LINE__, __FUNCTION__);
92 if (!strncmp(key, "Keycode-", 8))
93 keycode = atoi(key + 8);
94 else
95 {
96 keysym = XStringToKeysym(key);
97 if (keysym == NoSymbol)
98 return EINA_FALSE;
99
100 keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
101 if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym)
102 {
103 if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym)
104 shift = 1;
105 else
106 keycode = 0;
107 }
108 else
109 shift = 0;
110 }
111
112 if (keycode == 0)
113 {
114 static int mod = 0;
115 KeySym *keysyms;
116 int keycode_min, keycode_max, keycode_num;
117 int i;
118
119 XDisplayKeycodes(_ecore_x_disp, &keycode_min, &keycode_max);
120 keysyms = XGetKeyboardMapping(_ecore_x_disp, keycode_min,
121 keycode_max - keycode_min + 1,
122 &keycode_num);
123 mod = (mod + 1) & 0x7;
124 i = (keycode_max - keycode_min - mod - 1) * keycode_num;
125
126 keysyms[i] = keysym;
127 XChangeKeyboardMapping(_ecore_x_disp, keycode_min, keycode_num,
128 keysyms, (keycode_max - keycode_min));
129 XFree(keysyms);
130 XSync(_ecore_x_disp, False);
131 keycode = keycode_max - mod - 1;
132 }
133
134 if (shift)
135 XTestFakeKeyEvent(_ecore_x_disp,
136 XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 1, 0);
137
138 XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0);
139 XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0);
140 if (shift)
141 XTestFakeKeyEvent(_ecore_x_disp,
142 XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0);
143
144 return EINA_TRUE;
145#else /* ifdef ECORE_XTEST */
146 return EINA_FALSE;
147#endif /* ifdef ECORE_XTEST */
148}
149
150EAPI const char *
151ecore_x_keysym_string_get(int keysym)
152{
153 return XKeysymToString(keysym);
154}
155
156EAPI int
157ecore_x_keysym_keycode_get(const char *keyname)
158{
159 int keycode = 0;
160
161 if (!strncmp(keyname, "Keycode-", 8))
162 keycode = atoi(keyname + 8);
163 else
164 keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname));
165
166 return keycode;
167}
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
deleted file mode 100644
index 4296bb2..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c
+++ /dev/null
@@ -1,351 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "Ecore.h"
6#include "ecore_x_private.h"
7#include "Ecore_X.h"
8
9#include <string.h>
10#include <stdlib.h>
11#include <string.h>
12#include <unistd.h>
13#include <dlfcn.h>
14#include <sys/types.h>
15#include <sys/stat.h>
16#include <fcntl.h>
17
18#define ECORE_X_VSYNC_DRI2 1
19
20#ifdef ECORE_X_VSYNC_DRI2
21// relevant header bits of dri/drm inlined here to avoid needing external
22// headers to build
23/// drm
24typedef unsigned int drm_magic_t;
25
26typedef enum
27{
28 DRM_VBLANK_ABSOLUTE = 0x00000000,
29 DRM_VBLANK_RELATIVE = 0x00000001,
30 DRM_VBLANK_EVENT = 0x04000000,
31 DRM_VBLANK_FLIP = 0x08000000,
32 DRM_VBLANK_NEXTONMISS = 0x10000000,
33 DRM_VBLANK_SECONDARY = 0x20000000,
34 DRM_VBLANK_SIGNAL = 0x40000000
35}
36drmVBlankSeqType;
37
38typedef struct _drmVBlankReq
39{
40 drmVBlankSeqType type;
41 unsigned int sequence;
42 unsigned long signal;
43} drmVBlankReq;
44
45typedef struct _drmVBlankReply
46{
47 drmVBlankSeqType type;
48 unsigned int sequence;
49 long tval_sec;
50 long tval_usec;
51} drmVBlankReply;
52
53typedef union _drmVBlank
54{
55 drmVBlankReq request;
56 drmVBlankReply reply;
57} drmVBlank;
58
59#define DRM_EVENT_CONTEXT_VERSION 2
60
61typedef struct _drmEventContext
62{
63 int version;
64 void (*vblank_handler)(int fd,
65 unsigned int sequence,
66 unsigned int tv_sec,
67 unsigned int tv_usec,
68 void *user_data);
69 void (*page_flip_handler)(int fd,
70 unsigned int sequence,
71 unsigned int tv_sec,
72 unsigned int tv_usec,
73 void *user_data);
74} drmEventContext;
75
76static int (*sym_drmClose)(int fd) = NULL;
77static int (*sym_drmGetMagic)(int fd,
78 drm_magic_t *magic) = NULL;
79static int (*sym_drmWaitVBlank)(int fd,
80 drmVBlank *vbl) = NULL;
81static int (*sym_drmHandleEvent)(int fd,
82 drmEventContext *evctx) = NULL;
83
84//// dri
85
86static Bool (*sym_DRI2QueryExtension)(Display *display,
87 int *eventBase,
88 int *errorBase) = NULL;
89static Bool (*sym_DRI2QueryVersion)(Display *display,
90 int *major,
91 int *minor) = NULL;
92static Bool (*sym_DRI2Connect)(Display *display,
93 XID window,
94 char **driverName,
95 char **deviceName) = NULL;
96static Bool (*sym_DRI2Authenticate)(Display *display,
97 XID window,
98 drm_magic_t magic) = NULL;
99
100//// dri/drm data needed
101static int dri2_event = 0;
102static int dri2_error = 0;
103static int dri2_major = 0;
104static int dri2_minor = 0;
105static char *device_name = 0;
106static char *driver_name = 0;
107static drm_magic_t drm_magic;
108
109static int drm_fd = -1;
110static int drm_event_is_busy = 0;
111static int drm_animators_interval = 1;
112static drmEventContext drm_evctx;
113static Ecore_Fd_Handler *dri_drm_fdh = NULL;
114
115static void *dri_lib = NULL;
116static void *drm_lib = NULL;
117
118static Window dri_drm_vsync_root = 0;
119
120static void
121_dri_drm_tick_schedule(void)
122{
123 drmVBlank vbl;
124
125 vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
126 vbl.request.sequence = drm_animators_interval;
127 vbl.request.signal = 0;
128 sym_drmWaitVBlank(drm_fd, &vbl);
129}
130
131static void
132_dri_drm_tick_begin(void *data __UNUSED__)
133{
134 drm_event_is_busy = 1;
135 _dri_drm_tick_schedule();
136}
137
138static void
139_dri_drm_tick_end(void *data __UNUSED__)
140{
141 drm_event_is_busy = 0;
142}
143
144static void
145_dri_drm_vblank_handler(int fd __UNUSED__,
146 unsigned int frame __UNUSED__,
147 unsigned int sec __UNUSED__,
148 unsigned int usec __UNUSED__,
149 void *data __UNUSED__)
150{
151 ecore_animator_custom_tick();
152 if (drm_event_is_busy) _dri_drm_tick_schedule();
153}
154
155static Eina_Bool
156_dri_drm_cb(void *data __UNUSED__,
157 Ecore_Fd_Handler *fd_handler __UNUSED__)
158{
159 sym_drmHandleEvent(drm_fd, &drm_evctx);
160 return ECORE_CALLBACK_RENEW;
161}
162
163// yes. most evil. we dlopen libdrm and libGL etc. to manually find smbols
164// so we can be as compatible as possible given the whole mess of the
165// gl/dri/drm etc. world. and handle graceful failure at runtime not
166// compile time
167static int
168_dri_drm_link(void)
169{
170 const char *drm_libs[] =
171 {
172 "libdrm.so.2",
173 "libdrm.so.1",
174 "libdrm.so.0",
175 "libdrm.so",
176 NULL,
177 };
178 const char *dri_libs[] =
179 {
180 "libdri2.so.2",
181 "libdri2.so.1",
182 "libdri2.so.0",
183 "libdri2.so",
184 "libGL.so.4",
185 "libGL.so.3",
186 "libGL.so.2",
187 "libGL.so.1",
188 "libGL.so.0",
189 "libGL.so",
190 NULL,
191 };
192 int i, fail;
193#define SYM(lib, xx) \
194 do { \
195 sym_ ## xx = dlsym(lib, #xx); \
196 if (!(sym_ ## xx)) { \
197 fprintf(stderr, "%s\n", dlerror()); \
198 fail = 1; \
199 } \
200 } while (0)
201
202 if (dri_lib) return 1;
203 for (i = 0; drm_libs[i]; i++)
204 {
205 drm_lib = dlopen(drm_libs[i], RTLD_LOCAL | RTLD_LAZY);
206 if (drm_lib)
207 {
208 fail = 0;
209 SYM(drm_lib, drmClose);
210 SYM(drm_lib, drmWaitVBlank);
211 SYM(drm_lib, drmHandleEvent);
212 if (fail)
213 {
214 dlclose(drm_lib);
215 drm_lib = NULL;
216 }
217 else break;
218 }
219 }
220 if (!drm_lib) return 0;
221 for (i = 0; dri_libs[i]; i++)
222 {
223 dri_lib = dlopen(dri_libs[i], RTLD_LOCAL | RTLD_LAZY);
224 if (dri_lib)
225 {
226 fail = 0;
227 SYM(dri_lib, DRI2QueryExtension);
228 SYM(dri_lib, DRI2QueryVersion);
229 SYM(dri_lib, DRI2Connect);
230 SYM(dri_lib, DRI2Authenticate);
231 if (fail)
232 {
233 dlclose(dri_lib);
234 dri_lib = NULL;
235 }
236 else break;
237 }
238 }
239 if (!dri_lib)
240 {
241 dlclose(drm_lib);
242 drm_lib = NULL;
243 return 0;
244 }
245 return 1;
246}
247
248static int
249_dri_drm_init(void)
250{
251 if (!sym_DRI2QueryExtension(_ecore_x_disp, &dri2_event, &dri2_error))
252 return 0;
253 if (!sym_DRI2QueryVersion(_ecore_x_disp, &dri2_major, &dri2_minor))
254 return 0;
255 if (dri2_major < 2)
256 return 0;
257 if (!sym_DRI2Connect(_ecore_x_disp, dri_drm_vsync_root, &driver_name, &device_name))
258 return 0;
259 drm_fd = open(device_name, O_RDWR);
260 if (drm_fd < 0)
261 return 0;
262 sym_drmGetMagic(drm_fd, &drm_magic);
263 if (!sym_DRI2Authenticate(_ecore_x_disp, dri_drm_vsync_root, drm_magic))
264 {
265 close(drm_fd);
266 drm_fd = -1;
267 return 0;
268 }
269 memset(&drm_evctx, 0, sizeof(drm_evctx));
270 drm_evctx.version = DRM_EVENT_CONTEXT_VERSION;
271 drm_evctx.vblank_handler = _dri_drm_vblank_handler;
272 drm_evctx.page_flip_handler = NULL;
273
274 dri_drm_fdh = ecore_main_fd_handler_add(drm_fd, ECORE_FD_READ,
275 _dri_drm_cb, NULL, NULL, NULL);
276 if (!dri_drm_fdh)
277 {
278 close(drm_fd);
279 drm_fd = -1;
280 return 0;
281 }
282 return 1;
283}
284
285static void
286_dri_drm_shutdown(void)
287{
288 if (drm_fd >= 0)
289 {
290 close(drm_fd);
291 drm_fd = -1;
292 }
293 if (dri_drm_fdh)
294 {
295 ecore_main_fd_handler_del(dri_drm_fdh);
296 dri_drm_fdh = NULL;
297 }
298}
299
300#endif
301
302EAPI Eina_Bool
303ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win)
304{
305#ifdef ECORE_X_VSYNC_DRI2
306 Ecore_X_Window root;
307
308 root = ecore_x_window_root_get(win);
309 if (root != dri_drm_vsync_root)
310 {
311 dri_drm_vsync_root = root;
312 if (dri_drm_vsync_root)
313 {
314 if (!_dri_drm_link())
315 {
316 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
317 return EINA_FALSE;
318 }
319 _dri_drm_shutdown();
320 if (!_dri_drm_init())
321 {
322 dri_drm_vsync_root = 0;
323 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
324 return EINA_FALSE;
325 }
326 ecore_animator_custom_source_tick_begin_callback_set
327 (_dri_drm_tick_begin, NULL);
328 ecore_animator_custom_source_tick_end_callback_set
329 (_dri_drm_tick_end, NULL);
330 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
331 }
332 else
333 {
334 if (drm_fd >= 0)
335 {
336 _dri_drm_shutdown();
337 ecore_animator_custom_source_tick_begin_callback_set
338 (NULL, NULL);
339 ecore_animator_custom_source_tick_end_callback_set
340 (NULL, NULL);
341 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
342 }
343 }
344 }
345 return EINA_TRUE;
346#else
347 return EINA_FALSE;
348 win = 0;
349#endif
350}
351
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
deleted file mode 100644
index 90392bf..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
+++ /dev/null
@@ -1,1723 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <sys/types.h>
7#include <unistd.h>
8
9#include "Ecore.h"
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12#include "Ecore_X_Atoms.h"
13
14static int ignore_num = 0;
15static Ecore_X_Window *ignore_list = NULL;
16
17/**
18 * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions
19 *
20 * Functions that can be used to create an X window.
21 */
22
23/**
24 * Creates a new window.
25 * @param parent The parent window to use. If @p parent is @c 0, the root
26 * window of the default display is used.
27 * @param x X position.
28 * @param y Y position.
29 * @param w Width.
30 * @param h Height.
31 * @return The new window handle.
32 * @ingroup Ecore_X_Window_Create_Group
33 */
34EAPI Ecore_X_Window
35ecore_x_window_new(Ecore_X_Window parent,
36 int x,
37 int y,
38 int w,
39 int h)
40{
41 Window win;
42 XSetWindowAttributes attr;
43
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45 if (parent == 0)
46 parent = DefaultRootWindow(_ecore_x_disp);
47
48 attr.backing_store = NotUseful;
49 attr.override_redirect = False;
50 attr.border_pixel = 0;
51 attr.background_pixmap = None;
52 attr.bit_gravity = NorthWestGravity;
53 attr.win_gravity = NorthWestGravity;
54 attr.save_under = False;
55 attr.do_not_propagate_mask = NoEventMask;
56 attr.event_mask = KeyPressMask |
57 KeyReleaseMask |
58 ButtonPressMask |
59 ButtonReleaseMask |
60 EnterWindowMask |
61 LeaveWindowMask |
62 PointerMotionMask |
63 ExposureMask |
64 VisibilityChangeMask |
65 StructureNotifyMask |
66 FocusChangeMask |
67 PropertyChangeMask |
68 ColormapChangeMask;
69 win = XCreateWindow(_ecore_x_disp, parent,
70 x, y, w, h, 0,
71 CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
72 InputOutput,
73 CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
74 CWBackingStore |
75 CWOverrideRedirect |
76/* CWColormap | */
77 CWBorderPixel |
78 CWBackPixmap |
79 CWSaveUnder |
80 CWDontPropagate |
81 CWEventMask |
82 CWBitGravity |
83 CWWinGravity,
84 &attr);
85
86 if (parent == DefaultRootWindow(_ecore_x_disp))
87 ecore_x_window_defaults_set(win);
88
89 return win;
90}
91
92/**
93 * Creates a window with the override redirect attribute set to @c True.
94 * @param parent The parent window to use. If @p parent is @c 0, the root
95 * window of the default display is used.
96 * @param x X position.
97 * @param y Y position.
98 * @param w Width.
99 * @param h Height.
100 * @return The new window handle.
101 * @ingroup Ecore_X_Window_Create_Group
102 */
103EAPI Ecore_X_Window
104ecore_x_window_override_new(Ecore_X_Window parent,
105 int x,
106 int y,
107 int w,
108 int h)
109{
110 Window win;
111 XSetWindowAttributes attr;
112
113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
114 if (parent == 0)
115 parent = DefaultRootWindow(_ecore_x_disp);
116
117 attr.backing_store = NotUseful;
118 attr.override_redirect = True;
119 attr.border_pixel = 0;
120 attr.background_pixmap = None;
121 attr.bit_gravity = NorthWestGravity;
122 attr.win_gravity = NorthWestGravity;
123 attr.save_under = False;
124 attr.do_not_propagate_mask = NoEventMask;
125 attr.event_mask = KeyPressMask |
126 KeyReleaseMask |
127 ButtonPressMask |
128 ButtonReleaseMask |
129 EnterWindowMask |
130 LeaveWindowMask |
131 PointerMotionMask |
132 ExposureMask |
133 VisibilityChangeMask |
134 StructureNotifyMask |
135 FocusChangeMask |
136 PropertyChangeMask |
137 ColormapChangeMask;
138 win = XCreateWindow(_ecore_x_disp, parent,
139 x, y, w, h, 0,
140 CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
141 InputOutput,
142 CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
143 CWBackingStore |
144 CWOverrideRedirect |
145/* CWColormap | */
146 CWBorderPixel |
147 CWBackPixmap |
148 CWSaveUnder |
149 CWDontPropagate |
150 CWEventMask |
151 CWBitGravity |
152 CWWinGravity,
153 &attr);
154 return win;
155}
156
157/**
158 * Creates a new input window.
159 * @param parent The parent window to use. If @p parent is @c 0, the root
160 * window of the default display is used.
161 * @param x X position.
162 * @param y Y position.
163 * @param w Width.
164 * @param h Height.
165 * @return The new window.
166 * @ingroup Ecore_X_Window_Create_Group
167 */
168EAPI Ecore_X_Window
169ecore_x_window_input_new(Ecore_X_Window parent,
170 int x,
171 int y,
172 int w,
173 int h)
174{
175 Window win;
176 XSetWindowAttributes attr;
177
178 LOGFN(__FILE__, __LINE__, __FUNCTION__);
179 if (parent == 0)
180 parent = DefaultRootWindow(_ecore_x_disp);
181
182 attr.override_redirect = True;
183 attr.do_not_propagate_mask = NoEventMask;
184 attr.event_mask = KeyPressMask |
185 KeyReleaseMask |
186 ButtonPressMask |
187 ButtonReleaseMask |
188 EnterWindowMask |
189 LeaveWindowMask |
190 PointerMotionMask |
191 ExposureMask |
192 VisibilityChangeMask |
193 StructureNotifyMask |
194 FocusChangeMask |
195 PropertyChangeMask |
196 ColormapChangeMask;
197 win = XCreateWindow(_ecore_x_disp, parent,
198 x, y, w, h, 0,
199 CopyFromParent,
200 InputOnly,
201 CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
202 CWOverrideRedirect |
203 CWDontPropagate |
204 CWEventMask,
205 &attr);
206
207 if (parent == DefaultRootWindow(_ecore_x_disp))
208 {
209 }
210
211 return win;
212}
213
214/**
215 * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions
216 *
217 * Functions that set window properties.
218 */
219
220/**
221 * Sets the default properties for the given window.
222 *
223 * The default properties set for the window are @c WM_CLIENT_MACHINE and
224 * @c _NET_WM_PID.
225 *
226 * @param win The given window.
227 * @ingroup Ecore_X_Window_Properties_Group
228 */
229EAPI void
230ecore_x_window_defaults_set(Ecore_X_Window win)
231{
232 long pid;
233 char buf[MAXHOSTNAMELEN];
234 char *hostname[1];
235 int argc;
236 char **argv;
237 XTextProperty xprop;
238
239 LOGFN(__FILE__, __LINE__, __FUNCTION__);
240 /*
241 * Set WM_CLIENT_MACHINE.
242 */
243 gethostname(buf, MAXHOSTNAMELEN);
244 buf[MAXHOSTNAMELEN - 1] = '\0';
245 hostname[0] = buf;
246 /* The ecore function uses UTF8 which Xlib may not like (especially
247 * with older clients) */
248 /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE,
249 (char *)buf); */
250 if (XStringListToTextProperty(hostname, 1, &xprop))
251 {
252 XSetWMClientMachine(_ecore_x_disp, win, &xprop);
253 XFree(xprop.value);
254 }
255
256 /*
257 * Set _NET_WM_PID
258 */
259 pid = getpid();
260 ecore_x_netwm_pid_set(win, pid);
261
262 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
263
264 ecore_app_args_get(&argc, &argv);
265 ecore_x_icccm_command_set(win, argc, argv);
266}
267
268EAPI void
269ecore_x_window_configure(Ecore_X_Window win,
270 Ecore_X_Window_Configure_Mask mask,
271 int x,
272 int y,
273 int w,
274 int h,
275 int border_width,
276 Ecore_X_Window sibling,
277 int stack_mode)
278{
279 XWindowChanges xwc;
280
281 if (!win)
282 return;
283
284 LOGFN(__FILE__, __LINE__, __FUNCTION__);
285
286 xwc.x = x;
287 xwc.y = y;
288 xwc.width = w;
289 xwc.height = h;
290 xwc.border_width = border_width;
291 xwc.sibling = sibling;
292 xwc.stack_mode = stack_mode;
293
294 XConfigureWindow(_ecore_x_disp, win, mask, &xwc);
295}
296
297/**
298 * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
299 *
300 * Functions to destroy X windows.
301 */
302
303/**
304 * Deletes the given window.
305 * @param win The given window.
306 * @ingroup Ecore_X_Window_Destroy_Group
307 */
308EAPI void
309ecore_x_window_free(Ecore_X_Window win)
310{
311 /* sorry sir, deleting the root window doesn't sound like
312 * a smart idea.
313 */
314 LOGFN(__FILE__, __LINE__, __FUNCTION__);
315 if (win)
316 XDestroyWindow(_ecore_x_disp, win);
317}
318
319/**
320 * Set if a window should be ignored.
321 * @param win The given window.
322 * @param ignore if to ignore
323 */
324EAPI void
325ecore_x_window_ignore_set(Ecore_X_Window win,
326 int ignore)
327{
328 int i, j, cnt;
329 Ecore_X_Window *t;
330
331 LOGFN(__FILE__, __LINE__, __FUNCTION__);
332 if (ignore)
333 {
334 if (ignore_list)
335 {
336 for (i = 0; i < ignore_num; i++)
337 {
338 if (win == ignore_list[i])
339 return;
340 }
341 t = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
342 if (!t) return;
343 ignore_list = t;
344 ignore_list[ignore_num++] = win;
345 }
346 else
347 {
348 ignore_num = 0;
349 ignore_list = malloc(sizeof(Ecore_X_Window));
350 if (ignore_list)
351 ignore_list[ignore_num++] = win;
352 }
353 }
354 else
355 {
356 if (!ignore_list)
357 return;
358
359 for (cnt = ignore_num, i = 0, j = 0; i < cnt; i++)
360 {
361 if (win != ignore_list[i])
362 ignore_list[j++] = ignore_list[i];
363 else
364 ignore_num--;
365 }
366
367 if (ignore_num <= 0)
368 {
369 free(ignore_list);
370 ignore_list = NULL;
371 return;
372 }
373 t = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
374 if (t) ignore_list = t;
375 }
376}
377
378/**
379 * Get the ignore list
380 * @param num number of windows in the list
381 * @return list of windows to ignore
382 */
383EAPI Ecore_X_Window *
384ecore_x_window_ignore_list(int *num)
385{
386 if (num)
387 *num = ignore_num;
388
389 return ignore_list;
390}
391
392/**
393 * Sends a delete request to the given window.
394 * @param win The given window.
395 * @ingroup Ecore_X_Window_Destroy_Group
396 */
397EAPI void
398ecore_x_window_delete_request_send(Ecore_X_Window win)
399{
400 XEvent xev;
401
402 /* sorry sir, deleting the root window doesn't sound like
403 * a smart idea.
404 */
405 if (!win)
406 return;
407
408 LOGFN(__FILE__, __LINE__, __FUNCTION__);
409 xev.xclient.type = ClientMessage;
410 xev.xclient.display = _ecore_x_disp;
411 xev.xclient.window = win;
412 xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
413 xev.xclient.format = 32;
414 xev.xclient.data.l[0] = ECORE_X_ATOM_WM_DELETE_WINDOW;
415 xev.xclient.data.l[1] = CurrentTime;
416
417 XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
418}
419
420/**
421 * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
422 *
423 * Functions to access and change the visibility of X windows.
424 */
425
426/**
427 * Shows a window.
428 *
429 * Synonymous to "mapping" a window in X Window System terminology.
430 *
431 * @param win The window to show.
432 * @ingroup Ecore_X_Window_Visibility
433 */
434EAPI void
435ecore_x_window_show(Ecore_X_Window win)
436{
437 LOGFN(__FILE__, __LINE__, __FUNCTION__);
438 XMapWindow(_ecore_x_disp, win);
439}
440
441/**
442 * Hides a window.
443 *
444 * Synonymous to "unmapping" a window in X Window System terminology.
445 *
446 * @param win The window to hide.
447 * @ingroup Ecore_X_Window_Visibility
448 */
449EAPI void
450ecore_x_window_hide(Ecore_X_Window win)
451{
452 XEvent xev;
453 Window root;
454 int idum;
455 unsigned int uidum;
456
457 /* ICCCM: SEND unmap event... */
458 LOGFN(__FILE__, __LINE__, __FUNCTION__);
459 root = win;
460 if (ScreenCount(_ecore_x_disp) == 1)
461 root = DefaultRootWindow(_ecore_x_disp);
462 else
463 XGetGeometry(_ecore_x_disp,
464 win,
465 &root,
466 &idum,
467 &idum,
468 &uidum,
469 &uidum,
470 &uidum,
471 &uidum);
472
473 xev.xunmap.type = UnmapNotify;
474 xev.xunmap.serial = 0;
475 xev.xunmap.send_event = True;
476 xev.xunmap.display = _ecore_x_disp;
477 xev.xunmap.event = root;
478 xev.xunmap.window = win;
479 xev.xunmap.from_configure = False;
480 XSendEvent(_ecore_x_disp, xev.xunmap.event, False,
481 SubstructureRedirectMask | SubstructureNotifyMask, &xev);
482 XUnmapWindow(_ecore_x_disp, win);
483}
484
485/**
486 * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
487 *
488 * Functions that change or retrieve the geometry of X windows.
489 */
490
491/**
492 * Moves a window to the position @p x, @p y.
493 *
494 * The position is relative to the upper left hand corner of the
495 * parent window.
496 *
497 * @param win The window to move.
498 * @param x X position.
499 * @param y Y position.
500 * @ingroup Ecore_X_Window_Geometry_Group
501 */
502EAPI void
503ecore_x_window_move(Ecore_X_Window win,
504 int x,
505 int y)
506{
507 LOGFN(__FILE__, __LINE__, __FUNCTION__);
508 XMoveWindow(_ecore_x_disp, win, x, y);
509}
510
511/**
512 * Resizes a window.
513 * @param win The window to resize.
514 * @param w New width of the window.
515 * @param h New height of the window.
516 * @ingroup Ecore_X_Window_Geometry_Group
517 */
518EAPI void
519ecore_x_window_resize(Ecore_X_Window win,
520 int w,
521 int h)
522{
523 LOGFN(__FILE__, __LINE__, __FUNCTION__);
524 if (w < 1)
525 w = 1;
526
527 if (h < 1)
528 h = 1;
529
530 XResizeWindow(_ecore_x_disp, win, w, h);
531}
532
533/**
534 * Moves and resizes a window.
535 * @param win The window to move and resize.
536 * @param x New X position of the window.
537 * @param y New Y position of the window.
538 * @param w New width of the window.
539 * @param h New height of the window.
540 * @ingroup Ecore_X_Window_Geometry_Group
541 */
542EAPI void
543ecore_x_window_move_resize(Ecore_X_Window win,
544 int x,
545 int y,
546 int w,
547 int h)
548{
549 LOGFN(__FILE__, __LINE__, __FUNCTION__);
550 if (w < 1)
551 w = 1;
552
553 if (h < 1)
554 h = 1;
555
556 XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h);
557}
558
559/**
560 * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions
561 *
562 * Functions that give the focus to an X Window.
563 */
564
565/**
566 * Sets the focus to the window @p win.
567 * @param win The window to focus.
568 * @ingroup Ecore_X_Window_Focus_Functions
569 */
570EAPI void
571ecore_x_window_focus(Ecore_X_Window win)
572{
573 LOGFN(__FILE__, __LINE__, __FUNCTION__);
574 if (win == 0)
575 win = DefaultRootWindow(_ecore_x_disp); // XSetInputFocus(_ecore_x_disp, win, RevertToNone, CurrentTime);
576
577// XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime);
578 XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime);
579}
580
581/**
582 * Sets the focus to the given window at a specific time.
583 * @param win The window to focus.
584 * @param t When to set the focus to the window.
585 * @ingroup Ecore_X_Window_Focus_Functions
586 */
587EAPI void
588ecore_x_window_focus_at_time(Ecore_X_Window win,
589 Ecore_X_Time t)
590{
591 LOGFN(__FILE__, __LINE__, __FUNCTION__);
592 if (win == 0)
593 win = DefaultRootWindow(_ecore_x_disp); // XSetInputFocus(_ecore_x_disp, win, RevertToNone, t);
594
595// XSetInputFocus(_ecore_x_disp, win, PointerRoot, t);
596 XSetInputFocus(_ecore_x_disp, win, RevertToParent, t);
597}
598
599/**
600 * gets the window that has focus.
601 * @return The window that has focus.
602 * @ingroup Ecore_X_Window_Focus_Functions
603 */
604EAPI Ecore_X_Window
605ecore_x_window_focus_get(void)
606{
607 Window win;
608 int revert_mode;
609
610 LOGFN(__FILE__, __LINE__, __FUNCTION__);
611 win = 0;
612 XGetInputFocus(_ecore_x_disp, &win, &revert_mode);
613 return win;
614}
615
616/**
617 * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions
618 *
619 * Functions that change the Z order of X windows.
620 */
621
622/**
623 * Raises the given window.
624 * @param win The window to raise.
625 * @ingroup Ecore_X_Window_Z_Order_Group
626 */
627EAPI void
628ecore_x_window_raise(Ecore_X_Window win)
629{
630 LOGFN(__FILE__, __LINE__, __FUNCTION__);
631 XRaiseWindow(_ecore_x_disp, win);
632}
633
634/**
635 * Lowers the given window.
636 * @param win The window to lower.
637 * @ingroup Ecore_X_Window_Z_Order_Group
638 */
639EAPI void
640ecore_x_window_lower(Ecore_X_Window win)
641{
642 LOGFN(__FILE__, __LINE__, __FUNCTION__);
643 XLowerWindow(_ecore_x_disp, win);
644}
645
646/**
647 * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions
648 *
649 * Functions that retrieve or changes the parent window of a window.
650 */
651
652/**
653 * Moves a window to within another window at a given position.
654 * @param win The window to reparent.
655 * @param new_parent The new parent window.
656 * @param x X position within new parent window.
657 * @param y Y position within new parent window.
658 * @ingroup Ecore_X_Window_Parent_Group
659 */
660EAPI void
661ecore_x_window_reparent(Ecore_X_Window win,
662 Ecore_X_Window new_parent,
663 int x,
664 int y)
665{
666 LOGFN(__FILE__, __LINE__, __FUNCTION__);
667 if (new_parent == 0)
668 new_parent = DefaultRootWindow(_ecore_x_disp);
669
670 XReparentWindow(_ecore_x_disp, win, new_parent, x, y);
671}
672
673/**
674 * Retrieves the size of the given window.
675 * @param win The given window.
676 * @param w Pointer to an integer into which the width is to be stored.
677 * @param h Pointer to an integer into which the height is to be stored.
678 * @ingroup Ecore_X_Window_Geometry_Group
679 */
680EAPI void
681ecore_x_window_size_get(Ecore_X_Window win,
682 int *w,
683 int *h)
684{
685 int dummy_x, dummy_y;
686
687 LOGFN(__FILE__, __LINE__, __FUNCTION__);
688 if (win == 0)
689 win = DefaultRootWindow(_ecore_x_disp);
690
691 ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h);
692}
693
694/**
695 * Retrieves the geometry of the given window.
696 *
697 * Note that the x & y coordingates are relative to your parent. In
698 * particular for reparenting window managers - relative to you window border.
699 * If you want screen coordinates either walk the window tree to the root,
700 * else for ecore_evas applications see ecore_evas_geometry_get(). Elementary
701 * applications can use elm_win_screen_position_get().
702 *
703 * @param win The given window.
704 * @param x Pointer to an integer in which the X position is to be stored.
705 * @param y Pointer to an integer in which the Y position is to be stored.
706 * @param w Pointer to an integer in which the width is to be stored.
707 * @param h Pointer to an integer in which the height is to be stored.
708 * @ingroup Ecore_X_Window_Geometry_Group
709 */
710EAPI void
711ecore_x_window_geometry_get(Ecore_X_Window win,
712 int *x,
713 int *y,
714 int *w,
715 int *h)
716{
717 LOGFN(__FILE__, __LINE__, __FUNCTION__);
718 if (!win)
719 win = DefaultRootWindow(_ecore_x_disp);
720
721 ecore_x_drawable_geometry_get(win, x, y, w, h);
722}
723
724/**
725 * Retrieves the width of the border of the given window.
726 * @param win The given window.
727 * @return Width of the border of @p win.
728 * @ingroup Ecore_X_Window_Geometry_Group
729 */
730EAPI int
731ecore_x_window_border_width_get(Ecore_X_Window win)
732{
733 LOGFN(__FILE__, __LINE__, __FUNCTION__);
734 /* doesn't make sense to call this on a root window */
735 if (!win)
736 return 0;
737
738 return ecore_x_drawable_border_width_get(win);
739}
740
741/**
742 * Sets the width of the border of the given window.
743 * @param win The given window.
744 * @param width The new border width.
745 * @ingroup Ecore_X_Window_Geometry_Group
746 */
747EAPI void
748ecore_x_window_border_width_set(Ecore_X_Window win,
749 int width)
750{
751 LOGFN(__FILE__, __LINE__, __FUNCTION__);
752 /* doesn't make sense to call this on a root window */
753 if (!win)
754 return;
755
756 XSetWindowBorderWidth (_ecore_x_disp, win, width);
757}
758
759/**
760 * Retrieves the depth of the given window.
761 * @param win The given window.
762 * @return Depth of the window.
763 */
764EAPI int
765ecore_x_window_depth_get(Ecore_X_Window win)
766{
767 LOGFN(__FILE__, __LINE__, __FUNCTION__);
768 return ecore_x_drawable_depth_get(win);
769}
770
771/**
772 * To be documented.
773 *
774 * FIXME: To be fixed.
775 */
776EAPI void
777ecore_x_window_cursor_show(Ecore_X_Window win,
778 Eina_Bool show)
779{
780 LOGFN(__FILE__, __LINE__, __FUNCTION__);
781 if (win == 0)
782 win = DefaultRootWindow(_ecore_x_disp);
783
784 if (!show)
785 {
786 Cursor c;
787 XColor cl;
788 Pixmap p, m;
789 GC gc;
790 XGCValues gcv;
791
792 p = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1);
793 m = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1);
794 gc = XCreateGC(_ecore_x_disp, m, 0, &gcv);
795 XSetForeground(_ecore_x_disp, gc, 0);
796 XDrawPoint(_ecore_x_disp, m, gc, 0, 0);
797 XFreeGC(_ecore_x_disp, gc);
798 c = XCreatePixmapCursor(_ecore_x_disp, p, m, &cl, &cl, 0, 0);
799 XDefineCursor(_ecore_x_disp, win, c);
800 XFreeCursor(_ecore_x_disp, c);
801 XFreePixmap(_ecore_x_disp, p);
802 XFreePixmap(_ecore_x_disp, m);
803 }
804 else
805 XDefineCursor(_ecore_x_disp, win, 0);
806}
807
808EAPI void
809ecore_x_window_cursor_set(Ecore_X_Window win,
810 Ecore_X_Cursor c)
811{
812 LOGFN(__FILE__, __LINE__, __FUNCTION__);
813 if (c == 0)
814 XUndefineCursor(_ecore_x_disp, win);
815 else
816 XDefineCursor(_ecore_x_disp, win, c);
817}
818
819/**
820 * Finds out whether the given window is currently visible.
821 * @param win The given window.
822 * @return 1 if the window is visible, otherwise 0.
823 * @ingroup Ecore_X_Window_Visibility_Group
824 */
825EAPI int
826ecore_x_window_visible_get(Ecore_X_Window win)
827{
828 XWindowAttributes attr;
829
830 LOGFN(__FILE__, __LINE__, __FUNCTION__);
831 return XGetWindowAttributes(_ecore_x_disp, win, &attr) &&
832 (attr.map_state == IsViewable);
833}
834
835typedef struct _Shadow Shadow;
836struct _Shadow
837{
838 Shadow *parent;
839 Shadow **children;
840 Window win;
841 int children_num;
842 short x, y;
843 unsigned short w, h;
844};
845
846static Shadow **shadow_base = NULL;
847static int shadow_num = 0;
848
849static Shadow *
850_ecore_x_window_tree_walk(Window win)
851{
852 Window *list = NULL;
853 Window parent_win = 0, root_win = 0;
854 unsigned int num;
855 Shadow *s, **sl;
856 XWindowAttributes att;
857
858 if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
859 return NULL; // if (att.class == InputOnly) return NULL;
860
861 if (att.map_state != IsViewable)
862 return NULL;
863
864 s = calloc(1, sizeof(Shadow));
865 if (!s)
866 return NULL;
867
868 s->win = win;
869 s->x = att.x;
870 s->y = att.y;
871 s->w = att.width;
872 s->h = att.height;
873 if (XQueryTree(_ecore_x_disp, s->win, &root_win, &parent_win,
874 &list, &num))
875 {
876 s->children = calloc(1, sizeof(Shadow *) * num);
877 if (s->children)
878 {
879 size_t i, j;
880 s->children_num = num;
881 for (i = 0; i < num; i++)
882 {
883 s->children[i] = _ecore_x_window_tree_walk(list[i]);
884 if (s->children[i])
885 s->children[i]->parent = s;
886 }
887 /* compress list down */
888 j = 0;
889 for (i = 0; i < num; i++)
890 {
891 if (s->children[i])
892 {
893 s->children[j] = s->children[i];
894 j++;
895 }
896 }
897 if (j == 0)
898 {
899 free(s->children);
900 s->children = NULL;
901 s->children_num = 0;
902 }
903 else
904 {
905 s->children_num = j;
906 sl = realloc(s->children, sizeof(Shadow *) * j);
907 if (sl)
908 s->children = sl;
909 }
910 }
911 }
912
913 if (list)
914 XFree(list);
915
916 return s;
917}
918
919static void
920_ecore_x_window_tree_shadow_free1(Shadow *s)
921{
922 int i;
923
924 if (!s)
925 return;
926
927 if (s->children)
928 {
929 for (i = 0; i < s->children_num; i++)
930 {
931 if (s->children[i])
932 _ecore_x_window_tree_shadow_free1(s->children[i]);
933 }
934 free(s->children);
935 }
936
937 free(s);
938}
939
940static void
941_ecore_x_window_tree_shadow_free(void)
942{
943 int i;
944
945 if (!shadow_base)
946 return;
947
948 for (i = 0; i < shadow_num; i++)
949 {
950 if (!shadow_base[i])
951 continue;
952
953 _ecore_x_window_tree_shadow_free1(shadow_base[i]);
954 }
955 free(shadow_base);
956 shadow_base = NULL;
957 shadow_num = 0;
958}
959
960static void
961_ecore_x_window_tree_shadow_populate(void)
962{
963 Ecore_X_Window *roots;
964 int i, num;
965
966 roots = ecore_x_window_root_list(&num);
967 if (roots)
968 {
969 shadow_base = calloc(1, sizeof(Shadow *) * num);
970 if (shadow_base)
971 {
972 shadow_num = num;
973 for (i = 0; i < num; i++)
974 shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
975 }
976
977 free(roots);
978 }
979}
980
981/*
982 static int shadow_count = 0;
983
984 static void
985 _ecore_x_window_tree_shadow_start(void)
986 {
987 shadow_count++;
988 if (shadow_count > 1) return;
989 _ecore_x_window_tree_shadow_populate();
990 }
991
992 static void
993 _ecore_x_window_tree_shadow_stop(void)
994 {
995 shadow_count--;
996 if (shadow_count != 0) return;
997 _ecore_x_window_tree_shadow_free();
998 }
999 */
1000
1001static Shadow *
1002_ecore_x_window_shadow_tree_find_shadow(Shadow *s,
1003 Window win)
1004{
1005 Shadow *ss;
1006 int i;
1007
1008 if (s->win == win)
1009 return s;
1010
1011 if (s->children)
1012 for (i = 0; i < s->children_num; i++)
1013 {
1014 if (!s->children[i])
1015 continue;
1016
1017 if ((ss =
1018 _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
1019 return ss;
1020 }
1021
1022 return NULL;
1023}
1024
1025static Shadow *
1026_ecore_x_window_shadow_tree_find(Window base)
1027{
1028 Shadow *s;
1029 int i;
1030
1031 for (i = 0; i < shadow_num; i++)
1032 {
1033 if (!shadow_base[i])
1034 continue;
1035
1036 if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
1037 return s;
1038 }
1039 return NULL;
1040}
1041
1042static int
1043_inside_rects(Shadow *s,
1044 int x,
1045 int y,
1046 int bx,
1047 int by,
1048 Ecore_X_Rectangle *rects,
1049 int num)
1050{
1051 int i, inside;
1052
1053 if (!rects) return 0;
1054 inside = 0;
1055 for (i = 0; i < num; i++)
1056 {
1057 if ((x >= s->x + bx + rects[i].x) &&
1058 (y >= s->y + by + rects[i].y) &&
1059 (x < (int)(s->x + bx + rects[i].x + rects[i].width)) &&
1060 (y < (int)(s->y + by + rects[i].y + rects[i].height)))
1061 {
1062 inside = 1;
1063 break;
1064 }
1065 }
1066 free(rects);
1067 return inside;
1068}
1069
1070static Window
1071_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s,
1072 int bx,
1073 int by,
1074 int x,
1075 int y,
1076 Ecore_X_Window *skip,
1077 int skip_num)
1078{
1079 Window child;
1080 int i, j;
1081 int wx, wy;
1082
1083 wx = s->x + bx;
1084 wy = s->y + by;
1085 if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h))))
1086 return 0;
1087
1088 /* FIXME: get shape */
1089 {
1090 int num;
1091 Ecore_X_Rectangle *rects;
1092
1093 num = 0;
1094 rects = ecore_x_window_shape_rectangles_get(s->win, &num);
1095 if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0;
1096 num = 0;
1097 rects = ecore_x_window_shape_input_rectangles_get(s->win, &num);
1098 if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0;
1099 }
1100
1101 if (s->children)
1102 {
1103 int skipit = 0;
1104
1105 for (i = s->children_num - 1; i >= 0; --i)
1106 {
1107 if (!s->children[i])
1108 continue;
1109
1110 skipit = 0;
1111 if (skip)
1112 for (j = 0; j < skip_num; j++)
1113 {
1114 if (s->children[i]->win == skip[j])
1115 {
1116 skipit = 1;
1117 goto onward;
1118 }
1119 }
1120
1121onward:
1122 if (!skipit)
1123 if ((child =
1124 _ecore_x_window_shadow_tree_at_xy_get_shadow(s->
1125 children[i
1126 ], wx, wy,
1127 x, y, skip,
1128 skip_num)))
1129 return child;
1130 }
1131 }
1132
1133 return s->win;
1134}
1135
1136static Window
1137_ecore_x_window_shadow_tree_at_xy_get(Window base,
1138 int bx,
1139 int by,
1140 int x,
1141 int y,
1142 Ecore_X_Window *skip,
1143 int skip_num)
1144{
1145 Shadow *s;
1146
1147 if (!shadow_base)
1148 {
1149 _ecore_x_window_tree_shadow_populate();
1150 if (!shadow_base)
1151 return 0;
1152 }
1153
1154 s = _ecore_x_window_shadow_tree_find(base);
1155 if (!s)
1156 return 0;
1157
1158 return _ecore_x_window_shadow_tree_at_xy_get_shadow(s,
1159 bx,
1160 by,
1161 x,
1162 y,
1163 skip,
1164 skip_num);
1165}
1166
1167/**
1168 * Retrieves the top, visible window at the given location,
1169 * but skips the windows in the list. This uses a shadow tree built from the
1170 * window tree that is only updated the first time
1171 * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time
1172 * it is called after a ecore_x_window_shadow_tree_flush()
1173 * @param base The base window to start searching from (normally root).
1174 * @param x The given X position.
1175 * @param y The given Y position.
1176 * @return The window at that position.
1177 * @ingroup Ecore_X_Window_Geometry_Group
1178 */
1179EAPI Ecore_X_Window
1180ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base,
1181 int x,
1182 int y,
1183 Ecore_X_Window *skip,
1184 int skip_num)
1185{
1186 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1187 return _ecore_x_window_shadow_tree_at_xy_get(base,
1188 0,
1189 0,
1190 x,
1191 y,
1192 skip,
1193 skip_num);
1194}
1195
1196/**
1197 * Retrieves the parent window a given window has. This uses the shadow window
1198 * tree.
1199 * @param root The root window of @p win - if 0, this will be automatically determined with extra processing overhead
1200 * @param win The window to get the parent window of
1201 * @return The parent window of @p win
1202 * @ingroup Ecore_X_Window_Geometry_Group
1203 */
1204EAPI Ecore_X_Window
1205ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__,
1206 Ecore_X_Window win)
1207{
1208 Shadow *s;
1209 int i;
1210
1211 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1212 if (!shadow_base)
1213 {
1214 _ecore_x_window_tree_shadow_populate();
1215 if (!shadow_base)
1216 return 0;
1217 }
1218
1219 for (i = 0; i < shadow_num; i++)
1220 {
1221 if (!shadow_base[i])
1222 continue;
1223
1224 s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
1225 if (s)
1226 {
1227 if (!s->parent)
1228 return 0;
1229
1230 return s->parent->win;
1231 }
1232 }
1233 return 0;
1234}
1235
1236/**
1237 * Flushes the window shadow tree so nothing is stored.
1238 * @ingroup Ecore_X_Window_Geometry_Group
1239 */
1240EAPI void
1241ecore_x_window_shadow_tree_flush(void)
1242{
1243 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1244 _ecore_x_window_tree_shadow_free();
1245}
1246
1247/**
1248 * Retrieves the root window a given window is on.
1249 * @param win The window to get the root window of
1250 * @return The root window of @p win
1251 * @ingroup Ecore_X_Window_Geometry_Group
1252 */
1253EAPI Ecore_X_Window
1254ecore_x_window_root_get(Ecore_X_Window win)
1255{
1256 XWindowAttributes att;
1257
1258 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1259 if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
1260 return 0;
1261
1262 return att.root;
1263}
1264
1265static Window
1266_ecore_x_window_at_xy_get(Window base,
1267 int bx,
1268 int by,
1269 int x,
1270 int y,
1271 Ecore_X_Window *skip,
1272 int skip_num)
1273{
1274 Window *list = NULL;
1275 Window parent_win = 0, child = 0, root_win = 0;
1276 int i, j, wx, wy, ww, wh;
1277 unsigned int num;
1278
1279 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1280 if (!ecore_x_window_visible_get(base))
1281 return 0;
1282
1283 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1284 ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh);
1285 wx += bx;
1286 wy += by;
1287
1288 if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh))))
1289 return 0;
1290
1291 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1292 if (!XQueryTree(_ecore_x_disp, base, &root_win, &parent_win, &list, &num))
1293 return base;
1294
1295 if (list)
1296 {
1297 int skipit = 0;
1298
1299 for (i = num - 1; i >= 0; --i)
1300 {
1301 skipit = 0;
1302
1303 if (skip)
1304 for (j = 0; j < skip_num; j++)
1305 {
1306 if (list[i] == skip[j])
1307 {
1308 skipit = 1;
1309 goto onward;
1310 }
1311 }
1312
1313onward:
1314 if (!skipit)
1315 if ((child =
1316 _ecore_x_window_at_xy_get(list[i], wx, wy, x, y, skip,
1317 skip_num)))
1318 {
1319 XFree(list);
1320 return child;
1321 }
1322 }
1323 XFree(list);
1324 }
1325
1326 return base;
1327}
1328
1329/**
1330 * Retrieves the top, visible window at the given location.
1331 * @param x The given X position.
1332 * @param y The given Y position.
1333 * @return The window at that position.
1334 * @ingroup Ecore_X_Window_Geometry_Group
1335 */
1336EAPI Ecore_X_Window
1337ecore_x_window_at_xy_get(int x,
1338 int y)
1339{
1340 Ecore_X_Window win, root;
1341
1342 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1343 /* FIXME: Proper function to determine current root/virtual root
1344 * window missing here */
1345 root = DefaultRootWindow(_ecore_x_disp);
1346
1347 ecore_x_grab();
1348 win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, NULL, 0);
1349 ecore_x_ungrab();
1350
1351 return win ? win : root;
1352}
1353
1354/**
1355 * Retrieves the top, visible window at the given location,
1356 * but skips the windows in the list.
1357 * @param x The given X position.
1358 * @param y The given Y position.
1359 * @return The window at that position.
1360 * @ingroup Ecore_X_Window_Geometry_Group
1361 */
1362EAPI Ecore_X_Window
1363ecore_x_window_at_xy_with_skip_get(int x,
1364 int y,
1365 Ecore_X_Window *skip,
1366 int skip_num)
1367{
1368 Ecore_X_Window win, root;
1369
1370 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1371 /* FIXME: Proper function to determine current root/virtual root
1372 * window missing here */
1373 root = DefaultRootWindow(_ecore_x_disp);
1374
1375 ecore_x_grab();
1376 win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, skip, skip_num);
1377 ecore_x_ungrab();
1378
1379 return win ? win : root;
1380}
1381
1382EAPI Ecore_X_Window
1383ecore_x_window_at_xy_begin_get(Ecore_X_Window begin,
1384 int x,
1385 int y)
1386{
1387 Ecore_X_Window win;
1388
1389 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1390 ecore_x_grab();
1391 win = _ecore_x_window_at_xy_get(begin, 0, 0, x, y, NULL, 0);
1392 ecore_x_ungrab();
1393
1394 return win ? win : begin;
1395}
1396
1397/**
1398 * Retrieves the parent window of the given window.
1399 * @param win The given window.
1400 * @return The parent window of @p win.
1401 * @ingroup Ecore_X_Window_Parent_Group
1402 */
1403EAPI Ecore_X_Window
1404ecore_x_window_parent_get(Ecore_X_Window win)
1405{
1406 Window root, parent, *children = NULL;
1407 unsigned int num;
1408
1409 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1410 if (!XQueryTree(_ecore_x_disp, win, &root, &parent, &children, &num))
1411 return 0;
1412
1413 if (children)
1414 XFree(children);
1415
1416 return parent;
1417}
1418
1419/**
1420 * Sets the background color of the given window.
1421 * @param win The given window
1422 * @param r red value (0...65536, 16 bits)
1423 * @param g green value (0...65536, 16 bits)
1424 * @param b blue value (0...65536, 16 bits)
1425 */
1426EAPI void
1427ecore_x_window_background_color_set(Ecore_X_Window win,
1428 unsigned short r,
1429 unsigned short g,
1430 unsigned short b)
1431{
1432 XSetWindowAttributes attr;
1433 Colormap map;
1434 XColor col;
1435
1436 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1437 col.red = r;
1438 col.green = g;
1439 col.blue = b;
1440
1441 map = DefaultColormap(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
1442 XAllocColor(_ecore_x_disp, map, &col);
1443
1444 attr.background_pixel = col.pixel;
1445 XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr);
1446}
1447
1448EAPI void
1449ecore_x_window_gravity_set(Ecore_X_Window win,
1450 Ecore_X_Gravity grav)
1451{
1452 XSetWindowAttributes att;
1453
1454 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1455 att.win_gravity = grav;
1456 XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att);
1457}
1458
1459EAPI void
1460ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
1461 Ecore_X_Gravity grav)
1462{
1463 XSetWindowAttributes att;
1464
1465 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1466 att.bit_gravity = grav;
1467 XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att);
1468}
1469
1470EAPI void
1471ecore_x_window_pixmap_set(Ecore_X_Window win,
1472 Ecore_X_Pixmap pmap)
1473{
1474 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1475 XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap);
1476}
1477
1478EAPI void
1479ecore_x_window_area_clear(Ecore_X_Window win,
1480 int x,
1481 int y,
1482 int w,
1483 int h)
1484{
1485 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1486 XClearArea(_ecore_x_disp, win, x, y, w, h, False);
1487}
1488
1489EAPI void
1490ecore_x_window_area_expose(Ecore_X_Window win,
1491 int x,
1492 int y,
1493 int w,
1494 int h)
1495{
1496 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1497 XClearArea(_ecore_x_disp, win, x, y, w, h, True);
1498}
1499
1500EAPI void
1501ecore_x_window_override_set(Ecore_X_Window win,
1502 Eina_Bool override)
1503{
1504 XSetWindowAttributes att;
1505
1506 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1507 att.override_redirect = override;
1508 XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att);
1509}
1510
1511#ifdef ECORE_XRENDER
1512static Ecore_X_Window
1513_ecore_x_window_argb_internal_new(Ecore_X_Window parent,
1514 int x,
1515 int y,
1516 int w,
1517 int h,
1518 Eina_Bool override,
1519 Eina_Bool saveunder)
1520{
1521 Window win;
1522 XSetWindowAttributes attr;
1523 XWindowAttributes att;
1524 XVisualInfo *xvi;
1525 XVisualInfo vi_in;
1526 int nvi, i, scr = 0;
1527 XRenderPictFormat *fmt;
1528 Visual *vis;
1529
1530 if (parent == 0)
1531 {
1532 parent = DefaultRootWindow(_ecore_x_disp);
1533 scr = DefaultScreen(_ecore_x_disp);
1534 }
1535 else
1536 {
1537 /* ewww - round trip */
1538 XGetWindowAttributes(_ecore_x_disp, parent, &att);
1539 for (i = 0; i < ScreenCount(_ecore_x_disp); i++)
1540 {
1541 if (att.screen == ScreenOfDisplay(_ecore_x_disp, i))
1542 {
1543 scr = i;
1544 break;
1545 }
1546 }
1547 }
1548
1549 vi_in.screen = scr;
1550 vi_in.depth = 32;
1551 vi_in.class = TrueColor;
1552 xvi = XGetVisualInfo(_ecore_x_disp,
1553 VisualScreenMask |
1554 VisualDepthMask |
1555 VisualClassMask,
1556 &vi_in,
1557 &nvi);
1558 if (!xvi)
1559 return 0;
1560
1561 vis = NULL;
1562 for (i = 0; i < nvi; i++)
1563 {
1564 fmt = XRenderFindVisualFormat(_ecore_x_disp, xvi[i].visual);
1565 if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask))
1566 {
1567 vis = xvi[i].visual;
1568 break;
1569 }
1570 }
1571 XFree (xvi);
1572
1573 attr.backing_store = NotUseful;
1574 attr.override_redirect = override;
1575 attr.colormap = XCreateColormap(_ecore_x_disp, parent,
1576 vis, AllocNone);
1577 attr.border_pixel = 0;
1578 attr.background_pixmap = None;
1579 attr.bit_gravity = NorthWestGravity;
1580 attr.win_gravity = NorthWestGravity;
1581 attr.save_under = saveunder;
1582 attr.do_not_propagate_mask = NoEventMask;
1583 attr.event_mask = KeyPressMask |
1584 KeyReleaseMask |
1585 ButtonPressMask |
1586 ButtonReleaseMask |
1587 EnterWindowMask |
1588 LeaveWindowMask |
1589 PointerMotionMask |
1590 ExposureMask |
1591 VisibilityChangeMask |
1592 StructureNotifyMask |
1593 FocusChangeMask |
1594 PropertyChangeMask |
1595 ColormapChangeMask;
1596 win = XCreateWindow(_ecore_x_disp, parent,
1597 x, y, w, h, 0,
1598 32,
1599 InputOutput,
1600 vis,
1601 CWBackingStore |
1602 CWOverrideRedirect |
1603 CWColormap |
1604 CWBorderPixel |
1605 CWBackPixmap |
1606 CWSaveUnder |
1607 CWDontPropagate |
1608 CWEventMask |
1609 CWBitGravity |
1610 CWWinGravity,
1611 &attr);
1612 XFreeColormap(_ecore_x_disp, attr.colormap);
1613
1614 if (parent == DefaultRootWindow(_ecore_x_disp))
1615 ecore_x_window_defaults_set(win);
1616
1617 return win;
1618}
1619
1620#endif /* ifdef ECORE_XRENDER */
1621
1622EAPI int
1623ecore_x_window_argb_get(Ecore_X_Window win)
1624{
1625#ifdef ECORE_XRENDER
1626 XWindowAttributes att;
1627 XRenderPictFormat *fmt;
1628
1629 att.visual = 0;
1630 if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
1631 return 0;
1632
1633 fmt = XRenderFindVisualFormat(_ecore_x_disp, att.visual);
1634 if (!fmt)
1635 return 0;
1636
1637 if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask))
1638 return 1;
1639
1640 return 0;
1641#else /* ifdef ECORE_XRENDER */
1642 return 0;
1643#endif /* ifdef ECORE_XRENDER */
1644}
1645
1646/**
1647 * Creates a new window.
1648 * @param parent The parent window to use. If @p parent is @c 0, the root
1649 * window of the default display is used.
1650 * @param x X position.
1651 * @param y Y position.
1652 * @param w Width.
1653 * @param h Height.
1654 * @return The new window handle.
1655 * @ingroup Ecore_X_Window_Create_Group
1656 */
1657EAPI Ecore_X_Window
1658ecore_x_window_manager_argb_new(Ecore_X_Window parent,
1659 int x,
1660 int y,
1661 int w,
1662 int h)
1663{
1664#ifdef ECORE_XRENDER
1665 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1666 return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0);
1667#else /* ifdef ECORE_XRENDER */
1668 return 0;
1669#endif /* ifdef ECORE_XRENDER */
1670}
1671
1672/**
1673 * Creates a new window.
1674 * @param parent The parent window to use. If @p parent is @c 0, the root
1675 * window of the default display is used.
1676 * @param x X position.
1677 * @param y Y position.
1678 * @param w Width.
1679 * @param h Height.
1680 * @return The new window handle.
1681 * @ingroup Ecore_X_Window_Create_Group
1682 */
1683EAPI Ecore_X_Window
1684ecore_x_window_argb_new(Ecore_X_Window parent,
1685 int x,
1686 int y,
1687 int w,
1688 int h)
1689{
1690#ifdef ECORE_XRENDER
1691 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1692 return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 0, 0);
1693#else /* ifdef ECORE_XRENDER */
1694 return 0;
1695#endif /* ifdef ECORE_XRENDER */
1696}
1697
1698/**
1699 * Creates a window with the override redirect attribute set to @c True.
1700 * @param parent The parent window to use. If @p parent is @c 0, the root
1701 * window of the default display is used.
1702 * @param x X position.
1703 * @param y Y position.
1704 * @param w Width.
1705 * @param h Height.
1706 * @return The new window handle.
1707 * @ingroup Ecore_X_Window_Create_Group
1708 */
1709EAPI Ecore_X_Window
1710ecore_x_window_override_argb_new(Ecore_X_Window parent,
1711 int x,
1712 int y,
1713 int w,
1714 int h)
1715{
1716#ifdef ECORE_XRENDER
1717 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1718 return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0);
1719#else /* ifdef ECORE_XRENDER */
1720 return 0;
1721#endif /* ifdef ECORE_XRENDER */
1722}
1723
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
deleted file mode 100644
index b581a0e..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c
+++ /dev/null
@@ -1,752 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <string.h>
7
8#include "Ecore.h"
9#include "ecore_x_private.h"
10#include "Ecore_X.h"
11#include "Ecore_X_Atoms.h"
12#include <inttypes.h>
13#include <limits.h>
14
15#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \
16 XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
17 (unsigned char *)p_val, cnt)
18
19/*
20 * Set CARD32 (array) property
21 */
22EAPI void
23ecore_x_window_prop_card32_set(Ecore_X_Window win,
24 Ecore_X_Atom atom,
25 unsigned int *val,
26 unsigned int num)
27{
28#if SIZEOF_INT == SIZEOF_LONG
29 _ATOM_SET_CARD32(win, atom, val, num);
30#else /* if SIZEOF_INT == SIZEOF_LONG */
31 long *v2;
32 unsigned int i;
33
34 LOGFN(__FILE__, __LINE__, __FUNCTION__);
35 v2 = malloc(num * sizeof(long));
36 if (!v2)
37 return;
38
39 for (i = 0; i < num; i++)
40 v2[i] = val[i];
41 _ATOM_SET_CARD32(win, atom, v2, num);
42 free(v2);
43#endif /* if SIZEOF_INT == SIZEOF_LONG */
44}
45
46/*
47 * Get CARD32 (array) property
48 *
49 * At most len items are returned in val.
50 * If the property was successfully fetched the number of items stored in
51 * val is returned, otherwise -1 is returned.
52 * Note: Return value 0 means that the property exists but has no elements.
53 */
54EAPI int
55ecore_x_window_prop_card32_get(Ecore_X_Window win,
56 Ecore_X_Atom atom,
57 unsigned int *val,
58 unsigned int len)
59{
60 unsigned char *prop_ret;
61 Atom type_ret;
62 unsigned long bytes_after, num_ret;
63 int format_ret;
64 unsigned int i;
65 int num;
66
67 LOGFN(__FILE__, __LINE__, __FUNCTION__);
68 prop_ret = NULL;
69 if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
70 XA_CARDINAL, &type_ret, &format_ret, &num_ret,
71 &bytes_after, &prop_ret) != Success)
72 return -1;
73
74 if (type_ret != XA_CARDINAL || format_ret != 32)
75 num = -1;
76 else if (num_ret == 0 || !prop_ret)
77 num = 0;
78 else
79 {
80 if (num_ret < len)
81 len = num_ret;
82
83 for (i = 0; i < len; i++)
84 val[i] = ((unsigned long *)prop_ret)[i];
85 num = len;
86 }
87
88 if (prop_ret)
89 XFree(prop_ret);
90
91 return num;
92}
93
94/*
95 * Get CARD32 (array) property of any length
96 *
97 * If the property was successfully fetched the number of items stored in
98 * val is returned, otherwise -1 is returned.
99 * Note: Return value 0 means that the property exists but has no elements.
100 */
101EAPI int
102ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
103 Ecore_X_Atom atom,
104 unsigned int **plst)
105{
106 unsigned char *prop_ret;
107 Atom type_ret;
108 unsigned long bytes_after, num_ret;
109 int format_ret;
110 unsigned int i, *val;
111 int num;
112
113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
114 *plst = NULL;
115 prop_ret = NULL;
116 if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
117 XA_CARDINAL, &type_ret, &format_ret, &num_ret,
118 &bytes_after, &prop_ret) != Success)
119 return -1;
120
121 if ((type_ret != XA_CARDINAL) || (format_ret != 32))
122 num = -1;
123 else if ((num_ret == 0) || (!prop_ret))
124 num = 0;
125 else
126 {
127 val = malloc(num_ret * sizeof(unsigned int));
128 if (!val)
129 {
130 if (prop_ret) XFree(prop_ret);
131 return -1;
132 }
133 for (i = 0; i < num_ret; i++)
134 val[i] = ((unsigned long *)prop_ret)[i];
135 num = num_ret;
136 *plst = val;
137 }
138
139 if (prop_ret)
140 XFree(prop_ret);
141
142 return num;
143}
144
145/*
146 * Set X ID (array) property
147 */
148EAPI void
149ecore_x_window_prop_xid_set(Ecore_X_Window win,
150 Ecore_X_Atom atom,
151 Ecore_X_Atom type,
152 Ecore_X_ID *lst,
153 unsigned int num)
154{
155#if SIZEOF_INT == SIZEOF_LONG
156 XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace,
157 (unsigned char *)lst, num);
158#else /* if SIZEOF_INT == SIZEOF_LONG */
159 unsigned long *pl;
160 unsigned int i;
161
162 LOGFN(__FILE__, __LINE__, __FUNCTION__);
163 pl = malloc(num * sizeof(long));
164 if (!pl)
165 return;
166
167 for (i = 0; i < num; i++)
168 pl[i] = lst[i];
169 XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace,
170 (unsigned char *)pl, num);
171 free(pl);
172#endif /* if SIZEOF_INT == SIZEOF_LONG */
173}
174
175/*
176 * Get X ID (array) property
177 *
178 * At most len items are returned in val.
179 * If the property was successfully fetched the number of items stored in
180 * val is returned, otherwise -1 is returned.
181 * Note: Return value 0 means that the property exists but has no elements.
182 */
183EAPI int
184ecore_x_window_prop_xid_get(Ecore_X_Window win,
185 Ecore_X_Atom atom,
186 Ecore_X_Atom type,
187 Ecore_X_ID *lst,
188 unsigned int len)
189{
190 unsigned char *prop_ret;
191 Atom type_ret;
192 unsigned long bytes_after, num_ret;
193 int format_ret;
194 int num;
195 unsigned i;
196
197 LOGFN(__FILE__, __LINE__, __FUNCTION__);
198 prop_ret = NULL;
199 if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
200 type, &type_ret, &format_ret, &num_ret,
201 &bytes_after, &prop_ret) != Success)
202 return -1;
203
204 if (type_ret != type || format_ret != 32)
205 num = -1;
206 else if (num_ret == 0 || !prop_ret)
207 num = 0;
208 else
209 {
210 if (num_ret < len)
211 len = num_ret;
212
213 for (i = 0; i < len; i++)
214 lst[i] = ((unsigned long *)prop_ret)[i];
215 num = len;
216 }
217
218 if (prop_ret)
219 XFree(prop_ret);
220
221 return num;
222}
223
224/*
225 * Get X ID (array) property
226 *
227 * If the property was successfully fetched the number of items stored in
228 * val is returned, otherwise -1 is returned.
229 * The returned array must be freed with free().
230 * Note: Return value 0 means that the property exists but has no elements.
231 */
232EAPI int
233ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
234 Ecore_X_Atom atom,
235 Ecore_X_Atom type,
236 Ecore_X_ID **val)
237{
238 unsigned char *prop_ret;
239 Atom type_ret;
240 unsigned long bytes_after, num_ret;
241 int format_ret;
242 Ecore_X_Atom *alst;
243 int num;
244 unsigned i;
245
246 LOGFN(__FILE__, __LINE__, __FUNCTION__);
247 *val = NULL;
248 prop_ret = NULL;
249 if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
250 type, &type_ret, &format_ret, &num_ret,
251 &bytes_after, &prop_ret) != Success)
252 return -1;
253
254 if (type_ret != type || format_ret != 32)
255 num = -1;
256 else if (num_ret == 0 || !prop_ret)
257 num = 0;
258 else
259 {
260 alst = malloc(num_ret * sizeof(Ecore_X_ID));
261 for (i = 0; i < num_ret; i++)
262 alst[i] = ((unsigned long *)prop_ret)[i];
263 num = num_ret;
264 *val = alst;
265 }
266
267 if (prop_ret)
268 XFree(prop_ret);
269
270 return num;
271}
272
273/*
274 * Remove/add/toggle X ID list item.
275 */
276EAPI void
277ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
278 Ecore_X_Atom atom,
279 Ecore_X_Atom type,
280 Ecore_X_ID item,
281 int op)
282{
283 Ecore_X_ID *lst;
284 int i, num;
285
286 LOGFN(__FILE__, __LINE__, __FUNCTION__);
287 num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
288 if (num < 0)
289 {
290 return; /* Error - assuming invalid window */
291 }
292
293 /* Is it there? */
294 for (i = 0; i < num; i++)
295 {
296 if (lst[i] == item)
297 break;
298 }
299
300 if (i < num)
301 {
302 /* Was in list */
303 if (op == ECORE_X_PROP_LIST_ADD)
304 goto done; /* Remove it */
305
306 num--;
307 for (; i < num; i++)
308 lst[i] = lst[i + 1];
309 }
310 else
311 {
312 /* Was not in list */
313 if (op == ECORE_X_PROP_LIST_REMOVE)
314 goto done; /* Add it */
315
316 num++;
317 lst = realloc(lst, num * sizeof(Ecore_X_ID));
318 lst[i] = item;
319 }
320
321 ecore_x_window_prop_xid_set(win, atom, type, lst, num);
322
323done:
324 if (lst)
325 free(lst);
326}
327
328/*
329 * Set Atom (array) property
330 */
331EAPI void
332ecore_x_window_prop_atom_set(Ecore_X_Window win,
333 Ecore_X_Atom atom,
334 Ecore_X_Atom *lst,
335 unsigned int num)
336{
337 LOGFN(__FILE__, __LINE__, __FUNCTION__);
338 ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num);
339}
340
341/*
342 * Get Atom (array) property
343 *
344 * At most len items are returned in val.
345 * If the property was successfully fetched the number of items stored in
346 * val is returned, otherwise -1 is returned.
347 * Note: Return value 0 means that the property exists but has no elements.
348 */
349EAPI int
350ecore_x_window_prop_atom_get(Ecore_X_Window win,
351 Ecore_X_Atom atom,
352 Ecore_X_Atom *lst,
353 unsigned int len)
354{
355 LOGFN(__FILE__, __LINE__, __FUNCTION__);
356 return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len);
357}
358
359/*
360 * Get Atom (array) property
361 *
362 * If the property was successfully fetched the number of items stored in
363 * val is returned, otherwise -1 is returned.
364 * The returned array must be freed with free().
365 * Note: Return value 0 means that the property exists but has no elements.
366 */
367EAPI int
368ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
369 Ecore_X_Atom atom,
370 Ecore_X_Atom **plst)
371{
372 LOGFN(__FILE__, __LINE__, __FUNCTION__);
373 return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst);
374}
375
376/*
377 * Remove/add/toggle atom list item.
378 */
379EAPI void
380ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
381 Ecore_X_Atom atom,
382 Ecore_X_Atom item,
383 int op)
384{
385 LOGFN(__FILE__, __LINE__, __FUNCTION__);
386 ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op);
387}
388
389/*
390 * Set Window (array) property
391 */
392EAPI void
393ecore_x_window_prop_window_set(Ecore_X_Window win,
394 Ecore_X_Atom atom,
395 Ecore_X_Window *lst,
396 unsigned int num)
397{
398 LOGFN(__FILE__, __LINE__, __FUNCTION__);
399 ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num);
400}
401
402/*
403 * Get Window (array) property
404 *
405 * At most len items are returned in val.
406 * If the property was successfully fetched the number of items stored in
407 * val is returned, otherwise -1 is returned.
408 * Note: Return value 0 means that the property exists but has no elements.
409 */
410EAPI int
411ecore_x_window_prop_window_get(Ecore_X_Window win,
412 Ecore_X_Atom atom,
413 Ecore_X_Window *lst,
414 unsigned int len)
415{
416 LOGFN(__FILE__, __LINE__, __FUNCTION__);
417 return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len);
418}
419
420/*
421 * Get Window (array) property
422 *
423 * If the property was successfully fetched the number of items stored in
424 * val is returned, otherwise -1 is returned.
425 * The returned array must be freed with free().
426 * Note: Return value 0 means that the property exists but has no elements.
427 */
428EAPI int
429ecore_x_window_prop_window_list_get(Ecore_X_Window win,
430 Ecore_X_Atom atom,
431 Ecore_X_Window **plst)
432{
433 LOGFN(__FILE__, __LINE__, __FUNCTION__);
434 return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
435}
436
437/**
438 * To be documented.
439 *
440 * FIXME: To be fixed.
441 */
442EAPI Ecore_X_Atom
443ecore_x_window_prop_any_type(void)
444{
445 return AnyPropertyType;
446}
447
448/**
449 * To be documented.
450 *
451 * FIXME: To be fixed.
452 */
453EAPI void
454ecore_x_window_prop_property_set(Ecore_X_Window win,
455 Ecore_X_Atom property,
456 Ecore_X_Atom type,
457 int size,
458 void *data,
459 int number)
460{
461 LOGFN(__FILE__, __LINE__, __FUNCTION__);
462 if (win == 0)
463 win = DefaultRootWindow(_ecore_x_disp);
464
465 if (size != 32)
466 XChangeProperty(_ecore_x_disp,
467 win,
468 property,
469 type,
470 size,
471 PropModeReplace,
472 (unsigned char *)data,
473 number);
474 else
475 {
476 unsigned long *dat;
477 int i, *ptr;
478
479 dat = malloc(sizeof(unsigned long) * number);
480 if (dat)
481 {
482 for (ptr = (int *)data, i = 0; i < number; i++)
483 dat[i] = ptr[i];
484 XChangeProperty(_ecore_x_disp, win, property, type, size,
485 PropModeReplace, (unsigned char *)dat, number);
486 free(dat);
487 }
488 }
489}
490
491/**
492 * To be documented.
493 *
494 * FIXME: To be fixed.
495 */
496EAPI int
497ecore_x_window_prop_property_get(Ecore_X_Window win,
498 Ecore_X_Atom property,
499 Ecore_X_Atom type,
500 int size __UNUSED__,
501 unsigned char **data,
502 int *num)
503{
504 Atom type_ret = 0;
505 int ret, size_ret = 0;
506 unsigned long num_ret = 0, bytes = 0, i;
507 unsigned char *prop_ret = NULL;
508
509 /* make sure these are initialized */
510 if (num)
511 *num = 0;
512
513 if (data)
514 *data = NULL;
515 else /* we can't store the retrieved data, so just return */
516 return 0;
517
518 LOGFN(__FILE__, __LINE__, __FUNCTION__);
519 if (!win)
520 win = DefaultRootWindow(_ecore_x_disp);
521
522 ret = XGetWindowProperty(_ecore_x_disp, win, property, 0, LONG_MAX,
523 False, type, &type_ret, &size_ret,
524 &num_ret, &bytes, &prop_ret);
525
526 if (ret != Success)
527 return 0;
528
529 if (!num_ret)
530 {
531 XFree(prop_ret);
532 return 0;
533 }
534
535 if (!(*data = malloc(num_ret * size_ret / 8)))
536 {
537 XFree(prop_ret);
538 return 0;
539 }
540
541 switch (size_ret) {
542 case 8:
543 for (i = 0; i < num_ret; i++)
544 (*data)[i] = prop_ret[i];
545 break;
546
547 case 16:
548 for (i = 0; i < num_ret; i++)
549 ((unsigned short *)*data)[i] = ((unsigned short *)prop_ret)[i];
550 break;
551
552 case 32:
553 for (i = 0; i < num_ret; i++)
554 ((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i];
555 break;
556 }
557
558 XFree(prop_ret);
559
560 if (num)
561 *num = num_ret;
562
563 return size_ret;
564}
565
566EAPI void
567ecore_x_window_prop_property_del(Ecore_X_Window win,
568 Ecore_X_Atom property)
569{
570 LOGFN(__FILE__, __LINE__, __FUNCTION__);
571 XDeleteProperty(_ecore_x_disp, win, property);
572}
573
574EAPI Ecore_X_Atom *
575ecore_x_window_prop_list(Ecore_X_Window win,
576 int *num_ret)
577{
578 Ecore_X_Atom *atoms;
579 Atom *atom_ret;
580 int num = 0, i;
581
582 LOGFN(__FILE__, __LINE__, __FUNCTION__);
583 if (num_ret)
584 *num_ret = 0;
585
586 atom_ret = XListProperties(_ecore_x_disp, win, &num);
587 if (!atom_ret)
588 return NULL;
589
590 atoms = malloc(num * sizeof(Ecore_X_Atom));
591 if (atoms)
592 {
593 for (i = 0; i < num; i++)
594 atoms[i] = atom_ret[i];
595 if (num_ret)
596 *num_ret = num;
597 }
598
599 XFree(atom_ret);
600 return atoms;
601}
602
603/**
604 * Set a window string property.
605 * @param win The window
606 * @param type The property
607 * @param str The string
608 *
609 * Set a window string property
610 */
611EAPI void
612ecore_x_window_prop_string_set(Ecore_X_Window win,
613 Ecore_X_Atom type,
614 const char *str)
615{
616 XTextProperty xtp;
617
618 LOGFN(__FILE__, __LINE__, __FUNCTION__);
619 if (win == 0)
620 win = DefaultRootWindow(_ecore_x_disp);
621
622 xtp.value = (unsigned char *)str;
623 xtp.format = 8;
624 xtp.encoding = ECORE_X_ATOM_UTF8_STRING;
625 xtp.nitems = strlen(str);
626 XSetTextProperty(_ecore_x_disp, win, &xtp, type);
627}
628
629/**
630 * Get a window string property.
631 * @param win The window
632 * @param type The property
633 *
634 * Return window string property of a window. String must be free'd when done.
635 */
636EAPI char *
637ecore_x_window_prop_string_get(Ecore_X_Window win,
638 Ecore_X_Atom type)
639{
640 XTextProperty xtp;
641 char *str = NULL;
642
643 LOGFN(__FILE__, __LINE__, __FUNCTION__);
644 if (win == 0)
645 win = DefaultRootWindow(_ecore_x_disp);
646
647 if (XGetTextProperty(_ecore_x_disp, win, &xtp, type))
648 {
649 int items;
650 char **list = NULL;
651 Status s;
652
653 if (xtp.encoding == ECORE_X_ATOM_UTF8_STRING)
654 str = strdup((char *)xtp.value);
655 else
656 {
657#ifdef X_HAVE_UTF8_STRING
658 s = Xutf8TextPropertyToTextList(_ecore_x_disp, &xtp,
659 &list, &items);
660#else /* ifdef X_HAVE_UTF8_STRING */
661 s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp,
662 &list, &items);
663#endif /* ifdef X_HAVE_UTF8_STRING */
664 if ((s == XLocaleNotSupported) ||
665 (s == XNoMemory) || (s == XConverterNotFound))
666 str = strdup((char *)xtp.value);
667 else if ((s >= Success) && (items > 0))
668 str = strdup(list[0]);
669
670 if (list)
671 XFreeStringList(list);
672 }
673
674 XFree(xtp.value);
675 }
676
677 return str;
678}
679
680EAPI Eina_Bool
681ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
682 Ecore_X_WM_Protocol protocol)
683{
684 Atom proto, *protos = NULL;
685 int i, protos_count = 0;
686 Eina_Bool ret = EINA_FALSE;
687
688 /* check for invalid values */
689 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
690 return EINA_FALSE;
691
692 LOGFN(__FILE__, __LINE__, __FUNCTION__);
693 proto = _ecore_x_atoms_wm_protocols[protocol];
694
695 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
696 return ret;
697
698 for (i = 0; i < protos_count; i++)
699 if (protos[i] == proto)
700 {
701 ret = EINA_TRUE;
702 break;
703 }
704
705 XFree(protos);
706
707 return ret;
708}
709
710/**
711 * To be documented.
712 *
713 * FIXME: To be fixed.
714 */
715EAPI Ecore_X_WM_Protocol *
716ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
717 int *num_ret)
718{
719 Atom *protos = NULL;
720 int i, protos_count = 0;
721 Ecore_X_WM_Protocol *prot_ret = NULL;
722
723 LOGFN(__FILE__, __LINE__, __FUNCTION__);
724 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
725 return NULL;
726
727 if ((!protos) || (protos_count <= 0))
728 return NULL;
729
730 prot_ret = calloc(1, protos_count * sizeof(Ecore_X_WM_Protocol));
731 if (!prot_ret)
732 {
733 XFree(protos);
734 return NULL;
735 }
736
737 for (i = 0; i < protos_count; i++)
738 {
739 Ecore_X_WM_Protocol j;
740
741 prot_ret[i] = -1;
742 for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
743 {
744 if (_ecore_x_atoms_wm_protocols[j] == protos[i])
745 prot_ret[i] = j;
746 }
747 }
748 XFree(protos);
749 *num_ret = protos_count;
750 return prot_ret;
751}
752
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
deleted file mode 100644
index 71718cf..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
+++ /dev/null
@@ -1,658 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_x_private.h"
9#include "Ecore_X.h"
10
11/**
12 * @defgroup Ecore_X_Window_Shape X Window Shape Functions
13 *
14 * These functions use the shape extension of the X server to change
15 * shape of given windows.
16 */
17
18/**
19 * Sets the shape of the given window to that given by the pixmap @p mask.
20 * @param win The given window.
21 * @param mask A 2-bit depth pixmap that provides the new shape of the
22 * window.
23 * @ingroup Ecore_X_Window_Shape
24 */
25EAPI void
26ecore_x_window_shape_mask_set(Ecore_X_Window win,
27 Ecore_X_Pixmap mask)
28{
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30 XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
31}
32
33/**
34 * Sets the input shape of the given window to that given by the pixmap @p mask.
35 * @param win The given window.
36 * @param mask A 1-bit depth pixmap that provides the new input shape of the
37 * window.
38 * @ingroup Ecore_X_Window_Shape
39 */
40EAPI void
41ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
42 Ecore_X_Pixmap mask)
43{
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45#ifdef ShapeInput
46 XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
47#else /* ifdef ShapeInput */
48 return;
49 win = mask = 0;
50#endif /* ifdef ShapeInput */
51}
52
53EAPI void
54ecore_x_window_shape_window_set(Ecore_X_Window win,
55 Ecore_X_Window shape_win)
56{
57 LOGFN(__FILE__, __LINE__, __FUNCTION__);
58 XShapeCombineShape(_ecore_x_disp,
59 win,
60 ShapeBounding,
61 0,
62 0,
63 shape_win,
64 ShapeBounding,
65 ShapeSet);
66}
67
68EAPI void
69ecore_x_window_shape_input_window_set(Ecore_X_Window win,
70 Ecore_X_Window shape_win)
71{
72#ifdef ShapeInput
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 XShapeCombineShape(_ecore_x_disp,
75 win,
76 ShapeInput,
77 0,
78 0,
79 shape_win,
80 ShapeInput,
81 ShapeSet);
82#else
83 return;
84 win = shape_win = 0;
85#endif
86}
87
88EAPI void
89ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
90 Ecore_X_Window shape_win,
91 int x,
92 int y)
93{
94 LOGFN(__FILE__, __LINE__, __FUNCTION__);
95 XShapeCombineShape(_ecore_x_disp,
96 win,
97 ShapeBounding,
98 x,
99 y,
100 shape_win,
101 ShapeBounding,
102 ShapeSet);
103}
104
105EAPI void
106ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
107 Ecore_X_Window shape_win,
108 int x,
109 int y)
110{
111#ifdef ShapeInput
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 XShapeCombineShape(_ecore_x_disp,
114 win,
115 ShapeInput,
116 x,
117 y,
118 shape_win,
119 ShapeInput,
120 ShapeSet);
121#else
122 return;
123 win = shape_win = x = y = 0;
124#endif
125}
126
127EAPI void
128ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
129 int x,
130 int y,
131 int w,
132 int h)
133{
134 XRectangle rect;
135
136 LOGFN(__FILE__, __LINE__, __FUNCTION__);
137 rect.x = x;
138 rect.y = y;
139 rect.width = w;
140 rect.height = h;
141 XShapeCombineRectangles(_ecore_x_disp,
142 win,
143 ShapeBounding,
144 0,
145 0,
146 &rect,
147 1,
148 ShapeSet,
149 Unsorted);
150}
151
152EAPI void
153ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
154 int x,
155 int y,
156 int w,
157 int h)
158{
159#ifdef ShapeInput
160 XRectangle rect;
161
162 LOGFN(__FILE__, __LINE__, __FUNCTION__);
163 rect.x = x;
164 rect.y = y;
165 rect.width = w;
166 rect.height = h;
167 XShapeCombineRectangles(_ecore_x_disp,
168 win,
169 ShapeInput,
170 0,
171 0,
172 &rect,
173 1,
174 ShapeSet,
175 Unsorted);
176#else
177 return;
178 win = x = y = w = h = 0;
179#endif
180}
181
182EAPI void
183ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
184 Ecore_X_Rectangle *rects,
185 int num)
186{
187#ifdef ShapeInput
188 XRectangle *rect = NULL;
189 int i;
190
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
192 if (!rects) return;
193 if (num > 0)
194 {
195 rect = malloc(sizeof(XRectangle) * num);
196 if (!rect) return;
197 for (i = 0; i < num; i++)
198 {
199 rect[i].x = rects[i].x;
200 rect[i].y = rects[i].y;
201 rect[i].width = rects[i].width;
202 rect[i].height = rects[i].height;
203 }
204 }
205 XShapeCombineRectangles(_ecore_x_disp,
206 win,
207 ShapeBounding,
208 0,
209 0,
210 rect,
211 num,
212 ShapeSet,
213 Unsorted);
214 if (rect) free(rect);
215#else
216 return;
217 win = rects = num = 0;
218#endif
219}
220
221EAPI void
222ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
223 Ecore_X_Rectangle *rects,
224 int num)
225{
226#ifdef ShapeInput
227 XRectangle *rect = NULL;
228 int i;
229
230 LOGFN(__FILE__, __LINE__, __FUNCTION__);
231 if (!rects) return;
232 if (num > 0)
233 {
234 rect = malloc(sizeof(XRectangle) * num);
235 if (!rect) return;
236 for (i = 0; i < num; i++)
237 {
238 rect[i].x = rects[i].x;
239 rect[i].y = rects[i].y;
240 rect[i].width = rects[i].width;
241 rect[i].height = rects[i].height;
242 }
243 }
244 XShapeCombineRectangles(_ecore_x_disp,
245 win,
246 ShapeInput,
247 0,
248 0,
249 rect,
250 num,
251 ShapeSet,
252 Unsorted);
253 if (rect) free(rect);
254#else
255 return;
256 win = rects = num = 0;
257#endif
258}
259
260EAPI void
261ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
262 int x,
263 int y,
264 int w,
265 int h)
266{
267 XRectangle rect;
268
269 LOGFN(__FILE__, __LINE__, __FUNCTION__);
270 rect.x = x;
271 rect.y = y;
272 rect.width = w;
273 rect.height = h;
274 XShapeCombineRectangles(_ecore_x_disp,
275 win,
276 ShapeBounding,
277 0,
278 0,
279 &rect,
280 1,
281 ShapeSubtract,
282 Unsorted);
283}
284
285EAPI void
286ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
287 int x,
288 int y,
289 int w,
290 int h)
291{
292#ifdef ShapeInput
293 XRectangle rect;
294
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
296 rect.x = x;
297 rect.y = y;
298 rect.width = w;
299 rect.height = h;
300 XShapeCombineRectangles(_ecore_x_disp,
301 win,
302 ShapeInput,
303 0,
304 0,
305 &rect,
306 1,
307 ShapeSubtract,
308 Unsorted);
309#else
310 return;
311 win = x = y = w = h = 0;
312#endif
313}
314
315EAPI void
316ecore_x_window_shape_window_add(Ecore_X_Window win,
317 Ecore_X_Window shape_win)
318{
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320 XShapeCombineShape(_ecore_x_disp,
321 win,
322 ShapeBounding,
323 0,
324 0,
325 shape_win,
326 ShapeBounding,
327 ShapeUnion);
328}
329
330EAPI void
331ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
332 Ecore_X_Window shape_win,
333 int x,
334 int y)
335{
336 LOGFN(__FILE__, __LINE__, __FUNCTION__);
337 XShapeCombineShape(_ecore_x_disp,
338 win,
339 ShapeBounding,
340 x,
341 y,
342 shape_win,
343 ShapeBounding,
344 ShapeUnion);
345}
346
347EAPI void
348ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
349 Ecore_X_Window shape_win,
350 int x,
351 int y)
352{
353#ifdef ShapeInput
354 LOGFN(__FILE__, __LINE__, __FUNCTION__);
355 XShapeCombineShape(_ecore_x_disp,
356 win,
357 ShapeInput,
358 x,
359 y,
360 shape_win,
361 ShapeInput,
362 ShapeUnion);
363#else
364 return;
365 win = shape_win = x = y = 0;
366#endif
367}
368
369EAPI void
370ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
371 int x,
372 int y,
373 int w,
374 int h)
375{
376 XRectangle rect;
377
378 LOGFN(__FILE__, __LINE__, __FUNCTION__);
379 rect.x = x;
380 rect.y = y;
381 rect.width = w;
382 rect.height = h;
383 XShapeCombineRectangles(_ecore_x_disp,
384 win,
385 ShapeBounding,
386 0,
387 0,
388 &rect,
389 1,
390 ShapeUnion,
391 Unsorted);
392}
393
394EAPI void
395ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
396 int x,
397 int y,
398 int w,
399 int h)
400{
401#ifdef ShapeInput
402 XRectangle rect;
403
404 LOGFN(__FILE__, __LINE__, __FUNCTION__);
405 rect.x = x;
406 rect.y = y;
407 rect.width = w;
408 rect.height = h;
409 XShapeCombineRectangles(_ecore_x_disp,
410 win,
411 ShapeInput,
412 0,
413 0,
414 &rect,
415 1,
416 ShapeUnion,
417 Unsorted);
418#else
419 return;
420 win = x = y = w = h = 0;
421#endif
422}
423
424EAPI void
425ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
426 int x,
427 int y,
428 int w,
429 int h)
430{
431 XRectangle rect;
432
433 LOGFN(__FILE__, __LINE__, __FUNCTION__);
434 rect.x = x;
435 rect.y = y;
436 rect.width = w;
437 rect.height = h;
438 XShapeCombineRectangles(_ecore_x_disp,
439 win,
440 ShapeBounding,
441 0,
442 0,
443 &rect,
444 1,
445 ShapeIntersect,
446 Unsorted);
447}
448
449EAPI void
450ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
451 int x,
452 int y,
453 int w,
454 int h)
455{
456#ifdef ShapeInput
457 XRectangle rect;
458
459 LOGFN(__FILE__, __LINE__, __FUNCTION__);
460 rect.x = x;
461 rect.y = y;
462 rect.width = w;
463 rect.height = h;
464 XShapeCombineRectangles(_ecore_x_disp,
465 win,
466 ShapeInput,
467 0,
468 0,
469 &rect,
470 1,
471 ShapeIntersect,
472 Unsorted);
473#else
474 return;
475 win = x = y = w = h = 0;
476#endif
477}
478
479EAPI void
480ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
481 Ecore_X_Rectangle *rects,
482 int num)
483{
484 XRectangle *rect = NULL;
485 int i;
486
487 LOGFN(__FILE__, __LINE__, __FUNCTION__);
488 if (num > 0)
489 {
490 rect = malloc(sizeof(XRectangle) * num);
491 if (!rect) return;
492 for (i = 0; i < num; i++)
493 {
494 rect[i].x = rects[i].x;
495 rect[i].y = rects[i].y;
496 rect[i].width = rects[i].width;
497 rect[i].height = rects[i].height;
498 }
499 }
500
501 XShapeCombineRectangles(_ecore_x_disp,
502 win,
503 ShapeBounding,
504 0,
505 0,
506 rect,
507 num,
508 ShapeUnion,
509 Unsorted);
510 if (rect) free(rect);
511}
512
513EAPI void
514ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
515 Ecore_X_Rectangle *rects,
516 int num)
517{
518#ifdef ShapeInput
519 XRectangle *rect = NULL;
520 int i;
521
522 LOGFN(__FILE__, __LINE__, __FUNCTION__);
523 if (num > 0)
524 {
525 rect = malloc(sizeof(XRectangle) * num);
526 if (!rect) return;
527 for (i = 0; i < num; i++)
528 {
529 rect[i].x = rects[i].x;
530 rect[i].y = rects[i].y;
531 rect[i].width = rects[i].width;
532 rect[i].height = rects[i].height;
533 }
534 }
535
536 XShapeCombineRectangles(_ecore_x_disp,
537 win,
538 ShapeInput,
539 0,
540 0,
541 rect,
542 num,
543 ShapeUnion,
544 Unsorted);
545 if (rect) free(rect);
546#else
547 return;
548 win = rects = num = 0;
549#endif
550}
551
552EAPI Ecore_X_Rectangle *
553ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
554 int *num_ret)
555{
556 XRectangle *rect;
557 Ecore_X_Rectangle *rects = NULL;
558 int i, num = 0, ord;
559
560 LOGFN(__FILE__, __LINE__, __FUNCTION__);
561 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
562 if (rect)
563 {
564 if (num < 1)
565 {
566 XFree(rect);
567 if (num_ret) *num_ret = 0;
568 return NULL;
569 }
570 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
571 if (!rects)
572 {
573 XFree(rect);
574 if (num_ret) *num_ret = 0;
575 return NULL;
576 }
577 for (i = 0; i < num; i++)
578 {
579 rects[i].x = rect[i].x;
580 rects[i].y = rect[i].y;
581 rects[i].width = rect[i].width;
582 rects[i].height = rect[i].height;
583 }
584 XFree(rect);
585 }
586 if (num_ret) *num_ret = num;
587 return rects;
588}
589
590EAPI Ecore_X_Rectangle *
591ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
592 int *num_ret)
593{
594 Ecore_X_Rectangle *rects = NULL;
595#ifdef ShapeInput
596 XRectangle *rect;
597 int i, num = 0, ord;
598
599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
600 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord);
601 if (rect)
602 {
603 if (num < 1)
604 {
605 XFree(rect);
606 if (num_ret) *num_ret = 0;
607 return NULL;
608 }
609 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
610 if (!rects)
611 {
612 XFree(rect);
613 if (num_ret) *num_ret = 0;
614 return NULL;
615 }
616 for (i = 0; i < num; i++)
617 {
618 rects[i].x = rect[i].x;
619 rects[i].y = rect[i].y;
620 rects[i].width = rect[i].width;
621 rects[i].height = rect[i].height;
622 }
623 XFree(rect);
624 }
625 if (num_ret) *num_ret = num;
626 return rects;
627#else
628 // have to return fake shape input rect of size of window
629 Window dw;
630 unsigned int di;
631
632 if (num_ret) *num_ret = 0;
633 rects = malloc(sizeof(Ecore_X_Rectangle));
634 if (!rects) return NULL;
635 if (!XGetGeometry(_ecore_x_disp, win, &dw,
636 &(rects[0].x), &(rects[0].y),
637 &(rects[0].width), &(rects[0].height),
638 &di, &di))
639 {
640 free(rects);
641 return NULL;
642 }
643 if (num_ret) *num_ret = 1;
644 return rects;
645#endif
646}
647
648EAPI void
649ecore_x_window_shape_events_select(Ecore_X_Window win,
650 Eina_Bool on)
651{
652 LOGFN(__FILE__, __LINE__, __FUNCTION__);
653 if (on)
654 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
655 else
656 XShapeSelectInput(_ecore_x_disp, win, 0);
657}
658
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
deleted file mode 100644
index fbfbd43..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c
+++ /dev/null
@@ -1,283 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <string.h>
6
7#include "Ecore.h"
8#include "ecore_x_private.h"
9#include "Ecore_X.h"
10
11#ifdef ECORE_XI2
12#include "Ecore_Input.h"
13#endif /* ifdef ECORE_XI2 */
14
15int _ecore_x_xi2_opcode = -1;
16
17#ifndef XIPointerEmulated
18#define XIPointerEmulated (1 << 16)
19#endif
20
21#ifdef ECORE_XI2
22static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
23static int _ecore_x_xi2_num = 0;
24#endif /* ifdef ECORE_XI2 */
25
26void
27_ecore_x_input_init(void)
28{
29#ifdef ECORE_XI2
30 int event, error;
31 int major = 2, minor = 0;
32
33 if (!XQueryExtension(_ecore_x_disp, "XInputExtension",
34 &_ecore_x_xi2_opcode, &event, &error))
35 {
36 _ecore_x_xi2_opcode = -1;
37 return;
38 }
39
40 if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest)
41 {
42 _ecore_x_xi2_opcode = -1;
43 return;
44 }
45
46 _ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices,
47 &_ecore_x_xi2_num);
48#endif /* ifdef ECORE_XI2 */
49}
50
51void
52_ecore_x_input_shutdown(void)
53{
54#ifdef ECORE_XI2
55 if (_ecore_x_xi2_devs)
56 {
57 XIFreeDeviceInfo(_ecore_x_xi2_devs);
58 _ecore_x_xi2_devs = NULL;
59 }
60
61 _ecore_x_xi2_num = 0;
62 _ecore_x_xi2_opcode = -1;
63#endif /* ifdef ECORE_XI2 */
64}
65
66void
67_ecore_x_input_handler(XEvent *xevent)
68{
69#ifdef ECORE_XI2
70 XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
71 int devid = evd->deviceid;
72 int i;
73
74 if (_ecore_x_xi2_devs)
75 {
76 for (i = 0; i < _ecore_x_xi2_num; i++)
77 {
78 XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]);
79
80 if (devid == dev->deviceid)
81 {
82 if (dev->use == XIMasterPointer) return;
83 if ((dev->use == XISlavePointer) &&
84 (evd->flags & XIPointerEmulated)) return;
85 }
86 }
87 }
88 switch (xevent->xcookie.evtype)
89 {
90 case XI_Motion:
91 _ecore_mouse_move
92 (evd->time,
93 0, // state
94 evd->event_x, evd->event_y,
95 evd->root_x, evd->root_y,
96 evd->event,
97 (evd->child ? evd->child : evd->event),
98 evd->root,
99 1, // same_screen
100 devid, 1, 1,
101 1.0, // pressure
102 0.0, // angle
103 evd->event_x, evd->event_y,
104 evd->root_x, evd->root_y);
105 break;
106
107 case XI_ButtonPress:
108 _ecore_mouse_button
109 (ECORE_EVENT_MOUSE_BUTTON_DOWN,
110 evd->time,
111 0, // state
112 0, // button
113 evd->event_x, evd->event_y,
114 evd->root_x, evd->root_y,
115 evd->event,
116 (evd->child ? evd->child : evd->event),
117 evd->root,
118 1, // same_screen
119 devid, 1, 1,
120 1.0, // pressure
121 0.0, // angle
122 evd->event_x, evd->event_y,
123 evd->root_x, evd->root_y);
124 break;
125
126 case XI_ButtonRelease:
127 _ecore_mouse_button
128 (ECORE_EVENT_MOUSE_BUTTON_UP,
129 evd->time,
130 0, // state
131 0, // button
132 evd->event_x, evd->event_y,
133 evd->root_x, evd->root_y,
134 evd->event,
135 (evd->child ? evd->child : evd->event),
136 evd->root,
137 1, // same_screen
138 devid, 1, 1,
139 1.0, // pressure
140 0.0, // angle
141 evd->event_x, evd->event_y,
142 evd->root_x, evd->root_y);
143 break;
144
145#ifdef XI_TouchUpdate
146 case XI_TouchUpdate:
147 _ecore_mouse_move
148 (evd->time,
149 0, // state
150 evd->event_x, evd->event_y,
151 evd->root_x, evd->root_y,
152 evd->event,
153 (evd->child ? evd->child : evd->event),
154 evd->root,
155 1, // same_screen
156 devid, 1, 1,
157 1.0, // pressure
158 0.0, // angle
159 evd->event_x, evd->event_y,
160 evd->root_x, evd->root_y);
161 break;
162
163#endif
164#ifdef XI_TouchBegin
165 case XI_TouchBegin:
166 _ecore_mouse_button
167 (ECORE_EVENT_MOUSE_BUTTON_DOWN,
168 evd->time,
169 0, // state
170 0, // button
171 evd->event_x, evd->event_y,
172 evd->root_x, evd->root_y,
173 evd->event,
174 (evd->child ? evd->child : evd->event),
175 evd->root,
176 1, // same_screen
177 devid, 1, 1,
178 1.0, // pressure
179 0.0, // angle
180 evd->event_x, evd->event_y,
181 evd->root_x, evd->root_y);
182 break;
183
184#endif
185#ifdef XI_TouchEnd
186 case XI_TouchEnd:
187 _ecore_mouse_button
188 (ECORE_EVENT_MOUSE_BUTTON_UP,
189 evd->time,
190 0, // state
191 0, // button
192 evd->event_x, evd->event_y,
193 evd->root_x, evd->root_y,
194 evd->event,
195 (evd->child ? evd->child : evd->event),
196 evd->root,
197 1, // same_screen
198 devid, 1, 1,
199 1.0, // pressure
200 0.0, // angle
201 evd->event_x, evd->event_y,
202 evd->root_x, evd->root_y);
203 break;
204
205#endif
206 default:
207 break;
208 }
209#endif /* ifdef ECORE_XI2 */
210}
211
212EAPI Eina_Bool
213ecore_x_input_multi_select(Ecore_X_Window win)
214{
215#ifdef ECORE_XI2
216 int i;
217 Eina_Bool find = EINA_FALSE;
218
219 if (!_ecore_x_xi2_devs)
220 return 0;
221
222 LOGFN(__FILE__, __LINE__, __FUNCTION__);
223 for (i = 0; i < _ecore_x_xi2_num; i++)
224 {
225 XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]);
226
227 if (dev->use == XIFloatingSlave)
228 {
229 XIEventMask eventmask;
230 unsigned char mask[4] = { 0 };
231
232 eventmask.deviceid = dev->deviceid;
233 eventmask.mask_len = sizeof(mask);
234 eventmask.mask = mask;
235 XISetMask(mask, XI_ButtonPress);
236 XISetMask(mask, XI_ButtonRelease);
237 XISetMask(mask, XI_Motion);
238 XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
239 find = EINA_TRUE;
240 }
241 else if (dev->use == XISlavePointer)
242 {
243 XIDeviceInfo *atdev = NULL;
244 int j;
245
246 for (j = 0; j < _ecore_x_xi2_num; j++)
247 {
248 if (_ecore_x_xi2_devs[j].deviceid == dev->attachment)
249 atdev = &(_ecore_x_xi2_devs[j]);
250 }
251 if (((atdev) && (atdev->use != XIMasterPointer)) ||
252 (!atdev))
253 {
254 XIEventMask eventmask;
255 unsigned char mask[4] = { 0 };
256
257 eventmask.deviceid = dev->deviceid;
258 eventmask.mask_len = sizeof(mask);
259 eventmask.mask = mask;
260 XISetMask(mask, XI_ButtonPress);
261 XISetMask(mask, XI_ButtonRelease);
262 XISetMask(mask, XI_Motion);
263# ifdef XI_TouchUpdate
264 XISetMask(mask, XI_TouchUpdate);
265# endif
266# ifdef XI_TouchBegin
267 XISetMask(mask, XI_TouchBegin);
268# endif
269# ifdef XI_TouchEnd
270 XISetMask(mask, XI_TouchEnd);
271# endif
272 XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
273 find = EINA_TRUE;
274 }
275 }
276 }
277
278 return find;
279#else /* ifdef ECORE_XI2 */
280 return EINA_FALSE;
281#endif /* ifdef ECORE_XI2 */
282}
283
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
deleted file mode 100644
index f49a4d3..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Xinerama code
3 */
4
5#ifdef HAVE_CONFIG_H
6# include <config.h>
7#endif /* ifdef HAVE_CONFIG_H */
8
9#include "Ecore.h"
10#include "ecore_x_private.h"
11#include "Ecore_X.h"
12#include "Ecore_X_Atoms.h"
13
14#ifdef ECORE_XINERAMA
15static XineramaScreenInfo *_xin_info = NULL;
16static int _xin_scr_num = 0;
17#endif /* ifdef ECORE_XINERAMA */
18
19EAPI int
20ecore_x_xinerama_screen_count_get(void)
21{
22#ifdef ECORE_XINERAMA
23 int event_base, error_base;
24
25 LOGFN(__FILE__, __LINE__, __FUNCTION__);
26 if (_xin_info)
27 XFree(_xin_info);
28
29 _xin_info = NULL;
30 if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base))
31 {
32 _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num);
33 if (_xin_info)
34 return _xin_scr_num;
35 }
36
37#endif /* ifdef ECORE_XINERAMA */
38 return 0;
39}
40
41EAPI Eina_Bool
42ecore_x_xinerama_screen_geometry_get(int screen,
43 int *x,
44 int *y,
45 int *w,
46 int *h)
47{
48 LOGFN(__FILE__, __LINE__, __FUNCTION__);
49#ifdef ECORE_XINERAMA
50 if (_xin_info)
51 {
52 int i;
53
54 for (i = 0; i < _xin_scr_num; i++)
55 {
56 if (_xin_info[i].screen_number == screen)
57 {
58 if (x)
59 *x = _xin_info[i].x_org;
60
61 if (y)
62 *y = _xin_info[i].y_org;
63
64 if (w)
65 *w = _xin_info[i].width;
66
67 if (h)
68 *h = _xin_info[i].height;
69
70 return EINA_TRUE;
71 }
72 }
73 }
74
75#endif /* ifdef ECORE_XINERAMA */
76 if (x)
77 *x = 0;
78
79 if (y)
80 *y = 0;
81
82 if (w)
83 *w = DisplayWidth(_ecore_x_disp, 0);
84
85 if (h)
86 *h = DisplayHeight(_ecore_x_disp, 0);
87
88 return EINA_FALSE;
89 screen = 0;
90}
91