Brett Nash <nash@nash.id.au>
Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Leif Middelschulte <leif.middelschulte@gmail.com>
-Mike McCormack <mj.mccormack@samsung.com>
+Mike McCormack <mikem@ring3k.org>
Sangho Park <gouache95@gmail.com>
Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
PnB <Poor.NewBie@gmail.com>
Kim Yunhan <spbear@gmail.com>
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
Bluezery <ohpowel@gmail.com>
+Doyoun Kang <wayofmine@gmail.com> <doyoun.kang@samsung.com>
+Haifeng Deng <haifeng.deng@samsung.com>
2011-11-27 Vincent Torri
* Fix and improve key management on Windows XP
+
+2011-11-29 Vincent Torri
+
+ * Discard left Ctrl when AltGr is pressed (Windows XP)
+ * Fix the string value for the Delete key (Windows XP)
+ * Fix the key release values for non keystroke keys (Windows XP)
+
+2011-11-29 Mike McCormack
+
+ * Allow quitting before entering the glib version of the main loop
+
+2011-12-02 Carsten Haitzler (The Rasterman)
+
+ 1.1.0 release
+
+2011-12-02 Mike Blumenkrantz
+
+ * Use mempools for allocations
+
+2011-12-02 Term <term@twistedpath.org>
+
+ * added ecore_x_randr_output_backlight_available()
+
+2011-12-03 Vincent Torri
+
+ * Fix the modifiers value (Windows XP)
+
+2011-12-04 Mike Blumenkrantz
+
+ * added ecore_timer_reset()
+
+2011-12-05 Mike Blumenkrantz
+
+ * added ecore_con_socks api
+
+2011-12-07 Mike Blumenkrantz
+
+ * Allow SSL certificates to be loaded for STARTTLS
+ * Added functions to set/get the hostname used for SSL certificate verification
+ * ecore_con_ssl_server_cafile_add() now accepts directories
+
+2011-12-10 Mike Blumenkrantz
+
+ * Fix case where SSL certificates would not be used
+ * Added ECORE_CON_REMOTE_CORK for applying TCP_CORK to sends
+
+2011-12-12 Carsten Haitzler (The Rasterman)
+
+ * Fix bug where an animator that just keeps adding another
+ animator keeps the animator handler in an infinite loop. Do
+ the same as timers and mark them as "just added" to skip in
+ this run of animators
+
+2011-12-13 Doyun Kang
+
+ * Add ability to get resource id of last x error in ecore_x.
+
+2011-12-16 Carsten Haitzler (The Rasterman)
+
+ * Clean up some ecore-evas-buffer code
+ * Add Ecore-evas extn (external) plug and socket canvas wrappers
+ allowing for any ecore-evas to contain an image object that is
+ a "socket" for other processes to plug into with "plugs" and
+ thus provide image content via a canvas remotely (from another
+ process) as well as the socket process passing in events to the
+ plug process to it can see key, mouse, multi etc. events.
+
+
+2011-12-16 Mike Blumenkrantz
+
+ * Fix possible 0 byte allocation in ecore-x
+
+2011-12-20 Carsten Haitzler (The Rasterman)
+
+ * Fix probable leak for g_static_mutex's on some architectures
+
+2011-12-20 Jihoon Kim
+
+ * Add XIM attribute support to Ecore_IMF
+
+2011-12-21 Tae-Hwan Kim (Bluezery)
+
+ * Add proxy set and timeout set functions in ecore_con.
+
+2011-12-26 Tae-Hwan Kim (Bluezery)
+
+ * Add proxy username/password set functions in ecore_con.
+
+2011-12-26 Christopher Michael (devilhorns)
+
+ * Add Ecore_Wayland (backend to support Wayland).
+ * Add Shm and Egl engines for ecore_evas to draw in Wayland.
+
+2011-12-27 Carsten Haitzler (The Rasterman)
+
+ * Fix mouse down grab counts going bad by missing events.
+
+2011-12-29 Carsten Haitzler (The Rasterman)
+
+ * Fix massive post data probile in ecore-con that would cause
+ post data to be corrupted (as it was never copied into the
+ ecore con url struct) or could cause crashes if the memory
+ pointed to became invalid.
+
+2012-01-04 Carsten Haitzler (The Rasterman)
+
+ * Add HEX, TERMINAL and PASSWORD layouts to ecore-imf
+
+2011-01-05 Jiyoun Park (Jypark)
+
+ * Fix Ecore-evas extn (external) for multi client model.
+ "Socket" creates canvas and other process can show that canvas
+ using "Plug" image object. Before only one to one communication
+ is possible, but now many "plug"s can show socket's canvas.
+
+2011-12-26 Christopher Michael (devilhorns)
+
+ * Add Ecore_X function to return the keycode from a given keyname.
+
+2012-02-06 Jihoon Kim (jihoon)
+
+ * Set ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL as default layout in ecore_imf_context_add.
+ * Add Ecore_IMF function to set or get the input panel-specific data.
+
+2012-02-07 Jihoon Kim (jihoon)
+
+ * Support ecore_imf_context_input_panel_show/hide in XIM and SCIM module.
+
+2012-02-08 Carsten Haitzler (The Rasterman)
+
+ * Add ecore_con_url_http_version_set() to set url request version
+
+2012-02-09 Jihoon Kim (jihoon)
+
+ * Provide compose, string in key down/up event in case of scim-input-pad.
+
+2012-02-10 Christopher Michael (devilhorns)
+
+ * Add Ecore_Evas function to allow setting a mouse pointer from efl/elm wayland clients.
+
+2012-02-15 Jihoon Kim (jihoon)
+
+ * Add ecore_imf APIs to set return key type, disable return key.
+
ecore-psl1ght.pc.in \
ecore-input.pc.in \
ecore-wince.pc.in \
+ecore-wayland.pc.in \
ecore.spec.in \
ecore.spec \
m4/ac_abstract_socket.m4 \
pkgconfig_DATA += ecore-psl1ght.pc
endif
+if BUILD_ECORE_WAYLAND
+pkgconfig_DATA += ecore-wayland.pc
+endif
+
.PHONY: doc
# Documentation
+Ecore 1.2.0
+
+Changes since Ecore 1.1.0:
+--------------------------
+
+Additions:
+ * ecore
+ - ecore_timer_reset()
+ * ecore_con
+ - ecore_con_socks api
+ - ecore_con_ssl_server_verify_name_set/get
+ - ecore_con_ssl_server_cafile_add() now accepts directories
+ - ECORE_CON_REMOTE_CORK
+ - ecore_con_url_proxy_set()
+ - ecore_con_url_timeout_set()
+ - ecore_con_url_proxy_username_set
+ - ecore_con_url_proxy_password_set()
+ * ecore_x:
+ - ecore_x_randr_output_backlight_available()
+ * ecore_evas:
+ - Add Shm and Egl engines for ecore_evas to draw in Wayland.
+ - Add Socket and Plug to draw other process area.
+ * ecore_wayland
+ - Add Ecore_Wayland (backend to support Wayland).
+
+Improvements:
+ * ecore:
+ - most allocations moved to mempools
+ * ecore_con:
+ - certificates can now be added for STARTTTLS
+ * ecore_win32:
+ - fix modifiers value on Windows XP
+
+
Ecore 1.1.0
Changes since Ecore 1.0.0:
* NULL pointer dereference in ecore_x selection notification code
* sync GNUTLS thread activation with eina changes
* ecore_ipc compilation on Windows
- * fix Shift, Control and Alt keys detection on Windows
+ * fix Shift, Control, Alt and AltGr keys detection on Windows XP
* "mouse-down inside and mouse-up outside" issue on Windows
* ecore_x shadow tree search fixed to respect shape input of windows
* fd handlers fixed when idler callbacks add jobs or events
echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp
echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp
echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp
+echo "OLD_CXXFLAGS=\"$CXXFLAGS\"" >> config.cache-env.tmp
cmp config.cache-env.tmp config.cache-env >> /dev/null
if [ $? -ne 0 ]; then
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [1])
m4_define([v_min], [1])
-m4_define([v_mic], [0])
-m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
+m4_define([v_mic], [99])
+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
-m4_undefine([v_rev])
+dnl 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])
want_ecore_fb="no"
want_ecore_directfb="no"
want_ecore_wince="no"
+want_ecore_wayland="no"
# ecore_x options (both xlib and xcb)
want_ecore_x_composite="yes"
want_ecore_evas_fb="no"
want_ecore_evas_software_16_wince="no"
want_ecore_evas_ews="yes"
+want_ecore_evas_wayland_shm="no"
+want_ecore_evas_wayland_egl="no"
# ecore_imf modules
want_ecore_imf_xim="no"
+want_ecore_imf_scim="no"
case "$host_os" in
mingw32ce* | cegcc*)
want_ecore_fb="yes"
want_ecore_imf="yes"
want_ecore_x="yes"
+ want_ecore_wayland="yes"
want_ecore_evas_software_x11="yes"
want_ecore_evas_opengl_x11="yes"
want_ecore_evas_software_16_x11="yes"
want_ecore_evas_gl_cocoa="no"
want_ecore_evas_directfb="yes"
want_ecore_evas_fb="yes"
+ want_ecore_evas_wayland_shm="yes"
+ want_ecore_evas_wayland_egl="yes"
want_ecore_imf_xim="yes"
+ want_ecore_imf_scim="yes"
;;
esac
requirements_ecore_win32=""
requirements_ecore_wince=""
requirements_ecore_imf_xim=""
+requirements_ecore_imf_scim=""
+requirements_ecore_wayland=""
AC_CHECK_DECL([MAXHOSTNAMELEN],[FOUND_MAXHOSTNAMELEN=yes])
have_backtrace="no"
AC_CHECK_FUNCS([backtrace], [have_backtrace="yes"], [])
-want_ecore_timer_dump="yes"
+want_ecore_timer_dump="no"
AC_ARG_ENABLE([ecore-timer-dump],
[AC_HELP_STRING([--disable-ecore-timer-dump], [disable tracking of timer allocation. @<:@default=enable@:>@])],
#FIXME check all the requirements when the eina move will be finished
requirements_ecore="eina >= 1.1.0 ${requirements_ecore}"
requirements_ecore_con="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_con}"
-#requirements_ecore_config="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_config}"
-requirements_ecore_directfb="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_directfb}"
-requirements_ecore_evas="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_evas}"
-requirements_ecore_fb="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_fb}"
-requirements_ecore_file="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_file}"
-requirements_ecore_imf="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_imf}"
-requirements_ecore_imf_evas="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_imf_evas}"
-requirements_ecore_input="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_input}"
-requirements_ecore_input_evas="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_input_evas}"
-requirements_ecore_ipc="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_ipc}"
-requirements_ecore_cocoa="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_cocoa}"
-requirements_ecore_sdl="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_sdl}"
-requirements_ecore_psl1ght="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_sdl}"
-requirements_ecore_win32="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_win32}"
-requirements_ecore_wince="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_wince}"
-requirements_ecore_x="ecore >= 1.1.0 eina >= 1.1.0 ${requirements_ecore_x}"
+#requirements_ecore_config="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_config}"
+requirements_ecore_directfb="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_directfb}"
+requirements_ecore_evas="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_evas}"
+requirements_ecore_fb="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_fb}"
+requirements_ecore_file="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_file}"
+requirements_ecore_imf="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_imf}"
+requirements_ecore_imf_evas="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_imf_evas}"
+requirements_ecore_input="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_input}"
+requirements_ecore_input_evas="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_input_evas}"
+requirements_ecore_ipc="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_ipc}"
+requirements_ecore_cocoa="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_cocoa}"
+requirements_ecore_sdl="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_sdl}"
+requirements_ecore_psl1ght="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_sdl}"
+requirements_ecore_win32="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_win32}"
+requirements_ecore_wince="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_wince}"
+requirements_ecore_x="ecore >= 1.1.99 eina >= 1.1.0 ${requirements_ecore_x}"
# glib support (main loop integration)
# Evas library (ecore_config, ecore_input_evas, ecore_imf_evas and ecore_evas)
-PKG_CHECK_MODULES([EVAS], [evas >= 1.1.0],
+PKG_CHECK_MODULES([EVAS], [evas >= 1.1.99],
[have_evas="yes"],
[have_evas="no"])
# ecore_con
-AC_CHECK_HEADERS([arpa/inet.h arpa/nameser.h netinet/tcp.h netinet/in.h sys/socket.h sys/un.h ws2tcpip.h netdb.h])
+AC_CHECK_HEADERS([arpa/inet.h arpa/nameser.h netinet/tcp.h net/if.h netinet/in.h sys/socket.h sys/un.h ws2tcpip.h netdb.h])
if test "x${ac_cv_header_netdb_h}" = "xyes" ; then
have_addrinfo="yes"
# ecore_ipc
ECORE_CHECK_MODULE([ipc], [${want_ecore_ipc}], [Ipc], [${have_ecore_con}],
- [requirements_ecore_ipc="ecore-con >= 1.1.0 ${requirements_ecore_ipc}"])
+ [
+ requirements_ecore_ipc="ecore-con >= 1.1.99 ${requirements_ecore_ipc}"
+ requirements_ecore_evas="ecore-ipc >= 1.1.99 ${requirements_ecore_evas}"
+ ])
# ecore_file
ECORE_CHECK_MODULE([file], [${want_ecore_file}], [File])
ECORE_CHECK_NOTIFY_WIN32([${want_notify_win32}], [have_notify_win32="yes"], [have_notify_win32="no"])
if test "x${have_ecore_con}" = "xyes" ; then
- requirements_ecore_file="ecore-con >= 1.1.0 ${requirements_ecore_file}"
+ requirements_ecore_file="ecore-con >= 1.1.99 ${requirements_ecore_file}"
else
ECORE_CHECK_CURL([${want_curl}],
[
#fi
#ECORE_CHECK_MODULE([config], [${want_ecore_config}], [Config], [${ecore_config_deps}],
-# [requirements_ecore_config="ecore-ipc >= 1.1.0 evas >= 1.1.0 eet >= 1.5.0 ${requirements_ecore_config}"])
+# [requirements_ecore_config="ecore-ipc >= 1.1.99 evas >= 1.1.99 eet >= 1.5.0 ${requirements_ecore_config}"])
AM_CONDITIONAL(BUILD_ECORE_CONFIG, false)
fi
ECORE_CHECK_MODULE([imf-evas], [${want_ecore_imf}], [Imf_Evas], [${ecore_imf_evas_deps}],
- [requirements_ecore_imf_evas="ecore-imf >= 1.1.0 evas >= 1.1.0 ${requirements_ecore_imf_evas}"])
+ [requirements_ecore_imf_evas="ecore-imf >= 1.1.99 evas >= 1.1.99 ${requirements_ecore_imf_evas}"])
# ecore_input{_evas}
ECORE_CHECK_MODULE([input], [${want_ecore_input}], [Input])
ECORE_CHECK_MODULE([input-evas], [${want_ecore_input}], [Input_Evas], [${have_evas}],
- [requirements_ecore_input_evas="ecore-input >= 1.1.0 evas >= 1.1.0 ${requirements_ecore_input}"])
+ [requirements_ecore_input_evas="ecore-input >= 1.1.99 evas >= 1.1.99 ${requirements_ecore_input}"])
# ecore_imf_xim
AM_CONDITIONAL(BUILD_ECORE_IMF_XIM, false)
fi
ECORE_CHECK_MODULE([imf-xim], [${want_ecore_imf}], [Imf_XIM], [${ecore_imf_xim_deps}],
- [requirements_ecore_imf_xim="ecore-imf >= 1.1.0 ecore-x >= 1.1.0 ecore-input >= 1.1.0 ${requirements_ecore_imf_xim}"])
+ [requirements_ecore_imf_xim="ecore-imf >= 1.1.99 ecore-x >= 1.1.99 ecore-input >= 1.1.99 ${requirements_ecore_imf_xim}"])
+
+# ecore_imf_scim
+PKG_CHECK_MODULES([SCIM], [scim], [have_scim="yes"], [have_scim="no"])
+
+AM_CONDITIONAL(BUILD_ECORE_IMF_SCIM, false)
+ecore_imf_scim_deps="no"
+echo "have_ecore_x_xlib: ${have_ecore_x_xlib}"
+if test "x${have_ecore_imf}" = "xyes" \
+ -a "x${have_scim}" = "xyes" \
+ -a "x${have_ecore_input}" = "xyes" ; then
+ ecore_imf_scim_deps="yes"
+ AC_DEFINE(BUILD_ECORE_IMF_SCIM, 1, [Ecore Imf SCIM Support])
+fi
+
+ECORE_CHECK_MODULE([imf-scim], [${want_ecore_imf}], [Imf_SCIM], [${ecore_imf_scim_deps}],
+ [requirements_ecore_imf_scim="ecore-imf >= 1.1.0 ecore-x >= 1.1.0 ecore-input >= 1.1.0 ${requirements_ecore_imf_scim}"])
## Graphic systems
ECORE_CHECK_MODULE([x], [${want_ecore_x}], [X], [${ecore_x_deps}],
[
ecore_x_libs="$ecore_x_libs $x_libs"
- requirements_ecore_x="ecore-input >= 1.1.0 ${requirements_ecore_x}"
+ requirements_ecore_x="ecore-input >= 1.1.99 ${requirements_ecore_x}"
])
# ecore_win32
ECORE_CHECK_MODULE([win32], [${want_ecore_win32}], [Win32], [${have_ecore_input}],
[
ecore_win32_libs="-lole32 -lgdi32"
- requirements_ecore_win32="ecore-input >= 1.1.0 ${requirements_ecore_win32}"
+ requirements_ecore_win32="ecore-input >= 1.1.99 ${requirements_ecore_win32}"
])
AC_SUBST(ecore_win32_libs)
fi
ECORE_CHECK_MODULE([cocoa], [${want_ecore_cocoa}], [Cocoa], [${ecore_cocoa_deps}],
- [requirements_ecore_cocoa="ecore-input >= 1.1.0 ${requirements_ecore_cocoa}"])
+ [requirements_ecore_cocoa="ecore-input >= 1.1.99 ${requirements_ecore_cocoa}"])
# ecore_sdl
fi
ECORE_CHECK_MODULE([sdl], [${want_ecore_sdl}], [Sdl], [${ecore_sdl_deps}],
- [requirements_ecore_sdl="ecore-input >= 1.1.0 ${requirements_ecore_sdl}"])
+ [requirements_ecore_sdl="ecore-input >= 1.1.99 ${requirements_ecore_sdl}"])
ECORE_CHECK_MODULE([psl1ght], [${want_ecore_psl1ght}], [psl1ght], [${ecore_psl1ght_deps}],
- [requirements_ecore_psl1ght="ecore-input >= 1.1.0 ${requirements_ecore_psl1ght}"])
+ [requirements_ecore_psl1ght="ecore-input >= 1.1.99 ${requirements_ecore_psl1ght}"])
# ecore_fb
ECORE_CHECK_MODULE([fb], [${want_ecore_fb}], [FB], [$have_fb])
# ecore_wince
ECORE_CHECK_MODULE([wince], [${want_ecore_wince}], [WinCE], [${have_ecore_input}],
- [requirements_ecore_win32="ecore-input >= 1.1.0 ${requirements_ecore_win32}"])
+ [requirements_ecore_win32="ecore-input >= 1.1.99 ${requirements_ecore_win32}"])
## Ecore Evas
fi
ECORE_CHECK_MODULE([evas], [${want_ecore_evas}], [Evas], [${ecore_evas_deps}],
- [requirements_ecore_evas="ecore-input >= 1.1.0 ecore-input-evas >= 1.1.0 evas >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-input >= 1.1.99 ecore-input-evas >= 1.1.99 evas >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_buffer
"x$have_ecore_evas_software_16_x11" = "xyes" -o \
"x$have_ecore_evas_software_xcb" = "xyes"; then
AC_DEFINE(BUILD_ECORE_EVAS_X11, 1, [Support for X Window Engines in Ecore_Evas])
- requirements_ecore_evas="ecore-x >= 1.1.0 ${requirements_ecore_evas}"
+ requirements_ecore_evas="ecore-x >= 1.1.99 ${requirements_ecore_evas}"
fi
# ecore_evas_win32
"x${have_ecore_evas_opengl_glew}" = "xyes" -o \
"x${have_ecore_evas_software_16_ddraw}" = "xyes" ; then
AC_DEFINE(BUILD_ECORE_EVAS_WIN32, 1, [Support for Win32 Engine in Ecore_Evas])
- requirements_ecore_evas="ecore-win32 >= 1.1.0 ${requirements_ecore_evas}"
+ requirements_ecore_evas="ecore-win32 >= 1.1.99 ${requirements_ecore_evas}"
fi
# ecore_evas_software_sdl
[${want_ecore_evas_software_sdl}],
[Software SDL],
[${have_ecore_sdl}],
- [requirements_ecore_evas="ecore-sdl >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-sdl >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_gl_sdl
[${want_ecore_evas_gl_sdl}],
[OpenGL SDL],
[${have_ecore_sdl}],
- [requirements_ecore_evas="ecore-sdl >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-sdl >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_cocoa
[${want_ecore_evas_gl_cocoa}],
[OpenGL Cocoa],
[${have_ecore_cocoa}],
- [requirements_ecore_evas="ecore-cocoa >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-cocoa >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_directfb
[${want_ecore_evas_directfb}],
[DirectFB],
[${have_ecore_directfb}],
- [requirements_ecore_evas="ecore-directfb >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-directfb >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_fb
[${want_ecore_evas_fb}],
[Linux Framebuffer],
[${have_ecore_fb}],
- [requirements_ecore_evas="ecore-fb >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-fb >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_wince
[${want_ecore_evas_software_16_wince}],
[16 bpp Software Windows CE],
[${have_ecore_wince}],
- [requirements_ecore_evas="ecore-wince >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-wince >= 1.1.99 ${requirements_ecore_evas}"])
# ecore_evas_ews
[${want_ecore_evas_psl1ght}],
[PSL1GHT],
[${have_ecore_psl1ght}],
- [requirements_ecore_evas="ecore-psl1ght >= 1.1.0 ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-psl1ght >= 1.1.99 ${requirements_ecore_evas}"])
+
+### WAYLAND
+
+ecore_wayland_deps="no"
+have_wayland="no"
+if test "x${want_ecore_wayland}" = "xyes" ; then
+ 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"
+fi
+
+ECORE_CHECK_MODULE([wayland], [${want_ecore_wayland}], [Wayland], [${ecore_wayland_deps}])
+if test "x${have_ecore_wayland}" = "xyes" ; then
+ requirements_ecore_wayland="ecore-input >= 1.1.0 wayland-client xkbcommon ${requirements_ecore_wayland}"
+fi
+
+ECORE_EVAS_CHECK_MODULE_FULL([wayland-shm], [wayland-shm],
+ [${want_ecore_evas_wayland_shm}],
+ [Wayland Shm],
+ [${have_ecore_wayland}],
+ [requirements_ecore_evas="${requirements_ecore_wayland} ${requirements_ecore_evas}"])
+
+ECORE_EVAS_CHECK_MODULE_FULL([wayland-egl], [wayland-egl],
+ [${want_ecore_evas_wayland_egl}],
+ [Wayland Egl],
+ [${have_ecore_wayland}],
+ [
+ PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [have_wayland_egl="yes"], [have_wayland_egl="no"])
+ if test "x${have_wayland_egl}" = "xyes" ; then
+ requirements_ecore_evas="wayland-egl egl ${requirements_ecore_wayland} ${requirements_ecore_evas}"
+ fi
+ ])
### install and build examples
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_wayland)
AC_CONFIG_FILES([
Makefile
ecore-cocoa.pc
ecore-psl1ght.pc
ecore-wince.pc
+ecore-wayland.pc
ecore.pc
doc/ecore.dox
doc/Makefile
src/lib/ecore_x/Makefile
src/lib/ecore_x/xlib/Makefile
src/lib/ecore_x/xcb/Makefile
+src/lib/ecore_wayland/Makefile
src/examples/Makefile
src/tests/Makefile
src/modules/Makefile
src/modules/immodules/Makefile
src/modules/immodules/xim/Makefile
+src/modules/immodules/scim/Makefile
ecore.spec
$po_makefile_in
])
#echo " Ecore_Config.................: $have_ecore_config (deprecated)"
echo " Ecore_IMF....................: $have_ecore_imf"
echo " XIM........................: $have_ecore_imf_xim"
+echo " SCIM.......................: $have_ecore_imf_scim"
echo " Ecore_IMF_Evas...............: $have_ecore_imf_evas"
echo " Ecore_Input..................: $have_ecore_input"
echo " Ecore_Input_Evas.............: $have_ecore_input_evas"
echo " Ecore_DirectFB...............: $have_ecore_directfb"
echo " Ecore_WinCE..................: $have_ecore_wince"
echo " Ecore_PSL1GHT................: $have_ecore_psl1ght"
+echo " Ecore_Wayland................: $have_ecore_wayland"
echo
echo " Ecore Evas:"
echo " Software 16bit DirectDraw..: $have_ecore_evas_software_16_ddraw"
echo " Software 16bit WinCE.......: $have_ecore_evas_software_16_wince"
echo " Sing.Proc. Windowing System: $have_ecore_evas_ews"
+ echo " Wayland Shm................: $have_ecore_evas_wayland_shm"
+ echo " Wayland Egl................: $have_ecore_evas_wayland_egl"
fi
echo
echo " Tests................: ${enable_tests}"
+ecore (1.1.0+svn.67695slp2+build01) unstable; urgency=low
+
+ * Package Upload
+ * Git: slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.67695slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com> Wed, 15 Feb 2012 19:01:02 +0900
+
+ecore (1.1.0+svn.66972slp2+build03) unstable; urgency=low
+
+ * [ECORE_X] Add feature - illume window state for app-in-app
+ * Git: slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.66972slp2+build03
+
+ -- Doyoun Kang <doyoun.kang@samsung.com> Thu, 02 Feb 2012 15:04:12 +0900
+
+ecore (1.1.0+svn.66972slp2+build02) unstable; urgency=low
+
+ * Use synchronous ecore_imf callback API
+ * Git: slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.66972slp2+build02
+
+ -- Jihoon Kim <jihoon48.kim@samsung.com> Tue, 31 Jan 2012 13:21:06 +0900
+
+ecore (1.1.0+svn.66972slp2+build01) unstable; urgency=low
+
+ * Package Upload
+ * Git: slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.66972slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com> Mon, 16 Jan 2012 18:29:42 +0900
+
+ecore (1.1.0+svn.65878slp2+build05) unstable; urgency=low
+
+ * jpeg7 -> jpeg8
+ * Git: slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.65878slp2+build05
+
+ -- ChunEon Park <chuneon.park@samsung.com> Mon, 16 Jan 2012 11:14:18 +0900
+
+ecore (1.1.0+svn.65878slp2+build04) unstable; urgency=low
+
+ * Repackaging
+ * Git: slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.65878slp2+build04
+
+ -- ChunEon Park <chuneon.park@samsung.com> Fri, 30 Dec 2011 15:07:27 +0900
+
+ecore (1.1.0+svn.65878slp2+build03) unstable; urgency=low
+
+ * Just Bumped up version
+ * Git: slp-scm.sec.samsung.net:slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.65878slp2+build03
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Mon, 26 Dec 2011 15:20:31 +0900
+
+ecore (1.1.0+svn.65878slp2+build02) unstable; urgency=low
+
+ * Upstream sync related ecore_con (r66414, 66462, sync after r65934)
+ * ecore_timer_dump is disabled as default
+ * Git: slp-scm.sec.samsung.net:slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.65878slp2+build02
+
+ -- Tae-Hwan Kim <the81.kim@samsung.com> Fri, 23 Dec 2011 18:07:06 +0900
+
+ecore (1.1.0+svn.65878slp2+build01) unstable; urgency=low
+
+ * Package Upload for migration
+ * Git: slp-scm.sec.samsung.net:slp/pkgs/e/ecore
+ * Tag: ecore_1.1.0+svn.65878slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com> Thu, 08 Dec 2011 13:51:03 +0900
+
ecore (1.1.0+svn.65618slp2+build02) unstable; urgency=low
* [Bug Fix] CQ H0100136744 - curl fd handler refactoring
libxrandr-dev,
libxext-dev,
libxcomposite-dev,
- libjpeg7-dev,
+ libjpeg8-dev,
libxdamage-dev,
x11proto-xext-dev,
libxtst-dev,
--disable-openssl \
--enable-glib-integration-always \
--enable-ecore-x-gesture \
- --disable-xim
+ --disable-xim \
+ --disable-ecore-imf-scim
DEB_MAKE_EXTRA_ARGS := V=0
DEB_MAKE_CLEAN_TARGET := distclean
* @example ecore_con_url_headers_example.c
* Shows how to make GET or POST requests using an @ref Ecore_Con_Url object,
* and make use of most of its API. See the complete example description at
- * @ref ecore_con_headers_example_c
+ * @ref ecore_con_url_headers_example_c
*/
/**
* On this example, we accomplish the very same task, but by using the
* @c Ecore_Evas helper wrapper functions on a buffer engine
* canvas. If you compare both codes, you'll see how much code one is
- * saved from by using the @Ecore_Evas wrapper functions.
+ * saved from by using the @c Ecore_Evas wrapper functions.
*
* The code is simple as it can be. After instantianting our canvas
* window, with ecore_evas_buffer_new(), we grab its canvas pointer
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: ecore-wayland
+Description: E core library, Wayland module
+@pkgconfig_requires_private@: @requirements_ecore_wayland@
+Version: @VERSION@
+Libs: -L${libdir} -lecore_wayland
+Libs.private: -lwayland-client
+Cflags: -I${includedir}/ecore-@VMAJ@
%files -f %{name}.lang
%defattr(-, root, root)
%doc AUTHORS COPYING* README*
-%{_bindir}/ecore_test
%{_libdir}/libecore*.so.*
%files devel
msgstr ""
"Project-Id-Version: ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:55+0900\n"
-"PO-Revision-Date: 2009-10-27 19:35+0100\n"
-"Last-Translator: quaker66 <quaker66@gmail.com>\n"
-"Language-Team: cs <quaker66@gmail.com>\n"
+"POT-Creation-Date: 2011-12-26 13:27+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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Verze:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Použití:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [volby]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Licence:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Typ: "
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Výchozí: "
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Možnosti: "
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Volby:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "CHYBA: neznámá volba --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "CHYBA: neznámá volba -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "CHYBA: "
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "hodnota nemá nastaven pointer.\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "neznámá boolean hodnota %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "neznámý číselný formát %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "neznámá volba \"%s\". Možné hodnoty jsou: "
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "chybějící parametr k připojení.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "nemůžu parsovat hodnotu.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "chybějící parametr.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "chybějící callback funkce!\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "nebyla definována verze.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "nebyl definován copyright.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "nebyla definována licence.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "CHYBA: neznámá volba --%s, ignoruji.\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "CHYBA: volba --%s vyžaduje argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "CHYBA: neznámá volba -%c, ignoruji.\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "CHYBA: volba -%c vyžaduje argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "CHYBA: nebyl poskytnut parser.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "CHYBA: nebyly poskytnuty hodnoty.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "CHYBA: nebyly poskytnuty argumenty.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "CHYBA: nalezeny neplatné volby."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr " viz. --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr " viz. -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "CHYBA: neplatná hodnota geometrie '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "CHYBA: neplatná hodnota velikosti '%s'\n"
msgstr ""
"Project-Id-Version: ecore 0.9.9.063-2\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:51+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+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"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Version:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Aufruf:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [Optionen]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Lizenz:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Typ: "
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Standard: "
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Auswahlmöglichkeiten: "
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Optionen:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "FEHLER: Unbekannte Option --%s\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "FEHLER: Unbekannte Option -%c\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "FEHLER: "
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "kein Zeiger auf Wert gesetzt\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "unbekannter boolescher Wert %s\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "ungültiges Zahlenformat %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "ungültige Auswahl \"%s\". Gültige Werte sind: "
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "fehlender Parameter zum Anhängen.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "Wert kann nicht ausgewertet werden.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "fehlender Parameter.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "fehlende Rückruffunktion!\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "es wurde keine Version angegeben.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "es wurde kein Copyright angegeben.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "es wurde keine Lizenz angegeben.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "FEHLER: Unbekannte Option --%s, ignoriert\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, 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:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "FEHLER: Unbekannte Option -%c, ignoriert\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, 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:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "FEHLER: Kein Parser bereitgestellt.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "FEHLER: Keine Werte bereitgestellt.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "FEHLER: Keine Argumente bereitgestellt.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "FEHLER: Ungültige Optionen gefunden."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr " Siehe --%s\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr " Siehe -%c\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "FEHLER: Falscher Geometriewert \"%s\"\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "FEHLER: Falscher Größenwert \"%s\"\n"
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-15 18:22+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+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"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Έκδοση:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Χρήση:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [επιλογές]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Πνευματικά δικαιώματα:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Άδεια:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Τύπος:"
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Προκαθορισμένο:"
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Επιλογές:"
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Επιλογές:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "ΣΦΑΛΜΑ:"
-#: src/lib/ecore/ecore_getopt.c:924
-#: src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077
-#: src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109
-#: src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276
-#: src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "η τιμή δεν έχει δείκτη ορισμένο.\n"
-#: src/lib/ecore/ecore_getopt.c:956
-#: src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "άγνωστη τιμή boolean %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007
-#: src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "άγνωστη μορφή αριθμού %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "μη έγκυρη επιλογή \"%s\". Οι έγκυρες τιμές είναι: "
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "ελλιπής παράμετρος προς επισύναψη.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "αδυναμία ανάλυσης τιμών.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "ελλιπής παράμετρος.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "λείπει η λειτουργία επανάκλησης!\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "δεν έχει οριστεί έκδοση.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "δεν έχουν οριστεί πνευματικά δικαιώματα.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "δεν έχει οριστεί άδεια.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ΣΦΑΛΜΑ:άγνωστη επιλογή --%s, αγνοήθηκε.\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ΣΦΑΛΜΑ: η επιλογή --%s απαιτεί παραμέτρους!\n"
-#: src/lib/ecore/ecore_getopt.c:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή -%c, αγνοήθηκε.\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ΣΦAΛΜΑ: η επιλογή -%c απαιτεί μία παράμετρο!\n"
-#: src/lib/ecore/ecore_getopt.c:1784
+#: src/lib/ecore/ecore_getopt.c:1785
#, fuzzy
msgid "ERROR: no parser provided.\n"
msgstr "ΣΦΑΛΜΑ:δεν παρέχεται αναλυτής.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "ΣΦΑΛΜΑ:δεν έχουν δοθεί τιμές.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "ΣΦΑΛΜΑ:δεν έχουν δοθεί παράμετροι.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "ΣΦΑΛΜΑ: βρέθηκαν μη έγκυρες επιλογές."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr " Δείτε --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr " Δείτε -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ΣΦΑΛΜΑ: μη έγκυρη γεωμετρική τιμή '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ΣΦΑΛΜΑ: μη έγκυρη τιμή μεγέθους '%s'\n"
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:51+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+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"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-SourceCharset: utf-8\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Version :"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Usage :"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [options]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Copyright :"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Licence :"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Type : "
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Par défaut :"
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Choix :"
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Options :\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERREUR : option inconnue --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERREUR : option inconnue -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "ERREUR :"
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "la valeur n'a aucun pointeur défini.\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valeur booléenne inconnue %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "format du nombre non valide %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "choix non valide « %s ». Les valeurs valides sont : "
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "paramètre manquant à ajouter.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "analyse de la valeur impossible.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "paramètre manquant.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "fonction de rappel manquante !\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "aucune version n'est définie.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "aucun copyright n'est défini.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "aucune licence n'est définie.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, 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:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, 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:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, 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:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, 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:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "ERREUR : aucun analyseur n'est fourni.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "ERREUR : aucune valeur n'est fournie.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "ERREUR : aucun argument n'est fourni.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "ERREUR : options non valides détectées."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr " Voir --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr " Voir -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERREUR : valeur géométrique incorrecte « %s »\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERREUR : valeur de taille incorrecte « %s »\n"
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:51+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+0900\n"
"PO-Revision-Date: 2009-10-27 19:36+0100\n"
"Last-Translator: quaker66 <quaker66@gmail.com>\n"
"Language-Team: none\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Versione:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Uso:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [opzioni]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Licenza:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Tipo: "
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Predefinito:"
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Scelte:"
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Opzioni:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERRORE: opzione sconosciuta --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERRORE: opzione sconosciuta -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "ERRORE:"
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "il valore non ha puntatori impostati.\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valore booleano sconosciuto %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "formato numero non valido %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "scelta non valida \"%s\". I valori ammessi sono: "
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "parametro da appendere mancante.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "impossibile il parsing del valore.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "parametro mancante.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "funzione callback mancante!\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "nessuna versione definita.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "nessun copyright definito.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "nessuna licenza definita.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERRORE: opzione sconosciuta --%s, ignorata.\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, 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:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERRORE: opzione sconosciuta -%c, ignorata.\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, 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:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "ERRORE: nessun parser fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "ERRORE: nessun valore fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "ERRORE: nessun argomento fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "ERRORE: trovate opzioni non valide."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr " Vedere --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr " Vedere -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERRORE: valore geometrico non corretto '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERRORE: valore dimensione non corretto '%s'\n"
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:51+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+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"
"X-Poedit-Language: NL\n"
"X-Poedit-Country: Nederland\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Versie:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Gebruik:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [opties]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Licentie:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Type:"
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Standaard:"
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Keuzes:"
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Opties:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "FOUT: onbekende optie --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "FOUT: onbekende optie -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "FOUT:"
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "waarde heeft geen pointer ingsteld.\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "onbekende boolean-waarde %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "ongeldig nummerformaat %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "ongeldige keuze \"%s\". Geldige waardes zijn:"
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "parameter om toe te wijzen ontbreekt.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "kon waarde niet doorvoeren.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "paramater ontbreekt.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "ontbrekende terugroep-functie!\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "geen versie was gedefinieerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "geen copyright was gedefinieerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "geen licentie was gedefinieerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "FOUT: onbekende optie --%s, genegeerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "FOUT: optie --%s vereist een argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "FOUT: onbekende opties -%c, genegeerd.\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "FOUT: optie -%c vereist een argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "FOUT: geen doorvoerder beschikbaar gesteld.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "FOUT: geen waarden beschikbaar gesteld.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "FOUT: geen argumenten beschibaar gesteld.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "FOUT: ongeldige opties gevonden."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr "Zie --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr "Zie -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "Fout: foutieve wiskundige waarde '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "FOUT: foutieve grootte-waarden '%s'\n"
msgstr ""
"Project-Id-Version: ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:51+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+0900\n"
"PO-Revision-Date: 2010-10-06 12:37-0000\n"
"Last-Translator: Sérgio Marques <smarquespt@gmail.com>\n"
"Language-Team: \n"
"X-Poedit-Language: Portuguese\n"
"X-Poedit-Country: Portugal\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Versão:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Utilização:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s [opções]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Direitos de autor:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Licença:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Tipo:"
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Omissão:"
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Escolhas:"
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Opções:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERRO: opção desconhecida --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERRO: opção desconhecida -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "ERRO: "
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "o valor não está definido.\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valor booleano desconhecido %s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "formato do número inválido %s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, 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:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "faltam os parâmetros a anexar.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "incapaz de analisar o valor.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "parâmetro em falta.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "função de chamada em falta!\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "nenhuma versão definida.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "direitos de autor não definidos.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "licença não definida.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERRO: opção desconhecida --%s, ignorada.\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, 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:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERRO: opção desconhecida --%c, ignorada.\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, 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:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "ERRO: nenhum analisador fornecido.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "ERRO: nenhum valor fornecido.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "ERRO: nenhum argumento fornecido.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "ERRO: encontradas opções inválidas."
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr " Veja --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr " Veja -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERRO: valor geométrico incorreto \"%s\"\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERRO: tamanho incorreto \"%s\"\n"
msgstr ""
"Project-Id-Version: ecore 1.0\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-11-03 10:51+0900\n"
+"POT-Creation-Date: 2011-12-26 13:27+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"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:90
+#: src/lib/ecore/ecore_getopt.c:91
msgid "Version:"
msgstr "Različica"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:100
msgid "Usage:"
msgstr "Uporaba:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:105
#, c-format
msgid "%s [options]\n"
msgstr "%s·[možnosti]\n"
-#: src/lib/ecore/ecore_getopt.c:259
+#: src/lib/ecore/ecore_getopt.c:260
msgid "Copyright:"
msgstr "Avtorstvo:"
-#: src/lib/ecore/ecore_getopt.c:271
+#: src/lib/ecore/ecore_getopt.c:272
msgid "License:"
msgstr "Licenca:"
-#: src/lib/ecore/ecore_getopt.c:452
+#: src/lib/ecore/ecore_getopt.c:453
msgid "Type: "
msgstr "Vrsta:·"
-#: src/lib/ecore/ecore_getopt.c:528
+#: src/lib/ecore/ecore_getopt.c:529
msgid "Default: "
msgstr "Privzeto:·"
-#: src/lib/ecore/ecore_getopt.c:555
+#: src/lib/ecore/ecore_getopt.c:556
msgid "Choices: "
msgstr "Izbire:·"
-#: src/lib/ecore/ecore_getopt.c:656
+#: src/lib/ecore/ecore_getopt.c:657
msgid "Options:\n"
msgstr "Možnosti:\n"
-#: src/lib/ecore/ecore_getopt.c:781
+#: src/lib/ecore/ecore_getopt.c:782
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "NAPAKA:·Neznana možnost·--%s.\n"
-#: src/lib/ecore/ecore_getopt.c:783
+#: src/lib/ecore/ecore_getopt.c:784
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "NAPAKA:·neznana možnost·-%c.\n"
-#: src/lib/ecore/ecore_getopt.c:841
+#: src/lib/ecore/ecore_getopt.c:842
msgid "ERROR: "
msgstr "NAPAKA:"
-#: src/lib/ecore/ecore_getopt.c:924 src/lib/ecore/ecore_getopt.c:1061
-#: src/lib/ecore/ecore_getopt.c:1077 src/lib/ecore/ecore_getopt.c:1092
-#: src/lib/ecore/ecore_getopt.c:1109 src/lib/ecore/ecore_getopt.c:1156
-#: src/lib/ecore/ecore_getopt.c:1276 src/lib/ecore/ecore_getopt.c:1317
+#: src/lib/ecore/ecore_getopt.c:925 src/lib/ecore/ecore_getopt.c:1062
+#: src/lib/ecore/ecore_getopt.c:1078 src/lib/ecore/ecore_getopt.c:1093
+#: src/lib/ecore/ecore_getopt.c:1110 src/lib/ecore/ecore_getopt.c:1157
+#: src/lib/ecore/ecore_getopt.c:1277 src/lib/ecore/ecore_getopt.c:1318
msgid "value has no pointer set.\n"
msgstr "vrednost nima nastavljenega kazalnika.\n"
-#: src/lib/ecore/ecore_getopt.c:956 src/lib/ecore/ecore_getopt.c:1176
+#: src/lib/ecore/ecore_getopt.c:957 src/lib/ecore/ecore_getopt.c:1177
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "neznana Boolova vrednost·%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1007 src/lib/ecore/ecore_getopt.c:1264
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1265
#, c-format
msgid "invalid number format %s\n"
msgstr "napačen·format števila·%s\n"
-#: src/lib/ecore/ecore_getopt.c:1122
+#: src/lib/ecore/ecore_getopt.c:1123
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "napačna izbira·\"%s\".·Pravilne izbire so:·"
-#: src/lib/ecore/ecore_getopt.c:1150
+#: src/lib/ecore/ecore_getopt.c:1151
msgid "missing parameter to append.\n"
msgstr "manjka·parameter·za dodajo.\n"
-#: src/lib/ecore/ecore_getopt.c:1254
+#: src/lib/ecore/ecore_getopt.c:1255
msgid "could not parse value.\n"
msgstr "vrednosti ni bilo možno razčleniti.\n"
-#: src/lib/ecore/ecore_getopt.c:1311
+#: src/lib/ecore/ecore_getopt.c:1312
msgid "missing parameter.\n"
msgstr "manjkajoči·parameter.\n"
-#: src/lib/ecore/ecore_getopt.c:1324
+#: src/lib/ecore/ecore_getopt.c:1325
msgid "missing callback function!\n"
msgstr "manjkajoča povratno-zasilna funkcija !\n"
-#: src/lib/ecore/ecore_getopt.c:1353
+#: src/lib/ecore/ecore_getopt.c:1354
msgid "no version was defined.\n"
msgstr "definirana ni bila nobena različica.\n"
-#: src/lib/ecore/ecore_getopt.c:1370
+#: src/lib/ecore/ecore_getopt.c:1371
msgid "no copyright was defined.\n"
msgstr "definirano ni bilo nobeno avtorstvo.\n"
-#: src/lib/ecore/ecore_getopt.c:1387
+#: src/lib/ecore/ecore_getopt.c:1388
msgid "no license was defined.\n"
msgstr "definirana ni bila nobena licenca.\n"
-#: src/lib/ecore/ecore_getopt.c:1462
+#: src/lib/ecore/ecore_getopt.c:1463
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "NAPAKA:·neznana možnost·--%s,·prezrto.\n"
-#: src/lib/ecore/ecore_getopt.c:1495
+#: src/lib/ecore/ecore_getopt.c:1496
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "NAPAKA:·možnost·--%s·zahteva argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1537
+#: src/lib/ecore/ecore_getopt.c:1538
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "NAPAKA:·neznana možnost·-%c,·prezrto.\n"
-#: src/lib/ecore/ecore_getopt.c:1575
+#: src/lib/ecore/ecore_getopt.c:1576
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "NAPAKA:·možnost·-%c zahteva argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1784
+#: src/lib/ecore/ecore_getopt.c:1785
msgid "ERROR: no parser provided.\n"
msgstr "NAPAKA:·ni podan razčlenjevalnik.\n"
-#: src/lib/ecore/ecore_getopt.c:1789
+#: src/lib/ecore/ecore_getopt.c:1790
msgid "ERROR: no values provided.\n"
msgstr "NAPAKA::·ni podanih vrednosti.\n"
-#: src/lib/ecore/ecore_getopt.c:1798
+#: src/lib/ecore/ecore_getopt.c:1799
msgid "ERROR: no arguments provided.\n"
msgstr "NAPAKA::·ni podanih argumentov.\n"
-#: src/lib/ecore/ecore_getopt.c:1824
+#: src/lib/ecore/ecore_getopt.c:1825
msgid "ERROR: invalid options found."
msgstr "NAPAKA::·najdene nepravilne možnosti"
-#: src/lib/ecore/ecore_getopt.c:1830
+#: src/lib/ecore/ecore_getopt.c:1831
#, c-format
msgid " See --%s.\n"
msgstr "·Glej·--%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1832
+#: src/lib/ecore/ecore_getopt.c:1833
#, c-format
msgid " See -%c.\n"
msgstr "·Glej·-%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1873
+#: src/lib/ecore/ecore_getopt.c:1874
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "NAPAKA::·nepravilna geometrijska vrednost·'%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1900
+#: src/lib/ecore/ecore_getopt.c:1901
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "NAPAKA::·nepravilna vrednost velikosti·'%s'\n"
MAINTAINERCLEANFILES = Makefile.in
-pkglibdir = $(datadir)/$(PACKAGE)/examples
+examplesdir = $(datadir)/$(PACKAGE)/examples
filesdir = $(datadir)/$(PACKAGE)/examples
files_DATA =
EXTRA_DIST = $(SRCS) \
$(srcdir)/red.png
-pkglib_PROGRAMS =
+examples_PROGRAMS =
if EFL_INSTALL_EXAMPLES
files_DATA += $(SRCS) \
endif
if EFL_BUILD_EXAMPLES
-pkglib_PROGRAMS += \
+examples_PROGRAMS += \
ecore_animator_example \
ecore_fd_handler_example \
ecore_poller_example \
SUBDIRS += ecore_cocoa
endif
+if BUILD_ECORE_WAYLAND
+SUBDIRS += ecore_wayland
+endif
+
if BUILD_ECORE_IPC
SUBDIRS += ecore_ipc
endif
@mainpage Ecore
@version 1.1
- @date 2000-2011
+ @date 2000-2012
Please see the @ref authors page for contact details.
pkgconfig (.pc) files are installed for every ecore module.
Thus, to compile using any of them, you can use something like the following:
- @verbatim
- gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs)
- @endverbatim
+@verbatim
+gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs)
+@endverbatim
@section install How is it installed?
- Suggested configure options for evas for a Linux desktop X display:
+ Suggested configure options for ecore for a Linux desktop X display
+ with OpenGL and Software support, communication (networking) and
+ IPC (inter process communication):
- @verbatim
- ./configure \
- make
- su -
- ...
- make install
- @endverbatim
+@verbatim
+./configure \
+ --enable-ecore-con \
+ --enable-ecore-ipc \
+ --enable-ecore-file \
+ --enable-ecore-input \
+ --enable-ecore-input-evas \
+ --enable-ecore-x \
+ --enable-ecore-evas \
+ --enable-ecore-evas-software-buffer \
+ --enable-ecore-evas-software-x11 \
+ --enable-ecore-evas-opengl-x11
+make
+sudo make install
+@endverbatim
*/
@author Mike McCormack <mj.mccormack@samsung.com>
@author Sangho Park <gouache95@gmail.com>
@author Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
+ @author PnB <Poor.NewBie@gmail.com>
@author Daniel Juyung Seo <seojuyung2@gmail.com> <juyung.seo@samsung.com>
+ @author Christopher 'devilhorns' Michael <cpmichael1@comcast.net>
+ @author ChunEon Park <hermet@hermet.pe.kr>
+ @author xlopez@igalia.com
+ @author Rafael Antognolli <antognolli@profusion.mobi>
+ @author Kim Yunhan <spbear@gmail.com>
+ @author Youness Alaoui <kakaroto@kakaroto.homelinux.net>
+ @author Bluezery <ohpowel@gmail.com>
+ @author Doyoun Kang <wayofmine@gmail.com> <doyoun.kang@samsung.com>
+ @author Haifeng Deng <haifeng.deng@samsung.com>
Please contact <enlightenment-devel@lists.sourceforge.net> to get in
contact with the developers and maintainers.
*/
-/*
+/**
@page Ecore_Main_Loop_Page The Ecore Main Loop
@section intro What is Ecore?
* @{
*/
-EAPI int
- ecore_init(void);
-EAPI int
- ecore_shutdown(void);
+EAPI int ecore_init(void);
+EAPI int ecore_shutdown(void);
/**
* @}
typedef Eina_Bool (*Ecore_Task_Cb)(void *data);
/**
- * @typedef Ecore_Eselect_Function Ecore_Eselect_Function
+ * @typedef Ecore_Eselect_Function
* A function which can be used to replace select() in the main loop
*/
typedef int (*Ecore_Select_Function)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
-EAPI void
-ecore_main_loop_iterate(void);
+EAPI void ecore_main_loop_iterate(void);
-EAPI void
- ecore_main_loop_select_func_set(Ecore_Select_Function func);
-EAPI Ecore_Select_Function
- ecore_main_loop_select_func_get(void);
+EAPI void ecore_main_loop_select_func_set(Ecore_Select_Function func);
+EAPI Ecore_Select_Function ecore_main_loop_select_func_get(void);
-EAPI Eina_Bool
- ecore_main_loop_glib_integrate(void);
-EAPI void
- ecore_main_loop_glib_always_integrate_disable(void);
+EAPI Eina_Bool ecore_main_loop_glib_integrate(void);
+EAPI void ecore_main_loop_glib_always_integrate_disable(void);
-EAPI void
- ecore_main_loop_begin(void);
-EAPI void
- ecore_main_loop_quit(void);
+EAPI void ecore_main_loop_begin(void);
+EAPI void ecore_main_loop_quit(void);
/**
* @typedef Ecore_Cb Ecore_Cb
* in the thread, it is owned by the main loop and your callback should take
* care of freeing it if necessary.
*/
-EAPI void
-ecore_main_loop_thread_safe_call_async(Ecore_Cb callback,
- void *data);
+EAPI void ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, void *data);
/**
* @brief Call callback synchronously in the main loop.
* Remember this function will block until the callback is executed in the
* main loop. It can take time and you have no guaranty about the timeline.
*/
-EAPI void *
-ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback,
- void *data);
+EAPI void *ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, void *data);
/**
* @brief This function suspend the main loop in a know state
* We still advise you, when possible, to use ecore_main_loop_thread_safe_call_async()
* as it will not block the thread nor the main loop.
*/
-EAPI int
-ecore_thread_main_loop_begin(void);
+EAPI int ecore_thread_main_loop_begin(void);
/**
* @brief Unlock the main loop.
* After a call to ecore_thread_main_loop_begin(), you need to absolutly
* call ecore_thread_main_loop_end(), or you application will stay frozen.
*/
-EAPI int
-ecore_thread_main_loop_end(void);
+EAPI int ecore_thread_main_loop_end(void);
/**
* @}
#endif
};
-EAPI Ecore_Event_Handler *
-ecore_event_handler_add(int type,
- Ecore_Event_Handler_Cb func,
- const void *data);
-EAPI void *
- ecore_event_handler_del(Ecore_Event_Handler *event_handler);
-EAPI Ecore_Event *
- ecore_event_add(int type,
- void *ev,
- Ecore_End_Cb func_free,
- void *data);
-EAPI void *
- ecore_event_del(Ecore_Event *event);
-EAPI void *
- ecore_event_handler_data_get(Ecore_Event_Handler *eh);
-EAPI void *
- ecore_event_handler_data_set(Ecore_Event_Handler *eh,
- const void *data);
-EAPI int
- ecore_event_type_new(void);
-EAPI Ecore_Event_Filter *
- ecore_event_filter_add(Ecore_Data_Cb func_start,
- Ecore_Filter_Cb func_filter,
- Ecore_End_Cb func_end,
- const void *data);
-EAPI void *
- ecore_event_filter_del(Ecore_Event_Filter *ef);
-EAPI int
- ecore_event_current_type_get(void);
-EAPI void *
- ecore_event_current_event_get(void);
+EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data);
+EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler);
+EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
+EAPI void *ecore_event_del(Ecore_Event *event);
+EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh);
+EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data);
+EAPI int ecore_event_type_new(void);
+EAPI Ecore_Event_Filter *ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data);
+EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef);
+EAPI int ecore_event_current_type_get(void);
+EAPI void *ecore_event_current_event_get(void);
/**
* @}
enum _Ecore_Exe_Win32_Priority
{
- ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */
- ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */
- ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */
- ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */
- ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */
+ ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */
+ ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */
+ ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */
+ ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */
+ ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */
ECORE_EXE_WIN32_PRIORITY_REALTIME /**< Realtime priority, should be almost never used as it can interrupt system threads that manage mouse input, keyboard input, and background disk flushing */
};
typedef enum _Ecore_Exe_Win32_Priority Ecore_Exe_Win32_Priority;
Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */
};
-EAPI void
- ecore_exe_run_priority_set(int pri);
-EAPI int
- ecore_exe_run_priority_get(void);
-EAPI Ecore_Exe *
- ecore_exe_run(const char *exe_cmd,
- const void *data);
-EAPI Ecore_Exe *
-ecore_exe_pipe_run(const char *exe_cmd,
- Ecore_Exe_Flags flags,
- const void *data);
-EAPI void
-ecore_exe_callback_pre_free_set(Ecore_Exe *exe,
- Ecore_Exe_Cb func);
-EAPI Eina_Bool
-ecore_exe_send(Ecore_Exe *exe,
- const void *data,
- int size);
-EAPI void
- ecore_exe_close_stdin(Ecore_Exe *exe);
-EAPI void
- ecore_exe_auto_limits_set(Ecore_Exe *exe,
- int start_bytes,
- int end_bytes,
- int start_lines,
- int end_lines);
-EAPI Ecore_Exe_Event_Data *
-ecore_exe_event_data_get(Ecore_Exe *exe,
- Ecore_Exe_Flags flags);
-EAPI void
- ecore_exe_event_data_free(Ecore_Exe_Event_Data *data);
-EAPI void *
- ecore_exe_free(Ecore_Exe *exe);
-EAPI pid_t
- ecore_exe_pid_get(const Ecore_Exe *exe);
-EAPI void
- ecore_exe_tag_set(Ecore_Exe *exe,
- const char *tag);
-EAPI const char *
- ecore_exe_tag_get(const Ecore_Exe *exe);
-EAPI const char *
- ecore_exe_cmd_get(const Ecore_Exe *exe);
-EAPI void *
- ecore_exe_data_get(const Ecore_Exe *exe);
-EAPI void *
- ecore_exe_data_set(Ecore_Exe *exe,
- void *data);
-EAPI Ecore_Exe_Flags
- ecore_exe_flags_get(const Ecore_Exe *exe);
-EAPI void
- ecore_exe_pause(Ecore_Exe *exe);
-EAPI void
- ecore_exe_continue(Ecore_Exe *exe);
-EAPI void
- ecore_exe_interrupt(Ecore_Exe *exe);
-EAPI void
- ecore_exe_quit(Ecore_Exe *exe);
-EAPI void
- ecore_exe_terminate(Ecore_Exe *exe);
-EAPI void
- ecore_exe_kill(Ecore_Exe *exe);
-EAPI void
- ecore_exe_signal(Ecore_Exe *exe,
- int num);
-EAPI void
-ecore_exe_hup(Ecore_Exe *exe);
+EAPI void ecore_exe_run_priority_set(int pri);
+EAPI int ecore_exe_run_priority_get(void);
+EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
+EAPI Ecore_Exe *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data);
+EAPI void ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func);
+EAPI Eina_Bool ecore_exe_send(Ecore_Exe *exe, const void *data, int size);
+EAPI void ecore_exe_close_stdin(Ecore_Exe *exe);
+EAPI void ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines);
+EAPI Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags);
+EAPI void ecore_exe_event_data_free(Ecore_Exe_Event_Data *data);
+EAPI void *ecore_exe_free(Ecore_Exe *exe);
+EAPI pid_t ecore_exe_pid_get(const Ecore_Exe *exe);
+EAPI void ecore_exe_tag_set(Ecore_Exe *exe, const char *tag);
+EAPI const char *ecore_exe_tag_get(const Ecore_Exe *exe);
+EAPI const char *ecore_exe_cmd_get(const Ecore_Exe *exe);
+EAPI void *ecore_exe_data_get(const Ecore_Exe *exe);
+EAPI void *ecore_exe_data_set(Ecore_Exe *exe, void *data);
+EAPI Ecore_Exe_Flags ecore_exe_flags_get(const Ecore_Exe *exe);
+EAPI void ecore_exe_pause(Ecore_Exe *exe);
+EAPI void ecore_exe_continue(Ecore_Exe *exe);
+EAPI void ecore_exe_interrupt(Ecore_Exe *exe);
+EAPI void ecore_exe_quit(Ecore_Exe *exe);
+EAPI void ecore_exe_terminate(Ecore_Exe *exe);
+EAPI void ecore_exe_kill(Ecore_Exe *exe);
+EAPI void ecore_exe_signal(Ecore_Exe *exe, int num);
+EAPI void ecore_exe_hup(Ecore_Exe *exe);
/**
* @}
* for data available for reading, for the availability to write
* without blocking, and for errors on the file descriptor.
*
- * ecore_main_fd_handler_add() is used to setup a handler for a
+ *ecore_main_fd_handler_add() is used to setup a handler for a
* given file descriptor. This file descriptor can be the standard
* input, a network socket, a stream received through some driver
* of a hardware decoder, etc. Thus it can contain errors, like a
*/
typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh);
-EAPI Ecore_Fd_Handler *
-ecore_main_fd_handler_add(int fd,
- Ecore_Fd_Handler_Flags flags,
- Ecore_Fd_Cb func,
- const void *data,
- Ecore_Fd_Cb buf_func,
- const void *buf_data);
-EAPI void
-ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler,
- Ecore_Fd_Prep_Cb func,
- const void *data);
-EAPI void *
- ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
-EAPI int
- ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
-EAPI Eina_Bool
- ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler,
- Ecore_Fd_Handler_Flags flags);
-EAPI void
-ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler,
- Ecore_Fd_Handler_Flags flags);
-
-EAPI Ecore_Win32_Handler *
-ecore_main_win32_handler_add(void *h,
- Ecore_Win32_Handle_Cb func,
- const void *data);
-EAPI void *
-ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler);
+EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data);
+EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data);
+EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
+EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
+EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
+EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
+
+EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data);
+EAPI void *ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler);
/**
* @}
* areound a core poll interval. For now only 1 core poller type is
* supprted: ECORE_POLLER_CORE
*
- * Example of @ref Ecore_Poller:
+ * Example of @ref Ecore_Poller :
* @li @ref ecore_poller_example_c
*
* @ingroup Ecore_Main_Loop_Group
typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */
-EAPI void
-ecore_poller_poll_interval_set(Ecore_Poller_Type type,
- double poll_time);
-EAPI double
- ecore_poller_poll_interval_get(Ecore_Poller_Type type);
-EAPI Eina_Bool
- ecore_poller_poller_interval_set(Ecore_Poller *poller,
- int interval);
-EAPI int
- ecore_poller_poller_interval_get(Ecore_Poller *poller);
-EAPI Ecore_Poller *
- ecore_poller_add(Ecore_Poller_Type type,
- int interval,
- Ecore_Task_Cb func,
- const void *data);
+EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time);
+EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type);
+EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval);
+EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller);
+EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data);
EAPI void *ecore_poller_del(Ecore_Poller *poller);
/**
* ... do some more animating ...
* }
* ...
- * ecore_animator_timeline_add(2, _do_animation, my_evas_object);
+ *ecore_animator_timeline_add(2, _do_animation, my_evas_object);
* @endcode
* In the sample above we create an animation to move
* @c my_evas_object from position (0,0) to (100,100) in 2 seconds.
*
* If your animation will run for an unspecified amount of time you
* can use ecore_animator_add(), which is like using
- * ecore_timer_add() with the interval being the
+ *ecore_timer_add() with the interval being the
* @ref ecore_animator_frametime_set "framerate". Note that this has
* tangible benefits to creating a timer for each animation in terms
* of performance.
* @see ecore_animator_timeline_add()
* @see ecore_animator_frametime_set()
*/
-EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func,
- const void *data);
+EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data);
/**
* @brief Add a animator that runs for a limited time
*
* @see ecore_animator_pos_map()
* @since 1.1.0
*/
-EAPI Ecore_Animator *
-ecore_animator_timeline_add(double runtime,
- Ecore_Timeline_Cb func,
- const void *data);
+EAPI Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data);
/**
* @brief Delete the specified animator from the animator list.
*
* is invalid and should not be used again. It will not get called again after
* deletion.
*/
-EAPI void *
-ecore_animator_del(Ecore_Animator *animator);
+EAPI void *ecore_animator_del(Ecore_Animator *animator);
/**
* @brief Suspend the specified animator.
*
*
* @warning Freezing an animator doesn't freeze accounting of how long that
* animator has been running. Therefore if the animator was created with
- * ecore_animator_timeline_add() the @p pos argument given to the callback
+ *ecore_animator_timeline_add() the @p pos argument given to the callback
* will increase as if the animator hadn't been frozen and the animator may
* have it's execution halted if @p runtime elapsed.
*/
-EAPI void
-ecore_animator_freeze(Ecore_Animator *animator);
+EAPI void ecore_animator_freeze(Ecore_Animator *animator);
/**
* @brief Restore execution of the specified animator.
*
* The specified @p animator will be put back in the set of animators that are
* executed during main loop.
*/
-EAPI void
-ecore_animator_thaw(Ecore_Animator *animator);
+EAPI void ecore_animator_thaw(Ecore_Animator *animator);
/**
* @brief Set the animator call interval in seconds.
*
*
* @note The default @p frametime value is 1/30th of a second.
*/
-EAPI void
-ecore_animator_frametime_set(double frametime);
+EAPI void ecore_animator_frametime_set(double frametime);
/**
* @brief Get the animator call interval in seconds.
*
*
* @see ecore_animator_frametime_set()
*/
-EAPI double
-ecore_animator_frametime_get(void);
+EAPI double ecore_animator_frametime_get(void);
/**
* @brief Maps an input position from 0.0 to 1.0 along a timeline to a
* position in a different curve.
*
* @since 1.1.0
*/
-EAPI double
-ecore_animator_pos_map(double pos,
- Ecore_Pos_Map map,
- double v1,
- double v2);
+EAPI double ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2);
/**
* @brief Set the source of animator ticks for the mainloop
*
* ECORE_ANIMATOR_SOURCE_CUSTOM and then drive it yourself based on some input
* tick source (like another application via ipc, some vertical blanking
* interrupt interrupt etc.) using
- * ecore_animator_custom_source_tick_begin_callback_set() and
- * ecore_animator_custom_source_tick_end_callback_set() to set the functions
+ *ecore_animator_custom_source_tick_begin_callback_set() and
+ *ecore_animator_custom_source_tick_end_callback_set() to set the functions
* that will be called to start and stop the ticking source, which when it
* gets a "tick" should call ecore_animator_custom_tick() to make the "tick" over 1
* frame.
*/
-EAPI void
-ecore_animator_source_set(Ecore_Animator_Source source);
+EAPI void ecore_animator_source_set(Ecore_Animator_Source source);
/**
* @brief Get the animator source currently set.
*
*
* @see ecore_animator_source_set()
*/
-EAPI Ecore_Animator_Source
-ecore_animator_source_get(void);
+EAPI Ecore_Animator_Source ecore_animator_source_get(void);
/**
* @brief Set the function that begins a custom animator tick source
*
* The Ecore Animator infrastructure handles tracking if animators are needed
* or not and which ones need to be called and when, but when the tick source
* is custom, you have to provide a tick source by calling
- * ecore_animator_custom_tick() to indicate a frame tick happened. In order
+ *ecore_animator_custom_tick() to indicate a frame tick happened. In order
* to allow the source of ticks to be dynamically enabled or disabled as
* needed, the @p func when set is called to enable the tick source to
* produce tick events that call ecore_animator_custom_tick(). If @p func
* @see ecore_animator_custom_source_tick_end_callback_set()
* @see ecore_animator_custom_tick()
*/
-EAPI void
-ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func,
- const void *data);
+EAPI void ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data);
/**
* @brief Set the function that ends a custom animator tick source
*
* @param data The data passed to the tick end function as its parameter
*
* This function is a matching pair to the function set by
- * ecore_animator_custom_source_tick_begin_callback_set() and is called
+ *ecore_animator_custom_source_tick_begin_callback_set() and is called
* when ticking is to stop. If @p func is NULL then no function will be
* called to stop ticking. For more information please see
- * ecore_animator_custom_source_tick_begin_callback_set().
+ *ecore_animator_custom_source_tick_begin_callback_set().
*
* @see ecore_animator_source_set()
* @see ecore_animator_custom_source_tick_begin_callback_set()
* @see ecore_animator_custom_tick()
*/
-EAPI void
-ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func,
- const void *data);
+EAPI void ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data);
/**
* @brief Trigger a custom animator tick
*
* @see ecore_animator_custom_source_tick_begin_callback_set
* @see ecore_animator_custom_source_tick_end_callback_set()()
*/
-EAPI void
-ecore_animator_custom_tick(void);
+EAPI void ecore_animator_custom_tick(void);
/**
* @}
typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */
-EAPI double
- ecore_time_get(void);
-EAPI double
- ecore_time_unix_get(void);
-EAPI double
- ecore_loop_time_get(void);
-
-EAPI Ecore_Timer *
-ecore_timer_add(double in,
- Ecore_Task_Cb func,
- const void *data);
-EAPI Ecore_Timer *
-ecore_timer_loop_add(double in,
- Ecore_Task_Cb func,
- const void *data);
-EAPI void *
- ecore_timer_del(Ecore_Timer *timer);
-EAPI void
- ecore_timer_interval_set(Ecore_Timer *timer,
- double in);
-EAPI double
- ecore_timer_interval_get(Ecore_Timer *timer);
-EAPI void
- ecore_timer_freeze(Ecore_Timer *timer);
-EAPI void
- ecore_timer_thaw(Ecore_Timer *timer);
-EAPI void
- ecore_timer_delay(Ecore_Timer *timer,
- double add);
-EAPI double
- ecore_timer_pending_get(Ecore_Timer *timer);
-EAPI double
- ecore_timer_precision_get(void);
-EAPI void
- ecore_timer_precision_set(double precision);
-EAPI char *
- ecore_timer_dump(void);
+EAPI double ecore_time_get(void);
+EAPI double ecore_time_unix_get(void);
+EAPI double ecore_loop_time_get(void);
+
+EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data);
+EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
+EAPI void *ecore_timer_del(Ecore_Timer *timer);
+EAPI void ecore_timer_interval_set(Ecore_Timer *timer, double in);
+EAPI double ecore_timer_interval_get(Ecore_Timer *timer);
+EAPI void ecore_timer_freeze(Ecore_Timer *timer);
+EAPI void ecore_timer_thaw(Ecore_Timer *timer);
+EAPI void ecore_timer_delay(Ecore_Timer *timer, double add);
+EAPI void ecore_timer_reset(Ecore_Timer *timer);
+EAPI double ecore_timer_pending_get(Ecore_Timer *timer);
+EAPI double ecore_timer_precision_get(void);
+EAPI void ecore_timer_precision_set(double precision);
+EAPI char *ecore_timer_dump(void);
/**
* @}
*
* Idlers are useful for progressively prossessing data without blocking.
*/
-EAPI Ecore_Idler *
-ecore_idler_add(Ecore_Task_Cb func,
- const void *data);
+EAPI Ecore_Idler *ecore_idler_add(Ecore_Task_Cb func, const void *data);
/**
* Delete an idler callback from the list to be executed.
* @return The data pointer passed to the idler callback on success. NULL
* otherwise.
*/
-EAPI void *
-ecore_idler_del(Ecore_Idler *idler);
+EAPI void *ecore_idler_del(Ecore_Idler *idler);
-EAPI Ecore_Idle_Enterer *
-ecore_idle_enterer_add(Ecore_Task_Cb func,
- const void *data);
-EAPI Ecore_Idle_Enterer *
-ecore_idle_enterer_before_add(Ecore_Task_Cb func,
- const void *data);
-EAPI void *
-ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
+EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data);
+EAPI Ecore_Idle_Enterer *ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data);
+EAPI void *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
-EAPI Ecore_Idle_Exiter *
-ecore_idle_exiter_add(Ecore_Task_Cb func,
- const void *data);
-EAPI void *
-ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
+EAPI Ecore_Idle_Exiter *ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data);
+EAPI void *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
/**
* @}
*
* The worker function, that's the one running in the thread, also receives
* an ::Ecore_Thread handler that can be used with ecore_thread_cancel() and
- * ecore_thread_check(), sharing the flag with the main loop. But this
+ *ecore_thread_check(), sharing the flag with the main loop. But this
* handler is also associated with the thread where the function is running.
* This has strong implications when working with thread local data.
*
* so here it's safe to use anything from the EFL freely.
*
* The thread can also be cancelled before its completion calling
- * ecore_thread_cancel(), either from the main thread or @p func_blocking.
+ *ecore_thread_cancel(), either from the main thread or @p func_blocking.
* In this case, @p func_cancel will be called, also from the main thread
* to inform of this happening. If the thread could not be created, this
* function will be called and it's @c thread parameter will be NULL. It's
* @see ecore_thread_reschedule()
* @see ecore_thread_max_set()
*/
-EAPI Ecore_Thread *
-ecore_thread_run(Ecore_Thread_Cb func_blocking,
- Ecore_Thread_Cb func_end,
- Ecore_Thread_Cb func_cancel,
- const void *data);
+EAPI Ecore_Thread *ecore_thread_run(Ecore_Thread_Cb func_blocking, Ecore_Thread_Cb func_end, Ecore_Thread_Cb func_cancel, const void *data);
/**
* Launch a thread to run a task than can talk back to the main thread
*
* @see ecore_thread_reschedule()
* @see ecore_thread_max_set()
*/
-EAPI Ecore_Thread *
-ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
- Ecore_Thread_Notify_Cb func_notify,
- Ecore_Thread_Cb func_end,
- Ecore_Thread_Cb func_cancel,
- const void *data,
- Eina_Bool try_no_queue);
+EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, Ecore_Thread_Notify_Cb func_notify,
+ Ecore_Thread_Cb func_end, Ecore_Thread_Cb func_cancel,
+ const void *data, Eina_Bool try_no_queue);
/**
* Cancel a running thread.
*
* @li The function ends and returns normally. If it hadn't been cancelled,
* @c func_end would be called here, but instead @c func_cancel will happen.
* @li The function returns after requesting to be rescheduled with
- * ecore_thread_reschedule().
+ *ecore_thread_reschedule().
* @li The function is prepared to leave early by checking if
- * ecore_thread_check() returns EINA_TRUE.
+ *ecore_thread_check() returns EINA_TRUE.
*
* The user function can cancel itself by calling ecore_thread_cancel(), but
* it should always use the ::Ecore_Thread handle passed to it and never
*
* @see ecore_thread_check()
*/
-EAPI Eina_Bool
-ecore_thread_cancel(Ecore_Thread *thread);
+EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread);
/**
* Checks if a thread is pending cancellation
*
*
* @see ecore_thread_cancel()
*/
-EAPI Eina_Bool
-ecore_thread_check(Ecore_Thread *thread);
+EAPI Eina_Bool ecore_thread_check(Ecore_Thread *thread);
/**
* Sends data from the worker thread to the main loop
*
*
* @see ecore_thread_feedback_run()
*/
-EAPI Eina_Bool
-ecore_thread_feedback(Ecore_Thread *thread,
- const void *msg_data);
+EAPI Eina_Bool ecore_thread_feedback(Ecore_Thread *thread, const void *msg_data);
/**
* Asks for the function in the thread to be called again at a later time
*
* EINA_FALSE if anything goes wrong.
*
* This function should be called only from the same function represented
- * by @pthread.
+ * by @p thread.
*
* Calling this function will mark the thread for a reschedule, so as soon
* as it returns, it will be added to the end of the list of pending tasks.
* Similarly, if the @p thread is cancelled, the reschedule will not take
* effect.
*/
-EAPI Eina_Bool
-ecore_thread_reschedule(Ecore_Thread *thread);
+EAPI Eina_Bool ecore_thread_reschedule(Ecore_Thread *thread);
/**
* Gets the number of active threads running jobs
*
* in the return of this function unless the thread creation fails and it
* falls back to using one from the pool.
*/
-EAPI int
-ecore_thread_active_get(void);
+EAPI int ecore_thread_active_get(void);
/**
* Gets the number of short jobs waiting for a thread to run
*
* This returns the number of tasks started with ecore_thread_run() that are
* pending, waiting for a thread to become available to run them.
*/
-EAPI int
-ecore_thread_pending_get(void);
+EAPI int ecore_thread_pending_get(void);
/**
* Gets the number of feedback jobs waiting for a thread to run
*
* This returns the number of tasks started with ecore_thread_feedback_run()
* that are pending, waiting for a thread to become available to run them.
*/
-EAPI int
-ecore_thread_pending_feedback_get(void);
+EAPI int ecore_thread_pending_feedback_get(void);
/**
* Gets the total number of pending jobs
*
* @return Number of pending threads running jobs
*
* Same as the sum of ecore_thread_pending_get() and
- * ecore_thread_pending_feedback_get().
+ *ecore_thread_pending_feedback_get().
*/
-EAPI int
-ecore_thread_pending_total_get(void);
+EAPI int ecore_thread_pending_total_get(void);
/**
* Gets the maximum number of threads that can run simultaneously
*
*
* This returns the maximum number of Ecore_Thread's that may be running at
* the same time. If this number is reached, new jobs started by either
- * ecore_thread_run() or ecore_thread_feedback_run() will be added to the
+ *ecore_thread_run() or ecore_thread_feedback_run() will be added to the
* respective pending queue until one of the running threads finishes its
* task and becomes available to run a new one.
*
* @see ecore_thread_max_set()
* @see ecore_thread_max_reset()
*/
-EAPI int
-ecore_thread_max_get(void);
+EAPI int ecore_thread_max_get(void);
/**
* Sets the maximum number of threads allowed to run simultaneously
*
* @see ecore_thread_max_get()
* @see ecore_thread_max_reset()
*/
-EAPI void
-ecore_thread_max_set(int num);
+EAPI void ecore_thread_max_set(int num);
/**
* Resets the maximum number of concurrently running threads to the default
*
* @see ecore_thread_max_get()
* @see ecore_thread_max_set()
*/
-EAPI void
-ecore_thread_max_reset(void);
+EAPI void ecore_thread_max_reset(void);
/**
* Gets the number of threads available for running tasks
*
* changed the maximum number of running threads while other tasks are
* running.
*/
-EAPI int
-ecore_thread_available_get(void);
+EAPI int ecore_thread_available_get(void);
/**
* Adds some data to a hash local to the thread
*
* because @p thread was terminated and the hash destroyed. This parameter
* may be NULL, in which case @p value needs to be manually freed after
* removing it from the hash with either ecore_thread_local_data_del() or
- * ecore_thread_local_data_set(), but it's very unlikely that this is what
+ *ecore_thread_local_data_set(), but it's very unlikely that this is what
* you want.
*
* This function, and all of the others in the @c ecore_thread_local_data
* @see ecore_thread_local_data_find()
* @see ecore_thread_local_data_del()
*/
-EAPI Eina_Bool
-ecore_thread_local_data_add(Ecore_Thread *thread,
- const char *key,
- void *value,
- Eina_Free_Cb cb,
- Eina_Bool direct);
+EAPI Eina_Bool ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value,
+ Eina_Free_Cb cb, Eina_Bool direct);
/**
* Sets some data in the hash local to the given thread
*
* @see ecore_thread_local_data_del()
* @see ecore_thread_local_data_find()
*/
-EAPI void *
-ecore_thread_local_data_set(Ecore_Thread *thread,
- const char *key,
- void *value,
- Eina_Free_Cb cb);
+EAPI void *ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb);
/**
* Gets data stored in the hash local to the given thread
*
* @see ecore_thread_local_data_add()
* @see ecore_thread_local_data_wait()
*/
-EAPI void *
-ecore_thread_local_data_find(Ecore_Thread *thread,
- const char *key);
+EAPI void *ecore_thread_local_data_find(Ecore_Thread *thread, const char *key);
/**
* Deletes from the thread's hash the data corresponding to the given key
*
*
* @see ecore_thread_local_data_add()
*/
-EAPI Eina_Bool
-ecore_thread_local_data_del(Ecore_Thread *thread,
- const char *key);
+EAPI Eina_Bool ecore_thread_local_data_del(Ecore_Thread *thread, const char *key);
/**
* Adds some data to a hash shared by all threads
* because Ecore Thread was shut down and the hash destroyed. This parameter
* may be NULL, in which case @p value needs to be manually freed after
* removing it from the hash with either ecore_thread_global_data_del() or
- * ecore_thread_global_data_set().
+ *ecore_thread_global_data_set().
*
* Manually freeing any data that was added to the hash with a @p cb function
* is likely to produce a segmentation fault, or any other strange
* @see ecore_thread_global_data_set()
* @see ecore_thread_global_data_find()
*/
-EAPI Eina_Bool
-ecore_thread_global_data_add(const char *key,
- void *value,
- Eina_Free_Cb cb,
- Eina_Bool direct);
+EAPI Eina_Bool ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct);
/**
* Sets some data in the hash shared by all threads
*
* @see ecore_thread_global_data_del()
* @see ecore_thread_global_data_find()
*/
-EAPI void *
-ecore_thread_global_data_set(const char *key,
- void *value,
- Eina_Free_Cb cb);
+EAPI void *ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb);
/**
* Gets data stored in the hash shared by all threads
*
* @see ecore_thread_global_data_add()
* @see ecore_thread_global_data_wait()
*/
-EAPI void *
-ecore_thread_global_data_find(const char *key);
+EAPI void *ecore_thread_global_data_find(const char *key);
/**
* Deletes from the shared hash the data corresponding to the given key
*
*
* @see ecore_thread_global_data_add()
*/
-EAPI Eina_Bool
-ecore_thread_global_data_del(const char *key);
+EAPI Eina_Bool ecore_thread_global_data_del(const char *key);
/**
* Gets data stored in the shared hash, or wait for it if it doesn't exist
*
* If there's nothing in the hash under the given @p key, the function
* will block and wait up to @p seconds seconds for some other thread to
* add it with either ecore_thread_global_data_add() or
- * ecore_thread_global_data_set(). If after waiting there's still no data
+ *ecore_thread_global_data_set(). If after waiting there's still no data
* to get, NULL will be returned.
*
* If @p seconds is 0, then no waiting will happen and this function works
* @see ecore_thread_global_data_add()
* @see ecore_thread_global_data_find()
*/
-EAPI void *
-ecore_thread_global_data_wait(const char *key,
- double seconds);
+EAPI void *ecore_thread_global_data_wait(const char *key, double seconds);
/**
* @}
*/
typedef void (*Ecore_Pipe_Cb)(void *data, void *buffer, unsigned int nbyte);
-EAPI Ecore_Pipe *
-ecore_pipe_add(Ecore_Pipe_Cb handler,
- const void *data);
-EAPI void *
- ecore_pipe_del(Ecore_Pipe *p);
-EAPI Eina_Bool
- ecore_pipe_write(Ecore_Pipe *p,
- const void *buffer,
- unsigned int nbytes);
-EAPI void
- ecore_pipe_write_close(Ecore_Pipe *p);
-EAPI void
- ecore_pipe_read_close(Ecore_Pipe *p);
-EAPI void
- ecore_pipe_thaw(Ecore_Pipe *p);
-EAPI void
- ecore_pipe_freeze(Ecore_Pipe *p);
-EAPI int
- ecore_pipe_wait(Ecore_Pipe *p,
- int message_count,
- double wait);
+EAPI Ecore_Pipe *ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data);
+EAPI void *ecore_pipe_del(Ecore_Pipe *p);
+EAPI Eina_Bool ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes);
+EAPI void ecore_pipe_write_close(Ecore_Pipe *p);
+EAPI void ecore_pipe_read_close(Ecore_Pipe *p);
+EAPI void ecore_pipe_thaw(Ecore_Pipe *p);
+EAPI void ecore_pipe_freeze(Ecore_Pipe *p);
+EAPI int ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait);
/**
* @}
* will be processed first). This also gives the chance to other
* actions in your program to cancel the job before it is started.
*
- * Examples of using @ref Ecore_Job:
+ * Examples of using @ref Ecore_Job :
* @li @ref ecore_job_example_c
*
* @ingroup Ecore_Main_Loop_Group
typedef struct _Ecore_Job Ecore_Job; /**< A job handle */
-EAPI Ecore_Job *
-ecore_job_add(Ecore_Cb func,
- const void *data);
-EAPI void *
-ecore_job_del(Ecore_Job *job);
+EAPI Ecore_Job *ecore_job_add(Ecore_Cb func, const void *data);
+EAPI void *ecore_job_del(Ecore_Job *job);
/**
* @}
* @{
*/
-EAPI void
-ecore_app_args_set(int argc,
- const char **argv);
-EAPI void
-ecore_app_args_get(int *argc,
- char ***argv);
-EAPI void
-ecore_app_restart(void);
+EAPI void ecore_app_args_set(int argc, const char **argv);
+EAPI void ecore_app_args_get(int *argc, char ***argv);
+EAPI void ecore_app_restart(void);
/**
* @}
* @{
*/
-EAPI void
- ecore_throttle_adjust(double amount);
-EAPI double
- ecore_throttle_get(void);
+EAPI void ecore_throttle_adjust(double amount);
+EAPI double ecore_throttle_get(void);
/**
* @}
libecore_la_SOURCES = \
ecore.c \
+ecore_alloc.c \
ecore_anim.c \
ecore_app.c \
ecore_events.c \
# include <config.h>
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
}
if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
if (_ecore_fps_debug) _ecore_fps_debug_init();
+ if (!ecore_mempool_init()) goto shutdown_mempool;
_ecore_main_loop_init();
_ecore_signal_init();
_ecore_thread_init();
return _ecore_init_count;
+shutdown_mempool:
+ ecore_mempool_shutdown();
shutdown_log_dom:
eina_shutdown();
shutdown_evil:
_ecore_lock();
if (--_ecore_init_count != 0)
goto unlock;
-
- ecore_pipe_del(_thread_call);
+
+ /* this looks horrible - a hack for now, but something to note. as
+ * we delete the _thread_call pipe a thread COULD be doing
+ * ecore_pipe_write() or what not to it at the same time - we
+ * must ensure all possible users of this _thread_call are finished
+ * and exited before we delete it here */
+ /*
+ * ok - this causes other valgrind complaints regarding glib aquiring
+ * locks internally. so fix bug a or bug b. let's leave the original
+ * bug in then and leave this as a note for now
+ Ecore_Pipe *p;
+ p = _thread_call;
+ _thread_call = NULL;
+ ecore_pipe_wait(p, 1, 0.1);
+ ecore_pipe_del(p);
+ */
eina_lock_free(&_thread_safety);
eina_condition_free(&_thread_cond);
eina_lock_free(&_thread_mutex);
_ecore_memory_max_free);
}
#endif
-
+ ecore_mempool_shutdown();
eina_log_domain_unregister(_ecore_log_dom);
_ecore_log_dom = -1;
eina_shutdown();
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdlib.h>
+
+#include <Eina.h>
+
+#include "Ecore.h"
+#include "ecore_private.h"
+
+typedef struct _Ecore_Mempool Ecore_Mempool;
+struct _Ecore_Mempool
+{
+ const char *name;
+ Eina_Mempool *mp;
+ size_t size;
+};
+
+#define GENERIC_ALLOC_FREE(TYPE, Type) \
+ extern size_t _ecore_sizeof_##TYPE; \
+ Ecore_Mempool Type##_mp = { #TYPE, NULL, 0 }; \
+ TYPE * \
+ Type##_calloc(unsigned int num) \
+ { \
+ return eina_mempool_calloc(Type##_mp.mp, \
+ num * _ecore_sizeof_##TYPE); \
+ } \
+ void \
+ Type##_mp_free(TYPE *e) \
+ { \
+ eina_mempool_free(Type##_mp.mp, e); \
+ }
+
+GENERIC_ALLOC_FREE(Ecore_Animator, ecore_animator);
+GENERIC_ALLOC_FREE(Ecore_Event_Handler, ecore_event_handler);
+GENERIC_ALLOC_FREE(Ecore_Event_Filter, ecore_event_filter);
+GENERIC_ALLOC_FREE(Ecore_Event, ecore_event);
+GENERIC_ALLOC_FREE(Ecore_Idle_Exiter, ecore_idle_exiter);
+GENERIC_ALLOC_FREE(Ecore_Idle_Enterer, ecore_idle_enterer);
+GENERIC_ALLOC_FREE(Ecore_Idler, ecore_idler);
+GENERIC_ALLOC_FREE(Ecore_Job, ecore_job);
+GENERIC_ALLOC_FREE(Ecore_Timer, ecore_timer);
+GENERIC_ALLOC_FREE(Ecore_Poller, ecore_poller);
+GENERIC_ALLOC_FREE(Ecore_Pipe, ecore_pipe);
+GENERIC_ALLOC_FREE(Ecore_Fd_Handler, ecore_fd_handler);
+#ifdef _WIN32
+GENERIC_ALLOC_FREE(Ecore_Win32_Handler, ecore_win32_handler);
+#endif
+
+static Ecore_Mempool *mempool_array[] = {
+ &ecore_animator_mp,
+ &ecore_event_handler_mp,
+ &ecore_event_filter_mp,
+ &ecore_event_mp,
+ &ecore_idle_exiter_mp,
+ &ecore_idle_enterer_mp,
+ &ecore_idler_mp,
+ &ecore_job_mp,
+ &ecore_timer_mp,
+ &ecore_poller_mp,
+ &ecore_pipe_mp,
+ &ecore_fd_handler_mp,
+#ifdef _WIN32
+ &ecore_win32_handler_mp
+#endif
+};
+
+Eina_Bool
+ecore_mempool_init(void)
+{
+ const char *choice;
+ unsigned int i;
+
+#define MP_SIZE_INIT(TYPE, Type) \
+ Type##_mp.size = _ecore_sizeof_##TYPE
+
+ MP_SIZE_INIT(Ecore_Animator, ecore_animator);
+ MP_SIZE_INIT(Ecore_Event_Handler, ecore_event_handler);
+ MP_SIZE_INIT(Ecore_Event_Filter, ecore_event_filter);
+ MP_SIZE_INIT(Ecore_Event, ecore_event);
+ MP_SIZE_INIT(Ecore_Idle_Exiter, ecore_idle_exiter);
+ MP_SIZE_INIT(Ecore_Idle_Enterer, ecore_idle_enterer);
+ MP_SIZE_INIT(Ecore_Idler, ecore_idler);
+ MP_SIZE_INIT(Ecore_Job, ecore_job);
+ MP_SIZE_INIT(Ecore_Timer, ecore_timer);
+ MP_SIZE_INIT(Ecore_Poller, ecore_poller);
+ MP_SIZE_INIT(Ecore_Pipe, ecore_pipe);
+ MP_SIZE_INIT(Ecore_Fd_Handler, ecore_fd_handler);
+#ifdef _WIN32
+ MP_SIZE_INIT(Ecore_Win32_Handler, ecore_win32_handler);
+#endif
+#undef MP_SIZE_INIT
+
+ choice = getenv("EINA_MEMPOOL");
+ if ((!choice) || (!choice[0]))
+ choice = "chained_mempool";
+
+ for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
+ {
+ retry:
+ mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
+ if (!mempool_array[i]->mp)
+ {
+ if (!strcmp(choice, "pass_through"))
+ {
+ ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice);
+ choice = "pass_through";
+ goto retry;
+ }
+ else
+ {
+ ERR("Impossible to allocate mempool '%s' !", choice);
+ return EINA_FALSE;
+ }
+ }
+ }
+ return EINA_TRUE;
+}
+
+void
+ecore_mempool_shutdown(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
+ {
+ eina_mempool_del(mempool_array[i]->mp);
+ mempool_array[i]->mp = NULL;
+ }
+}
+
Eina_Bool delete_me : 1;
Eina_Bool suspended : 1;
+ Eina_Bool just_added : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Animator);
+
static Eina_Bool _ecore_animator_run(void *data);
static Eina_Bool _ecore_animator(void *data);
EINA_INLIST_FOREACH(animators, animator)
{
- if (!animator->delete_me && !animator->suspended)
+ animator->just_added = EINA_FALSE;
+ }
+ EINA_INLIST_FOREACH(animators, animator)
+ {
+ if ((!animator->delete_me) &&
+ (!animator->suspended) &&
+ (!animator->just_added))
{
if (!_ecore_call_task_cb(animator->func, animator->data))
{
animators_delete_me++;
}
}
+ else animator->just_added = EINA_FALSE;
}
if (animators_delete_me)
{
eina_inlist_remove(EINA_INLIST_GET(animators),
EINA_INLIST_GET(animator));
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
- free(animator);
+ ecore_animator_mp_free(animator);
animators_delete_me--;
if (animators_delete_me == 0) break;
}
Ecore_Animator *animator = NULL;
if (!func) return animator;
- animator = calloc(1, sizeof(Ecore_Animator));
+ animator = ecore_animator_calloc(1);
if (!animator) return animator;
ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR);
animator->func = func;
animator->data = (void *)data;
+ animator->just_added = EINA_TRUE;
animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
_begin_tick();
return animator;
return pos;
case ECORE_POS_MAP_ACCELERATE:
- pos = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0));
+ pos = 1.0 - _pos_map_sin(M_PI_2 + pos * M_PI_2);
return pos;
case ECORE_POS_MAP_DECELERATE:
- pos = _pos_map_sin((pos * M_PI) / 2.0);
+ pos = _pos_map_sin(pos * M_PI_2);
return pos;
case ECORE_POS_MAP_SINUSOIDAL:
animator = animators;
animators = (Ecore_Animator *)eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
- free(animator);
+ ecore_animator_mp_free(animator);
}
}
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Handler);
struct _Ecore_Event_Filter
{
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Filter);
struct _Ecore_Event
{
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event);
static int events_num = 0;
static Ecore_Event *events = NULL;
if (!func) goto unlock;
if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) goto unlock;
- eh = calloc(1, sizeof(Ecore_Event_Handler));
+ eh = ecore_event_handler_calloc(1);
if (!eh) goto unlock;
ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER);
eh->type = type;
new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *));
if (!new_handlers)
{
- free(eh);
+ ecore_event_handler_mp_free(eh);
goto unlock;
}
event_handlers = new_handlers;
static void
_ecore_event_generic_free(void *data __UNUSED__,
void *event)
-{
+{ /* DO NOT MEMPOOL FREE THIS */
free (event);
}
_ecore_lock();
if (!func_filter) goto unlock;
- ef = calloc(1, sizeof(Ecore_Event_Filter));
+ ef = ecore_event_filter_calloc(1);
if (!ef) goto unlock;
ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER);
ef->func_start = func_start;
{
event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
- if (!eh->delete_me) free(eh);
+ if (!eh->delete_me) ecore_event_handler_mp_free(eh);
}
}
EINA_LIST_FREE(event_handlers_delete_list, eh)
- free(eh);
+ ecore_event_handler_mp_free(eh);
if (event_handlers) free(event_handlers);
event_handlers = NULL;
event_handlers_num = 0;
{
event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
- free(ef);
+ ecore_event_filter_mp_free(ef);
}
event_filters_delete_me = 0;
event_filter_current = NULL;
{
Ecore_Event *e;
- e = calloc(1, sizeof(Ecore_Event));
+ e = ecore_event_calloc(1);
if (!e) return NULL;
ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT);
e->type = type;
if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event);
events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event));
ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE);
- free(event);
+ ecore_event_mp_free(event);
events_num--;
return data;
}
event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
- free(ef);
+ ecore_event_filter_mp_free(ef);
}
}
if (!deleted_in_use)
event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
- free(eh);
+ ecore_event_handler_mp_free(eh);
}
}
void *alloca(size_t);
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
todo = len;
for (i = 0; i < todo; i++)
- if (isspace(text[i]))
+ if (isspace((unsigned char)text[i]))
{
space = text + i;
break;
* will be applied on them if ecore was compiled with such support.
*
* @param parser description of how to work.
- * @param value where to store values, it is assumed that this is a vector
+ * @param values where to store values, it is assumed that this is a vector
* of the same size as @c parser->descs. Values should be previously
* initialized.
* @param argc how many elements in @a argv. If not provided it will be
/**
* Helper ecore_getopt callback to parse geometry (x:y:w:h).
*
- * Storage must be a pointer to @c Eina_Rectangle and will be used to
+ * @param str Geometry value
+ * @param storage must be a pointer to @c Eina_Rectangle and will be used to
* store the four values passed in the given string.
*
* @c callback_data value is ignored, you can safely use @c NULL.
/**
* Helper ecore_getopt callback to parse geometry size (WxH).
*
- * Storage must be a pointer to @c Eina_Rectangle and will be used to
+ * @param str size value
+ * @param storage must be a pointer to @c Eina_Rectangle and will be used to
* store the two values passed in the given string and 0 in the x and y
* fields.
*
# include <config.h>
#endif
+#include <stdlib.h>
#include <stdio.h>
#include "Ecore.h"
int ret;
if (g_main_context_acquire(ctx))
- g_mutex_lock(mutex);
+ {
+ if (mutex) g_mutex_lock(mutex);
+ }
else
{
if (!_ecore_glib_cond)
ret = _ecore_glib_select__locked
(ctx, ecore_fds, rfds, wfds, efds, ecore_timeout);
- g_mutex_unlock(mutex);
+ if (mutex) g_mutex_unlock(mutex);
g_main_context_release(ctx);
+ g_static_mutex_free(&lock);
return ret;
}
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Enterer);
static Ecore_Idle_Enterer *idle_enterers = NULL;
static Ecore_Idle_Enterer *idle_enterer_current = NULL;
_ecore_lock();
if (!func) goto unlock;
- ie = calloc(1, sizeof(Ecore_Idle_Enterer));
+ ie = ecore_idle_enterer_calloc(1);
if (!ie) goto unlock;
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
ie->func = func;
_ecore_lock();
if (!func) goto unlock;
- ie = calloc(1, sizeof(Ecore_Idle_Enterer));
+ ie = ecore_idle_enterer_calloc(1);
if (!ie) goto unlock;
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
ie->func = func;
{
idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
- free(ie);
+ ecore_idle_enterer_mp_free(ie);
}
idle_enterers_delete_me = 0;
idle_enterer_current = NULL;
idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
- free(ie);
+ ecore_idle_enterer_mp_free(ie);
}
}
if (!deleted_idler_enterers_in_use)
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Exiter);
static Ecore_Idle_Exiter *idle_exiters = NULL;
static Ecore_Idle_Exiter *idle_exiter_current = NULL;
_ecore_lock();
if (!func) goto unlock;
- ie = calloc(1, sizeof(Ecore_Idle_Exiter));
+ ie = ecore_idle_exiter_calloc(1);
if (!ie) goto unlock;
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER);
ie->func = func;
{
idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
- free(ie);
+ ecore_idle_exiter_mp_free(ie);
}
idle_exiters_delete_me = 0;
idle_exiter_current = NULL;
idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
- free(ie);
+ ecore_idle_exiter_mp_free(ie);
}
}
if (!deleted_idler_exiters_in_use)
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idler);
static Ecore_Idler *idlers = NULL;
static Ecore_Idler *idler_current = NULL;
_ecore_lock();
if (!func) goto unlock;
- ie = calloc(1, sizeof(Ecore_Idler));
+ ie = ecore_idler_calloc(1);
if (!ie) goto unlock;
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLER);
ie->func = func;
{
idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
- free(ie);
+ ecore_idler_mp_free(ie);
}
idlers_delete_me = 0;
idler_current = NULL;
idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
- free(ie);
+ ecore_idler_mp_free(ie);
}
}
if (!deleted_idlers_in_use)
Ecore_Cb func;
void *data;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Job);
void
_ecore_job_init(void)
if (!func) return NULL;
- job = calloc(1, sizeof(Ecore_Job));
+ job = ecore_job_calloc(1);
if (!job) return NULL;
ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB);
job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, NULL);
if (!job->event)
{
- free(job);
+ ecore_job_mp_free(job);
return NULL;
}
job->func = func;
static void
_ecore_job_event_free(void *data __UNUSED__,
- void *ev)
+ void *job)
{
- free(ev);
+ ecore_job_mp_free(job);
}
GPollFD gfd;
#endif
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Fd_Handler);
#ifdef _WIN32
struct _Ecore_Win32_Handler
int references;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Win32_Handler);
#endif
#ifndef USE_G_MAIN_LOOP
#endif
static int in_main_loop = 0;
-#ifndef USE_G_MAIN_LOOP
static int do_quit = 0;
-#endif
static Ecore_Fd_Handler *fd_handlers = NULL;
static Ecore_Fd_Handler *fd_handler_current = NULL;
static Eina_List *fd_handlers_with_prep = NULL;
* DO NOT use this function unless you are the person God comes to ask for
* advice when He has trouble managing the Universe.
*/
+
+EAPI int
+ecore_main_loop_iterate_may_block(int may_block)
+{
+#ifndef USE_G_MAIN_LOOP
+ _ecore_lock();
+in_main_loop++;
+ _ecore_main_loop_iterate_internal(!may_block);
+in_main_loop--;
+ _ecore_unlock();
+ return _ecore_event_exist();
+#else
+ return g_main_context_iteration(NULL, may_block);
+#endif
+}
EAPI void
ecore_main_loop_iterate(void)
{
in_main_loop--;
_ecore_unlock();
#else
- ecore_main_loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(ecore_main_loop);
+ if (!do_quit)
+ {
+ if (!ecore_main_loop)
+ ecore_main_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(ecore_main_loop);
+ }
+ do_quit = 0;
#endif
}
EAPI void
ecore_main_loop_quit(void)
{
-#ifndef USE_G_MAIN_LOOP
do_quit = 1;
-#else
- g_main_loop_quit(ecore_main_loop);
+#ifdef USE_G_MAIN_LOOP
+ if (ecore_main_loop)
+ g_main_loop_quit(ecore_main_loop);
#endif
}
if ((fd < 0) || (flags == 0) || (!func)) goto unlock;
- fdh = calloc(1, sizeof(Ecore_Fd_Handler));
+ fdh = ecore_fd_handler_calloc(1);
if (!fdh) goto unlock;
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER);
fdh->next_ready = NULL;
{
int err = errno;
ERR("Failed to add poll on fd %d (errno = %d: %s)!", fd, err, strerror(err));
- free(fdh);
+ ecore_fd_handler_mp_free(fdh);
fdh = NULL;
goto unlock;
}
if (!h || !func) return NULL;
- wh = calloc(1, sizeof(Ecore_Win32_Handler));
+ wh = ecore_win32_handler_calloc(1);
if (!wh) return NULL;
ECORE_MAGIC_SET(wh, ECORE_MAGIC_WIN32_HANDLER);
wh->h = (HANDLE)h;
fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
EINA_INLIST_GET(fdh));
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
- free(fdh);
+ ecore_fd_handler_mp_free(fdh);
}
if (fd_handlers_with_buffer)
fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer);
win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
EINA_INLIST_GET(wh));
ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
- free(wh);
+ ecore_win32_handler_mp_free(wh);
}
win32_handlers_delete_me = EINA_FALSE;
win32_handler_current = NULL;
fd_handlers = (Ecore_Fd_Handler *)
eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh));
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
- free(fdh);
+ ecore_fd_handler_mp_free(fdh);
fd_handlers_to_delete = eina_list_remove_list(fd_handlers_to_delete, l);
}
}
eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
EINA_INLIST_GET(wh));
ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
- free(wh);
+ ecore_win32_handler_mp_free(wh);
}
}
if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE;
if (_ecore_event_exist())
{
/* but first conceptually enter an idle state */
- _ecore_idle_enterer_call();
- _ecore_throttle();
- /* now quickly poll to see which input fd's are active */
- _ecore_main_select(0.0);
- /* allow newly queued timers to expire from now on */
- _ecore_timer_enable_new();
- /* go straight to processing the events we had queued */
- goto process_all;
+ _ecore_idle_enterer_call();
+ _ecore_throttle();
+ /* now quickly poll to see which input fd's are active */
+ _ecore_main_select(0.0);
+ /* allow newly queued timers to expire from now on */
+ _ecore_timer_enable_new();
+ /* go straight to processing the events we had queued */
+ goto process_all;
}
if (once_only)
* if we got any events or signals, allow new timers to process.
* use bitwise or to force both conditions to be tested and
* merged together */
- if (_ecore_main_select(0.0) | _ecore_signal_count_get())
- {
- _ecore_timer_enable_new();
- goto process_all;
- }
+ if (_ecore_main_select(0.0) | _ecore_signal_count_get())
+ {
+ _ecore_timer_enable_new();
+ goto process_all;
+ }
}
else
{
/* call idle enterers ... */
- _ecore_idle_enterer_call();
- _ecore_throttle();
+ _ecore_idle_enterer_call();
+ _ecore_throttle();
}
/* if these calls caused any buffered events to appear - deal with them */
if (once_only)
{
/* in once_only mode enter idle here instead and then return */
- _ecore_idle_enterer_call();
- _ecore_throttle();
- _ecore_timer_enable_new();
- goto done;
+ _ecore_idle_enterer_call();
+ _ecore_throttle();
+ _ecore_timer_enable_new();
+ goto done;
}
_ecore_fps_marker_1();
if (!_ecore_event_exist())
{
/* init flags */
- next_time = _ecore_timer_next_get();
- /* no idlers */
- if (!_ecore_idler_exist())
- {
- /* sleep until timeout or forever (-1.0) waiting for on fds */
- _ecore_main_select(next_time);
- }
- else
- {
- int action = LOOP_CONTINUE;
+ next_time = _ecore_timer_next_get();
+ /* no idlers */
+ if (!_ecore_idler_exist())
+ {
+ /* sleep until timeout or forever (-1.0) waiting for on fds */
+ _ecore_main_select(next_time);
+ }
+ else
+ {
+ int action = LOOP_CONTINUE;
- /* no timers - spin */
- if (next_time < 0) action = _ecore_main_loop_spin_no_timers();
- /* timers - spin */
- else action = _ecore_main_loop_spin_timers();
- if (action == SPIN_RESTART) goto start_loop;
- }
+ /* no timers - spin */
+ if (next_time < 0) action = _ecore_main_loop_spin_no_timers();
+ /* timers - spin */
+ else action = _ecore_main_loop_spin_timers();
+ if (action == SPIN_RESTART) goto start_loop;
+ }
}
_ecore_fps_marker_2();
if (once_only)
{
/* if in once_only mode handle idle exiting */
- _ecore_idle_enterer_call();
- _ecore_throttle();
+ _ecore_idle_enterer_call();
+ _ecore_throttle();
}
done: /*******************************************************************/
int message;
Eina_Bool delete_me : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Pipe);
static Eina_Bool _ecore_pipe_read(void *data,
Ecore_Fd_Handler *fd_handler);
if (!handler) return NULL;
- p = (Ecore_Pipe *)calloc(1, sizeof(Ecore_Pipe));
+ p = ecore_pipe_calloc(1);
if (!p) return NULL;
if (pipe(fds))
{
- free(p);
+ ecore_pipe_mp_free(p);
return NULL;
}
if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read);
if (p->fd_write != PIPE_FD_INVALID) pipe_close(p->fd_write);
data = (void *)p->data;
- free(p);
+ ecore_pipe_mp_free(p);
return data;
}
else if ((ret == PIPE_FD_ERROR) &&
((errno == EINTR) || (errno == EAGAIN)))
{
- _ecore_pipe_unhandle(p);
return ECORE_CALLBACK_RENEW;
}
else
ERR("An unhandled error (ret: %i errno: %i [%s])"
"occurred while reading from the pipe the length",
(int)ret, errno, strerror(errno));
- _ecore_pipe_unhandle(p);
return ECORE_CALLBACK_RENEW;
}
#else
Ecore_Task_Cb func;
void *data;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Poller);
static Ecore_Timer *timer = NULL;
static int min_interval = -1;
at_tick++;
last_tick = ecore_time_get();
- /* we have 16 counters - each incriments every time the poller counter
- * "ticks". it incriments by the minimum interval (which can be 1, 2, 4,
+ /* we have 16 counters - each increments every time the poller counter
+ * "ticks". it increments by the minimum interval (which can be 1, 2, 4,
* 7, 16 etc. up to 32768) */
for (i = 0; i < 15; i++)
{
if (poller->delete_me)
{
pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
- free(poller);
+ ecore_poller_mp_free(poller);
poller_delete_count--;
changes++;
if (poller_delete_count <= 0) break;
at_tick--;
/* if the timer was deleted then there is no point returning 1 - ambiguous
- * if we do as it im plies "keep running me" but we have been deleted
+ * if we do as it implies keep running me" but we have been deleted
* anyway */
if (!timer) return ECORE_CALLBACK_CANCEL;
* @param type The ticker type to query
* @return The time in seconds between ticks of the ticker clock
*
- * This will get the time between ticks of the specifider ticker clock.
+ * This will get the time between ticks of the specified ticker clock.
*/
EAPI double
ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__)
if (!func) return NULL;
if (interval < 1) interval = 1;
- poller = calloc(1, sizeof(Ecore_Poller));
+ poller = ecore_poller_calloc(1);
if (!poller) return NULL;
ECORE_MAGIC_SET(poller, ECORE_MAGIC_POLLER);
/* interval MUST be a power of 2, so enforce it */
/* not in loop so safe - delete immediately */
data = poller->data;
pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
- free(poller);
+ ecore_poller_mp_free(poller);
_ecore_poller_next_tick_eval();
return data;
}
while ((poller = pollers[i]))
{
pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
- free(poller);
+ ecore_poller_mp_free(poller);
}
}
}
#define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3
#define ECORE_MAGIC_JOB 0x76543210
+typedef unsigned int Ecore_Magic;
#define ECORE_MAGIC Ecore_Magic __magic
#define ECORE_MAGIC_SET(d, m) (d)->__magic = (m)
return; \
}
-typedef unsigned int Ecore_Magic;
-
EAPI void _ecore_magic_fail(const void *d,
Ecore_Magic m,
Ecore_Magic req_m,
extern Eina_Bool _ecore_glib_always_integrate;
extern Ecore_Select_Function main_loop_select;
+Eina_Bool ecore_mempool_init(void);
+void ecore_mempool_shutdown(void);
+#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \
+ TYPE *Type##_calloc(unsigned int); \
+ void Type##_mp_free(TYPE *e);
+#define GENERIC_ALLOC_SIZE_DECLARE(TYPE) \
+ size_t _ecore_sizeof_##TYPE = sizeof (TYPE);
+
+GENERIC_ALLOC_FREE_HEADER(Ecore_Animator, ecore_animator);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Handler, ecore_event_handler);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Filter, ecore_event_filter);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Event, ecore_event);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Exiter, ecore_idle_exiter);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Enterer, ecore_idle_enterer);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Idler, ecore_idler);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Job, ecore_job);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Timer, ecore_timer);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Poller, ecore_poller);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Pipe, ecore_pipe);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Fd_Handler, ecore_fd_handler);
+#ifdef _WIN32
+GENERIC_ALLOC_FREE_HEADER(Ecore_Win32_Handler, ecore_win32_handler);
+#endif
+
+#undef GENERIC_ALLOC_FREE_HEADER
+
#endif
# include <config.h>
#endif
+#include <stdlib.h>
#include <sys/time.h>
#include <assert.h>
#include <sys/types.h>
static Ecore_Pipe *
_ecore_thread_pipe_get(void)
{
- if (eina_array_count_get(_ecore_thread_pipe) > 0)
+ if (eina_array_count(_ecore_thread_pipe) > 0)
return eina_array_pop(_ecore_thread_pipe);
return ecore_pipe_add(_ecore_thread_handler, NULL);
{
Ecore_Pipe *p = event;
- if (eina_array_count_get(_ecore_thread_pipe) < 50)
+ if (eina_array_count(_ecore_thread_pipe) < 50)
eina_array_push(_ecore_thread_pipe, p);
else
ecore_pipe_del(p);
LKD(work->mutex);
if (work->hash)
eina_hash_free(work->hash);
- free(work);
+ _ecore_thread_worker_free(work);
}
static void
}
static void
-_ecore_short_job(Ecore_Pipe *end_pipe)
+_ecore_short_job(Ecore_Pipe *end_pipe,
+ PH(thread))
{
Ecore_Pthread_Worker *work;
LKU(_ecore_pending_job_threads_mutex);
+ work->self = thread;
if (!work->cancel)
work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work);
eina_sched_prio_drop();
restart:
- if (_ecore_pending_job_threads) _ecore_short_job(pth->p);
+ 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. */
work->data = data;
#ifdef EFL_HAVE_THREADS
+ work->self = 0;
work->hash = NULL;
CDI(work->cond);
LKI(work->mutex);
worker->feedback_run = EINA_TRUE;
worker->kill = EINA_FALSE;
worker->reschedule = EINA_FALSE;
+ worker->self = 0;
worker->u.feedback_run.send = 0;
worker->u.feedback_run.received = 0;
unsigned char just_added : 1;
unsigned char frozen : 1;
};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Timer);
static void _ecore_timer_set(Ecore_Timer *timer,
double at,
_ecore_lock();
if (!func) goto unlock;
if (in < 0.0) in = 0.0;
- timer = calloc(1, sizeof(Ecore_Timer));
+ timer = ecore_timer_calloc(1);
if (!timer) goto unlock;
ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER);
now = ecore_time_get();
}
/**
+ * Reset a timer to its full interval
+ * This doesn't affect the interval of a timer
+ * @param timer The timer
+ * @since 1.2
+ * @note This is equivalent to (but faster than)
+ * @code
+ * ecore_timer_delay(timer, ecore_timer_interval_get(timer) - ecore_timer_pending_get(timer));
+ * @endcode
+ */
+EAPI void
+ecore_timer_reset(Ecore_Timer *timer)
+{
+ double now, add;
+ if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
+ {
+ ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
+ __func__);
+ return;
+ }
+ _ecore_lock();
+ now = ecore_time_get();
+
+ if (timer->frozen)
+ add = timer->pending;
+ else
+ add = timer->at - now;
+ _ecore_timer_delay(timer, timer->in - add);
+ _ecore_unlock();
+}
+
+/**
* Get the pending time regarding a timer.
*
* @param timer The timer to learn from.
if (!func) return timer;
if (in < 0.0) in = 0.0;
- timer = calloc(1, sizeof(Ecore_Timer));
+ timer = ecore_timer_calloc(1);
if (!timer) return timer;
ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER);
now = ecore_loop_time_get();
if (timer->delete_me)
timers_delete_me--;
- free(timer);
+ ecore_timer_mp_free(timer);
return data;
}
{
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
- free(timer);
+ ecore_timer_mp_free(timer);
}
while ((timer = suspended))
{
suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended));
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
- free(timer);
+ ecore_timer_mp_free(timer);
}
timer_current = NULL;
}
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
- free(timer);
+ ecore_timer_mp_free(timer);
timers_delete_me--;
done++;
if (timers_delete_me == 0) return;
}
suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
- free(timer);
+ ecore_timer_mp_free(timer);
timers_delete_me--;
done++;
if (timers_delete_me == 0) return;
typedef struct _Ecore_Con_Client Ecore_Con_Client;
/**
+ * @typedef Ecore_Con_Socks
+ * An object representing a SOCKS proxy
+ * @ingroup Ecore_Con_Socks_Group
+ * @since 1.2
+ */
+typedef struct Ecore_Con_Socks Ecore_Con_Socks;
+
+/**
* @typedef Ecore_Con_Url
* A handle to an http upload/download object
* @ingroup Ecore_Con_Url_Group
typedef struct _Ecore_Con_Event_Server_Write Ecore_Con_Event_Server_Write;
/**
+ * @typedef Ecore_Con_Event_Proxy_Bind
+ * Used as the @p data param for the corresponding event
+ * @since 1.2
+ */
+typedef struct _Ecore_Con_Event_Proxy_Bind Ecore_Con_Event_Proxy_Bind;
+
+/**
* @typedef Ecore_Con_Event_Url_Data
* Used as the @p data param for the corresponding event
* @ingroup Ecore_Con_Url_Group
};
/**
+ * @struct _Ecore_Con_Event_Proxy_Bind
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_PROXY_BIND event
+ * @ingroup Ecore_Con_Socks_Group
+ * @since 1.2
+ */
+struct _Ecore_Con_Event_Proxy_Bind
+{
+ Ecore_Con_Server *server; /**< the server object connected to the proxy */
+ const char *ip; /**< the proxy-bound ip address */
+ int port; /**< the proxy-bound port */
+};
+
+/**
* @struct _Ecore_Con_Event_Url_Data
* Used as the @p data param for the @ref ECORE_CON_EVENT_URL_DATA event
* @ingroup Ecore_Con_Url_Group
EAPI extern int ECORE_CON_EVENT_CLIENT_DATA;
/** A server connection object has data */
EAPI extern int ECORE_CON_EVENT_SERVER_DATA;
+/** A server connection has successfully negotiated an ip:port binding
+ * @since 1.2
+ */
+EAPI extern int ECORE_CON_EVENT_PROXY_BIND;
/** A URL object has data */
EAPI extern int ECORE_CON_EVENT_URL_DATA;
/** A URL object has completed its transfer to and from the server and can be reused */
ECORE_CON_REMOTE_UDP = 5,
/** Remote broadcast using UDP */
ECORE_CON_REMOTE_BROADCAST = 6,
+ /** Remote connection sending packets immediately */
ECORE_CON_REMOTE_NODELAY = 7,
+ /** Remote connection sending data in large chunks
+ * @note Only available on Linux
+ * @since 1.2
+ */
+ ECORE_CON_REMOTE_CORK = 8,
/** Use SSL2: UNSUPPORTED. **/
ECORE_CON_USE_SSL2 = (1 << 4),
/** Use SSL3 */
EAPI Eina_Bool ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr, const char *ca_file);
EAPI void ecore_con_ssl_server_verify(Ecore_Con_Server *svr);
EAPI void ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr);
+EAPI void ecore_con_ssl_server_verify_name_set(Ecore_Con_Server *svr, const char *name);
+EAPI const char *ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr);
EAPI Eina_Bool ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type compl_type);
EAPI Eina_Bool ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type compl_type);
* @}
*/
+EAPI Ecore_Con_Socks *ecore_con_socks4_remote_add(const char *ip, int port, const char *username);
+EAPI void ecore_con_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable);
+EAPI Eina_Bool ecore_con_socks4_lookup_get(Ecore_Con_Socks *ecs);
+EAPI Eina_Bool ecore_con_socks4_remote_exists(const char *ip, int port, const char *username);
+EAPI void ecore_con_socks4_remote_del(const char *ip, int port, const char *username);
+EAPI void ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind);
+EAPI Eina_Bool ecore_con_socks_bind_get(Ecore_Con_Socks *ecs);
+EAPI unsigned int ecore_con_socks_version_get(Ecore_Con_Socks *ecs);
+EAPI void ecore_con_socks_remote_del(Ecore_Con_Socks *ecs);
+EAPI void ecore_con_socks_apply_once(Ecore_Con_Socks *ecs);
+EAPI void ecore_con_socks_apply_always(Ecore_Con_Socks *ecs);
+
/**
* @defgroup Ecore_Con_Server_Group Ecore Connection Server Functions
*
*/
EAPI int ecore_con_client_port_get(Ecore_Con_Client *cl);
+
+
/**
* @}
*/
* modification time.
*
* @param url_con Ecore_Con_Url to act upon.
- * @param condition Condition to use for HTTP requests.
+ * @param time_condition Condition to use for HTTP requests.
* @param timestamp Time since 1 Jan 1970 to use in the condition.
*
* This function may set the header "If-Modified-Since" or
const char *ca_path);
/**
+ * Set HTTP proxy to use.
+ *
+ * The parameter should be a char * to a zero terminated string holding
+ * the host name or dotted IP address. To specify port number in this string,
+ * append :[port] to the end of the host name.
+ * The proxy string may be prefixed with [protocol]:// since any such prefix
+ * will be ignored.
+ * The proxy's port number may optionally be specified with the separate option.
+ * If not specified, libcurl will default to using port 1080 for proxies.
+ *
+ * @param url_con Connection object that will use the proxy.
+ * @param proxy Porxy string or @c NULL to disable
+ *
+ * @return #EINA_TRUE on success, #EINA_FALSE on error.
+ * @since 1.2
+ */
+EAPI Eina_Bool ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy);
+
+/**
+ * Set zero terminated username to use for proxy.
+ *
+ * if socks protocol is used for proxy, protocol should be socks5 and above.
+ *
+ * @param url_con Connection object that will use the proxy.
+ * @param username Username string.
+ *
+ * @return #EINA_TRUE on success, #EINA_FALSE on error.
+ *
+ * @see ecore_con_url_proxy_set()
+ *
+<<<<<<< HEAD
+ * @since 1.2
+=======
+ * @since 1.2
+>>>>>>> origin/upstream
+ */
+EAPI Eina_Bool ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username);
+
+/**
+ * Set zero terminated password to use for proxy.
+ *
+ * if socks protocol is used for proxy, protocol should be socks5 and above.
+ *
+ * @param url_con Connection object that will use the proxy.
+ * @param password Password string.
+ *
+ * @return #EINA_TRUE on success, #EINA_FALSE on error.
+ *
+ * @see ecore_con_url_proxy_set()
+ *
+ * @since 1.2
+ */
+EAPI Eina_Bool ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password);
+
+/**
+ * Set timeout in seconds.
+ *
+ * the maximum time in seconds that you allow the ecore con url transfer
+ * operation to take. Normally, name lookups can take a considerable time
+ * and limiting operations to less than a few minutes risk aborting perfectly
+ * normal operations.
+ *
+ * @param url_con Connection object that will use the timeout.
+ * @param timeout time in seconds.
+ *
+ * @see ecore_con_url_cookies_jar_file_set()
+ *
+ * @since 1.2
+ */
+EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout);
+
+/**
* @}
*/
libecore_con_la_SOURCES = \
ecore_con.c \
+ecore_con_socks.c \
ecore_con_ssl.c \
ecore_con_url.c \
ecore_con_alloc.c
static Eina_Bool _ecore_con_client_timer(Ecore_Con_Client *cl);
static void _ecore_con_cl_timer_update(Ecore_Con_Client *cl);
-
static Eina_Bool _ecore_con_server_timer(Ecore_Con_Server *svr);
static void _ecore_con_server_timer_update(Ecore_Con_Server *svr);
static const char * _ecore_con_pretty_ip(struct sockaddr *client_addr);
+
+void
+_ecore_con_client_kill(Ecore_Con_Client *cl)
+{
+ if (cl->delete_me)
+ DBG("Multi kill request for client %p", cl);
+ else
+ ecore_con_event_client_del(cl);
+ INF("Lost client %s", (cl->ip) ? cl->ip : "");
+ if (cl->fd_handler)
+ ecore_main_fd_handler_del(cl->fd_handler);
+
+ cl->fd_handler = NULL;
+}
+
+void
+_ecore_con_server_kill(Ecore_Con_Server *svr)
+{
+ if (svr->delete_me)
+ DBG("Multi kill request for svr %p", svr);
+ else
+ ecore_con_event_server_del(svr);
+
+ if (svr->fd_handler)
+ ecore_main_fd_handler_del(svr->fd_handler);
+
+ svr->fd_handler = NULL;
+}
+
+#define _ecore_con_server_kill(svr) do { \
+ DBG("KILL %p", (svr)); \
+ _ecore_con_server_kill((svr)); \
+} while (0)
+
+#define _ecore_con_client_kill(cl) do { \
+ DBG("KILL %p", (cl)); \
+ _ecore_con_client_kill((cl)); \
+} while (0)
+
EAPI int ECORE_CON_EVENT_CLIENT_ADD = 0;
EAPI int ECORE_CON_EVENT_CLIENT_DEL = 0;
EAPI int ECORE_CON_EVENT_SERVER_ADD = 0;
EAPI int ECORE_CON_EVENT_SERVER_WRITE = 0;
EAPI int ECORE_CON_EVENT_CLIENT_ERROR = 0;
EAPI int ECORE_CON_EVENT_SERVER_ERROR = 0;
+EAPI int ECORE_CON_EVENT_PROXY_BIND = 0;
static Eina_List *servers = NULL;
static int _ecore_con_init_count = 0;
static int _ecore_con_event_count = 0;
int _ecore_con_log_dom = -1;
+Ecore_Con_Socks *_ecore_con_proxy_once = NULL;
+Ecore_Con_Socks *_ecore_con_proxy_global = NULL;
EAPI int
ecore_con_init(void)
ECORE_CON_EVENT_SERVER_WRITE = ecore_event_type_new();
ECORE_CON_EVENT_CLIENT_ERROR = ecore_event_type_new();
ECORE_CON_EVENT_SERVER_ERROR = ecore_event_type_new();
+ ECORE_CON_EVENT_PROXY_BIND = ecore_event_type_new();
eina_magic_string_set(ECORE_MAGIC_CON_SERVER, "Ecore_Con_Server");
eina_magic_string_set(ECORE_MAGIC_CON_URL, "Ecore_Con_Url");
/* TODO Remember return value, if it fails, use gethostbyname() */
+ ecore_con_socks_init();
ecore_con_ssl_init();
ecore_con_info_init();
{
Ecore_Con_Event_Server_Add *ev;
- svr->delete_me = svr->dead = EINA_TRUE;
+ svr->delete_me = EINA_TRUE;
+ INF("svr %p is dead", svr);
/* some pointer hacks here to prevent double frees if people are being stupid */
EINA_LIST_FREE(svr->event_count, ev)
ev->server = NULL;
_ecore_con_server_free(svr);
}
+ ecore_con_socks_shutdown();
if (!_ecore_con_event_count) ecore_con_mempool_shutdown();
ecore_con_info_shutdown();
svr->port = port;
svr->data = (void *)data;
svr->created = EINA_TRUE;
- if (compl_type & ECORE_CON_LOAD_CERT)
- svr->use_cert = EINA_TRUE;
+ svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
svr->reject_excess_clients = EINA_FALSE;
svr->client_limit = -1;
svr->clients = NULL;
#endif
if ((type == ECORE_CON_REMOTE_TCP) ||
- (type == ECORE_CON_REMOTE_NODELAY))
+ (type == ECORE_CON_REMOTE_NODELAY) ||
+ (type == ECORE_CON_REMOTE_CORK))
{
/* TCP */
if (!ecore_con_info_tcp_listen(svr, _ecore_con_cb_tcp_listen,
svr->port = port;
svr->data = (void *)data;
svr->created = EINA_FALSE;
- svr->use_cert = (compl_type & ECORE_CON_LOAD_CERT);
+ svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
svr->reject_excess_clients = EINA_FALSE;
svr->clients = NULL;
svr->client_limit = -1;
- if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL))
- goto error;
type = compl_type & ECORE_CON_TYPE;
+ if (type > ECORE_CON_LOCAL_ABSTRACT)
+ {
+ /* never use proxies on local connections */
+ if (_ecore_con_proxy_once)
+ svr->ecs = _ecore_con_proxy_once;
+ else if (_ecore_con_proxy_global)
+ svr->ecs = _ecore_con_proxy_global;
+ _ecore_con_proxy_once = NULL;
+ if (svr->ecs)
+ {
+ if ((!svr->ecs->lookup) &&
+ (!ecore_con_lookup(svr->name, (Ecore_Con_Dns_Cb)ecore_con_socks_dns_cb, svr)))
+ goto error;
+ if (svr->ecs->lookup)
+ svr->ecs_state = ECORE_CON_SOCKS_STATE_RESOLVED;
+ }
+ }
+ if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL))
+ goto error;
+
if (((type == ECORE_CON_REMOTE_TCP) ||
(type == ECORE_CON_REMOTE_NODELAY) ||
+ (type == ECORE_CON_REMOTE_CORK) ||
(type == ECORE_CON_REMOTE_UDP) ||
(type == ECORE_CON_REMOTE_BROADCAST)) &&
(port < 0))
#endif
if ((type == ECORE_CON_REMOTE_TCP) ||
- (type == ECORE_CON_REMOTE_NODELAY))
+ (type == ECORE_CON_REMOTE_NODELAY) ||
+ (type == ECORE_CON_REMOTE_CORK))
{
/* TCP */
if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect,
EAPI void *
ecore_con_server_del(Ecore_Con_Server *svr)
{
- void *data;
-
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del");
if (svr->delete_me)
return NULL;
- data = svr->data;
- svr->delete_me = EINA_TRUE;
- if (svr->event_count)
- {
- if (svr->fd_handler)
- {
- ecore_main_fd_handler_del(svr->fd_handler);
- svr->fd_handler = NULL;
- }
- }
- else
- _ecore_con_server_free(svr);
-
- return data;
+ _ecore_con_server_kill(svr);
+ return svr->data;
}
EAPI void *
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr,
- ECORE_MAGIC_CON_SERVER,
- "ecore_con_server_data_get");
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get");
return NULL;
}
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr,
- ECORE_MAGIC_CON_SERVER,
- "ecore_con_server_data_get");
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get");
return NULL;
}
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
- "ecore_con_server_connected_get");
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_connected_get");
return EINA_FALSE;
}
return 0;
}
- EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->dead, 0);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->delete_me, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
{
svr->buf = eina_binbuf_new();
EINA_SAFETY_ON_NULL_RETURN_VAL(svr->buf, 0);
+#ifdef TCP_CORK
+ if ((svr->fd >= 0) && ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
+ {
+ int state = 1;
+ if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
+ /* realistically this isn't anything serious so we can just log and continue */
+ ERR("corking failed! %s", strerror(errno));
+ }
+#endif
}
eina_binbuf_append_length(svr->buf, data, size);
return 0;
}
- EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->dead, 0);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->delete_me, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0);
{
cl->buf = eina_binbuf_new();
EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0);
+#ifdef TCP_CORK
+ if ((cl->fd >= 0) && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
+ {
+ int state = 1;
+ if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
+ /* realistically this isn't anything serious so we can just log and continue */
+ ERR("corking failed! %s", strerror(errno));
+ }
+#endif
}
eina_binbuf_append_length(cl->buf, data, size);
return EINA_FALSE;
}
- return !cl->dead;
+ return !cl->delete_me;
}
EAPI void
EAPI void *
ecore_con_client_del(Ecore_Con_Client *cl)
{
- void *data = NULL;
-
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del");
return NULL;
}
- data = cl->data;
- cl->delete_me = EINA_TRUE;
- if (cl->event_count)
- {
- if (cl->fd_handler)
- {
- ecore_main_fd_handler_del(cl->fd_handler);
- cl->fd_handler = NULL;
- }
- }
- else
- {
- if (cl->host_server)
- {
- cl->host_server->clients = eina_list_remove(cl->host_server->clients, cl);
- --cl->host_server->client_count;
- }
-
- _ecore_con_client_free(cl);
- }
-
- return data;
+ _ecore_con_client_kill(cl);
+ return cl->data;
}
EAPI void
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl,
- ECORE_MAGIC_CON_CLIENT,
- "ecore_con_client_data_set");
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_set");
return;
}
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl,
- ECORE_MAGIC_CON_CLIENT,
- "ecore_con_client_data_get");
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_get");
return NULL;
}
*/
void
+ecore_con_event_proxy_bind(Ecore_Con_Server *svr)
+{
+ Ecore_Con_Event_Proxy_Bind *e;
+ int ev = ECORE_CON_EVENT_PROXY_BIND;
+
+ e = ecore_con_event_proxy_bind_alloc();
+ EINA_SAFETY_ON_NULL_RETURN(e);
+
+ svr->event_count = eina_list_append(svr->event_count, e);
+ _ecore_con_server_timer_update(svr);
+ e->server = svr;
+ e->ip = svr->proxyip;
+ e->port = svr->proxyport;
+ ecore_event_add(ev, e,
+ _ecore_con_event_server_add_free, NULL);
+ _ecore_con_event_count++;
+}
+
+void
ecore_con_event_server_add(Ecore_Con_Server *svr)
{
/* we got our server! */
e = ecore_con_event_server_add_alloc();
EINA_SAFETY_ON_NULL_RETURN(e);
+ svr->connecting = EINA_FALSE;
+ svr->start_time = ecore_time_get();
svr->event_count = eina_list_append(svr->event_count, e);
_ecore_con_server_timer_update(svr);
e->server = svr;
{
Ecore_Con_Event_Server_Del *e;
+ svr->delete_me = EINA_TRUE;
+ INF("svr %p is dead", svr);
e = ecore_con_event_server_del_alloc();
EINA_SAFETY_ON_NULL_RETURN(e);
svr->event_count = eina_list_append(svr->event_count, e);
_ecore_con_server_timer_update(svr);
e->server = svr;
+ if (svr->ecs)
+ {
+ svr->ecs_state = svr->ecs->lookup ? ECORE_CON_SOCKS_STATE_RESOLVED : ECORE_CON_SOCKS_STATE_DONE;
+ eina_stringshare_replace(&svr->proxyip, NULL);
+ svr->proxyport = 0;
+ }
ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e,
_ecore_con_event_server_del_free, NULL);
_ecore_con_event_count++;
e = ecore_con_event_server_write_alloc();
EINA_SAFETY_ON_NULL_RETURN(e);
+ INF("Wrote %d bytes", num);
svr->event_count = eina_list_append(svr->event_count, e);
e->server = svr;
e->size = num;
Ecore_Con_Event_Client_Del *e;
if (!cl) return;
+ cl->delete_me = EINA_TRUE;
+ INF("cl %p is dead", cl);
e = ecore_con_event_client_del_alloc();
EINA_SAFETY_ON_NULL_RETURN(e);
cl->event_count = eina_list_append(cl->event_count, e);
}
void
-ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error)
+_ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate)
{
Ecore_Con_Event_Server_Error *e;
EINA_SAFETY_ON_NULL_RETURN(e);
e->server = svr;
- e->error = strdup(error);
+ e->error = duplicate ? strdup(error) : error;
ERR("%s", error);
svr->event_count = eina_list_append(svr->event_count, e);
ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL);
ecore_con_info_data_clear(svr->infos->data);
svr->infos = eina_list_remove_list(svr->infos, svr->infos);
}
- if ((!svr->buf) && svr->delete_me && (!svr->dead) && (!svr->event_count))
- {
- /* this is a catch-all for cases when a server is not properly killed. */
- svr->dead = EINA_TRUE;
- ecore_con_event_server_del(svr);
- return;
- }
t_start = ecore_time_get();
- while (svr->buf && (!svr->dead))
+ while (svr->buf && (!svr->delete_me))
{
_ecore_con_server_flush(svr);
t = ecore_time_get();
/* some pointer hacks here to prevent double frees if people are being stupid */
EINA_LIST_FREE(cl->event_count, ev)
ev->server = NULL;
- cl->delete_me = cl->dead = EINA_TRUE;
+ cl->delete_me = EINA_TRUE;
+ INF("cl %p is dead", cl);
_ecore_con_client_free(cl);
}
if ((svr->created) && (svr->path) && (svr->ppid == getpid()))
free(svr->path);
eina_stringshare_del(svr->ip);
+ eina_stringshare_del(svr->verify_name);
+
+ if (svr->ecs_buf) eina_binbuf_free(svr->ecs_buf);
+ if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
if (svr->fd_handler)
ecore_main_fd_handler_del(svr->fd_handler);
if (cl->event_count) return;
- if (cl->delete_me && (!cl->dead) && (!cl->event_count))
- {
- /* this is a catch-all for cases when a client is not properly killed. */
- cl->dead = EINA_TRUE;
- ecore_con_event_client_del(cl);
- return;
- }
-
-
t_start = ecore_time_get();
- while ((cl->buf) && (!cl->dead))
+ while ((cl->buf) && (!cl->delete_me))
{
_ecore_con_client_flush(cl);
t = ecore_time_get();
return;
}
-static void
-_ecore_con_server_kill(Ecore_Con_Server *svr)
-{
- if (!svr->delete_me)
- ecore_con_event_server_del(svr);
-
- svr->dead = EINA_TRUE;
- if (svr->fd_handler)
- ecore_main_fd_handler_del(svr->fd_handler);
-
- svr->fd_handler = NULL;
-}
-
static Eina_Bool
_ecore_con_server_timer(Ecore_Con_Server *svr)
{
{
Ecore_Con_Server *svr;
struct linger lin;
+ const char *memerr = NULL;
svr = data;
+ errno = 0;
if (!net_info) /* error message has already been handled */
goto error;
svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
net_info->info.ai_protocol);
- if (svr->fd < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ if (svr->fd < 0) goto error;
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
lin.l_onoff = 1;
lin.l_linger = 0;
if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin,
sizeof(struct linger)) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
{
sizeof(int)) < 0)
#endif
{
- ecore_con_event_server_error(svr, strerror(errno));
goto error;
}
}
- if (bind(svr->fd, net_info->info.ai_addr,
- net_info->info.ai_addrlen) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
- if (listen(svr->fd, 4096) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
+ goto error;
+
+ if (listen(svr->fd, 4096) < 0) goto error;
svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
_ecore_con_svr_tcp_handler, svr, NULL, NULL);
if (!svr->fd_handler)
{
- ecore_con_event_server_error(svr, "Memory allocation failure");
+ memerr = "Memory allocation failure";
goto error;
}
return;
error:
+ if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
ecore_con_ssl_server_shutdown(svr);
_ecore_con_server_kill(svr);
}
struct ipv6_mreq mreq6;
#endif
const int on = 1;
+ const char *memerr = NULL;
svr = data;
type = svr->type;
type &= ECORE_CON_TYPE;
+ errno = 0;
if (!net_info) /* error message has already been handled */
goto error;
svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
net_info->info.ai_protocol);
- if (svr->fd < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ if (svr->fd < 0) goto error;
if (type == ECORE_CON_REMOTE_MCAST)
{
{
if (!inet_pton(net_info->info.ai_family, net_info->ip,
&mreq.imr_multiaddr))
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(const void *)&mreq, sizeof(mreq)) != 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
}
#ifdef HAVE_IPV6
else if (net_info->info.ai_family == AF_INET6)
{
if (!inet_pton(net_info->info.ai_family, net_info->ip,
&mreq6.ipv6mr_multiaddr))
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
mreq6.ipv6mr_interface = htonl(INADDR_ANY);
if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(const void *)&mreq6, sizeof(mreq6)) != 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
}
#endif
}
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on)) != 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
svr->fd_handler =
ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
_ecore_con_svr_udp_handler, svr, NULL, NULL);
if (!svr->fd_handler)
{
- ecore_con_event_server_error(svr, "Memory allocation failure");
+ memerr = "Memory allocation failure";
goto error;
}
return;
error:
+ if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
ecore_con_ssl_server_shutdown(svr);
_ecore_con_server_kill(svr);
}
Ecore_Con_Server *svr;
int res;
int curstate = 0;
+ const char *memerr = NULL;
svr = data;
+ errno = 0;
if (!net_info) /* error message has already been handled */
goto error;
svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
net_info->info.ai_protocol);
- if (svr->fd < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ if (svr->fd < 0) goto error;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
{
if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0)
#endif
{
- ecore_con_event_server_error(svr, strerror(errno));
goto error;
}
}
if (res == SOCKET_ERROR)
{
if (WSAGetLastError() != WSAEINPROGRESS)
- goto error; /* FIXME: strerror on windows? */
+ {
+ char *err;
+ err = evil_format_message(WSAGetLastError());
+ _ecore_con_event_server_error(svr, err, EINA_FALSE);
+ ecore_con_ssl_server_shutdown(svr);
+ _ecore_con_server_kill(svr);
+ return;
+ }
#else
if (res < 0)
{
- if (errno != EINPROGRESS)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
+ if (errno != EINPROGRESS) goto error;
#endif
svr->connecting = EINA_TRUE;
svr->fd_handler =
{
svr->handshaking = EINA_TRUE;
svr->ssl_state = ECORE_CON_SSL_STATE_INIT;
- DBG("beginning ssl handshake");
- if (ecore_con_ssl_server_init(svr))
+ DBG("%s ssl handshake", svr->ecs_state ? "Queuing" : "Beginning");
+ if ((!svr->ecs_state) && ecore_con_ssl_server_init(svr))
goto error;
}
if (!svr->fd_handler)
{
- ecore_con_event_server_error(svr, "Memory allocation failure");
+ memerr = "Memory allocation failure";
goto error;
}
- svr->ip = eina_stringshare_add(net_info->ip);
+ if ((!svr->ecs) || (svr->ecs->lookup))
+ svr->ip = eina_stringshare_add(net_info->ip);
return;
error:
+ if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
ecore_con_ssl_server_shutdown(svr);
_ecore_con_server_kill(svr);
}
Ecore_Con_Server *svr;
int curstate = 0;
int broadcast = 1;
+ const char *memerr = NULL;
svr = data;
+ errno = 0;
if (!net_info) /* error message has already been handled */
goto error;
svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
net_info->info.ai_protocol);
- if (svr->fd < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
-
+ if (svr->fd < 0) goto error;
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_BROADCAST)
{
if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST,
(const void *)&broadcast,
sizeof(broadcast)) < 0)
{
- ecore_con_event_server_error(svr, strerror(errno));
goto error;
}
}
- else if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR,
- (const void *)&curstate, sizeof(curstate)) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR,
+ (const void *)&curstate, sizeof(curstate)) < 0)
+ goto error;
if (connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto error;
- }
+ goto error;
svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
_ecore_con_cl_udp_handler, svr, NULL, NULL);
if (!svr->fd_handler)
{
- ecore_con_event_server_error(svr, "Memory allocation failure");
+ memerr = "Memory allocation failure";
goto error;
}
- svr->ip = eina_stringshare_add(net_info->ip);
+ if ((!svr->ecs) || (svr->ecs->lookup))
+ svr->ip = eina_stringshare_add(net_info->ip);
return;
error:
+ if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno));
ecore_con_ssl_server_shutdown(svr);
_ecore_con_server_kill(svr);
}
if (res == SOCKET_ERROR)
so_err = WSAGetLastError();
- if ((so_err == WSAEINPROGRESS) && !svr->dead)
+ if ((so_err == WSAEINPROGRESS) && !svr->delete_me)
return ECORE_CON_INPROGRESS;
#else
if (res < 0)
so_err = errno;
- if ((so_err == EINPROGRESS) && !svr->dead)
+ if ((so_err == EINPROGRESS) && !svr->delete_me)
return ECORE_CON_INPROGRESS;
#endif
if ((!svr->delete_me) && (!svr->handshaking) && svr->connecting)
{
- svr->connecting = EINA_FALSE;
- svr->start_time = ecore_time_get();
- ecore_con_event_server_add(svr);
+ if (svr->ecs)
+ {
+ if (ecore_con_socks_svr_init(svr))
+ return ECORE_CON_INPROGRESS;
+ }
+ else
+ ecore_con_event_server_add(svr);
}
if (svr->fd_handler && (!svr->buf))
ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
- if (!svr->dead)
+ if (!svr->delete_me)
return ECORE_CON_CONNECTED;
else
return ECORE_CON_DISCONNECTED;
Ecore_Con_Client *cl = NULL;
unsigned char client_addr[256];
unsigned int client_addr_len;
+ const char *clerr = NULL;
svr = data;
- if (svr->dead)
+ if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
if (svr->delete_me)
client_addr_len = sizeof(client_addr);
memset(&client_addr, 0, client_addr_len);
cl->fd = accept(svr->fd, (struct sockaddr *)&client_addr, (socklen_t *)&client_addr_len);
- if (cl->fd < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto free_cl;
- }
-
+ if (cl->fd < 0) goto error;
if ((svr->client_limit >= 0) && (svr->reject_excess_clients) &&
(svr->client_count >= (unsigned int)svr->client_limit))
{
- ecore_con_event_server_error(svr, "Maximum client limit reached");
- goto close_fd;
+ clerr = "Maximum client limit reached";
+ goto error;
}
- if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto close_fd;
- }
- if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0)
- {
- ecore_con_event_server_error(svr, strerror(errno));
- goto close_fd;
- }
+ if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
+ if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
cl->fd_handler = ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ,
_ecore_con_svr_cl_handler, cl, NULL, NULL);
- if (!cl->fd_handler)
- goto close_fd;
-
+ if (!cl->fd_handler) goto error;
ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
if ((!svr->upgrade) && (svr->type & ECORE_CON_SSL))
cl->handshaking = EINA_TRUE;
cl->ssl_state = ECORE_CON_SSL_STATE_INIT;
if (ecore_con_ssl_client_init(cl))
- goto del_handler;
+ goto error;
}
cl->client_addr = malloc(client_addr_len);
if (!cl->client_addr)
{
- ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client");
- goto del_handler;
+ clerr = "Memory allocation failure when attempting to add a new client";
+ goto error;
}
cl->client_addr_len = client_addr_len;
memcpy(cl->client_addr, &client_addr, client_addr_len);
return ECORE_CALLBACK_RENEW;
- del_handler:
- ecore_main_fd_handler_del(cl->fd_handler);
- close_fd:
- close(cl->fd);
- free_cl:
+error:
+ if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler);
+ if (cl->fd >= 0) close(cl->fd);
free(cl);
-
+ if (clerr || errno) ecore_con_event_server_error(svr, clerr ?: strerror(errno));
return ECORE_CALLBACK_RENEW;
}
static void
_ecore_con_cl_read(Ecore_Con_Server *svr)
{
- DBG("svr=%p", svr);
int num = 0;
Eina_Bool lost_server = EINA_TRUE;
unsigned char buf[READBUFSIZ];
+ DBG("svr=%p", svr);
+
/* only possible with non-ssl connections */
if (svr->connecting && (svr_try_connect_plain(svr) != ECORE_CON_CONNECTED))
return;
- if (svr->handshaking)
+ if (svr->handshaking && (!svr->ecs_state))
{
DBG("Continuing ssl handshake");
if (!ecore_con_ssl_server_init(svr))
_ecore_con_server_timer_update(svr);
}
- if (!(svr->type & ECORE_CON_SSL))
+ if (svr->ecs_state || !(svr->type & ECORE_CON_SSL))
{
+ errno = 0;
num = read(svr->fd, buf, sizeof(buf));
/* 0 is not a valid return value for a tcp socket */
if ((num > 0) || ((num < 0) && (errno == EAGAIN)))
}
if ((!svr->delete_me) && (num > 0))
- ecore_con_event_server_data(svr, buf, num, EINA_TRUE);
+ {
+ if (svr->ecs_state)
+ ecore_con_socks_read(svr, buf, num);
+ else
+ ecore_con_event_server_data(svr, buf, num, EINA_TRUE);
+ }
if (lost_server)
_ecore_con_server_kill(svr);
Eina_Bool want_read, want_write;
svr = data;
- if (svr->dead)
+ if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
if (svr->delete_me)
want_read = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ);
want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE);
- if (svr->handshaking && (want_read || want_write))
+ if ((!svr->ecs_state) && svr->handshaking && (want_read || want_write))
{
DBG("Continuing ssl handshake: preparing to %s...", want_read ? "read" : "write");
#ifdef ISCOMFITOR
{
ERR("ssl handshaking failed!");
svr->handshaking = EINA_FALSE;
-
}
else if (!svr->ssl_state)
+ ecore_con_event_server_add(svr);
+ return ECORE_CALLBACK_RENEW;
+ }
+ if (svr->ecs && svr->ecs_state && (svr->ecs_state < ECORE_CON_SOCKS_STATE_READ) && (!svr->ecs_buf))
+ {
+ if (svr->ecs_state < ECORE_CON_SOCKS_STATE_INIT)
{
- svr->connecting = EINA_FALSE;
- svr->start_time = ecore_time_get();
- ecore_con_event_server_add(svr);
+ INF("PROXY STATE++");
+ svr->ecs_state++;
}
+ if (ecore_con_socks_svr_init(svr)) return ECORE_CALLBACK_RENEW;
}
- else if (want_read)
+ if (want_read)
_ecore_con_cl_read(svr);
else if (want_write) /* only possible with non-ssl connections */
{
- if (svr->connecting && (!svr_try_connect_plain(svr)))
+ if (svr->connecting && (!svr_try_connect_plain(svr)) && (!svr->ecs_state))
return ECORE_CALLBACK_RENEW;
_ecore_con_server_flush(svr);
want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE);
svr = data;
- if (svr->dead || svr->delete_me || ((!want_read) && (!want_write)))
+ if (svr->delete_me || svr->delete_me || ((!want_read) && (!want_write)))
return ECORE_CALLBACK_RENEW;
if (want_write)
svr = data;
- if (svr->delete_me || svr->dead)
+ if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
ecore_con_event_server_error(svr, strerror(errno));
if (!svr->delete_me)
ecore_con_event_client_del(NULL);
-
- svr->dead = EINA_TRUE;
- svr->fd_handler = NULL;
+ _ecore_con_server_kill(svr);
return ECORE_CALLBACK_CANCEL;
}
if ((!cl->delete_me) && (num > 0))
ecore_con_event_client_data(cl, buf, num, EINA_TRUE);
- if (lost_client)
- {
- if (!cl->delete_me)
- ecore_con_event_client_del(cl);
- INF("Lost client %s", (cl->ip) ? cl->ip : "");
- cl->dead = EINA_TRUE;
- if (cl->fd_handler)
- ecore_main_fd_handler_del(cl->fd_handler);
-
- cl->fd_handler = NULL;
- return;
- }
+ if (lost_client) _ecore_con_client_kill(cl);
}
static Eina_Bool
Ecore_Con_Client *cl;
cl = data;
- if (cl->dead)
- return ECORE_CALLBACK_RENEW;
-
if (cl->delete_me)
return ECORE_CALLBACK_RENEW;
if (ecore_con_ssl_client_init(cl))
{
ERR("ssl handshaking failed!");
- cl->handshaking = EINA_FALSE;
- cl->dead = EINA_TRUE;
- INF("Lost client %s", (cl->ip) ? cl->ip : "");
- ecore_con_event_client_del(cl);
+ _ecore_con_client_kill(cl);
+ return ECORE_CALLBACK_RENEW;
}
else if (!cl->ssl_state)
ecore_con_event_client_add(cl);
_ecore_con_server_flush(Ecore_Con_Server *svr)
{
int count, num;
+ size_t buf_len, buf_offset;
+ const void *buf;
+ DBG("(svr=%p,buf=%p)", svr, svr->buf);
#ifdef _WIN32
if (ecore_con_local_win32_server_flush(svr))
return;
#endif
- if ((!svr->buf) && svr->fd_handler)
+ if ((!svr->buf) && (!svr->ecs_buf) && svr->fd_handler)
{
ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
return;
}
- num = eina_binbuf_length_get(svr->buf) - svr->write_buf_offset;
+ buf = svr->buf ? eina_binbuf_string_get(svr->buf) : eina_binbuf_string_get(svr->ecs_buf);
+ buf_len = svr->buf ? eina_binbuf_length_get(svr->buf) : eina_binbuf_length_get(svr->ecs_buf);
+ buf_offset = svr->buf ? svr->write_buf_offset : svr->ecs_buf_offset;
+ num = buf_len - buf_offset;
/* check whether we need to write anything at all.
* we must not write zero bytes with SSL_write() since it
*/
if (num <= 0) return;
- if (svr->handshaking)
+ if ((!svr->ecs_state) && svr->handshaking)
{
DBG("Continuing ssl handshake");
if (ecore_con_ssl_server_init(svr))
return;
}
- if (!(svr->type & ECORE_CON_SSL))
- count = write(svr->fd, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num);
+ if (svr->ecs_state || (!(svr->type & ECORE_CON_SSL)))
+ count = write(svr->fd, buf + buf_offset, num);
else
- count = ecore_con_ssl_server_write(svr, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num);
+ count = ecore_con_ssl_server_write(svr, buf + buf_offset, num);
if (count < 0)
{
return;
}
- if (count) ecore_con_event_server_write(svr, count);
- svr->write_buf_offset += count;
- if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf))
+ if (count && (!svr->ecs_state)) ecore_con_event_server_write(svr, count);
+ if (svr->ecs_buf)
+ buf_offset = svr->ecs_buf_offset += count;
+ else
+ buf_offset = svr->write_buf_offset += count;
+ if (buf_offset >= buf_len)
{
- svr->write_buf_offset = 0;
- eina_binbuf_free(svr->buf);
- svr->buf = NULL;
+ if (svr->ecs_buf)
+ {
+ svr->ecs_buf_offset = 0;
+ eina_binbuf_free(svr->ecs_buf);
+ svr->ecs_buf = NULL;
+ INF("PROXY STATE++");
+ svr->ecs_state++;
+ }
+ else
+ {
+ svr->write_buf_offset = 0;
+ eina_binbuf_free(svr->buf);
+ svr->buf = NULL;
+#ifdef TCP_CORK
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)
+ {
+ int state = 0;
+ if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
+ /* realistically this isn't anything serious so we can just log and continue */
+ ERR("uncorking failed! %s", strerror(errno));
+ }
+#endif
+ }
if (svr->fd_handler)
ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
}
if ((errno != EAGAIN) && (errno != EINTR) && (!cl->delete_me))
{
ecore_con_event_client_error(cl, strerror(errno));
- ecore_con_event_client_del(cl);
- cl->dead = EINA_TRUE;
- INF("Lost client %s", (cl->ip) ? cl->ip : "");
- if (cl->fd_handler)
- ecore_main_fd_handler_del(cl->fd_handler);
-
- cl->fd_handler = NULL;
+ _ecore_con_client_kill(cl);
}
return;
cl->buf_offset = 0;
eina_binbuf_free(cl->buf);
cl->buf = NULL;
+#ifdef TCP_CORK
+ if ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)
+ {
+ int state = 0;
+ if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
+ /* realistically this isn't anything serious so we can just log and continue */
+ ERR("uncorking failed! %s", strerror(errno));
+ }
+#endif
if (cl->fd_handler)
ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
}
e = ev;
if (e->client)
{
- e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
- if ((!e->client->event_count) && (e->client->delete_me))
- ecore_con_client_del(e->client);
+ e->client->event_count = eina_list_remove(e->client->event_count, e);
if (e->client->host_server)
{
e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
if ((!svr->event_count) && (svr->delete_me))
_ecore_con_server_free(svr);
}
+ if ((!e->client->event_count) && (e->client->delete_me))
+ ecore_con_client_del(e->client);
}
ecore_con_event_client_add_free(e);
e = ev;
if (e->client)
{
- e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
- if ((!e->client->event_count) && (e->client->delete_me))
- ecore_con_client_del(e->client);
+ e->client->event_count = eina_list_remove(e->client->event_count, e);
if (e->client->host_server)
{
e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
if ((!svr->event_count) && (svr->delete_me))
_ecore_con_server_free(svr);
}
+ if (!e->client->event_count)
+ ecore_con_client_del(e->client);
}
ecore_con_event_client_del_free(e);
_ecore_con_event_count--;
{
if (e->client)
{
- e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
- if (((!e->client->event_count) && (e->client->delete_me)) ||
- ((e->client->host_server &&
- ((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP ||
- (e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST))))
- ecore_con_client_del(e->client);
+ e->client->event_count = eina_list_remove(e->client->event_count, e);
if (e->client->host_server)
{
e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
if ((!svr->event_count) && (svr->delete_me))
_ecore_con_server_free(svr);
}
+ if (((!e->client->event_count) && (e->client->delete_me)) ||
+ ((e->client->host_server &&
+ ((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP ||
+ (e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST))))
+ ecore_con_client_del(e->client);
}
ecore_con_event_client_write_free(e);
_ecore_con_event_count--;
e = ev;
if (e->client)
{
- e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e);
+ e->client->event_count = eina_list_remove(e->client->event_count, e);
+ if (e->client->host_server)
+ {
+ e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
+ }
+ if ((!svr->event_count) && (svr->delete_me))
+ _ecore_con_server_free(svr);
if (((!e->client->event_count) && (e->client->delete_me)) ||
((e->client->host_server &&
((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP ||
(e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST))))
ecore_con_client_del(e->client);
- e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev);
- if ((!svr->event_count) && (svr->delete_me))
- _ecore_con_server_free(svr);
}
free(e->data);
ecore_con_event_client_data_free(e);
if (e->server)
{
e->server->event_count = eina_list_remove(e->server->event_count, ev);
- if ((!e->server->event_count) && (e->server->delete_me))
+ if (!e->server->event_count)
_ecore_con_server_free(e->server);
}
ecore_con_event_server_del_free(e);
GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Del, ecore_con_event_server_del);
GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Write, ecore_con_event_server_write);
GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Data, ecore_con_event_server_data);
+GENERIC_ALLOC_FREE(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind);
static Ecore_Con_Mempool *mempool_array[] = {
&ecore_con_event_client_add_mp,
&ecore_con_event_server_add_mp,
&ecore_con_event_server_del_mp,
&ecore_con_event_server_write_mp,
- &ecore_con_event_server_data_mp
+ &ecore_con_event_server_data_mp,
+ &ecore_con_event_proxy_bind_mp
};
void
memcpy(&cares->hints, hints, sizeof(struct addrinfo));
}
- if (inet_pton(AF_INET, svr->name, &cares->addr.v4) == 1)
+ if (inet_pton(AF_INET, svr->ecs ? svr->ecs->ip : svr->name, &cares->addr.v4) == 1)
{
cares->byaddr = EINA_TRUE;
cares->isv6 = EINA_FALSE;
cares);
}
#ifdef HAVE_IPV6
- else if (inet_pton(AF_INET6, svr->name, &cares->addr.v6) == 1)
+ else if (inet_pton(AF_INET6, svr->ecs ? svr->ecs->ip : svr->name, &cares->addr.v6) == 1)
{
cares->byaddr = EINA_TRUE;
cares->isv6 = EINA_TRUE;
else
{
cares->byaddr = EINA_FALSE;
- ares_gethostbyname(info_channel, svr->name, ai_family,
+ ares_gethostbyname(info_channel, svr->ecs ? svr->ecs->ip : svr->name, ai_family,
(ares_host_callback)_ecore_con_info_ares_host_cb,
cares);
}
goto on_mem_error;
addri->sin_family = AF_INET;
- addri->sin_port = htons(arg->svr->port);
+ addri->sin_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
memcpy(&addri->sin_addr.s_addr,
hostent->h_addr_list[0], sizeof(struct in_addr));
goto on_mem_error;
addri6->sin6_family = AF_INET6;
- addri6->sin6_port = htons(arg->svr->port);
+ addri6->sin6_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
addri6->sin6_flowinfo = 0;
addri6->sin6_scope_id = 0;
goto on_mem_error;
addri6->sin6_family = AF_INET6;
- addri6->sin6_port = htons(arg->svr->port);
+ addri6->sin6_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
addri6->sin6_flowinfo = 0;
addri6->sin6_scope_id = 0;
goto on_mem_error;
addri->sin_family = AF_INET;
- addri->sin_port = htons(arg->svr->port);
+ addri->sin_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port);
memcpy(&addri->sin_addr.s_addr,
&arg->addr.v4, sizeof(struct in_addr));
unsigned char *tosend = NULL;
int tosend_len;
int canonname_len = 0;
- int err;
- eina_convert_itoa(svr->port, service);
+ eina_convert_itoa(svr->ecs ? svr->ecs->port : svr->port, service);
/* CHILD */
- if (!getaddrinfo(svr->name, service, hints, &result) && result)
+ if (!getaddrinfo(svr->ecs ? svr->ecs->ip : svr->name, service, hints, &result) && result)
{
if (result->ai_canonname)
canonname_len = strlen(result->ai_canonname) + 1;
memcpy(container->service, sbuf, sizeof(container->service));
}
- err = write(fd[1], tosend, tosend_len);
+ if (write(fd[1], tosend, tosend_len) < 0) perror("write");
}
if (result)
freeaddrinfo(result);
- err = write(fd[1], "", 1);
+ if (write(fd[1], "", 1) < 0) perror("write");
close(fd[1]);
#if defined(__USE_ISOC99) && !defined(__UCLIBC__)
_Exit(0);
free(msg);
}
#endif
- if (!cl->delete_me)
- ecore_con_event_client_del(cl);
- cl->dead = EINA_TRUE;
+ _ecore_con_client_kill(cl);
return ECORE_CALLBACK_CANCEL;
}
free(msg);
}
#endif
- if (!cl->host_server->delete_me)
- ecore_con_event_server_del(cl->host_server);
- cl->host_server->dead = EINA_TRUE;
+ _ecore_con_server_kill(cl->host_server);
return ECORE_CALLBACK_CANCEL;
ecore_main_win32_handler_del(wh);
free(msg);
}
#endif
- if (!svr->delete_me)
- ecore_con_event_server_del(svr);
- svr->dead = EINA_TRUE;
+ _ecore_con_server_kill(svr);
return ECORE_CALLBACK_CANCEL;
ecore_main_win32_handler_del(wh);
free(msg);
}
#endif
- if (!svr->delete_me)
- ecore_con_event_server_del(svr);
- svr->dead = EINA_TRUE;
+ _ecore_con_server_kill(svr);
return ECORE_CALLBACK_CANCEL;
}
if (!svr->pipe)
return ECORE_CALLBACK_CANCEL;
- if (svr->dead)
- return ECORE_CALLBACK_CANCEL;
-
if (svr->delete_me)
return ECORE_CALLBACK_CANCEL;
ecore_con_event_server_error(svr, msg);
free(msg);
}
- if (!svr->delete_me)
- ecore_con_event_server_del(svr);
- svr->dead = EINA_TRUE;
+ _ecore_con_server_kill(svr);
}
svr->write_buf_offset += written;
if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf))
{
svr->write_buf_offset = 0;
- eina_binbuf_free(svr->buf);
+ eina_binbuf_free(svr->buf);
svr->buf = NULL;
svr->want_write = 0;
}
ecore_con_event_client_error(cl, msg);
free(msg);
}
- if (!cl->delete_me)
- ecore_con_event_client_del(cl);
- cl->dead = EINA_TRUE;
+ _ecore_con_client_kill(cl);
}
cl->buf_offset += written;
typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup;
typedef struct _Ecore_Con_Info Ecore_Con_Info;
-
+typedef struct Ecore_Con_Socks_v4 Ecore_Con_Socks_v4;
+typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5;
typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos);
typedef enum _Ecore_Con_State
ECORE_CON_SSL_STATE_INIT
} Ecore_Con_Ssl_State;
+typedef enum Ecore_Con_Socks_State
+{
+ ECORE_CON_SOCKS_STATE_DONE = 0,
+ ECORE_CON_SOCKS_STATE_RESOLVED,
+ ECORE_CON_SOCKS_STATE_INIT,
+ ECORE_CON_SOCKS_STATE_READ
+} Ecore_Con_Socks_State;
+
struct _Ecore_Con_Client
{
ECORE_MAGIC;
#endif
Ecore_Con_Ssl_State ssl_state;
Eina_Bool handshaking : 1;
- Eina_Bool upgrade : 1;
- Eina_Bool dead : 1;
- Eina_Bool delete_me : 1;
+ Eina_Bool upgrade : 1; /* STARTTLS queued */
+ Eina_Bool delete_me : 1; /* del event has been queued */
};
struct _Ecore_Con_Server
Eina_List *event_count;
int client_limit;
pid_t ppid;
+ /* socks */
+ Ecore_Con_Socks *ecs;
+ Ecore_Con_Socks_State ecs_state;
+ int ecs_addrlen;
+ unsigned char ecs_addr[16];
+ unsigned int ecs_buf_offset;
+ Eina_Binbuf *ecs_buf;
+ Eina_Binbuf *ecs_recvbuf;
+ const char *proxyip;
+ int proxyport;
+ /* endsocks */
+ const char *verify_name;
#if USE_GNUTLS
gnutls_session_t session;
gnutls_anon_client_credentials_t anoncred_c;
double disconnect_time;
double client_disconnect_time;
const char *ip;
- Eina_Bool dead : 1;
Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */
Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */
Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */
- Eina_Bool upgrade : 1;
+ Eina_Bool upgrade : 1; /* STARTTLS queued */
Eina_Bool ssl_prepared : 1;
Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */
Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */
Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */
Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */
Eina_Bool reject_excess_clients : 1;
- Eina_Bool delete_me : 1;
+ Eina_Bool delete_me : 1; /* del event has been queued */
#ifdef _WIN32
Eina_Bool want_write : 1;
Eina_Bool read_stop : 1;
Eina_List *additional_headers;
Eina_List *response_headers;
const char *url;
+ long proxy_type;
+
+ Ecore_Timer *timer;
Ecore_Con_Url_Time time_condition;
double timestamp;
void *data;
+
+ void *post_data;
int received;
int write_fd;
const void *data;
};
+#define ECORE_CON_SOCKS_CAST_ELSE(X) \
+ Ecore_Con_Socks_v4 *v4 = NULL; \
+ Ecore_Con_Socks_v5 *v5 = NULL; \
+ if ((X) && ((X)->version == 4)) \
+ v4 = (Ecore_Con_Socks_v4*)(X); \
+ else if ((X) && ((X)->version == 5)) \
+ v5 = (Ecore_Con_Socks_v5*)(X); \
+ else
+
+struct Ecore_Con_Socks
+{
+ unsigned char version;
+
+ const char *ip;
+ int port;
+ const char *username;
+ Eina_Bool lookup : 1;
+ Eina_Bool bind : 1;
+};
+
+struct Ecore_Con_Socks_v4
+{
+ unsigned char version;
+
+ const char *ip;
+ int port;
+ const char *username;
+ Eina_Bool lookup : 1;
+ Eina_Bool bind : 1;
+};
+
+struct Ecore_Con_Socks_v5
+{
+ unsigned char version;
+
+ const char *ip;
+ int port;
+ const char *username;
+ Eina_Bool lookup : 1;
+ Eina_Bool bind : 1;
+};
+
+extern Ecore_Con_Socks *_ecore_con_proxy_once;
+extern Ecore_Con_Socks *_ecore_con_proxy_global;
+void ecore_con_socks_init(void);
+void ecore_con_socks_shutdown(void);
+Eina_Bool ecore_con_socks_svr_init(Ecore_Con_Server *svr);
+void ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num);
+void ecore_con_socks_dns_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr);
/* from ecore_con.c */
void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info);
+void ecore_con_event_proxy_bind(Ecore_Con_Server *svr);
void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate);
void ecore_con_event_server_del(Ecore_Con_Server *svr);
-void ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error);
+#define ecore_con_event_server_error(svr, error) _ecore_con_event_server_error((svr), (char*)(error), EINA_TRUE)
+void _ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate);
void ecore_con_event_client_add(Ecore_Con_Client *cl);
void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate);
void ecore_con_event_client_del(Ecore_Con_Client *cl);
void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error);
-
+void _ecore_con_server_kill(Ecore_Con_Server *svr);
+void _ecore_con_client_kill(Ecore_Con_Client *cl);
/* from ecore_local_win32.c */
#ifdef _WIN32
Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr);
GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del);
GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write);
GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data);
+GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind);
void ecore_con_mempool_init(void);
void ecore_con_mempool_shutdown(void);
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#ifdef HAVE_NETINET_TCP_H
+# include <netinet/tcp.h>
+#endif
+
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+
+/* if net/if.h is not found or if an older versions of net/if.h is provided
+ which does not define IF_NAMESIZE. We must define it ourselves */
+#ifndef IF_NAMESIZE
+# ifdef IFNAMSIZ
+# define IF_NAMESIZE IFNAMSIZ
+# else
+# define IF_NAMESIZE 16
+# endif
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+#ifdef HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+
+#ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
+#include "Ecore.h"
+#include "ecore_private.h"
+#include "Ecore_Con.h"
+#include "ecore_con_private.h"
+
+#define _ecore_con_server_kill(svr) do { \
+ DBG("KILL %p", (svr)); \
+ _ecore_con_server_kill((svr)); \
+} while (0)
+
+Eina_List *ecore_con_socks_proxies = NULL;
+
+static Ecore_Con_Socks *
+_ecore_con_socks_find(unsigned char version, const char *ip, int port, const char *username)
+{
+ Eina_List *l;
+ Ecore_Con_Socks *ecs;
+
+ if (!ecore_con_socks_proxies) return NULL;
+
+ EINA_LIST_FOREACH(ecore_con_socks_proxies, l, ecs)
+ {
+ if (ecs->version != version) continue;
+ if (strcmp(ecs->ip, ip)) continue;
+ if ((port != -1) && (port != ecs->port)) continue;
+ if (username && strcmp(ecs->username, username)) continue;
+ return ecs;
+ }
+ return NULL;
+}
+
+static void
+_ecore_con_socks_free(Ecore_Con_Socks *ecs)
+{
+ ECORE_CON_SOCKS_CAST_ELSE(ecs) return;
+
+ if (_ecore_con_proxy_once == ecs) _ecore_con_proxy_once = NULL;
+ if (_ecore_con_proxy_global == ecs) _ecore_con_proxy_global = NULL;
+ eina_stringshare_del(ecs->ip);
+ eina_stringshare_del(ecs->username);
+ free(ecs);
+}
+/////////////////////////////////////////////////////////////////////////////////////
+void
+ecore_con_socks_shutdown(void)
+{
+ Ecore_Con_Socks *ecs;
+ EINA_LIST_FREE(ecore_con_socks_proxies, ecs)
+ _ecore_con_socks_free(ecs);
+ _ecore_con_proxy_once = NULL;
+ _ecore_con_proxy_global = NULL;
+}
+
+void
+ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num)
+{
+ const unsigned char *data;
+ ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return;
+
+ if (svr->ecs_state != ECORE_CON_SOCKS_STATE_READ) return;
+
+ if (v4)
+ {
+ DBG("SOCKS: %d bytes", num);
+ if (num < 8)
+ {
+ if (!svr->ecs_recvbuf) svr->ecs_recvbuf = eina_binbuf_new();
+ if (!svr->ecs_recvbuf) goto error;
+ eina_binbuf_append_length(svr->ecs_recvbuf, buf, num);
+ /* the slowest connection on earth */
+ if (eina_binbuf_length_get(svr->ecs_recvbuf) != 8) return;
+ data = eina_binbuf_string_get(svr->ecs_recvbuf);
+ }
+ else if (num > 8) goto error;
+ else
+ data = buf;
+
+ /* http://ufasoft.com/doc/socks4_protocol.htm */
+ if (data[0]) goto error;
+ switch (data[1])
+ {
+ case 90:
+ /* success! */
+ break;
+ case 91:
+ ecore_con_event_server_error(svr, "proxy request rejected or failed");
+ goto error;
+ case 92:
+ ecore_con_event_server_error(svr, "proxying SOCKS server could not perform authentication");
+ goto error;
+ case 93:
+ ecore_con_event_server_error(svr, "proxy request authentication rejected");
+ goto error;
+ default:
+ ecore_con_event_server_error(svr, "garbage data from proxy");
+ goto error;
+ }
+ if (svr->ecs->bind)
+ {
+ unsigned int nport;
+ char naddr[IF_NAMESIZE];
+
+ memcpy(&nport, &data[2], 2);
+ svr->proxyport = ntohl(nport);
+
+ if (!inet_ntop(AF_INET, &data[4], naddr, sizeof(naddr))) goto error;
+ svr->proxyip = eina_stringshare_add(naddr);
+ ecore_con_event_proxy_bind(svr);
+ }
+ svr->ecs_state = ECORE_CON_SOCKS_STATE_DONE;
+ INF("PROXY CONNECTED");
+ if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
+ svr->ecs_recvbuf = NULL;
+ svr->ecs_buf_offset = svr->ecs_addrlen = 0;
+ memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr));
+ if (!svr->ssl_state)
+ ecore_con_event_server_add(svr);
+ if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf)))
+ ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
+ }
+ return;
+error:
+ _ecore_con_server_kill(svr);
+}
+
+Eina_Bool
+ecore_con_socks_svr_init(Ecore_Con_Server *svr)
+{
+ unsigned char *sbuf;
+ ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return EINA_FALSE;
+
+ if (!svr->ip) return EINA_FALSE;
+ if (svr->ecs_buf) return EINA_FALSE;
+ if (svr->ecs_state != ECORE_CON_SOCKS_STATE_INIT) return EINA_FALSE;
+ ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
+ if (v4)
+ {
+ size_t addrlen, buflen, ulen = 1;
+ addrlen = svr->ecs->lookup ? strlen(svr->name) + 1: 0;
+ if (svr->ecs->username) ulen += strlen(svr->ecs->username);
+ buflen = sizeof(char) * (8 + ulen + addrlen);
+ sbuf = malloc(buflen);
+ if (!sbuf)
+ {
+ ecore_con_event_server_error(svr, "Memory allocation failure!");
+ _ecore_con_server_kill(svr);
+ return EINA_FALSE;
+ }
+ /* http://en.wikipedia.org/wiki/SOCKS */
+ sbuf[0] = 4;
+ sbuf[1] = v4->bind ? 2 : 1;
+ sbuf[2] = svr->port >> 8;
+ sbuf[3] = svr->port & 0xff;
+ if (addrlen)
+ {
+ sbuf[4] = sbuf[5] = sbuf[6] = 0;
+ sbuf[7] = 1;
+ }
+ else
+ memcpy(sbuf + 4, svr->ecs_addr, 4);
+ if (svr->ecs->username)
+ memcpy(sbuf + 8, svr->ecs->username, ulen);
+ else
+ sbuf[8] = 0;
+ if (addrlen) memcpy(sbuf + 8 + ulen, svr->name, addrlen);
+
+ svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
+ }
+ return EINA_TRUE;
+}
+
+void
+ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr)
+{
+ svr->ip = eina_stringshare_add(ip);
+ svr->ecs_addrlen = addrlen;
+ svr->ecs_state++;
+ if (addr->sa_family == AF_INET)
+ memcpy(svr->ecs_addr, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4);
+#ifdef HAVE_IPV6
+ else
+ memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, addrlen);
+#endif
+ ecore_con_socks_svr_init(svr);
+}
+
+void
+ecore_con_socks_init(void)
+{
+ const char *socks;
+ char *u, *h, *p, *l;
+ char buf[64];
+ int port, lookup = 0;
+ Ecore_Con_Socks *ecs;
+ unsigned char addr[sizeof(struct in_addr)];
+
+ /* ECORE_CON_SOCKS_V4=user@host:port:[1|0] */
+ socks = getenv("ECORE_CON_SOCKS_V4");
+ if ((!socks) || (!socks[0]) || (strlen(socks) > 64)) return;
+ strncpy(buf, socks, sizeof(buf));
+ h = strchr(buf, '@');
+ u = NULL;
+ /* username */
+ if (h && (h - buf > 0)) *h++ = 0, u = buf;
+ else h = buf;
+
+ /* host ip; I ain't resolvin shit here */
+ p = strchr(h, ':');
+ if (!p) return;
+ *p++ = 0;
+ if (!inet_pton(AF_INET, h, addr)) return;
+
+ errno = 0;
+ port = strtol(p, &l, 10);
+ if (errno || (port < 0) || (port > 65535)) return;
+ if (l && (l[0] == ':'))
+ lookup = (l[1] == '1');
+ ecs = ecore_con_socks4_remote_add(h, port, u);
+ if (!ecs) return;
+ ecore_con_socks4_lookup_set(ecs, lookup);
+ ecore_con_socks_apply_always(ecs);
+ INF("Added global proxy server %s%s%s:%d - DNS lookup %s",
+ u ?: "", u ? "@" : "", h, port, lookup ? "ENABLED" : "DISABLED");
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @defgroup Ecore_Con_Socks_Group Ecore Connection SOCKS functions
+ * @{
+ */
+
+/**
+ * Add a SOCKS v4 proxy to the proxy list
+ *
+ * Use this to create (or return, if previously added) a SOCKS proxy
+ * object which can be used by any ecore_con servers.
+ * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
+ * @param port The port to connect to on the proxy
+ * @param username The username to use for the proxy (OPTIONAL)
+ * @return An allocated proxy object, or NULL on failure
+ * @note This object NEVER needs to be explicitly freed.
+ * @since 1.2
+ */
+EAPI Ecore_Con_Socks *
+ecore_con_socks4_remote_add(const char *ip, int port, const char *username)
+{
+ Ecore_Con_Socks *ecs;
+
+ if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL;
+
+ ecs = _ecore_con_socks_find(4, ip, port, username);
+ if (ecs) return ecs;
+
+ ecs = calloc(1, sizeof(Ecore_Con_Socks_v4));
+ if (!ecs) return NULL;
+
+ ecs->version = 4;
+ ecs->ip = eina_stringshare_add(ip);
+ ecs->port = port;
+ ecs->username = eina_stringshare_add(username);
+ ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs);
+ return ecs;
+}
+
+/**
+ * Set DNS lookup mode on an existing SOCKS v4 proxy
+ *
+ * According to RFC, SOCKS v4 does not require that a proxy perform
+ * its own DNS lookups for addresses. SOCKS v4a specifies the protocol
+ * for this. If you want to enable remote DNS lookup and are sure that your
+ * proxy supports it, use this function.
+ * @param ecs The proxy object
+ * @param enable If true, the proxy will perform the dns lookup
+ * @note By default, this setting is DISABLED.
+ * @since 1.2
+ */
+EAPI void
+ecore_con_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable)
+{
+ ECORE_CON_SOCKS_CAST_ELSE(ecs) return;
+ if (v4) v4->lookup = !!enable;
+}
+
+/**
+ * Get DNS lookup mode on an existing SOCKS v4 proxy
+ *
+ * According to RFC, SOCKS v4 does not require that a proxy perform
+ * its own DNS lookups for addresses. SOCKS v4a specifies the protocol
+ * for this. This function returns whether lookups are enabled on a proxy object.
+ * @param ecs The proxy object
+ * @return If true, the proxy will perform the dns lookup
+ * @note By default, this setting is DISABLED.
+ * @since 1.2
+ */
+EAPI Eina_Bool
+ecore_con_socks4_lookup_get(Ecore_Con_Socks *ecs)
+{
+ ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE;
+ return v4 ? v4->lookup : EINA_FALSE;
+}
+
+/**
+ * Find a SOCKS v4 proxy in the proxy list
+ *
+ * Use this to determine if a SOCKS proxy was previously added by checking
+ * the proxy list against the parameters given.
+ * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
+ * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
+ * @param username The username used for the proxy (OPTIONAL)
+ * @return true only if a proxy exists matching the given params
+ * @note This function matches slightly more loosely than ecore_con_socks4_remote_add(), and
+ * ecore_con_socks4_remote_add() should be used to return the actual object.
+ * @since 1.2
+ */
+EAPI Eina_Bool
+ecore_con_socks4_remote_exists(const char *ip, int port, const char *username)
+{
+ if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])))
+ return EINA_FALSE;
+ return !!_ecore_con_socks_find(4, ip, port, username);
+}
+
+/**
+ * Remove a SOCKS v4 proxy from the proxy list and delete it
+ *
+ * Use this to remove a SOCKS proxy from the proxy list by checking
+ * the list against the parameters given. The proxy will then be deleted.
+ * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
+ * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
+ * @param username The username used for the proxy (OPTIONAL)
+ * @note This function matches in the same way as ecore_con_socks4_remote_exists().
+ * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
+ * @since 1.2
+ */
+EAPI void
+ecore_con_socks4_remote_del(const char *ip, int port, const char *username)
+{
+ Ecore_Con_Socks_v4 *v4;
+
+ if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) return;
+ if (!ecore_con_socks_proxies) return;
+
+ v4 = (Ecore_Con_Socks_v4*)_ecore_con_socks_find(4, ip, port, username);
+ if (!v4) return;
+ ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4);
+ _ecore_con_socks_free((Ecore_Con_Socks*)v4);
+}
+
+/**
+ * Enable bind mode on a SOCKS proxy
+ *
+ * Use this function to enable binding a remote port for use with a remote server.
+ * For more information, see http://ufasoft.com/doc/socks4_protocol.htm
+ * @param ecs The proxy object
+ * @param is_bind If true, the connection established will be a port binding
+ * @warning Be aware that changing the operation mode of an active proxy may result in undefined behavior
+ * @since 1.2
+ */
+EAPI void
+ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ecs);
+ ecs->bind = !!is_bind;
+}
+
+/**
+ * Return bind mode of a SOCKS proxy
+ *
+ * Use this function to return bind mode of a proxy (binding a remote port for use with a remote server).
+ * For more information, see http://ufasoft.com/doc/socks4_protocol.htm
+ * @param ecs The proxy object
+ * @return If true, the connection established will be a port binding
+ * @since 1.2
+ */
+EAPI Eina_Bool
+ecore_con_socks_bind_get(Ecore_Con_Socks *ecs)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ecs, EINA_FALSE);
+ return ecs->bind;
+}
+
+EAPI unsigned int
+ecore_con_socks_version_get(Ecore_Con_Socks *ecs)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ecs, 0);
+ return ecs->version;
+}
+
+/**
+ * Remove a SOCKS v4 proxy from the proxy list and delete it
+ *
+ * Use this to remove a SOCKS proxy from the proxy list by directly deleting the object given.
+ * @param ecs The proxy object to delete
+ * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
+ * @since 1.2
+ */
+EAPI void
+ecore_con_socks_remote_del(Ecore_Con_Socks *ecs)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ecs);
+ if (!ecore_con_socks_proxies) return;
+
+ ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, ecs);
+ _ecore_con_socks_free(ecs);
+}
+
+/**
+ * Set a proxy object to be used with the next server created with ecore_con_server_connect()
+ *
+ * This function sets a proxy for the next ecore_con connection. After the next server is created,
+ * the proxy will NEVER be applied again unless explicitly enabled.
+ * @param ecs The proxy object
+ * @see ecore_con_socks_apply_always()
+ * @since 1.2
+ */
+EAPI void
+ecore_con_socks_apply_once(Ecore_Con_Socks *ecs)
+{
+ _ecore_con_proxy_once = ecs;
+}
+
+/**
+ * Set a proxy object to be used with all servers created with ecore_con_server_connect()
+ *
+ * This function sets a proxy for all ecore_con connections. It will always be used.
+ * @param ecs The proxy object
+ * @see ecore_con_socks_apply_once()
+ * @since 1.2
+ * @note ecore-con supports setting this through environment variables like so:
+ * ECORE_CON_SOCKS_V4=[user@]server:port:lookup
+ * user is the OPTIONAL string that would be passed to the proxy as the username
+ * server is the IP_ADDRESS of the proxy server
+ * port is the port to connect to on the proxy server
+ * lookup is 1 if the proxy should perform all DNS lookups, otherwise 0 or omitted
+ */
+EAPI void
+ecore_con_socks_apply_always(Ecore_Con_Socks *ecs)
+{
+ _ecore_con_proxy_global = ecs;
+}
+/** @} */
# include <ws2tcpip.h>
#endif
+#include <sys/stat.h>
#include "Ecore.h"
#include "ecore_con_private.h"
ecore_con_event_server_error(conn, buf);
}
+static void
+_gnutls_print_session(const gnutls_datum_t *cert_list, unsigned int cert_list_size)
+{
+ char *c = NULL;
+ gnutls_x509_crt_t crt;
+ unsigned int x;
+
+ if (!eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) return;
+ for (x = 0; x < cert_list_size; x++)
+ {
+ gnutls_x509_crt_init(&crt);
+ gnutls_x509_crt_import(crt, &cert_list[x], GNUTLS_X509_FMT_DER);
+ gnutls_x509_crt_print(crt, GNUTLS_CRT_PRINT_FULL, (gnutls_datum_t*)&c);
+ INF("CERTIFICATE:\n%s", c);
+ gnutls_free(c);
+ gnutls_x509_crt_deinit(crt);
+ crt = NULL;
+ }
+}
+
#ifdef ISCOMFITOR
static void
_gnutls_log_func(int level,
const char *str)
{
- DBG("|<%d>| %s", level, str);
+ char buf[128];
+ strncat(buf, str, strlen(str) - 1);
+ DBG("|<%d>| %s", level, buf);
}
#endif
#elif USE_OPENSSL
static void
+_openssl_print_verify_error(int error)
+{
+ switch (error)
+ {
+#define ERROR(X) \
+ case (X): \
+ ERR("%s", #X); \
+ break
+#ifdef X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
+ ERROR(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT);
+#endif
+#ifdef X509_V_ERR_UNABLE_TO_GET_CRL
+ ERROR(X509_V_ERR_UNABLE_TO_GET_CRL);
+#endif
+#ifdef X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
+ ERROR(X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE);
+#endif
+#ifdef X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
+ ERROR(X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE);
+#endif
+#ifdef X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
+ ERROR(X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY);
+#endif
+#ifdef X509_V_ERR_CERT_SIGNATURE_FAILURE
+ ERROR(X509_V_ERR_CERT_SIGNATURE_FAILURE);
+#endif
+#ifdef X509_V_ERR_CRL_SIGNATURE_FAILURE
+ ERROR(X509_V_ERR_CRL_SIGNATURE_FAILURE);
+#endif
+#ifdef X509_V_ERR_CERT_NOT_YET_VALID
+ ERROR(X509_V_ERR_CERT_NOT_YET_VALID);
+#endif
+#ifdef X509_V_ERR_CERT_HAS_EXPIRED
+ ERROR(X509_V_ERR_CERT_HAS_EXPIRED);
+#endif
+#ifdef X509_V_ERR_CRL_NOT_YET_VALID
+ ERROR(X509_V_ERR_CRL_NOT_YET_VALID);
+#endif
+#ifdef X509_V_ERR_CRL_HAS_EXPIRED
+ ERROR(X509_V_ERR_CRL_HAS_EXPIRED);
+#endif
+#ifdef X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
+ ERROR(X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD);
+#endif
+#ifdef X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
+ ERROR(X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD);
+#endif
+#ifdef X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
+ ERROR(X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD);
+#endif
+#ifdef X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
+ ERROR(X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD);
+#endif
+#ifdef X509_V_ERR_OUT_OF_MEM
+ ERROR(X509_V_ERR_OUT_OF_MEM);
+#endif
+#ifdef X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
+ ERROR(X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT);
+#endif
+#ifdef X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
+ ERROR(X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN);
+#endif
+#ifdef X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
+ ERROR(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY);
+#endif
+#ifdef X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
+ ERROR(X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
+#endif
+#ifdef X509_V_ERR_CERT_CHAIN_TOO_LONG
+ ERROR(X509_V_ERR_CERT_CHAIN_TOO_LONG);
+#endif
+#ifdef X509_V_ERR_CERT_REVOKED
+ ERROR(X509_V_ERR_CERT_REVOKED);
+#endif
+#ifdef X509_V_ERR_INVALID_CA
+ ERROR(X509_V_ERR_INVALID_CA);
+#endif
+#ifdef X509_V_ERR_PATH_LENGTH_EXCEEDED
+ ERROR(X509_V_ERR_PATH_LENGTH_EXCEEDED);
+#endif
+#ifdef X509_V_ERR_INVALID_PURPOSE
+ ERROR(X509_V_ERR_INVALID_PURPOSE);
+#endif
+#ifdef X509_V_ERR_CERT_UNTRUSTED
+ ERROR(X509_V_ERR_CERT_UNTRUSTED);
+#endif
+#ifdef X509_V_ERR_CERT_REJECTED
+ ERROR(X509_V_ERR_CERT_REJECTED);
+#endif
+ /* These are 'informational' when looking for issuer cert */
+#ifdef X509_V_ERR_SUBJECT_ISSUER_MISMATCH
+ ERROR(X509_V_ERR_SUBJECT_ISSUER_MISMATCH);
+#endif
+#ifdef X509_V_ERR_AKID_SKID_MISMATCH
+ ERROR(X509_V_ERR_AKID_SKID_MISMATCH);
+#endif
+#ifdef X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
+ ERROR(X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH);
+#endif
+#ifdef X509_V_ERR_KEYUSAGE_NO_CERTSIGN
+ ERROR(X509_V_ERR_KEYUSAGE_NO_CERTSIGN);
+#endif
+
+#ifdef X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER
+ ERROR(X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER);
+#endif
+#ifdef X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION
+ ERROR(X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION);
+#endif
+#ifdef X509_V_ERR_KEYUSAGE_NO_CRL_SIGN
+ ERROR(X509_V_ERR_KEYUSAGE_NO_CRL_SIGN);
+#endif
+#ifdef X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION
+ ERROR(X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION);
+#endif
+#ifdef X509_V_ERR_INVALID_NON_CA
+ ERROR(X509_V_ERR_INVALID_NON_CA);
+#endif
+#ifdef X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED
+ ERROR(X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED);
+#endif
+#ifdef X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE
+ ERROR(X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE);
+#endif
+#ifdef X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED
+ ERROR(X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED);
+#endif
+
+#ifdef X509_V_ERR_INVALID_EXTENSION
+ ERROR(X509_V_ERR_INVALID_EXTENSION);
+#endif
+#ifdef X509_V_ERR_INVALID_POLICY_EXTENSION
+ ERROR(X509_V_ERR_INVALID_POLICY_EXTENSION);
+#endif
+#ifdef X509_V_ERR_NO_EXPLICIT_POLICY
+ ERROR(X509_V_ERR_NO_EXPLICIT_POLICY);
+#endif
+#ifdef X509_V_ERR_DIFFERENT_CRL_SCOPE
+ ERROR(X509_V_ERR_DIFFERENT_CRL_SCOPE);
+#endif
+#ifdef X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE
+ ERROR(X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE);
+#endif
+
+#ifdef X509_V_ERR_UNNESTED_RESOURCE
+ ERROR(X509_V_ERR_UNNESTED_RESOURCE);
+#endif
+
+#ifdef X509_V_ERR_PERMITTED_VIOLATION
+ ERROR(X509_V_ERR_PERMITTED_VIOLATION);
+#endif
+#ifdef X509_V_ERR_EXCLUDED_VIOLATION
+ ERROR(X509_V_ERR_EXCLUDED_VIOLATION);
+#endif
+#ifdef X509_V_ERR_SUBTREE_MINMAX
+ ERROR(X509_V_ERR_SUBTREE_MINMAX);
+#endif
+#ifdef X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
+ ERROR(X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE);
+#endif
+#ifdef X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX
+ ERROR(X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX);
+#endif
+#ifdef X509_V_ERR_UNSUPPORTED_NAME_SYNTAX
+ ERROR(X509_V_ERR_UNSUPPORTED_NAME_SYNTAX);
+#endif
+#ifdef X509_V_ERR_CRL_PATH_VALIDATION_ERROR
+ ERROR(X509_V_ERR_CRL_PATH_VALIDATION_ERROR);
+#endif
+
+ /* The application is not happy */
+#ifdef X509_V_ERR_APPLICATION_VERIFICATION
+ ERROR(X509_V_ERR_APPLICATION_VERIFICATION);
+#endif
+ }
+#undef ERROR
+}
+
+static void
_openssl_print_errors(void *conn, int type)
{
char buf[1024];
EINA_SAFETY_ON_TRUE_RETURN_VAL(!s, EINA_FALSE);
/* same as above for the stored name */
EINA_SAFETY_ON_TRUE_RETURN_VAL(!strchr(s + 1, '.'), EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(strcasecmp(s, name + 1), EINA_FALSE);
+ if (strcasecmp(s, name + 1))
+ {
+ ERR("%s != %s", s, name + 1);
+ return EINA_FALSE;
+ }
}
else
- EINA_SAFETY_ON_TRUE_RETURN_VAL(strcasecmp(name, svrname), EINA_FALSE);
+ if (strcasecmp(name, svrname))
+ {
+ ERR("%s != %s", name, svrname);
+ return EINA_FALSE;
+ }
return EINA_TRUE;
}
+static void
+_openssl_print_session(SSL *ssl)
+{
+ /* print session info into DBG */
+ SSL_SESSION *s;
+ STACK_OF(X509) *sk;
+ BIO *b;
+ char log[4096], *p;
+ int x;
+
+ if (!eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) return;
+
+ memset(log, 0, sizeof(log));
+ b = BIO_new(BIO_s_mem());
+ sk = SSL_get_peer_cert_chain(ssl);
+ if (sk)
+ {
+ DBG("CERTIFICATES:");
+ for (x = 0; x < sk_X509_num(sk); x++)
+ {
+ p = X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, x)), log, sizeof(log));
+ DBG("%2d s:%s", x, p);
+ p = X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk, x)), log, sizeof(log));
+ DBG(" i:%s", p);
+ PEM_write_X509(stderr, sk_X509_value(sk, x));
+ }
+ }
+ s = SSL_get_session(ssl);
+ SSL_SESSION_print(b, s);
+ fprintf(stderr, "\n");
+ while (BIO_read(b, log, sizeof(log)) > 0)
+ fprintf(stderr, "%s", log);
+
+ BIO_free(b);
+}
+
#endif
#define SSL_ERROR_CHECK_GOTO_ERROR(X) \
}
/**
+ * @brief Set the hostname to verify against in certificate verification
+ *
+ * Sometimes the certificate hostname will not match the hostname that you are
+ * connecting to, and will instead match a different name. An example of this is
+ * that if you connect to talk.google.com to use Google Talk, you receive Google's
+ * certificate for gmail.com. This certificate should be trusted, and so you must call
+ * this function with "gmail.com" as @p name.
+ * See RFC2818 for more details.
+ * @param svr The server object
+ * @param name The hostname to verify against
+ * @since 1.2
+ */
+EAPI void
+ecore_con_ssl_server_verify_name_set(Ecore_Con_Server *svr, const char *name)
+{
+ if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
+ {
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
+ return;
+ }
+ eina_stringshare_replace(&svr->verify_name, name);
+}
+
+/**
+ * @brief Get the hostname to verify against in certificate verification
+ *
+ * This function returns the name which will be used to validate the SSL certificate
+ * common name (CN) or alt name (subjectAltName). It will default to the @p name
+ * param in ecore_con_server_connect(), but can be changed with ecore_con_ssl_server_verify_name_set().
+ * @param svr The server object
+ * @return The hostname which will be used
+ * @since 1.2
+ */
+EAPI const char *
+ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr)
+{
+ if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
+ {
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__);
+ return NULL;
+ }
+ return svr->verify_name ?: svr->name;
+}
+
+/**
* @brief Add an ssl certificate for use in ecore_con functions.
*
* Use this function to add a SSL PEM certificate.
return EINA_FALSE;
}
+ if (!svr->ssl_prepared)
+ {
+ svr->use_cert = EINA_TRUE;
+ svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
+ if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
+ return EINA_FALSE;
+ }
+
return SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (svr, cert);
}
* If there is an error loading the CAs, an error will automatically be logged.
* @param ca_file The path to the CA file.
* @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE.
+ * @note since 1.2, this function can load directores
*/
EAPI Eina_Bool
return EINA_FALSE;
}
+ if (!svr->ssl_prepared)
+ {
+ svr->use_cert = EINA_TRUE;
+ svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
+ if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
+ return EINA_FALSE;
+ }
+
return SSL_SUFFIX(_ecore_con_ssl_server_cafile_add) (svr, ca_file);
}
return EINA_FALSE;
}
+ if (!svr->ssl_prepared)
+ {
+ svr->use_cert = EINA_TRUE;
+ svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
+ if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
+ return EINA_FALSE;
+ }
+
return SSL_SUFFIX(_ecore_con_ssl_server_privkey_add) (svr, key_file);
}
return EINA_FALSE;
}
+ if (!svr->ssl_prepared)
+ {
+ svr->use_cert = EINA_TRUE;
+ svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
+ if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL))
+ return EINA_FALSE;
+ }
+
return SSL_SUFFIX(_ecore_con_ssl_server_crl_add) (svr, crl_file);
}
if (ecore_con_ssl_server_prepare(svr, ssl_type))
return EINA_FALSE;
}
- svr->type |= ssl_type;
+ if (!svr->use_cert)
+ svr->type |= ssl_type;
svr->upgrade = EINA_TRUE;
svr->handshaking = EINA_TRUE;
svr->ssl_state = ECORE_CON_SSL_STATE_INIT;
* Once the upgrade has been completed, an ECORE_CON_EVENT_CLIENT_UPGRADE event will be emitted.
* The connection should be treated as disconnected until the next event.
* @param cl The client object
- * @param compl_type The SSL connection type (ONLY).
+ * @param ssl_type The SSL connection type (ONLY).
* @return EINA_FALSE if the connection cannot be upgraded, otherwise EINA_TRUE.
* @warning Setting a wrong value for @p compl_type WILL mess up your program.
* @since 1.1
if (ecore_con_ssl_server_prepare(cl->host_server, ssl_type))
return EINA_FALSE;
}
- cl->host_server->type |= ssl_type;
+ if (!cl->host_server->use_cert)
+ cl->host_server->type |= ssl_type;
cl->upgrade = EINA_TRUE;
cl->host_server->upgrade = EINA_TRUE;
cl->handshaking = EINA_TRUE;
return ECORE_CON_SSL_ERROR_INIT_FAILED;
#ifdef ISCOMFITOR
- gnutls_global_set_log_level(9);
- gnutls_global_set_log_function(_gnutls_log_func);
+ if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG))
+ {
+ gnutls_global_set_log_level(9);
+ gnutls_global_set_log_function(_gnutls_log_func);
+ }
#endif
return ECORE_CON_SSL_ERROR_NONE;
}
SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(svr->session, &cert_list_size)));
SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size);
+ _gnutls_print_session(cert_list, cert_list_size);
+
SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert));
SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER));
- SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, svr->name));
+ SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, svr->verify_name ?: svr->name));
gnutls_x509_crt_deinit(cert);
DBG("SSL certificate verification succeeded!");
return ECORE_CON_SSL_ERROR_NONE;
_ecore_con_ssl_server_cafile_add_gnutls(Ecore_Con_Server *svr,
const char *ca_file)
{
- SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_trust_file(svr->cert, ca_file,
- GNUTLS_X509_FMT_PEM) < 1);
+ struct stat st;
+ Eina_Iterator *it;
+ const char *file;
+ Eina_Bool error = EINA_FALSE;
- return EINA_TRUE;
+ if (stat(ca_file, &st)) return EINA_FALSE;
+ if (S_ISDIR(st.st_mode))
+ {
+ it = eina_file_ls(ca_file);
+ SSL_ERROR_CHECK_GOTO_ERROR(!it);
+ EINA_ITERATOR_FOREACH(it, file)
+ {
+ if (!error)
+ {
+ if (gnutls_certificate_set_x509_trust_file(svr->cert, file, GNUTLS_X509_FMT_PEM) < 1)
+ error++;
+ }
+ eina_stringshare_del(file);
+ }
+ eina_iterator_free(it);
+ }
+ else
+ SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_trust_file(svr->cert, ca_file,
+ GNUTLS_X509_FMT_PEM) < 1);
+
+ return !error;
error:
ERR("Could not load CA file!");
return EINA_FALSE;
SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(cl->session, &cert_list_size)));
SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size);
+ _gnutls_print_session(cert_list, cert_list_size);
/*
gnutls_x509_crt_t cert = NULL;
SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert));
break;
}
-#ifdef ISCOMFITOR
- {
- /* print session info into DBG */
- SSL_SESSION *s;
- BIO *b;
- char log[4096];
-
- memset(log, 0, sizeof(log));
- s = SSL_get_session(svr->ssl);
- b = BIO_new(BIO_s_mem());
- SSL_SESSION_print(b, s);
- while (BIO_read(b, log, sizeof(log)) > 0)
- DBG("%s", log);
-
- BIO_free(b);
- }
-#endif
+ _openssl_print_session(svr->ssl);
if ((!svr->verify) && (!svr->verify_basic))
/* not verifying certificates, so we're done! */
return ECORE_CON_SSL_ERROR_NONE;
cert = SSL_get_peer_certificate(svr->ssl);
if (cert)
{
- char buf[256] = {0};
+ char *c;
+ int clen;
+ int name = 0;
+
if (svr->verify)
- SSL_ERROR_CHECK_GOTO_ERROR(SSL_get_verify_result(svr->ssl));
- X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_subject_alt_name, buf, sizeof(buf));
- if (buf[0])
- SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(buf, svr->name));
- else
{
- X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, buf, sizeof(buf));
- SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(buf, svr->name));
+ int err;
+
+ err = SSL_get_verify_result(svr->ssl);
+ _openssl_print_verify_error(err);
+ SSL_ERROR_CHECK_GOTO_ERROR(err);
}
+ clen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_subject_alt_name, NULL, 0);
+ if (clen > 0)
+ name = NID_subject_alt_name;
+ else
+ clen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, NULL, 0);
+ SSL_ERROR_CHECK_GOTO_ERROR(clen < 1);
+ if (!name) name = NID_commonName;
+ c = alloca(++clen);
+ X509_NAME_get_text_by_NID(X509_get_subject_name(cert), name, c, clen);
+ INF("CERT NAME: %s\n", c);
+ SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(c, svr->verify_name ?: svr->name));
}
}
_ecore_con_ssl_server_cafile_add_openssl(Ecore_Con_Server *svr,
const char *ca_file)
{
- SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, ca_file, NULL));
+ struct stat st;
+
+ if (stat(ca_file, &st)) return EINA_FALSE;
+ if (S_ISDIR(st.st_mode))
+ SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, NULL, ca_file));
+ else
+ SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, ca_file, NULL));
return EINA_TRUE;
error:
break;
}
-#ifdef ISCOMFITOR
- {
- /* print session info into DBG */
- SSL_SESSION *s;
- BIO *b;
- char log[4096];
-
- memset(log, 0, sizeof(log));
- s = SSL_get_session(cl->ssl);
- b = BIO_new(BIO_s_mem());
- SSL_SESSION_print(b, s);
- while (BIO_read(b, log, sizeof(log)) > 0)
- DBG("%s", log);
-
- BIO_free(b);
- }
-#endif
-
+ _openssl_print_session(cl->ssl);
if (!cl->host_server->verify)
/* not verifying certificates, so we're done! */
return ECORE_CON_SSL_ERROR_NONE;
SSL_set_verify(cl->ssl, SSL_VERIFY_PEER, NULL);
/* use CRL/CA lists to verify */
if (SSL_get_peer_certificate(cl->ssl))
- SSL_ERROR_CHECK_GOTO_ERROR(SSL_get_verify_result(cl->ssl));
+ {
+ int err;
+
+ err = SSL_get_verify_result(cl->ssl);
+ _openssl_print_verify_error(err);
+ SSL_ERROR_CHECK_GOTO_ERROR(err);
+ }
return ECORE_CON_SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
-_ecore_con_ssl_server_upgrade_none(Ecore_Con_Server *svr __UNUSED__)
-{
- return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
-}
-
-static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_init_none(Ecore_Con_Server *svr __UNUSED__)
{
return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
}
static Ecore_Con_Ssl_Error
-_ecore_con_ssl_client_upgrade_none(Ecore_Con_Client *cl __UNUSED__)
-{
- return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
-}
-
-static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_init_none(Ecore_Con_Client *cl __UNUSED__)
{
return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
void *ev);
static Eina_Bool _ecore_con_url_idler_handler(void *data);
static Eina_Bool _ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__);
+static Eina_Bool _ecore_con_url_timeout_cb(void *data);
static Eina_List *_url_con_list = NULL;
static Eina_List *_fd_hd_list = NULL;
return NULL;
}
+ url_con->proxy_type = -1;
+ if (_ecore_con_proxy_global)
+ {
+ if (_ecore_con_proxy_global->ip)
+ {
+ char host[128];
+ if (_ecore_con_proxy_global->port > 0 &&
+ _ecore_con_proxy_global->port <= 65535)
+ snprintf(host, sizeof(host), "socks4://%s:%d",
+ _ecore_con_proxy_global->ip,
+ _ecore_con_proxy_global->port);
+ else
+ snprintf(host, sizeof(host), "socks4://%s",
+ _ecore_con_proxy_global->ip);
+ ecore_con_url_proxy_set(url_con, host);
+ }
+ }
+
ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate");
if (ret != CURLE_OK)
{
{
ret = curl_multi_remove_handle(_curlm, url_con->curl_easy);
if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
+ _url_con_list = eina_list_remove(_url_con_list, url_con);
}
curl_easy_cleanup(url_con->curl_easy);
}
+ if (url_con->timer) ecore_timer_del(url_con->timer);
- _url_con_list = eina_list_remove(_url_con_list, url_con);
curl_slist_free_all(url_con->headers);
EINA_LIST_FREE(url_con->additional_headers, s)
free(s);
EINA_LIST_FREE(url_con->response_headers, s)
free(s);
eina_stringshare_del(url_con->url);
+ if (url_con->post_data) free(url_con->post_data);
free(url_con);
#else
return;
#ifdef HAVE_CURL
Eina_List *l;
const char *s;
- char tmp[256];
+ char tmp[512];
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
if ((mode == MODE_POST) || (mode == MODE_AUTO))
{
- if (data)
+ if (url_con->post_data) free(url_con->post_data);
+ url_con->post_data = NULL;
+ if ((data) && (length > 0))
{
- if ((content_type) && (strlen(content_type) < 200))
+ url_con->post_data = malloc(length);
+ if (url_con->post_data)
{
- snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type);
- url_con->headers = curl_slist_append(url_con->headers, tmp);
+ memcpy(url_con->post_data, data, length);
+ if ((content_type) && (strlen(content_type) < 450))
+ {
+ snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type);
+ url_con->headers = curl_slist_append(url_con->headers, tmp);
+ }
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, url_con->post_data);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
}
-
- curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
+ else
+ return EINA_FALSE;
}
else curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 0);
if (mode == MODE_POST)
return res;
}
+EAPI Eina_Bool
+ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy)
+{
+#ifdef HAVE_CURL
+ int res = -1;
+ curl_version_info_data *vers = NULL;
+
+ if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+ {
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_set");
+ return EINA_FALSE;
+ }
+
+ if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE;
+ if (!url_con->url) return EINA_FALSE;
+
+ if (!proxy) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, "");
+ else
+ {
+ // before curl version 7.21.7, socks protocol:// prefix is not supported
+ // (e.g. socks4://, socks4a://, socks5:// or socks5h://, etc.)
+ vers = curl_version_info(CURLVERSION_NOW);
+ if (vers->version_num < 0x71507)
+ {
+ url_con->proxy_type = CURLPROXY_HTTP;
+ if (strstr(proxy, "socks4")) url_con->proxy_type = CURLPROXY_SOCKS4;
+ else if (strstr(proxy, "socks4a")) url_con->proxy_type = CURLPROXY_SOCKS4A;
+ else if (strstr(proxy, "socks5")) url_con->proxy_type = CURLPROXY_SOCKS5;
+ else if (strstr(proxy, "socks5h")) url_con->proxy_type = CURLPROXY_SOCKS5_HOSTNAME;
+ res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXYTYPE, url_con->proxy_type);
+ if (res != CURLE_OK)
+ {
+ ERR("curl proxy type setting failed: %s", curl_easy_strerror(res));
+ url_con->proxy_type = -1;
+ return EINA_FALSE;
+ }
+ }
+ res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, proxy);
+ }
+ if (res != CURLE_OK)
+ {
+ ERR("curl proxy setting failed: %s", curl_easy_strerror(res));
+ url_con->proxy_type = -1;
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+ (void)url_con;
+ (void)proxy;
+#endif
+}
+
+EAPI void
+ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout)
+{
+#ifdef HAVE_CURL
+ if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+ {
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_timeout_set");
+ return;
+ }
+
+ if (eina_list_data_find(_url_con_list, url_con)) return;
+ if (!url_con->url || timeout < 0) return;
+ if (url_con->timer) ecore_timer_del(url_con->timer);
+ url_con->timer = ecore_timer_add(timeout, _ecore_con_url_timeout_cb, url_con);
+#else
+ return;
+ (void)url_con;
+ (void)timeout;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username)
+{
+#ifdef HAVE_CURL
+ int res = -1;
+ if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+ {
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_username_set");
+ return EINA_FALSE;
+ }
+
+ if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE;
+ if (!url_con->url) return EINA_FALSE;
+ if (!username) return EINA_FALSE;
+ if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
+ {
+ ERR("Proxy type should be socks5 and above");
+ return EINA_FALSE;
+ }
+
+ res = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username);
+ if (res != CURLE_OK)
+ {
+ ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res));
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+ (void)url_con;
+ (void)username;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
+{
+#ifdef HAVE_CURL
+ int res = -1;
+ if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+ {
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_password_set");
+ return EINA_FALSE;
+ }
+ if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE;
+ if (!url_con->url) return EINA_FALSE;
+ if (!password) return EINA_FALSE;
+ if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
+ {
+ ERR("Proxy type should be socks5 and above");
+ return EINA_FALSE;
+ }
+
+ res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
+ if (res != CURLE_OK)
+ {
+ ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res));
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+ (void)url_con;
+ (void)password;
+#endif
+}
/**
* @}
*/
#ifdef HAVE_CURL
+static Eina_Bool
+_ecore_con_url_timeout_cb(void *data)
+{
+ Ecore_Con_Url *url_con = data;
+ CURLMcode ret;
+ Ecore_Con_Event_Url_Complete *e;
+
+ if (!url_con) return ECORE_CALLBACK_CANCEL;
+ if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL;
+ if (!eina_list_data_find(_url_con_list, url_con)) return ECORE_CALLBACK_CANCEL;
+
+ ret = curl_multi_remove_handle(_curlm, url_con->curl_easy);
+ if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
+ _url_con_list = eina_list_remove(_url_con_list, url_con);
+
+ curl_slist_free_all(url_con->headers);
+ url_con->headers = NULL;
+
+ url_con->timer = NULL;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
+ if (e)
+ {
+ e->url_con = url_con;
+ e->status = 0;
+ ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL);
+ }
+ return ECORE_CALLBACK_CANCEL;
+}
+
static size_t
_ecore_con_url_data_cb(void *buffer,
size_t size,
{
int fd = ecore_main_fd_handler_fd_get(fd_handler);
FD_CLR(fd, &_current_fd_set);
- // FIXME: ecore_main_fd_handler_del() sometimes give warnnings
- // because curl do not make fd itself controlled by users.
- // But it can be ignored.
+ // FIXME: ecore_main_fd_handler_del() sometimes give errors
+ // because curl do not make fd itself controlled by users, but it can be ignored.
ecore_main_fd_handler_del(fd_handler);
}
- _fd_hd_list = NULL;
}
EINA_LIST_FREE(_url_con_list, url_con)
static Eina_Bool
_ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
+ if (_fd_hd_list)
+ {
+ Ecore_Fd_Handler *fd_handler;
+ EINA_LIST_FREE(_fd_hd_list, fd_handler)
+ {
+ int fd = ecore_main_fd_handler_fd_get(fd_handler);
+ FD_CLR(fd, &_current_fd_set);
+ // FIXME: ecore_main_fd_handler_del() sometimes give errors
+ // because curl do not make fd itself controlled by users, but it can be ignored.
+ ecore_main_fd_handler_del(fd_handler);
+ }
+ }
ecore_timer_thaw(_curl_timeout);
return ECORE_CALLBACK_RENEW;
}
CURLMcode ret;
ret = curl_multi_perform(_curlm, &still_running);
- if (ret != CURLM_OK)
+ if (ret == CURLM_CALL_MULTI_PERFORM)
{
- ERR("curl_multi_perform() failed: %s", curl_multi_strerror(ret));
- _ecore_con_url_curl_clear();
- ecore_timer_freeze(_curl_timeout);
+ DBG("Call multiperform again");
return ECORE_CALLBACK_RENEW;
}
- if (ret == CURLM_CALL_MULTI_PERFORM)
+ else if (ret != CURLM_OK)
{
- DBG("Call multiperform again");
+ ERR("curl_multi_perform() failed: %s", curl_multi_strerror(ret));
+ _ecore_con_url_curl_clear();
+ ecore_timer_freeze(_curl_timeout);
return ECORE_CALLBACK_RENEW;
}
free(e->key_compose);
free(e);
-} /* _ecore_directfb_event_free_key_down */
+}
static void
_ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev)
free(e->key_compose);
free(e);
-} /* _ecore_directfb_event_free_key_up */
+}
/* directfb window input events handler */
/****************************************/
default:
return;
- } /* switch */
+ }
e->win = _ecore_directfb_fullscreen_window_id;
e->time = 0;
break;
default:
break;
- } /* switch */
+ }
ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_motion */
+}
static void
_ecore_directfb_event_handle_key_down(DFBEvent *evt)
default:
break;
- } /* switch */
+ }
ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL);
-} /* _ecore_directfb_event_handle_key_down */
+}
static void
_ecore_directfb_event_handle_key_up(DFBEvent *evt)
default:
break;
- } /* switch */
+ }
ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL);
-} /* _ecore_directfb_event_handle_key_up */
+}
static void
_ecore_directfb_event_handle_button_down(DFBEvent *evt)
default:
break;
- } /* switch */
+ }
ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_button_down */
+}
static void
_ecore_directfb_event_handle_button_up(DFBEvent *evt)
default:
break;
- } /* switch */
+ }
ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_button_up */
+}
static void
_ecore_directfb_event_handle_enter(DFBWindowEvent *evt)
e->time = 0;
ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_enter */
+}
static void
_ecore_directfb_event_handle_leave(DFBWindowEvent *evt)
e->time = 0;
ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_leave */
+}
static void
_ecore_directfb_event_handle_wheel(DFBWindowEvent *evt)
e->time = 0;
ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_wheel */
+}
static void
_ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt)
e->time = 0;
ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_got_focus */
+}
static void
_ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt)
e->time = 0;
ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL);
-} /* _ecore_directfb_event_handle_lost_focus */
+}
/* inputs and windows fds handlers */
/***********************************/
_ecore_directfb_event_handle_motion(&evt);
return EINA_TRUE;
-} /* _ecore_directfb_input_event_fd_handler */
+}
static Eina_Bool
_ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
_ecore_directfb_event_handle_wheel(&evt.window);
return EINA_TRUE;
-} /* _ecore_directfb_window_event_fd_handler */
+}
/* api functions */
/*****************/
ecore_directfb_interface_get(void)
{
return _dfb;
-} /* ecore_directfb_interface_get */
+}
EAPI Ecore_DirectFB_Window *
ecore_directfb_window_new(int x, int y, int w, int h)
window->cursor = NULL;
return window;
-} /* ecore_directfb_window_new */
+}
EAPI void
ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window)
DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
DFBCHECK(ecore_window->window->Release(ecore_window->window));
free(ecore_window);
-} /* ecore_directfb_window_free */
+}
EAPI void
ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y)
{
DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y));
-} /* ecore_directfb_window_move */
+}
EAPI void
ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h)
{
DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h));
-} /* ecore_directfb_window_resize */
+}
EAPI void
ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window)
{
DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window));
-} /* ecore_directfb_window_focus */
+}
EAPI void
ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window)
{
DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0));
-} /* ecore_directfb_window_hide */
+}
EAPI void
ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window)
{
DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF));
-} /* ecore_directfb_window_show */
+}
EAPI void
ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool set)
opts &= ~DWOP_ALPHACHANNEL;
DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
}
-} /* ecore_directfb_window_shaped_set */
+}
EAPI void
ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool show)
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
}
}
-} /* ecore_directfb_window_cursor_show */
+}
EAPI void
ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor)
ecore_window->cursor = cursor;
DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y));
}
-} /* ecore_directfb_window_cursor_set */
+}
EAPI void
ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool on)
DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface));
_ecore_directfb_fullscreen_window_id = 0;
}
-} /* ecore_directfb_window_fullscreen_set */
+}
EAPI void
ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h)
{
DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h));
return;
-} /* ecore_directfb_window_size_get */
+}
EAPI int
ecore_directfb_init(const char *name __UNUSED__)
}
/* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */
return _ecore_directfb_init_count;
-} /* ecore_directfb_init */
+}
EAPI int
ecore_directfb_shutdown(void)
eina_log_domain_unregister(_ecore_directfb_log_dom);
_ecore_directfb_log_dom = -1;
return _ecore_directfb_init_count;
-} /* ecore_directfb_shutdown */
+}
#define HAVE_ECORE_EVAS_WINCE 1
#define HAVE_ECORE_EVAS_EWS 1
#define HAVE_ECORE_EVAS_PSL1GHT 1
+#define HAVE_ECORE_EVAS_WAYLAND_SHM 1
+#define HAVE_ECORE_EVAS_WAYLAND_EGL 1
typedef enum _Ecore_Evas_Engine_Type
{
ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
ECORE_EVAS_ENGINE_OPENGL_SDL,
ECORE_EVAS_ENGINE_EWS,
- ECORE_EVAS_ENGINE_PSL1GHT
+ ECORE_EVAS_ENGINE_PSL1GHT,
+ ECORE_EVAS_ENGINE_WAYLAND_SHM,
+ ECORE_EVAS_ENGINE_WAYLAND_EGL
} Ecore_Evas_Engine_Type;
typedef enum _Ecore_Evas_Avoid_Damage_Type
EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h);
EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee);
+EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame);
+EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame);
+EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
+EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
+
/**
* @brief Create a new @c Ecore_Evas canvas bound to the Evas
* @b buffer engine
/**
* @brief Create an Evas image object with image data <b>bound to an
- * own, internal @c Ecore_Evas canvas wrapper<b>
+ * own, internal @c Ecore_Evas canvas wrapper</b>
*
* @param ee_target @c Ecore_Evas to have the canvas receiving the new
* image object
* @param h The step height
*
* This function sets the size steps of @p ee to be @p w x @p h. This
- * limits the size of this @cEcore_Evas window to be @b always an
+ * limits the size of this @c Ecore_Evas window to be @b always an
* integer multiple of the step size, for each axis.
*/
EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h);
*/
EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
+EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame);
+EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee);
+
/**
* @brief Associate the given object to this ecore evas.
*
*/
EAPI const void *ecore_evas_ews_manager_get(void);
-EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed */
-EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created */
-EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. */
-EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized */
-EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved */
-EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible */
-EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden */
-EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused */
-EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus */
-EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised */
-EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered */
-EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated */
-
-EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed */
-EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed */
-EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed */
-EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed */
-EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) */
+EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated @since 1.1 */
+
+EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed @since 1.1 */
+EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) @since 1.1 */
/**
* @}
*/
+/**
+ * @defgroup Ecore_Evas_Extn External plug/socket infrastructure to remote canvases
+ *
+ * These functions allow 1 process to create a "socket" was pluged into which another
+ * process can create a "plug" remotely to plug into.
+ * Socket can provides content for several plugs.
+ * This is best for small sized objects (about the size range
+ * of a small icon up to a few large icons). Sine the plug is actually an
+ * image object, you can fetch the pixel data
+ *
+ * @since 1.2
+ * @{
+ */
+
+EAPI extern int ECORE_EVAS_EXTN_CLIENT_ADD; /**< this event is received when a plug has connected to an extn socket @since 1.2 */
+EAPI extern int ECORE_EVAS_EXTN_CLIENT_DEL; /**< this event is received when a plug has disconnected from an extn socket @since 1.2 */
+
+/**
+ * @brief Create a new Ecore_Evas canvas for the new external ecore evas socket
+ *
+ * @param w The width of the canvas, in pixels
+ * @param h The height of the canvas, in pixels
+ * @return A new @c Ecore_Evas instance or @c NULL, on failure
+ *
+ * This creates a new extn_socket canvas wrapper, with image data array
+ * @b bound to the ARGB format, 8 bits per pixel.
+ *
+ * If creation is successful, an Ecore_Evas handle is returned or NULL if creation
+ * fails. Also focus, show, hide etc. callbacks
+ * will also be called if the plug object is shown, or already visible on
+ * connect, or if it is hidden later, focused or unfocused.
+ *
+ * This function has to be flowed by ecore_evas_extn_socket_listen(),
+ * for starting ecore ipc service.
+ *
+ * @code
+ * Eina_Bool res = EINA_FALSE;
+ * Ecore_Evas *ee = ecore_evas_extn_socket_new(1, 1);
+ *
+ * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE);
+ * if (!res) return;
+ * ecore_evas_resize(ee, 240, 400);
+ * @endcode
+ *
+ * or
+ *
+ * @code
+ * Eina_Bool res = EINA_FALSE;
+ * Ecore_Evas *ee = ecore_evas_extn_socket_new(240, 400);
+ *
+ * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE);
+ * if (!res) return;
+ * @endcode
+ *
+ * When a client(plug) connects, you will get the ECORE_EVAS_EXTN_CLIENT_ADD event
+ * in the ecore event queue, with event_info being the image object pointer
+ * passed as a void pointer. When a client disconnects you will get the
+ * ECORE_EVAS_EXTN_CLIENT_DEL event.
+ *
+ * You can set up event handles for these events as follows:
+ *
+ * @code
+ * static void client_add_cb(void *data, int event, void *event_info)
+ * {
+ * Evas_Object *obj = event_info;
+ * printf("client added to image object %p\n", obj);
+ * evas_object_show(obj);
+ * }
+ *
+ * static void client_del_cb(void *data, int event, void *event_info)
+ * {
+ * Evas_Object *obj = event_info;
+ * printf("client deleted from image object %p\n", obj);
+ * evas_object_hide(obj);
+ * }
+ *
+ * void setup(void)
+ * {
+ * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_ADD,
+ * client_add_cb, NULL);
+ * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_DEL,
+ * client_del_cb, NULL);
+ * }
+ * @endcode
+ *
+ * Note that events come in later after the event happened. You may want to be
+ * careful as data structures you had associated with the image object
+ * may have been freed after deleting, but the object may still be around
+ * awating cleanup and thus still be valid.You can change the size with something like:
+ *
+ * @see ecore_evas_extn_socket_listen()
+ * @see ecore_evas_extn_plug_new()
+ * @see ecore_evas_extn_plug_object_data_lock()
+ * @see ecore_evas_extn_plug_object_data_unlock()
+ *
+ * @since 1.2
+ */
+EAPI Ecore_Evas *ecore_evas_extn_socket_new(int w, int h);
+
+/**
+ * @brief Create a socket to provide the service for external ecore evas socket.
+ *
+ * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail.
+ * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name.
+ * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service.
+ * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not.
+ *
+ * This creates socket specified by @p svcname, @p svcnum and @p svcsys. If creation
+ * is successful, EINA_TRUE is returned or EINA_FALSE if creation
+ * fails.
+ *
+ * @see ecore_evas_extn_socket_new()
+ * @see ecore_evas_extn_plug_new()
+ * @see ecore_evas_extn_plug_object_data_lock()
+ * @see ecore_evas_extn_plug_object_data_unlock()
+ *
+ * @since 1.2
+ */
+EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys);
+
+/**
+ * @brief Lock the pixel data so the socket cannot change it
+ *
+ * @param obj The image object returned by ecore_evas_extn_plug_new() to lock
+ *
+ * You may need to get the image pixel data with evas_object_image_data_get()
+ * from the image object, but need to ensure that it does not change while
+ * you are using the data. This function lets you set an advisory lock on the
+ * image data so the external plug process will not render to it or alter it.
+ *
+ * You should only hold the lock for just as long as you need to read out the
+ * image data or otherwise deal with it, and then unlokc it with
+ * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than
+ * 1 iteration of the main ecore loop will be problematic, so avoid it. Also
+ * forgetting to unlock may cause the socket process to freeze and thus create
+ * odd behavior.
+ *
+ * @see ecore_evas_extn_plug_new()
+ * @see ecore_evas_extn_plug_object_data_unlock()
+ *
+ * @since 1.2
+ */
+EAPI void ecore_evas_extn_plug_object_data_lock(Evas_Object *obj);
+
+/**
+ * @brief Unlock the pixel data so the socket can change it again.
+ *
+ * @param obj The image object returned by ecore_evas_extn_plug_new() to unlock
+ *
+ * This unlocks after an advisor lock has been taken by
+ * ecore_evas_extn_plug_object_data_lock().
+ *
+ * @see ecore_evas_extn_plug_new()
+ * @see ecore_evas_extn_plug_object_data_lock()
+ *
+ * @since 1.2
+ */
+EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj);
+
+/**
+ * @brief Create a new external ecore evas plug
+ *
+ * @param ee_target The Ecore_Evas containing the canvas in which the new image object will live.
+ * @return An evas image object that will contain the image output of a socket.
+ *
+ * This creates an image object that will contain the output of another
+ * processes socket canvas when it connects. All input will be sent back to
+ * this process as well, effectively swallowing or placing the socket process
+ * in the canvas of the plug process in place of the image object. The image
+ * object by default is created to be filled (equivalent of
+ * evas_object_image_filled_add() on creation) so image content will scale
+ * toi fill the image unless otherwise reconfigured. The Ecore_Evas size
+ * of the plug is the master size and determines size in pixels of the
+ * plug canvas. You can change the size with something like:
+ *
+ * @code
+ * Eina_Bool res = EINA_FALSE;
+ * Evas_Object *obj = ecore_evas_extn_plug_new(ee);
+ *
+ * res = ecore_evas_extn_plug_connect("svcname", 1, EINA_FALSE);
+ * if (!res) return;
+ * ecore_evas_resize(ee, 240, 400);
+ * @endcode
+ *
+ * @see ecore_evas_extn_socket_new()
+ * @see ecore_evas_extn_plug_connect()
+ * @since 1.2
+ */
+EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target);
+
+/**
+ * @brief Connect a external ecore evas plug to service provided by external ecore evas socket
+ *
+ * @param obj The Ecore_Evas containing the canvas in which the new image object will live.
+ * @param svcname The service name to connect to set up by the socket.
+ * @param svcnum The service number to connect to (set up by socket).
+ * @param svcsys Booleain to set if the service is a system one or not (set up by socket).
+ * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not.
+ *
+ *
+ * @see ecore_evas_extn_plug_new()
+ *
+ * @since 1.2
+ */
+EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
+
+/**
+ * @}
+ */
/**
* @}
MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_X
-ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@
-ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@
+ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@
+ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@
else
ECORE_X_INC =
ECORE_X_LIB =
ECORE_PSL1GHT_LIB =
endif
+if BUILD_ECORE_WAYLAND
+ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@
+ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la
+ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB)
+else
+ECORE_WAYLAND_INC =
+ECORE_WAYLAND_LIB =
+ECORE_WAYLAND_LIBADD =
+endif
+
+if BUILD_ECORE_IPC
+ECORE_IPC_INC= \
+-I$(top_srcdir)/src/lib/ecore_ipc \
+-I$(top_builddir)/src/lib/ecore_ipc
+
+ECORE_IPC_LIB=$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la
+endif
+
AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_evas \
$(ECORE_COCOA_INC) \
$(ECORE_WINCE_INC) \
$(ECORE_PSL1GHT_INC) \
+$(ECORE_WAYLAND_INC) \
+$(ECORE_IPC_INC) \
@EVAS_CFLAGS@ \
@EINA_CFLAGS@ \
-@EVIL_CFLAGS@
+@EVIL_CFLAGS@ \
+@WAYLAND_EGL_CFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
ecore_evas_cocoa.c \
ecore_evas_wince.c \
ecore_evas_ews.c \
-ecore_evas_psl1ght.c
+ecore_evas_psl1ght.c \
+ecore_evas_wayland_shm.c \
+ecore_evas_wayland_egl.c \
+ecore_evas_extn.c
libecore_evas_la_LIBADD = \
$(ECORE_X_LIB) \
$(ECORE_SDL_LIBADD) \
$(ECORE_COCOA_LIB) \
$(ECORE_WINCE_LIB) \
+$(ECORE_IPC_LIB) \
$(ECORE_PSL1GHT_LIB) \
+$(ECORE_WAYLAND_LIB) \
+$(ECORE_WAYLAND_LIBADD) \
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
$(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \
$(top_builddir)/src/lib/ecore/libecore.la \
@EVAS_LIBS@ \
@EINA_LIBS@ \
-@EVIL_LIBS@
+@EVIL_LIBS@ \
+@WAYLAND_EGL_LIBS@
libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
# include <config.h>
#endif
+#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#ifndef _MSC_VER
# include <unistd.h>
#endif
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#else
return EINA_FALSE;
#endif
+ case ECORE_EVAS_ENGINE_WAYLAND_SHM:
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+#endif
+ case ECORE_EVAS_ENGINE_WAYLAND_EGL:
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+#endif
default:
return EINA_FALSE;
};
_ecore_evas_ews_events_init();
#endif
+ _ecore_evas_extn_init();
+
if (getenv("ECORE_EVAS_COMP_NOSYNC"))
_ecore_evas_app_comp_sync = 0;
return _ecore_evas_init_count;
while (ecore_evases) _ecore_evas_free(ecore_evases);
+ _ecore_evas_extn_shutdown();
+
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
ecore_idle_enterer_del(ecore_evas_idle_enterer);
ecore_evas_idle_enterer = NULL;
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
while (_ecore_evas_wince_shutdown());
#endif
+
if (_ecore_evas_async_events_fd)
ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
}
#endif
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+static Ecore_Evas *
+_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
+{
+ char *disp_name = NULL;
+ unsigned int frame = 0;
+ Ecore_Evas *ee;
+
+ _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
+ _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
+ ee = ecore_evas_wayland_shm_new(disp_name, x, y, w, h, frame);
+ free(disp_name);
+
+ return ee;
+}
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+static Ecore_Evas *
+_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
+{
+ char *disp_name = NULL;
+ unsigned int frame = 0;
+ Ecore_Evas *ee;
+
+ _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
+ _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
+ ee = ecore_evas_wayland_egl_new(disp_name, x, y, w, h, frame);
+ free(disp_name);
+
+ return ee;
+}
+#endif
+
#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
static Ecore_Evas *
_ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options)
{"psl1ght", _ecore_evas_constructor_psl1ght},
#endif
- /* Last chance to have a window */
+ /* Wayland */
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+ {"wayland_shm", _ecore_evas_constructor_wayland_shm},
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+ {"wayland_egl", _ecore_evas_constructor_wayland_egl},
+#endif
+
+ /* Last chance to have a window */
#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
{"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
#endif
* Set whether or not an Ecore_Evas' window should avoid damage
*
* @param ee The Ecore_Evas
- * @param The type of the damage management
+ * @param on The type of the damage management
*
* This function causes @p ee to be drawn to a pixmap to avoid recalculations.
* On expose events it will copy from the pixmap to the window.
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
"ecore_evas_withdrawn_get");
return EINA_FALSE;
- } else
- return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
+ }
+ return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
}
/**
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
"ecore_evas_sticky_get");
return EINA_FALSE;
- } else
- return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
+ }
+ return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
}
EAPI void
IFE;
}
+EAPI void
+ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
+{
+ if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+ {
+ ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set");
+ return;
+ }
+ ee->prop.draw_frame = draw_frame;
+}
+
+EAPI Eina_Bool
+ecore_evas_draw_frame_get(const Ecore_Evas *ee)
+{
+ if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+ {
+ ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get");
+ return EINA_FALSE;
+ }
+ return ee->prop.draw_frame;
+}
+
/* fps debug calls - for debugging how much time your app actually spends */
/* rendering graphics... :) */
{
ecore_event_window_unregister((Ecore_Window)ee);
}
+
+#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL)
+EAPI void
+ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
+{
+ if (!ee) return;
+ if (!strcmp(ee->driver, "wayland_shm"))
+ {
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+ _ecore_evas_wayland_shm_resize(ee, location);
+#endif
+ }
+ else if (!strcmp(ee->driver, "wayland_egl"))
+ {
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+ _ecore_evas_wayland_egl_resize(ee, location);
+#endif
+ }
+}
+
+EAPI void
+ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
+{
+ if ((!ee) || (!source)) return;
+ if (!ee->engine.wl.surface) return;
+
+ if (!strcmp(ee->driver, "wayland_shm"))
+ {
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+ _ecore_evas_wayland_shm_drag_start(ee, drag_ee, source);
+#endif
+ }
+ else if (!strcmp(ee->driver, "wayland_egl"))
+ {
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+ _ecore_evas_wayland_egl_drag_start(ee, drag_ee, source);
+#endif
+ }
+}
+#else
+EAPI void
+ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
+{
+
+}
+
+EAPI void
+ecore_evas_wayland_drag_start(Ecore_Evas *ee __UNUSED__, Ecore_Evas *drag_ee __UNUSED__, void *source __UNUSED__)
+{
+
+}
+#endif
#endif
// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
+#include <stdlib.h>
#include <Ecore.h>
#include "ecore_private.h"
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
if (einfo)
{
- einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ if (ee->alpha)
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ else
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
einfo->info.dest_buffer = ee->engine.buffer.pixels;
einfo->info.dest_buffer_row_bytes = stride;
einfo->info.use_color_key = 0;
if (ee->func.fn_resize) ee->func.fn_resize(ee);
}
+static void
+_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
+{
+ _ecore_evas_resize(ee, w, h);
+}
+
int
_ecore_evas_buffer_shutdown(void)
{
if (fw < 1) fw = 1;
if (fh < 1) fh = 1;
+ if (evas_object_map_get(ee->engine.buffer.image) &&
+ evas_object_map_enable_get(ee->engine.buffer.image))
+ {
+ fx = 0; fy = 0;
+ fw = ee->w; fh = ee->h;
+ ww = ee->w; hh = ee->h;
+ }
+
if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
{
*x = (ee->w * (*x - xx)) / fw;
}
static void
-_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+_ecore_evas_buffer_transfer_modifiers_locks(Evas *e, Evas *e2)
+{
+ const char *mods[] =
+ { "Shift", "Control", "Alt", "Meta", "Hyper", "Super", NULL };
+ const char *locks[] =
+ { "Scroll_Lock", "Num_Lock", "Caps_Lock", NULL };
+ int i;
+
+ for (i = 0; mods[i]; i++)
+ {
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), mods[i]))
+ evas_key_modifier_on(e2, mods[i]);
+ else
+ evas_key_modifier_off(e2, mods[i]);
+ }
+ for (i = 0; locks[i]; i++)
+ {
+ if (evas_key_lock_is_set(evas_key_lock_get(e), locks[i]))
+ evas_key_lock_on(e2, locks[i]);
+ else
+ evas_key_lock_off(e2, locks[i]);
+ }
+}
+
+static void
+_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Ecore_Evas *ee;
Evas_Event_Mouse_In *ev;
ee = data;
ev = event_info;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Ecore_Evas *ee;
Evas_Event_Mouse_Out *ev;
ee = data;
ev = event_info;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Mouse_Down *ev;
ee = data;
ev = event_info;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Mouse_Up *ev;
ee = data;
ev = event_info;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Mouse_Move *ev;
x = ev->cur.canvas.x;
y = ev->cur.canvas.y;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
_ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
}
static void
-_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Mouse_Wheel *ev;
ee = data;
ev = event_info;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_multi_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Multi_Down *ev;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
xf = (ev->canvas.xsub - (double)xx) + (double)x;
yf = (ev->canvas.ysub - (double)yy) + (double)y;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_multi_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Multi_Up *ev;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
xf = (ev->canvas.xsub - (double)xx) + (double)x;
yf = (ev->canvas.ysub - (double)yy) + (double)y;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL);
}
static void
-_ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ecore_evas_buffer_cb_multi_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
{
Ecore_Evas *ee;
Evas_Event_Multi_Move *ev;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL);
}
ee = data;
ev = event_info;
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
- evas_key_modifier_on(ee->evas, "Shift");
- else
- evas_key_modifier_off(ee->evas, "Shift");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
- evas_key_modifier_on(ee->evas, "Control");
- else
- evas_key_modifier_off(ee->evas, "Control");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
- evas_key_modifier_on(ee->evas, "Alt");
- else
- evas_key_modifier_off(ee->evas, "Alt");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
- evas_key_modifier_on(ee->evas, "Meta");
- else
- evas_key_modifier_off(ee->evas, "Meta");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
- evas_key_modifier_on(ee->evas, "Hyper");
- else
- evas_key_modifier_off(ee->evas, "Hyper");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
- evas_key_modifier_on(ee->evas, "Super");
- else
- evas_key_modifier_off(ee->evas, "Super");
- if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
- evas_key_lock_on(ee->evas, "Scroll_Lock");
- else
- evas_key_lock_off(ee->evas, "Scroll_Lock");
- if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
- evas_key_lock_on(ee->evas, "Num_Lock");
- else
- evas_key_lock_off(ee->evas, "Num_Lock");
- if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
- evas_key_lock_on(ee->evas, "Caps_Lock");
- else
- evas_key_lock_off(ee->evas, "Caps_Lock");
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
}
ee = data;
ev = event_info;
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
- evas_key_modifier_on(ee->evas, "Shift");
- else
- evas_key_modifier_off(ee->evas, "Shift");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
- evas_key_modifier_on(ee->evas, "Control");
- else
- evas_key_modifier_off(ee->evas, "Control");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
- evas_key_modifier_on(ee->evas, "Alt");
- else
- evas_key_modifier_off(ee->evas, "Alt");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
- evas_key_modifier_on(ee->evas, "Meta");
- else
- evas_key_modifier_off(ee->evas, "Meta");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
- evas_key_modifier_on(ee->evas, "Hyper");
- else
- evas_key_modifier_off(ee->evas, "Hyper");
- if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
- evas_key_modifier_on(ee->evas, "Super");
- else
- evas_key_modifier_off(ee->evas, "Super");
- if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
- evas_key_lock_on(ee->evas, "Scroll_Lock");
- else
- evas_key_lock_off(ee->evas, "Scroll_Lock");
- if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
- evas_key_lock_on(ee->evas, "Num_Lock");
- else
- evas_key_lock_off(ee->evas, "Num_Lock");
- if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
- evas_key_lock_on(ee->evas, "Caps_Lock");
- else
- evas_key_lock_off(ee->evas, "Caps_Lock");
+ _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
}
ee->alpha = alpha;
if (ee->engine.buffer.image)
evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha);
+ else
+ {
+ Evas_Engine_Info_Buffer *einfo;
+
+ einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ if (ee->alpha)
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ else
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+ }
+ }
}
static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
NULL,
NULL,
_ecore_evas_resize,
- NULL,
+ _ecore_evas_move_resize,
NULL,
NULL,
_ecore_evas_show,
_ecore_evas_buffer_alpha_set,
NULL, //transparent
- NULL, // render
+ _ecore_evas_buffer_render,
NULL // screen_geometry_get
};
#endif
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
if (einfo)
{
- einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
einfo->info.dest_buffer = ee->engine.buffer.pixels;
einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int);
einfo->info.use_color_key = 0;
evas_event_feed_mouse_in(ee->evas, 0, NULL);
- ee->engine.func->fn_render = _ecore_evas_buffer_render;
_ecore_evas_register(ee);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee);
- ee->engine.func->fn_render = _ecore_evas_buffer_render;
-
return o;
#else
return NULL;
#else
ERR("Cocoa support in ecore-evas not enabled");
return NULL;
- parent = NULL;
- x = y = w = h = 0;
+ (void) parent;
+ (void) x; (void) y; (void) w; (void) h;
#endif
}
# include <config.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include <Eina.h>
#include <Ecore.h>
#include "ecore_private.h"
#include <Ecore_Input.h>
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include "ecore_private.h"
+#include <Ecore_Input.h>
+
+#ifdef BUILD_ECORE_IPC
+# ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
+# define EXTN_ENABLED 1
+# endif
+#endif
+
+#include "ecore_evas_private.h"
+#include "Ecore_Evas.h"
+#ifdef EXTN_ENABLED
+#include "Ecore_Ipc.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <math.h>
+#include <time.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/file.h>
+
+typedef struct _Shmfile Shmfile;
+
+struct _Shmfile
+{
+ int fd;
+ int size;
+ void *addr;
+ const char *file;
+};
+
+static int blank = 0x00000000;
+
+static Shmfile *
+shmfile_new(const char *base, int id, int size, Eina_Bool sys)
+{
+ Shmfile *sf;
+ char file[PATH_MAX];
+
+ sf = calloc(1, sizeof(Shmfile));
+ do
+ {
+ mode_t mode;
+
+ snprintf(file, sizeof(file), "/%s-%i-%i.%i.%i",
+ base, id, (int)time(NULL), (int)getpid(), (int)rand());
+ mode = S_IRUSR | S_IWUSR;
+ if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+ sf->fd = shm_open(file, O_RDWR | O_CREAT | O_EXCL, mode);
+ }
+ while (sf->fd < 0);
+
+ sf->file = eina_stringshare_add(file);
+ if (!sf->file)
+ {
+ close(sf->fd);
+ shm_unlink(sf->file);
+ eina_stringshare_del(sf->file);
+ free(sf);
+ return NULL;
+ }
+ sf->size = size;
+ if (ftruncate(sf->fd, size) < 0)
+ {
+ close(sf->fd);
+ shm_unlink(sf->file);
+ eina_stringshare_del(sf->file);
+ free(sf);
+ return NULL;
+ }
+ sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0);
+ if (sf->addr == MAP_FAILED)
+ {
+ close(sf->fd);
+ shm_unlink(sf->file);
+ eina_stringshare_del(sf->file);
+ free(sf);
+ return NULL;
+ }
+ return sf;
+}
+
+void
+shmfile_free(Shmfile *sf)
+{
+ munmap(sf->addr, sf->size);
+ close(sf->fd);
+ shm_unlink(sf->file);
+ eina_stringshare_del(sf->file);
+ free(sf);
+}
+
+static Shmfile *
+shmfile_open(const char *ref, int size, Eina_Bool sys)
+{
+ Shmfile *sf;
+ mode_t mode;
+
+ sf = calloc(1, sizeof(Shmfile));
+ mode = S_IRUSR | S_IWUSR;
+ if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+ sf->fd = shm_open(ref, O_RDWR, mode);
+ if (sf->fd < 0)
+ {
+ free(sf);
+ return NULL;
+ }
+ sf->file = eina_stringshare_add(ref);
+ if (!sf->file)
+ {
+ close(sf->fd);
+ eina_stringshare_del(sf->file);
+ free(sf);
+ return NULL;
+ }
+ sf->size = size;
+ sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0);
+ if (sf->addr == MAP_FAILED)
+ {
+ close(sf->fd);
+ eina_stringshare_del(sf->file);
+ free(sf);
+ return NULL;
+ }
+ return sf;
+}
+
+void
+shmfile_close(Shmfile *sf)
+{
+ munmap(sf->addr, sf->size);
+ close(sf->fd);
+ eina_stringshare_del(sf->file);
+ free(sf);
+}
+
+// procotol version - change this as needed
+#define MAJOR 0x1011
+
+enum // opcodes
+{
+ OP_RESIZE,
+ OP_SHOW,
+ OP_HIDE,
+ OP_FOCUS,
+ OP_UNFOCUS,
+ OP_UPDATE,
+ OP_UPDATE_DONE,
+ OP_LOCK_FILE,
+ OP_SHM_REF,
+ OP_EV_MOUSE_IN,
+ OP_EV_MOUSE_OUT,
+ OP_EV_MOUSE_UP,
+ OP_EV_MOUSE_DOWN,
+ OP_EV_MOUSE_MOVE,
+ OP_EV_MOUSE_WHEEL,
+ OP_EV_MULTI_UP,
+ OP_EV_MULTI_DOWN,
+ OP_EV_MULTI_MOVE,
+ OP_EV_KEY_UP,
+ OP_EV_KEY_DOWN,
+ OP_EV_HOLD
+};
+
+enum
+{
+ MOD_SHIFT = (1 << 0),
+ MOD_CTRL = (1 << 1),
+ MOD_ALT = (1 << 2),
+ MOD_META = (1 << 3),
+ MOD_HYPER = (1 << 4),
+ MOD_SUPER = (1 << 5),
+ MOD_CAPS = (1 << 6),
+ MOD_NUM = (1 << 7),
+ MOD_SCROLL = (1 << 8),
+};
+
+typedef struct _Ipc_Data_Resize Ipc_Data_Resize;
+typedef struct _Ipc_Data_Update Ipc_Data_Update;
+typedef struct _Ipc_Data_Ev_Mouse_In Ipc_Data_Ev_Mouse_In;
+typedef struct _Ipc_Data_Ev_Mouse_Out Ipc_Data_Ev_Mouse_Out;
+typedef struct _Ipc_Data_Ev_Mouse_Up Ipc_Data_Ev_Mouse_Up;
+typedef struct _Ipc_Data_Ev_Mouse_Down Ipc_Data_Ev_Mouse_Down;
+typedef struct _Ipc_Data_Ev_Mouse_Move Ipc_Data_Ev_Mouse_Move;
+typedef struct _Ipc_Data_Ev_Mouse_Wheel Ipc_Data_Ev_Mouse_Wheel;
+typedef struct _Ipc_Data_Ev_Hold Ipc_Data_Ev_Hold;
+typedef struct _Ipc_Data_Ev_Multi_Up Ipc_Data_Ev_Multi_Up;
+typedef struct _Ipc_Data_Ev_Multi_Down Ipc_Data_Ev_Multi_Down;
+typedef struct _Ipc_Data_Ev_Multi_Move Ipc_Data_Ev_Multi_Move;
+typedef struct _Ipc_Data_Ev_Key_Up Ipc_Data_Ev_Key_Up;
+typedef struct _Ipc_Data_Ev_Key_Down Ipc_Data_Ev_Key_Down;
+
+struct _Ipc_Data_Resize
+{
+ int w, h;
+};
+
+struct _Ipc_Data_Update
+{
+ int x, w, y, h;
+};
+
+struct _Ipc_Data_Ev_Mouse_In
+{
+ unsigned int timestamp;
+ int mask;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Mouse_Out
+{
+ unsigned int timestamp;
+ int mask;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Mouse_Up
+{
+ int b;
+ Evas_Button_Flags flags;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Mouse_Down
+{
+ int b;
+ Evas_Button_Flags flags;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Mouse_Move
+{
+ int x, y;
+ Evas_Button_Flags flags;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Mouse_Wheel
+{
+ int direction, z;
+ Evas_Button_Flags flags;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Hold
+{
+ int hold;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Multi_Up
+{
+ Evas_Button_Flags flags;
+ int d, x, y;
+ double rad, radx, rady, pres, ang, fx, fy;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Multi_Down
+{
+ Evas_Button_Flags flags;
+ int d, x, y;
+ double rad, radx, rady, pres, ang, fx, fy;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Multi_Move
+{
+ int d, x, y;
+ double rad, radx, rady, pres, ang, fx, fy;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Key_Up
+{
+ const char *keyname, *key, *string, *compose;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+struct _Ipc_Data_Ev_Key_Down
+{
+ const char *keyname, *key, *string, *compose;
+ int mask;
+ unsigned int timestamp;
+ Evas_Event_Flags event_flags;
+};
+
+typedef struct _Extn Extn;
+
+struct _Extn
+{
+ struct {
+ Ecore_Ipc_Server *server;
+ Eina_List *clients;
+ Eina_List *handlers;
+ Eina_Bool am_server : 1;
+ } ipc;
+ struct {
+ const char *name;
+ int num;
+ Eina_Bool sys : 1;
+ } svc;
+ struct {
+ const char *lock;
+ int lockfd;
+ const char *shm;
+ int w, h;
+ Shmfile *shmfile;
+ Eina_List *updates;
+ Eina_Bool have_lock : 1;
+ } file;
+};
+
+static Eina_List *extn_ee_list = NULL;
+
+EAPI int ECORE_EVAS_EXTN_CLIENT_ADD = 0;
+EAPI int ECORE_EVAS_EXTN_CLIENT_DEL = 0;
+
+void
+_ecore_evas_extn_init(void)
+{
+ if (ECORE_EVAS_EXTN_CLIENT_ADD) return;
+ ECORE_EVAS_EXTN_CLIENT_ADD = ecore_event_type_new();
+ ECORE_EVAS_EXTN_CLIENT_DEL = ecore_event_type_new();
+}
+
+void
+_ecore_evas_extn_shutdown(void)
+{
+}
+
+static void
+_ecore_evas_extn_event_free(void *data, void *ev __UNUSED__)
+{
+ Ecore_Evas *ee = data;
+ if (ee->engine.buffer.image)
+ evas_object_unref(ee->engine.buffer.image);
+ _ecore_evas_unref(ee);
+}
+
+static void
+_ecore_evas_extn_event(Ecore_Evas *ee, int event)
+{
+ _ecore_evas_ref(ee);
+ if (ee->engine.buffer.image)
+ evas_object_ref(ee->engine.buffer.image);
+ ecore_event_add(event, ee->engine.buffer.image,
+ _ecore_evas_extn_event_free, ee);
+}
+
+static void
+_ecore_evas_socket_lock(Ecore_Evas *ee)
+{
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->file.lockfd < 0) return;
+ if (extn->file.have_lock) return;
+ flock(extn->file.lockfd, LOCK_EX);
+ extn->file.have_lock = EINA_TRUE;
+}
+
+static void
+_ecore_evas_socket_unlock(Ecore_Evas *ee)
+{
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->file.lockfd < 0) return;
+ if (!extn->file.have_lock) return;
+ flock(extn->file.lockfd, LOCK_UN);
+ extn->file.have_lock = EINA_FALSE;
+}
+
+static void
+_ecore_evas_extn_plug_targer_render_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee = data;
+ if (ee) _ecore_evas_socket_lock(ee);
+}
+
+static void
+_ecore_evas_extn_plug_targer_render_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee = data;
+ if (ee) _ecore_evas_socket_unlock(ee);
+}
+
+static void
+_ecore_evas_extn_plug_image_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee = data;
+ if (ee) ecore_evas_free(ee);
+}
+
+static void
+_ecore_evas_extn_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
+{
+ Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
+
+ evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh);
+ evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh);
+
+ if (fw < 1) fw = 1;
+ if (fh < 1) fh = 1;
+
+ if (evas_object_map_get(ee->engine.buffer.image) &&
+ evas_object_map_enable_get(ee->engine.buffer.image))
+ {
+ fx = 0; fy = 0;
+ fw = ee->w; fh = ee->h;
+ ww = ee->w; hh = ee->h;
+ }
+
+ if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
+ {
+ *x = (ee->w * (*x - xx)) / fw;
+ *y = (ee->h * (*y - yy)) / fh;
+ }
+ else
+ {
+ xx = (*x - xx) - fx;
+ while (xx < 0) xx += fw;
+ while (xx > fw) xx -= fw;
+ *x = (ee->w * xx) / fw;
+
+ yy = (*y - yy) - fy;
+ while (yy < 0) yy += fh;
+ while (yy > fh) yy -= fh;
+ *y = (ee->h * yy) / fh;
+ }
+}
+
+static void
+_ecore_evas_extn_free(Ecore_Evas *ee)
+{
+ Extn *extn;
+ Ecore_Ipc_Client *client;
+
+ extn = ee->engine.buffer.data;
+ if (extn)
+ {
+ Ecore_Event_Handler *hdl;
+
+ if (extn->file.have_lock)
+ _ecore_evas_socket_unlock(ee);
+ if (extn->file.lockfd)
+ {
+ close(extn->file.lockfd);
+ if (extn->ipc.am_server)
+ {
+ if (extn->file.lock) unlink(extn->file.lock);
+ }
+ }
+ if (extn->svc.name) eina_stringshare_del(extn->svc.name);
+ if (extn->ipc.clients)
+ {
+ EINA_LIST_FREE(extn->ipc.clients, client)
+ ecore_ipc_client_del(client);
+ }
+ if (extn->ipc.server) ecore_ipc_server_del(extn->ipc.server);
+ if (extn->file.lock) eina_stringshare_del(extn->file.lock);
+ if (extn->file.shm) eina_stringshare_del(extn->file.shm);
+ if (extn->file.shmfile)
+ {
+ if (extn->ipc.am_server)
+ shmfile_free(extn->file.shmfile);
+ else
+ shmfile_close(extn->file.shmfile);
+ }
+
+ EINA_LIST_FREE(extn->ipc.handlers, hdl)
+ ecore_event_handler_del(hdl);
+ free(extn);
+ ecore_ipc_shutdown();
+ ee->engine.buffer.data = NULL;
+ }
+ if (ee->engine.buffer.image)
+ {
+ Ecore_Evas *ee2;
+
+ evas_object_event_callback_del_full(ee->engine.buffer.image,
+ EVAS_CALLBACK_DEL,
+ _ecore_evas_extn_plug_image_obj_del,
+ ee);
+ evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image),
+ EVAS_CALLBACK_RENDER_PRE,
+ _ecore_evas_extn_plug_targer_render_pre,
+ ee);
+ evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image),
+ EVAS_CALLBACK_RENDER_POST,
+ _ecore_evas_extn_plug_targer_render_post,
+ ee);
+ evas_object_del(ee->engine.buffer.image);
+ ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent");
+ if (ee2)
+ {
+ ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee);
+ }
+ }
+ extn_ee_list = eina_list_remove(extn_ee_list, ee);
+}
+
+static void
+_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
+{
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+ ee->req.w = w;
+ ee->req.h = h;
+ if ((w == ee->w) && (h == ee->h)) return;
+ ee->w = w;
+ ee->h = h;
+
+ /*
+ * No need for it if not used later.
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ */
+ if (ee->engine.buffer.image)
+ evas_object_image_size_set(ee->engine.buffer.image, ee->w, ee->h);
+ /* Server can have many plugs, so I block resize comand from client to server *
+ if ((extn) && (extn->ipc.server))
+ {
+ Ipc_Data_Resize ipc;
+
+ ipc.w = ee->w;
+ ipc.h = ee->h;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_RESIZE, 0, 0, 0, &ipc, sizeof(ipc));
+ }*/
+ if (ee->func.fn_resize) ee->func.fn_resize(ee);
+}
+
+static void
+_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
+{
+ _ecore_evas_resize(ee, w, h);
+}
+
+static int
+_ecore_evas_modifiers_locks_mask_get(Evas *e)
+{
+ int mask = 0;
+
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
+ mask |= MOD_SHIFT;
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
+ mask |= MOD_CTRL;
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
+ mask |= MOD_ALT;
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
+ mask |= MOD_META;
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
+ mask |= MOD_HYPER;
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
+ mask |= MOD_SUPER;
+ if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
+ mask |= MOD_SCROLL;
+ if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
+ mask |= MOD_NUM;
+ if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
+ mask |= MOD_CAPS;
+ return mask;
+}
+
+static void
+_ecore_evas_modifiers_locks_mask_set(Evas *e, int mask)
+{
+ if (mask & MOD_SHIFT) evas_key_modifier_on (e, "Shift");
+ else evas_key_modifier_off(e, "Shift");
+ if (mask & MOD_CTRL) evas_key_modifier_on (e, "Control");
+ else evas_key_modifier_off(e, "Control");
+ if (mask & MOD_ALT) evas_key_modifier_on (e, "Alt");
+ else evas_key_modifier_off(e, "Alt");
+ if (mask & MOD_META) evas_key_modifier_on (e, "Meta");
+ else evas_key_modifier_off(e, "Meta");
+ if (mask & MOD_HYPER) evas_key_modifier_on (e, "Hyper");
+ else evas_key_modifier_off(e, "Hyper");
+ if (mask & MOD_SUPER) evas_key_modifier_on (e, "Super");
+ else evas_key_modifier_off(e, "Super");
+ if (mask & MOD_SCROLL) evas_key_lock_on (e, "Scroll_Lock");
+ else evas_key_lock_off(e, "Scroll_Lock");
+ if (mask & MOD_NUM) evas_key_lock_on (e, "Num_Lock");
+ else evas_key_lock_off(e, "Num_Lock");
+ if (mask & MOD_CAPS) evas_key_lock_on (e, "Caps_Lock");
+ else evas_key_lock_off(e, "Caps_Lock");
+}
+
+static void
+_ecore_evas_extn_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Mouse_In *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Mouse_In ipc;
+
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_IN, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Mouse_Out *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Mouse_Out ipc;
+
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_OUT, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Mouse_Down *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Mouse_Down ipc;
+
+ ipc.b = ev->button;
+ ipc.flags = ev->flags;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_DOWN, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Mouse_Up *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Mouse_Up ipc;
+
+ ipc.b = ev->button;
+ ipc.flags = ev->flags;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_UP, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Mouse_Move *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Mouse_Move ipc;
+ Evas_Coord x, y;
+
+ x = ev->cur.canvas.x;
+ y = ev->cur.canvas.y;
+ _ecore_evas_extn_coord_translate(ee, &x, &y);
+ ipc.x = x;
+ ipc.y = y;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Mouse_Wheel *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Mouse_Wheel ipc;
+
+ ipc.direction = ev->direction;
+ ipc.z = ev->z;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_WHEEL, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Multi_Down *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Multi_Down ipc;
+ Evas_Coord x, y;
+
+ ipc.d = ev->device;
+ x = ev->canvas.x;
+ y = ev->canvas.y;
+ _ecore_evas_extn_coord_translate(ee, &x, &y);
+ ipc.x = x;
+ ipc.y = y;
+ ipc.rad = ev->radius;
+ ipc.radx = ev->radius_x;
+ ipc.rady = ev->radius_y;
+ ipc.pres = ev->pressure;
+ ipc.ang = ev->angle;
+ ipc.fx = ev->canvas.xsub;
+ ipc.fy = ev->canvas.ysub;
+ ipc.flags = ev->flags;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_DOWN, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+
+static void
+_ecore_evas_extn_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Multi_Up *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Multi_Up ipc;
+ Evas_Coord x, y;
+
+ ipc.d = ev->device;
+ x = ev->canvas.x;
+ y = ev->canvas.y;
+ _ecore_evas_extn_coord_translate(ee, &x, &y);
+ ipc.x = x;
+ ipc.y = y;
+ ipc.rad = ev->radius;
+ ipc.radx = ev->radius_x;
+ ipc.rady = ev->radius_y;
+ ipc.pres = ev->pressure;
+ ipc.ang = ev->angle;
+ ipc.fx = ev->canvas.xsub;
+ ipc.fy = ev->canvas.ysub;
+ ipc.flags = ev->flags;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_UP, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Multi_Move *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Multi_Move ipc;
+ Evas_Coord x, y;
+
+ ipc.d = ev->device;
+ x = ev->cur.canvas.x;
+ y = ev->cur.canvas.y;
+ _ecore_evas_extn_coord_translate(ee, &x, &y);
+ ipc.x = x;
+ ipc.y = y;
+ ipc.rad = ev->radius;
+ ipc.radx = ev->radius_x;
+ ipc.rady = ev->radius_y;
+ ipc.pres = ev->pressure;
+ ipc.ang = ev->angle;
+ ipc.fx = ev->cur.canvas.xsub;
+ ipc.fy = ev->cur.canvas.ysub;
+ ipc.timestamp = ev->timestamp;
+ ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_MOVE, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee;
+
+ ee = data;
+ if (ee->driver) _ecore_evas_free(ee);
+}
+
+static void
+_ecore_evas_extn_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Key_Down *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Key_Down *ipc;
+ char *st, *p;
+ int len = 0;
+
+ len = sizeof(Ipc_Data_Ev_Key_Down);
+ if (ev->key) len += strlen(ev->key) + 1;
+ if (ev->keyname) len += strlen(ev->keyname) + 1;
+ if (ev->string) len += strlen(ev->string) + 1;
+ if (ev->compose) len += strlen(ev->compose) + 1;
+ len += 1;
+ st = alloca(len);
+ ipc = (Ipc_Data_Ev_Key_Down *)st;
+ memset(st, 0, len);
+ p = st + sizeof(Ipc_Data_Ev_Key_Down);
+ if (ev->key)
+ {
+ strcpy(p, ev->key);
+ ipc->key = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ if (ev->keyname)
+ {
+ strcpy(p, ev->keyname);
+ ipc->keyname = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ if (ev->string)
+ {
+ strcpy(p, ev->string);
+ ipc->string = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ if (ev->compose)
+ {
+ strcpy(p, ev->compose);
+ ipc->compose = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ ipc->timestamp = ev->timestamp;
+ ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc->event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_DOWN, 0, 0, 0, ipc, len);
+ }
+}
+
+static void
+_ecore_evas_extn_cb_key_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Key_Up *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Key_Up *ipc;
+ char *st, *p;
+ int len = 0;
+
+ len = sizeof(Ipc_Data_Ev_Key_Up);
+ if (ev->key) len += strlen(ev->key) + 1;
+ if (ev->keyname) len += strlen(ev->keyname) + 1;
+ if (ev->string) len += strlen(ev->string) + 1;
+ if (ev->compose) len += strlen(ev->compose) + 1;
+ len += 1;
+ st = alloca(len);
+ ipc = (Ipc_Data_Ev_Key_Up *)st;
+ memset(st, 0, len);
+ p = st + sizeof(Ipc_Data_Ev_Key_Down);
+ if (ev->key)
+ {
+ strcpy(p, ev->key);
+ ipc->key = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ if (ev->keyname)
+ {
+ strcpy(p, ev->keyname);
+ ipc->keyname = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ if (ev->string)
+ {
+ strcpy(p, ev->string);
+ ipc->string = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ if (ev->compose)
+ {
+ strcpy(p, ev->compose);
+ ipc->compose = p - (long)st;
+ p += strlen(p) + 1;
+ }
+ ipc->timestamp = ev->timestamp;
+ ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
+ ipc->event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_UP, 0, 0, 0, ipc, len);
+ }
+}
+
+static void
+_ecore_evas_extn_cb_hold(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Ecore_Evas *ee = data;
+ Evas_Event_Hold *ev = event_info;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (extn->ipc.server)
+ {
+ Ipc_Data_Ev_Hold ipc;
+
+ ipc.hold = ev->hold;
+ ipc.timestamp = ev->timestamp;
+ ipc.event_flags = ev->event_flags;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_HOLD, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+}
+
+static void
+_ecore_evas_extn_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee;
+ Extn *extn;
+
+ ee = data;
+ ee->prop.focused = 1;
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (!extn->ipc.server) return;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_FOCUS, 0, 0, 0, NULL, 0);
+}
+
+static void
+_ecore_evas_extn_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee;
+ Extn *extn;
+
+ ee = data;
+ ee->prop.focused = 0;
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (!extn->ipc.server) return;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_UNFOCUS, 0, 0, 0, NULL, 0);
+}
+
+static void
+_ecore_evas_extn_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee;
+ Extn *extn;
+
+ ee = data;
+ ee->visible = 1;
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (!extn->ipc.server) return;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_SHOW, 0, 0, 0, NULL, 0);
+}
+
+static void
+_ecore_evas_extn_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Ecore_Evas *ee;
+ Extn *extn;
+
+ ee = data;
+ ee->visible = 0;
+ extn = ee->engine.buffer.data;
+ if (!extn) return;
+ if (!extn->ipc.server) return;
+ ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0);
+}
+
+static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
+{
+ _ecore_evas_extn_free,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _ecore_evas_resize,
+ _ecore_evas_move_resize,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL, //transparent
+
+ NULL, // render
+ NULL // screen_geometry_get
+};
+
+static Eina_Bool
+_ipc_server_add(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_Ipc_Event_Server_Add *e = event;
+ Ecore_Evas *ee = data;
+ Extn *extn;
+
+ if (ee != ecore_ipc_server_data_get(e->server))
+ return ECORE_CALLBACK_PASS_ON;
+ if (!eina_list_data_find(extn_ee_list, ee))
+ return ECORE_CALLBACK_PASS_ON;
+ extn = ee->engine.buffer.data;
+ if (!extn) return ECORE_CALLBACK_PASS_ON;
+ //FIXME: find a way to let app know server there
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ipc_server_del(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_Ipc_Event_Server_Del *e = event;
+ Ecore_Evas *ee = data;
+ Extn *extn;
+
+ extn = ee->engine.buffer.data;
+ if (!extn) return ECORE_CALLBACK_PASS_ON;
+ if (extn->ipc.server != e->server) return ECORE_CALLBACK_PASS_ON;
+ evas_object_image_data_set(ee->engine.buffer.image, NULL);
+ ee->engine.buffer.pixels = NULL;
+ if (extn->file.shmfile)
+ {
+ shmfile_close(extn->file.shmfile);
+ extn->file.shmfile = NULL;
+ }
+ if (extn->file.shm)
+ {
+ eina_stringshare_del(extn->file.shm);
+ extn->file.shm = NULL;
+ }
+ extn->ipc.server = NULL;
+ if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ipc_server_data(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_Ipc_Event_Server_Data *e = event;
+ Ecore_Evas *ee = data;
+ Extn *extn;
+
+ if (ee != ecore_ipc_server_data_get(e->server))
+ return ECORE_CALLBACK_PASS_ON;
+ if (!eina_list_data_find(extn_ee_list, ee))
+ return ECORE_CALLBACK_PASS_ON;
+ extn = ee->engine.buffer.data;
+ if (!extn) return ECORE_CALLBACK_PASS_ON;
+ if (e->major != MAJOR)
+ return ECORE_CALLBACK_PASS_ON;
+ switch (e->minor)
+ {
+ case OP_UPDATE:
+ // add rect to update list
+ if (e->size >= (int)sizeof(Ipc_Data_Update))
+ {
+ Ipc_Data_Update *ipc = malloc(sizeof(Ipc_Data_Update));
+ if (ipc)
+ {
+ memcpy(ipc, e->data, sizeof(Ipc_Data_Update));
+ extn->file.updates = eina_list_append(extn->file.updates, ipc);
+ }
+ }
+ break;
+ case OP_UPDATE_DONE:
+ // updates finished being sent - done now. frame ready
+ {
+ Ipc_Data_Update *ipc;
+
+ EINA_LIST_FREE(extn->file.updates, ipc)
+ {
+ if (ee->engine.buffer.image)
+ evas_object_image_data_update_add(ee->engine.buffer.image,
+ ipc->x, ipc->y,
+ ipc->w, ipc->h);
+ }
+ }
+ break;
+ case OP_LOCK_FILE:
+ if ((e->data) && (e->size > 0) &&
+ (((unsigned char *)e->data)[e->size - 1] == 0))
+ {
+ if (extn->file.lockfd) close(extn->file.lockfd);
+ if (extn->file.lock) eina_stringshare_del(extn->file.lock);
+ extn->file.lock = eina_stringshare_add(e->data);
+ extn->file.lockfd = open(extn->file.lock, O_RDONLY);
+ }
+ break;
+ case OP_SHM_REF:
+ // e->ref == w
+ // e->ref_to == h
+ // e->response == alpha
+ // e->data = shm ref string + nul byte
+ if ((e->data) && ((unsigned char *)e->data)[e->size - 1] == 0)
+ {
+ ee->engine.buffer.pixels = NULL;
+ if (extn->file.shmfile)
+ {
+ shmfile_close(extn->file.shmfile);
+ extn->file.shmfile = NULL;
+ }
+ if (extn->file.shm)
+ {
+ eina_stringshare_del(extn->file.shm);
+ extn->file.shm = NULL;
+ }
+ if ((e->ref > 0) && (e->ref_to > 0))
+ {
+ extn->file.w = e->ref;
+ extn->file.h = e->ref_to;
+ extn->file.shm = eina_stringshare_add(e->data);
+ extn->file.shmfile = shmfile_open(extn->file.shm,
+ extn->file.w *
+ extn->file.h * 4,
+ EINA_TRUE);
+ if (extn->file.shmfile)
+ {
+ ee->engine.buffer.pixels = extn->file.shmfile->addr;
+ if (ee->engine.buffer.image)
+ {
+ if (e->response)
+ evas_object_image_alpha_set(ee->engine.buffer.image,
+ EINA_TRUE);
+ else
+ evas_object_image_alpha_set(ee->engine.buffer.image,
+ EINA_FALSE);
+ evas_object_image_size_set(ee->engine.buffer.image,
+ extn->file.w,
+ extn->file.h);
+ evas_object_image_data_set(ee->engine.buffer.image,
+ ee->engine.buffer.pixels);
+ evas_object_image_data_update_add(ee->engine.buffer.image,
+ 0, 0,
+ extn->file.w,
+ extn->file.h);
+ _ecore_evas_resize(ee,
+ extn->file.w,
+ extn->file.h);
+ }
+ else
+ evas_object_image_data_set(ee->engine.buffer.image, NULL);
+ }
+ else
+ evas_object_image_data_set(ee->engine.buffer.image, NULL);
+ }
+ else
+ evas_object_image_data_set(ee->engine.buffer.image, NULL);
+ }
+ break;
+ case OP_RESIZE:
+ if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize)))
+ {
+ Ipc_Data_Resize *ipc = e->data;
+ _ecore_evas_resize(ee, ipc->w, ipc->h);
+ }
+ break;
+ default:
+ break;
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+#else
+void
+_ecore_evas_extn_init(void)
+{
+}
+
+void
+_ecore_evas_extn_shutdown(void)
+{
+}
+#endif
+
+EAPI Evas_Object *
+ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
+{
+#ifdef EXTN_ENABLED
+ Evas_Object *o;
+ Ecore_Evas *ee;
+ int w = 1, h = 1;
+
+ if (!ee_target) return NULL;
+
+ ee = calloc(1, sizeof(Ecore_Evas));
+ if (!ee) return NULL;
+
+ o = evas_object_image_filled_add(ee_target->evas);
+ evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+ evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_alpha_set(o, 1);
+ evas_object_image_size_set(o, 1, 1);
+ evas_object_image_data_set(o, &blank);
+
+ ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
+
+ ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_plug_engine_func;
+
+ ee->driver = "extn_plug";
+
+ ee->rotation = 0;
+ ee->visible = 0;
+ ee->w = w;
+ ee->h = h;
+ ee->req.w = ee->w;
+ ee->req.h = ee->h;
+
+ ee->prop.max.w = 0;
+ ee->prop.max.h = 0;
+ ee->prop.layer = 0;
+ ee->prop.focused = 0;
+ ee->prop.borderless = 1;
+ ee->prop.override = 1;
+ ee->prop.maximized = 0;
+ ee->prop.fullscreen = 0;
+ ee->prop.withdrawn = 0;
+ ee->prop.sticky = 0;
+
+ ee->engine.buffer.image = o;
+ evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee);
+ evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MOUSE_IN,
+ _ecore_evas_extn_cb_mouse_in, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MOUSE_OUT,
+ _ecore_evas_extn_cb_mouse_out, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MOUSE_DOWN,
+ _ecore_evas_extn_cb_mouse_down, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MOUSE_UP,
+ _ecore_evas_extn_cb_mouse_up, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MOUSE_MOVE,
+ _ecore_evas_extn_cb_mouse_move, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MOUSE_WHEEL,
+ _ecore_evas_extn_cb_mouse_wheel, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MULTI_DOWN,
+ _ecore_evas_extn_cb_multi_down, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MULTI_UP,
+ _ecore_evas_extn_cb_multi_up, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_MULTI_MOVE,
+ _ecore_evas_extn_cb_multi_move, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_FREE,
+ _ecore_evas_extn_cb_free, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_KEY_DOWN,
+ _ecore_evas_extn_cb_key_down, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_KEY_UP,
+ _ecore_evas_extn_cb_key_up, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_HOLD,
+ _ecore_evas_extn_cb_hold, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_FOCUS_IN,
+ _ecore_evas_extn_cb_focus_in, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_FOCUS_OUT,
+ _ecore_evas_extn_cb_focus_out, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_SHOW,
+ _ecore_evas_extn_cb_show, ee);
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_HIDE,
+ _ecore_evas_extn_cb_hide, ee);
+
+ evas_object_event_callback_add(ee->engine.buffer.image,
+ EVAS_CALLBACK_DEL,
+ _ecore_evas_extn_plug_image_obj_del, ee);
+
+
+ extn_ee_list = eina_list_append(extn_ee_list, ee);
+ ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee);
+
+ evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_PRE,
+ _ecore_evas_extn_plug_targer_render_pre, ee);
+ evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_POST,
+ _ecore_evas_extn_plug_targer_render_post, ee);
+ return o;
+#else
+ return NULL;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
+{
+#ifdef EXTN_ENABLED
+ Extn *extn;
+ Ecore_Evas *ee = NULL;
+
+ if (!obj) return EINA_FALSE;
+
+ ee = evas_object_data_get(obj, "Ecore_Evas");
+ if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) return EINA_FALSE;
+
+ extn = calloc(1, sizeof(Extn));
+ if (!extn) return EINA_FALSE;
+
+ Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER;
+
+ ecore_ipc_init();
+ extn->svc.name = eina_stringshare_add(svcname);
+ extn->svc.num = svcnum;
+ extn->svc.sys = svcsys;
+
+ if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM;
+ extn->ipc.server = ecore_ipc_server_connect(ipctype, (char *)extn->svc.name,
+ extn->svc.num, ee);
+ if (!extn->ipc.server)
+ {
+ eina_stringshare_del(extn->svc.name);
+ free(extn);
+ ecore_ipc_shutdown();
+ return EINA_FALSE;
+ }
+ ee->engine.buffer.data = extn;
+ extn->ipc.handlers = eina_list_append
+ (extn->ipc.handlers,
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD,
+ _ipc_server_add, ee));
+ extn->ipc.handlers = eina_list_append
+ (extn->ipc.handlers,
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL,
+ _ipc_server_del, ee));
+ extn->ipc.handlers = eina_list_append
+ (extn->ipc.handlers,
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,
+ _ipc_server_data, ee));
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+#endif
+}
+
+EAPI void
+ecore_evas_extn_plug_object_data_lock(Evas_Object *obj)
+{
+#ifdef EXTN_ENABLED
+ Ecore_Evas *ee;
+
+ ee = ecore_evas_object_ecore_evas_get(obj);
+ if (!ee) return;
+ _ecore_evas_socket_lock(ee);
+#endif
+}
+
+EAPI void
+ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj)
+{
+#ifdef EXTN_ENABLED
+ Ecore_Evas *ee;
+
+ ee = ecore_evas_object_ecore_evas_get(obj);
+ if (!ee) return;
+ _ecore_evas_socket_unlock(ee);
+#endif
+}
+
+#ifdef EXTN_ENABLED
+static void
+_ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h)
+{
+ Extn *extn;
+ Evas_Engine_Info_Buffer *einfo;
+ int stride = 0;
+
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+ ee->req.w = w;
+ ee->req.h = h;
+ if ((w == ee->w) && (h == ee->h)) return;
+ ee->w = w;
+ ee->h = h;
+ evas_output_size_set(ee->evas, ee->w, ee->h);
+ evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ extn = ee->engine.buffer.data;
+ if (extn)
+ {
+ if (extn->file.shmfile)
+ shmfile_free(extn->file.shmfile);
+ ee->engine.buffer.pixels = NULL;
+ extn->file.shmfile = shmfile_new(extn->svc.name, extn->svc.num,
+ ee->w * ee->h * 4, extn->svc.sys);
+ if (extn->file.shmfile)
+ ee->engine.buffer.pixels = extn->file.shmfile->addr;
+
+ stride = ee->w * 4;
+ einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ if (ee->alpha)
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ else
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
+ einfo->info.dest_buffer = ee->engine.buffer.pixels;
+ einfo->info.dest_buffer_row_bytes = stride;
+ einfo->info.use_color_key = 0;
+ einfo->info.alpha_threshold = 0;
+ einfo->info.func.new_update_region = NULL;
+ einfo->info.func.free_update_region = NULL;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ }
+ }
+
+ if (extn->ipc.clients && extn->file.shmfile)
+ {
+ Ipc_Data_Resize ipc;
+ Eina_List *l;
+ Ecore_Ipc_Client *client;
+
+ EINA_LIST_FOREACH(extn->ipc.clients, l, client)
+ ecore_ipc_client_send(client, MAJOR, OP_SHM_REF,
+ ee->w, ee->h, ee->alpha,
+ extn->file.shmfile->file,
+ strlen(extn->file.shmfile->file) + 1);
+ ipc.w = ee->w;
+ ipc.h = ee->h;
+ EINA_LIST_FOREACH(extn->ipc.clients, l, client)
+ ecore_ipc_client_send(client, MAJOR, OP_RESIZE,
+ 0, 0, 0, &ipc, sizeof(ipc));
+ }
+ }
+ if (ee->func.fn_resize) ee->func.fn_resize(ee);
+}
+
+static void
+_ecore_evas_socket_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
+{
+ _ecore_evas_socket_resize(ee, w, h);
+}
+
+int
+_ecore_evas_extn_socket_render(Ecore_Evas *ee)
+{
+ Eina_List *updates = NULL, *l, *ll;
+ Ecore_Evas *ee2;
+ int rend = 0;
+ Eina_Rectangle *r;
+ Extn *extn;
+ Ecore_Ipc_Client *client;
+
+ extn = ee->engine.buffer.data;
+ EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
+ {
+ if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
+ if (ee2->engine.func->fn_render)
+ rend |= ee2->engine.func->fn_render(ee2);
+ if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
+ }
+ if (ee->engine.buffer.pixels)
+ {
+ _ecore_evas_socket_lock(ee);
+ updates = evas_render_updates(ee->evas);
+ _ecore_evas_socket_unlock(ee);
+ }
+ EINA_LIST_FOREACH(updates, l, r)
+ {
+ Ipc_Data_Update ipc;
+
+
+ ipc.x = r->x;
+ ipc.y = r->y;
+ ipc.w = r->w;
+ ipc.h = r->h;
+ EINA_LIST_FOREACH(extn->ipc.clients, ll, client)
+ ecore_ipc_client_send(client, MAJOR, OP_UPDATE, 0, 0, 0, &ipc, sizeof(ipc));
+ }
+ if (updates)
+ {
+ evas_render_updates_free(updates);
+ _ecore_evas_idle_timeout_update(ee);
+ EINA_LIST_FOREACH(extn->ipc.clients, ll, client)
+ ecore_ipc_client_send(client, MAJOR, OP_UPDATE_DONE, 0, 0, 0, NULL, 0);
+ }
+
+ return updates ? 1 : rend;
+}
+
+static Eina_Bool
+_ipc_client_add(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_Ipc_Event_Client_Add *e = event;
+ Ecore_Evas *ee = data;
+ Extn *extn;
+
+ if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client)))
+ return ECORE_CALLBACK_PASS_ON;
+ if (!eina_list_data_find(extn_ee_list, ee))
+ return ECORE_CALLBACK_PASS_ON;
+ extn = ee->engine.buffer.data;
+ if (!extn) return ECORE_CALLBACK_PASS_ON;
+
+ extn->ipc.clients = eina_list_append(extn->ipc.clients, e->client);
+ ecore_ipc_client_send(e->client, MAJOR, OP_LOCK_FILE, 0, 0, 0, extn->file.lock, strlen(extn->file.lock) + 1);
+
+ if (extn->file.shmfile)
+ {
+ Ipc_Data_Resize ipc;
+
+ ecore_ipc_client_send(e->client, MAJOR, OP_SHM_REF,
+ ee->w, ee->h, ee->alpha,
+ extn->file.shmfile->file,
+ strlen(extn->file.shmfile->file) + 1);
+ ipc.w = ee->w;
+ ipc.h = ee->h;
+
+ ecore_ipc_client_send(e->client, MAJOR, OP_RESIZE,
+ 0, 0, 0, &ipc, sizeof(ipc));
+ }
+ _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_ADD);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ipc_client_del(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_Ipc_Event_Client_Del *e = event;
+ Ecore_Evas *ee = data;
+ Extn *extn;
+ extn = ee->engine.buffer.data;
+ if (!extn) return ECORE_CALLBACK_PASS_ON;
+ if (!eina_list_data_find(extn->ipc.clients, e->client)) return ECORE_CALLBACK_PASS_ON;
+
+ extn->ipc.clients = eina_list_remove(extn->ipc.clients, e->client);
+
+ _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_DEL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ipc_client_data(void *data, int type __UNUSED__, void *event)
+{
+ Ecore_Ipc_Event_Client_Data *e = event;
+ Ecore_Evas *ee = data;
+ Extn *extn;
+
+ if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client)))
+ return ECORE_CALLBACK_PASS_ON;
+ if (!eina_list_data_find(extn_ee_list, ee))
+ return ECORE_CALLBACK_PASS_ON;
+ extn = ee->engine.buffer.data;
+ if (!extn) return ECORE_CALLBACK_PASS_ON;
+ if (e->major != MAJOR)
+ return ECORE_CALLBACK_PASS_ON;
+ switch (e->minor)
+ {
+ case OP_RESIZE:
+ if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize)))
+ {
+
+ Ipc_Data_Resize *ipc = e->data;
+ /* create callbacke data size changed */
+ _ecore_evas_socket_resize(ee, ipc->w, ipc->h);
+ }
+ break;
+ case OP_SHOW:
+ if (!ee->visible)
+ {
+ ee->visible = 1;
+ if (ee->func.fn_show) ee->func.fn_show(ee);
+ }
+ break;
+ case OP_HIDE:
+ if (ee->visible)
+ {
+ ee->visible = 0;
+ if (ee->func.fn_hide) ee->func.fn_hide(ee);
+ }
+ break;
+ case OP_FOCUS:
+ if (!ee->prop.focused)
+ {
+ ee->prop.focused = 1;
+ evas_focus_in(ee->evas);
+ if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
+ }
+ break;
+ case OP_UNFOCUS:
+ if (ee->prop.focused)
+ {
+ ee->prop.focused = 0;
+ evas_focus_out(ee->evas);
+ if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
+ }
+ break;
+ case OP_EV_MOUSE_IN:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_In))
+ {
+ Ipc_Data_Ev_Mouse_In *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_mouse_in(ee->evas, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MOUSE_OUT:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Out))
+ {
+ Ipc_Data_Ev_Mouse_Out *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_mouse_out(ee->evas, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MOUSE_UP:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Up))
+ {
+ Ipc_Data_Ev_Mouse_Up *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_mouse_up(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MOUSE_DOWN:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Down))
+ {
+ Ipc_Data_Ev_Mouse_Up *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_mouse_down(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MOUSE_MOVE:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Move))
+ {
+ Ipc_Data_Ev_Mouse_Move *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_mouse_move(ee->evas, ipc->x, ipc->y, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MOUSE_WHEEL:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Wheel))
+ {
+ Ipc_Data_Ev_Mouse_Wheel *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_mouse_wheel(ee->evas, ipc->direction, ipc->z, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MULTI_UP:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Up))
+ {
+ Ipc_Data_Ev_Multi_Up *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_multi_up(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MULTI_DOWN:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Down))
+ {
+ Ipc_Data_Ev_Multi_Down *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_multi_down(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ case OP_EV_MULTI_MOVE:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Move))
+ {
+ Ipc_Data_Ev_Multi_Move *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_multi_move(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+
+#define STRGET(val) \
+ do { \
+ if ((ipc->val) && (ipc->val < (char *)(e->size - 1))) \
+ ipc->val = ((char *)ipc) + (long)ipc->val; \
+ else \
+ ipc->val = NULL; \
+ } while (0)
+
+ case OP_EV_KEY_UP:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Up))
+ {
+ if ((e->data) && (e->size > 0) &&
+ (((unsigned char *)e->data)[e->size - 1] == 0))
+ {
+ Ipc_Data_Ev_Key_Up *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ STRGET(keyname);
+ STRGET(key);
+ STRGET(string);
+ STRGET(compose);
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_key_up(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ }
+ break;
+ case OP_EV_KEY_DOWN:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Down))
+ {
+ if ((e->data) && (e->size > 0) &&
+ (((unsigned char *)e->data)[e->size - 1] == 0))
+ {
+ Ipc_Data_Ev_Key_Down *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ STRGET(keyname);
+ STRGET(key);
+ STRGET(string);
+ STRGET(compose);
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask);
+ evas_event_feed_key_down(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ }
+ break;
+ case OP_EV_HOLD:
+ if (e->size >= (int)sizeof(Ipc_Data_Ev_Hold))
+ {
+ Ipc_Data_Ev_Hold *ipc = e->data;
+ Evas_Event_Flags flags;
+
+ flags = evas_event_default_flags_get(ee->evas);
+ evas_event_default_flags_set(ee->evas, ipc->event_flags);
+ evas_event_feed_hold(ee->evas, ipc->hold, ipc->timestamp, NULL);
+ evas_event_default_flags_set(ee->evas, flags);
+ }
+ break;
+ default:
+ break;
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_ecore_evas_extn_socket_alpha_set(Ecore_Evas *ee, int alpha)
+{
+ Extn *extn;
+ Eina_List *l;
+ Ecore_Ipc_Client *client;
+
+ if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return;
+ ee->alpha = alpha;
+
+ extn = ee->engine.buffer.data;
+ if (extn)
+ {
+ Evas_Engine_Info_Buffer *einfo;
+
+ einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ if (ee->alpha)
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ else
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ }
+ EINA_LIST_FOREACH(extn->ipc.clients, l, client)
+ ecore_ipc_client_send(client, MAJOR, OP_SHM_REF,
+ ee->w, ee->h, ee->alpha,
+ extn->file.shmfile->file,
+ strlen(extn->file.shmfile->file) + 1);
+ }
+}
+
+static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func =
+{
+ _ecore_evas_extn_free,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _ecore_evas_socket_resize,
+ _ecore_evas_socket_move_resize,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ _ecore_evas_extn_socket_alpha_set,
+ NULL, //transparent
+
+ _ecore_evas_extn_socket_render, // render
+ NULL // screen_geometry_get
+};
+
+#endif
+
+EAPI Ecore_Evas *
+ecore_evas_extn_socket_new(int w, int h)
+{
+#ifdef EXTN_ENABLED
+ Evas_Engine_Info_Buffer *einfo;
+ Ecore_Evas *ee;
+ int rmethod;
+
+ rmethod = evas_render_method_lookup("buffer");
+ if (!rmethod) return NULL;
+ ee = calloc(1, sizeof(Ecore_Evas));
+ if (!ee) return NULL;
+
+ ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
+
+ ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_socket_engine_func;
+
+ ee->driver = "extn_socket";
+
+ ee->rotation = 0;
+ ee->visible = 0;
+ ee->w = w;
+ ee->h = h;
+ ee->req.w = ee->w;
+ ee->req.h = ee->h;
+
+ ee->prop.max.w = 0;
+ ee->prop.max.h = 0;
+ ee->prop.layer = 0;
+ ee->prop.focused = 0;
+ ee->prop.borderless = 1;
+ ee->prop.override = 1;
+ ee->prop.maximized = 0;
+ ee->prop.fullscreen = 0;
+ ee->prop.withdrawn = 0;
+ ee->prop.sticky = 0;
+
+ /* init evas here */
+ ee->evas = evas_new();
+ evas_data_attach_set(ee->evas, ee);
+ evas_output_method_set(ee->evas, rmethod);
+ evas_output_size_set(ee->evas, w, h);
+ evas_output_viewport_set(ee->evas, 0, 0, w, h);
+
+ einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ if (ee->alpha)
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ else
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
+ einfo->info.dest_buffer = NULL;
+ einfo->info.dest_buffer_row_bytes = 0;
+ einfo->info.use_color_key = 0;
+ einfo->info.alpha_threshold = 0;
+ einfo->info.func.new_update_region = NULL;
+ einfo->info.func.free_update_region = NULL;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+ }
+ else
+ {
+ ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+ evas_key_modifier_add(ee->evas, "Shift");
+ evas_key_modifier_add(ee->evas, "Control");
+ evas_key_modifier_add(ee->evas, "Alt");
+ evas_key_modifier_add(ee->evas, "Meta");
+ evas_key_modifier_add(ee->evas, "Hyper");
+ evas_key_modifier_add(ee->evas, "Super");
+ evas_key_lock_add(ee->evas, "Caps_Lock");
+ evas_key_lock_add(ee->evas, "Num_Lock");
+ evas_key_lock_add(ee->evas, "Scroll_Lock");
+
+ extn_ee_list = eina_list_append(extn_ee_list, ee);
+
+ _ecore_evas_register(ee);
+
+ return ee;
+#else
+ return NULL;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys)
+{
+#ifdef EXTN_ENABLED
+ Extn *extn;
+
+ extn = calloc(1, sizeof(Extn));
+ if (!extn)
+ {
+ return EINA_FALSE;
+ }
+ else
+ {
+ Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER;
+ char buf[PATH_MAX];
+
+ ecore_ipc_init();
+ extn->svc.name = eina_stringshare_add(svcname);
+ extn->svc.num = svcnum;
+ extn->svc.sys = svcsys;
+
+ snprintf(buf, sizeof(buf), "/tmp/ee-lock-XXXXXX");
+ extn->file.lockfd = mkstemp(buf);
+ if (extn->file.lockfd >= 0)
+ extn->file.lock = eina_stringshare_add(buf);
+ if ((extn->file.lockfd < 0) || (!extn->file.lock))
+ {
+ if (extn->file.lockfd)
+ {
+ close(extn->file.lockfd);
+ unlink(buf);
+ }
+ eina_stringshare_del(extn->svc.name);
+ if (extn->file.lock) eina_stringshare_del(extn->file.lock);
+ free(extn);
+ ecore_ipc_shutdown();
+ return EINA_FALSE;
+ }
+
+ if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM;
+ extn->ipc.am_server = EINA_TRUE;
+ extn->ipc.server = ecore_ipc_server_add(ipctype,
+ (char *)extn->svc.name,
+ extn->svc.num, ee);
+ if (!extn->ipc.server)
+ {
+ if (extn->file.lockfd)
+ {
+ close(extn->file.lockfd);
+ if (extn->file.lock) unlink(extn->file.lock);
+ }
+ eina_stringshare_del(extn->svc.name);
+ eina_stringshare_del(extn->file.lock);
+ free(extn);
+ ecore_ipc_shutdown();
+ return EINA_FALSE;
+ }
+ ee->engine.buffer.data = extn;
+ extn->ipc.handlers = eina_list_append
+ (extn->ipc.handlers,
+ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
+ _ipc_client_add, ee));
+ extn->ipc.handlers = eina_list_append
+ (extn->ipc.handlers,
+ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
+ _ipc_client_del, ee));
+ extn->ipc.handlers = eina_list_append
+ (extn->ipc.handlers,
+ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
+ _ipc_client_data, ee));
+ }
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+#endif
+}
# include <config.h>
#endif
+#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
if (ee->visible)
{
Eina_List *updates;
-
Eina_List *ll;
Ecore_Evas *ee2;
+
if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
static int
_ecore_evas_fb_init(Ecore_Evas *ee, int w, int h)
{
+ Eina_File_Direct_Info *info;
+ Eina_Iterator *ls;
Ecore_Fb_Input_Device *device;
Ecore_Fb_Input_Device_Cap caps;
int mouse_handled = 0;
- DIR *input_dir;
- struct dirent *input_entry;
-
_ecore_evas_init_count++;
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
ecore_event_evas_init();
/* register all input devices */
- input_dir = opendir("/dev/input/");
- if (!input_dir) return _ecore_evas_init_count;
+ ls = eina_file_direct_ls("/dev/input/");
- while ((input_entry = readdir(input_dir)))
+ EINA_ITERATOR_FOREACH(ls, info)
{
- char device_path[256];
-
- if (strncmp(input_entry->d_name, "event", 5) != 0)
+ if (strncmp(info->path + info->name_start, "event", 5) != 0)
continue;
- snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name);
- if (!(device = ecore_fb_input_device_open(device_path)))
+ if (!(device = ecore_fb_input_device_open(info->path)))
continue;
ecore_fb_input_device_window_set(device, ee);
ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
}
}
- closedir(input_dir);
+ eina_iterator_free(ls);
if (!mouse_handled)
{
#ifndef _ECORE_EVAS_PRIVATE_H
#define _ECORE_EVAS_PRIVATE_H
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef HAVE_SYS_MMAN_H
-# include <sys/mman.h>
-#endif
-
#include <Evas.h>
#include <Ecore.h>
#include <ecore_private.h>
# include <Evas_Engine_Gl_Cocoa.h>
#endif
-/**
- Log domain macros and variable
- **/
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+# include "Ecore_Wayland.h"
+# include <Evas_Engine_Wayland_Shm.h>
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+# include "Ecore_Wayland.h"
+# include <Evas_Engine_Wayland_Egl.h>
+#endif
+
+/** Log domain macros and variables **/
extern int _ecore_evas_log_dom;
} ews;
#endif
+#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL)
+ struct
+ {
+ Evas_Object *frame;
+
+ struct wl_shell_surface *shell_surface;
+ struct wl_surface *surface;
+ struct wl_buffer *buffer;
+ } wl;
+#endif
+
Ecore_Timer *idle_flush_timer;
};
Eina_Bool should_be_visible : 1;
Eina_Bool alpha : 1;
Eina_Bool transparent : 1;
+ Eina_Bool in : 1;
Eina_Hash *data;
char withdrawn : 1;
char sticky : 1;
char request_pos : 1;
+ char draw_frame : 1;
} prop;
struct {
int _ecore_evas_ews_shutdown(void);
#endif
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location);
+void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location);
+void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
+#endif
+
void _ecore_evas_fps_debug_init(void);
void _ecore_evas_fps_debug_shutdown(void);
void _ecore_evas_fps_debug_rendertime_add(double t);
extern Eina_Bool _ecore_evas_app_comp_sync;
+void _ecore_evas_extn_init(void);
+void _ecore_evas_extn_shutdown(void);
+
#endif
static int _ecore_evas_init_count = 0;
static Ecore_Evas *psl1ght_ee = NULL;
-static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {
+static Ecore_Event_Handler *ecore_evas_event_handlers[5] = {
NULL, NULL, NULL, NULL
};
ee->prop.focused = 1;
evas_focus_in(ee->evas);
if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
-
+
return ECORE_CALLBACK_PASS_ON;
}
evas_focus_out(ee->evas);
ee->prop.focused = 0;
if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
-
+
return ECORE_CALLBACK_PASS_ON;
}
return ECORE_CALLBACK_PASS_ON;
}
+static Eina_Bool
+_ecore_evas_psl1ght_event_quit (void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
+{
+ Ecore_Evas *ee;
+
+ ee = _ecore_evas_psl1ght_match();
+
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (ee->func.fn_delete_request)
+ ee->func.fn_delete_request(ee);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
static int
_ecore_evas_render(Ecore_Evas *ee)
{
ecore_event_evas_init();
- ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, _ecore_evas_psl1ght_event_got_focus, NULL);
- ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, _ecore_evas_psl1ght_event_lost_focus, NULL);
- ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, _ecore_evas_psl1ght_event_video_expose, NULL);
- ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, _ecore_evas_psl1ght_event_key_modifiers, NULL);
+ ecore_evas_event_handlers[0] =
+ ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS,
+ _ecore_evas_psl1ght_event_got_focus, NULL);
+ ecore_evas_event_handlers[1] =
+ ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS,
+ _ecore_evas_psl1ght_event_lost_focus, NULL);
+ ecore_evas_event_handlers[2] =
+ ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE,
+ _ecore_evas_psl1ght_event_video_expose, NULL);
+ ecore_evas_event_handlers[3] =
+ ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS,
+ _ecore_evas_psl1ght_event_key_modifiers, NULL);
+ ecore_evas_event_handlers[4] =
+ ecore_event_handler_add(ECORE_PSL1GHT_EVENT_QUIT,
+ _ecore_evas_psl1ght_event_quit, NULL);
return _ecore_evas_init_count;
}
}
static void
+_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
+{
+ ee->func.fn_delete_request = func;
+}
+
+static void
_ecore_evas_screen_resized(Ecore_Evas *ee)
{
int w, h;
NULL,
NULL,
NULL,
- NULL,
+ _ecore_evas_psl1ght_callback_delete_request_set,
NULL,
NULL,
NULL,
# endif
#endif
+#include <stdlib.h>
+#include <string.h>
+
#include "ecore_evas_private.h"
#include "Ecore_Evas.h"
# include <config.h>
#endif
+#include <stdlib.h>
#include <string.h>
#include <Ecore.h>
}
static void
-_ecore_evas_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+_ecore_evas_obj_callback_resize(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
{
Ecore_Evas *ee = data;
- Evas_Coord ow, oh, w, h;
+ Evas_Coord ow, oh, fw, fh;
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
- ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
- /*if ((w != ow) || (h != oh))*/ /* avoid recursion on ecore_evas_resize side */
- ecore_evas_resize(ee, ow, oh);
+ evas_output_framespace_get(e, NULL, NULL, &fw, &fh);
+ ow += fw;
+ oh += fh;
+ ecore_evas_resize(ee, ow, oh);
}
static void
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#define LOGFNS 1
+
+#ifdef LOGFNS
+# include <stdio.h>
+# define LOGFN(fl, ln, fn) \
+ printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn);
+#else
+# define LOGFN(fl, ln, fn)
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+# include <stdlib.h>
+# include <string.h>
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/mman.h>
+#endif
+
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+
+#include "ecore_evas_private.h"
+#include "Ecore_Evas.h"
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+# include <wayland-egl.h>
+# include <Evas_Engine_Wayland_Egl.h>
+# include <Ecore_Wayland.h>
+
+/* local structures */
+typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
+struct _EE_Wl_Smart_Data
+{
+ Evas_Object *frame, *text;
+ Evas_Coord x, y, w, h;
+};
+
+/* local function prototypes */
+static int _ecore_evas_wl_init(void);
+static int _ecore_evas_wl_shutdown(void);
+static void _ecore_evas_wl_pre_free(Ecore_Evas *ee);
+static void _ecore_evas_wl_free(Ecore_Evas *ee);
+static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_mouse_in_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_show(Ecore_Evas *ee);
+static void _ecore_evas_wl_hide(Ecore_Evas *ee);
+static void _ecore_evas_wl_raise(Ecore_Evas *ee);
+static void _ecore_evas_wl_lower(Ecore_Evas *ee);
+static void _ecore_evas_wl_activate(Ecore_Evas *ee);
+static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t);
+static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
+static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
+static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__);
+static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
+static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__);
+static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
+static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
+static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__);
+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 Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
+
+static void _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height);
+static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__);
+
+/* SMART stuff for frame */
+static Evas_Smart *_ecore_evas_wl_smart = NULL;
+
+static void _ecore_evas_wl_smart_init(void);
+static void _ecore_evas_wl_smart_add(Evas_Object *obj);
+static void _ecore_evas_wl_smart_del(Evas_Object *obj);
+static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+static void _ecore_evas_wl_smart_show(Evas_Object *obj);
+static void _ecore_evas_wl_smart_hide(Evas_Object *obj);
+
+static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
+
+/* local variables */
+static int _ecore_evas_wl_init_count = 0;
+static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8];
+static uint32_t _ecore_evas_wl_btn_timestamp;
+static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener =
+{
+ _ecore_evas_wl_handle_configure,
+ _ecore_evas_wl_handle_popup_done
+};
+
+static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
+{
+ _ecore_evas_wl_free,
+ _ecore_evas_wl_callback_resize_set,
+ _ecore_evas_wl_callback_move_set,
+ NULL, // callback show set
+ NULL, // callback hide set
+ _ecore_evas_wl_callback_delete_request_set,
+ NULL, // callback destroy set
+ _ecore_evas_wl_callback_focus_in_set,
+ _ecore_evas_wl_callback_focus_out_set,
+ _ecore_evas_wl_callback_mouse_in_set,
+ NULL, // callback mouse out set
+ NULL, // callback sticky set
+ NULL, // callback unsticky set
+ NULL, // callback pre render set
+ NULL, // callback post render set
+ _ecore_evas_wl_move,
+ NULL, // func managed move
+ _ecore_evas_wl_resize,
+ NULL, // _ecore_evas_wl_move_resize,
+ NULL, // func rotation set
+ NULL, // func shaped set
+ _ecore_evas_wl_show,
+ _ecore_evas_wl_hide,
+ _ecore_evas_wl_raise,
+ _ecore_evas_wl_lower,
+ _ecore_evas_wl_activate,
+ _ecore_evas_wl_title_set,
+ _ecore_evas_wl_name_class_set,
+ _ecore_evas_wl_size_min_set,
+ _ecore_evas_wl_size_max_set,
+ _ecore_evas_wl_size_base_set,
+ _ecore_evas_wl_size_step_set,
+ _ecore_evas_wl_object_cursor_set,
+ _ecore_evas_wl_layer_set,
+ _ecore_evas_wl_focus_set,
+ _ecore_evas_wl_iconified_set,
+ NULL, // func borderless set
+ NULL, // func override set
+ _ecore_evas_wl_maximized_set,
+ _ecore_evas_wl_fullscreen_set,
+ NULL, // _ecore_evas_wl_avoid_damage_set,
+ NULL, // func withdrawn set
+ NULL, // func sticky set
+ NULL, // func ignore events set
+ NULL, // func alpha set
+ NULL, // func transparent set
+ _ecore_evas_wl_render,
+ _ecore_evas_wl_screen_geometry_get
+};
+
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
+EAPI Ecore_Evas *
+ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame)
+{
+ Evas_Engine_Info_Wayland_Egl *einfo;
+ Ecore_Evas *ee;
+ int method = 0;
+ static int _win_id = 1;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(method = evas_render_method_lookup("wayland_egl")))
+ {
+ printf("Render method lookup failed for Wayland Egl");
+ return NULL;
+ }
+
+ if (!ecore_wl_init(disp_name))
+ {
+ printf("Failed to initialize Ecore Wayland");
+ return NULL;
+ }
+
+ if (!(ee = calloc(1, sizeof(Ecore_Evas))))
+ {
+ printf("Failed to allocate Ecore_Evas.");
+ ecore_wl_shutdown();
+ return NULL;
+ }
+
+ ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
+
+ _ecore_evas_wl_init();
+
+ ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
+
+ ee->driver = "wayland_egl";
+ if (disp_name) ee->name = strdup(disp_name);
+
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+
+ ee->req.x = ee->x = x;
+ ee->req.y = ee->y = y;
+ ee->req.w = ee->w = w;
+ ee->req.h = ee->h = h;
+ ee->rotation = 0;
+ ee->prop.max.w = ee->prop.max.h = 32767;
+ ee->prop.layer = 4;
+ ee->prop.request_pos = 0;
+ ee->prop.sticky = 0;
+ ee->prop.draw_frame = frame;
+ ee->prop.window = _win_id++;
+
+ ee->evas = evas_new();
+ evas_data_attach_set(ee->evas, ee);
+ evas_output_method_set(ee->evas, method);
+ evas_output_size_set(ee->evas, ee->w, ee->h);
+ evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
+
+ if (ee->prop.draw_frame)
+ evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
+
+ if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
+ {
+ einfo->info.display = ecore_wl_display_get();
+ einfo->info.rotation = ee->rotation;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ printf("Failed to set Evas Engine Info for '%s'.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+ }
+ else
+ {
+ printf("Failed to get Evas Engine Info for '%s'.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+
+ /* NB: we need to be notified before 'free' so we can munmap the evas
+ * engine destination */
+ ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
+
+ if (ee->prop.draw_frame)
+ {
+ ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas);
+ evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE);
+ evas_object_move(ee->engine.wl.frame, 0, 0);
+ }
+
+ 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,
+ (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
+ (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
+ (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
+
+ evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
+
+ return ee;
+}
+
+/* local functions */
+static int
+_ecore_evas_wl_init(void)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (++_ecore_evas_wl_init_count != 1)
+ return _ecore_evas_wl_init_count;
+
+ _ecore_evas_wl_event_handlers[0] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ _ecore_evas_wl_event_mouse_down, NULL);
+ _ecore_evas_wl_event_handlers[1] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
+ _ecore_evas_wl_event_mouse_up, NULL);
+ _ecore_evas_wl_event_handlers[2] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
+ _ecore_evas_wl_event_mouse_move, NULL);
+ _ecore_evas_wl_event_handlers[3] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
+ _ecore_evas_wl_event_mouse_wheel, NULL);
+ _ecore_evas_wl_event_handlers[4] =
+ ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
+ _ecore_evas_wl_event_mouse_in, NULL);
+ _ecore_evas_wl_event_handlers[5] =
+ ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
+ _ecore_evas_wl_event_mouse_out, NULL);
+ _ecore_evas_wl_event_handlers[6] =
+ ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
+ _ecore_evas_wl_event_focus_in, NULL);
+ _ecore_evas_wl_event_handlers[7] =
+ ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
+ _ecore_evas_wl_event_focus_out, NULL);
+
+ ecore_event_evas_init();
+
+ return _ecore_evas_wl_init_count;
+}
+
+static int
+_ecore_evas_wl_shutdown(void)
+{
+ unsigned int i = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (--_ecore_evas_wl_init_count != 0)
+ return _ecore_evas_wl_init_count;
+
+ for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++)
+ {
+ if (_ecore_evas_wl_event_handlers[i])
+ ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]);
+ }
+
+ ecore_event_evas_shutdown();
+
+ return _ecore_evas_wl_init_count;
+}
+
+static void
+_ecore_evas_wl_pre_free(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
+}
+
+static void
+_ecore_evas_wl_free(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (ee)
+ {
+ /* destroy shell surface */
+ if (ee->engine.wl.shell_surface)
+ wl_shell_surface_destroy(ee->engine.wl.shell_surface);
+ ee->engine.wl.shell_surface = NULL;
+
+ /* destroy surface */
+ if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface);
+ ee->engine.wl.surface = NULL;
+
+ ecore_event_window_unregister(ee->prop.window);
+ ecore_evas_input_event_unregister(ee);
+ }
+ _ecore_evas_wl_shutdown();
+ ecore_wl_shutdown();
+}
+
+static void
+_ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_resize = func;
+}
+
+static void
+_ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_move = func;
+}
+
+static void
+_ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_delete_request = func;
+}
+
+static void
+_ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_focus_in = func;
+}
+
+static void
+_ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_focus_out = func;
+}
+
+static void
+_ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_mouse_in = func;
+}
+
+static void
+_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+// if ((ee->x == x) && (ee->y == y)) return;
+ ee->req.x = x;
+ ee->req.y = y;
+
+ ee->x = x;
+ ee->y = y;
+ if (ee->engine.wl.shell_surface)
+ {
+ wl_shell_surface_move(ee->engine.wl.shell_surface,
+ ecore_wl_input_device_get(),
+ _ecore_evas_wl_btn_timestamp);
+ }
+ if (ee->func.fn_move) ee->func.fn_move(ee);
+}
+
+static void
+_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+ if ((ee->w == w) && (ee->h == h)) return;
+
+ ee->req.w = w;
+ ee->req.h = h;
+
+ /* if (ee->visible) */
+ /* { */
+ /* damage old surface, if it exists */
+
+ /* NB: This removes any lingering screen artifacts in the compositor.
+ * This may be a 'HACK' if the issue is actually in the wayland
+ * compositor, but for now lets implement this so we don't have screen
+ * artifacts laying around during a resize */
+ /* if (ee->engine.wl.surface) */
+ /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */
+ /* } */
+
+ ee->w = w;
+ ee->h = h;
+
+// ecore_wl_flush();
+
+ 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);
+
+ /* if ((ee->visible) && (ee->engine.wl.surface)) */
+ /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */
+
+ if (ee->func.fn_resize) ee->func.fn_resize(ee);
+}
+
+static void
+_ecore_evas_wl_show(Ecore_Evas *ee)
+{
+ Evas_Engine_Info_Wayland_Egl *einfo;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->visible) return;
+
+ einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
+
+ /* create new surface */
+ ee->engine.wl.surface =
+ wl_compositor_create_surface(ecore_wl_compositor_get());
+ wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window);
+
+ /* create new shell surface */
+ ee->engine.wl.shell_surface =
+ wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface);
+
+ /* set the engine surface here. This should trigger an egl window create */
+ einfo->info.surface = ee->engine.wl.surface;
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+
+ /* add listener for configure events (happen on shell surface resize) */
+ wl_shell_surface_add_listener(ee->engine.wl.shell_surface,
+ &_ecore_evas_wl_shell_surface_listener, ee);
+
+ /* Raise this surface to the top */
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+
+ 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_flush();
+
+ ee->visible = 1;
+ if (ee->func.fn_show) ee->func.fn_show(ee);
+}
+
+static void
+_ecore_evas_wl_hide(Ecore_Evas *ee)
+{
+ Evas_Engine_Info_Wayland_Egl *einfo;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (!ee->visible) return;
+
+ /* get engine info */
+ einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
+ einfo->info.surface = NULL;
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+
+ /* destroy shell surface */
+ if (ee->engine.wl.shell_surface)
+ wl_shell_surface_destroy(ee->engine.wl.shell_surface);
+ ee->engine.wl.shell_surface = NULL;
+
+ /* destroy surface */
+ if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface);
+ ee->engine.wl.surface = NULL;
+
+ ee->visible = 0;
+ ee->should_be_visible = 0;
+ if (ee->func.fn_hide) ee->func.fn_hide(ee);
+}
+
+static void
+_ecore_evas_wl_raise(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+}
+
+static void
+_ecore_evas_wl_lower(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ /* FIXME: Need a way to tell Wayland to lower */
+}
+
+static void
+_ecore_evas_wl_activate(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+}
+
+static void
+_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.title) free(ee->prop.title);
+ ee->prop.title = NULL;
+ if (t) ee->prop.title = strdup(t);
+
+ if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
+ {
+ EE_Wl_Smart_Data *sd;
+
+ if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
+ evas_object_text_text_set(sd->text, ee->prop.title);
+ }
+}
+
+static void
+_ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.name) free(ee->prop.name);
+ if (ee->prop.clas) free(ee->prop.clas);
+ ee->prop.name = NULL;
+ ee->prop.clas = NULL;
+ if (n) ee->prop.name = strdup(n);
+ if (c) ee->prop.clas = strdup(c);
+ /* FIXME: Forward these changes to Wayland somehow */
+}
+
+static void
+_ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
+ ee->prop.min.w = w;
+ ee->prop.min.h = h;
+}
+
+static void
+_ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
+ ee->prop.max.w = w;
+ ee->prop.max.h = h;
+}
+
+static void
+_ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
+ ee->prop.base.w = w;
+ ee->prop.base.h = h;
+}
+
+static void
+_ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
+ ee->prop.step.w = w;
+ ee->prop.step.h = h;
+}
+
+static void
+_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
+{
+ int x = 0, y = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
+ ee->prop.cursor.object = NULL;
+
+ if (!obj)
+ {
+ ee->prop.cursor.layer = 0;
+ ee->prop.cursor.hot.x = 0;
+ ee->prop.cursor.hot.y = 0;
+ return;
+ }
+
+ ee->prop.cursor.object = obj;
+ ee->prop.cursor.layer = layer;
+ ee->prop.cursor.hot.x = hot_x;
+ ee->prop.cursor.hot.y = hot_y;
+
+ evas_pointer_output_xy_get(ee->evas, &x, &y);
+ evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
+ evas_object_move(ee->prop.cursor.object,
+ x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y);
+ evas_object_pass_events_set(ee->prop.cursor.object, 1);
+ if (evas_pointer_inside_get(ee->evas))
+ evas_object_show(ee->prop.cursor.object);
+
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
+ _ecore_evas_wl_object_cursor_del, ee);
+}
+
+static void
+_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
+{
+ Ecore_Evas *ee;
+
+ if (!(ee = data)) return;
+ ee->prop.cursor.object = NULL;
+}
+
+static void
+_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.layer == layer) return;
+ if (layer < 1) layer = 1;
+ else if (layer > 255) layer = 255;
+ ee->prop.layer = layer;
+}
+
+static void
+_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+}
+
+static void
+_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.iconified == iconify) return;
+ ee->prop.iconified = iconify;
+ /* FIXME: Implement this in Wayland someshow */
+}
+
+static void
+_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.maximized == max) return;
+ ee->prop.maximized = max;
+ /* FIXME: Implement this in Wayland someshow */
+}
+
+static void
+_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface);
+}
+
+static int
+_ecore_evas_wl_render(Ecore_Evas *ee)
+{
+ int rend = 0;
+
+ if (!ee) return 0;
+ if (!ee->visible)
+ evas_norender(ee->evas);
+ else
+ {
+ Eina_List *ll = NULL, *updates = NULL;
+ Ecore_Evas *ee2 = NULL;
+
+ if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
+
+ EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
+ {
+ if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
+ if (ee2->engine.func->fn_render)
+ rend |= ee2->engine.func->fn_render(ee2);
+ if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
+ }
+
+ if ((updates = evas_render_updates(ee->evas)))
+ {
+ /* if (ee->engine.wl.surface) */
+ /* { */
+ /* Eina_List *l = NULL; */
+ /* Eina_Rectangle *r; */
+
+ /* EINA_LIST_FOREACH(updates, l, r) */
+ /* wl_surface_damage(ee->engine.wl.surface, */
+ /* r->x, r->y, r->w, r->h); */
+ /* } */
+
+ evas_render_updates_free(updates);
+ _ecore_evas_idle_timeout_update(ee);
+ rend = 1;
+
+ ecore_wl_flush();
+ }
+
+ if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
+ }
+
+ return rend;
+}
+
+static void
+_ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (x) *x = 0;
+ if (y) *y = 0;
+ ecore_wl_screen_size_get(w, h);
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Button *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ _ecore_evas_wl_btn_timestamp = ev->timestamp;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers,
+ ev->timestamp, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Button *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers,
+ ev->timestamp, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Move *ev;
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ ee->mouse.x = ev->x;
+ ee->mouse.y = ev->y;
+ evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Wheel *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z,
+ ev->timestamp, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Mouse_In *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ 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->time, NULL);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Mouse_Out *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time);
+ evas_event_feed_mouse_out(ee->evas, ev->time, NULL);
+ if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+ if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Focus_In *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ ee->prop.focused = 1;
+ evas_focus_in(ee->evas);
+ if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Focus_Out *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_focus_out(ee->evas);
+ ee->prop.focused = 0;
+ if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height)
+{
+ Ecore_Evas *ee;
+
+ /* NB: Trap to prevent compositor from crashing */
+ if ((width <= 0) || (height <= 0)) return;
+
+ if (!(ee = data)) return;
+
+ printf("EGL Handle Configure Message\n");
+ if ((shell_surface) && (ee->engine.wl.shell_surface))
+ {
+ if (ee->engine.wl.shell_surface != shell_surface) return;
+ ecore_evas_resize(ee, width, height);
+ }
+}
+
+static void
+_ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__)
+{
+
+}
+
+static void
+_ecore_evas_wl_smart_init(void)
+{
+ if (_ecore_evas_wl_smart) return;
+ {
+ static const Evas_Smart_Class sc =
+ {
+ "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION,
+ _ecore_evas_wl_smart_add,
+ _ecore_evas_wl_smart_del,
+ NULL,
+ _ecore_evas_wl_smart_resize,
+ _ecore_evas_wl_smart_show,
+ _ecore_evas_wl_smart_hide,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ };
+ _ecore_evas_wl_smart = evas_smart_class_new(&sc);
+ }
+}
+
+static void
+_ecore_evas_wl_smart_add(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+ Evas *evas;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
+
+ evas = evas_object_evas_get(obj);
+
+ sd->x = 0;
+ sd->y = 0;
+ sd->w = 1;
+ sd->h = 1;
+
+ sd->frame = evas_object_rectangle_add(evas);
+ evas_object_is_frame_object_set(sd->frame, EINA_TRUE);
+ evas_object_color_set(sd->frame, 249, 249, 249, 255);
+ evas_object_smart_member_add(sd->frame, obj);
+
+ sd->text = evas_object_text_add(evas);
+ evas_object_color_set(sd->text, 0, 0, 0, 255);
+ evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
+ evas_object_text_font_set(sd->text, "Sans", 10);
+ evas_object_text_text_set(sd->text, "Smart Test");
+
+ evas_object_smart_data_set(obj, sd);
+}
+
+static void
+_ecore_evas_wl_smart_del(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ evas_object_del(sd->text);
+ evas_object_del(sd->frame);
+ free(sd);
+}
+
+static void
+_ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ if ((sd->w == w) && (sd->h == h)) return;
+ sd->w = w;
+ sd->h = h;
+ evas_object_resize(sd->frame, w, h);
+}
+
+static void
+_ecore_evas_wl_smart_show(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ evas_object_show(sd->frame);
+ evas_object_show(sd->text);
+}
+
+static void
+_ecore_evas_wl_smart_hide(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ evas_object_hide(sd->text);
+ evas_object_hide(sd->frame);
+}
+
+static Evas_Object *
+_ecore_evas_wl_frame_add(Evas *evas)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ _ecore_evas_wl_smart_init();
+ return evas_object_smart_add(evas, _ecore_evas_wl_smart);
+}
+
+void
+_ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->engine.wl.shell_surface)) return;
+ wl_shell_surface_resize(ee->engine.wl.shell_surface,
+ ecore_wl_input_device_get(),
+ _ecore_evas_wl_btn_timestamp, location);
+}
+
+void
+_ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->engine.wl.surface)) return;
+ if ((!source) || (!drag_ee)) return;
+ ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer);
+}
+
+#else
+EAPI Ecore_Evas *
+ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__)
+{
+ return NULL;
+}
+#endif
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+//#define LOGFNS 1
+
+#ifdef LOGFNS
+# include <stdio.h>
+# define LOGFN(fl, ln, fn) \
+ printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn);
+#else
+# define LOGFN(fl, ln, fn)
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+# include <stdlib.h>
+# include <string.h>
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/mman.h>
+#endif
+
+# include <Eina.h>
+# include <Evas.h>
+# include <Ecore.h>
+
+# include "ecore_evas_private.h"
+# include "Ecore_Evas.h"
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+# include <Evas_Engine_Wayland_Shm.h>
+# include <Ecore_Wayland.h>
+
+/* local structures */
+typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
+struct _EE_Wl_Smart_Data
+{
+ Evas_Object *frame;
+ Evas_Object *text;
+ Evas_Coord x, y, w, h;
+};
+
+/* local function prototypes */
+static int _ecore_evas_wl_init(void);
+static int _ecore_evas_wl_shutdown(void);
+static void _ecore_evas_wl_pre_free(Ecore_Evas *ee);
+static void _ecore_evas_wl_free(Ecore_Evas *ee);
+static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
+static void _ecore_evas_wl_callback_mouse_in_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_show(Ecore_Evas *ee);
+static void _ecore_evas_wl_hide(Ecore_Evas *ee);
+static void _ecore_evas_wl_raise(Ecore_Evas *ee);
+static void _ecore_evas_wl_lower(Ecore_Evas *ee);
+static void _ecore_evas_wl_activate(Ecore_Evas *ee);
+static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t);
+static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
+static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
+static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
+static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__);
+static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
+static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__);
+static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
+static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
+static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__);
+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_buffer_new(Ecore_Evas *ee, void **dest);
+
+static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
+
+static void _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height);
+static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__);
+
+/* SMART stuff for frame */
+static Evas_Smart *_ecore_evas_wl_smart = NULL;
+
+static void _ecore_evas_wl_smart_init(void);
+static void _ecore_evas_wl_smart_add(Evas_Object *obj);
+static void _ecore_evas_wl_smart_del(Evas_Object *obj);
+static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+static void _ecore_evas_wl_smart_show(Evas_Object *obj);
+static void _ecore_evas_wl_smart_hide(Evas_Object *obj);
+
+static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
+
+/* local variables */
+static int _ecore_evas_wl_init_count = 0;
+static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8];
+static uint32_t _ecore_evas_wl_btn_timestamp;
+static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener =
+{
+ _ecore_evas_wl_handle_configure,
+ _ecore_evas_wl_handle_popup_done
+};
+
+static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
+{
+ _ecore_evas_wl_free,
+ _ecore_evas_wl_callback_resize_set,
+ _ecore_evas_wl_callback_move_set,
+ NULL, // callback show set
+ NULL, // callback hide set
+ _ecore_evas_wl_callback_delete_request_set,
+ NULL, // callback destroy set
+ _ecore_evas_wl_callback_focus_in_set,
+ _ecore_evas_wl_callback_focus_out_set,
+ _ecore_evas_wl_callback_mouse_in_set,
+ NULL, // callback mouse out set
+ NULL, // callback sticky set
+ NULL, // callback unsticky set
+ NULL, // callback pre render set
+ NULL, // callback post render set
+ _ecore_evas_wl_move,
+ NULL, // func managed move
+ _ecore_evas_wl_resize,
+ NULL, // func move_resize
+ NULL, // func rotation set
+ NULL, // func shaped set
+ _ecore_evas_wl_show,
+ _ecore_evas_wl_hide,
+ _ecore_evas_wl_raise,
+ _ecore_evas_wl_lower,
+ _ecore_evas_wl_activate,
+ _ecore_evas_wl_title_set,
+ _ecore_evas_wl_name_class_set,
+ _ecore_evas_wl_size_min_set,
+ _ecore_evas_wl_size_max_set,
+ _ecore_evas_wl_size_base_set,
+ _ecore_evas_wl_size_step_set,
+ _ecore_evas_wl_object_cursor_set,
+ _ecore_evas_wl_layer_set,
+ _ecore_evas_wl_focus_set,
+ _ecore_evas_wl_iconified_set,
+ NULL, // func borderless set
+ NULL, // func override set
+ _ecore_evas_wl_maximized_set,
+ _ecore_evas_wl_fullscreen_set,
+ NULL, // func avoid_damage set
+ NULL, // func withdrawn set
+ NULL, // func sticky set
+ NULL, // func ignore_events set
+ NULL, // func alpha set
+ NULL, // func transparent set
+ _ecore_evas_wl_render,
+ _ecore_evas_wl_screen_geometry_get
+};
+
+/* external variables */
+#endif
+
+#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
+EAPI Ecore_Evas *
+ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame)
+{
+ Evas_Engine_Info_Wayland_Shm *einfo;
+ Ecore_Evas *ee;
+ int method = 0;
+ static int _win_id = 1;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(method = evas_render_method_lookup("wayland_shm")))
+ {
+ ERR("Render method lookup failed.");
+ return NULL;
+ }
+
+ if (!(ecore_wl_init(disp_name)))
+ {
+ ERR("Failed to initialize Ecore Wayland.");
+ return NULL;
+ }
+
+ if (!(ee = calloc(1, sizeof(Ecore_Evas))))
+ {
+ ERR("Failed to allocate Ecore_Evas.");
+ ecore_wl_shutdown();
+ return NULL;
+ }
+
+ ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
+
+ _ecore_evas_wl_init();
+
+ ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
+
+ ee->driver = "wayland_shm";
+ if (disp_name) ee->name = strdup(disp_name);
+
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+
+ ee->req.x = ee->x = x;
+ ee->req.y = ee->y = y;
+ ee->req.w = ee->w = w;
+ ee->req.h = ee->h = h;
+ ee->rotation = 0;
+ ee->prop.max.w = ee->prop.max.h = 32767;
+ ee->prop.layer = 4;
+ ee->prop.request_pos = 0;
+ ee->prop.sticky = 0;
+ ee->prop.draw_frame = frame;
+ ee->prop.window = _win_id++;
+
+ ee->evas = evas_new();
+ evas_data_attach_set(ee->evas, ee);
+ evas_output_method_set(ee->evas, method);
+ evas_output_size_set(ee->evas, ee->w, ee->h);
+ evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
+
+ if (ee->prop.draw_frame)
+ evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
+
+ if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
+ {
+ einfo->info.rotation = ee->rotation;
+ einfo->info.debug = EINA_FALSE;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("Failed to set Evas Engine Info for '%s'.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+ }
+ else
+ {
+ ERR("Failed to get Evas Engine Info for '%s'.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+
+ /* NB: we need to be notified before 'free' so we can munmap the evas
+ * engine destination */
+ ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
+
+ if (ee->prop.draw_frame)
+ {
+ ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas);
+ evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE);
+ evas_object_move(ee->engine.wl.frame, 0, 0);
+ }
+
+ 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,
+ (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
+ (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
+ (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
+
+ evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
+
+ return ee;
+}
+
+/* local functions */
+static int
+_ecore_evas_wl_init(void)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (++_ecore_evas_wl_init_count != 1)
+ return _ecore_evas_wl_init_count;
+
+ _ecore_evas_wl_event_handlers[0] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ _ecore_evas_wl_event_mouse_down, NULL);
+ _ecore_evas_wl_event_handlers[1] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
+ _ecore_evas_wl_event_mouse_up, NULL);
+ _ecore_evas_wl_event_handlers[2] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
+ _ecore_evas_wl_event_mouse_move, NULL);
+ _ecore_evas_wl_event_handlers[3] =
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
+ _ecore_evas_wl_event_mouse_wheel, NULL);
+ _ecore_evas_wl_event_handlers[4] =
+ ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
+ _ecore_evas_wl_event_mouse_in, NULL);
+ _ecore_evas_wl_event_handlers[5] =
+ ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
+ _ecore_evas_wl_event_mouse_out, NULL);
+ _ecore_evas_wl_event_handlers[6] =
+ ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
+ _ecore_evas_wl_event_focus_in, NULL);
+ _ecore_evas_wl_event_handlers[7] =
+ ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
+ _ecore_evas_wl_event_focus_out, NULL);
+
+ ecore_event_evas_init();
+
+ return _ecore_evas_wl_init_count;
+}
+
+static int
+_ecore_evas_wl_shutdown(void)
+{
+ unsigned int i = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (--_ecore_evas_wl_init_count != 0)
+ return _ecore_evas_wl_init_count;
+
+ for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++)
+ {
+ if (_ecore_evas_wl_event_handlers[i])
+ ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]);
+ }
+
+ ecore_event_evas_shutdown();
+
+ return _ecore_evas_wl_init_count;
+}
+
+static void
+_ecore_evas_wl_pre_free(Ecore_Evas *ee)
+{
+ Evas_Engine_Info_Wayland_Shm *einfo;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ /* destroy frame */
+ if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
+
+ /* get engine info */
+ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
+ if ((einfo) && (einfo->info.dest))
+ {
+ int ret = 0;
+
+ /* munmap previous engine destination */
+ ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
+ }
+}
+
+static void
+_ecore_evas_wl_free(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ /* destroy buffer */
+ if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
+ ee->engine.wl.buffer = NULL;
+
+ /* destroy shell surface */
+ if (ee->engine.wl.shell_surface)
+ wl_shell_surface_destroy(ee->engine.wl.shell_surface);
+ ee->engine.wl.shell_surface = NULL;
+
+ /* destroy surface */
+ if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface);
+ ee->engine.wl.surface = NULL;
+
+ ecore_event_window_unregister(ee->prop.window);
+ ecore_evas_input_event_unregister(ee);
+
+ _ecore_evas_wl_shutdown();
+ ecore_wl_shutdown();
+}
+
+static void
+_ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_resize = func;
+}
+
+static void
+_ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_move = func;
+}
+
+static void
+_ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_delete_request = func;
+}
+
+static void
+_ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_focus_in = func;
+}
+
+static void
+_ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_focus_out = func;
+}
+
+static void
+_ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ ee->func.fn_mouse_in = func;
+}
+
+static void
+_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+// if ((ee->x == x) && (ee->y == y)) return;
+ ee->req.x = x;
+ ee->req.y = y;
+
+ ee->x = x;
+ ee->y = y;
+
+ if (ee->engine.wl.shell_surface)
+ {
+ wl_shell_surface_move(ee->engine.wl.shell_surface,
+ ecore_wl_input_device_get(),
+ _ecore_evas_wl_btn_timestamp);
+ }
+
+ if (ee->func.fn_move) ee->func.fn_move(ee);
+}
+
+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;
+ if ((ee->w == w) && (ee->h == h)) return;
+
+ ee->req.w = w;
+ ee->req.h = h;
+
+ if (ee->visible)
+ {
+ /* damage old surface, if it exists */
+
+ /* NB: This removes any lingering screen artifacts in the compositor.
+ * This may be a 'HACK' if the issue is actually in the wayland
+ * compositor, but for now lets implement this so we don't have screen
+ * artifacts laying around during a resize */
+ if (ee->engine.wl.surface)
+ wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h);
+ }
+
+ /* get engine info */
+ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
+ if (einfo->info.dest)
+ {
+ int ret = 0;
+
+ /* munmap previous engine destination */
+ ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
+ }
+
+ /* free old buffer */
+ if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
+ ee->engine.wl.buffer = NULL;
+
+ ee->w = w;
+ ee->h = h;
+
+ /* create buffer @ new size (also mmaps the new destination) */
+ _ecore_evas_wl_buffer_new(ee, &einfo->info.dest);
+
+ /* flush new buffer fd */
+ ecore_wl_flush();
+
+ /* 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);
+
+ /* set new engine destination */
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+
+ /* damage buffer */
+ wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h);
+
+ if (ee->visible)
+ {
+ /* damage surface */
+ wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h);
+
+ /* if visible, attach to surface */
+ wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0);
+ }
+
+ if (ee->func.fn_resize) ee->func.fn_resize(ee);
+}
+
+static void
+_ecore_evas_wl_show(Ecore_Evas *ee)
+{
+ Evas_Engine_Info_Wayland_Shm *einfo;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->visible) return;
+
+ /* get engine info */
+ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
+
+ /* create new surface */
+ ee->engine.wl.surface =
+ wl_compositor_create_surface(ecore_wl_compositor_get());
+ wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window);
+
+ /* get new shell surface */
+ ee->engine.wl.shell_surface =
+ wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface);
+
+ /* set toplevel */
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+
+ /* create buffer @ new size (also mmaps the new destination) */
+ _ecore_evas_wl_buffer_new(ee, &einfo->info.dest);
+
+ if (ee->engine.wl.frame)
+ {
+ evas_object_show(ee->engine.wl.frame);
+ evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
+ }
+
+ /* set new engine destination */
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+
+ /* add configure listener for wayland resize events */
+ wl_shell_surface_add_listener(ee->engine.wl.shell_surface,
+ &_ecore_evas_wl_shell_surface_listener, ee);
+
+ /* flush new buffer fd */
+ ecore_wl_flush();
+
+ /* attach buffer to surface */
+ wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0);
+
+ /* NB: No need to do a damage here. If we do, we end up w/ screen
+ * artifacts in the compositor */
+ /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */
+
+ ee->visible = 1;
+ if (ee->func.fn_show) ee->func.fn_show(ee);
+}
+
+static void
+_ecore_evas_wl_hide(Ecore_Evas *ee)
+{
+ Evas_Engine_Info_Wayland_Shm *einfo;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (!ee->visible) return;
+
+ /* get engine info */
+ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
+ if (einfo->info.dest)
+ {
+ int ret = 0;
+
+ /* munmap previous engine destination */
+ ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
+ einfo->info.dest = NULL;
+ }
+
+ /* free old buffer */
+ if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
+ ee->engine.wl.buffer = NULL;
+
+ /* set new engine destination */
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+
+ /* destroy shell surface */
+ if (ee->engine.wl.shell_surface)
+ wl_shell_surface_destroy(ee->engine.wl.shell_surface);
+ ee->engine.wl.shell_surface = NULL;
+
+ /* destroy surface */
+ if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface);
+ ee->engine.wl.surface = NULL;
+
+ ee->visible = 0;
+ ee->should_be_visible = 0;
+ if (ee->func.fn_hide) ee->func.fn_hide(ee);
+}
+
+static void
+_ecore_evas_wl_raise(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+}
+
+static void
+_ecore_evas_wl_lower(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ /* FIXME: Need a way to tell Wayland to lower */
+}
+
+static void
+_ecore_evas_wl_activate(Ecore_Evas *ee)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+}
+
+static void
+_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.title) free(ee->prop.title);
+ ee->prop.title = NULL;
+ if (t) ee->prop.title = strdup(t);
+
+ if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
+ {
+ EE_Wl_Smart_Data *sd;
+
+ if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return;
+ evas_object_text_text_set(sd->text, ee->prop.title);
+ }
+}
+
+static void
+_ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.name) free(ee->prop.name);
+ if (ee->prop.clas) free(ee->prop.clas);
+ ee->prop.name = NULL;
+ ee->prop.clas = NULL;
+ if (n) ee->prop.name = strdup(n);
+ if (c) ee->prop.clas = strdup(c);
+ /* FIXME: Forward these changes to Wayland somehow */
+}
+
+static void
+_ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
+ ee->prop.min.w = w;
+ ee->prop.min.h = h;
+}
+
+static void
+_ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
+ ee->prop.max.w = w;
+ ee->prop.max.h = h;
+}
+
+static void
+_ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
+ ee->prop.base.w = w;
+ ee->prop.base.h = h;
+}
+
+static void
+_ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (w < 0) w = 0;
+ if (h < 0) h = 0;
+ if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
+ ee->prop.step.w = w;
+ ee->prop.step.h = h;
+}
+
+static void
+_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
+{
+ int x = 0, y = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
+ ee->prop.cursor.object = NULL;
+
+ if (!obj)
+ {
+ ee->prop.cursor.layer = 0;
+ ee->prop.cursor.hot.x = 0;
+ ee->prop.cursor.hot.y = 0;
+ return;
+ }
+
+ ee->prop.cursor.object = obj;
+ ee->prop.cursor.layer = layer;
+ ee->prop.cursor.hot.x = hot_x;
+ ee->prop.cursor.hot.y = hot_y;
+
+ evas_pointer_output_xy_get(ee->evas, &x, &y);
+ evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
+ evas_object_move(ee->prop.cursor.object,
+ x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y);
+ evas_object_pass_events_set(ee->prop.cursor.object, 1);
+ if (evas_pointer_inside_get(ee->evas))
+ evas_object_show(ee->prop.cursor.object);
+
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
+ _ecore_evas_wl_object_cursor_del, ee);
+}
+
+static void
+_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
+{
+ Ecore_Evas *ee;
+
+ if (!(ee = data)) return;
+ ee->prop.cursor.object = NULL;
+}
+
+static void
+_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.layer == layer) return;
+ if (layer < 1) layer = 1;
+ else if (layer > 255) layer = 255;
+ ee->prop.layer = layer;
+}
+
+static void
+_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
+}
+
+static void
+_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.iconified == iconify) return;
+ ee->prop.iconified = iconify;
+ /* FIXME: Implement this in Wayland someshow */
+}
+
+static void
+_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ee) return;
+ if (ee->prop.maximized == max) return;
+ ee->prop.maximized = max;
+ /* FIXME: Implement this in Wayland someshow */
+}
+
+static void
+_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface);
+}
+
+static int
+_ecore_evas_wl_render(Ecore_Evas *ee)
+{
+ int rend = 0;
+
+ if (!ee) return 0;
+ if (!ee->visible)
+ evas_norender(ee->evas);
+ else
+ {
+ Eina_List *ll = NULL, *updates = NULL;
+ Ecore_Evas *ee2 = NULL;
+
+ if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
+
+ EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
+ {
+ if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
+ if (ee2->engine.func->fn_render)
+ rend |= ee2->engine.func->fn_render(ee2);
+ if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
+ }
+
+ if ((updates = evas_render_updates(ee->evas)))
+ {
+ Eina_List *l = NULL;
+ Eina_Rectangle *r;
+
+ EINA_LIST_FOREACH(updates, l, r)
+ {
+ if (ee->engine.wl.buffer)
+ wl_buffer_damage(ee->engine.wl.buffer,
+ r->x, r->y, r->w, r->h);
+
+ if (ee->engine.wl.surface)
+ wl_surface_damage(ee->engine.wl.surface,
+ r->x, r->y, r->w, r->h);
+ }
+
+ evas_render_updates_free(updates);
+ _ecore_evas_idle_timeout_update(ee);
+ rend = 1;
+
+ ecore_wl_flush();
+ }
+
+ if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
+ }
+
+ return rend;
+}
+
+static void
+_ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (x) *x = 0;
+ if (y) *y = 0;
+ ecore_wl_screen_size_get(w, h);
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Button *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ _ecore_evas_wl_btn_timestamp = ev->timestamp;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers,
+ ev->timestamp, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Button *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers,
+ ev->timestamp, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Move *ev;
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ ee->mouse.x = ev->x;
+ ee->mouse.y = ev->y;
+ evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Event_Mouse_Wheel *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z,
+ ev->timestamp, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Mouse_In *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ 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->time, NULL);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Mouse_Out *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
+ _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time);
+ evas_event_feed_mouse_out(ee->evas, ev->time, NULL);
+ if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+ if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Focus_In *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ ee->prop.focused = 1;
+ evas_focus_in(ee->evas);
+ if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Evas *ee;
+ Ecore_Wl_Event_Focus_Out *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ ev = event;
+ ee = ecore_event_window_match(ev->window);
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
+ if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ evas_focus_out(ee->evas);
+ ee->prop.focused = 0;
+ if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height)
+{
+ Ecore_Evas *ee;
+
+ /* NB: Trap to prevent compositor from crashing */
+ if ((width <= 0) || (height <= 0)) return;
+
+ if (!(ee = data)) return;
+
+ if ((shell_surface) && (ee->engine.wl.shell_surface))
+ {
+ if (ee->engine.wl.shell_surface != shell_surface) return;
+ ecore_evas_resize(ee, width, height);
+ }
+}
+
+static void
+_ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__)
+{
+
+}
+
+static void
+_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest)
+{
+ static unsigned int format;
+ char tmp[PATH_MAX];
+ int fd = -1, stride = 0, size = 0;
+ void *ret;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (dest) *dest = NULL;
+
+ if (!format) format = ecore_wl_format_get();
+
+ strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX");
+ if ((fd = mkstemp(tmp)) < 0)
+ {
+ ERR("Could not create temporary file.");
+ return;
+ }
+
+ stride = (ee->w * sizeof(int));
+ size = (stride * ee->h);
+ if (ftruncate(fd, size) < 0)
+ {
+ ERR("Could not truncate temporary file.");
+ close(fd);
+ return;
+ }
+
+ ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
+ unlink(tmp);
+
+ if (ret == MAP_FAILED)
+ {
+ ERR("mmap of temporary file failed.");
+ close(fd);
+ return;
+ }
+
+ if (dest) *dest = ret;
+
+ ee->engine.wl.buffer =
+ wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format);
+
+ close(fd);
+}
+
+static void
+_ecore_evas_wl_smart_init(void)
+{
+ if (_ecore_evas_wl_smart) return;
+ {
+ static const Evas_Smart_Class sc =
+ {
+ "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION,
+ _ecore_evas_wl_smart_add,
+ _ecore_evas_wl_smart_del,
+ NULL,
+ _ecore_evas_wl_smart_resize,
+ _ecore_evas_wl_smart_show,
+ _ecore_evas_wl_smart_hide,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ };
+ _ecore_evas_wl_smart = evas_smart_class_new(&sc);
+ }
+}
+
+static void
+_ecore_evas_wl_smart_add(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+ Evas *evas;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return;
+
+ evas = evas_object_evas_get(obj);
+
+ sd->x = 0;
+ sd->y = 0;
+ sd->w = 1;
+ sd->h = 1;
+
+ sd->frame = evas_object_rectangle_add(evas);
+ evas_object_is_frame_object_set(sd->frame, EINA_TRUE);
+ evas_object_color_set(sd->frame, 249, 249, 249, 255);
+ evas_object_smart_member_add(sd->frame, obj);
+
+ sd->text = evas_object_text_add(evas);
+ evas_object_color_set(sd->text, 0, 0, 0, 255);
+ evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN);
+ evas_object_text_font_set(sd->text, "Sans", 10);
+ evas_object_text_text_set(sd->text, "Smart Test");
+
+ evas_object_smart_data_set(obj, sd);
+}
+
+static void
+_ecore_evas_wl_smart_del(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ evas_object_del(sd->text);
+ evas_object_del(sd->frame);
+ free(sd);
+}
+
+static void
+_ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ if ((sd->w == w) && (sd->h == h)) return;
+ sd->w = w;
+ sd->h = h;
+ evas_object_resize(sd->frame, w, h);
+}
+
+static void
+_ecore_evas_wl_smart_show(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ evas_object_show(sd->frame);
+ evas_object_show(sd->text);
+}
+
+static void
+_ecore_evas_wl_smart_hide(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ evas_object_hide(sd->text);
+ evas_object_hide(sd->frame);
+}
+
+static Evas_Object *
+_ecore_evas_wl_frame_add(Evas *evas)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ _ecore_evas_wl_smart_init();
+ return evas_object_smart_add(evas, _ecore_evas_wl_smart);
+}
+
+void
+_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->engine.wl.shell_surface)) return;
+ wl_shell_surface_resize(ee->engine.wl.shell_surface,
+ ecore_wl_input_device_get(),
+ _ecore_evas_wl_btn_timestamp, location);
+}
+
+void
+_ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->engine.wl.surface)) return;
+ if ((!source) || (!drag_ee)) return;
+ ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer);
+}
+
+#else
+EAPI Ecore_Evas *
+ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__)
+{
+ return NULL;
+}
+#endif
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
- evas_event_feed_mouse_in(ee->evas, e->time, NULL);
+ evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL);
evas_focus_in(ee->evas);
- _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+ _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
return 1;
}
/* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
- _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+ _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
- evas_event_feed_mouse_out(ee->evas, e->time, NULL);
+ evas_event_feed_mouse_out(ee->evas, e->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);
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
#include <string.h>
+
+#include <Eina.h>
+#include <Ecore.h>
+
#include "ecore_evas_private.h"
#include "Ecore_Evas.h"
// (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
// return 0;
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
- if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
- ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
- evas_event_feed_mouse_in(ee->evas, e->time, NULL);
- _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+ if (!ee->in)
+ {
+ if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
+ ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
+ evas_event_feed_mouse_in(ee->evas, e->time, NULL);
+ _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+ ee->in = EINA_TRUE;
+ }
return ECORE_CALLBACK_PASS_ON;
}
// (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
// return 0;
/* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
- ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
- _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
- if (e->mode == ECORE_X_EVENT_MODE_GRAB)
- evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
- evas_event_feed_mouse_out(ee->evas, e->time, NULL);
- if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
- if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+// printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n",
+// ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas));
+ if (ee->in)
+ {
+ if ((evas_event_down_count_get(ee->evas) > 0) &&
+ (!((e->mode == ECORE_X_EVENT_MODE_GRAB) &&
+ (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR))))
+ return ECORE_CALLBACK_PASS_ON;
+ ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
+ _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+ if (e->mode == ECORE_X_EVENT_MODE_GRAB)
+ evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
+ evas_event_feed_mouse_out(ee->evas, e->time, NULL);
+ if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+ if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+ ee->in = EINA_FALSE;
+ }
return ECORE_CALLBACK_PASS_ON;
}
ee = ecore_event_window_match(e->win);
if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (ee->in)
+ {
+ evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
+ evas_event_feed_mouse_out(ee->evas, e->time, NULL);
+ if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+ if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+ ee->in = EINA_FALSE;
+ }
if (!ee->visible) return ECORE_CALLBACK_PASS_ON;
// if (!ee->visible) return ECORE_CALLBACK_DONE;
// printf("HIDE EVENT %p\n", ee);
# include <config.h>
#endif
+#include <stdlib.h>
+
#include "Ecore_Fb.h"
#include "ecore_fb_private.h"
#endif
/**
- * @brief Associates an input device with the given @ref Ecore_Evas.
+ * @brief Associates an input device with the given @ref Ecore_Evas_Group.
*
- * @param dev The input being associated with an @ref Ecore_Evas (not @c NULL).
+ * @param dev The input being associated with an @ref Ecore_Evas_Group (not @c NULL).
* @param window The window which this input is being associated to.
* @c NULL will remove any previous association.
*
* @endcode
*
* On the previous code, all input captured on the mentioned device will be
- * delivered to the @Ecore_Evas @c ee.
+ * delivered to the @c Ecore_Evas @c ee.
*
* @since 1.1
*/
#include "Ecore_Input.h"
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <errno.h>
+#include <Ecore_Fb.h>
+
/* ecore_fb_li.c */
struct _Ecore_Fb_Input_Device
{
# include <config.h>
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
dir, ecore_file_file_get(dst));
free(dir);
fd = mkstemp(buf);
- if (fd < 0)
- {
- perror("mkstemp");
- goto FAIL;
- }
+ if (fd < 0) goto FAIL;
close(fd);
// Copy to temp file
}
/**
- * @bbrief Check if the given file can be executed.
+ * @brief Check if the given file can be executed.
*
* @param file The name of the file.
* @return EINA_TRUE if the file can be executed, EINA_FALSE otherwise.
p = (char *)app;
restart:
- while ((*p) && (isspace(*p))) p++;
+ while ((*p) && (isspace((unsigned char)*p))) p++;
exe1 = p;
while (*p)
{
in_quot_sing = 1;
else if (*p == '\"')
in_quot_dbl = 1;
- if ((isspace(*p)) && (!((p > app) && (p[-1] != '\\'))))
+ if ((isspace((unsigned char)*p)) && ((p <= app) || (p[-1] == '\\')))
break;
}
p++;
in_quot_sing = 1;
else if (*p == '\"')
in_quot_dbl = 1;
- else if (isspace(*p))
+ else if (isspace((unsigned char)*p))
{
if (restart)
goto restart;
}
/**
- * @bried Remove the extension from the given file name.
+ * @brief Remove the extension from the given file name.
*
* @param path The name of the file.
* @return A newly allocated string with the extension stripped out or
# include <config.h>
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef BUILD_ECORE_CON
#define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8
+#define ECORE_FILE_DOWNLOAD_TIMEOUT 30
struct _Ecore_File_Download_Job
{
}
if (headers) eina_hash_foreach(headers, _ecore_file_download_headers_foreach_cb, job);
+ ecore_con_url_timeout_set(job->url_con, ECORE_FILE_DOWNLOAD_TIMEOUT);
ecore_con_url_fd_set(job->url_con, fileno(job->file));
ecore_con_url_data_set(job->url_con, data);
# include <config.h>
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
# include <config.h>
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void *alloca (size_t);
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/**
* @brief Check if the given directory is in PATH.
*
- * @param The name of the directory to search in PATH.
+ * @param in_dir The name of the directory to search in PATH.
* @return EINA_TRUE if the directory exist in PATH, EINA_FALSE otherwise.
*
* This function checks if @p in_dir is in the environment variable
#define _ECORE_IMF_H
#include <Eina.h>
-#include <Ecore_IMF_Input_Panel_Key.h>
#ifdef EAPI
# undef EAPI
ECORE_IMF_INPUT_PANEL_MODE_EVENT, /**< Input Panel MODE Event */
ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, /**< Input Panel LANGUAGE Event */
ECORE_IMF_INPUT_PANEL_SHIFT_MODE_EVENT, /**< Input Panel SHIFT MODE */
- ECORE_IMF_INPUT_PANEL_PREEDIT_MODE_EVENT, /**< Input Panel PREEDIT MODE */
- ECORE_IMF_INPUT_PANEL_COMPLETION_MODE_EVENT, /**< Input Panel COMPLETION MODE */
- ECORE_IMF_INPUT_PANEL_CUSTOM_INPUT_MODE_EVENT, /**< Input Panel CUSTOM INPUT MODE */
- ECORE_IMF_INPUT_PANEL_EVENT_INVALID
+ ECORE_IMF_INPUT_PANEL_PREDICTION_MODE_EVENT /**< Input Panel PREDICTION MODE */
} Ecore_IMF_Input_Panel_Event;
typedef enum
{
- ECORE_IMF_INPUT_PANEL_STATE_SHOW, /**< Show Input panel */
- ECORE_IMF_INPUT_PANEL_STATE_HIDE, /**< Hide Input panel */
- ECORE_IMF_INPUT_PANEL_STATE_INVALID
+ ECORE_IMF_INPUT_PANEL_STATE_SHOW, /**< Notification after the display of the input panel */
+ ECORE_IMF_INPUT_PANEL_STATE_HIDE, /**< Notification prior to the dismissal of the input panel */
+ ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW /**< Notification prior to the display of the input panel */
} Ecore_IMF_Input_Panel_State;
-typedef enum
-{
- ECORE_IMF_INPUT_PANEL_ORIENT_NONE,
- ECORE_IMF_INPUT_PANEL_ORIENT_90_CW, /* Clockwise */
- ECORE_IMF_INPUT_PANEL_ORIENT_180,
- ECORE_IMF_INPUT_PANEL_ORIENT_90_CCW /* CounterClockwise */
-} Ecore_IMF_Input_Panel_Orient;
-
-typedef struct
-{
- int layout_idx;
- int key_idx;
- Eina_Bool disabled;
-} Disable_Key_Item;
-
-typedef struct
-{
- int layout_idx;
- int key_idx;
- int type;
- char data[128]; // label or image path
- int key_value;
- char key_string[32];
-} Private_Key_Item;
-
/* Events sent by the Input Method */
typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start;
typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End;
EAPI extern int ECORE_IMF_EVENT_COMMIT;
EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING;
+typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info);
+
+typedef enum
+{
+ ECORE_IMF_CALLBACK_PREEDIT_START,
+ ECORE_IMF_CALLBACK_PREEDIT_END,
+ ECORE_IMF_CALLBACK_PREEDIT_CHANGED,
+ ECORE_IMF_CALLBACK_COMMIT,
+ ECORE_IMF_CALLBACK_DELETE_SURROUNDING
+} Ecore_IMF_Callback_Type;
+
typedef enum
{
ECORE_IMF_EVENT_MOUSE_DOWN,
ECORE_IMF_INPUT_PANEL_LAYOUT_IP, /**< IP layout */
ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */
ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */
- ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID
+ ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this */
+ ECORE_IMF_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */
} Ecore_IMF_Input_Panel_Layout;
typedef enum
{
- ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */
- ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */
+ ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet @since 1.2 */
} Ecore_IMF_Input_Panel_Lang;
+typedef enum
+{
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, /**< Default @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE, /**< Done @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO, /**< Go @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, /**< Join @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, /**< Login @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, /**< Next @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, /**< Search or magnifier icon @since 1.2 */
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND /**< Send @since 1.2 */
+} Ecore_IMF_Input_Panel_Return_Key_Type;
+
struct _Ecore_IMF_Event_Preedit_Start
{
Ecore_IMF_Context *ctx;
void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
-
- void (*input_panel_imdata_set) (Ecore_IMF_Context *ctx, const char* data, int len);
- void (*input_panel_imdata_get) (Ecore_IMF_Context *ctx, char* data, int *len);
-
- void (*input_panel_use_effect_set) (Ecore_IMF_Context *ctx, Eina_Bool use_effect);
- void (*input_panel_orient_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Orient orientation);
-
- void (*input_panel_move) (Ecore_IMF_Context *ctx, int x, int y);
- void (*input_panel_geometry_get) (Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h);
- void (*input_panel_private_key_set) (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char *img_path, const char* label, const char* value);
- void (*input_panel_key_disabled_set) (Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled);
-
- void (*input_panel_reset) (Ecore_IMF_Context *ctx); /* Same as reset to default property*/
+ void (*input_panel_imdata_set)(Ecore_IMF_Context *ctx, const void* data, int len);
+ void (*input_panel_imdata_get)(Ecore_IMF_Context *ctx, void* data, int *len);
+ void (*input_panel_return_key_type_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type);
+ void (*input_panel_return_key_disabled_set) (Ecore_IMF_Context *ctx, Eina_Bool disabled);
+ void (*input_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h);
Ecore_IMF_Input_Panel_State (*input_panel_state_get) (Ecore_IMF_Context *ctx);
-
- /* CallBack APIs */
- void (*input_panel_event_callback_add) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*pEventCallBackFunc) (void *data, Ecore_IMF_Context *ctx, int value), void *data);
- void (*input_panel_event_callback_del) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*pEventCallbackFunc) (void *data, Ecore_IMF_Context *ctx, int value));
+ void (*input_panel_event_callback_add) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value), void *data);
+ void (*input_panel_event_callback_del) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value));
};
struct _Ecore_IMF_Context_Info
EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str);
EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars);
+EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data);
+EAPI void *ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func);
+EAPI void ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info);
EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction);
EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable);
EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx);
-EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const char *data, int len);
-EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, char *data, int *len);
+EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len);
+EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len);
+EAPI void ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type actiontype);
+EAPI Ecore_IMF_Input_Panel_Return_Key_Type ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx);
+EAPI void ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled);
+EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h);
-EAPI void ecore_imf_context_input_panel_private_key_set(Ecore_IMF_Context *ctx, int layout_index, int key_index, const char *img_path, const char* label, int key_value, const char* key_string);
-EAPI Eina_List *ecore_imf_context_input_panel_private_key_list_get(Ecore_IMF_Context *ctx);
EAPI Ecore_IMF_Input_Panel_State ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx);
EAPI void ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value), const void *data);
EAPI void ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value));
-EAPI void ecore_imf_context_input_panel_key_disabled_set(Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled);
-EAPI Eina_List *ecore_imf_context_input_panel_key_disabled_list_get(Ecore_IMF_Context *ctx);
-EAPI void ecore_imf_context_input_panel_move(Ecore_IMF_Context *ctx, int x, int y);
+
+EINA_DEPRECATED EAPI void ecore_imf_context_input_panel_private_key_set(Ecore_IMF_Context *ctx, int layout_index, int key_index, const char *img_path, const char* label, int key_value, const char* key_string);
+EINA_DEPRECATED EAPI Eina_List *ecore_imf_context_input_panel_private_key_list_get(Ecore_IMF_Context *ctx);
+EINA_DEPRECATED EAPI void ecore_imf_context_input_panel_key_disabled_set(Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled);
+EINA_DEPRECATED EAPI Eina_List *ecore_imf_context_input_panel_key_disabled_list_get(Ecore_IMF_Context *ctx);
+EINA_DEPRECATED EAPI void ecore_imf_context_input_panel_move(Ecore_IMF_Context *ctx, int x, int y);
/* The following entry points must be exported by each input method module
*/
AM_CFLAGS = @WIN32_CFLAGS@
lib_LTLIBRARIES = libecore_imf.la
-includes_HEADERS = Ecore_IMF.h Ecore_IMF_Input_Panel_Key.h
+includes_HEADERS = Ecore_IMF.h
includesdir = $(includedir)/ecore-@VMAJ@
libecore_imf_la_SOURCES = \
EAPI void
ecore_imf_context_del(Ecore_IMF_Context *ctx)
{
- void *data;
+ Ecore_IMF_Func_Node *fn;
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
return;
}
if (ctx->klass->del) ctx->klass->del(ctx);
- ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE);
-
- EINA_LIST_FREE(ctx->private_key_list, data)
- free(data);
- EINA_LIST_FREE(ctx->disabled_key_list, data)
- free(data);
-
- ctx->private_key_list = NULL;
- ctx->disabled_key_list = NULL;
+ if (ctx->callbacks)
+ {
+ EINA_LIST_FREE(ctx->callbacks, fn)
+ free(fn);
+ }
+ ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE);
free(ctx);
}
/**
* Notify the Input Method Context that a change in the cursor
* location has been made. The location is relative to the canvas.
+ * The cursor location can be used to determine the position of
+ * candidate word window in the immodule.
*
* @param ctx An #Ecore_IMF_Context.
* @param x cursor x position.
/**
* Set whether the IM context should use the preedit string
- * to display feedback. If @use_preedit is EINA_FALSE (default
+ * to display feedback. If @c use_preedit is EINA_FALSE (default
* is EINA_TRUE), then the IM context may use some other method to display
* feedback, such as displaying it in a child of the root window.
*
/**
* Set whether the IM context should allow to use the text prediction.
- * If @prediction is EINA_FALSE (default is EINA_TRUE), then the IM context will not display the text prediction window.
+ * If @c prediction is EINA_FALSE (default is EINA_TRUE), then the IM context will not display the text prediction window.
*
* @param ctx An #Ecore_IMF_Context.
* @param prediction Whether the IM context should allow to use the text prediction.
ctx->data = NULL;
ctx->retrieve_surrounding_func = NULL;
ctx->retrieve_surrounding_data = NULL;
- ctx->input_panel_x = 0;
- ctx->input_panel_y = 0;
- ctx->input_panel_layout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
- ctx->callbacks = NULL;
-
return ctx;
}
}
/**
+ * Add (register) a callback function to a given context event.
+ *
+ * This function adds a function callback to the context @p ctx when the
+ * event of type @p type occurs on it. The function pointer is @p
+ * func.
+ *
+ * The event type @p type to trigger the function may be one of
+ * #ECORE_IMF_CALLBACK_PREEDIT_START, #ECORE_IMF_CALLBACK_PREEDIT_END,
+ * #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT and
+ * #ECORE_IMF_CALLBACK_DELETE_SURROUNDING.
+ *
+ * @param ctx Ecore_IMF_Context to attach a callback to.
+ * @param type The type of event that will trigger the callback
+ * @param func The (callback) function to be called when the event is
+ * triggered
+ * @param data The data pointer to be passed to @p func
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI void
+ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data)
+{
+ Ecore_IMF_Func_Node *fn = NULL;
+
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_event_callback_add");
+ return;
+ }
+
+ if (!func) return;
+
+ fn = calloc(1, sizeof (Ecore_IMF_Func_Node));
+ if (!fn) return;
+
+ fn->func = func;
+ fn->data = data;
+ fn->type = type;
+
+ ctx->callbacks = eina_list_append(ctx->callbacks, fn);
+}
+
+/**
+ * Delete (unregister) a callback function registered to a given
+ * context event.
+ *
+ * This function removes a function callback from the context @p ctx when the
+ * event of type @p type occurs on it. The function pointer is @p
+ * func.
+ *
+ * @see ecore_imf_context_event_callback_add() for more details
+ *
+ * @param ctx Ecore_IMF_Context to remove a callback from.
+ * @param type The type of event that was trigerring the callback
+ * @param func The (callback) function that was to be called when the event was triggered
+ * @return the data pointer
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI void *
+ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func)
+{
+ Eina_List *l = NULL;
+ Eina_List *l_next = NULL;
+ Ecore_IMF_Func_Node *fn = NULL;
+
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_event_callback_del");
+ return NULL;
+ }
+
+ if (!func) return NULL;
+ if (!ctx->callbacks) return NULL;
+
+ EINA_LIST_FOREACH_SAFE(ctx->callbacks, l, l_next, fn)
+ {
+ if ((fn) && (fn->func == func) && (fn->type == type))
+ {
+ void *tmp = (void *)fn->data;
+ free(fn);
+ ctx->callbacks = eina_list_remove_list(ctx->callbacks, l);
+ return tmp;
+ }
+ }
+ return NULL;
+}
+
+/**
+ * Call a given callback on the context @p ctx.
+ *
+ * ecore_imf_context_preedit_start_event_add, ecore_imf_context_preedit_end_event_add,
+ * ecore_imf_context_preedit_changed_event_add, ecore_imf_context_commit_event_add and
+ * ecore_imf_context_delete_surrounding_event_add APIs are asynchronous
+ * because those API adds each event to the event queue.
+ *
+ * This API provides the way to call each callback function immediately.
+ *
+ * @param ctx Ecore_IMF_Context.
+ * @param type The type of event that will trigger the callback
+ * @param event_info The pointer to event specific struct or information to
+ * pass to the callback functions registered on this event
+ * @ingroup Ecore_IMF_Context_Module_Group
+ * @since 1.2.0
+ */
+EAPI void
+ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info)
+{
+ Ecore_IMF_Func_Node *fn = NULL;
+ Eina_List *l = NULL;
+
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_event_callback_call");
+ return;
+ }
+
+ EINA_LIST_FOREACH(ctx->callbacks, l, fn)
+ {
+ if ((fn) && (fn->type == type) && (fn->func))
+ fn->func(fn->data, ctx, event_info);
+ }
+}
+
+/**
* Ask the Input Method Context to show the control panel of using Input Method.
*
* @param ctx An #Ecore_IMF_Context.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx)
+ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
* Ask the Input Method Context to hide the control panel of using Input Method.
*
* @param ctx An #Ecore_IMF_Context.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx)
+ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
* Ask the Input Method Context to show the input panel (virtual keyboard).
*
* @param ctx An #Ecore_IMF_Context.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
* Ask the Input Method Context to hide the input panel.
*
* @param ctx An #Ecore_IMF_Context.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
*
* @param ctx An #Ecore_IMF_Context.
* @param layout see #ECORE_IMF_INPUT_PANEL_LAYOUT
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
+ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
*
* @param ctx An #Ecore_IMF_Context.
* @return layout see #Ecore_IMF_Input_Panel_Layout
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI Ecore_IMF_Input_Panel_Layout
-ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx)
+ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
}
if (ctx->klass->input_panel_layout_get)
- {
- return ctx->input_panel_layout;
- }
+ return ctx->input_panel_layout;
else
return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
}
*
* @param ctx An #Ecore_IMF_Context.
* @param lang the language to be set to the input panel.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
+ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
*
* @param ctx An #Ecore_IMF_Context.
* @return Ecore_IMF_Input_Panel_Lang
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI Ecore_IMF_Input_Panel_Lang
-ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx)
+ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx,
+ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx,
Eina_Bool enabled)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
* @since 1.1.0
*/
EAPI Eina_Bool
-ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx)
+ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
}
/**
- * Set the specific data to pass to the input panel.
+ * Set the input panel-specific data to deliver to the input panel.
* this API is used by applications to deliver specific data to the input panel.
- * the data format MUST be negotiated by both application and the input panel.
+ * the data format MUST be negotiated by both application and the input panel.
+ * The size and format of data are defined by the input panel.
*
* @param ctx An #Ecore_IMF_Context.
* @param data The specific data to be set to the input panel.
- * @param len the length of data
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @param len the length of data, in bytes, to send to the input panel
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
*/
EAPI void
-ecore_imf_context_input_panel_imdata_set (Ecore_IMF_Context *ctx, const char *data, int len)
+ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
return;
}
- if ((!data) || (len <=0)) return;
+ if (!data) return;
if (ctx->klass->input_panel_imdata_set)
ctx->klass->input_panel_imdata_set(ctx, data, len);
* @param ctx An #Ecore_IMF_Context.
* @param data The specific data to be got from the input panel
* @param len The length of data
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
*/
EAPI void
-ecore_imf_context_input_panel_imdata_get (Ecore_IMF_Context *ctx, char *data, int *len)
+ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
}
/**
+ * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel.
+ *
+ * An input panel displays the string or icon associated with this type
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @param return_key_type The type of "return" key on the input panel
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI void
+ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type)
+{
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_input_panel_return_key_type_set");
+ return;
+ }
+
+ ctx->input_panel_return_key_type = return_key_type;
+ if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type);
+}
+
+/**
+ * Get the "return" key type.
+ *
+ * @see ecore_imf_context_input_panel_return_key_type_set() for more details
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @return The type of "return" key on the input panel
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI Ecore_IMF_Input_Panel_Return_Key_Type
+ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx)
+{
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_input_panel_return_key_type_get");
+ return EINA_FALSE;
+ }
+
+ return ctx->input_panel_return_key_type;
+}
+
+/**
+ * Set the return key on the input panel to be disabled.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @param disabled The state
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI void
+ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled)
+{
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_input_panel_return_key_disabled_set");
+ return;
+ }
+
+ ctx->input_panel_return_key_disabled = disabled;
+ if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled);
+}
+
+/**
+ * Get whether the return key on the input panel should be disabled or not.
+ *
+ * @param ctx An #Ecore_IMF_Context.
+ * @return EINA_TRUE if it should be disabled
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
+ */
+EAPI Eina_Bool
+ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx)
+{
+ if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
+ {
+ ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
+ "ecore_imf_context_input_panel_return_key_disabled_get");
+ return EINA_FALSE;
+ }
+
+ return ctx->input_panel_return_key_disabled;
+}
+
+/**
* Get the position of the current active input panel.
*
* @param ctx An #Ecore_IMF_Context.
* @param y top-left y co-ordinate of the input panel
* @param w width of the input panel
* @param h height of the input panel
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
*/
EAPI void
-ecore_imf_context_input_panel_geometry_get (Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h)
+ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
* @param key_index index of key to be set
* @param label text label to be appeared on private key
* @param value value of key, If NULL it will use original value of key
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @ingroup Ecore_IMF_Context_Group
*/
-EAPI void
-ecore_imf_context_input_panel_private_key_set (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char *img_path, const char *label, int key_value, const char *key_string)
+EINA_DEPRECATED EAPI void
+ecore_imf_context_input_panel_private_key_set(Ecore_IMF_Context *ctx, int layout_index, int key_index, const char *img_path, const char *label, int key_value, const char *key_string)
{
- Private_Key_Item *key_item;
- Eina_List *l;
- Eina_Bool exist = EINA_FALSE;
-
- if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
- {
- ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
- "ecore_imf_context_input_panel_private_key_set");
- return;
- }
-
- if ((!label) && (!img_path)) return;
-
- EINA_LIST_FOREACH(ctx->private_key_list, l, key_item)
- {
- if (key_item && (key_item->layout_idx == layout_index) &&
- (key_item->key_idx == key_index))
- {
- // if exist in the list
- exist = EINA_TRUE;
- if (label)
- {
- key_item->type = 0;
- strcpy(key_item->data, label);
- }
- else
- {
- key_item->type = 1;
- strcpy(key_item->data, img_path);
- }
- key_item->key_value = key_value;
- strcpy(key_item->key_string, key_string);
- }
- }
-
- if (!exist)
- {
- key_item = calloc(1, sizeof(Private_Key_Item));
- if (!key_item) return;
-
- key_item->layout_idx = layout_index;
- key_item->key_idx = key_index;;
- if (label)
- {
- key_item->type = 0;
- strcpy(key_item->data, label);
- }
- else
- {
- key_item->type = 1;
- strcpy(key_item->data, img_path);
- }
- key_item->key_value = key_value;
-
- if (key_string)
- strcpy(key_item->key_string, key_string);
-
- ctx->private_key_list = eina_list_append(ctx->private_key_list, key_item);
- }
-
-// if (ctx->klass->input_panel_private_key_set) ctx->klass->input_panel_private_key_set(ctx, layout_index, key_index, img_path, label, value);
+ // will be deleted
}
/**
*
* @param ctx An #Ecore_IMF_Context.
* @return Return the list of private key
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @ingroup Ecore_IMF_Context_Group
*/
-EAPI Eina_List *
-ecore_imf_context_input_panel_private_key_list_get (Ecore_IMF_Context *ctx)
+EINA_DEPRECATED EAPI Eina_List *
+ecore_imf_context_input_panel_private_key_list_get(Ecore_IMF_Context *ctx)
{
- if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
- {
- ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
- "ecore_imf_context_input_panel_private_key_list_get");
- return NULL;
- }
-
- return ctx->private_key_list;
+ // will be deleted
+ return NULL;
}
/**
* @param layout_index index of layout page to be set
* @param key_index index of key to be set
* @param disabled The state
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @ingroup Ecore_IMF_Context_Group
*/
-EAPI void
-ecore_imf_context_input_panel_key_disabled_set (Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled)
+EINA_DEPRECATED EAPI void
+ecore_imf_context_input_panel_key_disabled_set(Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled)
{
- Disable_Key_Item *key_item;
- Eina_List *l;
- Eina_Bool exist = EINA_FALSE;
-
- if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
- {
- ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
- "ecore_imf_context_input_panel_key_disabled_set");
- return;
- }
-
- EINA_LIST_FOREACH(ctx->disabled_key_list, l, key_item)
- {
- if (key_item && (key_item->layout_idx == layout_index) &&
- (key_item->key_idx == key_index))
- {
- key_item->disabled = disabled;
- exist = EINA_TRUE;
- }
- }
-
- if (!exist)
- {
- key_item = calloc(1, sizeof(Disable_Key_Item));
- if (!key_item) return;
-
- key_item->layout_idx = layout_index;
- key_item->key_idx = key_index;;
- key_item->disabled = disabled;
-
- ctx->disabled_key_list = eina_list_append(ctx->disabled_key_list, key_item);
- }
-
-// if (ctx->klass->input_panel_key_disabled_set) ctx->klass->input_panel_key_disabled_set(ctx, layout_index, key_index, disabled);
+ // will be deleted
}
/**
*
* @param ctx An #Ecore_IMF_Context.
* @return Return the list of private key
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
-EAPI Eina_List *
-ecore_imf_context_input_panel_key_disabled_list_get (Ecore_IMF_Context *ctx)
+EINA_DEPRECATED EAPI Eina_List *
+ecore_imf_context_input_panel_key_disabled_list_get(Ecore_IMF_Context *ctx)
{
- return ctx->disabled_key_list;
+ // will be deleted
+ return NULL;
}
/**
*
* @param ctx An #Ecore_IMF_Context.
* @param The state of input panel.
- * @ingroup Ecore_IMF_Context_IMControl_Group
- * @since 1.1.0
+ * @ingroup Ecore_IMF_Context_Group
+ * @since 1.2.0
*/
EAPI Ecore_IMF_Input_Panel_State
-ecore_imf_context_input_panel_state_get (Ecore_IMF_Context *ctx)
+ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx)
{
- Ecore_IMF_Input_Panel_State state = ECORE_IMF_INPUT_PANEL_STATE_INVALID;
+ Ecore_IMF_Input_Panel_State state = ECORE_IMF_INPUT_PANEL_STATE_HIDE;
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
"ecore_imf_context_input_panel_state_get");
- return ECORE_IMF_INPUT_PANEL_STATE_INVALID;
+ return ECORE_IMF_INPUT_PANEL_STATE_HIDE;
}
if (ctx->klass->input_panel_state_get)
* @param type event type
* @param func the callback function
* @param data application-input panel specific data.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_input_panel_event_callback_add (Ecore_IMF_Context *ctx,
- Ecore_IMF_Input_Panel_Event type,
- void (*func) (void *data, Ecore_IMF_Context *ctx, int value),
- const void *data)
+ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx,
+ Ecore_IMF_Input_Panel_Event type,
+ void (*func) (void *data, Ecore_IMF_Context *ctx, int value),
+ const void *data)
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
}
if (ctx->klass->input_panel_event_callback_add)
- ctx->klass->input_panel_event_callback_add(ctx, type, func, data);
+ ctx->klass->input_panel_event_callback_add(ctx, type, func, (void *)data);
}
/**
* @param ctx An #Ecore_IMF_Context.
* @param func the callback function
* @param data application-input panel specific data.
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
EAPI void
-ecore_imf_context_input_panel_event_callback_del (Ecore_IMF_Context *ctx,
- Ecore_IMF_Input_Panel_Event type,
- void (*func) (void *data, Ecore_IMF_Context *ctx, int value))
+ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx,
+ Ecore_IMF_Input_Panel_Event type,
+ void (*func) (void *data, Ecore_IMF_Context *ctx, int value))
{
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
{
* @param ctx An #Ecore_IMF_Context.
* @param x X position to move the input panel to
* @param y Y position to move the input panel to
- * @ingroup Ecore_IMF_Context_IMControl_Group
+ * @ingroup Ecore_IMF_Context_Group
* @since 1.1.0
*/
-EAPI void
-ecore_imf_context_input_panel_move (Ecore_IMF_Context *ctx, int x, int y)
+EINA_DEPRECATED EAPI void
+ecore_imf_context_input_panel_move(Ecore_IMF_Context *ctx __UNUSED__, int x __UNUSED__, int y __UNUSED__)
{
- if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
- {
- ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
- "ecore_imf_context_input_panel_move");
- return;
- }
-
- if (ctx->klass->input_panel_move) ctx->klass->input_panel_move(ctx, x, y);
- ctx->input_panel_x = x;
- ctx->input_panel_y = y;
+ // will be deprecated
}
-
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_imf_log_dom, __VA_ARGS__)
typedef struct _Ecore_IMF_Module Ecore_IMF_Module;
+typedef struct _Ecore_IMF_Func_Node Ecore_IMF_Func_Node;
struct _Ecore_IMF_Context
{
int input_mode;
void *window;
void *client_canvas;
- int input_panel_x;
- int input_panel_y;
Eina_Bool (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
void *retrieve_surrounding_data;
+ Eina_List *callbacks;
Ecore_IMF_Autocapital_Type autocapital_type;
Ecore_IMF_Input_Panel_Layout input_panel_layout;
Ecore_IMF_Input_Panel_Lang input_panel_lang;
- Eina_List *callbacks;
- Eina_List *disabled_key_list;
- Eina_List *private_key_list;
+ Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
Eina_Bool allow_prediction : 1;
Eina_Bool input_panel_enabled : 1;
+ Eina_Bool input_panel_return_key_disabled : 1;
};
struct _Ecore_IMF_Module
Ecore_IMF_Context *(*exit)(void);
};
+struct _Ecore_IMF_Func_Node
+{
+ void (*func) ();
+ const void *data;
+ Ecore_IMF_Callback_Type type;
+};
+
void ecore_imf_module_init(void);
void ecore_imf_module_shutdown(void);
Eina_List *ecore_imf_module_available_get(void);
#endif
#include <string.h>
+#include <stdlib.h>
#include "Ecore.h"
#include "Ecore_Input.h"
if (--_ecore_ipc_init_count != 0)
return _ecore_ipc_init_count;
- while (servers) ecore_ipc_server_del(eina_list_data_get(servers));
+ Eina_List *l, *l2;
+ Ecore_Ipc_Server *svr;
+ EINA_LIST_FOREACH_SAFE(servers, l, l2, svr)
+ ecore_ipc_server_del(svr);
for (i = 0; i < 6; i++)
ecore_event_handler_del(handler[i]);
/**
* Sets the max data payload size for an Ipc message in bytes
*
- * @param client The given client.
+ * @param cl The given client.
* @param size The maximum data payload size in bytes.
* @ingroup Ecore_Ipc_Client_Group
*/
* Sets the max data payload size for an Ipc message in bytes
*
* @param cl The given client.
- * @param size The maximum data payload size in bytes.
* @ingroup Ecore_Ipc_Client_Group
*/
EAPI int
EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS;
EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS;
EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE;
+EAPI extern int ECORE_PSL1GHT_EVENT_QUIT;
typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers;
struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */
unsigned int time;
};
-EAPI int
- ecore_psl1ght_init(const char *name);
-EAPI int
- ecore_psl1ght_shutdown(void);
-EAPI void
- ecore_psl1ght_resolution_set(int width, int height);
-EAPI void
- ecore_psl1ght_poll_events(void);
+EAPI int ecore_psl1ght_init(const char *name);
+EAPI int ecore_psl1ght_shutdown(void);
+EAPI void ecore_psl1ght_resolution_set(int width, int height);
+EAPI void ecore_psl1ght_poll_events(void);
EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h);
EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h);
EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0;
EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0;
+EAPI int ECORE_PSL1GHT_EVENT_QUIT = 0;
static int _ecore_psl1ght_init_count = 0;
static int window_width = 0;
static u16 keyboard_old_key = 0;
/* Pad support */
static padData pad_data;
+static padData old_pad_data = {0};
static int pad_old_x = 0;
static int pad_old_o = 0;
/* Move support */
ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new();
+ ECORE_PSL1GHT_EVENT_QUIT = ecore_event_type_new();
mouse_x = 0;
mouse_y = 0;
ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
ECORE_PSL1GHT_EVENT_EXPOSE = 0;
ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
+ ECORE_PSL1GHT_EVENT_QUIT = 0;
ioPadEnd();
ioMouseEnd();
ev->event_window = 0;
ev->modifiers = _ecore_psl1ght_get_modifiers();
- printf ("Key is %X\n", key);
key &= ~KB_KEYPAD;
for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i)
if (keystable[i].code == key)
ev->string = keystable[i].compose;
ev->compose = keystable[i].compose;
- printf ("Found key '%s' in the table\n", ev->keyname);
return ev;
}
utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key);
unicodeToUtf8(utf16, utf8);
- printf ("Converting to utf16 : %X - utf8 : %s\n", utf16, utf8);
ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8);
return ev;
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
}
+static void
+_ecore_psl1ght_pad_button (const char *name, int pressed)
+{
+ Ecore_Event_Key *ev = NULL;
+
+ ev = malloc(sizeof(Ecore_Event_Key));
+ if (!ev) return;
+
+ ev->timestamp = _ecore_psl1ght_get_time ();
+ ev->window = 0;
+ ev->event_window = 0;
+ ev->modifiers = 0;
+
+ ev->keyname = name;
+ ev->key = name;
+ ev->string = "";
+ ev->compose = "";
+
+ if (pressed)
+ ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
+ else
+ ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
+}
+
#define PAD_STICK_DEADZONE 0x20
static void
if (analog_h != 0 || analog_v != 0)
_ecore_psl1ght_mouse_move (analog_h, analog_v);
- if (pad_old_x != pad_data.BTN_CROSS)
+ if (old_pad_data.BTN_CROSS ^ pad_data.BTN_CROSS) {
+ _ecore_psl1ght_pad_button ("Cross", pad_data.BTN_CROSS);
_ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS);
- if (pad_old_o != pad_data.BTN_CIRCLE)
+ }
+ if (old_pad_data.BTN_CIRCLE ^ pad_data.BTN_CIRCLE) {
+ _ecore_psl1ght_pad_button ("Circle", pad_data.BTN_CIRCLE);
_ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE);
-
- pad_old_x = pad_data.BTN_CROSS;
- pad_old_o = pad_data.BTN_CIRCLE;
-
- //pad_buttons = paddata.buttons;
+ }
+ if (old_pad_data.BTN_SQUARE ^ pad_data.BTN_SQUARE)
+ _ecore_psl1ght_pad_button ("Square", pad_data.BTN_SQUARE);
+ if (old_pad_data.BTN_TRIANGLE ^ pad_data.BTN_TRIANGLE)
+ _ecore_psl1ght_pad_button ("Triangle", pad_data.BTN_TRIANGLE);
+ if (old_pad_data.BTN_UP ^ pad_data.BTN_UP)
+ _ecore_psl1ght_pad_button ("Up", pad_data.BTN_UP);
+ if (old_pad_data.BTN_DOWN ^ pad_data.BTN_DOWN)
+ _ecore_psl1ght_pad_button ("Down", pad_data.BTN_DOWN);
+ if (old_pad_data.BTN_LEFT ^ pad_data.BTN_LEFT)
+ _ecore_psl1ght_pad_button ("Left", pad_data.BTN_LEFT);
+ if (old_pad_data.BTN_RIGHT ^ pad_data.BTN_RIGHT)
+ _ecore_psl1ght_pad_button ("Right", pad_data.BTN_RIGHT);
+ if (old_pad_data.BTN_L1 ^ pad_data.BTN_L1)
+ _ecore_psl1ght_pad_button ("L1", pad_data.BTN_L1);
+ if (old_pad_data.BTN_L2 ^ pad_data.BTN_L2)
+ _ecore_psl1ght_pad_button ("L2", pad_data.BTN_L2);
+ if (old_pad_data.BTN_L3 ^ pad_data.BTN_L3)
+ _ecore_psl1ght_pad_button ("L3", pad_data.BTN_L3);
+ if (old_pad_data.BTN_R1 ^ pad_data.BTN_R1)
+ _ecore_psl1ght_pad_button ("R1", pad_data.BTN_R1);
+ if (old_pad_data.BTN_R2 ^ pad_data.BTN_R2)
+ _ecore_psl1ght_pad_button ("R2", pad_data.BTN_R2);
+ if (old_pad_data.BTN_R3 ^ pad_data.BTN_R3)
+ _ecore_psl1ght_pad_button ("R3", pad_data.BTN_R3);
+ if (old_pad_data.BTN_START ^ pad_data.BTN_START)
+ _ecore_psl1ght_pad_button ("Start", pad_data.BTN_START);
+ if (old_pad_data.BTN_SELECT ^ pad_data.BTN_SELECT)
+ _ecore_psl1ght_pad_button ("Select", pad_data.BTN_SELECT);
+
+ old_pad_data = pad_data;
}
}
}
case 4:
// Move button
- printf ("Calibrating\n");
+ //printf ("Calibrating\n");
gemCalibrate (0);
calibrated = 1;
break;
static void
xmb_event_handler(u64 status, u64 param, void *user_data)
{
- printf ("Received event %lX\n", status);
- if (status == SYSUTIL_EXIT_GAME)
- {
- ecore_main_loop_quit();
- }
- else if (status == SYSUTIL_MENU_OPEN)
- {
- }
- else if (status == SYSUTIL_MENU_CLOSE)
- {
- }
- else if (status == SYSUTIL_DRAW_BEGIN)
- {
- }
- else if (status == SYSUTIL_DRAW_END)
- {
- }
+ //printf ("Received event %lX\n", status);
+ switch (status) {
+ case SYSUTIL_EXIT_GAME:
+ ecore_event_add(ECORE_PSL1GHT_EVENT_QUIT, NULL, NULL, NULL);
+ break;
+ case SYSUTIL_DRAW_BEGIN:
+ ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
+ case SYSUTIL_MENU_OPEN:
+ ecore_event_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, NULL, NULL, NULL);
+ break;
+ case SYSUTIL_DRAW_END:
+ ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
+ case SYSUTIL_MENU_CLOSE:
+ ecore_event_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, NULL, NULL, NULL);
+ break;
+ default:
+ break;
+ }
}
EAPI void
--- /dev/null
+#ifndef _ECORE_WAYLAND_H_
+# define _ECORE_WAYLAND_H_
+
+# include <Eina.h>
+# include <wayland-client.h>
+
+# ifdef EAPI
+# undef EAPI
+# endif
+
+# ifdef __GNUC__
+# if __GNUC__ >= 4
+# define EAPI __attribute__ ((visibility("default")))
+# else
+# define EAPI
+# endif
+# else
+# define EAPI
+# endif
+
+typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In;
+typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out;
+typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In;
+typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out;
+
+typedef struct _Ecore_Wl_Drag_Source Ecore_Wl_Drag_Source;
+
+typedef struct _Ecore_Wl_Event_Drag_Start Ecore_Wl_Event_Drag_Start;
+typedef struct _Ecore_Wl_Event_Drag_Stop Ecore_Wl_Event_Drag_Stop;
+
+struct _Ecore_Wl_Event_Mouse_In
+{
+ int modifiers;
+ int x, y;
+
+ struct
+ {
+ int x, y;
+ } root;
+
+ unsigned int window;
+
+ unsigned int time;
+};
+
+struct _Ecore_Wl_Event_Mouse_Out
+{
+ int modifiers;
+ int x, y;
+
+ struct
+ {
+ int x, y;
+ } root;
+
+ unsigned int window;
+
+ unsigned int time;
+};
+
+struct _Ecore_Wl_Event_Focus_In
+{
+ unsigned int window;
+ /* TODO: mode & detail */
+ unsigned int time;
+};
+
+struct _Ecore_Wl_Event_Focus_Out
+{
+ unsigned int window;
+ /* TODO: mode & detail */
+ unsigned int time;
+};
+
+struct _Ecore_Wl_Event_Drag_Start
+{
+ struct wl_data_device *device;
+ struct wl_surface *surface;
+ const char *mime_type;
+ uint32_t timestamp;
+};
+
+struct _Ecore_Wl_Event_Drag_Stop
+{
+
+};
+
+/**
+ * @file
+ * @brief Ecore functions for dealing with the Wayland window system
+ *
+ * Ecore_Wl provides a wrapper and convenience functions for using the
+ * Wayland window system. Function groups for this part of the library
+ * include the following:
+ * @li @ref Ecore_Wl_Init_Group
+ */
+
+EAPI int ecore_wl_init(const char *name);
+EAPI int ecore_wl_shutdown(void);
+
+EAPI struct wl_display *ecore_wl_display_get(void);
+EAPI struct wl_shm *ecore_wl_shm_get(void);
+EAPI struct wl_compositor *ecore_wl_compositor_get(void);
+EAPI struct wl_shell *ecore_wl_shell_get(void);
+EAPI struct wl_input_device *ecore_wl_input_device_get(void);
+EAPI void ecore_wl_screen_size_get(int *w, int *h);
+EAPI unsigned int ecore_wl_format_get(void);
+EAPI void ecore_wl_flush(void);
+EAPI void ecore_wl_sync(void);
+EAPI void ecore_wl_pointer_xy_get(int *x, int *y);
+
+EAPI Ecore_Wl_Drag_Source *ecore_wl_drag_source_create(int hotspot_x, int hotspot_y, int offset_x, int offset_y, const char *mimetype, unsigned int timestamp, void *data);
+EAPI void ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer);
+EAPI void ecore_wl_drag_stop(void);
+
+EAPI extern int ECORE_WL_EVENT_MOUSE_IN;
+EAPI extern int ECORE_WL_EVENT_MOUSE_OUT;
+EAPI extern int ECORE_WL_EVENT_FOCUS_IN;
+EAPI extern int ECORE_WL_EVENT_FOCUS_OUT;
+EAPI extern int ECORE_WL_EVENT_DRAG_START;
+EAPI extern int ECORE_WL_EVENT_DRAG_STOP;
+
+#endif
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+
+AM_CPPFLAGS = \
+-I$(top_srcdir)/src/lib/ecore \
+-I$(top_srcdir)/src/lib/ecore_input \
+-I$(top_builddir)/src/lib/ecore \
+-I$(top_builddir)/src/lib/ecore_input \
+@WAYLAND_CFLAGS@ \
+@EVAS_CFLAGS@ \
+@EINA_CFLAGS@
+
+lib_LTLIBRARIES = libecore_wayland.la
+includes_HEADERS = Ecore_Wayland.h
+includesdir = $(includedir)/ecore-@VMAJ@
+
+libecore_wayland_la_SOURCES = \
+ecore_wl.c
+
+## ecore_wl_window.c
+
+libecore_wayland_la_LIBADD = \
+$(top_builddir)/src/lib/ecore/libecore.la \
+$(top_builddir)/src/lib/ecore_input/libecore_input.la \
+@WAYLAND_LIBS@ \
+@EVAS_LIBS@ \
+@EINA_LIBS@
+
+libecore_wayland_la_LDFLAGS = -version-info @version_info@ @release_info@
+libecore_wayland_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la
+
+EXTRA_DIST = ecore_wl_private.h
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "Ecore.h"
+#include "ecore_private.h"
+#include "Ecore_Input.h"
+#include "ecore_wl_private.h"
+#include "Ecore_Wayland.h"
+
+/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ...
+ * What about other OSs ?? */
+#include <fcntl.h>
+#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 <X11/extensions/XKBcommon.h>
+
+/* local function prototypes */
+static Eina_Bool _ecore_wl_shutdown(Eina_Bool close_display);
+static void _ecore_wl_cb_disp_handle_global(struct wl_display *disp, uint32_t id, const char *interface, uint32_t version __UNUSED__, void *data __UNUSED__);
+static int _ecore_wl_cb_disp_event_mask_update(uint32_t mask, void *data __UNUSED__);
+static void _ecore_wl_cb_disp_handle_geometry(void *data __UNUSED__, struct wl_output *output __UNUSED__, int x, int y, int pw __UNUSED__, int ph __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__);
+static void _ecore_wl_cb_disp_handle_mode(void *data __UNUSED__, struct wl_output *output __UNUSED__, uint32_t flags, int w, int h, int refresh __UNUSED__);
+static Eina_Bool _ecore_wl_cb_fd_handle(void *data, Ecore_Fd_Handler *hdl __UNUSED__);
+static void _ecore_wl_cb_handle_motion(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, int32_t x, int32_t y, int32_t sx, int32_t sy);
+static void _ecore_wl_cb_handle_button(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, uint32_t btn, uint32_t state);
+static void _ecore_wl_cb_handle_key(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, uint32_t key, uint32_t state);
+static void _ecore_wl_cb_handle_pointer_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, struct wl_surface *surface, int32_t x, int32_t y, int32_t sx, int32_t sy);
+static void _ecore_wl_cb_handle_keyboard_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, struct wl_surface *surface, struct wl_array *keys);
+static void _ecore_wl_cb_handle_touch_down(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, struct wl_surface *surface, int32_t id, int32_t x, int32_t y);
+static void _ecore_wl_cb_handle_touch_up(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id);
+static void _ecore_wl_cb_handle_touch_motion(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id, int32_t x, int32_t y);
+static void _ecore_wl_cb_handle_touch_frame(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__);
+static void _ecore_wl_cb_handle_touch_cancel(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__);
+static void _ecore_wl_cb_source_target(void *data, struct wl_data_source *source __UNUSED__, const char *mime_type __UNUSED__);
+static void _ecore_wl_cb_source_send(void *data, struct wl_data_source *source, const char *mime_type, int32_t fd);
+static void _ecore_wl_cb_source_cancelled(void *data, struct wl_data_source *source __UNUSED__);
+static void _ecore_wl_cb_source_offer(void *data, struct wl_data_offer *offer __UNUSED__, const char *type);
+static void _ecore_wl_cb_data_offer(void *data, struct wl_data_device *data_dev, uint32_t id);
+static void _ecore_wl_cb_data_enter(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, struct wl_surface *surface, int32_t x, int32_t y, struct wl_data_offer *offer);
+static void _ecore_wl_cb_data_leave(void *data __UNUSED__, struct wl_data_device *data_dev);
+static void _ecore_wl_cb_data_motion(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, int32_t x, int32_t y);
+static void _ecore_wl_cb_data_drop(void *data __UNUSED__, struct wl_data_device *data_dev);
+static void _ecore_wl_cb_data_selection(void *data, struct wl_data_device *data_dev, struct wl_data_offer *offer);
+
+static void _ecore_wl_mouse_move_send(uint32_t timestamp);
+static void _ecore_wl_mouse_out_send(struct wl_surface *surface, uint32_t timestamp);
+static void _ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp);
+static void _ecore_wl_mouse_up_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp);
+static void _ecore_wl_mouse_down_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp);
+static void _ecore_wl_focus_out_send(struct wl_surface *surface, uint32_t timestamp);
+static void _ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp);
+
+/* local variables */
+static int _ecore_wl_init_count = 0;
+static struct wl_display *_ecore_wl_disp = NULL;
+static uint32_t _ecore_wl_disp_mask = 0;
+static uint32_t _ecore_wl_disp_format = WL_SHM_FORMAT_ARGB8888;
+static Eina_Rectangle _ecore_wl_screen;
+static Ecore_Fd_Handler *_ecore_wl_fd_hdl = NULL;
+static int _ecore_wl_screen_x = 0;
+static int _ecore_wl_screen_y = 0;
+static int _ecore_wl_surface_x = 0;
+static int _ecore_wl_surface_y = 0;
+static int _ecore_wl_touch_x = 0;
+static int _ecore_wl_touch_y = 0;
+static int _ecore_wl_input_modifiers = 0;
+static struct xkb_desc *_ecore_wl_xkb = NULL;
+static uint32_t _ecore_wl_input_button = 0;
+
+static struct wl_compositor *_ecore_wl_comp = NULL;
+static struct wl_shm *_ecore_wl_shm = NULL;
+static struct wl_shell *_ecore_wl_shell = NULL;
+static struct wl_output *_ecore_wl_output = NULL;
+static struct wl_input_device *_ecore_wl_input_dev = NULL;
+static struct wl_surface *_ecore_wl_input_surface = NULL;
+static struct wl_surface *_ecore_wl_touch_surface = NULL;
+static struct wl_data_device_manager *_ecore_wl_data_manager = NULL;
+static struct wl_data_device *_ecore_wl_data_dev = NULL;
+
+static const struct wl_output_listener _ecore_wl_output_listener =
+{
+ _ecore_wl_cb_disp_handle_geometry,
+ _ecore_wl_cb_disp_handle_mode
+};
+static const struct wl_input_device_listener _ecore_wl_input_listener =
+{
+ _ecore_wl_cb_handle_motion,
+ _ecore_wl_cb_handle_button,
+ _ecore_wl_cb_handle_key,
+ _ecore_wl_cb_handle_pointer_focus,
+ _ecore_wl_cb_handle_keyboard_focus,
+ _ecore_wl_cb_handle_touch_down,
+ _ecore_wl_cb_handle_touch_up,
+ _ecore_wl_cb_handle_touch_motion,
+ _ecore_wl_cb_handle_touch_frame,
+ _ecore_wl_cb_handle_touch_cancel,
+};
+static const struct wl_data_source_listener _ecore_wl_source_listener =
+{
+ _ecore_wl_cb_source_target,
+ _ecore_wl_cb_source_send,
+ _ecore_wl_cb_source_cancelled
+};
+static const struct wl_data_device_listener _ecore_wl_data_listener =
+{
+ _ecore_wl_cb_data_offer,
+ _ecore_wl_cb_data_enter,
+ _ecore_wl_cb_data_leave,
+ _ecore_wl_cb_data_motion,
+ _ecore_wl_cb_data_drop,
+ _ecore_wl_cb_data_selection
+};
+static const struct wl_data_offer_listener _ecore_wl_offer_listener =
+{
+ _ecore_wl_cb_source_offer,
+};
+
+/* external variables */
+int _ecore_wl_log_dom = -1;
+EAPI int ECORE_WL_EVENT_MOUSE_IN = 0;
+EAPI int ECORE_WL_EVENT_MOUSE_OUT = 0;
+EAPI int ECORE_WL_EVENT_FOCUS_IN = 0;
+EAPI int ECORE_WL_EVENT_FOCUS_OUT = 0;
+EAPI int ECORE_WL_EVENT_DRAG_START = 0;
+EAPI int ECORE_WL_EVENT_DRAG_STOP = 0;
+
+EAPI int
+ecore_wl_init(const char *name)
+{
+ struct xkb_rule_names xkb_names;
+ int fd = 0;
+
+ if (++_ecore_wl_init_count != 1)
+ return _ecore_wl_init_count;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!eina_init()) return --_ecore_wl_init_count;
+
+ _ecore_wl_log_dom =
+ eina_log_domain_register("ecore_wl", ECORE_WL_DEFAULT_LOG_COLOR);
+ if (_ecore_wl_log_dom < 0)
+ {
+ EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland.");
+ eina_shutdown();
+ return --_ecore_wl_init_count;
+ }
+
+ if (!ecore_init())
+ {
+ eina_log_domain_unregister(_ecore_wl_log_dom);
+ _ecore_wl_log_dom = -1;
+ eina_shutdown();
+ return --_ecore_wl_init_count;
+ }
+
+ if (!ecore_event_init())
+ {
+ eina_log_domain_unregister(_ecore_wl_log_dom);
+ _ecore_wl_log_dom = -1;
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_wl_init_count;
+ }
+
+ if (!ECORE_WL_EVENT_MOUSE_IN)
+ {
+ ECORE_WL_EVENT_MOUSE_IN = ecore_event_type_new();
+ ECORE_WL_EVENT_MOUSE_OUT = ecore_event_type_new();
+ ECORE_WL_EVENT_FOCUS_IN = ecore_event_type_new();
+ ECORE_WL_EVENT_FOCUS_OUT = ecore_event_type_new();
+ ECORE_WL_EVENT_DRAG_START = ecore_event_type_new();
+ ECORE_WL_EVENT_DRAG_STOP = ecore_event_type_new();
+ }
+
+ /* init xkb */
+ /* FIXME: Somehow make this portable to other languages/countries */
+ xkb_names.rules = "evdev";
+ xkb_names.model = "evdev";
+ xkb_names.layout = "us";
+ xkb_names.variant = "";
+ xkb_names.options = "";
+ if (!(_ecore_wl_xkb = xkb_compile_keymap_from_rules(&xkb_names)))
+ {
+ ERR("Could not compile keymap");
+ eina_log_domain_unregister(_ecore_wl_log_dom);
+ _ecore_wl_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_wl_init_count;
+ }
+
+ /* connect to the wayland display */
+ if (!(_ecore_wl_disp = wl_display_connect(name)))
+ {
+ eina_log_domain_unregister(_ecore_wl_log_dom);
+ _ecore_wl_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_wl_init_count;
+ }
+
+ /* setup handler for wayland interfaces */
+ wl_display_add_global_listener(_ecore_wl_disp,
+ _ecore_wl_cb_disp_handle_global, NULL);
+
+ /* process connection events */
+ wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE);
+
+ fd = wl_display_get_fd(_ecore_wl_disp,
+ _ecore_wl_cb_disp_event_mask_update, NULL);
+
+ _ecore_wl_fd_hdl =
+ ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_wl_cb_fd_handle,
+ _ecore_wl_disp, NULL, NULL);
+ if (!_ecore_wl_fd_hdl)
+ {
+ wl_display_destroy(_ecore_wl_disp);
+ _ecore_wl_disp = NULL;
+ eina_log_domain_unregister(_ecore_wl_log_dom);
+ _ecore_wl_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_wl_init_count;
+ }
+
+ return _ecore_wl_init_count;
+}
+
+EAPI int
+ecore_wl_shutdown(void)
+{
+ return _ecore_wl_shutdown(EINA_TRUE);
+}
+
+EAPI struct wl_display *
+ecore_wl_display_get(void)
+{
+ return _ecore_wl_disp;
+}
+
+EAPI struct wl_shm *
+ecore_wl_shm_get(void)
+{
+ return _ecore_wl_shm;
+}
+
+EAPI struct wl_compositor *
+ecore_wl_compositor_get(void)
+{
+ return _ecore_wl_comp;
+}
+
+EAPI struct wl_shell *
+ecore_wl_shell_get(void)
+{
+ return _ecore_wl_shell;
+}
+
+EAPI struct wl_input_device *
+ecore_wl_input_device_get(void)
+{
+ return _ecore_wl_input_dev;
+}
+
+EAPI void
+ecore_wl_screen_size_get(int *w, int *h)
+{
+ if (w) *w = _ecore_wl_screen.w;
+ if (h) *h = _ecore_wl_screen.h;
+}
+
+EAPI unsigned int
+ecore_wl_format_get(void)
+{
+ return _ecore_wl_disp_format;
+}
+
+EAPI void
+ecore_wl_flush(void)
+{
+ wl_display_flush(_ecore_wl_disp);
+}
+
+EAPI void
+ecore_wl_sync(void)
+{
+ wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE);
+}
+
+EAPI void
+ecore_wl_pointer_xy_get(int *x, int *y)
+{
+ if (x) *x = _ecore_wl_screen_x;
+ if (y) *y = _ecore_wl_screen_y;
+}
+
+EAPI Ecore_Wl_Drag_Source *
+ecore_wl_drag_source_create(int hotspot_x, int hotspot_y, int offset_x, int offset_y, const char *mimetype, unsigned int timestamp, void *data)
+{
+ Ecore_Wl_Drag_Source *source;
+
+ if (!(source = calloc(1, sizeof(Ecore_Wl_Drag_Source)))) return NULL;
+
+ source->data_dev = _ecore_wl_data_dev;
+ source->hotspot_x = hotspot_x;
+ source->hotspot_y = hotspot_y;
+ source->offset_x = offset_x;
+ source->offset_y = offset_y;
+ source->mimetype = mimetype;
+ source->timestamp = timestamp;
+ source->data = data;
+
+ source->data_source =
+ wl_data_device_manager_create_data_source(_ecore_wl_data_manager);
+
+ wl_data_source_add_listener(source->data_source,
+ &_ecore_wl_source_listener, source);
+
+ wl_data_source_offer(source->data_source, source->mimetype);
+
+ /* NB: Do we add some default mimetypes here ?? */
+ /* text/plain, etc */
+
+ return source;
+}
+
+EAPI void
+ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer)
+{
+ source->buffer = buffer;
+
+ wl_data_device_start_drag(source->data_dev, source->data_source,
+ surface, source->timestamp);
+}
+
+EAPI void
+ecore_wl_drag_stop(void)
+{
+
+}
+
+/* local functions */
+static Eina_Bool
+_ecore_wl_shutdown(Eina_Bool close_display)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (--_ecore_wl_init_count != 0)
+ return _ecore_wl_init_count;
+
+ if (!_ecore_wl_disp) return _ecore_wl_init_count;
+
+ if (_ecore_wl_xkb) free(_ecore_wl_xkb);
+
+ if (_ecore_wl_fd_hdl) ecore_main_fd_handler_del(_ecore_wl_fd_hdl);
+ _ecore_wl_fd_hdl = NULL;
+
+ if (close_display)
+ {
+ if (_ecore_wl_data_dev) wl_data_device_destroy(_ecore_wl_data_dev);
+ if (_ecore_wl_input_dev) wl_input_device_destroy(_ecore_wl_input_dev);
+ if (_ecore_wl_data_manager)
+ wl_data_device_manager_destroy(_ecore_wl_data_manager);
+ if (_ecore_wl_shell) wl_shell_destroy(_ecore_wl_shell);
+ if (_ecore_wl_shm) wl_shm_destroy(_ecore_wl_shm);
+ if (_ecore_wl_comp) wl_compositor_destroy(_ecore_wl_comp);
+ if (_ecore_wl_disp)
+ {
+ wl_display_flush(_ecore_wl_disp);
+ wl_display_destroy(_ecore_wl_disp);
+ }
+ _ecore_wl_disp = NULL;
+ }
+
+ eina_log_domain_unregister(_ecore_wl_log_dom);
+ _ecore_wl_log_dom = -1;
+
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+
+ return _ecore_wl_init_count;
+}
+
+static void
+_ecore_wl_cb_disp_handle_global(struct wl_display *disp, uint32_t id, const char *interface, uint32_t version __UNUSED__, void *data __UNUSED__)
+{
+// LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (disp != _ecore_wl_disp) return;
+ if (!strcmp(interface, "wl_compositor"))
+ {
+ _ecore_wl_comp =
+ wl_display_bind(_ecore_wl_disp, id, &wl_compositor_interface);
+ }
+ else if (!strcmp(interface, "wl_shm"))
+ {
+ _ecore_wl_shm =
+ wl_display_bind(_ecore_wl_disp, id, &wl_shm_interface);
+ }
+ else if (!strcmp(interface, "wl_output"))
+ {
+ _ecore_wl_output =
+ wl_display_bind(_ecore_wl_disp, id, &wl_output_interface);
+ wl_output_add_listener(_ecore_wl_output,
+ &_ecore_wl_output_listener, NULL);
+ }
+ else if (!strcmp(interface, "wl_shell"))
+ {
+ _ecore_wl_shell =
+ wl_display_bind(_ecore_wl_disp, id, &wl_shell_interface);
+ }
+ else if (!strcmp(interface, "wl_input_device"))
+ {
+ _ecore_wl_input_dev =
+ wl_display_bind(_ecore_wl_disp, id, &wl_input_device_interface);
+ wl_input_device_add_listener(_ecore_wl_input_dev,
+ &_ecore_wl_input_listener, NULL);
+ }
+ else if (!strcmp(interface, "wl_data_device_manager"))
+ {
+ _ecore_wl_data_manager =
+ wl_display_bind(_ecore_wl_disp, id,
+ &wl_data_device_manager_interface);
+ }
+
+ if ((_ecore_wl_input_dev) && (_ecore_wl_data_manager) && (!_ecore_wl_data_dev))
+ {
+ _ecore_wl_data_dev =
+ wl_data_device_manager_get_data_device(_ecore_wl_data_manager,
+ _ecore_wl_input_dev);
+ wl_data_device_add_listener(_ecore_wl_data_dev,
+ &_ecore_wl_data_listener, NULL);
+ }
+}
+
+static int
+_ecore_wl_cb_disp_event_mask_update(uint32_t mask, void *data __UNUSED__)
+{
+// LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ _ecore_wl_disp_mask = mask;
+
+ return 0;
+}
+
+static void
+_ecore_wl_cb_disp_handle_geometry(void *data __UNUSED__, struct wl_output *output __UNUSED__, int x, int y, int pw __UNUSED__, int ph __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__)
+{
+ _ecore_wl_screen.x = x;
+ _ecore_wl_screen.y = y;
+}
+
+static void
+_ecore_wl_cb_disp_handle_mode(void *data __UNUSED__, struct wl_output *output __UNUSED__, uint32_t flags, int w, int h, int refresh __UNUSED__)
+{
+ if (flags & WL_OUTPUT_MODE_CURRENT)
+ {
+ _ecore_wl_screen.w = w;
+ _ecore_wl_screen.h = h;
+ }
+}
+
+static Eina_Bool
+_ecore_wl_cb_fd_handle(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
+{
+ struct wl_display *disp;
+
+// LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(disp = data)) return ECORE_CALLBACK_RENEW;
+ if (disp != _ecore_wl_disp) return ECORE_CALLBACK_RENEW;
+
+ if (_ecore_wl_disp_mask & WL_DISPLAY_WRITABLE)
+ wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_WRITABLE);
+
+ if (_ecore_wl_disp_mask & WL_DISPLAY_READABLE)
+ wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_ecore_wl_cb_handle_motion(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, int32_t x, int32_t y, int32_t sx, int32_t sy)
+{
+ if (dev != _ecore_wl_input_dev) return;
+
+ _ecore_wl_screen_x = x;
+ _ecore_wl_screen_y = y;
+ _ecore_wl_surface_x = sx;
+ _ecore_wl_surface_y = sy;
+
+ _ecore_wl_mouse_move_send(t);
+}
+
+static void
+_ecore_wl_cb_handle_button(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, uint32_t btn, uint32_t state)
+{
+ if (dev != _ecore_wl_input_dev) return;
+
+ if ((btn >= BTN_SIDE) && (btn <= BTN_BACK))
+ {
+ Ecore_Event_Mouse_Wheel *ev;
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
+
+ ev->timestamp = t;
+ ev->x = _ecore_wl_surface_x;
+ ev->y = _ecore_wl_surface_y;
+ ev->root.x = _ecore_wl_screen_x;
+ ev->root.y = _ecore_wl_screen_y;
+ ev->modifiers = _ecore_wl_input_modifiers;
+ ev->direction = 0;
+
+ if (_ecore_wl_input_surface)
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+
+ /* NB: (FIXME) Currently Wayland provides no measure of how much the
+ * wheel has scrolled (read: delta of movement). So for now, we will
+ * just assume that the amount scrolled is 1 */
+ if ((btn == BTN_EXTRA) || (btn == BTN_FORWARD)) // down
+ ev->z = 1;
+ else if ((btn == BTN_SIDE) || (btn == BTN_BACK)) // up
+ ev->z = -1;
+
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
+ }
+ else
+ {
+ if (state)
+ {
+ _ecore_wl_input_button = btn;
+ if (_ecore_wl_input_surface)
+ _ecore_wl_mouse_down_send(_ecore_wl_input_surface, btn, t);
+ /* NB: Ideally, this is not the place to check for drags.
+ * IMO, drags should be handled by the client. EG: we raise the
+ * mouse_down to the client, and the client can 'request' a
+ * drag_start from ecore_wl */
+ if ((_ecore_wl_input_surface) || (_ecore_wl_touch_surface))
+ {
+ /* record item which was grabbed.
+ * create drag source. start drag */
+ }
+ }
+ else
+ {
+ if ((_ecore_wl_input_surface) || (_ecore_wl_touch_surface))
+ {
+ /* release grabbed button and finish drag */
+ if ((_ecore_wl_input_button) &&
+ (_ecore_wl_input_button == btn))
+ {
+
+ }
+ }
+ _ecore_wl_input_button = 0;
+ if (_ecore_wl_input_surface)
+ _ecore_wl_mouse_up_send(_ecore_wl_input_surface, btn, t);
+ }
+ }
+}
+
+static void
+_ecore_wl_cb_handle_key(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, uint32_t key, uint32_t state)
+{
+ unsigned int keycode = 0;
+
+ if (dev != _ecore_wl_input_dev) return;
+
+ keycode = key + _ecore_wl_xkb->min_key_code;
+
+ if (state)
+ _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[keycode];
+ else
+ _ecore_wl_input_modifiers &= ~_ecore_wl_xkb->map->modmap[keycode];
+}
+
+static void
+_ecore_wl_cb_handle_pointer_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, struct wl_surface *surface, int32_t x, int32_t y, int32_t sx, int32_t sy)
+{
+ if (dev != _ecore_wl_input_dev) return;
+
+ /* NB: Wayland pointer focus is weird. It's not pointer focus in the normal
+ * sense...Wayland 'moving/resizing' (and maybe other stuff) has a habit
+ * of stealing the pointer focus and thus this cannot be used to control
+ * normal pointer focus. On mouse down, the 'active' surface is stolen
+ * by Wayland for the grab, so 'surface' here ends up being NULL. When a
+ * move or resize is finished, we get this event again, but this time
+ * with an active surface */
+ _ecore_wl_screen_x = x;
+ _ecore_wl_screen_y = y;
+ _ecore_wl_surface_x = sx;
+ _ecore_wl_surface_y = sy;
+
+ if ((_ecore_wl_input_surface) && (_ecore_wl_input_surface != surface))
+ {
+ if (!_ecore_wl_input_button)
+ _ecore_wl_mouse_out_send(_ecore_wl_input_surface, t);
+ }
+
+ if (surface)
+ {
+ if (_ecore_wl_input_button)
+ {
+ _ecore_wl_mouse_up_send(surface, _ecore_wl_input_button, t);
+ _ecore_wl_input_button = 0;
+ }
+ else
+ _ecore_wl_mouse_in_send(surface, t);
+ }
+}
+
+static void
+_ecore_wl_cb_handle_keyboard_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, struct wl_surface *surface, struct wl_array *keys)
+{
+ unsigned int *keyend = 0, *i = 0;
+
+ if (dev != _ecore_wl_input_dev) return;
+
+ /* NB: Remove old keyboard focus */
+ if ((_ecore_wl_input_surface) && (_ecore_wl_input_surface != surface))
+ _ecore_wl_focus_out_send(_ecore_wl_input_surface, t);
+
+ _ecore_wl_input_surface = NULL;
+
+ keyend = keys->data + keys->size;
+ _ecore_wl_input_modifiers = 0;
+ for (i = keys->data; i < keyend; i++)
+ _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[*i];
+
+ if (surface)
+ {
+ /* set new input surface */
+ _ecore_wl_input_surface = surface;
+
+ /* send mouse in to new surface */
+ /* _ecore_wl_mouse_in_send(surface, t); */
+
+ /* send focus to new surface */
+ _ecore_wl_focus_in_send(surface, t);
+ }
+}
+
+static void
+_ecore_wl_cb_handle_touch_down(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, struct wl_surface *surface, int32_t id, int32_t x, int32_t y)
+{
+ Ecore_Event_Mouse_Button *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ _ecore_wl_touch_surface = surface;
+ _ecore_wl_touch_x = x;
+ _ecore_wl_touch_y = y;
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
+
+ ev->timestamp = timestamp;
+
+ /* NB: Need to verify using x,y for these */
+ ev->x = x;
+ ev->y = y;
+ ev->root.x = x;
+ ev->root.y = y;
+ ev->modifiers = 0;
+ ev->buttons = 0;
+ ev->same_screen = 1;
+
+ /* FIXME: Need to get these from Wayland somehow */
+ ev->double_click = 0;
+ ev->triple_click = 0;
+
+ ev->multi.device = id;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+ /* NB: Need to verify using x,y for these */
+ ev->multi.x = x;
+ ev->multi.y = y;
+ ev->multi.root.x = x;
+ ev->multi.root.y = y;
+
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_cb_handle_touch_up(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id)
+{
+ Ecore_Event_Mouse_Button *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
+
+ ev->timestamp = timestamp;
+
+ /* TODO: Need to verify using x,y for these */
+ ev->x = _ecore_wl_touch_x;
+ ev->y = _ecore_wl_touch_y;
+ ev->root.x = _ecore_wl_touch_x;
+ ev->root.y = _ecore_wl_touch_y;
+ ev->modifiers = 0;
+ ev->buttons = 0;
+ ev->same_screen = 1;
+
+ /* FIXME: Need to get these from Wayland somehow */
+ ev->double_click = 0;
+ ev->triple_click = 0;
+
+ ev->multi.device = id;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+
+ /* TODO: Need to verify using x,y for these */
+ ev->multi.x = _ecore_wl_touch_x;
+ ev->multi.y = _ecore_wl_touch_y;
+ ev->multi.root.x = _ecore_wl_touch_x;
+ ev->multi.root.y = _ecore_wl_touch_y;
+
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+
+ _ecore_wl_touch_surface = NULL;
+
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_cb_handle_touch_motion(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id, int32_t x, int32_t y)
+{
+ Ecore_Event_Mouse_Move *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!_ecore_wl_touch_surface) return;
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
+
+ ev->timestamp = timestamp;
+ /* TODO: Need to verify using x,y for these */
+ ev->x = x;
+ ev->y = y;
+ ev->root.x = x;
+ ev->root.y = y;
+ ev->modifiers = 0; //_ecore_wl_input_modifiers;
+ ev->same_screen = 1;
+
+ ev->multi.device = id;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+
+ /* TODO: Need to verify using x,y for these */
+ ev->multi.x = x;
+ ev->multi.y = y;
+ ev->multi.root.x = x;
+ ev->multi.root.y = y;
+
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_cb_handle_touch_frame(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ /* FIXME: Need to get a device and actually test what happens here */
+}
+
+static void
+_ecore_wl_cb_handle_touch_cancel(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ /* FIXME: Need to get a device and actually test what happens here */
+ _ecore_wl_touch_surface = NULL;
+}
+
+static void
+_ecore_wl_cb_source_target(void *data, struct wl_data_source *source __UNUSED__, const char *mime_type __UNUSED__)
+{
+ Ecore_Wl_Drag_Source *s;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ printf("Ecore_Wl Source Target\n");
+ if (!(s = data)) return;
+ printf("\tHave Drag Source\n");
+
+ /* FIXME: buffer here should really be the mouse cursor buffer */
+ wl_data_device_attach(s->data_dev, s->timestamp, s->buffer,
+ s->hotspot_x, s->hotspot_y);
+}
+
+static void
+_ecore_wl_cb_source_send(void *data, struct wl_data_source *source, const char *mime_type, int32_t fd)
+{
+ Ecore_Wl_Drag_Source *s;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ printf("Ecore_Wl Source Send\n");
+ if (!(s = data)) return;
+ printf("\tHave Drag Source\n");
+
+ /* FIXME: write message to fd */
+
+ /* NB: Wayland really sucks in this regard. Why should selection stuff
+ * require an 'fd' ?? */
+}
+
+static void
+_ecore_wl_cb_source_cancelled(void *data, struct wl_data_source *source __UNUSED__)
+{
+ Ecore_Wl_Drag_Source *s;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ /* The cancelled event usually means source is no longer in use by
+ * the drag (or selection). */
+
+ printf("Ecore_Wl Source Cancel\n");
+ if (!(s = data)) return;
+ printf("\tHave Drag Source\n");
+
+ /* FIXME: raise this to ecore_evas so the surface/buffer
+ * of the drag can be destroyed */
+
+ if (s->data_source) wl_data_source_destroy(s->data_source);
+ s->data_source = NULL;
+
+ free(s);
+}
+
+static void
+_ecore_wl_cb_source_offer(void *data, struct wl_data_offer *offer __UNUSED__, const char *type)
+{
+ Ecore_Wl_Dnd_Source *s;
+
+ if (!(s = data)) return;
+ eina_array_push(s->types, strdup(type));
+}
+
+static void
+_ecore_wl_cb_data_offer(void *data, struct wl_data_device *data_dev, uint32_t id)
+{
+ Ecore_Wl_Dnd_Source *source;
+
+ /* create a new 'data offer' structure and setup a listener for it */
+ if (!(source = calloc(1, sizeof(Ecore_Wl_Dnd_Source)))) return;
+
+ source->types = eina_array_new(1);
+ source->data = data;
+ source->refs = 1;
+
+ /* FIXME: This will need to change when Wayland has typesafe wrappers for this */
+ source->offer = (struct wl_data_offer *)
+ wl_proxy_create_for_id((struct wl_proxy *)data_dev,
+ id, &wl_data_offer_interface);
+
+ wl_data_device_set_user_data(data_dev, source);
+ wl_data_offer_add_listener(source->offer, &_ecore_wl_offer_listener, source);
+}
+
+static void
+_ecore_wl_cb_data_enter(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, struct wl_surface *surface, int32_t x, int32_t y, struct wl_data_offer *offer)
+{
+ Ecore_Wl_Dnd_Source *source;
+
+ if (!(source = wl_data_device_get_user_data(data_dev))) return;
+
+ /* TODO: maybe set pointer focus here ?? */
+
+ source->timestamp = timestamp;
+}
+
+static void
+_ecore_wl_cb_data_leave(void *data __UNUSED__, struct wl_data_device *data_dev)
+{
+ Ecore_Wl_Dnd_Source *source;
+
+ if (!(source = wl_data_device_get_user_data(data_dev))) return;
+
+ /* destroy drag offer */
+ wl_data_offer_destroy(source->offer);
+
+ while (eina_array_count(source->types))
+ free(eina_array_pop(source->types));
+
+ eina_array_free(source->types);
+ free(source);
+
+ wl_data_device_set_user_data(data_dev, NULL);
+}
+
+static void
+_ecore_wl_cb_data_motion(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, int32_t x, int32_t y)
+{
+ Ecore_Wl_Dnd_Source *source;
+
+ if (!(source = wl_data_device_get_user_data(data_dev))) return;
+ /* TODO: Here we should raise motion events for dragging */
+}
+
+static void
+_ecore_wl_cb_data_drop(void *data __UNUSED__, struct wl_data_device *data_dev)
+{
+ Ecore_Wl_Dnd_Source *source;
+
+ if (!(source = wl_data_device_get_user_data(data_dev))) return;
+
+ /* TODO: Raise event for drop */
+
+ wl_data_offer_accept(source->offer, source->timestamp, NULL);
+// eina_array_data_get(source->types, 0));
+}
+
+static void
+_ecore_wl_cb_data_selection(void *data, struct wl_data_device *data_dev, struct wl_data_offer *offer)
+{
+ Ecore_Wl_Dnd_Source *source;
+
+ printf("Ecore_Wl Data Selection\n");
+ if ((source = wl_data_device_get_user_data(data_dev)))
+ {
+ /* destroy old source */
+ wl_data_offer_destroy(source->offer);
+
+ while (eina_array_count(source->types))
+ free(eina_array_pop(source->types));
+
+ eina_array_free(source->types);
+ free(source);
+
+ wl_data_device_set_user_data(data_dev, NULL);
+ }
+}
+
+static void
+_ecore_wl_mouse_move_send(uint32_t timestamp)
+{
+ Ecore_Event_Mouse_Move *ev;
+
+// if (!_ecore_wl_input_surface) return;
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
+
+ ev->timestamp = timestamp;
+ ev->x = _ecore_wl_surface_x;
+ ev->y = _ecore_wl_surface_y;
+ ev->root.x = _ecore_wl_screen_x;
+ ev->root.y = _ecore_wl_screen_y;
+ ev->modifiers = _ecore_wl_input_modifiers;
+
+ ev->multi.device = 0;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+ ev->multi.x = _ecore_wl_surface_x;
+ ev->multi.y = _ecore_wl_surface_y;
+ ev->multi.root.x = _ecore_wl_screen_x;
+ ev->multi.root.y = _ecore_wl_screen_y;
+
+ {
+ unsigned int id = 0;
+
+ if (_ecore_wl_input_surface)
+ {
+ if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_mouse_out_send(struct wl_surface *surface, uint32_t timestamp)
+{
+ Ecore_Wl_Event_Mouse_Out *ev;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_Out)))) return;
+
+ ev->x = _ecore_wl_surface_x;
+ ev->y = _ecore_wl_surface_y;
+ ev->root.x = _ecore_wl_screen_x;
+ ev->root.y = _ecore_wl_screen_y;
+ ev->modifiers = _ecore_wl_input_modifiers;
+ ev->time = timestamp;
+
+ if (surface)
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ ev->window = id;
+ }
+
+ ecore_event_add(ECORE_WL_EVENT_MOUSE_OUT, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp)
+{
+ Ecore_Wl_Event_Mouse_In *ev;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_In)))) return;
+
+ ev->x = _ecore_wl_surface_x;
+ ev->y = _ecore_wl_surface_y;
+ ev->root.x = _ecore_wl_screen_x;
+ ev->root.y = _ecore_wl_screen_y;
+ ev->modifiers = _ecore_wl_input_modifiers;
+ ev->time = timestamp;
+
+ if (surface)
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ ev->window = id;
+ }
+
+ ecore_event_add(ECORE_WL_EVENT_MOUSE_IN, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_mouse_up_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp)
+{
+ Ecore_Event_Mouse_Button *ev;
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
+
+ if (button == BTN_LEFT)
+ ev->buttons = 1;
+ else if (button == BTN_MIDDLE)
+ ev->buttons = 2;
+ else if (button == BTN_RIGHT)
+ ev->buttons = 3;
+
+ ev->timestamp = timestamp;
+ ev->x = _ecore_wl_surface_x;
+ ev->y = _ecore_wl_surface_y;
+ ev->root.x = _ecore_wl_screen_x;
+ ev->root.y = _ecore_wl_screen_y;
+ ev->modifiers = _ecore_wl_input_modifiers;
+
+ /* FIXME: Need to get these from Wayland somehow */
+ ev->double_click = 0;
+ ev->triple_click = 0;
+
+ ev->multi.device = 0;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+ ev->multi.x = _ecore_wl_surface_x;
+ ev->multi.y = _ecore_wl_surface_y;
+ ev->multi.root.x = _ecore_wl_screen_x;
+ ev->multi.root.y = _ecore_wl_screen_y;
+
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_mouse_down_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp)
+{
+ Ecore_Event_Mouse_Button *ev;
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
+
+ if (button == BTN_LEFT)
+ ev->buttons = 1;
+ else if (button == BTN_MIDDLE)
+ ev->buttons = 2;
+ else if (button == BTN_RIGHT)
+ ev->buttons = 3;
+
+ ev->timestamp = timestamp;
+ ev->x = _ecore_wl_surface_x;
+ ev->y = _ecore_wl_surface_y;
+ ev->root.x = _ecore_wl_screen_x;
+ ev->root.y = _ecore_wl_screen_y;
+ ev->modifiers = _ecore_wl_input_modifiers;
+
+ /* FIXME: Need to get these from Wayland somehow */
+ ev->double_click = 0;
+ ev->triple_click = 0;
+
+ ev->multi.device = 0;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+ ev->multi.x = _ecore_wl_surface_x;
+ ev->multi.y = _ecore_wl_surface_y;
+ ev->multi.root.x = _ecore_wl_screen_x;
+ ev->multi.root.y = _ecore_wl_screen_y;
+
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ {
+ ev->window = id;
+ ev->event_window = id;
+ }
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_focus_out_send(struct wl_surface *surface, uint32_t timestamp)
+{
+ Ecore_Wl_Event_Focus_Out *ev;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_Out)))) return;
+ ev->time = timestamp;
+ if (surface)
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ ev->window = id;
+ }
+ ecore_event_add(ECORE_WL_EVENT_FOCUS_OUT, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp)
+{
+ Ecore_Wl_Event_Focus_In *ev;
+
+ if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_In)))) return;
+ ev->time = timestamp;
+ if (surface)
+ {
+ unsigned int id = 0;
+
+ if ((id = (unsigned int)wl_surface_get_user_data(surface)))
+ ev->window = id;
+ }
+ ecore_event_add(ECORE_WL_EVENT_FOCUS_IN, ev, NULL, NULL);
+}
--- /dev/null
+#ifndef _ECORE_WAYLAND_PRIVATE_H
+# define _ECORE_WAYLAND_PRIVATE_H
+
+# include <limits.h>
+
+//# define LOGFNS 1
+
+# ifdef LOGFNS
+# include <stdio.h>
+# define LOGFN(fl, ln, fn) printf("-ECORE-WL: %25s: %5i - %s\n", fl, ln, fn);
+# else
+# define LOGFN(fl, ln, fn)
+# endif
+
+extern int _ecore_wl_log_dom;
+
+# ifdef ECORE_WL_DEFAULT_LOG_COLOR
+# undef ECORE_WL_DEFAULT_LOG_COLOR
+# endif
+# define ECORE_WL_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
+
+# ifdef ERR
+# undef ERR
+# endif
+# define ERR(...) EINA_LOG_DOM_ERR(_ecore_wl_log_dom, __VA_ARGS__)
+
+# ifdef DBG
+# undef DBG
+# endif
+# define DBG(...) EINA_LOG_DOM_DBG(_ecore_wl_log_dom, __VA_ARGS__)
+
+# ifdef INF
+# undef INF
+# endif
+# define INF(...) EINA_LOG_DOM_INFO(_ecore_wl_log_dom, __VA_ARGS__)
+
+# ifdef WRN
+# undef WRN
+# endif
+# define WRN(...) EINA_LOG_DOM_WARN(_ecore_wl_log_dom, __VA_ARGS__)
+
+# ifdef CRIT
+# undef CRIT
+# endif
+# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__)
+
+typedef struct _Ecore_Wl_Dnd_Source
+{
+ struct wl_data_offer *offer;
+ int refs;
+
+ Eina_Array *types;
+
+ uint32_t timestamp;
+ void *data;
+} Ecore_Wl_Dnd_Source;
+
+typedef struct _Ecore_Wl_Dnd_Target
+{
+ /* NB: These are not the real fields for this structure,
+ * and it is Bound to change....soon */
+ struct wl_data_offer *offer;
+ int refs;
+
+ Eina_Array *types;
+
+ uint32_t timestamp;
+ void *data;
+} Ecore_Wl_Dnd_Target;
+
+struct _Ecore_Wl_Drag_Source
+{
+ struct wl_data_device *data_dev;
+ struct wl_buffer *buffer;
+
+ int32_t hotspot_x, hotspot_y;
+ int32_t offset_x, offset_y;
+ const char *mimetype;
+ uint32_t timestamp;
+ void *data;
+
+ struct wl_data_source *data_source;
+};
+
+#endif
Ecore_Win32_Window *window; /**< The window that received the event */
int x; /**< The x coordinate where the mouse leaved */
int y; /**< The y coordinate where the mouse entered */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
Ecore_Win32_Window *window; /**< The window that received the event */
int x; /**< The x coordinate where the mouse leaved */
int y; /**< The y coordinate where the mouse leaved */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Focus_In
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Focus_Out
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
int y; /**< The y coordinate of the top left corner of the damaged region */
int width; /**< The width of the damaged region */
int height; /**< The time the event occurred */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Create
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Destroy
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Hide
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Show
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
int y; /**< The new y coordinate of the top left corner */
int width; /**< The new width */
int height; /**< The new height */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
Ecore_Win32_Window *window; /**< The window that received the event */
int width; /**< The new width */
int height; /**< The new height */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
struct _Ecore_Win32_Event_Window_Delete_Request
{
Ecore_Win32_Window *window; /**< The window that received the event */
- long time; /**< The time the event occurred */
+ unsigned long timestamp; /**< The time the event occurred */
};
/**
/* Core */
-EAPI int ecore_win32_init();
-EAPI int ecore_win32_shutdown();
-EAPI int ecore_win32_screen_depth_get();
-EAPI void ecore_win32_double_click_time_set(double t);
-EAPI double ecore_win32_double_click_time_get(void);
-EAPI long ecore_win32_current_time_get(void);
+EAPI int ecore_win32_init();
+EAPI int ecore_win32_shutdown();
+EAPI int ecore_win32_screen_depth_get();
+EAPI void ecore_win32_double_click_time_set(double t);
+EAPI double ecore_win32_double_click_time_get(void);
+EAPI unsigned long ecore_win32_current_time_get(void);
/* Window */
data->message = message;
data->window_param = window_param;
data->data_param = data_param;
- data->time = GetMessageTime();
+ data->timestamp = GetMessageTime();
coord = GetMessagePos();
point = MAKEPOINTS(coord);
data->x = point.x;
data->y = point.y;
+ data->discard_ctrl = EINA_FALSE;
switch (data->message)
{
/* Keyboard input notifications */
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
- INF("keydown message");
+ if ((data->message == WM_KEYDOWN) &&
+ (data->window_param == VK_CONTROL) &&
+ ((HIWORD(data->data_param) & KF_EXTENDED) == 0))
+ {
+ /* Ctrl left key is pressed */
+ BOOL res;
+ MSG next_msg;
+
+ /*
+ * we check if the next message
+ * - is a WM_KEYDOWN
+ * - has the same timestamp than the Ctrl one
+ * - is the key press of the right Alt key
+ */
+ res = PeekMessage(&next_msg, data->window,
+ WM_KEYDOWN, WM_KEYDOWN,
+ PM_NOREMOVE);
+ if (res &&
+ (next_msg.wParam == VK_MENU) &&
+ (next_msg.time == data->timestamp) &&
+ (HIWORD(next_msg.lParam) & KF_EXTENDED))
+ {
+ INF("discard left Ctrl key press (sent by AltGr key press)");
+ data->discard_ctrl = EINA_TRUE;
+ }
+ }
_ecore_win32_event_handle_key_press(data, 1);
return 0;
case WM_CHAR:
case WM_KEYUP:
case WM_SYSKEYUP:
INF("keyup message");
+ if ((data->window_param == VK_CONTROL) &&
+ ((HIWORD(data->data_param) & KF_EXTENDED) == 0))
+ {
+ /* Ctrl left key is pressed */
+ BOOL res;
+ MSG next_msg;
+
+ /*
+ * we check if the next message
+ * - is a WM_KEYUP or WM_SYSKEYUP
+ * - has the same timestamp than the Ctrl one
+ * - is the key release of the right Alt key
+ */
+ res = PeekMessage(&next_msg, data->window,
+ WM_KEYUP, WM_SYSKEYUP,
+ PM_NOREMOVE);
+ if (res &&
+ ((next_msg.message == WM_KEYUP) ||
+ (next_msg.message == WM_SYSKEYUP)) &&
+ (next_msg.wParam == VK_MENU) &&
+ (next_msg.time == data->timestamp) &&
+ (HIWORD(next_msg.lParam) & KF_EXTENDED))
+ {
+ INF("discard left Ctrl key release (sent by AltGr key release)");
+ data->discard_ctrl = EINA_TRUE;
+ }
+ }
_ecore_win32_event_handle_key_release(data);
return 0;
case WM_SETFOCUS:
HINSTANCE _ecore_win32_instance = NULL;
double _ecore_win32_double_click_time = 0.25;
-long _ecore_win32_event_last_time = 0;
+unsigned long _ecore_win32_event_last_time = 0;
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
int _ecore_win32_log_dom_global = -1;
*
* This function returns the last event time.
*/
-EAPI long
+EAPI unsigned long
ecore_win32_current_time_get(void)
{
return _ecore_win32_event_last_time;
static void _ecore_win32_event_free_key_up(void *data,
void *ev);
-static int _ecore_win32_event_keystroke_get(int key,
- int is_extended,
- Eina_Bool is_down,
- char **keyname,
- char **keysymbol,
- char **keycompose,
- unsigned int *modifiers);
+static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
+ Eina_Bool is_down,
+ char **keyname,
+ char **keysymbol,
+ char **keycompose,
+ unsigned int *modifiers);
-static int _ecore_win32_event_char_get(int key,
- char **keyname,
- char **keysymbol,
- char **keycompose);
+static int _ecore_win32_event_char_get(int key,
+ char **keyname,
+ char **keysymbol,
+ char **keycompose,
+ unsigned int *modifiers);
/***** Global functions definitions *****/
if (is_keystroke)
{
- if (!_ecore_win32_event_keystroke_get(msg->window_param,
- msg->data_param & 0x01000000,
+ if (!_ecore_win32_event_keystroke_get(msg,
EINA_TRUE,
(char **)&e->keyname,
(char **)&e->key,
if (!_ecore_win32_event_char_get(LOWORD(msg->window_param),
(char **)&e->keyname,
(char **)&e->key,
- (char **)&e->string))
+ (char **)&e->string,
+ &e->modifiers))
{
free(e);
return;
return;
}
e->event_window = e->window;
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
if (!e) return;
- if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param),
- msg->data_param & 0x01000000,
+ if (!_ecore_win32_event_keystroke_get(msg,
EINA_FALSE,
(char **)&e->keyname,
(char **)&e->key,
(char **)&e->string,
&e->modifiers))
{
- if (!_ecore_win32_event_char_get(LOWORD(msg->window_param),
+ if (msg->discard_ctrl ||
+ !_ecore_win32_event_char_get(LOWORD(msg->window_param),
(char **)&e->keyname,
(char **)&e->key,
- (char **)&e->string))
+ (char **)&e->string,
+ &e->modifiers))
{
free(e);
return;
return;
}
e->event_window = e->window;
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
e->event_window = e->window;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
e->buttons = button;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) &&
(e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window))
e->event_window = e->window;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
e->buttons = button;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_mouse_up_count++;
e->event_window = e->window;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
}
e->event_window = e->window;
e->x = msg->x;
e->y = msg->y;
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->x = msg->x;
e->y = msg->y;
- e->time = msg->time ;
+ e->timestamp = msg->timestamp ;
- _ecore_win32_event_last_time = e->time;
+ _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL);
}
e->event_window = e->window;
e->x = msg->x;
e->y = msg->y;
- e->timestamp = msg->time;
+ e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->x = msg->x;
e->y = msg->y;
- e->time = msg->time;
+ e->timestamp = msg->timestamp;
- _ecore_win32_event_last_time = e->time;
+ _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL);
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
- _ecore_win32_event_last_time = e->time;
+ e->timestamp = _ecore_win32_event_last_time;
+ _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
- _ecore_win32_event_last_time = e->time;
+ e->timestamp = _ecore_win32_event_last_time;
+ _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
}
e->width = msg->update.right - msg->update.left;
e->height = msg->update.bottom - msg->update.top;
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL);
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL);
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL);
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL);
}
e->y = wi.rcClient.top;
e->width = wi.rcClient.right - wi.rcClient.left;
e->height = wi.rcClient.bottom - wi.rcClient.top;
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->width = rect.right - rect.left;
e->height = rect.bottom - rect.top;
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL);
}
if (!e) return;
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
- e->time = _ecore_win32_event_last_time;
+ e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
}
}
static int
-_ecore_win32_event_keystroke_get(int key,
- int is_extended,
+_ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
Eina_Bool is_down,
char **keyname,
char **keysymbol,
char **keycompose,
unsigned int *modifiers)
{
+ WCHAR buf[3];
+ char delete_string[2] = { 0x7f, 0 };
char *kn = NULL;
char *ks = NULL;
char *kc = NULL;
+ int key;
+ int is_extended;
+
+ key = msg->window_param;
+ is_extended = msg->data_param & 0x01000000;
*keyname = NULL;
*keysymbol = NULL;
*keycompose = NULL;
-
- printf("vk key 0x%x\n", key);
switch (key)
{
/* Keystroke */
}
break;
case VK_RIGHT:
- printf("vk val 0x%x (right)\n", VK_RIGHT);
if (is_extended)
{
kn = "Right";
{
kn = "Delete";
ks = "Delete";
- /* FIXME: kc is wrong, here */
- kc = "Delete";
+ kc = delete_string;
}
else
{
ks = "Shift_R";
kc = "";
}
- *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
+ *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
}
else /* is_up */
{
kc = "";
_ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT;
}
- *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
+ *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
}
break;
}
{
SHORT res;
+ if (msg->discard_ctrl)
+ return 0;
+
if (is_down)
{
res = GetKeyState(VK_LCONTROL);
kc = "";
break;
default:
- /* other non keystroke characters */
- return 0;
+ {
+ /* other non keystroke characters */
+ BYTE kbd_state[256];
+ int res;
+
+ if (is_down)
+ return 0;
+
+ if (!GetKeyboardState(kbd_state))
+ return 0;
+
+ res = ToUnicode(msg->window_param,
+ MapVirtualKey(msg->window_param, 2),
+ kbd_state, buf, 3, 0);
+ if (res == 1)
+ {
+ /* FIXME: might be troublesome for non european languages */
+ /* in that case, UNICODE should be used, I guess */
+ buf[1] = '\0';
+ kn = (char *)buf;
+ ks = (char *)buf;
+ kc = (char *)buf;
+
+ res = GetAsyncKeyState(VK_SHIFT);
+ if (res & 0x8000)
+ *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
+ else
+ *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
+
+ res = GetKeyState(VK_CONTROL);
+ if (res & 0x8000)
+ *modifiers |= ECORE_EVENT_MODIFIER_CTRL;
+ else
+ *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
+
+ res = GetKeyState(VK_MENU);
+ if (res & 0x8000)
+ *modifiers |= ECORE_EVENT_MODIFIER_ALT;
+ else
+ *modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
+
+ break;
+ }
+ return 0;
+ }
}
- printf("sortie...\n");
*keyname = strdup(kn);
if (!*keyname) return 0;
*keysymbol = strdup(ks);
return 0;
}
}
- printf("sortie 2 ...\n");
return 1;
}
static int
-_ecore_win32_event_char_get(int key,
- char **keyname,
- char **keysymbol,
- char **keycompose)
+_ecore_win32_event_char_get(int key,
+ char **keyname,
+ char **keysymbol,
+ char **keycompose,
+ unsigned int *modifiers)
{
char *kn = NULL;
char *ks = NULL;
char *kc = NULL;
char buf[2];
+ SHORT res;
*keyname = NULL;
*keysymbol = NULL;
*keycompose = NULL;
- printf("char key 0x%x\n", key);
-
switch (key)
{
case VK_PROCESSKEY:
break;
default:
/* displayable characters */
- printf (" * key : %d\n", key);
buf[0] = key;
buf[1] = '\0';
kn = buf;
return 0;
}
+ res = GetAsyncKeyState(VK_SHIFT);
+ if (res & 0x8000)
+ *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
+ else
+ *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
+
+ res = GetKeyState(VK_CONTROL);
+ if (res & 0x8000)
+ *modifiers |= ECORE_EVENT_MODIFIER_CTRL;
+ else
+ *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
+
+ res = GetKeyState(VK_MENU);
+ if (res & 0x8000)
+ *modifiers |= ECORE_EVENT_MODIFIER_ALT;
+ else
+ *modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
+
return 1;
}
struct _Ecore_Win32_Callback_Data
{
- RECT update;
- HWND window;
- unsigned int message;
- WPARAM window_param;
- LPARAM data_param;
- long time;
- int x;
- int y;
+ RECT update;
+ HWND window;
+ unsigned int message;
+ WPARAM window_param;
+ LPARAM data_param;
+ unsigned long timestamp;
+ int x;
+ int y;
+ Eina_Bool discard_ctrl;
};
struct _Ecore_Win32_Window
extern HINSTANCE _ecore_win32_instance;
extern double _ecore_win32_double_click_time;
-extern long _ecore_win32_event_last_time;
+extern unsigned long _ecore_win32_event_last_time;
extern Ecore_Win32_Window *_ecore_win32_event_last_window;
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,
EAPI void
ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win);
-/* added by doyoun.kang - for sliding window */
+/* for sliding window */
EAPI void
ecore_x_e_illume_sliding_win_state_set(Ecore_X_Window win,
unsigned int is_visible);
ecore_x_randr_edid_display_interface_type_get(unsigned char *edid,
unsigned long edid_length);
-/* ecore_x_randr_13.c */
+/* 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 const char *
ecore_x_keysym_string_get(int keysym);
+/**
+ * Given a keyname, return the keycode representing that key
+ *
+ * @since 1.2.0
+ */
+EAPI int ecore_x_keysym_keycode_get(const char *keyname);
+
typedef struct _Ecore_X_Image Ecore_X_Image;
EAPI Ecore_X_Image *
Ecore_X_Gesture_Event_Type type,
int num_fingers);
+/* Illume window states */
+typedef enum _Ecore_X_Illume_Window_State
+{
+ ECORE_X_ILLUME_WINDOW_STATE_NORMAL = 0,
+ ECORE_X_ILLUME_WINDOW_STATE_INSET
+} Ecore_X_Illume_Window_State;
+
+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);
+
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_OPERATOR;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE;
-/* added by doyoun.kang - for user created window */
+/* for user created window */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_USER_CREATED_WINDOW;
-/* added by gl77.lee - XID that points to the parent border window */
+/* XID that points to the parent border window */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_PARENT_BORDER_WINDOW;
-/* added by doyoun.kang - for indicator's state */
+/* for indicator's state */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE;
-/* added by doyoun.kang - for sliding window */
+/* for sliding window */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_STATE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY;
+/* for illume window state */
+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_INSET;
+
+/* for SDB(Samsung Debug Bridge) */
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_CONNECT;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT;
#endif /* _ECORE_X_ATOMS_H */
EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_PARENT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_POSITION = 0;
-/* added by doyoun.kang - for user created window */
+/* for user created window */
EAPI Ecore_X_Atom ECORE_X_ATOM_USER_CREATED_WINDOW = 0;
-/* added by gl77.lee - XID that points to the parent border window */
+/* XID that points to the parent border window */
EAPI Ecore_X_Atom ECORE_X_ATOM_PARENT_BORDER_WINDOW = 0;
-
-/* added by doyoun.kang - for sliding window */
+/* for sliding window */
EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_STATE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY = 0;
+
+/* for illume window state */
+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_INSET = 0;
+
+/* for SDB(Samsung Debug Bridge) */
+EAPI Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_CONNECT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT = 0;
/**
* Destroy a damage object
*
- * @param The damage object to destroy
+ * @param damage The damage object to destroy
*
* Destroys the damage object @p damage
*
* @param data User data.
*/
EAPI void
-ecore_x_dnd_callback_pos_update_set(void (*cb)(void *,
- Ecore_X_Xdnd_Position *data),
- const void *data)
+ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data),
+ const void *data)
{
_posupdatecb = cb;
_posupdatedata = (void *)data;
/**
* Sets the standby timeout (in unit of seconds).
- * @param new_standby Amount of time of inactivity before standby mode will be invoked.
+ * @param new_timeout Amount of time of inactivity before standby mode will be invoked.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
/**
* Sets the suspend timeout (in unit of seconds).
- * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
+ * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
/**
* Sets the off timeout (in unit of seconds).
- * @param off Amount of time of inactivity before the monitor is shut off.
+ * @param new_timeout Amount of time of inactivity before the monitor is shut off.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
static void *_io_error_data = NULL;
static int _error_request_code = 0;
static int _error_code = 0;
+static Ecore_X_ID _error_resource_id = 0;
/**
* Set the error handler.
return _error_code;
}
+/**
+ * Get the resource id that caused the error.
+ * @return The resource id causing the X error
+ *
+ * Return the X resource id that caused the last X error
+ */
+EAPI Ecore_X_ID
+ecore_x_error_resource_id_get(void)
+{
+ return _error_resource_id;
+}
+
int
_ecore_xcb_error_handle(xcb_generic_error_t *err)
{
_error_request_code = err->sequence;
_error_code = err->error_code;
+ _error_resource_id = err->resource_id;
if (_error_func)
_error_func(_error_data);
/**
* Remove the transient_for setting from a window.
- * @param The window
+ * @param win The window
*/
EAPI void
ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ CHECK_XCB_CONN;
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
XCB_EVENT_MASK_NO_EVENT,
return _ecore_xcb_keymap_keysym_to_string(keysym);
}
+EAPI int
+ecore_x_keysym_keycode_get(const char *keyname)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ return _ecore_xcb_keymap_string_to_keycode(keyname);
+}
+
/* local functions */
static int
_ecore_xcb_keymap_mask_get(void *reply,
/**
* @brief sets a CRTC relative to another one.
- * @param crtc_r1 the CRTC to be positioned.
- * @param crtc_r2 the CRTC the position should be relative to
- * @param position the relation between the crtcs
+ * @param crtc1 the CRTC to be positioned.
+ * @param crtc2 the CRTC the position should be relative to
+ * @param policy the relation between the crtcs
* @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's
* borders
* @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if
return EINA_FALSE;
}
+/*
+ * @brief check if a backlight is available
+ * @return whether a blacklight is available
+ */
+EAPI Eina_Bool
+ecore_x_randr_output_backlight_available(void)
+{
+#ifdef ECORE_XCB_RANDR
+ Ecore_X_Atom _backlight;
+ xcb_intern_atom_cookie_t acookie;
+ xcb_intern_atom_reply_t *areply;
+#endif
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ CHECK_XCB_CONN;
+
+#ifdef ECORE_XCB_RANDR
+ RANDR_CHECK_1_2_RET(EINA_FALSE);
+
+ acookie =
+ xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
+ strlen("Backlight"), "Backlight");
+ areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL);
+
+ if (!areply)
+ {
+ ERR("Backlight property is not suppported on this server or driver");
+ return EINA_FALSE;
+ }
+ else
+ {
+ _backlight = areply->atom;
+ free(areply);
+ return EINA_TRUE;
+ }
+#endif
+ return EINA_FALSE;
+}
+
EAPI int
ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length)
{
*/
EAPI void
ecore_x_window_focus_at_time(Ecore_X_Window win,
- Ecore_X_Time time)
+ Ecore_X_Time time __UNUSED__)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN;
if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
- xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_PARENT, win, time);
+ xcb_set_input_focus(_ecore_xcb_conn,
+ XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME);
// ecore_x_flush();
}
/**
* Create a region from a window.
- * @param window The window used to initialize the region.
+ * @param win The window used to initialize the region.
* @param type The type of the region.
* @return The newly created region.
*
* Change clip-mask in a graphic context to the specified region.
* @param region The region to change.
* @param gc The clip-mask graphic context.
- * @param x_origin The horizontal translation.
- * @param y_origin The vertical translation.
+ * @param x The horizontal translation.
+ * @param y The vertical translation.
*
* Changes clip-mask in @p gc to the specified @p region and
* sets the clip origin with the values of @p x_origin and @p y_origin.
* @param region The region.
* @param dest The window whose shape is changed.
* @param type The kind of shape.
- * @param x_offset The horizontal offset.
- * @param y_offset The vertical offset.
+ * @param x The horizontal offset.
+ * @param y The vertical offset.
*
* Set the specified Shape extension region of @p window to @p region,
* offset by @p x_offset and @p y_offset. Future changes to region
* Change clip-mask in picture to the specified region.
* @param region The region.
* @param picture The picture.
- * @param x_origin The X coordinate of the origin.
- * @param y_origin The Y coordinate of the origin.
+ * @param x The X coordinate of the origin.
+ * @param y The Y coordinate of the origin.
*
* Changes clip-mask in picture to the specified @p region
* and sets the clip origin. Input and output will be clipped to
#include "Ecore_X_Atoms.h"
#include "Ecore_Input.h"
-static Eina_Bool _ecore_x_fd_handler(void *data,
+static Eina_Bool _ecore_x_fd_handler(void *data,
Ecore_Fd_Handler *fd_handler);
-static Eina_Bool _ecore_x_fd_handler_buf(void *data,
+static Eina_Bool _ecore_x_fd_handler_buf(void *data,
Ecore_Fd_Handler *fd_handler);
static int _ecore_x_key_mask_get(KeySym sym);
static int _ecore_x_event_modifier(unsigned int state);
#ifdef LOGRT
static double t0 = 0.0;
static Status (*_logrt_real_reply)(Display *disp,
- void *rep,
- int extra,
- Bool discard) = NULL;
+ void *rep,
+ int extra,
+ Bool discard) = NULL;
static void
_logrt_init(void)
{
_logrt_real_reply = dlsym(lib, "_XReply");
t0 = ecore_time_get();
-} /* _logrt_init */
+}
Status
_XReply(Display *disp,
- void *rep,
- int extra,
- Bool discard)
+ void *rep,
+ int extra,
+ Bool discard)
{
void *bt[128];
int i, n;
// fixme: logme
return _logrt_real_reply(disp, rep, extra, discard);
-} /* _XReply */
+}
#endif /* ifdef LOGRT */
_ecore_x_modifiers_get(void)
{
/* everything has these... unless its like a pda... :) */
- ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
- ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L);
+ ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
+ ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L);
- /* apple's xdarwin has no alt!!!! */
- ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L);
- if (!ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L);
+ /* apple's xdarwin has no alt!!!! */
+ ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L);
+ if (!ECORE_X_MODIFIER_ALT)
+ ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L);
- if (!ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L);
+ if (!ECORE_X_MODIFIER_ALT)
+ ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L);
- /* the windows key... a valid modifier :) */
- ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L);
- if (!ECORE_X_MODIFIER_WIN)
- ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch);
+ /* the windows key... a valid modifier :) */
+ ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L);
+ if (!ECORE_X_MODIFIER_WIN)
+ ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch);
- if (!ECORE_X_MODIFIER_WIN)
- ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L);
+ if (!ECORE_X_MODIFIER_WIN)
+ ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L);
- if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_WIN = 0;
+ if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT)
+ ECORE_X_MODIFIER_WIN = 0;
- if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL)
- ECORE_X_MODIFIER_ALT = 0;
+ if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL)
+ ECORE_X_MODIFIER_ALT = 0;
- ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock);
- ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock);
- ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock);
- ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock);
+ ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock);
+ ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock);
+ ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock);
+ ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock);
}
/**
eina_init();
_ecore_xlib_log_dom = eina_log_domain_register
("ecore_x", ECORE_XLIB_DEFAULT_LOG_COLOR);
- if(_ecore_xlib_log_dom < 0)
+ if (_ecore_xlib_log_dom < 0)
{
EINA_LOG_ERR(
"Impossible to create a log domain for the Ecore Xlib module.");
#ifdef ECORE_XGESTURE
if (XGestureQueryExtension(_ecore_x_disp, &gesture_base, &gesture_err_base))
- _ecore_x_event_gesture_id = gesture_base;
+ _ecore_x_event_gesture_id = gesture_base;
ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents);
#endif /* ifdef ECORE_XGESTURE */
#ifdef ECORE_XGESTURE
if (_ecore_x_event_gesture_id)
{
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] =
- _ecore_x_event_handle_gesture_notify_flick;
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] =
- _ecore_x_event_handle_gesture_notify_pan;
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] =
- _ecore_x_event_handle_gesture_notify_pinchrotation;
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] =
- _ecore_x_event_handle_gesture_notify_tap;
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] =
- _ecore_x_event_handle_gesture_notify_tapnhold;
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] =
- _ecore_x_event_handle_gesture_notify_hold;
- _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] =
- _ecore_x_event_handle_gesture_notify_group;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] =
+ _ecore_x_event_handle_gesture_notify_flick;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] =
+ _ecore_x_event_handle_gesture_notify_pan;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] =
+ _ecore_x_event_handle_gesture_notify_pinchrotation;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] =
+ _ecore_x_event_handle_gesture_notify_tap;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] =
+ _ecore_x_event_handle_gesture_notify_tapnhold;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] =
+ _ecore_x_event_handle_gesture_notify_hold;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] =
+ _ecore_x_event_handle_gesture_notify_group;
}
#endif /* ifdef ECORE_XGESTURE */
eina_shutdown();
return --_ecore_x_init_count;
-} /* ecore_x_init */
+}
static int
_ecore_x_shutdown(int close_display)
eina_shutdown();
return _ecore_x_init_count;
-} /* _ecore_x_shutdown */
+}
/**
* Shuts down the Ecore X library.
ecore_x_shutdown(void)
{
return _ecore_x_shutdown(1);
-} /* ecore_x_shutdown */
+}
/**
* Shuts down the Ecore X library.
ecore_x_disconnect(void)
{
return _ecore_x_shutdown(0);
-} /* ecore_x_disconnect */
+}
/**
* @defgroup Ecore_X_Display_Attr_Group X Display Attributes
ecore_x_display_get(void)
{
return (Ecore_X_Display *)_ecore_x_disp;
-} /* ecore_x_display_get */
+}
/**
* Retrieves the X display file descriptor.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ConnectionNumber(_ecore_x_disp);
-} /* ecore_x_fd_get */
+}
/**
* Retrieves the Ecore_X_Screen handle used for the current X connection.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return (Ecore_X_Screen *)DefaultScreenOfDisplay(_ecore_x_disp);
-} /* ecore_x_default_screen_get */
+}
/**
* Retrieves the size of an Ecore_X_Screen.
*/
EAPI void
ecore_x_screen_size_get(const Ecore_X_Screen *screen,
- int *w,
- int *h)
+ int *w,
+ int *h)
{
Screen *s = (Screen *)screen;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
t = 0.0;
_ecore_x_double_click_time = t;
-} /* ecore_x_double_click_time_set */
+}
/**
* Retrieves the double and triple click flag timeout.
ecore_x_double_click_time_get(void)
{
return _ecore_x_double_click_time;
-} /* ecore_x_double_click_time_get */
+}
/**
* @defgroup Ecore_X_Flush_Group X Synchronization Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFlush(_ecore_x_disp);
-} /* ecore_x_flush */
+}
/**
* Flushes the command buffer and waits until all requests have been
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSync(_ecore_x_disp, False);
-} /* ecore_x_sync */
+}
/**
* Kill all clients with subwindows under a given window.
}
XUngrabServer(_ecore_x_disp);
XSync(_ecore_x_disp, False);
-} /* ecore_x_killall */
+}
/**
* Kill a specific client
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XKillClient(_ecore_x_disp, win);
-} /* ecore_x_kill */
+}
/**
* Return the last event time
ecore_x_current_time_get(void)
{
return _ecore_x_event_last_time;
-} /* ecore_x_current_time_get */
+}
/**
* Return the screen DPI
return 75;
return (((s->width * 254) / s->mwidth) + 5) / 10;
-} /* ecore_x_dpi_get */
+}
/**
* Invoke the standard system beep to alert users
return EINA_FALSE;
return EINA_TRUE;
-} /* ecore_x_bell */
+}
static Eina_Bool
-_ecore_x_fd_handler(void *data,
+_ecore_x_fd_handler(void *data,
Ecore_Fd_Handler *fd_handler __UNUSED__)
{
Display *d;
}
}
return ECORE_CALLBACK_RENEW;
-} /* _ecore_x_fd_handler */
+}
static Eina_Bool
-_ecore_x_fd_handler_buf(void *data,
+_ecore_x_fd_handler_buf(void *data,
Ecore_Fd_Handler *fd_handler __UNUSED__)
{
Display *d;
return ECORE_CALLBACK_RENEW;
return ECORE_CALLBACK_CANCEL;
-} /* _ecore_x_fd_handler_buf */
+}
static int
_ecore_x_key_mask_get(KeySym sym)
}
return 0;
-} /* _ecore_x_key_mask_get */
+}
/*****************************************************************************/
/*****************************************************************************/
overlap++;
}
}
- roots = malloc((num - overlap) * sizeof(Window));
+ roots = malloc(MAX((num - overlap) * sizeof(Window), 1));
if (roots)
{
int k;
roots[i] = RootWindow(_ecore_x_disp, i);
#endif /* ifdef ECORE_XPRINT */
return roots;
-} /* ecore_x_window_root_list */
+}
EAPI Ecore_X_Window
ecore_x_window_root_first_get(void)
free(roots);
return root;
*/
-} /* ecore_x_window_root_first_get */
+}
static void _ecore_x_window_manage_error(void *data);
if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) &&
(ecore_x_error_code_get() == BadAccess))
_ecore_x_window_manage_failed = 1;
-} /* _ecore_x_window_manage_error */
+}
EAPI Eina_Bool
ecore_x_window_manage(Ecore_X_Window win)
}
return EINA_TRUE;
-} /* ecore_x_window_manage */
+}
EAPI void
ecore_x_window_container_manage(Ecore_X_Window win)
XSelectInput(_ecore_x_disp, win,
SubstructureRedirectMask |
SubstructureNotifyMask);
-} /* ecore_x_window_container_manage */
+}
EAPI void
ecore_x_window_client_manage(Ecore_X_Window win)
SubstructureNotifyMask
);
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
-} /* ecore_x_window_client_manage */
+}
EAPI void
ecore_x_window_sniff(Ecore_X_Window win)
XSelectInput(_ecore_x_disp, win,
PropertyChangeMask |
SubstructureNotifyMask);
-} /* ecore_x_window_sniff */
+}
EAPI void
ecore_x_window_client_sniff(Ecore_X_Window win)
StructureNotifyMask |
SubstructureNotifyMask);
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
-} /* ecore_x_window_client_sniff */
+}
EAPI Eina_Bool
-ecore_x_window_attributes_get(Ecore_X_Window win,
+ecore_x_window_attributes_get(Ecore_X_Window win,
Ecore_X_Window_Attributes *att_ret)
{
XWindowAttributes att;
att_ret->colormap = att.colormap;
att_ret->visual = att.visual;
return EINA_TRUE;
-} /* ecore_x_window_attributes_get */
+}
EAPI void
ecore_x_window_save_set_add(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XAddToSaveSet(_ecore_x_disp, win);
-} /* ecore_x_window_save_set_add */
+}
EAPI void
ecore_x_window_save_set_del(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XRemoveFromSaveSet(_ecore_x_disp, win);
-} /* ecore_x_window_save_set_del */
+}
EAPI Ecore_X_Window *
ecore_x_window_children_get(Ecore_X_Window win,
- int *num)
+ int *num)
{
Ecore_X_Window *windows = NULL;
Window root_ret = 0, parent_ret = 0, *children_ret = NULL;
}
return windows;
-} /* ecore_x_window_children_get */
+}
EAPI Eina_Bool
ecore_x_pointer_control_set(int accel_num,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XChangePointerControl(_ecore_x_disp, 1, 1,
accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_pointer_control_set */
+}
EAPI Eina_Bool
ecore_x_pointer_control_get(int *accel_num,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XGetPointerControl(_ecore_x_disp,
accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_pointer_control_get */
+}
EAPI Eina_Bool
ecore_x_pointer_mapping_set(unsigned char *map,
- int nmap)
+ int nmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_pointer_mapping_set */
+}
EAPI Eina_Bool
ecore_x_pointer_mapping_get(unsigned char *map,
- int nmap)
+ int nmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XGetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_pointer_mapping_get */
+}
EAPI Eina_Bool
ecore_x_pointer_grab(Ecore_X_Window win)
return EINA_TRUE;
return EINA_FALSE;
-} /* ecore_x_pointer_grab */
+}
EAPI Eina_Bool
ecore_x_pointer_confine_grab(Ecore_X_Window win)
return EINA_TRUE;
return EINA_FALSE;
-} /* ecore_x_pointer_confine_grab */
+}
EAPI void
ecore_x_pointer_ungrab(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XUngrabPointer(_ecore_x_disp, CurrentTime);
-} /* ecore_x_pointer_ungrab */
+}
EAPI Eina_Bool
ecore_x_pointer_warp(Ecore_X_Window win,
- int x,
- int y)
+ int x,
+ int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_pointer_warp */
+}
EAPI Eina_Bool
ecore_x_keyboard_grab(Ecore_X_Window win)
return EINA_TRUE;
return EINA_FALSE;
-} /* ecore_x_keyboard_grab */
+}
EAPI void
ecore_x_keyboard_ungrab(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XUngrabKeyboard(_ecore_x_disp, CurrentTime);
-} /* ecore_x_keyboard_ungrab */
+}
EAPI void
ecore_x_grab(void)
_ecore_x_grab_count++;
if (_ecore_x_grab_count == 1)
XGrabServer(_ecore_x_disp);
-} /* ecore_x_grab */
+}
EAPI void
ecore_x_ungrab(void)
if (_ecore_x_grab_count == 0)
XUngrabServer(_ecore_x_disp);
-} /* ecore_x_ungrab */
+}
int _ecore_window_grabs_num = 0;
Window *_ecore_window_grabs = NULL;
Eina_Bool (*_ecore_window_grab_replay_func)(void *data,
- int event_type,
+ int event_type,
void *event);
void *_ecore_window_grab_replay_data;
EAPI void
-ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
- int event_type,
- void *event),
- void *data)
+ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event),
+ void *data)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_window_grab_replay_func = func;
_ecore_window_grab_replay_data = data;
-} /* ecore_x_passive_grab_replay_func_set */
+}
EAPI void
-ecore_x_window_button_grab(Ecore_X_Window win,
- int button,
+ecore_x_window_button_grab(Ecore_X_Window win,
+ int button,
Ecore_X_Event_Mask event_mask,
- int mod,
- int any_mod)
+ int mod,
+ int any_mod)
{
unsigned int b;
unsigned int m;
if (!t) return;
_ecore_window_grabs = t;
_ecore_window_grabs[_ecore_window_grabs_num - 1] = win;
-} /* ecore_x_window_button_grab */
+}
void
-_ecore_x_sync_magic_send(int val,
+_ecore_x_sync_magic_send(int val,
Ecore_X_Window swin)
{
XEvent xev;
xev.xclient.data.l[1] = 0x10000000 + val;
xev.xclient.data.l[2] = swin;
XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev);
-} /* _ecore_x_sync_magic_send */
+}
void
_ecore_x_window_grab_remove(Ecore_X_Window win)
_ecore_window_grabs = t;
}
}
-} /* _ecore_x_window_grab_remove */
+}
EAPI void
ecore_x_window_button_ungrab(Ecore_X_Window win,
- int button,
- int mod,
- int any_mod)
+ int button,
+ int mod,
+ int any_mod)
{
unsigned int b;
unsigned int m;
for (i = 0; i < 8; i++)
XUngrabButton(_ecore_x_disp, b, m | locks[i], win);
_ecore_x_sync_magic_send(1, win);
-} /* ecore_x_window_button_ungrab */
+}
int _ecore_key_grabs_num = 0;
Window *_ecore_key_grabs = NULL;
EAPI void
ecore_x_window_key_grab(Ecore_X_Window win,
- const char *key,
- int mod,
- int any_mod)
+ const char *key,
+ int mod,
+ int any_mod)
{
KeyCode keycode = 0;
KeySym keysym;
if (!t) return;
_ecore_key_grabs = t;
_ecore_key_grabs[_ecore_key_grabs_num - 1] = win;
-} /* ecore_x_window_key_grab */
+}
void
_ecore_x_key_grab_remove(Ecore_X_Window win)
_ecore_key_grabs = t;
}
}
-} /* _ecore_x_key_grab_remove */
+}
EAPI void
ecore_x_window_key_ungrab(Ecore_X_Window win,
- const char *key,
- int mod,
- int any_mod)
+ const char *key,
+ int mod,
+ int any_mod)
{
KeyCode keycode = 0;
KeySym keysym;
for (i = 0; i < 8; i++)
XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win);
_ecore_x_sync_magic_send(2, win);
-} /* ecore_x_window_key_ungrab */
+}
/**
* Send client message with given type and format 32.
* @return EINA_TRUE on success EINA_FALSE otherwise.
*/
EAPI Eina_Bool
-ecore_x_client_message32_send(Ecore_X_Window win,
- Ecore_X_Atom type,
+ecore_x_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)
+ long d0,
+ long d1,
+ long d2,
+ long d3,
+ long d4)
{
XEvent xev;
xev.xclient.data.l[4] = d4;
return XSendEvent(_ecore_x_disp, win, False, mask, &xev) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_client_message32_send */
+}
/**
* Send client message with given type and format 8.
*/
EAPI Eina_Bool
ecore_x_client_message8_send(Ecore_X_Window win,
- Ecore_X_Atom type,
- const void *data,
- int len)
+ Ecore_X_Atom type,
+ const void *data,
+ int len)
{
XEvent xev;
memset(xev.xclient.data.b + len, 0, 20 - len);
return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_client_message8_send */
+}
EAPI Eina_Bool
ecore_x_mouse_move_send(Ecore_X_Window win,
- int x,
- int y)
+ int x,
+ int y)
{
XEvent xev;
XWindowAttributes att;
xev.xmotion.is_hint = 0;
xev.xmotion.same_screen = 1;
return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_mouse_move_send */
+}
EAPI Eina_Bool
ecore_x_mouse_down_send(Ecore_X_Window win,
- int x,
- int y,
- int b)
+ int x,
+ int y,
+ int b)
{
XEvent xev;
XWindowAttributes att;
xev.xbutton.button = b;
xev.xbutton.same_screen = 1;
return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_mouse_down_send */
+}
EAPI Eina_Bool
ecore_x_mouse_up_send(Ecore_X_Window win,
- int x,
- int y,
- int b)
+ int x,
+ int y,
+ int b)
{
XEvent xev;
XWindowAttributes att;
xev.xbutton.button = b;
xev.xbutton.same_screen = 1;
return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_mouse_up_send */
+}
EAPI void
ecore_x_focus_reset(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime);
-} /* ecore_x_focus_reset */
+}
EAPI void
ecore_x_events_allow_all(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime);
-} /* ecore_x_events_allow_all */
+}
EAPI void
ecore_x_pointer_last_xy_get(int *x,
if (y)
*y = _ecore_x_event_last_root_y;
-} /* ecore_x_pointer_last_xy_get */
+}
EAPI void
ecore_x_pointer_xy_get(Ecore_X_Window win,
- int *x,
- int *y)
+ int *x,
+ int *y)
{
Window rwin, cwin;
int rx, ry, wx, wy, ret;
if (x) *x = wx;
if (y) *y = wy;
-} /* ecore_x_pointer_xy_get */
+}
/**
* Retrieve the Visual ID from a given Visual.
*/
EAPI Ecore_X_Visual
ecore_x_default_visual_get(Ecore_X_Display *disp,
- Ecore_X_Screen *screen)
+ Ecore_X_Screen *screen)
{
return DefaultVisual(disp, ecore_x_screen_index_get(screen));
}
*/
EAPI Ecore_X_Colormap
ecore_x_default_colormap_get(Ecore_X_Display *disp,
- Ecore_X_Screen *screen)
+ Ecore_X_Screen *screen)
{
return DefaultColormap(disp, ecore_x_screen_index_get(screen));
}
*/
EAPI int
ecore_x_default_depth_get(Ecore_X_Display *disp,
- Ecore_X_Screen *screen)
+ Ecore_X_Screen *screen)
{
return DefaultDepth(disp, ecore_x_screen_index_get(screen));
}
xmodifiers |= ECORE_X_LOCK_SHIFT;
return xmodifiers;
-} /* _ecore_x_event_modifier */
+}
{ "_E_PARENT_BORDER_WINDOW", &ECORE_X_ATOM_E_PARENT_BORDER_WINDOW },
{ "_E_COMP_DRI_BUFF_FLIP_SUPPORTED", &ECORE_X_ATOM_E_COMP_DRI_BUFF_FLIP_SUPPORTED },
- /* added by doyoun.kang 100218 - for rotation */
+ /* for rotation */
{ "_E_ILLUME_ROTATE_WINDOW_ANGLE", & ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
{ "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", & ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
{ "_E_ILLUME_ROTATE_OPERATOR", & ECORE_X_ATOM_E_ILLUME_ROTATE_OPERATOR },
{ "_E_ILLUME_ROTATE_ROOT_ANGLE", & ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
- /* added by doyoun.kang - for user created window */
+ /* for user created window */
{ "_ECORE_X_USER_CREATED_WINDOW", & ECORE_X_ATOM_USER_CREATED_WINDOW },
- /* added by gl77.lee - XID that points to the parent border window */
+ /* XID that points to the parent border window */
{ "_ECORE_X_PARENT_BORDER_WINDOW", &ECORE_X_ATOM_PARENT_BORDER_WINDOW },
- /* added by doyoun.kang - for indicator's state */
+ /* for indicator's state */
{ "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
{ "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
{ "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
{ "_E_ILLUME_ROTATE_OPERATOR", &ECORE_X_ATOM_E_ILLUME_ROTATE_OPERATOR },
{ "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
- /* added by doyoun.kang - for sliding window */
+ /* for sliding window */
{ "_E_ILLUME_SLIDING_WIN_STATE", &ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_STATE },
- { "_E_ILLUME_SLIDING_WIN_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY }
+ { "_E_ILLUME_SLIDING_WIN_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY },
+
+ /* for illume window state */
+ { "_E_ILLUME_WINDOW_STATE", &ECORE_X_ATOM_E_ILLUME_WINDOW_STATE },
+ { "_E_ILLUME_WINDOW_STATE_NORMAL", &ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL },
+ { "_E_ILLUME_WINDOW_STATE_INSET", &ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_INSET },
+
+ /* for SDB(Samsung Debug Bridge) */
+ { "_SDB_SERVER_CONNECT", &ECORE_X_ATOM_SDB_SERVER_CONNECT },
+ { "_SDB_SERVER_DISCONNECT", &ECORE_X_ATOM_SDB_SERVER_DISCONNECT }
};
Atom *atoms;
char **names;
num = sizeof(items) / sizeof(Atom_Item);
atoms = alloca(num * sizeof(Atom));
names = alloca(num * sizeof(char *));
- for (i = 0; i < num; i++) names[i] = (char *)items[i].name;
+ for (i = 0; i < num; i++)
+ names[i] = (char *)items[i].name;
XInternAtoms(_ecore_x_disp, names, num, False, atoms);
- for (i = 0; i < num; i++) *(items[i].atom) = atoms[i];
-} /* _ecore_x_atoms_init */
+ for (i = 0; i < num; i++)
+ *(items[i].atom) = atoms[i];
+}
/**
* Retrieves the atom value associated with the given name.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XInternAtom(_ecore_x_disp, name, False);
-} /* ecore_x_atom_get */
+}
EAPI void
-ecore_x_atoms_get(const char **names,
- int num,
+ecore_x_atoms_get(const char **names,
+ int num,
Ecore_X_Atom *atoms)
{
Atom *atoms_int;
XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
for (i = 0; i < num; i++)
atoms[i] = atoms_int[i];
-} /* ecore_x_atoms_get */
+}
EAPI char *
ecore_x_atom_name_get(Ecore_X_Atom atom)
XFree(xname);
return name;
-} /* ecore_x_atom_name_get */
+}
# endif
}
#endif
-} /* _ecore_x_composite_init */
+}
EAPI Eina_Bool
ecore_x_composite_query(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _composite_available;
-} /* ecore_x_composite_query */
+}
EAPI void
-ecore_x_composite_redirect_window(Ecore_X_Window win,
+ecore_x_composite_redirect_window(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- switch(type)
+ switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
- } /* switch */
+ }
XCompositeRedirectWindow(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
-} /* ecore_x_composite_redirect_window */
+}
EAPI void
-ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
+ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- switch(type)
+ switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
- } /* switch */
+ }
XCompositeRedirectSubwindows(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
-} /* ecore_x_composite_redirect_subwindows */
+}
EAPI void
-ecore_x_composite_unredirect_window(Ecore_X_Window win,
+ecore_x_composite_unredirect_window(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- switch(type)
+ switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
- } /* switch */
+ }
XCompositeUnredirectWindow(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
-} /* ecore_x_composite_unredirect_window */
+}
EAPI void
-ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
+ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- switch(type)
+ switch (type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
update = CompositeRedirectAutomatic;
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
update = CompositeRedirectManual;
break;
- } /* switch */
+ }
XCompositeUnredirectSubwindows(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
-} /* ecore_x_composite_unredirect_subwindows */
+}
EAPI Ecore_X_Pixmap
ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win);
#endif /* ifdef ECORE_XCOMPOSITE */
return pixmap;
-} /* ecore_x_composite_name_window_pixmap_get */
+}
EAPI void
ecore_x_composite_window_events_disable(Ecore_X_Window win)
ecore_x_composite_window_events_disable(win);
#endif /* ifdef ECORE_XCOMPOSITE */
return win;
-} /* ecore_x_composite_render_window_enable */
+}
EAPI void
ecore_x_composite_render_window_disable(Ecore_X_Window root)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XCompositeReleaseOverlayWindow(_ecore_x_disp, root);
#endif /* ifdef ECORE_XCOMPOSITE */
-} /* ecore_x_composite_render_window_disable */
+}
ecore_x_cursor_color_supported_get(void)
{
return _ecore_x_xcursor;
-} /* ecore_x_cursor_color_supported_get */
+}
EAPI Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window win,
- int *pixels,
- int w,
- int h,
- int hot_x,
- int hot_y)
+ int *pixels,
+ int w,
+ int h,
+ int hot_x,
+ int hot_y)
{
#ifdef ECORE_XCURSOR
LOGFN(__FILE__, __LINE__, __FUNCTION__);
// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff;
// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff;
// b = (((pixels[i] ) & 0xff) * a) / 0xff;
- xci->pixels[i] = pixels[i];
+ xci->pixels[i] = pixels[i];
// (a << 24) | (r << 16) | (g << 8) | (b);
}
c = XcursorImageLoadCursor(_ecore_x_disp, xci);
}
return 0;
-} /* ecore_x_cursor_new */
+}
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor c)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFreeCursor(_ecore_x_disp, c);
-} /* ecore_x_cursor_free */
+}
/*
* Returns the cursor for the given shape.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* Shapes are defined in Ecore_X_Cursor.h */
return XCreateFontCursor(_ecore_x_disp, shape);
-} /* ecore_x_cursor_shape_get */
+}
EAPI void
ecore_x_cursor_size_set(int size)
#else /* ifdef ECORE_XCURSOR */
size = 0;
#endif /* ifdef ECORE_XCURSOR */
-} /* ecore_x_cursor_size_set */
+}
EAPI int
ecore_x_cursor_size_get(void)
#else /* ifdef ECORE_XCURSOR */
return 0;
#endif /* ifdef ECORE_XCURSOR */
-} /* ecore_x_cursor_size_get */
+}
#else /* ifdef ECORE_XDAMAGE */
_damage_available = EINA_FALSE;
#endif /* ifdef ECORE_XDAMAGE */
-} /* _ecore_x_damage_init */
+}
EAPI Eina_Bool
ecore_x_damage_query(void)
{
return _damage_available;
-} /* ecore_x_damage_query */
+}
EAPI Ecore_X_Damage
-ecore_x_damage_new(Ecore_X_Drawable d,
+ecore_x_damage_new(Ecore_X_Drawable d,
Ecore_X_Damage_Report_Level level)
{
#ifdef ECORE_XDAMAGE
#else /* ifdef ECORE_XDAMAGE */
return 0;
#endif /* ifdef ECORE_XDAMAGE */
-} /* ecore_x_damage_new */
+}
EAPI void
ecore_x_damage_free(Ecore_X_Damage damage)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDamageDestroy(_ecore_x_disp, damage);
#endif /* ifdef ECORE_XDAMAGE */
-} /* ecore_x_damage_free */
+}
EAPI void
ecore_x_damage_subtract(Ecore_X_Damage damage,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDamageSubtract(_ecore_x_disp, damage, repair, parts);
#endif /* ifdef ECORE_XDAMAGE */
-} /* ecore_x_damage_subtract */
+}
}
_ecore_x_dnd_init_count++;
-} /* _ecore_x_dnd_init */
+}
void
_ecore_x_dnd_shutdown(void)
_target = NULL;
_ecore_x_dnd_init_count = 0;
-} /* _ecore_x_dnd_shutdown */
+}
static Eina_Bool
-_ecore_x_dnd_converter_copy(char *target __UNUSED__,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
+_ecore_x_dnd_converter_copy(char *target __UNUSED__,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
Ecore_X_Atom *tprop __UNUSED__,
- int *count __UNUSED__)
+ int *count __UNUSED__)
{
XTextProperty text_prop;
char *mystr;
free(mystr);
return EINA_FALSE;
}
-} /* _ecore_x_dnd_converter_copy */
+}
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window win,
- Eina_Bool on)
+ Eina_Bool on)
{
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
XA_ATOM, 32, &prop_data, 1);
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
-} /* ecore_x_dnd_aware_set */
+}
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window win)
}
return 0;
-} /* ecore_x_dnd_version_get */
+}
EAPI Eina_Bool
ecore_x_dnd_type_isset(Ecore_X_Window win,
- const char *type)
+ const char *type)
{
int num, i, ret = EINA_FALSE;
unsigned char *data;
XFree(data);
return ret;
-} /* ecore_x_dnd_type_isset */
+}
EAPI void
ecore_x_dnd_type_set(Ecore_X_Window win,
- const char *type,
- Eina_Bool on)
+ const char *type,
+ Eina_Bool on)
{
Ecore_X_Atom atom;
Ecore_X_Atom *oldset = NULL, *newset = NULL;
XFree(oldset);
free(newset);
-} /* ecore_x_dnd_type_set */
+}
EAPI void
ecore_x_dnd_types_set(Ecore_X_Window win,
- const char **types,
- unsigned int num_types)
+ const char **types,
+ unsigned int num_types)
{
Ecore_X_Atom *newset = NULL;
unsigned int i;
XA_ATOM, 32, data, num_types);
free(newset);
}
-} /* ecore_x_dnd_types_set */
+}
EAPI void
ecore_x_dnd_actions_set(Ecore_X_Window win,
- Ecore_X_Atom *actions,
- unsigned int num_actions)
+ Ecore_X_Atom *actions,
+ unsigned int num_actions)
{
unsigned int i;
unsigned char *data = NULL;
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST,
XA_ATOM, 32, data, num_actions);
}
-} /* ecore_x_dnd_actions_set */
+}
/**
* The DND position update cb is called Ecore_X sends a DND position to a
*/
EAPI void
ecore_x_dnd_callback_pos_update_set(
- void (*cb)(void *,
- Ecore_X_Xdnd_Position *data),
- const void *data)
+ void (*cb)(void *,
+ Ecore_X_Xdnd_Position *data),
+ const void *data)
{
_posupdatecb = cb;
_posupdatedata = (void *)data; /* Discard the const early */
_ecore_x_dnd_source_get(void)
{
return _source;
-} /* _ecore_x_dnd_source_get */
+}
Ecore_X_DND_Target *
_ecore_x_dnd_target_get(void)
{
return _target;
-} /* _ecore_x_dnd_target_get */
+}
EAPI Eina_Bool
ecore_x_dnd_begin(Ecore_X_Window source,
unsigned char *data,
- int size)
+ int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ecore_x_dnd_version_get(source))
_source->dest = None;
return EINA_TRUE;
-} /* ecore_x_dnd_begin */
+}
EAPI Eina_Bool
ecore_x_dnd_drop(void)
else
{
/* Dropping on nothing */
- ecore_x_selection_xdnd_clear();
- _source->state = ECORE_X_DND_SOURCE_IDLE;
+ ecore_x_selection_xdnd_clear();
+ _source->state = ECORE_X_DND_SOURCE_IDLE;
}
ecore_x_window_ignore_set(_source->win, 0);
_source->prev.window = 0;
return status;
-} /* ecore_x_dnd_drop */
+}
EAPI void
-ecore_x_dnd_send_status(Eina_Bool will_accept,
- Eina_Bool suppress,
+ecore_x_dnd_send_status(Eina_Bool will_accept,
+ Eina_Bool suppress,
Ecore_X_Rectangle rectangle,
- Ecore_X_Atom action)
+ Ecore_X_Atom action)
{
XEvent xev;
}
XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
-} /* ecore_x_dnd_send_status */
+}
EAPI void
ecore_x_dnd_send_finished(void)
XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
_target->state = ECORE_X_DND_TARGET_IDLE;
-} /* ecore_x_dnd_send_finished */
+}
EAPI void
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
_source->action = action;
if (_source->prev.window)
_ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
-} /* ecore_x_dnd_source_action_set */
+}
EAPI Ecore_X_Atom
ecore_x_dnd_source_action_get(void)
{
return _source->action;
-} /* ecore_x_dnd_source_action_get */
+}
void
_ecore_x_dnd_drag(Ecore_X_Window root,
- int x,
- int y)
+ int x,
+ int y)
{
XEvent xev;
Ecore_X_Window win;
_source->prev.y = y;
_source->prev.window = root;
_source->dest = win;
-} /* _ecore_x_dnd_drag */
+}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
#else /* ifdef ECORE_XDPMS */
_dpms_available = EINA_FALSE;
#endif /* ifdef ECORE_XDPMS */
-} /* _ecore_x_dpms_init */
+}
/**
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
ecore_x_dpms_query(void)
{
return _dpms_available;
-} /* ecore_x_dpms_query */
+}
/**
* Checks if the X server is capable of DPMS.
#else /* ifdef ECORE_XDPMS */
return EINA_FALSE;
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_capable_get */
+}
/**
* Checks the DPMS state of the display.
#else /* ifdef ECORE_XDPMS */
return EINA_FALSE;
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_enabled_get */
+}
/**
* Sets the DPMS state of the display.
DPMSDisable(_ecore_x_disp);
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_enabled_set */
+}
/**
* Gets the timeouts. The values are in unit of seconds.
DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
(unsigned short *)suspend, (unsigned short *)off);
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeouts_get */
+}
/**
* Sets the timeouts. The values are in unit of seconds.
#else /* ifdef ECORE_XDPMS */
return EINA_FALSE;
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeouts_set */
+}
/**
* Returns the amount of time of inactivity before standby mode is invoked.
#else /* ifdef ECORE_XDPMS */
return 0;
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeout_standby_get */
+}
/**
* Returns the amount of time of inactivity before the second level of
#else /* ifdef ECORE_XDPMS */
return 0;
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeout_suspend_get */
+}
/**
* Returns the amount of time of inactivity before the third and final
#else /* ifdef ECORE_XDPMS */
return 0;
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeout_off_get */
+}
/**
* Sets the standby timeout (in unit of seconds).
- * @param new_standby Amount of time of inactivity before standby mode will be invoked.
+ * @param new_timeout Amount of time of inactivity before standby mode will be invoked.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeout_standby_set */
+}
/**
* Sets the suspend timeout (in unit of seconds).
- * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
+ * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeout_suspend_set */
+}
/**
* Sets the off timeout (in unit of seconds).
- * @param off Amount of time of inactivity before the monitor is shut off.
+ * @param new_timeout Amount of time of inactivity before the monitor is shut off.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);
#endif /* ifdef ECORE_XDPMS */
-} /* ecore_x_dpms_timeout_off_set */
+}
*/
EAPI void
ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
Window dummy_win;
int ret_x, ret_y;
if (h)
*h = (int)ret_h;
-} /* ecore_x_drawable_geometry_get */
+}
/**
* Retrieves the width of the border of the given drawable.
border_ret = 0;
return (int)border_ret;
-} /* ecore_x_drawable_border_width_get */
+}
/**
* Retrieves the depth of the given drawable.
depth_ret = 0;
return (int)depth_ret;
-} /* ecore_x_drawable_depth_get */
+}
/**
* Fill the specified rectangle on a drawable.
*/
EAPI void
ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
- Ecore_X_GC gc,
- int x,
- int y,
- int width,
- int height)
+ Ecore_X_GC gc,
+ int x,
+ int y,
+ int width,
+ int height)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height);
-} /* ecore_x_drawable_rectangle_fill */
+}
EAPI void
ecore_x_e_init(void)
{
-} /* ecore_x_e_init */
+}
EAPI void
ecore_x_e_frame_size_set(Ecore_X_Window win,
- int fl,
- int fr,
- int ft,
- int fb)
+ int fl,
+ int fr,
+ int ft,
+ int fb)
{
unsigned int frames[4];
frames[2] = ft;
frames[3] = fb;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4);
-} /* ecore_x_e_frame_size_set */
+}
EAPI void
ecore_x_e_virtual_keyboard_set(Ecore_X_Window win,
- unsigned int is_keyboard)
+ unsigned int is_keyboard)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
&is_keyboard, 1);
-} /* ecore_x_e_virtual_keyboard_set */
+}
EAPI Eina_Bool
ecore_x_e_virtual_keyboard_get(Ecore_X_Window win)
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_e_virtual_keyboard_get */
+}
static Ecore_X_Virtual_Keyboard_State
_ecore_x_e_vkbd_state_get(Ecore_X_Atom atom)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME;
return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
-} /* _ecore_x_e_vkbd_state_get */
+}
static Ecore_X_Atom
_ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state)
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
default: break;
- } /* switch */
+ }
return 0;
-} /* _ecore_x_e_vkbd_atom_get */
+}
EAPI void
-ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win,
+ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win,
Ecore_X_Virtual_Keyboard_State state)
{
Ecore_X_Atom atom = 0;
atom = _ecore_x_e_vkbd_atom_get(state);
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE,
&atom, 1);
-} /* ecore_x_e_virtual_keyboard_state_set */
+}
EAPI Ecore_X_Virtual_Keyboard_State
ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win)
return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
return _ecore_x_e_vkbd_state_get(atom);
-} /* ecore_x_e_virtual_keyboard_state_get */
+}
EAPI void
-ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win,
+ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win,
Ecore_X_Virtual_Keyboard_State state)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
_ecore_x_e_vkbd_atom_get(state),
0, 0, 0, 0);
-} /* ecore_x_e_virtual_keyboard_state_send */
+}
static Ecore_X_Atom
_ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode)
default:
break;
- } /* switch */
+ }
return ECORE_X_ILLUME_MODE_UNKNOWN;
-} /* _ecore_x_e_illume_atom_get */
+}
static Ecore_X_Illume_Mode
_ecore_x_e_illume_mode_get(Ecore_X_Atom atom)
return ECORE_X_ILLUME_MODE_DUAL_LEFT;
return ECORE_X_ILLUME_MODE_UNKNOWN;
-} /* _ecore_x_e_illume_mode_get */
+}
EAPI void
ecore_x_e_illume_zone_set(Ecore_X_Window win,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE,
&zone, 1);
-} /* ecore_x_e_illume_zone_set */
+}
EAPI Ecore_X_Window
ecore_x_e_illume_zone_get(Ecore_X_Window win)
return 0;
return zone;
-} /* ecore_x_e_illume_zone_get */
+}
EAPI void
-ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
+ecore_x_e_illume_zone_list_set(Ecore_X_Window win,
Ecore_X_Window *zones,
- unsigned int n_zones)
+ unsigned int n_zones)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST,
zones, n_zones);
-} /* ecore_x_e_illume_zone_list_set */
+}
EAPI void
ecore_x_e_illume_conformant_set(Ecore_X_Window win,
- unsigned int is_conformant)
+ unsigned int is_conformant)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
&is_conformant, 1);
-} /* ecore_x_e_illume_conformant_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_conformant_get(Ecore_X_Window win)
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_e_illume_conformant_get */
+}
EAPI void
-ecore_x_e_illume_mode_set(Ecore_X_Window win,
+ecore_x_e_illume_mode_set(Ecore_X_Window win,
Ecore_X_Illume_Mode mode)
{
Ecore_X_Atom atom = 0;
atom = _ecore_x_e_illume_atom_get(mode);
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE,
&atom, 1);
-} /* ecore_x_e_illume_mode_set */
+}
EAPI Ecore_X_Illume_Mode
ecore_x_e_illume_mode_get(Ecore_X_Window win)
return ECORE_X_ILLUME_MODE_UNKNOWN;
return _ecore_x_e_illume_mode_get(atom);
-} /* ecore_x_e_illume_mode_get */
+}
EAPI void
-ecore_x_e_illume_mode_send(Ecore_X_Window win,
+ecore_x_e_illume_mode_send(Ecore_X_Window win,
Ecore_X_Illume_Mode mode)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
_ecore_x_e_illume_atom_get(mode),
0, 0, 0, 0);
-} /* ecore_x_e_illume_mode_send */
+}
EAPI void
ecore_x_e_illume_focus_back_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_focus_back_send */
+}
EAPI void
ecore_x_e_illume_focus_forward_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_focus_forward_send */
+}
EAPI void
ecore_x_e_illume_focus_home_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_focus_home_send */
+}
EAPI void
ecore_x_e_illume_close_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_close_send */
+}
EAPI void
ecore_x_e_illume_home_new_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_home_new_send */
+}
EAPI void
ecore_x_e_illume_home_del_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_home_del_send */
+}
EAPI void
ecore_x_e_illume_drag_set(Ecore_X_Window win,
- unsigned int drag)
+ unsigned int drag)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1);
-} /* ecore_x_e_illume_drag_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_drag_get(Ecore_X_Window win)
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_e_illume_drag_get */
+}
EAPI void
ecore_x_e_illume_drag_locked_set(Ecore_X_Window win,
- unsigned int is_locked)
+ unsigned int is_locked)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
&is_locked, 1);
-} /* ecore_x_e_illume_drag_locked_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_drag_locked_get(Ecore_X_Window win)
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_e_illume_drag_locked_get */
+}
EAPI void
ecore_x_e_illume_drag_start_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_drag_start_send */
+}
EAPI void
ecore_x_e_illume_drag_end_send(Ecore_X_Window win)
ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_drag_end_send */
+}
EAPI void
ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
unsigned int geom[4];
geom[3] = h;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
geom, 4);
-} /* ecore_x_e_illume_indicator_geometry_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
int ret = 0;
unsigned int geom[4];
*h = geom[3];
return EINA_TRUE;
-} /* ecore_x_e_illume_indicator_geometry_get */
+}
EAPI void
ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
unsigned int geom[4];
geom[3] = h;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
geom, 4);
-} /* ecore_x_e_illume_softkey_geometry_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
int ret = 0;
unsigned int geom[4];
*h = geom[3];
return EINA_TRUE;
-} /* ecore_x_e_illume_softkey_geometry_get */
+}
EAPI void
ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
unsigned int geom[4];
geom[3] = h;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
geom, 4);
-} /* ecore_x_e_illume_keyboard_geometry_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
int ret = 0;
unsigned int geom[4];
*h = geom[3];
return EINA_TRUE;
-} /* ecore_x_e_illume_keyboard_geometry_get */
+}
static Ecore_X_Atom
_ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state)
default:
break;
- } /* switch */
+ }
return 0;
-} /* _ecore_x_e_quickpanel_atom_get */
+}
static Ecore_X_Illume_Quickpanel_State
_ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom)
return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF;
return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
-} /* _ecore_x_e_quickpanel_state_get */
+}
EAPI void
ecore_x_e_illume_quickpanel_set(Ecore_X_Window win,
- unsigned int is_quickpanel)
+ unsigned int is_quickpanel)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
&is_quickpanel, 1);
-} /* ecore_x_e_illume_quickpanel_set */
+}
EAPI Eina_Bool
ecore_x_e_illume_quickpanel_get(Ecore_X_Window win)
return EINA_FALSE;
return val ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_e_illume_quickpanel_get */
+}
EAPI void
-ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win,
+ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win,
Ecore_X_Illume_Quickpanel_State state)
{
Ecore_X_Atom atom = 0;
atom = _ecore_x_e_quickpanel_atom_get(state);
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE,
&atom, 1);
-} /* ecore_x_e_illume_quickpanel_state_set */
+}
EAPI Ecore_X_Illume_Quickpanel_State
ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win)
return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
return _ecore_x_e_quickpanel_state_get(atom);
-} /* ecore_x_e_illume_quickpanel_state_get */
+}
EAPI void
-ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win,
+ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win,
Ecore_X_Illume_Quickpanel_State state)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
_ecore_x_e_quickpanel_atom_get(state),
0, 0, 0, 0);
-} /* ecore_x_e_illume_quickpanel_state_send */
+}
EAPI void
ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win)
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
0, 0, 0, 0, 0);
-} /* ecore_x_e_illume_quickpanel_state_toggle */
+}
EAPI void
ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win,
- unsigned int priority)
+ unsigned int priority)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
&priority, 1);
-} /* ecore_x_e_illume_quickpanel_priority_major_set */
+}
EAPI int
ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win)
return 0;
return val;
-} /* ecore_x_e_illume_quickpanel_priority_major_get */
+}
EAPI void
ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win,
- unsigned int priority)
+ unsigned int priority)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
&priority, 1);
-} /* ecore_x_e_illume_quickpanel_priority_minor_set */
+}
EAPI int
ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win)
return 0;
return val;
-} /* ecore_x_e_illume_quickpanel_priority_minor_get */
+}
EAPI void
ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win,
- unsigned int zone)
+ unsigned int zone)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
&zone, 1);
-} /* ecore_x_e_illume_quickpanel_zone_set */
+}
EAPI int
ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win)
return 0;
return val;
-} /* ecore_x_e_illume_quickpanel_zone_get */
+}
EAPI void
ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win)
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1, 0, 0, 0, 0);
-} /* ecore_x_e_illume_quickpanel_position_update_send */
+}
-/* added by doyoun.kang - for sliding window */
+/* for sliding window */
EAPI void
ecore_x_e_illume_sliding_win_state_set(Ecore_X_Window win,
unsigned int is_visible)
}/* ecore_x_e_illume_sliding_win_geometry_get */
EAPI void
-ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
+ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
Ecore_X_Sync_Counter counter)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ECORE_X_ATOM_CARDINAL, &counter, 1);
else
ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER);
-} /* ecore_x_e_comp_sync_counter_set */
+}
EAPI Ecore_X_Sync_Counter
ecore_x_e_comp_sync_counter_get(Ecore_X_Window win)
return 0;
return counter;
-} /* ecore_x_e_comp_sync_counter_get */
+}
EAPI void
ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
XSendEvent(_ecore_x_disp, root, False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_sync_draw_done_send */
+}
EAPI void
ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
Ecore_X_Window win,
- int w,
- int h)
+ int w,
+ int h)
{
XEvent xev;
XSendEvent(_ecore_x_disp, root, False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_sync_draw_done_send */
+}
EAPI void
ecore_x_e_comp_sync_supported_set(Ecore_X_Window root,
- Eina_Bool enabled)
+ Eina_Bool enabled)
{
Ecore_X_Window win;
ecore_x_window_free(win);
}
}
-} /* ecore_x_e_comp_sync_supported_set */
+}
EAPI Eina_Bool
ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
}
return EINA_FALSE;
-} /* ecore_x_e_comp_sync_supported_get */
+}
EAPI void
ecore_x_e_comp_sync_begin_send(Ecore_X_Window win)
XSendEvent(_ecore_x_disp, win, False,
NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_sync_begin_send */
+}
EAPI void
ecore_x_e_comp_sync_end_send(Ecore_X_Window win)
XSendEvent(_ecore_x_disp, win, False,
NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_sync_end_send */
+}
EAPI void
ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win)
XSendEvent(_ecore_x_disp, win, False,
NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_sync_cancel_send */
+}
EAPI void
ecore_x_e_comp_flush_send(Ecore_X_Window win)
XSendEvent(_ecore_x_disp, win, False,
NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_flush_send */
+}
EAPI void
ecore_x_e_comp_dump_send(Ecore_X_Window win)
XSendEvent(_ecore_x_disp, win, False,
NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-} /* ecore_x_e_comp_dump_send */
+}
EAPI void
ecore_x_e_comp_pixmap_set(Ecore_X_Window win,
ECORE_X_ATOM_PIXMAP, &pixmap, 1);
else
ecore_x_window_prop_property_del(win, pixmap);
-} /* ecore_x_e_comp_pixmap_set */
+}
EAPI Ecore_X_Pixmap
ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
return 0;
return pixmap;
-} /* ecore_x_e_comp_pixmap_get */
+}
EAPI void
ecore_x_e_comp_dri_buff_flip_supported_set(Ecore_X_Window root, Eina_Bool enabled)
}
return EINA_FALSE;
}
+
+static Ecore_X_Atom
+_ecore_x_e_illume_window_state_atom_get(Ecore_X_Illume_Window_State state)
+{
+ switch (state)
+ {
+ case ECORE_X_ILLUME_WINDOW_STATE_NORMAL:
+ return ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL;
+
+ case ECORE_X_ILLUME_WINDOW_STATE_INSET:
+ return ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_INSET;
+
+ default:
+ break;
+ }
+ return 0;
+}
+
+static Ecore_X_Illume_Window_State
+_ecore_x_e_illume_window_state_get(Ecore_X_Atom atom)
+{
+ if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_NORMAL)
+ return ECORE_X_ILLUME_WINDOW_STATE_NORMAL;
+
+ if (atom == ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_INSET)
+ return ECORE_X_ILLUME_WINDOW_STATE_INSET;
+
+ return ECORE_X_ILLUME_WINDOW_STATE_NORMAL;
+}
+
+EAPI void
+ecore_x_e_illume_window_state_set(Ecore_X_Window win,
+ Ecore_X_Illume_Window_State state)
+{
+ Ecore_X_Atom atom = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ atom = _ecore_x_e_illume_window_state_atom_get(state);
+ ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_WINDOW_STATE,
+ &atom, 1);
+}
+
+EAPI Ecore_X_Illume_Window_State
+ecore_x_e_illume_window_state_get(Ecore_X_Window win)
+{
+ Ecore_X_Atom atom;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!ecore_x_window_prop_atom_get(win,
+ ECORE_X_ATOM_E_ILLUME_WINDOW_STATE,
+ &atom, 1))
+ return ECORE_X_ILLUME_WINDOW_STATE_NORMAL;
+
+ return _ecore_x_e_illume_window_state_get(atom);
+}
+
#include "ecore_x_private.h"
#include "Ecore_X.h"
-static int _ecore_x_error_handle(Display *d,
+static int _ecore_x_error_handle(Display *d,
XErrorEvent *ev);
static int _ecore_x_io_error_handle(Display *d);
static void *_io_error_data = NULL;
static int _error_request_code = 0;
static int _error_code = 0;
+static Ecore_X_ID _error_resource_id = 0;
/**
* Set the error handler.
* Set the X error handler function
*/
EAPI void
-ecore_x_error_handler_set(void (*func)(void *data),
+ecore_x_error_handler_set(void (*func)(void *data),
const void *data)
{
_error_func = func;
_error_data = (void *)data;
-} /* ecore_x_error_handler_set */
+}
/**
* Set the I/O error handler.
* Set the X I/O error handler function
*/
EAPI void
-ecore_x_io_error_handler_set(void (*func)(void *data),
+ecore_x_io_error_handler_set(void (*func)(void *data),
const void *data)
{
_io_error_func = func;
_io_error_data = (void *)data;
-} /* ecore_x_io_error_handler_set */
+}
/**
* Get the request code that caused the error.
ecore_x_error_request_get(void)
{
return _error_request_code;
-} /* ecore_x_error_request_get */
+}
/**
* Get the error code from the error.
ecore_x_error_code_get(void)
{
return _error_code;
-} /* ecore_x_error_code_get */
+}
+
+/**
+ * Get the resource id that caused the error.
+ * @return The resource id causing the X error
+ *
+ * Return the X resource id that caused the last X error
+ */
+EAPI Ecore_X_ID
+ecore_x_error_resource_id_get(void)
+{
+ return _error_resource_id;
+}
void
_ecore_x_error_handler_init(void)
{
XSetErrorHandler((XErrorHandler)_ecore_x_error_handle);
XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle);
-} /* _ecore_x_error_handler_init */
+}
static int
-_ecore_x_error_handle(Display *d,
+_ecore_x_error_handle(Display *d,
XErrorEvent *ev)
{
if (d == _ecore_x_disp)
{
_error_request_code = ev->request_code;
_error_code = ev->error_code;
+ _error_resource_id = ev->resourceid;
if (_error_func)
_error_func(_error_data);
}
return 0;
-} /* _ecore_x_error_handle */
+}
static int
_ecore_x_io_error_handle(Display *d)
}
return 0;
-} /* _ecore_x_io_error_handle */
+}
}
free(e);
-} /* _ecore_x_event_free_mouse_move */
+}
EAPI void
-ecore_x_event_mask_set(Ecore_X_Window w,
+ecore_x_event_mask_set(Ecore_X_Window w,
Ecore_X_Event_Mask mask)
{
XWindowAttributes attr;
XGetWindowAttributes(_ecore_x_disp, w, &attr);
s_attr.event_mask = mask | attr.your_event_mask;
XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
-} /* ecore_x_event_mask_set */
+}
EAPI void
-ecore_x_event_mask_unset(Ecore_X_Window w,
+ecore_x_event_mask_unset(Ecore_X_Window w,
Ecore_X_Event_Mask mask)
{
XWindowAttributes attr;
XGetWindowAttributes(_ecore_x_disp, w, &attr);
s_attr.event_mask = attr.your_event_mask & ~mask;
XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
-} /* ecore_x_event_mask_unset */
+}
static void
_ecore_x_event_free_xdnd_enter(void *data __UNUSED__,
XFree(e->types[i]);
free(e->types);
free(e);
-} /* _ecore_x_event_free_xdnd_enter */
+}
static void
_ecore_x_event_free_selection_notify(void *data __UNUSED__,
free(e->target);
free(e);
-} /* _ecore_x_event_free_selection_notify */
+}
static unsigned int
_ecore_x_event_modifiers(unsigned int state)
modifiers |= ECORE_EVENT_LOCK_SHIFT;
return modifiers;
-} /* _ecore_x_event_modifiers */
+}
void
_ecore_mouse_move(unsigned int timestamp,
unsigned int xmodifiers,
- int x,
- int y,
- int x_root,
- int y_root,
+ int x,
+ int y,
+ int x_root,
+ int y_root,
unsigned int event_window,
unsigned int window,
unsigned int root_win,
- int same_screen,
- int dev,
- double radx,
- double rady,
- double pressure,
- double angle,
- double mx,
- double my,
- double mrx,
- double mry)
+ int same_screen,
+ int dev,
+ double radx,
+ double rady,
+ double pressure,
+ double angle,
+ double mx,
+ double my,
+ double mrx,
+ double mry)
{
Ecore_Event_Mouse_Move *e;
Ecore_Event *event;
_ecore_x_event_last_root_y = y_root;
_ecore_x_last_event_mouse_move_event = event;
-} /* _ecore_mouse_move */
+}
static void
-_ecore_key_press(int event,
+_ecore_key_press(int event,
XKeyEvent *xevent)
{
Ecore_Event_Key *e;
on_error:
if (tmp)
free(tmp);
-} /* _ecore_key_press */
+}
Ecore_Event_Mouse_Button *
-_ecore_mouse_button(int event,
+_ecore_mouse_button(int event,
unsigned int timestamp,
unsigned int xmodifiers,
unsigned int buttons,
- int x,
- int y,
- int x_root,
- int y_root,
+ int x,
+ int y,
+ int x_root,
+ int y_root,
unsigned int event_window,
unsigned int window,
unsigned int root_win,
- int same_screen,
- int dev,
- double radx,
- double rady,
- double pressure,
- double angle,
- double mx,
- double my,
- double mrx,
- double mry)
+ int same_screen,
+ int dev,
+ double radx,
+ double rady,
+ double pressure,
+ double angle,
+ double mx,
+ double my,
+ double mrx,
+ double mry)
{
Ecore_Event_Mouse_Button *e;
{
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
{
- //Check Double Clicked
- if (((int)(timestamp - down_info->last_time) <=
- (int)(1000 * _ecore_x_double_click_time)) &&
- (window == down_info->last_win) &&
- (event_window == down_info->last_event_win))
- {
- e->double_click = 1;
- down_info->did_double = EINA_TRUE;
- }
- else
- {
- down_info->did_double = EINA_FALSE;
- down_info->did_triple = EINA_FALSE;
- }
-
- //Check Triple Clicked
- if (((int)(timestamp - down_info->last_last_time) <=
- (int)(2 * 1000 * _ecore_x_double_click_time)) &&
- (window == down_info->last_win) &&
- (window == down_info->last_last_win) &&
- (event_window == down_info->last_event_win) &&
- (event_window == down_info->last_last_event_win)
- )
- {
- e->triple_click = 1;
- down_info->did_triple = EINA_TRUE;
- }
- else
- {
- down_info->did_triple = EINA_FALSE;
- }
+ //Check Double Clicked
+ if (((int)(timestamp - down_info->last_time) <=
+ (int)(1000 * _ecore_x_double_click_time)) &&
+ (window == down_info->last_win) &&
+ (event_window == down_info->last_event_win))
+ {
+ e->double_click = 1;
+ down_info->did_double = EINA_TRUE;
+ }
+ else
+ {
+ down_info->did_double = EINA_FALSE;
+ down_info->did_triple = EINA_FALSE;
+ }
+
+ //Check Triple Clicked
+ if (((int)(timestamp - down_info->last_last_time) <=
+ (int)(2 * 1000 * _ecore_x_double_click_time)) &&
+ (window == down_info->last_win) &&
+ (window == down_info->last_last_win) &&
+ (event_window == down_info->last_event_win) &&
+ (event_window == down_info->last_last_event_win)
+ )
+ {
+ e->triple_click = 1;
+ down_info->did_triple = EINA_TRUE;
+ }
+ else
+ {
+ down_info->did_triple = EINA_FALSE;
+ }
}
else
{
}
return e;
-} /* _ecore_mouse_button */
+}
void
_ecore_x_event_handle_any_event(XEvent *xevent)
if (!ev) return;
memcpy(ev, xevent, sizeof(XEvent));
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
-} /* _ecore_x_event_handle_any_event */
+}
void
_ecore_x_event_handle_key_press(XEvent *xevent)
{
_ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent);
-} /* _ecore_x_event_handle_key_press */
+}
void
_ecore_x_event_handle_key_release(XEvent *xevent)
{
_ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent);
-} /* _ecore_x_event_handle_key_release */
+}
void
_ecore_x_event_handle_button_press(XEvent *xevent)
case 7: e->direction = 1; e->z = 1; break;
default: e->direction = 0; e->z = 0; break;
- } /* switch */
+ }
e->x = xevent->xbutton.x;
e->y = xevent->xbutton.y;
}
}
}
-} /* _ecore_x_event_handle_button_press */
+}
void
_ecore_x_event_handle_button_release(XEvent *xevent)
xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.x_root, xevent->xbutton.y_root);
}
-} /* _ecore_x_event_handle_button_release */
+}
void
_ecore_x_event_handle_motion_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move_event = NULL;
}
*/
- _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state,
- xevent->xmotion.x, xevent->xmotion.y,
- xevent->xmotion.x_root, xevent->xmotion.y_root,
- xevent->xmotion.window,
- (xevent->xmotion.subwindow ? xevent->xmotion.subwindow :
- xevent->xmotion.window),
- xevent->xmotion.root,
- xevent->xmotion.same_screen,
- 0, 1, 1,
- 1.0, // pressure
- 0.0, // angle
- xevent->xmotion.x, xevent->xmotion.y,
- xevent->xmotion.x_root, xevent->xmotion.y_root);
-
- _ecore_x_last_event_mouse_move = 1;
-
- /* Xdnd handling */
- _ecore_x_dnd_drag(xevent->xmotion.root,
- xevent->xmotion.x_root,
- xevent->xmotion.y_root);
-} /* _ecore_x_event_handle_motion_notify */
+ _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state,
+ xevent->xmotion.x, xevent->xmotion.y,
+ xevent->xmotion.x_root, xevent->xmotion.y_root,
+ xevent->xmotion.window,
+ (xevent->xmotion.subwindow ? xevent->xmotion.subwindow :
+ xevent->xmotion.window),
+ xevent->xmotion.root,
+ xevent->xmotion.same_screen,
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xmotion.x, xevent->xmotion.y,
+ xevent->xmotion.x_root, xevent->xmotion.y_root);
+
+ _ecore_x_last_event_mouse_move = 1;
+
+ /* Xdnd handling */
+ _ecore_x_dnd_drag(xevent->xmotion.root,
+ xevent->xmotion.x_root,
+ xevent->xmotion.y_root);
+}
void
_ecore_x_event_handle_enter_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
}
-} /* _ecore_x_event_handle_enter_notify */
+}
void
_ecore_x_event_handle_leave_notify(XEvent *xevent)
_ecore_x_event_last_root_y = e->root.y;
ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL);
}
-} /* _ecore_x_event_handle_leave_notify */
+}
void
_ecore_x_event_handle_focus_in(XEvent *xevent)
e->time = _ecore_x_event_last_time;
_ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
-} /* _ecore_x_event_handle_focus_in */
+}
void
_ecore_x_event_handle_focus_out(XEvent *xevent)
e->time = _ecore_x_event_last_time;
_ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
-} /* _ecore_x_event_handle_focus_out */
+}
void
_ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__)
{
_ecore_x_last_event_mouse_move = 0;
/* FIXME: handle this event type */
-} /* _ecore_x_event_handle_keymap_notify */
+}
void
_ecore_x_event_handle_expose(XEvent *xevent)
e->h = xevent->xexpose.height;
e->count = xevent->xexpose.count;
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
-} /* _ecore_x_event_handle_expose */
+}
void
_ecore_x_event_handle_graphics_expose(XEvent *xevent)
e->h = xevent->xgraphicsexpose.height;
e->count = xevent->xgraphicsexpose.count;
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
-} /* _ecore_x_event_handle_graphics_expose */
+}
void
_ecore_x_event_handle_visibility_notify(XEvent *xevent)
ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
}
-} /* _ecore_x_event_handle_visibility_notify */
+}
void
_ecore_x_event_handle_create_notify(XEvent *xevent)
e->border = xevent->xcreatewindow.border_width;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
-} /* _ecore_x_event_handle_create_notify */
+}
void
_ecore_x_event_handle_destroy_notify(XEvent *xevent)
_ecore_x_event_last_win = 0;
ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
-} /* _ecore_x_event_handle_destroy_notify */
+}
void
_ecore_x_event_handle_unmap_notify(XEvent *xevent)
e->event_win = xevent->xunmap.event;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
-} /* _ecore_x_event_handle_unmap_notify */
+}
void
_ecore_x_event_handle_map_notify(XEvent *xevent)
e->event_win = xevent->xmap.event;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
-} /* _ecore_x_event_handle_map_notify */
+}
void
_ecore_x_event_handle_map_request(XEvent *xevent)
e->time = _ecore_x_event_last_time;
e->parent = xevent->xmaprequest.parent;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
-} /* _ecore_x_event_handle_map_request */
+}
void
_ecore_x_event_handle_reparent_notify(XEvent *xevent)
e->parent = xevent->xreparent.parent;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
-} /* _ecore_x_event_handle_reparent_notify */
+}
void
_ecore_x_event_handle_configure_notify(XEvent *xevent)
e->from_wm = xevent->xconfigure.send_event;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
-} /* _ecore_x_event_handle_configure_notify */
+}
void
_ecore_x_event_handle_configure_request(XEvent *xevent)
e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
-} /* _ecore_x_event_handle_configure_request */
+}
void
_ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__)
{
_ecore_x_last_event_mouse_move = 0;
/* FIXME: handle this event type */
-} /* _ecore_x_event_handle_gravity_notify */
+}
void
_ecore_x_event_handle_resize_request(XEvent *xevent)
e->h = xevent->xresizerequest.height;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
-} /* _ecore_x_event_handle_resize_request */
+}
void
_ecore_x_event_handle_circulate_notify(XEvent *xevent)
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
-} /* _ecore_x_event_handle_circulate_notify */
+}
void
_ecore_x_event_handle_circulate_request(XEvent *xevent)
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
-} /* _ecore_x_event_handle_circulate_request */
+}
void
_ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL);
}
-} /* _ecore_x_event_handle_property_notify */
+}
void
_ecore_x_event_handle_selection_clear(XEvent *xevent)
{
// Ecore_X_Selection_Intern *d;
- Ecore_X_Event_Selection_Clear *e;
- Ecore_X_Atom sel;
+ Ecore_X_Event_Selection_Clear *e;
+ Ecore_X_Atom sel;
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_x_last_event_mouse_move = 0;
/* errr..... why? paranoia.
d = _ecore_x_selection_get(xevent->xselectionclear.selection);
if (d && (xevent->xselectionclear.time > d->time))
}
*/
/* Generate event for app cleanup */
- e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
- e->win = xevent->xselectionclear.window;
- e->time = xevent->xselectionclear.time;
- e->atom = sel = xevent->xselectionclear.selection;
- if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
- e->selection = ECORE_X_SELECTION_PRIMARY;
- else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
- else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
- else
- e->selection = ECORE_X_SELECTION_OTHER;
-
- ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
-} /* _ecore_x_event_handle_selection_clear */
+ e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
+ e->win = xevent->xselectionclear.window;
+ e->time = xevent->xselectionclear.time;
+ e->atom = sel = xevent->xselectionclear.selection;
+ if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
+ e->selection = ECORE_X_SELECTION_PRIMARY;
+ else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
+ e->selection = ECORE_X_SELECTION_SECONDARY;
+ else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ else
+ e->selection = ECORE_X_SELECTION_OTHER;
+
+ ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
+}
void
_ecore_x_event_handle_selection_request(XEvent *xevent)
property = None;
else if (data)
{
- /* FIXME: This does not properly handle large data transfers */
- ecore_x_window_prop_property_set(
- xevent->xselectionrequest.requestor,
- xevent->xselectionrequest.
- property,
- type,
- typesize,
- data,
- len);
- property = xevent->xselectionrequest.property;
- free(data);
+ /* FIXME: This does not properly handle large data transfers */
+ ecore_x_window_prop_property_set(
+ xevent->xselectionrequest.requestor,
+ xevent->xselectionrequest.
+ property,
+ type,
+ typesize,
+ data,
+ len);
+ property = xevent->xselectionrequest.property;
+ free(data);
}
ecore_x_selection_notify_send(xevent->xselectionrequest.requestor,
xevent->xselectionrequest.time);
}
}
-} /* _ecore_x_event_handle_selection_request */
+}
void
_ecore_x_event_handle_selection_notify(XEvent *xevent)
ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,
_ecore_x_event_free_selection_notify, NULL);
-} /* _ecore_x_event_handle_selection_notify */
+}
void
_ecore_x_event_handle_colormap_notify(XEvent *xevent)
e->installed = EINA_FALSE;
ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
-} /* _ecore_x_event_handle_colormap_notify */
+}
void
_ecore_x_event_handle_client_message(XEvent *xevent)
if (xevent->xclient.data.l[1] & 0x1UL)
{
/* source supports more than 3 types, fetch property */
- unsigned char *data;
- Ecore_X_Atom *types;
- int i, num_ret;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ecore_x_window_prop_property_get(target->source,
- ECORE_X_ATOM_XDND_TYPE_LIST,
- XA_ATOM,
- 32, &data, &num_ret)))
- {
- WRN(
- "DND: Could not fetch data type list from source window, aborting.");
- free(e);
- return;
- }
-
- types = (Ecore_X_Atom *)data;
- e->types = calloc(num_ret, sizeof(char *));
- if (e->types)
- {
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- for (i = 0; i < num_ret; i++)
- e->types[i] = XGetAtomName(_ecore_x_disp, types[i]);
- }
-
- e->num_types = num_ret;
+ unsigned char *data;
+ Ecore_X_Atom *types;
+ int i, num_ret;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!(ecore_x_window_prop_property_get(target->source,
+ ECORE_X_ATOM_XDND_TYPE_LIST,
+ XA_ATOM,
+ 32, &data, &num_ret)))
+ {
+ WRN(
+ "DND: Could not fetch data type list from source window, aborting.");
+ free(e);
+ return;
+ }
+
+ types = (Ecore_X_Atom *)data;
+ e->types = calloc(num_ret, sizeof(char *));
+ if (e->types)
+ {
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ for (i = 0; i < num_ret; i++)
+ e->types[i] = XGetAtomName(_ecore_x_disp, types[i]);
+ }
+
+ e->num_types = num_ret;
}
else
{
if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
{
// char *name;
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]);
// if (name) ERR("Unknown state: %s", name);
if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
{
// char *name;
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]);
// if (name) ERR("Unknown state: %s", name);
&& (xevent->xclient.window == _ecore_x_private_win))
{
/* a grab sync marker */
- if (xevent->xclient.data.l[1] == 0x10000001)
- _ecore_x_window_grab_remove(xevent->xclient.data.l[2]);
- else if (xevent->xclient.data.l[1] == 0x10000002)
- _ecore_x_key_grab_remove(xevent->xclient.data.l[2]);
+ if (xevent->xclient.data.l[1] == 0x10000001)
+ _ecore_x_window_grab_remove(xevent->xclient.data.l[2]);
+ else if (xevent->xclient.data.l[1] == 0x10000002)
+ _ecore_x_key_grab_remove(xevent->xclient.data.l[2]);
}
else
{
ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
}
-} /* _ecore_x_event_handle_client_message */
+}
void
_ecore_x_event_handle_mapping_notify(XEvent *xevent)
e->keycode = xevent->xmapping.first_keycode;
e->num = xevent->xmapping.count;
ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL);
-} /* _ecore_x_event_handle_mapping_notify */
+}
void
_ecore_x_event_handle_shape_change(XEvent *xevent)
e->h = shape_event->height;
e->shaped = shape_event->shaped;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
-} /* _ecore_x_event_handle_shape_change */
+}
void
_ecore_x_event_handle_screensaver_notify(XEvent *xevent)
#else /* ifdef ECORE_XSS */
xevent = NULL;
#endif /* ifdef ECORE_XSS */
-} /* _ecore_x_event_handle_screensaver_notify */
+}
void
_ecore_x_event_handle_sync_counter(XEvent *xevent)
e->time = sync_counter_event->time;
ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
-} /* _ecore_x_event_handle_sync_counter */
+}
void
_ecore_x_event_handle_sync_alarm(XEvent *xevent)
e->time = sync_alarm_event->time;
e->alarm = sync_alarm_event->alarm;
ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
-} /* _ecore_x_event_handle_sync_alarm */
+}
#ifdef ECORE_XRANDR
void
e->orientation = randr_event->rotation;
e->subpixel_order = randr_event->subpixel_order;
ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL);
-} /* _ecore_x_event_handle_randr_change */
+}
static void
_ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent)
e->geo.w = randr_event->width;
e->geo.h = randr_event->height;
ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL);
-} /* _ecore_x_event_handle_randr_notify_crtc_change */
+}
static void
_ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent)
e->connection = randr_event->connection;
e->subpixel_order = randr_event->subpixel_order;
ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL);
-} /* _ecore_x_event_handle_randr_notify_output_change */
+}
static void
_ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent)
else
e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL;
ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL);
-} /* _ecore_x_event_handle_randr_notify_output_property */
+}
void
_ecore_x_event_handle_randr_notify(XEvent *xevent)
ERR("Unknown XRandR RRNotify subtype: %d.",
randr_event->subtype);
break;
- } /* switch */
-} /* _ecore_x_event_handle_randr_notify */
+ }
+}
#endif /* ifdef ECORE_XRANDR */
e->reason = notify_event->subtype;
ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL);
-} /* _ecore_x_event_handle_fixes_selection_notify */
+}
#endif /* ifdef ECORE_XFIXES */
e->geometry.height = damage_event->geometry.height;
ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);
-} /* _ecore_x_event_handle_damage_notify */
+}
#endif /* ifdef ECORE_XDAMAGE */
return;
data = NULL; ev = NULL;
#endif /* ifdef ECORE_XI2 */
-} /* _ecore_x_event_free_generic_event */
+}
void
_ecore_x_event_handle_generic_event(XEvent *event)
return;
event = NULL;
#endif /* ifdef ECORE_XI2 */
-} /* _ecore_x_event_handle_generic_event */
+}
#ifdef ECORE_XGESTURE
void
xfe = (XGestureNotifyFlickEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick));
if (!e)
- return;
+ return;
e->win = xfe->window;
e->time = xfe->time;
xpe = (XGestureNotifyPanEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan));
if (!e)
- return;
+ return;
e->win = xpe->window;
e->time = xpe->time;
xpre = (XGestureNotifyPinchRotationEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation));
if (!e)
- return;
+ return;
e->win = xpre->window;
e->time = xpre->time;
xte = (XGestureNotifyTapEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap));
if (!e)
- return;
+ return;
e->win = xte->window;
e->time = xte->time;
xthe = (XGestureNotifyTapNHoldEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold));
if (!e)
- return;
+ return;
e->win = xthe->window;
e->time = xthe->time;
}
void
- _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent)
+_ecore_x_event_handle_gesture_notify_hold(XEvent *xevent)
{
XGestureNotifyHoldEvent *xhe;
Ecore_X_Event_Gesture_Notify_Hold *e;
xhe = (XGestureNotifyHoldEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold));
if (!e)
- return;
+ return;
e->win = xhe->window;
e->time = xhe->time;
}
void
- _ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
+_ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
{
XGestureNotifyGroupEvent *xge;
Ecore_X_Event_Gesture_Notify_Group *e;
xge = (XGestureNotifyGroupEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group));
if (!e)
- return;
+ return;
e->win = xge->window;
e->time = xge->time;
ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL);
}
+
#endif /* ifdef ECORE_XGESTURE */
#else /* ifdef ECORE_XFIXES */
_fixes_available = 0;
#endif /* ifdef ECORE_XFIXES */
-} /* _ecore_x_fixes_init */
+}
#ifdef ECORE_XFIXES
/* I don't know what to call this function. */
static XRectangle *
_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
XRectangle *xrect;
int i;
xrect[i].height = rects[i].height;
}
return xrect;
-} /* _ecore_x_rectangle_ecore_to_x */
+}
static Ecore_X_Rectangle *
_ecore_x_rectangle_x_to_ecore(XRectangle *xrect,
- int num)
+ int num)
{
Ecore_X_Rectangle *rects;
int i;
rects[i].height = xrect[i].height;
}
return rects;
-} /* _ecore_x_rectangle_x_to_ecore */
+}
#endif /* ifdef ECORE_XFIXES */
EAPI Ecore_X_Region
ecore_x_region_new(Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
#ifdef ECORE_XFIXES
Ecore_X_Region region;
#else /* ifdef ECORE_XFIXES */
return 0;
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_new */
+}
EAPI Ecore_X_Region
ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
#else /* ifdef ECORE_XFIXES */
return 0;
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_new_from_bitmap */
+}
EAPI Ecore_X_Region
-ecore_x_region_new_from_window(Ecore_X_Window win,
+ecore_x_region_new_from_window(Ecore_X_Window win,
Ecore_X_Region_Type type)
{
#ifdef ECORE_XFIXES
#else /* ifdef ECORE_XFIXES */
return 0;
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_new_from_window */
+}
EAPI Ecore_X_Region
ecore_x_region_new_from_gc(Ecore_X_GC gc)
#else /* ifdef ECORE_XFIXES */
return 0;
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_new_from_gc */
+}
EAPI Ecore_X_Region
ecore_x_region_new_from_picture(Ecore_X_Picture picture)
#else /* ifdef ECORE_XFIXES */
return 0;
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_new_from_picture */
+}
EAPI void
ecore_x_region_free(Ecore_X_Region region)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesDestroyRegion(_ecore_x_disp, region);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_free */
+}
EAPI void
-ecore_x_region_set(Ecore_X_Region region,
+ecore_x_region_set(Ecore_X_Region region,
Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
#ifdef ECORE_XFIXES
XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesSetRegion(_ecore_x_disp, region, xrect, num);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_set */
+}
EAPI void
ecore_x_region_copy(Ecore_X_Region dest,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesCopyRegion(_ecore_x_disp, dest, source);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_copy */
+}
EAPI void
ecore_x_region_combine(Ecore_X_Region dest,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesUnionRegion(_ecore_x_disp, dest, source1, source2);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_combine */
+}
EAPI void
ecore_x_region_intersect(Ecore_X_Region dest,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_intersect */
+}
EAPI void
ecore_x_region_subtract(Ecore_X_Region dest,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_subtract */
+}
EAPI void
-ecore_x_region_invert(Ecore_X_Region dest,
+ecore_x_region_invert(Ecore_X_Region dest,
Ecore_X_Rectangle *bounds,
- Ecore_X_Region source)
+ Ecore_X_Region source)
{
#ifdef ECORE_XFIXES
XRectangle *xbound;
int num = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- while (bounds + num) num++;
+ while (bounds + num)
+ num++;
xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_invert */
+}
EAPI void
ecore_x_region_translate(Ecore_X_Region region,
- int dx,
- int dy)
+ int dx,
+ int dy)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesTranslateRegion(_ecore_x_disp, region, dx, dy);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_translate */
+}
EAPI void
ecore_x_region_extents(Ecore_X_Region dest,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesRegionExtents(_ecore_x_disp, dest, source);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_extents */
+}
EAPI Ecore_X_Rectangle *
-ecore_x_region_fetch(Ecore_X_Region region,
- int *num,
+ecore_x_region_fetch(Ecore_X_Region region,
+ int *num,
Ecore_X_Rectangle *bounds){
#ifdef ECORE_XFIXES
Ecore_X_Rectangle *rects;
#else /* ifdef ECORE_XFIXES */
return NULL;
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_fetch */
+}
EAPI void
ecore_x_region_expand(Ecore_X_Region dest,
Ecore_X_Region source,
- unsigned int left,
- unsigned int right,
- unsigned int top,
- unsigned int bottom)
+ unsigned int left,
+ unsigned int right,
+ unsigned int top,
+ unsigned int bottom)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_expand */
+}
EAPI void
ecore_x_region_gc_clip_set(Ecore_X_Region region,
- Ecore_X_GC gc,
- int x_origin,
- int y_origin)
+ Ecore_X_GC gc,
+ int x_origin,
+ int y_origin)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_gc_clip_set */
+}
EAPI void
-ecore_x_region_window_shape_set(Ecore_X_Region region,
- Ecore_X_Window win,
+ecore_x_region_window_shape_set(Ecore_X_Region region,
+ Ecore_X_Window win,
Ecore_X_Shape_Type type,
- int x_offset,
- int y_offset)
+ int x_offset,
+ int y_offset)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
y_offset,
region);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_window_shape_set */
+}
EAPI void
-ecore_x_region_picture_clip_set(Ecore_X_Region region,
+ecore_x_region_picture_clip_set(Ecore_X_Region region,
Ecore_X_Picture picture,
- int x_origin,
- int y_origin)
+ int x_origin,
+ int y_origin)
{
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
y_origin,
region);
#endif /* ifdef ECORE_XFIXES */
-} /* ecore_x_region_picture_clip_set */
+}
* @return The new default graphics context.
*/
EAPI Ecore_X_GC
-ecore_x_gc_new(Ecore_X_Drawable draw,
+ecore_x_gc_new(Ecore_X_Drawable draw,
Ecore_X_GC_Value_Mask value_mask,
- const unsigned int *value_list)
+ const unsigned int *value_list)
{
XGCValues gcv;
int mask;
gcv.arc_mode = value_list[idx];
idx++;
break;
- } /* switch */
+ }
}
return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv);
-} /* ecore_x_gc_new */
+}
/**
* Deletes and frees the given graphics context.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFreeGC(_ecore_x_disp, gc);
-} /* ecore_x_gc_free */
+}
_gesture_available = EINA_TRUE;
}
else
- _gesture_available = EINA_FALSE;
+ _gesture_available = EINA_FALSE;
#else /* ifdef ECORE_XGESTURE */
_gesture_available = EINA_FALSE;
#endif /* ifdef ECORE_XGESTURE */
{
#ifdef ECORE_XGESTURE
if (!_gesture_available)
- return EINA_FALSE;
+ return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGestureSelectEvents(_ecore_x_disp, win, mask);
-
+
return EINA_TRUE;
#else /* ifdef ECORE_XGESTURE */
return EINA_FALSE;
Ecore_X_Gesture_Event_Mask mask;
if (!_gesture_available)
- return ECORE_X_GESTURE_EVENT_MASK_NONE;
+ return ECORE_X_GESTURE_EVENT_MASK_NONE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask))
mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
return mask;
}
-
+
return mask;
#else /* ifdef ECORE_XGESTURE */
return ECORE_X_GESTURE_EVENT_MASK_NONE;
{
#ifdef ECORE_XGESTURE
if (!_gesture_available)
- return EINA_FALSE;
+ return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
{
return EINA_FALSE;
}
-
+
return EINA_TRUE;
#else /* ifdef ECORE_XGESTURE */
return EINA_FALSE;
Ecore_X_Gesture_Event_Mask mask;
if (!_gesture_available)
- return EINA_FALSE;
+ return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
{
return EINA_FALSE;
}
-
+
return EINA_TRUE;
#else /* ifdef ECORE_XGESTURE */
return EINA_FALSE;
ecore_x_icccm_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
-} /* ecore_x_icccm_init */
+}
EAPI void
-ecore_x_icccm_state_set(Ecore_X_Window win,
+ecore_x_icccm_state_set(Ecore_X_Window win,
Ecore_X_Window_State_Hint state)
{
unsigned long c[2];
XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
(unsigned char *)c, 2);
-} /* ecore_x_icccm_state_set */
+}
EAPI Ecore_X_Window_State_Hint
ecore_x_icccm_state_get(Ecore_X_Window win)
XFree(prop_ret);
return hint;
-} /* ecore_x_icccm_state_get */
+}
EAPI void
ecore_x_icccm_delete_window_send(Ecore_X_Window win,
- Ecore_X_Time t)
+ Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_DELETE_WINDOW,
t, 0, 0, 0);
-} /* ecore_x_icccm_delete_window_send */
+}
EAPI void
ecore_x_icccm_take_focus_send(Ecore_X_Window win,
- Ecore_X_Time t)
+ Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_TAKE_FOCUS,
t, 0, 0, 0);
-} /* ecore_x_icccm_take_focus_send */
+}
EAPI void
ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
- Ecore_X_Time t)
+ Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_SAVE_YOURSELF,
t, 0, 0, 0);
-} /* ecore_x_icccm_save_yourself_send */
+}
EAPI void
ecore_x_icccm_move_resize_send(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
XEvent ev;
ev.xconfigure.above = None;
ev.xconfigure.override_redirect = False;
XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
-} /* ecore_x_icccm_move_resize_send */
+}
EAPI void
-ecore_x_icccm_hints_set(Ecore_X_Window win,
- Eina_Bool accepts_focus,
+ecore_x_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)
+ Ecore_X_Pixmap icon_pixmap,
+ Ecore_X_Pixmap icon_mask,
+ Ecore_X_Window icon_window,
+ Ecore_X_Window window_group,
+ Eina_Bool is_urgent)
{
XWMHints *hints;
XSetWMHints(_ecore_x_disp, win, hints);
XFree(hints);
-} /* ecore_x_icccm_hints_set */
+}
EAPI Eina_Bool
-ecore_x_icccm_hints_get(Ecore_X_Window win,
- Eina_Bool *accepts_focus,
+ecore_x_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)
+ Ecore_X_Pixmap *icon_pixmap,
+ Ecore_X_Pixmap *icon_mask,
+ Ecore_X_Window *icon_window,
+ Ecore_X_Window *window_group,
+ Eina_Bool *is_urgent)
{
XWMHints *hints;
}
return EINA_FALSE;
-} /* ecore_x_icccm_hints_get */
+}
EAPI void
-ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
- Eina_Bool request_pos,
+ecore_x_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)
+ int min_w,
+ int min_h,
+ int max_w,
+ int max_h,
+ int base_w,
+ int base_h,
+ int step_x,
+ int step_y,
+ double min_aspect,
+ double max_aspect)
{
XSizeHints hint;
long mask;
}
XSetWMNormalHints(_ecore_x_disp, win, &hint);
-} /* ecore_x_icccm_size_pos_hints_set */
+}
EAPI Eina_Bool
-ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
- Eina_Bool *request_pos,
+ecore_x_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)
+ int *min_w,
+ int *min_h,
+ int *max_w,
+ int *max_h,
+ int *base_w,
+ int *base_h,
+ int *step_x,
+ int *step_y,
+ double *min_aspect,
+ double *max_aspect)
{
XSizeHints hint;
long mask;
*max_aspect = maxa;
return EINA_TRUE;
-} /* ecore_x_icccm_size_pos_hints_get */
+}
EAPI void
ecore_x_icccm_title_set(Ecore_X_Window win,
- const char *t)
+ const char *t)
{
char *list[1];
XTextProperty xprop;
}
free(list[0]);
-} /* ecore_x_icccm_title_set */
+}
EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window win)
t = strdup((char *)xprop.value);
else
{
- /* convert to utf8 */
+ /* convert to utf8 */
#ifdef X_HAVE_UTF8_STRING
- ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
- &list, &num);
+ ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
+ &list, &num);
#else /* ifdef X_HAVE_UTF8_STRING */
- ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
- &list, &num);
+ ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
+ &list, &num);
#endif /* ifdef X_HAVE_UTF8_STRING */
- if ((ret == XLocaleNotSupported) ||
- (ret == XNoMemory) || (ret == XConverterNotFound))
- t = strdup((char *)xprop.value);
- else if ((ret >= Success) && (num > 0))
- t = strdup(list[0]);
+ if ((ret == XLocaleNotSupported) ||
+ (ret == XNoMemory) || (ret == XConverterNotFound))
+ t = strdup((char *)xprop.value);
+ else if ((ret >= Success) && (num > 0))
+ t = strdup(list[0]);
- if (list)
- XFreeStringList(list);
+ if (list)
+ XFreeStringList(list);
}
if (xprop.value)
}
return NULL;
-} /* ecore_x_icccm_title_get */
+}
/**
* Set protocol atoms explicitly
*/
EAPI void
ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
- Ecore_X_Atom *protos,
- int num)
+ Ecore_X_Atom *protos,
+ int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (num > 0)
XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
else
XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
-} /* ecore_x_icccm_protocol_atoms_set */
+}
/**
* Set or unset a wm protocol property.
* @param on On/Off
*/
EAPI void
-ecore_x_icccm_protocol_set(Ecore_X_Window win,
+ecore_x_icccm_protocol_set(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol,
- Eina_Bool on)
+ Eina_Bool on)
{
Atom *protos = NULL;
Atom proto;
leave:
if (protos)
XFree(protos);
-} /* ecore_x_icccm_protocol_set */
+}
/**
* Determines whether a protocol is set for a window.
* @return 1 if the protocol is set, else 0.
*/
EAPI Eina_Bool
-ecore_x_icccm_protocol_isset(Ecore_X_Window win,
+ecore_x_icccm_protocol_isset(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol)
{
Atom proto, *protos = NULL;
XFree(protos);
return ret;
-} /* ecore_x_icccm_protocol_isset */
+}
/**
* Set a window name & class.
*/
EAPI void
ecore_x_icccm_name_class_set(Ecore_X_Window win,
- const char *n,
- const char *c)
+ const char *n,
+ const char *c)
{
XClassHint *xch;
xch->res_class = (char *)c;
XSetClassHint(_ecore_x_disp, win, xch);
XFree(xch);
-} /* ecore_x_icccm_name_class_set */
+}
/**
* Get a window name & class.
*/
EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window win,
- char **n,
- char **c)
+ char **n,
+ char **c)
{
XClassHint xch;
XFree(xch.res_name);
XFree(xch.res_class);
}
-} /* ecore_x_icccm_name_class_get */
+}
/**
* Get a window client machine string.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
return name;
-} /* ecore_x_icccm_client_machine_get */
+}
/**
* Sets the WM_COMMAND property for @a win.
*/
EAPI void
ecore_x_icccm_command_set(Ecore_X_Window win,
- int argc,
- char **argv)
+ int argc,
+ char **argv)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetCommand(_ecore_x_disp, win, argv, argc);
-} /* ecore_x_icccm_command_set */
+}
/**
* Get the WM_COMMAND property for @a win.
*/
EAPI void
ecore_x_icccm_command_get(Ecore_X_Window win,
- int *argc,
- char ***argv)
+ int *argc,
+ char ***argv)
{
int i, c;
char **v;
}
XFreeStringList(v);
-} /* ecore_x_icccm_command_get */
+}
/**
* Set a window icon name.
*/
EAPI void
ecore_x_icccm_icon_name_set(Ecore_X_Window win,
- const char *t)
+ const char *t)
{
char *list[1];
XTextProperty xprop;
}
free(list[0]);
-} /* ecore_x_icccm_icon_name_set */
+}
/**
* Get a window icon name.
t = strdup((char *)xprop.value);
else
{
- /* convert to utf8 */
+ /* convert to utf8 */
#ifdef X_HAVE_UTF8_STRING
- ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
- &list, &num);
+ ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
+ &list, &num);
#else /* ifdef X_HAVE_UTF8_STRING */
- ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
- &list, &num);
+ ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
+ &list, &num);
#endif /* ifdef X_HAVE_UTF8_STRING */
- if ((ret == XLocaleNotSupported) ||
- (ret == XNoMemory) || (ret == XConverterNotFound))
- t = strdup((char *)xprop.value);
- else if (ret >= Success)
- {
- if ((num >= 1) && (list))
- t = strdup(list[0]);
-
- if (list)
- XFreeStringList(list);
- }
+ if ((ret == XLocaleNotSupported) ||
+ (ret == XNoMemory) || (ret == XConverterNotFound))
+ t = strdup((char *)xprop.value);
+ else if (ret >= Success)
+ {
+ if ((num >= 1) && (list))
+ t = strdup(list[0]);
+
+ if (list)
+ XFreeStringList(list);
+ }
}
if (xprop.value)
}
return NULL;
-} /* ecore_x_icccm_icon_name_get */
+}
/**
* Add a subwindow to the list of windows that need a different colormap installed.
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW, 32, data, num);
free(newset);
-} /* ecore_x_icccm_colormap_window_set */
+}
/**
* Remove a window from the list of colormap windows.
if (old_data)
XFree(old_data);
-} /* ecore_x_icccm_colormap_window_unset */
+}
/**
* Specify that a window is transient for another top-level window and should be handled accordingly.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetTransientForHint(_ecore_x_disp, win, forwin);
-} /* ecore_x_icccm_transient_for_set */
+}
/**
* Remove the transient_for setting from a window.
- * @param The window
+ * @param win The window
*/
EAPI void
ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
-} /* ecore_x_icccm_transient_for_unset */
+}
/**
* Get the window this window is transient for, if any.
return (Ecore_X_Window)forwin;
else
return 0;
-} /* ecore_x_icccm_transient_for_get */
+}
/**
* Set the window role hint.
*/
EAPI void
ecore_x_icccm_window_role_set(Ecore_X_Window win,
- const char *role)
+ const char *role)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
(char *)role);
-} /* ecore_x_icccm_window_role_set */
+}
/**
* Get the window role.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
-} /* ecore_x_icccm_window_role_get */
+}
/**
* Set the window's client leader.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
&l, 1);
-} /* ecore_x_icccm_client_leader_set */
+}
/**
* Get the window's client leader.
return l;
return 0;
-} /* ecore_x_icccm_client_leader_get */
+}
EAPI void
ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
XSendEvent(_ecore_x_disp, root, False,
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-} /* ecore_x_icccm_iconic_request_send */
+}
/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
/* hints. each should go in their own file/section so we know which */
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif /* ifdef HAVE_CONFIG_H */
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
#include "ecore_x_private.h"
#include "Ecore_X.h"
#include <X11/extensions/XShm.h>
#include <X11/Xutil.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <string.h>
static int _ecore_x_image_shm_can = -1;
static int _ecore_x_image_err = 0;
static int
-_ecore_x_image_error_handler(Display *d __UNUSED__,
+_ecore_x_image_error_handler(Display *d __UNUSED__,
XErrorEvent *ev __UNUSED__)
{
_ecore_x_image_err = 1;
return 0;
-} /* _ecore_x_image_error_handler */
+}
static void
_ecore_x_image_shm_check(void)
shmctl(shminfo.shmid, IPC_RMID, 0);
_ecore_x_image_shm_can = 1;
-} /* _ecore_x_image_shm_check */
+}
struct _Ecore_X_Image
{
};
EAPI Ecore_X_Image *
-ecore_x_image_new(int w,
- int h,
+ecore_x_image_new(int w,
+ int h,
Ecore_X_Visual vis,
- int depth)
+ int depth)
{
Ecore_X_Image *im;
_ecore_x_image_shm_check();
im->shm = _ecore_x_image_shm_can;
return im;
-} /* ecore_x_image_new */
+}
EAPI void
ecore_x_image_free(Ecore_X_Image *im)
}
free(im);
-} /* ecore_x_image_free */
+}
static void
_ecore_x_image_shm_create(Ecore_X_Image *im)
im->bpp = 2;
else
im->bpp = 4;
-} /* _ecore_x_image_shm_create */
+}
EAPI Eina_Bool
-ecore_x_image_get(Ecore_X_Image *im,
+ecore_x_image_get(Ecore_X_Image *im,
Ecore_X_Drawable draw,
- int x,
- int y,
- int sx,
- int sy,
- int w,
- int h)
+ int x,
+ int y,
+ int sx,
+ int sy,
+ int w,
+ int h)
{
Eina_Bool ret = EINA_TRUE;
XErrorHandler ph;
}
return ret;
-} /* ecore_x_image_get */
+}
EAPI void
-ecore_x_image_put(Ecore_X_Image *im,
+ecore_x_image_put(Ecore_X_Image *im,
Ecore_X_Drawable draw,
- Ecore_X_GC gc,
- int x,
- int y,
- int sx,
- int sy,
- int w,
- int h)
+ Ecore_X_GC gc,
+ int x,
+ int y,
+ int sx,
+ int sy,
+ int w,
+ int h)
{
Ecore_X_GC tgc = 0;
if (im->xim)
XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False);
if (tgc) ecore_x_gc_free(tgc);
-} /* ecore_x_image_put */
+}
EAPI void *
ecore_x_image_data_get(Ecore_X_Image *im,
- int *bpl,
- int *rows,
- int *bpp)
+ int *bpl,
+ int *rows,
+ int *bpp)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!im->xim) _ecore_x_image_shm_create(im);
if (rows) *rows = im->rows;
if (bpp) *bpp = im->bpp;
return im->data;
-} /* ecore_x_image_data_get */
+}
EAPI Eina_Bool
ecore_x_image_is_argb32_get(Ecore_X_Image *im)
}
EAPI Eina_Bool
-ecore_x_image_to_argb_convert(void *src,
- int sbpp,
- int sbpl,
+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)
+ Ecore_X_Visual v,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned int *dst,
+ int dbpl,
+ int dx,
+ int dy)
{
Visual *vis = v;
XColor *cols = NULL;
else if ((vis->class == TrueColor) ||
(vis->class == DirectColor))
{
- if ((vis->red_mask == 0x00ff0000) &&
- (vis->green_mask == 0x0000ff00) &&
- (vis->blue_mask == 0x000000ff))
+ if ((vis->red_mask == 0x00ff0000) &&
+ (vis->green_mask == 0x0000ff00) &&
+ (vis->blue_mask == 0x000000ff))
mode = argbx888;
else if ((vis->red_mask == 0x000000ff) &&
(vis->green_mask == 0x0000ff00) &&
MWMHints;
EAPI Eina_Bool
-ecore_x_mwm_hints_get(Ecore_X_Window win,
- Ecore_X_MWM_Hint_Func *fhint,
+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)
{
}
return ret;
-} /* ecore_x_mwm_hints_get */
+}
EAPI void
ecore_x_mwm_borderless_set(Ecore_X_Window win,
- Eina_Bool borderless)
+ Eina_Bool borderless)
{
unsigned int data[5] = {0, 0, 0, 0, 0};
ECORE_X_ATOM_MOTIF_WM_HINTS,
ECORE_X_ATOM_MOTIF_WM_HINTS,
32, (void *)data, 5);
-} /* ecore_x_mwm_borderless_set */
+}
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif /* ifdef HAVE_CONFIG_H */
+#endif
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int silent;
};
-static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- const char *str);
+static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ const char *str);
static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win,
- Ecore_X_Atom atom);
+ Ecore_X_Atom atom);
#if 0 /* Unused */
-static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
-static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
- char *data);
+static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
+static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
+ char *data);
#endif /* if 0 */
-static void _ecore_x_netwm_startup_info_free(void *data);
+static void _ecore_x_netwm_startup_info_free(void *data);
/*
* Convenience macros
LOGFN(__FILE__, __LINE__, __FUNCTION__);
startup_info = eina_hash_string_superfast_new(
_ecore_x_netwm_startup_info_free);
-} /* ecore_x_netwm_init */
+}
EAPI void
ecore_x_netwm_shutdown(void)
eina_hash_free(startup_info);
startup_info = NULL;
-} /* ecore_x_netwm_shutdown */
+}
/*
* WM identification
EAPI void
ecore_x_netwm_wm_identify(Ecore_X_Window root,
Ecore_X_Window check,
- const char *wm_name)
+ const char *wm_name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(root,
_ecore_x_window_prop_string_utf8_set(root,
ECORE_X_ATOM_NET_WM_NAME,
wm_name);
-} /* ecore_x_netwm_wm_identify */
+}
/*
* Set supported atoms
*/
EAPI void
ecore_x_netwm_supported_set(Ecore_X_Window root,
- Ecore_X_Atom *supported,
- int num)
+ Ecore_X_Atom *supported,
+ int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_atom_set(root,
ECORE_X_ATOM_NET_SUPPORTED,
supported,
num);
-} /* ecore_x_netwm_supported_set */
+}
EAPI Eina_Bool
ecore_x_netwm_supported_get(Ecore_X_Window root,
Ecore_X_Atom **supported,
- int *num)
+ int *num)
{
int num_ret;
*num = num_ret;
return EINA_TRUE;
-} /* ecore_x_netwm_supported_get */
+}
/*
* Desktop configuration and status
*/
EAPI void
ecore_x_netwm_desk_count_set(Ecore_X_Window root,
- unsigned int n_desks)
+ unsigned int n_desks)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
&n_desks, 1);
-} /* ecore_x_netwm_desk_count_set */
+}
EAPI void
-ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
+ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
Ecore_X_Window *vroots,
- unsigned int n_desks)
+ unsigned int n_desks)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_VIRTUAL_ROOTS,
vroots,
n_desks);
-} /* ecore_x_netwm_desk_roots_set */
+}
EAPI void
ecore_x_netwm_desk_names_set(Ecore_X_Window root,
- const char **names,
- unsigned int n_desks)
+ const char **names,
+ unsigned int n_desks)
{
char ss[32], *buf, *t;
const char *s;
if (!s)
{
/* Default to "Desk-<number>" */
- sprintf(ss, "Desk-%d", i);
- s = ss;
+ sprintf(ss, "Desk-%d", i);
+ s = ss;
}
l = strlen(s) + 1;
_ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len);
free(buf);
-} /* ecore_x_netwm_desk_names_set */
+}
EAPI void
ecore_x_netwm_desk_size_set(Ecore_X_Window root,
- unsigned int width,
- unsigned int height)
+ unsigned int width,
+ unsigned int height)
{
unsigned int size[2];
size[1] = height;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size,
2);
-} /* ecore_x_netwm_desk_size_set */
+}
EAPI void
ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
- unsigned int *origins,
- unsigned int n_desks)
+ unsigned int *origins,
+ unsigned int n_desks)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
origins, 2 * n_desks);
-} /* ecore_x_netwm_desk_viewports_set */
+}
EAPI void
ecore_x_netwm_desk_layout_set(Ecore_X_Window root,
- int orientation,
- int columns,
- int rows,
- int starting_corner)
+ int orientation,
+ int columns,
+ int rows,
+ int starting_corner)
{
unsigned int layout[4];
layout[3] = starting_corner;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT,
layout, 4);
-} /* ecore_x_netwm_desk_layout_set */
+}
EAPI void
ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
- unsigned int *areas,
- unsigned int n_desks)
+ unsigned int *areas,
+ unsigned int n_desks)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas,
4 * n_desks);
-} /* ecore_x_netwm_desk_workareas_set */
+}
EAPI unsigned int *
ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks)
{
int ret;
unsigned int *areas = NULL;
-
+
if (!root) root = DefaultRootWindow(_ecore_x_disp);
-
+
ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA,
&areas);
if (!areas)
EAPI void
ecore_x_netwm_desk_current_set(Ecore_X_Window root,
- unsigned int desk)
+ unsigned int desk)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, &desk,
1);
-} /* ecore_x_netwm_desk_current_set */
+}
EAPI void
ecore_x_netwm_showing_desktop_set(Ecore_X_Window root,
- Eina_Bool on)
+ Eina_Bool on)
{
unsigned int val;
val = (on) ? 1 : 0;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val,
1);
-} /* ecore_x_netwm_showing_desktop_set */
+}
/*
* Client status
/* Mapping order */
EAPI void
-ecore_x_netwm_client_list_set(Ecore_X_Window root,
+ecore_x_netwm_client_list_set(Ecore_X_Window root,
Ecore_X_Window *p_clients,
- unsigned int n_clients)
+ unsigned int n_clients)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST,
p_clients, n_clients);
-} /* ecore_x_netwm_client_list_set */
+}
/* Stacking order */
EAPI void
-ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
+ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
Ecore_X_Window *p_clients,
- unsigned int n_clients)
+ unsigned int n_clients)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
p_clients, n_clients);
-} /* ecore_x_netwm_client_list_stacking_set */
+}
EAPI void
ecore_x_netwm_client_active_set(Ecore_X_Window root,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_ACTIVE_WINDOW,
&win, 1);
-} /* ecore_x_netwm_client_active_set */
+}
EAPI void
ecore_x_netwm_client_active_request(Ecore_X_Window root,
Ecore_X_Window win,
- int type,
+ int type,
Ecore_X_Window current_win)
{
XEvent xev;
XSendEvent(_ecore_x_disp, root, False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev);
-} /* ecore_x_netwm_client_active_request */
+}
EAPI void
ecore_x_netwm_name_set(Ecore_X_Window win,
- const char *name)
+ const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name);
-} /* ecore_x_netwm_name_set */
+}
EAPI int
ecore_x_netwm_name_get(Ecore_X_Window win,
- char **name)
+ char **name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (name)
ECORE_X_ATOM_NET_WM_NAME);
return 1;
-} /* ecore_x_netwm_name_get */
+}
EAPI void
ecore_x_netwm_startup_id_set(Ecore_X_Window win,
- const char *id)
+ const char *id)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id);
-} /* ecore_x_netwm_startup_id_set */
+}
EAPI int
ecore_x_netwm_startup_id_get(Ecore_X_Window win,
- char **id)
+ char **id)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (id)
ECORE_X_ATOM_NET_STARTUP_ID);
return 1;
-} /* ecore_x_netwm_startup_id_get */
+}
EAPI void
ecore_x_netwm_visible_name_set(Ecore_X_Window win,
- const char *name)
+ const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
name);
-} /* ecore_x_netwm_visible_name_set */
+}
EAPI int
ecore_x_netwm_visible_name_get(Ecore_X_Window win,
- char **name)
+ char **name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (name)
ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
return 1;
-} /* ecore_x_netwm_visible_name_get */
+}
EAPI void
ecore_x_netwm_icon_name_set(Ecore_X_Window win,
- const char *name)
+ const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME,
name);
-} /* ecore_x_netwm_icon_name_set */
+}
EAPI int
ecore_x_netwm_icon_name_get(Ecore_X_Window win,
- char **name)
+ char **name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (name)
ECORE_X_ATOM_NET_WM_ICON_NAME);
return 1;
-} /* ecore_x_netwm_icon_name_get */
+}
EAPI void
ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win,
- const char *name)
+ const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win,
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
name);
-} /* ecore_x_netwm_visible_icon_name_set */
+}
EAPI int
ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win,
- char **name)
+ char **name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (name)
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
return 1;
-} /* ecore_x_netwm_visible_icon_name_get */
+}
EAPI void
ecore_x_netwm_desktop_set(Ecore_X_Window win,
- unsigned int desk)
+ unsigned int desk)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
-} /* ecore_x_netwm_desktop_set */
+}
EAPI Eina_Bool
ecore_x_netwm_desktop_get(Ecore_X_Window win,
- unsigned int *desk)
+ unsigned int *desk)
{
int ret;
unsigned int tmp;
*desk = tmp;
return ret == 1 ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_netwm_desktop_get */
+}
/*
* _NET_WM_STRUT is deprecated
*/
EAPI void
ecore_x_netwm_strut_set(Ecore_X_Window win,
- int left,
- int right,
- int top,
- int bottom)
+ int left,
+ int right,
+ int top,
+ int bottom)
{
unsigned int strut[4];
strut[2] = top;
strut[3] = bottom;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
-} /* ecore_x_netwm_strut_set */
+}
/*
* _NET_WM_STRUT is deprecated
*/
EAPI Eina_Bool
ecore_x_netwm_strut_get(Ecore_X_Window win,
- int *left,
- int *right,
- int *top,
- int *bottom)
+ int *left,
+ int *right,
+ int *top,
+ int *bottom)
{
int ret = 0;
unsigned int strut[4];
*bottom = strut[3];
return EINA_TRUE;
-} /* ecore_x_netwm_strut_get */
+}
EAPI void
ecore_x_netwm_strut_partial_set(Ecore_X_Window win,
- int left,
- int right,
- int top,
- int bottom,
- int left_start_y,
- int left_end_y,
- int right_start_y,
- int right_end_y,
- int top_start_x,
- int top_end_x,
- int bottom_start_x,
- int bottom_end_x)
+ int left,
+ int right,
+ int top,
+ int bottom,
+ int left_start_y,
+ int left_end_y,
+ int right_start_y,
+ int right_end_y,
+ int top_start_x,
+ int top_end_x,
+ int bottom_start_x,
+ int bottom_end_x)
{
unsigned int strut[12];
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
strut,
12);
-} /* ecore_x_netwm_strut_partial_set */
+}
EAPI Eina_Bool
ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
- int *left,
- int *right,
- int *top,
- int *bottom,
- int *left_start_y,
- int *left_end_y,
- int *right_start_y,
- int *right_end_y,
- int *top_start_x,
- int *top_end_x,
- int *bottom_start_x,
- int *bottom_end_x)
+ int *left,
+ int *right,
+ int *top,
+ int *bottom,
+ int *left_start_y,
+ int *left_end_y,
+ int *right_start_y,
+ int *right_end_y,
+ int *top_start_x,
+ int *top_end_x,
+ int *bottom_start_x,
+ int *bottom_end_x)
{
int ret = 0;
unsigned int strut[12];
*bottom_end_x = strut[11];
return EINA_TRUE;
-} /* ecore_x_netwm_strut_partial_get */
+}
EAPI Eina_Bool
ecore_x_netwm_icons_get(Ecore_X_Window win,
Ecore_X_Icon **icon,
- int *num)
+ int *num)
{
unsigned int *data, *p;
unsigned int *src;
free(data);
return EINA_TRUE;
-} /* ecore_x_netwm_icons_get */
+}
EAPI void
ecore_x_netwm_icon_geometry_set(Ecore_X_Window win,
- int x,
- int y,
- int width,
- int height)
+ int x,
+ int y,
+ int width,
+ int height)
{
unsigned int geometry[4];
ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
geometry,
4);
-} /* ecore_x_netwm_icon_geometry_set */
+}
EAPI Eina_Bool
ecore_x_netwm_icon_geometry_get(Ecore_X_Window win,
- int *x,
- int *y,
- int *width,
- int *height)
+ int *x,
+ int *y,
+ int *width,
+ int *height)
{
int ret;
unsigned int geometry[4];
*height = geometry[3];
return EINA_TRUE;
-} /* ecore_x_netwm_icon_geometry_get */
+}
EAPI void
ecore_x_netwm_pid_set(Ecore_X_Window win,
- int pid)
+ int pid)
{
unsigned int tmp;
tmp = pid;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID,
&tmp, 1);
-} /* ecore_x_netwm_pid_set */
+}
EAPI Eina_Bool
ecore_x_netwm_pid_get(Ecore_X_Window win,
- int *pid)
+ int *pid)
{
int ret;
unsigned int tmp;
*pid = tmp;
return ret == 1 ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_netwm_pid_get */
+}
EAPI void
ecore_x_netwm_handled_icons_set(Ecore_X_Window win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
NULL, 0);
-} /* ecore_x_netwm_handled_icons_set */
+}
EAPI Eina_Bool
ecore_x_netwm_handled_icons_get(Ecore_X_Window win)
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
NULL, 0);
return ret == 0 ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_netwm_handled_icons_get */
+}
EAPI void
ecore_x_netwm_user_time_set(Ecore_X_Window win,
- unsigned int tim)
+ unsigned int tim)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME,
&tim, 1);
-} /* ecore_x_netwm_user_time_set */
+}
EAPI Eina_Bool
ecore_x_netwm_user_time_get(Ecore_X_Window win,
- unsigned int *tim)
+ unsigned int *tim)
{
int ret;
unsigned int tmp;
*tim = tmp;
return ret == 1 ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_netwm_user_time_get */
+}
Ecore_X_Window_State
_ecore_x_netwm_state_get(Ecore_X_Atom a)
return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
else
return ECORE_X_WINDOW_STATE_UNKNOWN;
-} /* _ecore_x_netwm_state_get */
+}
static Ecore_X_Atom
_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
{
- switch(s)
+ switch (s)
{
case ECORE_X_WINDOW_STATE_MODAL:
return ECORE_X_ATOM_NET_WM_STATE_MODAL;
default:
return 0;
- } /* switch */
-} /* _ecore_x_netwm_state_atom_get */
+ }
+}
EAPI void
-ecore_x_netwm_window_state_set(Ecore_X_Window win,
+ecore_x_netwm_window_state_set(Ecore_X_Window win,
Ecore_X_Window_State *state,
- unsigned int num)
+ unsigned int num)
{
Ecore_X_Atom *set;
unsigned int i;
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num);
free(set);
-} /* ecore_x_netwm_window_state_set */
+}
EAPI Eina_Bool
-ecore_x_netwm_window_state_get(Ecore_X_Window win,
+ecore_x_netwm_window_state_get(Ecore_X_Window win,
Ecore_X_Window_State **state,
- unsigned int *num)
+ unsigned int *num)
{
int num_ret, i;
Ecore_X_Atom *atoms;
free(atoms);
return EINA_TRUE;
-} /* ecore_x_netwm_window_state_get */
+}
static Ecore_X_Window_Type
_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom)
return ECORE_X_WINDOW_TYPE_DND;
else
return ECORE_X_WINDOW_TYPE_UNKNOWN;
-} /* _ecore_x_netwm_window_type_type_get */
+}
static Ecore_X_Atom
_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
default:
return 0;
- } /* switch */
-} /* _ecore_x_netwm_window_type_atom_get */
+ }
+}
/*
* FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
* , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG
*/
EAPI void
-ecore_x_netwm_window_type_set(Ecore_X_Window win,
+ecore_x_netwm_window_type_set(Ecore_X_Window win,
Ecore_X_Window_Type type)
{
Ecore_X_Atom atom;
atom = _ecore_x_netwm_window_type_atom_get(type);
ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
&atom, 1);
-} /* ecore_x_netwm_window_type_set */
+}
/* FIXME: Maybe return 0 on some conditions? */
EAPI Eina_Bool
-ecore_x_netwm_window_type_get(Ecore_X_Window win,
+ecore_x_netwm_window_type_get(Ecore_X_Window win,
Ecore_X_Window_Type *type)
{
int num;
return EINA_TRUE;
return EINA_FALSE;
-} /* ecore_x_netwm_window_type_get */
+}
EAPI int
-ecore_x_netwm_window_types_get(Ecore_X_Window win,
+ecore_x_netwm_window_types_get(Ecore_X_Window win,
Ecore_X_Window_Type **types)
{
int num, i;
free(atoms2);
return num;
-} /* ecore_x_netwm_window_types_get */
+}
static Ecore_X_Atom
_ecore_x_netwm_action_atom_get(Ecore_X_Action action)
default:
return 0;
- } /* switch */
-} /* _ecore_x_netwm_action_atom_get */
+ }
+}
/* FIXME: Get complete list */
EAPI Eina_Bool
free(atoms);
return ret;
-} /* ecore_x_netwm_allowed_action_isset */
+}
/* FIXME: Set complete list */
EAPI void
-ecore_x_netwm_allowed_action_set(Ecore_X_Window win,
+ecore_x_netwm_allowed_action_set(Ecore_X_Window win,
Ecore_X_Action *action,
- unsigned int num)
+ unsigned int num)
{
Ecore_X_Atom *set;
unsigned int i;
num);
free(set);
-} /* ecore_x_netwm_allowed_action_set */
+}
EAPI Eina_Bool
-ecore_x_netwm_allowed_action_get(Ecore_X_Window win,
+ecore_x_netwm_allowed_action_get(Ecore_X_Window win,
Ecore_X_Action **action,
- unsigned int *num)
+ unsigned int *num)
{
int num_ret, i;
Ecore_X_Atom *atoms;
free(atoms);
return EINA_TRUE;
-} /* ecore_x_netwm_allowed_action_get */
+}
EAPI void
ecore_x_netwm_opacity_set(Ecore_X_Window win,
- unsigned int opacity)
+ unsigned int opacity)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
&opacity, 1);
-} /* ecore_x_netwm_opacity_set */
+}
EAPI Eina_Bool
ecore_x_netwm_opacity_get(Ecore_X_Window win,
- unsigned int *opacity)
+ unsigned int *opacity)
{
int ret;
unsigned int tmp;
*opacity = tmp;
return ret == 1 ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_netwm_opacity_get */
+}
EAPI void
ecore_x_netwm_frame_size_set(Ecore_X_Window win,
- int fl,
- int fr,
- int ft,
- int fb)
+ int fl,
+ int fr,
+ int ft,
+ int fb)
{
unsigned int frames[4];
ECORE_X_ATOM_NET_FRAME_EXTENTS,
frames,
4);
-} /* ecore_x_netwm_frame_size_set */
+}
EAPI Eina_Bool
ecore_x_netwm_frame_size_get(Ecore_X_Window win,
- int *fl,
- int *fr,
- int *ft,
- int *fb)
+ int *fl,
+ int *fr,
+ int *ft,
+ int *fb)
{
int ret = 0;
unsigned int frames[4];
*fb = frames[3];
return EINA_TRUE;
-} /* ecore_x_netwm_frame_size_get */
+}
EAPI Eina_Bool
-ecore_x_netwm_sync_counter_get(Ecore_X_Window win,
+ecore_x_netwm_sync_counter_get(Ecore_X_Window win,
Ecore_X_Sync_Counter *counter)
{
int ret;
*counter = tmp;
return ret == 1 ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_netwm_sync_counter_get */
+}
EAPI void
ecore_x_netwm_ping_send(Ecore_X_Window win)
xev.xclient.data.l[4] = 0;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
-} /* ecore_x_netwm_ping_send */
+}
EAPI void
ecore_x_netwm_sync_request_send(Ecore_X_Window win,
- unsigned int serial)
+ unsigned int serial)
{
XSyncValue value;
XEvent xev;
xev.xclient.data.l[4] = 0;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
-} /* ecore_x_netwm_sync_request_send */
+}
EAPI void
-ecore_x_netwm_state_request_send(Ecore_X_Window win,
- Ecore_X_Window root,
+ecore_x_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)
+ Eina_Bool set)
{
XEvent xev;
XSendEvent(_ecore_x_disp, root, False,
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-} /* ecore_x_netwm_state_request_send */
+}
EAPI void
ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
Ecore_X_Window root,
- unsigned int desktop)
+ unsigned int desktop)
{
XEvent xev;
XSendEvent(_ecore_x_disp, root, False,
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-} /* ecore_x_netwm_desktop_request_send */
+}
int
_ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__,
- char *data __UNUSED__)
+ char *data __UNUSED__)
{
#if 0
Ecore_X_Startup_Info *info;
#endif /* if 0 */
return 1;
-} /* _ecore_x_netwm_startup_info_begin */
+}
int
_ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__,
- char *data __UNUSED__)
+ char *data __UNUSED__)
{
#if 0
Ecore_X_Startup_Info *info;
#endif /* if 0 */
return 1;
-} /* _ecore_x_netwm_startup_info */
+}
/*
* Set UTF-8 string property
*/
static void
_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- const char *str)
+ Ecore_X_Atom atom,
+ const char *str)
{
XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str));
-} /* _ecore_x_window_prop_string_utf8_set */
+}
/*
* Get UTF-8 string property
*/
static char *
_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win,
- Ecore_X_Atom atom)
+ Ecore_X_Atom atom)
{
char *str;
unsigned char *prop_ret;
XFree(prop_ret);
return str;
-} /* _ecore_x_window_prop_string_utf8_get */
+}
#if 0 /* Unused */
/*
else
{
/* Discard buffer */
- info->length = 0;
- info->buffer[0] = 0;
+ info->length = 0;
+ info->buffer[0] = 0;
}
return 1;
-} /* _ecore_x_netwm_startup_info_process */
+}
/*
* Parse startup info
*/
static int
_ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
- char *data)
+ char *data)
{
while (*data)
{
char value[1024];
/* Skip space */
- while (*data == ' ') data++;
+ while (*data == ' ')
+ data++;
/* Get key */
key = data;
data = strchr(key, '=');
return 0;
return 1;
-} /* _ecore_x_netwm_startup_info_parse */
+}
#endif /* if 0 */
free(info->wmclass);
free(info);
-} /* _ecore_x_netwm_startup_info_free */
+}
/*
* Is screen composited?
win = XGetSelectionOwner(_ecore_x_disp, atom);
return (win != None) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_screen_is_composited */
+}
EAPI void
-ecore_x_screen_is_composited_set(int screen,
+ecore_x_screen_is_composited_set(int screen,
Ecore_X_Window win)
{
static Ecore_X_Atom atom = None;
return;
XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time);
-} /* ecore_x_screen_is_composited_set */
+}
*/
EAPI Ecore_X_Pixmap
ecore_x_pixmap_new(Ecore_X_Window win,
- int w,
- int h,
- int dep)
+ int w,
+ int h,
+ int dep)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
return XCreatePixmap(_ecore_x_disp, win, w, h, dep);
-} /* ecore_x_pixmap_new */
+}
/**
* Deletes the reference to the given pixmap.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFreePixmap(_ecore_x_disp, pmap);
-} /* ecore_x_pixmap_free */
+}
/**
* Pastes a rectangular area of the given pixmap onto the given drawable.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
-ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
+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)
+ Ecore_X_GC gc,
+ int sx,
+ int sy,
+ int w,
+ int h,
+ int dx,
+ int dy)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy);
-} /* ecore_x_pixmap_paste */
+}
/**
* Retrieves the size of the given pixmap.
*/
EAPI void
ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (pmap)
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
-} /* ecore_x_pixmap_geometry_get */
+}
/**
* Retrieves the depth of the given pixmap.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_drawable_depth_get(pmap);
-} /* ecore_x_pixmap_depth_get */
+}
#include "ecore_x_private.h"
#include "ecore_x_randr.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#define Ecore_X_Randr_None 0
#ifdef ECORE_XRANDR
root) ((screen = \
XRRRootToScreen(_ecore_x_disp, \
root)) != -1)
-#define RANDR_CHECK_1_1_RET(ret) if(_randr_version < RANDR_1_1) return ret
+#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) \
+ return ret
extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
dpy,
#else /* ifdef ECORE_XRANDR */
return Ecore_X_Randr_None;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_orientations_get */
+}
/*
* @param root window which's primary output will be queried
#else /* ifdef ECORE_XRANDR */
return Ecore_X_Randr_None;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_orientation_get */
+}
/*
* @brief sets a given screen's primary output's orientation
#else /* ifdef ECORE_XRANDR */
return EINA_FALSE;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_orientation_set */
+}
/*
* @brief gets a screen's primary output's possible sizes
*/
EAPI Ecore_X_Randr_Screen_Size_MM *
ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
Ecore_X_Randr_Screen_Size_MM *ret = NULL;
#else /* ifdef ECORE_XRANDR */
return NULL;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_sizes_get */
+}
/*
* @brief get the current set size of a given screen's primary output
*/
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)
+ int *w,
+ int *h,
+ int *w_mm,
+ int *h_mm,
+ int *size_index)
{
#ifdef ECORE_XRANDR
XRRScreenSize *sizes;
XRRFreeScreenConfigInfo(sc);
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_current_size_get */
+}
/*
* @brief sets a given screen's primary output size, but disables all other outputs at the same time
*/
EAPI Eina_Bool
ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
- int size_index)
+ int size_index)
{
#ifdef ECORE_XRANDR
XRRScreenConfiguration *sc = NULL;
- XRRScreenSize *sizes;
Eina_Bool ret = EINA_FALSE;
int nsizes = 0;
if (size_index >= 0 && _ecore_x_randr_root_validate(root))
{
- sizes =
- XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
+ XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
root), &nsizes);
if (size_index < nsizes)
#else /* ifdef ECORE_XRANDR */
return EINA_FALSE;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_size_set */
+}
/*
* @param root window which's primary output will be queried
#else /* ifdef ECORE_XRANDR */
return 0.0;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_current_refresh_rate_get */
+}
/*
* @param root window which's primary output will be queried
*/
EAPI Ecore_X_Randr_Refresh_Rate *
ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
- int size_index,
- int *num)
+ int size_index,
+ int *num)
{
#ifdef ECORE_XRANDR
Ecore_X_Randr_Refresh_Rate *ret = NULL, *rates = NULL;
#else /* ifdef ECORE_XRANDR */
return NULL;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_refresh_rates_get */
+}
//>= 1.1
/*
EAPI Eina_Bool
ecore_x_randr_screen_primary_output_refresh_rate_set(
Ecore_X_Window root,
- int size_index,
+ int size_index,
Ecore_X_Randr_Refresh_Rate
rate)
{
#else /* ifdef ECORE_XRANDR */
return EINA_FALSE;
#endif /* ifdef ECORE_XRANDR */
-} /* ecore_x_randr_screen_primary_output_refresh_rate_set */
+}
#include "ecore_x_private.h"
#include "ecore_x_randr.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#define Ecore_X_Randr_None (Ecore_X_Randr_Crtc)0
#define Ecore_X_Randr_Unset (Ecore_X_Randr_Crtc) - 1
#define RANDR_VALIDATE_ROOT(screen, root) \
((screen = XRRRootToScreen(_ecore_x_disp, root)) != -1)
-#define RANDR_CHECK_1_2_RET(ret) if(_randr_version < RANDR_1_2) return ret
+#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) \
+ return ret
#define RANDR_PROPERTY_EDID "EDID"
#define RANDR_PROPERTY_BACKLIGHT "Backlight"
*/
EAPI void
ecore_x_randr_events_select(Ecore_X_Window win,
- Eina_Bool on)
+ Eina_Bool on)
{
#ifdef ECORE_XRANDR
int mask;
* @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned.
*/
static inline Eina_Bool
-_ecore_x_randr_crtc_validate(Ecore_X_Window root,
+_ecore_x_randr_crtc_validate(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc)
{
#ifdef ECORE_XRANDR
}
Eina_Bool
-_ecore_x_randr_output_validate(Ecore_X_Window root,
+_ecore_x_randr_output_validate(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
#ifdef ECORE_XRANDR
}
static inline Eina_Bool
-_ecore_x_randr_mode_validate(Ecore_X_Window root,
+_ecore_x_randr_mode_validate(Ecore_X_Window root,
Ecore_X_Randr_Mode mode)
{
#ifdef ECORE_XRANDR
*/
EAPI void
ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
- int *w,
- int *h,
- int *w_mm,
- int *h_mm)
+ int *w,
+ int *h,
+ int *w_mm,
+ int *h_mm)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
*/
EAPI void
ecore_x_randr_screen_size_range_get(Ecore_X_Window root,
- int *wmin,
- int *hmin,
- int *wmax,
- int *hmax)
+ int *wmin,
+ int *hmin,
+ int *wmax,
+ int *hmax)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
*/
EAPI Eina_Bool
ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
- int w,
- int h,
- int w_mm,
- int h_mm)
+ int w,
+ int h,
+ int w_mm,
+ int h_mm)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(EINA_FALSE);
if (h <= 0)
h = DisplayHeight(_ecore_x_disp, scr);
- if(w_mm <= 0)
+ if (w_mm <= 0)
w_mm =
(int)(((double)(DisplayWidthMM(_ecore_x_disp,
scr) /
(double)DisplayWidth(_ecore_x_disp,
scr))) * (double)w);
- if(h_mm <= 0)
+ if (h_mm <= 0)
h_mm =
(int)(((double)(DisplayHeightMM(_ecore_x_disp,
scr) /
*/
EAPI Ecore_X_Randr_Mode_Info **
ecore_x_randr_modes_info_get(Ecore_X_Window root,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
}
else
{
- while(i > 0)
+ while (i > 0)
free(ret[--i]);
free(ret);
ret = NULL;
* @return mode's detailed information
*/
EAPI Ecore_X_Randr_Mode_Info *
-ecore_x_randr_mode_info_get(Ecore_X_Window root,
+ecore_x_randr_mode_info_get(Ecore_X_Window root,
Ecore_X_Randr_Mode mode)
{
#ifdef ECORE_XRANDR
*/
EAPI Ecore_X_Randr_Crtc *
ecore_x_randr_crtcs_get(Ecore_X_Window root,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
EAPI Ecore_X_Randr_Output *
ecore_x_randr_outputs_get(Ecore_X_Window root,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
* @param num number of outputs referenced by given CRTC
*/
EAPI Ecore_X_Randr_Output *
-ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
+ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
* @param num number of possible outputs referenced by given CRTC
*/
EAPI Ecore_X_Randr_Output *
-ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root,
+ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
crtc) &&
(res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)))
{
- if((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
+ if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc)))
{
if ((ret =
malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->npossible)))
}
EAPI void
-ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
+ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
* @return EINA_TRUE if position could be successfully be altered.
*/
EAPI Eina_Bool
-ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
+ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc,
- int x,
- int y)
+ int x,
+ int y)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(EINA_FALSE);
* Ecore_X_Randr_Unset
*/
EAPI Ecore_X_Randr_Mode
-ecore_x_randr_crtc_mode_get(Ecore_X_Window root,
+ecore_x_randr_crtc_mode_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc)
{
#ifdef ECORE_XRANDR
* @return EINA_TRUE if mode setting was successful. Else EINA_FALSE
*/
EAPI Eina_Bool
-ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
- Ecore_X_Randr_Crtc crtc,
+ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
Ecore_X_Randr_Output *outputs,
- int noutputs,
- Ecore_X_Randr_Mode mode)
+ int noutputs,
+ Ecore_X_Randr_Mode mode)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(EINA_FALSE);
}
EAPI void
-ecore_x_randr_crtc_size_get(Ecore_X_Window root,
+ecore_x_randr_crtc_size_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc,
- int *w,
- int *h)
+ int *w,
+ int *h)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
}
EAPI Ecore_X_Randr_Refresh_Rate
-ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
+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_orientations_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc)
{
#ifdef ECORE_XRANDR
}
EAPI Ecore_X_Randr_Orientation
-ecore_x_randr_crtc_orientation_get(Ecore_X_Window root,
+ecore_x_randr_crtc_orientation_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc)
{
#ifdef ECORE_XRANDR
}
EAPI Eina_Bool
-ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
- Ecore_X_Randr_Crtc crtc,
+ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
Ecore_X_Randr_Orientation orientation)
{
#ifdef ECORE_XRANDR
}
EAPI void
-ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
+ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
Ecore_X_Randr_Crtc crtc,
- int *x,
- int *y)
+ int *x,
+ int *y)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
}
EAPI Eina_Bool
-ecore_x_randr_crtc_clone_set(Ecore_X_Window root,
+ecore_x_randr_crtc_clone_set(Ecore_X_Window root,
Ecore_X_Randr_Crtc original,
Ecore_X_Randr_Crtc clon)
{
* EINA_FALSE
*/
EAPI Eina_Bool
-ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
- Ecore_X_Randr_Crtc crtc,
- Ecore_X_Randr_Output *outputs,
- int noutputs,
- int x,
- int y,
- Ecore_X_Randr_Mode mode,
+ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Output *outputs,
+ int noutputs,
+ int x,
+ int y,
+ Ecore_X_Randr_Mode mode,
Ecore_X_Randr_Orientation orientation)
{
#ifdef ECORE_XRANDR
* @brief sets a CRTC relative to another one.
* @param crtc_r1 the CRTC to be positioned.
* @param crtc_r2 the CRTC the position should be relative to
- * @param position the relation between the crtcs
+ * @param policy the relation between the crtcs
* @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's
* borders
* @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if
* repositioning failed or if position of new crtc would be out of given screen's min/max bounds.
*/
EAPI Eina_Bool
-ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
- Ecore_X_Randr_Crtc crtc_r1,
- Ecore_X_Randr_Crtc crtc_r2,
- Ecore_X_Randr_Output_Policy policy,
+ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc_r1,
+ Ecore_X_Randr_Crtc crtc_r2,
+ Ecore_X_Randr_Output_Policy policy,
Ecore_X_Randr_Relative_Alignment alignment)
{
#ifdef ECORE_XRANDR
}
EAPI Ecore_X_Randr_Mode *
-ecore_x_randr_output_modes_get(Ecore_X_Window root,
+ecore_x_randr_output_modes_get(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- int *num,
- int *npreferred)
+ int *num,
+ int *npreferred)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
}
EAPI Ecore_X_Randr_Crtc *
-ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root,
+ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
* @param num number of possible clones
*/
EAPI Ecore_X_Randr_Output *
-ecore_x_randr_output_clones_get(Ecore_X_Window root,
+ecore_x_randr_output_clones_get(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
}
EAPI Ecore_X_Randr_Crtc
-ecore_x_randr_output_crtc_get(Ecore_X_Window root,
+ecore_x_randr_output_crtc_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
#ifdef ECORE_XRANDR
* @return name of the output as reported by X
*/
EAPI char *
-ecore_x_randr_output_name_get(Ecore_X_Window root,
+ecore_x_randr_output_name_get(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- int *len)
+ int *len)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
* *len = output_info->nameLen;
*
*/
- if ((ret = strdup(output_info->name)) && len)
- *len = strlen(ret);
+ if ((ret = strdup(output_info->name)) && len)
+ *len = strlen(ret);
- XRRFreeOutputInfo(output_info);
+ XRRFreeOutputInfo(output_info);
}
if (res)
* @param h height of given mode in px
*/
EAPI void
-ecore_x_randr_mode_size_get(Ecore_X_Window root,
+ecore_x_randr_mode_size_get(Ecore_X_Window root,
Ecore_X_Randr_Mode mode,
- int *w,
- int *h)
+ int *w,
+ int *h)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
* @param length length of the byte-array. If NULL, request will fail.
*/
EAPI unsigned char *
-ecore_x_randr_output_edid_get(Ecore_X_Window root,
+ecore_x_randr_output_edid_get(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- unsigned long *length)
+ unsigned long *length)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(NULL);
if (!length || !_ecore_x_randr_output_validate(root, output))
return NULL;
- if(XRRGetOutputProperty (_ecore_x_disp, output, name,
- 0, 100, False, False,
- AnyPropertyType,
- &actual_type, &actual_format,
- &nitems, &bytes_after, &prop_data) == Success)
+ if (XRRGetOutputProperty (_ecore_x_disp, output, name,
+ 0, 100, False, False,
+ AnyPropertyType,
+ &actual_type, &actual_format,
+ &nitems, &bytes_after, &prop_data) == Success)
{
if (actual_type == XA_INTEGER && actual_format == 8)
{
if ((ret = malloc(nitems * sizeof(unsigned char))))
{
- if(length &&
- (memcpy(ret, prop_data, (nitems * sizeof(unsigned char)))))
+ if (length &&
+ (memcpy(ret, prop_data, (nitems * sizeof(unsigned char)))))
*length = nitems;
return ret;
}
EAPI Ecore_X_Randr_Connection_Status
-ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
+ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
#ifdef ECORE_XRANDR
}
EAPI void
-ecore_x_randr_output_size_mm_get(Ecore_X_Window root,
+ecore_x_randr_output_size_mm_get(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- int *w_mm,
- int *h_mm)
+ int *w_mm,
+ int *h_mm)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
}
EAPI Eina_Bool
-ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root,
+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)
+ int nnot_moved,
+ int dx,
+ int dy)
{
#ifdef ECORE_XRANDR
Ecore_X_Randr_Crtc *crtcs_to_be_moved = NULL;
* @return EINA_TRUE if all crtcs could be moved successfully.
*/
EAPI Eina_Bool
-ecore_x_randr_move_crtcs(Ecore_X_Window root,
+ecore_x_randr_move_crtcs(Ecore_X_Window root,
const Ecore_X_Randr_Crtc *crtcs,
- int ncrtc,
- int dx,
- int dy)
+ int ncrtc,
+ int dx,
+ int dy)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(EINA_FALSE);
{
//something went wrong, let's try to move the already moved crtcs
//back.
- while ((i--) >= 0)
- {
- if (crtc_info[i])
- ecore_x_randr_crtc_settings_set(root,
- crtcs[i],
- NULL,
- Ecore_X_Randr_Unset,
- (crtc_info[i]->x - dx),
- (crtc_info[i]->y - dy),
- crtc_info[i]->mode,
- crtc_info[i]->rotation);
- }
+ while ((i--) >= 0)
+ {
+ if (crtc_info[i])
+ ecore_x_randr_crtc_settings_set(root,
+ crtcs[i],
+ NULL,
+ Ecore_X_Randr_Unset,
+ (crtc_info[i]->x - dx),
+ (crtc_info[i]->y - dy),
+ crtc_info[i]->mode,
+ crtc_info[i]->rotation);
+ }
}
for (i = 0; i < ncrtc; i++)
EAPI void
ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root,
- double level)
+ double level)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET();
}
/*
+ * @brief check if a backlight is available
+ * @return whether a blacklight is available
+ */
+
+EAPI Eina_Bool
+ecore_x_randr_output_backlight_available(void)
+{
+#ifdef ECORE_XRANDR
+ RANDR_CHECK_1_2_RET(-1);
+ Atom _backlight;
+
+ _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True);
+
+ return (_backlight == None) ? EINA_FALSE : EINA_TRUE;
+
+#endif
+ return EINA_FALSE;
+}
+
+/*
* @brief get the backlight level of the given output
* @param root window which's screen should be queried
* @param output from which the backlight level should be retrieved
*/
EAPI double
-ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
+ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
#ifdef ECORE_XRANDR
if ((info->range) && (info->num_values == 2))
{
/* finally convert the current value in the interval [0..1] */
- min = info->values[0];
- max = info->values[1];
- dvalue = ((double)(value - min)) / ((double)(max - min));
+ min = info->values[0];
+ max = info->values[1];
+ dvalue = ((double)(value - min)) / ((double)(max - min));
}
free(info);
return dvalue;
*/
EAPI Eina_Bool
-ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
+ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
Ecore_X_Randr_Output output,
- double level)
+ double level)
{
#ifdef ECORE_XRANDR
RANDR_CHECK_1_2_RET(EINA_FALSE);
EAPI Ecore_X_Randr_Output *
ecore_x_randr_window_outputs_get(Ecore_X_Window window,
- int *num)
+ int *num)
{
#ifdef ECORE_XRANDR
Ecore_X_Window root;
for (i = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
- mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
- if (mode == Ecore_X_Randr_None) continue;
-
- ecore_x_randr_crtc_geometry_get(root, crtcs[i],
- &c_geo.x, &c_geo.y,
- &c_geo.w, &c_geo.h);
- if (eina_rectangles_intersect(&w_geo, &c_geo))
- {
- outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
- &noutputs);
- /* The case below should be impossible, but for safety reasons
- * remains */
- if (!outputs)
- {
- if (num) *num = 0;
- free(ret);
- free(crtcs);
- return NULL;
- }
- tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
- if (!tret)
- {
- if (num) *num = 0;
- free(outputs);
- free(ret);
- free(crtcs);
- return NULL;
- }
- ret = tret;
- memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
- nret += noutputs;
- free(outputs);
- }
+ mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
+ if (mode == Ecore_X_Randr_None) continue;
+
+ ecore_x_randr_crtc_geometry_get(root, crtcs[i],
+ &c_geo.x, &c_geo.y,
+ &c_geo.w, &c_geo.h);
+ if (eina_rectangles_intersect(&w_geo, &c_geo))
+ {
+ outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
+ &noutputs);
+ /* The case below should be impossible, but for safety reasons
+ * remains */
+ if (!outputs)
+ {
+ if (num) *num = 0;
+ free(ret);
+ free(crtcs);
+ return NULL;
+ }
+ tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
+ if (!tret)
+ {
+ if (num) *num = 0;
+ free(outputs);
+ free(ret);
+ free(crtcs);
+ return NULL;
+ }
+ ret = tret;
+ memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
+ nret += noutputs;
+ free(outputs);
+ }
}
free(crtcs);
EINA_DEPRECATED EAPI Ecore_X_Randr_Output *
ecore_x_randr_current_output_get(Ecore_X_Window window,
- int *num)
+ int *num)
{
return ecore_x_randr_window_outputs_get(window, num);
}
/* Heavily modified by: Leif Middelschulte <leif.middelschulte@gmail.com> */
#include "Ecore_X.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
/* TODO:
* - see other TODO's within this file.
EAPI Eina_Bool
ecore_x_randr_edid_has_valid_header(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
const unsigned char header[] =
{ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
EAPI int
ecore_x_randr_edid_version_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
EAPI int
ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
if ((edid_length > 0x0b) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
EAPI int
ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
if ((edid_length > 0x0f) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
EAPI char *
ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) &&
(ecore_x_randr_edid_has_valid_header(edid, edid_length)))
EAPI char *
ecore_x_randr_edid_display_name_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, 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)
+ unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Ecore_X_Randr_Edid_Aspect_Ratio
ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
unsigned char *block = NULL;
EAPI char *
ecore_x_randr_edid_display_ascii_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI char *
ecore_x_randr_edid_display_serial_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
unsigned char *block = NULL;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Eina_Bool
ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
unsigned char *cea_block_iter = NULL;
char sum = 0;
if (edid_length < 128) return EINA_FALSE;
/* Check the EDID block itself */
- for (i = 0; i < 128; i++) sum += edid[i];
+ for (i = 0; i < 128; i++)
+ sum += edid[i];
if (sum) return EINA_FALSE;
/* Check the cea extension blocks */
_ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter)
{
- for (i = 0, sum = 0; i < 128; i++) sum += cea_block_iter[i];
+ for (i = 0, sum = 0; i < 128; i++)
+ sum += cea_block_iter[i];
}
if (sum) return EINA_FALSE;
return EINA_TRUE;
EAPI Eina_Bool
ecore_x_randr_edid_dpms_available_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Eina_Bool
ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Eina_Bool
ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Eina_Bool
ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Eina_Bool
ecore_x_randr_edid_display_type_digital_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Ecore_X_Randr_Edid_Display_Colorscheme
ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
Ecore_X_Randr_Edid_Display_Colorscheme colorscheme = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
EAPI Ecore_X_Randr_Edid_Display_Interface_Type
ecore_x_randr_edid_display_interface_type_get(unsigned char *edid,
- unsigned long edid_length)
+ unsigned long edid_length)
{
Ecore_X_Randr_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE;
int version = ecore_x_randr_edid_version_get(edid, edid_length);
#include "ecore_x_private.h"
#include "ecore_x_randr.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#define Ecore_X_Randr_None 0
#define Ecore_X_Randr_Unset -1
#ifdef ECORE_XRANDR
#define RANDR_1_3 ((1 << 16) | 3)
-#define RANDR_CHECK_1_3_RET(ret) if(_randr_version < RANDR_1_3) return ret
+#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) \
+ return ret
extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display *
dpy,
* @param output that should be set as given root window's screen primary output
*/
EAPI void
-ecore_x_randr_primary_output_set(Ecore_X_Window root,
+ecore_x_randr_primary_output_set(Ecore_X_Window root,
Ecore_X_Randr_Output output)
{
#ifdef ECORE_XRANDR
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return (Ecore_X_XRegion *)XCreateRegion();
-} /* ecore_x_xregion_new */
+}
EAPI void
ecore_x_xregion_free(Ecore_X_XRegion *region)
return;
XDestroyRegion((Region)region);
-} /* ecore_x_xregion_free */
+}
EAPI Eina_Bool
ecore_x_xregion_set(Ecore_X_XRegion *region,
- Ecore_X_GC gc)
+ Ecore_X_GC gc)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_set */
+}
EAPI void
ecore_x_xregion_translate(Ecore_X_XRegion *region,
- int x,
- int y)
+ int x,
+ int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!region)
/* return value not used */
XOffsetRegion((Region)region, x, y);
-} /* ecore_x_xregion_translate */
+}
EAPI Eina_Bool
ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XIntersectRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_intersect */
+}
EAPI Eina_Bool
ecore_x_xregion_union(Ecore_X_XRegion *dst,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_union */
+}
EAPI Eina_Bool
-ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
- Ecore_X_XRegion *src,
+ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *src,
Ecore_X_Rectangle *rect)
{
XRectangle xr;
xr.height = rect->height;
return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_union_rect */
+}
EAPI Eina_Bool
ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSubtractRegion((Region)rm, (Region)rs, (Region)dst) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_subtract */
+}
EAPI Eina_Bool
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_is_empty */
+}
EAPI Eina_Bool
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_is_equal */
+}
EAPI Eina_Bool
ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
- int x,
- int y)
+ int x,
+ int y)
{
if (!region)
return EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_point_contain */
+}
EAPI Eina_Bool
-ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
+ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
Ecore_X_Rectangle *rect)
{
if (!region || !rect)
rect->y,
rect->width,
rect->height) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_xregion_rect_contain */
+}
_screensaver_available = 0;
#endif /* ifdef ECORE_XSS */
return _screensaver_available;
-} /* ecore_x_screensaver_event_available_get */
+}
EAPI int
ecore_x_screensaver_idle_time_get(void)
#else
return 0;
#endif /* ifdef ECORE_XSS */
-} /* ecore_x_screensaver_idle_time_get */
+}
EAPI void
ecore_x_screensaver_set(int timeout,
interval,
prefer_blanking,
allow_exposures);
-} /* ecore_x_screensaver_set */
+}
EAPI void
ecore_x_screensaver_timeout_set(int timeout)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, timeout, pint, pblank, pexpo);
-} /* ecore_x_screensaver_timeout_set */
+}
EAPI int
ecore_x_screensaver_timeout_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pto;
-} /* ecore_x_screensaver_timeout_get */
+}
EAPI void
ecore_x_screensaver_blank_set(int blank)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, pto, pint, blank, pexpo);
-} /* ecore_x_screensaver_blank_set */
+}
EAPI int
ecore_x_screensaver_blank_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pblank;
-} /* ecore_x_screensaver_blank_get */
+}
EAPI void
ecore_x_screensaver_expose_set(int expose)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, pto, pint, pblank, expose);
-} /* ecore_x_screensaver_expose_set */
+}
EAPI int
ecore_x_screensaver_expose_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pexpo;
-} /* ecore_x_screensaver_expose_get */
+}
EAPI void
ecore_x_screensaver_interval_set(int interval)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, pto, interval, pblank, pexpo);
-} /* ecore_x_screensaver_interval_set */
+}
EAPI int
ecore_x_screensaver_interval_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pint;
-} /* ecore_x_screensaver_interval_get */
+}
EAPI void
ecore_x_screensaver_event_listen_set(Eina_Bool on)
return;
on = EINA_FALSE;
#endif /* ifdef ECORE_XSS */
-} /* ecore_x_screensaver_event_listen_set */
+}
static Ecore_X_Selection_Converter *converters = NULL;
static Ecore_X_Selection_Parser *parsers = NULL;
-static Eina_Bool _ecore_x_selection_converter_text(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
+static Eina_Bool _ecore_x_selection_converter_text(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
Ecore_X_Atom *tprop,
int *);
static int _ecore_x_selection_data_default_free(void *data);
static void *_ecore_x_selection_parser_files(const char *target,
- void *data,
- int size,
- int format);
+ void *data,
+ int size,
+ int format);
static int _ecore_x_selection_data_files_free(void *data);
static void *_ecore_x_selection_parser_text(const char *target,
- void *data,
- int size,
- int format);
+ void *data,
+ int size,
+ int format);
static int _ecore_x_selection_data_text_free(void *data);
static void *_ecore_x_selection_parser_targets(const char *target,
- void *data,
- int size,
- int format);
-static int _ecore_x_selection_data_targets_free(void *data);
+ void *data,
+ int size,
+ int format);
+static int _ecore_x_selection_data_targets_free(void *data);
#define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
_ecore_x_selection_data_init(void)
{
/* Initialize global data */
- memset(selections, 0, sizeof(selections));
+ memset(selections, 0, sizeof(selections));
- /* Initialize converters */
- ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
- _ecore_x_selection_converter_text);
+ /* Initialize converters */
+ ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
+ _ecore_x_selection_converter_text);
#ifdef X_HAVE_UTF8_STRING
- ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
- _ecore_x_selection_converter_text);
+ ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
+ _ecore_x_selection_converter_text);
#endif /* ifdef X_HAVE_UTF8_STRING */
- ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
- _ecore_x_selection_converter_text);
- ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
- _ecore_x_selection_converter_text);
-
- /* Initialize parsers */
- ecore_x_selection_parser_add("text/plain",
- _ecore_x_selection_parser_text);
- ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
- _ecore_x_selection_parser_text);
- ecore_x_selection_parser_add("text/uri-list",
- _ecore_x_selection_parser_files);
- ecore_x_selection_parser_add("_NETSCAPE_URL",
- _ecore_x_selection_parser_files);
- ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
- _ecore_x_selection_parser_targets);
-} /* _ecore_x_selection_data_init */
+ ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
+ _ecore_x_selection_converter_text);
+ ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
+ _ecore_x_selection_converter_text);
+
+ /* Initialize parsers */
+ ecore_x_selection_parser_add("text/plain",
+ _ecore_x_selection_parser_text);
+ ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
+ _ecore_x_selection_parser_text);
+ ecore_x_selection_parser_add("text/uri-list",
+ _ecore_x_selection_parser_files);
+ ecore_x_selection_parser_add("_NETSCAPE_URL",
+ _ecore_x_selection_parser_files);
+ ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
+ _ecore_x_selection_parser_targets);
+}
void
_ecore_x_selection_shutdown(void)
free(tmp);
}
parsers = NULL;
-} /* _ecore_x_selection_shutdown */
+}
Ecore_X_Selection_Intern *
_ecore_x_selection_get(Ecore_X_Atom selection)
return &selections[3];
else
return NULL;
-} /* _ecore_x_selection_get */
+}
Eina_Bool
-_ecore_x_selection_set(Window w,
- const void *data,
- int size,
+_ecore_x_selection_set(Window w,
+ const void *data,
+ int size,
Ecore_X_Atom selection)
{
int in;
}
return EINA_TRUE;
-} /* _ecore_x_selection_set */
+}
/**
* Claim ownership of the PRIMARY selection and set its data.
*/
EAPI Eina_Bool
ecore_x_selection_primary_set(Ecore_X_Window w,
- const void *data,
- int size)
+ const void *data,
+ int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY);
-} /* ecore_x_selection_primary_set */
+}
/**
* Release ownership of the primary selection
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY);
-} /* ecore_x_selection_primary_clear */
+}
/**
* Claim ownership of the SECONDARY selection and set its data.
*/
EAPI Eina_Bool
ecore_x_selection_secondary_set(Ecore_X_Window w,
- const void *data,
- int size)
+ const void *data,
+ int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w,
data,
size,
ECORE_X_ATOM_SELECTION_SECONDARY);
-} /* ecore_x_selection_secondary_set */
+}
/**
* Release ownership of the secondary selection
NULL,
0,
ECORE_X_ATOM_SELECTION_SECONDARY);
-} /* ecore_x_selection_secondary_clear */
+}
/**
* Claim ownership of the XDND selection and set its data.
*/
EAPI Eina_Bool
ecore_x_selection_xdnd_set(Ecore_X_Window w,
- const void *data,
- int size)
+ const void *data,
+ int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND);
-} /* ecore_x_selection_xdnd_set */
+}
/**
* Release ownership of the XDND selection
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND);
-} /* ecore_x_selection_xdnd_clear */
+}
/**
* Claim ownership of the CLIPBOARD selection and set its data.
*/
EAPI Eina_Bool
ecore_x_selection_clipboard_set(Ecore_X_Window w,
- const void *data,
- int size)
+ const void *data,
+ int size)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(w,
data,
size,
ECORE_X_ATOM_SELECTION_CLIPBOARD);
-} /* ecore_x_selection_clipboard_set */
+}
/**
* Release ownership of the clipboard selection
NULL,
0,
ECORE_X_ATOM_SELECTION_CLIPBOARD);
-} /* ecore_x_selection_clipboard_clear */
+}
Ecore_X_Atom
_ecore_x_selection_target_atom_get(const char *target)
x_target = ecore_x_atom_get(target);
return x_target;
-} /* _ecore_x_selection_target_atom_get */
+}
char *
_ecore_x_selection_target_get(Ecore_X_Atom target)
{
/* FIXME: Should not return mem allocated with strdup or X mixed,
* one should use free to free, the other XFree */
- if (target == ECORE_X_ATOM_FILE_NAME)
- return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
- else if (target == ECORE_X_ATOM_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_STRING);
- else if (target == ECORE_X_ATOM_UTF8_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
- else if (target == ECORE_X_ATOM_TEXT)
- return strdup(ECORE_X_SELECTION_TARGET_TEXT);
- else
- return XGetAtomName(_ecore_x_disp, target);
-} /* _ecore_x_selection_target_get */
+ if (target == ECORE_X_ATOM_FILE_NAME)
+ return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
+ else if (target == ECORE_X_ATOM_STRING)
+ return strdup(ECORE_X_SELECTION_TARGET_STRING);
+ else if (target == ECORE_X_ATOM_UTF8_STRING)
+ return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
+ else if (target == ECORE_X_ATOM_TEXT)
+ return strdup(ECORE_X_SELECTION_TARGET_TEXT);
+ else
+ return XGetAtomName(_ecore_x_disp, target);
+}
static void
_ecore_x_selection_request(Ecore_X_Window w,
- Ecore_X_Atom selection,
- const char *target_str)
+ Ecore_X_Atom selection,
+ const char *target_str)
{
Ecore_X_Atom target, prop;
XConvertSelection(_ecore_x_disp, selection, target, prop,
w, CurrentTime);
-} /* _ecore_x_selection_request */
+}
EAPI void
ecore_x_selection_primary_request(Ecore_X_Window w,
- const char *target)
+ const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target);
-} /* ecore_x_selection_primary_request */
+}
EAPI void
ecore_x_selection_secondary_request(Ecore_X_Window w,
- const char *target)
+ const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target);
-} /* ecore_x_selection_secondary_request */
+}
EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window w,
- const char *target)
+ const char *target)
{
Ecore_X_Atom atom;
Ecore_X_DND_Target *_target;
XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom,
ECORE_X_ATOM_SELECTION_PROP_XDND, w,
_target->time);
-} /* ecore_x_selection_xdnd_request */
+}
EAPI void
ecore_x_selection_clipboard_request(Ecore_X_Window w,
- const char *target)
+ const char *target)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
-} /* ecore_x_selection_clipboard_request */
+}
EAPI void
-ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
- Eina_Bool (*func)(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
- Ecore_X_Atom *ttype,
- int *tsize))
+ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
+ Eina_Bool (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *ttype,
+ int *tsize))
{
Ecore_X_Selection_Converter *cnv;
cnv->target = target;
cnv->convert = func;
-} /* ecore_x_selection_converter_atom_add */
+}
EAPI void
-ecore_x_selection_converter_add(char *target,
- Eina_Bool (*func)(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
- Ecore_X_Atom *,
- int *))
+ecore_x_selection_converter_add(char *target,
+ Eina_Bool (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *,
+ int *))
{
Ecore_X_Atom x_target;
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_add(x_target, func);
-} /* ecore_x_selection_converter_add */
+}
EAPI void
ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
prev_cnv = cnv;
cnv = cnv->next;
}
-} /* ecore_x_selection_converter_atom_del */
+}
EAPI void
ecore_x_selection_converter_del(char *target)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_del(x_target);
-} /* ecore_x_selection_converter_del */
+}
EAPI Eina_Bool
ecore_x_selection_notify_send(Ecore_X_Window requestor,
- Ecore_X_Atom selection,
- Ecore_X_Atom target,
- Ecore_X_Atom property,
- Ecore_X_Time tim)
+ Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ Ecore_X_Atom property,
+ Ecore_X_Time tim)
{
XEvent xev;
XSelectionEvent xnotify;
xev.xselection = xnotify;
return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE;
-} /* ecore_x_selection_notify_send */
+}
/* Locate and run conversion callback for specified selection target */
EAPI Eina_Bool
-ecore_x_selection_convert(Ecore_X_Atom selection,
- Ecore_X_Atom target,
- void **data_ret,
- int *size,
+ecore_x_selection_convert(Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ void **data_ret,
+ int *size,
Ecore_X_Atom *targtype,
- int *typesize)
+ int *typesize)
{
Ecore_X_Selection_Intern *sel;
Ecore_X_Selection_Converter *cnv;
return EINA_FALSE;
/* Default, just return the data
- *data_ret = malloc(sel->length);
+ * data_ret = malloc(sel->length);
memcpy(*data_ret, sel->data, sel->length);
free(tgt_str);
return 1;
*/
-} /* ecore_x_selection_convert */
+}
/* TODO: We need to work out a mechanism for automatic conversion to any requested
* locale using Ecore_Txt functions */
/* Converter for standard non-utf8 text targets */
static Eina_Bool
-_ecore_x_selection_converter_text(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
+_ecore_x_selection_converter_text(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
Ecore_X_Atom *targprop __UNUSED__,
- int *s __UNUSED__)
+ int *s __UNUSED__)
{
XTextProperty text_prop;
char *mystr;
{
return EINA_TRUE;
}
-} /* _ecore_x_selection_converter_text */
+}
EAPI void
ecore_x_selection_parser_add(const char *target,
prs->target = strdup(target);
prs->parse = func;
-} /* ecore_x_selection_parser_add */
+}
EAPI void
ecore_x_selection_parser_del(const char *target)
prev_prs = prs;
prs = prs->next;
}
-} /* ecore_x_selection_parser_del */
+}
/**
* Change the owner and last-change time for the specified selection.
* @param win The owner of the specified atom.
* @param atom The selection atom
- * @param time Specifies the time
+ * @param tim Specifies the time
* @since 1.1.0
*/
EAPI void
ecore_x_selection_owner_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Time tim)
+ Ecore_X_Atom atom,
+ Ecore_X_Time tim)
{
XSetSelectionOwner(_ecore_x_disp, atom, win, tim);
}
/* Locate and run conversion callback for specified selection target */
void *
_ecore_x_selection_parse(const char *target,
- void *data,
- int size,
- int format)
+ void *data,
+ int size,
+ int format)
{
Ecore_X_Selection_Parser *prs;
Ecore_X_Selection_Data *sel;
sel->format = format;
sel->data = data;
return sel;
-} /* _ecore_x_selection_parse */
+}
static int
_ecore_x_selection_data_default_free(void *data)
free(sel->data);
free(sel);
return 1;
-} /* _ecore_x_selection_data_default_free */
+}
static void *
_ecore_x_selection_parser_files(const char *target,
- void *_data,
- int size,
- int format __UNUSED__)
+ void *_data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Files *sel;
char *t, *data = _data;
if (data[size - 1])
{
/* Isn't nul terminated */
- size++;
- t = realloc(data, size);
- if (!t)
- {
- free(sel);
- return NULL;
- }
- data = t;
- data[size - 1] = 0;
+ size++;
+ t = realloc(data, size);
+ if (!t)
+ {
+ free(sel);
+ return NULL;
+ }
+ data = t;
+ data[size - 1] = 0;
}
tmp = malloc(size);
tmp[i++] = data[is++];
else
{
- while ((data[is] == '\r') || (data[is] == '\n')) is++;
+ while ((data[is] == '\r') || (data[is] == '\n'))
+ is++;
tmp[i] = 0;
sel->num_files++;
t2 = realloc(sel->files, sel->num_files * sizeof(char *));
ECORE_X_SELECTION_DATA(sel)->length = sel->num_files;
return ECORE_X_SELECTION_DATA(sel);
-} /* _ecore_x_selection_parser_files */
+}
static int
_ecore_x_selection_data_files_free(void *data)
free(sel);
return 0;
-} /* _ecore_x_selection_data_files_free */
+}
static void *
_ecore_x_selection_parser_text(const char *target __UNUSED__,
- void *_data,
- int size,
- int format __UNUSED__)
+ void *_data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Text *sel;
unsigned char *data = _data;
if (data[size - 1])
{
/* Isn't nul terminated */
- size++;
- t = realloc(data, size);
- if (!t)
- {
- free(sel);
- return NULL;
- }
- data = t;
- data[size - 1] = 0;
+ size++;
+ t = realloc(data, size);
+ if (!t)
+ {
+ free(sel);
+ return NULL;
+ }
+ data = t;
+ data[size - 1] = 0;
}
sel->text = (char *)data;
ECORE_X_SELECTION_DATA(sel)->data = data;
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free;
return sel;
-} /* _ecore_x_selection_parser_text */
+}
static int
_ecore_x_selection_data_text_free(void *data)
free(sel->text);
free(sel);
return 1;
-} /* _ecore_x_selection_data_text_free */
+}
static void *
_ecore_x_selection_parser_targets(const char *target __UNUSED__,
- void *data,
- int size,
- int format __UNUSED__)
+ void *data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Targets *sel;
unsigned long *targets;
ECORE_X_SELECTION_DATA(sel)->length = size;
ECORE_X_SELECTION_DATA(sel)->data = data;
return sel;
-} /* _ecore_x_selection_parser_targets */
+}
static int
_ecore_x_selection_data_targets_free(void *data)
free(ECORE_X_SELECTION_DATA(sel)->data);
free(sel);
return 1;
-} /* _ecore_x_selection_data_targets_free */
+}
ecore_x_sync();
return alarm;
-} /* ecore_x_sync_alarm_new */
+}
EAPI Eina_Bool
ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSyncDestroyAlarm(_ecore_x_disp, alarm);
-} /* ecore_x_sync_alarm_free */
+}
EAPI Eina_Bool
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter,
- unsigned int *val)
+ unsigned int *val)
{
XSyncValue value;
}
return EINA_FALSE;
-} /* ecore_x_sync_counter_query */
+}
EAPI Ecore_X_Sync_Counter
ecore_x_sync_counter_new(int val)
XSyncIntToValue(&v, val);
counter = XSyncCreateCounter(_ecore_x_disp, v);
return counter;
-} /* ecore_x_sync_counter_new */
+}
EAPI void
ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncDestroyCounter(_ecore_x_disp, counter);
-} /* ecore_x_sync_counter_free */
+}
EAPI void
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter,
- int by)
+ int by)
{
XSyncValue v;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncIntToValue(&v, by);
XSyncChangeCounter(_ecore_x_disp, counter, v);
-} /* ecore_x_sync_counter_inc */
+}
EAPI void
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter,
- int val)
+ int val)
{
XSyncWaitCondition cond;
XSyncValue v, v2;
cond.event_threshold = v2;
XSyncAwait(_ecore_x_disp, &cond, 1);
// XSync(_ecore_x_disp, False); // dont need this
-} /* ecore_x_sync_counter_val_wait */
+}
EAPI void
ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter,
- int val)
+ int val)
{
XSyncValue v;
EAPI void
ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter,
- int val_hi,
- unsigned int val_lo)
+ int val_hi,
+ unsigned int val_lo)
{
XSyncValue v;
EAPI Eina_Bool
ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
- int *val_hi,
- unsigned int *val_lo)
+ int *val_hi,
+ unsigned int *val_lo)
{
XSyncValue value;
#else /* ifdef ECORE_XTEST */
return EINA_FALSE;
#endif /* ifdef ECORE_XTEST */
-} /* ecore_x_test_fake_key_down */
+}
EAPI Eina_Bool
#ifdef ECORE_XTEST
#else /* ifdef ECORE_XTEST */
return EINA_FALSE;
#endif /* ifdef ECORE_XTEST */
-} /* ecore_x_test_fake_key_up */
+}
EAPI Eina_Bool
#ifdef ECORE_XTEST
#else /* ifdef ECORE_XTEST */
return EINA_FALSE;
#endif /* ifdef ECORE_XTEST */
-} /* ecore_x_test_fake_key_press */
+}
EAPI const char *
ecore_x_keysym_string_get(int keysym)
{
return XKeysymToString(keysym);
-} /* ecore_x_keysym_string_get */
+}
+EAPI int
+ecore_x_keysym_keycode_get(const char *keyname)
+{
+ int keycode = 0;
+
+ if (!strncmp(keyname, "Keycode-", 8))
+ keycode = atoi(keyname + 8);
+ else
+ keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname));
+
+ return keycode;
+}
typedef struct _drmEventContext
{
int version;
- void (*vblank_handler)(int fd,
+ void (*vblank_handler)(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
- void *user_data);
- void (*page_flip_handler)(int fd,
+ void *user_data);
+ void (*page_flip_handler)(int fd,
unsigned int sequence,
unsigned int tv_sec,
unsigned int tv_usec,
- void *user_data);
+ void *user_data);
} drmEventContext;
static int (*sym_drmClose)(int fd) = NULL;
-static int (*sym_drmGetMagic)(int fd,
+static int (*sym_drmGetMagic)(int fd,
drm_magic_t *magic) = NULL;
-static int (*sym_drmWaitVBlank)(int fd,
+static int (*sym_drmWaitVBlank)(int fd,
drmVBlank *vbl) = NULL;
-static int (*sym_drmHandleEvent)(int fd,
+static int (*sym_drmHandleEvent)(int fd,
drmEventContext *evctx) = NULL;
//// dri
static Bool (*sym_DRI2QueryExtension)(Display *display,
- int *eventBase,
- int *errorBase) = NULL;
+ int *eventBase,
+ int *errorBase) = NULL;
static Bool (*sym_DRI2QueryVersion)(Display *display,
- int *major,
- int *minor) = NULL;
+ int *major,
+ int *minor) = NULL;
static Bool (*sym_DRI2Connect)(Display *display,
- XID window,
- char **driverName,
- char **deviceName) = NULL;
-static Bool (*sym_DRI2Authenticate)(Display *display,
- XID window,
+ XID window,
+ char **driverName,
+ char **deviceName) = NULL;
+static Bool (*sym_DRI2Authenticate)(Display *display,
+ XID window,
drm_magic_t magic) = NULL;
//// dri/drm data needed
}
static void
-_dri_drm_vblank_handler(int fd __UNUSED__,
+_dri_drm_vblank_handler(int fd __UNUSED__,
unsigned int frame __UNUSED__,
unsigned int sec __UNUSED__,
unsigned int usec __UNUSED__,
- void *data __UNUSED__)
+ void *data __UNUSED__)
{
ecore_animator_custom_tick();
if (drm_event_is_busy) _dri_drm_tick_schedule();
}
static Eina_Bool
-_dri_drm_cb(void *data __UNUSED__,
+_dri_drm_cb(void *data __UNUSED__,
Ecore_Fd_Handler *fd_handler __UNUSED__)
{
sym_drmHandleEvent(drm_fd, &drm_evctx);
*/
EAPI Ecore_X_Window
ecore_x_window_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
Window win;
XSetWindowAttributes attr;
ecore_x_window_defaults_set(win);
return win;
-} /* ecore_x_window_new */
+}
/**
* Creates a window with the override redirect attribute set to @c True.
*/
EAPI Ecore_X_Window
ecore_x_window_override_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
Window win;
XSetWindowAttributes attr;
CWWinGravity,
&attr);
return win;
-} /* ecore_x_window_override_new */
+}
/**
* Creates a new input window.
*/
EAPI Ecore_X_Window
ecore_x_window_input_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
Window win;
XSetWindowAttributes attr;
}
return win;
-} /* ecore_x_window_input_new */
+}
/**
* @defgroup Ecore_X_Window_Properties_Group X Window Property Functions
ecore_app_args_get(&argc, &argv);
ecore_x_icccm_command_set(win, argc, argv);
-} /* ecore_x_window_defaults_set */
+}
EAPI void
-ecore_x_window_configure(Ecore_X_Window win,
+ecore_x_window_configure(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)
+ int x,
+ int y,
+ int w,
+ int h,
+ int border_width,
+ Ecore_X_Window sibling,
+ int stack_mode)
{
XWindowChanges xwc;
xwc.stack_mode = stack_mode;
XConfigureWindow(_ecore_x_disp, win, mask, &xwc);
-} /* ecore_x_window_configure */
+}
/**
* @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
/* sorry sir, deleting the root window doesn't sound like
* a smart idea.
*/
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (win)
- XDestroyWindow(_ecore_x_disp, win);
-} /* ecore_x_window_free */
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (win)
+ XDestroyWindow(_ecore_x_disp, win);
+}
/**
* Set if a window should be ignored.
*/
EAPI void
ecore_x_window_ignore_set(Ecore_X_Window win,
- int ignore)
+ int ignore)
{
int i, j, cnt;
Ecore_X_Window *t;
t = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
if (t) ignore_list = t;
}
-} /* ecore_x_window_ignore_set */
+}
/**
* Get the ignore list
*num = ignore_num;
return ignore_list;
-} /* ecore_x_window_ignore_list */
+}
/**
* Sends a delete request to the given window.
xev.xclient.data.l[1] = CurrentTime;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
-} /* ecore_x_window_delete_request_send */
+}
/**
* @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XMapWindow(_ecore_x_disp, win);
-} /* ecore_x_window_show */
+}
/**
* Hides a window.
XSendEvent(_ecore_x_disp, xev.xunmap.event, False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev);
XUnmapWindow(_ecore_x_disp, win);
-} /* ecore_x_window_hide */
+}
/**
* @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
*/
EAPI void
ecore_x_window_move(Ecore_X_Window win,
- int x,
- int y)
+ int x,
+ int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XMoveWindow(_ecore_x_disp, win, x, y);
-} /* ecore_x_window_move */
+}
/**
* Resizes a window.
*/
EAPI void
ecore_x_window_resize(Ecore_X_Window win,
- int w,
- int h)
+ int w,
+ int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (w < 1)
h = 1;
XResizeWindow(_ecore_x_disp, win, w, h);
-} /* ecore_x_window_resize */
+}
/**
* Moves and resizes a window.
*/
EAPI void
ecore_x_window_move_resize(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (w < 1)
h = 1;
XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h);
-} /* ecore_x_window_move_resize */
+}
/**
* @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions
// XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime);
XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime);
-} /* ecore_x_window_focus */
+}
/**
* Sets the focus to the given window at a specific time.
*/
EAPI void
ecore_x_window_focus_at_time(Ecore_X_Window win,
- Ecore_X_Time t)
+ Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
// XSetInputFocus(_ecore_x_disp, win, PointerRoot, t);
XSetInputFocus(_ecore_x_disp, win, RevertToParent, t);
-} /* ecore_x_window_focus_at_time */
+}
/**
* gets the focus to the window @p win.
win = 0;
XGetInputFocus(_ecore_x_disp, &win, &revert_mode);
return win;
-} /* ecore_x_window_focus_get */
+}
/**
* @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XRaiseWindow(_ecore_x_disp, win);
-} /* ecore_x_window_raise */
+}
/**
* Lowers the given window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XLowerWindow(_ecore_x_disp, win);
-} /* ecore_x_window_lower */
+}
/**
* @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions
EAPI void
ecore_x_window_reparent(Ecore_X_Window win,
Ecore_X_Window new_parent,
- int x,
- int y)
+ int x,
+ int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (new_parent == 0)
new_parent = DefaultRootWindow(_ecore_x_disp);
XReparentWindow(_ecore_x_disp, win, new_parent, x, y);
-} /* ecore_x_window_reparent */
+}
/**
* Retrieves the size of the given window.
*/
EAPI void
ecore_x_window_size_get(Ecore_X_Window win,
- int *w,
- int *h)
+ int *w,
+ int *h)
{
int dummy_x, dummy_y;
win = DefaultRootWindow(_ecore_x_disp);
ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h);
-} /* ecore_x_window_size_get */
+}
/**
* Retrieves the geometry of the given window.
*/
EAPI void
ecore_x_window_geometry_get(Ecore_X_Window win,
- int *x,
- int *y,
- int *w,
- int *h)
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win)
win = DefaultRootWindow(_ecore_x_disp);
ecore_x_drawable_geometry_get(win, x, y, w, h);
-} /* ecore_x_window_geometry_get */
+}
/**
* Retrieves the width of the border of the given window.
return 0;
return ecore_x_drawable_border_width_get(win);
-} /* ecore_x_window_border_width_get */
+}
/**
* Sets the width of the border of the given window.
*/
EAPI void
ecore_x_window_border_width_set(Ecore_X_Window win,
- int width)
+ int width)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* doesn't make sense to call this on a root window */
return;
XSetWindowBorderWidth (_ecore_x_disp, win, width);
-} /* ecore_x_window_border_width_set */
+}
/**
* Retrieves the depth of the given window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_drawable_depth_get(win);
-} /* ecore_x_window_depth_get */
+}
/**
* To be documented.
*/
EAPI void
ecore_x_window_cursor_show(Ecore_X_Window win,
- Eina_Bool show)
+ Eina_Bool show)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
}
else
XDefineCursor(_ecore_x_disp, win, 0);
-} /* ecore_x_window_cursor_show */
+}
EAPI void
ecore_x_window_cursor_set(Ecore_X_Window win,
XUndefineCursor(_ecore_x_disp, win);
else
XDefineCursor(_ecore_x_disp, win, c);
-} /* ecore_x_window_cursor_set */
+}
/**
* Finds out whether the given window is currently visible.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XGetWindowAttributes(_ecore_x_disp, win, &attr) &&
(attr.map_state == IsViewable);
-} /* ecore_x_window_visible_get */
+}
typedef struct _Shadow Shadow;
struct _Shadow
XFree(list);
return s;
-} /* _ecore_x_window_tree_walk */
+}
static void
_ecore_x_window_tree_shadow_free1(Shadow *s)
}
free(s);
-} /* _ecore_x_window_tree_shadow_free1 */
+}
static void
_ecore_x_window_tree_shadow_free(void)
free(shadow_base);
shadow_base = NULL;
shadow_num = 0;
-} /* _ecore_x_window_tree_shadow_free */
+}
static void
_ecore_x_window_tree_shadow_populate(void)
free(roots);
}
-} /* _ecore_x_window_tree_shadow_populate */
+}
/*
static int shadow_count = 0;
static Shadow *
_ecore_x_window_shadow_tree_find_shadow(Shadow *s,
- Window win)
+ Window win)
{
Shadow *ss;
int i;
}
return NULL;
-} /* _ecore_x_window_shadow_tree_find_shadow */
+}
static Shadow *
_ecore_x_window_shadow_tree_find(Window base)
return s;
}
return NULL;
-} /* _ecore_x_window_shadow_tree_find */
+}
static int
-_inside_rects(Shadow *s,
- int x,
- int y,
- int bx,
- int by,
+_inside_rects(Shadow *s,
+ int x,
+ int y,
+ int bx,
+ int by,
Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
int i, inside;
}
static Window
-_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s,
- int bx,
- int by,
- int x,
- int y,
+_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s,
+ int bx,
+ int by,
+ int x,
+ int y,
Ecore_X_Window *skip,
- int skip_num)
+ int skip_num)
{
Window child;
int i, j;
}
return s->win;
-} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */
+}
static Window
-_ecore_x_window_shadow_tree_at_xy_get(Window base,
- int bx,
- int by,
- int x,
- int y,
+_ecore_x_window_shadow_tree_at_xy_get(Window base,
+ int bx,
+ int by,
+ int x,
+ int y,
Ecore_X_Window *skip,
- int skip_num)
+ int skip_num)
{
Shadow *s;
y,
skip,
skip_num);
-} /* _ecore_x_window_shadow_tree_at_xy_get */
+}
/**
* Retrieves the top, visible window at the given location,
* @ingroup Ecore_X_Window_Geometry_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base,
- int x,
- int y,
+ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base,
+ int x,
+ int y,
Ecore_X_Window *skip,
- int skip_num)
+ int skip_num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_window_shadow_tree_at_xy_get(base,
y,
skip,
skip_num);
-} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */
+}
/**
* Retrieves the parent window a given window has. This uses the shadow window
}
}
return 0;
-} /* ecore_x_window_shadow_parent_get */
+}
/**
* Flushes the window shadow tree so nothing is stored.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_tree_shadow_free();
-} /* ecore_x_window_shadow_tree_flush */
+}
/**
* Retrieves the root window a given window is on.
return 0;
return att.root;
-} /* ecore_x_window_root_get */
+}
static Window
-_ecore_x_window_at_xy_get(Window base,
- int bx,
- int by,
- int x,
- int y,
+_ecore_x_window_at_xy_get(Window base,
+ int bx,
+ int by,
+ int x,
+ int y,
Ecore_X_Window *skip,
- int skip_num)
+ int skip_num)
{
Window *list = NULL;
Window parent_win = 0, child = 0, root_win = 0;
}
return base;
-} /* _ecore_x_window_at_xy_get */
+}
/**
* Retrieves the top, visible window at the given location.
ecore_x_ungrab();
return win ? win : root;
-} /* ecore_x_window_at_xy_get */
+}
/**
* Retrieves the top, visible window at the given location,
* @ingroup Ecore_X_Window_Geometry_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_at_xy_with_skip_get(int x,
- int y,
+ecore_x_window_at_xy_with_skip_get(int x,
+ int y,
Ecore_X_Window *skip,
- int skip_num)
+ int skip_num)
{
Ecore_X_Window win, root;
ecore_x_ungrab();
return win ? win : root;
-} /* ecore_x_window_at_xy_with_skip_get */
+}
EAPI Ecore_X_Window
ecore_x_window_at_xy_begin_get(Ecore_X_Window begin,
- int x,
- int y)
+ int x,
+ int y)
{
Ecore_X_Window win;
ecore_x_ungrab();
return win ? win : begin;
-} /* ecore_x_window_at_xy_begin_get */
+}
/**
* Retrieves the parent window of the given window.
XFree(children);
return parent;
-} /* ecore_x_window_parent_get */
+}
/**
* Sets the background color of the given window.
attr.background_pixel = col.pixel;
XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr);
-} /* ecore_x_window_background_color_set */
+}
EAPI void
-ecore_x_window_gravity_set(Ecore_X_Window win,
+ecore_x_window_gravity_set(Ecore_X_Window win,
Ecore_X_Gravity grav)
{
XSetWindowAttributes att;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
att.win_gravity = grav;
XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att);
-} /* ecore_x_window_gravity_set */
+}
EAPI void
-ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
+ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
Ecore_X_Gravity grav)
{
XSetWindowAttributes att;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
att.bit_gravity = grav;
XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att);
-} /* ecore_x_window_pixel_gravity_set */
+}
EAPI void
ecore_x_window_pixmap_set(Ecore_X_Window win,
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap);
-} /* ecore_x_window_pixmap_set */
+}
EAPI void
ecore_x_window_area_clear(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XClearArea(_ecore_x_disp, win, x, y, w, h, False);
-} /* ecore_x_window_area_clear */
+}
EAPI void
ecore_x_window_area_expose(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XClearArea(_ecore_x_disp, win, x, y, w, h, True);
-} /* ecore_x_window_area_expose */
+}
EAPI void
ecore_x_window_override_set(Ecore_X_Window win,
- Eina_Bool override)
+ Eina_Bool override)
{
XSetWindowAttributes att;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
att.override_redirect = override;
XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att);
-} /* ecore_x_window_override_set */
+}
#ifdef ECORE_XRENDER
static Ecore_X_Window
_ecore_x_window_argb_internal_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h,
- Eina_Bool override,
- Eina_Bool saveunder)
+ int x,
+ int y,
+ int w,
+ int h,
+ Eina_Bool override,
+ Eina_Bool saveunder)
{
Window win;
XSetWindowAttributes attr;
else
{
/* ewww - round trip */
- XGetWindowAttributes(_ecore_x_disp, parent, &att);
- for (i = 0; i < ScreenCount(_ecore_x_disp); i++)
- {
- if (att.screen == ScreenOfDisplay(_ecore_x_disp, i))
- {
- scr = i;
- break;
- }
- }
+ XGetWindowAttributes(_ecore_x_disp, parent, &att);
+ for (i = 0; i < ScreenCount(_ecore_x_disp); i++)
+ {
+ if (att.screen == ScreenOfDisplay(_ecore_x_disp, i))
+ {
+ scr = i;
+ break;
+ }
+ }
}
vi_in.screen = scr;
ecore_x_window_defaults_set(win);
return win;
-} /* _ecore_x_window_argb_internal_new */
+}
#endif /* ifdef ECORE_XRENDER */
#else /* ifdef ECORE_XRENDER */
return 0;
#endif /* ifdef ECORE_XRENDER */
-} /* ecore_x_window_argb_get */
+}
/**
* Creates a new window.
*/
EAPI Ecore_X_Window
ecore_x_window_manager_argb_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ECORE_XRENDER
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#else /* ifdef ECORE_XRENDER */
return 0;
#endif /* ifdef ECORE_XRENDER */
-} /* ecore_x_window_manager_argb_new */
+}
/**
* Creates a new window.
*/
EAPI Ecore_X_Window
ecore_x_window_argb_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ECORE_XRENDER
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#else /* ifdef ECORE_XRENDER */
return 0;
#endif /* ifdef ECORE_XRENDER */
-} /* ecore_x_window_argb_new */
+}
/**
* Creates a window with the override redirect attribute set to @c True.
*/
EAPI Ecore_X_Window
ecore_x_window_override_argb_new(Ecore_X_Window parent,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ECORE_XRENDER
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#else /* ifdef ECORE_XRENDER */
return 0;
#endif /* ifdef ECORE_XRENDER */
-} /* ecore_x_window_override_argb_new */
+}
*/
EAPI void
ecore_x_window_prop_card32_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- unsigned int *val,
- unsigned int num)
+ Ecore_X_Atom atom,
+ unsigned int *val,
+ unsigned int num)
{
#if SIZEOF_INT == SIZEOF_LONG
_ATOM_SET_CARD32(win, atom, val, num);
_ATOM_SET_CARD32(win, atom, v2, num);
free(v2);
#endif /* if SIZEOF_INT == SIZEOF_LONG */
-} /* ecore_x_window_prop_card32_set */
+}
/*
* Get CARD32 (array) property
*/
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- unsigned int *val,
- unsigned int len)
+ Ecore_X_Atom atom,
+ unsigned int *val,
+ unsigned int len)
{
unsigned char *prop_ret;
Atom type_ret;
XFree(prop_ret);
return num;
-} /* ecore_x_window_prop_card32_get */
+}
/*
* Get CARD32 (array) property of any length
*/
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
+ Ecore_X_Atom atom,
unsigned int **plst)
{
unsigned char *prop_ret;
else
{
val = malloc(num_ret * sizeof(unsigned int));
- if (!val)
+ if (!val)
{
if (prop_ret) XFree(prop_ret);
return -1;
XFree(prop_ret);
return num;
-} /* ecore_x_window_prop_card32_list_get */
+}
/*
* Set X ID (array) property
*/
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID *lst,
- unsigned int num)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID *lst,
+ unsigned int num)
{
#if SIZEOF_INT == SIZEOF_LONG
XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace,
(unsigned char *)pl, num);
free(pl);
#endif /* if SIZEOF_INT == SIZEOF_LONG */
-} /* ecore_x_window_prop_xid_set */
+}
/*
* Get X ID (array) property
*/
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)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID *lst,
+ unsigned int len)
{
unsigned char *prop_ret;
Atom type_ret;
XFree(prop_ret);
return num;
-} /* ecore_x_window_prop_xid_get */
+}
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID **val)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID **val)
{
unsigned char *prop_ret;
Atom type_ret;
XFree(prop_ret);
return num;
-} /* ecore_x_window_prop_xid_list_get */
+}
/*
* Remove/add/toggle X ID list item.
*/
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID item,
- int op)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID item,
+ int op)
{
Ecore_X_ID *lst;
int i, num;
if (i < num)
{
/* Was in list */
- if (op == ECORE_X_PROP_LIST_ADD)
- goto done; /* Remove it */
+ if (op == ECORE_X_PROP_LIST_ADD)
+ goto done; /* Remove it */
- num--;
- for (; i < num; i++)
- lst[i] = lst[i + 1];
+ num--;
+ for (; i < num; i++)
+ lst[i] = lst[i + 1];
}
else
{
/* Was not in list */
- if (op == ECORE_X_PROP_LIST_REMOVE)
- goto done; /* Add it */
+ if (op == ECORE_X_PROP_LIST_REMOVE)
+ goto done; /* Add it */
- num++;
- lst = realloc(lst, num * sizeof(Ecore_X_ID));
- lst[i] = item;
+ num++;
+ lst = realloc(lst, num * sizeof(Ecore_X_ID));
+ lst[i] = item;
}
ecore_x_window_prop_xid_set(win, atom, type, lst, num);
done:
if (lst)
free(lst);
-} /* ecore_x_window_prop_xid_list_change */
+}
/*
* Set Atom (array) property
*/
EAPI void
ecore_x_window_prop_atom_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom *lst,
- unsigned int num)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom *lst,
+ unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num);
-} /* ecore_x_window_prop_atom_set */
+}
/*
* Get Atom (array) property
*/
EAPI int
ecore_x_window_prop_atom_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom *lst,
- unsigned int len)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom *lst,
+ unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len);
-} /* ecore_x_window_prop_atom_get */
+}
/*
* Get Atom (array) property
*/
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
+ Ecore_X_Atom atom,
Ecore_X_Atom **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst);
-} /* ecore_x_window_prop_atom_list_get */
+}
/*
* Remove/add/toggle atom list item.
*/
EAPI void
ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom item,
- int op)
+ Ecore_X_Atom atom,
+ Ecore_X_Atom item,
+ int op)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op);
-} /* ecore_x_window_prop_atom_list_change */
+}
/*
* Set Window (array) property
*/
EAPI void
-ecore_x_window_prop_window_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
+ecore_x_window_prop_window_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
Ecore_X_Window *lst,
- unsigned int num)
+ unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num);
-} /* ecore_x_window_prop_window_set */
+}
/*
* Get Window (array) property
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
-ecore_x_window_prop_window_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
+ecore_x_window_prop_window_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
Ecore_X_Window *lst,
- unsigned int len)
+ unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len);
-} /* ecore_x_window_prop_window_get */
+}
/*
* Get Window (array) property
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
-ecore_x_window_prop_window_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
+ecore_x_window_prop_window_list_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
Ecore_X_Window **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
-} /* ecore_x_window_prop_window_list_get */
+}
/**
* To be documented.
ecore_x_window_prop_any_type(void)
{
return AnyPropertyType;
-} /* ecore_x_window_prop_any_type */
+}
/**
* To be documented.
*/
EAPI void
ecore_x_window_prop_property_set(Ecore_X_Window win,
- Ecore_X_Atom property,
- Ecore_X_Atom type,
- int size,
- void *data,
- int number)
+ Ecore_X_Atom property,
+ Ecore_X_Atom type,
+ int size,
+ void *data,
+ int number)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (win == 0)
dat = malloc(sizeof(unsigned long) * number);
if (dat)
{
- for (ptr = (int *)data, i = 0; i < number; i++) dat[i] = ptr[i];
+ for (ptr = (int *)data, i = 0; i < number; i++)
+ dat[i] = ptr[i];
XChangeProperty(_ecore_x_disp, win, property, type, size,
PropModeReplace, (unsigned char *)dat, number);
free(dat);
}
}
-} /* ecore_x_window_prop_property_set */
+}
/**
* To be documented.
* FIXME: To be fixed.
*/
EAPI int
-ecore_x_window_prop_property_get(Ecore_X_Window win,
- Ecore_X_Atom property,
- Ecore_X_Atom type,
- int size __UNUSED__,
+ecore_x_window_prop_property_get(Ecore_X_Window win,
+ Ecore_X_Atom property,
+ Ecore_X_Atom type,
+ int size __UNUSED__,
unsigned char **data,
- int *num)
+ int *num)
{
Atom type_ret = 0;
int ret, size_ret = 0;
for (i = 0; i < num_ret; i++)
((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i];
break;
- } /* switch */
+ }
XFree(prop_ret);
*num = num_ret;
return size_ret;
-} /* ecore_x_window_prop_property_get */
+}
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window win,
- Ecore_X_Atom property)
+ Ecore_X_Atom property)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDeleteProperty(_ecore_x_disp, win, property);
-} /* ecore_x_window_prop_property_del */
+}
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window win,
- int *num_ret)
+ int *num_ret)
{
Ecore_X_Atom *atoms;
Atom *atom_ret;
atoms = malloc(num * sizeof(Ecore_X_Atom));
if (atoms)
{
- for (i = 0; i < num; i++) atoms[i] = atom_ret[i];
+ for (i = 0; i < num; i++)
+ atoms[i] = atom_ret[i];
if (num_ret)
*num_ret = num;
}
XFree(atom_ret);
return atoms;
-} /* ecore_x_window_prop_list */
+}
/**
* Set a window string property.
*/
EAPI void
ecore_x_window_prop_string_set(Ecore_X_Window win,
- Ecore_X_Atom type,
- const char *str)
+ Ecore_X_Atom type,
+ const char *str)
{
XTextProperty xtp;
xtp.encoding = ECORE_X_ATOM_UTF8_STRING;
xtp.nitems = strlen(str);
XSetTextProperty(_ecore_x_disp, win, &xtp, type);
-} /* ecore_x_window_prop_string_set */
+}
/**
* Get a window string property.
*/
EAPI char *
ecore_x_window_prop_string_get(Ecore_X_Window win,
- Ecore_X_Atom type)
+ Ecore_X_Atom type)
{
XTextProperty xtp;
char *str = NULL;
}
return str;
-} /* ecore_x_window_prop_string_get */
+}
EAPI Eina_Bool
-ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
+ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol)
{
Atom proto, *protos = NULL;
XFree(protos);
return ret;
-} /* ecore_x_window_prop_protocol_isset */
+}
/**
* To be documented.
*/
EAPI Ecore_X_WM_Protocol *
ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
- int *num_ret)
+ int *num_ret)
{
Atom *protos = NULL;
int i, protos_count = 0;
XFree(protos);
*num_ret = protos_count;
return prot_ret;
-} /* ecore_x_window_prop_protocol_list_get */
+}
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
-} /* ecore_x_window_shape_mask_set */
+}
/**
* Sets the input shape of the given window to that given by the pixmap @p mask.
return;
win = mask = 0;
#endif /* ifdef ShapeInput */
-} /* ecore_x_window_shape_input_mask_set */
+}
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window win,
shape_win,
ShapeBounding,
ShapeSet);
-} /* ecore_x_window_shape_window_set */
+}
EAPI void
ecore_x_window_shape_input_window_set(Ecore_X_Window win,
return;
win = shape_win = 0;
#endif
-} /* ecore_x_window_shape_input_window_set */
+}
EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
- int x,
- int y)
+ int x,
+ int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineShape(_ecore_x_disp,
shape_win,
ShapeBounding,
ShapeSet);
-} /* ecore_x_window_shape_window_set_xy */
+}
EAPI void
ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
- int x,
- int y)
+ int x,
+ int y)
{
#ifdef ShapeInput
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return;
win = shape_win = x = y = 0;
#endif
-} /* ecore_x_window_shape_input_window_set_xy */
+}
EAPI void
ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
XRectangle rect;
1,
ShapeSet,
Unsorted);
-} /* ecore_x_window_shape_rectangle_set */
+}
EAPI void
ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ShapeInput
XRectangle rect;
return;
win = x = y = w = h = 0;
#endif
-} /* ecore_x_window_shape_input_rectangle_set */
+}
EAPI void
-ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
+ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
#ifdef ShapeInput
XRectangle *rect = NULL;
return;
win = rects = num = 0;
#endif
-} /* ecore_x_window_shape_rectangles_set */
+}
EAPI void
-ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
+ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
#ifdef ShapeInput
XRectangle *rect = NULL;
return;
win = rects = num = 0;
#endif
-} /* ecore_x_window_shape_input_rectangles_set */
+}
EAPI void
ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
XRectangle rect;
1,
ShapeSubtract,
Unsorted);
-} /* ecore_x_window_shape_rectangle_subtract */
+}
EAPI void
ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ShapeInput
XRectangle rect;
return;
win = x = y = w = h = 0;
#endif
-} /* ecore_x_window_shape_input_rectangle_subtract */
+}
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window win,
shape_win,
ShapeBounding,
ShapeUnion);
-} /* ecore_x_window_shape_window_add */
+}
EAPI void
ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
- int x,
- int y)
+ int x,
+ int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineShape(_ecore_x_disp,
shape_win,
ShapeBounding,
ShapeUnion);
-} /* ecore_x_window_shape_window_add_xy */
+}
EAPI void
ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
- int x,
- int y)
+ int x,
+ int y)
{
#ifdef ShapeInput
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return;
win = shape_win = x = y = 0;
#endif
-} /* ecore_x_window_shape_input_window_add_xy */
+}
EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
XRectangle rect;
1,
ShapeUnion,
Unsorted);
-} /* ecore_x_window_shape_rectangle_add */
+}
EAPI void
ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ShapeInput
XRectangle rect;
return;
win = x = y = w = h = 0;
#endif
-} /* ecore_x_window_shape_input_rectangle_add */
+}
EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
XRectangle rect;
1,
ShapeIntersect,
Unsorted);
-} /* ecore_x_window_shape_rectangle_clip */
+}
EAPI void
ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
- int x,
- int y,
- int w,
- int h)
+ int x,
+ int y,
+ int w,
+ int h)
{
#ifdef ShapeInput
XRectangle rect;
return;
win = x = y = w = h = 0;
#endif
-} /* ecore_x_window_shape_input_rectangle_clip */
+}
EAPI void
-ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
+ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
XRectangle *rect = NULL;
int i;
ShapeUnion,
Unsorted);
if (rect) free(rect);
-} /* ecore_x_window_shape_rectangles_add */
+}
EAPI void
-ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
+ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
- int num)
+ int num)
{
#ifdef ShapeInput
XRectangle *rect = NULL;
return;
win = rects = num = 0;
#endif
-} /* ecore_x_window_shape_input_rectangles_add */
+}
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
- int *num_ret)
+ int *num_ret)
{
XRectangle *rect;
Ecore_X_Rectangle *rects = NULL;
}
if (num_ret) *num_ret = num;
return rects;
-} /* ecore_x_window_shape_rectangles_get */
+}
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
- int *num_ret)
+ int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
#ifdef ShapeInput
if (num_ret) *num_ret = 1;
return rects;
#endif
-} /* ecore_x_window_shape_input_rectangles_get */
+}
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window win,
- Eina_Bool on)
+ Eina_Bool on)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (on)
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
else
XShapeSelectInput(_ecore_x_disp, win, 0);
-} /* ecore_x_window_shape_events_select */
+}
_ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices,
&_ecore_x_xi2_num);
#endif /* ifdef ECORE_XI2 */
-} /* _ecore_x_input_init */
+}
void
_ecore_x_input_shutdown(void)
_ecore_x_xi2_num = 0;
_ecore_x_xi2_opcode = -1;
#endif /* ifdef ECORE_XI2 */
-} /* _ecore_x_input_shutdown */
+}
void
_ecore_x_input_handler(XEvent *xevent)
#endif
default:
break;
- } /* switch */
+ }
#endif /* ifdef ECORE_XI2 */
-} /* _ecore_x_input_handler */
+}
EAPI Eina_Bool
ecore_x_input_multi_select(Ecore_X_Window win)
#else /* ifdef ECORE_XI2 */
return EINA_FALSE;
#endif /* ifdef ECORE_XI2 */
-} /* ecore_x_input_multi_select */
+}
#endif /* ifdef ECORE_XINERAMA */
return 0;
-} /* ecore_x_xinerama_screen_count_get */
+}
EAPI Eina_Bool
-ecore_x_xinerama_screen_geometry_get(int screen,
+ecore_x_xinerama_screen_geometry_get(int screen,
int *x,
int *y,
int *w,
return EINA_FALSE;
screen = 0;
-} /* ecore_x_xinerama_screen_geometry_get */
+}
if BUILD_ECORE_IMF_XIM
SUBDIRS += xim
endif
+
+if BUILD_ECORE_IMF_SCIM
+SUBDIRS += scim
+endif
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in
+
+AM_CPPFLAGS = \
+-I$(top_srcdir) \
+-I$(top_srcdir)/src/lib/ecore \
+-I$(top_srcdir)/src/lib/ecore_input \
+-I$(top_srcdir)/src/lib/ecore_x \
+-I$(top_srcdir)/src/lib/ecore_imf \
+-I$(top_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)\" \
+@SCIM_CFLAGS@ \
+@EVAS_CFLAGS@ \
+@EINA_CFLAGS@
+
+pkgdir = $(libdir)/ecore/immodules
+
+pkg_LTLIBRARIES = scim.la
+scim_la_SOURCES = \
+scim_imcontext.cpp \
+scim_module.cpp \
+scim_imcontext.h
+
+scim_la_LIBADD = \
+ $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
+ $(top_builddir)/src/lib/ecore_x/libecore_x.la \
+ @SCIM_LIBS@ \
+ @EVAS_LIBS@ \
+ @EINA_LIBS@
+scim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
+scim_la_LIBTOOLFLAGS = --tag=disable-static
--- /dev/null
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define Uses_SCIM_DEBUG
+#define Uses_SCIM_BACKEND
+#define Uses_SCIM_IMENGINE_MODULE
+#define Uses_SCIM_HOTKEY
+#define Uses_SCIM_PANEL_CLIENT
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <Ecore_Evas.h>
+#include <Ecore_X.h>
+#include <Ecore.h>
+#include <Evas.h>
+
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+#include <X11/Xutil.h>
+
+#include <scim.h>
+#include "scim_imcontext.h"
+
+using namespace scim;
+
+struct _EcoreIMFContextISFImpl
+{
+ EcoreIMFContextISF *parent;
+ IMEngineInstancePointer si;
+ Ecore_X_Window client_window;
+ Evas *client_canvas;
+ Ecore_IMF_Input_Mode input_mode;
+ WideString preedit_string;
+ AttributeList preedit_attrlist;
+ Ecore_IMF_Autocapital_Type autocapital_type;
+ int preedit_caret;
+ int cursor_x;
+ int cursor_y;
+ int cursor_pos;
+ bool use_preedit;
+ bool is_on;
+ bool shared_si;
+ bool preedit_started;
+ bool preedit_updating;
+ bool need_commit_preedit;
+ bool uppercase;
+ bool prediction_allow;
+
+ EcoreIMFContextISFImpl *next;
+};
+
+/* Input Context handling functions. */
+static EcoreIMFContextISFImpl *new_ic_impl (EcoreIMFContextISF *parent);
+static void delete_ic_impl (EcoreIMFContextISFImpl *impl);
+static void delete_all_ic_impl (void);
+
+static EcoreIMFContextISF *find_ic (int id);
+
+
+/* private functions */
+static void panel_slot_reload_config (int context);
+static void panel_slot_exit (int context);
+static void panel_slot_update_lookup_table_page_size(int context,
+ int page_size);
+static void panel_slot_lookup_table_page_up (int context);
+static void panel_slot_lookup_table_page_down (int context);
+static void panel_slot_trigger_property (int context,
+ const String &property);
+static void panel_slot_process_helper_event (int context,
+ const String &target_uuid,
+ const String &helper_uuid,
+ const Transaction &trans);
+static void panel_slot_move_preedit_caret (int context,
+ int caret_pos);
+static void panel_slot_select_candidate (int context,
+ int cand_index);
+static void panel_slot_process_key_event (int context,
+ const KeyEvent &key);
+static void panel_slot_commit_string (int context,
+ const WideString &wstr);
+static void panel_slot_forward_key_event (int context,
+ const KeyEvent &key);
+static void panel_slot_request_help (int context);
+static void panel_slot_request_factory_menu (int context);
+static void panel_slot_change_factory (int context,
+ const String &uuid);
+
+static void panel_req_focus_in (EcoreIMFContextISF *ic);
+static void panel_req_update_factory_info (EcoreIMFContextISF *ic);
+static void panel_req_update_spot_location (EcoreIMFContextISF *ic);
+static void panel_req_show_help (EcoreIMFContextISF *ic);
+static void panel_req_show_factory_menu (EcoreIMFContextISF *ic);
+
+/* Panel iochannel handler*/
+static bool panel_initialize (void);
+static void panel_finalize (void);
+static Eina_Bool panel_iochannel_handler (void *data,
+ Ecore_Fd_Handler *fd_handler);
+
+/* utility functions */
+static bool filter_hotkeys (EcoreIMFContextISF *ic,
+ const KeyEvent &key);
+static void turn_on_ic (EcoreIMFContextISF *ic);
+static void turn_off_ic (EcoreIMFContextISF *ic);
+static void set_ic_capabilities (EcoreIMFContextISF *ic);
+
+static void initialize (void);
+static void finalize (void);
+
+static void open_next_factory (EcoreIMFContextISF *ic);
+static void open_previous_factory (EcoreIMFContextISF *ic);
+static void open_specific_factory (EcoreIMFContextISF *ic,
+ const String &uuid);
+static void initialize_modifier_bits (Display *display);
+static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask);
+static XKeyEvent createKeyEvent (Display *display, Window &win,
+ Window &winRoot, bool press,
+ int keycode, int modifiers);
+static void _x_send_key_event (const KeyEvent &key);
+
+static void attach_instance (const IMEngineInstancePointer &si);
+
+/* slot functions */
+static void slot_show_preedit_string (IMEngineInstanceBase *si);
+static void slot_show_aux_string (IMEngineInstanceBase *si);
+static void slot_show_lookup_table (IMEngineInstanceBase *si);
+
+static void slot_hide_preedit_string (IMEngineInstanceBase *si);
+static void slot_hide_aux_string (IMEngineInstanceBase *si);
+static void slot_hide_lookup_table (IMEngineInstanceBase *si);
+
+static void slot_update_preedit_caret (IMEngineInstanceBase *si,
+ int caret);
+static void slot_update_preedit_string (IMEngineInstanceBase *si,
+ const WideString &str,
+ const AttributeList &attrs);
+static void slot_update_aux_string (IMEngineInstanceBase *si,
+ const WideString &str,
+ const AttributeList &attrs);
+static void slot_commit_string (IMEngineInstanceBase *si,
+ const WideString &str);
+static void slot_forward_key_event (IMEngineInstanceBase *si,
+ const KeyEvent &key);
+static void slot_update_lookup_table (IMEngineInstanceBase *si,
+ const LookupTable &table);
+
+static void slot_register_properties (IMEngineInstanceBase *si,
+ const PropertyList &properties);
+static void slot_update_property (IMEngineInstanceBase *si,
+ const Property &property);
+static void slot_beep (IMEngineInstanceBase *si);
+static void slot_start_helper (IMEngineInstanceBase *si,
+ const String &helper_uuid);
+static void slot_stop_helper (IMEngineInstanceBase *si,
+ const String &helper_uuid);
+static void slot_send_helper_event (IMEngineInstanceBase *si,
+ const String &helper_uuid,
+ const Transaction &trans);
+static bool slot_get_surrounding_text (IMEngineInstanceBase *si,
+ WideString &text,
+ int &cursor,
+ int maxlen_before,
+ int maxlen_after);
+static bool slot_delete_surrounding_text (IMEngineInstanceBase *si,
+ int offset,
+ int len);
+
+static void reload_config_callback (const ConfigPointer &config);
+
+static void fallback_commit_string_cb (IMEngineInstanceBase *si,
+ const WideString &str);
+
+static void caps_mode_check (Ecore_IMF_Context *ctx, Eina_Bool force);
+
+/* Local variables declaration */
+static String _language;
+static EcoreIMFContextISFImpl *_used_ic_impl_list = 0;
+static EcoreIMFContextISFImpl *_free_ic_impl_list = 0;
+static EcoreIMFContextISF *_ic_list = 0;
+
+static KeyboardLayout _keyboard_layout = SCIM_KEYBOARD_Default;
+static int _valid_key_mask = SCIM_KEY_AllMasks;
+
+static FrontEndHotkeyMatcher _frontend_hotkey_matcher;
+static IMEngineHotkeyMatcher _imengine_hotkey_matcher;
+
+static IMEngineInstancePointer _default_instance;
+
+static ConfigModule *_config_module = 0;
+static ConfigPointer _config;
+static BackEndPointer _backend;
+
+static EcoreIMFContextISF *_focused_ic = 0;
+
+static bool _scim_initialized = false;
+
+static int _instance_count = 0;
+static int _context_count = 0;
+
+static IMEngineFactoryPointer _fallback_factory;
+static IMEngineInstancePointer _fallback_instance;
+static PanelClient _panel_client;
+
+static Ecore_Fd_Handler *_panel_iochannel_read_handler = 0;
+static Ecore_Fd_Handler *_panel_iochannel_err_handler = 0;
+
+static Ecore_X_Window _client_window = 0;
+
+static bool _on_the_spot = true;
+static bool _shared_input_method = false;
+
+static Eina_Bool autocap_allow = EINA_FALSE;
+
+static Display *__current_display = 0;
+static int __current_alt_mask = Mod1Mask;
+static int __current_meta_mask = 0;
+static int __current_super_mask = 0;
+static int __current_hyper_mask = 0;
+static int __current_numlock_mask = Mod2Mask;
+
+// A hack to shutdown the immodule cleanly even if im_module_exit() is not called when exiting.
+class FinalizeHandler
+{
+public:
+ FinalizeHandler()
+ {
+ SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler()\n";
+ }
+ ~FinalizeHandler()
+ {
+ SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler()\n";
+ isf_imf_context_shutdown();
+ }
+};
+
+static FinalizeHandler _finalize_handler;
+
+static unsigned int
+utf8_offset_to_index(const char *str, int offset)
+{
+ int index = 0;
+ int i;
+ for (i = 0; i < offset; i++)
+ {
+ eina_unicode_utf8_get_next(str, &index);
+ }
+
+ return index;
+}
+
+static unsigned int
+get_time(void)
+{
+ unsigned int tint;
+ struct timeval tv;
+ struct timezone tz; /* is not used since ages */
+ gettimeofday(&tv, &tz);
+ tint = tv.tv_sec * 1000;
+ tint = tint / 1000 * 1000;
+ tint = tint + tv.tv_usec / 1000;
+ return tint;
+}
+
+/* Function Implementations */
+static EcoreIMFContextISFImpl *
+new_ic_impl(EcoreIMFContextISF *parent)
+{
+ EcoreIMFContextISFImpl *impl = NULL;
+
+ if (_free_ic_impl_list != NULL)
+ {
+ impl = _free_ic_impl_list;
+ _free_ic_impl_list = _free_ic_impl_list->next;
+ }
+ else
+ {
+ impl = new EcoreIMFContextISFImpl;
+ if (impl == NULL)
+ return NULL;
+ }
+
+ impl->uppercase = false;
+ impl->autocapital_type = ECORE_IMF_AUTOCAPITAL_TYPE_NONE;
+ impl->next = _used_ic_impl_list;
+ _used_ic_impl_list = impl;
+
+ impl->parent = parent;
+
+ return impl;
+}
+
+static void
+delete_ic_impl(EcoreIMFContextISFImpl *impl)
+{
+ EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0;
+
+ for (; rec != 0; last = rec, rec = rec->next)
+ {
+ if (rec == impl)
+ {
+ if (last != 0)
+ last->next = rec->next;
+ else
+ _used_ic_impl_list = rec->next;
+
+ rec->next = _free_ic_impl_list;
+ _free_ic_impl_list = rec;
+
+ rec->parent = 0;
+ rec->si.reset();
+ rec->client_window = 0;
+ rec->preedit_string = WideString();
+ rec->preedit_attrlist.clear();
+
+ return;
+ }
+ }
+}
+
+static void
+delete_all_ic_impl(void)
+{
+ EcoreIMFContextISFImpl *it = _used_ic_impl_list;
+
+ while (it != 0)
+ {
+ _used_ic_impl_list = it->next;
+ delete it;
+ it = _used_ic_impl_list;
+ }
+
+ it = _free_ic_impl_list;
+ while (it != 0)
+ {
+ _free_ic_impl_list = it->next;
+ delete it;
+ it = _free_ic_impl_list;
+ }
+}
+
+static EcoreIMFContextISF *
+find_ic(int id)
+{
+ EcoreIMFContextISFImpl *rec = _used_ic_impl_list;
+
+ while (rec != 0)
+ {
+ if (rec->parent && rec->parent->id == id)
+ return rec->parent;
+ rec = rec->next;
+ }
+
+ return 0;
+}
+
+static Eina_Bool
+analyze_surrounding_text(Ecore_IMF_Context *ctx)
+{
+ char *plain_str = NULL;
+ char *markup_str = NULL;
+ const char *puncs[3] = {". ", "! ", "? "};
+ Eina_Bool ret = EINA_FALSE;
+ int cursor_pos = 0;
+ int i = 0;
+ Eina_Unicode *tail = NULL;
+ Eina_Unicode *ustr = NULL;
+ Eina_Unicode *uni_puncs[3];
+ EcoreIMFContextISF *context_scim;
+
+ if (!ctx) return EINA_FALSE;
+ context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+ if (!context_scim || !context_scim->impl) return EINA_FALSE;
+
+ switch (context_scim->impl->autocapital_type)
+ {
+ case ECORE_IMF_AUTOCAPITAL_TYPE_NONE:
+ return EINA_FALSE;
+ case ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER:
+ return EINA_TRUE;
+ default:
+ break;
+ }
+
+ for (i = 0; i < 3; i++)
+ uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL);
+
+ ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos);
+ if (!markup_str) goto done;
+
+ if (cursor_pos == 0)
+ {
+ ret = EINA_TRUE;
+ goto done;
+ }
+
+ // Convert into plain string
+ plain_str = evas_textblock_text_markup_to_utf8(NULL, markup_str);
+ if (!plain_str) goto done;
+
+ // Convert string from utf8 to unicode
+ ustr = eina_unicode_utf8_to_unicode(plain_str, NULL);
+ if (!ustr) goto done;
+
+ if (cursor_pos >= 1)
+ {
+ if (context_scim->impl->autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_WORD)
+ {
+ if (ustr[cursor_pos-1] == ' ')
+ {
+ ret = EINA_TRUE;
+ goto done;
+ }
+ }
+
+ // Check paragraph separator <PS> and carrage return <br>
+ if ((ustr[cursor_pos-1] == 0x2029) || (ustr[cursor_pos-1] == '\n'))
+ {
+ ret = EINA_TRUE;
+ goto done;
+ }
+ }
+
+ // check punctuation
+ if (cursor_pos >= 2)
+ {
+ tail = eina_unicode_strndup(ustr+cursor_pos-2, 2);
+
+ if (tail)
+ {
+ for (i = 0; i < 3; i++)
+ {
+ if (!eina_unicode_strcmp(tail, uni_puncs[i]))
+ {
+ ret = EINA_TRUE;
+ break;
+ }
+ }
+ free(tail);
+ tail = NULL;
+ }
+ }
+
+done:
+ if (ustr) free(ustr);
+ if (markup_str) free(markup_str);
+ if (plain_str) free(plain_str);
+
+ for (i = 0; i < 3; i++)
+ if (uni_puncs[i]) free(uni_puncs[i]);
+
+ return ret;
+}
+
+static void
+caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force)
+{
+ Eina_Bool uppercase;
+ EcoreIMFContextISF *context_scim;
+
+ if (!ctx) return;
+ context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (autocap_allow == EINA_FALSE)
+ return;
+
+ // Check autocapital type
+ if (!context_scim || !context_scim->impl)
+ return;
+
+ if (analyze_surrounding_text(ctx))
+ uppercase = EINA_TRUE;
+ else
+ uppercase = EINA_FALSE;
+
+ if (force)
+ context_scim->impl->uppercase = uppercase;
+ else
+ if (context_scim->impl->uppercase != uppercase)
+ context_scim->impl->uppercase = uppercase;
+}
+
+static void
+feed_key_event(Evas *evas, const char *str, Eina_Bool fake)
+{
+ char key_string[128] = {0};
+ unsigned int timestamp = 0;
+
+ if (!fake)
+ timestamp = get_time();
+
+ if (strncmp(str, "KeyRelease+", 11) == 0)
+ {
+ strncpy(key_string, str + 11, strlen(str)-11);
+ evas_event_feed_key_up(evas, key_string, key_string, NULL, NULL, timestamp, NULL);
+ SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up()...\n";
+ }
+ else
+ {
+ strncpy(key_string, str, strlen(str));
+ evas_event_feed_key_down(evas, key_string, key_string, NULL, NULL, timestamp, NULL);
+ SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down()...\n";
+ }
+}
+
+/* Public functions */
+/**
+ * isf_imf_context_new
+ *
+ * This function will be called by Ecore IMF.
+ * Create a instance of type EcoreIMFContextISF.
+ *
+ * Return value: A pointer to the newly created EcoreIMFContextISF instance
+ */
+EAPI EcoreIMFContextISF *
+isf_imf_context_new(void)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ char *env;
+
+ Ecore_X_Display *display = ecore_x_display_get();
+ if (!display)
+ {
+ std::cerr << "ecore_x_display_get() failed !!!";
+ return NULL;
+ }
+
+ EcoreIMFContextISF *context_scim = new EcoreIMFContextISF;
+ if (context_scim == NULL)
+ {
+ std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n";
+ return NULL;
+ }
+
+ context_scim->id = _context_count++;
+
+ if (!_scim_initialized)
+ {
+ initialize();
+ _scim_initialized = true;
+ }
+
+ env = getenv("ECORE_IMF_AUTOCAPITAL_ALLOW");
+ if (env)
+ autocap_allow = !!atoi(env);
+
+ return context_scim;
+}
+
+/**
+ * isf_imf_shutdown
+ *
+ * It will be called when the scim im module is unloaded by ecore. It will do some
+ * cleanup job.
+ */
+EAPI void
+isf_imf_context_shutdown(void)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (_scim_initialized)
+ {
+ _scim_initialized = false;
+ finalize();
+ }
+}
+
+EAPI void
+isf_imf_context_add(Ecore_IMF_Context *ctx)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+
+ if (!context_scim) return;
+
+ context_scim->impl = NULL;
+
+ if (_backend.null())
+ return;
+
+ IMEngineInstancePointer si;
+
+ // Use the default instance if "shared input method" mode is enabled.
+ if (_shared_input_method && !_default_instance.null())
+ {
+ si = _default_instance;
+ SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n";
+ }
+
+ // Not in "shared input method" mode, or no default instance, create an instance.
+ if (si.null())
+ {
+ IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
+ if (factory.null()) return;
+ si = factory->create_instance("UTF-8", _instance_count++);
+ if (si.null()) return;
+ attach_instance(si);
+ SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n";
+ }
+
+ // If "shared input method" mode is enabled, and there is no default instance,
+ // then store this instance as default one.
+ if (_shared_input_method && _default_instance.null())
+ {
+ SCIM_DEBUG_FRONTEND(2) << "update default instance.\n";
+ _default_instance = si;
+ }
+
+ context_scim->ctx = ctx;
+ context_scim->impl = new_ic_impl(context_scim);
+ if (context_scim->impl == NULL)
+ {
+ std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n";
+ return;
+ }
+
+ context_scim->impl->si = si;
+ context_scim->impl->client_window = 0;
+ context_scim->impl->client_canvas = NULL;
+ context_scim->impl->preedit_caret = 0;
+ context_scim->impl->cursor_x = 0;
+ context_scim->impl->cursor_y = 0;
+ context_scim->impl->cursor_pos = -1;
+ context_scim->impl->is_on = false;
+ context_scim->impl->shared_si = _shared_input_method;
+ context_scim->impl->use_preedit = _on_the_spot;
+ context_scim->impl->preedit_started = false;
+ context_scim->impl->preedit_updating = false;
+ context_scim->impl->need_commit_preedit = false;
+
+ if (!_ic_list)
+ context_scim->next = NULL;
+ else
+ context_scim->next = _ic_list;
+ _ic_list = context_scim;
+
+ if (_shared_input_method)
+ context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
+
+ _panel_client.prepare(context_scim->id);
+ _panel_client.register_input_context(context_scim->id, si->get_factory_uuid());
+ set_ic_capabilities(context_scim);
+ _panel_client.send();
+
+ SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n";
+}
+
+EAPI void
+isf_imf_context_del(Ecore_IMF_Context *ctx)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (!_ic_list) return;
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+
+ if (context_scim)
+ {
+ if (context_scim->id != _ic_list->id)
+ {
+ EcoreIMFContextISF * pre = _ic_list;
+ EcoreIMFContextISF * cur = _ic_list->next;
+ while (cur != NULL)
+ {
+ if (cur->id == context_scim->id)
+ {
+ pre->next = cur->next;
+ break;
+ }
+ pre = cur;
+ cur = cur->next;
+ }
+ }
+ else
+ _ic_list = _ic_list->next;
+ }
+
+ if (context_scim && context_scim->impl)
+ {
+ _panel_client.prepare(context_scim->id);
+
+ if (context_scim == _focused_ic)
+ context_scim->impl->si->focus_out();
+
+ // Delete the instance.
+ EcoreIMFContextISF *old_focused = _focused_ic;
+ _focused_ic = context_scim;
+ context_scim->impl->si.reset();
+ _focused_ic = old_focused;
+
+ if (context_scim == _focused_ic)
+ {
+ _panel_client.turn_off(context_scim->id);
+ _panel_client.focus_out(context_scim->id);
+ }
+
+ _panel_client.remove_input_context(context_scim->id);
+ _panel_client.send();
+
+ if (context_scim->impl->client_window)
+ isf_imf_context_client_window_set(ctx, NULL);
+
+ if (context_scim->impl)
+ {
+ delete_ic_impl(context_scim->impl);
+ context_scim->impl = 0;
+ }
+ }
+
+ if (context_scim == _focused_ic)
+ _focused_ic = 0;
+
+ if (context_scim)
+ {
+ delete context_scim;
+ context_scim = 0;
+ }
+}
+
+/**
+ * isf_imf_context_client_canvas_set
+ * @ctx: a #Ecore_IMF_Context
+ * @canvas: the client canvas
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Set the client canvas for the Input Method Context; this is the canvas
+ * in which the input appears.
+ *
+ * The canvas type can be determined by using the context canvas type.
+ * Actually only canvas with type "evas" (Evas *) is supported. This canvas
+ * may be used in order to correctly position status windows, and may also
+ * be used for purposes internal to the Input Method Context.
+ */
+EAPI void
+isf_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas)
+ context_scim->impl->client_canvas = (Evas*)canvas;
+}
+
+/**
+ * isf_imf_context_client_window_set
+ * @ctx: a #Ecore_IMF_Context
+ * @window: the client window
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Set the client window for the Input Method Context; this is the Ecore_X_Window
+ * when using X11, Ecore_Win32_Window when using Win32, etc.
+ *
+ * This window is used in order to correctly position status windows,
+ * and may also be used for purposes internal to the Input Method Context.
+ */
+EAPI void
+isf_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window))
+ {
+ context_scim->impl->client_window = (Ecore_X_Window)((Ecore_Window)window);
+
+ if ((context_scim->impl->client_window != 0) &&
+ (context_scim->impl->client_window != _client_window))
+ _client_window = context_scim->impl->client_window;
+ }
+}
+
+/**
+ * isf_imf_context_reset
+ * @ctx: a #Ecore_IMF_Context
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Notify the Input Method Context that a change such as a change in cursor
+ * position has been made. This will typically cause the Input Method Context
+ * to clear the preedit state.
+ */
+EAPI void
+isf_imf_context_reset(Ecore_IMF_Context *ctx)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim == _focused_ic)
+ {
+ WideString wstr = context_scim->impl->preedit_string;
+
+ _panel_client.prepare(context_scim->id);
+ context_scim->impl->si->reset();
+ _panel_client.send();
+
+ if (context_scim->impl->need_commit_preedit)
+ {
+ if (wstr.length())
+ {
+ ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str());
+ ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
+ }
+ _panel_client.prepare(context_scim->id);
+ _panel_client.send();
+ }
+ }
+}
+
+/**
+ * isf_imf_context_focus_in
+ * @ctx: a #Ecore_IMF_Context
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Notify the Input Method Context that the widget to which its correspond has gained focus.
+ */
+EAPI void
+isf_imf_context_focus_in(Ecore_IMF_Context *ctx)
+{
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (!context_scim)
+ return;
+
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__<< "(" << context_scim->id << ")...\n";
+
+ if (_focused_ic)
+ {
+ if (_focused_ic == context_scim)
+ {
+ SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n";
+ return;
+ }
+ SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n";
+ if (_focused_ic->ctx)
+ isf_imf_context_focus_out(_focused_ic->ctx);
+ }
+
+ bool need_cap = false;
+ bool need_reset = false;
+ bool need_reg = false;
+
+ if (context_scim && context_scim->impl)
+ {
+ _focused_ic = context_scim;
+ _panel_client.prepare(context_scim->id);
+
+ // Handle the "Shared Input Method" mode.
+ if (_shared_input_method)
+ {
+ SCIM_DEBUG_FRONTEND(2) << "shared input method.\n";
+ IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
+ if (!factory.null())
+ {
+ if (_default_instance.null() || _default_instance->get_factory_uuid() != factory->get_uuid())
+ {
+ _default_instance = factory->create_instance("UTF-8", _default_instance.null() ? _instance_count++ : _default_instance->get_id());
+ attach_instance(_default_instance);
+ SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id() << " " << _default_instance->get_factory_uuid() << "\n";
+ }
+
+ context_scim->impl->shared_si = true;
+ context_scim->impl->si = _default_instance;
+
+ context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
+ context_scim->impl->preedit_string.clear();
+ context_scim->impl->preedit_attrlist.clear();
+ context_scim->impl->preedit_caret = 0;
+ context_scim->impl->preedit_started = false;
+ need_cap = true;
+ need_reset = true;
+ need_reg = true;
+ }
+ }
+ else if (context_scim->impl->shared_si)
+ {
+ SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n";
+ IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
+ if (!factory.null())
+ {
+ context_scim->impl->si = factory->create_instance("UTF-8", _instance_count++);
+ context_scim->impl->preedit_string.clear();
+ context_scim->impl->preedit_attrlist.clear();
+ context_scim->impl->preedit_caret = 0;
+ context_scim->impl->preedit_started = false;
+ attach_instance(context_scim->impl->si);
+ need_cap = true;
+ need_reg = true;
+ context_scim->impl->shared_si = false;
+ SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id() << " " << context_scim->impl->si->get_factory_uuid() << "\n";
+ }
+ }
+
+ context_scim->impl->si->set_frontend_data(static_cast <void*>(context_scim));
+
+ if (need_reg) _panel_client.register_input_context(context_scim->id, context_scim->impl->si->get_factory_uuid());
+ if (need_cap) set_ic_capabilities(context_scim);
+ if (need_reset) context_scim->impl->si->reset();
+
+ panel_req_focus_in(context_scim);
+ panel_req_update_spot_location(context_scim);
+ panel_req_update_factory_info(context_scim);
+
+ if (context_scim->impl->is_on)
+ {
+ _panel_client.turn_on(context_scim->id);
+ _panel_client.hide_preedit_string(context_scim->id);
+ _panel_client.hide_aux_string(context_scim->id);
+ _panel_client.hide_lookup_table(context_scim->id);
+ context_scim->impl->si->focus_in();
+ }
+ else
+ {
+ _panel_client.turn_off(context_scim->id);
+ }
+
+ _panel_client.send();
+ }
+}
+
+/**
+ * isf_imf_context_focus_out
+ * @ctx: a #Ecore_IMF_Context
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Notify the Input Method Context that the widget to which its correspond has lost focus.
+ */
+EAPI void
+isf_imf_context_focus_out(Ecore_IMF_Context *ctx)
+{
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (!context_scim) return;
+
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "(" << context_scim->id << ")...\n";
+
+ if (context_scim && context_scim->impl && context_scim == _focused_ic)
+ {
+ WideString wstr = context_scim->impl->preedit_string;
+
+ if (context_scim->impl->need_commit_preedit)
+ {
+ if (wstr.length())
+ {
+ ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str());
+ ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
+ }
+ _panel_client.prepare(context_scim->id);
+ _panel_client.send();
+ }
+
+ _panel_client.prepare(context_scim->id);
+ context_scim->impl->si->focus_out();
+ context_scim->impl->si->reset();
+ _panel_client.turn_off(context_scim->id);
+ _panel_client.focus_out(context_scim->id);
+ _panel_client.send();
+ _focused_ic = 0;
+ }
+}
+
+/**
+ * isf_imf_context_cursor_location_set
+ * @ctx: a #Ecore_IMF_Context
+ * @x: x position of New cursor.
+ * @y: y position of New cursor.
+ * @w: the width of New cursor.
+ * @h: the height of New cursor.
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Notify the Input Method Context that a change in the cursor location has been made.
+ */
+EAPI void
+isf_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+ Ecore_Evas *ee;
+ int canvas_x, canvas_y;
+
+ if (cw == 0 && ch == 0)
+ return;
+
+ if (context_scim && context_scim->impl && context_scim == _focused_ic)
+ {
+ // Don't update spot location while updating preedit string.
+ if (context_scim->impl->preedit_updating)
+ return;
+
+ if (!context_scim->impl->client_canvas)
+ return;
+
+ ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
+ if (!ee) return;
+
+ ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL);
+
+ if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch)
+ {
+ context_scim->impl->cursor_x = canvas_x + cx;
+ context_scim->impl->cursor_y = canvas_y + cy + ch;
+ _panel_client.prepare(context_scim->id);
+ panel_req_update_spot_location(context_scim);
+ _panel_client.send();
+ SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n";
+ }
+ }
+}
+
+/**
+ * isf_imf_context_use_preedit_set
+ * @ctx: a #Ecore_IMF_Context
+ * @use_preedit: Whether the IM context should use the preedit string.
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Set whether the IM context should use the preedit string to display feedback.
+ * If is 0 (default is 1), then the IM context may use some other method to
+ * display feedback, such as displaying it in a child of the root window.
+ */
+EAPI void
+isf_imf_context_use_preedit_set(Ecore_IMF_Context* ctx, Eina_Bool use_preedit)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+
+ if (!_on_the_spot) return;
+
+ if (context_scim && context_scim->impl)
+ {
+ bool old = context_scim->impl->use_preedit;
+ context_scim->impl->use_preedit = use_preedit;
+ if (context_scim == _focused_ic)
+ {
+ _panel_client.prepare(context_scim->id);
+
+ if (old != use_preedit)
+ set_ic_capabilities(context_scim);
+
+ if (context_scim->impl->preedit_string.length())
+ slot_show_preedit_string(context_scim->impl->si);
+
+ _panel_client.send();
+ }
+ }
+}
+
+EAPI void
+isf_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim->impl->is_on)
+ {
+ String mbs = utf8_wcstombs(context_scim->impl->preedit_string);
+
+ if (str)
+ {
+ if (mbs.length())
+ *str = strdup(mbs.c_str());
+ else
+ *str = strdup("");
+ }
+
+ if (cursor_pos)
+ {
+ *cursor_pos = context_scim->impl->preedit_caret;
+ }
+
+ if (attrs)
+ {
+ if (mbs.length())
+ {
+ int start_index, end_index;
+ int wlen = context_scim->impl->preedit_string.length();
+
+ Ecore_IMF_Preedit_Attr *attr = NULL;
+ AttributeList::const_iterator i;
+ bool *attrs_flag = new bool [mbs.length()];
+ memset(attrs_flag, 0, mbs.length() *sizeof(bool));
+
+ for (i = context_scim->impl->preedit_attrlist.begin();
+ i != context_scim->impl->preedit_attrlist.end(); ++i)
+ {
+ start_index = i->get_start();
+ end_index = i->get_end();
+
+ if (end_index <= wlen && start_index < end_index && i->get_type() != SCIM_ATTR_DECORATE_NONE)
+ {
+ start_index = utf8_offset_to_index(mbs.c_str(), i->get_start());
+ end_index = utf8_offset_to_index(mbs.c_str(), i->get_end());
+
+ if (i->get_type() == SCIM_ATTR_DECORATE)
+ {
+ attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
+ if (attr == NULL)
+ continue;
+ attr->start_index = start_index;
+ attr->end_index = end_index;
+
+ if (i->get_value() == SCIM_ATTR_DECORATE_UNDERLINE)
+ {
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1;
+ *attrs = eina_list_append(*attrs, (void *)attr);
+ }
+ else if (i->get_value() == SCIM_ATTR_DECORATE_REVERSE)
+ {
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
+ *attrs = eina_list_append(*attrs, (void *)attr);
+ }
+ else if (i->get_value() == SCIM_ATTR_DECORATE_HIGHLIGHT)
+ {
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
+ *attrs = eina_list_append(*attrs, (void *)attr);
+ }
+ else
+ {
+ free(attr);
+ }
+
+ switch(i->get_value())
+ {
+ case SCIM_ATTR_DECORATE_UNDERLINE:
+ case SCIM_ATTR_DECORATE_REVERSE:
+ case SCIM_ATTR_DECORATE_HIGHLIGHT:
+ // Record which character has attribute.
+ for (int pos = start_index; pos < end_index; ++pos)
+ attrs_flag [pos] = 1;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (i->get_type() == SCIM_ATTR_FOREGROUND)
+ {
+ SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n";
+ }
+ else if (i->get_type() == SCIM_ATTR_BACKGROUND)
+ {
+ SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n";
+ }
+ }
+ }
+
+ // Add underline for all characters which don't have attribute.
+ for (unsigned int pos = 0; pos < mbs.length(); ++pos)
+ {
+ if (!attrs_flag [pos])
+ {
+ int begin_pos = pos;
+
+ while (pos < mbs.length() && !attrs_flag[pos])
+ ++pos;
+
+ // use REVERSE style as default
+ attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
+ if (attr == NULL)
+ continue;
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
+ attr->start_index = begin_pos;
+ attr->end_index = pos;
+ *attrs = eina_list_append(*attrs, (void *)attr);
+ }
+ }
+
+ delete [] attrs_flag;
+ }
+ }
+ }
+ else
+ {
+ if (str)
+ *str = strdup("");
+
+ if (cursor_pos)
+ *cursor_pos = 0;
+
+ if (attrs)
+ *attrs = NULL;
+ }
+}
+
+/**
+ * isf_imf_context_preedit_string_get
+ * @ctx: a #Ecore_IMF_Context
+ * @str: the preedit string
+ * @cursor_pos: the cursor position
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * To get the preedit string of the input method.
+ */
+EAPI void
+isf_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char** str, int *cursor_pos)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim->impl->is_on)
+ {
+ String mbs = utf8_wcstombs(context_scim->impl->preedit_string);
+
+ if (str)
+ {
+ if (mbs.length())
+ *str = strdup(mbs.c_str());
+ else
+ *str = strdup("");
+ }
+
+ if (cursor_pos)
+ *cursor_pos = context_scim->impl->preedit_caret;
+ }
+ else
+ {
+ if (str)
+ *str = strdup("");
+
+ if (cursor_pos)
+ *cursor_pos = 0;
+ }
+}
+
+/**
+ * isf_imf_context_cursor_position_set
+ * @ctx: a #Ecore_IMF_Context
+ * @cursor_pos: New cursor position in characters.
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Notify the Input Method Context that a change in the cursor position has been made.
+ */
+EAPI void
+isf_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim == _focused_ic)
+ {
+ // Don't update spot location while updating preedit string.
+ if (context_scim->impl->preedit_updating)
+ return;
+
+ if (context_scim->impl->cursor_pos != cursor_pos)
+ {
+ context_scim->impl->cursor_pos = cursor_pos;
+ caps_mode_check(ctx, EINA_FALSE);
+ }
+ }
+}
+
+/**
+ * isf_imf_context_input_mode_set
+ * @ctx: a #Ecore_IMF_Context
+ * @input_mode: the input mode
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * To set the input mode of input method. The definition of Ecore_IMF_Input_Mode
+ * is in Ecore_IMF.h.
+ */
+EAPI void
+isf_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+ if (context_scim && context_scim->impl)
+ context_scim->impl->input_mode = input_mode;
+}
+
+/**
+ * isf_imf_context_prediction_allow_set
+ * @ctx: a #Ecore_IMF_Context
+ * @use_prediction: Whether the IM context should use the prediction.
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Set whether the IM context should use the prediction.
+ */
+EAPI void
+isf_imf_context_prediction_allow_set(Ecore_IMF_Context* ctx, Eina_Bool prediction)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction)
+ context_scim->impl->prediction_allow = prediction;
+}
+
+EAPI void
+isf_imf_context_autocapital_type_set(Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n";
+
+ EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
+
+ if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type)
+ context_scim->impl->autocapital_type = autocapital_type;
+}
+
+/**
+ * isf_imf_context_filter_event
+ * @ctx: a #Ecore_IMF_Context
+ * @type: The type of event defined by Ecore_IMF_Event_Type.
+ * @event: The event itself.
+ * Return value: %TRUE if the input method handled the key event.
+ *
+ * This function will be called by Ecore IMF.
+ *
+ * Allow an Ecore Input Context to internally handle an event. If this function
+ * returns 1, then no further processing should be done for this event. Input
+ * methods must be able to accept all types of events (simply returning 0 if
+ * the event was not handled), but there is no obligation of any events to be
+ * submitted to this function.
+ */
+
+EAPI Eina_Bool
+isf_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
+ Eina_Bool ret = EINA_FALSE;
+
+ if (ic == NULL || ic->impl == NULL)
+ return ret;
+
+ KeyEvent key;
+
+ if (type == ECORE_IMF_EVENT_KEY_DOWN)
+ {
+ Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
+ scim_string_to_key(key, ev->key);
+ if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
+ if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
+ if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
+ if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_CAPS) key.mask |=SCIM_KEY_CapsLockMask;
+ if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_NUM) key.mask |=SCIM_KEY_NumLockMask;
+ }
+ else if (type == ECORE_IMF_EVENT_KEY_UP)
+ {
+ Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event;
+ scim_string_to_key(key, ev->key);
+ key.mask = SCIM_KEY_ReleaseMask;
+ if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
+ if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
+ if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
+ if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_CAPS) key.mask |=SCIM_KEY_CapsLockMask;
+ if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_NUM) key.mask |=SCIM_KEY_NumLockMask;
+ }
+ else
+ {
+ return ret;
+ }
+
+ key.mask &= _valid_key_mask;
+
+ _panel_client.prepare(ic->id);
+
+ ret = EINA_TRUE;
+ if (!filter_hotkeys(ic, key))
+ {
+ if (!_focused_ic || !_focused_ic->impl->is_on ||
+ !_focused_ic->impl->si->process_key_event(key))
+ ret = EINA_FALSE;
+ }
+
+ _panel_client.send();
+
+ return ret;
+}
+
+/* Panel Slot functions */
+static void
+panel_slot_reload_config(int context __UNUSED__)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+ _config->reload();
+}
+
+static void
+panel_slot_exit(int /* context */)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ finalize();
+}
+
+static void
+panel_slot_update_lookup_table_page_size(int context, int page_size)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n";
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ ic->impl->si->update_lookup_table_page_size(page_size);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_lookup_table_page_up(int context)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ ic->impl->si->lookup_table_page_up();
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_lookup_table_page_down(int context)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ ic->impl->si->lookup_table_page_down();
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_trigger_property(int context, const String &property)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n";
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ ic->impl->si->trigger_property(property);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_process_helper_event(int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid
+ << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid="
+ << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid() : "" ) << "\n";
+ if (ic && ic->impl && ic->impl->si->get_factory_uuid() == target_uuid)
+ {
+ _panel_client.prepare(ic->id);
+ SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n";
+ ic->impl->si->process_helper_event(helper_uuid, trans);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_move_preedit_caret(int context, int caret_pos)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n";
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ ic->impl->si->move_preedit_caret(caret_pos);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_select_candidate(int context, int cand_index)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n";
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ ic->impl->si->select_candidate(cand_index);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_process_key_event(int context, const KeyEvent &key)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n";
+
+ if (ic && ic->impl && ic->impl->client_canvas)
+ feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE);
+}
+
+static void
+panel_slot_commit_string(int context, const WideString &wstr)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs(wstr) << " ic=" << ic << "\n";
+
+ if (ic && ic->impl)
+ {
+ if (_focused_ic != ic)
+ return;
+
+ ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(wstr).c_str());
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
+ }
+}
+
+static void
+panel_slot_forward_key_event(int context, const KeyEvent &key)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n";
+
+ if (ic && ic->impl && ic->impl->client_canvas)
+ feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_TRUE);
+}
+
+static void
+panel_slot_request_help(int context)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ panel_req_show_help(ic);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_request_factory_menu(int context)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
+
+ if (ic && ic->impl)
+ {
+ _panel_client.prepare(ic->id);
+ panel_req_show_factory_menu(ic);
+ _panel_client.send();
+ }
+}
+
+static void
+panel_slot_change_factory(int context, const String &uuid)
+{
+ EcoreIMFContextISF *ic = find_ic(context);
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n";
+
+ if (ic && ic->impl)
+ {
+ ic->impl->si->reset();
+ _panel_client.prepare(ic->id);
+ open_specific_factory(ic, uuid);
+ _panel_client.send();
+ }
+}
+
+/* Panel Requestion functions. */
+static void
+panel_req_show_help(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ String help;
+
+ help = String("Smart Common Input Method platform ") +
+ //String(SCIM_VERSION) +
+ String("\n(C) 2002-2005 James Su <suzhe@tsinghua.org.cn>\n\n");
+
+ if (ic && ic->impl)
+ {
+ IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid());
+ if (sf)
+ {
+ help += utf8_wcstombs(sf->get_name());
+ help += String(":\n\n");
+
+ help += utf8_wcstombs(sf->get_help());
+ help += String("\n\n");
+
+ help += utf8_wcstombs(sf->get_credits());
+ }
+ _panel_client.show_help(ic->id, help);
+ }
+}
+
+static void
+panel_req_show_factory_menu(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ std::vector<IMEngineFactoryPointer> factories;
+ std::vector <PanelFactoryInfo> menu;
+
+ _backend->get_factories_for_encoding(factories, "UTF-8");
+
+ for (size_t i = 0; i < factories.size(); ++ i)
+ {
+ menu.push_back(PanelFactoryInfo(
+ factories [i]->get_uuid(),
+ utf8_wcstombs(factories [i]->get_name()),
+ factories [i]->get_language(),
+ factories [i]->get_icon_file()));
+ }
+
+ if (menu.size())
+ _panel_client.show_factory_menu(ic->id, menu);
+}
+
+static void
+panel_req_update_factory_info(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (ic && ic->impl && ic == _focused_ic)
+ {
+ PanelFactoryInfo info;
+ if (ic->impl->is_on)
+ {
+ IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid());
+ if (sf)
+ info = PanelFactoryInfo(sf->get_uuid(), utf8_wcstombs(sf->get_name()), sf->get_language(), sf->get_icon_file());
+ }
+ else
+ {
+ info = PanelFactoryInfo(String(""), String("English/Keyboard"), String("C"), "");
+ }
+ _panel_client.update_factory_info(ic->id, info);
+ }
+}
+
+static void
+panel_req_focus_in(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ _panel_client.focus_in(ic->id, ic->impl->si->get_factory_uuid());
+}
+
+static void
+panel_req_update_spot_location(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ _panel_client.update_spot_location(ic->id, ic->impl->cursor_x, ic->impl->cursor_y);
+}
+
+static bool
+filter_hotkeys(EcoreIMFContextISF *ic, const KeyEvent &key)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ bool ret = false;
+
+ _frontend_hotkey_matcher.push_key_event(key);
+ _imengine_hotkey_matcher.push_key_event(key);
+
+ FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result();
+
+ if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER)
+ {
+ if (!ic->impl->is_on)
+ turn_on_ic(ic);
+ else
+ turn_off_ic(ic);
+ ret = true;
+ }
+ else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON)
+ {
+ if (!ic->impl->is_on)
+ turn_on_ic(ic);
+ ret = true;
+ }
+ else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF)
+ {
+ if (ic->impl->is_on)
+ turn_off_ic(ic);
+ ret = true;
+ }
+ else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY)
+ {
+ open_next_factory(ic);
+ ret = true;
+ }
+ else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY)
+ {
+ open_previous_factory(ic);
+ ret = true;
+ }
+ else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU)
+ {
+ panel_req_show_factory_menu(ic);
+ ret = true;
+ }
+ else if (_imengine_hotkey_matcher.is_matched())
+ {
+ String sfid = _imengine_hotkey_matcher.get_match_result();
+ open_specific_factory(ic, sfid);
+ ret = true;
+ }
+ return ret;
+}
+
+static bool
+panel_initialize(void)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ String display_name;
+ {
+ const char *p = getenv("DISPLAY");
+ if (p) display_name = String(p);
+ }
+
+ if (_panel_client.open_connection(_config->get_name(), display_name) >= 0)
+ {
+ int fd = _panel_client.get_connection_number();
+
+ _panel_iochannel_read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL);
+
+ SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n";
+
+ return true;
+ }
+ std::cerr << "panel_initialize() failed!!!\n";
+ return false;
+}
+
+static void
+panel_finalize(void)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ _panel_client.close_connection();
+
+ if (_panel_iochannel_read_handler)
+ {
+ ecore_main_fd_handler_del(_panel_iochannel_read_handler);
+ _panel_iochannel_read_handler = 0;
+ }
+
+ if (_panel_iochannel_err_handler)
+ {
+ ecore_main_fd_handler_del(_panel_iochannel_err_handler);
+ _panel_iochannel_err_handler = 0;
+ }
+}
+
+static Eina_Bool
+panel_iochannel_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (fd_handler == _panel_iochannel_read_handler)
+ {
+ if (!_panel_client.filter_event())
+ {
+ panel_finalize();
+ panel_initialize();
+ return ECORE_CALLBACK_CANCEL;
+ }
+ }
+ else if (fd_handler == _panel_iochannel_err_handler)
+ {
+ panel_finalize();
+ panel_initialize();
+ return ECORE_CALLBACK_CANCEL;
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+turn_on_ic(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (ic && ic->impl && !ic->impl->is_on)
+ {
+ ic->impl->is_on = true;
+
+ if (ic == _focused_ic)
+ {
+ panel_req_focus_in(ic);
+ panel_req_update_spot_location(ic);
+ panel_req_update_factory_info(ic);
+ _panel_client.turn_on(ic->id);
+ _panel_client.hide_preedit_string(ic->id);
+ _panel_client.hide_aux_string(ic->id);
+ _panel_client.hide_lookup_table(ic->id);
+ ic->impl->si->focus_in();
+ }
+
+ //Record the IC on/off status
+ if (_shared_input_method)
+ _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true);
+
+ if (ic->impl->use_preedit && ic->impl->preedit_string.length())
+ {
+ ecore_imf_context_preedit_start_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
+ ecore_imf_context_preedit_changed_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ ic->impl->preedit_started = true;
+ }
+ }
+}
+
+static void
+turn_off_ic(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (ic && ic->impl && ic->impl->is_on)
+ {
+ ic->impl->is_on = false;
+
+ if (ic == _focused_ic)
+ {
+ ic->impl->si->focus_out();
+
+ panel_req_update_factory_info(ic);
+ _panel_client.turn_off(ic->id);
+ }
+
+ //Record the IC on/off status
+ if (_shared_input_method)
+ _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
+
+ if (ic->impl->use_preedit && ic->impl->preedit_string.length())
+ {
+ ecore_imf_context_preedit_changed_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ ecore_imf_context_preedit_end_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
+ ic->impl->preedit_started = false;
+ }
+ }
+}
+
+static void
+set_ic_capabilities(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (ic && ic->impl)
+ {
+ unsigned int cap = SCIM_CLIENT_CAP_ALL_CAPABILITIES;
+
+ if (!_on_the_spot || !ic->impl->use_preedit)
+ cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT;
+
+ ic->impl->si->update_client_capabilities(cap);
+ }
+}
+
+static bool
+check_socket_frontend(void)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ SocketAddress address;
+ SocketClient client;
+
+ uint32 magic;
+
+ address.set_address(scim_get_default_socket_frontend_address());
+
+ if (!client.connect(address))
+ return false;
+
+ if (!scim_socket_open_connection(magic,
+ String("ConnectionTester"),
+ String("SocketFrontEnd"),
+ client,
+ 1000))
+ return false;
+
+ return true;
+}
+
+void
+initialize(void)
+{
+ std::vector<String> config_list;
+ std::vector<String> engine_list;
+ std::vector<String> load_engine_list;
+
+ std::vector<String>::iterator it;
+
+ bool manual = false;
+
+ bool socket = true;
+
+ String config_module_name = "simple";
+
+ printf("Initializing Ecore SCIM IMModule...\n");
+
+ SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n";
+
+ // Get system language.
+ _language = scim_get_locale_language(scim_get_current_locale());
+
+ if (socket)
+ {
+ // If no Socket FrontEnd is running, then launch one.
+ // And set manual to false.
+ bool check_result = check_socket_frontend();
+ if (!check_result)
+ {
+ std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n";
+ //get modules list
+ scim_get_imengine_module_list(engine_list);
+
+ for (it = engine_list.begin(); it != engine_list.end(); it++)
+ {
+ if (*it != "socket")
+ load_engine_list.push_back(*it);
+ }
+
+ const char *new_argv [] = { "--no-stay", 0 };
+ scim_launch(true,
+ config_module_name,
+ (load_engine_list.size() ? scim_combine_string_list(load_engine_list, ',') : "none"),
+ "socket",
+ (char **)new_argv);
+ manual = false;
+ }
+
+ // If there is one Socket FrontEnd running and it's not manual mode,
+ // then just use this Socket Frontend.
+ if (!manual)
+ {
+ for (int i = 0; i < 200; ++i)
+ {
+ if (check_result)
+ {
+ config_module_name = "socket";
+ load_engine_list.clear();
+ load_engine_list.push_back("socket");
+ break;
+ }
+ scim_usleep(50000);
+ check_result = check_socket_frontend();
+ }
+ }
+ }
+
+ if (config_module_name != "dummy")
+ {
+ //load config module
+ SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n";
+ _config_module = new ConfigModule(config_module_name);
+
+ //create config instance
+ if (_config_module != NULL && _config_module->valid())
+ _config = _config_module->create_config();
+ }
+
+ if (_config.null())
+ {
+ SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n";
+
+ if (_config_module) delete _config_module;
+ _config_module = NULL;
+
+ _config = new DummyConfig();
+ config_module_name = "dummy";
+ }
+
+ reload_config_callback(_config);
+ _config->signal_connect_reload(slot(reload_config_callback));
+
+ // create backend
+ _backend = new CommonBackEnd(_config, load_engine_list.size() ? load_engine_list : engine_list);
+
+ if (_backend.null())
+ std::cerr << "Cannot create BackEnd Object!\n";
+ else
+ _fallback_factory = _backend->get_factory(SCIM_COMPOSE_KEY_FACTORY_UUID);
+
+ if (_fallback_factory.null())
+ _fallback_factory = new DummyIMEngineFactory();
+
+ _fallback_instance = _fallback_factory->create_instance(String("UTF-8"), 0);
+ _fallback_instance->signal_connect_commit_string(slot(fallback_commit_string_cb));
+
+ // Attach Panel Client signal.
+ _panel_client.signal_connect_reload_config (slot(panel_slot_reload_config));
+ _panel_client.signal_connect_exit (slot(panel_slot_exit));
+ _panel_client.signal_connect_update_lookup_table_page_size(slot(panel_slot_update_lookup_table_page_size));
+ _panel_client.signal_connect_lookup_table_page_up (slot(panel_slot_lookup_table_page_up));
+ _panel_client.signal_connect_lookup_table_page_down (slot(panel_slot_lookup_table_page_down));
+ _panel_client.signal_connect_trigger_property (slot(panel_slot_trigger_property));
+ _panel_client.signal_connect_process_helper_event (slot(panel_slot_process_helper_event));
+ _panel_client.signal_connect_move_preedit_caret (slot(panel_slot_move_preedit_caret));
+ _panel_client.signal_connect_select_candidate (slot(panel_slot_select_candidate));
+ _panel_client.signal_connect_process_key_event (slot(panel_slot_process_key_event));
+ _panel_client.signal_connect_commit_string (slot(panel_slot_commit_string));
+ _panel_client.signal_connect_forward_key_event (slot(panel_slot_forward_key_event));
+ _panel_client.signal_connect_request_help (slot(panel_slot_request_help));
+ _panel_client.signal_connect_request_factory_menu (slot(panel_slot_request_factory_menu));
+ _panel_client.signal_connect_change_factory (slot(panel_slot_change_factory));
+
+ if (!panel_initialize())
+ std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
+}
+
+static void
+finalize(void)
+{
+ SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n";
+
+ // Reset this first so that the shared instance could be released correctly afterwards.
+ _default_instance.reset();
+
+ SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n";
+ while (_used_ic_impl_list)
+ {
+ // In case in "shared input method" mode,
+ // all contexts share only one instance,
+ // so we need point the reference pointer correctly before finalizing.
+ _used_ic_impl_list->si->set_frontend_data(static_cast <void*>(_used_ic_impl_list->parent));
+ isf_imf_context_del(_used_ic_impl_list->parent->ctx);
+ }
+
+ delete_all_ic_impl();
+
+ _fallback_instance.reset();
+ _fallback_factory.reset();
+
+ SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n";
+ _backend.reset();
+
+ SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n";
+ _config.reset();
+
+ if (_config_module)
+ {
+ SCIM_DEBUG_FRONTEND(2) << " Deleting _config_module...\n";
+ delete _config_module;
+ _config_module = 0;
+ }
+
+ _focused_ic = NULL;
+ _ic_list = NULL;
+
+ _scim_initialized = false;
+
+ panel_finalize();
+}
+
+static void
+open_next_factory(EcoreIMFContextISF *ic)
+{
+ SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
+ IMEngineFactoryPointer sf = _backend->get_next_factory("", "UTF-8", ic->impl->si->get_factory_uuid());
+
+ if (!sf.null())
+ {
+ turn_off_ic(ic);
+ ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
+ ic->impl->si->set_frontend_data(static_cast <void*>(ic));
+ ic->impl->preedit_string = WideString();
+ ic->impl->preedit_caret = 0;
+ attach_instance(ic->impl->si);
+ _backend->set_default_factory(_language, sf->get_uuid());
+ _panel_client.register_input_context(ic->id, sf->get_uuid());
+ set_ic_capabilities(ic);
+ turn_on_ic(ic);
+
+ if (_shared_input_method)
+ {
+ _default_instance = ic->impl->si;
+ ic->impl->shared_si = true;
+ }
+ }
+}
+
+static void
+open_previous_factory(EcoreIMFContextISF *ic)
+{
+ if (ic == NULL)
+ return;
+
+ SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
+ IMEngineFactoryPointer sf = _backend->get_previous_factory("", "UTF-8", ic->impl->si->get_factory_uuid());
+
+ if (!sf.null())
+ {
+ turn_off_ic(ic);
+ ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
+ ic->impl->si->set_frontend_data(static_cast <void*>(ic));
+ ic->impl->preedit_string = WideString();
+ ic->impl->preedit_caret = 0;
+ attach_instance(ic->impl->si);
+ _backend->set_default_factory(_language, sf->get_uuid());
+ _panel_client.register_input_context(ic->id, sf->get_uuid());
+ set_ic_capabilities(ic);
+ turn_on_ic(ic);
+
+ if (_shared_input_method)
+ {
+ _default_instance = ic->impl->si;
+ ic->impl->shared_si = true;
+ }
+ }
+}
+
+static void
+open_specific_factory(EcoreIMFContextISF *ic,
+ const String &uuid)
+{
+ if (ic == NULL)
+ return;
+
+ SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
+
+ // The same input method is selected, just turn on the IC.
+ if (ic->impl->si->get_factory_uuid() == uuid)
+ {
+ turn_on_ic(ic);
+ return;
+ }
+
+ IMEngineFactoryPointer sf = _backend->get_factory(uuid);
+
+ if (uuid.length() && !sf.null())
+ {
+ turn_off_ic(ic);
+ ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
+ ic->impl->si->set_frontend_data(static_cast <void*>(ic));
+ ic->impl->preedit_string = WideString();
+ ic->impl->preedit_caret = 0;
+ attach_instance(ic->impl->si);
+ _backend->set_default_factory(_language, sf->get_uuid());
+ _panel_client.register_input_context(ic->id, sf->get_uuid());
+ set_ic_capabilities(ic);
+ turn_on_ic(ic);
+
+ if (_shared_input_method)
+ {
+ _default_instance = ic->impl->si;
+ ic->impl->shared_si = true;
+ }
+ }
+ else
+ {
+ // turn_off_ic comment out panel_req_update_factory_info()
+ turn_off_ic(ic);
+ if (ic && ic->impl->is_on)
+ {
+ ic->impl->is_on = false;
+
+ if (ic == _focused_ic)
+ {
+ ic->impl->si->focus_out();
+
+ panel_req_update_factory_info(ic);
+ _panel_client.turn_off(ic->id);
+ }
+
+ //Record the IC on/off status
+ if (_shared_input_method)
+ _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
+
+ if (ic->impl->use_preedit && ic->impl->preedit_string.length())
+ {
+ ecore_imf_context_preedit_changed_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ ecore_imf_context_preedit_end_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
+ ic->impl->preedit_started = false;
+ }
+ }
+ }
+}
+
+static void initialize_modifier_bits(Display *display)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (__current_display == display)
+ return;
+
+ __current_display = display;
+
+ if (display == 0)
+ {
+ __current_alt_mask = Mod1Mask;
+ __current_meta_mask = ShiftMask | Mod1Mask;
+ __current_super_mask = 0;
+ __current_hyper_mask = 0;
+ __current_numlock_mask = Mod2Mask;
+ return;
+ }
+
+ XModifierKeymap *mods = NULL;
+
+ ::KeyCode ctrl_l = XKeysymToKeycode(display, XK_Control_L);
+ ::KeyCode ctrl_r = XKeysymToKeycode(display, XK_Control_R);
+ ::KeyCode meta_l = XKeysymToKeycode(display, XK_Meta_L);
+ ::KeyCode meta_r = XKeysymToKeycode(display, XK_Meta_R);
+ ::KeyCode alt_l = XKeysymToKeycode(display, XK_Alt_L);
+ ::KeyCode alt_r = XKeysymToKeycode(display, XK_Alt_R);
+ ::KeyCode super_l = XKeysymToKeycode(display, XK_Super_L);
+ ::KeyCode super_r = XKeysymToKeycode(display, XK_Super_R);
+ ::KeyCode hyper_l = XKeysymToKeycode(display, XK_Hyper_L);
+ ::KeyCode hyper_r = XKeysymToKeycode(display, XK_Hyper_R);
+ ::KeyCode numlock = XKeysymToKeycode(display, XK_Num_Lock);
+
+ int i, j;
+
+ mods = XGetModifierMapping(display);
+ if (mods == NULL)
+ return;
+
+ __current_alt_mask = 0;
+ __current_meta_mask = 0;
+ __current_super_mask = 0;
+ __current_hyper_mask = 0;
+ __current_numlock_mask = 0;
+
+ /* We skip the first three sets for Shift, Lock, and Control. The
+ remaining sets are for Mod1, Mod2, Mod3, Mod4, and Mod5. */
+ for (i = 3; i < 8; i++)
+ {
+ for (j = 0; j < mods->max_keypermod; j++)
+ {
+ ::KeyCode code = mods->modifiermap [i * mods->max_keypermod + j];
+ if (! code) continue;
+ if (code == alt_l || code == alt_r)
+ __current_alt_mask |= (1 << i);
+ else if (code == meta_l || code == meta_r)
+ __current_meta_mask |= (1 << i);
+ else if (code == super_l || code == super_r)
+ __current_super_mask |= (1 << i);
+ else if (code == hyper_l || code == hyper_r)
+ __current_hyper_mask |= (1 << i);
+ else if (code == numlock)
+ __current_numlock_mask |= (1 << i);
+ }
+ }
+
+ /* Check whether there is a combine keys mapped to Meta */
+ if (__current_meta_mask == 0)
+ {
+ char buf [32];
+ XKeyEvent xkey;
+ KeySym keysym_l, keysym_r;
+
+ xkey.type = KeyPress;
+ xkey.display = display;
+ xkey.serial = 0L;
+ xkey.send_event = False;
+ xkey.x = xkey.y = xkey.x_root = xkey.y_root = 0;
+ xkey.time = 0;
+ xkey.same_screen = False;
+ xkey.subwindow = None;
+ xkey.window = None;
+ xkey.root = DefaultRootWindow(display);
+ xkey.state = ShiftMask;
+
+ xkey.keycode = meta_l;
+ XLookupString(&xkey, buf, 32, &keysym_l, 0);
+ xkey.keycode = meta_r;
+ XLookupString(&xkey, buf, 32, &keysym_r, 0);
+
+ if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R))
+ __current_meta_mask = ShiftMask + __current_alt_mask;
+ else if ((meta_l == ctrl_l && keysym_l == XK_Meta_L) || (meta_r == ctrl_r && keysym_r == XK_Meta_R))
+ __current_meta_mask = ShiftMask + ControlMask;
+ }
+
+ XFreeModifiermap(mods);
+}
+
+static unsigned int scim_x11_keymask_scim_to_x11(Display *display, uint16 scimkeymask)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ unsigned int state = 0;
+
+ initialize_modifier_bits(display);
+
+ if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask;
+ if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask;
+ if (scimkeymask & SCIM_KEY_ControlMask) state |= ControlMask;
+ if (scimkeymask & SCIM_KEY_AltMask) state |= __current_alt_mask;
+ if (scimkeymask & SCIM_KEY_MetaMask) state |= __current_meta_mask;
+ if (scimkeymask & SCIM_KEY_SuperMask) state |= __current_super_mask;
+ if (scimkeymask & SCIM_KEY_HyperMask) state |= __current_hyper_mask;
+ if (scimkeymask & SCIM_KEY_NumLockMask) state |= __current_numlock_mask;
+
+ return state;
+}
+
+static XKeyEvent createKeyEvent(Display *display, Window &win,
+ Window &winRoot, bool press,
+ int keycode, int modifiers)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ XKeyEvent event;
+
+ event.display = display;
+ event.window = win;
+ event.root = winRoot;
+ event.subwindow = None;
+ event.time = CurrentTime;
+ 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, keycode);
+ if (press)
+ event.type = KeyPress;
+ else
+ event.type = KeyRelease;
+ event.send_event = EINA_FALSE;
+ event.serial = 0;
+
+ return event;
+}
+
+static void _x_send_key_event(const KeyEvent &key)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ // Obtain the X11 display.
+ Display *display = XOpenDisplay(NULL);
+ if (display == NULL)
+ {
+ std::cerr << "XOpenDisplay failed\n";
+ return;
+ }
+
+ // Get the root window for the current display.
+ Window winRoot = 0;
+
+ // Find the window which has the current keyboard focus.
+ Window winFocus = 0;
+ int revert = RevertToParent;
+
+ XGetInputFocus(display, &winFocus, &revert);
+
+ // Send a fake key press event to the window.
+ XSelectInput(display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask);
+ XMapWindow(display, winFocus);
+
+ unsigned int modifier = scim_x11_keymask_scim_to_x11(display, key.mask);
+ XKeyEvent event;
+ if (key.is_key_press())
+ {
+ event = createKeyEvent(display, winFocus, winRoot, true, key.code, modifier);
+ XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
+ }
+ else
+ {
+ event = createKeyEvent(display, winFocus, winRoot, false, key.code, modifier);
+ XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
+ }
+
+ XCloseDisplay(display);
+}
+
+static void
+attach_instance(const IMEngineInstancePointer &si)
+{
+ si->signal_connect_show_preedit_string(
+ slot(slot_show_preedit_string));
+ si->signal_connect_show_aux_string(
+ slot(slot_show_aux_string));
+ si->signal_connect_show_lookup_table(
+ slot(slot_show_lookup_table));
+
+ si->signal_connect_hide_preedit_string(
+ slot(slot_hide_preedit_string));
+ si->signal_connect_hide_aux_string(
+ slot(slot_hide_aux_string));
+ si->signal_connect_hide_lookup_table(
+ slot(slot_hide_lookup_table));
+
+ si->signal_connect_update_preedit_caret(
+ slot(slot_update_preedit_caret));
+ si->signal_connect_update_preedit_string(
+ slot(slot_update_preedit_string));
+ si->signal_connect_update_aux_string(
+ slot(slot_update_aux_string));
+ si->signal_connect_update_lookup_table(
+ slot(slot_update_lookup_table));
+
+ si->signal_connect_commit_string(
+ slot(slot_commit_string));
+
+ si->signal_connect_forward_key_event(
+ slot(slot_forward_key_event));
+
+ si->signal_connect_register_properties(
+ slot(slot_register_properties));
+
+ si->signal_connect_update_property(
+ slot(slot_update_property));
+
+ si->signal_connect_beep(
+ slot(slot_beep));
+
+ si->signal_connect_start_helper(
+ slot(slot_start_helper));
+
+ si->signal_connect_stop_helper(
+ slot(slot_stop_helper));
+
+ si->signal_connect_send_helper_event(
+ slot(slot_send_helper_event));
+
+ si->signal_connect_get_surrounding_text(
+ slot(slot_get_surrounding_text));
+
+ si->signal_connect_delete_surrounding_text(
+ slot(slot_delete_surrounding_text));
+}
+
+// Implementation of slot functions
+static void
+slot_show_preedit_string(IMEngineInstanceBase *si)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ {
+ if (ic->impl->use_preedit)
+ {
+ if (!ic->impl->preedit_started)
+ {
+ ecore_imf_context_preedit_start_event_add(_focused_ic->ctx);
+ ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
+ ic->impl->preedit_started = true;
+ }
+ }
+ else
+ _panel_client.show_preedit_string(ic->id);
+ }
+}
+
+static void
+slot_show_aux_string(IMEngineInstanceBase *si)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.show_aux_string(ic->id);
+}
+
+static void
+slot_show_lookup_table(IMEngineInstanceBase *si)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.show_lookup_table(ic->id);
+}
+
+static void
+slot_hide_preedit_string(IMEngineInstanceBase *si)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ {
+ bool emit = false;
+ if (ic->impl->preedit_string.length())
+ {
+ ic->impl->preedit_string = WideString();
+ ic->impl->preedit_caret = 0;
+ ic->impl->preedit_attrlist.clear();
+ emit = true;
+ }
+ if (ic->impl->use_preedit)
+ {
+ if (emit)
+ {
+ ecore_imf_context_preedit_changed_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ }
+ if (ic->impl->preedit_started)
+ {
+ ecore_imf_context_preedit_end_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
+ ic->impl->preedit_started = false;
+ }
+ }
+ else
+ _panel_client.hide_preedit_string(ic->id);
+ }
+}
+
+static void
+slot_hide_aux_string(IMEngineInstanceBase *si)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.hide_aux_string(ic->id);
+}
+
+static void
+slot_hide_lookup_table(IMEngineInstanceBase *si)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.hide_lookup_table(ic->id);
+}
+
+static void
+slot_update_preedit_caret(IMEngineInstanceBase *si, int caret)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret)
+ {
+ ic->impl->preedit_caret = caret;
+ if (ic->impl->use_preedit)
+ {
+ if (!ic->impl->preedit_started)
+ {
+ ecore_imf_context_preedit_start_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
+ ic->impl->preedit_started = true;
+ }
+ ecore_imf_context_preedit_changed_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ }
+ else
+ _panel_client.update_preedit_caret(ic->id, caret);
+ }
+}
+
+static void
+slot_update_preedit_string(IMEngineInstanceBase *si,
+ const WideString & str,
+ const AttributeList & attrs)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length()))
+ {
+ ic->impl->preedit_string = str;
+ ic->impl->preedit_attrlist = attrs;
+ if (ic->impl->use_preedit)
+ {
+ if (!ic->impl->preedit_started)
+ {
+ ecore_imf_context_preedit_start_event_add(_focused_ic->ctx);
+ ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
+ ic->impl->preedit_started = true;
+ }
+ ic->impl->preedit_caret = str.length();
+ ic->impl->preedit_updating = true;
+ ecore_imf_context_preedit_changed_event_add(ic->ctx);
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ ic->impl->preedit_updating = false;
+ }
+ else
+ {
+ _panel_client.update_preedit_string(ic->id, str, attrs);
+ }
+ }
+}
+
+static void
+slot_update_aux_string(IMEngineInstanceBase *si,
+ const WideString & str,
+ const AttributeList & attrs)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.update_aux_string(ic->id, str, attrs);
+}
+
+static void
+slot_commit_string(IMEngineInstanceBase *si,
+ const WideString & str)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->ctx)
+ {
+ ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(str).c_str());
+ ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
+ }
+}
+
+static void
+slot_forward_key_event(IMEngineInstanceBase *si,
+ const KeyEvent & key)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && _focused_ic == ic)
+ {
+ if (!_fallback_instance->process_key_event(key))
+ _x_send_key_event(key);
+ }
+}
+
+static void
+slot_update_lookup_table(IMEngineInstanceBase *si,
+ const LookupTable & table)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.update_lookup_table(ic->id, table);
+}
+
+static void
+slot_register_properties(IMEngineInstanceBase *si,
+ const PropertyList & properties)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.register_properties(ic->id, properties);
+}
+
+static void
+slot_update_property(IMEngineInstanceBase *si,
+ const Property & property)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ _panel_client.update_property(ic->id, property);
+}
+
+static void
+slot_beep(IMEngineInstanceBase *si __UNUSED__)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+}
+
+static void
+slot_start_helper(IMEngineInstanceBase *si,
+ const String &helper_uuid)
+{
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
+ << (ic ? ic->id : -1) << " ic=" << ic
+ << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid() : "") << "...\n";
+
+ if (ic && ic->impl)
+ _panel_client.start_helper(ic->id, helper_uuid);
+}
+
+static void
+slot_stop_helper(IMEngineInstanceBase *si,
+ const String &helper_uuid)
+{
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n";
+
+ if (ic && ic->impl)
+ _panel_client.stop_helper(ic->id, helper_uuid);
+}
+
+static void
+slot_send_helper_event(IMEngineInstanceBase *si,
+ const String &helper_uuid,
+ const Transaction &trans)
+{
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
+ << (ic ? ic->id : -1) << " ic=" << ic
+ << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid() : "") << "...\n";
+
+ if (ic && ic->impl)
+ _panel_client.send_helper_event(ic->id, helper_uuid, trans);
+}
+
+static bool
+slot_get_surrounding_text(IMEngineInstanceBase *si,
+ WideString &text,
+ int &cursor,
+ int maxlen_before,
+ int maxlen_after)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ {
+ char *surrounding = NULL;
+ int cursor_index;
+ if (ecore_imf_context_surrounding_get(_focused_ic->ctx, &surrounding, &cursor_index))
+ {
+ SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n";
+ SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n";
+ WideString before(utf8_mbstowcs(String(surrounding, surrounding + cursor_index)));
+ WideString after(utf8_mbstowcs(String(surrounding + cursor_index)));
+ if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length())
+ before = WideString(before.begin() + (before.length() - maxlen_before), before.end());
+ else if (maxlen_before == 0) before = WideString();
+ if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length())
+ after = WideString(after.begin(), after.begin() + maxlen_after);
+ else if (maxlen_after == 0) after = WideString();
+ text = before + after;
+ cursor = before.length();
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool
+slot_delete_surrounding_text(IMEngineInstanceBase *si,
+ int offset,
+ int len)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
+
+ if (ic && ic->impl && _focused_ic == ic)
+ {
+ Ecore_IMF_Event_Delete_Surrounding ev;
+ ev.ctx = _focused_ic->ctx;
+ ev.n_chars = len;
+ ev.offset = offset;
+ ecore_imf_context_delete_surrounding_event_add(_focused_ic->ctx, offset, len);
+ ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev);
+ return true;
+ }
+ return false;
+}
+
+static void
+reload_config_callback(const ConfigPointer &config)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ _frontend_hotkey_matcher.load_hotkeys(config);
+ _imengine_hotkey_matcher.load_hotkeys(config);
+
+ KeyEvent key;
+
+ scim_string_to_key(key,
+ config->read(String(SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK),
+ String("Shift+Control+Alt+Lock")));
+
+ _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF;
+ _valid_key_mask |= SCIM_KEY_ReleaseMask;
+ // Special treatment for two backslash keys on jp106 keyboard.
+ _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask;
+
+ _on_the_spot = config->read(String(SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot);
+ _shared_input_method = config->read(String(SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method);
+
+ // Get keyboard layout setting
+ // Flush the global config first, in order to load the new configs from disk.
+ scim_global_config_flush();
+
+ _keyboard_layout = scim_get_default_keyboard_layout();
+}
+
+static void
+fallback_commit_string_cb(IMEngineInstanceBase *si __UNUSED__,
+ const WideString &str)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (_focused_ic && _focused_ic->impl)
+ {
+ ecore_imf_context_commit_event_add(_focused_ic->ctx, utf8_wcstombs(str).c_str());
+ ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
+ }
+}
+
--- /dev/null
+#ifndef __ISF_IMF_CONTEXT_H
+#define __ISF_IMF_CONTEXT_H
+
+#include <Ecore_IMF.h>
+
+typedef struct _EcoreIMFContextISF EcoreIMFContextISF;
+typedef struct _EcoreIMFContextISFImpl EcoreIMFContextISFImpl;
+
+struct _EcoreIMFContextISF {
+ Ecore_IMF_Context *ctx;
+
+ EcoreIMFContextISFImpl *impl;
+
+ int id; /* Input Context id*/
+ struct _EcoreIMFContextISF *next;
+};
+
+void isf_imf_context_add (Ecore_IMF_Context *ctx);
+void isf_imf_context_del (Ecore_IMF_Context *ctx);
+void isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window);
+void isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *window);
+void isf_imf_context_focus_in (Ecore_IMF_Context *ctx);
+void isf_imf_context_focus_out (Ecore_IMF_Context *ctx);
+void isf_imf_context_reset (Ecore_IMF_Context *ctx);
+void isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos);
+void isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
+void isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
+void isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos);
+void isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos);
+void isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit);
+Eina_Bool isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
+void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction);
+void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type);
+void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout);
+
+EcoreIMFContextISF* isf_imf_context_new (void);
+void isf_imf_context_shutdown (void);
+
+#endif /* __ISF_IMF_CONTEXT_H */
+
--- /dev/null
+#include <stdio.h>
+#include "scim_imcontext.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+ static const Ecore_IMF_Context_Info isf_imf_info = {
+ "scim", /* ID */
+ "SCIM immodule for Ecore", /* Description */
+ "*", /* Default locales */
+ NULL, /* Canvas type */
+ 0 /* Canvas required */
+ };
+
+ static Ecore_IMF_Context_Class isf_imf_class = {
+ isf_imf_context_add, /* add */
+ isf_imf_context_del, /* del */
+ isf_imf_context_client_window_set, /* client_window_set */
+ isf_imf_context_client_canvas_set, /* client_canvas_set */
+ NULL, /* isf_imf_context_input_panel_show, - show */
+ NULL, /* isf_imf_context_input_panel_hide, - hide */
+ isf_imf_context_preedit_string_get, /* get_preedit_string */
+ isf_imf_context_focus_in, /* focus_in */
+ isf_imf_context_focus_out, /* focus_out */
+ isf_imf_context_reset, /* reset */
+ isf_imf_context_cursor_position_set, /* cursor_position_set */
+ isf_imf_context_use_preedit_set, /* use_preedit_set */
+ isf_imf_context_input_mode_set, /* input_mode_set */
+ isf_imf_context_filter_event, /* filter_event */
+ isf_imf_context_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */
+ isf_imf_context_prediction_allow_set, /* prediction_allow_set */
+ isf_imf_context_autocapital_type_set, /* autocapital_type_set */
+ NULL, /* control panel show */
+ NULL, /* control panel hide */
+ NULL, /* input_panel_layout_set */
+ NULL, /* isf_imf_context_input_panel_layout_get, */
+ NULL, /* isf_imf_context_input_panel_language_set, */
+ NULL, /* isf_imf_context_input_panel_language_get, */
+ isf_imf_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 */
+ };
+
+ static Ecore_IMF_Context *imf_module_create (void);
+ static Ecore_IMF_Context *imf_module_exit (void);
+
+ static Eina_Bool imf_module_init (void)
+ {
+ ecore_imf_module_register (&isf_imf_info, imf_module_create, imf_module_exit);
+ return EINA_TRUE;
+ }
+
+ static void imf_module_shutdown (void)
+ {
+ isf_imf_context_shutdown ();
+ }
+
+ static Ecore_IMF_Context *imf_module_create (void)
+ {
+ Ecore_IMF_Context *ctx = NULL;
+ EcoreIMFContextISF *ctxd = NULL;
+
+ ctxd = isf_imf_context_new ();
+ if (!ctxd)
+ {
+ printf ("isf_imf_context_new () failed!!!\n");
+ return NULL;
+ }
+
+ ctx = ecore_imf_context_new (&isf_imf_class);
+ if (!ctx)
+ {
+ delete ctxd;
+ return NULL;
+ }
+
+ ecore_imf_context_data_set (ctx, ctxd);
+
+ return ctx;
+ }
+
+ static Ecore_IMF_Context *imf_module_exit (void)
+ {
+ return NULL;
+ }
+
+ EINA_MODULE_INIT(imf_module_init);
+ EINA_MODULE_SHUTDOWN(imf_module_shutdown);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Input.h>
#include <string.h>
#include <langinfo.h>
#include <assert.h>
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
#define CLAMP(x, low, high) (x > high) ? high : (x < low) ? low : x
#define _(x) x
static Eina_List *open_ims = NULL;
#endif
+#define FEEDBACK_MASK (XIMReverse | XIMUnderline | XIMHighlight)
+
typedef struct _XIM_Im_Info XIM_Im_Info;
struct _XIM_Im_Info
{
Eina_Bool finalizing;
Eina_Bool has_focus;
Eina_Bool in_toplevel;
+ XIMFeedback *feedbacks;
XIMCallback preedit_start_cb;
XIMCallback preedit_done_cb;
void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data);
#ifdef ENABLE_XIM
-static void reinitialize_ic(Ecore_IMF_Context *ctx);
-static void reinitialize_all_ics(XIM_Im_Info *info);
-static void set_ic_client_window(Ecore_IMF_Context *ctx,
- Ecore_X_Window window);
-static int preedit_start_callback(XIC xic,
- XPointer client_data,
- XPointer call_data);
-static void preedit_done_callback(XIC xic,
- XPointer client_data,
- XPointer call_data);
-static int xim_text_to_utf8(Ecore_IMF_Context *ctx,
- XIMText *xim_text,
- char **text);
-static void preedit_draw_callback(XIC xic,
- XPointer client_data,
- XIMPreeditDrawCallbackStruct *call_data);
-static void preedit_caret_callback(XIC xic,
- XPointer client_data,
- XIMPreeditCaretCallbackStruct *call_data);
+static 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);
+static void set_ic_client_window(Ecore_IMF_Context *ctx,
+ Ecore_X_Window window);
+static int preedit_start_callback(XIC xic,
+ XPointer client_data,
+ XPointer call_data);
+static void preedit_done_callback(XIC xic,
+ XPointer client_data,
+ XPointer call_data);
+static int xim_text_to_utf8(Ecore_IMF_Context *ctx,
+ XIMText *xim_text,
+ char **text);
+static void preedit_draw_callback(XIC xic,
+ XPointer client_data,
+ XIMPreeditDrawCallbackStruct *call_data);
+static void preedit_caret_callback(XIC xic,
+ XPointer client_data,
+ XIMPreeditCaretCallbackStruct *call_data);
static XVaNestedList preedit_callback_set(Ecore_IMF_Context *ctx);
static XIC get_ic(Ecore_IMF_Context *ctx);
static XIM_Im_Info *get_im(Ecore_X_Window window,
- char *locale);
+ char *locale);
static void xim_info_try_im(XIM_Im_Info *info);
static void xim_info_display_closed(Ecore_X_Display *display,
- int is_error,
- XIM_Im_Info *info);
-static void xim_instantiate_callback(Display *display,
- XPointer client_data,
- XPointer call_data);
-static void setup_im(XIM_Im_Info *info);
-static void xim_destroy_callback(XIM xim,
- XPointer client_data,
- XPointer call_data);
+ int is_error,
+ XIM_Im_Info *info);
+static void xim_instantiate_callback(Display *display,
+ XPointer client_data,
+ XPointer call_data);
+static void setup_im(XIM_Im_Info *info);
+static void xim_destroy_callback(XIM xim,
+ XPointer client_data,
+ XPointer call_data);
+#endif
+
+#ifdef ENABLE_XIM
+static unsigned int
+utf8_offset_to_index(const char *str, int offset)
+{
+ int index = 0;
+ int i;
+ for (i = 0; i < offset; i++)
+ {
+ eina_unicode_utf8_get_next(str, &index);
+ }
+
+ return index;
+}
+
#endif
static void
Ecore_IMF_Context_Data *imf_context_data = NULL;
imf_context_data = imf_context_data_new();
- if(!imf_context_data) return;
+ if (!imf_context_data) return;
imf_context_data->use_preedit = EINA_TRUE;
imf_context_data->finalizing = EINA_FALSE;
imf_context_data->in_toplevel = EINA_FALSE;
ecore_imf_context_data_set(ctx, imf_context_data);
+#else
+ (void)ctx;
#endif
}
imf_context_data = ecore_imf_context_data_get(ctx);
imf_context_data->finalizing = EINA_TRUE;
- if(imf_context_data->im_info && !imf_context_data->im_info->ics->next)
+ if (imf_context_data->im_info && !imf_context_data->im_info->ics->next)
{
- if(imf_context_data->im_info->reconnecting == EINA_TRUE)
+ if (imf_context_data->im_info->reconnecting == EINA_TRUE)
{
Ecore_X_Display *dsp;
dsp = ecore_x_display_get();
- XUnregisterIMInstantiateCallback (dsp,
- NULL, NULL, NULL,
- xim_instantiate_callback,
- (XPointer)imf_context_data->im_info);
+ XUnregisterIMInstantiateCallback(dsp,
+ NULL, NULL, NULL,
+ xim_instantiate_callback,
+ (XPointer)imf_context_data->im_info);
}
- else if(imf_context_data->im_info->im)
+ else if (imf_context_data->im_info->im)
{
XIMCallback im_destroy_callback;
im_destroy_callback.client_data = NULL;
im_destroy_callback.callback = NULL;
- XSetIMValues (imf_context_data->im_info->im,
- XNDestroyCallback, &im_destroy_callback,
- NULL);
+ XSetIMValues(imf_context_data->im_info->im,
+ XNDestroyCallback, &im_destroy_callback,
+ NULL);
}
}
set_ic_client_window(ctx, 0);
imf_context_data_destroy(imf_context_data);
+#else
+ (void)ctx;
#endif
}
static void
_ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx,
- void *window)
+ void *window)
{
EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window));
+#else
+ (void)ctx;
+ (void)window;
#endif
}
static void
_ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx,
- char **str,
- int *cursor_pos)
+ char **str,
+ int *cursor_pos)
{
EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
{
utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars,
&len);
- if(str)
- *str = utf8;
+ if (str)
+ *str = utf8;
else
- free(utf8);
+ free(utf8);
}
else
{
- if(str)
- *str = NULL;
- if(cursor_pos)
- *cursor_pos = 0;
+ if (str)
+ *str = NULL;
+ if (cursor_pos)
+ *cursor_pos = 0;
}
- if(cursor_pos)
+ if (cursor_pos)
*cursor_pos = imf_context_data->preedit_cursor;
#else
- if(str)
+ (void)ctx;
+ if (str)
+ *str = NULL;
+ if (cursor_pos)
+ *cursor_pos = 0;
+#endif
+}
+
+static void
+_ecore_imf_context_xim_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx,
+ char **str,
+ Eina_List **attrs,
+ int *cursor_pos)
+{
+ EINA_LOG_DBG("in");
+
+#ifdef ENABLE_XIM
+ Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
+
+ _ecore_imf_context_xim_preedit_string_get(ctx, str, cursor_pos);
+
+ if (!attrs) return;
+ if (!imf_context_data || !imf_context_data->feedbacks) return;
+
+ int i = 0;
+ XIMFeedback last_feedback = 0;
+ int start = -1;
+
+ for (i = 0; i < imf_context_data->preedit_length; i++)
+ {
+ XIMFeedback new_feedback = imf_context_data->feedbacks[i] & FEEDBACK_MASK;
+
+ if (new_feedback != last_feedback)
+ {
+ if (start >= 0)
+ add_feedback_attr(attrs, *str, last_feedback, start, i);
+
+ last_feedback = new_feedback;
+ start = i;
+ }
+ }
+
+ if (start >= 0)
+ add_feedback_attr(attrs, *str, last_feedback, start, i);
+#else
+ (void)ctx;
+ if (str)
*str = NULL;
- if(cursor_pos)
+ if (attrs)
+ *attrs = NULL;
+ if (cursor_pos)
*cursor_pos = 0;
#endif
}
imf_context_data = ecore_imf_context_data_get(ctx);
ic = imf_context_data->ic;
imf_context_data->has_focus = EINA_TRUE;
- if(ic)
+ if (ic)
{
char *str;
XSetICFocus(ic);
}
+#else
+ (void)ctx;
#endif
}
XIC ic;
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- if(imf_context_data->has_focus == EINA_TRUE)
+ if (imf_context_data->has_focus == EINA_TRUE)
{
imf_context_data->has_focus = EINA_FALSE;
ic = imf_context_data->ic;
- if(ic)
+ if (ic)
XUnsetICFocus(ic);
}
+#else
+ (void)ctx;
#endif
}
imf_context_data = ecore_imf_context_data_get(ctx);
ic = imf_context_data->ic;
- if(!ic)
+ if (!ic)
return;
- if(imf_context_data->preedit_length == 0)
+ if (imf_context_data->preedit_length == 0)
return;
preedit_attr = XVaCreateNestedList(0,
XNPreeditState, &preedit_state,
NULL);
- if(!XGetICValues(ic,
- XNPreeditAttributes, preedit_attr,
- NULL))
+ if (!XGetICValues(ic,
+ XNPreeditAttributes, preedit_attr,
+ NULL))
have_preedit_state = EINA_TRUE;
XFree(preedit_attr);
preedit_attr = XVaCreateNestedList(0,
XNPreeditState, preedit_state,
NULL);
- if(have_preedit_state)
+ if (have_preedit_state)
XSetICValues(ic,
XNPreeditAttributes, preedit_attr,
NULL);
XFree(preedit_attr);
- if(imf_context_data->preedit_length)
+ if (imf_context_data->feedbacks)
+ {
+ free(imf_context_data->feedbacks);
+ imf_context_data->feedbacks = NULL;
+ }
+
+ if (imf_context_data->preedit_length)
{
imf_context_data->preedit_length = 0;
free(imf_context_data->preedit_chars);
imf_context_data->preedit_chars = NULL;
+
ecore_imf_context_preedit_changed_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
}
- if(result)
+ if (result)
{
- char *result_utf8 = strdup(result);
- if(result_utf8)
- {
- ecore_imf_context_commit_event_add(ctx, result_utf8);
- free(result_utf8);
- }
+ char *result_utf8 = strdup(result);
+ if (result_utf8)
+ {
+ ecore_imf_context_commit_event_add(ctx, result_utf8);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, result_utf8);
+ free(result_utf8);
+ }
}
- XFree (result);
+ XFree(result);
+#else
+ (void)ctx;
#endif
}
static void
_ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx,
- Eina_Bool use_preedit)
+ Eina_Bool use_preedit)
{
EINA_LOG_DBG("in");
#ifdef ENABLE_XIM
use_preedit = use_preedit != EINA_FALSE;
- if(imf_context_data->use_preedit != use_preedit)
+ if (imf_context_data->use_preedit != use_preedit)
{
imf_context_data->use_preedit = use_preedit;
reinitialize_ic(ctx);
}
+#else
+ (void)ctx;
+ (void)use_preedit;
#endif
}
+#ifdef ENABLE_XIM
+static void
+add_feedback_attr(Eina_List **attrs,
+ const char *str,
+ XIMFeedback feedback,
+ int start_pos,
+ int end_pos)
+{
+ Ecore_IMF_Preedit_Attr *attr = NULL;
+
+ unsigned int start_index = utf8_offset_to_index(str, start_pos);
+ unsigned int end_index = utf8_offset_to_index(str, end_pos);
+
+ if (feedback & FEEDBACK_MASK)
+ {
+ attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
+ attr->start_index = start_index;
+ attr->end_index = end_index;
+ *attrs = eina_list_append(*attrs, (void *)attr);
+ }
+
+ if (feedback & XIMUnderline)
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1;
+
+ if (feedback & XIMReverse)
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
+
+ if (feedback & XIMHighlight)
+ attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
+}
+
+#endif
+
static void
-_ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx,
- int x, int y, int w, int h)
+_ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx,
+ int x, int y, int w, int h)
{
EINA_LOG_DBG("%s in", __FUNCTION__);
Ecore_IMF_Context_Data *imf_context_data;
XIC ic;
XVaNestedList preedit_attr;
- XPoint spot;
+ XPoint spot;
imf_context_data = ecore_imf_context_data_get(ctx);
ic = imf_context_data->ic;
spot.x = x;
spot.y = y + h;
-
- preedit_attr = XVaCreateNestedList (0,
- XNSpotLocation, &spot,
- NULL);
- XSetICValues (ic,
- XNPreeditAttributes, preedit_attr,
- NULL);
+
+ preedit_attr = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ NULL);
+ XSetICValues(ic,
+ XNPreeditAttributes, preedit_attr,
+ NULL);
XFree(preedit_attr);
+#else
+ (void)ctx;
+ (void)x;
+ (void)y;
+ (void)h;
#endif
(void)(w); // yes w is unused, but only a bi-product of the algorithm
}
unsigned int modifiers = 0;
/**< "Control" is pressed */
- if(state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL)
+ if (state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL)
modifiers |= ControlMask;
/**< "Alt" is pressed */
- if(state & ECORE_IMF_KEYBOARD_MODIFIER_ALT)
+ if (state & ECORE_IMF_KEYBOARD_MODIFIER_ALT)
modifiers |= Mod1Mask;
/**< "Shift" is pressed */
- if(state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT)
+ if (state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT)
modifiers |= ShiftMask;
/**< "Win" (between "Ctrl" and "A */
- if(state & ECORE_IMF_KEYBOARD_MODIFIER_WIN)
+ if (state & ECORE_IMF_KEYBOARD_MODIFIER_WIN)
modifiers |= Mod5Mask;
return modifiers;
unsigned int locks = 0;
/**< "Num" lock is active */
- if(state & ECORE_IMF_KEYBOARD_LOCK_NUM)
+ if (state & ECORE_IMF_KEYBOARD_LOCK_NUM)
locks |= Mod3Mask;
- if(state & ECORE_IMF_KEYBOARD_LOCK_CAPS)
+ if (state & ECORE_IMF_KEYBOARD_LOCK_CAPS)
locks |= LockMask;
-#if 0 /* FIXME: add mask. */
- if(state & ECORE_IMF_KEYBOARD_LOCK_SCROLL)
+#if 0 /* FIXME: add mask. */
+ if (state & ECORE_IMF_KEYBOARD_LOCK_SCROLL)
;
#endif
static KeyCode
_keycode_get(Ecore_X_Display *dsp,
- const char *keyname)
+ const char *keyname)
{
KeyCode keycode;
// EINA_LOG_DBG("keyname:%s keysym:%lu", keyname, XStringToKeysym(keyname));
- if(strcmp(keyname, "Keycode-0") == 0)
+ if (strcmp(keyname, "Keycode-0") == 0)
{
keycode = 0;
}
#endif
static Eina_Bool
-_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
+_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
Ecore_IMF_Event_Type type,
- Ecore_IMF_Event *event)
+ Ecore_IMF_Event *event)
{
EINA_LOG_DBG("%s in", __FUNCTION__);
#ifdef ENABLE_XIM
imf_context_data = ecore_imf_context_data_get(ctx);
ic = imf_context_data->ic;
- if(!ic)
+ if (!ic)
{
ic = get_ic(ctx);
}
- if(type == ECORE_IMF_EVENT_KEY_DOWN)
+ if (type == ECORE_IMF_EVENT_KEY_DOWN)
{
XKeyPressedEvent xev;
Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
xev.keycode = _keycode_get(dsp, ev->keyname);
xev.same_screen = True;
- if(ic)
+ if (ic)
{
Status mbstatus;
#ifdef X_HAVE_UTF8_STRING
}
}
- if(compose)
+ if (compose)
{
Eina_Unicode *unicode;
int len;
unicode = eina_unicode_utf8_to_unicode(compose, &len);
- if(!unicode) abort();
- if(unicode[0] >= 0x20 && unicode[0] != 0x7f)
+ if (!unicode) abort();
+ if (unicode[0] >= 0x20 && unicode[0] != 0x7f)
{
ecore_imf_context_commit_event_add(ctx, compose);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, compose);
result = EINA_TRUE;
}
free(compose);
return result;
#else
+ (void)ctx;
+ (void)type;
+ (void)event;
return EINA_FALSE;
#endif
}
.use_preedit_set = _ecore_imf_context_xim_use_preedit_set,
.input_mode_set = NULL,
.filter_event = _ecore_imf_context_xim_filter_event,
- .preedit_string_with_attributes_get = NULL,
+ .preedit_string_with_attributes_get = _ecore_imf_context_xim_preedit_string_with_attributes_get,
.prediction_allow_set = NULL,
.autocapital_type_set = NULL,
.control_panel_show = NULL,
.input_panel_language_set = NULL,
.input_panel_language_get = NULL,
.cursor_location_set = _ecore_imf_context_xim_cursor_location_set,
+ .input_panel_imdata_set = NULL,
+ .input_panel_imdata_get = NULL,
+ .input_panel_return_key_type_set = NULL,
+ .input_panel_return_key_disabled_set = NULL
};
static Ecore_IMF_Context *
Ecore_IMF_Context *ctx = NULL;
ctx = ecore_imf_context_new(&xim_class);
- if(!ctx)
+ if (!ctx)
goto error;
return ctx;
char *locale;
locale = setlocale(LC_CTYPE, "");
- if(!locale) return NULL;
+ if (!locale) return NULL;
- if(!XSupportsLocale()) return NULL;
+ if (!XSupportsLocale()) return NULL;
imf_context_data = calloc(1, sizeof(Ecore_IMF_Context_Data));
- if(!imf_context_data) return NULL;
+ if (!imf_context_data) return NULL;
imf_context_data->locale = strdup(locale);
- if(!imf_context_data->locale) goto error;
+ if (!imf_context_data->locale) goto error;
return imf_context_data;
error:
void
imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data)
{
- if(!imf_context_data)
+ if (!imf_context_data)
return;
- if(imf_context_data->ic)
+ if (imf_context_data->ic)
XDestroyIC(imf_context_data->ic);
free(imf_context_data->preedit_chars);
+
+ if (imf_context_data->feedbacks)
+ {
+ free(imf_context_data->feedbacks);
+ imf_context_data->feedbacks = NULL;
+ }
+
free(imf_context_data->locale);
free(imf_context_data);
}
static int
-preedit_start_callback(XIC xic __UNUSED__,
+preedit_start_callback(XIC xic __UNUSED__,
XPointer client_data,
XPointer call_data __UNUSED__)
{
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- if(imf_context_data->finalizing == EINA_FALSE)
- ecore_imf_context_preedit_start_event_add(ctx);
-
+ if (imf_context_data->finalizing == EINA_FALSE)
+ {
+ ecore_imf_context_preedit_start_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
+ }
return -1;
}
static void
-preedit_done_callback(XIC xic __UNUSED__,
+preedit_done_callback(XIC xic __UNUSED__,
XPointer client_data,
XPointer call_data __UNUSED__)
{
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- if(imf_context_data->preedit_length)
+ if (imf_context_data->preedit_length)
{
imf_context_data->preedit_length = 0;
free(imf_context_data->preedit_chars);
imf_context_data->preedit_chars = NULL;
ecore_imf_context_preedit_changed_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
}
- if(imf_context_data->finalizing == EINA_FALSE)
- ecore_imf_context_preedit_end_event_add(ctx);
+ if (imf_context_data->finalizing == EINA_FALSE)
+ {
+ ecore_imf_context_preedit_end_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
+ }
}
/* FIXME */
static int
xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
- XIMText *xim_text,
- char **text)
+ XIMText *xim_text,
+ char **text)
{
int text_length = 0;
char *result = NULL;
- if(xim_text && xim_text->string.multi_byte)
+ if (xim_text && xim_text->string.multi_byte)
{
- if(xim_text->encoding_is_wchar)
+ if (xim_text->encoding_is_wchar)
{
EINA_LOG_WARN("Wide character return from Xlib not currently supported");
*text = NULL;
/* XXX Convert to UTF-8 */
result = strdup(xim_text->string.multi_byte);
- if(result)
+ if (result)
{
text_length = eina_unicode_utf8_get_len(result);
if (text_length != xim_text->length)
}
static void
-preedit_draw_callback(XIC xic __UNUSED__,
- XPointer client_data,
+preedit_draw_callback(XIC xic __UNUSED__,
+ XPointer client_data,
XIMPreeditDrawCallbackStruct *call_data)
{
EINA_LOG_DBG("in");
Eina_Unicode *new_text = NULL;
Eina_UStrbuf *preedit_bufs = NULL;
int new_text_length;
+ int i = 0;
preedit_bufs = eina_ustrbuf_new();
- if(imf_context_data->preedit_chars) {
- ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars);
- if(ret == EINA_FALSE) goto done;
- }
+ if (imf_context_data->preedit_chars)
+ {
+ ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars);
+ if (ret == EINA_FALSE) goto done;
+ }
new_text_length = xim_text_to_utf8(ctx, t, &tmp);
- if(tmp)
+ if (tmp)
{
int tmp_len;
new_text = eina_unicode_utf8_to_unicode((const char *)tmp, &tmp_len);
free(tmp);
}
- if(t == NULL) {
- /* delete string */
- ret = eina_ustrbuf_remove(preedit_bufs,
- call_data->chg_first, call_data->chg_length);
- } else if(call_data->chg_length == 0) {
- /* insert string */
- ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first);
- } else if(call_data->chg_length > 0) {
- /* replace string */
- ret = eina_ustrbuf_remove(preedit_bufs,
- call_data->chg_first, call_data->chg_length);
- if(ret == EINA_FALSE) goto done;
-
- ret = eina_ustrbuf_insert_n(preedit_bufs, new_text,
- new_text_length, call_data->chg_first);
- if(ret == EINA_FALSE) goto done;
- } else {
- ret = EINA_FALSE;
- }
-
- done:
- if(ret == EINA_TRUE) {
- free(imf_context_data->preedit_chars);
- imf_context_data->preedit_chars =
+ if (t == NULL)
+ {
+ /* delete string */
+ ret = eina_ustrbuf_remove(preedit_bufs,
+ call_data->chg_first, call_data->chg_length);
+ }
+ else if (call_data->chg_length == 0)
+ {
+ /* insert string */
+ ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first);
+ }
+ else if (call_data->chg_length > 0)
+ {
+ /* replace string */
+ ret = eina_ustrbuf_remove(preedit_bufs,
+ call_data->chg_first, call_data->chg_length);
+ if (ret == EINA_FALSE) goto done;
+
+ ret = eina_ustrbuf_insert_n(preedit_bufs, new_text,
+ new_text_length, call_data->chg_first);
+ if (ret == EINA_FALSE) goto done;
+ }
+ else {
+ ret = EINA_FALSE;
+ }
+
+done:
+ if (ret == EINA_TRUE)
+ {
+ free(imf_context_data->preedit_chars);
+ imf_context_data->preedit_chars =
eina_ustrbuf_string_steal(preedit_bufs);
- imf_context_data->preedit_length =
+ imf_context_data->preedit_length =
eina_unicode_strlen(imf_context_data->preedit_chars);
- ecore_imf_context_preedit_changed_event_add(ctx);
- }
+ if (imf_context_data->feedbacks)
+ {
+ free(imf_context_data->feedbacks);
+ imf_context_data->feedbacks = NULL;
+ }
+
+ if (imf_context_data->preedit_length > 0)
+ {
+ imf_context_data->feedbacks = calloc(imf_context_data->preedit_length, sizeof(XIMFeedback));
+
+ for (i = 0; i < imf_context_data->preedit_length; i++)
+ imf_context_data->feedbacks[i] = t->feedback[i];
+ }
+
+ ecore_imf_context_preedit_changed_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ }
free(new_text);
eina_ustrbuf_free(preedit_bufs);
}
static void
-preedit_caret_callback(XIC xic __UNUSED__,
- XPointer client_data,
+preedit_caret_callback(XIC xic __UNUSED__,
+ XPointer client_data,
XIMPreeditCaretCallbackStruct *call_data)
{
EINA_LOG_DBG("in");
Ecore_IMF_Context_Data *imf_context_data;
imf_context_data = ecore_imf_context_data_get(ctx);
- if(call_data->direction == XIMAbsolutePosition)
+ if (call_data->direction == XIMAbsolutePosition)
{
// printf("call_data->position:%d\n", call_data->position);
- imf_context_data->preedit_cursor = call_data->position;
- if(imf_context_data->finalizing == EINA_FALSE)
- ecore_imf_context_preedit_changed_event_add(ctx);
+ imf_context_data->preedit_cursor = call_data->position;
+ if (imf_context_data->finalizing == EINA_FALSE)
+ {
+ ecore_imf_context_preedit_changed_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
+ }
}
}
XIC ic;
imf_context_data = ecore_imf_context_data_get(ctx);
ic = imf_context_data->ic;
- if(!ic)
+ if (!ic)
{
XIM_Im_Info *im_info = imf_context_data->im_info;
XVaNestedList preedit_attr = NULL;
EINA_LOG_WARN("Doesn't open XIM.");
return NULL;
}
-
+
// supported styles
#if 0
int i;
{
printf("%i: ", i);
if (im_info->xim_styles->supported_styles[i] & XIMPreeditCallbacks)
- printf("XIMPreeditCallbacks | ");
+ printf("XIMPreeditCallbacks | ");
if (im_info->xim_styles->supported_styles[i] & XIMPreeditPosition)
- printf("XIMPreeditPosition | ");
+ printf("XIMPreeditPosition | ");
if (im_info->xim_styles->supported_styles[i] & XIMPreeditArea)
- printf("XIMPreeditArea | ");
+ printf("XIMPreeditArea | ");
if (im_info->xim_styles->supported_styles[i] & XIMPreeditNothing)
- printf("XIMPreeditNothing | ");
+ printf("XIMPreeditNothing | ");
if (im_info->xim_styles->supported_styles[i] & XIMPreeditNone)
- printf("XIMPreeditNone | ");
+ printf("XIMPreeditNone | ");
if (im_info->xim_styles->supported_styles[i] & XIMStatusArea)
- printf("XIMStatusArea | ");
+ printf("XIMStatusArea | ");
if (im_info->xim_styles->supported_styles[i] & XIMStatusCallbacks)
- printf("XIMStatusCallbacks | ");
+ printf("XIMStatusCallbacks | ");
if (im_info->xim_styles->supported_styles[i] & XIMStatusNothing)
- printf("XIMStatusNothing | ");
+ printf("XIMStatusNothing | ");
if (im_info->xim_styles->supported_styles[i] & XIMStatusNone)
- printf("XIMStatusNone | ");
+ printf("XIMStatusNone | ");
printf("\n");
}
}
{
if (im_info->supports_cursor)
{
- // kinput2 DOES do this...
+ // kinput2 DOES do this...
XFontSet fs;
char **missing_charset_list;
int missing_charset_count;
char *def_string;
-
+
im_style |= XIMPreeditPosition;
im_style |= XIMStatusNothing;
fs = XCreateFontSet(ecore_x_display_get(),
}
name = XNPreeditAttributes;
}
- else
+ else
{
im_style |= XIMPreeditNothing;
im_style |= XIMStatusNothing;
name, preedit_attr, NULL);
}
XFree(preedit_attr);
- if(ic)
+ if (ic)
{
unsigned long mask = 0xaaaaaaaa;
- XGetICValues (ic,
- XNFilterEvents, &mask,
- NULL);
+ XGetICValues(ic,
+ XNFilterEvents, &mask,
+ NULL);
imf_context_data->mask = mask;
ecore_x_event_mask_set(imf_context_data->win, mask);
}
imf_context_data->ic = ic;
- if(ic && imf_context_data->has_focus == EINA_TRUE)
+ if (ic && imf_context_data->has_focus == EINA_TRUE)
XSetICFocus(ic);
}
{
Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
XIC ic = imf_context_data->ic;
- if(ic)
+ if (ic)
{
XDestroyIC(ic);
imf_context_data->ic = NULL;
- if(imf_context_data->preedit_length)
+ if (imf_context_data->preedit_length)
{
imf_context_data->preedit_length = 0;
free(imf_context_data->preedit_chars);
imf_context_data->preedit_chars = NULL;
ecore_imf_context_preedit_changed_event_add(ctx);
+ ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
}
}
}
Eina_List *tmp_list;
Ecore_IMF_Context *ctx;
- EINA_LIST_FOREACH(info->ics, tmp_list, ctx)
+ EINA_LIST_FOREACH (info->ics, tmp_list, ctx)
reinitialize_ic(ctx);
}
static void
set_ic_client_window(Ecore_IMF_Context *ctx,
- Ecore_X_Window window)
+ Ecore_X_Window window)
{
EINA_LOG_DBG("in");
Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
old_win = imf_context_data->win;
EINA_LOG_DBG("old_win:%d window:%d ", old_win, window);
- if(old_win != 0 && old_win != window) /* XXX how do check window... */
+ if (old_win != 0 && old_win != window) /* XXX how do check window... */
{
XIM_Im_Info *info;
info = imf_context_data->im_info;
imf_context_data->win = window;
- if(window) /* XXX */
+ if (window) /* XXX */
{
XIM_Im_Info *info = NULL;
info = get_im(window, imf_context_data->locale);
static XIM_Im_Info *
get_im(Ecore_X_Window window,
- char *locale)
+ char *locale)
{
EINA_LOG_DBG("in");
Eina_List *l;
XIM_Im_Info *im_info = NULL;
XIM_Im_Info *info = NULL;
- EINA_LIST_FOREACH(open_ims, l, im_info) {
- if(strcmp(im_info->locale, locale) == 0)
+ EINA_LIST_FOREACH (open_ims, l, im_info) {
+ if (strcmp(im_info->locale, locale) == 0)
{
- if(im_info->im)
+ if (im_info->im)
{
return im_info;
}
}
}
- if(!info)
+ if (!info)
{
info = calloc(1, sizeof(XIM_Im_Info));
- if(!info) return NULL;
+ if (!info) return NULL;
open_ims = eina_list_prepend(open_ims, info);
info->win = window;
info->locale = strdup(locale);
if (info->reconnecting == EINA_TRUE)
return;
- if(XSupportsLocale())
+ if (XSupportsLocale())
{
- if (!XSetLocaleModifiers (""))
+ if (!XSetLocaleModifiers(""))
EINA_LOG_WARN("Unable to set locale modifiers with XSetLocaleModifiers()");
dsp = ecore_x_display_get();
info->im = XOpenIM(dsp, NULL, NULL, NULL);
- if(!info->im)
+ if (!info->im)
{
XRegisterIMInstantiateCallback(dsp,
NULL, NULL, NULL,
static void
xim_info_display_closed(Ecore_X_Display *display __UNUSED__,
- int is_error __UNUSED__,
- XIM_Im_Info *info)
+ int is_error __UNUSED__,
+ XIM_Im_Info *info)
{
Eina_List *ics, *tmp_list;
Ecore_IMF_Context *ctx;
ics = info->ics;
info->ics = NULL;
- EINA_LIST_FOREACH(ics, tmp_list, ctx)
+ 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);
}
- free (info->locale);
+ free(info->locale);
if (info->im)
- XCloseIM (info->im);
+ XCloseIM(info->im);
- free (info);
+ free(info);
}
static void
}
info->im = im;
- setup_im (info);
+ setup_im(info);
- XUnregisterIMInstantiateCallback (display, NULL, NULL, NULL,
- xim_instantiate_callback,
- (XPointer)info);
+ XUnregisterIMInstantiateCallback(display, NULL, NULL, NULL,
+ xim_instantiate_callback,
+ (XPointer)info);
info->reconnecting = EINA_FALSE;
}
XIMValuesList *ic_values = NULL;
XIMCallback im_destroy_callback;
- if(!info->im)
+ if (!info->im)
return;
im_destroy_callback.client_data = (XPointer)info;
{
if (!strcmp(ic_values->supported_values[i],
XNStringConversionCallback))
- info->supports_string_conversion = EINA_TRUE;
+ info->supports_string_conversion = EINA_TRUE;
if (!strcmp(ic_values->supported_values[i],
XNCursor))
- info->supports_cursor = EINA_TRUE;
+ info->supports_cursor = EINA_TRUE;
}
#if 0
printf("values........\n");
for (i = 0; i < ic_values->count_values; i++)
- printf("%s\n", ic_values->supported_values[i]);
+ printf("%s\n", ic_values->supported_values[i]);
printf("styles........\n");
for (i = 0; i < info->xim_styles->count_styles; i++)
- printf("%lx\n", info->xim_styles->supported_styles[i]);
+ printf("%lx\n", info->xim_styles->supported_styles[i]);
#endif
XFree(ic_values);
}
}
static void
-xim_destroy_callback(XIM xim __UNUSED__,
+xim_destroy_callback(XIM xim __UNUSED__,
XPointer client_data,
XPointer call_data __UNUSED__)
{