summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2012-07-27 17:01:30 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2012-07-27 17:01:30 +0900
commit1d514bb31a4ceedbf432f2a5b185e929e0d85a88 (patch)
treef3586b0ab3f2d0614102ea7ab9bc7068ea692e23
parent18047243bf3b564d56049e7d7955f13922818ddd (diff)
downloadecore-1d514bb31a4ceedbf432f2a5b185e929e0d85a88.tar.gz
ecore-1d514bb31a4ceedbf432f2a5b185e929e0d85a88.tar.bz2
ecore-1d514bb31a4ceedbf432f2a5b185e929e0d85a88.zip
Revert "Upstream merge"
This reverts commit fd1621ca03ea335f8a5bf0a08c37923836f68b8d, reversing changes made to c8860c078c350417bfe9254689a468ed5ac0c5e9. Conflicts: packaging/ecore.spec src/lib/ecore_x/Ecore_X.h
-rw-r--r--AUTHORS2
-rw-r--r--ChangeLog135
-rw-r--r--NEWS38
-rw-r--r--README5
-rw-r--r--configure.ac55
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/examples.dox163
-rw-r--r--ecore.pc.in2
-rw-r--r--m4/ecore_check_options.m44
-rw-r--r--m4/efl_compiler.m456
-rw-r--r--packaging/ecore.spec6
-rw-r--r--po/cs.po60
-rw-r--r--po/de.po60
-rw-r--r--po/el.po60
-rw-r--r--po/fr.po60
-rw-r--r--po/it.po60
-rw-r--r--po/nl.po60
-rw-r--r--po/pt.po60
-rw-r--r--po/sl.po60
-rw-r--r--src/examples/Makefile.am8
-rw-r--r--src/examples/ecore_exe_example.c93
-rw-r--r--src/examples/ecore_exe_example_child.c57
-rw-r--r--src/examples/ecore_imf_example.c562
-rw-r--r--src/lib/ecore/Ecore.h20
-rw-r--r--src/lib/ecore/ecore.c30
-rw-r--r--src/lib/ecore/ecore_alloc.c2
-rw-r--r--src/lib/ecore/ecore_anim.c22
-rw-r--r--src/lib/ecore/ecore_exe.c4
-rw-r--r--src/lib/ecore/ecore_main.c5
-rw-r--r--src/lib/ecore/ecore_private.h2
-rw-r--r--src/lib/ecore/ecore_signal.c17
-rw-r--r--src/lib/ecore/ecore_thread.c1027
-rw-r--r--src/lib/ecore_con/Ecore_Con.h7
-rw-r--r--src/lib/ecore_con/Makefile.am11
-rw-r--r--src/lib/ecore_con/dns.c7873
-rw-r--r--src/lib/ecore_con/dns.h1074
-rw-r--r--src/lib/ecore_con/ecore_con.c6
-rw-r--r--src/lib/ecore_con/ecore_con_alloc.c2
-rw-r--r--src/lib/ecore_con/ecore_con_dns.c340
-rw-r--r--src/lib/ecore_con/ecore_con_local.c5
-rw-r--r--src/lib/ecore_con/ecore_con_private.h2
-rw-r--r--src/lib/ecore_con/ecore_con_socks.c2
-rw-r--r--src/lib/ecore_directfb/Ecore_DirectFB.h4
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h2
-rw-r--r--src/lib/ecore_evas/ecore_evas.c3
-rw-r--r--src/lib/ecore_evas/ecore_evas_directfb.c1
-rw-r--r--src/lib/ecore_evas/ecore_evas_fb.c2
-rw-r--r--src/lib/ecore_evas/ecore_evas_wayland_egl.c126
-rw-r--r--src/lib/ecore_evas/ecore_evas_wayland_shm.c189
-rw-r--r--src/lib/ecore_evas/ecore_evas_win32.c79
-rw-r--r--src/lib/ecore_evas/ecore_evas_x.c41
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c4
-rw-r--r--src/lib/ecore_imf/ecore_imf_context.c5
-rw-r--r--src/lib/ecore_imf_evas/ecore_imf_evas.c4
-rw-r--r--src/lib/ecore_ipc/Ecore_Ipc.h5
-rw-r--r--src/lib/ecore_ipc/Makefile.am9
-rw-r--r--src/lib/ecore_ipc/ecore_ipc.c42
-rw-r--r--src/lib/ecore_ipc/ecore_ipc_private.h4
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h42
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c60
-rw-r--r--src/lib/ecore_wayland/ecore_wl_dnd.c16
-rw-r--r--src/lib/ecore_wayland/ecore_wl_input.c473
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h2
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c149
-rw-r--r--src/lib/ecore_win32/Makefile.am4
-rw-r--r--src/lib/ecore_win32/ecore_win32_cursor.c7
-rw-r--r--src/lib/ecore_x/Ecore_X.h3072
-rw-r--r--src/lib/ecore_x/Ecore_X_Atoms.h7
-rw-r--r--src/lib/ecore_x/ecore_x_atoms_decl.h285
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb.c106
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_atoms.c15
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_e.c72
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_randr.c83
-rw-r--r--src/lib/ecore_x/xlib/ecore_x.c79
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_atoms.c13
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_e.c66
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_events.c4
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_private.h1
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_randr_11.c9
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_randr_12.c23
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_test.c4
-rw-r--r--src/modules/immodules/Makefile.am4
-rw-r--r--src/modules/immodules/ibus/Makefile.am36
-rw-r--r--src/modules/immodules/ibus/ibus_imcontext.c727
-rw-r--r--src/modules/immodules/ibus/ibus_imcontext.h36
-rw-r--r--src/modules/immodules/ibus/ibus_module.c97
-rw-r--r--src/modules/immodules/scim/scim_imcontext.cpp6
-rw-r--r--src/modules/immodules/xim/ecore_imf_xim.c129
-rw-r--r--src/tests/ecore_test_ecore.c9
-rw-r--r--src/tests/ecore_test_ecore_x.c2
90 files changed, 3577 insertions, 14700 deletions
diff --git a/AUTHORS b/AUTHORS
index f5314623..3db7a4b2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -42,7 +42,7 @@ Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
PnB <Poor.NewBie@gmail.com>
Daniel Juyung Seo <seojuyung2@gmail.com> <juyung.seo@samsung.com>
Christopher 'devilhorns' Michael <cpmichael1@comcast.net>
-ChunEon Park (Hermet) <hermet@hermet.pe.kr>
+ChunEon Park <hermet@hermet.pe.kr>
xlopez@igalia.com
Rafael Antognolli <antognolli@profusion.mobi>
Kim Yunhan <spbear@gmail.com>
diff --git a/ChangeLog b/ChangeLog
index 04a1a35f..03de1edf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -621,141 +621,6 @@
* Add override_set() support in ecore_evas_win32.
-2012-04-26 Carsten Haitzler (The Rasterman)
-
- 1.2.0 release
-
-2012-05-08 Cedric Bail
-
- * Don't over allocate Ecore_Pipe during ecore_init/ecore_shutdown.
-
-2012-05-10 Cedric Bail
-
- * Reduce rounding error in ecore_animator_pos_map.
-
2012-05-10 Jiyoun Park
* Send mouse move event before mouse down event in ecore_extn
-
-2012-05-13 Carsten Haitzler (The Rasterman)
-
- * Fix ecore-x randr issues with memory access when building
- output arrays which are memory segv bugs waiting to crash.
-
-2012-05-17 Vincent Torri
-
- * Add transparent support in ecore_evas on Windows (GDI engine only)
-
-2012-05-22 Cedric Bail
-
- * Reduce race condition on Ecore_Thread shutdown.
-
-2012-05-22 Carsten Haitzler (The Rasterman)
-
- * Add ecore_x_mouse_in_send() and ecore_x_mouse_out_send()
- * Add ecore_x illume access control/action atoms+api's
-
-2012-05-24 Doyoun Kang
-
- * Add Ecore_X_Error_Code enumeration in ecore_x
-
-2012-05-24 Carsten Haitzler (The Rasterman)
-
- * Fix ecore-thread scheduling issue where re-scheduled threads
- will hold a loop busy and not allow feedback workers to run,
- so now have fairer scheduling.
- * Allow 16 * cpu num for worker threads (default still cpu num)
-
-2012-05-25 Carsten Haitzler (The Rasterman)
-
- * Fix ecore mainloop issue if you begin the mainloop, keep a
- timer around, quit mainloop, then start it again expecting the timer
- to keep ticking off. also happens to be an issue with
- iterating the mainloop.
-
-2012-05-25 Rob Bradford
-
- * Make ecore_{software_x11, software_x11_8, software_x11_16, wayland,
- directfb}_window_get return 0 if the Ecore_Evas was not created with
- the appropriate constructor.
-
-2012-05-29 Rob Bradford
-
- * Initial cursor support for Wayland:
- * Add api to the ecore_wl_input_ namespace to allow setting the buffer
- to use for the pointer and for loading a named cursor from a cursor
- theme. Under the Wayland protocol the cursor is associated with the
- input device.
- * Add helper functions to ecore_wl_window to set the cursor based on
- the active pointer input device for the window.
- * Load the cursor theme when the SHM interface is ready and provide an
- API call to provide a wl_cursor for a given name.
- * Add API to restore to the default cursor and then use that when the
- pointer enters the surface to ensure compliance with the Wayland
- protocol.
-
-2012-05-30 Cedric Bail
-
- * Force cancel of all running Ecore_Thread on shutdown.
- * Make Ecore_Thread work reliabily when main loop isn't running.
-
-2012-05-30 Mariusz Grzegorczyk
-
- * Small fix to ecore-evas buffer engine on resize to make the
- right kind of buffer cavas (ARGB32 vs RGB32).
-
-2012-05-30 Leif Middelschulte (T_UNIX)
-
- * Add ECORE_X_RANDR_OUTPUT_POLICY_ASK
-
-2012-06-04 Mike Blumenkrantz
-
- * ECORE_{CON,IPC}_NO_PROXY now available for disabling proxying on certain connections
- * Added new resolver method: dns.c -- This is used by default now when ipv6 is enabled
- and c-ares support is disabled.
-
-2012-06-06 Rob Bradford
-
- * Ecore_Wayland: Enhance the keyboard input handling
- * Associate the keymap with the input device rather than the display
- since you could could have different keymaps associated with different
- devices.
- * Increase the size of character arrays used for the string
- representations of the keyname, keysym and for the string
- representing the key.
- * Re-enable the code that converts the keysym to a printable definition
- - this is required where the keysym is not the same as the printable
- definition
-
-2012-06-06 Rob Bradford
-
- * Ecore_Wayland: Update to protocol change - axis events are now fixed point numbers
-
-2012-06-11 Rob Bradford
-
- * Ecore_Wayland: Add missing null pointer checks on input device
- deletion (ticket #1031). Not all devices are keyboards.
-
-2012-06-11 Jihoon Kim (jihoon)
-
- * ibus-immodule: Add immodule for supporting ibus.
-
-2012-06-12 Mike Blumenkrantz
-
- * Fixed bug in ecore-file monitoring with inotify where watching a file
- that was deleted broke the world.
-
-2012-06-15 Rob Bradford
-
- * Ecore_Wayland: Port to latest Wayland protocol. The cursor for a
- pointer is now a surface rather than a buffer.
-
-2012-06-15 Rob Bradford
-
- * Ecore_Wayland: Drop unused timestamp from configure event. Rationale:
- - timestamp isn't used by the handler for this event
- - configure event we receive from the compositor doesn't have a timestamp
- - ecore_wl_window_maximized_set and ecore_wl_window_fullscreen_set had
- an implicit requirement that the window had keyboard focus to retrieve
- a timestamp that wasn't used. This removes that requirement and fixes
- ticket #1030.
diff --git a/NEWS b/NEWS
index 54bd6444..ab0ba68e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,30 +1,12 @@
Ecore 1.3.0
Changes since Ecore 1.2.0:
---------------------------
-
-Additions:
- * ecore_evas:
- - Add transparency support on Windows (GDI engine only)
- * ecore_x:
- - Add Ecore_X_Error_Code enumeration
- * ecore_x:
- - ECORE_X_RANDR_OUTPUT_POLICY_ASK
- * ecore_con:
- - ECORE_{CON,IPC}_NO_PROXY now available for disabling proxying on certain connections
- - New dns.c resolver backend for faster dns lookups
- * immodule:
- - Add immodule for supporing ibus
Fixes:
* ecore
- Prevent running out of fd when cycling ecore_init/ecore_shutdown.
- Reduce rounding error in ecore_animator_pos_map.
- Send mouse move event before mouse down event in ecore_extn
- - Reduce race condition on shutdown of Ecore_Thread.
- - Force cancel of all running Ecore_Thread on shutdown.
- - Make Ecore_Thread work reliably when called without a running main loop.
-
Ecore 1.2.0
@@ -56,16 +38,6 @@ Additions:
- ecore_x_randr_output_mode_del()
- Add indicator controls
- ecore_x_netwm_icons_set()
- - ecore_x_illume_clipboard_state_set()
- - ecore_x_illume_clipboard_state_get()
- - ecore_x_illume_clipboard_geometry_set()
- - ecore_x_illume_clipboard_geometry_get()
- - Add indicator rotation and transparency controls
- * ecore_evas:
- - Add Shm and Egl engines for ecore_evas to draw in Wayland.
- - Add Socket and Plug to draw other process area.
- - Ability to set pointer for wayland support
- - Add override_set support on Windows XP
- ecore_evas_window_group_set()
- ecore_evas_window_group_get()
- ecore_evas_aspect_set()
@@ -79,6 +51,16 @@ Additions:
- ecore_evas_focus_skip_set()
- ecore_evas_focus_skip_get()
- ecore_evas_callback_state_change_set()
+ - ecore_x_illume_clipboard_state_set()
+ - ecore_x_illume_clipboard_state_get()
+ - ecore_x_illume_clipboard_geometry_set()
+ - ecore_x_illume_clipboard_geometry_get()
+ - Add indicator rotation and transparency controls
+ * ecore_evas:
+ - Add Shm and Egl engines for ecore_evas to draw in Wayland.
+ - Add Socket and Plug to draw other process area.
+ - Ability to set pointer for wayland support
+ - Add override_set support on Windows XP
* ecore_wayland
- Add Ecore_Wayland (backend to support Wayland).
* ecore_imf
diff --git a/README b/README
index ef984514..c9025282 100644
--- a/README
+++ b/README
@@ -91,8 +91,3 @@ doesn't use an asynchronous dns resolver. Since Curl 7.21.0, you can use the
native dns resolver asynchronously by turning --enable-threaded-resolver
on during configure time. For older version, C-Ares is the way to solve that
issue (see: http://c-ares.haxx.se/ ).
-
-Also the wayland support (ecore_wayland) is considered experimental as
-wayland itself is still unstable and liable to change core protocol.
-If you use this api, it is possible it will break in future, until this
-notice is removed.
diff --git a/configure.ac b/configure.ac
index 115e75f0..827cf7d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,11 +2,11 @@
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [1])
m4_define([v_min], [2])
-m4_define([v_mic], [99])
+m4_define([v_mic], [0])
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n' | sed 's/Unversioneddirectory/0/' | tr -d '\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
##-- When released, remove the dnl on the below line
-dnl m4_undefine([v_rev])
+m4_undefine([v_rev])
##-- When doing snapshots - change soname. remove dnl on below line
dnl m4_define([relname], [ver-pre-svn-07])
dnl m4_define([v_rel], [-release relname])
@@ -18,7 +18,7 @@ m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-AC_INIT([ecore], [v_ver], [enlightenment-devel@lists.sourceforge.net])
+AC_INIT([ecore], [v_ver]-beta, [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ([2.52])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
@@ -58,7 +58,9 @@ AC_SUBST(release_info)
VMAJ=v_maj
AC_SUBST(VMAJ)
-AM_GNU_GETTEXT_VERSION(0.17)
+m4_ifdef([AM_GNU_GETTEXT_VERSION], [
+AM_GNU_GETTEXT_VERSION([0.17])
+])
m4_ifdef([AM_GNU_GETTEXT], [
AM_GNU_GETTEXT([external])
@@ -179,7 +181,6 @@ want_ecore_evas_wayland_egl="no"
# ecore_imf modules
want_ecore_imf_xim="no"
want_ecore_imf_scim="no"
-want_ecore_imf_ibus="no"
case "$host_os" in
mingw32ce*)
@@ -244,7 +245,6 @@ case "$host_os" in
want_ecore_evas_wayland_egl="yes"
want_ecore_imf_xim="yes"
want_ecore_imf_scim="yes"
- want_ecore_imf_ibus="yes"
;;
esac
@@ -273,7 +273,6 @@ requirements_ecore_win32=""
requirements_ecore_wince=""
requirements_ecore_imf_xim=""
requirements_ecore_imf_scim=""
-requirements_ecore_imf_ibus=""
requirements_ecore_wayland=""
### Additional options to configure
@@ -373,10 +372,7 @@ m4_ifndef([am__fastdepOBJC], [
])
AC_PROG_CXX
-AC_PROG_CC_C99
-if test "x${ac_cv_prog_cc_c99}" = "xno" ; then
- AC_MSG_ERROR([ecore requires a c99-capable compiler])
-fi
+AC_PROG_CC
have_gnu_objc=${ac_cv_objc_compiler_gnu}
@@ -1248,7 +1244,7 @@ AC_CHECK_HEADERS([net/if.h], [], [],
# include <sys/socket.h>
#endif
])
-AC_CHECK_HEADERS([sys/un.h arpa/inet.h arpa/nameser.h netinet/tcp.h netinet/in.h ws2tcpip.h netdb.h errno.h])
+AC_CHECK_HEADERS([sys/un.h arpa/inet.h arpa/nameser.h netinet/tcp.h netinet/in.h ws2tcpip.h netdb.h])
if test "x${ac_cv_header_netdb_h}" = "xyes" ; then
have_addrinfo="yes"
@@ -1494,7 +1490,6 @@ if test "x${have_ecore_con}" = "xyes" ; then
if test "x${have_ipv6}" = "xyes" ; then
AC_DEFINE(HAVE_IPV6, 1, [Define if IPV6 is supported])
fi
- AM_CONDITIONAL([HAVE_IPV6], [test "x${have_ipv6}" = "xyes"])
ECORE_CHECK_CURL([${want_curl}],
[
@@ -1532,8 +1527,6 @@ if test "x${have_ecore_con}" = "xyes" ; then
fi
-EFL_CHECK_COMPILER_FLAGS([ECORE_CON], [-Wno-override-init -Wno-initializer-overrides])
-
AM_CONDITIONAL([HAVE_CARES], [test "x${have_cares}" = "xyes"])
# ecore_ipc
@@ -1627,23 +1620,6 @@ fi
ECORE_CHECK_MODULE([imf-scim], [${want_ecore_imf}], [Imf_SCIM], [${ecore_imf_scim_deps}],
[requirements_ecore_imf_scim="ecore-imf >= 1.2.0 ecore-x >= 1.2.0 ecore-input >= 1.2.0 ${requirements_ecore_imf_scim}"])
-# ecore_imf_ibus
-PKG_CHECK_MODULES([IBUS], [ibus-1.0 >= 1.3.99], [have_ibus="yes"], [have_ibus="no"])
-
-AM_CONDITIONAL(BUILD_ECORE_IMF_IBUS, false)
-ecore_imf_ibus_deps="no"
-echo "have_ecore_x_xlib: ${have_ecore_x_xlib}"
-if test "x${have_ecore_imf}" = "xyes" \
- -a "x${have_glib}" = "xyes" \
- -a "x${have_ibus}" = "xyes" \
- -a "x${have_ecore_input}" = "xyes" ; then
- ecore_imf_ibus_deps="yes"
- AC_DEFINE(BUILD_ECORE_IMF_IBUS, 1, [Ecore Imf IBUS Support])
-fi
-
-ECORE_CHECK_MODULE([imf-ibus], [${want_ecore_imf}], [Imf_IBUS], [${ecore_imf_ibus_deps}],
- [requirements_ecore_imf_ibus="ecore-imf >= 1.2.0 ecore-x >= 1.2.0 ecore-input >= 1.2.0 ${requirements_ecore_imf_ibus}"])
-
## Graphic systems
# ecore_x{cb}
@@ -1941,7 +1917,7 @@ ECORE_EVAS_CHECK_MODULE([psl1ght],
ecore_wayland_deps="no"
have_wayland="no"
if test "x${want_ecore_wayland}" = "xyes" ; then
- PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-cursor xkbcommon], [have_wayland="yes"], [have_wayland="no"])
+ PKG_CHECK_MODULES([WAYLAND], [wayland-client xkbcommon], [have_wayland="yes"], [have_wayland="no"])
fi
if test "x${have_ecore_input}" = "xyes" -a "x${have_wayland}" = "xyes" ; then
ecore_wayland_deps="yes"
@@ -2000,7 +1976,6 @@ AC_SUBST(requirements_ecore_win32)
AC_SUBST(requirements_ecore_wince)
AC_SUBST(requirements_ecore_imf_xim)
AC_SUBST(requirements_ecore_imf_scim)
-AC_SUBST(requirements_ecore_imf_ibus)
AC_SUBST(requirements_ecore_wayland)
AC_CONFIG_FILES([
@@ -2058,7 +2033,6 @@ src/modules/Makefile
src/modules/immodules/Makefile
src/modules/immodules/xim/Makefile
src/modules/immodules/scim/Makefile
-src/modules/immodules/ibus/Makefile
ecore.spec
$po_makefile_in
])
@@ -2095,13 +2069,7 @@ fi
if test "x$want_ecore_con_local_sockets" = "xyes" ; then
echo " Abstract Sockets.........: $want_ecore_con_abstract_sockets"
fi
-if test "x$have_cares" = "xyes" ; then
- echo " Resolver...................: c-ares"
-elif test "x$have_ipv6" = "xyes" ; then
- echo " Resolver...................: dns.c"
-else
- echo " Resolver...................: fork"
-fi
+ echo " c-ares.....................: $have_cares"
fi
echo " Ecore_Ipc....................: $have_ecore_ipc"
if test "x$have_ecore_ipc" = "xyes" ; then
@@ -2124,7 +2092,6 @@ fi
echo " Ecore_IMF....................: $have_ecore_imf"
echo " XIM........................: $have_ecore_imf_xim"
echo " SCIM.......................: $have_ecore_imf_scim"
-echo " IBUS.......................: $have_ecore_imf_ibus"
echo " Ecore_IMF_Evas...............: $have_ecore_imf_evas"
echo " Ecore_Input..................: $have_ecore_input"
echo " Ecore_Input_Evas.............: $have_ecore_input_evas"
@@ -2222,8 +2189,6 @@ echo
echo " Tests................: ${enable_tests}"
echo " Maximum log level....: ${with_max_log_level}"
echo "Documentation..........: ${build_doc}"
-echo "Examples...............: ${enable_build_examples}"
-echo "Examples installed.....: ${enable_install_examples}"
echo
echo "Compilation............: make (or gmake)"
echo " CPPFLAGS.............: $CPPFLAGS"
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8bffa144..09ce976b 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -30,4 +30,4 @@ doc:
endif
-EXTRA_DIST = Doxyfile.in $(wildcard img/*.*) e.css head.html foot.html ecore.dox.in examples.dox
+EXTRA_DIST = Doxyfile.in $(wildcard img/*.*) e.css head.html foot.html ecore.dox.in
diff --git a/doc/examples.dox b/doc/examples.dox
index cc7ec9d0..5ee08a9d 100644
--- a/doc/examples.dox
+++ b/doc/examples.dox
@@ -21,8 +21,6 @@
* @li @ref Ecore_Evas_Window_Sizes_Example_c
* @li @ref Ecore_Evas_Buffer_Example_01_c
* @li @ref Ecore_Evas_Buffer_Example_02_c
- * @li @ref Ecore_exe_simple_example_c
- * @li @ref ecore_imf_example_c
*/
/**
@@ -917,20 +915,6 @@
*/
/**
- * @example ecore_exe_example_child.c
- * This is a child process used to receive messages and send it back
- * to its father.
- * Check the @ref Ecore_exe_simple_example_c "Full tutorial"
- */
-
-/**
- * @example ecore_exe_example.c
- * This is a process that will send messages to a child and it will stop
- * when it receives "quit".
- * Check the @ref Ecore_exe_simple_example_c "Full tutorial"
- */
-
-/**
* @example ecore_fd_handler_example.c
* This example shows how to setup and use an fd_handler. See
* @ref ecore_fd_handler_example_c "the explanation here".
@@ -1543,150 +1527,3 @@
* @include ecore_evas_buffer_example_02.c
* @example ecore_evas_buffer_example_02.c
*/
-
-/**
- * @page Ecore_exe_simple_example_c Ecore_exe
- * Creating a processes and IPC (Inter process communication)
- *
- * In this example we will show how to create a new process and communicate
- * with it in a portable way using the Ecore_exe module.
- *
- * In this example we will have two process and both will communicate with each
- * other using messages. A father process will start a child process and it will
- * keep sending messages to the child until it receives a message to quit.
- * To see the full source use the links:
- * @li @ref ecore_exe_example.c "Father"
- * @li @ref ecore_exe_example_child.c "Child"
- *
- * Let's start the tutorial. The implementation of the child it's pretty simple.
- * We just read strings from stdin and write a message in the stdout. But you
- * should be asking yourself right know. "If I'm receiving data from an other
- * process why I'm reading and writing in stdin/stdout?". That's because, when
- * you spawn a process using the Ecore_Exe module it will create a pipe between
- * the father and the child process and the stdin/stdout of the child process
- * will be redirected to the pipe. So when the child wants to receive or send
- * data to the father, just use the stdin/stdout.
- * However the steps to send data from the father to the child is quite
- * different, but we will get there.
- *
- * The child will register a fd handler to monitor the stdin.
- * So we start registering the ecore FD handler:
- * @dontinclude ecore_exe_example_child.c
- * @skip ecore_main_fd_handler_add
- * @until ;
- *
- * If you don't remenber the parameters of @ref ecore_main_fd_handler_add,
- * please check its documentation.
- *
- * Now that we have our handler registered we will start the ecore's main loop:
- * @skipline ecore_main_loop_begin
- *
- * Now let's take a look in the callback function. Its a simple function
- * that will read from stdin 3 times and at the third time will say
- * to the father: "quit".
- * @dontinclude ecore_exe_example_child.c
- * @skip static Eina_Bool
- * @until }
- * @until }
- * @until }
- * @until }
- *
- * You may notice that we are sending the messages to stdout, and our father
- * will receive it. Also our string must have a "\n" because the string will
- * be buffered in the pipe until it finds EOF or a "newline" in our case we
- * won't have a EOF unless we close the pipe, so we use the "\n" char.
- *
- * One more thing, we use fflush(stdout) because probably our message won't
- * fill our entire buffer and the father would never receive the message. So we
- * use this function to flush the buffer and the father can receive as fast as
- * possible.
- *
- * Now that we have our child ready, let's start our work in the father's source
- * code.
- *
- * We start creating the child process like this:
- * @dontinclude ecore_exe_example.c
- * @skip childHandle = ecore_exe_pipe_run
- * @until ;
- *
- * With the command above we are creating our child process, the first
- * parameter is the command to be executed, the second are the pipe flags and
- * in our case we will write and read in the pipe so we must say what we are
- * doing in the pipe. You may notice the flag ECORE_EXE_PIPE_READ_LINE_BUFFERED,
- * this means that reads are buffered until I find a newline. And the third
- * parameter is data that we would like to send to the process in its creating.
- * This case we are sending nothing, so just use NULL.
- *
- * Then we check if the process was created:
- * @skip if
- * @until }
- *
- * After this we get the PID of the child process and just print it in the screen.
- * The PID stands for Process identification. This is just an internal
- * identifier of your process:
- *
- * @skip childPid
- * @until fprintf
- * @until fprintf
- *
- * The way that Ecore_exe works is: when we want to read data sent from
- * our child we must use an ecore event.
- * So let's start register our event listener:
- * @skipline ecore_event_handler_add
- *
- * Now to send messages to our child we will use a timer, so every 1 second we
- * will send a message to the child.
- * @skipline ecore_timer_add
- *
- * After all this we start the main loop. Now let's pass to the callback
- * functions.
- *
- * Now we will see how we actually send the data and receive it.
- * Let's start with _sendMessage:
- * @dontinclude ecore_exe_example.c
- * @skip _sendMessage(void *data)
- * @until }
- *
- * We use ecore_exe_send to send data to the child process, it's pretty simple.
- * To know what the parameters stands for, check the docs.
- *
- * @note The function @b ecore_exe_send will never block your program, also
- * there is no partial send of the data. This means either the function will
- * send all the data or it will fail.
- *
- * Now let's take a look in our event callback and see how we retrieve the
- * messages.
- * @dontinclude ecore_exe_example.c
- * @skip static Eina_Bool
- * @until }
- * @until }
- *
- * It's just like an normal event, we get a reference to Ecore_Exe_Event_Data,
- * extract the data and then show it in the screen.
- *
- * And that's it, after all it's not complicated to create a process and
- * communicate with it.
- *
- */
-
-/**
- * @page ecore_imf_example_c ecore_imf - How to handle preedit and commit string from Input Method Framework
- *
- * This example demonstrates how to connect input method framework and handle preedit and commit string from input method framework.
- *
- * To input Chinese, Japanese, Korean and other complex languages, the editor should be connected with input method framework.
- *
- * How to initialize and shutdown ecore imf module
- * @li ecore_imf_init() should be called to initialize and load immodule.
- * @li ecore_imf_shutdown() is used for shutdowning and unloading immodule.
- *
- * How to create input context and register pre-edit and commit event handler
- *
- * Each entry should have each input context to connect with input service framework.
- * Key event is processed by input method engine.
- * The result is notified to application through ECORE_IMF_CALLBACK_PREEDIT_CHANGED and ECORE_IMF_CALLBACK_COMMIT event.
- *
- * The full example follows.
- *
- * @include ecore_imf_example.c
- */
diff --git a/ecore.pc.in b/ecore.pc.in
index db67e7a7..65c5a119 100644
--- a/ecore.pc.in
+++ b/ecore.pc.in
@@ -9,4 +9,4 @@ Description: Ecore event abstraction library
Version: @VERSION@
Libs: -L${libdir} -lecore @EINA_LIBS@
Libs.private: -lm
-Cflags: -I${includedir}/ecore-@VMAJ@
+Cflags: -I${includedir}/ecore-@VMAJ@ @EINA_CFLAGS@
diff --git a/m4/ecore_check_options.m4 b/m4/ecore_check_options.m4
index d20adcae..fb7031a1 100644
--- a/m4/ecore_check_options.m4
+++ b/m4/ecore_check_options.m4
@@ -178,8 +178,8 @@ if test "x${_ecore_want_gnutls}" = "xyes" -o "x${_ecore_want_gnutls}" = "xauto"
if test "x$_ecore_have_gnutls" = "xyes";then
AC_PATH_GENERIC([libgcrypt], [], [_ecore_have_gnutls="yes"], [_ecore_have_gnutls="no"])
if test "x${_ecore_have_gnutls}" = "xyes" ; then
- TLS_CFLAGS="${TLS_CFLAGS} ${LIBGCRYPT_CFLAGS}"
- TLS_LIBS="${TLS_LIBS} ${LIBGCRYPT_LIBS}"
+ TLS_CFLAGS+=" ${LIBGCRYPT_CFLAGS}"
+ TLS_LIBS+=" ${LIBGCRYPT_LIBS}"
fi
fi
diff --git a/m4/efl_compiler.m4 b/m4/efl_compiler.m4
deleted file mode 100644
index 5f17be49..00000000
--- a/m4/efl_compiler.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
-dnl This code is public domain and can be freely used or copied.
-
-dnl Macro that check if compiler of linker flags are available
-
-
-dnl Macro that checks for a compiler flag availability
-dnl
-dnl EFL_CHECK_COMPILER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
-dnl AC_SUBST : EFL_CFLAGS (EFL being replaced by its value)
-dnl AM_CONDITIONAL : EFL_HAVE_FLAG (FLAG being replaced by its value)
-
-AC_DEFUN([EFL_CHECK_COMPILER_FLAG],
-[
-m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
-m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
-
-dnl store in options -Wfoo if -Wno-foo is passed
-option=m4_bpatsubst([[$2]], [-Wno-], [-W])
-
-CFLAGS_save="${CFLAGS}"
-CFLAGS="${CFLAGS} ${option}"
-
-AC_LANG_PUSH([C])
-AC_MSG_CHECKING([whether the compiler supports $2])
-
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]])],
- [have_flag="yes"],
- [have_flag="no"])
-AC_MSG_RESULT([${have_flag}])
-
-CFLAGS="${CFLAGS_save}"
-AC_LANG_POP([C])
-
-if test "x${have_flag}" = "xyes" ; then
- UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]"
-fi
-AC_ARG_VAR(UPEFL[_CFLAGS], [preprocessor flags for $2])
-AC_SUBST(UPEFL[_CFLAGS])
-
-AM_CONDITIONAL([EFL_HAVE]UP, [test "x${have_flag}" = "xyes"])
-
-m4_popdef([UP])
-m4_popdef([UPEFL])
-])
-
-dnl Macro that iterates over a sequence of white separated flags
-dnl and that call EFL_CHECK_COMPILER_FLAG() for each of these flags
-dnl
-dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
-
-AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
-[
-m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
-])
diff --git a/packaging/ecore.spec b/packaging/ecore.spec
index d2d3cc21..b9a1293a 100644
--- a/packaging/ecore.spec
+++ b/packaging/ecore.spec
@@ -1,14 +1,13 @@
Name: ecore
Summary: Enlightened Core X interface library
-Version: 1.2.0+svn.72988slp2+build02
-Release: 1
+Version: 1.2.0+svn.70444slp2+build05
+Release: 2
Group: System/Libraries
License: BSD
URL: http://www.enlightenment.org
Source0: %{name}-%{version}.tar.gz
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
-BuildRequires: gettext
BuildRequires: eina-devel
BuildRequires: eet-devel
BuildRequires: evas-devel
@@ -246,7 +245,6 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_libdir}/libecore.so.*
-/usr/share/locale/*
%files devel
%defattr(-,root,root,-)
diff --git a/po/cs.po b/po/cs.po
index 5c7544cf..3bfe5ae0 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2011-10-23 01:28+0100\n"
"Last-Translator: Daniel Kolesa <quaker66@gmail.com>\n"
"Language-Team: Czech <kde-i18n-doc@kde.org>\n"
@@ -50,122 +50,122 @@ msgstr "Možnosti: "
msgid "Options:\n"
msgstr "Volby:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "CHYBA: neznámá volba --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "CHYBA: neznámá volba -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "CHYBA: "
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "hodnota nemá nastaven pointer.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "neznámá boolean hodnota %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "neznámý číselný formát %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "neznámá volba \"%s\". Možné hodnoty jsou: "
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "chybějící parametr k připojení.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "nemůžu parsovat hodnotu.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "chybějící parametr.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "chybějící callback funkce!\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "nebyla definována verze.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "nebyl definován copyright.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "nebyla definována licence.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "CHYBA: neznámá volba --%s, ignoruji.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "CHYBA: volba --%s vyžaduje argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "CHYBA: neznámá volba -%c, ignoruji.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "CHYBA: volba -%c vyžaduje argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "CHYBA: nebyl poskytnut parser.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "CHYBA: nebyly poskytnuty hodnoty.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "CHYBA: nebyly poskytnuty argumenty.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "CHYBA: nalezeny neplatné volby."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr " viz. --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr " viz. -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "CHYBA: neplatná hodnota geometrie '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "CHYBA: neplatná hodnota velikosti '%s'\n"
diff --git a/po/de.po b/po/de.po
index a61c4256..fbcecb39 100644
--- a/po/de.po
+++ b/po/de.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ecore 0.9.9.063-2\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2010-01-03 21:52+GMT\n"
"Last-Translator: Fabian Nowak <timystery@arcor.de>\n"
"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
@@ -54,122 +54,122 @@ msgstr "Auswahlmöglichkeiten: "
msgid "Options:\n"
msgstr "Optionen:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "FEHLER: Unbekannte Option --%s\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "FEHLER: Unbekannte Option -%c\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "FEHLER: "
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "kein Zeiger auf Wert gesetzt\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "unbekannter boolescher Wert %s\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "ungültiges Zahlenformat %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "ungültige Auswahl \"%s\". Gültige Werte sind: "
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "fehlender Parameter zum Anhängen.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "Wert kann nicht ausgewertet werden.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "fehlender Parameter.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "fehlende Rückruffunktion!\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "es wurde keine Version angegeben.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "es wurde kein Copyright angegeben.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "es wurde keine Lizenz angegeben.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "FEHLER: Unbekannte Option --%s, ignoriert\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "FEHLER: Option --%s benötigt ein Argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "FEHLER: Unbekannte Option -%c, ignoriert\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "FEHLER: Option -%c benötigt ein Argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "FEHLER: Kein Parser bereitgestellt.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "FEHLER: Keine Werte bereitgestellt.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "FEHLER: Keine Argumente bereitgestellt.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "FEHLER: Ungültige Optionen gefunden."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr " Siehe --%s\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr " Siehe -%c\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "FEHLER: Falscher Geometriewert \"%s\"\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "FEHLER: Falscher Größenwert \"%s\"\n"
diff --git a/po/el.po b/po/el.po
index a9625f04..b7c4ec5a 100644
--- a/po/el.po
+++ b/po/el.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2011-11-20 22:42+0200\n"
"Last-Translator: George Rizopoulos <george.rizopoulos.1@gmail.com>\n"
"Language-Team: Greek\n"
@@ -52,123 +52,123 @@ msgstr "Επιλογές:"
msgid "Options:\n"
msgstr "Επιλογές:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "ΣΦΑΛΜΑ:"
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "η τιμή δεν έχει δείκτη ορισμένο.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "άγνωστη τιμή boolean %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "άγνωστη μορφή αριθμού %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "μη έγκυρη επιλογή \"%s\". Οι έγκυρες τιμές είναι: "
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "ελλιπής παράμετρος προς επισύναψη.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "αδυναμία ανάλυσης τιμών.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "ελλιπής παράμετρος.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "λείπει η λειτουργία επανάκλησης!\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "δεν έχει οριστεί έκδοση.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "δεν έχουν οριστεί πνευματικά δικαιώματα.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "δεν έχει οριστεί άδεια.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ΣΦΑΛΜΑ:άγνωστη επιλογή --%s, αγνοήθηκε.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ΣΦΑΛΜΑ: η επιλογή --%s απαιτεί παραμέτρους!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή -%c, αγνοήθηκε.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ΣΦAΛΜΑ: η επιλογή -%c απαιτεί μία παράμετρο!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
#, fuzzy
msgid "ERROR: no parser provided.\n"
msgstr "ΣΦΑΛΜΑ:δεν παρέχεται αναλυτής.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "ΣΦΑΛΜΑ:δεν έχουν δοθεί τιμές.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "ΣΦΑΛΜΑ:δεν έχουν δοθεί παράμετροι.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "ΣΦΑΛΜΑ: βρέθηκαν μη έγκυρες επιλογές."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr " Δείτε --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr " Δείτε -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ΣΦΑΛΜΑ: μη έγκυρη γεωμετρική τιμή '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ΣΦΑΛΜΑ: μη έγκυρη τιμή μεγέθους '%s'\n"
diff --git a/po/fr.po b/po/fr.po
index b833447a..80a4f9b3 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2010-07-11 11:01+0400\n"
"Last-Translator: batden <batden@orange.fr>\n"
"Language-Team: Enlightenment French Team <pourunmondesansgourou@gmail.com>\n"
@@ -56,122 +56,122 @@ msgstr "Choix :"
msgid "Options:\n"
msgstr "Options :\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERREUR : option inconnue --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERREUR : option inconnue -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "ERREUR :"
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "la valeur n'a aucun pointeur défini.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valeur booléenne inconnue %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "format du nombre non valide %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "choix non valide « %s ». Les valeurs valides sont : "
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "paramètre manquant à ajouter.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "analyse de la valeur impossible.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "paramètre manquant.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "fonction de rappel manquante !\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "aucune version n'est définie.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "aucun copyright n'est défini.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "aucune licence n'est définie.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERREUR : option inconnue --%s, non prise en compte.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ERREUR : l'option --%s requiert un argument !\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERREUR : option inconnue -%c, non prise en compte.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ERREUR : l'option -%c requiert un argument !\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "ERREUR : aucun analyseur n'est fourni.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "ERREUR : aucune valeur n'est fournie.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "ERREUR : aucun argument n'est fourni.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "ERREUR : options non valides détectées."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr " Voir --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr " Voir -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERREUR : valeur géométrique incorrecte « %s »\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERREUR : valeur de taille incorrecte « %s »\n"
diff --git a/po/it.po b/po/it.po
index 8e1704f7..c5399db5 100644
--- a/po/it.po
+++ b/po/it.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2009-10-27 19:36+0100\n"
"Last-Translator: quaker66 <quaker66@gmail.com>\n"
"Language-Team: none\n"
@@ -52,122 +52,122 @@ msgstr "Scelte:"
msgid "Options:\n"
msgstr "Opzioni:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERRORE: opzione sconosciuta --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERRORE: opzione sconosciuta -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "ERRORE:"
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "il valore non ha puntatori impostati.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valore booleano sconosciuto %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "formato numero non valido %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "scelta non valida \"%s\". I valori ammessi sono: "
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "parametro da appendere mancante.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "impossibile il parsing del valore.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "parametro mancante.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "funzione callback mancante!\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "nessuna versione definita.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "nessun copyright definito.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "nessuna licenza definita.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERRORE: opzione sconosciuta --%s, ignorata.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ERRORE: l'opzione --%s richiede un argomento!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERRORE: opzione sconosciuta -%c, ignorata.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ERRORE: l'opzione -%c richiede un argomento!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "ERRORE: nessun parser fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "ERRORE: nessun valore fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "ERRORE: nessun argomento fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "ERRORE: trovate opzioni non valide."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr " Vedere --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr " Vedere -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERRORE: valore geometrico non corretto '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERRORE: valore dimensione non corretto '%s'\n"
diff --git a/po/nl.po b/po/nl.po
index 406bba50..d8744a33 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2011-09-03 15:48+0100\n"
"Last-Translator: Heimen Stoffels <vistausss@gmail.com>\n"
"Language-Team: <vistausss@gmail.com>\n"
@@ -54,122 +54,122 @@ msgstr "Keuzes:"
msgid "Options:\n"
msgstr "Opties:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "FOUT: onbekende optie --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "FOUT: onbekende optie -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "FOUT:"
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "waarde heeft geen pointer ingsteld.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "onbekende boolean-waarde %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "ongeldig nummerformaat %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "ongeldige keuze \"%s\". Geldige waardes zijn:"
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "parameter om toe te wijzen ontbreekt.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "kon waarde niet doorvoeren.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "paramater ontbreekt.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "ontbrekende terugroep-functie!\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "geen versie was gedefinieerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "geen copyright was gedefinieerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "geen licentie was gedefinieerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "FOUT: onbekende optie --%s, genegeerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "FOUT: optie --%s vereist een argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "FOUT: onbekende opties -%c, genegeerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "FOUT: optie -%c vereist een argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "FOUT: geen doorvoerder beschikbaar gesteld.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "FOUT: geen waarden beschikbaar gesteld.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "FOUT: geen argumenten beschibaar gesteld.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "FOUT: ongeldige opties gevonden."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr "Zie --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr "Zie -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "Fout: foutieve wiskundige waarde '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "FOUT: foutieve grootte-waarden '%s'\n"
diff --git a/po/pt.po b/po/pt.po
index 55d61c02..d2d280a7 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2010-10-06 12:37-0000\n"
"Last-Translator: Sérgio Marques <smarquespt@gmail.com>\n"
"Language-Team: \n"
@@ -55,122 +55,122 @@ msgstr "Escolhas:"
msgid "Options:\n"
msgstr "Opções:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERRO: opção desconhecida --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERRO: opção desconhecida -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "ERRO: "
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "o valor não está definido.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valor booleano desconhecido %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "formato do número inválido %s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "escolha inválida \"%s\". O valores possíveis são:"
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "faltam os parâmetros a anexar.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "incapaz de analisar o valor.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "parâmetro em falta.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "função de chamada em falta!\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "nenhuma versão definida.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "direitos de autor não definidos.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "licença não definida.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERRO: opção desconhecida --%s, ignorada.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ERRO: a opção --%s requer um argumento!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERRO: opção desconhecida --%c, ignorada.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ERRO: a opção --%c requer um argumento!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "ERRO: nenhum analisador fornecido.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "ERRO: nenhum valor fornecido.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "ERRO: nenhum argumento fornecido.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "ERRO: encontradas opções inválidas."
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr " Veja --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr " Veja -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERRO: valor geométrico incorreto \"%s\"\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERRO: tamanho incorreto \"%s\"\n"
diff --git a/po/sl.po b/po/sl.po
index deed11af..83bf651b 100644
--- a/po/sl.po
+++ b/po/sl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ecore 1.0\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2012-04-26 13:55+0900\n"
+"POT-Creation-Date: 2012-04-20 22:25+0900\n"
"PO-Revision-Date: 2011-02-24 16:54+0100\n"
"Last-Translator: r1to <renato.rener@gmail.com>\n"
"Language-Team: Slovenian <sl@li.org>\n"
@@ -54,122 +54,122 @@ msgstr "Izbire:·"
msgid "Options:\n"
msgstr "Možnosti:\n"
-#: src/lib/ecore/ecore_getopt.c:788
+#: src/lib/ecore/ecore_getopt.c:787
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "NAPAKA:·Neznana možnost·--%s.\n"
-#: src/lib/ecore/ecore_getopt.c:790
+#: src/lib/ecore/ecore_getopt.c:789
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "NAPAKA:·neznana možnost·-%c.\n"
-#: src/lib/ecore/ecore_getopt.c:848
+#: src/lib/ecore/ecore_getopt.c:847
msgid "ERROR: "
msgstr "NAPAKA:"
-#: src/lib/ecore/ecore_getopt.c:931 src/lib/ecore/ecore_getopt.c:1068
-#: src/lib/ecore/ecore_getopt.c:1084 src/lib/ecore/ecore_getopt.c:1099
-#: src/lib/ecore/ecore_getopt.c:1116 src/lib/ecore/ecore_getopt.c:1163
-#: src/lib/ecore/ecore_getopt.c:1283 src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1067
+#: src/lib/ecore/ecore_getopt.c:1083 src/lib/ecore/ecore_getopt.c:1098
+#: src/lib/ecore/ecore_getopt.c:1115 src/lib/ecore/ecore_getopt.c:1162
+#: src/lib/ecore/ecore_getopt.c:1282 src/lib/ecore/ecore_getopt.c:1323
msgid "value has no pointer set.\n"
msgstr "vrednost nima nastavljenega kazalnika.\n"
-#: src/lib/ecore/ecore_getopt.c:963 src/lib/ecore/ecore_getopt.c:1183
+#: src/lib/ecore/ecore_getopt.c:962 src/lib/ecore/ecore_getopt.c:1182
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "neznana Boolova vrednost·%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1014 src/lib/ecore/ecore_getopt.c:1271
+#: src/lib/ecore/ecore_getopt.c:1013 src/lib/ecore/ecore_getopt.c:1270
#, c-format
msgid "invalid number format %s\n"
msgstr "napačen·format števila·%s\n"
-#: src/lib/ecore/ecore_getopt.c:1129
+#: src/lib/ecore/ecore_getopt.c:1128
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "napačna izbira·\"%s\".·Pravilne izbire so:·"
-#: src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1156
msgid "missing parameter to append.\n"
msgstr "manjka·parameter·za dodajo.\n"
-#: src/lib/ecore/ecore_getopt.c:1261
+#: src/lib/ecore/ecore_getopt.c:1260
msgid "could not parse value.\n"
msgstr "vrednosti ni bilo možno razčleniti.\n"
-#: src/lib/ecore/ecore_getopt.c:1318
+#: src/lib/ecore/ecore_getopt.c:1317
msgid "missing parameter.\n"
msgstr "manjkajoči·parameter.\n"
-#: src/lib/ecore/ecore_getopt.c:1331
+#: src/lib/ecore/ecore_getopt.c:1330
msgid "missing callback function!\n"
msgstr "manjkajoča povratno-zasilna funkcija !\n"
-#: src/lib/ecore/ecore_getopt.c:1360
+#: src/lib/ecore/ecore_getopt.c:1359
msgid "no version was defined.\n"
msgstr "definirana ni bila nobena različica.\n"
-#: src/lib/ecore/ecore_getopt.c:1377
+#: src/lib/ecore/ecore_getopt.c:1376
msgid "no copyright was defined.\n"
msgstr "definirano ni bilo nobeno avtorstvo.\n"
-#: src/lib/ecore/ecore_getopt.c:1394
+#: src/lib/ecore/ecore_getopt.c:1393
msgid "no license was defined.\n"
msgstr "definirana ni bila nobena licenca.\n"
-#: src/lib/ecore/ecore_getopt.c:1469
+#: src/lib/ecore/ecore_getopt.c:1468
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "NAPAKA:·neznana možnost·--%s,·prezrto.\n"
-#: src/lib/ecore/ecore_getopt.c:1502
+#: src/lib/ecore/ecore_getopt.c:1501
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "NAPAKA:·možnost·--%s·zahteva argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1544
+#: src/lib/ecore/ecore_getopt.c:1543
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "NAPAKA:·neznana možnost·-%c,·prezrto.\n"
-#: src/lib/ecore/ecore_getopt.c:1582
+#: src/lib/ecore/ecore_getopt.c:1581
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "NAPAKA:·možnost·-%c zahteva argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1793
+#: src/lib/ecore/ecore_getopt.c:1791
msgid "ERROR: no parser provided.\n"
msgstr "NAPAKA:·ni podan razčlenjevalnik.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1796
msgid "ERROR: no values provided.\n"
msgstr "NAPAKA::·ni podanih vrednosti.\n"
-#: src/lib/ecore/ecore_getopt.c:1807
+#: src/lib/ecore/ecore_getopt.c:1805
msgid "ERROR: no arguments provided.\n"
msgstr "NAPAKA::·ni podanih argumentov.\n"
-#: src/lib/ecore/ecore_getopt.c:1833
+#: src/lib/ecore/ecore_getopt.c:1831
msgid "ERROR: invalid options found."
msgstr "NAPAKA::·najdene nepravilne možnosti"
-#: src/lib/ecore/ecore_getopt.c:1839
+#: src/lib/ecore/ecore_getopt.c:1837
#, c-format
msgid " See --%s.\n"
msgstr "·Glej·--%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1841
+#: src/lib/ecore/ecore_getopt.c:1839
#, c-format
msgid " See -%c.\n"
msgstr "·Glej·-%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1887
+#: src/lib/ecore/ecore_getopt.c:1882
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "NAPAKA::·nepravilna geometrijska vrednost·'%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1919
+#: src/lib/ecore/ecore_getopt.c:1911
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "NAPAKA::·nepravilna vrednost velikosti·'%s'\n"
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 00ea91df..11f2e492 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -55,9 +55,7 @@ SRCS = \
ecore_evas_basics_example.c \
ecore_evas_buffer_example_01.c \
ecore_evas_buffer_example_02.c \
- ecore_evas_ews_example.c \
- ecore_exe_example.c \
- ecore_exe_example_child.c
+ ecore_evas_ews_example.c
EXTRA_DIST = $(SRCS) \
$(srcdir)/red.png
@@ -97,9 +95,7 @@ examples_PROGRAMS += \
ecore_evas_buffer_example_02 \
ecore_evas_ews_example \
ecore_client_bench \
- ecore_server_bench \
- ecore_exe_example \
- ecore_exe_example_child
+ ecore_server_bench
ecore_con_lookup_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la
ecore_con_url_headers_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la
diff --git a/src/examples/ecore_exe_example.c b/src/examples/ecore_exe_example.c
deleted file mode 100644
index c0a00f72..00000000
--- a/src/examples/ecore_exe_example.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
-Compile with gcc -o ecore_exe_example ecore_exe_example.c `pkg-config --cflags --libs ecore`
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <Ecore.h>
-
-#define BUFFER_SIZE 1024
-
-static Eina_Bool
-_msg_from_child_handler(void *data, int type, void *event)
-{
- Ecore_Exe_Event_Data *dataFromProcess = (Ecore_Exe_Event_Data *)event;
- char *msg = (char *) dataFromProcess->data;
-
- if (strcmp(msg, "quit") == 0)
- {
- fprintf(stdout, "My child said to me, QUIT!\n");
- ecore_main_loop_quit();
- }
- else
- fprintf(stdout, "I received a message from my child: %s\n", msg);
-
- return ECORE_CALLBACK_DONE;
-
-}
-
-static Eina_Bool
-_sendMessage(void *data)
-{
- static int numberOfMessages = 0;
- Ecore_Exe *childHandle = (Ecore_Exe*) data;
- char msg[BUFFER_SIZE];
-
- sprintf(msg, " Message: %d\n", numberOfMessages);
- numberOfMessages++;
-
- if (ecore_exe_send(childHandle, msg, strlen(msg)) != EINA_TRUE)
- fprintf(stderr, "Could not send my name to the child\n");
- else
- fprintf(stdout,
- "I'm the father and I sent this message to the child: %s\n", msg);
-
-
-
- return ECORE_CALLBACK_RENEW;
-}
-
-int
-main(int argc, char **argv)
-{
- pid_t childPid;
- Ecore_Exe *childHandle;
-
- if (!ecore_init())
- goto exit;
-
- childHandle = ecore_exe_pipe_run("./ecore_exe_example_child",
- ECORE_EXE_PIPE_WRITE |
- ECORE_EXE_PIPE_READ_LINE_BUFFERED |
- ECORE_EXE_PIPE_READ, NULL);
-
- if (childHandle == NULL)
- {
- fprintf(stderr, "Could not create a child process!\n");
- goto ecore_shutdown;
- }
-
- childPid = ecore_exe_pid_get(childHandle);
-
- if (childPid == -1)
- fprintf(stderr, "Could not retrive the PID!\n");
- else
- fprintf(stdout, "The child process has PID:%d\n", childPid);
-
- ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_handler, NULL);
- ecore_timer_add(1, _sendMessage, childHandle);
-
- ecore_main_loop_begin();
-
- ecore_exe_free(childHandle); //This will not affect the child process
-
- ecore_shutdown();
-
- return EXIT_SUCCESS;
-
-ecore_shutdown:
- ecore_shutdown();
-
-exit:
- return EXIT_FAILURE;
-}
diff --git a/src/examples/ecore_exe_example_child.c b/src/examples/ecore_exe_example_child.c
deleted file mode 100644
index 332b66f1..00000000
--- a/src/examples/ecore_exe_example_child.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- Compile with gcc -o ecore_exe_example_child ecore_exe_example_child.c `pkg-config --cflags --libs ecore`
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#include <Ecore.h>
-
-
-#define BUFFER_SIZE 1024
-
-static Eina_Bool
-_fd_handler_cb(void *data, Ecore_Fd_Handler
- *fd_handler)
-{
- static int numberOfMessages = 0;
- char message[BUFFER_SIZE];
-
- fgets(message, BUFFER_SIZE, stdin);
-
- numberOfMessages++;
-
- if (numberOfMessages < 3)
- {
- fprintf(stdout, "My father sent this message to me:%s\n", message);
- fflush(stdout);
- return ECORE_CALLBACK_RENEW;
- }
- else
- {
- fprintf(stdout, "quit\n");
- fflush(stdout);
- ecore_main_loop_quit();
- return ECORE_CALLBACK_DONE;
- }
-}
-
-int
-main(int argc, char **argv)
-{
-
- if (!ecore_init())
- goto error;
-
- ecore_main_fd_handler_add(STDIN_FILENO,
- ECORE_FD_READ,
- _fd_handler_cb,
- NULL, NULL, NULL);
- ecore_main_loop_begin();
-
- ecore_shutdown();
-
- return EXIT_SUCCESS;
-
-error:
- return EXIT_FAILURE;
-}
diff --git a/src/examples/ecore_imf_example.c b/src/examples/ecore_imf_example.c
deleted file mode 100644
index b0f43e58..00000000
--- a/src/examples/ecore_imf_example.c
+++ /dev/null
@@ -1,562 +0,0 @@
-/**
- * Ecore example illustrating how to use ecore imf.
- *
- * @verbatim
- * gcc -o ecore_imf_example ecore_imf_example.c `pkg-config --cflags --libs ecore evas ecore-evas ecore-imf ecore-imf-evas`
- * @endverbatim
- */
-
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <Ecore_IMF.h>
-#include <Ecore_IMF_Evas.h>
-#include <Evas.h>
-#include <stdio.h>
-
-typedef struct _Entry Entry;
-
-struct _Entry
-{
- Evas_Object *rect;
- Evas_Object *txt_obj;
- Evas_Textblock_Style *txt_style;
- Evas_Textblock_Cursor *cursor;
- Evas_Textblock_Cursor *preedit_start;
- Evas_Textblock_Cursor *preedit_end;
- Ecore_IMF_Context *imf_context;
- Eina_Bool have_preedit : 1;
-};
-
-static void _mouse_up_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
-{
- Entry *en = data;
- if (!en) return;
-
- evas_object_focus_set(en->rect, EINA_TRUE);
-}
-
-static void _entry_focus_in_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Entry *en = data;
- if (!en) return;
-
- if (en->imf_context)
- ecore_imf_context_focus_in(en->imf_context);
-}
-
-static void _entry_focus_out_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Entry *en = data;
- if (!en) return;
-
- if (en->imf_context)
- {
- ecore_imf_context_reset(en->imf_context);
- ecore_imf_context_focus_out(en->imf_context);
- }
-}
-
-static void
-_canvas_focus_in_cb(void *data, Evas *e, void *event_info)
-{
- Evas_Object *obj = evas_focus_get(e);
- if (obj)
- _entry_focus_in_cb(obj, NULL, NULL, NULL);
-}
-
-static void
-_canvas_focus_out_cb(void *data, Evas *e, void *event_info)
-{
- Evas_Object *obj = evas_focus_get(e);
- if (obj)
- _entry_focus_out_cb(obj, NULL, NULL, NULL);
-}
-
-static void
-_imf_cursor_info_set(Entry *en)
-{
- Evas_Coord x, y, w, h;
- Evas_Coord cx, cy, cw, ch; // cursor geometry
- int cursor_pos; // cursor position in chars (Not bytes)
-
- if (!en) return;
-
- // get cursor geometry
- evas_object_geometry_get(en->txt_obj, &x, &y, &w, &h);
- evas_textblock_cursor_geometry_get(en->cursor, &cx, &cy, &cw, &ch, NULL, EVAS_TEXTBLOCK_CURSOR_BEFORE);
-
- // get cursor position
- cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
-
- ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos);
- ecore_imf_context_cursor_location_set(en->imf_context, x+cx, y+cy, cw, ch);
-}
-
-static void _preedit_del(Entry *en)
-{
- if (!en || !en->have_preedit) return;
- if (!en->preedit_start || !en->preedit_end) return;
- if (!evas_textblock_cursor_compare(en->preedit_start, en->preedit_end)) return;
-
- /* delete the preedit characters */
- evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
-}
-
-static void
-_preedit_clear(Entry *en)
-{
- if (en->preedit_start)
- {
- evas_textblock_cursor_free(en->preedit_start);
- en->preedit_start = NULL;
- }
-
- if (en->preedit_end)
- {
- evas_textblock_cursor_free(en->preedit_end);
- en->preedit_end = NULL;
- }
-
- en->have_preedit = EINA_FALSE;
-}
-
-static Eina_Bool
-_ecore_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos)
-{
- /* This callback will be called when the Input Method Context module requests the surrounding context. */
- Entry *en = data;
- const char *str;
-
- if (!en) return;
-
- str = evas_object_textblock_text_markup_get(en->txt_obj);
- *text = str ? strdup(str) : strdup("");
-
- /* get the current position of cursor */
- if (cursor_pos)
- *cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
-
- return EINA_TRUE;
-}
-
-static void
-_ecore_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
-{
- /* called when the input method needs to delete all or part of the context surrounding the cursor */
- Entry *en = data;
- Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
- Evas_Textblock_Cursor *del_start, *del_end;
- int cursor_pos;
-
- if (!en) return;
-
- cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
-
- del_start = evas_object_textblock_cursor_new(en->txt_obj);
- evas_textblock_cursor_pos_set(del_start, cursor_pos + ev->offset);
-
- del_end = evas_object_textblock_cursor_new(en->txt_obj);
- evas_textblock_cursor_pos_set(del_end, cursor_pos + ev->offset + ev->n_chars);
-
- /* implement function to delete character(s) from 'cursor_pos+ev->offset' cursor position to 'cursor_pos + ev->offset + ev->n_chars' */
- evas_textblock_cursor_range_delete(del_start, del_end);
-
- evas_textblock_cursor_free(del_start);
- evas_textblock_cursor_free(del_end);
-}
-
-static void _ecore_imf_event_commit_cb (void *data, Ecore_IMF_Context *ctx, void *event_info)
-{
- Entry *en = data;
- char *commit_str = (char *)event_info;
- if (!en) return;
-
- /* delete preedit string */
- _preedit_del(en);
- _preedit_clear(en);
-
- printf ("commit string : %s\n", commit_str);
-
- evas_object_textblock_text_markup_prepend(en->cursor, commit_str);
-
- /* notify cursor information */
- _imf_cursor_info_set(en);
-
- return;
-}
-
-static void _ecore_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
-{
- /* example how to get preedit string */
- Entry *en = data;
- char *preedit_string;
- int cursor_pos;
- Eina_List *attrs = NULL;
- Eina_List *l;
- Ecore_IMF_Preedit_Attr *attr;
- Ecore_IMF_Context * imf_context = ctx;
- int preedit_start_pos, preedit_end_pos;
- int i;
- Eina_Bool preedit_end_state = EINA_FALSE;
-
- if (!en) return;
-
- /* get preedit string, attributes */
- ecore_imf_context_preedit_string_with_attributes_get(imf_context, &preedit_string, &attrs, &cursor_pos);
- printf("preedit string : %s\n", preedit_string);
-
- if (!strcmp(preedit_string, ""))
- preedit_end_state = EINA_TRUE;
-
- /* delete preedit */
- _preedit_del(en);
-
- preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor);
-
- /* insert preedit character(s) */
- if (strlen(preedit_string) > 0)
- {
- if (attrs)
- {
- EINA_LIST_FOREACH(attrs, l, attr)
- {
- if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) // style type
- {
- /* apply appropriate style such as underline */
- }
- else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2 || attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3)
- {
- /* apply appropriate style such as underline */
- }
- }
-
- /* insert code to display preedit string in your editor */
- evas_object_textblock_text_markup_prepend(en->cursor, preedit_string);
- }
- }
-
- if (!preedit_end_state)
- {
- /* set preedit start cursor */
- if (!en->preedit_start)
- en->preedit_start = evas_object_textblock_cursor_new(en->txt_obj);
- evas_textblock_cursor_copy(en->cursor, en->preedit_start);
-
- /* set preedit end cursor */
- if (!en->preedit_end)
- en->preedit_end = evas_object_textblock_cursor_new(en->txt_obj);
- evas_textblock_cursor_copy(en->cursor, en->preedit_end);
-
- preedit_end_pos = evas_textblock_cursor_pos_get(en->cursor);
-
- for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++)
- {
- evas_textblock_cursor_char_prev(en->preedit_start);
- }
-
- en->have_preedit = EINA_TRUE;
-
- /* set cursor position */
- evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
- }
-
- /* notify cursor information */
- _imf_cursor_info_set(en);
-
- EINA_LIST_FREE(attrs, attr) free(attr);
-
- free(preedit_string);
-}
-
-static void
-_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Entry *en = data;
- Evas_Event_Key_Down *ev = event_info;
- Eina_Bool control, alt, shift;
- Eina_Bool multiline;
- Eina_Bool cursor_changed;
- if (!en) return;
- if (!ev->key) return;
-
- if (en->imf_context)
- {
- Ecore_IMF_Event_Key_Down ecore_ev;
- ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
- if (ecore_imf_context_filter_event(en->imf_context,
- ECORE_IMF_EVENT_KEY_DOWN,
- (Ecore_IMF_Event *)&ecore_ev))
- return;
- }
-
- control = evas_key_modifier_is_set(ev->modifiers, "Control");
- alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
- shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
-
- if ((!strcmp(ev->keyname, "Escape")) ||
- (!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter")))
- ecore_imf_context_reset(en->imf_context);
-
- if (!strcmp(ev->key, "BackSpace"))
- {
- if (evas_textblock_cursor_char_prev(en->cursor))
- evas_textblock_cursor_char_delete(en->cursor);
-
- return;
- }
- else if (!strcmp(ev->key, "Delete") ||
- (!strcmp(ev->key, "KP_Delete") && !ev->string))
- {
- // FILLME
- }
- else if ((control) && (!strcmp(ev->key, "v")))
- {
- // ctrl + v
- // FILLME
- }
- else if ((control) && (!strcmp(ev->key, "a")))
- {
- // ctrl + a
- // FILLME
- }
- else if ((control) && (!strcmp(ev->key, "A")))
- {
- // ctrl + A
- // FILLME
- }
- else if ((control) && ((!strcmp(ev->key, "c") || (!strcmp(ev->key, "Insert")))))
- {
- // ctrl + c
- // FILLME
- }
- else if ((control) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m")))))
- {
- // ctrl + x
- // FILLME
- }
- else if ((control) && (!strcmp(ev->key, "z")))
- {
- // ctrl + z (undo)
- // FILLME
- }
- else if ((control) && (!strcmp(ev->key, "y")))
- {
- // ctrl + y (redo)
- // FILLME
- }
- else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
- {
- // FILLME
- }
- else
- {
- if (ev->string)
- {
- printf("key down string : %s\n", ev->string);
- evas_object_textblock_text_markup_prepend(en->cursor, ev->string);
- }
- }
-
- /* notify cursor information */
- _imf_cursor_info_set(en);
-}
-
-static void
-_key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Entry *en = data;
- Evas_Event_Key_Up *ev = event_info;
-
- if (!en) return;
-
- if (en->imf_context)
- {
- Ecore_IMF_Event_Key_Up ecore_ev;
-
- ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
- if (ecore_imf_context_filter_event(en->imf_context,
- ECORE_IMF_EVENT_KEY_UP,
- (Ecore_IMF_Event *)&ecore_ev))
- return;
- }
-}
-
-static void
-create_input_field(Evas *evas, Entry *en, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
-{
- if (!en) return;
-
- /* create background for text input field */
- en->rect = evas_object_rectangle_add(evas);
- evas_object_color_set(en->rect, 150, 150, 150, 255); /* gray */
- evas_object_move(en->rect, x, y);
- evas_object_resize(en->rect, w, h);
- evas_object_show(en->rect);
-
- /* create text object for displaying text */
- en->txt_obj = evas_object_textblock_add(evas);
- evas_object_color_set(en->txt_obj, 0, 0, 0, 255);
- evas_object_pass_events_set(en->txt_obj, EINA_TRUE);
- evas_object_move(en->txt_obj, x, y);
- evas_object_resize(en->txt_obj, w, h);
- evas_object_show(en->txt_obj);
-
- /* set style on textblock */
- static const char *style_buf =
- "DEFAULT='font=Sans font_size=30 color=#000 text_class=entry'"
- "newline='br'"
- "b='+ font=Sans:style=bold'";
- en->txt_style = evas_textblock_style_new();
- evas_textblock_style_set(en->txt_style, style_buf);
- evas_object_textblock_style_set(en->txt_obj, en->txt_style);
-
- /* create cursor */
- en->cursor = evas_object_textblock_cursor_new(en->txt_obj);
-
- /* create input context */
- const char* default_id = ecore_imf_context_default_id_get();
- if (!default_id)
- return;
-
- en->imf_context = ecore_imf_context_add(default_id);
- ecore_imf_context_client_window_set(en->imf_context, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(evas)));
- ecore_imf_context_client_canvas_set(en->imf_context, evas);
-
- evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, en);
- evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_UP, _key_up_cb, en);
- evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, en);
- evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_IN, _entry_focus_in_cb, en);
- evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_OUT, _entry_focus_out_cb, en);
-
- en->have_preedit = EINA_FALSE;
- en->preedit_start = NULL;
- en->preedit_end = NULL;
-
- /* register retrieve surrounding callback */
- ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context, _ecore_imf_retrieve_surrounding_cb, en);
-
- /* register commit event callback */
- ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _ecore_imf_event_commit_cb, en);
-
- /* register preedit changed event handler */
- ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ecore_imf_event_preedit_changed_cb, en);
-
- /* register surrounding delete event callback */
- ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _ecore_imf_event_delete_surrounding_cb, en);
-}
-
-static void
-delete_input_field(Entry *en)
-{
- if (!en) return;
-
- if (en->rect)
- {
- evas_object_del(en->rect);
- en->rect = NULL;
- }
-
- if (en->cursor)
- {
- evas_textblock_cursor_free(en->cursor);
- en->cursor = NULL;
- }
-
- if (en->preedit_start)
- {
- evas_textblock_cursor_free(en->preedit_start);
- en->preedit_start = NULL;
- }
-
- if (en->preedit_end)
- {
- evas_textblock_cursor_free(en->preedit_end);
- en->preedit_end = NULL;
- }
-
- if (en->txt_obj)
- {
- evas_object_del(en->txt_obj);
- en->txt_obj = NULL;
- }
-
- if (en->txt_style)
- {
- evas_textblock_style_free(en->txt_style);
- en->txt_style = NULL;
- }
-
- if (en->imf_context)
- {
- ecore_imf_context_del(en->imf_context);
- en->imf_context = NULL;
- }
-}
-
-int main(int argc, char *argv[])
-{
- Ecore_Evas* ee;
- Evas* evas;
- Entry en1, en2;
-
- if (!ecore_evas_init())
- {
- fprintf(stderr, "failed to call ecore_evas_init()\n");
- return EXIT_FAILURE;
- }
-
- ecore_imf_init();
-
- // create a new window, with size=480x800 and default engine
- ee = ecore_evas_new(NULL, 0, 0, 480, 800, NULL);
-
- if (!ee)
- {
- fprintf(stderr, "failed to call ecore_evas_new\n");
- return EXIT_FAILURE;
- }
-
- ecore_evas_show(ee);
-
- // get the canvas off just-created window
- evas = ecore_evas_get(ee);
- if (!evas)
- {
- fprintf(stderr, "failed to ccall ecore_evas_get\n");
- return EXIT_FAILURE;
- }
-
- // create input field rectangle
- Evas_Object* bg = evas_object_rectangle_add(evas);
- evas_object_move(bg, 0, 0);
- evas_object_resize(bg, 480, 800);
- evas_object_color_set(bg, 255, 255, 255, 255);
- evas_object_show(bg);
-
- evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL);
- evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _canvas_focus_out_cb, NULL);
-
- // create input field 1
- create_input_field(evas, &en1, 40, 60, 400, 80);
-
- // create input field 2
- create_input_field(evas, &en2, 40, 180, 400, 80);
-
- // give focus to input field 1
- evas_object_focus_set(en1.rect, EINA_TRUE);
-
- ecore_main_loop_begin(); // begin mainloop
-
- delete_input_field(&en1); // delete input field 1
- delete_input_field(&en2); // delete input field 2
-
- evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL);
- evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _canvas_focus_out_cb, NULL);
-
- ecore_evas_free(ee);
-
- ecore_imf_shutdown();
- ecore_evas_shutdown();
-
- return 0;
-}
diff --git a/src/lib/ecore/Ecore.h b/src/lib/ecore/Ecore.h
index f283849c..ef4925c3 100644
--- a/src/lib/ecore/Ecore.h
+++ b/src/lib/ecore/Ecore.h
@@ -8,7 +8,7 @@
@mainpage Ecore
- @version 1.2
+ @version 1.1
@date 2000-2012
Please see the @ref authors page for contact details.
@@ -116,8 +116,6 @@ sudo make install
@author Bluezery <ohpowel@gmail.com>
@author Doyoun Kang <wayofmine@gmail.com> <doyoun.kang@samsung.com>
@author Haifeng Deng <haifeng.deng@samsung.com>
- @author Jérémy Zurcher <jeremy@asynk.ch>
- @author Vikram Narayanan <vikram186@gmail.com>
Please contact <enlightenment-devel@lists.sourceforge.net> to get in
contact with the developers and maintainers.
@@ -352,7 +350,7 @@ sudo make install
#ifdef _WIN32
# include <winsock2.h>
-#elif defined (__FreeBSD__) || defined (__OpenBSD__)
+#elif (defined (__FreeBSD__) && (__FreeBSD_version >= 420001)) || defined (__OpenBSD__)
# include <sys/select.h>
# include <signal.h>
#else
@@ -837,14 +835,7 @@ EAPI void *ecore_event_current_event_get(void);
/**
* @defgroup Ecore_Exe_Group Process Spawning Functions
*
- * This module is responsible for managing portable processes using Ecore.
- * With this module you're able to spawn processes and you also can pause,
- * quit your spawned processes.
- * An interaction between your process and those spawned is possible
- * using pipes or signals.
- *
- * Example
- * @li @ref Ecore_exe_simple_example_c
+ * Functions that deal with and send signals to spawned processes.
*
* @ingroup Ecore_Main_Loop_Group
*
@@ -1076,9 +1067,6 @@ typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh);
* Some systems, notably xlib, handle their own buffering, and would otherwise
* not work with select(). These systems should use a @a buf_func. This is a
* most annoying hack, only ecore_x uses it, so refer to that for an example.
- *
- * @warning This function should @b not be used for monitoring "normal" files, like text files.
- *
*/
EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data);
/**
@@ -2120,7 +2108,7 @@ EAPI int ecore_thread_max_get(void);
* @param num The new maximum
*
* This sets a new value for the maximum number of concurrently running
- * Ecore_Thread's. It @b must an integer between 1 and (16 * @c x), where @c x
+ * Ecore_Thread's. It @b must an integer between 1 and (2 * @c x), where @c x
* is the number for CPUs available.
*
* @see ecore_thread_max_get()
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 7a221e3b..ea5b5cf5 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -171,16 +171,12 @@ ecore_init(void)
_ecore_job_init();
_ecore_time_init();
+ eina_lock_new(&_thread_safety);
eina_lock_new(&_thread_mutex);
eina_condition_new(&_thread_cond, &_thread_mutex);
eina_lock_new(&_thread_feedback_mutex);
eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex);
- if (!_thread_call)
- {
- _thread_call = ecore_pipe_add(_thread_callback, NULL);
- eina_lock_new(&_thread_safety);
- }
-
+ _thread_call = ecore_pipe_add(_thread_callback, NULL);
eina_lock_new(&_thread_id_lock);
eina_lock_new(&_ecore_main_loop_lock);
@@ -228,12 +224,6 @@ ecore_shutdown(void)
* take a lock here because _ecore_event_shutdown() does callbacks
*/
_ecore_lock();
- if (_ecore_init_count <= 0)
- {
- ERR("Init count not greater than 0 in shutdown.");
- _ecore_unlock();
- return 0;
- }
if (--_ecore_init_count != 0)
goto unlock;
@@ -251,8 +241,8 @@ ecore_shutdown(void)
_thread_call = NULL;
ecore_pipe_wait(p, 1, 0.1);
ecore_pipe_del(p);
- eina_lock_free(&_thread_safety);
*/
+ eina_lock_free(&_thread_safety);
eina_condition_free(&_thread_cond);
eina_lock_free(&_thread_mutex);
eina_condition_free(&_thread_feedback_cond);
@@ -709,8 +699,10 @@ _thread_safe_cleanup(void *data)
eina_lock_free(&call->m);
}
-void
-_ecore_main_call_flush(void)
+static void
+_thread_callback(void *data __UNUSED__,
+ void *buffer __UNUSED__,
+ unsigned int nbyte __UNUSED__)
{
Ecore_Safe_Call *call;
Eina_List *callback;
@@ -760,11 +752,3 @@ _ecore_main_call_flush(void)
}
}
-static void
-_thread_callback(void *data __UNUSED__,
- void *buffer __UNUSED__,
- unsigned int nbyte __UNUSED__)
-{
- _ecore_main_call_flush();
-}
-
diff --git a/src/lib/ecore/ecore_alloc.c b/src/lib/ecore/ecore_alloc.c
index c9e77cdc..412c3832 100644
--- a/src/lib/ecore/ecore_alloc.c
+++ b/src/lib/ecore/ecore_alloc.c
@@ -99,7 +99,7 @@ ecore_mempool_init(void)
for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
{
retry:
- mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 16);
+ mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
if (!mempool_array[i]->mp)
{
if (!strcmp(choice, "pass_through"))
diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c
index 67bf8b11..4ced67a7 100644
--- a/src/lib/ecore/ecore_anim.c
+++ b/src/lib/ecore/ecore_anim.c
@@ -203,20 +203,18 @@ _pos_map_sin(double in)
return eina_f32p32_double_to(eina_f32p32_sin(eina_f32p32_double_from(in)));
}
-#if 0
static double
_pos_map_cos(double in)
{
return eina_f32p32_double_to(eina_f32p32_cos(eina_f32p32_double_from(in)));
}
-#endif
static double
_pos_map_accel_factor(double pos,
double v1)
{
int i, fact = (int)v1;
- double p, o1 = pos, o2, v;
+ double p, o1 = pos, o2 = pos, v;
p = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0));
o2 = p;
for (i = 0; i < fact; i++)
@@ -260,15 +258,6 @@ _pos_map_spring(double pos,
return _pos_map_sin((M_PI / 2.0) + (p2 * len)) * decay;
}
-#define DBL_TO(Fp) eina_f32p32_double_to(Fp)
-#define DBL_FROM(D) eina_f32p32_double_from(D)
-#define INT_FROM(I) eina_f32p32_int_from(I)
-#define SIN(Fp) eina_f32p32_sin(Fp)
-#define COS(Fp) eina_f32p32_cos(Fp)
-#define ADD(A, B) eina_f32p32_add(A, B)
-#define SUB(A, B) eina_f32p32_sub(A, B)
-#define MUL(A, B) eina_f32p32_mul(A, B)
-
EAPI double
ecore_animator_pos_map(double pos,
Ecore_Pos_Map map,
@@ -285,18 +274,15 @@ ecore_animator_pos_map(double pos,
return pos;
case ECORE_POS_MAP_ACCELERATE:
- /* pos = 1 - sin(Pi / 2 + pos * Pi / 2); */
- pos = DBL_TO(SUB(INT_FROM(1), SIN(ADD((EINA_F32P32_PI >> 1), MUL(DBL_FROM(pos), (EINA_F32P32_PI >> 1))))));
+ pos = 1.0 - _pos_map_sin(M_PI_2 + pos * M_PI_2);
return pos;
case ECORE_POS_MAP_DECELERATE:
- /* pos = sin(pos * Pi / 2); */
- pos = DBL_TO(SIN(MUL(DBL_FROM(pos), (EINA_F32P32_PI >> 1))));
+ pos = _pos_map_sin(pos * M_PI_2);
return pos;
case ECORE_POS_MAP_SINUSOIDAL:
- /* pos = (1 - cos(pos * Pi)) / 2 */
- pos = DBL_TO((SUB(INT_FROM(1), COS(MUL(DBL_FROM(pos), EINA_F32P32_PI)))) >> 1);
+ pos = (1.0 - _pos_map_cos(pos * M_PI)) / 2.0;
return pos;
case ECORE_POS_MAP_ACCELERATE_FACTOR:
diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c
index 7931a96c..719bc175 100644
--- a/src/lib/ecore/ecore_exe.c
+++ b/src/lib/ecore/ecore_exe.c
@@ -368,10 +368,6 @@ ecore_exe_run_priority_get(void)
* Spawns a child process.
*
* This is now just a thin wrapper around ecore_exe_pipe_run()
- * @note When you use this function you will have no permissions
- * to write or read on the pipe that connects you with the spwaned process.
- * If you need to do that use ecore_exe_pipe_run() with the
- * appropriated flags.
*
* @param exe_cmd The command to run with @c /bin/sh.
* @param data Data to attach to the returned process handle.
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index a936a2b4..3107c3fe 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -860,7 +860,6 @@ ecore_main_loop_iterate(void)
EINA_MAIN_LOOP_CHECK_RETURN;
#ifndef USE_G_MAIN_LOOP
_ecore_lock();
- _ecore_time_loop_time = ecore_time_get();
_ecore_main_loop_iterate_internal(1);
_ecore_unlock();
#else
@@ -891,7 +890,6 @@ ecore_main_loop_iterate_may_block(int may_block)
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
#ifndef USE_G_MAIN_LOOP
_ecore_lock();
- _ecore_time_loop_time = ecore_time_get();
in_main_loop++;
_ecore_main_loop_iterate_internal(!may_block);
in_main_loop--;
@@ -927,7 +925,6 @@ ecore_main_loop_begin(void)
#ifndef USE_G_MAIN_LOOP
_ecore_lock();
in_main_loop++;
- _ecore_time_loop_time = ecore_time_get();
while (do_quit == 0) _ecore_main_loop_iterate_internal(0);
do_quit = 0;
in_main_loop--;
@@ -1223,7 +1220,7 @@ _ecore_main_shutdown(void)
if (in_main_loop)
{
ERR("\n"
- "*** ECORE WARNING: Calling ecore_shutdown() while still in the main loop.\n"
+ "*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n"
"*** Program may crash or behave strangely now.");
return;
}
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index d812e3a3..a35d12e5 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -224,8 +224,6 @@ void _ecore_main_loop_shutdown(void);
void _ecore_throttle(void);
-void _ecore_main_call_flush(void);
-
extern int _ecore_main_lock_count;
extern Eina_Lock _ecore_main_loop_lock;
diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c
index 05fe3b73..57df0274 100644
--- a/src/lib/ecore/ecore_signal.c
+++ b/src/lib/ecore/ecore_signal.c
@@ -145,7 +145,6 @@ _ecore_signal_call(void)
{
volatile sig_atomic_t n;
sigset_t oldset, newset;
- int tot;
if (sig_count == 0) return;
sigemptyset(&newset);
@@ -165,19 +164,6 @@ _ecore_signal_call(void)
if (sigchld_count > MAXSIGQ)
WRN("%i SIGCHLD in queue. max queue size %i. losing "
"siginfo for extra signals.", sigchld_count, MAXSIGQ);
- tot = sigchld_count + sigusr1_count + sigusr2_count +
- sighup_count + sigquit_count + sigint_count + sigterm_count
-#ifdef SIGPWR
- + sigpwr_count
-#endif
- ;
-
- if (sig_count != tot)
- {
- ERR("sig_count (%i) != actual totals (%i) ", sig_count, tot);
- sig_count = tot;
- }
-
for (n = 0; n < sigchld_count; n++)
{
pid_t pid;
@@ -405,8 +391,7 @@ _ecore_signal_call(void)
}
sigpwr_count = 0;
#endif
- sig_count = 0;
-
+
sigprocmask(SIG_SETMASK, &oldset, NULL);
}
diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c
index b91d0fef..d4659d64 100644
--- a/src/lib/ecore/ecore_thread.c
+++ b/src/lib/ecore/ecore_thread.c
@@ -1,4 +1,3 @@
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -18,25 +17,6 @@
#ifdef EFL_HAVE_THREADS
-# define LK(x) Eina_Lock x
-# define LKI(x) eina_lock_new(&(x))
-# define LKD(x) eina_lock_free(&(x))
-# define LKL(x) eina_lock_take(&(x))
-# define LKU(x) eina_lock_release(&(x))
-
-# define CD(x) Eina_Condition x
-# define CDI(x, m) eina_condition_new(&(x), &(m))
-# define CDD(x) eina_condition_free(&(x))
-# define CDB(x) eina_condition_broadcast(&(x))
-# define CDW(x, t) eina_condition_timedwait(&(x), t)
-
-# define LRWK(x) Eina_RWLock x
-# define LRWKI(x) eina_rwlock_new(&(x));
-# define LRWKD(x) eina_rwlock_free(&(x));
-# define LRWKWL(x) eina_rwlock_take_write(&(x));
-# define LRWKRL(x) eina_rwlock_take_read(&(x));
-# define LRWKU(x) eina_rwlock_release(&(x));
-
# ifdef EFL_HAVE_POSIX_THREADS
# include <pthread.h>
# ifdef __linux__
@@ -51,9 +31,28 @@
# define PHE(x, y) pthread_equal(x, y)
# define PHS() pthread_self()
# define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d)
-# define PHJ(x) pthread_join(x, NULL)
+# define PHJ(x, p) pthread_join(x, (void **)(&(p)))
# define PHA(x) pthread_cancel(x)
+# define CD(x) pthread_cond_t x
+# define CDI(x) pthread_cond_init(&(x), NULL);
+# define CDD(x) pthread_cond_destroy(&(x));
+# define CDB(x) pthread_cond_broadcast(&(x));
+# define CDW(x, y, t) pthread_cond_timedwait(&(x), &(y), t);
+
+# define LK(x) pthread_mutex_t x
+# define LKI(x) pthread_mutex_init(&(x), NULL);
+# define LKD(x) pthread_mutex_destroy(&(x));
+# define LKL(x) pthread_mutex_lock(&(x));
+# define LKU(x) pthread_mutex_unlock(&(x));
+
+# define LRWK(x) pthread_rwlock_t x
+# define LRWKI(x) pthread_rwlock_init(&(x), NULL);
+# define LRWKD(x) pthread_rwlock_destroy(&(x));
+# define LRWKWL(x) pthread_rwlock_wrlock(&(x));
+# define LRWKRL(x) pthread_rwlock_rdlock(&(x));
+# define LRWKU(x) pthread_rwlock_unlock(&(x));
+
# else /* EFL_HAVE_WIN32_THREADS */
# define WIN32_LEAN_AND_MEAN
@@ -109,9 +108,209 @@ _ecore_thread_win32_join(win32_thread *x,
return 0;
}
-# define PHJ(x) _ecore_thread_win32_join(x, NULL)
+# define PHJ(x, p) _ecore_thread_win32_join(x, (void **)(&(p)))
# define PHA(x) TerminateThread(x->thread, 0)
+# define LK(x) HANDLE x
+# define LKI(x) x = CreateMutex(NULL, FALSE, NULL)
+# define LKD(x) CloseHandle(x)
+# define LKL(x) WaitForSingleObject(x, INFINITE)
+# define LKU(x) ReleaseMutex(x)
+
+typedef struct
+{
+ HANDLE semaphore;
+ LONG threads_count;
+ CRITICAL_SECTION threads_count_lock;
+} win32_cond;
+
+# define CD(x) win32_cond * x
+
+# define CDI(x) \
+ do { \
+ x = (win32_cond *)calloc(1, sizeof(win32_cond)); \
+ if (x) \
+ { \
+ x->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); \
+ if (x->semaphore) \
+ InitializeCriticalSection(&x->threads_count_lock); \
+ else \
+ { \
+ free(x); \
+ x = NULL; \
+ } \
+ } \
+ } while (0)
+
+# define CDD(x) \
+ do { \
+ CloseHandle(x->semaphore); \
+ free(x); \
+ x = NULL; \
+ } while (0)
+
+# define CDB(x) \
+ do { \
+ EnterCriticalSection(&x->threads_count_lock); \
+ if (x->threads_count > 0) \
+ ReleaseSemaphore(x->semaphore, x->threads_count, NULL); \
+ LeaveCriticalSection (&x->threads_count_lock); \
+ } while (0)
+
+int
+_ecore_thread_win32_cond_timedwait(win32_cond *c,
+ HANDLE *external_mutex,
+ struct timeval *t)
+{
+ DWORD res;
+ DWORD val = t->tv_sec * 1000 + (t->tv_usec / 1000);
+ LKL(external_mutex);
+ EnterCriticalSection (&c->threads_count_lock);
+ c->threads_count++;
+ LeaveCriticalSection (&c->threads_count_lock);
+ LKU(external_mutex);
+ res = WaitForSingleObject(c->semaphore, val);
+ if (res == WAIT_OBJECT_0)
+ return 0;
+ else
+ return -1;
+}
+
+# define CDW(x, y, t) _ecore_thread_win32_cond_timedwait(x, y, t)
+
+typedef struct
+{
+ LONG readers_count;
+ LONG writers_count;
+ int readers;
+ int writers;
+ LK(mutex);
+ CD(cond_read);
+ CD(cond_write);
+} win32_rwl;
+
+# define LRWK(x) win32_rwl * x
+# define LRWKI(x) \
+ do { \
+ x = (win32_rwl *)calloc(1, sizeof(win32_rwl)); \
+ if (x) \
+ { \
+ LKI(x->mutex); \
+ if (x->mutex) \
+ { \
+ CDI(x->cond_read); \
+ if (x->cond_read) \
+ { \
+ CDI(x->cond_write); \
+ if (!x->cond_write) \
+ { \
+ CDD(x->cond_read); \
+ LKD(x->mutex); \
+ free(x); \
+ x = NULL; \
+ } \
+ } \
+ else \
+ { \
+ LKD(x->mutex); \
+ free(x); \
+ x = NULL; \
+ } \
+ } \
+ else \
+ { \
+ free(x); \
+ x = NULL; \
+ } \
+ } \
+ } while (0)
+
+# define LRWKD(x) \
+ do { \
+ LKU(x->mutex); \
+ LKD(x->mutex); \
+ CDD(x->cond_write); \
+ CDD(x->cond_read); \
+ free(x); \
+ } while (0)
+# define LRWKWL(x) \
+ do { \
+ DWORD res; \
+ LKU(x->mutex); \
+ if (x->writers || x->readers > 0) \
+ { \
+ x->writers_count++; \
+ while (x->writers || x->readers > 0) \
+ { \
+ EnterCriticalSection(&x->cond_write->threads_count_lock); \
+ x->cond_read->threads_count++; \
+ LeaveCriticalSection(&x->cond_write->threads_count_lock); \
+ res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \
+ if (res != WAIT_OBJECT_0) break; \
+ } \
+ x->writers_count--; \
+ } \
+ if (res == 0) x->writers_count = 1; \
+ LKU(x->mutex); \
+ } while (0)
+# define LRWKRL(x) \
+ do { \
+ DWORD res; \
+ LKL(x->mutex); \
+ if (x->writers) \
+ { \
+ x->readers_count++; \
+ while (x->writers) \
+ { \
+ EnterCriticalSection(&x->cond_write->threads_count_lock); \
+ x->cond_read->threads_count++; \
+ LeaveCriticalSection(&x->cond_write->threads_count_lock); \
+ res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \
+ if (res != WAIT_OBJECT_0) break; \
+ } \
+ x->readers_count--; \
+ } \
+ if (res == 0) \
+ x->readers++; \
+ LKU(x->mutex); \
+ } while (0)
+# define LRWKU(x) \
+ do { \
+ LKL(x->mutex); \
+ if (x->writers) \
+ { \
+ x->writers = 0; \
+ if (x->readers_count == 1) \
+ { \
+ EnterCriticalSection(&x->cond_read->threads_count_lock); \
+ if (x->cond_read->threads_count > 0) \
+ ReleaseSemaphore(x->cond_read->semaphore, 1, 0); \
+ LeaveCriticalSection(&x->cond_read->threads_count_lock); \
+ } \
+ else if (x->readers_count > 0) \
+ CDB(x->cond_read); \
+ else if (x->writers_count > 0) \
+ { \
+ EnterCriticalSection (&x->cond_write->threads_count_lock); \
+ if (x->cond_write->threads_count > 0) \
+ ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \
+ LeaveCriticalSection (&x->cond_write->threads_count_lock); \
+ } \
+ } \
+ else if (x->readers > 0) \
+ { \
+ x->readers--; \
+ if (x->readers == 0 && x->writers_count > 0) \
+ { \
+ EnterCriticalSection (&x->cond_write->threads_count_lock); \
+ if (x->cond_write->threads_count > 0) \
+ ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \
+ LeaveCriticalSection (&x->cond_write->threads_count_lock); \
+ } \
+ } \
+ LKU(x->mutex); \
+ } while (0)
+
# endif
#endif
@@ -137,24 +336,14 @@ struct _Ecore_Pthread_Worker
{
Ecore_Thread_Cb func_heavy;
Ecore_Thread_Notify_Cb func_notify;
+ Ecore_Pipe *notify;
+ Ecore_Pipe *direct_pipe;
Ecore_Pthread_Worker *direct_worker;
int send;
int received;
} feedback_run;
- struct {
- Ecore_Thread_Cb func_main;
- Ecore_Thread_Notify_Cb func_notify;
-
- Ecore_Pipe *send;
- Ecore_Pthread_Worker *direct_worker;
-
- struct {
- int send;
- int received;
- } from, to;
- } message_run;
} u;
Ecore_Thread_Cb func_cancel;
@@ -168,56 +357,48 @@ struct _Ecore_Pthread_Worker
const void *data;
- int cancel;
-
-#ifdef EFL_HAVE_THREADS
- LK(cancel_mutex);
-#endif
-
- Eina_Bool message_run : 1;
- Eina_Bool feedback_run : 1;
- Eina_Bool kill : 1;
- Eina_Bool reschedule : 1;
- Eina_Bool no_queue : 1;
+ Eina_Bool cancel : 1;
+ Eina_Bool feedback_run : 1;
+ Eina_Bool kill : 1;
+ Eina_Bool reschedule : 1;
+ Eina_Bool no_queue : 1;
};
#ifdef EFL_HAVE_THREADS
-typedef struct _Ecore_Pthread_Notify Ecore_Pthread_Notify;
-struct _Ecore_Pthread_Notify
-{
- Ecore_Pthread_Worker *work;
- const void *user_data;
-};
-
-typedef void *(*Ecore_Thread_Sync_Cb)(void* data, Ecore_Thread *thread);
+typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data;
-typedef struct _Ecore_Pthread_Message Ecore_Pthread_Message;
-struct _Ecore_Pthread_Message
+struct _Ecore_Pthread_Data
{
- union {
- Ecore_Thread_Cb async;
- Ecore_Thread_Sync_Cb sync;
- } u;
-
- const void *data;
-
- int code;
-
- Eina_Bool callback : 1;
- Eina_Bool sync : 1;
+ Ecore_Pthread_Worker *death_job;
+ Ecore_Pipe *p;
+ void *data;
+ PH(thread);
};
-
#endif
static int _ecore_thread_count_max = 0;
+static int ECORE_THREAD_PIPE_DEL = 0;
+static Eina_Array *_ecore_thread_pipe = NULL;
#ifdef EFL_HAVE_THREADS
-static void _ecore_thread_handler(void *data);
+static void _ecore_thread_handler(void *data __UNUSED__,
+ void *buffer,
+ unsigned int nbyte);
+
+static Ecore_Pipe *
+_ecore_thread_pipe_get(void)
+{
+ if (eina_array_count(_ecore_thread_pipe) > 0)
+ return eina_array_pop(_ecore_thread_pipe);
+
+ return ecore_pipe_add(_ecore_thread_handler, NULL);
+}
static int _ecore_thread_count = 0;
-static Eina_List *_ecore_running_job = NULL;
+static Ecore_Event_Handler *del_handler = NULL;
+static Eina_List *_ecore_active_job_threads = NULL;
static Eina_List *_ecore_pending_job_threads = NULL;
static Eina_List *_ecore_pending_job_threads_feedback = NULL;
static LK(_ecore_pending_job_threads_mutex);
@@ -232,7 +413,7 @@ static Eina_Bool have_main_loop_thread = 0;
static Eina_Trash *_ecore_thread_worker_trash = NULL;
static int _ecore_thread_worker_count = 0;
-static void *_ecore_thread_worker(void *);
+static void *_ecore_thread_worker(Ecore_Pthread_Data *pth);
static Ecore_Pthread_Worker *_ecore_thread_worker_new(void);
static PH(get_main_loop_thread) (void)
@@ -254,13 +435,8 @@ static PH(get_main_loop_thread) (void)
static void
_ecore_thread_worker_free(Ecore_Pthread_Worker *worker)
{
- LKD(worker->cancel_mutex);
- CDD(worker->cond);
- LKD(worker->mutex);
-
- if (_ecore_thread_worker_count > ((_ecore_thread_count_max + 1) * 16))
+ if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16)
{
- _ecore_thread_worker_count--;
free(worker);
return;
}
@@ -278,9 +454,68 @@ _ecore_thread_data_free(void *data)
}
static void
-_ecore_thread_join(PH(thread))
+_ecore_thread_pipe_free(void *data __UNUSED__,
+ void *event)
{
- PHJ(thread);
+ Ecore_Pipe *p = event;
+
+ if (eina_array_count(_ecore_thread_pipe) < 50)
+ eina_array_push(_ecore_thread_pipe, p);
+ else
+ ecore_pipe_del(p);
+ eina_threads_shutdown();
+}
+
+static Eina_Bool
+_ecore_thread_pipe_del(void *data __UNUSED__,
+ int type __UNUSED__,
+ void *event __UNUSED__)
+{
+ /* This is a hack to delay pipe destruction until we are out of its internal loop. */
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_ecore_thread_end(Ecore_Pthread_Data *pth,
+ Ecore_Thread *work)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work;
+ Ecore_Pipe *p;
+
+ if (!worker->feedback_run || (worker->feedback_run && !worker->no_queue))
+ _ecore_thread_count--;
+
+ if (PHJ(pth->thread, p) != 0)
+ return;
+
+ if (eina_list_count(_ecore_pending_job_threads) > 0
+ && (unsigned int)_ecore_thread_count < eina_list_count(_ecore_pending_job_threads)
+ && _ecore_thread_count < _ecore_thread_count_max)
+ {
+ /* One more thread should be created. */
+ INF("spawning threads because of still pending jobs.");
+
+ pth->death_job = _ecore_thread_worker_new();
+ if (!pth->p || !pth->death_job) goto end;
+
+ eina_threads_init();
+
+ if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
+ {
+ _ecore_thread_count++;
+ return;
+ }
+
+ eina_threads_shutdown();
+
+end:
+ if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
+ }
+
+ _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth);
+
+ ecore_event_add(ECORE_THREAD_PIPE_DEL, pth->p, _ecore_thread_pipe_free, NULL);
+ free(pth);
}
static void
@@ -299,18 +534,30 @@ _ecore_thread_kill(Ecore_Pthread_Worker *work)
if (work->feedback_run)
{
+ ecore_pipe_del(work->u.feedback_run.notify);
+
+ if (work->u.feedback_run.direct_pipe)
+ eina_array_push(_ecore_thread_pipe, work->u.feedback_run.direct_pipe);
if (work->u.feedback_run.direct_worker)
_ecore_thread_worker_free(work->u.feedback_run.direct_worker);
}
+ CDD(work->cond);
+ LKD(work->mutex);
if (work->hash)
eina_hash_free(work->hash);
_ecore_thread_worker_free(work);
}
static void
-_ecore_thread_handler(void *data)
+_ecore_thread_handler(void *data __UNUSED__,
+ void *buffer,
+ unsigned int nbyte)
{
- Ecore_Pthread_Worker *work = data;
+ Ecore_Pthread_Worker *work;
+
+ if (nbyte != sizeof (Ecore_Pthread_Worker *)) return;
+
+ work = *(Ecore_Pthread_Worker **)buffer;
if (work->feedback_run)
{
@@ -324,20 +571,17 @@ _ecore_thread_handler(void *data)
_ecore_thread_kill(work);
}
-#if 0
static void
-_ecore_nothing_handler(void *data __UNUSED__, void *buffer __UNUSED__, unsigned int nbyte __UNUSED__)
+_ecore_notify_handler(void *data,
+ void *buffer,
+ unsigned int nbyte)
{
-}
-#endif
+ Ecore_Pthread_Worker *work = data;
+ void *user_data;
-static void
-_ecore_notify_handler(void *data)
-{
- Ecore_Pthread_Notify *notify = data;
- Ecore_Pthread_Worker *work = notify->work;
- void *user_data = (void*) notify->user_data;
+ if (nbyte != sizeof (Ecore_Pthread_Worker *)) return;
+ user_data = *(void **)buffer;
work->u.feedback_run.received++;
if (work->u.feedback_run.func_notify)
@@ -348,148 +592,95 @@ _ecore_notify_handler(void *data)
{
_ecore_thread_kill(work);
}
-
- free(notify);
}
static void
-_ecore_message_notify_handler(void *data)
+_ecore_short_job(Ecore_Pipe *end_pipe,
+ PH(thread))
{
- Ecore_Pthread_Notify *notify = data;
- Ecore_Pthread_Worker *work = notify->work;
- Ecore_Pthread_Message *user_data = (void *) notify->user_data;
- Eina_Bool delete = EINA_TRUE;
-
- work->u.message_run.from.received++;
+ Ecore_Pthread_Worker *work;
- if (!user_data->callback)
+ while (_ecore_pending_job_threads)
{
- if (work->u.message_run.func_notify)
- work->u.message_run.func_notify((void *) work->data, (Ecore_Thread *) work, (void *) user_data->data);
- }
- else
- {
- if (user_data->sync)
+ LKL(_ecore_pending_job_threads_mutex);
+
+ if (!_ecore_pending_job_threads)
+ {
+ LKU(_ecore_pending_job_threads_mutex);
+ break;
+ }
+
+ work = eina_list_data_get(_ecore_pending_job_threads);
+ _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads,
+ _ecore_pending_job_threads);
+
+ LKU(_ecore_pending_job_threads_mutex);
+
+ work->self = thread;
+ if (!work->cancel)
+ work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work);
+
+ if (work->reschedule)
{
- user_data->data = user_data->u.sync((void*) user_data->data, (Ecore_Thread *) work);
- user_data->callback = EINA_FALSE;
- user_data->code = INT_MAX;
- ecore_pipe_write(work->u.message_run.send, &user_data, sizeof (Ecore_Pthread_Message *));
+ work->reschedule = EINA_FALSE;
- delete = EINA_FALSE;
+ LKL(_ecore_pending_job_threads_mutex);
+ _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
+ LKU(_ecore_pending_job_threads_mutex);
}
else
{
- user_data->u.async((void*) user_data->data, (Ecore_Thread *) work);
+ ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
}
}
-
- if (delete)
- {
- free(user_data);
- }
-
- /* Force reading all notify event before killing the thread */
- if (work->kill && work->u.message_run.from.send == work->u.message_run.from.received)
- {
- _ecore_thread_kill(work);
- }
- free(notify);
}
static void
-_ecore_short_job(PH(thread))
+_ecore_feedback_job(Ecore_Pipe *end_pipe,
+ PH(thread))
{
Ecore_Pthread_Worker *work;
- int cancel;
-
- LKL(_ecore_pending_job_threads_mutex);
-
- if (!_ecore_pending_job_threads)
- {
- LKU(_ecore_pending_job_threads_mutex);
- return;
- }
-
- work = eina_list_data_get(_ecore_pending_job_threads);
- _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads,
- _ecore_pending_job_threads);
- _ecore_running_job = eina_list_append(_ecore_running_job, work);
- LKU(_ecore_pending_job_threads_mutex);
-
- LKL(work->cancel_mutex);
- cancel = work->cancel;
- LKU(work->cancel_mutex);
- work->self = thread;
- if (!cancel)
- work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work);
- LKL(_ecore_pending_job_threads_mutex);
- _ecore_running_job = eina_list_remove(_ecore_running_job, work);
- LKU(_ecore_pending_job_threads_mutex);
-
- if (work->reschedule)
+ while (_ecore_pending_job_threads_feedback)
{
- work->reschedule = EINA_FALSE;
-
LKL(_ecore_pending_job_threads_mutex);
- _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
- LKU(_ecore_pending_job_threads_mutex);
- }
- else
- {
- ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
- }
-}
-static void
-_ecore_feedback_job(PH(thread))
-{
- Ecore_Pthread_Worker *work;
- int cancel;
-
- LKL(_ecore_pending_job_threads_mutex);
-
- if (!_ecore_pending_job_threads_feedback)
- {
- LKU(_ecore_pending_job_threads_mutex);
- return;
- }
-
- work = eina_list_data_get(_ecore_pending_job_threads_feedback);
- _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback,
- _ecore_pending_job_threads_feedback);
- _ecore_running_job = eina_list_append(_ecore_running_job, work);
- LKU(_ecore_pending_job_threads_mutex);
-
- LKL(work->cancel_mutex);
- cancel = work->cancel;
- LKU(work->cancel_mutex);
- work->self = thread;
- if (!cancel)
- work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
+ if (!_ecore_pending_job_threads_feedback)
+ {
+ LKU(_ecore_pending_job_threads_mutex);
+ break;
+ }
- LKL(_ecore_pending_job_threads_mutex);
- _ecore_running_job = eina_list_remove(_ecore_running_job, work);
- LKU(_ecore_pending_job_threads_mutex);
+ work = eina_list_data_get(_ecore_pending_job_threads_feedback);
+ _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback,
+ _ecore_pending_job_threads_feedback);
- if (work->reschedule)
- {
- work->reschedule = EINA_FALSE;
-
- LKL(_ecore_pending_job_threads_mutex);
- _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, work);
LKU(_ecore_pending_job_threads_mutex);
- }
- else
- {
- ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
+
+ work->self = thread;
+ if (!work->cancel)
+ work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work);
+
+ if (work->reschedule)
+ {
+ work->reschedule = EINA_FALSE;
+
+ LKL(_ecore_pending_job_threads_mutex);
+ _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, work);
+ LKU(_ecore_pending_job_threads_mutex);
+ }
+ else
+ {
+ ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
+ }
}
}
static void *
_ecore_direct_worker(Ecore_Pthread_Worker *work)
{
+ Ecore_Pthread_Data *pth;
+
#ifdef EFL_POSIX_THREADS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
@@ -497,23 +688,50 @@ _ecore_direct_worker(Ecore_Pthread_Worker *work)
eina_sched_prio_drop();
- work->self = PHS();
- if (work->message_run)
- work->u.message_run.func_main((void *) work->data, (Ecore_Thread *) work);
- else
- work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
+ pth = malloc(sizeof (Ecore_Pthread_Data));
+ if (!pth) return NULL;
- ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
+ pth->p = work->u.feedback_run.direct_pipe;
+ if (!pth->p)
+ {
+ free(pth);
+ return NULL;
+ }
+ pth->thread = PHS();
- ecore_main_loop_thread_safe_call_async((Ecore_Cb) _ecore_thread_join,
- (void*) PHS());
+ work->self = pth->thread;
+ work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work);
- return NULL;
+ ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
+
+ work = work->u.feedback_run.direct_worker;
+ if (!work)
+ {
+ free(pth);
+ return NULL;
+ }
+
+ work->data = pth;
+ work->u.short_run.func_blocking = NULL;
+ work->func_end = (void *)_ecore_thread_end;
+ work->func_cancel = NULL;
+ work->cancel = EINA_FALSE;
+ work->feedback_run = EINA_FALSE;
+ work->kill = EINA_FALSE;
+ work->hash = NULL;
+ CDI(work->cond);
+ LKI(work->mutex);
+
+ ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
+
+ return pth->p;
}
static void *
-_ecore_thread_worker(void *data __UNUSED__)
+_ecore_thread_worker(Ecore_Pthread_Data *pth)
{
+ Ecore_Pthread_Worker *work;
+
#ifdef EFL_POSIX_THREADS
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
@@ -522,8 +740,8 @@ _ecore_thread_worker(void *data __UNUSED__)
eina_sched_prio_drop();
restart:
- _ecore_short_job(PHS());
- _ecore_feedback_job(PHS());
+ if (_ecore_pending_job_threads) _ecore_short_job(pth->p, pth->thread);
+ if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->p, pth->thread);
/* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */
@@ -539,7 +757,7 @@ restart:
#ifdef _WIN32
Sleep(1); /* around 50ms */
#else
- usleep(50);
+ usleep(200);
#endif
LKL(_ecore_pending_job_threads_mutex);
@@ -548,13 +766,25 @@ restart:
LKU(_ecore_pending_job_threads_mutex);
goto restart;
}
- _ecore_thread_count--;
-
- ecore_main_loop_thread_safe_call_async((Ecore_Cb) _ecore_thread_join,
- (void*) PHS());
LKU(_ecore_pending_job_threads_mutex);
- return NULL;
+ work = pth->death_job;
+ if (!work) return NULL;
+
+ work->data = pth;
+ work->u.short_run.func_blocking = NULL;
+ work->func_end = (void *)_ecore_thread_end;
+ work->func_cancel = NULL;
+ work->cancel = EINA_FALSE;
+ work->feedback_run = EINA_FALSE;
+ work->kill = EINA_FALSE;
+ work->hash = NULL;
+ CDI(work->cond);
+ LKI(work->mutex);
+
+ ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
+
+ return pth->p;
}
#endif
@@ -567,15 +797,8 @@ _ecore_thread_worker_new(void)
result = eina_trash_pop(&_ecore_thread_worker_trash);
- if (!result)
- {
- result = calloc(1, sizeof(Ecore_Pthread_Worker));
- _ecore_thread_worker_count++;
- }
-
- LKI(result->cancel_mutex);
- LKI(result->mutex);
- CDI(result->cond, result->mutex);
+ if (!result) result = malloc(sizeof (Ecore_Pthread_Worker));
+ else _ecore_thread_worker_count--;
return result;
#else
@@ -590,11 +813,16 @@ _ecore_thread_init(void)
if (_ecore_thread_count_max <= 0)
_ecore_thread_count_max = 1;
+ ECORE_THREAD_PIPE_DEL = ecore_event_type_new();
+ _ecore_thread_pipe = eina_array_new(8);
+
#ifdef EFL_HAVE_THREADS
+ del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
+
LKI(_ecore_pending_job_threads_mutex);
LRWKI(_ecore_thread_global_hash_lock);
LKI(_ecore_thread_global_hash_mutex);
- CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex);
+ CDI(_ecore_thread_global_hash_cond);
#endif
}
@@ -602,69 +830,77 @@ void
_ecore_thread_shutdown(void)
{
/* FIXME: If function are still running in the background, should we kill them ? */
+ Ecore_Pipe *p;
+ Eina_Array_Iterator it;
+ unsigned int i;
+
#ifdef EFL_HAVE_THREADS
Ecore_Pthread_Worker *work;
- Eina_List *l;
- Eina_Bool test;
- int iteration = 0;
+ Ecore_Pthread_Data *pth;
LKL(_ecore_pending_job_threads_mutex);
EINA_LIST_FREE(_ecore_pending_job_threads, work)
{
if (work->func_cancel)
- work->func_cancel((void *)work->data, (Ecore_Thread *) work);
+ work->func_cancel((void *)work->data, (Ecore_Thread *)work);
free(work);
}
EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work)
{
if (work->func_cancel)
- work->func_cancel((void *)work->data, (Ecore_Thread *) work);
+ work->func_cancel((void *)work->data, (Ecore_Thread *)work);
free(work);
}
- EINA_LIST_FOREACH(_ecore_running_job, l, work)
- ecore_thread_cancel((Ecore_Thread*) work);
-
LKU(_ecore_pending_job_threads_mutex);
- do
+ /* Improve emergency shutdown */
+ EINA_LIST_FREE(_ecore_active_job_threads, pth)
{
- LKL(_ecore_pending_job_threads_mutex);
- if (_ecore_thread_count > 0)
- {
- test = EINA_TRUE;
- }
- else
- {
- test = EINA_FALSE;
- }
- LKU(_ecore_pending_job_threads_mutex);
- iteration++;
- if (test) usleep(50000);
- }
- while (test == EINA_TRUE && iteration < 20);
+ Ecore_Pipe *ep;
- if (iteration == 20 && _ecore_thread_count > 0)
- {
- ERR("%i of the child thread are still running after 1s. This can lead to a segv. Sorry.", _ecore_thread_count);
- }
+ PHA(pth->thread);
+ PHJ(pth->thread, ep);
+ ecore_pipe_del(pth->p);
+ }
if (_ecore_thread_global_hash)
eina_hash_free(_ecore_thread_global_hash);
+ _ecore_event_handler_del(del_handler);
have_main_loop_thread = 0;
-
- while ((work = eina_trash_pop(&_ecore_thread_worker_trash)))
- {
- free(work);
- }
+ del_handler = NULL;
LKD(_ecore_pending_job_threads_mutex);
LRWKD(_ecore_thread_global_hash_lock);
LKD(_ecore_thread_global_hash_mutex);
CDD(_ecore_thread_global_hash_cond);
#endif
+
+ EINA_ARRAY_ITER_NEXT(_ecore_thread_pipe, i, p, it)
+ ecore_pipe_del(p);
+
+ eina_array_free(_ecore_thread_pipe);
+ _ecore_thread_pipe = NULL;
+}
+
+void
+_ecore_thread_assert_main_loop_thread(const char *function)
+{
+ Eina_Bool good;
+#ifdef EFL_HAVE_THREADS
+ good = PHE(get_main_loop_thread(), PHS());
+#else
+ good = EINA_TRUE;
+#endif
+ if (!good)
+ {
+ EINA_LOG_CRIT("Call to %s from wrong thread!", function);
+#if 0
+ abort();
+#endif
+ }
}
EAPI Ecore_Thread *
@@ -674,13 +910,10 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
const void *data)
{
Ecore_Pthread_Worker *work;
- Eina_Bool tried = EINA_FALSE;
#ifdef EFL_HAVE_THREADS
- PH(thread);
+ Ecore_Pthread_Data *pth = NULL;
#endif
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
-
if (!func_blocking) return NULL;
work = _ecore_thread_worker_new();
@@ -696,15 +929,15 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
work->func_cancel = func_cancel;
work->cancel = EINA_FALSE;
work->feedback_run = EINA_FALSE;
- work->message_run = EINA_FALSE;
work->kill = EINA_FALSE;
work->reschedule = EINA_FALSE;
- work->no_queue = EINA_FALSE;
work->data = data;
#ifdef EFL_HAVE_THREADS
work->self = 0;
work->hash = NULL;
+ CDI(work->cond);
+ LKI(work->mutex);
LKL(_ecore_pending_job_threads_mutex);
_ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
@@ -718,41 +951,42 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
LKU(_ecore_pending_job_threads_mutex);
/* One more thread could be created. */
- eina_threads_init();
+ pth = malloc(sizeof (Ecore_Pthread_Data));
+ if (!pth) goto on_error;
- LKL(_ecore_pending_job_threads_mutex);
+ pth->p = _ecore_thread_pipe_get();
+ pth->death_job = _ecore_thread_worker_new();
+ if (!pth->p || !pth->death_job) goto on_error;
- retry:
- if (PHC(thread, _ecore_thread_worker, NULL) == 0)
+ eina_threads_init();
+
+ if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
{
_ecore_thread_count++;
- LKU(_ecore_pending_job_threads_mutex);
return (Ecore_Thread *)work;
}
- if (!tried)
+
+ eina_threads_shutdown();
+
+on_error:
+ if (pth)
{
- _ecore_main_call_flush();
- tried = EINA_TRUE;
- goto retry;
+ if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p);
+ if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
+ free(pth);
}
if (_ecore_thread_count == 0)
{
+ LKL(_ecore_pending_job_threads_mutex);
_ecore_pending_job_threads = eina_list_remove(_ecore_pending_job_threads, work);
+ LKU(_ecore_pending_job_threads_mutex);
if (work->func_cancel)
- work->func_cancel((void *) work->data, (Ecore_Thread *) work);
-
- CDD(work->cond);
- LKD(work->mutex);
- LKD(work->cancel_mutex);
+ work->func_cancel((void *)work->data, (Ecore_Thread *)work);
free(work);
work = NULL;
}
- LKU(_ecore_pending_job_threads_mutex);
-
- eina_threads_shutdown();
-
return (Ecore_Thread *)work;
#else
/*
@@ -781,16 +1015,12 @@ EAPI Eina_Bool
ecore_thread_cancel(Ecore_Thread *thread)
{
#ifdef EFL_HAVE_THREADS
- Ecore_Pthread_Worker *volatile work = (Ecore_Pthread_Worker *)thread;
+ Ecore_Pthread_Worker *work = (Ecore_Pthread_Worker *)thread;
Eina_List *l;
- int cancel;
if (!work)
return EINA_TRUE;
- LKL(work->cancel_mutex);
- cancel = work->cancel;
- LKU(work->cancel_mutex);
- if (cancel)
+ if (work->cancel)
return EINA_FALSE;
if (work->feedback_run)
@@ -842,14 +1072,9 @@ ecore_thread_cancel(Ecore_Thread *thread)
LKU(_ecore_pending_job_threads_mutex);
- work = (Ecore_Pthread_Worker *)thread;
-
/* Delay the destruction */
- on_exit:
- LKL(work->cancel_mutex);
- work->cancel = EINA_TRUE;
- LKU(work->cancel_mutex);
-
+on_exit:
+ ((Ecore_Pthread_Worker *)thread)->cancel = EINA_TRUE;
return EINA_FALSE;
#else
(void) thread;
@@ -860,23 +1085,10 @@ ecore_thread_cancel(Ecore_Thread *thread)
EAPI Eina_Bool
ecore_thread_check(Ecore_Thread *thread)
{
- Ecore_Pthread_Worker *volatile worker = (Ecore_Pthread_Worker *) thread;
- int cancel;
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
if (!worker) return EINA_TRUE;
-#ifdef EFL_HAVE_THREADS
- LKL(worker->cancel_mutex);
-#endif
- cancel = worker->cancel;
- /* FIXME: there is an insane bug driving me nuts here. I don't know if
- it's a race condition, some cache issue or some alien attack on our software.
- But ecore_thread_check will only work correctly with a printf, all the volatile,
- lock and even usleep don't help here... */
- /* fprintf(stderr, "wc: %i\n", cancel); */
-#ifdef EFL_HAVE_THREADS
- LKU(worker->cancel_mutex);
-#endif
- return cancel;
+ return worker->cancel;
}
EAPI Ecore_Thread *
@@ -889,11 +1101,8 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
{
#ifdef EFL_HAVE_THREADS
Ecore_Pthread_Worker *worker;
- Eina_Bool tried = EINA_FALSE;
- PH(thread);
+ Ecore_Pthread_Data *pth = NULL;
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
-
if (!func_heavy) return NULL;
worker = _ecore_thread_worker_new();
@@ -902,11 +1111,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
worker->u.feedback_run.func_heavy = func_heavy;
worker->u.feedback_run.func_notify = func_notify;
worker->hash = NULL;
+ CDI(worker->cond);
+ LKI(worker->mutex);
worker->func_cancel = func_cancel;
worker->func_end = func_end;
worker->data = data;
worker->cancel = EINA_FALSE;
- worker->message_run = EINA_FALSE;
worker->feedback_run = EINA_TRUE;
worker->kill = EINA_FALSE;
worker->reschedule = EINA_FALSE;
@@ -915,32 +1125,22 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
worker->u.feedback_run.send = 0;
worker->u.feedback_run.received = 0;
+ worker->u.feedback_run.notify = ecore_pipe_add(_ecore_notify_handler, worker);
+ worker->u.feedback_run.direct_pipe = NULL;
worker->u.feedback_run.direct_worker = NULL;
- if (try_no_queue)
+ if (!try_no_queue)
{
PH(t);
+ worker->u.feedback_run.direct_pipe = _ecore_thread_pipe_get();
worker->u.feedback_run.direct_worker = _ecore_thread_worker_new();
worker->no_queue = EINA_TRUE;
eina_threads_init();
- retry_direct:
if (PHC(t, _ecore_direct_worker, worker) == 0)
return (Ecore_Thread *)worker;
- if (!tried)
- {
- _ecore_main_call_flush();
- tried = EINA_TRUE;
- goto retry_direct;
- }
-
- if (worker->u.feedback_run.direct_worker)
- {
- _ecore_thread_worker_free(worker->u.feedback_run.direct_worker);
- worker->u.feedback_run.direct_worker = NULL;
- }
eina_threads_shutdown();
}
@@ -959,44 +1159,47 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
LKU(_ecore_pending_job_threads_mutex);
/* One more thread could be created. */
+ pth = malloc(sizeof (Ecore_Pthread_Data));
+ if (!pth) goto on_error;
+
+ pth->p = _ecore_thread_pipe_get();
+ pth->death_job = _ecore_thread_worker_new();
+ if (!pth->p || !pth->death_job) goto on_error;
+
eina_threads_init();
- LKL(_ecore_pending_job_threads_mutex);
- retry:
- if (PHC(thread, _ecore_thread_worker, NULL) == 0)
+ if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
{
_ecore_thread_count++;
- LKU(_ecore_pending_job_threads_mutex);
return (Ecore_Thread *)worker;
}
- if (!tried)
- {
- _ecore_main_call_flush();
- tried = EINA_TRUE;
- goto retry;
- }
- LKU(_ecore_pending_job_threads_mutex);
eina_threads_shutdown();
on_error:
- LKL(_ecore_pending_job_threads_mutex);
+ if (pth)
+ {
+ if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p);
+ if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
+ free(pth);
+ }
+
if (_ecore_thread_count == 0)
{
+ LKL(_ecore_pending_job_threads_mutex);
_ecore_pending_job_threads_feedback = eina_list_remove(_ecore_pending_job_threads_feedback,
worker);
+ LKU(_ecore_pending_job_threads_mutex);
if (func_cancel) func_cancel((void *)data, NULL);
if (worker)
{
- CDD(worker->cond);
- LKD(worker->mutex);
+ ecore_pipe_del(worker->u.feedback_run.notify);
free(worker);
worker = NULL;
}
}
- LKU(_ecore_pending_job_threads_mutex);
return (Ecore_Thread *)worker;
#else
@@ -1010,6 +1213,7 @@ on_error:
*/
worker.u.feedback_run.func_heavy = func_heavy;
worker.u.feedback_run.func_notify = func_notify;
+ worker.u.feedback_run.notify = NULL;
worker.u.feedback_run.send = 0;
worker.u.feedback_run.received = 0;
worker.func_cancel = func_cancel;
@@ -1017,7 +1221,6 @@ on_error:
worker.data = data;
worker.cancel = EINA_FALSE;
worker.feedback_run = EINA_TRUE;
- worker.message_run = EINA_FALSE;
worker.kill = EINA_FALSE;
do {
@@ -1040,48 +1243,13 @@ ecore_thread_feedback(Ecore_Thread *thread,
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
if (!worker) return EINA_FALSE;
+ if (!worker->feedback_run) return EINA_FALSE;
#ifdef EFL_HAVE_THREADS
if (!PHE(worker->self, PHS())) return EINA_FALSE;
- if (worker->feedback_run)
- {
- Ecore_Pthread_Notify *notify;
-
- notify = malloc(sizeof (Ecore_Pthread_Notify));
- if (!notify) return EINA_FALSE;
-
- notify->user_data = data;
- notify->work = worker;
- worker->u.feedback_run.send++;
-
- ecore_main_loop_thread_safe_call_async(_ecore_notify_handler, notify);
- }
- else if (worker->message_run)
- {
- Ecore_Pthread_Message *msg;
- Ecore_Pthread_Notify *notify;
-
- msg = malloc(sizeof (Ecore_Pthread_Message*));
- if (!msg) return EINA_FALSE;
- msg->data = data;
- msg->callback = EINA_FALSE;
- msg->sync = EINA_FALSE;
-
- notify = malloc(sizeof (Ecore_Pthread_Notify));
- if (!notify)
- {
- free(msg);
- return EINA_FALSE;
- }
- notify->work = worker;
- notify->user_data = msg;
-
- worker->u.message_run.from.send++;
- ecore_main_loop_thread_safe_call_async(_ecore_message_notify_handler, notify);
- }
- else
- return EINA_FALSE;
+ worker->u.feedback_run.send++;
+ ecore_pipe_write(worker->u.feedback_run.notify, &data, sizeof (void *));
return EINA_TRUE;
#else
@@ -1091,71 +1259,6 @@ ecore_thread_feedback(Ecore_Thread *thread,
#endif
}
-#if 0
-EAPI Ecore_Thread *
-ecore_thread_message_run(Ecore_Thread_Cb func_main,
- Ecore_Thread_Notify_Cb func_notify,
- Ecore_Thread_Cb func_end,
- Ecore_Thread_Cb func_cancel,
- const void *data)
-{
-#ifdef EFL_HAVE_THREADS
- Ecore_Pthread_Worker *worker;
- PH(t);
-
- if (!func_main) return NULL;
-
- worker = _ecore_thread_worker_new();
- if (!worker) return NULL;
-
- worker->u.message_run.func_main = func_main;
- worker->u.message_run.func_notify = func_notify;
- worker->u.message_run.direct_worker = _ecore_thread_worker_new();
- worker->u.message_run.send = ecore_pipe_add(_ecore_nothing_handler, worker);
- worker->u.message_run.from.send = 0;
- worker->u.message_run.from.received = 0;
- worker->u.message_run.to.send = 0;
- worker->u.message_run.to.received = 0;
-
- ecore_pipe_freeze(worker->u.message_run.send);
-
- worker->func_cancel = func_cancel;
- worker->func_end = func_end;
- worker->hash = NULL;
- worker->data = data;
-
- worker->cancel = EINA_FALSE;
- worker->message_run = EINA_TRUE;
- worker->feedback_run = EINA_FALSE;
- worker->kill = EINA_FALSE;
- worker->reschedule = EINA_FALSE;
- worker->no_queue = EINA_FALSE;
- worker->self = 0;
-
- eina_threads_init();
-
- if (PHC(t, _ecore_direct_worker, worker) == 0)
- return (Ecore_Thread*) worker;
-
- eina_threads_shutdown();
-
- if (worker->u.message_run.direct_worker) _ecore_thread_worker_free(worker->u.message_run.direct_worker);
- if (worker->u.message_run.send) ecore_pipe_del(worker->u.message_run.send);
-
- CDD(worker->cond);
- LKD(worker->mutex);
-#else
- /* Note: This type of thread can't and never will work without thread support */
- WRN("ecore_thread_message_run called, but threads disable in Ecore, things will go wrong. Starting now !");
-# warning "You disabled threads support in ecore, I hope you know what you are doing !"
-#endif
-
- func_cancel((void *) data, NULL);
-
- return NULL;
-}
-#endif
-
EAPI Eina_Bool
ecore_thread_reschedule(Ecore_Thread *thread)
{
@@ -1175,7 +1278,6 @@ EAPI int
ecore_thread_active_get(void)
{
#ifdef EFL_HAVE_THREADS
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
return _ecore_thread_count;
#else
return 0;
@@ -1188,7 +1290,6 @@ ecore_thread_pending_get(void)
#ifdef EFL_HAVE_THREADS
int ret;
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
LKL(_ecore_pending_job_threads_mutex);
ret = eina_list_count(_ecore_pending_job_threads);
LKU(_ecore_pending_job_threads_mutex);
@@ -1204,7 +1305,6 @@ ecore_thread_pending_feedback_get(void)
#ifdef EFL_HAVE_THREADS
int ret;
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
LKL(_ecore_pending_job_threads_mutex);
ret = eina_list_count(_ecore_pending_job_threads_feedback);
LKU(_ecore_pending_job_threads_mutex);
@@ -1220,7 +1320,6 @@ ecore_thread_pending_total_get(void)
#ifdef EFL_HAVE_THREADS
int ret;
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
LKL(_ecore_pending_job_threads_mutex);
ret = eina_list_count(_ecore_pending_job_threads) + eina_list_count(_ecore_pending_job_threads_feedback);
LKU(_ecore_pending_job_threads_mutex);
@@ -1233,17 +1332,15 @@ ecore_thread_pending_total_get(void)
EAPI int
ecore_thread_max_get(void)
{
- EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
return _ecore_thread_count_max;
}
EAPI void
ecore_thread_max_set(int num)
{
- EINA_MAIN_LOOP_CHECK_RETURN;
if (num < 1) return;
/* avoid doing something hilarious by blocking dumb users */
- if (num > (16 * eina_cpu_count())) num = 16 * eina_cpu_count();
+ if (num >= (2 * eina_cpu_count())) return;
_ecore_thread_count_max = num;
}
@@ -1251,7 +1348,6 @@ ecore_thread_max_set(int num)
EAPI void
ecore_thread_max_reset(void)
{
- EINA_MAIN_LOOP_CHECK_RETURN;
_ecore_thread_count_max = eina_cpu_count();
}
@@ -1547,13 +1643,24 @@ ecore_thread_global_data_wait(const char *key,
while (1)
{
+#ifndef _WIN32
+ struct timespec t = { 0, 0 };
+
+ t.tv_sec = (long int)tm;
+ t.tv_nsec = (long int)((tm - (double)t.tv_sec) * 1000000000);
+#else
+ struct timeval t = { 0, 0 };
+
+ t.tv_sec = (long int)tm;
+ t.tv_usec = (long int)((tm - (double)t.tv_sec) * 1000000);
+#endif
LRWKRL(_ecore_thread_global_hash_lock);
ret = eina_hash_find(_ecore_thread_global_hash, key);
LRWKU(_ecore_thread_global_hash_lock);
if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get())))
break;
LKL(_ecore_thread_global_hash_mutex);
- CDW(_ecore_thread_global_hash_cond, tm);
+ CDW(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex, &t);
LKU(_ecore_thread_global_hash_mutex);
}
if (ret) return ret->data;
diff --git a/src/lib/ecore_con/Ecore_Con.h b/src/lib/ecore_con/Ecore_Con.h
index 0a832fc3..9784adf7 100644
--- a/src/lib/ecore_con/Ecore_Con.h
+++ b/src/lib/ecore_con/Ecore_Con.h
@@ -653,12 +653,7 @@ typedef enum _Ecore_Con_Type
/** Use both TLS and SSL3 */
ECORE_CON_USE_MIXED = ECORE_CON_USE_SSL3 | ECORE_CON_USE_TLS,
/** Attempt to use the loaded certificate */
- ECORE_CON_LOAD_CERT = (1 << 7),
- /** Disable all types of proxy on the server
- * @note Only functional for clients
- * @since 1.2
- */
- ECORE_CON_NO_PROXY = (1 << 8)
+ ECORE_CON_LOAD_CERT = (1 << 7)
} Ecore_Con_Type;
/**
diff --git a/src/lib/ecore_con/Makefile.am b/src/lib/ecore_con/Makefile.am
index 0e8e0715..929b30e9 100644
--- a/src/lib/ecore_con/Makefile.am
+++ b/src/lib/ecore_con/Makefile.am
@@ -8,7 +8,6 @@ AM_CPPFLAGS = \
@EFL_ECORE_CON_BUILD@ \
@SSL_CFLAGS@ \
@CURL_CFLAGS@ \
-@EVIL_CFLAGS@ \
@EINA_CFLAGS@ \
@TLS_CFLAGS@ \
@CARES_CFLAGS@ \
@@ -25,8 +24,6 @@ ecore_con_ssl.c \
ecore_con_url.c \
ecore_con_alloc.c
-libecore_con_la_CFLAGS = @WIN32_CFLAGS@
-
if ECORE_HAVE_WIN32
libecore_con_la_SOURCES += ecore_con_local_win32.c
else
@@ -36,17 +33,13 @@ endif
if HAVE_CARES
libecore_con_la_SOURCES += ecore_con_ares.c
else
-if HAVE_IPV6
-libecore_con_la_CFLAGS += @ECORE_CON_CFLAGS@
-libecore_con_la_SOURCES += ecore_con_dns.c dns.c dns.h
-else
libecore_con_la_SOURCES += ecore_con_info.c
endif
-endif
+libecore_con_la_CFLAGS = @WIN32_CFLAGS@
libecore_con_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
-@SSL_LIBS@ @CURL_LIBS@ @EINA_LIBS@ @EVIL_LIBS@ @TLS_LIBS@ @CARES_LIBS@ @WIN32_LIBS@
+@SSL_LIBS@ @CURL_LIBS@ @EINA_LIBS@ @TLS_LIBS@ @CARES_LIBS@ @WIN32_LIBS@
libecore_con_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
diff --git a/src/lib/ecore_con/dns.c b/src/lib/ecore_con/dns.c
deleted file mode 100644
index 2413b0c9..00000000
--- a/src/lib/ecore_con/dns.c
+++ /dev/null
@@ -1,7873 +0,0 @@
-/* ==========================================================================
- * dns.c - Recursive, Reentrant DNS Resolver.
- * --------------------------------------------------------------------------
- * Copyright (c) 2008, 2009, 2010 William Ahern
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- * ==========================================================================
- */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE 600
-#endif
-
-#undef _BSD_SOURCE
-#define _BSD_SOURCE
-
-#undef _DARWIN_C_SOURCE
-#define _DARWIN_C_SOURCE
-
-#include <stddef.h> /* offsetof() */
-#include <stdint.h> /* uint32_t */
-#include <stdlib.h> /* malloc(3) realloc(3) free(3) rand(3) random(3) arc4random(3) */
-#include <stdio.h> /* FILE fopen(3) fclose(3) getc(3) rewind(3) */
-
-#include <string.h> /* memcpy(3) strlen(3) memmove(3) memchr(3) memcmp(3) strchr(3) strsep(3) strcspn(3) */
-#include <strings.h> /* strcasecmp(3) strncasecmp(3) */
-
-#include <ctype.h> /* isspace(3) isdigit(3) */
-
-#include <time.h> /* time_t time(2) */
-
-#include <signal.h> /* sig_atomic_t */
-
-#include <errno.h> /* errno EINVAL ENOENT */
-
-#undef NDEBUG
-#include <assert.h> /* assert(3) */
-
-#if _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
-#include <sys/types.h> /* FD_SETSIZE socklen_t */
-#include <sys/select.h> /* FD_ZERO FD_SET fd_set select(2) */
-#include <sys/socket.h> /* AF_INET AF_INET6 AF_UNIX struct sockaddr struct sockaddr_in struct sockaddr_in6 socket(2) */
-
-#if defined(AF_UNIX)
-#include <sys/un.h> /* struct sockaddr_un */
-#endif
-
-#include <fcntl.h> /* F_SETFD F_GETFL F_SETFL O_NONBLOCK fcntl(2) */
-
-#include <unistd.h> /* gethostname(3) close(2) */
-
-#include <poll.h> /* POLLIN POLLOUT */
-
-#include <netinet/in.h> /* struct sockaddr_in struct sockaddr_in6 */
-
-#include <arpa/inet.h> /* inet_pton(3) inet_ntop(3) htons(3) ntohs(3) */
-
-#include <netdb.h> /* struct addrinfo */
-#endif
-
-#include "dns.h"
-
-
-/*
- * S T A N D A R D M A C R O S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef MIN
-#define MIN(a, b) (((a) < (b))? (a) : (b))
-#endif
-
-
-#ifndef MAX
-#define MAX(a, b) (((a) > (b))? (a) : (b))
-#endif
-
-
-#ifndef lengthof
-#define lengthof(a) (sizeof (a) / sizeof (a)[0])
-#endif
-
-#ifndef endof
-#define endof(a) (&(a)[lengthof((a))])
-#endif
-
-
-/*
- * D E B U G M A C R O S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-int dns_debug = 0;
-
-#if DNS_DEBUG
-
-#undef DNS_DEBUG
-#define DNS_DEBUG dns_debug
-
-#define DNS_SAY_(fmt, ...) \
- do { if (DNS_DEBUG > 0) fprintf(stderr, fmt "%.1s", __func__, __LINE__, __VA_ARGS__); } while (0)
-#define DNS_SAY(...) DNS_SAY_("@@ (%s:%d) " __VA_ARGS__, "\n")
-#define DNS_HAI DNS_SAY("HAI")
-
-#define DNS_SHOW_(P, fmt, ...) do { \
- if (DNS_DEBUG > 1) { \
- fprintf(stderr, "@@ BEGIN * * * * * * * * * * * *\n"); \
- fprintf(stderr, "@@ " fmt "%.0s\n", __VA_ARGS__); \
- dns_p_dump((P), stderr); \
- fprintf(stderr, "@@ END * * * * * * * * * * * * *\n\n"); \
- } \
-} while (0)
-
-#define DNS_SHOW(...) DNS_SHOW_(__VA_ARGS__, "")
-
-#else /* !DNS_DEBUG */
-
-#undef DNS_DEBUG
-#define DNS_DEBUG 0
-
-#define DNS_SAY(...)
-#define DNS_HAI
-#define DNS_SHOW(...)
-
-#endif /* DNS_DEBUG */
-
-
-/*
- * V E R S I O N R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-const char *dns_vendor(void) {
- return DNS_VENDOR;
-} /* dns_vendor() */
-
-
-int dns_v_rel(void) {
- return DNS_V_REL;
-} /* dns_v_rel() */
-
-
-int dns_v_abi(void) {
- return DNS_V_ABI;
-} /* dns_v_abi() */
-
-
-int dns_v_api(void) {
- return DNS_V_API;
-} /* dns_v_api() */
-
-
-/*
- * E R R O R R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#if _WIN32
-
-#define DNS_EINTR WSAEINTR
-#define DNS_EINPROGRESS WSAEINPROGRESS
-#define DNS_EISCONN WSAEISCONN
-#define DNS_EWOULDBLOCK WSAEWOULDBLOCK
-#define DNS_EALREADY WSAEALREADY
-#define DNS_EAGAIN EAGAIN
-#define DNS_ETIMEDOUT WSAETIMEDOUT
-
-#define dns_syerr() ((int)GetLastError())
-#define dns_soerr() ((int)WSAGetLastError())
-
-#else
-
-#define DNS_EINTR EINTR
-#define DNS_EINPROGRESS EINPROGRESS
-#define DNS_EISCONN EISCONN
-#define DNS_EWOULDBLOCK EWOULDBLOCK
-#define DNS_EALREADY EALREADY
-#define DNS_EAGAIN EAGAIN
-#define DNS_ETIMEDOUT ETIMEDOUT
-
-#define dns_syerr() errno
-#define dns_soerr() errno
-
-#endif
-
-
-const char *dns_strerror(int error) {
- switch (error) {
- case DNS_ENOBUFS:
- return "DNS packet buffer too small";
- case DNS_EILLEGAL:
- return "Illegal DNS RR name or data";
- case DNS_EORDER:
- return "Attempt to push RR out of section order";
- case DNS_ESECTION:
- return "Invalid section specified";
- case DNS_EUNKNOWN:
- return "Unknown DNS error";
- default:
- return strerror(error);
- } /* switch() */
-} /* dns_strerror() */
-
-
-/*
- * A T O M I C R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static unsigned dns_atomic_inc(dns_atomic_t *i) {
- return (*i)++;
-} /* dns_atomic_inc() */
-
-
-static unsigned dns_atomic_dec(dns_atomic_t *i) {
- return (*i)--;
-} /* dns_atomic_dec() */
-
-
-/*
- * C R Y P T O R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * P R N G
- */
-
-#ifndef DNS_RANDOM
-#if defined(HAVE_ARC4RANDOM) \
- || defined(__OpenBSD__) \
- || defined(__FreeBSD__) \
- || defined(__NetBSD__) \
- || defined(__APPLE__)
-#define DNS_RANDOM arc4random
-#elif __linux
-#define DNS_RANDOM random
-#else
-#define DNS_RANDOM rand
-#endif
-#endif
-
-#define DNS_RANDOM_arc4random 1
-#define DNS_RANDOM_random 2
-#define DNS_RANDOM_rand 3
-#define DNS_RANDOM_RAND_bytes 4
-
-#define DNS_RANDOM_OPENSSL (DNS_RANDOM_RAND_bytes == DNS_PP_XPASTE(DNS_RANDOM_, DNS_RANDOM))
-
-#if DNS_RANDOM_OPENSSL
-#include <openssl/rand.h>
-#endif
-
-static unsigned dns_random_(void) {
-#if DNS_RANDOM_OPENSSL
- unsigned r;
-
- assert(1 == RAND_bytes((unsigned char *)&r, sizeof r));
-
- return r;
-#else
- return DNS_RANDOM();
-#endif
-} /* dns_random_() */
-
-unsigned (*dns_random)(void) __attribute__((weak)) = &dns_random_;
-
-
-/*
- * P E R M U T A T I O N G E N E R A T O R
- */
-
-#define DNS_K_TEA_KEY_SIZE 16
-#define DNS_K_TEA_BLOCK_SIZE 8
-#define DNS_K_TEA_CYCLES 32
-#define DNS_K_TEA_MAGIC 0x9E3779B9U
-
-struct dns_k_tea {
- uint32_t key[DNS_K_TEA_KEY_SIZE / sizeof (uint32_t)];
- unsigned cycles;
-}; /* struct dns_k_tea */
-
-
-static void dns_k_tea_init(struct dns_k_tea *tea, uint32_t key[], unsigned cycles) {
- memcpy(tea->key, key, sizeof tea->key);
-
- tea->cycles = (cycles)? cycles : DNS_K_TEA_CYCLES;
-} /* dns_k_tea_init() */
-
-
-static void dns_k_tea_encrypt(struct dns_k_tea *tea, uint32_t v[], uint32_t *w) {
- uint32_t y, z, sum, n;
-
- y = v[0];
- z = v[1];
- sum = 0;
-
- for (n = 0; n < tea->cycles; n++) {
- sum += DNS_K_TEA_MAGIC;
- y += ((z << 4) + tea->key[0]) ^ (z + sum) ^ ((z >> 5) + tea->key[1]);
- z += ((y << 4) + tea->key[2]) ^ (y + sum) ^ ((y >> 5) + tea->key[3]);
- }
-
- w[0] = y;
- w[1] = z;
-
- return /* void */;
-} /* dns_k_tea_encrypt() */
-
-
-/*
- * Permutation generator, based on a Luby-Rackoff Feistel construction.
- *
- * Specifically, this is a generic balanced Feistel block cipher using TEA
- * (another block cipher) as the pseudo-random function, F. At best it's as
- * strong as F (TEA), notwithstanding the seeding. F could be AES, SHA-1, or
- * perhaps Bernstein's Salsa20 core; I am naively trying to keep things
- * simple.
- *
- * The generator can create a permutation of any set of numbers, as long as
- * the size of the set is an even power of 2. This limitation arises either
- * out of an inherent property of balanced Feistel constructions, or by my
- * own ignorance. I'll tackle an unbalanced construction after I wrap my
- * head around Schneier and Kelsey's paper.
- *
- * CAVEAT EMPTOR. IANAC.
- */
-#define DNS_K_PERMUTOR_ROUNDS 8
-
-struct dns_k_permutor {
- unsigned stepi, length, limit;
- unsigned shift, mask, rounds;
-
- struct dns_k_tea tea;
-}; /* struct dns_k_permutor */
-
-
-static inline unsigned dns_k_permutor_powof(unsigned n) {
- unsigned m, i = 0;
-
- for (m = 1; m < n; m <<= 1, i++)
- ;;
-
- return i;
-} /* dns_k_permutor_powof() */
-
-static void dns_k_permutor_init(struct dns_k_permutor *p, unsigned low, unsigned high) {
- uint32_t key[DNS_K_TEA_KEY_SIZE / sizeof (uint32_t)];
- unsigned width, i;
-
- p->stepi = 0;
-
- p->length = (high - low) + 1;
- p->limit = high;
-
- width = dns_k_permutor_powof(p->length);
- width += width % 2;
-
- p->shift = width / 2;
- p->mask = (1U << p->shift) - 1;
- p->rounds = DNS_K_PERMUTOR_ROUNDS;
-
- for (i = 0; i < lengthof(key); i++)
- key[i] = dns_random();
-
- dns_k_tea_init(&p->tea, key, 0);
-
- return /* void */;
-} /* dns_k_permutor_init() */
-
-
-static unsigned dns_k_permutor_F(struct dns_k_permutor *p, unsigned k, unsigned x) {
- uint32_t in[DNS_K_TEA_BLOCK_SIZE / sizeof (uint32_t)], out[DNS_K_TEA_BLOCK_SIZE / sizeof (uint32_t)];
-
- memset(in, '\0', sizeof in);
-
- in[0] = k;
- in[1] = x;
-
- dns_k_tea_encrypt(&p->tea, in, out);
-
- return p->mask & out[0];
-} /* dns_k_permutor_F() */
-
-
-static unsigned dns_k_permutor_E(struct dns_k_permutor *p, unsigned n) {
- unsigned l[2], r[2];
- unsigned i;
-
- i = 0;
- l[i] = p->mask & (n >> p->shift);
- r[i] = p->mask & (n >> 0);
-
- do {
- l[(i + 1) % 2] = r[i % 2];
- r[(i + 1) % 2] = l[i % 2] ^ dns_k_permutor_F(p, i, r[i % 2]);
-
- i++;
- } while (i < p->rounds - 1);
-
- return ((l[i % 2] & p->mask) << p->shift) | ((r[i % 2] & p->mask) << 0);
-} /* dns_k_permutor_E() */
-
-static unsigned dns_k_permutor_step(struct dns_k_permutor *p) {
- unsigned n;
-
- do {
- n = dns_k_permutor_E(p, p->stepi++);
- } while (n >= p->length);
-
- return n + (p->limit + 1 - p->length);
-} /* dns_k_permutor_step() */
-
-
-/*
- * Simple permutation box. Useful for shuffling rrsets from an iterator.
- * Uses AES s-box to provide good diffusion.
- *
- * Seems to pass muster under runs test.
- *
- * $ for i in 0 1 2 3 4 5 6 7 8 9; do ./dns shuffle-16 > /tmp/out; done
- * $ R -q -f /dev/stdin 2>/dev/null <<-EOF | awk '/p-value/{ print $8 }'
- * library(lawstat)
- * runs.test(scan(file="/tmp/out"))
- * EOF
- */
-static unsigned short dns_k_shuffle16(unsigned short n, unsigned s) {
- static const unsigned char sbox[256] =
- { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
- 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
- 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
- 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
- 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
- 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
- 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
- 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
- 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
- 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
- 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
- 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
- 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
- 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
- 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
- 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
- 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
- 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
- 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
- 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
- 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
- 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
- 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
- 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
- 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
- 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
- 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
- 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
- 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
- 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
- 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
- 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 };
- unsigned char a, b;
- unsigned i;
-
- a = 0xff & (n >> 0);
- b = 0xff & (n >> 8);
-
- for (i = 0; i < 4; i++) {
- a ^= 0xff & s;
- a = sbox[a] ^ b;
- b = sbox[b] ^ a;
- s >>= 8;
- }
-
- return ((0xff00 & (a << 8)) | (0x00ff & (b << 0)));
-} /* dns_k_shuffle16() */
-
-
-/*
- * U T I L I T Y R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Monotonic Time
- *
- */
-static time_t dns_now(void) {
- /* XXX: Assumes sizeof (time_t) <= sizeof (sig_atomic_t) */
- static volatile sig_atomic_t last, tick;
- volatile sig_atomic_t tmp_last, tmp_tick;
- time_t now;
-
- time(&now);
-
- tmp_last = last;
-
- if (now > tmp_last) {
- tmp_tick = tick;
- tmp_tick += now - tmp_last;
- tick = tmp_tick;
- }
-
- last = now;
-
- return tick;
-} /* dns_now() */
-
-static time_t dns_elapsed(time_t from) {
- time_t now = dns_now();
-
- return (now > from)? now - from : 0;
-} /* dns_elpased() */
-
-
-static size_t dns_af_len(int af) {
- static const size_t table[AF_MAX] = {
- [AF_INET6] = sizeof (struct sockaddr_in6),
- [AF_INET] = sizeof (struct sockaddr_in),
-#if defined(AF_UNIX) && !defined(_WIN32)
- [AF_UNIX] = sizeof (struct sockaddr_un),
-#endif
- };
-
- return table[af];
-} /* dns_af_len() */
-
-#define dns_sa_len(sa) dns_af_len(dns_sa_family(sa))
-
-
-#define DNS_SA_NOPORT &dns_sa_noport
-static unsigned short dns_sa_noport;
-
-unsigned short *dns_sa_port(int af, void *sa) {
- switch (af) {
- case AF_INET6:
- return &((struct sockaddr_in6 *)sa)->sin6_port;
- case AF_INET:
- return &((struct sockaddr_in *)sa)->sin_port;
- default:
- return DNS_SA_NOPORT;
- }
-} /* dns_sa_port() */
-
-
-void *dns_sa_addr(int af, void *sa) {
- switch (af) {
- case AF_INET6:
- return &((struct sockaddr_in6 *)sa)->sin6_addr;
- case AF_INET:
- return &((struct sockaddr_in *)sa)->sin_addr;
- default:
- return 0;
- }
-} /* dns_sa_addr() */
-
-
-#if _WIN32
-static int dns_inet_pton(int af, const void *src, void *dst) {
- union { struct sockaddr_in sin; struct sockaddr_in6 sin6; } u;
-
- u.sin.sin_family = af;
-
- if (0 != WSAStringToAddressA((void *)src, af, (void *)0, (struct sockaddr *)&u, &(int){ sizeof u }))
- return -1;
-
- switch (af) {
- case AF_INET6:
- *(struct in6_addr *)dst = u.sin6.sin6_addr;
-
- return 1;
- case AF_INET:
- *(struct in_addr *)dst = u.sin.sin_addr;
-
- return 1;
- default:
- return 0;
- }
-} /* dns_inet_pton() */
-
-const char *dns_inet_ntop(int af, const void *src, void *dst, unsigned long lim) {
- union { struct sockaddr_in sin; struct sockaddr_in6 sin6; } u;
-
- /* NOTE: WSAAddressToString will print .sin_port unless zeroed. */
- memset(&u, 0, sizeof u);
-
- u.sin.sin_family = af;
-
- switch (af) {
- case AF_INET6:
- u.sin6.sin6_addr = *(struct in6_addr *)src;
- break;
- case AF_INET:
- u.sin.sin_addr = *(struct in_addr *)src;
-
- break;
- default:
- return 0;
- }
-
- if (0 != WSAAddressToStringA((struct sockaddr *)&u, dns_sa_len(&u), (void *)0, dst, &lim))
- return 0;
-
- return dst;
-} /* dns_inet_ntop() */
-#endif
-
-
-size_t dns_strlcpy(char *dst, const char *src, size_t lim) {
- char *d = dst;
- char *e = &dst[lim];
- const char *s = src;
-
- if (d < e) {
- do {
- if ('\0' == (*d++ = *s++))
- return s - src - 1;
- } while (d < e);
-
- d[-1] = '\0';
- }
-
- while (*s++ != '\0')
- ;;
-
- return s - src - 1;
-} /* dns_strlcpy() */
-
-
-size_t dns_strlcat(char *dst, const char *src, size_t lim) {
- char *d = memchr(dst, '\0', lim);
- char *e = &dst[lim];
- const char *s = src;
- const char *p;
-
- if (d && d < e) {
- do {
- if ('\0' == (*d++ = *s++))
- return d - dst - 1;
- } while (d < e);
-
- d[-1] = '\0';
- }
-
- p = s;
-
- while (*s++ != '\0')
- ;;
-
- return lim + (s - p - 1);
-} /* dns_strlcat() */
-
-
-#if _WIN32
-
-static char *dns_strsep(char **sp, const char *delim) {
- char *p;
-
- if (!(p = *sp))
- return 0;
-
- *sp += strcspn(p, delim);
-
- if (**sp != '\0') {
- **sp = '\0';
- ++*sp;
- } else
- *sp = NULL;
-
- return p;
-} /* dns_strsep() */
-
-#else
-#define dns_strsep(...) strsep(__VA_ARGS__)
-#endif
-
-
-#if _WIN32
-#define strcasecmp(...) _stricmp(__VA_ARGS__)
-#define strncasecmp(...) _strnicmp(__VA_ARGS__)
-#endif
-
-
-static int dns_poll(int fd, short events, int timeout) {
- fd_set rset, wset;
-
- if (!events)
- return 0;
-
- assert(fd >= 0 && fd < FD_SETSIZE);
-
- FD_ZERO(&rset);
- FD_ZERO(&wset);
-
- if (events & DNS_POLLIN)
- FD_SET(fd, &rset);
-
- if (events & DNS_POLLOUT)
- FD_SET(fd, &wset);
-
- select(fd + 1, &rset, &wset, 0, (timeout >= 0)? &(struct timeval){ timeout, 0 } : NULL);
-
- return 0;
-} /* dns_poll() */
-
-
-/*
- * P A C K E T R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-unsigned dns_p_count(struct dns_packet *P, enum dns_section section) {
- unsigned count;
-
- switch (section) {
- case DNS_S_QD:
- return ntohs(dns_header(P)->qdcount);
- case DNS_S_AN:
- return ntohs(dns_header(P)->ancount);
- case DNS_S_NS:
- return ntohs(dns_header(P)->nscount);
- case DNS_S_AR:
- return ntohs(dns_header(P)->arcount);
- default:
- count = 0;
-
- if (section & DNS_S_QD)
- count += ntohs(dns_header(P)->qdcount);
- if (section & DNS_S_AN)
- count += ntohs(dns_header(P)->ancount);
- if (section & DNS_S_NS)
- count += ntohs(dns_header(P)->nscount);
- if (section & DNS_S_AR)
- count += ntohs(dns_header(P)->arcount);
-
- return count;
- }
-} /* dns_p_count() */
-
-
-struct dns_packet *dns_p_init(struct dns_packet *P, size_t size) {
- if (!P)
- return 0;
-
- assert(size >= offsetof(struct dns_packet, data) + 12);
-
- memset(P, 0, sizeof *P);
- P->size = size - offsetof(struct dns_packet, data);
- P->end = 12;
-
- memset(P->data, '\0', 12);
-
- return P;
-} /* dns_p_init() */
-
-
-static unsigned short dns_p_qend(struct dns_packet *P) {
- unsigned short qend = 12;
- unsigned i, count = dns_p_count(P, DNS_S_QD);
-
- for (i = 0; i < count && qend < P->end; i++) {
- if (P->end == (qend = dns_d_skip(qend, P)))
- goto invalid;
-
- if (P->end - qend < 4)
- goto invalid;
-
- qend += 4;
- }
-
- return MIN(qend, P->end);
-invalid:
- return P->end;
-} /* dns_p_qend() */
-
-
-struct dns_packet *dns_p_make(size_t len, int *error) {
- struct dns_packet *P;
- size_t size = dns_p_calcsize(len);
-
- if (!(P = dns_p_init(malloc(size), size)))
- *error = dns_syerr();
-
- return P;
-} /* dns_p_make() */
-
-
-int dns_p_grow(struct dns_packet **P) {
- struct dns_packet *tmp;
- size_t size;
- int error;
-
- if (!*P) {
- if (!(*P = dns_p_make(DNS_P_QBUFSIZ, &error)))
- return error;
-
- return 0;
- }
-
- size = dns_p_sizeof(*P);
- size |= size >> 1;
- size |= size >> 2;
- size |= size >> 4;
- size |= size >> 8;
- size++;
-
- if (size > 65536)
- return DNS_ENOBUFS;
-
- if (!(tmp = realloc(*P, dns_p_calcsize(size))))
- return dns_syerr();
-
- tmp->size = size;
- *P = tmp;
-
- return 0;
-} /* dns_p_grow() */
-
-
-struct dns_packet *dns_p_copy(struct dns_packet *P, const struct dns_packet *P0) {
- if (!P)
- return 0;
-
- P->end = MIN(P->size, P0->end);
-
- memcpy(P->data, P0->data, P->end);
-
- return P;
-} /* dns_p_copy() */
-
-
-struct dns_packet *dns_p_merge(struct dns_packet *A, enum dns_section Amask, struct dns_packet *B, enum dns_section Bmask, int *error_) {
- size_t bufsiz = MIN(65535, ((A)? A->end : 0) + ((B)? B->end : 0));
- struct dns_packet *M;
- enum dns_section section;
- struct dns_rr rr, mr;
- int error, copy;
-
- if (!A && B) {
- A = B;
- Amask = Bmask;
- B = 0;
- }
-
-merge:
- if (!(M = dns_p_make(bufsiz, &error)))
- goto error;
-
- for (section = DNS_S_QD; (DNS_S_ALL & section); section <<= 1) {
- if (A && (section & Amask)) {
- dns_rr_foreach(&rr, A, .section = section) {
- if ((error = dns_rr_copy(M, &rr, A)))
- goto error;
- }
- }
-
- if (B && (section & Bmask)) {
- dns_rr_foreach(&rr, B, .section = section) {
- copy = 1;
-
- dns_rr_foreach(&mr, M, .type = rr.type, .section = DNS_S_ALL) {
- if (!(copy = dns_rr_cmp(&rr, B, &mr, M)))
- break;
- }
-
- if (copy && (error = dns_rr_copy(M, &rr, B)))
- goto error;
- }
- }
- }
-
- return M;
-error:
- free(M); M = 0;
-
- if (error == DNS_ENOBUFS && bufsiz < 65535) {
- bufsiz = MIN(65535, bufsiz * 2);
-
- goto merge;
- }
-
- *error_ = error;
-
- return 0;
-} /* dns_p_merge() */
-
-
-static unsigned short dns_l_skip(unsigned short, const unsigned char *, size_t);
-
-void dns_p_dictadd(struct dns_packet *P, unsigned short dn) {
- unsigned short lp, lptr, i;
-
- lp = dn;
-
- while (lp < P->end) {
- if (0xc0 == (0xc0 & P->data[lp]) && P->end - lp >= 2 && lp != dn) {
- lptr = ((0x3f & P->data[lp + 0]) << 8)
- | ((0xff & P->data[lp + 1]) << 0);
-
- for (i = 0; i < lengthof(P->dict) && P->dict[i]; i++) {
- if (P->dict[i] == lptr) {
- P->dict[i] = dn;
-
- return;
- }
- }
- }
-
- lp = dns_l_skip(lp, P->data, P->end);
- }
-
- for (i = 0; i < lengthof(P->dict); i++) {
- if (!P->dict[i]) {
- P->dict[i] = dn;
-
- break;
- }
- }
-} /* dns_p_dictadd() */
-
-
-int dns_p_push(struct dns_packet *P, enum dns_section section, const void *dn, size_t dnlen, enum dns_type type, enum dns_class class, unsigned ttl, const void *any) {
- size_t end = P->end;
- int error;
-
- if ((error = dns_d_push(P, dn, dnlen)))
- goto error;
-
- if (P->size - P->end < 4)
- goto nobufs;
-
- P->data[P->end++] = 0xff & (type >> 8);
- P->data[P->end++] = 0xff & (type >> 0);
-
- P->data[P->end++] = 0xff & (class >> 8);
- P->data[P->end++] = 0xff & (class >> 0);
-
- if (section == DNS_S_QD)
- goto update;
-
- if (P->size - P->end < 6)
- goto nobufs;
-
- P->data[P->end++] = 0x7f & (ttl >> 24);
- P->data[P->end++] = 0xff & (ttl >> 16);
- P->data[P->end++] = 0xff & (ttl >> 8);
- P->data[P->end++] = 0xff & (ttl >> 0);
-
- if ((error = dns_any_push(P, (union dns_any *)any, type)))
- goto error;
-
-update:
- switch (section) {
- case DNS_S_QD:
- if (dns_p_count(P, DNS_S_AN|DNS_S_NS|DNS_S_AR))
- goto order;
-
- if (!P->qd.base && (error = dns_p_study(P)))
- goto error;
-
- dns_header(P)->qdcount = htons(ntohs(dns_header(P)->qdcount) + 1);
-
- P->qd.end = P->end;
- P->an.base = P->end;
- P->an.end = P->end;
- P->ns.base = P->end;
- P->ns.end = P->end;
- P->ar.base = P->end;
- P->ar.end = P->end;
-
- break;
- case DNS_S_AN:
- if (dns_p_count(P, DNS_S_NS|DNS_S_AR))
- goto order;
-
- if (!P->an.base && (error = dns_p_study(P)))
- goto error;
-
- dns_header(P)->ancount = htons(ntohs(dns_header(P)->ancount) + 1);
-
- P->an.end = P->end;
- P->ns.base = P->end;
- P->ns.end = P->end;
- P->ar.base = P->end;
- P->ar.end = P->end;
-
- break;
- case DNS_S_NS:
- if (dns_p_count(P, DNS_S_AR))
- goto order;
-
- if (!P->ns.base && (error = dns_p_study(P)))
- goto error;
-
- dns_header(P)->nscount = htons(ntohs(dns_header(P)->nscount) + 1);
-
- P->ns.end = P->end;
- P->ar.base = P->end;
- P->ar.end = P->end;
-
- break;
- case DNS_S_AR:
- if (!P->ar.base && (error = dns_p_study(P)))
- goto error;
-
- dns_header(P)->arcount = htons(ntohs(dns_header(P)->arcount) + 1);
-
- P->ar.end = P->end;
-
- break;
- default:
- error = DNS_ESECTION;
-
- goto error;
- } /* switch() */
-
- return 0;
-nobufs:
- error = DNS_ENOBUFS;
-
- goto error;
-order:
- error = DNS_EORDER;
-
- goto error;
-error:
- P->end = end;
-
- return error;
-} /* dns_p_push() */
-
-
-static void dns_p_dump3(struct dns_packet *P, struct dns_rr_i *I, FILE *fp) {
- enum dns_section section;
- struct dns_rr rr;
- int error;
- union dns_any any;
- char pretty[sizeof any * 2];
- size_t len;
-
- fputs(";; [HEADER]\n", fp);
- fprintf(fp, ";; qr : %s(%d)\n", (dns_header(P)->qr)? "RESPONSE" : "QUERY", dns_header(P)->qr);
- fprintf(fp, ";; opcode : %s(%d)\n", dns_stropcode(dns_header(P)->opcode), dns_header(P)->opcode);
- fprintf(fp, ";; aa : %s(%d)\n", (dns_header(P)->aa)? "AUTHORITATIVE" : "NON-AUTHORITATIVE", dns_header(P)->aa);
- fprintf(fp, ";; tc : %s(%d)\n", (dns_header(P)->tc)? "TRUNCATED" : "NOT-TRUNCATED", dns_header(P)->tc);
- fprintf(fp, ";; rd : %s(%d)\n", (dns_header(P)->rd)? "RECURSION-DESIRED" : "RECURSION-NOT-DESIRED", dns_header(P)->rd);
- fprintf(fp, ";; ra : %s(%d)\n", (dns_header(P)->ra)? "RECURSION-ALLOWED" : "RECURSION-NOT-ALLOWED", dns_header(P)->ra);
- fprintf(fp, ";; rcode : %s(%d)\n", dns_strrcode(dns_header(P)->rcode), dns_header(P)->rcode);
-
- section = 0;
-
- while (dns_rr_grep(&rr, 1, I, P, &error)) {
- if (section != rr.section)
- fprintf(fp, "\n;; [%s:%d]\n", dns_strsection(rr.section), dns_p_count(P, rr.section));
-
- if ((len = dns_rr_print(pretty, sizeof pretty, &rr, P, &error)))
- fprintf(fp, "%s\n", pretty);
-
- section = rr.section;
- }
-} /* dns_p_dump3() */
-
-
-void dns_p_dump(struct dns_packet *P, FILE *fp) {
- dns_p_dump3(P, dns_rr_i_new(P, .section = 0), fp);
-} /* dns_p_dump() */
-
-
-static void dns_s_unstudy(struct dns_s_memo *m)
- { m->base = 0; m->end = 0; }
-
-static void dns_p_unstudy(struct dns_packet *P) {
- dns_s_unstudy(&P->qd);
- dns_s_unstudy(&P->an);
- dns_s_unstudy(&P->ns);
- dns_s_unstudy(&P->ar);
-} /* dns_p_unstudy() */
-
-static int dns_s_study(struct dns_s_memo *m, enum dns_section section, unsigned base, struct dns_packet *P) {
- unsigned short count, rp;
-
- count = dns_p_count(P, section);
-
- for (rp = base; count && rp < P->end; count--)
- rp = dns_rr_skip(rp, P);
-
- m->base = base;
- m->end = rp;
-
- return 0;
-} /* dns_s_study() */
-
-int dns_p_study(struct dns_packet *P) {
- int error;
-
- if ((error = dns_s_study(&P->qd, DNS_S_QD, 12, P)))
- goto error;
-
- if ((error = dns_s_study(&P->an, DNS_S_AN, P->qd.end, P)))
- goto error;
-
- if ((error = dns_s_study(&P->ns, DNS_S_NS, P->an.end, P)))
- goto error;
-
- if ((error = dns_s_study(&P->ar, DNS_S_AR, P->ns.end, P)))
- goto error;
-
- return 0;
-error:
- dns_p_unstudy(P);
-
- return error;
-} /* dns_p_study() */
-
-
-/*
- * D O M A I N N A M E R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef DNS_D_MAXPTRS
-#define DNS_D_MAXPTRS 127 /* Arbitrary; possible, valid depth is something like packet size / 2 + fudge. */
-#endif
-
-static size_t dns_l_expand(unsigned char *dst, size_t lim, unsigned short src, unsigned short *nxt, const unsigned char *data, size_t end) {
- unsigned short len;
- unsigned nptrs = 0;
-
-retry:
- if (src >= end)
- goto invalid;
-
- switch (0x03 & (data[src] >> 6)) {
- case 0x00:
- len = (0x3f & (data[src++]));
-
- if (end - src < len)
- goto invalid;
-
- if (lim > 0) {
- memcpy(dst, &data[src], MIN(lim, len));
-
- dst[MIN(lim - 1, len)] = '\0';
- }
-
- *nxt = src + len;
-
- return len;
- case 0x01:
- goto invalid;
- case 0x02:
- goto invalid;
- case 0x03:
- if (++nptrs > DNS_D_MAXPTRS)
- goto invalid;
-
- if (end - src < 2)
- goto invalid;
-
- src = ((0x3f & data[src + 0]) << 8)
- | ((0xff & data[src + 1]) << 0);
-
- goto retry;
- } /* switch() */
-
- /* NOT REACHED */
-invalid:
- *nxt = end;
-
- return 0;
-} /* dns_l_expand() */
-
-
-static unsigned short dns_l_skip(unsigned short src, const unsigned char *data, size_t end) {
- unsigned short len;
-
- if (src >= end)
- goto invalid;
-
- switch (0x03 & (data[src] >> 6)) {
- case 0x00:
- len = (0x3f & (data[src++]));
-
- if (end - src < len)
- goto invalid;
-
- return (len)? src + len : end;
- case 0x01:
- goto invalid;
- case 0x02:
- goto invalid;
- case 0x03:
- return end;
- } /* switch() */
-
- /* NOT REACHED */
-invalid:
- return end;
-} /* dns_l_skip() */
-
-
-size_t dns_d_trim(void *dst_, size_t lim, const void *src_, size_t len, int flags) {
- unsigned char *dst = dst_;
- const unsigned char *src = src_;
- size_t dp = 0, sp = 0;
- int lc;
-
- /* trim any leading dot(s) */
- while (sp < len && src[sp] == '.')
- sp++;
-
- for (lc = 0; sp < len; lc = src[sp]) {
- if (dp < lim)
- dst[dp] = src[sp];
-
- sp++;
- dp++;
-
- /* trim extra dot(s) */
- while (sp < len && src[sp] == '.')
- sp++;
- }
-
- if ((flags & DNS_D_ANCHOR) && lc != '.') {
- if (dp < lim)
- dst[dp] = '.';
-
- dp++;
- }
-
- if (lim > 0)
- dst[MIN(dp, lim - 1)] = '\0';
-
- return dp;
-} /* dns_d_trim() */
-
-
-char *dns_d_init(void *dst, size_t lim, const void *src, size_t len, int flags) {
- if (flags & DNS_D_TRIM) {
- dns_d_trim(dst, lim, src, len, flags);
- } if (flags & DNS_D_ANCHOR) {
- dns_d_anchor(dst, lim, src, len);
- } else {
- memmove(dst, src, MIN(lim, len));
-
- if (lim > 0)
- ((char *)dst)[MIN(len, lim - 1)] = '\0';
- }
-
- return dst;
-} /* dns_d_init() */
-
-
-size_t dns_d_anchor(void *dst, size_t lim, const void *src, size_t len) {
- if (len == 0)
- return 0;
-
- memmove(dst, src, MIN(lim, len));
-
- if (((const char *)src)[len - 1] != '.') {
- if (len < lim)
- ((char *)dst)[len] = '.';
- len++;
- }
-
- if (lim > 0)
- ((char *)dst)[MIN(lim - 1, len)] = '\0';
-
- return len;
-} /* dns_d_anchor() */
-
-
-size_t dns_d_cleave(void *dst, size_t lim, const void *src, size_t len) {
- const char *dot;
-
- /* XXX: Skip any leading dot. Handles cleaving root ".". */
- if (len == 0 || !(dot = memchr((const char *)src + 1, '.', len - 1)))
- return 0;
-
- len -= dot - (const char *)src;
-
- /* XXX: Unless root, skip the label's trailing dot. */
- if (len > 1) {
- src = ++dot;
- len--;
- } else
- src = dot;
-
- memmove(dst, src, MIN(lim, len));
-
- if (lim > 0)
- ((char *)dst)[MIN(lim - 1, len)] = '\0';
-
- return len;
-} /* dns_d_cleave() */
-
-
-size_t dns_d_comp(void *dst_, size_t lim, const void *src_, size_t len, struct dns_packet *P, int *error __UNUSED__) {
- struct { unsigned char *b; size_t p, x; } dst, src;
- unsigned char ch = '.';
-
- dst.b = dst_;
- dst.p = 0;
- dst.x = 1;
-
- src.b = (unsigned char *)src_;
- src.p = 0;
- src.x = 0;
-
- while (src.x < len) {
- ch = src.b[src.x];
-
- if (ch == '.') {
- if (dst.p < lim)
- dst.b[dst.p] = (0x3f & (src.x - src.p));
-
- dst.p = dst.x++;
- src.p = ++src.x;
- } else {
- if (dst.x < lim)
- dst.b[dst.x] = ch;
-
- dst.x++;
- src.x++;
- }
- } /* while() */
-
- if (src.x > src.p) {
- if (dst.p < lim)
- dst.b[dst.p] = (0x3f & (src.x - src.p));
-
- dst.p = dst.x;
- }
-
- if (dst.p > 1) {
- if (dst.p < lim)
- dst.b[dst.p] = 0x00;
-
- dst.p++;
- }
-
-#if 1
- if (dst.p < lim) {
- struct { unsigned char label[DNS_D_MAXLABEL + 1]; size_t len; unsigned short p, x, y; } a, b;
- unsigned i;
-
- a.p = 0;
-
- while ((a.len = dns_l_expand(a.label, sizeof a.label, a.p, &a.x, dst.b, lim))) {
- for (i = 0; i < lengthof(P->dict) && P->dict[i]; i++) {
- b.p = P->dict[i];
-
- while ((b.len = dns_l_expand(b.label, sizeof b.label, b.p, &b.x, P->data, P->end))) {
- a.y = a.x;
- b.y = b.x;
-
- while (a.len && b.len && 0 == strcasecmp((char *)a.label, (char *)b.label)) {
- a.len = dns_l_expand(a.label, sizeof a.label, a.y, &a.y, dst.b, lim);
- b.len = dns_l_expand(b.label, sizeof b.label, b.y, &b.y, P->data, P->end);
- }
-
- if (a.len == 0 && b.len == 0 && b.p <= 0x3fff) {
- dst.b[a.p++] = 0xc0
- | (0x3f & (b.p >> 8));
- dst.b[a.p++] = (0xff & (b.p >> 0));
-
- return a.p;
- }
-
- b.p = b.x;
- } /* while() */
- } /* for() */
-
- a.p = a.x;
- } /* while() */
- } /* if () */
-#endif
-
- return dst.p;
-} /* dns_d_comp() */
-
-
-unsigned short dns_d_skip(unsigned short src, struct dns_packet *P) {
- unsigned short len;
-
- while (src < P->end) {
- switch (0x03 & (P->data[src] >> 6)) {
- case 0x00: /* FOLLOWS */
- len = (0x3f & P->data[src++]);
-
- if (0 == len) {
-/* success ==> */ return src;
- } else if (P->end - src > len) {
- src += len;
-
- break;
- } else
- goto invalid;
-
- /* NOT REACHED */
- case 0x01: /* RESERVED */
- goto invalid;
- case 0x02: /* RESERVED */
- goto invalid;
- case 0x03: /* POINTER */
- if (P->end - src < 2)
- goto invalid;
-
- src += 2;
-
-/* success ==> */ return src;
- } /* switch() */
- } /* while() */
-
-invalid:
-//assert(0);
- return P->end;
-} /* dns_d_skip() */
-
-
-#include <stdio.h>
-
-size_t dns_d_expand(void *dst, size_t lim, unsigned short src, struct dns_packet *P, int *error) {
- size_t dstp = 0;
- unsigned nptrs = 0;
- unsigned char len;
-
- while (src < P->end) {
- switch ((0x03 & (P->data[src] >> 6))) {
- case 0x00: /* FOLLOWS */
- len = (0x3f & P->data[src]);
-
- if (0 == len) {
- if (dstp == 0) {
- if (dstp < lim)
- ((unsigned char *)dst)[dstp] = '.';
-
- dstp++;
- }
-
- /* NUL terminate */
- if (lim > 0)
- ((unsigned char *)dst)[MIN(dstp, lim - 1)] = '\0';
-
-/* success ==> */ return dstp;
- }
-
- src++;
-
- if (P->end - src < len)
- goto toolong;
-
- if (dstp < lim)
- memcpy(&((unsigned char *)dst)[dstp], &P->data[src], MIN(len, lim - dstp));
-
- src += len;
- dstp += len;
-
- if (dstp < lim)
- ((unsigned char *)dst)[dstp] = '.';
-
- dstp++;
-
- nptrs = 0;
-
- continue;
- case 0x01: /* RESERVED */
- goto reserved;
- case 0x02: /* RESERVED */
- goto reserved;
- case 0x03: /* POINTER */
- if (++nptrs > DNS_D_MAXPTRS)
- goto toolong;
-
- if (P->end - src < 2)
- goto toolong;
-
- src = ((0x3f & P->data[src + 0]) << 8)
- | ((0xff & P->data[src + 1]) << 0);
-
- continue;
- } /* switch() */
- } /* while() */
-
-toolong:
- *error = DNS_EILLEGAL;
-
- if (lim > 0)
- ((unsigned char *)dst)[MIN(dstp, lim - 1)] = '\0';
-
- return 0;
-reserved:
- *error = DNS_EILLEGAL;
-
- if (lim > 0)
- ((unsigned char *)dst)[MIN(dstp, lim - 1)] = '\0';
-
- return 0;
-} /* dns_d_expand() */
-
-
-int dns_d_push(struct dns_packet *P, const void *dn, size_t len) {
- size_t lim = P->size - P->end;
- unsigned dp = P->end;
- int error;
-
- len = dns_d_comp(&P->data[dp], lim, dn, len, P, &error);
-
- if (len == 0)
- return error;
- if (len > lim)
- return DNS_ENOBUFS;
-
- P->end += len;
-
- dns_p_dictadd(P, dp);
-
- return 0;
-} /* dns_d_push() */
-
-
-size_t dns_d_cname(void *dst, size_t lim, const void *dn, size_t len, struct dns_packet *P, int *error_) {
- char host[DNS_D_MAXNAME + 1];
- struct dns_rr_i i;
- struct dns_rr rr;
- unsigned depth;
- int error;
-
- if (sizeof host <= dns_d_anchor(host, sizeof host, dn, len))
- { error = ENAMETOOLONG; goto error; }
-
- for (depth = 0; depth < 7; depth++) {
- dns_rr_i_init(memset(&i, 0, sizeof i), P);
-
- i.section = DNS_S_ALL & ~DNS_S_QD;
- i.name = host;
- i.type = DNS_T_CNAME;
-
- if (!dns_rr_grep(&rr, 1, &i, P, &error))
- break;
-
- if ((error = dns_cname_parse((struct dns_cname *)host, &rr, P)))
- goto error;
- }
-
- return dns_strlcpy(dst, host, lim);
-error:
- *error_ = error;
-
- return 0;
-} /* dns_d_cname() */
-
-
-/*
- * R E S O U R C E R E C O R D R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-int dns_rr_copy(struct dns_packet *P, struct dns_rr *rr, struct dns_packet *Q) {
- unsigned char dn[DNS_D_MAXNAME + 1];
- union dns_any any;
- size_t len;
- int error;
-
- if (!(len = dns_d_expand(dn, sizeof dn, rr->dn.p, Q, &error)))
- return error;
- else if (len >= sizeof dn)
- return DNS_EILLEGAL;
-
- if (rr->section != DNS_S_QD && (error = dns_any_parse(dns_any_init(&any, sizeof any), rr, Q)))
- return error;
-
- return dns_p_push(P, rr->section, dn, len, rr->type, rr->class, rr->ttl, &any);
-} /* dns_rr_copy() */
-
-
-int dns_rr_parse(struct dns_rr *rr, unsigned short src, struct dns_packet *P) {
- unsigned short p = src;
-
- if (src >= P->end)
- goto invalid;
-
- rr->dn.p = p;
- rr->dn.len = (p = dns_d_skip(p, P)) - rr->dn.p;
-
- if (P->end - p < 4)
- goto invalid;
-
- rr->type = ((0xff & P->data[p + 0]) << 8)
- | ((0xff & P->data[p + 1]) << 0);
-
- rr->class = ((0xff & P->data[p + 2]) << 8)
- | ((0xff & P->data[p + 3]) << 0);
-
- p += 4;
-
- if (src < dns_p_qend(P)) {
- rr->section = DNS_S_QUESTION;
-
- rr->ttl = 0;
- rr->rd.p = 0;
- rr->rd.len = 0;
-
- return 0;
- }
-
- if (P->end - p < 4)
- goto invalid;
-
- rr->ttl = ((0x7f & P->data[p + 0]) << 24)
- | ((0xff & P->data[p + 1]) << 16)
- | ((0xff & P->data[p + 2]) << 8)
- | ((0xff & P->data[p + 3]) << 0);
-
- p += 4;
-
- if (P->end - p < 2)
- goto invalid;
-
- rr->rd.len = ((0xff & P->data[p + 0]) << 8)
- | ((0xff & P->data[p + 1]) << 0);
- rr->rd.p = p + 2;
-
- p += 2;
-
- if (P->end - p < rr->rd.len)
- goto invalid;
-
- return 0;
-invalid:
-//assert(0);
- return DNS_EILLEGAL;
-} /* dns_rr_parse() */
-
-
-static unsigned short dns_rr_len(const unsigned short src, struct dns_packet *P) {
- unsigned short rp, rdlen;
-
- rp = dns_d_skip(src, P);
-
- if (P->end - rp < 4)
- return P->end - src;
-
- rp += 4; /* TYPE, CLASS */
-
- if (rp <= dns_p_qend(P))
- return rp - src;
-
- if (P->end - rp < 6)
- return P->end - src;
-
- rp += 6; /* TTL, RDLEN */
-
- rdlen = ((0xff & P->data[rp - 2]) << 8)
- | ((0xff & P->data[rp - 1]) << 0);
-
- if (P->end - rp < rdlen)
- return P->end - src;
-
- rp += rdlen;
-
- return rp - src;
-} /* dns_rr_len() */
-
-
-unsigned short dns_rr_skip(unsigned short src, struct dns_packet *P) {
- return src + dns_rr_len(src, P);
-} /* dns_rr_skip() */
-
-
-static enum dns_section dns_rr_section(unsigned short src, struct dns_packet *P) {
- enum dns_section section;
- unsigned count, ind;
- unsigned short rp;
-
- if (src >= P->qd.base && src < P->qd.end)
- return DNS_S_QD;
- if (src >= P->an.base && src < P->an.end)
- return DNS_S_AN;
- if (src >= P->ns.base && src < P->ns.end)
- return DNS_S_NS;
- if (src >= P->ar.base && src < P->ar.end)
- return DNS_S_AR;
-
- /* NOTE: Possibly bad memoization. Try it the hard-way. */
-
- for (rp = 12, ind = 0; rp < src && rp < P->end; ind++)
- rp = dns_rr_skip(rp, P);
-
- section = DNS_S_QD;
- count = dns_p_count(P, section);
-
- while (ind >= count && section <= DNS_S_AR) {
- section <<= 1;
- count += dns_p_count(P, section);
- }
-
- return DNS_S_ALL & section;
-} /* dns_rr_section() */
-
-
-static enum dns_type dns_rr_type(unsigned short src, struct dns_packet *P) {
- struct dns_rr rr;
- int error;
-
- if ((error = dns_rr_parse(&rr, src, P)))
- return 0;
-
- return rr.type;
-} /* dns_rr_type() */
-
-
-int dns_rr_cmp(struct dns_rr *r0, struct dns_packet *P0, struct dns_rr *r1, struct dns_packet *P1) {
- char host0[DNS_D_MAXNAME + 1], host1[DNS_D_MAXNAME + 1];
- union dns_any any0, any1;
- int cmp, error;
- size_t len;
-
- if ((cmp = r0->type - r1->type))
- return cmp;
-
- if ((cmp = r0->class - r1->class))
- return cmp;
-
- /*
- * FIXME: Do label-by-label comparison to handle illegally long names?
- */
-
- if (!(len = dns_d_expand(host0, sizeof host0, r0->dn.p, P0, &error))
- || len >= sizeof host0)
- return -1;
-
- if (!(len = dns_d_expand(host1, sizeof host1, r1->dn.p, P1, &error))
- || len >= sizeof host1)
- return 1;
-
- if ((cmp = strcasecmp(host0, host1)))
- return cmp;
-
- if (DNS_S_QD & (r0->section | r1->section)) {
- if (r0->section == r1->section)
- return 0;
-
- return (r0->section == DNS_S_QD)? -1 : 1;
- }
-
- if ((error = dns_any_parse(&any0, r0, P0)))
- return -1;
-
- if ((error = dns_any_parse(&any1, r1, P1)))
- return 1;
-
- return dns_any_cmp(&any0, r0->type, &any1, r1->type);
-} /* dns_rr_cmp() */
-
-
-static _Bool dns_rr_exists(struct dns_rr *rr0, struct dns_packet *P0, struct dns_packet *P1) {
- struct dns_rr rr1;
-
- dns_rr_foreach(&rr1, P1, .section = rr0->section, .type = rr0->type) {
- if (0 == dns_rr_cmp(rr0, P0, &rr1, P1))
- return 1;
- }
-
- return 0;
-} /* dns_rr_exists() */
-
-
-static unsigned short dns_rr_offset(struct dns_rr *rr) {
- return rr->dn.p;
-} /* dns_rr_offset() */
-
-
-static _Bool dns_rr_i_match(struct dns_rr *rr, struct dns_rr_i *i, struct dns_packet *P) {
- if (i->section && !(rr->section & i->section))
- return 0;
-
- if (i->type && rr->type != i->type && i->type != DNS_T_ALL)
- return 0;
-
- if (i->class && rr->class != i->class && i->class != DNS_C_ANY)
- return 0;
-
- if (i->name) {
- char dn[DNS_D_MAXNAME + 1];
- size_t len;
- int error;
-
- if (!(len = dns_d_expand(dn, sizeof dn, rr->dn.p, P, &error))
- || len >= sizeof dn)
- return 0;
-
- if (0 != strcasecmp(dn, i->name))
- return 0;
- }
-
- if (i->data && i->type && rr->section > DNS_S_QD) {
- union dns_any rd;
- int error;
-
- if ((error = dns_any_parse(&rd, rr, P)))
- return 0;
-
- if (0 != dns_any_cmp(&rd, rr->type, i->data, i->type))
- return 0;
- }
-
- return 1;
-} /* dns_rr_i_match() */
-
-
-static unsigned short dns_rr_i_start(struct dns_rr_i *i, struct dns_packet *P) {
- unsigned short rp;
- struct dns_rr r0, rr;
- int error;
-
- if ((i->section & DNS_S_QD) && P->qd.base)
- rp = P->qd.base;
- else if ((i->section & DNS_S_AN) && P->an.base)
- rp = P->an.base;
- else if ((i->section & DNS_S_NS) && P->ns.base)
- rp = P->ns.base;
- else if ((i->section & DNS_S_AR) && P->ar.base)
- rp = P->ar.base;
- else
- rp = 12;
-
- for (rp = 12; rp < P->end; rp = dns_rr_skip(rp, P)) {
- if ((error = dns_rr_parse(&rr, rp, P)))
- continue;
-
- rr.section = dns_rr_section(rp, P);
-
- if (!dns_rr_i_match(&rr, i, P))
- continue;
-
- r0 = rr;
-
- goto lower;
- }
-
- return P->end;
-lower:
- if (i->sort == &dns_rr_i_packet)
- return dns_rr_offset(&r0);
-
- while ((rp = dns_rr_skip(rp, P)) < P->end) {
- if ((error = dns_rr_parse(&rr, rp, P)))
- continue;
-
- rr.section = dns_rr_section(rp, P);
-
- if (!dns_rr_i_match(&rr, i, P))
- continue;
-
- if (i->sort(&rr, &r0, i, P) < 0)
- r0 = rr;
- }
-
- return dns_rr_offset(&r0);
-} /* dns_rr_i_start() */
-
-
-static unsigned short dns_rr_i_skip(unsigned short rp, struct dns_rr_i *i, struct dns_packet *P) {
- struct dns_rr r0, r1, rr;
- int error;
-
- if ((error = dns_rr_parse(&r0, rp, P)))
- return P->end;
-
- r0.section = dns_rr_section(rp, P);
-
- rp = (i->sort == &dns_rr_i_packet)? dns_rr_skip(rp, P) : 12;
-
- for (; rp < P->end; rp = dns_rr_skip(rp, P)) {
- if ((error = dns_rr_parse(&rr, rp, P)))
- continue;
-
- rr.section = dns_rr_section(rp, P);
-
- if (!dns_rr_i_match(&rr, i, P))
- continue;
-
- if (i->sort(&rr, &r0, i, P) <= 0)
- continue;
-
- r1 = rr;
-
- goto lower;
- }
-
- return P->end;
-lower:
- if (i->sort == &dns_rr_i_packet)
- return dns_rr_offset(&r1);
-
- while ((rp = dns_rr_skip(rp, P)) < P->end) {
- if ((error = dns_rr_parse(&rr, rp, P)))
- continue;
-
- rr.section = dns_rr_section(rp, P);
-
- if (!dns_rr_i_match(&rr, i, P))
- continue;
-
- if (i->sort(&rr, &r0, i, P) <= 0)
- continue;
-
- if (i->sort(&rr, &r1, i, P) >= 0)
- continue;
-
- r1 = rr;
- }
-
- return dns_rr_offset(&r1);
-} /* dns_rr_i_skip() */
-
-
-int dns_rr_i_packet(struct dns_rr *a, struct dns_rr *b, struct dns_rr_i *i __UNUSED__, struct dns_packet *P __UNUSED__) {
- return (int)a->dn.p - (int)b->dn.p;
-} /* dns_rr_i_packet() */
-
-
-int dns_rr_i_order(struct dns_rr *a, struct dns_rr *b, struct dns_rr_i *i __UNUSED__, struct dns_packet *P) {
- int cmp;
-
- if ((cmp = a->section - b->section))
- return cmp;
-
- if (a->type != b->type)
- return (int)a->dn.p - (int)b->dn.p;
-
- return dns_rr_cmp(a, P, b, P);
-} /* dns_rr_i_order() */
-
-
-int dns_rr_i_shuffle(struct dns_rr *a, struct dns_rr *b, struct dns_rr_i *i, struct dns_packet *P __UNUSED__) {
- int cmp;
-
- while (!i->state.regs[0])
- i->state.regs[0] = dns_random();
-
- if ((cmp = a->section - b->section))
- return cmp;
-
- return dns_k_shuffle16(a->dn.p, i->state.regs[0]) - dns_k_shuffle16(b->dn.p, i->state.regs[0]);
-} /* dns_rr_i_shuffle() */
-
-
-struct dns_rr_i *dns_rr_i_init(struct dns_rr_i *i, struct dns_packet *P __UNUSED__) {
- static const struct dns_rr_i i_initializer;
-
- i->state = i_initializer.state;
- i->saved = i->state;
-
- return i;
-} /* dns_rr_i_init() */
-
-
-unsigned dns_rr_grep(struct dns_rr *rr, unsigned lim, struct dns_rr_i *i, struct dns_packet *P, int *error_) {
- unsigned count = 0;
- int error;
-
- switch (i->state.exec) {
- case 0:
- if (!i->sort)
- i->sort = &dns_rr_i_packet;
-
- i->state.next = dns_rr_i_start(i, P);
- i->state.exec++;
-
- /* FALL THROUGH */
- case 1:
- while (count < lim && i->state.next < P->end) {
- if ((error = dns_rr_parse(rr, i->state.next, P)))
- goto error;
-
- rr->section = dns_rr_section(i->state.next, P);
-
- rr++;
- count++;
- i->state.count++;
-
- i->state.next = dns_rr_i_skip(i->state.next, i, P);
- } /* while() */
-
- break;
- } /* switch() */
-
- return count;
-error:
- *error_ = error;
-
- return count;
-} /* dns_rr_grep() */
-
-
-static size_t dns__printchar(void *dst, size_t lim, size_t cp, unsigned char ch) {
- if (cp < lim)
- ((unsigned char *)dst)[cp] = ch;
-
- return 1;
-} /* dns__printchar() */
-
-
-static size_t dns__printstring(void *dst, size_t lim, size_t cp, const void *src, size_t len) {
- if (cp < lim)
- memcpy(&((unsigned char *)dst)[cp], src, MIN(len, lim - cp));
-
- return len;
-} /* dns__printstring() */
-
-#define dns__printstring5(a, b, c, d, e) dns__printstring((a), (b), (c), (d), (e))
-#define dns__printstring4(a, b, c, d) dns__printstring((a), (b), (c), (d), strlen((d)))
-#define dns__printstring(...) DNS_PP_CALL(DNS_PP_XPASTE(dns__printstring, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
-
-
-static void dns__printnul(void *dst, size_t lim, size_t off) {
- if (lim > 0)
- ((unsigned char *)dst)[MIN(off, lim - 1)] = '\0';
-} /* dns__printnul() */
-
-
-static size_t dns__print10(void *dst, size_t lim, size_t off, unsigned n, unsigned pad) {
- unsigned char tmp[32];
- unsigned dp = off;
- unsigned cp = 0;
- unsigned d = 1000000000;
- unsigned ch;
-
- pad = MAX(1, pad);
-
- while (d) {
- if ((ch = n / d) || cp > 0) {
- n -= ch * d;
-
- tmp[cp] = '0' + ch;
-
- cp++;
- }
-
- d /= 10;
- }
-
- while (cp < pad) {
- dp += dns__printchar(dst, lim, dp, '0');
- pad--;
- }
-
- dp += dns__printstring(dst, lim, dp, tmp, cp);
-
- return dp - off;
-} /* dns__print10() */
-
-
-size_t dns_rr_print(void *dst, size_t lim, struct dns_rr *rr, struct dns_packet *P, int *error_) {
- union dns_any any;
- size_t cp, n, rdlen;
- void *rd;
- int error;
-
- cp = 0;
-
- if (rr->section == DNS_S_QD)
- cp += dns__printchar(dst, lim, cp, ';');
-
- if (!(n = dns_d_expand(&((unsigned char *)dst)[cp], (cp < lim)? lim - cp : 0, rr->dn.p, P, &error)))
- goto error;
-
- cp += n;
-
- if (rr->section != DNS_S_QD) {
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, rr->ttl, 0);
- }
-
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__printstring(dst, lim, cp, dns_strclass(rr->class), strlen(dns_strclass(rr->class)));
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__printstring(dst, lim, cp, dns_strtype(rr->type), strlen(dns_strtype(rr->type)));
-
- if (rr->section == DNS_S_QD)
- goto epilog;
-
- cp += dns__printchar(dst, lim, cp, ' ');
-
- if ((error = dns_any_parse(dns_any_init(&any, sizeof any), rr, P)))
- goto error;
-
- if (cp < lim) {
- rd = &((unsigned char *)dst)[cp];
- rdlen = lim - cp;
- } else {
- rd = 0;
- rdlen = 0;
- }
-
- cp += dns_any_print(rd, rdlen, &any, rr->type);
-
-epilog:
- dns__printnul(dst, lim, cp);
-
- return cp;
-error:
- *error_ = error;
-
- return 0;
-} /* dns_rr_print() */
-
-
-int dns_a_parse(struct dns_a *a, struct dns_rr *rr, struct dns_packet *P) {
- unsigned long addr;
-
- if (rr->rd.len != 4)
- return DNS_EILLEGAL;
-
- addr = ((0xff & P->data[rr->rd.p + 0]) << 24)
- | ((0xff & P->data[rr->rd.p + 1]) << 16)
- | ((0xff & P->data[rr->rd.p + 2]) << 8)
- | ((0xff & P->data[rr->rd.p + 3]) << 0);
-
- a->addr.s_addr = htonl(addr);
-
- return 0;
-} /* dns_a_parse() */
-
-
-int dns_a_push(struct dns_packet *P, struct dns_a *a) {
- unsigned long addr;
-
- if (P->size - P->end < 6)
- return DNS_ENOBUFS;
-
- P->data[P->end++] = 0x00;
- P->data[P->end++] = 0x04;
-
- addr = ntohl(a->addr.s_addr);
-
- P->data[P->end++] = 0xff & (addr >> 24);
- P->data[P->end++] = 0xff & (addr >> 16);
- P->data[P->end++] = 0xff & (addr >> 8);
- P->data[P->end++] = 0xff & (addr >> 0);
-
- return 0;
-} /* dns_a_push() */
-
-
-size_t dns_a_arpa(void *dst, size_t lim, const struct dns_a *a) {
- unsigned long a4 = ntohl(a->addr.s_addr);
- size_t cp = 0;
- unsigned i;
-
- for (i = 4; i > 0; i--) {
- cp += dns__print10(dst, lim, cp, (0xff & a4), 0);
- cp += dns__printchar(dst, lim, cp, '.');
- a4 >>= 8;
- }
-
- cp += dns__printstring(dst, lim, cp, "in-addr.arpa.");
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_a_arpa() */
-
-
-int dns_a_cmp(const struct dns_a *a, const struct dns_a *b) {
- if (ntohl(a->addr.s_addr) < ntohl(b->addr.s_addr))
- return -1;
- if (ntohl(a->addr.s_addr) > ntohl(b->addr.s_addr))
- return 1;
-
- return 0;
-} /* dns_a_cmp() */
-
-
-size_t dns_a_print(void *dst, size_t lim, struct dns_a *a) {
- char addr[INET_ADDRSTRLEN + 1] = "0.0.0.0";
- size_t len;
-
- dns_inet_ntop(AF_INET, &a->addr, addr, sizeof addr);
-
- dns__printnul(dst, lim, (len = dns__printstring(dst, lim, 0, addr)));
-
- return len;
-} /* dns_a_print() */
-
-
-int dns_aaaa_parse(struct dns_aaaa *aaaa, struct dns_rr *rr, struct dns_packet *P) {
- if (rr->rd.len != sizeof aaaa->addr.s6_addr)
- return DNS_EILLEGAL;
-
- memcpy(aaaa->addr.s6_addr, &P->data[rr->rd.p], sizeof aaaa->addr.s6_addr);
-
- return 0;
-} /* dns_aaaa_parse() */
-
-
-int dns_aaaa_push(struct dns_packet *P, struct dns_aaaa *aaaa) {
- if (P->size - P->end < 2 + sizeof aaaa->addr.s6_addr)
- return DNS_ENOBUFS;
-
- P->data[P->end++] = 0x00;
- P->data[P->end++] = 0x10;
-
- memcpy(&P->data[P->end], aaaa->addr.s6_addr, sizeof aaaa->addr.s6_addr);
-
- P->end += sizeof aaaa->addr.s6_addr;
-
- return 0;
-} /* dns_aaaa_push() */
-
-
-int dns_aaaa_cmp(const struct dns_aaaa *a, const struct dns_aaaa *b) {
- unsigned i;
- int cmp;
-
- for (i = 0; i < lengthof(a->addr.s6_addr); i++) {
- if ((cmp = (a->addr.s6_addr[i] - b->addr.s6_addr[i])))
- return cmp;
- }
-
- return 0;
-} /* dns_aaaa_cmp() */
-
-
-size_t dns_aaaa_arpa(void *dst, size_t lim, const struct dns_aaaa *aaaa) {
- static const unsigned char hex[16] = "0123456789abcdef";
- size_t cp = 0;
- unsigned nyble;
- int i, j;
-
- for (i = sizeof aaaa->addr.s6_addr - 1; i >= 0; i--) {
- nyble = aaaa->addr.s6_addr[i];
-
- for (j = 0; j < 2; j++) {
- cp += dns__printchar(dst, lim, cp, hex[0x0f & nyble]);
- cp += dns__printchar(dst, lim, cp, '.');
- nyble >>= 4;
- }
- }
-
- cp += dns__printstring(dst, lim, cp, "ip6.arpa.");
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_aaaa_arpa() */
-
-
-size_t dns_aaaa_print(void *dst, size_t lim, struct dns_aaaa *aaaa) {
- char addr[INET6_ADDRSTRLEN + 1] = "::";
- size_t len;
-
- dns_inet_ntop(AF_INET6, &aaaa->addr, addr, sizeof addr);
-
- dns__printnul(dst, lim, (len = dns__printstring(dst, lim, 0, addr)));
-
- return len;
-} /* dns_aaaa_print() */
-
-
-int dns_mx_parse(struct dns_mx *mx, struct dns_rr *rr, struct dns_packet *P) {
- size_t len;
- int error;
-
- if (rr->rd.len < 3)
- return DNS_EILLEGAL;
-
- mx->preference = (0xff00 & (P->data[rr->rd.p + 0] << 8))
- | (0x00ff & (P->data[rr->rd.p + 1] << 0));
-
- if (!(len = dns_d_expand(mx->host, sizeof mx->host, rr->rd.p + 2, P, &error)))
- return error;
- else if (len >= sizeof mx->host)
- return DNS_EILLEGAL;
-
- return 0;
-} /* dns_mx_parse() */
-
-
-int dns_mx_push(struct dns_packet *P, struct dns_mx *mx) {
- size_t end, len;
- int error;
-
- if (P->size - P->end < 5)
- return DNS_ENOBUFS;
-
- end = P->end;
- P->end += 2;
-
- P->data[P->end++] = 0xff & (mx->preference >> 8);
- P->data[P->end++] = 0xff & (mx->preference >> 0);
-
- if ((error = dns_d_push(P, mx->host, strlen(mx->host))))
- goto error;
-
- len = P->end - end - 2;
-
- P->data[end + 0] = 0xff & (len >> 8);
- P->data[end + 1] = 0xff & (len >> 0);
-
- return 0;
-error:
- P->end = end;
-
- return error;
-} /* dns_mx_push() */
-
-
-int dns_mx_cmp(const struct dns_mx *a, const struct dns_mx *b) {
- int cmp;
-
- if ((cmp = a->preference - b->preference))
- return cmp;
-
- return strcasecmp(a->host, b->host);
-} /* dns_mx_cmp() */
-
-
-size_t dns_mx_print(void *dst, size_t lim, struct dns_mx *mx) {
- size_t cp = 0;
-
- cp += dns__print10(dst, lim, cp, mx->preference, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__printstring(dst, lim, cp, mx->host, strlen(mx->host));
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_mx_print() */
-
-
-size_t dns_mx_cname(void *dst, size_t lim, struct dns_mx *mx) {
- return dns_strlcpy(dst, mx->host, lim);
-} /* dns_mx_cname() */
-
-
-int dns_ns_parse(struct dns_ns *ns, struct dns_rr *rr, struct dns_packet *P) {
- size_t len;
- int error;
-
- if (!(len = dns_d_expand(ns->host, sizeof ns->host, rr->rd.p, P, &error)))
- return error;
- else if (len >= sizeof ns->host)
- return DNS_EILLEGAL;
-
- return 0;
-} /* dns_ns_parse() */
-
-
-int dns_ns_push(struct dns_packet *P, struct dns_ns *ns) {
- size_t end, len;
- int error;
-
- if (P->size - P->end < 3)
- return DNS_ENOBUFS;
-
- end = P->end;
- P->end += 2;
-
- if ((error = dns_d_push(P, ns->host, strlen(ns->host))))
- goto error;
-
- len = P->end - end - 2;
-
- P->data[end + 0] = 0xff & (len >> 8);
- P->data[end + 1] = 0xff & (len >> 0);
-
- return 0;
-error:
- P->end = end;
-
- return error;
-} /* dns_ns_push() */
-
-
-int dns_ns_cmp(const struct dns_ns *a, const struct dns_ns *b) {
- return strcasecmp(a->host, b->host);
-} /* dns_ns_cmp() */
-
-
-size_t dns_ns_print(void *dst, size_t lim, struct dns_ns *ns) {
- size_t cp;
-
- cp = dns__printstring(dst, lim, 0, ns->host, strlen(ns->host));
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_ns_print() */
-
-
-size_t dns_ns_cname(void *dst, size_t lim, struct dns_ns *ns) {
- return dns_strlcpy(dst, ns->host, lim);
-} /* dns_ns_cname() */
-
-
-int dns_cname_parse(struct dns_cname *cname, struct dns_rr *rr, struct dns_packet *P) {
- return dns_ns_parse((struct dns_ns *)cname, rr, P);
-} /* dns_cname_parse() */
-
-
-int dns_cname_push(struct dns_packet *P, struct dns_cname *cname) {
- return dns_ns_push(P, (struct dns_ns *)cname);
-} /* dns_cname_push() */
-
-
-int dns_cname_cmp(const struct dns_cname *a, const struct dns_cname *b) {
- return strcasecmp(a->host, b->host);
-} /* dns_cname_cmp() */
-
-
-size_t dns_cname_print(void *dst, size_t lim, struct dns_cname *cname) {
- return dns_ns_print(dst, lim, (struct dns_ns *)cname);
-} /* dns_cname_print() */
-
-
-size_t dns_cname_cname(void *dst, size_t lim, struct dns_cname *cname) {
- return dns_strlcpy(dst, cname->host, lim);
-} /* dns_cname_cname() */
-
-
-int dns_soa_parse(struct dns_soa *soa, struct dns_rr *rr, struct dns_packet *P) {
- struct { void *dst; size_t lim; } dn[] =
- { { soa->mname, sizeof soa->mname },
- { soa->rname, sizeof soa->rname } };
- unsigned *ts[] =
- { &soa->serial, &soa->refresh, &soa->retry, &soa->expire, &soa->minimum };
- unsigned short rp;
- unsigned i, j, n;
- int error;
-
- /* MNAME / RNAME */
- if ((rp = rr->rd.p) >= P->end)
- return DNS_EILLEGAL;
-
- for (i = 0; i < lengthof(dn); i++) {
- if (!(n = dns_d_expand(dn[i].dst, dn[i].lim, rp, P, &error)))
- return error;
- else if (n >= dn[i].lim)
- return DNS_EILLEGAL;
-
- if ((rp = dns_d_skip(rp, P)) >= P->end)
- return DNS_EILLEGAL;
- }
-
- /* SERIAL / REFRESH / RETRY / EXPIRE / MINIMUM */
- for (i = 0; i < lengthof(ts); i++) {
- for (j = 0; j < 4; j++, rp++) {
- if (rp >= P->end)
- return DNS_EILLEGAL;
-
- *ts[i] <<= 8;
- *ts[i] |= (0xff & P->data[rp]);
- }
- }
-
- return 0;
-} /* dns_soa_parse() */
-
-
-int dns_soa_push(struct dns_packet *P, struct dns_soa *soa) {
- void *dn[] = { soa->mname, soa->rname };
- unsigned ts[] = { (0xffffffff & soa->serial),
- (0x7fffffff & soa->refresh),
- (0x7fffffff & soa->retry),
- (0x7fffffff & soa->expire),
- (0xffffffff & soa->minimum) };
- unsigned i, j;
- size_t end, len;
- int error;
-
- end = P->end;
-
- if ((P->end += 2) >= P->size)
- goto toolong;
-
- /* MNAME / RNAME */
- for (i = 0; i < lengthof(dn); i++) {
- if ((error = dns_d_push(P, dn[i], strlen(dn[i]))))
- goto error;
- }
-
- /* SERIAL / REFRESH / RETRY / EXPIRE / MINIMUM */
- for (i = 0; i < lengthof(ts); i++) {
- if ((P->end += 4) >= P->size)
- goto toolong;
-
- for (j = 1; j <= 4; j++) {
- P->data[P->end - j] = (0xff & ts[i]);
- ts[i] >>= 8;
- }
- }
-
- len = P->end - end - 2;
- P->data[end + 0] = (0xff & (len >> 8));
- P->data[end + 1] = (0xff & (len >> 0));
-
- return 0;
-toolong:
- error = DNS_ENOBUFS;
-
- /* FALL THROUGH */
-error:
- P->end = end;
-
- return error;
-} /* dns_soa_push() */
-
-
-int dns_soa_cmp(const struct dns_soa *a, const struct dns_soa *b) {
- int cmp;
-
- if ((cmp = strcasecmp(a->mname, b->mname)))
- return cmp;
-
- if ((cmp = strcasecmp(a->rname, b->rname)))
- return cmp;
-
- if (a->serial > b->serial)
- return -1;
- else if (a->serial < b->serial)
- return 1;
-
- if (a->refresh > b->refresh)
- return -1;
- else if (a->refresh < b->refresh)
- return 1;
-
- if (a->retry > b->retry)
- return -1;
- else if (a->retry < b->retry)
- return 1;
-
- if (a->expire > b->expire)
- return -1;
- else if (a->expire < b->expire)
- return 1;
-
- if (a->minimum > b->minimum)
- return -1;
- else if (a->minimum < b->minimum)
- return 1;
-
- return 0;
-} /* dns_soa_cmp() */
-
-
-size_t dns_soa_print(void *dst, size_t lim, struct dns_soa *soa) {
- size_t cp = 0;
-
- cp += dns__printstring(dst, lim, cp, soa->mname, strlen(soa->mname));
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__printstring(dst, lim, cp, soa->rname, strlen(soa->rname));
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, soa->serial, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, soa->refresh, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, soa->retry, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, soa->expire, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, soa->minimum, 0);
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_soa_print() */
-
-
-int dns_srv_parse(struct dns_srv *srv, struct dns_rr *rr, struct dns_packet *P) {
- unsigned short rp;
- unsigned i;
- size_t n;
- int error;
-
- memset(srv, '\0', sizeof *srv);
-
- rp = rr->rd.p;
-
- if (P->size - P->end < 6)
- return DNS_EILLEGAL;
-
- for (i = 0; i < 2; i++, rp++) {
- srv->priority <<= 8;
- srv->priority |= (0xff & P->data[rp]);
- }
-
- for (i = 0; i < 2; i++, rp++) {
- srv->weight <<= 8;
- srv->weight |= (0xff & P->data[rp]);
- }
-
- for (i = 0; i < 2; i++, rp++) {
- srv->port <<= 8;
- srv->port |= (0xff & P->data[rp]);
- }
-
- if (!(n = dns_d_expand(srv->target, sizeof srv->target, rp, P, &error)))
- return error;
- else if (n >= sizeof srv->target)
- return DNS_EILLEGAL;
-
- return 0;
-} /* dns_srv_parse() */
-
-
-int dns_srv_push(struct dns_packet *P, struct dns_srv *srv) {
- size_t end, len;
- int error;
-
- end = P->end;
-
- if (P->size - P->end < 2)
- goto toolong;
-
- P->end += 2;
-
- if (P->size - P->end < 6)
- goto toolong;
-
- P->data[P->end++] = 0xff & (srv->priority >> 8);
- P->data[P->end++] = 0xff & (srv->priority >> 0);
-
- P->data[P->end++] = 0xff & (srv->weight >> 8);
- P->data[P->end++] = 0xff & (srv->weight >> 0);
-
- P->data[P->end++] = 0xff & (srv->port >> 8);
- P->data[P->end++] = 0xff & (srv->port >> 0);
-
- if (0 == (len = dns_d_comp(&P->data[P->end], P->size - P->end, srv->target, strlen(srv->target), P, &error)))
- goto error;
- else if (P->size - P->end < len)
- goto toolong;
-
- P->end += len;
-
- if (P->end > 65535)
- goto toolong;
-
- len = P->end - end - 2;
-
- P->data[end + 0] = 0xff & (len >> 8);
- P->data[end + 1] = 0xff & (len >> 0);
-
- return 0;
-toolong:
- error = DNS_ENOBUFS;
-
- /* FALL THROUGH */
-error:
- P->end = end;
-
- return error;
-} /* dns_srv_push() */
-
-
-int dns_srv_cmp(const struct dns_srv *a, const struct dns_srv *b) {
- int cmp;
-
- if ((cmp = a->priority - b->priority))
- return cmp;
-
- /*
- * FIXME: We need some sort of random seed to implement the dynamic
- * weighting required by RFC 2782.
- */
- if ((cmp = a->weight - b->weight))
- return cmp;
-
- if ((cmp = a->port - b->port))
- return cmp;
-
- return strcasecmp(a->target, b->target);
-} /* dns_srv_cmp() */
-
-
-size_t dns_srv_print(void *dst, size_t lim, struct dns_srv *srv) {
- size_t cp = 0;
-
- cp += dns__print10(dst, lim, cp, srv->priority, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, srv->weight, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__print10(dst, lim, cp, srv->port, 0);
- cp += dns__printchar(dst, lim, cp, ' ');
- cp += dns__printstring(dst, lim, cp, srv->target, strlen(srv->target));
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_srv_print() */
-
-
-size_t dns_srv_cname(void *dst, size_t lim, struct dns_srv *srv) {
- return dns_strlcpy(dst, srv->target, lim);
-} /* dns_srv_cname() */
-
-
-int dns_ptr_parse(struct dns_ptr *ptr, struct dns_rr *rr, struct dns_packet *P) {
- return dns_ns_parse((struct dns_ns *)ptr, rr, P);
-} /* dns_ptr_parse() */
-
-
-int dns_ptr_push(struct dns_packet *P, struct dns_ptr *ptr) {
- return dns_ns_push(P, (struct dns_ns *)ptr);
-} /* dns_ptr_push() */
-
-
-size_t dns_ptr_qname(void *dst, size_t lim, int af, void *addr) {
- unsigned len = (af == AF_INET6)
- ? dns_aaaa_arpa(dst, lim, addr)
- : dns_a_arpa(dst, lim, addr);
-
- dns__printnul(dst, lim, len);
-
- return len;
-} /* dns_ptr_qname() */
-
-
-int dns_ptr_cmp(const struct dns_ptr *a, const struct dns_ptr *b) {
- return strcasecmp(a->host, b->host);
-} /* dns_ptr_cmp() */
-
-
-size_t dns_ptr_print(void *dst, size_t lim, struct dns_ptr *ptr) {
- return dns_ns_print(dst, lim, (struct dns_ns *)ptr);
-} /* dns_ptr_print() */
-
-
-size_t dns_ptr_cname(void *dst, size_t lim, struct dns_ptr *ptr) {
- return dns_strlcpy(dst, ptr->host, lim);
-} /* dns_ptr_cname() */
-
-
-int dns_sshfp_parse(struct dns_sshfp *fp, struct dns_rr *rr, struct dns_packet *P) {
- unsigned p = rr->rd.p, pe = rr->rd.p + rr->rd.len;
-
- if (pe - p < 2)
- return DNS_EILLEGAL;
-
- fp->algo = P->data[p++];
- fp->type = P->data[p++];
-
- switch (fp->type) {
- case DNS_SSHFP_SHA1:
- if (pe - p < sizeof fp->digest.sha1)
- return DNS_EILLEGAL;
-
- memcpy(fp->digest.sha1, &P->data[p], sizeof fp->digest.sha1);
-
- break;
- default:
- break;
- } /* switch() */
-
- return 0;
-} /* dns_sshfp_parse() */
-
-
-int dns_sshfp_push(struct dns_packet *P, struct dns_sshfp *fp) {
- unsigned p = P->end, pe = P->size, n;
-
- if (pe - p < 4)
- return DNS_ENOBUFS;
-
- p += 2;
- P->data[p++] = 0xff & fp->algo;
- P->data[p++] = 0xff & fp->type;
-
- switch (fp->type) {
- case DNS_SSHFP_SHA1:
- if (pe - p < sizeof fp->digest.sha1)
- return DNS_ENOBUFS;
-
- memcpy(&P->data[p], fp->digest.sha1, sizeof fp->digest.sha1);
- p += sizeof fp->digest.sha1;
-
- break;
- default:
- return DNS_EILLEGAL;
- } /* switch() */
-
- n = p - P->end - 2;
- P->data[P->end++] = 0xff & (n >> 8);
- P->data[P->end++] = 0xff & (n >> 0);
- P->end = p;
-
- return 0;
-} /* dns_sshfp_push() */
-
-
-int dns_sshfp_cmp(const struct dns_sshfp *a, const struct dns_sshfp *b) {
- int cmp;
-
- if ((cmp = a->algo - b->algo) || (cmp - a->type - b->type))
- return cmp;
-
- switch (a->type) {
- case DNS_SSHFP_SHA1:
- return memcmp(a->digest.sha1, b->digest.sha1, sizeof a->digest.sha1);
- default:
- return 0;
- } /* switch() */
-
- /* NOT REACHED */
-} /* dns_sshfp_cmp() */
-
-
-size_t dns_sshfp_print(void *dst, size_t lim, struct dns_sshfp *fp) {
- static const unsigned char hex[16] = "0123456789abcdef";
- size_t i, p = 0;
-
- p += dns__print10(dst, lim, p, fp->algo, 0);
- p += dns__printchar(dst, lim, p, ' ');
- p += dns__print10(dst, lim, p, fp->type, 0);
- p += dns__printchar(dst, lim, p, ' ');
-
- switch (fp->type) {
- case DNS_SSHFP_SHA1:
- for (i = 0; i < sizeof fp->digest.sha1; i++) {
- p += dns__printchar(dst, lim, p, hex[0x0f & (fp->digest.sha1[i] >> 4)]);
- p += dns__printchar(dst, lim, p, hex[0x0f & (fp->digest.sha1[i] >> 0)]);
- }
-
- break;
- default:
- p += dns__printchar(dst, lim, p, '0');
-
- break;
- } /* switch() */
-
- dns__printnul(dst, lim, p);
-
- return p;
-} /* dns_sshfp_print() */
-
-
-struct dns_txt *dns_txt_init(struct dns_txt *txt, size_t size) {
- assert(size > offsetof(struct dns_txt, data));
-
- txt->size = size - offsetof(struct dns_txt, data);
- txt->len = 0;
-
- return txt;
-} /* dns_txt_init() */
-
-
-int dns_txt_parse(struct dns_txt *txt, struct dns_rr *rr, struct dns_packet *P) {
- struct { unsigned char *b; size_t p, end; } dst, src;
- unsigned n;
-
- dst.b = txt->data;
- dst.p = 0;
- dst.end = txt->size;
-
- src.b = P->data;
- src.p = rr->rd.p;
- src.end = src.p + rr->rd.len;
-
- while (src.p < src.end) {
- n = 0xff & P->data[src.p++];
-
- if (src.end - src.p < n || dst.end - dst.p < n)
- return DNS_EILLEGAL;
-
- memcpy(&dst.b[dst.p], &src.b[src.p], n);
-
- dst.p += n;
- src.p += n;
- }
-
- txt->len = dst.p;
-
- return 0;
-} /* dns_txt_parse() */
-
-
-int dns_txt_push(struct dns_packet *P, struct dns_txt *txt) {
- struct { unsigned char *b; size_t p, end; } dst, src;
- unsigned n;
-
- dst.b = P->data;
- dst.p = P->end;
- dst.end = P->size;
-
- src.b = txt->data;
- src.p = 0;
- src.end = txt->len;
-
- if (dst.end - dst.p < 2)
- return DNS_ENOBUFS;
-
- n = txt->len + ((txt->len + 254) / 255);
-
- dst.b[dst.p++] = 0xff & (n >> 8);
- dst.b[dst.p++] = 0xff & (n >> 0);
-
- while (src.p < src.end) {
- n = MIN(255, src.end - src.p);
-
- if (dst.p >= dst.end)
- return DNS_ENOBUFS;
-
- dst.b[dst.p++] = n;
-
- if (dst.end - dst.p < n)
- return DNS_ENOBUFS;
-
- memcpy(&dst.b[dst.p], &src.b[src.p], n);
-
- dst.p += n;
- src.p += n;
- }
-
- P->end = dst.p;
-
- return 0;
-} /* dns_txt_push() */
-
-
-int dns_txt_cmp(const struct dns_txt *a __UNUSED__, const struct dns_txt *b __UNUSED__) {
- return -1;
-} /* dns_txt_cmp() */
-
-
-size_t dns_txt_print(void *dst_, size_t lim, struct dns_txt *txt) {
- struct { unsigned char *b; size_t p, end; } dst, src;
- unsigned ch;
-
- dst.b = dst_;
- dst.end = lim;
- dst.p = 0;
-
- src.b = txt->data;
- src.end = txt->len;
- src.p = 0;
-
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '"');
-
- while (src.p < src.end) {
- ch = src.b[src.p];
-
- if (0 == (src.p++ % 255) && src.p != 1) {
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '"');
- dst.p += dns__printchar(dst.b, dst.end, dst.p, ' ');
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '"');
- }
-
- if (ch < 32 || ch > 126 || ch == '"' || ch == '\\') {
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '\\');
- dst.p += dns__print10(dst.b, dst.end, dst.p, ch, 3);
- } else {
- dst.p += dns__printchar(dst.b, dst.end, dst.p, ch);
- }
- }
-
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '"');
-
- dns__printnul(dst.b, dst.end, dst.p);
-
- return dst.p;
-} /* dns_txt_print() */
-
-
-static const struct {
- enum dns_type type;
- const char *name;
- int (*parse)();
- int (*push)();
- int (*cmp)();
- size_t (*print)();
- size_t (*cname)();
-} dns_rrtypes[] = {
- { DNS_T_A, "A", &dns_a_parse, &dns_a_push, &dns_a_cmp, &dns_a_print, 0 },
- { DNS_T_AAAA, "AAAA", &dns_aaaa_parse, &dns_aaaa_push, &dns_aaaa_cmp, &dns_aaaa_print, 0 },
- { DNS_T_MX, "MX", &dns_mx_parse, &dns_mx_push, &dns_mx_cmp, &dns_mx_print, &dns_mx_cname },
- { DNS_T_NS, "NS", &dns_ns_parse, &dns_ns_push, &dns_ns_cmp, &dns_ns_print, &dns_ns_cname },
- { DNS_T_CNAME, "CNAME", &dns_cname_parse, &dns_cname_push, &dns_cname_cmp, &dns_cname_print, &dns_cname_cname },
- { DNS_T_SOA, "SOA", &dns_soa_parse, &dns_soa_push, &dns_soa_cmp, &dns_soa_print, 0 },
- { DNS_T_SRV, "SRV", &dns_srv_parse, &dns_srv_push, &dns_srv_cmp, &dns_srv_print, &dns_srv_cname },
- { DNS_T_PTR, "PTR", &dns_ptr_parse, &dns_ptr_push, &dns_ptr_cmp, &dns_ptr_print, &dns_ptr_cname },
- { DNS_T_TXT, "TXT", &dns_txt_parse, &dns_txt_push, &dns_txt_cmp, &dns_txt_print, 0 },
- { DNS_T_SPF, "SPF", &dns_txt_parse, &dns_txt_push, &dns_txt_cmp, &dns_txt_print, 0 },
- { DNS_T_SSHFP, "SSHFP", &dns_sshfp_parse, &dns_sshfp_push, &dns_sshfp_cmp, &dns_sshfp_print, 0 },
-}; /* dns_rrtypes[] */
-
-
-union dns_any *dns_any_init(union dns_any *any, size_t size) {
- return (union dns_any *)dns_txt_init(&any->rdata, size);
-} /* dns_any_init() */
-
-
-int dns_any_parse(union dns_any *any, struct dns_rr *rr, struct dns_packet *P) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (dns_rrtypes[i].type == rr->type)
- return dns_rrtypes[i].parse(any, rr, P);
- }
-
- if (rr->rd.len > any->rdata.size)
- return DNS_EILLEGAL;
-
- memcpy(any->rdata.data, &P->data[rr->rd.p], rr->rd.len);
- any->rdata.len = rr->rd.len;
-
- return 0;
-} /* dns_any_parse() */
-
-
-int dns_any_push(struct dns_packet *P, union dns_any *any, enum dns_type type) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (dns_rrtypes[i].type == type)
- return dns_rrtypes[i].push(P, any);
- }
-
- if (P->size - P->end < any->rdata.len + 2)
- return DNS_ENOBUFS;
-
- P->data[P->end++] = 0xff & (any->rdata.len >> 8);
- P->data[P->end++] = 0xff & (any->rdata.len >> 0);
-
- memcpy(&P->data[P->end], any->rdata.data, any->rdata.len);
- P->end += any->rdata.len;
-
- return 0;
-} /* dns_any_push() */
-
-
-int dns_any_cmp(const union dns_any *a, enum dns_type x, const union dns_any *b, enum dns_type y) {
- unsigned i;
- int cmp;
-
- if ((cmp = x - y))
- return cmp;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (dns_rrtypes[i].type == x)
- return dns_rrtypes[i].cmp(a, b);
- }
-
- return -1;
-} /* dns_any_cmp() */
-
-
-size_t dns_any_print(void *dst_, size_t lim, union dns_any *any, enum dns_type type) {
- struct { unsigned char *b; size_t p, end; } dst, src;
- unsigned i, ch;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (dns_rrtypes[i].type == type)
- return dns_rrtypes[i].print(dst_, lim, any);
- }
-
- dst.b = dst_;
- dst.end = lim;
- dst.p = 0;
-
- src.b = any->rdata.data;
- src.end = any->rdata.len;
- src.p = 0;
-
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '"');
-
- while (src.p < src.end) {
- ch = src.b[src.p++];
-
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '\\');
- dst.p += dns__print10(dst.b, dst.end, dst.p, ch, 3);
- }
-
- dst.p += dns__printchar(dst.b, dst.end, dst.p, '"');
-
- dns__printnul(dst.b, dst.end, dst.p);
-
- return dst.p;
-} /* dns_any_print() */
-
-
-size_t dns_any_cname(void *dst, size_t lim, union dns_any *any, enum dns_type type) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (dns_rrtypes[i].type == type)
- return (dns_rrtypes[i].cname)? dns_rrtypes[i].cname(dst, lim, any) : 0;
- }
-
- return 0;
-} /* dns_any_cname() */
-
-
-/*
- * H O S T S R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_hosts {
- struct dns_hosts_entry {
- char host[DNS_D_MAXNAME + 1];
- char arpa[73 + 1];
-
- int af;
-
- union {
- struct in_addr a4;
- struct in6_addr a6;
- } addr;
-
- _Bool alias;
-
- struct dns_hosts_entry *next;
- } *head, **tail;
-
- dns_atomic_t refcount;
-}; /* struct dns_hosts */
-
-
-struct dns_hosts *dns_hosts_open(int *error) {
- static const struct dns_hosts hosts_initializer = { .refcount = 1 };
- struct dns_hosts *hosts;
-
- if (!(hosts = malloc(sizeof *hosts)))
- goto syerr;
-
- *hosts = hosts_initializer;
-
- hosts->tail = &hosts->head;
-
- return hosts;
-syerr:
- *error = dns_syerr();
-
- free(hosts);
-
- return 0;
-} /* dns_hosts_open() */
-
-
-void dns_hosts_close(struct dns_hosts *hosts) {
- struct dns_hosts_entry *ent, *xnt;
-
- if (!hosts || 1 != dns_hosts_release(hosts))
- return;
-
- for (ent = hosts->head; ent; ent = xnt) {
- xnt = ent->next;
-
- free(ent);
- }
-
- free(hosts);
-
- return;
-} /* dns_hosts_close() */
-
-
-unsigned dns_hosts_acquire(struct dns_hosts *hosts) {
- return dns_atomic_inc(&hosts->refcount);
-} /* dns_hosts_acquire() */
-
-
-unsigned dns_hosts_release(struct dns_hosts *hosts) {
- return dns_atomic_dec(&hosts->refcount);
-} /* dns_hosts_release() */
-
-
-struct dns_hosts *dns_hosts_mortal(struct dns_hosts *hosts) {
- if (hosts)
- dns_hosts_release(hosts);
-
- return hosts;
-} /* dns_hosts_mortal() */
-
-
-struct dns_hosts *dns_hosts_local(int *error_) {
- struct dns_hosts *hosts;
- int error;
-
- if (!(hosts = dns_hosts_open(&error)))
- goto error;
-
- if ((error = dns_hosts_loadpath(hosts, "/etc/hosts")))
- goto error;
-
- return hosts;
-error:
- *error_ = error;
-
- dns_hosts_close(hosts);
-
- return 0;
-} /* dns_hosts_local() */
-
-
-#define dns_hosts_issep(ch) (isspace(ch))
-#define dns_hosts_iscom(ch) ((ch) == '#' || (ch) == ';')
-
-int dns_hosts_loadfile(struct dns_hosts *hosts, FILE *fp) {
- struct dns_hosts_entry ent;
- char word[MAX(INET6_ADDRSTRLEN, DNS_D_MAXNAME) + 1];
- unsigned wp, wc, skip;
- int ch, error;
-
- rewind(fp);
-
- do {
- memset(&ent, '\0', sizeof ent);
- wc = 0;
- skip = 0;
-
- do {
- memset(word, '\0', sizeof word);
- wp = 0;
-
- while (EOF != (ch = fgetc(fp)) && ch != '\n') {
- skip |= !!dns_hosts_iscom(ch);
-
- if (skip)
- continue;
-
- if (dns_hosts_issep(ch))
- break;
-
- if (wp < sizeof word - 1)
- word[wp] = ch;
- wp++;
- }
-
- if (!wp)
- continue;
-
- wc++;
-
- switch (wc) {
- case 0:
- break;
- case 1:
- ent.af = (strchr(word, ':'))? AF_INET6 : AF_INET;
- skip = (1 != dns_inet_pton(ent.af, word, &ent.addr));
-
- break;
- default:
- if (!wp)
- break;
-
- dns_d_anchor(ent.host, sizeof ent.host, word, wp);
-
- if ((error = dns_hosts_insert(hosts, ent.af, &ent.addr, ent.host, (wc > 2))))
- return error;
-
- break;
- } /* switch() */
- } while (ch != EOF && ch != '\n');
- } while (ch != EOF);
-
- return 0;
-} /* dns_hosts_loadfile() */
-
-
-int dns_hosts_loadpath(struct dns_hosts *hosts, const char *path) {
- FILE *fp;
- int error;
-
- if (!(fp = fopen(path, "r")))
- return dns_syerr();
-
- error = dns_hosts_loadfile(hosts, fp);
-
- fclose(fp);
-
- return error;
-} /* dns_hosts_loadpath() */
-
-
-int dns_hosts_dump(struct dns_hosts *hosts, FILE *fp) {
- struct dns_hosts_entry *ent, *xnt;
- char addr[INET6_ADDRSTRLEN + 1];
- unsigned i;
-
- for (ent = hosts->head; ent; ent = xnt) {
- xnt = ent->next;
-
- dns_inet_ntop(ent->af, &ent->addr, addr, sizeof addr);
-
- fputs(addr, fp);
-
- for (i = strlen(addr); i < INET_ADDRSTRLEN; i++)
- fputc(' ', fp);
-
- fputc(' ', fp);
-
- fputs(ent->host, fp);
- fputc('\n', fp);
- }
-
- return 0;
-} /* dns_hosts_dump() */
-
-
-int dns_hosts_insert(struct dns_hosts *hosts, int af, const void *addr, const void *host, _Bool alias) {
- struct dns_hosts_entry *ent;
- int error;
-
- if (!(ent = malloc(sizeof *ent)))
- goto syerr;
-
- dns_d_anchor(ent->host, sizeof ent->host, host, strlen(host));
-
- switch ((ent->af = af)) {
- case AF_INET6:
- memcpy(&ent->addr.a6, addr, sizeof ent->addr.a6);
-
- dns_aaaa_arpa(ent->arpa, sizeof ent->arpa, addr);
-
- break;
- case AF_INET:
- memcpy(&ent->addr.a4, addr, sizeof ent->addr.a4);
-
- dns_a_arpa(ent->arpa, sizeof ent->arpa, addr);
-
- break;
- default:
- error = EINVAL;
-
- goto error;
- } /* switch() */
-
- ent->alias = alias;
-
- ent->next = 0;
- *hosts->tail = ent;
- hosts->tail = &ent->next;
-
- return 0;
-syerr:
- error = dns_syerr();
-error:
- free(ent);
-
- return error;
-} /* dns_hosts_insert() */
-
-
-struct dns_packet *dns_hosts_query(struct dns_hosts *hosts, struct dns_packet *Q, int *error_) {
- struct dns_packet *P = dns_p_new(512);
- struct dns_packet *A = 0;
- struct dns_rr rr;
- struct dns_hosts_entry *ent;
- int error, af;
- char qname[DNS_D_MAXNAME + 1];
- size_t qlen;
-
- if ((error = dns_rr_parse(&rr, 12, Q)))
- goto error;
-
- if (!(qlen = dns_d_expand(qname, sizeof qname, rr.dn.p, Q, &error)))
- goto error;
- else if (qlen >= sizeof qname)
- goto toolong;
-
- if ((error = dns_p_push(P, DNS_S_QD, qname, qlen, rr.type, rr.class, 0, 0)))
- goto error;
-
- switch (rr.type) {
- case DNS_T_PTR:
- for (ent = hosts->head; ent; ent = ent->next) {
- if (ent->alias || 0 != strcasecmp(qname, ent->arpa))
- continue;
-
- if ((error = dns_p_push(P, DNS_S_AN, qname, qlen, rr.type, rr.class, 0, ent->host)))
- goto error;
- }
-
- break;
- case DNS_T_AAAA:
- af = AF_INET6;
-
- goto loop;
- case DNS_T_A:
- af = AF_INET;
-
-loop: for (ent = hosts->head; ent; ent = ent->next) {
- if (ent->af != af || 0 != strcasecmp(qname, ent->host))
- continue;
-
- if ((error = dns_p_push(P, DNS_S_AN, qname, qlen, rr.type, rr.class, 0, &ent->addr)))
- goto error;
- }
-
- break;
- default:
- break;
- } /* switch() */
-
-
- if (!(A = dns_p_copy(dns_p_make(P->end, &error), P)))
- goto error;
-
- return A;
-toolong:
- error = DNS_EILLEGAL;
-error:
- *error_ = error;
-
- free(A);
-
- return 0;
-} /* dns_hosts_query() */
-
-
-/*
- * R E S O L V . C O N F R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_resolv_conf *dns_resconf_open(int *error) {
- static const struct dns_resolv_conf resconf_initializer
- = { .lookup = "bf", .options = { .ndots = 1, .timeout = 5, .attempts = 2, .tcp = DNS_RESCONF_TCP_ENABLE, },
- .iface = { .ss_family = AF_INET }, };
- struct dns_resolv_conf *resconf;
- struct sockaddr_in *sin;
-
- if (!(resconf = malloc(sizeof *resconf)))
- goto syerr;
-
- *resconf = resconf_initializer;
-
- sin = (struct sockaddr_in *)&resconf->nameserver[0];
- sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = INADDR_ANY;
- sin->sin_port = htons(53);
-#if defined(SA_LEN)
- sin->sin_len = sizeof *sin;
-#endif
-
- if (0 != gethostname(resconf->search[0], sizeof resconf->search[0]))
- goto syerr;
-
- dns_d_anchor(resconf->search[0], sizeof resconf->search[0], resconf->search[0], strlen(resconf->search[0]));
- dns_d_cleave(resconf->search[0], sizeof resconf->search[0], resconf->search[0], strlen(resconf->search[0]));
-
- /*
- * XXX: If gethostname() returned a string without any label
- * separator, then search[0][0] should be NUL.
- */
-
- dns_resconf_acquire(resconf);
-
- return resconf;
-syerr:
- *error = dns_syerr();
-
- free(resconf);
-
- return 0;
-} /* dns_resconf_open() */
-
-
-void dns_resconf_close(struct dns_resolv_conf *resconf) {
- if (!resconf || 1 != dns_resconf_release(resconf))
- return /* void */;
-
- free(resconf);
-} /* dns_resconf_close() */
-
-
-unsigned dns_resconf_acquire(struct dns_resolv_conf *resconf) {
- return dns_atomic_inc(&resconf->_.refcount);
-} /* dns_resconf_acquire() */
-
-
-unsigned dns_resconf_release(struct dns_resolv_conf *resconf) {
- return dns_atomic_dec(&resconf->_.refcount);
-} /* dns_resconf_release() */
-
-
-struct dns_resolv_conf *dns_resconf_mortal(struct dns_resolv_conf *resconf) {
- if (resconf)
- dns_resconf_release(resconf);
-
- return resconf;
-} /* dns_resconf_mortal() */
-
-
-struct dns_resolv_conf *dns_resconf_local(int *error_) {
- struct dns_resolv_conf *resconf;
- int error;
-
- if (!(resconf = dns_resconf_open(&error)))
- goto error;
-
- if ((error = dns_resconf_loadpath(resconf, "/etc/resolv.conf")))
- goto error;
-
- return resconf;
-error:
- *error_ = error;
-
- dns_resconf_close(resconf);
-
- return 0;
-} /* dns_resconf_local() */
-
-
-struct dns_resolv_conf *dns_resconf_root(int *error_) {
- struct dns_resolv_conf *resconf;
- int error;
-
- if (!(resconf = dns_resconf_open(&error)))
- goto error;
-
- if ((error = dns_resconf_loadpath(resconf, "/etc/resolv.conf")))
- goto error;
-
- resconf->options.recurse = 1;
-
- return resconf;
-error:
- *error_ = error;
-
- dns_resconf_close(resconf);
-
- return 0;
-} /* dns_resconf_root() */
-
-
-enum dns_resconf_keyword {
- DNS_RESCONF_NAMESERVER,
- DNS_RESCONF_DOMAIN,
- DNS_RESCONF_SEARCH,
- DNS_RESCONF_LOOKUP,
- DNS_RESCONF_FILE,
- DNS_RESCONF_BIND,
- DNS_RESCONF_CACHE,
- DNS_RESCONF_OPTIONS,
- DNS_RESCONF_EDNS0,
- DNS_RESCONF_NDOTS,
- DNS_RESCONF_TIMEOUT,
- DNS_RESCONF_ATTEMPTS,
- DNS_RESCONF_ROTATE,
- DNS_RESCONF_RECURSE,
- DNS_RESCONF_SMART,
- DNS_RESCONF_TCP,
- DNS_RESCONF_TCPx,
- DNS_RESCONF_INTERFACE,
- DNS_RESCONF_ZERO,
- DNS_RESCONF_ONE,
- DNS_RESCONF_ENABLE,
- DNS_RESCONF_ONLY,
- DNS_RESCONF_DISABLE,
-}; /* enum dns_resconf_keyword */
-
-static enum dns_resconf_keyword dns_resconf_keyword(const char *word) {
- static const char *words[] = {
- [DNS_RESCONF_NAMESERVER] = "nameserver",
- [DNS_RESCONF_DOMAIN] = "domain",
- [DNS_RESCONF_SEARCH] = "search",
- [DNS_RESCONF_LOOKUP] = "lookup",
- [DNS_RESCONF_FILE] = "file",
- [DNS_RESCONF_BIND] = "bind",
- [DNS_RESCONF_CACHE] = "cache",
- [DNS_RESCONF_OPTIONS] = "options",
- [DNS_RESCONF_EDNS0] = "edns0",
- [DNS_RESCONF_ROTATE] = "rotate",
- [DNS_RESCONF_RECURSE] = "recurse",
- [DNS_RESCONF_SMART] = "smart",
- [DNS_RESCONF_TCP] = "tcp",
- [DNS_RESCONF_INTERFACE] = "interface",
- [DNS_RESCONF_ZERO] = "0",
- [DNS_RESCONF_ONE] = "1",
- [DNS_RESCONF_ENABLE] = "enable",
- [DNS_RESCONF_ONLY] = "only",
- [DNS_RESCONF_DISABLE] = "disable",
- };
- unsigned i;
-
- for (i = 0; i < lengthof(words); i++) {
- if (words[i] && 0 == strcasecmp(words[i], word))
- return i;
- }
-
- if (0 == strncasecmp(word, "ndots:", sizeof "ndots:" - 1))
- return DNS_RESCONF_NDOTS;
-
- if (0 == strncasecmp(word, "timeout:", sizeof "timeout:" - 1))
- return DNS_RESCONF_TIMEOUT;
-
- if (0 == strncasecmp(word, "attempts:", sizeof "attempts:" - 1))
- return DNS_RESCONF_ATTEMPTS;
-
- if (0 == strncasecmp(word, "tcp:", sizeof "tcp:" - 1))
- return DNS_RESCONF_TCPx;
-
- return -1;
-} /* dns_resconf_keyword() */
-
-
-/** OpenBSD-style "[1.2.3.4]:53" nameserver syntax */
-static int dns_resconf_pton(struct sockaddr_storage *ss, const char *src) {
- struct { char buf[128], *p; } addr = { "", addr.buf };
- unsigned short port = 0;
- int ch, af = AF_INET;
-
- while ((ch = *src++)) {
- switch (ch) {
- case ' ':
- /* FALL THROUGH */
- case '\t':
- break;
- case '[':
- break;
- case ']':
- while ((ch = *src++)) {
- if (isdigit((unsigned char)ch)) {
- port *= 10;
- port += ch - '0';
- }
- }
-
- goto inet;
- case ':':
- af = AF_INET6;
-
- /* FALL THROUGH */
- default:
- if (addr.p < endof(addr.buf) - 1)
- *addr.p++ = ch;
-
- break;
- } /* switch() */
- } /* while() */
-inet:
-
- switch (dns_inet_pton(af, addr.buf, dns_sa_addr(af, ss))) {
- case -1:
- return errno;
- case 0:
- return EINVAL;
- } /* switch() */
-
- port = (!port)? 53 : port;
- *dns_sa_port(af, ss) = htons(port);
- dns_sa_family(ss) = af;
-
- return 0;
-} /* dns_resconf_pton() */
-
-#define dns_resconf_issep(ch) (isspace(ch) || (ch) == ',')
-#define dns_resconf_iscom(ch) ((ch) == '#' || (ch) == ';')
-
-int dns_resconf_loadfile(struct dns_resolv_conf *resconf, FILE *fp) {
- unsigned sa_count = 0;
- char words[6][DNS_D_MAXNAME + 1];
- unsigned wp, wc, i, j, n;
- int ch, error;
-
- rewind(fp);
-
- do {
- memset(words, '\0', sizeof words);
- wp = 0;
- wc = 0;
-
- while (EOF != (ch = getc(fp)) && ch != '\n') {
- if (dns_resconf_issep(ch)) {
- if (wp > 0) {
- wp = 0;
-
- if (++wc >= lengthof(words))
- goto skip;
- }
- } else if (dns_resconf_iscom(ch)) {
-skip:
- do {
- ch = getc(fp);
- } while (ch != EOF && ch != '\n');
-
- break;
- } else {
- dns__printchar(words[wc], sizeof words[wc], wp, ch);
- wp++;
- }
- }
-
- if (wp > 0)
- wc++;
-
- if (wc < 2)
- continue;
-
- switch (dns_resconf_keyword(words[0])) {
- case DNS_RESCONF_NAMESERVER:
- if (sa_count >= lengthof(resconf->nameserver))
- continue;
-
- if ((error = dns_resconf_pton(&resconf->nameserver[sa_count], words[1])))
- continue;
-
- sa_count++;
-
- break;
- case DNS_RESCONF_DOMAIN:
- case DNS_RESCONF_SEARCH:
- memset(resconf->search, '\0', sizeof resconf->search);
-
- for (i = 1, j = 0; i < wc && j < lengthof(resconf->search); i++, j++)
- dns_d_anchor(resconf->search[j], sizeof resconf->search[j], words[i], strlen(words[i]));
-
- break;
- case DNS_RESCONF_LOOKUP:
- for (i = 1, j = 0; i < wc && j < lengthof(resconf->lookup); i++) {
- switch (dns_resconf_keyword(words[i])) {
- case DNS_RESCONF_FILE:
- resconf->lookup[j++] = 'f';
-
- break;
- case DNS_RESCONF_BIND:
- resconf->lookup[j++] = 'b';
-
- break;
- case DNS_RESCONF_CACHE:
- resconf->lookup[j++] = 'c';
-
- break;
- default:
- break;
- } /* switch() */
- } /* for() */
-
- break;
- case DNS_RESCONF_OPTIONS:
- for (i = 1; i < wc; i++) {
- switch (dns_resconf_keyword(words[i])) {
- case DNS_RESCONF_EDNS0:
- resconf->options.edns0 = 1;
-
- break;
- case DNS_RESCONF_NDOTS:
- for (j = sizeof "ndots:" - 1, n = 0; isdigit((int)words[i][j]); j++) {
- n *= 10;
- n += words[i][j] - '0';
- } /* for() */
-
- resconf->options.ndots = n;
-
- break;
- case DNS_RESCONF_TIMEOUT:
- for (j = sizeof "timeout:" - 1, n = 0; isdigit((int)words[i][j]); j++) {
- n *= 10;
- n += words[i][j] - '0';
- } /* for() */
-
- resconf->options.timeout = n;
-
- break;
- case DNS_RESCONF_ATTEMPTS:
- for (j = sizeof "attempts:" - 1, n = 0; isdigit((int)words[i][j]); j++) {
- n *= 10;
- n += words[i][j] - '0';
- } /* for() */
-
- resconf->options.attempts = n;
-
- break;
- case DNS_RESCONF_ROTATE:
- resconf->options.rotate = 1;
-
- break;
- case DNS_RESCONF_RECURSE:
- resconf->options.recurse = 1;
-
- break;
- case DNS_RESCONF_SMART:
- resconf->options.smart = 1;
-
- break;
- case DNS_RESCONF_TCP:
- resconf->options.tcp = DNS_RESCONF_TCP_ONLY;
-
- break;
- case DNS_RESCONF_TCPx:
- switch (dns_resconf_keyword(&words[i][sizeof "tcp:" - 1])) {
- case DNS_RESCONF_ENABLE:
- resconf->options.tcp = DNS_RESCONF_TCP_ENABLE;
-
- break;
- case DNS_RESCONF_ONE:
- case DNS_RESCONF_ONLY:
- resconf->options.tcp = DNS_RESCONF_TCP_ONLY;
-
- break;
- case DNS_RESCONF_ZERO:
- case DNS_RESCONF_DISABLE:
- resconf->options.tcp = DNS_RESCONF_TCP_DISABLE;
-
- break;
- default:
- break;
- } /* switch() */
-
- break;
- default:
- break;
- } /* switch() */
- } /* for() */
-
- break;
- case DNS_RESCONF_INTERFACE:
- for (i = 0, n = 0; isdigit((int)words[2][i]); i++) {
- n *= 10;
- n += words[2][i] - '0';
- }
-
- dns_resconf_setiface(resconf, words[1], n);
-
- break;
- default:
- break;
- } /* switch() */
- } while (ch != EOF);
-
- return 0;
-} /* dns_resconf_loadfile() */
-
-
-int dns_resconf_loadpath(struct dns_resolv_conf *resconf, const char *path) {
- FILE *fp;
- int error;
-
- if (!(fp = fopen(path, "r")))
- return dns_syerr();
-
- error = dns_resconf_loadfile(resconf, fp);
-
- fclose(fp);
-
- return error;
-} /* dns_resconf_loadpath() */
-
-
-int dns_resconf_setiface(struct dns_resolv_conf *resconf, const char *addr, unsigned short port) {
- int af = (strchr(addr, ':'))? AF_INET6 : AF_INET;
-
- if (1 != dns_inet_pton(af, addr, dns_sa_addr(af, &resconf->iface)))
- return dns_soerr();
-
- *dns_sa_port(af, &resconf->iface) = htons(port);
- resconf->iface.ss_family = af;
-
- return 0;
-} /* dns_resconf_setiface() */
-
-
-size_t dns_resconf_search(void *dst, size_t lim, const void *qname, size_t qlen, struct dns_resolv_conf *resconf, dns_resconf_i_t *state) {
- unsigned srchi = 0xff & (*state >> 8);
- unsigned ndots = 0xff & (*state >> 16);
- unsigned slen, len = 0;
- const char *qp, *qe;
-
-// assert(0xff > lengthof(resconf->search));
-
- switch (0xff & *state) {
- case 0:
- qp = qname;
- qe = qp + qlen;
-
- while ((qp = memchr(qp, '.', qe - qp)))
- { ndots++; qp++; }
-
- ++*state;
-
- if (ndots >= resconf->options.ndots) {
- len = dns_d_anchor(dst, lim, qname, qlen);
-
- break;
- }
-
- /* FALL THROUGH */
- case 1:
- if (srchi < lengthof(resconf->search) && (slen = strlen(resconf->search[srchi]))) {
- len = dns__printstring(dst, lim, 0, qname, qlen);
- len = dns_d_anchor(dst, lim, dst, len);
- len += dns__printstring(dst, lim, len, resconf->search[srchi], slen);
-
- srchi++;
-
- break;
- }
-
- ++*state;
-
- /* FALL THROUGH */
- case 2:
- ++*state;
-
- if (ndots < resconf->options.ndots) {
- len = dns_d_anchor(dst, lim, qname, qlen);
-
- break;
- }
-
- /* FALL THROUGH */
- default:
- break;
- } /* switch() */
-
- dns__printnul(dst, lim, len);
-
- *state = ((0xff & *state) << 0)
- | ((0xff & srchi) << 8)
- | ((0xff & ndots) << 16);
-
- return len;
-} /* dns_resconf_search() */
-
-
-int dns_resconf_dump(struct dns_resolv_conf *resconf, FILE *fp) {
- unsigned i;
- int af;
-
- for (i = 0; i < lengthof(resconf->nameserver) && (af = resconf->nameserver[i].ss_family) != AF_UNSPEC; i++) {
- char addr[INET6_ADDRSTRLEN + 1] = "[INVALID]";
- unsigned short port;
-
- dns_inet_ntop(af, dns_sa_addr(af, &resconf->nameserver[i]), addr, sizeof addr);
- port = ntohs(*dns_sa_port(af, &resconf->nameserver[i]));
-
- if (port == 53)
- fprintf(fp, "nameserver %s\n", addr);
- else
- fprintf(fp, "nameserver [%s]:%hu\n", addr, port);
- }
-
-
- fprintf(fp, "search");
-
- for (i = 0; i < lengthof(resconf->search) && resconf->search[i][0]; i++)
- fprintf(fp, " %s", resconf->search[i]);
-
- fputc('\n', fp);
-
-
- fprintf(fp, "lookup");
-
- for (i = 0; i < lengthof(resconf->lookup) && resconf->lookup[i]; i++) {
- switch (resconf->lookup[i]) {
- case 'b':
- fprintf(fp, " bind"); break;
- case 'f':
- fprintf(fp, " file"); break;
- case 'c':
- fprintf(fp, " cache"); break;
- }
- }
-
- fputc('\n', fp);
-
-
- fprintf(fp, "options ndots:%u timeout:%u attempts:%u", resconf->options.ndots, resconf->options.timeout, resconf->options.attempts);
-
- if (resconf->options.edns0)
- fprintf(fp, " edns0");
- if (resconf->options.rotate)
- fprintf(fp, " rotate");
- if (resconf->options.recurse)
- fprintf(fp, " recurse");
- if (resconf->options.smart)
- fprintf(fp, " smart");
-
- fputc('\n', fp);
-
-
- if ((af = resconf->iface.ss_family) != AF_UNSPEC) {
- char addr[INET6_ADDRSTRLEN + 1] = "[INVALID]";
-
- dns_inet_ntop(af, dns_sa_addr(af, &resconf->iface), addr, sizeof addr);
-
- fprintf(fp, "interface %s %hu\n", addr, ntohs(*dns_sa_port(af, &resconf->iface)));
- }
-
- return 0;
-} /* dns_resconf_dump() */
-
-
-/*
- * H I N T S E R V E R R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_hints_soa {
- unsigned char zone[DNS_D_MAXNAME + 1];
-
- struct {
- struct sockaddr_storage ss;
- unsigned priority;
- } addrs[16];
-
- unsigned count;
-
- struct dns_hints_soa *next;
-}; /* struct dns_hints_soa */
-
-
-struct dns_hints {
- dns_atomic_t refcount;
-
- struct dns_hints_soa *head;
-}; /* struct dns_hints */
-
-
-struct dns_hints *dns_hints_open(struct dns_resolv_conf *resconf __UNUSED__, int *error) {
- static const struct dns_hints H_initializer;
- struct dns_hints *H;
-
- if (!(H = malloc(sizeof *H)))
- goto syerr;
-
- *H = H_initializer;
-
- dns_hints_acquire(H);
-
- return H;
-syerr:
- *error = dns_syerr();
-
- free(H);
-
- return 0;
-} /* dns_hints_open() */
-
-
-void dns_hints_close(struct dns_hints *H) {
- struct dns_hints_soa *soa, *nxt;
-
- if (!H || 1 != dns_hints_release(H))
- return /* void */;
-
- for (soa = H->head; soa; soa = nxt) {
- nxt = soa->next;
-
- free(soa);
- }
-
- free(H);
-
- return /* void */;
-} /* dns_hints_close() */
-
-
-unsigned dns_hints_acquire(struct dns_hints *H) {
- return dns_atomic_inc(&H->refcount);
-} /* dns_hints_acquire() */
-
-
-unsigned dns_hints_release(struct dns_hints *H) {
- return dns_atomic_dec(&H->refcount);
-} /* dns_hints_release() */
-
-
-struct dns_hints *dns_hints_mortal(struct dns_hints *hints) {
- if (hints)
- dns_hints_release(hints);
-
- return hints;
-} /* dns_hints_mortal() */
-
-
-struct dns_hints *dns_hints_local(struct dns_resolv_conf *resconf, int *error_) {
- struct dns_hints *hints = 0;
- int error;
-
- if (resconf)
- dns_resconf_acquire(resconf);
- else if (!(resconf = dns_resconf_local(&error)))
- goto error;
-
- if (!(hints = dns_hints_open(resconf, &error)))
- goto error;
-
- error = 0;
-
- if (0 == dns_hints_insert_resconf(hints, ".", resconf, &error) && error)
- goto error;
-
- dns_resconf_close(resconf);
-
- return hints;
-error:
- *error_ = error;
-
- dns_resconf_close(resconf);
- dns_hints_close(hints);
-
- return 0;
-} /* dns_hints_local() */
-
-
-struct dns_hints *dns_hints_root(struct dns_resolv_conf *resconf, int *error_) {
- static const struct {
- int af;
- char addr[INET6_ADDRSTRLEN];
- } root_hints[] = {
- { AF_INET, "198.41.0.4" }, /* A.ROOT-SERVERS.NET. */
- { AF_INET6, "2001:503:ba3e::2:30" }, /* A.ROOT-SERVERS.NET. */
- { AF_INET, "192.228.79.201" }, /* B.ROOT-SERVERS.NET. */
- { AF_INET, "192.33.4.12" }, /* C.ROOT-SERVERS.NET. */
- { AF_INET, "128.8.10.90" }, /* D.ROOT-SERVERS.NET. */
- { AF_INET, "192.203.230.10" }, /* E.ROOT-SERVERS.NET. */
- { AF_INET, "192.5.5.241" }, /* F.ROOT-SERVERS.NET. */
- { AF_INET6, "2001:500:2f::f" }, /* F.ROOT-SERVERS.NET. */
- { AF_INET, "192.112.36.4" }, /* G.ROOT-SERVERS.NET. */
- { AF_INET, "128.63.2.53" }, /* H.ROOT-SERVERS.NET. */
- { AF_INET6, "2001:500:1::803f:235" }, /* H.ROOT-SERVERS.NET. */
- { AF_INET, "192.36.148.17" }, /* I.ROOT-SERVERS.NET. */
- { AF_INET, "192.58.128.30" }, /* J.ROOT-SERVERS.NET. */
- { AF_INET6, "2001:503:c27::2:30" }, /* J.ROOT-SERVERS.NET. */
- };
- struct dns_hints *hints = 0;
- struct sockaddr_storage ss;
- unsigned i;
- int error, af;
-
- if (!(hints = dns_hints_open(resconf, &error)))
- goto error;
-
- for (i = 0; i < lengthof(root_hints); i++) {
- af = root_hints[i].af;
-
- if (1 != dns_inet_pton(af, root_hints[i].addr, dns_sa_addr(af, &ss)))
- goto soerr;
-
- *dns_sa_port(af, &ss) = htons(53);
- ss.ss_family = af;
-
- if ((error = dns_hints_insert(hints, ".", (struct sockaddr *)&ss, 1)))
- goto error;
- }
-
- return hints;
-soerr:
- error = dns_soerr();
-
- goto error;
-error:
- *error_ = error;
-
- dns_hints_close(hints);
-
- return 0;
-} /* dns_hints_root() */
-
-
-static struct dns_hints_soa *dns_hints_fetch(struct dns_hints *H, const char *zone) {
- struct dns_hints_soa *soa;
-
- for (soa = H->head; soa; soa = soa->next) {
- if (0 == strcasecmp(zone, (char *)soa->zone))
- return soa;
- }
-
- return 0;
-} /* dns_hints_fetch() */
-
-
-int dns_hints_insert(struct dns_hints *H, const char *zone, const struct sockaddr *sa, unsigned priority) {
- static const struct dns_hints_soa soa_initializer;
- struct dns_hints_soa *soa;
- unsigned i;
-
- if (!(soa = dns_hints_fetch(H, zone))) {
- if (!(soa = malloc(sizeof *soa)))
- return dns_syerr();
-
- *soa = soa_initializer;
-
- dns__printstring(soa->zone, sizeof soa->zone, 0, zone);
-
- soa->next = H->head;
- H->head = soa;
- }
-
- i = soa->count % lengthof(soa->addrs);
-
- memcpy(&soa->addrs[i].ss, sa, dns_sa_len(sa));
-
- soa->addrs[i].priority = MAX(1, priority);
-
- if (soa->count < lengthof(soa->addrs))
- soa->count++;
-
- return 0;
-} /* dns_hints_insert() */
-
-
-unsigned dns_hints_insert_resconf(struct dns_hints *H, const char *zone, const struct dns_resolv_conf *resconf, int *error_) {
- unsigned i, n, p;
- int error;
-
- for (i = 0, n = 0, p = 1; i < lengthof(resconf->nameserver) && resconf->nameserver[i].ss_family != AF_UNSPEC; i++, n++) {
- if ((error = dns_hints_insert(H, zone, (struct sockaddr *)&resconf->nameserver[i], p)))
- goto error;
-
- p += !resconf->options.rotate;
- }
-
- return n;
-error:
- *error_ = error;
-
- return n;
-} /* dns_hints_insert_resconf() */
-
-
-static int dns_hints_i_cmp(unsigned a, unsigned b, struct dns_hints_i *i, struct dns_hints_soa *soa) {
- int cmp;
-
- if ((cmp = soa->addrs[a].priority - soa->addrs[b].priority))
- return cmp;
-
- return dns_k_shuffle16(a, i->state.seed) - dns_k_shuffle16(b, i->state.seed);
-} /* dns_hints_i_cmp() */
-
-
-static unsigned dns_hints_i_start(struct dns_hints_i *i, struct dns_hints_soa *soa) {
- unsigned p0, p;
-
- p0 = 0;
-
- for (p = 1; p < soa->count; p++) {
- if (dns_hints_i_cmp(p, p0, i, soa) < 0)
- p0 = p;
- }
-
- return p0;
-} /* dns_hints_i_start() */
-
-
-static unsigned dns_hints_i_skip(unsigned p0, struct dns_hints_i *i, struct dns_hints_soa *soa) {
- unsigned pZ, p;
-
- for (pZ = 0; pZ < soa->count; pZ++) {
- if (dns_hints_i_cmp(pZ, p0, i, soa) > 0)
- goto cont;
- }
-
- return soa->count;
-cont:
- for (p = pZ + 1; p < soa->count; p++) {
- if (dns_hints_i_cmp(p, p0, i, soa) <= 0)
- continue;
-
- if (dns_hints_i_cmp(p, pZ, i, soa) >= 0)
- continue;
-
- pZ = p;
- }
-
-
- return pZ;
-} /* dns_hints_i_skip() */
-
-
-struct dns_hints_i *dns_hints_i_init(struct dns_hints_i *i, struct dns_hints *hints) {
- static const struct dns_hints_i i_initializer;
- struct dns_hints_soa *soa;
-
- i->state = i_initializer.state;
-
- do {
- i->state.seed = dns_random();
- } while (0 == i->state.seed);
-
- if ((soa = dns_hints_fetch(hints, i->zone))) {
- i->state.next = dns_hints_i_start(i, soa);
- }
-
- return i;
-} /* dns_hints_i_init() */
-
-
-unsigned dns_hints_grep(struct sockaddr **sa, socklen_t *sa_len, unsigned lim, struct dns_hints_i *i, struct dns_hints *H) {
- struct dns_hints_soa *soa;
- unsigned n;
-
- if (!(soa = dns_hints_fetch(H, i->zone)))
- return 0;
-
- n = 0;
-
- while (i->state.next < soa->count && n < lim) {
- *sa = (struct sockaddr *)&soa->addrs[i->state.next].ss;
- *sa_len = dns_sa_len(*sa);
-
- sa++;
- sa_len++;
- n++;
-
- i->state.next = dns_hints_i_skip(i->state.next, i, soa);
- }
-
- return n;
-} /* dns_hints_grep() */
-
-
-struct dns_packet *dns_hints_query(struct dns_hints *hints, struct dns_packet *Q, int *error_) {
- struct dns_packet *A, *P;
- struct dns_rr rr;
- char zone[DNS_D_MAXNAME + 1];
- size_t zlen;
- struct dns_hints_i i;
- struct sockaddr *sa;
- socklen_t slen;
- int error;
-
- if (!dns_rr_grep(&rr, 1, dns_rr_i_new(Q, .section = DNS_S_QUESTION), Q, &error))
- goto error;
-
- if (!(zlen = dns_d_expand(zone, sizeof zone, rr.dn.p, Q, &error)))
- goto error;
- else if (zlen >= sizeof zone)
- goto toolong;
-
- P = dns_p_new(512);
- dns_header(P)->qr = 1;
-
- if ((error = dns_rr_copy(P, &rr, Q)))
- goto error;
-
- if ((error = dns_p_push(P, DNS_S_AUTHORITY, ".", strlen("."), DNS_T_NS, DNS_C_IN, 0, "hints.local.")))
- goto error;
-
- do {
- i.zone = zone;
-
- dns_hints_i_init(&i, hints);
-
- while (dns_hints_grep(&sa, &slen, 1, &i, hints)) {
- int af = sa->sa_family;
- int rtype = (af == AF_INET6)? DNS_T_AAAA : DNS_T_A;
-
- if ((error = dns_p_push(P, DNS_S_ADDITIONAL, "hints.local.", strlen("hints.local."), rtype, DNS_C_IN, 0, dns_sa_addr(af, sa))))
- goto error;
- }
- } while ((zlen = dns_d_cleave(zone, sizeof zone, zone, zlen)));
-
- if (!(A = dns_p_copy(dns_p_make(P->end, &error), P)))
- goto error;
-
- return A;
-toolong:
- error = DNS_EILLEGAL;
-error:
- *error_ = error;
-
- return 0;
-} /* dns_hints_query() */
-
-
-/** ugly hack to support specifying ports other than 53 in resolv.conf. */
-static unsigned short dns_hints_port(struct dns_hints *hints, int af, void *addr) {
- struct dns_hints_soa *soa;
- unsigned short port;
- unsigned i;
-
- for (soa = hints->head; soa; soa = soa->next) {
- for (i = 0; i < soa->count; i++) {
- if (af != soa->addrs[i].ss.ss_family)
- continue;
-
- if (memcmp(addr, dns_sa_addr(af, &soa->addrs[i].ss), (af == AF_INET6)? sizeof (struct in6_addr) : sizeof (struct in_addr)))
- continue;
-
- port = *dns_sa_port(af, &soa->addrs[i].ss);
-
- return (port)? port : htons(53);
- }
- }
-
- return htons(53);
-} /* dns_hints_port() */
-
-
-int dns_hints_dump(struct dns_hints *hints, FILE *fp) {
- struct dns_hints_soa *soa;
- char addr[INET6_ADDRSTRLEN];
- unsigned i;
- int af;
-
- for (soa = hints->head; soa; soa = soa->next) {
- fprintf(fp, "ZONE \"%s\"\n", soa->zone);
-
- for (i = 0; i < soa->count; i++) {
- af = soa->addrs[i].ss.ss_family;
- if (!dns_inet_ntop(af, dns_sa_addr(af, &soa->addrs[i].ss), addr, sizeof addr))
- return dns_soerr();
-
- fprintf(fp, "\t(%d) [%s]:%hu\n", (int)soa->addrs[i].priority, addr, ntohs(*dns_sa_port(af, &soa->addrs[i].ss)));
- }
- }
-
- return 0;
-} /* dns_hints_dump() */
-
-
-/*
- * C A C H E R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static dns_atomic_t dns_cache_acquire(struct dns_cache *cache __UNUSED__) {
- return 0;
-} /* dns_cache_acquire() */
-
-
-static dns_atomic_t dns_cache_release(struct dns_cache *cache __UNUSED__) {
- return 0;
-} /* dns_cache_release() */
-
-
-static struct dns_packet *dns_cache_query(struct dns_packet *query __UNUSED__, struct dns_cache *cache __UNUSED__, int *error __UNUSED__) {
- return 0;
-} /* dns_cache_submit() */
-
-
-static int dns_cache_submit(struct dns_packet *query __UNUSED__, struct dns_cache *cache __UNUSED__) {
- return 0;
-} /* dns_cache_submit() */
-
-
-static int dns_cache_check(struct dns_cache *cache __UNUSED__) {
- return 0;
-} /* dns_cache_check() */
-
-
-static struct dns_packet *dns_cache_fetch(struct dns_cache *cache __UNUSED__, int *error __UNUSED__) {
- return 0;
-} /* dns_cache_fetch() */
-
-
-static int dns_cache_pollfd(struct dns_cache *cache __UNUSED__) {
- return -1;
-} /* dns_cache_pollfd() */
-
-
-static short dns_cache_events(struct dns_cache *cache __UNUSED__) {
- return 0;
-} /* dns_cache_events() */
-
-
-static void dns_cache_clear(struct dns_cache *cache __UNUSED__) {
- return;
-} /* dns_cache_clear() */
-
-
-struct dns_cache *dns_cache_init(struct dns_cache *cache) {
- static const struct dns_cache c_init = {
- .acquire = &dns_cache_acquire,
- .release = &dns_cache_release,
- .query = &dns_cache_query,
- .submit = &dns_cache_submit,
- .check = &dns_cache_check,
- .fetch = &dns_cache_fetch,
- .pollfd = &dns_cache_pollfd,
- .events = &dns_cache_events,
- .clear = &dns_cache_clear,
- };
-
- *cache = c_init;
-
- return cache;
-} /* dns_cache_init() */
-
-
-void dns_cache_close(struct dns_cache *cache) {
- if (cache)
- cache->release(cache);
-} /* dns_cache_close() */
-
-
-/*
- * S O C K E T R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static void dns_socketclose(int *fd) {
- if (*fd != -1) {
-#if _WIN32
- closesocket(*fd);
-#else
- close(*fd);
-#endif
- *fd = -1;
- }
-} /* dns_socketclose() */
-
-
-#define DNS_SO_MAXTRY 7
-
-static int dns_socket(struct sockaddr *local, int type, int *error_) {
- int error, fd = -1;
-#if defined(O_NONBLOCK)
- int flags;
-#elif defined(FIONBIO)
- unsigned long opt;
-#endif
-
- if (-1 == (fd = socket(local->sa_family, type, 0)))
- goto soerr;
-
-#if defined(F_SETFD)
- if (-1 == fcntl(fd, F_SETFD, 1))
- goto syerr;
-#endif
-
-#if defined(O_NONBLOCK)
- if (-1 == (flags = fcntl(fd, F_GETFL)))
- goto syerr;
-
- if (-1 == fcntl(fd, F_SETFL, flags | O_NONBLOCK))
- goto syerr;
-#elif defined(FIONBIO)
- opt = 1;
-
- if (0 != ioctlsocket(fd, FIONBIO, &opt))
- goto soerr;
-#endif
-
- if (local->sa_family != AF_INET && local->sa_family != AF_INET6)
- return fd;
-
- if (type != SOCK_DGRAM)
- return fd;
-
- if (*dns_sa_port(local->sa_family, local) == 0) {
- struct sockaddr_storage tmp;
- unsigned i, port;
-
- memcpy(&tmp, local, dns_sa_len(local));
-
- for (i = 0; i < DNS_SO_MAXTRY; i++) {
- port = 1025 + (dns_random() % 64510);
-
- *dns_sa_port(tmp.ss_family, &tmp) = htons(port);
-
- if (0 == bind(fd, (struct sockaddr *)&tmp, dns_sa_len(&tmp)))
- return fd;
- }
- }
-
- if (0 == bind(fd, local, dns_sa_len(local)))
- return fd;
-
- /* FALL THROUGH */
-soerr:
- error = dns_soerr();
-
- goto error;
-syerr:
- error = dns_syerr();
-
- goto error;
-error:
- *error_ = error;
-
- dns_socketclose(&fd);
-
- return -1;
-} /* dns_socket() */
-
-
-enum {
- DNS_SO_UDP_INIT = 1,
- DNS_SO_UDP_CONN,
- DNS_SO_UDP_SEND,
- DNS_SO_UDP_RECV,
- DNS_SO_UDP_DONE,
-
- DNS_SO_TCP_INIT,
- DNS_SO_TCP_CONN,
- DNS_SO_TCP_SEND,
- DNS_SO_TCP_RECV,
- DNS_SO_TCP_DONE,
-};
-
-struct dns_socket {
- struct dns_options opts;
-
- int udp;
- int tcp;
-
- int *old;
- unsigned onum, olim;
-
- int type;
-
- struct sockaddr_storage local, remote;
-
- struct dns_k_permutor qids;
-
- struct dns_stat stat;
-
- /*
- * NOTE: dns_so_reset() zeroes everything from here down.
- */
- int state;
-
- unsigned short qid;
- char qname[DNS_D_MAXNAME + 1];
- size_t qlen;
- enum dns_type qtype;
- enum dns_class qclass;
-
- struct dns_packet *query;
- size_t qout;
-
- time_t began;
-
- struct dns_packet *answer;
- size_t alen, apos;
-}; /* struct dns_socket() */
-
-
-/*
- * NOTE: Actual closure delayed so that kqueue(2) and epoll(2) callers have
- * a chance to recognize a state change after installing a persistent event
- * and where sequential descriptors with the same integer value returned
- * from _pollfd() would be ambiguous. See dns_so_closefds().
- */
-static int dns_so_closefd(struct dns_socket *so, int *fd) {
- int error;
-
- if (*fd == -1)
- return 0;
-
- if (so->opts.closefd.cb) {
- if ((error = so->opts.closefd.cb(fd, so->opts.closefd.arg))) {
- return error;
- } else if (*fd == -1)
- return 0;
- }
-
- if (!(so->onum < so->olim)) {
- unsigned olim = MAX(4, so->olim * 2);
- void *old;
-
- if (!(old = realloc(so->old, sizeof so->old[0] * olim)))
- return dns_syerr();
-
- so->old = old;
- so->olim = olim;
- }
-
- so->old[so->onum++] = *fd;
- *fd = -1;
-
- return 0;
-} /* dns_so_closefd() */
-
-
-#define DNS_SO_CLOSE_UDP 0x01
-#define DNS_SO_CLOSE_TCP 0x02
-#define DNS_SO_CLOSE_OLD 0x04
-#define DNS_SO_CLOSE_ALL (DNS_SO_CLOSE_UDP|DNS_SO_CLOSE_TCP|DNS_SO_CLOSE_OLD)
-
-static void dns_so_closefds(struct dns_socket *so, int which) {
- if (DNS_SO_CLOSE_UDP & which)
- dns_socketclose(&so->udp);
- if (DNS_SO_CLOSE_TCP & which)
- dns_socketclose(&so->tcp);
- if (DNS_SO_CLOSE_OLD & which) {
- unsigned i;
- for (i = 0; i < so->onum; i++)
- dns_socketclose(&so->old[i]);
- so->onum = 0;
- free(so->old);
- so->old = 0;
- so->olim = 0;
- }
-} /* dns_so_closefds() */
-
-
-static void dns_so_destroy(struct dns_socket *);
-
-static struct dns_socket *dns_so_init(struct dns_socket *so, const struct sockaddr *local, int type, const struct dns_options *opts, int *error) {
- static const struct dns_socket so_initializer = { .opts = DNS_OPTS_INITIALIZER, .udp = -1, .tcp = -1, };
-
- *so = so_initializer;
- so->type = type;
-
- if (opts)
- so->opts = *opts;
-
- if (local)
- memcpy(&so->local, local, dns_sa_len(local));
-
- if (-1 == (so->udp = dns_socket((struct sockaddr *)&so->local, SOCK_DGRAM, error)))
- goto error;
-
- dns_k_permutor_init(&so->qids, 1, 65535);
-
- return so;
-error:
- dns_so_destroy(so);
-
- return 0;
-} /* dns_so_init() */
-
-
-struct dns_socket *dns_so_open(const struct sockaddr *local, int type, const struct dns_options *opts, int *error) {
- struct dns_socket *so;
-
- if (!(so = malloc(sizeof *so)))
- goto syerr;
-
- if (!dns_so_init(so, local, type, opts, error))
- goto error;
-
- return so;
-syerr:
- *error = dns_syerr();
-error:
- dns_so_close(so);
-
- return 0;
-} /* dns_so_open() */
-
-
-static void dns_so_destroy(struct dns_socket *so) {
- dns_so_reset(so);
- dns_so_closefds(so, DNS_SO_CLOSE_ALL);
-} /* dns_so_destroy() */
-
-
-void dns_so_close(struct dns_socket *so) {
- if (!so)
- return;
-
- dns_so_destroy(so);
-
- free(so);
-} /* dns_so_close() */
-
-
-void dns_so_reset(struct dns_socket *so) {
- free(so->answer);
-
- memset(&so->state, '\0', sizeof *so - offsetof(struct dns_socket, state));
-} /* dns_so_reset() */
-
-
-unsigned short dns_so_mkqid(struct dns_socket *so) {
- return dns_k_permutor_step(&so->qids);
-} /* dns_so_mkqid() */
-
-
-#define DNS_SO_MINBUF 768
-
-static int dns_so_newanswer(struct dns_socket *so, size_t len) {
- size_t size = offsetof(struct dns_packet, data) + MAX(len, DNS_SO_MINBUF);
- void *p;
-
- if (!(p = realloc(so->answer, size)))
- return dns_syerr();
-
- so->answer = dns_p_init(p, size);
-
- return 0;
-} /* dns_so_newanswer() */
-
-
-int dns_so_submit(struct dns_socket *so, struct dns_packet *Q, struct sockaddr *host) {
- struct dns_rr rr;
- int error = -1;
-
- dns_so_reset(so);
-
- if ((error = dns_rr_parse(&rr, 12, Q)))
- goto error;
-
- if (!(so->qlen = dns_d_expand(so->qname, sizeof so->qname, rr.dn.p, Q, &error)))
- goto error;
- /*
- * NOTE: don't bail if expansion is too long; caller may be
- * intentionally sending long names. However, we won't be able to
- * verify it on return.
- */
-
- so->qtype = rr.type;
- so->qclass = rr.class;
-
- if ((error = dns_so_newanswer(so, DNS_SO_MINBUF)))
- goto syerr;
-
- memcpy(&so->remote, host, dns_sa_len(host));
-
- so->query = Q;
- so->qout = 0;
- so->began = dns_now();
-
- if (dns_header(so->query)->qid == 0)
- dns_header(so->query)->qid = dns_so_mkqid(so);
-
- so->qid = dns_header(so->query)->qid;
- so->state = (so->type == SOCK_STREAM)? DNS_SO_TCP_INIT : DNS_SO_UDP_INIT;
-
- so->stat.queries++;
-
- return 0;
-syerr:
- error = dns_syerr();
-error:
- dns_so_reset(so);
-
- return error;
-} /* dns_so_submit() */
-
-
-static int dns_so_verify(struct dns_socket *so, struct dns_packet *P) {
- char qname[DNS_D_MAXNAME + 1];
- size_t qlen;
- struct dns_rr rr;
- int error = -1;
-
- if (so->qid != dns_header(so->answer)->qid)
- return DNS_EUNKNOWN;
-
- if (!dns_p_count(so->answer, DNS_S_QD))
- return DNS_EUNKNOWN;
-
- if (0 != dns_rr_parse(&rr, 12, so->answer))
- return DNS_EUNKNOWN;
-
- if (rr.type != so->qtype || rr.class != so->qclass)
- return DNS_EUNKNOWN;
-
- if (!(qlen = dns_d_expand(qname, sizeof qname, rr.dn.p, P, &error)))
- return error;
- else if (qlen >= sizeof qname || qlen != so->qlen)
- return DNS_EUNKNOWN;
-
- if (0 != strcasecmp(so->qname, qname))
- return DNS_EUNKNOWN;
-
- return 0;
-} /* dns_so_verify() */
-
-
-static int dns_so_tcp_send(struct dns_socket *so) {
- unsigned char *qsrc;
- size_t qend;
- long n;
-
- so->query->data[-2] = 0xff & (so->query->end >> 8);
- so->query->data[-1] = 0xff & (so->query->end >> 0);
-
- qsrc = &so->query->data[-2] + so->qout;
- qend = so->query->end + 2;
-
- while (so->qout < qend) {
- if (0 > (n = send(so->tcp, (void *)&qsrc[so->qout], qend - so->qout, 0)))
- return dns_soerr();
-
- so->qout += n;
- so->stat.tcp.sent.bytes += n;
- }
-
- so->stat.tcp.sent.count++;
-
- return 0;
-} /* dns_so_tcp_send() */
-
-
-static int dns_so_tcp_recv(struct dns_socket *so) {
- unsigned char *asrc;
- size_t aend, alen;
- int error;
- long n;
-
- aend = so->alen + 2;
-
- while (so->apos < aend) {
- asrc = &so->answer->data[-2];
-
- if (0 > (n = recv(so->tcp, (void *)&asrc[so->apos], aend - so->apos, 0)))
- return dns_soerr();
- else if (n == 0)
- return DNS_EUNKNOWN; /* FIXME */
-
- so->apos += n;
- so->stat.tcp.rcvd.bytes += n;
-
- if (so->alen == 0 && so->apos >= 2) {
- alen = ((0xff & so->answer->data[-2]) << 8)
- | ((0xff & so->answer->data[-1]) << 0);
-
- if ((error = dns_so_newanswer(so, alen)))
- return error;
-
- so->alen = alen;
- aend = alen + 2;
- }
- }
-
- so->answer->end = so->alen;
- so->stat.tcp.rcvd.count++;
-
- return 0;
-} /* dns_so_tcp_recv() */
-
-
-int dns_so_check(struct dns_socket *so) {
- int error;
- long n;
-
-retry:
- switch (so->state) {
- case DNS_SO_UDP_INIT:
- so->state++;
- case DNS_SO_UDP_CONN:
- if (0 != connect(so->udp, (struct sockaddr *)&so->remote, dns_sa_len(&so->remote)))
- goto soerr;
-
- so->state++;
- case DNS_SO_UDP_SEND:
- if (0 > (n = send(so->udp, (void *)so->query->data, so->query->end, 0)))
- goto soerr;
-
- so->stat.udp.sent.bytes += n;
- so->stat.udp.sent.count++;
-
- so->state++;
- case DNS_SO_UDP_RECV:
- if (0 > (n = recv(so->udp, (void *)so->answer->data, so->answer->size, 0)))
- goto soerr;
-
- so->stat.udp.rcvd.bytes += n;
- so->stat.udp.rcvd.count++;
-
- if ((so->answer->end = n) < 12)
- goto trash;
-
- if ((error = dns_so_verify(so, so->answer)))
- goto trash;
-
- so->state++;
- case DNS_SO_UDP_DONE:
- if (!dns_header(so->answer)->tc || so->type == SOCK_DGRAM)
- return 0;
-
- so->state++;
- case DNS_SO_TCP_INIT:
- if ((error = dns_so_closefd(so, &so->tcp)))
- goto error;
-
- if (-1 == (so->tcp = dns_socket((struct sockaddr *)&so->local, SOCK_STREAM, &error)))
- goto error;
-
- so->state++;
- case DNS_SO_TCP_CONN:
- if (0 != connect(so->tcp, (struct sockaddr *)&so->remote, dns_sa_len(&so->remote))) {
- if (dns_soerr() != DNS_EISCONN)
- goto soerr;
- }
-
- so->state++;
- case DNS_SO_TCP_SEND:
- if ((error = dns_so_tcp_send(so)))
- goto error;
-
- so->state++;
- case DNS_SO_TCP_RECV:
- if ((error = dns_so_tcp_recv(so)))
- goto error;
-
- so->state++;
- case DNS_SO_TCP_DONE:
- if ((error = dns_so_closefd(so, &so->tcp)))
- goto error;
-
- if (so->answer->end < 12)
- return DNS_EILLEGAL;
-
- if ((error = dns_so_verify(so, so->answer)))
- goto error;
-
- return 0;
- default:
- error = DNS_EUNKNOWN;
-
- goto error;
- } /* switch() */
-
-trash:
- goto retry;
-soerr:
- error = dns_soerr();
-
- goto error;
-error:
- switch (error) {
- case DNS_EINTR:
- goto retry;
- case DNS_EINPROGRESS:
- /* FALL THROUGH */
- case DNS_EALREADY:
- /* FALL THROUGH */
-#if DNS_EWOULDBLOCK != DNS_EAGAIN
- case DNS_EWOULDBLOCK:
- /* FALL THROUGH */
-#endif
- error = DNS_EAGAIN;
-
- break;
- } /* switch() */
-
- return error;
-} /* dns_so_check() */
-
-
-struct dns_packet *dns_so_fetch(struct dns_socket *so, int *error) {
- struct dns_packet *answer;
-
- switch (so->state) {
- case DNS_SO_UDP_DONE:
- case DNS_SO_TCP_DONE:
- answer = so->answer;
- so->answer = 0;
-
- return answer;
- default:
- *error = DNS_EUNKNOWN;
-
- return 0;
- }
-} /* dns_so_fetch() */
-
-
-struct dns_packet *dns_so_query(struct dns_socket *so, struct dns_packet *Q, struct sockaddr *host, int *error_) {
- struct dns_packet *A;
- int error;
-
- if (!so->state) {
- if ((error = dns_so_submit(so, Q, host)))
- goto error;
- }
-
- if ((error = dns_so_check(so)))
- goto error;
-
- if (!(A = dns_so_fetch(so, &error)))
- goto error;
-
- dns_so_reset(so);
-
- return A;
-error:
- *error_ = error;
-
- return 0;
-} /* dns_so_query() */
-
-
-time_t dns_so_elapsed(struct dns_socket *so) {
- return dns_elapsed(so->began);
-} /* dns_so_elapsed() */
-
-
-void dns_so_clear(struct dns_socket *so) {
- dns_so_closefds(so, DNS_SO_CLOSE_OLD);
-} /* dns_so_clear() */
-
-
-static int dns_so_events2(struct dns_socket *so, enum dns_events type) {
- int events = 0;
-
- switch (so->state) {
- case DNS_SO_UDP_CONN:
- case DNS_SO_UDP_SEND:
- events |= DNS_POLLOUT;
-
- break;
- case DNS_SO_UDP_RECV:
- events |= DNS_POLLIN;
-
- break;
- case DNS_SO_TCP_CONN:
- case DNS_SO_TCP_SEND:
- events |= DNS_POLLOUT;
-
- break;
- case DNS_SO_TCP_RECV:
- events |= DNS_POLLIN;
-
- break;
- } /* switch() */
-
- switch (type) {
- case DNS_LIBEVENT:
- return DNS_POLL2EV(events);
- default:
- return events;
- } /* switch() */
-} /* dns_so_events2() */
-
-
-int dns_so_events(struct dns_socket *so) {
- return dns_so_events2(so, so->opts.events);
-} /* dns_so_events() */
-
-
-int dns_so_pollfd(struct dns_socket *so) {
- switch (so->state) {
- case DNS_SO_UDP_CONN:
- case DNS_SO_UDP_SEND:
- case DNS_SO_UDP_RECV:
- return so->udp;
- case DNS_SO_TCP_CONN:
- case DNS_SO_TCP_SEND:
- case DNS_SO_TCP_RECV:
- return so->tcp;
- } /* switch() */
-
- return -1;
-} /* dns_so_pollfd() */
-
-
-int dns_so_poll(struct dns_socket *so, int timeout) {
- return dns_poll(dns_so_pollfd(so), dns_so_events2(so, DNS_SYSPOLL), timeout);
-} /* dns_so_poll() */
-
-
-const struct dns_stat *dns_so_stat(struct dns_socket *so) {
- return &so->stat;
-} /* dns_so_stat() */
-
-
-/*
- * R E S O L V E R R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-enum dns_res_state {
- DNS_R_INIT,
- DNS_R_GLUE,
- DNS_R_SWITCH, /* (B)IND, (F)ILE, (C)ACHE */
-
- DNS_R_FILE, /* Lookup in local hosts database */
-
- DNS_R_CACHE, /* Lookup in application cache */
- DNS_R_SUBMIT,
- DNS_R_CHECK,
- DNS_R_FETCH,
-
- DNS_R_BIND, /* Lookup in the network */
- DNS_R_SEARCH,
- DNS_R_HINTS,
- DNS_R_ITERATE,
- DNS_R_FOREACH_NS,
- DNS_R_RESOLV0_NS, /* Prologue: Setup next frame and recurse */
- DNS_R_RESOLV1_NS, /* Epilog: Inspect answer */
- DNS_R_FOREACH_A,
- DNS_R_QUERY_A,
- DNS_R_CNAME0_A,
- DNS_R_CNAME1_A,
-
- DNS_R_FINISH,
- DNS_R_SMART0_A,
- DNS_R_SMART1_A,
- DNS_R_DONE,
- DNS_R_SERVFAIL,
-}; /* enum dns_res_state */
-
-
-#define DNS_R_MAXDEPTH 8
-#define DNS_R_ENDFRAME (DNS_R_MAXDEPTH - 1)
-
-struct dns_resolver {
- struct dns_socket so;
-
- struct dns_resolv_conf *resconf;
- struct dns_hosts *hosts;
- struct dns_hints *hints;
- struct dns_cache *cache;
-
- dns_atomic_t refcount;
-
- /* Reset zeroes everything below here. */
-
- char qname[DNS_D_MAXNAME + 1];
- size_t qlen;
-
- enum dns_type qtype;
- enum dns_class qclass;
-
- time_t began;
-
- dns_resconf_i_t search;
-
- struct dns_rr_i smart;
-
- struct dns_res_frame {
- enum dns_res_state state;
-
- int error;
- int which; /* (B)IND, (F)ILE; index into resconf->lookup */
-
- unsigned attempts;
-
- struct dns_packet *query, *answer, *hints;
-
- struct dns_rr_i hints_i, hints_j;
- struct dns_rr hints_ns, ans_cname;
- } stack[DNS_R_MAXDEPTH];
-
- unsigned sp;
-}; /* struct dns_resolver */
-
-
-static int dns_res_tcp2type(int tcp) {
- switch (tcp) {
- case DNS_RESCONF_TCP_ONLY:
- return SOCK_STREAM;
- case DNS_RESCONF_TCP_DISABLE:
- return SOCK_DGRAM;
- default:
- return 0;
- }
-} /* dns_res_tcp2type() */
-
-struct dns_resolver *dns_res_open(struct dns_resolv_conf *resconf, struct dns_hosts *hosts, struct dns_hints *hints, struct dns_cache *cache, const struct dns_options *opts, int *error_) {
- static const struct dns_resolver R_initializer
- = { .refcount = 1, };
- struct dns_resolver *R = 0;
- int type, error;
-
- /*
- * Grab ref count early because the caller may have passed us a mortal
- * reference, and we want to do the right thing if we return early
- * from an error.
- */
- if (resconf)
- dns_resconf_acquire(resconf);
- if (hosts)
- dns_hosts_acquire(hosts);
- if (hints)
- dns_hints_acquire(hints);
- if (cache)
- dns_cache_acquire(cache);
-
- /*
- * Don't try to load it ourselves because a NULL object might be an
- * error from, say, dns_resconf_root(), and loading
- * dns_resconf_local() by default would create undesirable surpises.
- */
- if (!resconf || !hosts || !hints)
- goto error;
-
- if (!(R = malloc(sizeof *R)))
- goto syerr;
-
- *R = R_initializer;
- type = dns_res_tcp2type(resconf->options.tcp);
-
- if (!dns_so_init(&R->so, (struct sockaddr *)&resconf->iface, type, opts, &error))
- goto error;
-
- R->resconf = resconf;
- R->hosts = hosts;
- R->hints = hints;
- R->cache = cache;
-
- return R;
-syerr:
- error = dns_syerr();
-error:
- *error_ = error;
-
- dns_res_close(R);
-
- dns_resconf_close(resconf);
- dns_hosts_close(hosts);
- dns_hints_close(hints);
- dns_cache_close(cache);
-
- return 0;
-} /* dns_res_open() */
-
-
-struct dns_resolver *dns_res_stub(const struct dns_options *opts, int *error) {
- struct dns_resolv_conf *resconf = 0;
- struct dns_hosts *hosts = 0;
- struct dns_hints *hints = 0;
- struct dns_resolver *res = 0;
-
- if (!(resconf = dns_resconf_local(error)))
- goto epilog;
-
- if (!(hosts = dns_hosts_local(error)))
- goto epilog;
-
- if (!(hints = dns_hints_local(resconf, error)))
- goto epilog;
-
- if (!(res = dns_res_open(resconf, hosts, hints, NULL, opts, error)))
- goto epilog;
-
-epilog:
- dns_resconf_close(resconf);
- dns_hosts_close(hosts);
- dns_hints_close(hints);
-
- return res;
-} /* dns_res_stub() */
-
-
-static void dns_res_reset_frame(struct dns_resolver *R __UNUSED__, struct dns_res_frame *frame) {
- free(frame->query);
- free(frame->answer);
- free(frame->hints);
-
- memset(frame, '\0', sizeof *frame);
-} /* dns_res_reset_frame() */
-
-
-void dns_res_reset(struct dns_resolver *R) {
- unsigned i;
-
- dns_so_reset(&R->so);
-
- for (i = 0; i < lengthof(R->stack); i++)
- dns_res_reset_frame(R, &R->stack[i]);
-
- memset(&R->qname, '\0', sizeof *R - offsetof(struct dns_resolver, qname));
-} /* dns_res_reset() */
-
-
-void dns_res_close(struct dns_resolver *R) {
- if (!R || 1 < dns_res_release(R))
- return;
-
- dns_res_reset(R);
-
- dns_so_destroy(&R->so);
-
- dns_hints_close(R->hints);
- dns_hosts_close(R->hosts);
- dns_resconf_close(R->resconf);
- dns_cache_close(R->cache);
-
- free(R);
-} /* dns_res_close() */
-
-
-unsigned dns_res_acquire(struct dns_resolver *R) {
- return dns_atomic_inc(&R->refcount);
-} /* dns_res_acquire() */
-
-
-unsigned dns_res_release(struct dns_resolver *R) {
- return dns_atomic_dec(&R->refcount);
-} /* dns_res_release() */
-
-
-struct dns_resolver *dns_res_mortal(struct dns_resolver *res) {
- if (res)
- dns_res_release(res);
- return res;
-} /* dns_res_mortal() */
-
-
-static struct dns_packet *dns_res_merge(struct dns_packet *P0, struct dns_packet *P1, int *error_) {
- size_t bufsiz = P0->end + P1->end;
- struct dns_packet *P[3] = { P0, P1, 0 };
- struct dns_rr rr[3];
- int error, copy, i;
- enum dns_section section;
-
-retry:
- if (!(P[2] = dns_p_make(bufsiz, &error)))
- goto error;
-
- dns_rr_foreach(&rr[0], P[0], .section = DNS_S_QD) {
- if ((error = dns_rr_copy(P[2], &rr[0], P[0])))
- goto error;
- }
-
- for (section = DNS_S_AN; (DNS_S_ALL & section); section <<= 1) {
- for (i = 0; i < 2; i++) {
- dns_rr_foreach(&rr[i], P[i], .section = section) {
- copy = 1;
-
- dns_rr_foreach(&rr[2], P[2], .type = rr[i].type, .section = (DNS_S_ALL & ~DNS_S_QD)) {
- if (0 == dns_rr_cmp(&rr[i], P[i], &rr[2], P[2])) {
- copy = 0;
-
- break;
- }
- }
-
- if (copy && (error = dns_rr_copy(P[2], &rr[i], P[i]))) {
- if (error == DNS_ENOBUFS && bufsiz < 65535) {
- free(P[2]); P[2] = 0;
-
- bufsiz = MAX(65535, bufsiz * 2);
-
- goto retry;
- }
-
- goto error;
- }
- } /* foreach(rr) */
- } /* foreach(packet) */
- } /* foreach(section) */
-
- return P[2];
-error:
- *error_ = error;
-
- free(P[2]);
-
- return 0;
-} /* dns_res_merge() */
-
-
-static struct dns_packet *dns_res_glue(struct dns_resolver *R, struct dns_packet *Q) {
- struct dns_packet *P = dns_p_new(512);
- char qname[DNS_D_MAXNAME + 1];
- size_t qlen;
- enum dns_type qtype;
- struct dns_rr rr;
- unsigned sp;
- int error;
-
- if (!(qlen = dns_d_expand(qname, sizeof qname, 12, Q, &error))
- || qlen >= sizeof qname)
- return 0;
-
- if (!(qtype = dns_rr_type(12, Q)))
- return 0;
-
- if ((error = dns_p_push(P, DNS_S_QD, qname, strlen(qname), qtype, DNS_C_IN, 0, 0)))
- return 0;
-
- for (sp = 0; sp <= R->sp; sp++) {
- if (!R->stack[sp].answer)
- continue;
-
- dns_rr_foreach(&rr, R->stack[sp].answer, .name = qname, .type = qtype, .section = (DNS_S_ALL & ~DNS_S_QD)) {
- rr.section = DNS_S_AN;
-
- if ((error = dns_rr_copy(P, &rr, R->stack[sp].answer)))
- return 0;
- }
- }
-
- if (dns_p_count(P, DNS_S_AN) > 0)
- goto copy;
-
- /* Otherwise, look for a CNAME */
- for (sp = 0; sp <= R->sp; sp++) {
- if (!R->stack[sp].answer)
- continue;
-
- dns_rr_foreach(&rr, R->stack[sp].answer, .name = qname, .type = DNS_T_CNAME, .section = (DNS_S_ALL & ~DNS_S_QD)) {
- rr.section = DNS_S_AN;
-
- if ((error = dns_rr_copy(P, &rr, R->stack[sp].answer)))
- return 0;
- }
- }
-
- if (!dns_p_count(P, DNS_S_AN))
- return 0;
-
-copy:
- return dns_p_copy(dns_p_make(P->end, &error), P);
-} /* dns_res_glue() */
-
-
-static struct dns_packet *dns_res_mkquery(struct dns_resolver *R, const char *qname, enum dns_type qtype, enum dns_class qclass, int *error_) {
- struct dns_packet *Q = 0;
- int error;
-
- if (!(Q = dns_p_init(malloc(DNS_P_QBUFSIZ), DNS_P_QBUFSIZ)))
- goto syerr;
-
- if ((error = dns_p_push(Q, DNS_S_QD, qname, strlen(qname), qtype, qclass, 0, 0)))
- goto error;
-
- dns_header(Q)->rd = !R->resconf->options.recurse;
-
- return Q;
-syerr:
- error = dns_syerr();
-error:
- free(Q);
-
- *error_ = error;
-
- return 0;
-} /* dns_res_mkquery() */
-
-
-/*
- * Sort NS records by three criteria:
- *
- * 1) Whether glue is present.
- * 2) Whether glue record is original or of recursive lookup.
- * 3) Randomly shuffle records which share the above criteria.
- *
- * NOTE: Assumes only NS records passed, AND ASSUMES no new NS records will
- * be added during an iteration.
- *
- * FIXME: Only groks A glue, not AAAA glue.
- */
-static int dns_res_nameserv_cmp(struct dns_rr *a, struct dns_rr *b, struct dns_rr_i *i, struct dns_packet *P) {
- _Bool glued[2] = { 0 };
- struct dns_ns ns;
- struct dns_rr x, y;
- int cmp, error;
-
- if (!(error = dns_ns_parse(&ns, a, P)))
- if (!(glued[0] = !!dns_rr_grep(&x, 1, dns_rr_i_new(P, .section = (DNS_S_ALL & ~DNS_S_QD), .name = ns.host, .type = DNS_T_A), P, &error)))
- x.dn.p = 0;
-
- if (!(error = dns_ns_parse(&ns, b, P)))
- if (!(glued[1] = !!dns_rr_grep(&y, 1, dns_rr_i_new(P, .section = (DNS_S_ALL & ~DNS_S_QD), .name = ns.host, .type = DNS_T_A), P, &error)))
- y.dn.p = 0;
-
- if ((cmp = glued[1] - glued[0]))
- return cmp;
- else if ((cmp = (dns_rr_offset(&y) < i->args[0]) - (dns_rr_offset(&x) < i->args[0])))
- return cmp;
- else
- return dns_rr_i_shuffle(a, b, i, P);
-} /* dns_res_nameserv_cmp() */
-
-
-#define goto(sp, i) \
- do { R->stack[(sp)].state = (i); goto exec; } while (0)
-
-static int dns_res_exec(struct dns_resolver *R) {
- struct dns_res_frame *F;
- struct dns_packet *P;
- char host[DNS_D_MAXNAME + 1];
- size_t len;
- struct dns_rr rr;
- struct sockaddr_in sin;
- int error;
-
-exec:
-
- F = &R->stack[R->sp];
-
- switch (F->state) {
- case DNS_R_INIT:
- F->state++;
- case DNS_R_GLUE:
- if (R->sp == 0)
- goto(R->sp, DNS_R_SWITCH);
-
- assert(F->query);
-
- if (!(F->answer = dns_res_glue(R, F->query)))
- goto(R->sp, DNS_R_SWITCH);
-
- if (!(len = dns_d_expand(host, sizeof host, 12, F->query, &error)))
- goto error;
- else if (len >= sizeof host)
- goto toolong;
-
- dns_rr_foreach(&rr, F->answer, .name = host, .type = dns_rr_type(12, F->query), .section = DNS_S_AN) {
- goto(R->sp, DNS_R_FINISH);
- }
-
- dns_rr_foreach(&rr, F->answer, .name = host, .type = DNS_T_CNAME, .section = DNS_S_AN) {
- F->ans_cname = rr;
-
- goto(R->sp, DNS_R_CNAME0_A);
- }
-
- F->state++;
- case DNS_R_SWITCH:
- while (F->which < (int)sizeof R->resconf->lookup) {
- switch (R->resconf->lookup[F->which++]) {
- case 'b': case 'B':
- goto(R->sp, DNS_R_BIND);
- case 'f': case 'F':
- goto(R->sp, DNS_R_FILE);
- case 'c': case 'C':
- if (R->cache)
- goto(R->sp, DNS_R_CACHE);
-
- break;
- default:
- break;
- }
- }
-
- goto(R->sp, DNS_R_SERVFAIL); /* FIXME: Right behavior? */
- case DNS_R_FILE:
- if (R->sp > 0) {
- free(F->answer);
-
- if (!(F->answer = dns_hosts_query(R->hosts, F->query, &error)))
- goto error;
-
- if (dns_p_count(F->answer, DNS_S_AN) > 0)
- goto(R->sp, DNS_R_FINISH);
-
- free(F->answer); F->answer = 0;
- } else {
- R->search = 0;
-
- while ((len = dns_resconf_search(host, sizeof host, R->qname, R->qlen, R->resconf, &R->search))) {
-/*
- * FIXME: Some sort of bug, either with this code or with GCC 3.3.5 on
- * OpenBSD 4.4, overwites the stack guard. If the bug is in this file, it
- * appears to be localized somewhere around here. It can also be mitigated
- * in dns_hosts_query(). In any event, the bug manifests only when using
- * compound literals. alloca(), malloc(), calloc(), etc, all work fine.
- * Valgrind (tested on Linux) cannot detect any issues, but stack issues are
- * not Valgrind's forte. Neither can I spot anything in the assembly, but
- * that's not my forte.
- */
-#if __OpenBSD__ && __GNUC__
- struct dns_packet *query = __builtin_alloca(DNS_P_QBUFSIZ);
-
- dns_p_init(query, DNS_P_QBUFSIZ);
-#else
- struct dns_packet *query = dns_p_new(DNS_P_QBUFSIZ);
-#endif
-
- if ((error = dns_p_push(query, DNS_S_QD, host, len, R->qtype, R->qclass, 0, 0)))
- goto error;
-
- free(F->answer);
-
- if (!(F->answer = dns_hosts_query(R->hosts, query, &error)))
- goto error;
-
- if (dns_p_count(F->answer, DNS_S_AN) > 0)
- goto(R->sp, DNS_R_FINISH);
-
- free(F->answer); F->answer = 0;
- }
- }
-
- goto(R->sp, DNS_R_SWITCH);
- case DNS_R_CACHE:
- error = 0;
-
- if (!F->query && !(F->query = dns_res_mkquery(R, R->qname, R->qtype, R->qclass, &error)))
- goto error;
-
- free(F->answer);
-
- if ((F->answer = R->cache->query(F->query, R->cache, &error))) {
- if (dns_p_count(F->answer, DNS_S_AN) > 0)
- goto(R->sp, DNS_R_FINISH);
-
- free(F->answer); F->answer = 0;
-
- goto(R->sp, DNS_R_SWITCH);
- } else if (error)
- goto error;
-
- F->state++;
- case DNS_R_SUBMIT:
- if ((error = R->cache->submit(F->query, R->cache)))
- goto error;
-
- F->state++;
- case DNS_R_CHECK:
- if ((error = R->cache->check(R->cache)))
- goto error;
-
- F->state++;
- case DNS_R_FETCH:
- error = 0;
-
- free(F->answer);
-
- if ((F->answer = R->cache->fetch(R->cache, &error))) {
- if (dns_p_count(F->answer, DNS_S_AN) > 0)
- goto(R->sp, DNS_R_FINISH);
-
- free(F->answer); F->answer = 0;
-
- goto(R->sp, DNS_R_SWITCH);
- } else if (error)
- goto error;
-
- goto(R->sp, DNS_R_SWITCH);
- case DNS_R_BIND:
- if (R->sp > 0) {
- assert(F->query);
-
- goto(R->sp, DNS_R_HINTS);
- }
-
- R->search = 0;
-
- F->state++;
- case DNS_R_SEARCH:
- if (!(len = dns_resconf_search(host, sizeof host, R->qname, R->qlen, R->resconf, &R->search)))
- goto(R->sp, DNS_R_SWITCH);
-
- if (!(P = dns_p_make(DNS_P_QBUFSIZ, &error)))
- goto error;
-
- dns_header(P)->rd = !R->resconf->options.recurse;
-
- free(F->query); F->query = P;
-
- if ((error = dns_p_push(F->query, DNS_S_QD, host, len, R->qtype, R->qclass, 0, 0)))
- goto error;
-
- F->state++;
- case DNS_R_HINTS:
- if (!(F->hints = dns_hints_query(R->hints, F->query, &error)))
- goto error;
-
- F->state++;
- case DNS_R_ITERATE:
- dns_rr_i_init(&F->hints_i, F->hints);
-
- F->hints_i.section = DNS_S_AUTHORITY;
- F->hints_i.type = DNS_T_NS;
- F->hints_i.sort = &dns_res_nameserv_cmp;
- F->hints_i.args[0] = F->hints->end;
-
- F->state++;
- case DNS_R_FOREACH_NS:
- dns_rr_i_save(&F->hints_i);
-
- /* Load our next nameserver host. */
- if (!dns_rr_grep(&F->hints_ns, 1, &F->hints_i, F->hints, &error)) {
- if (++F->attempts < R->resconf->options.attempts)
- goto(R->sp, DNS_R_ITERATE);
-
- goto(R->sp, DNS_R_SWITCH);
- }
-
- dns_rr_i_init(&F->hints_j, F->hints);
-
- /* Assume there are glue records */
- goto(R->sp, DNS_R_FOREACH_A);
- case DNS_R_RESOLV0_NS:
- /* Have we reached our max depth? */
- if (&F[1] >= endof(R->stack))
- goto(R->sp, DNS_R_FOREACH_NS);
-
- dns_res_reset_frame(R, &F[1]);
-
- if (!(F[1].query = dns_p_make(DNS_P_QBUFSIZ, &error)))
- goto error;
-
- if ((error = dns_ns_parse((struct dns_ns *)host, &F->hints_ns, F->hints)))
- goto error;
-
- if ((error = dns_p_push(F[1].query, DNS_S_QD, host, strlen(host), DNS_T_A, DNS_C_IN, 0, 0)))
- goto error;
-
- F->state++;
-
- goto(++R->sp, DNS_R_INIT);
- case DNS_R_RESOLV1_NS:
- if (!(len = dns_d_expand(host, sizeof host, 12, F[1].query, &error)))
- goto error;
- else if (len >= sizeof host)
- goto toolong;
-
- dns_rr_foreach(&rr, F[1].answer, .name = host, .type = DNS_T_A, .section = (DNS_S_ALL & ~DNS_S_QD)) {
- rr.section = DNS_S_AR;
-
- if ((error = dns_rr_copy(F->hints, &rr, F[1].answer)))
- goto error;
-
- dns_rr_i_rewind(&F->hints_i); /* Now there's glue. */
- }
-
- goto(R->sp, DNS_R_FOREACH_NS);
- case DNS_R_FOREACH_A:
- /*
- * NOTE: Iterator initialized in DNS_R_FOREACH_NS because
- * this state is re-entrant, but we need to reset
- * .name to a valid pointer each time.
- */
- if ((error = dns_ns_parse((struct dns_ns *)host, &F->hints_ns, F->hints)))
- goto error;
-
- F->hints_j.name = host;
- F->hints_j.type = DNS_T_A;
- F->hints_j.section = DNS_S_ALL & ~DNS_S_QD;
-
- if (!dns_rr_grep(&rr, 1, &F->hints_j, F->hints, &error)) {
- if (!dns_rr_i_count(&F->hints_j))
- goto(R->sp, DNS_R_RESOLV0_NS);
-
- goto(R->sp, DNS_R_FOREACH_NS);
- }
-
- sin.sin_family = AF_INET;
-
- if ((error = dns_a_parse((struct dns_a *)&sin.sin_addr, &rr, F->hints)))
- goto error;
-
- if (R->sp == 0)
- sin.sin_port = dns_hints_port(R->hints, AF_INET, (struct sockaddr *)&sin.sin_addr);
- else
- sin.sin_port = htons(53);
-
- if (DNS_DEBUG) {
- char addr[INET_ADDRSTRLEN + 1];
- dns_a_print(addr, sizeof addr, (struct dns_a *)&sin.sin_addr);
- DNS_SHOW(F->query, "ASKING: %s/%s @ DEPTH: %u)", host, addr, R->sp);
- }
-
- if ((error = dns_so_submit(&R->so, F->query, (struct sockaddr *)&sin)))
- goto error;
-
- F->state++;
- case DNS_R_QUERY_A:
- if (dns_so_elapsed(&R->so) >= (time_t)R->resconf->options.timeout)
- goto(R->sp, DNS_R_FOREACH_A);
-
- if ((error = dns_so_check(&R->so)))
- goto error;
-
- free(F->answer);
-
- if (!(F->answer = dns_so_fetch(&R->so, &error)))
- goto error;
-
- if (DNS_DEBUG) {
- DNS_SHOW(F->answer, "ANSWER @ DEPTH: %u)", R->sp);
- }
-
- if ((error = dns_rr_parse(&rr, 12, F->query)))
- goto error;
-
- if (!(len = dns_d_expand(host, sizeof host, rr.dn.p, F->query, &error)))
- goto error;
- else if (len >= sizeof host)
- goto toolong;
-
- dns_rr_foreach(&rr, F->answer, .section = DNS_S_AN, .name = host, .type = rr.type) {
- goto(R->sp, DNS_R_FINISH); /* Found */
- }
-
- dns_rr_foreach(&rr, F->answer, .section = DNS_S_AN, .name = host, .type = DNS_T_CNAME) {
- F->ans_cname = rr;
-
- goto(R->sp, DNS_R_CNAME0_A);
- }
-
- if (!R->resconf->options.recurse)
- goto(R->sp, DNS_R_SWITCH);
-
- dns_rr_foreach(&rr, F->answer, .section = DNS_S_NS, .type = DNS_T_NS) {
- free(F->hints);
-
- F->hints = F->answer;
- F->answer = 0;
-
- goto(R->sp, DNS_R_ITERATE);
- }
-
- /* XXX: Should this go further up? */
- if (dns_header(F->answer)->aa)
- goto(R->sp, DNS_R_FINISH);
-
- goto(R->sp, DNS_R_FOREACH_A);
- case DNS_R_CNAME0_A:
- if (&F[1] >= endof(R->stack))
- goto(R->sp, DNS_R_FINISH);
-
- if ((error = dns_cname_parse((struct dns_cname *)host, &F->ans_cname, F->answer)))
- goto error;
-
- dns_res_reset_frame(R, &F[1]);
-
- if (!(F[1].query = dns_p_make(DNS_P_QBUFSIZ, &error)))
- goto error;
-
- if ((error = dns_p_push(F[1].query, DNS_S_QD, host, strlen(host), dns_rr_type(12, F->query), DNS_C_IN, 0, 0)))
- goto error;
-
- F->state++;
-
- goto(++R->sp, DNS_R_INIT);
- case DNS_R_CNAME1_A:
- if (!(P = dns_res_merge(F->answer, F[1].answer, &error)))
- goto error;
-
- free(F->answer); F->answer = P;
-
- goto(R->sp, DNS_R_FINISH);
- case DNS_R_FINISH:
- assert(F->answer);
-
- if (!R->resconf->options.smart || R->sp > 0)
- goto(R->sp, DNS_R_DONE);
-
- R->smart.section = DNS_S_AN;
- R->smart.type = R->qtype;
-
- dns_rr_i_init(&R->smart, F->answer);
-
- F->state++;
- case DNS_R_SMART0_A:
- if (&F[1] >= endof(R->stack))
- goto(R->sp, DNS_R_DONE);
-
- while (dns_rr_grep(&rr, 1, &R->smart, F->answer, &error)) {
- union {
- struct dns_ns ns;
- struct dns_mx mx;
- struct dns_srv srv;
- } rd;
- const char *qname;
- enum dns_type qtype;
- enum dns_class qclass;
-
- switch (rr.type) {
- case DNS_T_NS:
- if ((error = dns_ns_parse(&rd.ns, &rr, F->answer)))
- goto error;
-
- qname = rd.ns.host;
- qtype = DNS_T_A;
- qclass = DNS_C_IN;
-
- break;
- case DNS_T_MX:
- if ((error = dns_mx_parse(&rd.mx, &rr, F->answer)))
- goto error;
-
- qname = rd.mx.host;
- qtype = DNS_T_A;
- qclass = DNS_C_IN;
-
- break;
- case DNS_T_SRV:
- if ((error = dns_srv_parse(&rd.srv, &rr, F->answer)))
- goto error;
-
- qname = rd.srv.target;
- qtype = DNS_T_A;
- qclass = DNS_C_IN;
-
- break;
- default:
- continue;
- } /* switch() */
-
- dns_res_reset_frame(R, &F[1]);
-
- if (!(F[1].query = dns_res_mkquery(R, qname, qtype, qclass, &error)))
- goto error;
-
- F->state++;
-
- goto(++R->sp, DNS_R_INIT);
- } /* while() */
-
- /*
- * NOTE: SMTP specification says to fallback to A record.
- *
- * XXX: Should we add a mock MX answer?
- */
- if (R->qtype == DNS_T_MX && R->smart.state.count == 0) {
- dns_res_reset_frame(R, &F[1]);
-
- if (!(F[1].query = dns_res_mkquery(R, R->qname, DNS_T_A, DNS_C_IN, &error)))
- goto error;
-
- R->smart.state.count++;
- F->state++;
-
- goto(++R->sp, DNS_R_INIT);
- }
-
- goto(R->sp, DNS_R_DONE);
- case DNS_R_SMART1_A:
- assert(F[1].answer);
-
- /*
- * FIXME: For CNAME chains (which are typically illegal in
- * this context), we should rewrite the record host name
- * to the original smart qname. All the user cares about
- * is locating that A/AAAA record.
- */
- dns_rr_foreach(&rr, F[1].answer, .section = DNS_S_AN, .type = DNS_T_A) {
- rr.section = DNS_S_AR;
-
- if (dns_rr_exists(&rr, F[1].answer, F->answer))
- continue;
-
- while ((error = dns_rr_copy(F->answer, &rr, F[1].answer))) {
- if (error != DNS_ENOBUFS)
- goto error;
- if ((error = dns_p_grow(&F->answer)))
- goto error;
- }
- }
-
- goto(R->sp, DNS_R_SMART0_A);
- case DNS_R_DONE:
- assert(F->answer);
-
- if (R->sp > 0)
- goto(--R->sp, F[-1].state);
-
- break;
- case DNS_R_SERVFAIL:
- free(F->answer);
-
- if (!(F->answer = dns_p_make(DNS_P_QBUFSIZ, &error)))
- goto error;
-
- dns_header(F->answer)->qr = 1;
- dns_header(F->answer)->rcode = DNS_RC_SERVFAIL;
-
- if ((error = dns_p_push(F->answer, DNS_S_QD, R->qname, strlen(R->qname), R->qtype, R->qclass, 0, 0)))
- goto error;
-
- goto(R->sp, DNS_R_DONE);
- default:
- error = EINVAL;
-
- goto error;
- } /* switch () */
-
- return 0;
-toolong:
- error = DNS_EILLEGAL;
-error:
- return error;
-} /* dns_res_exec() */
-
-#undef goto
-
-
-void dns_res_clear(struct dns_resolver *R) {
- switch (R->stack[R->sp].state) {
- case DNS_R_CHECK:
- return R->cache->clear(R->cache);
- default:
- return dns_so_clear(&R->so);
- }
-} /* dns_res_clear() */
-
-
-static int dns_res_events2(struct dns_resolver *R, enum dns_events type) {
- int events;
-
- switch (R->stack[R->sp].state) {
- case DNS_R_CHECK:
- events = R->cache->events(R->cache);
-
- return (type == DNS_LIBEVENT)? DNS_POLL2EV(events) : events;
- default:
- return dns_so_events2(&R->so, type);
- }
-} /* dns_res_events2() */
-
-
-int dns_res_events(struct dns_resolver *R) {
- return dns_res_events2(R, R->so.opts.events);
-} /* dns_res_events() */
-
-
-int dns_res_pollfd(struct dns_resolver *R) {
- switch (R->stack[R->sp].state) {
- case DNS_R_CHECK:
- return R->cache->pollfd(R->cache);
- default:
- return dns_so_pollfd(&R->so);
- }
-} /* dns_res_pollfd() */
-
-
-time_t dns_res_elapsed(struct dns_resolver *R) {
- return dns_elapsed(R->began);
-} /* dns_res_elapsed() */
-
-
-int dns_res_poll(struct dns_resolver *R, int timeout) {
- return dns_poll(dns_res_pollfd(R), dns_res_events2(R, DNS_SYSPOLL), timeout);
-} /* dns_res_poll() */
-
-
-int dns_res_submit(struct dns_resolver *R, const char *qname, enum dns_type qtype, enum dns_class qclass) {
- dns_res_reset(R);
-
- /* Don't anchor; that can conflict with searchlist generation. */
- dns_d_init(R->qname, sizeof R->qname, qname, (R->qlen = strlen(qname)), 0);
-
- R->qtype = qtype;
- R->qclass = qclass;
-
- R->began = dns_now();
-
- return 0;
-} /* dns_res_submit() */
-
-
-int dns_res_check(struct dns_resolver *R) {
- int error;
-
- if ((error = dns_res_exec(R)))
- return error;
-
- return 0;
-} /* dns_res_check() */
-
-
-struct dns_packet *dns_res_fetch(struct dns_resolver *R, int *error) {
- struct dns_packet *answer;
-
- if (R->stack[0].state != DNS_R_DONE) {
- *error = DNS_EUNKNOWN;
-
- return 0;
- }
-
- answer = R->stack[0].answer;
- R->stack[0].answer = 0;
-
- return answer;
-} /* dns_res_fetch() */
-
-
-struct dns_packet *dns_res_query(struct dns_resolver *res, const char *qname, enum dns_type qtype, enum dns_class qclass, int timeout, int *error_) {
- int error;
-
- if ((error = dns_res_submit(res, qname, qtype, qclass)))
- goto error;
-
- while ((error = dns_res_check(res))) {
- if (dns_res_elapsed(res) > timeout)
- error = DNS_ETIMEDOUT;
-
- if (error != DNS_EAGAIN)
- goto error;
-
- if ((error = dns_res_poll(res, 1)))
- goto error;
- }
-
- return dns_res_fetch(res, error_);
-error:
- *error_ = error;
-
- return 0;
-} /* dns_res_query() */
-
-
-const struct dns_stat *dns_res_stat(struct dns_resolver *res) {
- return dns_so_stat(&res->so);
-} /* dns_res_stat() */
-
-
-/*
- * A D D R I N F O R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_addrinfo {
- struct addrinfo hints;
- struct dns_resolver *res;
-
- char qname[DNS_D_MAXNAME + 1];
- enum dns_type qtype;
- unsigned short qport, port;
-
- struct dns_packet *answer;
- struct dns_packet *glue;
-
- struct dns_rr_i i, g;
- struct dns_rr rr;
-
- char cname[DNS_D_MAXNAME + 1];
-
- int state;
-}; /* struct dns_addrinfo */
-
-
-struct dns_addrinfo *dns_ai_open(const char *host, const char *serv, enum dns_type qtype, const struct addrinfo *hints, struct dns_resolver *res, int *error_) {
- static const struct dns_addrinfo ai_initializer;
- struct dns_addrinfo *ai;
- int error;
-
- if (!res)
- return 0;
-
- dns_res_acquire(res);
-
- if (!(ai = malloc(sizeof *ai)))
- goto syerr;
-
- *ai = ai_initializer;
- ai->hints = *hints;
-
- ai->res = res;
- res = 0;
-
- if (sizeof ai->qname <= dns_strlcpy(ai->qname, host, sizeof ai->qname))
- { error = ENAMETOOLONG; goto error; }
-
- ai->qtype = qtype;
- ai->qport = 0;
-
- if (serv) {
- while (isdigit((unsigned char)*serv)) {
- ai->qport *= 10;
- ai->qport += *serv++ - '0';
- }
- }
-
- ai->port = ai->qport;
-
- return ai;
-syerr:
- error = dns_syerr();
-error:
- *error_ = error;
-
- dns_ai_close(ai);
- dns_res_close(res);
-
- return 0;
-} /* dns_ai_open() */
-
-
-void dns_ai_close(struct dns_addrinfo *ai) {
- if (!ai)
- return;
-
- dns_res_close(ai->res);
-
- if (ai->answer != ai->glue)
- free(ai->glue);
-
- free(ai->answer);
- free(ai);
-} /* dns_ai_close() */
-
-
-static int dns_ai_setent(struct addrinfo **ent, union dns_any *any, enum dns_type type, struct dns_addrinfo *ai) {
- struct sockaddr *saddr;
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
- const char *cname;
- size_t clen;
-
- switch (type) {
- case DNS_T_A:
- saddr = memset(&sin, '\0', sizeof sin);
-
- sin.sin_family = AF_INET;
- sin.sin_port = htons(ai->port);
-
- memcpy(&sin.sin_addr, any, sizeof sin.sin_addr);
-
- break;
- case DNS_T_AAAA:
- saddr = memset(&sin6, '\0', sizeof sin6);
-
- sin6.sin6_family = AF_INET6;
- sin6.sin6_port = htons(ai->port);
-
- memcpy(&sin6.sin6_addr, any, sizeof sin6.sin6_addr);
-
- break;
- default:
- return EINVAL;
- } /* switch() */
-
- if (ai->hints.ai_flags & AI_CANONNAME) {
- cname = (*ai->cname)? ai->cname : ai->qname;
- clen = strlen(cname);
- } else {
- cname = NULL;
- clen = 0;
- }
-
- if (!(*ent = malloc(sizeof **ent + dns_sa_len(saddr) + ((ai->hints.ai_flags & AI_CANONNAME)? clen + 1 : 0))))
- return dns_syerr();
-
- memset(*ent, '\0', sizeof **ent);
-
- (*ent)->ai_family = saddr->sa_family;
- (*ent)->ai_socktype = ai->hints.ai_socktype;
- (*ent)->ai_protocol = ai->hints.ai_protocol;
-
- (*ent)->ai_addr = memcpy((unsigned char *)*ent + sizeof **ent, saddr, dns_sa_len(saddr));
- (*ent)->ai_addrlen = dns_sa_len(saddr);
-
- if (ai->hints.ai_flags & AI_CANONNAME)
- (*ent)->ai_canonname = memcpy((unsigned char *)*ent + sizeof **ent + dns_sa_len(saddr), cname, clen + 1);
-
- return 0;
-} /* dns_ai_setent() */
-
-
-enum dns_ai_state {
- DNS_AI_S_INIT,
- DNS_AI_S_NUMERIC,
- DNS_AI_S_SUBMIT,
- DNS_AI_S_CHECK,
- DNS_AI_S_FETCH,
- DNS_AI_S_FOREACH_I,
- DNS_AI_S_FOREACH_G,
- DNS_AI_S_SUBMIT_G,
- DNS_AI_S_CHECK_G,
- DNS_AI_S_FETCH_G,
- DNS_AI_S_DONE,
-}; /* enum dns_ai_state */
-
-#define dns_ai_goto(which) do { ai->state = (which); goto exec; } while (0)
-
-int dns_ai_nextent(struct addrinfo **ent, struct dns_addrinfo *ai) {
- struct dns_packet *ans, *glue;
- struct dns_rr rr;
- char qname[DNS_D_MAXNAME + 1];
- union dns_any any;
- size_t len;
- int error;
-
- *ent = 0;
-
-exec:
-
- switch (ai->state) {
- case DNS_AI_S_INIT:
- ai->state++;
- case DNS_AI_S_NUMERIC:
- if (1 == dns_inet_pton(AF_INET, ai->qname, &any.a)) {
- ai->state = DNS_AI_S_DONE;
-
- return dns_ai_setent(ent, &any, DNS_T_A, ai);
- }
-
- if (1 == dns_inet_pton(AF_INET6, ai->qname, &any.aaaa)) {
- ai->state = DNS_AI_S_DONE;
-
- return dns_ai_setent(ent, &any, DNS_T_AAAA, ai);
- }
-
- if (ai->hints.ai_flags & AI_NUMERICHOST)
- dns_ai_goto(DNS_AI_S_DONE);
-
- ai->state++;
- case DNS_AI_S_SUBMIT:
- if ((error = dns_res_submit(ai->res, ai->qname, ai->qtype, DNS_C_IN)))
- return error;
-
- ai->state++;
- case DNS_AI_S_CHECK:
- if ((error = dns_res_check(ai->res)))
- return error;
-
- ai->state++;
- case DNS_AI_S_FETCH:
- if (!(ai->answer = dns_res_fetch(ai->res, &error)))
- return error;
-
- if ((error = dns_p_study(ai->answer)))
- return error;
-
- ai->glue = ai->answer;
-
- dns_rr_i_init(&ai->i, ai->answer);
-
- ai->i.section = DNS_S_AN;
- ai->i.type = ai->qtype;
- ai->i.sort = &dns_rr_i_order;
-
- ai->state++;
- case DNS_AI_S_FOREACH_I:
- /* Search generator may have changed our qname. */
- if (!(len = dns_d_expand(qname, sizeof qname, 12, ai->answer, &error)))
- return error;
- else if (len >= sizeof qname)
- return DNS_EILLEGAL;
-
- if (!dns_d_cname(ai->cname, sizeof ai->cname, qname, strlen(qname), ai->answer, &error))
- return error;
-
- ai->i.name = ai->cname;
-
- if (!dns_rr_grep(&rr, 1, &ai->i, ai->answer, &error))
- dns_ai_goto(DNS_AI_S_DONE);
-
- if ((error = dns_any_parse(&any, &rr, ai->answer)))
- return error;
-
- ai->port = ai->qport;
-
- switch (rr.type) {
- case DNS_T_A:
- case DNS_T_AAAA:
- return dns_ai_setent(ent, &any, rr.type, ai);
- default:
- if (!dns_any_cname(ai->cname, sizeof ai->cname, &any, rr.type))
- dns_ai_goto(DNS_AI_S_FOREACH_I);
-
- /*
- * Find the "real" canonical name. Some authorities
- * publish aliases where an RFC defines a canonical
- * name. We trust that the resolver followed any
- * CNAME chains on it's own, regardless of whether
- * the "smart" option is enabled.
- */
- if (!dns_d_cname(ai->cname, sizeof ai->cname, ai->cname, strlen(ai->cname), ai->answer, &error))
- return error;
-
- if (rr.type == DNS_T_SRV)
- ai->port = any.srv.port;
-
- break;
- } /* switch() */
-
- dns_rr_i_init(&ai->g, ai->glue);
-
- ai->g.section = DNS_S_ALL & ~DNS_S_QD;
- ai->g.name = ai->cname;
- ai->g.type = (ai->hints.ai_family == AF_INET6)? DNS_T_AAAA : DNS_T_A;
-
- ai->state++;
- case DNS_AI_S_FOREACH_G:
- if (!dns_rr_grep(&rr, 1, &ai->g, ai->glue, &error)) {
- if (dns_rr_i_count(&ai->g) > 0)
- dns_ai_goto(DNS_AI_S_FOREACH_I);
- else
- dns_ai_goto(DNS_AI_S_SUBMIT_G);
- }
-
- if ((error = dns_any_parse(&any, &rr, ai->glue)))
- return error;
-
- return dns_ai_setent(ent, &any, rr.type, ai);
- case DNS_AI_S_SUBMIT_G:
- if (dns_rr_grep(&rr, 1, dns_rr_i_new(ai->glue, .section = DNS_S_QD, .name = ai->g.name, .type = ai->g.type), ai->glue, &error))
- dns_ai_goto(DNS_AI_S_FOREACH_I);
-
- if ((error = dns_res_submit(ai->res, ai->g.name, ai->g.type, DNS_C_IN)))
- return error;
-
- ai->state++;
- case DNS_AI_S_CHECK_G:
- if ((error = dns_res_check(ai->res)))
- return error;
-
- ai->state++;
- case DNS_AI_S_FETCH_G:
- if (!(ans = dns_res_fetch(ai->res, &error)))
- return error;
-
- dns_p_study(ans);
-
- glue = dns_p_merge(ai->glue, DNS_S_ALL, ans, DNS_S_ALL, &error);
-
- free(ans);
-
- if (!glue)
- return error;
-
- if (ai->glue != ai->answer)
- free(ai->glue);
-
- ai->glue = glue;
-
- dns_rr_i_init(&ai->g, ai->glue);
-
- /* ai->g.name should already point to ai->cname */
- if (!dns_d_cname(ai->cname, sizeof ai->cname, ai->cname, strlen(ai->cname), ai->glue, &error))
- dns_ai_goto(DNS_AI_S_FOREACH_I);
-
- /* NOTE: Keep all the other iterator filters */
-
- dns_ai_goto(DNS_AI_S_FOREACH_G);
- case DNS_AI_S_DONE:
- return ENOENT;
- default:
- return EINVAL;
- } /* switch() */
-} /* dns_ai_nextent() */
-
-
-time_t dns_ai_elapsed(struct dns_addrinfo *ai) {
- return dns_res_elapsed(ai->res);
-} /* dns_ai_elapsed() */
-
-
-void dns_ai_clear(struct dns_addrinfo *ai) {
- return dns_res_clear(ai->res);
-} /* dns_ai_clear() */
-
-
-int dns_ai_events(struct dns_addrinfo *ai) {
- return dns_res_events(ai->res);
-} /* dns_ai_events() */
-
-
-int dns_ai_pollfd(struct dns_addrinfo *ai) {
- return dns_res_pollfd(ai->res);
-} /* dns_ai_pollfd() */
-
-
-int dns_ai_poll(struct dns_addrinfo *ai, int timeout) {
- return dns_res_poll(ai->res, timeout);
-} /* dns_ai_poll() */
-
-
-size_t dns_ai_print(void *dst, size_t lim, struct addrinfo *ent, struct dns_addrinfo *ai) {
- char addr[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
- size_t cp = 0;
-
- cp += dns__printstring(dst, lim, cp, "[ ");
- cp += dns__printstring(dst, lim, cp, ai->qname);
- cp += dns__printstring(dst, lim, cp, " IN ");
- cp += dns__printstring(dst, lim, cp, dns_strtype(ai->qtype));
- cp += dns__printstring(dst, lim, cp, " ]\n");
-
- cp += dns__printstring(dst, lim, cp, ".ai_family = ");
-
- switch (ent->ai_family) {
- case AF_INET:
- cp += dns__printstring(dst, lim, cp, "AF_INET");
- break;
- case AF_INET6:
- cp += dns__printstring(dst, lim, cp, "AF_INET6");
- break;
- default:
- cp += dns__print10(dst, lim, cp, ent->ai_family, 0);
- break;
- }
-
- cp += dns__printchar(dst, lim, cp, '\n');
-
- cp += dns__printstring(dst, lim, cp, ".ai_socktype = ");
-
- switch (ent->ai_socktype) {
- case SOCK_STREAM:
- cp += dns__printstring(dst, lim, cp, "SOCK_STREAM");
- break;
- case SOCK_DGRAM:
- cp += dns__printstring(dst, lim, cp, "SOCK_DGRAM");
- break;
- default:
- cp += dns__print10(dst, lim, cp, ent->ai_socktype, 0);
- break;
- }
-
- cp += dns__printchar(dst, lim, cp, '\n');
-
- cp += dns__printstring(dst, lim, cp, ".ai_addr = [");
-
- dns_inet_ntop(dns_sa_family(ent->ai_addr), dns_sa_addr(dns_sa_family(ent->ai_addr), ent->ai_addr), addr, sizeof addr);
-
- cp += dns__printstring(dst, lim, cp, addr);
- cp += dns__printstring(dst, lim, cp, "]:");
-
- cp += dns__print10(dst, lim, cp, ntohs(*dns_sa_port(dns_sa_family(ent->ai_addr), ent->ai_addr)), 0);
- cp += dns__printchar(dst, lim, cp, '\n');
-
- cp += dns__printstring(dst, lim, cp, ".ai_canonname = ");
- cp += dns__printstring(dst, lim, cp, (ent->ai_canonname)? ent->ai_canonname : "[NULL]");
- cp += dns__printchar(dst, lim, cp, '\n');
-
- dns__printnul(dst, lim, cp);
-
- return cp;
-} /* dns_ai_print() */
-
-
-const struct dns_stat *dns_ai_stat(struct dns_addrinfo *ai) {
- return dns_res_stat(ai->res);
-} /* dns_ai_stat() */
-
-
-/*
- * M I S C E L L A N E O U S R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static const struct {
- char name[16];
- enum dns_section type;
-} dns_sections[] = {
- { "QUESTION", DNS_S_QUESTION },
- { "QD", DNS_S_QUESTION },
- { "ANSWER", DNS_S_ANSWER },
- { "AN", DNS_S_ANSWER },
- { "AUTHORITY", DNS_S_AUTHORITY },
- { "NS", DNS_S_AUTHORITY },
- { "ADDITIONAL", DNS_S_ADDITIONAL },
- { "AR", DNS_S_ADDITIONAL },
-};
-
-const char *(dns_strsection)(enum dns_section section, void *dst, size_t lim) {
- unsigned i, p = 0;
-
- for (i = 0; i < lengthof(dns_sections); i++) {
- if (dns_sections[i].type & section) {
- if (p > 0)
- p += dns__printchar(dst, lim, p, '|');
-
- p += dns__printstring(dst, lim, p, dns_sections[i].name);
-
- section &= ~dns_sections[i].type;
- }
- }
-
- if (!p)
- p += dns__print10(dst, lim, 0, (0xffff & section), 0);
-
- dns__printnul(dst, lim, p);
-
- return dst;
-} /* dns_strsection() */
-
-
-enum dns_section dns_isection(const char *src) {
- enum dns_section section = 0;
- char sbuf[128];
- char *name, *next;
- unsigned i;
-
- dns_strlcpy(sbuf, src, sizeof sbuf);
- next = sbuf;
-
- while ((name = dns_strsep(&next, "|+, \t"))) {
- for (i = 0; i < lengthof(dns_sections); i++) {
- if (!strcasecmp(dns_sections[i].name, name)) {
- section |= dns_sections[i].type;
- break;
- }
- }
- }
-
- return section;
-} /* dns_isection() */
-
-
-static const struct {
- char name[8];
- enum dns_class type;
-} dns_classes[] = {
- { "IN", DNS_C_IN },
-};
-
-const char *(dns_strclass)(enum dns_class type, void *dst, size_t lim) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_classes); i++) {
- if (dns_classes[i].type == type) {
- dns__printnul(dst, lim, dns__printstring(dst, lim, 0, dns_classes[i].name));
-
- return dst;
- }
- }
-
- dns__printnul(dst, lim, dns__print10(dst, lim, 0, (0xffff & type), 0));
-
- return dst;
-} /* dns_strclass() */
-
-
-enum dns_class dns_iclass(const char *name) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_classes); i++) {
- if (!strcasecmp(dns_classes[i].name, name))
- return dns_classes[i].type;
- }
-
- return 0;
-} /* dns_iclass() */
-
-
-const char *(dns_strtype)(enum dns_type type, void *dst, size_t lim) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (dns_rrtypes[i].type == type) {
- dns__printnul(dst, lim, dns__printstring(dst, lim, 0, dns_rrtypes[i].name));
-
- return dst;
- }
- }
-
- dns__printnul(dst, lim, dns__print10(dst, lim, 0, (0xffff & type), 0));
-
- return dst;
-} /* dns_strtype() */
-
-
-enum dns_type dns_itype(const char *type) {
- unsigned i;
-
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (!strcasecmp(dns_rrtypes[i].name, type))
- return dns_rrtypes[i].type;
- }
-
- return 0;
-} /* dns_itype() */
-
-
-static char dns_opcodes[16][16] = {
- [DNS_OP_QUERY] = "QUERY",
- [DNS_OP_IQUERY] = "IQUERY",
- [DNS_OP_STATUS] = "STATUS",
- [DNS_OP_NOTIFY] = "NOTIFY",
- [DNS_OP_UPDATE] = "UPDATE",
-};
-
-const char *dns_stropcode(enum dns_opcode opcode) {
- opcode &= 0xf;
-
- if ('\0' == dns_opcodes[opcode][0])
- dns__printnul(dns_opcodes[opcode], sizeof dns_opcodes[opcode], dns__print10(dns_opcodes[opcode], sizeof dns_opcodes[opcode], 0, opcode, 0));
-
- return dns_opcodes[opcode];
-} /* dns_stropcode() */
-
-
-enum dns_opcode dns_iopcode(const char *name) {
- unsigned opcode;
-
- for (opcode = 0; opcode < lengthof(dns_opcodes); opcode++) {
- if (!strcasecmp(name, dns_opcodes[opcode]))
- return opcode;
- }
-
- return lengthof(dns_opcodes) - 1;
-} /* dns_iopcode() */
-
-
-static char dns_rcodes[16][16] = {
- [DNS_RC_NOERROR] = "NOERROR",
- [DNS_RC_FORMERR] = "FORMERR",
- [DNS_RC_SERVFAIL] = "SERVFAIL",
- [DNS_RC_NXDOMAIN] = "NXDOMAIN",
- [DNS_RC_NOTIMP] = "NOTIMP",
- [DNS_RC_REFUSED] = "REFUSED",
- [DNS_RC_YXDOMAIN] = "YXDOMAIN",
- [DNS_RC_YXRRSET] = "YXRRSET",
- [DNS_RC_NXRRSET] = "NXRRSET",
- [DNS_RC_NOTAUTH] = "NOTAUTH",
- [DNS_RC_NOTZONE] = "NOTZONE",
-};
-
-const char *dns_strrcode(enum dns_rcode rcode) {
- rcode &= 0xf;
-
- if ('\0' == dns_rcodes[rcode][0])
- dns__printnul(dns_rcodes[rcode], sizeof dns_rcodes[rcode], dns__print10(dns_rcodes[rcode], sizeof dns_rcodes[rcode], 0, rcode, 0));
-
- return dns_rcodes[rcode];
-} /* dns_strrcode() */
-
-
-enum dns_rcode dns_ircode(const char *name) {
- unsigned rcode;
-
- for (rcode = 0; rcode < lengthof(dns_rcodes); rcode++) {
- if (!strcasecmp(name, dns_rcodes[rcode]))
- return rcode;
- }
-
- return lengthof(dns_rcodes) - 1;
-} /* dns_ircode() */
-
-
-/*
- * C O M M A N D - L I N E / R E G R E S S I O N R O U T I N E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#if DNS_MAIN
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <ctype.h>
-
-#if _WIN32
-#include <getopt.h>
-#endif
-
-#if !_WIN32
-#include <err.h>
-#endif
-
-
-struct {
- struct {
- const char *path[8];
- unsigned count;
- } resconf;
-
- struct {
- const char *path[8];
- unsigned count;
- } hosts;
-
- struct {
- const char *path[8];
- unsigned count;
- } cache;
-
- const char *qname;
- enum dns_type qtype;
-
- int (*sort)();
-
- int verbose;
-} MAIN = {
- .sort = &dns_rr_i_packet,
-};
-
-
-void hexdump(const unsigned char *src, size_t len, FILE *fp) {
- static const unsigned char hex[] = "0123456789abcdef";
- static const unsigned char tmpl[] = " | |\n";
- unsigned char ln[sizeof tmpl];
- const unsigned char *sp, *se;
- unsigned char *h, *g;
- unsigned i, n;
-
- sp = src;
- se = sp + len;
-
- while (sp < se) {
- memcpy(ln, tmpl, sizeof ln);
-
- h = &ln[2];
- g = &ln[53];
-
- for (n = 0; n < 2; n++) {
- for (i = 0; i < 8 && se - sp > 0; i++, sp++) {
- h[0] = hex[0x0f & (*sp >> 4)];
- h[1] = hex[0x0f & (*sp >> 0)];
- h += 3;
-
- *g++ = (isgraph(*sp))? *sp : '.';
- }
-
- h++;
- }
-
- fputs((char *)ln, fp);
- }
-
- return /* void */;
-} /* hexdump() */
-
-
-static void panic(const char *fmt, ...) {
- va_list ap;
-
- va_start(ap, fmt);
-
-#if _WIN32
- vfprintf(stderr, fmt, ap);
-
- exit(EXIT_FAILURE);
-#else
- verrx(EXIT_FAILURE, fmt, ap);
-#endif
-} /* panic() */
-
-#define panic_(fn, ln, fmt, ...) \
- panic(fmt "%0s", (fn), (ln), __VA_ARGS__)
-#define panic(...) \
- panic_(__func__, __LINE__, "(%s:%d) " __VA_ARGS__, "")
-
-
-static void *grow(unsigned char *p, size_t size) {
- void *tmp;
-
- if (!(tmp = realloc(p, size)))
- panic("realloc(%zu): %s", size, dns_strerror(errno));
-
- return tmp;
-} /* grow() */
-
-
-static size_t add(size_t a, size_t b) {
- if (~a < b)
- panic("%zu + %zu: integer overflow", a, b);
-
- return a + b;
-} /* add() */
-
-
-static size_t append(unsigned char **dst, size_t osize, const void *src, size_t len) {
- size_t size = add(osize, len);
-
- *dst = grow(*dst, size);
- memcpy(*dst + osize, src, len);
-
- return size;
-} /* append() */
-
-
-static size_t slurp(unsigned char **dst, size_t osize, FILE *fp, const char *path) {
- size_t size = osize;
- unsigned char buf[1024];
- size_t count;
-
- while ((count = fread(buf, 1, sizeof buf, fp)))
- size = append(dst, size, buf, count);
-
- if (ferror(fp))
- panic("%s: %s", path, dns_strerror(errno));
-
- return size;
-} /* slurp() */
-
-
-static struct dns_resolv_conf *resconf(void) {
- static struct dns_resolv_conf *resconf;
- const char *path;
- unsigned i;
- int error;
-
- if (resconf)
- return resconf;
-
- if (!(resconf = dns_resconf_open(&error)))
- panic("dns_resconf_open: %s", dns_strerror(error));
-
- if (!MAIN.resconf.count)
- MAIN.resconf.path[MAIN.resconf.count++] = "/etc/resolv.conf";
-
- for (i = 0; i < MAIN.resconf.count; i++) {
- path = MAIN.resconf.path[i];
-
- if (0 == strcmp(path, "-"))
- error = dns_resconf_loadfile(resconf, stdin);
- else
- error = dns_resconf_loadpath(resconf, path);
-
- if (error)
- panic("%s: %s", path, dns_strerror(error));
- }
-
- return resconf;
-} /* resconf() */
-
-
-static struct dns_hosts *hosts(void) {
- static struct dns_hosts *hosts;
- const char *path;
- unsigned i;
- int error;
-
- if (hosts)
- return hosts;
-
- if (!MAIN.hosts.count) {
- MAIN.hosts.path[MAIN.hosts.count++] = "/etc/hosts";
-
- /* Explicitly test dns_hosts_local() */
- if (!(hosts = dns_hosts_local(&error)))
- panic("%s: %s", "/etc/hosts", dns_strerror(error));
-
- return hosts;
- }
-
- if (!(hosts = dns_hosts_open(&error)))
- panic("dns_hosts_open: %s", dns_strerror(error));
-
- for (i = 0; i < MAIN.hosts.count; i++) {
- path = MAIN.hosts.path[i];
-
- if (0 == strcmp(path, "-"))
- error = dns_hosts_loadfile(hosts, stdin);
- else
- error = dns_hosts_loadpath(hosts, path);
-
- if (error)
- panic("%s: %s", path, dns_strerror(error));
- }
-
- return hosts;
-} /* hosts() */
-
-
-#if DNS_CACHE
-#include "cache.h"
-
-struct dns_cache *cache(void) {
- static struct cache *cache;
- const char *path;
- unsigned i;
- int error;
-
- if (cache)
- return cache_resi(cache);
- if (!MAIN.cache.count)
- return NULL;
-
- if (!(cache = cache_open(&error)))
- panic("%s: %s", MAIN.cache.path[0], dns_strerror(error));
-
- for (i = 0; i < MAIN.cache.count; i++) {
- path = MAIN.cache.path[i];
-
- if (!strcmp(path, "-")) {
- if ((error = cache_loadfile(cache, stdin, NULL, 0)))
- panic("%s: %s", path, dns_strerror(error));
- } else if ((error = cache_loadpath(cache, path, NULL, 0)))
- panic("%s: %s", path, dns_strerror(error));
- }
-
- return cache_resi(cache);
-} /* cache() */
-#else
-struct dns_cache *cache(void) { return NULL; }
-#endif
-
-
-static void print_packet(struct dns_packet *P, FILE *fp) {
- dns_p_dump3(P, dns_rr_i_new(P, .sort = MAIN.sort), fp);
-
- if (MAIN.verbose > 2)
- hexdump(P->data, P->end, fp);
-} /* print_packet() */
-
-
-static int parse_packet(int argc, char *argv[]) {
- struct dns_packet *P = dns_p_new(512);
- struct dns_packet *Q = dns_p_new(512);
- enum dns_section section;
- struct dns_rr rr;
- int error;
- union dns_any any;
- char pretty[sizeof any * 2];
- size_t len;
-
- P->end = fread(P->data, 1, P->size, stdin);
-
- fputs(";; [HEADER]\n", stdout);
- fprintf(stdout, ";; qr : %s(%d)\n", (dns_header(P)->qr)? "QUERY" : "RESPONSE", dns_header(P)->qr);
- fprintf(stdout, ";; opcode : %s(%d)\n", dns_stropcode(dns_header(P)->opcode), dns_header(P)->opcode);
- fprintf(stdout, ";; aa : %s(%d)\n", (dns_header(P)->aa)? "AUTHORITATIVE" : "NON-AUTHORITATIVE", dns_header(P)->aa);
- fprintf(stdout, ";; tc : %s(%d)\n", (dns_header(P)->tc)? "TRUNCATED" : "NOT-TRUNCATED", dns_header(P)->tc);
- fprintf(stdout, ";; rd : %s(%d)\n", (dns_header(P)->rd)? "RECURSION-DESIRED" : "RECURSION-NOT-DESIRED", dns_header(P)->rd);
- fprintf(stdout, ";; ra : %s(%d)\n", (dns_header(P)->ra)? "RECURSION-ALLOWED" : "RECURSION-NOT-ALLOWED", dns_header(P)->ra);
- fprintf(stdout, ";; rcode : %s(%d)\n", dns_strrcode(dns_header(P)->rcode), dns_header(P)->rcode);
-
- section = 0;
-
- dns_rr_foreach(&rr, P, .sort = MAIN.sort) {
- if (section != rr.section)
- fprintf(stdout, "\n;; [%s:%d]\n", dns_strsection(rr.section), dns_p_count(P, rr.section));
-
- if ((len = dns_rr_print(pretty, sizeof pretty, &rr, P, &error)))
- fprintf(stdout, "%s\n", pretty);
-
- dns_rr_copy(Q, &rr, P);
-
- section = rr.section;
- }
-
- fputs("; ; ; ; ; ; ; ;\n\n", stdout);
-
- section = 0;
-
-#if 0
- dns_rr_foreach(&rr, Q, .name = "ns8.yahoo.com.") {
-#else
- struct dns_rr rrset[32];
- struct dns_rr_i *rri = dns_rr_i_new(Q, .name = dns_d_new("ns8.yahoo.com", DNS_D_ANCHOR), .sort = MAIN.sort);
- unsigned rrcount = dns_rr_grep(rrset, lengthof(rrset), rri, Q, &error);
- unsigned i;
-
- for (i = 0; i < rrcount; i++) {
- rr = rrset[i];
-#endif
- if (section != rr.section)
- fprintf(stdout, "\n;; [%s:%d]\n", dns_strsection(rr.section), dns_p_count(Q, rr.section));
-
- if ((len = dns_rr_print(pretty, sizeof pretty, &rr, Q, &error)))
- fprintf(stdout, "%s\n", pretty);
-
- section = rr.section;
- }
-
- if (MAIN.verbose > 1) {
- fprintf(stderr, "orig:%zu\n", P->end);
- hexdump(P->data, P->end, stdout);
-
- fprintf(stderr, "copy:%zu\n", Q->end);
- hexdump(Q->data, Q->end, stdout);
- }
-
- return 0;
-} /* parse_packet() */
-
-
-static int parse_domain(int argc, char *argv[]) {
- char *dn;
-
- dn = (argc > 1)? argv[1] : "f.l.google.com";
-
- printf("[%s]\n", dn);
-
- dn = dns_d_new(dn);
-
- do {
- puts(dn);
- } while (dns_d_cleave(dn, strlen(dn) + 1, dn, strlen(dn)));
-
- return 0;
-} /* parse_domain() */
-
-
-static int expand_domain(int argc, char *argv[]) {
- unsigned short rp = 0;
- unsigned char *src = NULL;
- unsigned char *dst;
- struct dns_packet *pkt;
- size_t lim = 0, len;
- int error;
-
- if (argv[1])
- rp = atoi(argv[1]);
-
- len = slurp(&src, 0, stdin, "-");
-
- if (!(pkt = dns_p_make(len, &error)))
- panic("malloc(%zu): %s", len, dns_strerror(error));
-
- memcpy(pkt->data, src, len);
- pkt->end = len;
-
- lim = 1;
- dst = grow(NULL, lim);
-
- while (lim <= (len = dns_d_expand(dst, lim, rp, pkt, &error))) {
- lim = add(len, 1);
- dst = grow(dst, lim);
- }
-
- if (!len)
- panic("expand: %s", dns_strerror(error));
-
- fwrite(dst, 1, len, stdout);
- fflush(stdout);
-
- free(src);
- free(dst);
- free(pkt);
-
- return 0;
-} /* expand_domain() */
-
-
-static int show_resconf(int argc, char *argv[]) {
- unsigned i;
-
- resconf(); /* load it */
-
- fputs("; SOURCES\n", stdout);
-
- for (i = 0; i < MAIN.resconf.count; i++)
- fprintf(stdout, "; %s\n", MAIN.resconf.path[i]);
-
- fputs(";\n", stdout);
-
- dns_resconf_dump(resconf(), stdout);
-
- return 0;
-} /* show_resconf() */
-
-
-static int show_hosts(int argc, char *argv[]) {
- unsigned i;
-
- hosts();
-
- fputs("# SOURCES\n", stdout);
-
- for (i = 0; i < MAIN.hosts.count; i++)
- fprintf(stdout, "# %s\n", MAIN.hosts.path[i]);
-
- fputs("#\n", stdout);
-
- dns_hosts_dump(hosts(), stdout);
-
- return 0;
-} /* show_hosts() */
-
-
-static int query_hosts(int argc, char *argv[]) {
- struct dns_packet *Q = dns_p_new(512);
- struct dns_packet *A;
- char qname[DNS_D_MAXNAME + 1];
- size_t qlen;
- int error;
-
- if (!MAIN.qname)
- MAIN.qname = (argc > 1)? argv[1] : "localhost";
- if (!MAIN.qtype)
- MAIN.qtype = DNS_T_A;
-
- hosts();
-
- if (MAIN.qtype == DNS_T_PTR && !strstr(MAIN.qname, "arpa")) {
- union { struct in_addr a; struct in6_addr a6; } addr;
- int af = (strchr(MAIN.qname, ':'))? AF_INET6 : AF_INET;
-
- if (1 != dns_inet_pton(af, MAIN.qname, &addr))
- panic("%s: %s", MAIN.qname, dns_strerror(error));
-
- qlen = dns_ptr_qname(qname, sizeof qname, af, &addr);
- } else
- qlen = dns__printstring(qname, sizeof qname, 0, MAIN.qname);
-
- if ((error = dns_p_push(Q, DNS_S_QD, qname, qlen, MAIN.qtype, DNS_C_IN, 0, 0)))
- panic("%s: %s", qname, dns_strerror(error));
-
- if (!(A = dns_hosts_query(hosts(), Q, &error)))
- panic("%s: %s", qname, dns_strerror(error));
-
- print_packet(A, stdout);
-
- free(A);
-
- return 0;
-} /* query_hosts() */
-
-
-static int search_list(int argc, char *argv[]) {
- const char *qname = (argc > 1)? argv[1] : "f.l.google.com";
- unsigned long i = 0;
- char name[DNS_D_MAXNAME + 1];
-
- printf("[%s]\n", qname);
-
- while (dns_resconf_search(name, sizeof name, qname, strlen(qname), resconf(), &i))
- puts(name);
-
- return 0;
-} /* search_list() */
-
-
-int permute_set(int argc, char *argv[]) {
- unsigned lo, hi, i;
- struct dns_k_permutor p;
-
- hi = (--argc > 0)? atoi(argv[argc]) : 8;
- lo = (--argc > 0)? atoi(argv[argc]) : 0;
-
- fprintf(stderr, "[%u .. %u]\n", lo, hi);
-
- dns_k_permutor_init(&p, lo, hi);
-
- for (i = lo; i <= hi; i++)
- fprintf(stdout, "%u\n", dns_k_permutor_step(&p));
-// printf("%u -> %u -> %u\n", i, dns_k_permutor_E(&p, i), dns_k_permutor_D(&p, dns_k_permutor_E(&p, i)));
-
- return 0;
-} /* permute_set() */
-
-
-int shuffle_16(int argc, char *argv[]) {
- unsigned n, r;
-
- if (--argc > 0) {
- n = 0xffff & atoi(argv[argc]);
- r = (--argc > 0)? (unsigned)atoi(argv[argc]) : dns_random();
-
- fprintf(stdout, "%hu\n", dns_k_shuffle16(n, r));
- } else {
- r = dns_random();
-
- for (n = 0; n < 65536; n++)
- fprintf(stdout, "%hu\n", dns_k_shuffle16(n, r));
- }
-
- return 0;
-} /* shuffle_16() */
-
-
-int dump_random(int argc, char *argv[]) {
- unsigned char b[32];
- unsigned i, j, n, r;
-
- n = (argc > 1)? atoi(argv[1]) : 32;
-
- while (n) {
- i = 0;
-
- do {
- r = dns_random();
-
- for (j = 0; j < sizeof r && i < n && i < sizeof b; i++, j++) {
- b[i] = 0xff & r;
- r >>= 8;
- }
- } while (i < n && i < sizeof b);
-
- hexdump(b, i, stdout);
-
- n -= i;
- }
-
- return 0;
-} /* dump_random() */
-
-
-static int send_query(int argc, char *argv[]) {
- struct dns_packet *A, *Q = dns_p_new(512);
- char host[INET6_ADDRSTRLEN + 1];
- struct sockaddr_storage ss;
- struct dns_socket *so;
- int error, type;
-
- if (argc > 1) {
- ss.ss_family = (strchr(argv[1], ':'))? AF_INET6 : AF_INET;
-
- if (1 != dns_inet_pton(ss.ss_family, argv[1], dns_sa_addr(ss.ss_family, &ss)))
- panic("%s: invalid host address", argv[1]);
-
- *dns_sa_port(ss.ss_family, &ss) = htons(53);
- } else
- memcpy(&ss, &resconf()->nameserver[0], dns_sa_len(&resconf()->nameserver[0]));
-
- if (!dns_inet_ntop(ss.ss_family, dns_sa_addr(ss.ss_family, &ss), host, sizeof host))
- panic("bad host address, or none provided");
-
- if (!MAIN.qname)
- MAIN.qname = "ipv6.google.com";
- if (!MAIN.qtype)
- MAIN.qtype = DNS_T_AAAA;
-
- if ((error = dns_p_push(Q, DNS_S_QD, MAIN.qname, strlen(MAIN.qname), MAIN.qtype, DNS_C_IN, 0, 0)))
- panic("dns_p_push: %s", dns_strerror(error));
-
- dns_header(Q)->rd = 1;
-
- if (strstr(argv[0], "udp"))
- type = SOCK_DGRAM;
- else if (strstr(argv[0], "tcp"))
- type = SOCK_STREAM;
- else
- type = dns_res_tcp2type(resconf()->options.tcp);
-
- fprintf(stderr, "querying %s for %s IN %s\n", host, MAIN.qname, dns_strtype(MAIN.qtype));
-
- if (!(so = dns_so_open((struct sockaddr *)&resconf()->iface, type, dns_opts(), &error)))
- panic("dns_so_open: %s", dns_strerror(error));
-
- while (!(A = dns_so_query(so, Q, (struct sockaddr *)&ss, &error))) {
- if (error != EAGAIN)
- panic("dns_so_query: %s (%d)", dns_strerror(error), error);
- if (dns_so_elapsed(so) > 10)
- panic("query timed-out");
-
- dns_so_poll(so, 1);
- }
-
- print_packet(A, stdout);
-
- dns_so_close(so);
-
- return 0;
-} /* send_query() */
-
-
-static int print_arpa(int argc, char *argv[]) {
- const char *ip = (argc > 1)? argv[1] : "::1";
- int af = (strchr(ip, ':'))? AF_INET6 : AF_INET;
- union { struct in_addr a4; struct in6_addr a6; } addr;
- char host[DNS_D_MAXNAME + 1];
-
- if (1 != dns_inet_pton(af, ip, &addr) || 0 == dns_ptr_qname(host, sizeof host, af, &addr))
- panic("%s: invalid address", ip);
-
- fprintf(stdout, "%s\n", host);
-
- return 0;
-} /* print_arpa() */
-
-
-static int show_hints(int argc, char *argv[]) {
- struct dns_hints *(*load)(struct dns_resolv_conf *, int *);
- const char *which, *how, *who;
- struct dns_hints *hints;
- int error;
-
- which = (argc > 1)? argv[1] : "local";
- how = (argc > 2)? argv[2] : "plain";
- who = (argc > 3)? argv[3] : "google.com";
-
- load = (0 == strcmp(which, "local"))
- ? &dns_hints_local
- : &dns_hints_root;
-
- if (!(hints = load(resconf(), &error)))
- panic("%s: %s", argv[0], dns_strerror(error));
-
- if (0 == strcmp(how, "plain")) {
- dns_hints_dump(hints, stdout);
- } else {
- struct dns_packet *query, *answer;
-
- query = dns_p_new(512);
-
- if ((error = dns_p_push(query, DNS_S_QUESTION, who, strlen(who), DNS_T_A, DNS_C_IN, 0, 0)))
- panic("%s: %s", who, dns_strerror(error));
-
- if (!(answer = dns_hints_query(hints, query, &error)))
- panic("%s: %s", who, dns_strerror(error));
-
- print_packet(answer, stdout);
-
- free(answer);
- }
-
- dns_hints_close(hints);
-
- return 0;
-} /* show_hints() */
-
-
-static int resolve_query(int argc, char *argv[]) {
- struct dns_hints *(*hints)() = (strstr(argv[0], "recurse"))? &dns_hints_root : &dns_hints_local;
- struct dns_resolver *R;
- struct dns_packet *ans;
- const struct dns_stat *st;
- int error;
-
- if (!MAIN.qname)
- MAIN.qname = "www.google.com";
- if (!MAIN.qtype)
- MAIN.qtype = DNS_T_A;
-
- resconf()->options.recurse = (0 != strstr(argv[0], "recurse"));
-
- if (!(R = dns_res_open(resconf(), hosts(), dns_hints_mortal(hints(resconf(), &error)), cache(), dns_opts(), &error)))
- panic("%s: %s", MAIN.qname, dns_strerror(error));
-
- if ((error = dns_res_submit(R, MAIN.qname, MAIN.qtype, DNS_C_IN)))
- panic("%s: %s", MAIN.qname, dns_strerror(error));
-
- while ((error = dns_res_check(R))) {
- if (error != EAGAIN)
- panic("dns_res_check: %s (%d)", dns_strerror(error), error);
- if (dns_res_elapsed(R) > 30)
- panic("query timed-out");
-
- dns_res_poll(R, 1);
- }
-
- ans = dns_res_fetch(R, &error);
- print_packet(ans, stdout);
- free(ans);
-
- st = dns_res_stat(R);
- putchar('\n');
- printf(";; queries: %zu\n", st->queries);
- printf(";; udp sent: %zu in %zu bytes\n", st->udp.sent.count, st->udp.sent.bytes);
- printf(";; udp rcvd: %zu in %zu bytes\n", st->udp.rcvd.count, st->udp.rcvd.bytes);
- printf(";; tcp sent: %zu in %zu bytes\n", st->tcp.sent.count, st->tcp.sent.bytes);
- printf(";; tcp rcvd: %zu in %zu bytes\n", st->tcp.rcvd.count, st->tcp.rcvd.bytes);
-
- dns_res_close(R);
-
- return 0;
-} /* resolve_query() */
-
-
-static int resolve_addrinfo(int argc, char *argv[]) {
- struct dns_hints *(*hints)() = (strstr(argv[0], "recurse"))? &dns_hints_root : &dns_hints_local;
- struct dns_resolver *res = 0;
- struct dns_addrinfo *ai = 0;
- struct addrinfo ai_hints = { .ai_family = PF_UNSPEC, .ai_socktype = SOCK_STREAM, .ai_flags = AI_CANONNAME };
- struct addrinfo *ent;
- char pretty[512];
- int error;
-
- if (!MAIN.qname)
- MAIN.qname = "www.google.com";
- if (!MAIN.qtype)
- MAIN.qtype = DNS_T_A;
-
- resconf()->options.recurse = (0 != strstr(argv[0], "recurse"));
-
- if (!(res = dns_res_open(resconf(), hosts(), dns_hints_mortal(hints(resconf(), &error)), cache(), dns_opts(), &error)))
- panic("%s: %s", MAIN.qname, dns_strerror(error));
-
- if (!(ai = dns_ai_open(MAIN.qname, "80", MAIN.qtype, &ai_hints, res, &error)))
- panic("%s: %s", MAIN.qname, dns_strerror(error));
-
- do {
- switch (error = dns_ai_nextent(&ent, ai)) {
- case 0:
- dns_ai_print(pretty, sizeof pretty, ent, ai);
-
- fputs(pretty, stdout);
-
- free(ent);
-
- break;
- case ENOENT:
- break;
- case EAGAIN:
- if (dns_ai_elapsed(ai) > 30)
- panic("query timed-out");
-
- dns_ai_poll(ai, 1);
-
- break;
- default:
- panic("dns_ai_nextent: %s (%d)", dns_strerror(error), error);
- }
- } while (error != ENOENT);
-
- dns_res_close(res);
- dns_ai_close(ai);
-
- return 0;
-} /* resolve_addrinfo() */
-
-
-static int echo_port(int argc, char *argv[]) {
- union {
- struct sockaddr sa;
- struct sockaddr_in sin;
- } port;
- int fd;
-
- memset(&port, 0, sizeof port);
- port.sin.sin_family = AF_INET;
- port.sin.sin_port = htons(5354);
- port.sin.sin_addr.s_addr = inet_addr("127.0.0.1");
-
- if (-1 == (fd = socket(PF_INET, SOCK_DGRAM, 0)))
- panic("socket: %s", strerror(errno));
-
- if (0 != bind(fd, &port.sa, sizeof port.sa))
- panic("127.0.0.1:5353: %s", dns_strerror(errno));
-
- for (;;) {
- struct dns_packet *pkt = dns_p_new(512);
- struct sockaddr_storage ss;
- socklen_t slen = sizeof ss;
- ssize_t count;
-#if defined(MSG_WAITALL) /* MinGW issue */
- int rflags = MSG_WAITALL;
-#else
- int rflags = 0;
-#endif
-
- count = recvfrom(fd, (char *)pkt->data, pkt->size, rflags, (struct sockaddr *)&ss, &slen);
-
-
- if (!count || count < 0)
- panic("recvfrom: %s", strerror(errno));
-
- pkt->end = count;
-
- dns_p_dump(pkt, stdout);
-
- (void)sendto(fd, (char *)pkt->data, pkt->end, 0, (struct sockaddr *)&ss, slen);
- }
-
- return 0;
-} /* echo_port() */
-
-
-static int isection(int argc, char *argv[]) {
- const char *name = (argv[1])? argv[1] : "";
- int type;
-
- type = dns_isection(name);
- name = dns_strsection(type);
-
- printf("%s (%d)\n", name, type);
-
- return 0;
-} /* isection() */
-
-
-static int iclass(int argc, char *argv[]) {
- const char *name = (argv[1])? argv[1] : "";
- int type;
-
- type = dns_iclass(name);
- name = dns_strclass(type);
-
- printf("%s (%d)\n", name, type);
-
- return 0;
-} /* iclass() */
-
-
-static int itype(int argc, char *argv[]) {
- const char *name = (argv[1])? argv[1] : "";
- int type;
-
- type = dns_itype(name);
- name = dns_strtype(type);
-
- printf("%s (%d)\n", name, type);
-
- return 0;
-} /* itype() */
-
-
-static int iopcode(int argc, char *argv[]) {
- const char *name = (argv[1])? argv[1] : "";
- int type;
-
- type = dns_iopcode(name);
- name = dns_stropcode(type);
-
- printf("%s (%d)\n", name, type);
-
- return 0;
-} /* iopcode() */
-
-
-static int ircode(int argc, char *argv[]) {
- const char *name = (argv[1])? argv[1] : "";
- int type;
-
- type = dns_ircode(name);
- name = dns_strrcode(type);
-
- printf("%s (%d)\n", name, type);
-
- return 0;
-} /* ircode() */
-
-
-#define SIZE1(x) { DNS_PP_STRINGIFY(x), sizeof (x) }
-#define SIZE2(x, ...) SIZE1(x), SIZE1(__VA_ARGS__)
-#define SIZE3(x, ...) SIZE1(x), SIZE2(__VA_ARGS__)
-#define SIZE4(x, ...) SIZE1(x), SIZE3(__VA_ARGS__)
-#define SIZE(...) DNS_PP_CALL(DNS_PP_XPASTE(SIZE, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
-
-static int sizes(int argc, char *argv[]) {
- static const struct { const char *name; size_t size; } type[] = {
- SIZE(struct dns_header, struct dns_packet, struct dns_rr, struct dns_rr_i),
- SIZE(struct dns_a, struct dns_aaaa, struct dns_mx, struct dns_ns),
- SIZE(struct dns_cname, struct dns_soa, struct dns_ptr, struct dns_srv),
- SIZE(struct dns_sshfp, struct dns_txt, union dns_any),
- SIZE(struct dns_resolv_conf, struct dns_hosts, struct dns_hints, struct dns_hints_i),
- SIZE(struct dns_options, struct dns_socket, struct dns_resolver, struct dns_addrinfo),
- SIZE(struct dns_cache),
- };
- unsigned i, max;
-
- for (i = 0, max = 0; i < lengthof(type); i++)
- max = MAX(max, strlen(type[i].name));
-
- for (i = 0; i < lengthof(type); i++)
- printf("%*s : %zu\n", max, type[i].name, type[i].size);
-
- return 0;
-} /* sizes() */
-
-
-static const struct { const char *cmd; int (*run)(); const char *help; } cmds[] = {
- { "parse-packet", &parse_packet, "parse binary packet from stdin" },
- { "parse-domain", &parse_domain, "anchor and iteratively cleave domain" },
- { "expand-domain", &expand_domain, "expand domain at offset NN in packet from stdin" },
- { "show-resconf", &show_resconf, "show resolv.conf data" },
- { "show-hosts", &show_hosts, "show hosts data" },
- { "query-hosts", &query_hosts, "query A, AAAA or PTR in hosts data" },
- { "search-list", &search_list, "generate query search list from domain" },
- { "permute-set", &permute_set, "generate random permutation -> (0 .. N or N .. M)" },
- { "shuffle-16", &shuffle_16, "simple 16-bit permutation" },
- { "dump-random", &dump_random, "generate random bytes" },
- { "send-query", &send_query, "send query to host" },
- { "send-query-udp", &send_query, "send udp query to host" },
- { "send-query-tcp", &send_query, "send tcp query to host" },
- { "print-arpa", &print_arpa, "print arpa. zone name of address" },
- { "show-hints", &show_hints, "print hints: show-hints [local|root] [plain|packet]" },
- { "resolve-stub", &resolve_query, "resolve as stub resolver" },
- { "resolve-recurse", &resolve_query, "resolve as recursive resolver" },
- { "addrinfo-stub", &resolve_addrinfo, "resolve through getaddrinfo clone" },
- { "addrinfo-recurse", &resolve_addrinfo, "resolve through getaddrinfo clone" },
-/* { "resolve-nameinfo", &resolve_query, "resolve as recursive resolver" }, */
- { "echo", &echo_port, "server echo mode, for nmap fuzzing" },
- { "isection", &isection, "parse section string" },
- { "iclass", &iclass, "parse class string" },
- { "itype", &itype, "parse type string" },
- { "iopcode", &iopcode, "parse opcode string" },
- { "ircode", &ircode, "parse rcode string" },
- { "sizes", &sizes, "print data structure sizes" },
-};
-
-
-static void print_usage(const char *progname, FILE *fp) {
- static const char *usage =
- " [OPTIONS] COMMAND [ARGS]\n"
- " -c PATH Path to resolv.conf\n"
- " -l PATH Path to local hosts\n"
- " -z PATH Path to zone cache\n"
- " -q QNAME Query name\n"
- " -t QTYPE Query type\n"
- " -s HOW Sort records\n"
- " -v Be more verbose (-vv show packets; -vvv hexdump packets)\n"
- " -V Print version info\n"
- " -h Print this usage message\n"
- "\n";
- unsigned i, n, m;
-
- fputs(progname, fp);
- fputs(usage, fp);
-
- for (i = 0, m = 0; i < lengthof(cmds); i++) {
- if (strlen(cmds[i].cmd) > m)
- m = strlen(cmds[i].cmd);
- }
-
- for (i = 0; i < lengthof(cmds); i++) {
- fprintf(fp, " %s ", cmds[i].cmd);
-
- for (n = strlen(cmds[i].cmd); n < m; n++)
- putc(' ', fp);
-
- fputs(cmds[i].help, fp);
- putc('\n', fp);
- }
-
- fputs("\nReport bugs to William Ahern <william@25thandClement.com>\n", fp);
-} /* print_usage() */
-
-
-static void print_version(const char *progname, FILE *fp) {
- fprintf(fp, "%s (dns.c) %.8X\n", progname, dns_v_rel());
- fprintf(fp, "vendor %s\n", dns_vendor());
- fprintf(fp, "release %.8X\n", dns_v_rel());
- fprintf(fp, "abi %.8X\n", dns_v_abi());
- fprintf(fp, "api %.8X\n", dns_v_api());
-} /* print_version() */
-
-
-int main(int argc, char **argv) {
- extern int optind;
- extern char *optarg;
- const char *progname = argv[0];
- unsigned i;
- int ch;
-
- while (-1 != (ch = getopt(argc, argv, "q:t:c:l:z:s:vVh"))) {
- switch (ch) {
- case 'c':
- assert(MAIN.resconf.count < lengthof(MAIN.resconf.path));
-
- MAIN.resconf.path[MAIN.resconf.count++] = optarg;
-
- break;
- case 'l':
- assert(MAIN.hosts.count < lengthof(MAIN.hosts.path));
-
- MAIN.hosts.path[MAIN.hosts.count++] = optarg;
-
- break;
- case 'z':
- assert(MAIN.cache.count < lengthof(MAIN.cache.path));
-
- MAIN.cache.path[MAIN.cache.count++] = optarg;
-
- break;
- case 'q':
- MAIN.qname = optarg;
-
- break;
- case 't':
- for (i = 0; i < lengthof(dns_rrtypes); i++) {
- if (0 == strcasecmp(dns_rrtypes[i].name, optarg))
- { MAIN.qtype = dns_rrtypes[i].type; break; }
- }
-
- if (MAIN.qtype)
- break;
-
- for (i = 0; isdigit((int)optarg[i]); i++) {
- MAIN.qtype *= 10;
- MAIN.qtype += optarg[i] - '0';
- }
-
- if (!MAIN.qtype)
- panic("%s: invalid query type", optarg);
-
- break;
- case 's':
- if (0 == strcasecmp(optarg, "packet"))
- MAIN.sort = &dns_rr_i_packet;
- else if (0 == strcasecmp(optarg, "shuffle"))
- MAIN.sort = &dns_rr_i_shuffle;
- else if (0 == strcasecmp(optarg, "order"))
- MAIN.sort = &dns_rr_i_order;
- else
- panic("%s: invalid sort method", optarg);
-
- break;
- case 'v':
- dns_debug = ++MAIN.verbose;
-
- break;
- case 'V':
- print_version(progname, stdout);
-
- return 0;
- case 'h':
- print_usage(progname, stdout);
-
- return 0;
- default:
- print_usage(progname, stderr);
-
- return EXIT_FAILURE;
- } /* switch() */
- } /* while() */
-
- argc -= optind;
- argv += optind;
-
- for (i = 0; i < lengthof(cmds) && argv[0]; i++) {
- if (0 == strcmp(cmds[i].cmd, argv[0]))
- return cmds[i].run(argc, argv);
- }
-
- print_usage(progname, stderr);
-
- return EXIT_FAILURE;
-} /* main() */
-
-
-#endif /* DNS_MAIN */
diff --git a/src/lib/ecore_con/dns.h b/src/lib/ecore_con/dns.h
deleted file mode 100644
index 2b7315f3..00000000
--- a/src/lib/ecore_con/dns.h
+++ /dev/null
@@ -1,1074 +0,0 @@
-/* ==========================================================================
- * dns.h - Recursive, Reentrant DNS Resolver.
- * --------------------------------------------------------------------------
- * Copyright (c) 2009, 2010 William Ahern
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- * ==========================================================================
- */
-#ifndef DNS_H
-#define DNS_H
-
-#include <stddef.h> /* size_t offsetof() */
-#include <stdio.h> /* FILE */
-
-#include <string.h> /* strlen(3) */
-
-#include <time.h> /* time_t */
-
-#if _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
-#include <sys/types.h> /* socklen_t */
-#include <sys/socket.h> /* struct socket */
-
-#include <poll.h> /* POLLIN POLLOUT */
-
-#include <netinet/in.h> /* struct in_addr struct in6_addr */
-
-#include <netdb.h> /* struct addrinfo */
-#endif
-
-
-/*
- * V E R S I O N
- *
- * Vendor: Entity for which versions numbers are relevant. (If forking
- * change DNS_VENDOR to avoid confusion.)
- *
- * Three versions:
- *
- * REL Official "release"--bug fixes, new features, etc.
- * ABI Changes to existing object sizes or parameter types.
- * API Changes that might effect application source.
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define DNS_VENDOR "william@25thandClement.com"
-
-#define DNS_V_REL 0x20110117
-#define DNS_V_ABI 0x20100709
-#define DNS_V_API 0x20100709
-
-
-const char *dns_vendor(void);
-
-int dns_v_rel(void);
-int dns_v_abi(void);
-int dns_v_api(void);
-
-
-/*
- * E R R O R S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-enum dns_errno {
- DNS_ENOBUFS = -(('d' << 24) | ('n' << 16) | ('s' << 8) | 64),
- DNS_EILLEGAL,
- DNS_EORDER,
- DNS_ESECTION,
- DNS_EUNKNOWN,
-}; /* dns_errno */
-
-const char *dns_strerror(int);
-
-extern int dns_debug;
-
-
-/*
- * E V E N T S I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#if defined(POLLIN)
-#define DNS_POLLIN POLLIN
-#else
-#define DNS_POLLIN 1
-#endif
-
-#if defined(POLLOUT)
-#define DNS_POLLOUT POLLOUT
-#else
-#define DNS_POLLOUT 2
-#endif
-
-
-/*
- * See Application Interface below for configuring libevent bitmasks instead
- * of poll(2) bitmasks.
- */
-#define DNS_EVREAD 2
-#define DNS_EVWRITE 4
-
-
-#define DNS_POLL2EV(set) \
- (((set) & DNS_POLLIN)? DNS_EVREAD : 0) | (((set) & DNS_POLLOUT)? DNS_EVWRITE : 0)
-
-#define DNS_EV2POLL(set) \
- (((set) & DNS_EVREAD)? DNS_POLLIN : 0) | (((set) & DNS_EVWRITE)? DNS_POLLOUT : 0)
-
-
-/*
- * E N U M E R A T I O N I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-enum dns_section {
- DNS_S_QD = 0x01,
-#define DNS_S_QUESTION DNS_S_QD
-
- DNS_S_AN = 0x02,
-#define DNS_S_ANSWER DNS_S_AN
-
- DNS_S_NS = 0x04,
-#define DNS_S_AUTHORITY DNS_S_NS
-
- DNS_S_AR = 0x08,
-#define DNS_S_ADDITIONAL DNS_S_AR
-
- DNS_S_ALL = 0x0f
-}; /* enum dns_section */
-
-
-enum dns_class {
- DNS_C_IN = 1,
-
- DNS_C_ANY = 255
-}; /* enum dns_class */
-
-
-enum dns_type {
- DNS_T_A = 1,
- DNS_T_NS = 2,
- DNS_T_CNAME = 5,
- DNS_T_SOA = 6,
- DNS_T_PTR = 12,
- DNS_T_MX = 15,
- DNS_T_TXT = 16,
- DNS_T_AAAA = 28,
- DNS_T_SRV = 33,
- DNS_T_SSHFP = 44,
- DNS_T_SPF = 99,
-
- DNS_T_ALL = 255
-}; /* enum dns_type */
-
-
-enum dns_opcode {
- DNS_OP_QUERY = 0,
- DNS_OP_IQUERY = 1,
- DNS_OP_STATUS = 2,
- DNS_OP_NOTIFY = 4,
- DNS_OP_UPDATE = 5,
-}; /* dns_opcode */
-
-
-enum dns_rcode {
- DNS_RC_NOERROR = 0,
- DNS_RC_FORMERR = 1,
- DNS_RC_SERVFAIL = 2,
- DNS_RC_NXDOMAIN = 3,
- DNS_RC_NOTIMP = 4,
- DNS_RC_REFUSED = 5,
- DNS_RC_YXDOMAIN = 6,
- DNS_RC_YXRRSET = 7,
- DNS_RC_NXRRSET = 8,
- DNS_RC_NOTAUTH = 9,
- DNS_RC_NOTZONE = 10,
-}; /* dns_rcode */
-
-
-/*
- * NOTE: These string functions need a small buffer in case the literal
- * integer value needs to be printed and returned. UNLESS this buffer is
- * SPECIFIED, the returned string has ONLY BLOCK SCOPE.
- */
-#define DNS_STRMAXLEN 47 /* "QUESTION|ANSWER|AUTHORITY|ADDITIONAL" */
-
-const char *dns_strsection(enum dns_section, void *, size_t);
-#define dns_strsection3(a, b, c) \
- dns_strsection((a), (b), (c))
-#define dns_strsection1(a) dns_strsection((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
-#define dns_strsection(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strsection, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
-
-enum dns_section dns_isection(const char *);
-
-const char *dns_strclass(enum dns_class, void *, size_t);
-#define dns_strclass3(a, b, c) dns_strclass((a), (b), (c))
-#define dns_strclass1(a) dns_strclass((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
-#define dns_strclass(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strclass, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
-
-enum dns_class dns_iclass(const char *);
-
-const char *dns_strtype(enum dns_type, void *, size_t);
-#define dns_strtype3(a, b, c) dns_strtype((a), (b), (c))
-#define dns_strtype1(a) dns_strtype((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
-#define dns_strtype(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strtype, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
-
-enum dns_type dns_itype(const char *);
-
-const char *dns_stropcode(enum dns_opcode);
-
-enum dns_opcode dns_iopcode(const char *);
-
-const char *dns_strrcode(enum dns_rcode);
-
-enum dns_rcode dns_ircode(const char *);
-
-
-/*
- * A T O M I C I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-typedef unsigned long dns_atomic_t;
-
-
-/*
- * C R Y P T O I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-extern unsigned (*dns_random)(void);
-
-
-/*
- * P A C K E T I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_header {
- unsigned qid:16;
-
-#if BYTE_ORDER == BIG_ENDIAN
- unsigned qr:1;
- unsigned opcode:4;
- unsigned aa:1;
- unsigned tc:1;
- unsigned rd:1;
-
- unsigned ra:1;
- unsigned unused:3;
- unsigned rcode:4;
-#else
- unsigned rd:1;
- unsigned tc:1;
- unsigned aa:1;
- unsigned opcode:4;
- unsigned qr:1;
-
- unsigned rcode:4;
- unsigned unused:3;
- unsigned ra:1;
-#endif
-
- unsigned qdcount:16;
- unsigned ancount:16;
- unsigned nscount:16;
- unsigned arcount:16;
-}; /* struct dns_header */
-
-#define dns_header(p) (&(p)->header)
-
-
-#ifndef DNS_P_QBUFSIZ
-#define DNS_P_QBUFSIZ dns_p_calcsize(256 + 4)
-#endif
-
-#ifndef DNS_P_DICTSIZE
-#define DNS_P_DICTSIZE 16
-#endif
-
-struct dns_packet {
- unsigned short dict[DNS_P_DICTSIZE];
-
- struct dns_s_memo {
- unsigned short base, end;
- } qd, an, ns, ar;
-
- struct { struct dns_packet *cqe_next, *cqe_prev; } cqe;
-
- size_t size, end;
-
- int:16; /* tcp padding */
-
- union {
- struct dns_header header;
- unsigned char data[1];
- };
-}; /* struct dns_packet */
-
-#define dns_p_calcsize(n) (offsetof(struct dns_packet, data) + DNS_PP_MAX(12, (n)))
-
-#define dns_p_sizeof(P) dns_p_calcsize((P)->end)
-
-/** takes size of maximum desired payload */
-#define dns_p_new(n) (dns_p_init((struct dns_packet *)&(union { unsigned char b[dns_p_calcsize((n))]; struct dns_packet p; }){ { 0 } }, dns_p_calcsize((n))))
-
-/** takes size of entire packet structure as allocated */
-struct dns_packet *dns_p_init(struct dns_packet *, size_t);
-
-/** takes size of maximum desired payload */
-struct dns_packet *dns_p_make(size_t, int *);
-
-int dns_p_grow(struct dns_packet **);
-
-struct dns_packet *dns_p_copy(struct dns_packet *, const struct dns_packet *);
-
-#define dns_p_opcode(P) (dns_header(P)->opcode)
-
-#define dns_p_rcode(P) (dns_header(P)->rcode)
-
-unsigned dns_p_count(struct dns_packet *, enum dns_section);
-
-int dns_p_push(struct dns_packet *, enum dns_section, const void *, size_t, enum dns_type, enum dns_class, unsigned, const void *);
-
-void dns_p_dictadd(struct dns_packet *, unsigned short);
-
-struct dns_packet *dns_p_merge(struct dns_packet *, enum dns_section, struct dns_packet *, enum dns_section, int *);
-
-void dns_p_dump(struct dns_packet *, FILE *);
-
-int dns_p_study(struct dns_packet *);
-
-
-/*
- * D O M A I N N A M E I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define DNS_D_MAXLABEL 63 /* + 1 '\0' */
-#define DNS_D_MAXNAME 255 /* + 1 '\0' */
-
-#define DNS_D_ANCHOR 1 /* anchor domain w/ root "." */
-#define DNS_D_CLEAVE 2 /* cleave sub-domain */
-#define DNS_D_TRIM 4 /* remove superfluous dots */
-
-#define dns_d_new3(a, b, f) dns_d_init(&(char[DNS_D_MAXNAME + 1]){ 0 }, DNS_D_MAXNAME + 1, (a), (b), (f))
-#define dns_d_new2(a, f) dns_d_new3((a), strlen((a)), (f))
-#define dns_d_new1(a) dns_d_new3((a), strlen((a)), DNS_D_ANCHOR)
-#define dns_d_new(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_d_new, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
-
-char *dns_d_init(void *, size_t, const void *, size_t, int);
-
-size_t dns_d_anchor(void *, size_t, const void *, size_t);
-
-size_t dns_d_cleave(void *, size_t, const void *, size_t);
-
-size_t dns_d_comp(void *, size_t, const void *, size_t, struct dns_packet *, int *);
-
-size_t dns_d_expand(void *, size_t, unsigned short, struct dns_packet *, int *);
-
-unsigned short dns_d_skip(unsigned short, struct dns_packet *);
-
-int dns_d_push(struct dns_packet *, const void *, size_t);
-
-size_t dns_d_cname(void *, size_t, const void *, size_t, struct dns_packet *, int *error);
-
-
-/*
- * R E S O U R C E R E C O R D I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_rr {
- enum dns_section section;
-
- struct {
- unsigned short p;
- unsigned short len;
- } dn;
-
- enum dns_type type;
- enum dns_class class;
- unsigned ttl;
-
- struct {
- unsigned short p;
- unsigned short len;
- } rd;
-}; /* struct dns_rr */
-
-
-int dns_rr_copy(struct dns_packet *, struct dns_rr *, struct dns_packet *);
-
-int dns_rr_parse(struct dns_rr *, unsigned short, struct dns_packet *);
-
-unsigned short dns_rr_skip(unsigned short, struct dns_packet *);
-
-int dns_rr_cmp(struct dns_rr *, struct dns_packet *, struct dns_rr *, struct dns_packet *);
-
-size_t dns_rr_print(void *, size_t, struct dns_rr *, struct dns_packet *, int *);
-
-
-#define dns_rr_i_new(P, ...) dns_rr_i_init(&(struct dns_rr_i){ 0, __VA_ARGS__ }, (P))
-
-struct dns_rr_i {
- enum dns_section section;
- const void *name;
- enum dns_type type;
- enum dns_class class;
- const void *data;
-
- int follow;
-
- int (*sort)();
- unsigned args[2];
-
- struct {
- unsigned short next;
- unsigned short count;
-
- unsigned exec;
- unsigned regs[2];
- } state, saved;
-}; /* struct dns_rr_i */
-
-int dns_rr_i_packet(struct dns_rr *, struct dns_rr *, struct dns_rr_i *, struct dns_packet *);
-
-int dns_rr_i_order(struct dns_rr *, struct dns_rr *, struct dns_rr_i *, struct dns_packet *);
-
-int dns_rr_i_shuffle(struct dns_rr *, struct dns_rr *, struct dns_rr_i *, struct dns_packet *);
-
-struct dns_rr_i *dns_rr_i_init(struct dns_rr_i *, struct dns_packet *);
-
-#define dns_rr_i_save(i) ((i)->saved = (i)->state)
-#define dns_rr_i_rewind(i) ((i)->state = (i)->saved)
-#define dns_rr_i_count(i) ((i)->state.count)
-
-unsigned dns_rr_grep(struct dns_rr *, unsigned, struct dns_rr_i *, struct dns_packet *, int *);
-
-#define dns_rr_foreach_(rr, P, ...) \
- for (struct dns_rr_i DNS_PP_XPASTE(i, __LINE__) = *dns_rr_i_new((P), __VA_ARGS__); dns_rr_grep((rr), 1, &DNS_PP_XPASTE(i, __LINE__), (P), &(int){ 0 }); )
-
-#define dns_rr_foreach(...) dns_rr_foreach_(__VA_ARGS__)
-
-
-/*
- * A R E S O U R C E R E C O R D
- */
-
-struct dns_a {
- struct in_addr addr;
-}; /* struct dns_a */
-
-int dns_a_parse(struct dns_a *, struct dns_rr *, struct dns_packet *);
-
-int dns_a_push(struct dns_packet *, struct dns_a *);
-
-int dns_a_cmp(const struct dns_a *, const struct dns_a *);
-
-size_t dns_a_print(void *, size_t, struct dns_a *);
-
-
-/*
- * AAAA R E S O U R C E R E C O R D
- */
-
-struct dns_aaaa {
- struct in6_addr addr;
-}; /* struct dns_aaaa */
-
-int dns_aaaa_parse(struct dns_aaaa *, struct dns_rr *, struct dns_packet *);
-
-int dns_aaaa_push(struct dns_packet *, struct dns_aaaa *);
-
-int dns_aaaa_cmp(const struct dns_aaaa *, const struct dns_aaaa *);
-
-size_t dns_aaaa_print(void *, size_t, struct dns_aaaa *);
-
-
-/*
- * MX R E S O U R C E R E C O R D
- */
-
-struct dns_mx {
- unsigned short preference;
- char host[DNS_D_MAXNAME + 1];
-}; /* struct dns_mx */
-
-int dns_mx_parse(struct dns_mx *, struct dns_rr *, struct dns_packet *);
-
-int dns_mx_push(struct dns_packet *, struct dns_mx *);
-
-int dns_mx_cmp(const struct dns_mx *, const struct dns_mx *);
-
-size_t dns_mx_print(void *, size_t, struct dns_mx *);
-
-size_t dns_mx_cname(void *, size_t, struct dns_mx *);
-
-
-/*
- * NS R E S O U R C E R E C O R D
- */
-
-struct dns_ns {
- char host[DNS_D_MAXNAME + 1];
-}; /* struct dns_ns */
-
-int dns_ns_parse(struct dns_ns *, struct dns_rr *, struct dns_packet *);
-
-int dns_ns_push(struct dns_packet *, struct dns_ns *);
-
-int dns_ns_cmp(const struct dns_ns *, const struct dns_ns *);
-
-size_t dns_ns_print(void *, size_t, struct dns_ns *);
-
-size_t dns_ns_cname(void *, size_t, struct dns_ns *);
-
-
-/*
- * CNAME R E S O U R C E R E C O R D
- */
-
-struct dns_cname {
- char host[DNS_D_MAXNAME + 1];
-}; /* struct dns_cname */
-
-int dns_cname_parse(struct dns_cname *, struct dns_rr *, struct dns_packet *);
-
-int dns_cname_push(struct dns_packet *, struct dns_cname *);
-
-int dns_cname_cmp(const struct dns_cname *, const struct dns_cname *);
-
-size_t dns_cname_print(void *, size_t, struct dns_cname *);
-
-size_t dns_cname_cname(void *, size_t, struct dns_cname *);
-
-
-/*
- * SOA R E S O U R C E R E C O R D
- */
-
-struct dns_soa {
- char mname[DNS_D_MAXNAME + 1];
- char rname[DNS_D_MAXNAME + 1];
- unsigned serial, refresh, retry, expire, minimum;
-}; /* struct dns_soa */
-
-int dns_soa_parse(struct dns_soa *, struct dns_rr *, struct dns_packet *);
-
-int dns_soa_push(struct dns_packet *, struct dns_soa *);
-
-int dns_soa_cmp(const struct dns_soa *, const struct dns_soa *);
-
-size_t dns_soa_print(void *, size_t, struct dns_soa *);
-
-
-/*
- * PTR R E S O U R C E R E C O R D
- */
-
-struct dns_ptr {
- char host[DNS_D_MAXNAME + 1];
-}; /* struct dns_ptr */
-
-int dns_ptr_parse(struct dns_ptr *, struct dns_rr *, struct dns_packet *);
-
-int dns_ptr_push(struct dns_packet *, struct dns_ptr *);
-
-int dns_ptr_cmp(const struct dns_ptr *, const struct dns_ptr *);
-
-size_t dns_ptr_print(void *, size_t, struct dns_ptr *);
-
-size_t dns_ptr_cname(void *, size_t, struct dns_ptr *);
-
-
-/*
- * SRV R E S O U R C E R E C O R D
- */
-
-struct dns_srv {
- unsigned short priority;
- unsigned short weight;
- unsigned short port;
- char target[DNS_D_MAXNAME + 1];
-}; /* struct dns_srv */
-
-int dns_srv_parse(struct dns_srv *, struct dns_rr *, struct dns_packet *);
-
-int dns_srv_push(struct dns_packet *, struct dns_srv *);
-
-int dns_srv_cmp(const struct dns_srv *, const struct dns_srv *);
-
-size_t dns_srv_print(void *, size_t, struct dns_srv *);
-
-size_t dns_srv_cname(void *, size_t, struct dns_srv *);
-
-
-/*
- * SSHFP R E S O U R C E R E C O R D
- */
-
-struct dns_sshfp {
- enum dns_sshfp_key {
- DNS_SSHFP_RSA = 1,
- DNS_SSHFP_DSA = 2,
- } algo;
-
- enum dns_sshfp_digest {
- DNS_SSHFP_SHA1 = 1,
- } type;
-
- union {
- unsigned char sha1[20];
- } digest;
-}; /* struct dns_sshfp */
-
-int dns_sshfp_parse(struct dns_sshfp *, struct dns_rr *, struct dns_packet *);
-
-int dns_sshfp_push(struct dns_packet *, struct dns_sshfp *);
-
-int dns_sshfp_cmp(const struct dns_sshfp *, const struct dns_sshfp *);
-
-size_t dns_sshfp_print(void *, size_t, struct dns_sshfp *);
-
-
-/*
- * TXT R E S O U R C E R E C O R D
- */
-
-#ifndef DNS_TXT_MINDATA
-#define DNS_TXT_MINDATA 1024
-#endif
-
-struct dns_txt {
- size_t size, len;
- unsigned char data[DNS_TXT_MINDATA];
-}; /* struct dns_txt */
-
-struct dns_txt *dns_txt_init(struct dns_txt *, size_t);
-
-int dns_txt_parse(struct dns_txt *, struct dns_rr *, struct dns_packet *);
-
-int dns_txt_push(struct dns_packet *, struct dns_txt *);
-
-int dns_txt_cmp(const struct dns_txt *, const struct dns_txt *);
-
-size_t dns_txt_print(void *, size_t, struct dns_txt *);
-
-
-/*
- * ANY R E S O U R C E R E C O R D
- */
-
-union dns_any {
- struct dns_a a;
- struct dns_aaaa aaaa;
- struct dns_mx mx;
- struct dns_ns ns;
- struct dns_cname cname;
- struct dns_soa soa;
- struct dns_ptr ptr;
- struct dns_srv srv;
- struct dns_sshfp sshfp;
- struct dns_txt txt, spf, rdata;
-}; /* union dns_any */
-
-#define DNS_ANY_INIT(any) { .rdata = { .size = sizeof *(any) } }
-
-union dns_any *dns_any_init(union dns_any *, size_t);
-
-int dns_any_parse(union dns_any *, struct dns_rr *, struct dns_packet *);
-
-int dns_any_push(struct dns_packet *, union dns_any *, enum dns_type);
-
-int dns_any_cmp(const union dns_any *, enum dns_type, const union dns_any *, enum dns_type);
-
-size_t dns_any_print(void *, size_t, union dns_any *, enum dns_type);
-
-size_t dns_any_cname(void *, size_t, union dns_any *, enum dns_type);
-
-
-/*
- * H O S T S I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_hosts;
-
-struct dns_hosts *dns_hosts_open(int *);
-
-void dns_hosts_close(struct dns_hosts *);
-
-unsigned dns_hosts_acquire(struct dns_hosts *);
-
-unsigned dns_hosts_release(struct dns_hosts *);
-
-struct dns_hosts *dns_hosts_mortal(struct dns_hosts *);
-
-struct dns_hosts *dns_hosts_local(int *);
-
-int dns_hosts_loadfile(struct dns_hosts *, FILE *);
-
-int dns_hosts_loadpath(struct dns_hosts *, const char *);
-
-int dns_hosts_dump(struct dns_hosts *, FILE *);
-
-int dns_hosts_insert(struct dns_hosts *, int, const void *, const void *, _Bool);
-
-struct dns_packet *dns_hosts_query(struct dns_hosts *, struct dns_packet *, int *);
-
-
-/*
- * R E S O L V . C O N F I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_resolv_conf {
- struct sockaddr_storage nameserver[3];
-
- char search[4][DNS_D_MAXNAME + 1];
-
- /* (f)ile, (b)ind, (c)ache */
- char lookup[3];
-
- struct {
- _Bool edns0;
-
- unsigned ndots;
-
- unsigned timeout;
-
- unsigned attempts;
-
- _Bool rotate;
-
- _Bool recurse;
-
- _Bool smart;
-
- enum {
- DNS_RESCONF_TCP_ENABLE,
- DNS_RESCONF_TCP_ONLY,
- DNS_RESCONF_TCP_DISABLE,
- } tcp;
- } options;
-
- struct sockaddr_storage iface;
-
- struct { /* PRIVATE */
- dns_atomic_t refcount;
- } _;
-}; /* struct dns_resolv_conf */
-
-struct dns_resolv_conf *dns_resconf_open(int *);
-
-void dns_resconf_close(struct dns_resolv_conf *);
-
-unsigned dns_resconf_acquire(struct dns_resolv_conf *);
-
-unsigned dns_resconf_release(struct dns_resolv_conf *);
-
-struct dns_resolv_conf *dns_resconf_mortal(struct dns_resolv_conf *);
-
-struct dns_resolv_conf *dns_resconf_local(int *);
-
-struct dns_resolv_conf *dns_resconf_root(int *);
-
-int dns_resconf_loadfile(struct dns_resolv_conf *, FILE *);
-
-int dns_resconf_loadpath(struct dns_resolv_conf *, const char *);
-
-int dns_resconf_dump(struct dns_resolv_conf *, FILE *);
-
-int dns_resconf_setiface(struct dns_resolv_conf *, const char *, unsigned short);
-
-typedef unsigned long dns_resconf_i_t;
-
-size_t dns_resconf_search(void *, size_t, const void *, size_t, struct dns_resolv_conf *, dns_resconf_i_t *);
-
-
-/*
- * H I N T S E R V E R I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_hints;
-
-struct dns_hints *dns_hints_open(struct dns_resolv_conf *, int *);
-
-void dns_hints_close(struct dns_hints *);
-
-unsigned dns_hints_acquire(struct dns_hints *);
-
-unsigned dns_hints_release(struct dns_hints *);
-
-struct dns_hints *dns_hints_mortal(struct dns_hints *);
-
-int dns_hints_insert(struct dns_hints *, const char *, const struct sockaddr *, unsigned);
-
-unsigned dns_hints_insert_resconf(struct dns_hints *, const char *, const struct dns_resolv_conf *, int *);
-
-struct dns_hints *dns_hints_local(struct dns_resolv_conf *, int *);
-
-struct dns_hints *dns_hints_root(struct dns_resolv_conf *, int *);
-
-
-struct dns_hints_i {
- const char *zone;
-
- struct {
- unsigned next;
- unsigned seed;
- } state;
-}; /* struct dns_hints_i */
-
-#define dns_hints_i_new(...) (&(struct dns_hints_i){ __VA_ARGS__ })
-
-unsigned dns_hints_grep(struct sockaddr **, socklen_t *, unsigned, struct dns_hints_i *, struct dns_hints *);
-
-
-/*
- * C A C H E I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_cache {
- void *state;
-
- dns_atomic_t (*acquire)(struct dns_cache *);
- dns_atomic_t (*release)(struct dns_cache *);
-
- struct dns_packet *(*query)(struct dns_packet *, struct dns_cache *, int *);
-
- int (*submit)(struct dns_packet *, struct dns_cache *);
- int (*check)(struct dns_cache *);
- struct dns_packet *(*fetch)(struct dns_cache *, int *);
-
- int (*pollfd)(struct dns_cache *);
- short (*events)(struct dns_cache *);
- void (*clear)(struct dns_cache *);
-
- union {
- long i;
- void *p;
- } arg[3];
-}; /* struct dns_cache */
-
-
-struct dns_cache *dns_cache_init(struct dns_cache *);
-
-void dns_cache_close(struct dns_cache *);
-
-
-/*
- * A P P L I C A T I O N I N T E R F A C E
- *
- * Options to change the behavior of the API. Applies across all the
- * different components.
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define DNS_OPTS_INITIALIZER_ { 0, 0 }, 0
-#define DNS_OPTS_INITIALIZER { DNS_OPTS_INITIALIZER_ }
-#define DNS_OPTS_INIT(...) { DNS_OPTS_INITIALIZER_, __VA_ARGS__ }
-
-#define dns_opts(...) (&(struct dns_options)DNS_OPTS_INIT(__VA_ARGS__))
-
-struct dns_options {
- /*
- * If the callback closes *fd, it must set it to -1. Otherwise, the
- * descriptor is queued and lazily closed at object destruction or
- * by an explicit call to _clear(). This allows safe use of
- * kqueue(2), epoll(2), et al -style persistent events.
- */
- struct {
- void *arg;
- int (*cb)(int *fd, void *arg);
- } closefd;
-
- /* bitmask for _events() routines */
- enum dns_events {
- DNS_SYSPOLL,
- DNS_LIBEVENT,
- } events;
-}; /* struct dns_options */
-
-
-/*
- * S T A T S I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_stat {
- size_t queries;
-
- struct {
- struct {
- size_t count, bytes;
- } sent, rcvd;
- } udp, tcp;
-}; /* struct dns_stat */
-
-
-/*
- * S O C K E T I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_socket;
-
-struct dns_socket *dns_so_open(const struct sockaddr *, int, const struct dns_options *, int *error);
-
-void dns_so_close(struct dns_socket *);
-
-void dns_so_reset(struct dns_socket *);
-
-unsigned short dns_so_mkqid(struct dns_socket *so);
-
-struct dns_packet *dns_so_query(struct dns_socket *, struct dns_packet *, struct sockaddr *, int *);
-
-int dns_so_submit(struct dns_socket *, struct dns_packet *, struct sockaddr *);
-
-int dns_so_check(struct dns_socket *);
-
-struct dns_packet *dns_so_fetch(struct dns_socket *, int *);
-
-time_t dns_so_elapsed(struct dns_socket *);
-
-void dns_so_clear(struct dns_socket *);
-
-int dns_so_events(struct dns_socket *);
-
-int dns_so_pollfd(struct dns_socket *);
-
-int dns_so_poll(struct dns_socket *, int);
-
-const struct dns_stat *dns_so_stat(struct dns_socket *);
-
-
-/*
- * R E S O L V E R I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_resolver;
-
-struct dns_resolver *dns_res_open(struct dns_resolv_conf *, struct dns_hosts *hosts, struct dns_hints *, struct dns_cache *, const struct dns_options *, int *);
-
-struct dns_resolver *dns_res_stub(const struct dns_options *, int *);
-
-void dns_res_reset(struct dns_resolver *);
-
-void dns_res_close(struct dns_resolver *);
-
-unsigned dns_res_acquire(struct dns_resolver *);
-
-unsigned dns_res_release(struct dns_resolver *);
-
-struct dns_resolver *dns_res_mortal(struct dns_resolver *);
-
-int dns_res_submit(struct dns_resolver *, const char *, enum dns_type, enum dns_class);
-
-int dns_res_check(struct dns_resolver *);
-
-struct dns_packet *dns_res_fetch(struct dns_resolver *, int *);
-
-time_t dns_res_elapsed(struct dns_resolver *);
-
-void dns_res_clear(struct dns_resolver *);
-
-int dns_res_events(struct dns_resolver *);
-
-int dns_res_pollfd(struct dns_resolver *);
-
-int dns_res_poll(struct dns_resolver *, int);
-
-struct dns_packet *dns_res_query(struct dns_resolver *, const char *, enum dns_type, enum dns_class, int, int *);
-
-const struct dns_stat *dns_res_stat(struct dns_resolver *);
-
-
-/*
- * A D D R I N F O I N T E R F A C E
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-struct dns_addrinfo;
-
-struct dns_addrinfo *dns_ai_open(const char *, const char *, enum dns_type, const struct addrinfo *, struct dns_resolver *, int *);
-
-void dns_ai_close(struct dns_addrinfo *);
-
-int dns_ai_nextent(struct addrinfo **, struct dns_addrinfo *);
-
-size_t dns_ai_print(void *, size_t, struct addrinfo *, struct dns_addrinfo *);
-
-time_t dns_ai_elapsed(struct dns_addrinfo *);
-
-void dns_ai_clear(struct dns_addrinfo *);
-
-int dns_ai_events(struct dns_addrinfo *);
-
-int dns_ai_pollfd(struct dns_addrinfo *);
-
-int dns_ai_poll(struct dns_addrinfo *, int);
-
-const struct dns_stat *dns_ai_stat(struct dns_addrinfo *);
-
-void *dns_sa_addr(int af, void *sa);
-unsigned short *dns_sa_port(int af, void *sa);
-#if _WIN32
-const char *dns_inet_ntop(int af, const void *src, void *dst, unsigned long lim);
-#else
-#define dns_inet_pton(...) inet_pton(__VA_ARGS__)
-#define dns_inet_ntop(...) inet_ntop(__VA_ARGS__)
-#endif
-#define dns_sa_family(sa) (((struct sockaddr *)(sa))->sa_family)
-/*
- * U T I L I T Y I N T E R F A C E S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-size_t dns_strlcpy(char *, const char *, size_t);
-
-size_t dns_strlcat(char *, const char *, size_t);
-
-
-/*
- * M A C R O M A G I C S
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define DNS_PP_MAX(a, b) (((a) > (b))? (a) : (b))
-#define DNS_PP_NARG_(a, b, c, d, e, f, g, h, i, j, k, N,...) N
-#define DNS_PP_NARG(...) DNS_PP_NARG_(__VA_ARGS__, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
-#define DNS_PP_CALL(F, ...) F(__VA_ARGS__)
-#define DNS_PP_PASTE(x, y) x##y
-#define DNS_PP_XPASTE(x, y) DNS_PP_PASTE(x, y)
-#define DNS_PP_STRINGIFY_(s) #s
-#define DNS_PP_STRINGIFY(s) DNS_PP_STRINGIFY_(s)
-#define DNS_PP_D1 0
-#define DNS_PP_D2 1
-#define DNS_PP_D3 2
-#define DNS_PP_D4 3
-#define DNS_PP_D5 4
-#define DNS_PP_D6 5
-#define DNS_PP_D7 6
-#define DNS_PP_D8 7
-#define DNS_PP_D9 8
-#define DNS_PP_D10 9
-#define DNS_PP_D11 10
-#define DNS_PP_DEC(N) DNS_PP_XPASTE(DNS_PP_D, N)
-
-#endif /* DNS_H */
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index c9d2d9e6..fe834786 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -444,14 +444,13 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
svr->data = (void *)data;
svr->created = EINA_FALSE;
svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
- svr->disable_proxy = (compl_type & ECORE_CON_SUPER_SSL & ECORE_CON_NO_PROXY) == ECORE_CON_NO_PROXY;
svr->reject_excess_clients = EINA_FALSE;
svr->clients = NULL;
svr->client_limit = -1;
type = compl_type & ECORE_CON_TYPE;
- if ((!svr->disable_proxy) && (type > ECORE_CON_LOCAL_ABSTRACT))
+ if (type > ECORE_CON_LOCAL_ABSTRACT)
{
/* never use proxies on local connections */
if (_ecore_con_proxy_once)
@@ -1316,7 +1315,6 @@ _ecore_con_client_free(Ecore_Con_Client *cl)
break;
}
}
- cl->host_server->clients = eina_list_remove(cl->host_server->clients, cl);
#ifdef _WIN32
ecore_con_local_win32_client_del(cl);
@@ -2384,7 +2382,7 @@ _ecore_con_event_client_del_free(Ecore_Con_Server *svr,
_ecore_con_server_free(svr);
}
if (!e->client->event_count)
- _ecore_con_client_free(e->client);
+ ecore_con_client_del(e->client);
}
ecore_con_event_client_del_free(e);
_ecore_con_event_count--;
diff --git a/src/lib/ecore_con/ecore_con_alloc.c b/src/lib/ecore_con/ecore_con_alloc.c
index 68f24ccb..d922f204 100644
--- a/src/lib/ecore_con/ecore_con_alloc.c
+++ b/src/lib/ecore_con/ecore_con_alloc.c
@@ -69,7 +69,7 @@ ecore_con_mempool_init(void)
for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
{
retry:
- mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 16);
+ mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
if (!mempool_array[i]->mp)
{
if (strcmp(choice, "pass_through") != 0)
diff --git a/src/lib/ecore_con/ecore_con_dns.c b/src/lib/ecore_con/ecore_con_dns.c
deleted file mode 100644
index 979163fa..00000000
--- a/src/lib/ecore_con/ecore_con_dns.c
+++ /dev/null
@@ -1,340 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/*
- * This version of ecore_con_info uses dns.c to provide asynchronous dns lookup.
- *
- * dns.c is written by William Ahern:
- * http://25thandclement.com/~william/projects/dns.c.html
- */
-
-#include <string.h>
-#include <sys/types.h>
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-#ifdef HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-
-#ifdef HAVE_ERRNO_H
-# include <errno.h>
-#endif
-
-#include "dns.h"
-
-#include "Ecore.h"
-#include "Ecore_Con.h"
-#include "ecore_con_private.h"
-
-typedef struct dns_addrinfo dns_addrinfo;
-typedef struct dns_resolv_conf dns_resolv_conf;
-typedef struct dns_resolver dns_resolver;
-typedef struct dns_hosts dns_hosts;
-
-typedef struct _Ecore_Con_DNS Ecore_Con_DNS;
-
-struct _Ecore_Con_DNS
-{
- Ecore_Con_Server *svr;
- Ecore_Con_Info_Cb done_cb;
- void *data;
- dns_addrinfo *ai;
- dns_resolver *resolv;
- struct addrinfo hints;
- Ecore_Fd_Handler *fdh;
- Ecore_Timer *timer;
-};
-
-static int _ecore_con_dns_init = 0;
-static dns_resolv_conf *resconf = NULL;
-static dns_hosts *hosts = NULL;
-
-static void
-_ecore_con_dns_free(Ecore_Con_DNS *dns)
-{
- if (dns->svr->infos) dns->svr->infos = eina_list_remove(dns->svr->infos, dns);
- if (dns->timer) ecore_timer_del(dns->timer);
- if (dns->fdh) ecore_main_fd_handler_del(dns->fdh);
- dns_res_close(dns_res_mortal(dns->resolv));
- free(dns);
-}
-
-static Eina_Bool
-_dns_addrinfo_get(Ecore_Con_DNS *dns, const char *addr, int port)
-{
- int error = 0;
- char service[NI_MAXSERV];
-
- snprintf(service, sizeof(service), "%d", port);
- dns->ai = dns_ai_open(addr, service, DNS_T_A, (const struct addrinfo *)&dns->hints, dns->resolv, &error);
- return error;
-}
-
-static int
-_ecore_con_dns_check(Ecore_Con_DNS *dns)
-{
- struct addrinfo *ent = NULL;
- int error = 0;
-
- error = dns_ai_nextent(&ent, dns->ai);
-
- switch (error)
- {
- case 0:
- break;
- case EAGAIN:
- return 1;
- default:
- ERR("resolve failed: %s", dns_strerror(error));
- goto error;
- }
-
- {
- Ecore_Con_Info result = {0, .ip = {0}, .service = {0}};
-#if 0
- char pretty[512];
- dns_ai_print(pretty, sizeof(pretty), ent, dns->ai);
- printf("%s\n", pretty);
-#endif
- result.size = 0;
- dns_inet_ntop(dns_sa_family(ent->ai_addr), dns_sa_addr(dns_sa_family(ent->ai_addr), ent->ai_addr), result.ip, sizeof(result.ip));
- snprintf(result.service, sizeof(result.service), "%u", ntohs(*dns_sa_port(dns_sa_family(ent->ai_addr), ent->ai_addr)));
- memcpy(&result.info, ent, sizeof(result.info));
- if (dns->fdh) ecore_main_fd_handler_del(dns->fdh);
- dns->fdh = NULL;
- dns->done_cb(dns->data, &result);
- free(ent);
- _ecore_con_dns_free(dns);
- }
-
- return 0;
-error:
- dns->done_cb(dns->data, NULL);
- _ecore_con_dns_free(dns);
- return -1;
-}
-
-static Eina_Bool
-_dns_fd_cb(Ecore_Con_DNS *dns, Ecore_Fd_Handler *fdh __UNUSED__)
-{
- if (_ecore_con_dns_check(dns) != 1) return ECORE_CALLBACK_RENEW;
- if (ecore_main_fd_handler_fd_get(dns->fdh) != dns_ai_pollfd(dns->ai))
- {
- ecore_main_fd_handler_del(dns->fdh);
- dns->fdh = ecore_main_fd_handler_add(dns_ai_pollfd(dns->ai), dns_ai_events(dns->ai), (Ecore_Fd_Cb)_dns_fd_cb, dns, NULL, NULL);
- }
- else
- ecore_main_fd_handler_active_set(dns->fdh, dns_ai_events(dns->ai));
- return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool
-_dns_timer_cb(Ecore_Con_DNS *dns)
-{
- dns->done_cb(dns->data, NULL);
- _ecore_con_dns_free(dns);
- dns->timer = NULL;
- return EINA_FALSE;
-}
-
-int
-ecore_con_info_init(void)
-{
- int err;
- if (_ecore_con_dns_init) return ++_ecore_con_dns_init;
-
- resconf = dns_resconf_local(&err);
- if (!resconf)
- {
- ERR("resconf_open: %s", dns_strerror(err));
- return 0;
- }
- hosts = dns_hosts_local(&err);
- if (!hosts)
- {
- ERR("hosts_open: %s", dns_strerror(err));
- dns_resconf_close(resconf);
- resconf = NULL;
- return 0;
- }
- /* this is super slow don't do it */
- //resconf->options.recurse = 1;
- return ++_ecore_con_dns_init;
-}
-
-int
-ecore_con_info_shutdown(void)
-{
- if (!_ecore_con_dns_init) return 0;
- if (--_ecore_con_dns_init) return _ecore_con_dns_init;
- dns_resconf_close(resconf);
- resconf = NULL;
- dns_hosts_close(hosts);
- hosts = NULL;
- return 0;
-}
-
-void
-ecore_con_info_data_clear(void *info)
-{
- Ecore_Con_DNS *dns = info;
- if (dns) dns->data = NULL;
-}
-
-int
-ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
-{
- struct addrinfo hints;
-
- memset(&hints, 0, sizeof(struct addrinfo));
-#ifdef HAVE_IPV6
- hints.ai_family = AF_INET6;
-#else
- hints.ai_family = AF_INET;
-#endif
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME;
- hints.ai_protocol = IPPROTO_TCP;
-
- return ecore_con_info_get(svr, done_cb, data, &hints);
-}
-
-int
-ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
-{
- struct addrinfo hints;
-
- memset(&hints, 0, sizeof(struct addrinfo));
-#ifdef HAVE_IPV6
- hints.ai_family = AF_INET6;
-#else
- hints.ai_family = AF_INET;
-#endif
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_PASSIVE;
- hints.ai_protocol = IPPROTO_TCP;
-
- return ecore_con_info_get(svr, done_cb, data, &hints);
-}
-
-int
-ecore_con_info_udp_connect(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
-{
- struct addrinfo hints;
-
- memset(&hints, 0, sizeof(struct addrinfo));
-#ifdef HAVE_IPV6
- hints.ai_family = AF_INET6;
-#else
- hints.ai_family = AF_INET;
-#endif
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_flags = AI_CANONNAME;
- hints.ai_protocol = IPPROTO_UDP;
-
- return ecore_con_info_get(svr, done_cb, data, &hints);
-}
-
-int
-ecore_con_info_udp_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
-{
- struct addrinfo hints;
-
- memset(&hints, 0, sizeof(struct addrinfo));
-#ifdef HAVE_IPV6
- hints.ai_family = AF_INET6;
-#else
- hints.ai_family = AF_INET;
-#endif
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_flags = AI_PASSIVE;
- hints.ai_protocol = IPPROTO_UDP;
-
- return ecore_con_info_get(svr, done_cb, data, &hints);
-}
-
-int
-ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
-{
- struct addrinfo hints;
-
- memset(&hints, 0, sizeof(struct addrinfo));
-#ifdef HAVE_IPV6
- hints.ai_family = AF_INET6;
-#else
- hints.ai_family = AF_INET;
-#endif
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_protocol = IPPROTO_UDP;
-
- return ecore_con_info_get(svr, done_cb, data, &hints);
-}
-
-EAPI int
-ecore_con_info_get(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data,
- struct addrinfo *hints)
-{
- Ecore_Con_DNS *dns;
- int error = 0;
-
- dns = calloc(1, sizeof(Ecore_Con_DNS));
- if (!dns) return 0;
-
- dns->svr = svr;
- dns->done_cb = done_cb;
- dns->data = data;
-
- if (hints)
- memcpy(&dns->hints, hints, sizeof(struct addrinfo));
-
- if (!(dns->resolv = dns_res_open(resconf, hosts, dns_hints_mortal(dns_hints_local(resconf, &error)), NULL, dns_opts(), &error)))
- {
- ERR("res_open: %s", dns_strerror(error));
- goto reserr;
-
- }
-
- error = _dns_addrinfo_get(dns, svr->ecs ? svr->ecs->ip : svr->name, dns->svr->ecs ? dns->svr->ecs->port : dns->svr->port);
- if (error && (error != EAGAIN))
- {
- ERR("resolver: %s", dns_strerror(error));
- goto seterr;
- }
-
- switch (_ecore_con_dns_check(dns))
- {
- case 0:
- break;
- case 1:
- dns->fdh = ecore_main_fd_handler_add(dns_ai_pollfd(dns->ai), dns_ai_events(dns->ai), (Ecore_Fd_Cb)_dns_fd_cb, dns, NULL, NULL);
- svr->infos = eina_list_append(svr->infos, dns);
- dns->timer = ecore_timer_add(5.0, (Ecore_Task_Cb)_dns_timer_cb, dns);
- break;
- default:
- return 0;
- }
-
- return 1;
-seterr:
- if (dns->resolv) dns_res_close(dns_res_mortal(dns->resolv));
-reserr:
- free(dns);
- return 0;
-}
-
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index 7113b8ca..f02cc1f8 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -143,10 +143,7 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
if (connect(svr->fd, (struct sockaddr *)&socket_unix,
socket_unix_len) < 0)
- {
- ERR("local connection failed: %s", strerror(errno));
- return 0;
- }
+ return 0;
svr->path = strdup(buf);
if (!svr->path)
diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h
index 26e9970c..4f8f7923 100644
--- a/src/lib/ecore_con/ecore_con_private.h
+++ b/src/lib/ecore_con/ecore_con_private.h
@@ -10,7 +10,6 @@
#define ECORE_CON_TYPE 0x0f
#define ECORE_CON_SSL 0xf0
-#define ECORE_CON_SUPER_SSL 0xf00
#if USE_GNUTLS
# include <gnutls/gnutls.h>
@@ -179,7 +178,6 @@ struct _Ecore_Con_Server
Eina_Bool connecting : 1; /* @c EINA_FALSE if just initialized or connected */
Eina_Bool handshaking : 1; /* @c EINA_TRUE if server is ssl handshaking */
Eina_Bool upgrade : 1; /* STARTTLS queued */
- Eina_Bool disable_proxy : 1; /* proxy should never be used with this connection */
Eina_Bool ssl_prepared : 1;
Eina_Bool use_cert : 1; /* @c EINA_TRUE if using certificate auth */
Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */
diff --git a/src/lib/ecore_con/ecore_con_socks.c b/src/lib/ecore_con/ecore_con_socks.c
index e609a6a9..686f73bc 100644
--- a/src/lib/ecore_con/ecore_con_socks.c
+++ b/src/lib/ecore_con/ecore_con_socks.c
@@ -557,7 +557,7 @@ ecore_con_socks_init(void)
unsigned char addr6[sizeof(struct in6_addr)];
#endif
- /* ECORE_CON_SOCKS_V4=[user@]host-port:[1|0] */
+ /* ECORE_CON_SOCKS_V4=[user@]host:port-[1|0] */
socks = getenv("ECORE_CON_SOCKS_V4");
if (!socks)
{
diff --git a/src/lib/ecore_directfb/Ecore_DirectFB.h b/src/lib/ecore_directfb/Ecore_DirectFB.h
index 3b94816d..1f6fc639 100644
--- a/src/lib/ecore_directfb/Ecore_DirectFB.h
+++ b/src/lib/ecore_directfb/Ecore_DirectFB.h
@@ -1,10 +1,10 @@
#ifndef _ECORE_DIRECTFB_H
#define _ECORE_DIRECTFB_H
-#include <Eina.h>
-
#include <directfb.h>
+#include <Eina.h>
+
#ifdef EAPI
# undef EAPI
#endif /* ifdef EAPI */
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index e0c351b2..a2ea00dd 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -216,8 +216,6 @@ EAPI Eina_Bool ecore_evas_app_comp_sync_get(void);
EAPI Eina_List *ecore_evas_engines_get(void);
/**
* @brief Free list returned by ecore_evas_engines_get()
- *
- * @param engines list with engines names
*/
EAPI void ecore_evas_engines_free(Eina_List *engines);
/**
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index d8a05412..02b37c21 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -2804,9 +2804,6 @@ ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
EAPI Ecore_Wl_Window *
ecore_evas_wayland_window_get(const Ecore_Evas *ee)
{
- if (!(!strncmp(ee->driver, "wayland", 7)))
- return NULL;
-
return ee->engine.wl.win;
}
diff --git a/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c
index 074ce670..a4a2eaac 100644
--- a/src/lib/ecore_evas/ecore_evas_directfb.c
+++ b/src/lib/ecore_evas/ecore_evas_directfb.c
@@ -593,7 +593,6 @@ ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED_
EAPI Ecore_DirectFB_Window *
ecore_evas_directfb_window_get(const Ecore_Evas *ee)
{
- if (!(!strcmp(ee->driver, "directfb"))) return 0;
return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee);
}
#else
diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c
index f8b8b867..48da7ead 100644
--- a/src/lib/ecore_evas/ecore_evas_fb.c
+++ b/src/lib/ecore_evas/ecore_evas_fb.c
@@ -640,7 +640,7 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
}
einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
- if (einfo && disp_name)
+ if (einfo)
{
einfo->info.virtual_terminal = 0;
einfo->info.device_number = strtol(disp_name, NULL, 10);
diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c
index b168d31d..6237e594 100644
--- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c
+++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c
@@ -2,7 +2,7 @@
# include "config.h"
#endif
-#define LOGFNS 1
+//#define LOGFNS 1
#ifdef LOGFNS
# include <stdio.h>
@@ -241,9 +241,8 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
{
einfo->info.display = ecore_wl_display_get();
- einfo->info.destination_alpha = ee->alpha;
+ einfo->info.destination_alpha = EINA_FALSE;
einfo->info.rotation = ee->rotation;
- einfo->info.depth = 32;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
{
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
@@ -271,8 +270,8 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in
evas_object_move(ee->engine.wl.frame, 0, 0);
}
- _ecore_evas_register(ee);
ecore_evas_input_event_register(ee);
+ _ecore_evas_register(ee);
ecore_event_window_register(ee->prop.window, ee, ee->evas,
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
@@ -280,7 +279,7 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
(Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
- /* evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); */
+ evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
return ee;
}
@@ -431,14 +430,10 @@ _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
if (!ee) return;
ee->req.x = x;
ee->req.y = y;
- if ((ee->x != x) || (ee->y != y))
- {
- ee->x = x;
- ee->y = y;
- if (ee->engine.wl.win)
- ecore_wl_window_update_location(ee->engine.wl.win, x, y);
- if (ee->func.fn_move) ee->func.fn_move(ee);
- }
+ ee->x = x;
+ ee->y = y;
+ if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y);
+ if (ee->func.fn_move) ee->func.fn_move(ee);
}
static void
@@ -449,6 +444,7 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
if (!ee) return;
if (w < 1) w = 1;
if (h < 1) h = 1;
+// if ((ee->w == w) && (ee->h == h)) return;
if (ee->prop.min.w > w) w = ee->prop.min.w;
else if (w > ee->prop.max.w) w = ee->prop.max.w;
@@ -460,47 +456,25 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
- if ((ee->w != w) || (ee->h != h))
- {
- ee->w = w;
- ee->h = h;
-
- if ((ee->rotation == 90) || (ee->rotation == 270))
- {
- evas_output_size_set(ee->evas, h, w);
- evas_output_viewport_set(ee->evas, 0, 0, h, w);
- }
- else
- {
- evas_output_size_set(ee->evas, w, h);
- evas_output_viewport_set(ee->evas, 0, 0, w, h);
- }
-
- if (ee->prop.avoid_damage)
- {
- int pdam = 0;
-
- pdam = ecore_evas_avoid_damage_get(ee);
- ecore_evas_avoid_damage_set(ee, 0);
- ecore_evas_avoid_damage_set(ee, pdam);
- }
-
- if (ee->engine.wl.frame)
- evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
+ ee->w = w;
+ ee->h = h;
- /* set new engine destination */
- /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
+ /* change evas output & viewport sizes */
+ evas_output_size_set(ee->evas, ee->w, ee->h);
+ evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ if (ee->engine.wl.frame)
+ evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
- /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
+ /* set new engine destination */
+ /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
- // WAS ACTIVE
- /* ecore_wl_flush(); */
+ /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
+ ecore_wl_flush();
- if (ee->engine.wl.win)
- ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
+ ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
- if (ee->func.fn_resize) ee->func.fn_resize(ee);
- }
+ if (ee->func.fn_resize) ee->func.fn_resize(ee);
}
static void
@@ -515,37 +489,23 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
if (ee->engine.wl.win)
{
ecore_wl_window_show(ee->engine.wl.win);
- ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
- /* ecore_wl_sync(); */
-
- if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_class(ee->engine.wl.win->shell_surface,
- ee->prop.clas);
- if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_title(ee->engine.wl.win->shell_surface,
- ee->prop.title);
+ ecore_wl_flush();
}
- if (ee->engine.wl.frame)
+ einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
+ if (!einfo)
{
- evas_object_show(ee->engine.wl.frame);
- evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
+ ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
+ return;
}
- if (ee->engine.wl.win)
- {
- einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
- if (!einfo)
- {
- ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
- return;
- }
+ einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win);
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
- einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win);
- /* if (einfo->info.surface) */
- evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
- /* else */
- /* printf("Failed to get a Surface from Ecore_Wl\n"); */
+ if (ee->engine.wl.frame)
+ {
+ evas_object_show(ee->engine.wl.frame);
+ evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
}
/* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */
@@ -563,6 +523,12 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
if ((!ee) || (!ee->visible)) return;
+ if (ee->engine.wl.win)
+ {
+ ecore_wl_window_hide(ee->engine.wl.win);
+ ecore_wl_flush();
+ }
+
einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
if (einfo)
{
@@ -570,9 +536,6 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
}
- if (ee->engine.wl.win)
- ecore_wl_window_hide(ee->engine.wl.win);
-
ee->visible = 0;
ee->should_be_visible = 0;
@@ -604,10 +567,6 @@ _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
evas_object_text_text_set(sd->text, ee->prop.title);
}
-
- if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_title(ee->engine.wl.win->shell_surface,
- ee->prop.title);
}
static void
@@ -622,10 +581,7 @@ _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
ee->prop.clas = NULL;
if (n) ee->prop.name = strdup(n);
if (c) ee->prop.clas = strdup(c);
-
- if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_class(ee->engine.wl.win->shell_surface,
- ee->prop.clas);
+ /* FIXME: Forward these changes to Wayland somehow */
}
static void
diff --git a/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/src/lib/ecore_evas/ecore_evas_wayland_shm.c
index 598182f5..bc2f4e21 100644
--- a/src/lib/ecore_evas/ecore_evas_wayland_shm.c
+++ b/src/lib/ecore_evas/ecore_evas_wayland_shm.c
@@ -54,7 +54,6 @@ static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ec
static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
-static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
static void _ecore_evas_wl_show(Ecore_Evas *ee);
static void _ecore_evas_wl_hide(Ecore_Evas *ee);
static void _ecore_evas_wl_raise(Ecore_Evas *ee);
@@ -73,7 +72,6 @@ static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
static int _ecore_evas_wl_render(Ecore_Evas *ee);
static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
-static void _ecore_evas_wl_ensure_pool_size(Ecore_Evas *ee, int w, int h);
static struct wl_shm_pool *_ecore_evas_wl_shm_pool_create(int size, void **data);
static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, struct wl_shm_pool *pool);
@@ -120,7 +118,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
_ecore_evas_wl_move,
NULL, // managed_move
_ecore_evas_wl_resize,
- _ecore_evas_wl_move_resize,
+ NULL, // move_resize
NULL, // rotation_set
NULL, // shaped_set
_ecore_evas_wl_show,
@@ -149,13 +147,13 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
_ecore_evas_wl_alpha_set,
_ecore_evas_wl_transparent_set,
NULL, // func profiles set
- NULL, // window group set
- NULL, // aspect set
- NULL, // urgent set
- NULL, // modal set
- NULL, // demand attention set
- NULL, // focus skip set
- _ecore_evas_wl_render,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _ecore_evas_wl_render,
_ecore_evas_wl_screen_geometry_get
};
@@ -221,7 +219,6 @@ ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, in
ee->prop.request_pos = 0;
ee->prop.sticky = 0;
ee->prop.draw_frame = frame;
- ee->alpha = EINA_FALSE;
ee->evas = evas_new();
evas_data_attach_set(ee->evas, ee);
@@ -233,7 +230,8 @@ ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, in
if (ee->prop.draw_frame)
evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
- if (parent) p = ecore_wl_window_find(parent);
+ if (parent)
+ p = ecore_wl_window_find(parent);
/* FIXME: Get if parent is alpha, and set */
@@ -245,8 +243,6 @@ ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, in
if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
{
einfo->info.rotation = ee->rotation;
- einfo->info.destination_alpha = ee->alpha;
- einfo->info.rotation = ee->rotation;
einfo->info.debug = EINA_FALSE;
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
{
@@ -343,10 +339,21 @@ _ecore_evas_wl_shutdown(void)
static void
_ecore_evas_wl_pre_free(Ecore_Evas *ee)
{
+ /* Evas_Engine_Info_Wayland_Shm *einfo; */
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!ee) return;
if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
+
+ /* FIXME: remove the shm pool */
+ /* einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); */
+ /* if ((einfo) && (einfo->info.dest)) */
+ /* { */
+ /* int ret = 0; */
+
+ /* ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); */
+ /* if (!ret) ERR("Failed to unmap engine destination: %m"); */
+ /* } */
}
static void
@@ -452,14 +459,12 @@ _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
static void
_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
{
- Evas_Engine_Info_Wayland_Shm *einfo;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
if (!ee) return;
if (w < 1) w = 1;
if (h < 1) h = 1;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
if (ee->prop.min.w > w) w = ee->prop.min.w;
else if (w > ee->prop.max.w) w = ee->prop.max.w;
if (ee->prop.min.h > h) h = ee->prop.min.h;
@@ -499,20 +504,56 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
ee->engine.wl.buffer = NULL;
- _ecore_evas_wl_ensure_pool_size(ee, w, h);
+ Evas_Engine_Info_Wayland_Shm *einfo;
+ struct wl_shm_pool *pool = NULL;
+ int stride = 0;
+ size_t len = 0;
+ void *data;
+
+ stride = ee->w * sizeof(int);
+ len = stride * ee->h;
+
+ if ((ee->engine.wl.pool) && (len < ee->engine.wl.pool_size))
+ {
+ pool = ee->engine.wl.pool;
+ data = ee->engine.wl.pool_data;
+ }
+ else
+ {
+ int w = 0, size = 0;
+
+ ecore_wl_screen_size_get(&w, NULL);
+
+ if (w == 0) w = 1024;
+
+ size = (6 * w * w);
+ pool =
+ _ecore_evas_wl_shm_pool_create(size, &data);
+ ee->engine.wl.pool_size = size;
+ }
+
+ if (data != ee->engine.wl.pool_data)
+ {
+ if (ee->engine.wl.pool)
+ wl_shm_pool_destroy(ee->engine.wl.pool);
+
+ ee->engine.wl.pool = pool;
+ ee->engine.wl.pool_data = data;
+ }
+
if (ee->engine.wl.pool)
_ecore_evas_wl_buffer_new(ee, ee->engine.wl.pool);
- einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
- if (!einfo)
- {
- ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
- return;
- }
+ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
+ if (!einfo)
+ {
+ ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
+ return;
+ }
- einfo->info.dest = ee->engine.wl.pool_data;
- evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+ einfo->info.dest = data;
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
if (ee->engine.wl.win)
{
@@ -526,63 +567,51 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
}
static void
-_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!ee) return;
- if ((ee->x != x) || (ee->y != y))
- _ecore_evas_wl_move(ee, x, y);
- if ((ee->w != w) || (ee->h != h))
- _ecore_evas_wl_resize(ee, w, h);
-}
-
-static void
-_ecore_evas_wl_ensure_pool_size(Ecore_Evas *ee, int w, int h)
+_ecore_evas_wl_show(Ecore_Evas *ee)
{
+ Evas_Engine_Info_Wayland_Shm *einfo;
+ struct wl_shm_pool *pool = NULL;
int stride = 0;
size_t len = 0;
+ void *data;
- stride = w * sizeof(int);
- len = stride * h;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (ee->visible)) return;
+
+ stride = ee->w * sizeof(int);
+ len = stride * ee->h;
if ((ee->engine.wl.pool) && (len < ee->engine.wl.pool_size))
- return;
+ {
+ pool = ee->engine.wl.pool;
+ data = ee->engine.wl.pool_data;
+ }
else
{
- struct wl_shm_pool *pool = NULL;
- void *data;
- int size;
+ int w = 0, size = 0;
- if (ee->engine.wl.pool)
- wl_shm_pool_destroy(ee->engine.wl.pool);
+ ecore_wl_screen_size_get(&w, NULL);
- /*
- * Make the pool 1.5 times the current requirement to allow growth
- * without requiring a new pool allocation
- */
- size = 1.5 * len;
- pool = _ecore_evas_wl_shm_pool_create(size, &data);
+ /* set a default width */
+ if (w == 0) w = 1024;
- ee->engine.wl.pool = pool;
+ size = (6 * w * w);
+ pool =
+ _ecore_evas_wl_shm_pool_create(size, &data);
ee->engine.wl.pool_size = size;
- ee->engine.wl.pool_data = data;
}
-}
-
-static void
-_ecore_evas_wl_show(Ecore_Evas *ee)
-{
- Evas_Engine_Info_Wayland_Shm *einfo;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if ((!ee) || (ee->visible)) return;
+ if (data != ee->engine.wl.pool_data)
+ {
+ if (ee->engine.wl.pool)
+ wl_shm_pool_destroy(ee->engine.wl.pool);
- _ecore_evas_wl_ensure_pool_size(ee, ee->w, ee->h);
+ ee->engine.wl.pool = pool;
+ ee->engine.wl.pool_data = data;
+ }
- if (ee->engine.wl.pool)
- _ecore_evas_wl_buffer_new(ee, ee->engine.wl.pool);
+ _ecore_evas_wl_buffer_new(ee, pool);
einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
if (!einfo)
@@ -591,7 +620,7 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
return;
}
- einfo->info.dest = ee->engine.wl.pool_data;
+ einfo->info.dest = data;
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
/* ecore_wl_flush(); */
@@ -602,13 +631,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
ecore_wl_window_buffer_attach(ee->engine.wl.win,
ee->engine.wl.buffer, 0, 0);
ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
-
- if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_class(ee->engine.wl.win->shell_surface,
- ee->prop.clas);
- if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_title(ee->engine.wl.win->shell_surface,
- ee->prop.title);
}
if (ee->engine.wl.frame)
@@ -675,10 +697,6 @@ _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
evas_object_text_text_set(sd->text, ee->prop.title);
}
-
- if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_title(ee->engine.wl.win->shell_surface,
- ee->prop.title);
}
static void
@@ -693,10 +711,7 @@ _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
ee->prop.clas = NULL;
if (n) ee->prop.name = strdup(n);
if (c) ee->prop.clas = strdup(c);
-
- if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
- wl_shell_surface_set_class(ee->engine.wl.win->shell_surface,
- ee->prop.clas);
+ /* FIXME: Forward these changes to Wayland somehow */
}
static void
@@ -1007,7 +1022,7 @@ _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *eve
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
-// _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
ee->in = EINA_TRUE;
}
return ECORE_CALLBACK_PASS_ON;
@@ -1028,7 +1043,7 @@ _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *ev
if (ee->in)
{
ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
-// _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c
index ff3fe5c8..fdea053f 100644
--- a/src/lib/ecore_evas/ecore_evas_win32.c
+++ b/src/lib/ecore_evas/ecore_evas_win32.c
@@ -945,83 +945,6 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on)
}
#endif /* BUILD_ECORE_EVAS_DIRECT3D */
}
-static void
-_ecore_evas_win32_alpha_set(Ecore_Evas *ee, int alpha)
-{
- alpha = !!alpha;
- if ((ee->alpha == alpha)) return;
-
- if (!strcmp(ee->driver, "software_gdi"))
- {
-#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
- Evas_Engine_Info_Software_Gdi *einfo;
-
- einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas);
- if (!einfo) return;
-
- ee->shaped = 0;
- ee->alpha = alpha;
- /* ecore_win32_window_free(ee->prop.window); */
- /* ecore_event_window_unregister(ee->prop.window); */
- /* if (ee->alpha) */
- /* { */
- /* if (ee->prop.override) */
- /* ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); */
- /* else */
- /* ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); */
- /* if (!ee->engine.x.mask) */
- /* ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); */
- /* } */
- /* else */
- /* { */
- /* if (ee->prop.override) */
- /* ee->prop.window = ecore_win32_window_override_new(ee->engine.win32.win_root, */
- /* ee->req.x, */
- /* ee->req.y, */
- /* ee->req.w, */
- /* ee->req.h); */
- /* else */
- /* ee->prop.window = ecore_win32_window_new(ee->engine.win32.win_root, */
- /* ee->req.x, */
- /* ee->req.y, */
- /* ee->req.w, */
- /* ee->req.h); */
- /* if (ee->engine.win32.mask) ecore_x_pixmap_free(ee->engine.x.mask); */
- /* ee->engine.win32.mask = 0; */
- /* ecore_win32_window_shape_input_mask_set(ee->prop.window, 0); */
- /* } */
-
- /* einfo->info.destination_alpha = alpha; */
- einfo->info.region = alpha;
-
-// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
-// ee->engine.x.mask = 0;
- /* einfo->info.mask = ee->engine.win32.mask; */
- /* einfo->info.drawable = ee->prop.window; */
- if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
- {
- ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
- }
- evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
- /* ecore_win32_window_shape_mask_set(ee->prop.window, 0); */
- /* ecore_event_window_register(ee->prop.window, ee, ee->evas, */
- /* (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, */
- /* (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, */
- /* (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, */
- /* (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); */
- if (ee->prop.borderless)
- ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window, ee->prop.borderless);
- if (ee->visible) ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window);
- if (ee->prop.focused) ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window);
- if (ee->prop.title)
- {
- ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window, ee->prop.title);
- /* ecore_win32_name_set(ee->prop.window, ee->prop.title); */
- }
- ecore_win32_window_type_set((struct _Ecore_Win32_Window *)ee->prop.window, ECORE_WIN32_WINDOW_TYPE_NORMAL);
-#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */
- }
-}
static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
@@ -1070,7 +993,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
NULL, /* _ecore_evas_x_withdrawn_set */
NULL, /* _ecore_evas_x_sticky_set */
NULL, /* _ecore_evas_x_ignore_events_set */
- _ecore_evas_win32_alpha_set,
+ NULL, /* _ecore_evas_x_alpha_set */
NULL, //transparent
NULL, // profiles_set
diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c
index f6f6b04e..636b8e82 100644
--- a/src/lib/ecore_evas/ecore_evas_x.c
+++ b/src/lib/ecore_evas/ecore_evas_x.c
@@ -2074,15 +2074,11 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
}
- if (ee->prop.name)
- ecore_x_icccm_name_class_set(ee->prop.window,
- ee->prop.name, ee->prop.clas);
_ecore_evas_x_hints_update(ee);
_ecore_evas_x_group_leader_update(ee);
ecore_x_window_defaults_set(ee->prop.window);
_ecore_evas_x_protocols_set(ee);
_ecore_evas_x_sync_set(ee);
- _ecore_evas_x_size_pos_hints_update(ee);
#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
if ((id = getenv("DESKTOP_STARTUP_ID")))
{
@@ -2194,15 +2190,11 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
}
- if (ee->prop.name)
- ecore_x_icccm_name_class_set(ee->prop.window,
- ee->prop.name, ee->prop.clas);
_ecore_evas_x_hints_update(ee);
_ecore_evas_x_group_leader_update(ee);
ecore_x_window_defaults_set(ee->prop.window);
_ecore_evas_x_protocols_set(ee);
_ecore_evas_x_sync_set(ee);
- _ecore_evas_x_size_pos_hints_update(ee);
#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
if ((id = getenv("DESKTOP_STARTUP_ID")))
{
@@ -2277,15 +2269,11 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
}
- if (ee->prop.name)
- ecore_x_icccm_name_class_set(ee->prop.window,
- ee->prop.name, ee->prop.clas);
_ecore_evas_x_hints_update(ee);
_ecore_evas_x_group_leader_update(ee);
ecore_x_window_defaults_set(ee->prop.window);
_ecore_evas_x_protocols_set(ee);
_ecore_evas_x_sync_set(ee);
- _ecore_evas_x_size_pos_hints_update(ee);
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
if ((id = getenv("DESKTOP_STARTUP_ID")))
{
@@ -2360,15 +2348,11 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
}
- if (ee->prop.name)
- ecore_x_icccm_name_class_set(ee->prop.window,
- ee->prop.name, ee->prop.clas);
_ecore_evas_x_hints_update(ee);
_ecore_evas_x_group_leader_update(ee);
ecore_x_window_defaults_set(ee->prop.window);
_ecore_evas_x_protocols_set(ee);
_ecore_evas_x_sync_set(ee);
- _ecore_evas_x_size_pos_hints_update(ee);
if ((id = getenv("DESKTOP_STARTUP_ID")))
{
@@ -3323,9 +3307,7 @@ ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window par
/**
* @brief Get the window from Ecore_Evas using software x11.
- * @note If ecore is not compiled with support for x11 or if @p ee was not
- * created with ecore_evas_software_x11_new() then nothing is done and
- * 0 is returned.
+ * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned.
* @param ee The Ecore_Evas from which to get the window.
* @return The window of type Ecore_X_Window.
*/
@@ -3333,7 +3315,6 @@ ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window par
EAPI Ecore_X_Window
ecore_evas_software_x11_window_get(const Ecore_Evas *ee)
{
- if (!(!strcmp(ee->driver, "software_x11"))) return 0;
return (Ecore_X_Window) ecore_evas_window_get(ee);
}
#else
@@ -3579,9 +3560,7 @@ ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window p
/**
* @brief Get the window from Ecore_Evas using opengl x11.
- * @note If ecore is not compiled with support for x11 or if @p ee was not
- * created with ecore_evas_gl_x11_new() then nothing is done and
- * 0 is returned.
+ * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned.
* @param ee The Ecore_Evas from which to get the window.
* @return The window of type Ecore_X_Window of Ecore_Evas.
*/
@@ -3589,7 +3568,6 @@ ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window p
EAPI Ecore_X_Window
ecore_evas_gl_x11_window_get(const Ecore_Evas *ee)
{
- if (!(!strcmp(ee->driver, "opengl_x11"))) return 0;
return (Ecore_X_Window) ecore_evas_window_get(ee);
}
#else
@@ -3887,9 +3865,7 @@ ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window
/**
* @brief Get the window from Ecore_Evas using software 16 x11.
- * @note If ecore is not compiled with support for x11 or if @p ee was not
- * created with ecore_evas_software_x11_16_new() then nothing is done and
- * 0 is returned.
+ * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned.
* @param ee The Ecore_Evas from which to get the window.
* @return The window of type Ecore_X_Window of Ecore_Evas.
*/
@@ -3897,7 +3873,6 @@ ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window
EAPI Ecore_X_Window
ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee)
{
- if (!(!strcmp(ee->driver, "software_16_x11"))) return 0;
return (Ecore_X_Window) ecore_evas_window_get(ee);
}
#else
@@ -4219,9 +4194,7 @@ ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent,
/**
* @brief Get window from Ecore_Evas using software 8 x11.
- * @note If ecore is not compiled with support for x11 or if @p ee was not
- * created with ecore_evas_software_x11_8_new() then nothing is done and
- * 0 is returned.
+ * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned.
* @param ee The Ecore_Evas from which to get the window.
* @return The window of type Ecore_X_Window of Ecore_Evas.
*/
@@ -4229,7 +4202,6 @@ EAPI Ecore_X_Window
ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee)
{
#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
- if (!(!strcmp(ee->driver, "software_8_x11"))) return 0;
return (Ecore_X_Window) ecore_evas_window_get(ee);
#else
return 0;
@@ -4239,9 +4211,7 @@ ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee)
/**
* @brief Get subwindow from Ecore_Evas using software 8 x11.
- * @note If ecore is not compiled with support for x11 or if @p ee was not
- * created with ecore_evas_software_x11_8_new() then nothing is done and
- * 0 is returned.
+ * @note If ecore is not compiled with support to x11 then nothing is done and 0 is returned.
* @param ee The Ecore_Evas from which to get the subwindow.
* @return The window of type Ecore_X_Window of Ecore_Evas.
*/
@@ -4249,7 +4219,6 @@ EAPI Ecore_X_Window
ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee)
{
#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
- if (!(!strcmp(ee->driver, "software_8_x11"))) return 0;
return (Ecore_X_Window) ecore_evas_window_get(ee);
#else
return 0;
diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c
index 30226d3a..efdd8c2b 100644
--- a/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c
@@ -274,7 +274,7 @@ _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask)
* else delete it */
if (ecore_file_exists(em->path))
{
- if (_ecore_file_monitor_inotify_monitor(em, em->path))
+ if (!_ecore_file_monitor_inotify_monitor(em, em->path))
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
}
else
@@ -301,7 +301,7 @@ _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path)
inotify_add_watch(ecore_main_fd_handler_fd_get(_fdh), path, mask);
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
{
- INF("inotify_add_watch failed, file was deleted");
+ ERR("inotify_add_watch error");
ecore_file_monitor_inotify_del(em);
return 0;
}
diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c
index dbac2013..037bd7c2 100644
--- a/src/lib/ecore_imf/ecore_imf_context.c
+++ b/src/lib/ecore_imf/ecore_imf_context.c
@@ -29,10 +29,7 @@
*
* Immodule is plugin to connect your application and input method framework such as SCIM, ibus, and so on.@n
* ecore_imf_init() should be called to initialize and load immodule.@n
- * ecore_imf_shutdown() is used for shutdowning and unloading immodule.
- *
- * An example of usage of these functions can be found at:
- * @li @ref ecore_imf_example_c
+ * ecore_imf_shutdown() is used for shutdowning and unloading immodule.
*/
/**
diff --git a/src/lib/ecore_imf_evas/ecore_imf_evas.c b/src/lib/ecore_imf_evas/ecore_imf_evas.c
index 98dce885..62ba4c86 100644
--- a/src/lib/ecore_imf_evas/ecore_imf_evas.c
+++ b/src/lib/ecore_imf_evas/ecore_imf_evas.c
@@ -8,10 +8,6 @@
* @defgroup Ecore_IMF_Evas_Group Ecore Input Method Context Evas Helper Functions
*
* Helper functions to make it easy to use Evas with Ecore_IMF.
- * Converts each event from Evas to the corresponding event of Ecore_IMF.
- *
- * An example of usage of these functions can be found at:
- * @li @ref ecore_imf_example_c
*/
static const char *_ecore_imf_evas_event_empty = "";
diff --git a/src/lib/ecore_ipc/Ecore_Ipc.h b/src/lib/ecore_ipc/Ecore_Ipc.h
index f77870f8..40ae621e 100644
--- a/src/lib/ecore_ipc/Ecore_Ipc.h
+++ b/src/lib/ecore_ipc/Ecore_Ipc.h
@@ -1,8 +1,6 @@
#ifndef _ECORE_IPC_H
#define _ECORE_IPC_H
-#include <Eina.h>
-
#ifdef EAPI
# undef EAPI
#endif
@@ -222,8 +220,7 @@ typedef enum _Ecore_Ipc_Type
ECORE_IPC_LOCAL_USER,
ECORE_IPC_LOCAL_SYSTEM,
ECORE_IPC_REMOTE_SYSTEM,
- ECORE_IPC_USE_SSL = (1 << 4),
- ECORE_IPC_NO_PROXY = (1 << 5)
+ ECORE_IPC_USE_SSL = 16
} Ecore_Ipc_Type;
typedef struct _Ecore_Ipc_Event_Client_Add Ecore_Ipc_Event_Client_Add;
diff --git a/src/lib/ecore_ipc/Makefile.am b/src/lib/ecore_ipc/Makefile.am
index 60e32d38..9cbed43d 100644
--- a/src/lib/ecore_ipc/Makefile.am
+++ b/src/lib/ecore_ipc/Makefile.am
@@ -9,9 +9,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/ecore_ipc \
@EFL_ECORE_IPC_BUILD@ \
@SSL_CFLAGS@ \
-@EVIL_CFLAGS@ \
-@EINA_CFLAGS@ \
-@WIN32_CPPFLAGS@
+@EINA_CFLAGS@
lib_LTLIBRARIES = libecore_ipc.la
includes_HEADERS = Ecore_Ipc.h
@@ -20,14 +18,11 @@ includesdir = $(includedir)/ecore-@VMAJ@
libecore_ipc_la_SOURCES = \
ecore_ipc.c
-libecore_ipc_la_CFLAGS = @WIN32_CFLAGS@
libecore_ipc_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la \
@SSL_LIBS@ \
-@EINA_LIBS@ \
-@EVIL_LIBS@ \
-@WIN32_LIBS@
+@EINA_LIBS@
libecore_ipc_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c
index 0cddad22..3518be22 100644
--- a/src/lib/ecore_ipc/ecore_ipc.c
+++ b/src/lib/ecore_ipc/ecore_ipc.c
@@ -412,16 +412,12 @@ ecore_ipc_server_connect(Ecore_Ipc_Type compl_type, char *name, int port, const
Ecore_Ipc_Server *svr;
Ecore_Ipc_Type type;
Ecore_Con_Type extra = 0;
- int features;
svr = calloc(1, sizeof(Ecore_Ipc_Server));
if (!svr) return NULL;
- type = compl_type & ECORE_IPC_TYPE;
- features = compl_type & ECORE_IPC_SSL;
- if ((features & ECORE_IPC_USE_SSL) == ECORE_IPC_USE_SSL)
- extra |= ECORE_CON_USE_SSL;
- if ((features & ECORE_IPC_NO_PROXY) == ECORE_IPC_NO_PROXY)
- extra |= ECORE_CON_NO_PROXY;
+ type = compl_type;
+ type &= ~ECORE_IPC_USE_SSL;
+ if (compl_type & ECORE_IPC_USE_SSL) extra = ECORE_CON_USE_SSL;
switch (type)
{
case ECORE_IPC_LOCAL_USER:
@@ -477,7 +473,7 @@ ecore_ipc_server_del(Ecore_Ipc_Server *svr)
EINA_LIST_FREE(svr->clients, cl)
ecore_ipc_client_del(cl);
- if (svr->server) ecore_con_server_del(svr->server);
+ ecore_con_server_del(svr->server);
servers = eina_list_remove(servers, svr);
if (svr->buf) free(svr->buf);
@@ -814,8 +810,6 @@ ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int r
"ecore_ipc_client_send");
return 0;
}
- EINA_SAFETY_ON_TRUE_RETURN_VAL(!cl->client, 0);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(!ecore_con_client_connected_get(cl->client), 0);
if (size < 0) size = 0;
msg.major = major;
msg.minor = minor;
@@ -859,7 +853,7 @@ ecore_ipc_client_server_get(Ecore_Ipc_Client *cl)
"ecore_ipc_client_server_get");
return NULL;
}
- return cl->svr;
+ return (ecore_con_server_data_get(ecore_con_client_server_get(cl->client)));
}
/**
@@ -886,8 +880,8 @@ ecore_ipc_client_del(Ecore_Ipc_Client *cl)
cl->delete_me = 1;
if (cl->event_count == 0)
{
- svr = cl->svr;
- if (cl->client) ecore_con_client_del(cl->client);
+ svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client));
+ ecore_con_client_del(cl->client);
svr->clients = eina_list_remove(svr->clients, cl);
if (cl->buf) free(cl->buf);
ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
@@ -1027,18 +1021,17 @@ static Eina_Bool
_ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Client_Add *e;
- Ecore_Ipc_Server *svr;
e = ev;
- svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
- if (!eina_list_data_find(servers, svr)) return ECORE_CALLBACK_RENEW;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Client *cl;
+ Ecore_Ipc_Server *svr;
cl = calloc(1, sizeof(Ecore_Ipc_Client));
if (!cl) return ECORE_CALLBACK_CANCEL;
- cl->svr = svr;
+ svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
ECORE_MAGIC_SET(cl, ECORE_MAGIC_IPC_CLIENT);
cl->client = e->client;
cl->max_buf_size = 32 * 1024;
@@ -1066,21 +1059,19 @@ static Eina_Bool
_ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Client_Del *e;
- Ecore_Ipc_Server *svr;
e = ev;
- if (!e->client) return ECORE_CALLBACK_RENEW;
- svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
- if (!eina_list_data_find(servers, svr)) return ECORE_CALLBACK_RENEW;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Client *cl;
cl = ecore_con_client_data_get(e->client);
- cl->client = NULL;
{
Ecore_Ipc_Event_Client_Del *e2;
+ Ecore_Ipc_Server *svr;
+ svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
svr->client_list = eina_list_remove(svr->client_list, cl);
if (!cl->delete_me)
{
@@ -1139,7 +1130,6 @@ _ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void
Ecore_Ipc_Server *svr;
svr = ecore_con_server_data_get(e->server);
- svr->server = NULL;
if (!svr->delete_me)
{
Ecore_Ipc_Event_Server_Del *e2;
@@ -1202,11 +1192,9 @@ static Eina_Bool
_ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Client_Data *e;
- Ecore_Ipc_Server *svr;
e = ev;
- svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
- if (!eina_list_data_find(servers, svr)) return ECORE_CALLBACK_RENEW;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Client *cl;
@@ -1275,9 +1263,11 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void
if ((cl->buf_size - offset) >= (s + msg.size))
{
Ecore_Ipc_Event_Client_Data *e2;
+ Ecore_Ipc_Server *svr;
int max, max2;
buf = NULL;
+ svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client));
max = svr->max_buf_size;
max2 = cl->max_buf_size;
if ((max >= 0) && (max2 >= 0))
diff --git a/src/lib/ecore_ipc/ecore_ipc_private.h b/src/lib/ecore_ipc/ecore_ipc_private.h
index bbf3d7b9..57f78497 100644
--- a/src/lib/ecore_ipc/ecore_ipc_private.h
+++ b/src/lib/ecore_ipc/ecore_ipc_private.h
@@ -38,8 +38,7 @@ extern int _ecore_ipc_log_dom;
#define ECORE_MAGIC_IPC_CLIENT 0x78875665
typedef struct _Ecore_Ipc_Msg_Head Ecore_Ipc_Msg_Head;
-#define ECORE_IPC_TYPE 0x0f
-#define ECORE_IPC_SSL 0xf0
+
#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
# pragma pack(1)
@@ -70,7 +69,6 @@ struct _Ecore_Ipc_Client
{
ECORE_MAGIC;
Ecore_Con_Client *client;
- Ecore_Ipc_Server *svr;
void *data;
unsigned char *buf;
int buf_size;
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h
index ec0776bd..128d2706 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -1,16 +1,8 @@
#ifndef _ECORE_WAYLAND_H_
# define _ECORE_WAYLAND_H_
-/*
- * Wayland supoprt is considered experimental as wayland itself is still
- * unstable and liable to change core protocol. If you use this api, it is
- * possible it will break in future, until this notice is removed.
- */
-
# include <Eina.h>
# include <wayland-client.h>
-# include <wayland-cursor.h>
-# include <xkbcommon/xkbcommon.h>
# ifdef EAPI
# undef EAPI
@@ -51,7 +43,6 @@ typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound;
enum _Ecore_Wl_Window_Type
{
- ECORE_WL_WINDOW_TYPE_NONE,
ECORE_WL_WINDOW_TYPE_TOPLEVEL,
ECORE_WL_WINDOW_TYPE_FULLSCREEN,
ECORE_WL_WINDOW_TYPE_MAXIMIZED,
@@ -87,12 +78,7 @@ struct _Ecore_Wl_Display
struct wl_list inputs;
struct wl_list outputs;
- struct
- {
- struct xkb_context *context;
- } xkb;
-
- struct wl_cursor_theme *cursor_theme;
+ struct xkb_desc *xkb;
Ecore_Wl_Output *output;
Ecore_Wl_Input *input;
@@ -116,13 +102,7 @@ struct _Ecore_Wl_Output
struct _Ecore_Wl_Input
{
Ecore_Wl_Display *display;
- struct wl_seat *seat;
- struct wl_pointer *pointer;
- struct wl_keyboard *keyboard;
- struct wl_touch *touch;
-
- struct wl_surface *cursor_surface;
-
+ struct wl_input_device *input_device;
struct wl_data_device *data_device;
Ecore_Wl_Window *pointer_focus;
@@ -141,15 +121,6 @@ struct _Ecore_Wl_Input
Ecore_Wl_Dnd_Source *drag_source;
Ecore_Wl_Dnd_Source *selection_source;
-
- struct
- {
- struct xkb_keymap *keymap;
- struct xkb_state *state;
- xkb_mod_mask_t control_mask;
- xkb_mod_mask_t alt_mask;
- xkb_mod_mask_t shift_mask;
- } xkb;
};
struct _Ecore_Wl_Window
@@ -232,6 +203,7 @@ struct _Ecore_Wl_Event_Window_Configure
unsigned int win;
unsigned int event_win;
int x, y, w, h;
+ unsigned int timestamp;
};
struct _Ecore_Wl_Event_Dnd_Enter
@@ -310,13 +282,9 @@ EAPI void ecore_wl_screen_size_get(int *w, int *h);
EAPI void ecore_wl_pointer_xy_get(int *x, int *y);
EAPI int ecore_wl_dpi_get(void);
EAPI void ecore_wl_display_iterate(void);
-EAPI struct wl_cursor *ecore_wl_cursor_get(const char *cursor_name);
EAPI void ecore_wl_input_grab(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int button);
EAPI void ecore_wl_input_ungrab(Ecore_Wl_Input *input);
-EAPI void ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_surface *surface, int hot_x, int hot_y);
-EAPI void ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_name);
-EAPI void ecore_wl_input_cursor_default_restore(Ecore_Wl_Input *input);
EAPI struct wl_list ecore_wl_outputs_get(void);
@@ -338,9 +306,7 @@ EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win);
EAPI struct wl_shell_surface *ecore_wl_window_shell_surface_get(Ecore_Wl_Window *win);
EAPI Ecore_Wl_Window *ecore_wl_window_find(unsigned int id);
EAPI void ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type);
-EAPI void ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, int hot_x, int hot_y);
-EAPI void ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char *cursor_name);
-EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win);
+EAPI void ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_buffer *buffer, int hot_x, int hot_y, unsigned int timestamp);
EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent);
#endif
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index 3a3250da..9339becb 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -3,6 +3,21 @@
#endif
#include <fcntl.h>
+
+/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ...
+ * What about other OSs ?? */
+#ifdef __linux__
+# include <linux/input.h>
+#else
+# define BTN_LEFT 0x110
+# define BTN_RIGHT 0x111
+# define BTN_MIDDLE 0x112
+# define BTN_SIDE 0x113
+# define BTN_EXTRA 0x114
+# define BTN_FORWARD 0x115
+# define BTN_BACK 0x116
+#endif
+
#include "ecore_wl_private.h"
/* local function prototypes */
@@ -316,24 +331,6 @@ ecore_wl_display_iterate(void)
wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE);
}
-/**
- * Retrieves the requested cursor from the cursor theme
- *
- * @param cursor_name The desired cursor name to be looked up in the theme
- * @return the cursor or NULL if the cursor cannot be found
- *
- * @since 1.2
- */
-EAPI struct wl_cursor *
-ecore_wl_cursor_get(const char *cursor_name)
-{
- if ((!_ecore_wl_disp) || (!_ecore_wl_disp->cursor_theme))
- return NULL;
-
- return wl_cursor_theme_get_cursor(_ecore_wl_disp->cursor_theme,
- cursor_name);
-}
-
/* local functions */
static Eina_Bool
_ecore_wl_shutdown(Eina_Bool close)
@@ -403,7 +400,7 @@ _ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
{
Ecore_Wl_Display *ewd;
- /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(ewd = data)) return ECORE_CALLBACK_RENEW;
wl_display_iterate(ewd->wl.display, ewd->mask);
@@ -425,17 +422,14 @@ _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char
ewd->wl.compositor = wl_display_bind(disp, id, &wl_compositor_interface);
else if (!strcmp(interface, "wl_output"))
_ecore_wl_output_add(ewd, id);
- else if (!strcmp(interface, "wl_seat"))
+ else if (!strcmp(interface, "wl_input_device"))
_ecore_wl_input_add(ewd, id);
else if (!strcmp(interface, "wl_shell"))
ewd->wl.shell = wl_display_bind(disp, id, &wl_shell_interface);
/* else if (!strcmp(interface, "desktop_shell")) */
/* ewd->wl.desktop_shell = wl_display_bind(disp, id, &wl_shell_interface); */
else if (!strcmp(interface, "wl_shm"))
- {
- ewd->wl.shm = wl_display_bind(disp, id, &wl_shm_interface);
- ewd->cursor_theme = wl_cursor_theme_load(NULL, 32, ewd->wl.shm);
- }
+ ewd->wl.shm = wl_display_bind(disp, id, &wl_shm_interface);
else if (!strcmp(interface, "wl_data_device_manager"))
{
ewd->wl.data_device_manager =
@@ -460,10 +454,21 @@ _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char
static Eina_Bool
_ecore_wl_xkb_init(Ecore_Wl_Display *ewd)
{
+ struct xkb_rule_names names;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ewd->xkb.context = xkb_context_new(0)))
- return EINA_FALSE;
+ names.rules = "evdev";
+ names.model = "evdev";
+ names.layout = "us";
+ names.variant = "";
+ names.options = "";
+
+ if (!(ewd->xkb = xkb_compile_keymap_from_rules(&names)))
+ {
+ ERR("Failed to compile keymap");
+ return EINA_FALSE;
+ }
return EINA_TRUE;
}
@@ -473,7 +478,6 @@ _ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- xkb_context_unref(ewd->xkb.context);
-
+ if (ewd->xkb) xkb_free_keymap(ewd->xkb);
return EINA_TRUE;
}
diff --git a/src/lib/ecore_wayland/ecore_wl_dnd.c b/src/lib/ecore_wayland/ecore_wl_dnd.c
index 39e4f1cb..ced46c13 100644
--- a/src/lib/ecore_wayland/ecore_wl_dnd.c
+++ b/src/lib/ecore_wayland/ecore_wl_dnd.c
@@ -34,7 +34,7 @@ _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, uns
}
void
-_ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer)
+_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)
{
Ecore_Wl_Event_Dnd_Enter *event;
Ecore_Wl_Input *input;
@@ -57,8 +57,8 @@ _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, u
event->win = win->id;
event->source = input->drag_source->input->keyboard_focus->id;
- event->position.x = wl_fixed_to_int(x);
- event->position.y = wl_fixed_to_int(y);
+ event->position.x = x;
+ event->position.y = y;
event->num_types = input->drag_source->types.size;
event->types = input->drag_source->types.data;
@@ -81,7 +81,7 @@ _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device __UNUSED__)
}
void
-_ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, wl_fixed_t x, wl_fixed_t y)
+_ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y)
{
Ecore_Wl_Event_Dnd_Position *event;
Ecore_Wl_Input *input;
@@ -90,15 +90,15 @@ _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__,
if (!(input = data)) return;
- input->sx = wl_fixed_to_int(x);
- input->sy = wl_fixed_to_int(y);
+ input->sx = x;
+ input->sy = y;
if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Position)))) return;
event->win = input->drag_source->input->pointer_focus->id;
event->source = input->drag_source->input->keyboard_focus->id;
- event->position.x = input->sx;
- event->position.y = input->sy;
+ event->position.x = x;
+ event->position.y = y;
ecore_event_add(ECORE_WL_EVENT_DND_POSITION, event, NULL, NULL);
}
diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c
index 02399249..b7e6f956 100644
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -18,7 +18,6 @@
**/
#include "ecore_wl_private.h"
-#include <sys/mman.h>
/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ...
* What about other OSs ?? */
@@ -34,32 +33,24 @@
# define BTN_BACK 0x116
#endif
-#define MOD_SHIFT_MASK 0x01
-#define MOD_ALT_MASK 0x02
-#define MOD_CONTROL_MASK 0x04
-
/* local function prototypes */
-static void _ecore_wl_input_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps);
-
-static void _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy);
-static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, struct wl_surface *surface);
-static void _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, wl_fixed_t sx, wl_fixed_t sy);
-static void _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state);
-static void _ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, unsigned int axis, wl_fixed_t value);
-static void _ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int format, int fd, unsigned int size);
-static void _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface, struct wl_array *keys __UNUSED__);
-static void _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface);
-static void _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int key, unsigned int state);
-static void _ecore_wl_input_cb_keyboard_modifiers(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial __UNUSED__, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group);
-static void _ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch __UNUSED__, unsigned int serial, unsigned int timestamp, struct wl_surface *surface __UNUSED__, int id __UNUSED__, wl_fixed_t x, wl_fixed_t y);
-static void _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch __UNUSED__, unsigned int serial, unsigned int timestamp, int id __UNUSED__);
-static void _ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch __UNUSED__, unsigned int timestamp, int id __UNUSED__, wl_fixed_t x, wl_fixed_t y);
-static void _ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_touch *touch __UNUSED__);
-static void _ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_touch *touch __UNUSED__);
+static void _ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy);
+static void _ecore_wl_input_cb_button(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state);
+static void _ecore_wl_input_cb_axis(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int axis, int value);
+static void _ecore_wl_input_cb_key(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int key, unsigned int state);
+static void _ecore_wl_input_cb_pointer_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface, int sx, int sy);
+static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface);
+static void _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface, struct wl_array *keys);
+static void _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface);
+static void _ecore_wl_input_cb_touch_down(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, struct wl_surface *surface __UNUSED__, int id __UNUSED__, int x, int y);
+static void _ecore_wl_input_cb_touch_up(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, int id __UNUSED__);
+static 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);
+static void _ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__);
+static void _ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__);
static void _ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, unsigned int id);
-static void _ecore_wl_input_cb_data_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer);
+static 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);
static void _ecore_wl_input_cb_data_leave(void *data, struct wl_data_device *data_device);
-static void _ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, wl_fixed_t x, wl_fixed_t y);
+static void _ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, int x, int y);
static void _ecore_wl_input_cb_data_drop(void *data, struct wl_data_device *data_device);
static void _ecore_wl_input_cb_data_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer);
@@ -72,29 +63,17 @@ static void _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Wind
static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp);
static void _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp);
-/* static int _ecore_wl_input_keysym_to_string(unsigned int symbol, char *buffer, int len); */
-
/* wayland interfaces */
-static const struct wl_pointer_listener pointer_listener =
+static const struct wl_input_device_listener _ecore_wl_input_listener =
{
+ _ecore_wl_input_cb_motion,
+ _ecore_wl_input_cb_button,
+ _ecore_wl_input_cb_axis,
+ _ecore_wl_input_cb_key,
_ecore_wl_input_cb_pointer_enter,
_ecore_wl_input_cb_pointer_leave,
- _ecore_wl_input_cb_pointer_motion,
- _ecore_wl_input_cb_pointer_button,
- _ecore_wl_input_cb_pointer_axis,
-};
-
-static const struct wl_keyboard_listener keyboard_listener =
-{
- _ecore_wl_input_cb_keyboard_keymap,
_ecore_wl_input_cb_keyboard_enter,
_ecore_wl_input_cb_keyboard_leave,
- _ecore_wl_input_cb_keyboard_key,
- _ecore_wl_input_cb_keyboard_modifiers,
-};
-
-static const struct wl_touch_listener touch_listener =
-{
_ecore_wl_input_cb_touch_down,
_ecore_wl_input_cb_touch_up,
_ecore_wl_input_cb_touch_motion,
@@ -102,12 +81,6 @@ static const struct wl_touch_listener touch_listener =
_ecore_wl_input_cb_touch_cancel
};
-static const struct wl_seat_listener _ecore_wl_seat_listener =
-{
- _ecore_wl_input_seat_handle_capabilities,
-};
-
-
static const struct wl_data_device_listener _ecore_wl_data_listener =
{
_ecore_wl_input_cb_data_offer,
@@ -126,7 +99,6 @@ ecore_wl_input_grab(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int bu
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!input) return;
input->grab = win;
input->grab_button = button;
}
@@ -136,68 +108,10 @@ ecore_wl_input_ungrab(Ecore_Wl_Input *input)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!input) return;
input->grab = NULL;
input->grab_button = 0;
}
-EAPI void
-ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_surface *surface, int hot_x, int hot_y)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (input)
- wl_pointer_set_cursor(input->pointer, input->pointer_enter_serial,
- surface, hot_x, hot_y);
-}
-
-EAPI void
-ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_name)
-{
- struct wl_cursor_image *cursor_image;
- struct wl_buffer *buffer;
- struct wl_cursor *cursor;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!input) return;
-
- /* No cursor */
- if (!cursor_name)
- {
- ecore_wl_input_pointer_set(input, NULL, 0, 0);
- return;
- }
-
- if (!(cursor = ecore_wl_cursor_get(cursor_name)))
- return;
-
- if ((!cursor->images) || (!cursor->images[0]))
- return;
-
- cursor_image = cursor->images[0];
- if ((buffer = wl_cursor_image_get_buffer(cursor_image)))
- {
- ecore_wl_input_pointer_set(input, input->cursor_surface,
- cursor_image->hotspot_x,
- cursor_image->hotspot_y);
- wl_surface_attach(input->cursor_surface, buffer, 0, 0);
- wl_surface_damage(input->cursor_surface, 0, 0,
- cursor_image->width, cursor_image->height);
- }
-}
-
-EAPI void
-ecore_wl_input_cursor_default_restore(Ecore_Wl_Input *input)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!input) return;
-
- /* Restore to default wayland cursor */
- ecore_wl_input_cursor_from_name_set(input, "left_ptr");
-}
-
void
_ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)
{
@@ -213,21 +127,18 @@ _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)
input->pointer_focus = NULL;
input->keyboard_focus = NULL;
- input->seat =
- wl_display_bind(ewd->wl.display, id, &wl_seat_interface);
+ input->input_device =
+ wl_display_bind(ewd->wl.display, id, &wl_input_device_interface);
wl_list_insert(ewd->inputs.prev, &input->link);
- wl_seat_add_listener(input->seat,
- &_ecore_wl_seat_listener, input);
- wl_seat_set_user_data(input->seat, input);
+ wl_input_device_add_listener(input->input_device,
+ &_ecore_wl_input_listener, input);
+ wl_input_device_set_user_data(input->input_device, input);
input->data_device =
wl_data_device_manager_get_data_device(ewd->wl.data_device_manager,
- input->seat);
+ input->input_device);
wl_data_device_add_listener(input->data_device,
&_ecore_wl_data_listener, input);
- input->cursor_surface =
- wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
-
ewd->input = input;
}
@@ -243,16 +154,8 @@ _ecore_wl_input_del(Ecore_Wl_Input *input)
input->selection_source = NULL;
if (input->data_device) wl_data_device_destroy(input->data_device);
- if (input->seat) wl_seat_destroy(input->seat);
+ if (input->input_device) wl_input_device_destroy(input->input_device);
wl_list_remove(&input->link);
-
- if (input->xkb.state)
- xkb_state_unref(input->xkb.state);
- if (input->xkb.keymap)
- xkb_map_unref(input->xkb.keymap);
- if (input->cursor_surface)
- wl_surface_destroy(input->cursor_surface);
-
free(input);
}
@@ -265,60 +168,19 @@ _ecore_wl_input_pointer_xy_get(int *x, int *y)
/* local functions */
static void
-_ecore_wl_input_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps)
+_ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy)
{
Ecore_Wl_Input *input;
- if (!(input = data)) return;
- if ((caps & WL_SEAT_CAPABILITY_POINTER) && (!input->pointer))
- {
- input->pointer = wl_seat_get_pointer(seat);
- wl_pointer_set_user_data(input->pointer, input);
- wl_pointer_add_listener(input->pointer, &pointer_listener, input);
- }
- else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && (input->pointer))
- {
- wl_pointer_destroy(input->pointer);
- input->pointer = NULL;
- }
-
- if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && (!input->keyboard))
- {
- input->keyboard = wl_seat_get_keyboard(seat);
- wl_keyboard_set_user_data(input->keyboard, input);
- wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input);
- }
- else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && (input->keyboard))
- {
- wl_keyboard_destroy(input->keyboard);
- input->keyboard = NULL;
- }
-
- if ((caps & WL_SEAT_CAPABILITY_TOUCH) && (!input->touch))
- {
- input->touch = wl_seat_get_touch(seat);
- wl_touch_set_user_data(input->touch, input);
- wl_touch_add_listener(input->touch, &touch_listener, input);
- }
- else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && (input->touch))
- {
- wl_touch_destroy(input->touch);
- input->touch = NULL;
- }
-}
-
-
-static void
-_ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, wl_fixed_t sx, wl_fixed_t sy)
-{
- Ecore_Wl_Input *input;
-
- /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(input = data)) return;
- _pointer_x = input->sx = wl_fixed_to_int(sx);
- _pointer_y = input->sy = wl_fixed_to_int(sy);
+ _pointer_x = sx;
+ _pointer_y = sy;
+
+ input->sx = sx;
+ input->sy = sy;
input->timestamp = timestamp;
@@ -328,7 +190,7 @@ _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer __UNUSE
}
static void
-_ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state)
+_ecore_wl_input_cb_button(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state)
{
Ecore_Wl_Input *input;
@@ -339,7 +201,7 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer __UNUSE
input->timestamp = timestamp;
input->display->serial = serial;
-// _ecore_wl_input_mouse_move_send(input, input->pointer_focus, timestamp);
+// _ecore_wl_input_mouse_move_send(input, timestamp);
if (state)
{
@@ -364,222 +226,49 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer __UNUSE
}
static void
-_ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, unsigned int axis, wl_fixed_t value)
+_ecore_wl_input_cb_axis(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int axis, int value)
{
Ecore_Wl_Input *input;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(input = data)) return;
- _ecore_wl_input_mouse_wheel_send(input, axis, wl_fixed_to_int(value),
- timestamp);
+ _ecore_wl_input_mouse_wheel_send(input, axis, value, timestamp);
}
static void
-_ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int format, int fd, unsigned int size)
-{
- Ecore_Wl_Input *input;
- char *map = NULL;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!(input = data))
- {
- close(fd);
- return;
- }
-
- if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
- {
- close(fd);
- return;
- }
-
- map = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
- if (map == MAP_FAILED)
- {
- close(fd);
- return;
- }
-
- input->xkb.keymap =
- xkb_map_new_from_string(input->display->xkb.context, map,
- XKB_KEYMAP_FORMAT_TEXT_V1, 0);
-
- munmap(map, size);
- close(fd);
-
- if (!(input->xkb.keymap)) return;
- if (!(input->xkb.state = xkb_state_new(input->xkb.keymap)))
- {
- xkb_map_unref(input->xkb.keymap);
- input->xkb.keymap = NULL;
- return;
- }
-
- input->xkb.control_mask =
- 1 << xkb_map_mod_get_index(input->xkb.keymap, "Control");
- input->xkb.alt_mask =
- 1 << xkb_map_mod_get_index(input->xkb.keymap, "Mod1");
- input->xkb.shift_mask =
- 1 << xkb_map_mod_get_index(input->xkb.keymap, "Shift");
-}
-
-/*
- * _ecore_wl_input_keysym_to_string: Translate a symbol to its printable form
- *
- * @symbol: the symbol to translate
- * @buffer: the buffer where to put the translated string
- * @len: size of the buffer
- *
- * Translates @symbol into a printable representation in @buffer, if possible.
- *
- * Return value: The number of bytes of the translated string, 0 if the
- * symbol can't be printed
- *
- * Note: The code is derived from libX11's src/KeyBind.c
- * Copyright 1985, 1987, 1998 The Open Group
- *
- */
-static int
-_ecore_wl_input_keysym_to_string(unsigned int symbol, char *buffer, int len)
-{
- unsigned long high_bytes;
- unsigned char c;
-
- high_bytes = symbol >> 8;
- if (!(len &&
- ((high_bytes == 0) ||
- ((high_bytes == 0xFF) &&
- (((symbol >= XKB_KEY_BackSpace) &&
- (symbol <= XKB_KEY_Clear)) ||
- (symbol == XKB_KEY_Return) ||
- (symbol == XKB_KEY_Escape) ||
- (symbol == XKB_KEY_KP_Space) ||
- (symbol == XKB_KEY_KP_Tab) ||
- (symbol == XKB_KEY_KP_Enter) ||
- ((symbol >= XKB_KEY_KP_Multiply) &&
- (symbol <= XKB_KEY_KP_9)) ||
- (symbol == XKB_KEY_KP_Equal) ||
- (symbol == XKB_KEY_Delete))))))
- return 0;
-
- if (symbol == XKB_KEY_KP_Space)
- c = ' ';
- else if (high_bytes == 0xFF)
- c = symbol & 0x7F;
- else
- c = symbol & 0xFF;
-
- buffer[0] = c;
- return 1;
-}
-
-static void
-_ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state)
+_ecore_wl_input_cb_key(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int key, unsigned int state)
{
Ecore_Wl_Input *input;
Ecore_Wl_Window *win;
- unsigned int code, num;
- const xkb_keysym_t *syms;
- xkb_keysym_t sym;
- char string[32], key[32], keyname[32];
- Ecore_Event_Key *e;
+ unsigned int keycode = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(input = data)) return;
- input->display->serial = serial;
- code = keycode + 8;
+ input->timestamp = timestamp;
+ input->display->serial = serial;
win = input->keyboard_focus;
if ((!win) || (win->keyboard_device != input)) return;
- num = xkb_key_get_syms(input->xkb.state, code, &syms);
-
- xkb_state_update_key(input->xkb.state, code,
- (state ? XKB_KEY_DOWN : XKB_KEY_UP));
-
- /* mask = xkb_state_serialize_mods(input->display->xkb.state, */
- /* (XKB_STATE_DEPRESSED | XKB_STATE_LATCHED)); */
- /* input->modifiers = 0; */
- /* if (mask & input->display->xkb.control_mask) */
- /* input->modifiers |= MOD_CONTROL_MASK; */
- /* if (mask & input->display->xkb.alt_mask) */
- /* input->modifiers |= MOD_ALT_MASK; */
- /* if (mask & input->display->xkb.shift_mask) */
- /* input->modifiers |= MOD_SHIFT_MASK; */
-
- if (num == 1) sym = syms[0];
- else sym = XKB_KEY_NoSymbol;
-
- memset(key, 0, sizeof(key));
- memset(keyname, 0, sizeof(keyname));
- memset(string, 0, sizeof(string));
+ /* FIXME: NB: I believe this should be min_key_code rather than 8,
+ * but weston code has it like this */
+ keycode = key + 8;
- /* TODO: Switch over to the libxkbcommon API when it is available */
- if (!_ecore_wl_input_keysym_to_string(sym, string, sizeof(string)))
- string[0] = '\0';
-
- xkb_keysym_get_name(sym, key, sizeof(key));
- xkb_keysym_get_name(sym, keyname, sizeof(keyname));
-
- e = malloc(sizeof(Ecore_Event_Key) + strlen(keyname) + strlen(key) +
- strlen(string) + 3);
-
- e->keyname = (char *)(e + 1);
- e->key = e->keyname + strlen(keyname) + 1;
- e->string = strlen(string) ? e->key + strlen(key) + 1 : NULL;
- e->compose = e->string;
-
- strcpy((char *)e->keyname, keyname);
- strcpy((char *)e->key, key);
- if (strlen (string))
- strcpy((char *)e->string, string);
-
- e->window = win->id;
- e->event_window = win->id;
- e->timestamp = timestamp;
- e->modifiers = input->modifiers;
+ /* if ((input->modifiers & XKB_COMMON_SHIFT_MASK) && */
+ /* (XkbKeyGroupWidth(_ecore_wl_disp->xkb, keycode, 0) > 1)) */
+ /* level = 1; */
+ /* keysym = XkbKeySymEntry(_ecore_wl_disp->xkb, keycode, level, 0); */
if (state)
- ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
+ input->modifiers |= _ecore_wl_disp->xkb->map->modmap[keycode];
else
- ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
+ input->modifiers &= ~_ecore_wl_disp->xkb->map->modmap[keycode];
}
static void
-_ecore_wl_input_cb_keyboard_modifiers(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial __UNUSED__, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group)
-{
- Ecore_Wl_Input *input;
- xkb_mod_mask_t mask = 0;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!(input = data)) return;
- if (input->xkb.state)
- {
- xkb_state_update_mask(input->xkb.state, depressed, latched,
- locked, 0, 0, group);
-
- mask =
- xkb_state_serialize_mods(input->xkb.state,
- (XKB_STATE_DEPRESSED | XKB_STATE_LATCHED));
- }
-
- input->modifiers = 0;
-
- /* The Ecore_Event_Modifiers don't quite match the X mask bits */
- if (mask & input->xkb.control_mask)
- input->modifiers |= MOD_CONTROL_MASK;
- if (mask & input->xkb.alt_mask)
- input->modifiers |= MOD_ALT_MASK;
- if (mask & input->xkb.shift_mask)
- input->modifiers |= MOD_SHIFT_MASK;
-}
-
-static void
-_ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy)
+_ecore_wl_input_cb_pointer_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface, int sx, int sy)
{
Ecore_Wl_Input *input;
Ecore_Wl_Window *win = NULL;
@@ -596,8 +285,8 @@ _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer __UNUSED
input->timestamp = (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}
- input->sx = wl_fixed_to_int(sx);
- input->sy = wl_fixed_to_int(sy);
+ input->sx = sx;
+ input->sy = sy;
input->display->serial = serial;
input->pointer_enter_serial = serial;
@@ -606,12 +295,9 @@ _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer __UNUSED
win->pointer_device = input;
input->pointer_focus = win;
- /* _ecore_wl_input_mouse_move_send(input, win, input->timestamp); */
+ _ecore_wl_input_mouse_move_send(input, win, input->timestamp);
_ecore_wl_input_mouse_in_send(input, win, input->timestamp);
- /* The cursor on the surface is undefined until we set it */
- ecore_wl_window_cursor_default_restore(win);
-
/* NB: This whole 'if' below is a major HACK due to wayland's stupidness
* of not sending a mouse_up (or any notification at all for that matter)
* when a move or resize grab is finished */
@@ -647,7 +333,7 @@ _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer __UNUSED
}
static void
-_ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, struct wl_surface *surface)
+_ecore_wl_input_cb_pointer_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface)
{
Ecore_Wl_Input *input;
Ecore_Wl_Window *win;
@@ -664,7 +350,7 @@ _ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *pointer __UNUSED
win->pointer_device = NULL;
input->pointer_focus = NULL;
- /* _ecore_wl_input_mouse_move_send(input, win, input->timestamp); */
+ _ecore_wl_input_mouse_move_send(input, win, input->timestamp);
_ecore_wl_input_mouse_out_send(input, win, input->timestamp);
if (input->grab)
@@ -676,10 +362,11 @@ _ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *pointer __UNUSED
}
static void
-_ecore_wl_input_cb_keyboard_enter(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface, struct wl_array *keys __UNUSED__)
+_ecore_wl_input_cb_keyboard_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface, struct wl_array *keys)
{
Ecore_Wl_Input *input;
Ecore_Wl_Window *win = NULL;
+ unsigned int *k, *end;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -693,6 +380,11 @@ _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_keyboard *keyboard __UNU
input->timestamp = (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}
+ end = keys->data + keys->size;
+ input->modifiers = 0;
+ for (k = keys->data; k < end; k++)
+ input->modifiers |= _ecore_wl_disp->xkb->map->modmap[*k];
+
input->display->serial = serial;
if (!(win = wl_surface_get_user_data(surface))) return;
@@ -700,11 +392,12 @@ _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_keyboard *keyboard __UNU
win->keyboard_device = input;
input->keyboard_focus = win;
+ /* FIXME: NB: This may need to be 'serial' */
_ecore_wl_input_focus_in_send(input, win, input->timestamp);
}
static void
-_ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface)
+_ecore_wl_input_cb_keyboard_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, struct wl_surface *surface)
{
Ecore_Wl_Input *input;
Ecore_Wl_Window *win;
@@ -733,7 +426,7 @@ _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *keyboard __UNU
}
static void
-_ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch __UNUSED__, unsigned int serial, unsigned int timestamp, struct wl_surface *surface __UNUSED__, int id __UNUSED__, wl_fixed_t x, wl_fixed_t y)
+_ecore_wl_input_cb_touch_down(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, struct wl_surface *surface __UNUSED__, int id __UNUSED__, int x, int y)
{
Ecore_Wl_Input *input;
@@ -746,13 +439,13 @@ _ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch __UNUSED__, uns
/* input->timestamp = timestamp; */
input->display->serial = serial;
input->button = 0;
- input->sx = wl_fixed_to_int(x);
- input->sy = wl_fixed_to_int(y);
+ input->sx = x;
+ input->sy = y;
_ecore_wl_input_mouse_down_send(input, input->pointer_focus, timestamp);
}
static void
-_ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch __UNUSED__, unsigned int serial, unsigned int timestamp, int id __UNUSED__)
+_ecore_wl_input_cb_touch_up(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int serial, unsigned int timestamp, int id __UNUSED__)
{
Ecore_Wl_Input *input;
@@ -769,7 +462,7 @@ _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch __UNUSED__, unsig
}
static void
-_ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch __UNUSED__, unsigned int timestamp, int id __UNUSED__, wl_fixed_t x, wl_fixed_t y)
+_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)
{
Ecore_Wl_Input *input;
@@ -780,20 +473,20 @@ _ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch __UNUSED__, u
/* FIXME: NB: Not sure yet if input->timestamp should be set here.
* This needs to be tested with an actual touch device */
/* input->timestamp = timestamp; */
- input->sx = wl_fixed_to_int(x);
- input->sy = wl_fixed_to_int(y);
+ input->sx = x;
+ input->sy = y;
_ecore_wl_input_mouse_move_send(input, input->pointer_focus, timestamp);
}
static void
-_ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_touch *touch __UNUSED__)
+_ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
static void
-_ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_touch *touch __UNUSED__)
+_ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_input_device *input_device __UNUSED__)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
@@ -807,7 +500,7 @@ _ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, un
}
static void
-_ecore_wl_input_cb_data_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer)
+_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)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -823,7 +516,7 @@ _ecore_wl_input_cb_data_leave(void *data, struct wl_data_device *data_device)
}
static void
-_ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, wl_fixed_t x, wl_fixed_t y)
+_ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, int x, int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -969,7 +662,6 @@ _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, uns
ev->y = input->sy;
/* ev->root.x = input->sx; */
/* ev->root.y = input->sy; */
- /* printf("Input Modifiers: %d\n", input->modifiers); */
ev->modifiers = input->modifiers;
/* FIXME: Need to get these from wayland somehow */
@@ -1051,15 +743,14 @@ _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int v
/* ev->root.x = input->sx; */
/* ev->root.y = input->sy; */
- if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
+ if (axis == WL_INPUT_DEVICE_AXIS_VERTICAL_SCROLL)
{
- ev->direction = 0;
- ev->z = -value;
+ ev->direction = value;
+ ev->z = 1;
}
- else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
+ else if (axis == WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL)
{
- ev->direction = 1;
- ev->z = -value;
+ /* TODO: handle horizontal scroll */
}
if (input->grab)
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index 20d76261..75b562c4 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -2,7 +2,7 @@
# define _ECORE_WAYLAND_PRIVATE_H
# include <limits.h>
-# include <unistd.h>
+# include <xkbcommon/xkbcommon.h>
# include "Ecore.h"
# include "Ecore_Input.h"
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 45a82a37..d9493345 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -8,21 +8,12 @@
static void _ecore_wl_window_cb_ping(void *data __UNUSED__, struct wl_shell_surface *shell_surface, unsigned int serial);
static void _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, unsigned int edges, int w, int h);
static void _ecore_wl_window_cb_popup_done(void *data, struct wl_shell_surface *shell_surface __UNUSED__);
-static void _ecore_wl_window_cb_surface_enter(void *data, struct wl_surface *surface, struct wl_output *output);
-static void _ecore_wl_window_cb_surface_leave(void *data, struct wl_surface *surface, struct wl_output *output);
-static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h);
-static char *_ecore_wl_window_id_str_get(unsigned int win_id);
+static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int timestamp);
/* local variables */
static Eina_Hash *_windows = NULL;
/* wayland listeners */
-static const struct wl_surface_listener _ecore_wl_surface_listener =
-{
- _ecore_wl_window_cb_surface_enter,
- _ecore_wl_window_cb_surface_leave
-};
-
static const struct wl_shell_surface_listener _ecore_wl_shell_surface_listener =
{
_ecore_wl_window_cb_ping,
@@ -34,8 +25,7 @@ static const struct wl_shell_surface_listener _ecore_wl_shell_surface_listener =
void
_ecore_wl_window_init(void)
{
- if (!_windows)
- _windows = eina_hash_string_superfast_new(NULL);
+ if (!_windows) _windows = eina_hash_pointer_new(free);
}
void
@@ -91,12 +81,11 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
win->allocation.h = h;
win->saved_allocation = win->allocation;
win->transparent = EINA_FALSE;
- /* win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL; */
- win->type = ECORE_WL_WINDOW_TYPE_NONE;
+ win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
win->buffer_type = buffer_type;
win->id = _win_id++;
- eina_hash_add(_windows, _ecore_wl_window_id_str_get(win->id), win);
+ eina_hash_add(_windows, &win->id, win);
return win;
}
@@ -117,7 +106,7 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
if (!win) return;
- eina_hash_del(_windows, _ecore_wl_window_id_str_get(win->id), win);
+ eina_hash_del(_windows, &win->id, NULL);
wl_list_for_each(input, &_ecore_wl_disp->inputs, link)
{
@@ -137,8 +126,7 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
if (win->surface) wl_surface_destroy(win->surface);
win->surface = NULL;
- /* HMMM, why was this disabled ? */
- free(win);
+// free(win);
}
/**
@@ -177,9 +165,9 @@ ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y)
}
}
- if ((!input) || (!input->seat)) return;
+ if ((!input) || (!input->input_device)) return;
- wl_shell_surface_move(win->shell_surface, input->seat,
+ wl_shell_surface_move(win->shell_surface, input->input_device,
input->display->serial);
}
}
@@ -237,9 +225,9 @@ ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location)
}
}
- if ((!input) || (!input->seat)) return;
+ if ((!input) || (!input->input_device)) return;
- wl_shell_surface_resize(win->shell_surface, input->seat,
+ wl_shell_surface_resize(win->shell_surface, input->input_device,
input->display->serial, location);
}
}
@@ -273,9 +261,6 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
if (buffer)
wl_surface_attach(win->surface, buffer, x, y);
- wl_surface_damage(win->surface, 0, 0,
- win->allocation.w, win->allocation.h);
-
win->server_allocation = win->allocation;
}
break;
@@ -283,6 +268,10 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
return;
}
+ if (win->surface)
+ wl_surface_damage(win->surface, 0, 0,
+ win->allocation.w, win->allocation.h);
+
if (win->region.input)
{
wl_surface_set_input_region(win->surface, win->region.input);
@@ -318,7 +307,6 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
wl_surface_set_user_data(win->surface, win);
- /* wl_surface_add_listener(win->surface, &_ecore_wl_surface_listener, win); */
win->shell_surface =
wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, win->surface);
@@ -342,14 +330,13 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
break;
case ECORE_WL_WINDOW_TYPE_MENU:
wl_shell_surface_set_popup(win->shell_surface,
- _ecore_wl_disp->input->seat,
- _ecore_wl_disp->serial,
+ _ecore_wl_disp->input->input_device,
+ _ecore_wl_disp->input->timestamp,
+ /* win->parent->pointer_device->input_device, */
+ /* win->parent->pointer_device->timestamp, */
win->parent->shell_surface,
win->allocation.x, win->allocation.y, 0);
break;
- case ECORE_WL_WINDOW_TYPE_NONE:
- win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
- /* fallthrough */
case ECORE_WL_WINDOW_TYPE_TOPLEVEL:
wl_shell_surface_set_toplevel(win->shell_surface);
break;
@@ -430,12 +417,16 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
}
else
{
+ Ecore_Wl_Input *input;
+
+ input = win->keyboard_device;
+
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
win->allocation = win->saved_allocation;
_ecore_wl_window_configure_send(win, win->allocation.w,
- win->allocation.h);
+ win->allocation.h, input->timestamp);
}
}
@@ -457,12 +448,16 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
}
else
{
+ Ecore_Wl_Input *input;
+
+ input = win->keyboard_device;
+
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
win->allocation = win->saved_allocation;
_ecore_wl_window_configure_send(win, win->allocation.w,
- win->allocation.h);
+ win->allocation.h, input->timestamp);
}
}
@@ -517,10 +512,12 @@ ecore_wl_window_shell_surface_get(Ecore_Wl_Window *win)
EAPI Ecore_Wl_Window *
ecore_wl_window_find(unsigned int id)
{
- Ecore_Wl_Window *win = NULL;
+ Ecore_Wl_Window *win;
- win = eina_hash_find(_windows, _ecore_wl_window_id_str_get(id));
- return win;
+ if (!id) return NULL;
+ win = eina_hash_find(_windows, &id);
+ if (win) return win;
+ return NULL;
}
EAPI void
@@ -533,7 +530,7 @@ ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type)
}
EAPI void
-ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, int hot_x, int hot_y)
+ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_buffer *buffer, int hot_x, int hot_y, unsigned int timestamp)
{
Ecore_Wl_Input *input;
@@ -541,34 +538,9 @@ ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, in
if (!win) return;
- if ((input = win->pointer_device))
- ecore_wl_input_pointer_set(input, surface, hot_x, hot_y);
-}
-
-EAPI void
-ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char *cursor_name)
-{
- Ecore_Wl_Input *input;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!win) return;
-
- if ((input = win->pointer_device))
- ecore_wl_input_cursor_from_name_set(input, cursor_name);
-}
-
-EAPI void
-ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win)
-{
- Ecore_Wl_Input *input;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!win) return;
-
- if ((input = win->pointer_device))
- ecore_wl_input_cursor_default_restore(input);
+ input = _ecore_wl_disp->input;
+ wl_input_device_attach(input->input_device, timestamp,
+ buffer, hot_x, hot_y);
}
/* @since 1.2 */
@@ -606,7 +578,8 @@ _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface
if (win->region.opaque) wl_region_destroy(win->region.opaque);
win->region.opaque = NULL;
- _ecore_wl_window_configure_send(win, w, h);
+ /* FIXME: 0 timestamp here may not work. need to test */
+ _ecore_wl_window_configure_send(win, w, h, 0);
}
}
@@ -622,27 +595,7 @@ _ecore_wl_window_cb_popup_done(void *data, struct wl_shell_surface *shell_surfac
}
static void
-_ecore_wl_window_cb_surface_enter(void *data, struct wl_surface *surface, struct wl_output *output)
-{
- Ecore_Wl_Window *win;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!(win = data)) return;
-}
-
-static void
-_ecore_wl_window_cb_surface_leave(void *data, struct wl_surface *surface, struct wl_output *output)
-{
- Ecore_Wl_Window *win;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!(win = data)) return;
-}
-
-static void
-_ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h)
+_ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int timestamp)
{
Ecore_Wl_Event_Window_Configure *ev;
@@ -655,26 +608,6 @@ _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h)
ev->y = win->allocation.y;
ev->w = w;
ev->h = h;
+ ev->timestamp = timestamp;
ecore_event_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
}
-
-static char *
-_ecore_wl_window_id_str_get(unsigned int win_id)
-{
- const char *vals = "qWeRtYuIoP5$&<~";
- static char id[9];
- unsigned int val;
-
- val = win_id;
- id[0] = vals[(val >> 28) & 0xf];
- id[1] = vals[(val >> 24) & 0xf];
- id[2] = vals[(val >> 20) & 0xf];
- id[3] = vals[(val >> 16) & 0xf];
- id[4] = vals[(val >> 12) & 0xf];
- id[5] = vals[(val >> 8) & 0xf];
- id[6] = vals[(val >> 4) & 0xf];
- id[7] = vals[(val) & 0xf];
- id[8] = 0;
-
- return id;
-}
diff --git a/src/lib/ecore_win32/Makefile.am b/src/lib/ecore_win32/Makefile.am
index 7031fa57..ce317c77 100644
--- a/src/lib/ecore_win32/Makefile.am
+++ b/src/lib/ecore_win32/Makefile.am
@@ -6,7 +6,6 @@ AM_CPPFLAGS = \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_input \
@EFL_ECORE_WIN32_BUILD@ \
-@EVIL_CFLAGS@ \
@EINA_CFLAGS@ \
@WIN32_CPPFLAGS@
@@ -31,8 +30,7 @@ libecore_win32_la_LIBADD = \
@WIN32_LIBS@ \
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
-@EINA_LIBS@ \
-@EVIL_LIBS@
+@EINA_LIBS@
libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
diff --git a/src/lib/ecore_win32/ecore_win32_cursor.c b/src/lib/ecore_win32/ecore_win32_cursor.c
index 9b58c951..9a5a7eb7 100644
--- a/src/lib/ecore_win32/ecore_win32_cursor.c
+++ b/src/lib/ecore_win32/ecore_win32_cursor.c
@@ -46,7 +46,7 @@
*
* This function creates a new cursor of size @p width and @p
* height. They must be valid size. To determine the valid size of a
- * cursor, use ecore_win32_cursor_size_get(). @p pixels_and is an array
+ * cursor, useecore_win32_cursor_size_get(). @p pixels_and is an array
* of bytes (unsigned char) containing the bits of the cursor that
* will be visible. @p pixels_xor is similar but will allow the cursor
* to have a shape. Here is the truth table for the masks:
@@ -114,7 +114,8 @@
* 0xFF, 0xFF, 0xFF, 0xFF // line 32
* };
*
- * unsigned char pixels_xor[] = {
+ * unsigned char pixels_xor[] =
+ * {
* 0x00, 0x00, 0x00, 0x00, // line 1
* 0x00, 0x03, 0xC0, 0x00, // line 2
* 0x00, 0x3F, 0x00, 0x00, // line 3
@@ -156,7 +157,7 @@
* 0x00, 0x00, 0x00, 0x00 // line 32
* };
*
- * Ecore_Win32_Cursor *cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2);
+ * Ecore_Win32_Cursor cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2);
* @endcode
*/
EAPI Ecore_Win32_Cursor *
diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index 9e4a6f73..1472fc0a 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -126,22 +126,35 @@ typedef enum _Ecore_X_Composite_Update_Type
typedef enum _Ecore_X_Window_State
{
/* Unknown state */
- ECORE_X_WINDOW_STATE_UNKNOWN = 0, /** The window is iconified. */
- ECORE_X_WINDOW_STATE_ICONIFIED, /** The window is a modal dialog box. */
- ECORE_X_WINDOW_STATE_MODAL, /** The window manager should keep the window's position fixed
- * even if the virtual desktop scrolls. */
- ECORE_X_WINDOW_STATE_STICKY, /** The window has the maximum vertical size. */
- ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, /** The window has the maximum horizontal size. */
- ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, /** The window is shaded. */
- ECORE_X_WINDOW_STATE_SHADED, /** The window should not be included in the taskbar. */
- ECORE_X_WINDOW_STATE_SKIP_TASKBAR, /** The window should not be included in the pager. */
- ECORE_X_WINDOW_STATE_SKIP_PAGER, /** The window is invisible (i.e. minimized/iconified) */
- ECORE_X_WINDOW_STATE_HIDDEN, /** The window should fill the entire screen and have no
- * window border/decorations */
- ECORE_X_WINDOW_STATE_FULLSCREEN, /* The following are not documented because they are not
- * intended for use in applications. */
- ECORE_X_WINDOW_STATE_ABOVE, ECORE_X_WINDOW_STATE_BELOW, /* FIXME: Documentation */
- ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION
+ ECORE_X_WINDOW_STATE_UNKNOWN = 0,
+ /** The window is iconified. */
+ ECORE_X_WINDOW_STATE_ICONIFIED,
+ /** The window is a modal dialog box. */
+ ECORE_X_WINDOW_STATE_MODAL,
+ /** The window manager should keep the window's position fixed
+ * even if the virtual desktop scrolls. */
+ ECORE_X_WINDOW_STATE_STICKY,
+ /** The window has the maximum vertical size. */
+ ECORE_X_WINDOW_STATE_MAXIMIZED_VERT,
+ /** The window has the maximum horizontal size. */
+ ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ,
+ /** The window is shaded. */
+ ECORE_X_WINDOW_STATE_SHADED,
+ /** The window should not be included in the taskbar. */
+ ECORE_X_WINDOW_STATE_SKIP_TASKBAR,
+ /** The window should not be included in the pager. */
+ ECORE_X_WINDOW_STATE_SKIP_PAGER,
+ /** The window is invisible (i.e. minimized/iconified) */
+ ECORE_X_WINDOW_STATE_HIDDEN,
+ /** The window should fill the entire screen and have no
+ * window border/decorations */
+ ECORE_X_WINDOW_STATE_FULLSCREEN,
+ /* The following are not documented because they are not
+ * intended for use in applications. */
+ ECORE_X_WINDOW_STATE_ABOVE,
+ ECORE_X_WINDOW_STATE_BELOW,
+ /* FIXME: Documentation */
+ ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION
} Ecore_X_Window_State;
typedef enum _Ecore_X_Window_State_Action
@@ -184,8 +197,7 @@ typedef enum _Ecore_X_Randr_Output_Policy
ECORE_X_RANDR_OUTPUT_POLICY_BELOW = 3,
ECORE_X_RANDR_OUTPUT_POLICY_LEFT = 4,
ECORE_X_RANDR_OUTPUT_POLICY_CLONE = 5,
- ECORE_X_RANDR_OUTPUT_POLICY_NONE = 6,
- ECORE_X_RANDR_OUTPUT_POLICY_ASK = 7
+ ECORE_X_RANDR_OUTPUT_POLICY_NONE = 6
} Ecore_X_Randr_Output_Policy;
typedef enum _Ecore_X_Randr_Relative_Alignment
@@ -351,36 +363,6 @@ typedef enum _Ecore_X_Netwm_Direction
ECORE_X_NETWM_DIRECTION_CANCEL = 11,
} Ecore_X_Netwm_Direction;
-/**
- * @typedef _Ecore_X_Error_Code
- * Defines the error codes of Ecore_X which wraps the X Window Systems
- * protocol's errors.
- *
- * @since 1.3.0
- */
-typedef enum _Ecore_X_Error_Code
-{
- /** Everything is okay. */
- ECORE_X_ERROR_CODE_SUCCESS = 0, /** Bad request code */
- ECORE_X_ERROR_CODE_BAD_REQUEST = 1, /** Int parameter out of range */
- ECORE_X_ERROR_CODE_BAD_VALUE = 2, /** Parameter not a Window */
- ECORE_X_ERROR_CODE_BAD_WINDOW = 3, /** Parameter not a Pixmap */
- ECORE_X_ERROR_CODE_BAD_PIXMAP = 4, /** Parameter not an Atom */
- ECORE_X_ERROR_CODE_BAD_ATOM = 5, /** Parameter not a Cursor */
- ECORE_X_ERROR_CODE_BAD_CURSOR = 6, /** Parameter not a Font */
- ECORE_X_ERROR_CODE_BAD_FONT = 7, /** Parameter mismatch */
- ECORE_X_ERROR_CODE_BAD_MATCH = 8, /** Parameter not a Pixmap or Window */
- ECORE_X_ERROR_CODE_BAD_DRAWABLE = 9, /** Bad access */
- ECORE_X_ERROR_CODE_BAD_ACCESS = 10, /** Insufficient resources */
- ECORE_X_ERROR_CODE_BAD_ALLOC = 11, /** No such colormap */
- ECORE_X_ERROR_CODE_BAD_COLOR = 12, /** Parameter not a GC */
- ECORE_X_ERROR_CODE_BAD_GC = 13, /** Choice not in range or already used */
- ECORE_X_ERROR_CODE_BAD_ID_CHOICE = 14, /** Font or color name doesn't exist */
- ECORE_X_ERROR_CODE_BAD_NAME = 15, /** Request length incorrect */
- ECORE_X_ERROR_CODE_BAD_LENGTH = 16, /** Server is defective */
- ECORE_X_ERROR_CODE_BAD_IMPLEMENTATION = 17,
-} Ecore_X_Error_Code;
-
typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In;
typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In;
@@ -987,7 +969,8 @@ struct _Ecore_X_Event_Generic
};
EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on
- backend in use, if Xlib will be XEvent, if XCB will be xcb_generic_event_t.
+ backend in use, if Xlib will be XEvent,
+ if XCB will be xcb_generic_event_t.
@warning avoid using it.
*/
EAPI extern int ECORE_X_EVENT_MOUSE_IN;
@@ -1063,41 +1046,41 @@ EAPI extern int ECORE_X_LOCK_SHIFT;
typedef enum _Ecore_X_WM_Protocol
{
- /** If enabled the window manager will be asked to send a
+ /* If enabled the window manager will be asked to send a
* delete message instead of just closing (destroying) the window. */
- ECORE_X_WM_PROTOCOL_DELETE_REQUEST,
+ ECORE_X_WM_PROTOCOL_DELETE_REQUEST,
- /** If enabled the window manager will be told that the window
- * explicitly sets input focus. */
- ECORE_X_WM_PROTOCOL_TAKE_FOCUS,
+ /* If enabled the window manager will be told that the window
+ * explicitly sets input focus. */
+ ECORE_X_WM_PROTOCOL_TAKE_FOCUS,
- /** If enabled the window manager can ping the window to check
- * if it is alive. */
- ECORE_X_NET_WM_PROTOCOL_PING,
+ /* If enabled the window manager can ping the window to check
+ * if it is alive. */
+ ECORE_X_NET_WM_PROTOCOL_PING,
- /** If enabled the window manager can sync updating with the
- * window (?) */
- ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST,
+ /* If enabled the window manager can sync updating with the
+ * window (?) */
+ ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST,
- /** Number of defined items */
- ECORE_X_WM_PROTOCOL_NUM
+ /* Number of defined items */
+ ECORE_X_WM_PROTOCOL_NUM
} Ecore_X_WM_Protocol;
typedef enum _Ecore_X_Window_Input_Mode
{
- /** The window can never be focused */
- ECORE_X_WINDOW_INPUT_MODE_NONE,
+ /* The window can never be focused */
+ ECORE_X_WINDOW_INPUT_MODE_NONE,
- /** The window can be focused by the WM but doesn't focus itself */
- ECORE_X_WINDOW_INPUT_MODE_PASSIVE,
+ /* The window can be focused by the WM but doesn't focus itself */
+ ECORE_X_WINDOW_INPUT_MODE_PASSIVE,
- /** The window sets the focus itself if one of its sub-windows
- * already is focused */
- ECORE_X_WINDOW_INPUT_MODE_ACTIVE_LOCAL,
+ /* The window sets the focus itself if one of its sub-windows
+ * already is focused */
+ ECORE_X_WINDOW_INPUT_MODE_ACTIVE_LOCAL,
- /** The window sets the focus itself even if another window
- * is currently focused */
- ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL
+ /* The window sets the focus itself even if another window
+ * is currently focused */
+ ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL
} Ecore_X_Window_Input_Mode;
/**
@@ -1107,16 +1090,16 @@ typedef enum _Ecore_X_Window_Input_Mode
typedef enum _Ecore_X_Window_State_Hint
{
/** Do not provide any state hint to the window manager */
- ECORE_X_WINDOW_STATE_HINT_NONE = -1,
+ ECORE_X_WINDOW_STATE_HINT_NONE = -1,
- /** The window wants to remain hidden and NOT iconified */
- ECORE_X_WINDOW_STATE_HINT_WITHDRAWN,
+ /** The window wants to remain hidden and NOT iconified */
+ ECORE_X_WINDOW_STATE_HINT_WITHDRAWN,
- /** The window wants to be mapped normally */
- ECORE_X_WINDOW_STATE_HINT_NORMAL,
+ /** The window wants to be mapped normally */
+ ECORE_X_WINDOW_STATE_HINT_NORMAL,
- /** The window wants to start in an iconified state */
- ECORE_X_WINDOW_STATE_HINT_ICONIC
+ /** The window wants to start in an iconified state */
+ ECORE_X_WINDOW_STATE_HINT_ICONIC
} Ecore_X_Window_State_Hint;
typedef enum _Ecore_X_Window_Type
@@ -1238,258 +1221,864 @@ typedef enum _Ecore_X_Illume_Window_State
#define ECORE_X_PROP_LIST_ADD 1
#define ECORE_X_PROP_LIST_TOGGLE 2
-EAPI int ecore_x_init(const char *name);
-EAPI int ecore_x_shutdown(void);
-EAPI int ecore_x_disconnect(void);
-EAPI Ecore_X_Display *ecore_x_display_get(void);
-EAPI Ecore_X_Connection *ecore_x_connection_get(void);
-EAPI int ecore_x_fd_get(void);
-EAPI Ecore_X_Screen *ecore_x_default_screen_get(void);
-EAPI void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h);
-EAPI int ecore_x_screen_count_get(void);
-EAPI int ecore_x_screen_index_get(const Ecore_X_Screen *screen);
-EAPI Ecore_X_Screen *ecore_x_screen_get(int index);
-
-EAPI void ecore_x_double_click_time_set(double t);
-EAPI double ecore_x_double_click_time_get(void);
-EAPI void ecore_x_flush(void);
-EAPI void ecore_x_sync(void);
-EAPI void ecore_x_killall(Ecore_X_Window root);
-EAPI void ecore_x_kill(Ecore_X_Window win);
-EAPI int ecore_x_dpi_get(void);
-EAPI Eina_Bool ecore_x_bell(int percent);
-EAPI unsigned int ecore_x_visual_id_get(Ecore_X_Visual visual);
-
-EAPI Ecore_X_Visual ecore_x_default_visual_get(Ecore_X_Display *disp, Ecore_X_Screen *screen);
-EAPI Ecore_X_Colormap ecore_x_default_colormap_get(Ecore_X_Display *disp, Ecore_X_Screen *screen);
-EAPI int ecore_x_default_depth_get(Ecore_X_Display *disp, Ecore_X_Screen *screen);
-
-EAPI Ecore_X_Time ecore_x_current_time_get(void);
-
-EAPI void ecore_x_error_handler_set(void (*func)(void *data), const void *data);
-EAPI void ecore_x_io_error_handler_set(void (*func)(void *data), const void *data);
-EAPI int ecore_x_error_request_get(void);
-EAPI int ecore_x_error_code_get(void);
-EAPI Ecore_X_ID ecore_x_error_resource_id_get(void);
-
-EAPI void ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask);
-EAPI void ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask);
-
-EAPI Eina_Bool ecore_x_selection_notify_send(Ecore_X_Window requestor, Ecore_X_Atom selection, Ecore_X_Atom target, Ecore_X_Atom property, Ecore_X_Time time);
-EAPI Eina_Bool ecore_x_selection_primary_set(Ecore_X_Window w, const void *data, int size);
-EAPI Eina_Bool ecore_x_selection_primary_clear(void);
-EAPI Eina_Bool ecore_x_selection_secondary_set(Ecore_X_Window w, const void *data, int size);
-EAPI Eina_Bool ecore_x_selection_secondary_clear(void);
-EAPI Eina_Bool ecore_x_selection_xdnd_set(Ecore_X_Window w, const void *data, int size);
-EAPI Eina_Bool ecore_x_selection_xdnd_clear(void);
-EAPI Eina_Bool ecore_x_selection_clipboard_set(Ecore_X_Window w, const void *data, int size);
-EAPI Eina_Bool ecore_x_selection_clipboard_clear(void);
-EAPI void ecore_x_selection_primary_request(Ecore_X_Window w, const char *target);
-EAPI void ecore_x_selection_secondary_request(Ecore_X_Window w, const char *target);
-EAPI void ecore_x_selection_xdnd_request(Ecore_X_Window w, const char *target);
-EAPI void ecore_x_selection_clipboard_request(Ecore_X_Window w, const char *target);
-EAPI Eina_Bool ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret, int *len, Ecore_X_Atom *targprop, int *targsize);
-EAPI void ecore_x_selection_converter_add(char *target, Eina_Bool (*func)(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *, int *));
-EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, Eina_Bool (*func)(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *tprop, int *tsize));
-EAPI void ecore_x_selection_converter_del(char *target);
-EAPI void ecore_x_selection_converter_atom_del(Ecore_X_Atom target);
-EAPI void ecore_x_selection_parser_add(const char *target, void *(*func)(const char *target, void *data, int size, int format));
-EAPI void ecore_x_selection_parser_del(const char *target);
-EAPI void ecore_x_selection_owner_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Time tm);
-EAPI Ecore_X_Window ecore_x_selection_owner_get(Ecore_X_Atom atom);
-
-EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, Eina_Bool on);
-EAPI int ecore_x_dnd_version_get(Ecore_X_Window win);
-EAPI Eina_Bool ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type);
-EAPI void ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, Eina_Bool on);
-EAPI void ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_types);
-EAPI void ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int num_actions);
-EAPI Eina_Bool ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size);
-EAPI Eina_Bool ecore_x_dnd_drop(void);
-EAPI void ecore_x_dnd_send_status(Eina_Bool will_accept, Eina_Bool suppress, Ecore_X_Rectangle rectangle, Ecore_X_Atom action);
-EAPI void ecore_x_dnd_send_finished(void);
-EAPI void ecore_x_dnd_source_action_set(Ecore_X_Atom action);
-EAPI Ecore_X_Atom ecore_x_dnd_source_action_get(void);
-EAPI void ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data), const void *data);
-
-EAPI Ecore_X_Window ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI int ecore_x_window_argb_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_window_manager_argb_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_override_argb_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI void ecore_x_window_configure(Ecore_X_Window win, Ecore_X_Window_Configure_Mask mask, int x, int y, int w, int h, int border_width, Ecore_X_Window sibling, int stack_mode);
-EAPI void ecore_x_window_cursor_set(Ecore_X_Window win, Ecore_X_Cursor c);
-EAPI void ecore_x_window_free(Ecore_X_Window win);
-EAPI void ecore_x_window_ignore_set(Ecore_X_Window win, int ignore);
-EAPI Ecore_X_Window *ecore_x_window_ignore_list(int *num);
-
-EAPI void ecore_x_window_delete_request_send(Ecore_X_Window win);
-EAPI void ecore_x_window_show(Ecore_X_Window win);
-EAPI void ecore_x_window_hide(Ecore_X_Window win);
-EAPI void ecore_x_window_move(Ecore_X_Window win, int x, int y);
-EAPI void ecore_x_window_resize(Ecore_X_Window win, int w, int h);
-EAPI void ecore_x_window_move_resize(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_focus(Ecore_X_Window win);
-EAPI void ecore_x_window_focus_at_time(Ecore_X_Window win, Ecore_X_Time t);
-EAPI Ecore_X_Window ecore_x_window_focus_get(void);
-EAPI void ecore_x_window_raise(Ecore_X_Window win);
-EAPI void ecore_x_window_lower(Ecore_X_Window win);
-EAPI void ecore_x_window_reparent(Ecore_X_Window win, Ecore_X_Window new_parent, int x, int y);
-EAPI void ecore_x_window_size_get(Ecore_X_Window win, int *w, int *h);
-EAPI void ecore_x_window_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI int ecore_x_window_border_width_get(Ecore_X_Window win);
-EAPI void ecore_x_window_border_width_set(Ecore_X_Window win, int width);
-EAPI int ecore_x_window_depth_get(Ecore_X_Window win);
-EAPI void ecore_x_window_cursor_show(Ecore_X_Window win, Eina_Bool show);
-EAPI void ecore_x_window_defaults_set(Ecore_X_Window win);
-EAPI int ecore_x_window_visible_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num);
-EAPI Ecore_X_Window ecore_x_window_shadow_parent_get(Ecore_X_Window root, Ecore_X_Window win);
-EAPI void ecore_x_window_shadow_tree_flush(void);
-EAPI Ecore_X_Window ecore_x_window_root_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_window_at_xy_get(int x, int y);
-EAPI Ecore_X_Window ecore_x_window_at_xy_with_skip_get(int x, int y, Ecore_X_Window *skip, int skip_num);
-EAPI Ecore_X_Window ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, int x, int y);
-EAPI Ecore_X_Window ecore_x_window_parent_get(Ecore_X_Window win);
-
-EAPI void ecore_x_window_background_color_set(Ecore_X_Window win, unsigned short r, unsigned short g, unsigned short b);
-EAPI void ecore_x_window_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav);
-EAPI void ecore_x_window_pixel_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav);
-EAPI void ecore_x_window_pixmap_set(Ecore_X_Window win, Ecore_X_Pixmap pmap);
-EAPI void ecore_x_window_area_clear(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_area_expose(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_override_set(Ecore_X_Window win, Eina_Bool override);
-
-EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int num);
-EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int len);
-EAPI int ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int **plst);
-
-EAPI void ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID *lst, unsigned int num);
-EAPI int ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID *lst, unsigned int len);
-EAPI int ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID **plst);
-EAPI void ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom type, Ecore_X_ID item, int op);
-EAPI void ecore_x_window_prop_atom_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom *val, unsigned int num);
-EAPI int ecore_x_window_prop_atom_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom *val, unsigned int len);
-EAPI int ecore_x_window_prop_atom_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom **plst);
-EAPI void ecore_x_window_prop_atom_list_change(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Atom item, int op);
-EAPI void ecore_x_window_prop_window_set(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window *val, unsigned int num);
-EAPI int ecore_x_window_prop_window_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window *val, unsigned int len);
-EAPI int ecore_x_window_prop_window_list_get(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Window **plst);
-
-EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
-EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
-EAPI int ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int *num);
-EAPI void ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property);
-EAPI Ecore_X_Atom *ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret);
-EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, const char *str);
-EAPI char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type);
-EAPI Eina_Bool ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol);
-EAPI Ecore_X_WM_Protocol *ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret);
-
-EAPI void ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask);
-EAPI void ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win);
-EAPI void ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y);
-EAPI void ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y);
-EAPI void ecore_x_window_shape_input_window_set(Ecore_X_Window win, Ecore_X_Window shape_win);
-EAPI void ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win);
-EAPI void ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y);
-EAPI void ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y);
-EAPI void ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
-EAPI Ecore_X_Rectangle *ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret);
-EAPI Ecore_X_Rectangle *ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret);
-EAPI void ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on);
-EAPI void ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask);
-
-EAPI Ecore_X_Pixmap ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep);
-EAPI void ecore_x_pixmap_free(Ecore_X_Pixmap pmap);
-EAPI void ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, Ecore_X_GC gc, int sx, int sy, int w, int h, int dx, int dy);
-EAPI void ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h);
-EAPI int ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap);
-
-EAPI Ecore_X_GC ecore_x_gc_new(Ecore_X_Drawable draw, Ecore_X_GC_Value_Mask value_mask, const unsigned int *value_list);
-EAPI void ecore_x_gc_free(Ecore_X_GC gc);
-EAPI void ecore_x_gc_foreground_set(Ecore_X_GC gc, unsigned long foreground);
-EAPI void ecore_x_gc_background_set(Ecore_X_GC gc, unsigned long background);
-
-EAPI Eina_Bool ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Event_Mask mask, long d0, long d1, long d2, long d3, long d4);
-EAPI Eina_Bool ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type, const void *data, int len);
-EAPI Eina_Bool ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y);
-EAPI Eina_Bool ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b);
-EAPI Eina_Bool ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b);
-EAPI Eina_Bool ecore_x_mouse_in_send(Ecore_X_Window win, int x, int y);
-EAPI Eina_Bool ecore_x_mouse_out_send(Ecore_X_Window win, int x, int y);
-
-EAPI void ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, int *h);
-EAPI int ecore_x_drawable_border_width_get(Ecore_X_Drawable d);
-EAPI int ecore_x_drawable_depth_get(Ecore_X_Drawable d);
-EAPI void ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, Ecore_X_GC gc, int x, int y, int width, int height);
-
-EAPI Eina_Bool ecore_x_cursor_color_supported_get(void);
-EAPI Ecore_X_Cursor ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int hot_y);
-EAPI void ecore_x_cursor_free(Ecore_X_Cursor c);
-EAPI Ecore_X_Cursor ecore_x_cursor_shape_get(int shape);
-EAPI void ecore_x_cursor_size_set(int size);
-EAPI int ecore_x_cursor_size_get(void);
+EAPI int
+ ecore_x_init(const char *name);
+EAPI int
+ ecore_x_shutdown(void);
+EAPI int
+ ecore_x_disconnect(void);
+EAPI Ecore_X_Display *
+ ecore_x_display_get(void);
+EAPI Ecore_X_Connection *
+ ecore_x_connection_get(void);
+EAPI int
+ ecore_x_fd_get(void);
+EAPI Ecore_X_Screen *
+ ecore_x_default_screen_get(void);
+EAPI void
+ ecore_x_screen_size_get(const Ecore_X_Screen *screen,
+ int *w,
+ int *h);
+EAPI int
+ ecore_x_screen_count_get(void);
+EAPI int
+ ecore_x_screen_index_get(const Ecore_X_Screen *screen);
+EAPI Ecore_X_Screen *
+ ecore_x_screen_get(int index);
+
+EAPI void
+ ecore_x_double_click_time_set(double t);
+EAPI double
+ ecore_x_double_click_time_get(void);
+EAPI void
+ ecore_x_flush(void);
+EAPI void
+ ecore_x_sync(void);
+EAPI void
+ ecore_x_killall(Ecore_X_Window root);
+EAPI void
+ ecore_x_kill(Ecore_X_Window win);
+EAPI int
+ ecore_x_dpi_get(void);
+EAPI Eina_Bool
+ ecore_x_bell(int percent);
+EAPI unsigned int
+ ecore_x_visual_id_get(Ecore_X_Visual visual);
+
+EAPI Ecore_X_Visual
+ecore_x_default_visual_get(Ecore_X_Display *disp,
+ Ecore_X_Screen *screen);
+EAPI Ecore_X_Colormap
+ecore_x_default_colormap_get(Ecore_X_Display *disp,
+ Ecore_X_Screen *screen);
+EAPI int
+ecore_x_default_depth_get(Ecore_X_Display *disp,
+ Ecore_X_Screen *screen);
+
+EAPI Ecore_X_Time
+ecore_x_current_time_get(void);
+
+EAPI void
+ecore_x_error_handler_set(void (*func)(void *data),
+ const void *data);
+EAPI void
+ecore_x_io_error_handler_set(void (*func)(void *data),
+ const void *data);
+EAPI int
+ ecore_x_error_request_get(void);
+EAPI int
+ ecore_x_error_code_get(void);
+EAPI Ecore_X_ID
+ecore_x_error_resource_id_get(void);
+
+EAPI void
+ecore_x_event_mask_set(Ecore_X_Window w,
+ Ecore_X_Event_Mask mask);
+EAPI void
+ecore_x_event_mask_unset(Ecore_X_Window w,
+ Ecore_X_Event_Mask mask);
+
+EAPI Eina_Bool
+ecore_x_selection_notify_send(Ecore_X_Window requestor,
+ Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ Ecore_X_Atom property,
+ Ecore_X_Time time);
+EAPI Eina_Bool
+ecore_x_selection_primary_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI Eina_Bool
+ ecore_x_selection_primary_clear(void);
+EAPI Eina_Bool
+ ecore_x_selection_secondary_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI Eina_Bool
+ ecore_x_selection_secondary_clear(void);
+EAPI Eina_Bool
+ ecore_x_selection_xdnd_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI Eina_Bool
+ ecore_x_selection_xdnd_clear(void);
+EAPI Eina_Bool
+ ecore_x_selection_clipboard_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI Eina_Bool
+ ecore_x_selection_clipboard_clear(void);
+EAPI void
+ ecore_x_selection_primary_request(Ecore_X_Window w,
+ const char *target);
+EAPI void
+ecore_x_selection_secondary_request(Ecore_X_Window w,
+ const char *target);
+EAPI void
+ecore_x_selection_xdnd_request(Ecore_X_Window w,
+ const char *target);
+EAPI void
+ecore_x_selection_clipboard_request(Ecore_X_Window w,
+ const char *target);
+EAPI Eina_Bool
+ecore_x_selection_convert(Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ void **data_ret,
+ int *len,
+ Ecore_X_Atom *targprop,
+ int *targsize);
+EAPI void
+ecore_x_selection_converter_add(char *target,
+ Eina_Bool (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *,
+ int *));
+EAPI void
+ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
+ Eina_Bool (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *tprop,
+ int *tsize));
+EAPI void
+ ecore_x_selection_converter_del(char *target);
+EAPI void
+ ecore_x_selection_converter_atom_del(Ecore_X_Atom target);
+EAPI void
+ ecore_x_selection_parser_add(const char *target,
+ void *(*func)(const char *target, void *data, int size, int format));
+EAPI void
+ ecore_x_selection_parser_del(const char *target);
+EAPI void
+ ecore_x_selection_owner_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Time tm);
+EAPI Ecore_X_Window
+ecore_x_selection_owner_get(Ecore_X_Atom atom);
+
+EAPI void
+ecore_x_dnd_aware_set(Ecore_X_Window win,
+ Eina_Bool on);
+EAPI int
+ ecore_x_dnd_version_get(Ecore_X_Window win);
+EAPI Eina_Bool
+ ecore_x_dnd_type_isset(Ecore_X_Window win,
+ const char *type);
+EAPI void
+ecore_x_dnd_type_set(Ecore_X_Window win,
+ const char *type,
+ Eina_Bool on);
+EAPI void
+ecore_x_dnd_types_set(Ecore_X_Window win,
+ const char **types,
+ unsigned int num_types);
+EAPI void
+ecore_x_dnd_actions_set(Ecore_X_Window win,
+ Ecore_X_Atom *actions,
+ unsigned int num_actions);
+EAPI Eina_Bool
+ecore_x_dnd_begin(Ecore_X_Window source,
+ unsigned char *data,
+ int size);
+EAPI Eina_Bool
+ ecore_x_dnd_drop(void);
+EAPI void
+ ecore_x_dnd_send_status(Eina_Bool will_accept,
+ Eina_Bool suppress,
+ Ecore_X_Rectangle rectangle,
+ Ecore_X_Atom action);
+EAPI void
+ ecore_x_dnd_send_finished(void);
+EAPI void
+ ecore_x_dnd_source_action_set(Ecore_X_Atom action);
+EAPI Ecore_X_Atom
+ ecore_x_dnd_source_action_get(void);
+EAPI void
+ ecore_x_dnd_callback_pos_update_set(void (*cb)(void *,
+ Ecore_X_Xdnd_Position *data),
+ const void *data);
+
+EAPI Ecore_X_Window
+ecore_x_window_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window
+ecore_x_window_override_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI int
+ ecore_x_window_argb_get(Ecore_X_Window win);
+EAPI Ecore_X_Window
+ ecore_x_window_manager_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window
+ecore_x_window_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window
+ecore_x_window_override_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window
+ecore_x_window_input_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_configure(Ecore_X_Window win,
+ Ecore_X_Window_Configure_Mask mask,
+ int x,
+ int y,
+ int w,
+ int h,
+ int border_width,
+ Ecore_X_Window sibling,
+ int stack_mode);
+EAPI void
+ecore_x_window_cursor_set(Ecore_X_Window win,
+ Ecore_X_Cursor c);
+EAPI void
+ ecore_x_window_free(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_ignore_set(Ecore_X_Window win,
+ int ignore);
+EAPI Ecore_X_Window *
+ecore_x_window_ignore_list(int *num);
+
+EAPI void
+ ecore_x_window_delete_request_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_show(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_hide(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_move(Ecore_X_Window win,
+ int x,
+ int y);
+EAPI void
+ecore_x_window_resize(Ecore_X_Window win,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_move_resize(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ ecore_x_window_focus(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_focus_at_time(Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI Ecore_X_Window
+ ecore_x_window_focus_get(void);
+EAPI void
+ ecore_x_window_raise(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_lower(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_reparent(Ecore_X_Window win,
+ Ecore_X_Window new_parent,
+ int x,
+ int y);
+EAPI void
+ecore_x_window_size_get(Ecore_X_Window win,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_window_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI int
+ ecore_x_window_border_width_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_border_width_set(Ecore_X_Window win,
+ int width);
+EAPI int
+ ecore_x_window_depth_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_cursor_show(Ecore_X_Window win,
+ Eina_Bool show);
+EAPI void
+ ecore_x_window_defaults_set(Ecore_X_Window win);
+EAPI int
+ ecore_x_window_visible_get(Ecore_X_Window win);
+EAPI Ecore_X_Window
+ ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base,
+ int x,
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num);
+EAPI Ecore_X_Window
+ecore_x_window_shadow_parent_get(Ecore_X_Window root,
+ Ecore_X_Window win);
+EAPI void
+ ecore_x_window_shadow_tree_flush(void);
+EAPI Ecore_X_Window
+ ecore_x_window_root_get(Ecore_X_Window win);
+EAPI Ecore_X_Window
+ ecore_x_window_at_xy_get(int x,
+ int y);
+EAPI Ecore_X_Window
+ecore_x_window_at_xy_with_skip_get(int x,
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num);
+EAPI Ecore_X_Window
+ecore_x_window_at_xy_begin_get(Ecore_X_Window begin,
+ int x,
+ int y);
+EAPI Ecore_X_Window
+ecore_x_window_parent_get(Ecore_X_Window win);
+
+EAPI void
+ecore_x_window_background_color_set(Ecore_X_Window win,
+ unsigned short r,
+ unsigned short g,
+ unsigned short b);
+EAPI void
+ecore_x_window_gravity_set(Ecore_X_Window win,
+ Ecore_X_Gravity grav);
+EAPI void
+ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
+ Ecore_X_Gravity grav);
+EAPI void
+ecore_x_window_pixmap_set(Ecore_X_Window win,
+ Ecore_X_Pixmap pmap);
+EAPI void
+ecore_x_window_area_clear(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_area_expose(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_override_set(Ecore_X_Window win,
+ Eina_Bool override);
+
+EAPI void
+ecore_x_window_prop_card32_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ unsigned int *val,
+ unsigned int num);
+EAPI int
+ecore_x_window_prop_card32_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ unsigned int *val,
+ unsigned int len);
+EAPI int
+ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ unsigned int **plst);
+
+EAPI void
+ecore_x_window_prop_xid_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID *lst,
+ unsigned int num);
+EAPI int
+ecore_x_window_prop_xid_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID *lst,
+ unsigned int len);
+EAPI int
+ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID **plst);
+EAPI void
+ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID item,
+ int op);
+EAPI void
+ecore_x_window_prop_atom_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom *val,
+ unsigned int num);
+EAPI int
+ecore_x_window_prop_atom_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom *val,
+ unsigned int len);
+EAPI int
+ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom **plst);
+EAPI void
+ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom item,
+ int op);
+EAPI void
+ecore_x_window_prop_window_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Window *val,
+ unsigned int num);
+EAPI int
+ecore_x_window_prop_window_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Window *val,
+ unsigned int len);
+EAPI int
+ecore_x_window_prop_window_list_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Window **plst);
+
+EAPI Ecore_X_Atom
+ ecore_x_window_prop_any_type(void);
+EAPI void
+ ecore_x_window_prop_property_set(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ Ecore_X_Atom format,
+ int size,
+ void *data,
+ int number);
+EAPI int
+ecore_x_window_prop_property_get(Ecore_X_Window win,
+ Ecore_X_Atom property,
+ Ecore_X_Atom type,
+ int size,
+ unsigned char **data,
+ int *num);
+EAPI void
+ecore_x_window_prop_property_del(Ecore_X_Window win,
+ Ecore_X_Atom property);
+EAPI Ecore_X_Atom *
+ecore_x_window_prop_list(Ecore_X_Window win,
+ int *num_ret);
+EAPI void
+ecore_x_window_prop_string_set(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ const char *str);
+EAPI char *
+ecore_x_window_prop_string_get(Ecore_X_Window win,
+ Ecore_X_Atom type);
+EAPI Eina_Bool
+ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
+ Ecore_X_WM_Protocol protocol);
+EAPI Ecore_X_WM_Protocol *
+ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
+ int *num_ret);
+
+EAPI void
+ecore_x_window_shape_mask_set(Ecore_X_Window win,
+ Ecore_X_Pixmap mask);
+EAPI void
+ecore_x_window_shape_window_set(Ecore_X_Window win,
+ Ecore_X_Window shape_win);
+EAPI void
+ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y);
+EAPI void
+ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void
+ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void
+ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y);
+EAPI void
+ecore_x_window_shape_input_window_set(Ecore_X_Window win,
+ Ecore_X_Window shape_win);
+EAPI void
+ecore_x_window_shape_window_add(Ecore_X_Window win,
+ Ecore_X_Window shape_win);
+EAPI void
+ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y);
+EAPI void
+ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y);
+EAPI void
+ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void
+ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI Ecore_X_Rectangle *
+ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
+ int *num_ret);
+EAPI Ecore_X_Rectangle *
+ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
+ int *num_ret);
+EAPI void
+ecore_x_window_shape_events_select(Ecore_X_Window win,
+ Eina_Bool on);
+EAPI void
+ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
+ Ecore_X_Pixmap mask);
+
+EAPI Ecore_X_Pixmap
+ecore_x_pixmap_new(Ecore_X_Window win,
+ int w,
+ int h,
+ int dep);
+EAPI void
+ ecore_x_pixmap_free(Ecore_X_Pixmap pmap);
+EAPI void
+ ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
+ Ecore_X_Drawable dest,
+ Ecore_X_GC gc,
+ int sx,
+ int sy,
+ int w,
+ int h,
+ int dx,
+ int dy);
+EAPI void
+ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI int
+ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap);
+
+EAPI Ecore_X_GC
+ecore_x_gc_new(Ecore_X_Drawable draw,
+ Ecore_X_GC_Value_Mask value_mask,
+ const unsigned int *value_list);
+EAPI void
+ ecore_x_gc_free(Ecore_X_GC gc);
+EAPI void
+ ecore_x_gc_foreground_set(Ecore_X_GC gc,
+ unsigned long foreground);
+EAPI void
+ecore_x_gc_background_set(Ecore_X_GC gc,
+ unsigned long background);
+
+EAPI Eina_Bool
+ecore_x_client_message32_send(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ Ecore_X_Event_Mask mask,
+ long d0,
+ long d1,
+ long d2,
+ long d3,
+ long d4);
+EAPI Eina_Bool
+ecore_x_client_message8_send(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ const void *data,
+ int len);
+EAPI Eina_Bool
+ecore_x_mouse_move_send(Ecore_X_Window win,
+ int x,
+ int y);
+EAPI Eina_Bool
+ecore_x_mouse_down_send(Ecore_X_Window win,
+ int x,
+ int y,
+ int b);
+EAPI Eina_Bool
+ecore_x_mouse_up_send(Ecore_X_Window win,
+ int x,
+ int y,
+ int b);
+
+EAPI void
+ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI int
+ ecore_x_drawable_border_width_get(Ecore_X_Drawable d);
+EAPI int
+ ecore_x_drawable_depth_get(Ecore_X_Drawable d);
+EAPI void
+ ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
+ Ecore_X_GC gc,
+ int x,
+ int y,
+ int width,
+ int height);
+
+EAPI Eina_Bool
+ ecore_x_cursor_color_supported_get(void);
+EAPI Ecore_X_Cursor
+ ecore_x_cursor_new(Ecore_X_Window win,
+ int *pixels,
+ int w,
+ int h,
+ int hot_x,
+ int hot_y);
+EAPI void
+ ecore_x_cursor_free(Ecore_X_Cursor c);
+EAPI Ecore_X_Cursor
+ ecore_x_cursor_shape_get(int shape);
+EAPI void
+ ecore_x_cursor_size_set(int size);
+EAPI int
+ ecore_x_cursor_size_get(void);
/* FIXME: these funcs need categorising */
-EAPI Ecore_X_Window *ecore_x_window_root_list(int *num_ret);
-EAPI Ecore_X_Window ecore_x_window_root_first_get(void);
-EAPI Eina_Bool ecore_x_window_manage(Ecore_X_Window win);
-EAPI void ecore_x_window_container_manage(Ecore_X_Window win);
-EAPI void ecore_x_window_client_manage(Ecore_X_Window win);
-EAPI void ecore_x_window_sniff(Ecore_X_Window win);
-EAPI void ecore_x_window_client_sniff(Ecore_X_Window win);
-
-EAPI Ecore_X_Atom ecore_x_atom_get(const char *name);
-EAPI void ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms);
-EAPI char *ecore_x_atom_name_get(Ecore_X_Atom atom);
-
-EAPI void ecore_x_icccm_init(void);
-EAPI void ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state);
-EAPI Ecore_X_Window_State_Hint ecore_x_icccm_state_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_icccm_hints_set(Ecore_X_Window win, Eina_Bool accepts_focus, Ecore_X_Window_State_Hint initial_state, Ecore_X_Pixmap icon_pixmap, Ecore_X_Pixmap icon_mask, Ecore_X_Window icon_window, Ecore_X_Window window_group, Eina_Bool is_urgent);
-EAPI Eina_Bool ecore_x_icccm_hints_get(Ecore_X_Window win, Eina_Bool *accepts_focus, Ecore_X_Window_State_Hint *initial_state, Ecore_X_Pixmap *icon_pixmap, Ecore_X_Pixmap *icon_mask, Ecore_X_Window *icon_window, Ecore_X_Window *window_group, Eina_Bool *is_urgent);
-EAPI void ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, Eina_Bool request_pos, Ecore_X_Gravity gravity, int min_w, int min_h, int max_w, int max_h, int base_w, int base_h, int step_x, int step_y, double min_aspect, double max_aspect);
-EAPI Eina_Bool ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, Eina_Bool *request_pos, Ecore_X_Gravity *gravity, int *min_w, int *min_h, int *max_w, int *max_h, int *base_w, int *base_h, int *step_x, int *step_y, double *min_aspect, double *max_aspect);
-EAPI void ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
-EAPI char *ecore_x_icccm_title_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, Ecore_X_Atom *protos, int num);
-EAPI void ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, Eina_Bool on);
-EAPI Eina_Bool ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol);
-EAPI void ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c);
-EAPI void ecore_x_icccm_name_class_get(Ecore_X_Window win, char **n, char **c);
-EAPI char *ecore_x_icccm_client_machine_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv);
-EAPI void ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv);
-EAPI char *ecore_x_icccm_icon_name_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t);
-EAPI void ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin);
-EAPI void ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin);
-EAPI void ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin);
-EAPI void ecore_x_icccm_transient_for_unset(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_icccm_transient_for_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role);
-EAPI char *ecore_x_icccm_window_role_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l);
-EAPI Ecore_X_Window ecore_x_icccm_client_leader_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root);
+EAPI Ecore_X_Window *
+ ecore_x_window_root_list(int *num_ret);
+EAPI Ecore_X_Window
+ ecore_x_window_root_first_get(void);
+EAPI Eina_Bool
+ ecore_x_window_manage(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_container_manage(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_client_manage(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_sniff(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_client_sniff(Ecore_X_Window win);
+
+EAPI Ecore_X_Atom
+ ecore_x_atom_get(const char *name);
+EAPI void
+ ecore_x_atoms_get(const char **names,
+ int num,
+ Ecore_X_Atom *atoms);
+EAPI char *
+ecore_x_atom_name_get(Ecore_X_Atom atom);
+
+EAPI void
+ ecore_x_icccm_init(void);
+EAPI void
+ ecore_x_icccm_state_set(Ecore_X_Window win,
+ Ecore_X_Window_State_Hint state);
+EAPI Ecore_X_Window_State_Hint
+ ecore_x_icccm_state_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_delete_window_send(Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void
+ecore_x_icccm_take_focus_send(Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void
+ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void
+ecore_x_icccm_move_resize_send(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void
+ecore_x_icccm_hints_set(Ecore_X_Window win,
+ Eina_Bool accepts_focus,
+ Ecore_X_Window_State_Hint initial_state,
+ Ecore_X_Pixmap icon_pixmap,
+ Ecore_X_Pixmap icon_mask,
+ Ecore_X_Window icon_window,
+ Ecore_X_Window window_group,
+ Eina_Bool is_urgent);
+EAPI Eina_Bool
+ecore_x_icccm_hints_get(Ecore_X_Window win,
+ Eina_Bool *accepts_focus,
+ Ecore_X_Window_State_Hint *initial_state,
+ Ecore_X_Pixmap *icon_pixmap,
+ Ecore_X_Pixmap *icon_mask,
+ Ecore_X_Window *icon_window,
+ Ecore_X_Window *window_group,
+ Eina_Bool *is_urgent);
+EAPI void
+ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
+ Eina_Bool request_pos,
+ Ecore_X_Gravity gravity,
+ int min_w,
+ int min_h,
+ int max_w,
+ int max_h,
+ int base_w,
+ int base_h,
+ int step_x,
+ int step_y,
+ double min_aspect,
+ double max_aspect);
+EAPI Eina_Bool
+ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
+ Eina_Bool *request_pos,
+ Ecore_X_Gravity *gravity,
+ int *min_w,
+ int *min_h,
+ int *max_w,
+ int *max_h,
+ int *base_w,
+ int *base_h,
+ int *step_x,
+ int *step_y,
+ double *min_aspect,
+ double *max_aspect);
+EAPI void
+ecore_x_icccm_title_set(Ecore_X_Window win,
+ const char *t);
+EAPI char *
+ ecore_x_icccm_title_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
+ Ecore_X_Atom *protos,
+ int num);
+EAPI void
+ecore_x_icccm_protocol_set(Ecore_X_Window win,
+ Ecore_X_WM_Protocol protocol,
+ Eina_Bool on);
+EAPI Eina_Bool
+ecore_x_icccm_protocol_isset(Ecore_X_Window win,
+ Ecore_X_WM_Protocol protocol);
+EAPI void
+ecore_x_icccm_name_class_set(Ecore_X_Window win,
+ const char *n,
+ const char *c);
+EAPI void
+ecore_x_icccm_name_class_get(Ecore_X_Window win,
+ char **n,
+ char **c);
+EAPI char *
+ ecore_x_icccm_client_machine_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_command_set(Ecore_X_Window win,
+ int argc,
+ char **argv);
+EAPI void
+ecore_x_icccm_command_get(Ecore_X_Window win,
+ int *argc,
+ char ***argv);
+EAPI char *
+ ecore_x_icccm_icon_name_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_icon_name_set(Ecore_X_Window win,
+ const char *t);
+EAPI void
+ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
+ Ecore_X_Window subwin);
+EAPI void
+ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
+ Ecore_X_Window subwin);
+EAPI void
+ecore_x_icccm_transient_for_set(Ecore_X_Window win,
+ Ecore_X_Window forwin);
+EAPI void
+ ecore_x_icccm_transient_for_unset(Ecore_X_Window win);
+EAPI Ecore_X_Window
+ ecore_x_icccm_transient_for_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_window_role_set(Ecore_X_Window win,
+ const char *role);
+EAPI char *
+ ecore_x_icccm_window_role_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_client_leader_set(Ecore_X_Window win,
+ Ecore_X_Window l);
+EAPI Ecore_X_Window
+ ecore_x_icccm_client_leader_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
+ Ecore_X_Window root);
typedef enum _Ecore_X_MWM_Hint_Func
{
@@ -1520,153 +2109,485 @@ typedef enum _Ecore_X_MWM_Hint_Input
ECORE_X_MWM_HINT_INPUT_FULL_APPLICATION_MODAL = 3
} Ecore_X_MWM_Hint_Input;
-EAPI Eina_Bool ecore_x_mwm_hints_get(Ecore_X_Window win, Ecore_X_MWM_Hint_Func *fhint, Ecore_X_MWM_Hint_Decor *dhint, Ecore_X_MWM_Hint_Input *ihint);
-EAPI void ecore_x_mwm_borderless_set(Ecore_X_Window win, Eina_Bool borderless);
+EAPI Eina_Bool
+ecore_x_mwm_hints_get(Ecore_X_Window win,
+ Ecore_X_MWM_Hint_Func *fhint,
+ Ecore_X_MWM_Hint_Decor *dhint,
+ Ecore_X_MWM_Hint_Input *ihint);
+EAPI void
+ecore_x_mwm_borderless_set(Ecore_X_Window win,
+ Eina_Bool borderless);
/* netwm */
-EAPI void ecore_x_netwm_init(void);
-EAPI void ecore_x_netwm_shutdown(void);
-EAPI void ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check, const char *wm_name);
-EAPI void ecore_x_netwm_supported_set(Ecore_X_Window root, Ecore_X_Atom *supported, int num);
-EAPI Eina_Bool ecore_x_netwm_supported_get(Ecore_X_Window root, Ecore_X_Atom **supported, int *num);
-EAPI void ecore_x_netwm_desk_count_set(Ecore_X_Window root, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_roots_set(Ecore_X_Window root, Ecore_X_Window *vroots, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_names_set(Ecore_X_Window root, const char **names, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_size_set(Ecore_X_Window root, unsigned int width, unsigned int height);
-EAPI void ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, unsigned int *areas, unsigned int n_desks);
-EAPI unsigned int *ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks);
-EAPI void ecore_x_netwm_desk_current_set(Ecore_X_Window root, unsigned int desk);
-EAPI void ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, unsigned int *origins, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation, int columns, int rows, int starting_corner);
-EAPI void ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, Eina_Bool on);
-EAPI void ecore_x_netwm_client_list_set(Ecore_X_Window root, Ecore_X_Window *p_clients, unsigned int n_clients);
-EAPI void ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, Ecore_X_Window *p_clients, unsigned int n_clients);
-EAPI void ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win);
-EAPI void ecore_x_netwm_client_active_request(Ecore_X_Window root, Ecore_X_Window win, int type, Ecore_X_Window current_win);
-EAPI void ecore_x_netwm_name_set(Ecore_X_Window win, const char *name);
-EAPI int ecore_x_netwm_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_startup_id_set(Ecore_X_Window win, const char *id);
-EAPI int ecore_x_netwm_startup_id_get(Ecore_X_Window win, char **id);
-EAPI void ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name);
-EAPI int ecore_x_netwm_visible_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name);
-EAPI int ecore_x_netwm_icon_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name);
-EAPI int ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk);
-EAPI Eina_Bool ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk);
-EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right, int top, int bottom);
-EAPI Eina_Bool ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom);
-EAPI void ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right, int top, int bottom, int left_start_y, int left_end_y, int right_start_y, int right_end_y, int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x);
-EAPI Eina_Bool ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom, int *left_start_y, int *left_end_y, int *right_start_y, int *right_end_y, int *top_start_x, int *top_end_x, int *bottom_start_x, int *bottom_end_x);
-
-EAPI void ecore_x_netwm_icons_set(Ecore_X_Window win, Ecore_X_Icon *icon, int num);
-
-EAPI Eina_Bool ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, int *num);
-EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height);
-EAPI Eina_Bool ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height);
-EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win, int pid);
-EAPI Eina_Bool ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid);
-EAPI void ecore_x_netwm_handled_icons_set(Ecore_X_Window win);
-EAPI Eina_Bool ecore_x_netwm_handled_icons_get(Ecore_X_Window win);
-EAPI void ecore_x_netwm_user_time_set(Ecore_X_Window win, unsigned int time);
-EAPI Eina_Bool ecore_x_netwm_user_time_get(Ecore_X_Window win, unsigned int *time);
-EAPI void ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state, unsigned int num);
-EAPI Eina_Bool ecore_x_netwm_window_state_get(Ecore_X_Window win, Ecore_X_Window_State **state, unsigned int *num);
-EAPI void ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type);
-EAPI Eina_Bool ecore_x_netwm_window_type_get(Ecore_X_Window win, Ecore_X_Window_Type *type);
-EAPI int ecore_x_netwm_window_types_get(Ecore_X_Window win, Ecore_X_Window_Type **types);
-EAPI Eina_Bool ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, Ecore_X_Action action);
-EAPI void ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action *action, unsigned int num);
-EAPI Eina_Bool ecore_x_netwm_allowed_action_get(Ecore_X_Window win, Ecore_X_Action **action, unsigned int *num);
-EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity);
-EAPI Eina_Bool ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity);
-EAPI void ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
-EAPI Eina_Bool ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb);
-EAPI Eina_Bool ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter);
-EAPI void ecore_x_netwm_ping_send(Ecore_X_Window win);
-EAPI void ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial);
-EAPI void ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root, Ecore_X_Window_State s1, Ecore_X_Window_State s2, Eina_Bool set);
-EAPI void ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, unsigned int desktop);
-EAPI void ecore_x_netwm_moveresize_request_send(Ecore_X_Window win, int x, int y, Ecore_X_Netwm_Direction direction, unsigned int button);
-
-EAPI void ecore_x_e_init(void);
-EAPI void ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
-EAPI void ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, unsigned int is_keyboard);
-EAPI Eina_Bool ecore_x_e_virtual_keyboard_get(Ecore_X_Window win);
-EAPI void ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state);
-EAPI Ecore_X_Virtual_Keyboard_State ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win);
-EAPI void ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state);
+EAPI void
+ ecore_x_netwm_init(void);
+EAPI void
+ ecore_x_netwm_shutdown(void);
+EAPI void
+ ecore_x_netwm_wm_identify(Ecore_X_Window root,
+ Ecore_X_Window check,
+ const char *wm_name);
+EAPI void
+ecore_x_netwm_supported_set(Ecore_X_Window root,
+ Ecore_X_Atom *supported,
+ int num);
+EAPI Eina_Bool
+ecore_x_netwm_supported_get(Ecore_X_Window root,
+ Ecore_X_Atom **supported,
+ int *num);
+EAPI void
+ecore_x_netwm_desk_count_set(Ecore_X_Window root,
+ unsigned int n_desks);
+EAPI void
+ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
+ Ecore_X_Window *vroots,
+ unsigned int n_desks);
+EAPI void
+ecore_x_netwm_desk_names_set(Ecore_X_Window root,
+ const char **names,
+ unsigned int n_desks);
+EAPI void
+ecore_x_netwm_desk_size_set(Ecore_X_Window root,
+ unsigned int width,
+ unsigned int height);
+EAPI void
+ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
+ unsigned int *areas,
+ unsigned int n_desks);
+EAPI unsigned int *
+ecore_x_netwm_desk_workareas_get(Ecore_X_Window root,
+ unsigned int *n_desks);
+EAPI void
+ecore_x_netwm_desk_current_set(Ecore_X_Window root,
+ unsigned int desk);
+EAPI void
+ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
+ unsigned int *origins,
+ unsigned int n_desks);
+EAPI void
+ecore_x_netwm_desk_layout_set(Ecore_X_Window root,
+ int orientation,
+ int columns,
+ int rows,
+ int starting_corner);
+EAPI void
+ecore_x_netwm_showing_desktop_set(Ecore_X_Window root,
+ Eina_Bool on);
+EAPI void
+ecore_x_netwm_client_list_set(Ecore_X_Window root,
+ Ecore_X_Window *p_clients,
+ unsigned int n_clients);
+EAPI void
+ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
+ Ecore_X_Window *p_clients,
+ unsigned int n_clients);
+EAPI void
+ecore_x_netwm_client_active_set(Ecore_X_Window root,
+ Ecore_X_Window win);
+EAPI void
+ecore_x_netwm_client_active_request(Ecore_X_Window root,
+ Ecore_X_Window win,
+ int type,
+ Ecore_X_Window current_win);
+EAPI void
+ecore_x_netwm_name_set(Ecore_X_Window win,
+ const char *name);
+EAPI int
+ecore_x_netwm_name_get(Ecore_X_Window win,
+ char **name);
+EAPI void
+ecore_x_netwm_startup_id_set(Ecore_X_Window win,
+ const char *id);
+EAPI int
+ecore_x_netwm_startup_id_get(Ecore_X_Window win,
+ char **id);
+EAPI void
+ecore_x_netwm_visible_name_set(Ecore_X_Window win,
+ const char *name);
+EAPI int
+ecore_x_netwm_visible_name_get(Ecore_X_Window win,
+ char **name);
+EAPI void
+ecore_x_netwm_icon_name_set(Ecore_X_Window win,
+ const char *name);
+EAPI int
+ecore_x_netwm_icon_name_get(Ecore_X_Window win,
+ char **name);
+EAPI void
+ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win,
+ const char *name);
+EAPI int
+ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win,
+ char **name);
+EAPI void
+ecore_x_netwm_desktop_set(Ecore_X_Window win,
+ unsigned int desk);
+EAPI Eina_Bool
+ecore_x_netwm_desktop_get(Ecore_X_Window win,
+ unsigned int *desk);
+EAPI void
+ecore_x_netwm_strut_set(Ecore_X_Window win,
+ int left,
+ int right,
+ int top,
+ int bottom);
+EAPI Eina_Bool
+ecore_x_netwm_strut_get(Ecore_X_Window win,
+ int *left,
+ int *right,
+ int *top,
+ int *bottom);
+EAPI void
+ecore_x_netwm_strut_partial_set(Ecore_X_Window win,
+ int left,
+ int right,
+ int top,
+ int bottom,
+ int left_start_y,
+ int left_end_y,
+ int right_start_y,
+ int right_end_y,
+ int top_start_x,
+ int top_end_x,
+ int bottom_start_x,
+ int bottom_end_x);
+EAPI Eina_Bool
+ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
+ int *left,
+ int *right,
+ int *top,
+ int *bottom,
+ int *left_start_y,
+ int *left_end_y,
+ int *right_start_y,
+ int *right_end_y,
+ int *top_start_x,
+ int *top_end_x,
+ int *bottom_start_x,
+ int *bottom_end_x);
+
+EAPI void
+ecore_x_netwm_icons_set(Ecore_X_Window win,
+ Ecore_X_Icon *icon,
+ int num);
+
+EAPI Eina_Bool
+ecore_x_netwm_icons_get(Ecore_X_Window win,
+ Ecore_X_Icon **icon,
+ int *num);
+EAPI void
+ecore_x_netwm_icon_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int width,
+ int height);
+EAPI Eina_Bool
+ecore_x_netwm_icon_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *width,
+ int *height);
+EAPI void
+ecore_x_netwm_pid_set(Ecore_X_Window win,
+ int pid);
+EAPI Eina_Bool
+ecore_x_netwm_pid_get(Ecore_X_Window win,
+ int *pid);
+EAPI void
+ ecore_x_netwm_handled_icons_set(Ecore_X_Window win);
+EAPI Eina_Bool
+ ecore_x_netwm_handled_icons_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_netwm_user_time_set(Ecore_X_Window win,
+ unsigned int time);
+EAPI Eina_Bool
+ecore_x_netwm_user_time_get(Ecore_X_Window win,
+ unsigned int *time);
+EAPI void
+ecore_x_netwm_window_state_set(Ecore_X_Window win,
+ Ecore_X_Window_State *state,
+ unsigned int num);
+EAPI Eina_Bool
+ecore_x_netwm_window_state_get(Ecore_X_Window win,
+ Ecore_X_Window_State **state,
+ unsigned int *num);
+EAPI void
+ecore_x_netwm_window_type_set(Ecore_X_Window win,
+ Ecore_X_Window_Type type);
+EAPI Eina_Bool
+ecore_x_netwm_window_type_get(Ecore_X_Window win,
+ Ecore_X_Window_Type *type);
+EAPI int
+ecore_x_netwm_window_types_get(Ecore_X_Window win,
+ Ecore_X_Window_Type **types);
+EAPI Eina_Bool
+ecore_x_netwm_allowed_action_isset(Ecore_X_Window win,
+ Ecore_X_Action action);
+EAPI void
+ecore_x_netwm_allowed_action_set(Ecore_X_Window win,
+ Ecore_X_Action *action,
+ unsigned int num);
+EAPI Eina_Bool
+ecore_x_netwm_allowed_action_get(Ecore_X_Window win,
+ Ecore_X_Action **action,
+ unsigned int *num);
+EAPI void
+ecore_x_netwm_opacity_set(Ecore_X_Window win,
+ unsigned int opacity);
+EAPI Eina_Bool
+ecore_x_netwm_opacity_get(Ecore_X_Window win,
+ unsigned int *opacity);
+EAPI void
+ecore_x_netwm_frame_size_set(Ecore_X_Window win,
+ int fl,
+ int fr,
+ int ft,
+ int fb);
+EAPI Eina_Bool
+ecore_x_netwm_frame_size_get(Ecore_X_Window win,
+ int *fl,
+ int *fr,
+ int *ft,
+ int *fb);
+EAPI Eina_Bool
+ecore_x_netwm_sync_counter_get(Ecore_X_Window win,
+ Ecore_X_Sync_Counter *counter);
+EAPI void
+ ecore_x_netwm_ping_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_netwm_sync_request_send(Ecore_X_Window win,
+ unsigned int serial);
+EAPI void
+ecore_x_netwm_state_request_send(Ecore_X_Window win,
+ Ecore_X_Window root,
+ Ecore_X_Window_State s1,
+ Ecore_X_Window_State s2,
+ Eina_Bool set);
+EAPI void
+ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
+ Ecore_X_Window root,
+ unsigned int desktop);
+EAPI void
+ecore_x_netwm_moveresize_request_send(Ecore_X_Window win,
+ int x,
+ int y,
+ Ecore_X_Netwm_Direction direction,
+ unsigned int button);
+
+EAPI void
+ ecore_x_e_init(void);
+EAPI void
+ ecore_x_e_frame_size_set(Ecore_X_Window win,
+ int fl,
+ int fr,
+ int ft,
+ int fb);
+EAPI void
+ecore_x_e_virtual_keyboard_set(Ecore_X_Window win,
+ unsigned int is_keyboard);
+EAPI Eina_Bool
+ ecore_x_e_virtual_keyboard_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win,
+ Ecore_X_Virtual_Keyboard_State state);
+EAPI Ecore_X_Virtual_Keyboard_State
+ ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win,
+ Ecore_X_Virtual_Keyboard_State state);
/* Illume functions */
-EAPI void ecore_x_e_illume_zone_set(Ecore_X_Window win, Ecore_X_Window zone);
-EAPI Ecore_X_Window ecore_x_e_illume_zone_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_zone_list_set(Ecore_X_Window win, Ecore_X_Window *zones, unsigned int n_zones);
-EAPI void ecore_x_e_illume_conformant_set(Ecore_X_Window win, unsigned int is_conformant);
-EAPI Eina_Bool ecore_x_e_illume_conformant_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_mode_set(Ecore_X_Window win, Ecore_X_Illume_Mode mode);
-EAPI Ecore_X_Illume_Mode ecore_x_e_illume_mode_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_mode_send(Ecore_X_Window win, Ecore_X_Illume_Mode mode);
-EAPI void ecore_x_e_illume_focus_back_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_focus_forward_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_focus_home_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_close_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_home_new_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_home_del_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_access_action_next_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_access_action_prev_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_access_action_activate_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_access_action_read_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_access_action_read_next_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_access_action_read_prev_send(Ecore_X_Window win);
-
-EAPI void ecore_x_e_illume_drag_set(Ecore_X_Window win, unsigned int drag);
-EAPI Eina_Bool ecore_x_e_illume_drag_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, unsigned int is_locked);
-EAPI Eina_Bool ecore_x_e_illume_drag_locked_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_start_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_end_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI Eina_Bool ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI Eina_Bool ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI Eina_Bool ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, unsigned int is_quickpanel);
-EAPI Eina_Bool ecore_x_e_illume_quickpanel_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state);
-EAPI Ecore_X_Illume_Quickpanel_State ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state);
-EAPI void ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, unsigned int priority);
-EAPI int ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, unsigned int priority);
-EAPI int ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, unsigned int zone);
-EAPI int ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_zone_request_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win);
-
-EAPI void ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win, Ecore_X_Illume_Clipboard_State state);
-
-EAPI Ecore_X_Illume_Clipboard_State ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win);
-
-EAPI void ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI Eina_Bool ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter);
-EAPI Ecore_X_Sync_Counter ecore_x_e_comp_sync_counter_get(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, Ecore_X_Window win, int w, int h);
-EAPI void ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled);
-EAPI Eina_Bool ecore_x_e_comp_sync_supported_get(Ecore_X_Window root);
-EAPI void ecore_x_e_comp_sync_begin_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_end_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win);
-
-EAPI void ecore_x_e_comp_flush_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_dump_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_pixmap_set(Ecore_X_Window win, Ecore_X_Pixmap pixmap);
-EAPI Ecore_X_Pixmap ecore_x_e_comp_pixmap_get(Ecore_X_Window win);
+EAPI void
+ecore_x_e_illume_zone_set(Ecore_X_Window win,
+ Ecore_X_Window zone);
+EAPI Ecore_X_Window
+ ecore_x_e_illume_zone_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
+ Ecore_X_Window *zones,
+ unsigned int n_zones);
+EAPI void
+ecore_x_e_illume_conformant_set(Ecore_X_Window win,
+ unsigned int is_conformant);
+EAPI Eina_Bool
+ ecore_x_e_illume_conformant_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_mode_set(Ecore_X_Window win,
+ Ecore_X_Illume_Mode mode);
+EAPI Ecore_X_Illume_Mode
+ ecore_x_e_illume_mode_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_mode_send(Ecore_X_Window win,
+ Ecore_X_Illume_Mode mode);
+EAPI void
+ ecore_x_e_illume_focus_back_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_focus_forward_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_focus_home_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_close_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_home_new_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_home_del_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_drag_set(Ecore_X_Window win,
+ unsigned int drag);
+EAPI Eina_Bool
+ ecore_x_e_illume_drag_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_drag_locked_set(Ecore_X_Window win,
+ unsigned int is_locked);
+EAPI Eina_Bool
+ ecore_x_e_illume_drag_locked_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_drag_start_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_drag_end_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Eina_Bool
+ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Eina_Bool
+ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Eina_Bool
+ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_e_illume_quickpanel_set(Ecore_X_Window win,
+ unsigned int is_quickpanel);
+EAPI Eina_Bool
+ ecore_x_e_illume_quickpanel_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win,
+ Ecore_X_Illume_Quickpanel_State state);
+EAPI Ecore_X_Illume_Quickpanel_State
+ ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win,
+ Ecore_X_Illume_Quickpanel_State state);
+EAPI void
+ ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win,
+ unsigned int priority);
+EAPI int
+ ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win,
+ unsigned int priority);
+EAPI int
+ ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win,
+ unsigned int zone);
+EAPI int
+ ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_zone_request_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win);
+
+/* for sliding window */
+EAPI void
+ ecore_x_e_illume_sliding_win_state_set(Ecore_X_Window win,
+ unsigned int is_visible);
+EAPI int
+ ecore_x_e_illume_sliding_win_state_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_sliding_win_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI int
+ ecore_x_e_illume_sliding_win_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+
+EAPI void
+ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
+ Ecore_X_Illume_Clipboard_State state);
+
+EAPI Ecore_X_Illume_Clipboard_State
+ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win);
+
+EAPI void
+ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Eina_Bool
+ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
+ Ecore_X_Sync_Counter counter);
+EAPI Ecore_X_Sync_Counter
+ ecore_x_e_comp_sync_counter_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
+ Ecore_X_Window win);
+EAPI void
+ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
+ Ecore_X_Window win,
+ int w,
+ int h);
+EAPI void
+ecore_x_e_comp_sync_supported_set(Ecore_X_Window root,
+ Eina_Bool enabled);
+EAPI Eina_Bool
+ ecore_x_e_comp_sync_supported_get(Ecore_X_Window root);
+EAPI void
+ ecore_x_e_comp_sync_begin_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_comp_sync_end_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win);
+
+EAPI void
+ ecore_x_e_comp_flush_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_comp_dump_send(Ecore_X_Window win);
+EAPI void
+ ecore_x_e_comp_pixmap_set(Ecore_X_Window win,
+ Ecore_X_Pixmap pixmap);
+EAPI Ecore_X_Pixmap
+ecore_x_e_comp_pixmap_get(Ecore_X_Window win);
/**
* @brief Set the window profile list.
@@ -1677,7 +2598,11 @@ EAPI Ecore_X_Pixmap ecore_x_e_comp_pixmap_get(Ecore_X_Window wi
*
* @since 1.3.0
*/
-EAPI void ecore_x_e_window_profile_list_set(Ecore_X_Window win, const char **profiles, unsigned int num_profiles);
+EAPI void
+ecore_x_e_window_profile_list_set(Ecore_X_Window win,
+ const char **profiles,
+ unsigned int num_profiles);
+
/**
* @brief Get the window profile list.
*
@@ -1687,7 +2612,11 @@ EAPI void ecore_x_e_window_profile_list_set(Ecore_X_W
*
* @since 1.3.0
*/
-EAPI Eina_Bool ecore_x_e_window_profile_list_get(Ecore_X_Window win, const char ***profiles, int *ret_num);
+EAPI Eina_Bool
+ecore_x_e_window_profile_list_get(Ecore_X_Window win,
+ const char ***profiles,
+ int *ret_num);
+
/**
* @brief Set the window profile.
*
@@ -1696,7 +2625,10 @@ EAPI Eina_Bool ecore_x_e_window_profile_list_get(Ecore_X_W
*
* @since 1.3.0
*/
-EAPI void ecore_x_e_window_profile_set(Ecore_X_Window win, const char *profile);
+EAPI void
+ecore_x_e_window_profile_set(Ecore_X_Window win,
+ const char *profile);
+
/**
* @brief Get the window profile.
*
@@ -1705,35 +2637,75 @@ EAPI void ecore_x_e_window_profile_set(Ecore_X_Window
*
* @since 1.3.0
*/
-EAPI char *ecore_x_e_window_profile_get(Ecore_X_Window win);
-
-EAPI Ecore_X_Sync_Alarm ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter);
-EAPI Eina_Bool ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm);
-EAPI Eina_Bool ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val);
-EAPI Ecore_X_Sync_Counter ecore_x_sync_counter_new(int val);
-EAPI void ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter);
-EAPI void ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by);
-EAPI void ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val);
-
-EAPI void ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, int val);
-EAPI void ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, int val_hi, unsigned int val_lo);
-EAPI Eina_Bool ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, int *val_hi, unsigned int *val_lo);
-
-EAPI int ecore_x_xinerama_screen_count_get(void);
-EAPI Eina_Bool ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h);
-
-EAPI Eina_Bool ecore_x_screensaver_event_available_get(void);
-EAPI int ecore_x_screensaver_idle_time_get(void);
-EAPI void ecore_x_screensaver_set(int timeout, int interval, int prefer_blanking, int allow_exposures);
-EAPI void ecore_x_screensaver_timeout_set(int timeout);
-EAPI int ecore_x_screensaver_timeout_get(void);
-EAPI void ecore_x_screensaver_blank_set(int timeout);
-EAPI int ecore_x_screensaver_blank_get(void);
-EAPI void ecore_x_screensaver_expose_set(int timeout);
-EAPI int ecore_x_screensaver_expose_get(void);
-EAPI void ecore_x_screensaver_interval_set(int timeout);
-EAPI int ecore_x_screensaver_interval_get(void);
-EAPI void ecore_x_screensaver_event_listen_set(Eina_Bool on);
+EAPI char *
+ecore_x_e_window_profile_get(Ecore_X_Window win);
+
+EAPI Ecore_X_Sync_Alarm
+ ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter);
+EAPI Eina_Bool
+ ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm);
+EAPI Eina_Bool
+ ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
+ unsigned int *val);
+EAPI Ecore_X_Sync_Counter
+ ecore_x_sync_counter_new(int val);
+EAPI void
+ ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter);
+EAPI void
+ ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
+ int by);
+EAPI void
+ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
+ int val);
+
+EAPI void
+ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
+ int val);
+EAPI void
+ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
+ int val_hi,
+ unsigned int val_lo);
+EAPI Eina_Bool
+ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
+ int *val_hi,
+ unsigned int *val_lo);
+
+EAPI int
+ ecore_x_xinerama_screen_count_get(void);
+EAPI Eina_Bool
+ ecore_x_xinerama_screen_geometry_get(int screen,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+
+EAPI Eina_Bool
+ ecore_x_screensaver_event_available_get(void);
+EAPI int
+ ecore_x_screensaver_idle_time_get(void);
+EAPI void
+ ecore_x_screensaver_set(int timeout,
+ int interval,
+ int prefer_blanking,
+ int allow_exposures);
+EAPI void
+ ecore_x_screensaver_timeout_set(int timeout);
+EAPI int
+ ecore_x_screensaver_timeout_get(void);
+EAPI void
+ ecore_x_screensaver_blank_set(int timeout);
+EAPI int
+ ecore_x_screensaver_blank_get(void);
+EAPI void
+ ecore_x_screensaver_expose_set(int timeout);
+EAPI int
+ ecore_x_screensaver_expose_get(void);
+EAPI void
+ ecore_x_screensaver_interval_set(int timeout);
+EAPI int
+ ecore_x_screensaver_interval_get(void);
+EAPI void
+ ecore_x_screensaver_event_listen_set(Eina_Bool on);
/* FIXME: these funcs need categorising */
@@ -1764,47 +2736,128 @@ typedef struct _Ecore_X_Window_Attributes
*/
} Ecore_X_Window_Attributes;
-EAPI Eina_Bool ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att_ret);
-EAPI void ecore_x_window_save_set_add(Ecore_X_Window win);
-EAPI void ecore_x_window_save_set_del(Ecore_X_Window win);
-EAPI Ecore_X_Window *ecore_x_window_children_get(Ecore_X_Window win, int *num);
-
-EAPI Eina_Bool ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold);
-EAPI Eina_Bool ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold);
-EAPI Eina_Bool ecore_x_pointer_mapping_set(unsigned char *map, int nmap);
-EAPI Eina_Bool ecore_x_pointer_mapping_get(unsigned char *map, int nmap);
-EAPI Eina_Bool ecore_x_pointer_grab(Ecore_X_Window win);
-EAPI Eina_Bool ecore_x_pointer_confine_grab(Ecore_X_Window win);
-EAPI void ecore_x_pointer_ungrab(void);
-EAPI Eina_Bool ecore_x_pointer_warp(Ecore_X_Window win, int x, int y);
-EAPI Eina_Bool ecore_x_keyboard_grab(Ecore_X_Window win);
-EAPI void ecore_x_keyboard_ungrab(void);
-EAPI void ecore_x_grab(void);
-EAPI void ecore_x_ungrab(void);
-EAPI void ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, int event_type, void *event), void *data);
-EAPI void ecore_x_window_button_grab(Ecore_X_Window win, int button, Ecore_X_Event_Mask event_mask, int mod, int any_mod);
-EAPI void ecore_x_window_button_ungrab(Ecore_X_Window win, int button, int mod, int any_mod);
-EAPI void ecore_x_window_key_grab(Ecore_X_Window win, const char *key, int mod, int any_mod);
-EAPI void ecore_x_window_key_ungrab(Ecore_X_Window win, const char *key, int mod, int any_mod);
-
-EAPI void ecore_x_focus_reset(void);
-EAPI void ecore_x_events_allow_all(void);
-EAPI void ecore_x_pointer_last_xy_get(int *x, int *y);
-EAPI void ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y);
+EAPI Eina_Bool
+ecore_x_window_attributes_get(Ecore_X_Window win,
+ Ecore_X_Window_Attributes *att_ret);
+EAPI void
+ ecore_x_window_save_set_add(Ecore_X_Window win);
+EAPI void
+ ecore_x_window_save_set_del(Ecore_X_Window win);
+EAPI Ecore_X_Window *
+ ecore_x_window_children_get(Ecore_X_Window win,
+ int *num);
+
+EAPI Eina_Bool
+ecore_x_pointer_control_set(int accel_num,
+ int accel_denom,
+ int threshold);
+EAPI Eina_Bool
+ecore_x_pointer_control_get(int *accel_num,
+ int *accel_denom,
+ int *threshold);
+EAPI Eina_Bool
+ecore_x_pointer_mapping_set(unsigned char *map,
+ int nmap);
+EAPI Eina_Bool
+ecore_x_pointer_mapping_get(unsigned char *map,
+ int nmap);
+EAPI Eina_Bool
+ ecore_x_pointer_grab(Ecore_X_Window win);
+EAPI Eina_Bool
+ ecore_x_pointer_confine_grab(Ecore_X_Window win);
+EAPI void
+ ecore_x_pointer_ungrab(void);
+EAPI Eina_Bool
+ ecore_x_pointer_warp(Ecore_X_Window win,
+ int x,
+ int y);
+EAPI Eina_Bool
+ ecore_x_keyboard_grab(Ecore_X_Window win);
+EAPI void
+ ecore_x_keyboard_ungrab(void);
+EAPI void
+ ecore_x_grab(void);
+EAPI void
+ ecore_x_ungrab(void);
+EAPI void
+ ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event),
+ void *data);
+EAPI void
+ecore_x_window_button_grab(Ecore_X_Window win,
+ int button,
+ Ecore_X_Event_Mask event_mask,
+ int mod,
+ int any_mod);
+EAPI void
+ecore_x_window_button_ungrab(Ecore_X_Window win,
+ int button,
+ int mod,
+ int any_mod);
+EAPI void
+ecore_x_window_key_grab(Ecore_X_Window win,
+ const char *key,
+ int mod,
+ int any_mod);
+EAPI void
+ecore_x_window_key_ungrab(Ecore_X_Window win,
+ const char *key,
+ int mod,
+ int any_mod);
+
+EAPI void
+ ecore_x_focus_reset(void);
+EAPI void
+ ecore_x_events_allow_all(void);
+EAPI void
+ ecore_x_pointer_last_xy_get(int *x,
+ int *y);
+EAPI void
+ecore_x_pointer_xy_get(Ecore_X_Window win,
+ int *x,
+ int *y);
/* ecore_x_region.c */
-EAPI Ecore_X_XRegion *ecore_x_xregion_new(void);
-EAPI void ecore_x_xregion_free(Ecore_X_XRegion *region);
-EAPI Eina_Bool ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc);
-EAPI void ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y);
-EAPI Eina_Bool ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI Eina_Bool ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI Eina_Bool ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect);
-EAPI Eina_Bool ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI Eina_Bool ecore_x_xregion_is_empty(Ecore_X_XRegion *region);
-EAPI Eina_Bool ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI Eina_Bool ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y);
-EAPI Eina_Bool ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect);
+EAPI Ecore_X_XRegion *
+ ecore_x_xregion_new(void);
+EAPI void
+ ecore_x_xregion_free(Ecore_X_XRegion *region);
+EAPI Eina_Bool
+ ecore_x_xregion_set(Ecore_X_XRegion *region,
+ Ecore_X_GC gc);
+EAPI void
+ecore_x_xregion_translate(Ecore_X_XRegion *region,
+ int x,
+ int y);
+EAPI Eina_Bool
+ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI Eina_Bool
+ecore_x_xregion_union(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI Eina_Bool
+ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *src,
+ Ecore_X_Rectangle *rect);
+EAPI Eina_Bool
+ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI Eina_Bool
+ ecore_x_xregion_is_empty(Ecore_X_XRegion *region);
+EAPI Eina_Bool
+ ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI Eina_Bool
+ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
+ int x,
+ int y);
+EAPI Eina_Bool
+ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
+ Ecore_X_Rectangle *rect);
/* ecore_x_randr.c */
@@ -1838,101 +2891,258 @@ typedef struct _Ecore_X_Randr_Mode_Info
unsigned long modeFlags;
} Ecore_X_Randr_Mode_Info;
-EAPI int ecore_x_randr_version_get(void);
-EAPI Eina_Bool ecore_x_randr_query(void);
+EAPI int
+ ecore_x_randr_version_get(void);
+EAPI Eina_Bool
+ ecore_x_randr_query(void);
/* ecore_x_randr_11.c */
-EAPI Ecore_X_Randr_Orientation ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root);
-EAPI Ecore_X_Randr_Orientation ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root);
-EAPI Eina_Bool ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root, Ecore_X_Randr_Orientation orientation);
-EAPI Ecore_X_Randr_Screen_Size_MM *ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, int *num);
-
-/**
- * @brief get the current set size of a given screen's primary output
- * @param root window which's primary output will be queried
- * @param w the current size's width
- * @param h the current size's height
- * @param w_mm the current size's width in mm
- * @param h_mm the current size's height in mm
- * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set()
- */
-EAPI void ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, int *w, int *h, int *w_mm, int *h_mm, int *size_index);
-EAPI Eina_Bool ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, int size_index);
-EAPI Ecore_X_Randr_Refresh_Rate ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root);
-EAPI Ecore_X_Randr_Refresh_Rate *ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, int size_index, int *num);
-EAPI Eina_Bool ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root, int size_index, Ecore_X_Randr_Refresh_Rate rate);
+EAPI Ecore_X_Randr_Orientation
+ ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root);
+EAPI Ecore_X_Randr_Orientation
+ ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root);
+EAPI Eina_Bool
+ ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root,
+ Ecore_X_Randr_Orientation orientation);
+EAPI Ecore_X_Randr_Screen_Size_MM *
+ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
+ int *num);
+EAPI void
+ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root,
+ int *w,
+ int *h,
+ int *w_mm,
+ int *h_mm,
+ int *size_index);
+EAPI Eina_Bool
+ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
+ int size_index);
+EAPI Ecore_X_Randr_Refresh_Rate
+ ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root);
+EAPI Ecore_X_Randr_Refresh_Rate *
+ ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
+ int size_index,
+ int *num);
+EAPI Eina_Bool
+ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root,
+ int size_index,
+ Ecore_X_Randr_Refresh_Rate rate);
/* ecore_x_randr_12.c */
-EAPI void ecore_x_randr_events_select(Ecore_X_Window win, Eina_Bool on);
-
-EAPI void ecore_x_randr_screen_current_size_get(Ecore_X_Window root, int *w, int *h, int *w_mm, int *h_mm);
-EAPI void ecore_x_randr_screen_size_range_get(Ecore_X_Window root, int *wmin, int *hmin, int *wmax, int *hmax);
-EAPI void ecore_x_randr_screen_reset(Ecore_X_Window root);
-EAPI Eina_Bool ecore_x_randr_screen_current_size_set(Ecore_X_Window root, int w, int h, int w_mm, int h_mm);
-EAPI Ecore_X_Randr_Mode_Info **ecore_x_randr_modes_info_get(Ecore_X_Window root, int *num);
-EAPI Ecore_X_Randr_Mode ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info);
-EAPI void ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode);
-EAPI Ecore_X_Randr_Mode_Info *ecore_x_randr_mode_info_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode);
-EAPI void ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info);
-EAPI Ecore_X_Randr_Crtc *ecore_x_randr_crtcs_get(Ecore_X_Window root, int *num);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(Ecore_X_Window root, int *num);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_window_outputs_get(Ecore_X_Window window, int *num);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_current_output_get(Ecore_X_Window window, int *num);
-EAPI Ecore_X_Randr_Crtc *ecore_x_randr_window_crtcs_get(Ecore_X_Window window, int *num);
-EAPI Ecore_X_Randr_Crtc *ecore_x_randr_current_crtc_get(Ecore_X_Window window, int *num);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *num);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *num);
-EAPI void ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_randr_crtc_pos_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *x, int *y);
-EAPI Eina_Bool ecore_x_randr_crtc_pos_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int x, int y);
-EAPI Ecore_X_Randr_Mode ecore_x_randr_crtc_mode_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
-EAPI Eina_Bool ecore_x_randr_crtc_mode_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Output *outputs, int noutputs, Ecore_X_Randr_Mode mode);
-EAPI void ecore_x_randr_crtc_size_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *w, int *h);
-EAPI Ecore_X_Randr_Refresh_Rate ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Mode mode);
-EAPI Ecore_X_Randr_Orientation ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
-EAPI Ecore_X_Randr_Orientation ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
-EAPI Eina_Bool ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, const Ecore_X_Randr_Orientation orientation);
-EAPI Eina_Bool ecore_x_randr_crtc_clone_set(Ecore_X_Window root, Ecore_X_Randr_Crtc original, Ecore_X_Randr_Crtc clone);
-EAPI Eina_Bool ecore_x_randr_crtc_settings_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Output *outputs, int noutputs, int x, int y, Ecore_X_Randr_Mode mode, Ecore_X_Randr_Orientation orientation);
-EAPI Eina_Bool ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc_r1, Ecore_X_Randr_Crtc crtc_r2, Ecore_X_Randr_Output_Policy policy, Ecore_X_Randr_Relative_Alignment alignment);
-EAPI Eina_Bool ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, Ecore_X_Randr_Mode mode);
-EAPI void ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output, Ecore_X_Randr_Mode mode);
-EAPI Ecore_X_Randr_Mode *ecore_x_randr_output_modes_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num, int *npreferred);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_output_clones_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
-EAPI Ecore_X_Randr_Crtc *ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
-EAPI Ecore_X_Randr_Crtc ecore_x_randr_output_crtc_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI char *ecore_x_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *len);
-EAPI int ecore_x_randr_crtc_gamma_ramp_size_get(Ecore_X_Randr_Crtc crtc);
-EAPI Ecore_X_Randr_Crtc_Gamma **ecore_x_randr_crtc_gamma_ramps_get(Ecore_X_Randr_Crtc crtc);
-EAPI Eina_Bool ecore_x_randr_crtc_gamma_ramps_set(Ecore_X_Randr_Crtc crtc, const Ecore_X_Randr_Crtc_Gamma *red, const Ecore_X_Randr_Crtc_Gamma *green, const Ecore_X_Randr_Crtc_Gamma *blue);
-EAPI Eina_Bool ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, const Ecore_X_Randr_Crtc *not_moved, int nnot_moved, int dx, int dy);
-EAPI Eina_Bool ecore_x_randr_move_crtcs(Ecore_X_Window root, const Ecore_X_Randr_Crtc *crtcs, int ncrtc, int dx, int dy);
-EAPI void ecore_x_randr_mode_size_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode, int *w, int *h);
-EAPI Ecore_X_Randr_Connection_Status ecore_x_randr_output_connection_status_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI void ecore_x_randr_output_size_mm_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *w, int *h);
-EAPI Eina_Bool ecore_x_randr_output_crtc_set(Ecore_X_Window root, Ecore_X_Randr_Output output, const Ecore_X_Randr_Crtc crtc);
+EAPI void
+ecore_x_randr_events_select(Ecore_X_Window win,
+ Eina_Bool on);
+
+EAPI void
+ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
+ int *w,
+ int *h,
+ int *w_mm,
+ int *h_mm);
+EAPI void
+ecore_x_randr_screen_size_range_get(Ecore_X_Window root,
+ int *wmin,
+ int *hmin,
+ int *wmax,
+ int *hmax);
+EAPI void
+ ecore_x_randr_screen_reset(Ecore_X_Window root);
+EAPI Eina_Bool
+ ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
+ int w,
+ int h,
+ int w_mm,
+ int h_mm);
+EAPI Ecore_X_Randr_Mode_Info **
+ecore_x_randr_modes_info_get(Ecore_X_Window root,
+ int *num);
+EAPI Ecore_X_Randr_Mode
+ecore_x_randr_mode_info_add(Ecore_X_Window root,
+ Ecore_X_Randr_Mode_Info *mode_info);
+EAPI void
+ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode);
+EAPI Ecore_X_Randr_Mode_Info *
+ecore_x_randr_mode_info_get(Ecore_X_Window root,
+ Ecore_X_Randr_Mode mode);
+EAPI void
+ ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info);
+EAPI Ecore_X_Randr_Crtc *
+ ecore_x_randr_crtcs_get(Ecore_X_Window root,
+ int *num);
+EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(Ecore_X_Window root,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ecore_x_randr_window_outputs_get(Ecore_X_Window window,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ecore_x_randr_current_output_get(Ecore_X_Window window,
+ int *num);
+EAPI Ecore_X_Randr_Crtc *
+ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
+ int *num);
+EAPI Ecore_X_Randr_Crtc *
+ecore_x_randr_current_crtc_get(Ecore_X_Window window,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *num);
+EAPI void
+ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y);
+EAPI Eina_Bool
+ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int x,
+ int y);
+EAPI Ecore_X_Randr_Mode
+ecore_x_randr_crtc_mode_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Output *outputs,
+ int noutputs,
+ Ecore_X_Randr_Mode mode);
+EAPI void
+ecore_x_randr_crtc_size_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *w,
+ int *h);
+EAPI Ecore_X_Randr_Refresh_Rate
+ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Mode mode);
+EAPI Ecore_X_Randr_Orientation
+ecore_x_randr_crtc_orientations_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc);
+EAPI Ecore_X_Randr_Orientation
+ecore_x_randr_crtc_orientation_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ const Ecore_X_Randr_Orientation orientation);
+EAPI Eina_Bool
+ecore_x_randr_crtc_clone_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc original,
+ Ecore_X_Randr_Crtc clone);
+EAPI Eina_Bool
+ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Output *outputs,
+ int noutputs,
+ int x,
+ int y,
+ Ecore_X_Randr_Mode mode,
+ Ecore_X_Randr_Orientation orientation);
+EAPI Eina_Bool
+ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc_r1,
+ Ecore_X_Randr_Crtc crtc_r2,
+ Ecore_X_Randr_Output_Policy policy,
+ Ecore_X_Randr_Relative_Alignment alignment);
+EAPI Eina_Bool
+ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
+ Ecore_X_Randr_Mode mode);
+EAPI void
+ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
+ Ecore_X_Randr_Mode mode);
+EAPI Ecore_X_Randr_Mode *
+ecore_x_randr_output_modes_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num,
+ int *npreferred);
+EAPI Ecore_X_Randr_Output *ecore_x_randr_output_clones_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Ecore_X_Randr_Crtc *ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Ecore_X_Randr_Crtc
+ecore_x_randr_output_crtc_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI char *
+ecore_x_randr_output_name_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *len);
+EAPI int
+ ecore_x_randr_crtc_gamma_ramp_size_get(Ecore_X_Randr_Crtc crtc);
+EAPI Ecore_X_Randr_Crtc_Gamma **
+ ecore_x_randr_crtc_gamma_ramps_get(Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ ecore_x_randr_crtc_gamma_ramps_set(Ecore_X_Randr_Crtc crtc,
+ const Ecore_X_Randr_Crtc_Gamma *red,
+ const Ecore_X_Randr_Crtc_Gamma *green,
+ const Ecore_X_Randr_Crtc_Gamma *blue);
+EAPI Eina_Bool
+ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root,
+ const Ecore_X_Randr_Crtc *not_moved,
+ int nnot_moved,
+ int dx,
+ int dy);
+EAPI Eina_Bool
+ecore_x_randr_move_crtcs(Ecore_X_Window root,
+ const Ecore_X_Randr_Crtc *crtcs,
+ int ncrtc,
+ int dx,
+ int dy);
+EAPI void
+ecore_x_randr_mode_size_get(Ecore_X_Window root,
+ Ecore_X_Randr_Mode mode,
+ int *w,
+ int *h);
+EAPI Ecore_X_Randr_Connection_Status
+ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI void
+ecore_x_randr_output_size_mm_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *w,
+ int *h);
+EAPI Eina_Bool
+ecore_x_randr_output_crtc_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ const Ecore_X_Randr_Crtc crtc);
/* ecore_x_randr_12_edid.c */
-/**
+/*
* @brief Validates the header from raw EDID data.
*
* @param edid The edid structure.
* @param edid_length Length of the edid structure.
* @return @c EINA_TRUE, if the header is valid, @c EINA_FALSE otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_has_valid_header(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Checks whether a display's EDID has a valid checksum.
*
* @param edid The edid structure.
* @param edid_length Length of the edid structure.
* @return @c EINA_TRUE, if the checksum is valid, @c EINA_FALSE otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the encoded version from raw EDID data.
*
* The return value has the minor version in the lowest 8 bits, and the major
@@ -1945,45 +3155,55 @@ EAPI Eina_Bool ecore_x_randr_edid_info_has_valid
* @param edid_length length of the edid structure
* @return The encoded major and minor version encasuplated an int.
*/
-EAPI int ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length);
+EAPI int
+ecore_x_randr_edid_version_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the encoded manufacturer from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The encoded manufacturer identifier.
*/
-EAPI char *ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, unsigned long edid_length);
+EAPI char *
+ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the encoded name from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The encoded manufacturer identifier.
*/
-EAPI char *ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_length);
+EAPI char *
+ecore_x_randr_edid_display_name_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the encoded ASCII from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The encoded ASCII display identifier.
*/
-EAPI char *ecore_x_randr_edid_display_ascii_get(unsigned char *edid, unsigned long edid_length);
+EAPI char *
+ecore_x_randr_edid_display_ascii_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the encoded serial identifier from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The encoded serial identifier.
*/
-EAPI char *ecore_x_randr_edid_display_serial_get(unsigned char *edid, unsigned long edid_length);
+EAPI char *
+ecore_x_randr_edid_display_serial_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the encoded model number from raw EDID data.
*
* The manufacturer ID table is necessary for a useful description.
@@ -1992,27 +3212,33 @@ EAPI char *ecore_x_randr_edid_display_serial
* @param edid_length length of the edid structure
* @return The encoded model number.
*/
-EAPI int ecore_x_randr_edid_model_get(unsigned char *edid, unsigned long edid_length);
+EAPI int
+ecore_x_randr_edid_model_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the manufacturer serial number from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The encoded serial manufacturer serial number.
*/
-EAPI int ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, unsigned long edid_length);
+EAPI int
+ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the manufacturer model number from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The manufacturer's model number.
*/
-EAPI int ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, unsigned long edid_length);
+EAPI int
+ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Looks up the DPMS support from raw EDID data.
*
* @param edid The edid structure.
@@ -2020,63 +3246,77 @@ EAPI int ecore_x_randr_edid_manufacturer_m
* @return @c EINA_TRUE, if DPMS is supported in some way, @c EINA_FALSE
* otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_dpms_available_get(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_dpms_available_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Looks up the DPMS Standby support from raw EDID data.
*
* @param edid The edid structure.
* @param edid_length Length of the edid structure.
* @return @c EINA_TRUE, if DPMS Standby is supported, @c EINA_FALSE otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Looks up the DPMS Suspend support from raw EDID data.
*
* @param edid The edid structure.
* @param edid_length Length of the edid structure.
* @return @c EINA_TRUE, if DPMS Suspend is supported, @c EINA_FALSE otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Looks up the DPMS Off support from raw EDID data.
*
* @param edid The edid structure.
* @param edid_length Length of the edid structure.
* @return @c EINA_TRUE, if DPMS Off is supported, @c EINA_FALSE otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the preferred aspect ratio from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The preferred aspect ratio.
*/
-EAPI Ecore_X_Randr_Edid_Aspect_Ratio ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, unsigned long edid_length);
+EAPI Ecore_X_Randr_Edid_Aspect_Ratio
+ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the supported aspect ratios from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The supported aspect ratios.
*/
-EAPI Ecore_X_Randr_Edid_Aspect_Ratio ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, unsigned long edid_length);
+EAPI Ecore_X_Randr_Edid_Aspect_Ratio
+ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the supported colorschemes from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The supported colorschemes.
*/
-EAPI Ecore_X_Randr_Edid_Display_Colorscheme ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, unsigned long edid_length);
+EAPI Ecore_X_Randr_Edid_Display_Colorscheme
+ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the display type from raw EDID data.
*
* @param edid The edid structure.
@@ -2084,40 +3324,111 @@ EAPI Ecore_X_Randr_Edid_Display_Colorscheme ecore_x_randr_edid_display_colors
* @return @c EINA_TRUE, if the display is a digital one, @c EINA_FALSE
* otherwise.
*/
-EAPI Eina_Bool ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, unsigned long edid_length);
+EAPI Eina_Bool
+ecore_x_randr_edid_display_type_digital_get(unsigned char *edid,
+ unsigned long edid_length);
-/**
+/*
* @brief Get the display interface type from raw EDID data.
*
* @param edid the edid structure
* @param edid_length length of the edid structure
* @return The interface type.
*/
-EAPI Ecore_X_Randr_Edid_Display_Interface_Type ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, unsigned long edid_length);
+EAPI Ecore_X_Randr_Edid_Display_Interface_Type
+ecore_x_randr_edid_display_interface_type_get(unsigned char *edid,
+ unsigned long edid_length);
/* ecore_x_randr_12.c */
-EAPI Eina_Bool ecore_x_randr_output_backlight_available(void);
-EAPI void ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, double level);
-EAPI double ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI Eina_Bool ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, Ecore_X_Randr_Output output, double level);
-EAPI Ecore_X_Randr_Output ecore_x_randr_primary_output_get(Ecore_X_Window root);
-EAPI void ecore_x_randr_primary_output_set(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI Ecore_X_Render_Subpixel_Order ecore_x_randr_output_subpixel_order_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI unsigned char *ecore_x_randr_output_edid_get(Ecore_X_Window root, Ecore_X_Randr_Output output, unsigned long *length);
-EAPI Ecore_X_Randr_Output *ecore_x_randr_output_wired_clones_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
-EAPI Ecore_X_Randr_Output **ecore_x_randr_output_compatibility_list_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
-EAPI Ecore_X_Randr_Signal_Format *ecore_x_randr_output_signal_formats_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
-EAPI Eina_Bool ecore_x_randr_output_signal_format_set(Ecore_X_Window root, Ecore_X_Randr_Output output, Ecore_X_Randr_Signal_Format *signal);
-EAPI Ecore_X_Randr_Signal_Property *ecore_x_randr_output_signal_properties_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
-EAPI int ecore_x_randr_output_connector_number_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI Ecore_X_Randr_Connector_Type ecore_x_randr_output_connector_type_get(Ecore_X_Window root, Ecore_X_Randr_Output output);
-EAPI Eina_Rectangle *ecore_x_randr_crtc_panning_area_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *x, int *y, int *w, int *h);
-EAPI Eina_Bool ecore_x_randr_crtc_panning_area_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int x, const int y, const int w, const int h);
-EAPI Eina_Rectangle *ecore_x_randr_crtc_tracking_area_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *x, int *y, int *w, int *h);
-EAPI Eina_Bool ecore_x_randr_crtc_tracking_area_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int x, const int y, const int w, const int h);
-EAPI Eina_Rectangle *ecore_x_randr_crtc_border_area_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
-EAPI Eina_Bool ecore_x_randr_crtc_border_area_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int left, const int top, const int right, const int bottom);
+EAPI Eina_Bool
+ecore_x_randr_output_backlight_available(void);
+EAPI void
+ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root,
+ double level);
+EAPI double
+ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Eina_Bool
+ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ double level);
+EAPI Ecore_X_Randr_Output
+ ecore_x_randr_primary_output_get(Ecore_X_Window root);
+EAPI void
+ ecore_x_randr_primary_output_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Ecore_X_Render_Subpixel_Order
+ecore_x_randr_output_subpixel_order_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI unsigned char *
+ecore_x_randr_output_edid_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ unsigned long *length);
+EAPI Ecore_X_Randr_Output *
+ecore_x_randr_output_wired_clones_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Ecore_X_Randr_Output **
+ecore_x_randr_output_compatibility_list_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Ecore_X_Randr_Signal_Format *
+ecore_x_randr_output_signal_formats_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Eina_Bool
+ecore_x_randr_output_signal_format_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ Ecore_X_Randr_Signal_Format *signal);
+EAPI Ecore_X_Randr_Signal_Property *
+ecore_x_randr_output_signal_properties_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI int
+ecore_x_randr_output_connector_number_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Ecore_X_Randr_Connector_Type
+ecore_x_randr_output_connector_type_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Eina_Rectangle *
+ecore_x_randr_crtc_panning_area_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI Eina_Bool
+ecore_x_randr_crtc_panning_area_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int x,
+ const int y,
+ const int w,
+ const int h);
+EAPI Eina_Rectangle *
+ecore_x_randr_crtc_tracking_area_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI Eina_Bool
+ecore_x_randr_crtc_tracking_area_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int x,
+ const int y,
+ const int w,
+ const int h);
+EAPI Eina_Rectangle *
+ecore_x_randr_crtc_border_area_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ecore_x_randr_crtc_border_area_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int left,
+ const int top,
+ const int right,
+ const int bottom);
/* XRender Support (horrendously incomplete) */
typedef Ecore_X_ID Ecore_X_Picture;
@@ -2131,25 +3442,77 @@ typedef enum _Ecore_X_Region_Type
ECORE_X_REGION_CLIP
} Ecore_X_Region_Type;
-EAPI Ecore_X_Region ecore_x_region_new(Ecore_X_Rectangle *rects, int num);
-EAPI Ecore_X_Region ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap);
-EAPI Ecore_X_Region ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type);
-EAPI Ecore_X_Region ecore_x_region_new_from_gc(Ecore_X_GC gc);
-EAPI Ecore_X_Region ecore_x_region_new_from_picture(Ecore_X_Picture picture);
-EAPI void ecore_x_region_free(Ecore_X_Region region);
-EAPI void ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source);
-EAPI void ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2);
-EAPI void ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2);
-EAPI void ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2);
-EAPI void ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source);
-EAPI void ecore_x_region_translate(Ecore_X_Region region, int dx, int dy);
-EAPI void ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source);
-EAPI Ecore_X_Rectangle *ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds);
-EAPI void ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom);
-EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x_origin, int y_origin);
-EAPI void ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window win, Ecore_X_Shape_Type type, int x_offset, int y_offset);
-EAPI void ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x_origin, int y_origin);
+EAPI Ecore_X_Region
+ecore_x_region_new(Ecore_X_Rectangle *rects,
+ int num);
+EAPI Ecore_X_Region
+ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap);
+EAPI Ecore_X_Region
+ ecore_x_region_new_from_window(Ecore_X_Window win,
+ Ecore_X_Region_Type type);
+EAPI Ecore_X_Region
+ ecore_x_region_new_from_gc(Ecore_X_GC gc);
+EAPI Ecore_X_Region
+ ecore_x_region_new_from_picture(Ecore_X_Picture picture);
+EAPI void
+ ecore_x_region_free(Ecore_X_Region region);
+EAPI void
+ ecore_x_region_set(Ecore_X_Region region,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void
+ecore_x_region_copy(Ecore_X_Region dest,
+ Ecore_X_Region source);
+EAPI void
+ecore_x_region_combine(Ecore_X_Region dest,
+ Ecore_X_Region source1,
+ Ecore_X_Region source2);
+EAPI void
+ecore_x_region_intersect(Ecore_X_Region dest,
+ Ecore_X_Region source1,
+ Ecore_X_Region source2);
+EAPI void
+ecore_x_region_subtract(Ecore_X_Region dest,
+ Ecore_X_Region source1,
+ Ecore_X_Region source2);
+EAPI void
+ecore_x_region_invert(Ecore_X_Region dest,
+ Ecore_X_Rectangle *bounds,
+ Ecore_X_Region source);
+EAPI void
+ecore_x_region_translate(Ecore_X_Region region,
+ int dx,
+ int dy);
+EAPI void
+ecore_x_region_extents(Ecore_X_Region dest,
+ Ecore_X_Region source);
+EAPI Ecore_X_Rectangle *
+ecore_x_region_fetch(Ecore_X_Region region,
+ int *num,
+ Ecore_X_Rectangle *bounds);
+EAPI void
+ecore_x_region_expand(Ecore_X_Region dest,
+ Ecore_X_Region source,
+ unsigned int left,
+ unsigned int right,
+ unsigned int top,
+ unsigned int bottom);
+EAPI void
+ecore_x_region_gc_clip_set(Ecore_X_Region region,
+ Ecore_X_GC gc,
+ int x_origin,
+ int y_origin);
+EAPI void
+ecore_x_region_window_shape_set(Ecore_X_Region region,
+ Ecore_X_Window win,
+ Ecore_X_Shape_Type type,
+ int x_offset,
+ int y_offset);
+EAPI void
+ecore_x_region_picture_clip_set(Ecore_X_Region region,
+ Ecore_X_Picture picture,
+ int x_origin,
+ int y_origin);
/**
* xfixes selection notification request.
@@ -2159,19 +3522,34 @@ EAPI void ecore_x_region_picture_clip_set(Ecore_X_Region region, E
* @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
* @since 1.1.0
*/
-EAPI Eina_Bool ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection);
+EAPI Eina_Bool
+ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection);
/* XComposite Extension Support */
-EAPI Eina_Bool ecore_x_composite_query(void);
-EAPI void ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI void ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI void ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI void ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI Ecore_X_Pixmap ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win);
-EAPI void ecore_x_composite_window_events_disable(Ecore_X_Window win);
-EAPI void ecore_x_composite_window_events_enable(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_composite_render_window_enable(Ecore_X_Window root);
-EAPI void ecore_x_composite_render_window_disable(Ecore_X_Window root);
+EAPI Eina_Bool
+ ecore_x_composite_query(void);
+EAPI void
+ ecore_x_composite_redirect_window(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI void
+ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI void
+ecore_x_composite_unredirect_window(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI void
+ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI Ecore_X_Pixmap
+ ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win);
+EAPI void
+ ecore_x_composite_window_events_disable(Ecore_X_Window win);
+EAPI void
+ ecore_x_composite_window_events_enable(Ecore_X_Window win);
+EAPI Ecore_X_Window
+ ecore_x_composite_render_window_enable(Ecore_X_Window root);
+EAPI void
+ ecore_x_composite_render_window_disable(Ecore_X_Window root);
/* XDamage Extension Support */
typedef Ecore_X_ID Ecore_X_Damage;
@@ -2197,31 +3575,61 @@ struct _Ecore_X_Event_Damage
typedef struct _Ecore_X_Event_Damage Ecore_X_Event_Damage;
-EAPI Eina_Bool ecore_x_damage_query(void);
-EAPI Ecore_X_Damage ecore_x_damage_new(Ecore_X_Drawable d, Ecore_X_Damage_Report_Level level);
-EAPI void ecore_x_damage_free(Ecore_X_Damage damage);
-EAPI void ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Region repair, Ecore_X_Region parts);
-
-EAPI Eina_Bool ecore_x_screen_is_composited(int screen);
-EAPI void ecore_x_screen_is_composited_set(int screen, Ecore_X_Window win);
-
-EAPI Eina_Bool ecore_x_dpms_query(void);
-EAPI Eina_Bool ecore_x_dpms_capable_get(void);
-EAPI Eina_Bool ecore_x_dpms_enabled_get(void);
-EAPI void ecore_x_dpms_enabled_set(int enabled);
-EAPI void ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off);
-EAPI Eina_Bool ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off);
-EAPI unsigned int ecore_x_dpms_timeout_standby_get(void);
-EAPI unsigned int ecore_x_dpms_timeout_suspend_get(void);
-EAPI unsigned int ecore_x_dpms_timeout_off_get(void);
-EAPI void ecore_x_dpms_timeout_standby_set(unsigned int new_timeout);
-EAPI void ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout);
-EAPI void ecore_x_dpms_timeout_off_set(unsigned int new_timeout);
-
-EAPI Eina_Bool ecore_x_test_fake_key_down(const char *key);
-EAPI Eina_Bool ecore_x_test_fake_key_up(const char *key);
-EAPI Eina_Bool ecore_x_test_fake_key_press(const char *key);
-EAPI const char *ecore_x_keysym_string_get(int keysym);
+EAPI Eina_Bool
+ ecore_x_damage_query(void);
+EAPI Ecore_X_Damage
+ ecore_x_damage_new(Ecore_X_Drawable d,
+ Ecore_X_Damage_Report_Level level);
+EAPI void
+ ecore_x_damage_free(Ecore_X_Damage damage);
+EAPI void
+ ecore_x_damage_subtract(Ecore_X_Damage damage,
+ Ecore_X_Region repair,
+ Ecore_X_Region parts);
+
+EAPI Eina_Bool
+ ecore_x_screen_is_composited(int screen);
+EAPI void
+ ecore_x_screen_is_composited_set(int screen,
+ Ecore_X_Window win);
+
+EAPI Eina_Bool
+ ecore_x_dpms_query(void);
+EAPI Eina_Bool
+ ecore_x_dpms_capable_get(void);
+EAPI Eina_Bool
+ ecore_x_dpms_enabled_get(void);
+EAPI void
+ ecore_x_dpms_enabled_set(int enabled);
+EAPI void
+ ecore_x_dpms_timeouts_get(unsigned int *standby,
+ unsigned int *suspend,
+ unsigned int *off);
+EAPI Eina_Bool
+ecore_x_dpms_timeouts_set(unsigned int standby,
+ unsigned int suspend,
+ unsigned int off);
+EAPI unsigned int
+ ecore_x_dpms_timeout_standby_get(void);
+EAPI unsigned int
+ ecore_x_dpms_timeout_suspend_get(void);
+EAPI unsigned int
+ ecore_x_dpms_timeout_off_get(void);
+EAPI void
+ ecore_x_dpms_timeout_standby_set(unsigned int new_timeout);
+EAPI void
+ ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout);
+EAPI void
+ ecore_x_dpms_timeout_off_set(unsigned int new_timeout);
+
+EAPI Eina_Bool
+ ecore_x_test_fake_key_down(const char *key);
+EAPI Eina_Bool
+ ecore_x_test_fake_key_up(const char *key);
+EAPI Eina_Bool
+ ecore_x_test_fake_key_press(const char *key);
+EAPI const char *
+ ecore_x_keysym_string_get(int keysym);
/**
* Given a keyname, return the keycode representing that key
@@ -2230,22 +3638,64 @@ EAPI const char *ecore_x_keysym_string_get(int keysym);
*
* @since 1.2.0
*/
-EAPI int ecore_x_keysym_keycode_get(const char *keyname);
+EAPI int ecore_x_keysym_keycode_get(const char *keyname);
typedef struct _Ecore_X_Image Ecore_X_Image;
-EAPI Ecore_X_Image *ecore_x_image_new(int w, int h, Ecore_X_Visual vis, int depth);
-EAPI void ecore_x_image_free(Ecore_X_Image *im);
-EAPI Eina_Bool ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx, int sy, int w, int h);
-EAPI void ecore_x_image_put(Ecore_X_Image *im, Ecore_X_Drawable draw, Ecore_X_GC gc, int x, int y, int sx, int sy, int w, int h);
-EAPI void *ecore_x_image_data_get(Ecore_X_Image *im, int *bpl, int *rows, int *bpp);
-EAPI Eina_Bool ecore_x_image_is_argb32_get(Ecore_X_Image *im);
-
-EAPI Eina_Bool ecore_x_image_to_argb_convert(void *src, int sbpp, int sbpl, Ecore_X_Colormap c, Ecore_X_Visual v, int x, int y, int w, int h, unsigned int *dst, int dbpl, int dx, int dy);
-
-EAPI Eina_Bool ecore_x_input_multi_select(Ecore_X_Window win);
-
-EAPI Eina_Bool ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win);
+EAPI Ecore_X_Image *
+ecore_x_image_new(int w,
+ int h,
+ Ecore_X_Visual vis,
+ int depth);
+EAPI void
+ ecore_x_image_free(Ecore_X_Image *im);
+EAPI Eina_Bool
+ ecore_x_image_get(Ecore_X_Image *im,
+ Ecore_X_Drawable draw,
+ int x,
+ int y,
+ int sx,
+ int sy,
+ int w,
+ int h);
+EAPI void
+ecore_x_image_put(Ecore_X_Image *im,
+ Ecore_X_Drawable draw,
+ Ecore_X_GC gc,
+ int x,
+ int y,
+ int sx,
+ int sy,
+ int w,
+ int h);
+EAPI void *
+ecore_x_image_data_get(Ecore_X_Image *im,
+ int *bpl,
+ int *rows,
+ int *bpp);
+EAPI Eina_Bool
+ecore_x_image_is_argb32_get(Ecore_X_Image *im);
+
+EAPI Eina_Bool
+ecore_x_image_to_argb_convert(void *src,
+ int sbpp,
+ int sbpl,
+ Ecore_X_Colormap c,
+ Ecore_X_Visual v,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned int *dst,
+ int dbpl,
+ int dx,
+ int dy);
+
+EAPI Eina_Bool
+ecore_x_input_multi_select(Ecore_X_Window win);
+
+EAPI Eina_Bool
+ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win);
typedef enum _Ecore_X_Gesture_Event_Mask
{
@@ -2299,105 +3749,125 @@ typedef enum _Ecore_X_Gesture_Direction
struct _Ecore_X_Event_Gesture_Notify_Flick
{
- Ecore_X_Window win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
Ecore_X_Gesture_Event_Subtype subtype;
- int num_fingers;
- int distance;
- Ecore_X_Time duration;
- Ecore_X_Gesture_Direction direction;
- double angle;
+ int num_fingers;
+ int distance;
+ Ecore_X_Time duration;
+ Ecore_X_Gesture_Direction direction;
+ double angle;
};
-
+
struct _Ecore_X_Event_Gesture_Notify_Pan
{
- Ecore_X_Window win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
Ecore_X_Gesture_Event_Subtype subtype;
- int num_fingers;
- int dx;
- int dy;
- int distance;
- Ecore_X_Time duration;
- Ecore_X_Gesture_Direction direction;
+ int num_fingers;
+ int dx;
+ int dy;
+ int distance;
+ Ecore_X_Time duration;
+ Ecore_X_Gesture_Direction direction;
};
struct _Ecore_X_Event_Gesture_Notify_PinchRotation
{
- Ecore_X_Window win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
Ecore_X_Gesture_Event_Subtype subtype;
- int num_fingers;
- int distance;
- int cx;
- int cy;
- double zoom;
- double angle;
+ int num_fingers;
+ int distance;
+ int cx;
+ int cy;
+ double zoom;
+ double angle;
};
struct _Ecore_X_Event_Gesture_Notify_Tap
{
- Ecore_X_Window win;
- Ecore_X_Time time;
- Ecore_X_Gesture_Event_Subtype subtype;
- int num_fingers;
- int cx;
- int cy;
- int tap_repeat;
- Ecore_X_Time interval;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int cx;
+ int cy;
+ int tap_repeat;
+ Ecore_X_Time interval;
};
struct _Ecore_X_Event_Gesture_Notify_TapNHold
{
- Ecore_X_Window win;
- Ecore_X_Time time;
- Ecore_X_Gesture_Event_Subtype subtype;
- int num_fingers;
- int cx;
- int cy;
- Ecore_X_Time interval;
- Ecore_X_Time hold_time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int cx;
+ int cy;
+ Ecore_X_Time interval;
+ Ecore_X_Time hold_time;
};
struct _Ecore_X_Event_Gesture_Notify_Hold
{
- Ecore_X_Window win;
- Ecore_X_Time time;
- Ecore_X_Gesture_Event_Subtype subtype;
- int num_fingers;
- int cx;
- int cy;
- Ecore_X_Time hold_time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int cx;
+ int cy;
+ Ecore_X_Time hold_time;
};
struct _Ecore_X_Event_Gesture_Notify_Group
{
- Ecore_X_Window win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
Ecore_X_Gesture_Group_Subtype subtype;
- int num_groups;
- int group_id;
+ int num_groups;
+ int group_id;
};
-EAPI Eina_Bool ecore_x_gesture_supported(void);
+EAPI Eina_Bool
+ecore_x_gesture_supported(void);
-EAPI Eina_Bool ecore_x_gesture_events_select(Ecore_X_Window win, Ecore_X_Gesture_Event_Mask mask);
+EAPI Eina_Bool
+ecore_x_gesture_events_select(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Mask mask);
-EAPI Ecore_X_Gesture_Event_Mask ecore_x_gesture_events_selected_get(Ecore_X_Window win);
+EAPI Ecore_X_Gesture_Event_Mask
+ecore_x_gesture_events_selected_get(Ecore_X_Window win);
-EAPI Eina_Bool ecore_x_gesture_event_grab(Ecore_X_Window win, Ecore_X_Gesture_Event_Type type, int num_fingers);
+EAPI Eina_Bool
+ecore_x_gesture_event_grab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers);
-EAPI Eina_Bool ecore_x_gesture_event_ungrab(Ecore_X_Window win, Ecore_X_Gesture_Event_Type type, int num_fingers);
+EAPI Eina_Bool
+ecore_x_gesture_event_ungrab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers);
-EAPI void ecore_x_e_illume_indicator_state_set(Ecore_X_Window win, Ecore_X_Illume_Indicator_State state);
-EAPI Ecore_X_Illume_Indicator_State ecore_x_e_illume_indicator_state_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_indicator_state_send(Ecore_X_Window win, Ecore_X_Illume_Indicator_State state);
+EAPI void
+ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
+ Ecore_X_Illume_Indicator_State state);
+EAPI Ecore_X_Illume_Indicator_State
+ecore_x_e_illume_indicator_state_get(Ecore_X_Window win);
+EAPI void
+ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
+ Ecore_X_Illume_Indicator_State state);
-EAPI void ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win, Ecore_X_Illume_Indicator_Opacity_Mode mode);
+EAPI void
+ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
+ Ecore_X_Illume_Indicator_Opacity_Mode mode);
-EAPI Ecore_X_Illume_Indicator_Opacity_Mode ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win);
+EAPI Ecore_X_Illume_Indicator_Opacity_Mode
+ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, Ecore_X_Illume_Indicator_Opacity_Mode mode);
+EAPI void
+ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
+ Ecore_X_Illume_Indicator_Opacity_Mode mode);
EAPI void ecore_x_e_illume_window_state_set(Ecore_X_Window win, Ecore_X_Illume_Window_State state);
EAPI Ecore_X_Illume_Window_State ecore_x_e_illume_window_state_get(Ecore_X_Window win);
diff --git a/src/lib/ecore_x/Ecore_X_Atoms.h b/src/lib/ecore_x/Ecore_X_Atoms.h
index c9af5bf1..c5461c4f 100644
--- a/src/lib/ecore_x/Ecore_X_Atoms.h
+++ b/src/lib/ecore_x/Ecore_X_Atoms.h
@@ -255,13 +255,6 @@ EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_WINDOW_STATE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
diff --git a/src/lib/ecore_x/ecore_x_atoms_decl.h b/src/lib/ecore_x/ecore_x_atoms_decl.h
index 706fccdc..a2b86767 100644
--- a/src/lib/ecore_x/ecore_x_atoms_decl.h
+++ b/src/lib/ecore_x/ecore_x_atoms_decl.h
@@ -281,13 +281,6 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_WINDOW_STATE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE = 0;
@@ -315,281 +308,3 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT = 0;
/* currently elementary and E specific extension */
EAPI Ecore_X_Atom ECORE_X_ATOM_E_PROFILE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_PROFILE_LIST = 0;
-
-typedef struct _Atom_Item Atom_Item;
-
-struct _Atom_Item
-{
- const char *name;
- Ecore_X_Atom *atom;
-};
-
-const Atom_Item atom_items[] =
-{
- { "ATOM", &ECORE_X_ATOM_ATOM },
- { "CARDINAL", &ECORE_X_ATOM_CARDINAL },
- { "COMPOUND_TEXT", &ECORE_X_ATOM_COMPOUND_TEXT },
- { "FILE_NAME", &ECORE_X_ATOM_FILE_NAME },
- { "STRING", &ECORE_X_ATOM_STRING },
- { "TEXT", &ECORE_X_ATOM_TEXT },
- { "UTF8_STRING", &ECORE_X_ATOM_UTF8_STRING },
- { "WINDOW", &ECORE_X_ATOM_WINDOW },
- { "PIXMAP", &ECORE_X_ATOM_PIXMAP },
- { "VISUALID", &ECORE_X_ATOM_VISUALID },
-
- { "JXSelectionWindowProperty", &ECORE_X_ATOM_SELECTION_PROP_XDND },
- { "XdndSelection", &ECORE_X_ATOM_SELECTION_XDND },
- { "XdndAware", &ECORE_X_ATOM_XDND_AWARE },
- { "XdndEnter", &ECORE_X_ATOM_XDND_ENTER },
- { "XdndTypeList", &ECORE_X_ATOM_XDND_TYPE_LIST },
- { "XdndPosition", &ECORE_X_ATOM_XDND_POSITION },
- { "XdndActionCopy", &ECORE_X_ATOM_XDND_ACTION_COPY },
- { "XdndActionMove", &ECORE_X_ATOM_XDND_ACTION_MOVE },
- { "XdndActionPrivate", &ECORE_X_ATOM_XDND_ACTION_PRIVATE },
- { "XdndActionAsk", &ECORE_X_ATOM_XDND_ACTION_ASK },
- { "XdndActionList", &ECORE_X_ATOM_XDND_ACTION_LIST },
- { "XdndActionLink", &ECORE_X_ATOM_XDND_ACTION_LINK },
- { "XdndActionDescription", &ECORE_X_ATOM_XDND_ACTION_DESCRIPTION },
- { "XdndProxy", &ECORE_X_ATOM_XDND_PROXY },
- { "XdndStatus", &ECORE_X_ATOM_XDND_STATUS },
- { "XdndLeave", &ECORE_X_ATOM_XDND_LEAVE },
- { "XdndDrop", &ECORE_X_ATOM_XDND_DROP },
- { "XdndFinished", &ECORE_X_ATOM_XDND_FINISHED },
-
- { "XdndActionCopy", &ECORE_X_DND_ACTION_COPY },
- { "XdndActionMove", &ECORE_X_DND_ACTION_MOVE },
- { "XdndActionLink", &ECORE_X_DND_ACTION_LINK },
- { "XdndActionAsk", &ECORE_X_DND_ACTION_ASK },
- { "XdndActionPrivate", &ECORE_X_DND_ACTION_PRIVATE },
-
- { "_E_FRAME_SIZE", &ECORE_X_ATOM_E_FRAME_SIZE },
-
- { "_WIN_LAYER", &ECORE_X_ATOM_WIN_LAYER },
-
- { "WM_NAME", &ECORE_X_ATOM_WM_NAME },
- { "WM_ICON_NAME", &ECORE_X_ATOM_WM_ICON_NAME },
- { "WM_NORMAL_HINTS", &ECORE_X_ATOM_WM_NORMAL_HINTS },
- { "WM_SIZE_HINTS", &ECORE_X_ATOM_WM_SIZE_HINTS },
- { "WM_HINTS", &ECORE_X_ATOM_WM_HINTS },
- { "WM_CLASS", &ECORE_X_ATOM_WM_CLASS },
- { "WM_TRANSIENT_FOR", &ECORE_X_ATOM_WM_TRANSIENT_FOR },
- { "WM_PROTOCOLS", &ECORE_X_ATOM_WM_PROTOCOLS },
- { "WM_COLORMAP_WINDOWS", &ECORE_X_ATOM_WM_COLORMAP_WINDOWS },
- { "WM_COMMAND", &ECORE_X_ATOM_WM_COMMAND },
- { "WM_CLIENT_MACHINE", &ECORE_X_ATOM_WM_CLIENT_MACHINE },
-
- { "WM_STATE", &ECORE_X_ATOM_WM_STATE },
- { "WM_ICON_SIZE", &ECORE_X_ATOM_WM_ICON_SIZE },
-
- { "WM_CHANGE_STATE", &ECORE_X_ATOM_WM_CHANGE_STATE },
-
- { "WM_TAKE_FOCUS", &ECORE_X_ATOM_WM_TAKE_FOCUS },
- { "WM_SAVE_YOURSELF", &ECORE_X_ATOM_WM_SAVE_YOURSELF },
- { "WM_DELETE_WINDOW", &ECORE_X_ATOM_WM_DELETE_WINDOW },
-
- { "WM_COLORMAP_NOTIFY", &ECORE_X_ATOM_WM_COLORMAP_NOTIFY },
-
- { "SM_CLIENT_ID", &ECORE_X_ATOM_SM_CLIENT_ID },
- { "WM_CLIENT_LEADER", &ECORE_X_ATOM_WM_CLIENT_LEADER },
- { "WM_WINDOW_ROLE", &ECORE_X_ATOM_WM_WINDOW_ROLE },
-
- { "_MOTIF_WM_HINTS", &ECORE_X_ATOM_MOTIF_WM_HINTS },
-
- { "_NET_SUPPORTED", &ECORE_X_ATOM_NET_SUPPORTED },
- { "_NET_CLIENT_LIST", &ECORE_X_ATOM_NET_CLIENT_LIST },
- { "_NET_CLIENT_LIST_STACKING", &ECORE_X_ATOM_NET_CLIENT_LIST_STACKING },
- { "_NET_NUMBER_OF_DESKTOPS", &ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS },
- { "_NET_DESKTOP_GEOMETRY", &ECORE_X_ATOM_NET_DESKTOP_GEOMETRY },
- { "_NET_DESKTOP_VIEWPORT", &ECORE_X_ATOM_NET_DESKTOP_VIEWPORT },
- { "_NET_CURRENT_DESKTOP", &ECORE_X_ATOM_NET_CURRENT_DESKTOP },
- { "_NET_DESKTOP_NAMES", &ECORE_X_ATOM_NET_DESKTOP_NAMES },
- { "_NET_ACTIVE_WINDOW", &ECORE_X_ATOM_NET_ACTIVE_WINDOW },
- { "_NET_WORKAREA", &ECORE_X_ATOM_NET_WORKAREA },
- { "_NET_SUPPORTING_WM_CHECK", &ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK },
- { "_NET_VIRTUAL_ROOTS", &ECORE_X_ATOM_NET_VIRTUAL_ROOTS },
- { "_NET_DESKTOP_LAYOUT", &ECORE_X_ATOM_NET_DESKTOP_LAYOUT },
- { "_NET_SHOWING_DESKTOP", &ECORE_X_ATOM_NET_SHOWING_DESKTOP },
-
- { "_NET_CLOSE_WINDOW", &ECORE_X_ATOM_NET_CLOSE_WINDOW },
- { "_NET_MOVERESIZE_WINDOW", &ECORE_X_ATOM_NET_MOVERESIZE_WINDOW },
- { "_NET_WM_MOVERESIZE", &ECORE_X_ATOM_NET_WM_MOVERESIZE },
- { "_NET_RESTACK_WINDOW", &ECORE_X_ATOM_NET_RESTACK_WINDOW },
-
- { "_NET_REQUEST_FRAME_EXTENTS", &ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS },
-
- { "_NET_WM_NAME", &ECORE_X_ATOM_NET_WM_NAME },
- { "_NET_WM_VISIBLE_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_NAME },
- { "_NET_WM_ICON_NAME", &ECORE_X_ATOM_NET_WM_ICON_NAME },
- { "_NET_WM_VISIBLE_ICON_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME },
- { "_NET_WM_DESKTOP", &ECORE_X_ATOM_NET_WM_DESKTOP },
-
- { "_NET_WM_WINDOW_TYPE", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE },
- { "_NET_WM_WINDOW_TYPE_DESKTOP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP },
- { "_NET_WM_WINDOW_TYPE_DOCK", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK },
- { "_NET_WM_WINDOW_TYPE_TOOLBAR", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR },
- { "_NET_WM_WINDOW_TYPE_MENU", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU },
- { "_NET_WM_WINDOW_TYPE_UTILITY", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY },
- { "_NET_WM_WINDOW_TYPE_SPLASH", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH },
- { "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG },
- { "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL },
- { "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
- &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU },
- { "_NET_WM_WINDOW_TYPE_POPUP_MENU",
- &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU },
- { "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP },
- { "_NET_WM_WINDOW_TYPE_NOTIFICATION",
- &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION },
- { "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO },
- { "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND },
-
- { "_NET_WM_STATE", &ECORE_X_ATOM_NET_WM_STATE },
- { "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL },
- { "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY },
- { "_NET_WM_STATE_MAXIMIZED_VERT",
- &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT },
- { "_NET_WM_STATE_MAXIMIZED_HORZ",
- &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ },
- { "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED },
- { "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR },
- { "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER },
- { "_NET_WM_STATE_HIDDEN", &ECORE_X_ATOM_NET_WM_STATE_HIDDEN },
- { "_NET_WM_STATE_FULLSCREEN", &ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN },
- { "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE },
- { "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW },
- { "_NET_WM_STATE_DEMANDS_ATTENTION",
- &ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION },
-
- { "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS },
- { "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE },
- { "_NET_WM_ACTION_RESIZE", &ECORE_X_ATOM_NET_WM_ACTION_RESIZE },
- { "_NET_WM_ACTION_MINIMIZE", &ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE },
- { "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE },
- { "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK },
- { "_NET_WM_ACTION_MAXIMIZE_HORZ",
- &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ },
- { "_NET_WM_ACTION_MAXIMIZE_VERT",
- &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT },
- { "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN },
- { "_NET_WM_ACTION_CHANGE_DESKTOP",
- &ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP },
- { "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE },
- { "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE },
- { "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW },
-
- { "_NET_WM_STRUT", &ECORE_X_ATOM_NET_WM_STRUT },
- { "_NET_WM_STRUT_PARTIAL", &ECORE_X_ATOM_NET_WM_STRUT_PARTIAL },
- { "_NET_WM_ICON_GEOMETRY", &ECORE_X_ATOM_NET_WM_ICON_GEOMETRY },
- { "_NET_WM_ICON", &ECORE_X_ATOM_NET_WM_ICON },
- { "_NET_WM_PID", &ECORE_X_ATOM_NET_WM_PID },
- { "_NET_WM_HANDLED_ICONS", &ECORE_X_ATOM_NET_WM_HANDLED_ICONS },
- { "_NET_WM_USER_TIME", &ECORE_X_ATOM_NET_WM_USER_TIME },
- { "_NET_STARTUP_ID", &ECORE_X_ATOM_NET_STARTUP_ID },
- { "_NET_FRAME_EXTENTS", &ECORE_X_ATOM_NET_FRAME_EXTENTS },
-
- { "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING },
- { "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST },
- { "_NET_WM_SYNC_REQUEST_COUNTER",
- &ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER },
-
- { "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY },
- { "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW },
- { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE },
-
- { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS },
- { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD },
- { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY },
- { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY },
- { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY },
- { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY },
- { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD },
-
- { "_E_VIRTUAL_KEYBOARD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD },
- { "_E_VIRTUAL_KEYBOARD_STATE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE },
- { "_E_VIRTUAL_KEYBOARD_ON", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON },
- { "_E_VIRTUAL_KEYBOARD_OFF", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF },
- { "_E_VIRTUAL_KEYBOARD_ALPHA", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA },
- { "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC },
- { "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN },
- { "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER",
- &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER },
- { "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX },
- { "_E_VIRTUAL_KEYBOARD_TERMINAL",
- &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL },
- { "_E_VIRTUAL_KEYBOARD_PASSWORD",
- &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD },
- { "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP },
- { "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST },
- { "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE },
- { "_E_VIRTUAL_KEYBOARD_URL", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL },
- { "_E_VIRTUAL_KEYBOARD_KEYPAD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD },
- { "_E_VIRTUAL_KEYBOARD_J2ME", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME },
-
- { "_E_ILLUME_ZONE", &ECORE_X_ATOM_E_ILLUME_ZONE },
- { "_E_ILLUME_ZONE_LIST", &ECORE_X_ATOM_E_ILLUME_ZONE_LIST },
- { "_E_ILLUME_CONFORMANT", &ECORE_X_ATOM_E_ILLUME_CONFORMANT },
- { "_E_ILLUME_MODE", &ECORE_X_ATOM_E_ILLUME_MODE },
- { "_E_ILLUME_MODE_SINGLE", &ECORE_X_ATOM_E_ILLUME_MODE_SINGLE },
- { "_E_ILLUME_MODE_DUAL_TOP", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP },
- { "_E_ILLUME_MODE_DUAL_LEFT", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT },
- { "_E_ILLUME_FOCUS_BACK", &ECORE_X_ATOM_E_ILLUME_FOCUS_BACK },
- { "_E_ILLUME_FOCUS_FORWARD", &ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD },
- { "_E_ILLUME_FOCUS_HOME", &ECORE_X_ATOM_E_ILLUME_FOCUS_HOME },
- { "_E_ILLUME_CLOSE", &ECORE_X_ATOM_E_ILLUME_CLOSE },
- { "_E_ILLUME_HOME_NEW", &ECORE_X_ATOM_E_ILLUME_HOME_NEW },
- { "_E_ILLUME_HOME_DEL", &ECORE_X_ATOM_E_ILLUME_HOME_DEL },
- { "_E_ILLUME_DRAG", &ECORE_X_ATOM_E_ILLUME_DRAG },
- { "_E_ILLUME_DRAG_LOCKED", &ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED },
- { "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START },
- { "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END },
- { "_E_ILLUME_INDICATOR_GEOMETRY",
- &ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY },
- { "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY },
- { "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY },
- { "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL },
- { "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE },
- { "_E_ILLUME_QUICKPANEL_STATE_TOGGLE",
- &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE },
- { "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON },
- { "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF },
- { "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR",
- &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR },
- { "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR",
- &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR },
- { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
- { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
- &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
- { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
- { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON },
- { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF },
- { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE },
- { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE },
- { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT },
- { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT },
- { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
- { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
- { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
- { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE },
- { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON },
- { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF },
- { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY },
- { "_E_ILLUME_ACCESS_CONTROL", &ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL },
- { "_E_ILLUME_ACCESS_ACTION_NEXT", &ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT },
- { "_E_ILLUME_ACCESS_ACTION_PREV", &ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV },
- { "_E_ILLUME_ACCESS_ACTION_ACTIVATE", &ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE },
- { "_E_ILLUME_ACCESS_ACTION_READ", &ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ },
- { "_E_ILLUME_ACCESS_ACTION_READ_NEXT", &ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT },
- { "_E_ILLUME_ACCESS_ACTION_READ_PREV", &ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV },
- { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
- { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
- { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED },
- { "_E_COMP_SYNC_BEGIN", &ECORE_X_ATOM_E_COMP_SYNC_BEGIN },
- { "_E_COMP_SYNC_END", &ECORE_X_ATOM_E_COMP_SYNC_END },
- { "_E_COMP_SYNC_CANCEL", &ECORE_X_ATOM_E_COMP_SYNC_CANCEL },
-
- { "_E_COMP_FLUSH", &ECORE_X_ATOM_E_COMP_FLUSH },
- { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP },
- { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP },
- { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT },
- { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }
-};
-
diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c
index 9d8910d3..17d17af1 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb.c
@@ -652,106 +652,6 @@ ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y)
}
EAPI Eina_Bool
-ecore_x_mouse_in_send(Ecore_X_Window win, int x, int y)
-{
- xcb_translate_coordinates_cookie_t cookie;
- xcb_translate_coordinates_reply_t *reply;
- xcb_enter_notify_event_t ev;
- xcb_void_cookie_t vcookie;
- xcb_generic_error_t *err;
- Ecore_X_Window root = 0;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- CHECK_XCB_CONN;
-
- root = ecore_x_window_root_get(win);
- cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y);
- reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return EINA_FALSE;
-
- memset(&ev, 0, sizeof(xcb_enter_notify_event_t));
-
- ev.response_type = XCB_ENTER_NOTIFY;
- ev.event = win;
- ev.child = win;
- ev.root = root;
- ev.event_x = x;
- ev.event_y = y;
- ev.same_screen_focus = 1;
- ev.mode = XCB_NOTIFY_MODE_NORMAL;
- ev.detail = XCB_NOTIFY_DETAIL_NONLINEAR;
- /* ev.focus = 0; */
- ev.state = 0;
- ev.root_x = reply->dst_x;
- ev.root_y = reply->dst_y;
- ev.time = ecore_x_current_time_get();
- free(reply);
-
- vcookie = xcb_send_event(_ecore_xcb_conn, 1, win,
- XCB_EVENT_MASK_ENTER_WINDOW, (const char *)&ev);
-
- err = xcb_request_check(_ecore_xcb_conn, vcookie);
- if (err)
- {
- _ecore_xcb_error_handle(err);
- free(err);
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-ecore_x_mouse_out_send(Ecore_X_Window win, int x, int y)
-{
- xcb_translate_coordinates_cookie_t cookie;
- xcb_translate_coordinates_reply_t *reply;
- xcb_leave_notify_event_t ev;
- xcb_void_cookie_t vcookie;
- xcb_generic_error_t *err;
- Ecore_X_Window root = 0;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- CHECK_XCB_CONN;
-
- root = ecore_x_window_root_get(win);
- cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y);
- reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return EINA_FALSE;
-
- memset(&ev, 0, sizeof(xcb_leave_notify_event_t));
-
- ev.response_type = XCB_LEAVE_NOTIFY;
- ev.event = win;
- ev.child = win;
- ev.root = root;
- ev.event_x = x;
- ev.event_y = y;
- ev.same_screen_focus = 1;
- ev.mode = XCB_NOTIFY_MODE_NORMAL;
- ev.detail = XCB_NOTIFY_DETAIL_NONLINEAR;
- /* ev.focus = 0; */
- ev.state = 0;
- ev.root_x = reply->dst_x;
- ev.root_y = reply->dst_y;
- ev.time = ecore_x_current_time_get();
- free(reply);
-
- vcookie = xcb_send_event(_ecore_xcb_conn, 1, win,
- XCB_EVENT_MASK_LEAVE_WINDOW, (const char *)&ev);
-
- err = xcb_request_check(_ecore_xcb_conn, vcookie);
- if (err)
- {
- _ecore_xcb_error_handle(err);
- free(err);
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
ecore_x_keyboard_grab(Ecore_X_Window win)
{
xcb_grab_keyboard_cookie_t cookie;
@@ -1308,14 +1208,14 @@ ecore_x_screen_index_get(const Ecore_X_Screen *screen)
/**
* Retrieves the screen based on index number.
*
- * @param idx The index that will be used to retrieve the screen.
+ * @param index The index that will be used to retrieve the screen.
* @return The Ecore_X_Screen at this index.
* @ingroup Ecore_X_Display_Attr_Group
*
* @since 1.1
*/
EAPI Ecore_X_Screen *
-ecore_x_screen_get(int idx)
+ecore_x_screen_get(int index)
{
xcb_screen_iterator_t iter;
int i = 0;
@@ -1325,7 +1225,7 @@ ecore_x_screen_get(int idx)
iter =
xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
- if (i == idx) return iter.data;
+ if (i == index) return iter.data;
return NULL;
}
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_atoms.c b/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
index ac184d5f..82abe0d1 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
@@ -4,6 +4,13 @@
/* NB: Increment if you add new atoms */
#define ECORE_X_ATOMS_COUNT 199
+typedef struct _Xcb_Atom Xcb_Atom;
+struct _Xcb_Atom
+{
+ const char *name;
+ Ecore_X_Atom *atom;
+};
+
/* local function prototypes */
/* local variables */
@@ -284,12 +291,12 @@ _ecore_xcb_atoms_init(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
- num = (sizeof(atom_items) / sizeof(Atom_Item));
+ num = (sizeof(atoms) / sizeof(Xcb_Atom));
for (i = 0; i < num; i++)
{
cookies[i] =
xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
- strlen(atom_items[i].name), atom_items[i].name);
+ strlen(atoms[i].name), atoms[i].name);
}
}
@@ -301,14 +308,14 @@ _ecore_xcb_atoms_finalize(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
- num = (sizeof(atom_items) / sizeof(Atom_Item));
+ num = (sizeof(atoms) / sizeof(Xcb_Atom));
for (i = 0; i < num; i++)
{
xcb_intern_atom_reply_t *reply = NULL;
if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0)))
continue;
- *(atom_items[i].atom) = reply->atom;
+ *(atoms[i].atom) = reply->atom;
free(reply);
}
}
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_e.c b/src/lib/ecore_x/xcb/ecore_xcb_e.c
index 974655bc..68de828b 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_e.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_e.c
@@ -1030,78 +1030,6 @@ ecore_x_e_illume_home_del_send(Ecore_X_Window win)
}
EAPI void
-ecore_x_e_illume_access_action_next_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_prev_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_activate_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_read_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_read_next_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_read_prev_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV,
- 0, 0, 0);
-}
-
-EAPI void
ecore_x_e_illume_drag_set(Ecore_X_Window win,
unsigned int drag)
{
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
index a96b0475..a07e2866 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
@@ -74,10 +74,8 @@ static Eina_Bool _ecore_xcb_randr_crtc_val
Ecore_X_Randr_Crtc crtc);
static Eina_Bool _ecore_xcb_randr_root_validate(Ecore_X_Window root);
static int _ecore_xcb_randr_root_to_screen(Ecore_X_Window root);
-#ifdef ECORE_XCB_RANDR
static xcb_randr_get_screen_resources_reply_t *_ecore_xcb_randr_12_get_resources(Ecore_X_Window win);
static xcb_randr_get_screen_resources_current_reply_t *_ecore_xcb_randr_13_get_resources(Ecore_X_Window win);
-#endif
static xcb_timestamp_t _ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win);
static xcb_timestamp_t _ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win);
@@ -193,11 +191,7 @@ _ecore_xcb_randr_finalize(void)
}
static Eina_Bool
-#ifdef ECORE_XCB_RANDR
_ecore_xcb_randr_root_validate(Ecore_X_Window root)
-#else
-_ecore_xcb_randr_root_validate(Ecore_X_Window root __UNUSED__)
-#endif
{
#ifdef ECORE_XCB_RANDR
Ecore_X_Randr_Screen scr = -1;
@@ -848,8 +842,8 @@ ecore_x_randr_mode_info_get(Ecore_X_Window root,
EAPI Ecore_X_Randr_Mode
ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info)
{
- Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
#ifdef ECORE_XCB_RANDR
+ Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
xcb_randr_create_mode_cookie_t cookie;
xcb_randr_create_mode_reply_t *reply;
xcb_randr_mode_info_t info;
@@ -1634,7 +1628,7 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
root = ecore_x_window_root_get(window);
crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
- if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail;
+ if (!crtcs) return NULL;
/* now get window RELATIVE to root window - thats what matters. */
cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
@@ -1643,12 +1637,6 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
w_geo.y = trans->dst_y;
free(trans);
- ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc));
- if (!ret)
- {
- free(crtcs);
- goto _ecore_x_randr_window_crtcs_get_fail;
- }
for (i = 0, nret = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
@@ -1659,8 +1647,9 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
&c_geo.w, &c_geo.h);
if (eina_rectangles_intersect(&w_geo, &c_geo))
{
+ ret = realloc(ret, (++nret *
+ sizeof(Ecore_X_Randr_Output)));
ret[nret] = crtcs[i];
- nret++;
}
}
free(crtcs);
@@ -1668,7 +1657,6 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
if (num) *num = nret;
return ret;
-_ecore_x_randr_window_crtcs_get_fail:
#endif
if (num) *num = 0;
return NULL;
@@ -1854,8 +1842,6 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
case ECORE_X_RANDR_OUTPUT_POLICY_NONE:
break;
- default:
- return EINA_FALSE;
}
if ((xn == r1.x) && (yn == r1.x)) return EINA_TRUE;
@@ -2456,7 +2442,7 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
#ifdef ECORE_XCB_RANDR
Ecore_X_Window root;
Ecore_X_Randr_Crtc *crtcs;
- Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
+ Ecore_X_Randr_Output *outputs, *ret = NULL;
int ncrtcs, noutputs, i, nret = 0;
#endif
@@ -2479,13 +2465,10 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
&noutputs);
if (!outputs)
goto _ecore_x_randr_current_output_get_fail_free;
- tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
- if (!tret) goto _ecore_x_randr_current_output_get_fail_free;
- ret = tret;
- memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
nret += noutputs;
+ ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
+ memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
free(outputs);
- outputs = NULL;
}
free(crtcs);
@@ -2940,7 +2923,6 @@ _ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root,
int *npreferred)
{
Ecore_X_Randr_Mode *modes = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -2974,7 +2956,7 @@ _ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
+
return modes;
}
@@ -2985,7 +2967,6 @@ _ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root,
int *npreferred)
{
Ecore_X_Randr_Mode *modes = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_timestamp_t stamp = 0;
xcb_randr_get_output_info_cookie_t ocookie;
xcb_randr_get_output_info_reply_t *oreply;
@@ -3012,7 +2993,7 @@ _ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root,
}
free(oreply);
}
-#endif
+
return modes;
}
@@ -3021,7 +3002,6 @@ _ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root,
Ecore_X_Randr_Mode mode)
{
Ecore_X_Randr_Mode_Info *ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3072,7 +3052,6 @@ _ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root,
free(reply);
}
-#endif
return ret;
}
@@ -3081,7 +3060,6 @@ _ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root,
Ecore_X_Randr_Mode mode)
{
Ecore_X_Randr_Mode_Info *ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3133,7 +3111,6 @@ _ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root,
free(reply);
}
-#endif
return ret;
}
@@ -3142,7 +3119,6 @@ _ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Mode_Info **ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3202,7 +3178,6 @@ _ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3211,7 +3186,6 @@ _ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Mode_Info **ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3272,7 +3246,6 @@ _ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3282,10 +3255,6 @@ _ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root,
int *w,
int *h)
{
- if (w) *w = 0;
- if (h) *h = 0;
-
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3309,7 +3278,6 @@ _ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
}
static void
@@ -3318,10 +3286,6 @@ _ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root,
int *w,
int *h)
{
- if (w) *w = 0;
- if (h) *h = 0;
-
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3345,7 +3309,6 @@ _ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
}
static Ecore_X_Randr_Output *
@@ -3354,7 +3317,6 @@ _ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Output *outputs = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3383,7 +3345,6 @@ _ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return outputs;
}
@@ -3393,7 +3354,6 @@ _ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Output *outputs = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3422,7 +3382,6 @@ _ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return outputs;
}
@@ -3432,7 +3391,6 @@ _ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Crtc *crtcs = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3460,7 +3418,6 @@ _ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return crtcs;
}
@@ -3470,7 +3427,6 @@ _ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Crtc *crtcs = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3498,7 +3454,6 @@ _ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return crtcs;
}
@@ -3508,7 +3463,6 @@ _ecore_xcb_randr_12_output_name_get(Ecore_X_Window root,
int *len)
{
char *ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3541,7 +3495,6 @@ _ecore_xcb_randr_12_output_name_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3551,7 +3504,6 @@ _ecore_xcb_randr_13_output_name_get(Ecore_X_Window root,
int *len)
{
char *ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3584,7 +3536,6 @@ _ecore_xcb_randr_13_output_name_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3593,7 +3544,6 @@ _ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3614,7 +3564,6 @@ _ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3623,7 +3572,6 @@ _ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3644,7 +3592,6 @@ _ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3653,7 +3600,6 @@ _ecore_xcb_randr_12_outputs_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Output *ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3666,7 +3612,6 @@ _ecore_xcb_randr_12_outputs_get(Ecore_X_Window root,
sizeof(Ecore_X_Randr_Output) * reply->num_outputs);
free(reply);
}
-#endif
return ret;
}
@@ -3675,7 +3620,6 @@ _ecore_xcb_randr_13_outputs_get(Ecore_X_Window root,
int *num)
{
Ecore_X_Randr_Output *ret = NULL;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3688,7 +3632,6 @@ _ecore_xcb_randr_13_outputs_get(Ecore_X_Window root,
sizeof(Ecore_X_Randr_Output) * reply->num_outputs);
free(reply);
}
-#endif
return ret;
}
@@ -3697,7 +3640,6 @@ _ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(root);
@@ -3718,7 +3660,6 @@ _ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3727,7 +3668,6 @@ _ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(root);
@@ -3748,7 +3688,6 @@ _ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root,
}
free(reply);
}
-#endif
return ret;
}
@@ -3781,13 +3720,11 @@ static xcb_timestamp_t
_ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win)
{
xcb_timestamp_t stamp = 0;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_reply_t *reply;
reply = _ecore_xcb_randr_12_get_resources(win);
stamp = reply->config_timestamp;
free(reply);
-#endif
return stamp;
}
@@ -3795,13 +3732,11 @@ static xcb_timestamp_t
_ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win)
{
xcb_timestamp_t stamp = 0;
-#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_resources_current_reply_t *reply;
reply = _ecore_xcb_randr_13_get_resources(win);
stamp = reply->config_timestamp;
free(reply);
-#endif
return stamp;
}
diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c
index 98c2526a..4530b0c8 100644
--- a/src/lib/ecore_x/xlib/ecore_x.c
+++ b/src/lib/ecore_x/xlib/ecore_x.c
@@ -211,16 +211,6 @@ _XReply(Display *disp,
#endif /* ifdef LOGRT */
-/* wrapper to use XkbKeycodeToKeysym when possible */
-KeySym
-_ecore_x_XKeycodeToKeysym(Display *display, KeyCode keycode, int idx)
-{
-#ifdef ECORE_XKB
- return XkbKeycodeToKeysym(display, keycode, 0, idx);
-#endif
- return XKeycodeToKeysym(display, keycode, idx);
-}
-
void
_ecore_x_modifiers_get(void)
{
@@ -823,16 +813,16 @@ ecore_x_screen_index_get(const Ecore_X_Screen *screen)
/**
* Retrieves the screen based on index number.
*
- * @param idx The index that will be used to retrieve the screen.
+ * @param index The index that will be used to retrieve the screen.
* @return The Ecore_X_Screen at this index.
* @ingroup Ecore_X_Display_Attr_Group
*
* @since 1.1
*/
EAPI Ecore_X_Screen *
-ecore_x_screen_get(int idx)
+ecore_x_screen_get(int index)
{
- return XScreenOfDisplay(_ecore_x_disp, idx);
+ return XScreenOfDisplay(_ecore_x_disp, index);
}
/**
@@ -1066,8 +1056,7 @@ _ecore_x_key_mask_get(KeySym sym)
{
for (j = 0; j < 8; j++)
{
- sym2 = _ecore_x_XKeycodeToKeysym(_ecore_x_disp,
- mod->modifiermap[i], j);
+ sym2 = XKeycodeToKeysym(_ecore_x_disp, mod->modifiermap[i], j);
if (sym2 != 0)
break;
}
@@ -1968,66 +1957,6 @@ ecore_x_mouse_up_send(Ecore_X_Window win,
return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE;
}
-EAPI Eina_Bool
-ecore_x_mouse_in_send(Ecore_X_Window win,
- int x,
- int y)
-{
- XEvent xev;
- XWindowAttributes att;
- Window tw;
- int rx, ry;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- XGetWindowAttributes(_ecore_x_disp, win, &att);
- XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw);
- xev.xcrossing.type = EnterNotify;
- xev.xcrossing.window = win;
- xev.xcrossing.root = att.root;
- xev.xcrossing.subwindow = win;
- xev.xcrossing.time = _ecore_x_event_last_time;
- xev.xcrossing.x = x;
- xev.xcrossing.y = y;
- xev.xcrossing.x_root = rx;
- xev.xcrossing.y_root = ry;
- xev.xcrossing.mode = NotifyNormal;
- xev.xcrossing.detail = NotifyNonlinear;
- xev.xcrossing.same_screen = 1;
- xev.xcrossing.focus = 0;
- xev.xcrossing.state = 0;
- return XSendEvent(_ecore_x_disp, win, True, EnterWindowMask, &xev) ? EINA_TRUE : EINA_FALSE;
-}
-
-EAPI Eina_Bool
-ecore_x_mouse_out_send(Ecore_X_Window win,
- int x,
- int y)
-{
- XEvent xev;
- XWindowAttributes att;
- Window tw;
- int rx, ry;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- XGetWindowAttributes(_ecore_x_disp, win, &att);
- XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw);
- xev.xcrossing.type = LeaveNotify;
- xev.xcrossing.window = win;
- xev.xcrossing.root = att.root;
- xev.xcrossing.subwindow = win;
- xev.xcrossing.time = _ecore_x_event_last_time;
- xev.xcrossing.x = x;
- xev.xcrossing.y = y;
- xev.xcrossing.x_root = rx;
- xev.xcrossing.y_root = ry;
- xev.xcrossing.mode = NotifyNormal;
- xev.xcrossing.detail = NotifyNonlinear;
- xev.xcrossing.same_screen = 1;
- xev.xcrossing.focus = 0;
- xev.xcrossing.state = 0;
- return XSendEvent(_ecore_x_disp, win, True, LeaveWindowMask, &xev) ? EINA_TRUE : EINA_FALSE;
-}
-
EAPI void
ecore_x_focus_reset(void)
{
diff --git a/src/lib/ecore_x/xlib/ecore_x_atoms.c b/src/lib/ecore_x/xlib/ecore_x_atoms.c
index 8a508c85..1580a013 100644
--- a/src/lib/ecore_x/xlib/ecore_x_atoms.c
+++ b/src/lib/ecore_x/xlib/ecore_x_atoms.c
@@ -25,8 +25,15 @@ void *alloca(size_t);
#include "ecore_x_private.h"
#include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
+
#include "ecore_x_atoms_decl.h"
+typedef struct
+{
+ const char *name;
+ Ecore_X_Atom *atom;
+} Atom_Item;
+
void
_ecore_x_atoms_init(void)
{
@@ -310,14 +317,14 @@ _ecore_x_atoms_init(void)
char **names;
int i, num;
- num = sizeof(atom_items) / sizeof(Atom_Item);
+ num = sizeof(items) / sizeof(Atom_Item);
atoms = alloca(num * sizeof(Atom));
names = alloca(num * sizeof(char *));
for (i = 0; i < num; i++)
- names[i] = (char *) atom_items[i].name;
+ names[i] = (char *)items[i].name;
XInternAtoms(_ecore_x_disp, names, num, False, atoms);
for (i = 0; i < num; i++)
- *(atom_items[i].atom) = atoms[i];
+ *(items[i].atom) = atoms[i];
}
/**
diff --git a/src/lib/ecore_x/xlib/ecore_x_e.c b/src/lib/ecore_x/xlib/ecore_x_e.c
index 89a9b66d..17449a02 100644
--- a/src/lib/ecore_x/xlib/ecore_x_e.c
+++ b/src/lib/ecore_x/xlib/ecore_x_e.c
@@ -376,72 +376,6 @@ ecore_x_e_illume_home_del_send(Ecore_X_Window win)
}
EAPI void
-ecore_x_e_illume_access_action_next_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_prev_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_activate_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_read_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_read_next_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT,
- 0, 0, 0);
-}
-
-EAPI void
-ecore_x_e_illume_access_action_read_prev_send(Ecore_X_Window win)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- win,
- ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV,
- 0, 0, 0);
-}
-
-EAPI void
ecore_x_e_illume_drag_set(Ecore_X_Window win,
unsigned int drag)
{
diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c
index acb64a94..0b06a79c 100644
--- a/src/lib/ecore_x/xlib/ecore_x_events.c
+++ b/src/lib/ecore_x/xlib/ecore_x_events.c
@@ -278,8 +278,8 @@ _ecore_key_press(int event,
int val;
_ecore_x_last_event_mouse_move = 0;
- keyname = XKeysymToString(_ecore_x_XKeycodeToKeysym(xevent->display,
- xevent->keycode, 0));
+ keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
+ xevent->keycode, 0));
if (!keyname)
{
snprintf(keyname_buffer,
diff --git a/src/lib/ecore_x/xlib/ecore_x_private.h b/src/lib/ecore_x/xlib/ecore_x_private.h
index 8132e135..02a01f7e 100644
--- a/src/lib/ecore_x/xlib/ecore_x_private.h
+++ b/src/lib/ecore_x/xlib/ecore_x_private.h
@@ -372,7 +372,6 @@ Ecore_Event_Mouse_Button *_ecore_mouse_button(int event,
double mry);
void _ecore_x_modifiers_get(void);
-KeySym _ecore_x_XKeycodeToKeysym(Display *display, KeyCode keycode, int index);
//#define LOGFNS 1
diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_11.c b/src/lib/ecore_x/xlib/ecore_x_randr_11.c
index 7d2b3b34..f239c026 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr_11.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr_11.c
@@ -145,6 +145,15 @@ ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
#endif /* ifdef ECORE_XRANDR */
}
+/*
+ * @brief get the current set size of a given screen's primary output
+ * @param root window which's primary output will be queried
+ * @param w the current size's width
+ * @param h the current size's height
+ * @param w_mm the current size's width in mm
+ * @param h_mm the current size's height in mm
+ * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set()
+ */
EAPI void
ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root,
int *w,
diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/src/lib/ecore_x/xlib/ecore_x_randr_12.c
index a1fecf81..8ec75cdf 100644
--- a/src/lib/ecore_x/xlib/ecore_x_randr_12.c
+++ b/src/lib/ecore_x/xlib/ecore_x_randr_12.c
@@ -596,12 +596,6 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
w_geo.x = rx;
w_geo.y = ry;
- ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc));
- if (!ret)
- {
- free(crtcs);
- goto _ecore_x_randr_window_crtcs_get_fail;
- }
for (i = 0, nret = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
@@ -613,8 +607,8 @@ ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
&c_geo.w, &c_geo.h);
if (eina_rectangles_intersect(&w_geo, &c_geo))
{
+ ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret));
ret[nret] = crtcs[i];
- nret++;
}
}
free(crtcs);
@@ -1498,8 +1492,6 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
*/
case ECORE_X_RANDR_OUTPUT_POLICY_NONE:
break;
- default:
- return EINA_FALSE;
}
if ((x_n == r1_geo.x) && (y_n == r1_geo.x))
return EINA_TRUE;
@@ -2345,7 +2337,7 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
#ifdef ECORE_XRANDR
Ecore_X_Window root;
Ecore_X_Randr_Crtc *crtcs;
- Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
+ Ecore_X_Randr_Output *outputs, *ret = NULL;
int ncrtcs, noutputs, i, nret = 0;
if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
@@ -2353,21 +2345,18 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
root = ecore_x_window_root_get(window);
if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
goto _ecore_x_randr_current_output_get_fail;
-
+
for (i = 0, nret = 0; i < ncrtcs; i++)
{
outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
- &noutputs);
+ &noutputs);
if (!outputs)
goto _ecore_x_randr_current_output_get_fail_free;
- tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
- if (!tret) goto _ecore_x_randr_current_output_get_fail_free;
- ret = tret;
- memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
nret += noutputs;
+ ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
+ memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
free(outputs);
- outputs = NULL;
}
free(crtcs);
diff --git a/src/lib/ecore_x/xlib/ecore_x_test.c b/src/lib/ecore_x/xlib/ecore_x_test.c
index a4d40f6e..23eea105 100644
--- a/src/lib/ecore_x/xlib/ecore_x_test.c
+++ b/src/lib/ecore_x/xlib/ecore_x_test.c
@@ -98,9 +98,9 @@ ecore_x_test_fake_key_press(const char *key __UNUSED__)
return EINA_FALSE;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
- if (_ecore_x_XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym)
+ if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym)
{
- if (_ecore_x_XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym)
+ if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym)
shift = 1;
else
keycode = 0;
diff --git a/src/modules/immodules/Makefile.am b/src/modules/immodules/Makefile.am
index 22b64967..2f121ae3 100644
--- a/src/modules/immodules/Makefile.am
+++ b/src/modules/immodules/Makefile.am
@@ -9,7 +9,3 @@ endif
if BUILD_ECORE_IMF_SCIM
SUBDIRS += scim
endif
-
-if BUILD_ECORE_IMF_IBUS
-SUBDIRS += ibus
-endif
diff --git a/src/modules/immodules/ibus/Makefile.am b/src/modules/immodules/ibus/Makefile.am
deleted file mode 100644
index a59b5e85..00000000
--- a/src/modules/immodules/ibus/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CFLAGS = \
--I$(top_srcdir) \
--I$(top_srcdir)/src/lib/ecore \
--I$(top_srcdir)/src/lib/ecore_input \
--I$(top_srcdir)/src/lib/ecore_x \
--I$(top_srcdir)/src/lib/ecore_imf \
--I$(top_srcdir)/src/lib/ecore_evas \
--I$(top_builddir)/src/lib/ecore \
--I$(top_builddir)/src/lib/ecore_input \
--I$(top_builddir)/src/lib/ecore_x \
--I$(top_builddir)/src/lib/ecore_imf \
--I$(top_builddir)/src/lib/ecore_evas \
--DPACKAGE_LIB_DIR=\"$(libdir)\" \
--DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
-@IBUS_CFLAGS@ \
-@EVAS_CFLAGS@ \
-@EINA_CFLAGS@
-
-pkgdir = $(libdir)/ecore/immodules
-
-pkg_LTLIBRARIES = ibus.la
-ibus_la_SOURCES = \
-ibus_module.c \
-ibus_imcontext.c \
-ibus_imcontext.h
-
-ibus_la_LIBADD = \
- $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
- $(top_builddir)/src/lib/ecore_x/libecore_x.la \
- @IBUS_LIBS@ \
- @EVAS_LIBS@ \
- @EINA_LIBS@
-ibus_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
-ibus_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/src/modules/immodules/ibus/ibus_imcontext.c b/src/modules/immodules/ibus/ibus_imcontext.c
deleted file mode 100644
index 9bc2199a..00000000
--- a/src/modules/immodules/ibus/ibus_imcontext.c
+++ /dev/null
@@ -1,727 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/un.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include <X11/Xlib.h>
-#include <Ecore_X.h>
-#include <Ecore_Evas.h>
-
-#include <ibus.h>
-#include "ibus_imcontext.h"
-
-struct _IBusIMContext {
- /* instance members */
- Ecore_IMF_Context *ctx;
-
- /* enabled */
- Eina_Bool enable;
- IBusInputContext *ibuscontext;
-
- /* preedit status */
- char *preedit_string;
- Eina_List *preedit_attrs;
- int preedit_cursor_pos;
- Eina_Bool preedit_visible;
-
- int cursor_x;
- int cursor_y;
- int cursor_w;
- int cursor_h;
-
- Eina_Bool has_focus;
-
- Ecore_X_Window client_window;
- Evas *client_canvas;
-
- int caps;
-};
-
-static Ecore_IMF_Context *_focus_im_context = NULL;
-static IBusBus *_bus = NULL;
-
-/* functions prototype */
-/* static methods*/
-static void _create_input_context (IBusIMContext *context);
-static void _set_cursor_location_internal
-(Ecore_IMF_Context *ctx);
-static void _bus_connected_cb (IBusBus *bus,
- IBusIMContext *context);
-
-
-static void
-_window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y)
-{
- Ecore_X_Window root_window, win;
- int win_x, win_y;
- int sum_x = 0, sum_y = 0;
-
- root_window = ecore_x_window_root_get(client_win);
- win = client_win;
-
- while (root_window != win)
- {
- ecore_x_window_geometry_get(win, &win_x, &win_y, NULL, NULL);
- sum_x += win_x;
- sum_y += win_y;
- win = ecore_x_window_parent_get(win);
- }
-
- if (x)
- *x = sum_x;
- if (y)
- *y = sum_y;
-}
-
-static unsigned int
-_ecore_imf_modifier_to_ibus_modifier(unsigned int modifier)
-{
- unsigned int state = 0;
-
- /**< "Control" is pressed */
- if (modifier & ECORE_IMF_KEYBOARD_MODIFIER_CTRL)
- state |= IBUS_CONTROL_MASK;
-
- /**< "Alt" is pressed */
- if (modifier & ECORE_IMF_KEYBOARD_MODIFIER_ALT)
- state |= IBUS_MOD1_MASK;
-
- /**< "Shift" is pressed */
- if (modifier & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT)
- state |= IBUS_SHIFT_MASK;
-
- /**< "Win" (between "Ctrl" and "A */
- if (modifier & ECORE_IMF_KEYBOARD_MODIFIER_WIN)
- state |= IBUS_SUPER_MASK;
-
- return state;
-}
-
-IBusIMContext *
-ibus_im_context_new(void)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
-
- IBusIMContext *context = calloc(1, sizeof(IBusIMContext));
-
- /* init bus object */
- if (_bus == NULL)
- {
- char *display_name = NULL;
-
- if ((display_name = getenv ("DISPLAY")))
- ibus_set_display (display_name);
- else
- ibus_set_display (":0.0");
-
- _bus = ibus_bus_new();
- }
-
- return context;
-}
-
-EAPI void
-ibus_im_context_add(Ecore_IMF_Context *ctx)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
-
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- ibusimcontext->client_window = 0;
-
- // Init ibus status
- ibusimcontext->enable = EINA_FALSE;
-
- // Init preedit status
- ibusimcontext->preedit_string = NULL;
- ibusimcontext->preedit_attrs = NULL;
- ibusimcontext->preedit_cursor_pos = 0;
- ibusimcontext->preedit_visible = EINA_FALSE;
-
- // Init cursor area
- ibusimcontext->cursor_x = -1;
- ibusimcontext->cursor_y = -1;
- ibusimcontext->cursor_w = 0;
- ibusimcontext->cursor_h = 0;
-
- ibusimcontext->ibuscontext = NULL;
- ibusimcontext->has_focus = EINA_FALSE;
- ibusimcontext->caps = IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_FOCUS | IBUS_CAP_SURROUNDING_TEXT;
- ibusimcontext->ctx = ctx;
-
- if (ibus_bus_is_connected(_bus))
- _create_input_context (ibusimcontext);
-
- g_signal_connect(_bus, "connected", G_CALLBACK (_bus_connected_cb), ctx);
-}
-
-EAPI void
-ibus_im_context_del(Ecore_IMF_Context *ctx)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
-
- IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- g_signal_handlers_disconnect_by_func(_bus, G_CALLBACK(_bus_connected_cb), ctx);
-
- if (ibusimcontext->ibuscontext)
- ibus_proxy_destroy((IBusProxy *)ibusimcontext->ibuscontext);
-
- // release preedit
- if (ibusimcontext->preedit_string)
- free(ibusimcontext->preedit_string);
-}
-
-EAPI Eina_Bool
-ibus_im_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
-{
- IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ibusimcontext, EINA_FALSE);
-
- if (type != ECORE_IMF_EVENT_KEY_UP && type != ECORE_IMF_EVENT_KEY_DOWN)
- return EINA_FALSE;
-
- EINA_LOG_DBG("%s", __FUNCTION__);
-
- if (G_LIKELY(ibusimcontext->ibuscontext && ibusimcontext->has_focus))
- {
- /* If context does not have focus, ibus will process key event in sync mode.
- * It is a workaround for increase search in treeview.
- */
- Eina_Bool retval = EINA_FALSE;
- int keycode;
- int keysym;
- unsigned int state = 0;
-
- if (type == ECORE_IMF_EVENT_KEY_UP)
- {
- Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event;
- if (ev->timestamp == 0)
- return EINA_FALSE;
-
- keycode = ecore_x_keysym_keycode_get(ev->key);
- keysym = XStringToKeysym(ev->key);
- state = _ecore_imf_modifier_to_ibus_modifier(ev->modifiers) | IBUS_RELEASE_MASK;
- retval = ibus_input_context_process_key_event (ibusimcontext->ibuscontext,
- keysym,
- keycode - 8,
- state);
- }
- else if (type == ECORE_IMF_EVENT_KEY_DOWN)
- {
- Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
- if (ev->timestamp == 0)
- return EINA_FALSE;
-
- keycode = ecore_x_keysym_keycode_get(ev->key);
- keysym = XStringToKeysym(ev->key);
- state = _ecore_imf_modifier_to_ibus_modifier(ev->modifiers);
- retval = ibus_input_context_process_key_event (ibusimcontext->ibuscontext,
- keysym,
- keycode - 8,
- state);
- }
- else
- retval = EINA_FALSE;
-
- if (retval)
- return EINA_TRUE;
- else
- return EINA_FALSE;
- }
- else
- return EINA_FALSE;
-}
-
-EAPI void
-ibus_im_context_focus_in(Ecore_IMF_Context *ctx)
-{
- EINA_LOG_DBG("ctx : %p", ctx);
-
- IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->has_focus)
- return;
-
- if (_focus_im_context != NULL)
- ecore_imf_context_focus_out(_focus_im_context);
-
- ibusimcontext->has_focus = EINA_TRUE;
- if (ibusimcontext->ibuscontext)
- ibus_input_context_focus_in(ibusimcontext->ibuscontext);
-
- if (_focus_im_context != ctx)
- _focus_im_context = ctx;
-}
-
-EAPI void
-ibus_im_context_focus_out(Ecore_IMF_Context *ctx)
-{
- EINA_LOG_DBG("ctx : %p", ctx);
-
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->has_focus == EINA_FALSE)
- return;
-
- if (_focus_im_context == ctx)
- _focus_im_context = NULL;
-
- ibusimcontext->has_focus = EINA_FALSE;
- if (ibusimcontext->ibuscontext)
- ibus_input_context_focus_out(ibusimcontext->ibuscontext);
-}
-
-EAPI void
-ibus_im_context_reset(Ecore_IMF_Context *ctx)
-{
- IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->ibuscontext)
- ibus_input_context_reset(ibusimcontext->ibuscontext);
-}
-
-EAPI void
-ibus_im_context_preedit_string_get(Ecore_IMF_Context *ctx,
- char **str,
- int *cursor_pos)
-{
- IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->enable && ibusimcontext->preedit_visible)
- {
- if (str)
- *str = strdup (ibusimcontext->preedit_string ? ibusimcontext->preedit_string: "");
-
- if (cursor_pos)
- *cursor_pos = ibusimcontext->preedit_cursor_pos;
- }
- else
- {
- if (str)
- *str = strdup("");
-
- if (cursor_pos)
- *cursor_pos = 0;
- }
- EINA_LOG_DBG("str : %s, cursor_pos : %d", *str, *cursor_pos);
-}
-
-EAPI void
-ibus_im_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx,
- char **str,
- Eina_List **attr __UNUSED__,
- int *cursor_pos)
-{
- IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->enable && ibusimcontext->preedit_visible)
- {
- if (str)
- *str = strdup(ibusimcontext->preedit_string ? ibusimcontext->preedit_string: "");
-
- if (cursor_pos)
- *cursor_pos = ibusimcontext->preedit_cursor_pos;
- }
- else
- {
- if (str)
- *str = strdup("");
-
- if (cursor_pos)
- *cursor_pos = 0;
- }
- EINA_LOG_DBG("str : %s, cursor_pos : %d", *str, *cursor_pos);
-}
-
-EAPI void
-ibus_im_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
-{
- EINA_LOG_DBG("canvas : %p", window);
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (window != NULL)
- ibusimcontext->client_window = (Ecore_X_Window)(Ecore_Window)window;
-}
-
-EAPI void
-ibus_im_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
-{
- EINA_LOG_DBG("canvas : %p", canvas);
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (canvas != NULL)
- ibusimcontext->client_canvas = canvas;
-}
-
-static void
-_set_cursor_location_internal(Ecore_IMF_Context *ctx)
-{
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- Ecore_Evas *ee;
- int canvas_x, canvas_y;
-
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->ibuscontext == NULL)
- return;
-
- if (ibusimcontext->client_canvas)
- {
- ee = ecore_evas_ecore_evas_get(ibusimcontext->client_canvas);
- if (!ee) return;
-
- ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL);
- }
- else
- {
- if (ibusimcontext->client_window)
- _window_to_screen_geometry_get(ibusimcontext->client_window, &canvas_x, &canvas_y);
- else
- return;
- }
-
- ibus_input_context_set_cursor_location(ibusimcontext->ibuscontext,
- ibusimcontext->cursor_x + canvas_x,
- ibusimcontext->cursor_y + canvas_y,
- ibusimcontext->cursor_w,
- ibusimcontext->cursor_h);
-}
-
-EAPI void
-ibus_im_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
-{
- EINA_LOG_DBG("x : %d, y : %d, w, %d, h :%d", x, y, w, h);
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->cursor_x != x ||
- ibusimcontext->cursor_y != y ||
- ibusimcontext->cursor_w != w ||
- ibusimcontext->cursor_h != h)
- {
- ibusimcontext->cursor_x = x;
- ibusimcontext->cursor_y = y;
- ibusimcontext->cursor_w = w;
- ibusimcontext->cursor_h = h;
-
- _set_cursor_location_internal(ctx);
- }
-}
-
-EAPI void
-ibus_im_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit)
-{
- EINA_LOG_DBG("preedit : %d", use_preedit);
- IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->ibuscontext)
- {
- if (use_preedit)
- ibusimcontext->caps |= IBUS_CAP_PREEDIT_TEXT;
- else
- ibusimcontext->caps &= ~IBUS_CAP_PREEDIT_TEXT;
-
- ibus_input_context_set_capabilities(ibusimcontext->ibuscontext, ibusimcontext->caps);
- }
-}
-
-static void
-_bus_connected_cb(IBusBus *bus __UNUSED__,
- IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("ibus is connected");
-
- if (ibusimcontext)
- _create_input_context(ibusimcontext);
-}
-
-static void
-_ibus_context_commit_text_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusText *text,
- IBusIMContext *ibusimcontext)
-{
- if (!ibusimcontext || !text) return;
- char *commit_str = text->text ? text->text : "";
-
- EINA_LOG_DBG("commit string : %s", commit_str);
-
- if (ibusimcontext->ctx)
- {
- ecore_imf_context_commit_event_add(ibusimcontext->ctx, text->text);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)commit_str);
- }
-}
-
-static XKeyEvent createXKeyEvent(Window win, Eina_Bool press, int keysym, int modifiers)
-{
- XKeyEvent event;
- Display *display = ecore_x_display_get();
-
- event.display = display;
- event.window = win;
- event.root = ecore_x_window_root_get(win);
- event.subwindow = None;
- event.time = 0;
- event.x = 1;
- event.y = 1;
- event.x_root = 1;
- event.y_root = 1;
- event.same_screen = EINA_TRUE;
- event.state = modifiers;
- event.keycode = XKeysymToKeycode(display, keysym);
- if (press)
- event.type = KeyPress;
- else
- event.type = KeyRelease;
- event.send_event = EINA_FALSE;
- event.serial = 0;
-
- return event;
-}
-
-static void
-_ibus_context_forward_key_event_cb(IBusInputContext *ibuscontext __UNUSED__,
- guint keyval,
- guint state,
- IBusIMContext *ibusimcontext __UNUSED__)
-{
- EINA_LOG_DBG("keyval : %d, state : %d", keyval, state);
-
- // Find the window which has the current keyboard focus.
- Window winFocus = 0;
- int revert = RevertToParent;
-
- XGetInputFocus(ecore_x_display_get(), &winFocus, &revert);
-
- XKeyEvent event;
- if (state & IBUS_RELEASE_MASK)
- {
- event = createXKeyEvent(winFocus, EINA_FALSE, keyval, state);
- XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
- }
- else
- {
- event = createXKeyEvent(winFocus, EINA_TRUE, keyval, state);
- XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
- }
-}
-
-static void
-_ibus_context_update_preedit_text_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusText *text,
- gint cursor_pos,
- gboolean visible,
- IBusIMContext *ibusimcontext)
-{
- if (!ibusimcontext || !text) return;
-
- const char *str;
- gboolean flag;
-
- if (ibusimcontext->preedit_string)
- free (ibusimcontext->preedit_string);
-
- str = text->text;
-
- if (str)
- ibusimcontext->preedit_string = strdup(str);
- else
- ibusimcontext->preedit_string = strdup("");
-
- ibusimcontext->preedit_cursor_pos = cursor_pos;
-
- EINA_LOG_DBG("string : %s, cursor : %d",ibusimcontext->preedit_string, ibusimcontext->preedit_cursor_pos);
-
- flag = ibusimcontext->preedit_visible != visible;
- ibusimcontext->preedit_visible = visible;
-
- if (ibusimcontext->preedit_visible)
- {
- if (flag)
- {
- ecore_imf_context_preedit_start_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
- }
-
- ecore_imf_context_preedit_changed_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
- }
- else
- {
- if (flag)
- {
- ecore_imf_context_preedit_changed_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
- }
-
- ecore_imf_context_preedit_end_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
- }
-}
-
-static void
-_ibus_context_show_preedit_text_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("preedit visible : %d", ibusimcontext->preedit_visible);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->preedit_visible == EINA_TRUE)
- return;
-
- ibusimcontext->preedit_visible = EINA_TRUE;
-
- // call preedit start
- ecore_imf_context_preedit_start_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
-
- // call preedit changed
- ecore_imf_context_preedit_changed_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
-}
-
-static void
-_ibus_context_hide_preedit_text_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- if (ibusimcontext->preedit_visible == EINA_FALSE)
- return;
-
- ibusimcontext->preedit_visible = EINA_FALSE;
-
- // call preedit changed
- ecore_imf_context_preedit_changed_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
-
- // call preedit end
- ecore_imf_context_preedit_end_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
-}
-
-static void
-_ibus_context_enabled_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- ibusimcontext->enable = EINA_TRUE;
-}
-
-static void
-_ibus_context_disabled_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- ibusimcontext->enable = EINA_FALSE;
-
- /* clear preedit */
- ibusimcontext->preedit_visible = EINA_FALSE;
- ibusimcontext->preedit_cursor_pos = 0;
- free (ibusimcontext->preedit_string);
- ibusimcontext->preedit_string = NULL;
-
- // call preedit changed
- ecore_imf_context_preedit_changed_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
-
- // call preedit end
- ecore_imf_context_preedit_end_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
-}
-
-static void
-_ibus_context_destroy_cb(IBusInputContext *ibuscontext __UNUSED__,
- IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- ibusimcontext->ibuscontext = NULL;
- ibusimcontext->enable = EINA_FALSE;
-
- /* clear preedit */
- ibusimcontext->preedit_visible = EINA_FALSE;
- ibusimcontext->preedit_cursor_pos = 0;
- free (ibusimcontext->preedit_string);
- ibusimcontext->preedit_string = NULL;
-
- // call preedit changed
- ecore_imf_context_preedit_changed_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
-
- // call preedit end
- ecore_imf_context_preedit_end_event_add(ibusimcontext->ctx);
- ecore_imf_context_event_callback_call(ibusimcontext->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
-}
-
-static void
-_create_input_context(IBusIMContext *ibusimcontext)
-{
- EINA_LOG_DBG("%s", __FUNCTION__);
- EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
-
- ibusimcontext->ibuscontext = ibus_bus_create_input_context(_bus, "ecore");
-
- g_return_if_fail(ibusimcontext->ibuscontext != NULL);
-
- g_signal_connect(ibusimcontext->ibuscontext,
- "commit-text",
- G_CALLBACK (_ibus_context_commit_text_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext,
- "forward-key-event",
- G_CALLBACK (_ibus_context_forward_key_event_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext,
- "update-preedit-text",
- G_CALLBACK (_ibus_context_update_preedit_text_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext,
- "show-preedit-text",
- G_CALLBACK (_ibus_context_show_preedit_text_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext,
- "hide-preedit-text",
- G_CALLBACK (_ibus_context_hide_preedit_text_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext,
- "enabled",
- G_CALLBACK (_ibus_context_enabled_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext,
- "disabled",
- G_CALLBACK (_ibus_context_disabled_cb),
- ibusimcontext);
- g_signal_connect(ibusimcontext->ibuscontext, "destroy",
- G_CALLBACK (_ibus_context_destroy_cb),
- ibusimcontext);
-
- ibus_input_context_set_capabilities(ibusimcontext->ibuscontext, ibusimcontext->caps);
-
- if (ibusimcontext->has_focus)
- ibus_input_context_focus_in(ibusimcontext->ibuscontext);
-}
diff --git a/src/modules/immodules/ibus/ibus_imcontext.h b/src/modules/immodules/ibus/ibus_imcontext.h
deleted file mode 100644
index ce5c075c..00000000
--- a/src/modules/immodules/ibus/ibus_imcontext.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __IBUS_IM_CONTEXT_H_
-#define __IBUS_IM_CONTEXT_H_
-
-#include <Ecore_IMF.h>
-
-typedef struct _IBusIMContext IBusIMContext;
-
-EAPI void ibus_im_context_add (Ecore_IMF_Context *ctx);
-EAPI void ibus_im_context_del (Ecore_IMF_Context *ctx);
-EAPI void ibus_im_context_reset (Ecore_IMF_Context *context);
-EAPI void ibus_im_context_focus_in(Ecore_IMF_Context *context);
-EAPI void ibus_im_context_focus_out(Ecore_IMF_Context *context);
-EAPI void ibus_im_context_preedit_string_get
- (Ecore_IMF_Context *context,
- char **str,
- int *cursor_pos);
-EAPI void ibus_im_context_preedit_string_with_attributes_get
- (Ecore_IMF_Context *context,
- char **str,
- Eina_List **attr,
- int *cursor_pos);
-
-EAPI void ibus_im_context_cursor_location_set(Ecore_IMF_Context *context,
- int x, int y, int w, int h);
-EAPI void ibus_im_context_use_preedit_set(Ecore_IMF_Context *context,
- Eina_Bool use_preedit);
-EAPI void
-ibus_im_context_client_window_set(Ecore_IMF_Context *context, void *window);
-EAPI void
-ibus_im_context_client_canvas_set(Ecore_IMF_Context *context, void *canvas);
-EAPI Eina_Bool
-ibus_im_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
-
-IBusIMContext
- *ibus_im_context_new (void);
-#endif
diff --git a/src/modules/immodules/ibus/ibus_module.c b/src/modules/immodules/ibus/ibus_module.c
deleted file mode 100644
index a0bc3aa7..00000000
--- a/src/modules/immodules/ibus/ibus_module.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <ibus.h>
-#include "ibus_imcontext.h"
-#include <Ecore_IMF.h>
-#include <Ecore.h>
-#include <stdio.h>
-
-#define IBUS_LOCALDIR ""
-static const Ecore_IMF_Context_Info ibus_im_info = {
- "ibus",
- "IBus (Intelligent Input Bus)",
- "*",
- NULL,
- 0
-};
-
-static Ecore_IMF_Context_Class ibus_imf_class = {
- ibus_im_context_add, /* add */
- ibus_im_context_del, /* del */
- ibus_im_context_client_window_set, /* client_window_set */
- ibus_im_context_client_canvas_set, /* client_canvas_set */
- NULL, /* input_panel_show */
- NULL, /* input_panel_hide */
- ibus_im_context_preedit_string_get, /* get_preedit_string */
- ibus_im_context_focus_in, /* focus_in */
- ibus_im_context_focus_out, /* focus_out */
- ibus_im_context_reset, /* reset */
- NULL, /* cursor_position_set */
- ibus_im_context_use_preedit_set, /* use_preedit_set */
- NULL, /* input_mode_set */
- ibus_im_context_filter_event, /* filter_event */
- ibus_im_context_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */
- NULL, /* prediction_allow_set */
- NULL, /* autocapital_type_set */
- NULL, /* control panel show */
- NULL, /* control panel hide */
- NULL, /* input_panel_layout_set */
- NULL, /* ibus_im_context_input_panel_layout_get, */
- NULL, /* ibus_im_context_input_panel_language_set, */
- NULL, /* ibus_im_context_input_panel_language_get, */
- ibus_im_context_cursor_location_set, /* cursor_location_set */
- NULL, /* input_panel_imdata_set */
- NULL, /* input_panel_imdata_get */
- NULL, /* input_panel_return_key_type_set */
- NULL, /* input_panel_return_key_disabled_set */
- NULL /* input_panel_caps_lock_mode_set */
-};
-
-static Ecore_IMF_Context *im_module_create (void);
-static Ecore_IMF_Context *im_module_exit (void);
-
-static Eina_Bool
-im_module_init(void)
-{
- ecore_main_loop_glib_integrate();
- ibus_init();
- ecore_imf_module_register(&ibus_im_info, im_module_create, im_module_exit);
-
- return EINA_TRUE;
-}
-
-static void im_module_shutdown(void)
-{
-}
-
-static Ecore_IMF_Context *
-im_module_exit(void)
-{
- return NULL;
-}
-
-static Ecore_IMF_Context *
-im_module_create()
-{
- Ecore_IMF_Context *ctx = NULL;
- IBusIMContext *ctxd = NULL;
-
- ctxd = ibus_im_context_new();
- if (!ctxd)
- {
- return NULL;
- }
-
- ctx = ecore_imf_context_new(&ibus_imf_class);
- if (!ctx)
- {
- free(ctxd);
- return NULL;
- }
-
- ecore_imf_context_data_set(ctx, ctxd);
-
- return ctx;
-}
-
-EINA_MODULE_INIT(im_module_init);
-EINA_MODULE_SHUTDOWN(im_module_shutdown);
-
diff --git a/src/modules/immodules/scim/scim_imcontext.cpp b/src/modules/immodules/scim/scim_imcontext.cpp
index d085ec04..5b01cbd4 100644
--- a/src/modules/immodules/scim/scim_imcontext.cpp
+++ b/src/modules/immodules/scim/scim_imcontext.cpp
@@ -403,7 +403,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
plain_str = evas_textblock_text_markup_to_utf8(NULL, markup_str);
if (!plain_str) goto done;
- // Convert string from UTF-8 to unicode
+ // Convert string from utf8 to unicode
ustr = eina_unicode_utf8_to_unicode(plain_str, NULL);
if (!ustr) goto done;
@@ -418,7 +418,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
}
}
- // Check paragraph separator <PS> and carriage return <br>
+ // Check paragraph separator <PS> and carrage return <br>
if ((ustr[cursor_pos-1] == 0x2029) || (ustr[cursor_pos-1] == '\n'))
{
ret = EINA_TRUE;
@@ -570,7 +570,7 @@ isf_imf_context_new(void)
}
/**
- * isf_imf_context_shutdown
+ * isf_imf_shutdown
*
* It will be called when the scim im module is unloaded by ecore. It will do some
* cleanup job.
diff --git a/src/modules/immodules/xim/ecore_imf_xim.c b/src/modules/immodules/xim/ecore_imf_xim.c
index 8789b678..01a3576a 100644
--- a/src/modules/immodules/xim/ecore_imf_xim.c
+++ b/src/modules/immodules/xim/ecore_imf_xim.c
@@ -67,11 +67,11 @@ Ecore_IMF_Context_Data *imf_context_data_new();
void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data);
#ifdef ENABLE_XIM
-static void add_feedback_attr(Eina_List **attrs,
- const char *str,
- XIMFeedback feedback,
- int start_pos,
- int end_pos);
+static void add_feedback_attr(Eina_List **attrs,
+ const char *str,
+ XIMFeedback feedback,
+ int start_pos,
+ int end_pos);
static void reinitialize_ic(Ecore_IMF_Context *ctx);
static void reinitialize_all_ics(XIM_Im_Info *info);
@@ -113,14 +113,14 @@ static void xim_destroy_callback(XIM xim,
static unsigned int
utf8_offset_to_index(const char *str, int offset)
{
- int idx = 0;
+ int index = 0;
int i;
for (i = 0; i < offset; i++)
{
- eina_unicode_utf8_get_next(str, &idx);
+ eina_unicode_utf8_get_next(str, &index);
}
- return idx;
+ return index;
}
#endif
@@ -133,7 +133,7 @@ _ecore_imf_context_xim_add(Ecore_IMF_Context *ctx)
Ecore_IMF_Context_Data *imf_context_data = NULL;
imf_context_data = imf_context_data_new();
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
+ if (!imf_context_data) return;
imf_context_data->use_preedit = EINA_TRUE;
imf_context_data->finalizing = EINA_FALSE;
@@ -153,7 +153,6 @@ _ecore_imf_context_xim_del(Ecore_IMF_Context *ctx)
#ifdef ENABLE_XIM
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
imf_context_data->finalizing = EINA_TRUE;
if (imf_context_data->im_info && !imf_context_data->im_info->ics->next)
@@ -210,8 +209,6 @@ _ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx,
char *utf8;
int len;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
if (imf_context_data->preedit_chars)
{
utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars,
@@ -295,8 +292,6 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx)
XIC ic;
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
ic = imf_context_data->ic;
imf_context_data->has_focus = EINA_TRUE;
@@ -329,8 +324,6 @@ _ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx)
XIC ic;
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
if (imf_context_data->has_focus == EINA_TRUE)
{
imf_context_data->has_focus = EINA_FALSE;
@@ -361,8 +354,6 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx)
Eina_Bool have_preedit_state = EINA_FALSE;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
ic = imf_context_data->ic;
if (!ic)
return;
@@ -433,7 +424,6 @@ _ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx,
#ifdef ENABLE_XIM
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
use_preedit = use_preedit != EINA_FALSE;
@@ -494,7 +484,6 @@ _ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx,
XPoint spot;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
ic = imf_context_data->ic;
if (!ic)
return;
@@ -527,7 +516,6 @@ _ecore_imf_context_xim_input_panel_show(Ecore_IMF_Context *ctx)
#ifdef ENABLE_XIM
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
ecore_x_e_virtual_keyboard_state_set
(imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
@@ -544,7 +532,6 @@ _ecore_imf_context_xim_input_panel_hide(Ecore_IMF_Context *ctx)
#ifdef ENABLE_XIM
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
ecore_x_e_virtual_keyboard_state_set
(imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
@@ -606,9 +593,12 @@ _keycode_get(Ecore_X_Display *dsp,
// EINA_LOG_DBG("keyname:%s keysym:%lu", keyname, XStringToKeysym(keyname));
if (strcmp(keyname, "Keycode-0") == 0)
- keycode = 0;
- else
- keycode = XKeysymToKeycode(dsp, XStringToKeysym(keyname));
+ {
+ keycode = 0;
+ }
+ else {
+ keycode = XKeysymToKeycode(dsp, XStringToKeysym(keyname));
+ }
return keycode;
}
@@ -636,10 +626,11 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
Eina_Bool result = EINA_FALSE;
imf_context_data = ecore_imf_context_data_get(ctx);
- if (!imf_context_data) return EINA_FALSE;
ic = imf_context_data->ic;
if (!ic)
- ic = get_ic(ctx);
+ {
+ ic = get_ic(ctx);
+ }
if (type == ECORE_IMF_EVENT_KEY_DOWN)
{
@@ -688,7 +679,9 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
{
tmp = malloc(sizeof (char) * (val + 1));
if (!tmp)
- return EINA_FALSE;
+ {
+ return EINA_FALSE;
+ }
compose = tmp;
@@ -731,8 +724,7 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
#endif /* ifdef X_HAVE_UTF8_STRING */
}
}
- else
- {
+ else {
XComposeStatus status;
val = XLookupString(&xev,
compose_buffer,
@@ -853,8 +845,7 @@ void
ecore_imf_xim_shutdown(void)
{
#ifdef ENABLE_XIM
- while (open_ims)
- {
+ while (open_ims) {
XIM_Im_Info *info = open_ims->data;
Ecore_X_Display *display = ecore_x_display_get();
@@ -885,7 +876,7 @@ imf_context_data_new()
if (!XSupportsLocale()) return NULL;
imf_context_data = calloc(1, sizeof(Ecore_IMF_Context_Data));
- EINA_SAFETY_ON_NULL_RETURN_VAL(imf_context_data, NULL);
+ if (!imf_context_data) return NULL;
imf_context_data->locale = strdup(locale);
if (!imf_context_data->locale) goto error;
@@ -926,7 +917,6 @@ preedit_start_callback(XIC xic __UNUSED__,
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- if (!imf_context_data) return -1;
if (imf_context_data->finalizing == EINA_FALSE)
{
@@ -945,7 +935,6 @@ preedit_done_callback(XIC xic __UNUSED__,
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
if (imf_context_data->preedit_length)
{
@@ -991,8 +980,7 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
EINA_LOG_WARN("Size mismatch when converting text from input method: supplied length = %d\n, result length = %d", xim_text->length, text_length);
}
}
- else
- {
+ else {
EINA_LOG_WARN("Error converting text from IM to UCS-4");
*text = NULL;
return 0;
@@ -1001,8 +989,7 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
*text = result;
return text_length;
}
- else
- {
+ else {
*text = NULL;
return 0;
}
@@ -1024,8 +1011,6 @@ preedit_draw_callback(XIC xic __UNUSED__,
int new_text_length;
int i = 0;
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
preedit_bufs = eina_ustrbuf_new();
if (imf_context_data->preedit_chars)
{
@@ -1063,8 +1048,7 @@ preedit_draw_callback(XIC xic __UNUSED__,
new_text_length, call_data->chg_first);
if (ret == EINA_FALSE) goto done;
}
- else
- {
+ else {
ret = EINA_FALSE;
}
@@ -1108,7 +1092,6 @@ preedit_caret_callback(XIC xic __UNUSED__,
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
if (call_data->direction == XIMAbsolutePosition)
{
@@ -1158,8 +1141,6 @@ get_ic(Ecore_IMF_Context *ctx)
Ecore_IMF_Context_Data *imf_context_data;
XIC ic;
imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN_VAL(imf_context_data, NULL);
-
ic = imf_context_data->ic;
if (!ic)
{
@@ -1245,48 +1226,7 @@ get_ic(Ecore_IMF_Context *ctx)
im_style |= XIMStatusNothing;
}
- if (!im_info->xim_styles)
- {
- EINA_LOG_WARN("No XIM styles supported! Wanted %#llx",
- (unsigned long long)im_style);
- im_style = 0;
- }
- else
- {
- XIMStyle fallback = 0;
- int i;
-
- for (i = 0; i < im_info->xim_styles->count_styles; i++)
- {
- XIMStyle cur = im_info->xim_styles->supported_styles[i];
- if (cur == im_style)
- break;
- else if (cur == (XIMPreeditNothing | XIMStatusNothing))
- /* TODO: fallback is just that or the anyone? */
- fallback = cur;
- }
-
- if (i == im_info->xim_styles->count_styles)
- {
- if (fallback)
- {
- EINA_LOG_WARN("Wanted XIM style %#llx not found, "
- "using fallback %#llx instead.",
- (unsigned long long)im_style,
- (unsigned long long)fallback);
- im_style = fallback;
- }
- else
- {
- EINA_LOG_WARN("Wanted XIM style %#llx not found, "
- "no fallback supported.",
- (unsigned long long)im_style);
- im_style = 0;
- }
- }
- }
-
- if ((im_info->im) && (im_style))
+ if (im_info->im)
{
ic = XCreateIC(im_info->im,
XNInputStyle, im_style,
@@ -1316,8 +1256,6 @@ static void
reinitialize_ic(Ecore_IMF_Context *ctx)
{
Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
XIC ic = imf_context_data->ic;
if (ic)
{
@@ -1352,8 +1290,6 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
Ecore_X_Window old_win;
- EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
-
/* reinitialize IC */
reinitialize_ic(ctx);
@@ -1389,16 +1325,14 @@ get_im(Ecore_X_Window window,
Eina_List *l;
XIM_Im_Info *im_info = NULL;
XIM_Im_Info *info = NULL;
- EINA_LIST_FOREACH (open_ims, l, im_info)
- {
+ EINA_LIST_FOREACH (open_ims, l, im_info) {
if (strcmp(im_info->locale, locale) == 0)
{
if (im_info->im)
{
return im_info;
}
- else
- {
+ else {
info = im_info;
break;
}
@@ -1464,8 +1398,7 @@ xim_info_display_closed(Ecore_X_Display *display __UNUSED__,
EINA_LIST_FOREACH (ics, tmp_list, ctx)
set_ic_client_window(ctx, 0);
- EINA_LIST_FREE (ics, ctx)
- {
+ EINA_LIST_FREE (ics, ctx) {
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
imf_context_data_destroy(imf_context_data);
diff --git a/src/tests/ecore_test_ecore.c b/src/tests/ecore_test_ecore.c
index a37b00d1..36491968 100644
--- a/src/tests/ecore_test_ecore.c
+++ b/src/tests/ecore_test_ecore.c
@@ -156,13 +156,13 @@ START_TEST(ecore_test_ecore_main_loop_timer)
}
END_TEST
-static Eina_Bool _timer3(void *data __UNUSED__)
+static Eina_Bool _timer3(void *data)
{
/* timer 3, do nothing */
return EINA_FALSE;
}
-static Eina_Bool _timer2(void *data __UNUSED__)
+static Eina_Bool _timer2(void *data)
{
/* timer 2, quit inner mainloop */
ecore_main_loop_quit();
@@ -287,7 +287,7 @@ START_TEST(ecore_test_ecore_main_loop_event)
END_TEST
static Eina_Bool
-_timer_quit_recursive(void *data __UNUSED__)
+_timer_quit_recursive(void *data)
{
INF(" _timer_quit_recursive: begin");
ecore_main_loop_quit(); /* quits inner main loop */
@@ -296,8 +296,9 @@ _timer_quit_recursive(void *data __UNUSED__)
}
static Eina_Bool
-_event_recursive_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
+_event_recursive_cb(void *data, int type, void *event)
{
+ Ecore_Event *e;
static int guard = 0;
/* If we enter this callback more than once, it's wrong! */
diff --git a/src/tests/ecore_test_ecore_x.c b/src/tests/ecore_test_ecore_x.c
index db740927..2d14ff10 100644
--- a/src/tests/ecore_test_ecore_x.c
+++ b/src/tests/ecore_test_ecore_x.c
@@ -49,7 +49,7 @@ END_TEST
#endif
-void ecore_test_ecore_x(TCase *tc __UNUSED__)
+void ecore_test_ecore_x(TCase *tc)
{
/* TODO: change to HAVE_ECORE_X when xcb implementation is done */