From 4ed2e01591e1575800d9aa871f76a5f7559060b3 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 1 Nov 2016 23:04:47 +0900 Subject: [PATCH] remove xcb support in ecore_x and evas engines as per mailing list as per mailing list discussion about dropping xcb support now. it hasn't been complete for a long time, thus not recommented for being turned on. as we are moving to a wayland world xcbmakes even less sense. as agreed, time to clean up a bit and remove a distraction as well as not well tested code. this also updates po's too. @feature --- configure.ac | 232 +- m4/evas_check_engine.m4 | 161 - pc/evas-opengl-x11.pc.in | 1 - pc/evas-software-x11.pc.in | 1 - po/ca.po | 30 +- po/cs.po | 30 +- po/de.po | 30 +- po/el.po | 30 +- po/eo.po | 30 +- po/es.po | 30 +- po/fi.po | 30 +- po/fr.po | 30 +- po/gl.po | 30 +- po/hu.po | 30 +- po/it.po | 30 +- po/ja.po | 30 +- po/ko.po | 30 +- po/lt.po | 30 +- po/nl.po | 30 +- po/pl.po | 30 +- po/pt.po | 30 +- po/ru.po | 30 +- po/sl.po | 30 +- po/sr.po | 30 +- po/tr.po | 30 +- po/vi.po | 30 +- po/zh_CN.po | 30 +- src/Makefile_Ecore_X.am | 142 +- src/Makefile_Evas.am | 30 +- src/lib/ecore_evas/Ecore_Evas.h | 4 +- src/lib/ecore_evas/ecore_evas.c | 8 +- src/lib/ecore_evas/ecore_evas_module.c | 4 - src/lib/ecore_x/Ecore_X.h | 10 +- src/lib/ecore_x/{xlib => }/ecore_x.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_atoms.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_composite.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_cursor.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_damage.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_dnd.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_dpms.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_drawable.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_e.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_error.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_events.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_fixes.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_gc.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_gesture.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_icccm.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_image.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_keygrab.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_mwm.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_netwm.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_pixmap.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_present.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_private.h | 0 src/lib/ecore_x/{xlib => }/ecore_x_randr.c | 2 - src/lib/ecore_x/{xlib => }/ecore_x_region.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_screensaver.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_selection.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_sync.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_test.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_vsync.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_window.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_window_prop.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_window_shape.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_xi2.c | 0 src/lib/ecore_x/{xlib => }/ecore_x_xinerama.c | 0 src/lib/ecore_x/xcb/ecore_xcb.c | 1605 -------- src/lib/ecore_x/xcb/ecore_xcb_atoms.c | 155 - src/lib/ecore_x/xcb/ecore_xcb_composite.c | 291 -- src/lib/ecore_x/xcb/ecore_xcb_cursor.c | 400 -- src/lib/ecore_x/xcb/ecore_xcb_damage.c | 156 - src/lib/ecore_x/xcb/ecore_xcb_dnd.c | 720 ---- src/lib/ecore_x/xcb/ecore_xcb_dpms.c | 354 -- src/lib/ecore_x/xcb/ecore_xcb_drawable.c | 124 - src/lib/ecore_x/xcb/ecore_xcb_e.c | 2266 ---------- src/lib/ecore_x/xcb/ecore_xcb_error.c | 116 - src/lib/ecore_x/xcb/ecore_xcb_events.c | 2831 ------------- src/lib/ecore_x/xcb/ecore_xcb_extensions.c | 156 - src/lib/ecore_x/xcb/ecore_xcb_gc.c | 173 - src/lib/ecore_x/xcb/ecore_xcb_gesture.c | 203 - src/lib/ecore_x/xcb/ecore_xcb_icccm.c | 1259 ------ src/lib/ecore_x/xcb/ecore_xcb_image.c | 782 ---- src/lib/ecore_x/xcb/ecore_xcb_input.c | 295 -- src/lib/ecore_x/xcb/ecore_xcb_keygrab.c | 442 -- src/lib/ecore_x/xcb/ecore_xcb_keymap.c | 534 --- src/lib/ecore_x/xcb/ecore_xcb_mwm.c | 105 - src/lib/ecore_x/xcb/ecore_xcb_netwm.c | 1590 ------- src/lib/ecore_x/xcb/ecore_xcb_pixmap.c | 129 - src/lib/ecore_x/xcb/ecore_xcb_present.c | 200 - src/lib/ecore_x/xcb/ecore_xcb_private.h | 448 -- src/lib/ecore_x/xcb/ecore_xcb_randr.c | 4323 -------------------- src/lib/ecore_x/xcb/ecore_xcb_region.c | 159 - src/lib/ecore_x/xcb/ecore_xcb_render.c | 225 - src/lib/ecore_x/xcb/ecore_xcb_screensaver.c | 404 -- src/lib/ecore_x/xcb/ecore_xcb_selection.c | 1111 ----- src/lib/ecore_x/xcb/ecore_xcb_shape.c | 50 - src/lib/ecore_x/xcb/ecore_xcb_sync.c | 338 -- src/lib/ecore_x/xcb/ecore_xcb_textlist.c | 509 --- src/lib/ecore_x/xcb/ecore_xcb_vsync.c | 375 -- src/lib/ecore_x/xcb/ecore_xcb_window.c | 2255 ---------- src/lib/ecore_x/xcb/ecore_xcb_window_prop.c | 689 ---- src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c | 410 -- src/lib/ecore_x/xcb/ecore_xcb_window_shape.c | 791 ---- src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c | 120 - src/lib/ecore_x/xcb/ecore_xcb_xfixes.c | 745 ---- src/lib/ecore_x/xcb/ecore_xcb_xinerama.c | 139 - src/lib/ecore_x/xcb/ecore_xcb_xtest.c | 215 - src/modules/ecore_evas/engines/x/ecore_evas_x.c | 12 - .../software_x11/Evas_Engine_Software_X11.h | 3 +- .../evas/engines/software_x11/evas_engine.c | 300 +- .../evas/engines/software_x11/evas_engine.h | 36 +- .../evas/engines/software_x11/evas_xcb_buffer.c | 513 --- .../evas/engines/software_x11/evas_xcb_buffer.h | 32 - .../evas/engines/software_x11/evas_xcb_color.c | 424 -- .../evas/engines/software_x11/evas_xcb_color.h | 10 - .../evas/engines/software_x11/evas_xcb_image.c | 123 - .../evas/engines/software_x11/evas_xcb_image.h | 5 - .../evas/engines/software_x11/evas_xcb_main.c | 8 - .../evas/engines/software_x11/evas_xcb_outbuf.c | 1310 ------ .../evas/engines/software_x11/evas_xcb_outbuf.h | 26 - .../evas/engines/software_x11/evas_xcb_xdefaults.c | 108 - .../evas/engines/software_x11/evas_xcb_xdefaults.h | 11 - src/tests/ecore/ecore_test_ecore_x.c | 3 - src/utils/ecore/.gitignore | 2 +- src/utils/ecore/makekeys.c | 326 -- src/utils/ecore/mkks.sh | 10 - 127 files changed, 417 insertions(+), 32322 deletions(-) rename src/lib/ecore_x/{xlib => }/ecore_x.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_atoms.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_composite.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_cursor.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_damage.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_dnd.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_dpms.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_drawable.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_e.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_error.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_events.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_fixes.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_gc.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_gesture.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_icccm.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_image.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_keygrab.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_mwm.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_netwm.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_pixmap.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_present.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_private.h (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_randr.c (99%) rename src/lib/ecore_x/{xlib => }/ecore_x_region.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_screensaver.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_selection.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_sync.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_test.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_vsync.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_window.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_window_prop.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_window_shape.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_xi2.c (100%) rename src/lib/ecore_x/{xlib => }/ecore_x_xinerama.c (100%) delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_atoms.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_composite.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_cursor.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_damage.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_dnd.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_dpms.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_drawable.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_e.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_error.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_events.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_extensions.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_gc.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_gesture.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_icccm.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_image.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_input.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_keygrab.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_keymap.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_mwm.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_netwm.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_pixmap.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_present.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_private.h delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_randr.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_region.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_render.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_screensaver.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_selection.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_shape.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_sync.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_textlist.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_vsync.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_window.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_window_prop.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_window_shape.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_xfixes.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_xinerama.c delete mode 100644 src/lib/ecore_x/xcb/ecore_xcb_xtest.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_buffer.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_buffer.h delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_color.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_color.h delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_image.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_image.h delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_main.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_outbuf.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_outbuf.h delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_xdefaults.c delete mode 100644 src/modules/evas/engines/software_x11/evas_xcb_xdefaults.h delete mode 100644 src/utils/ecore/makekeys.c delete mode 100755 src/utils/ecore/mkks.sh diff --git a/configure.ac b/configure.ac index cd7ba3b..c709f7f 100644 --- a/configure.ac +++ b/configure.ac @@ -1912,7 +1912,7 @@ EFL_LIB_START([Evas]) # X11 AC_ARG_WITH([x11], - [AS_HELP_STRING([--with-x11=xlib|xcb|none],[X11 method to use: xlib, xcb or none])]) + [AS_HELP_STRING([--with-x11=xlib|none],[Use X11 (Xlib) or not])]) if test "x${have_windows}" = "xyes" || test "x${have_ps3}" = "xyes" || test "x${have_darwin}" = "xyes"; then with_x11="none" @@ -1921,7 +1921,6 @@ elif test "x${with_x11}" = "x"; then fi want_x11_xlib="no" -want_x11_xcb="no" want_x11_none="no" want_x11_any="no" case "${with_x11}" in @@ -1929,11 +1928,6 @@ case "${with_x11}" in want_x11_xlib="yes" want_x11_any="yes" ;; - xcb) - want_x11_xcb="yes" - want_x11_any="yes" - CFOPT_WARNING="xyes" - ;; none) want_x11_none="yes" ;; @@ -1961,10 +1955,8 @@ case "${with_opengl}" in esac want_x11_xlib_opengl="no" -want_x11_xcb_opengl="no" if test "${with_opengl}" != "none"; then want_x11_xlib_opengl="${want_x11_xlib}" - want_x11_xcb_opengl="${want_x11_xcb}" want_x11_any_opengl="${want_x11_any}" fi @@ -2529,50 +2521,30 @@ EVAS_CHECK_ENGINE([gl-drm], [${want_gl_drm}], [no], [OpenGL Drm]) EVAS_CHECK_ENGINE([eglfs], [${want_eglfs}], [no], [OpenGL Fb]) -# Software XCB - -have_evas_engine_software_xcb="no" -if test "${with_x11}" = "xcb" ; then - EVAS_CHECK_ENGINE([software-xcb], [${want_x11_xcb}], [no], [Software XCB]) -else - AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_XCB], [false]) - AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_XCB], [false]) -fi - -AC_MSG_CHECKING([whether to build Software XCB Engine]) -AC_MSG_RESULT([${have_evas_engine_software_xcb}]) - -# No Software XCB ? Then try Software Xlib +# Software Xlib have_evas_engine_software_xlib="no" -if test "x${want_x11_xcb}" = "xno" ; then - EVAS_CHECK_ENGINE([software-xlib], [${want_x11_xlib}], [no], [Software Xlib]) -else - AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_XLIB], [false]) - AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_XLIB], [false]) -fi - +EVAS_CHECK_ENGINE([software-xlib], [${want_x11_xlib}], [no], [Software Xlib]) AC_MSG_CHECKING([whether to build Software Xlib Engine]) AC_MSG_RESULT([${have_evas_engine_software_xlib}]) # If software_x11 is available, define everything needed for X11 have_evas_engine_software_x11="no" -if test "x${have_evas_engine_software_xlib}" = "xyes" || test "x${have_evas_engine_software_xlib}" = "xstatic" || test "x${have_evas_engine_software_xcb}" = "xyes" || test "x${have_evas_engine_software_xcb}" = "xstatic" ; then +if test "x${have_evas_engine_software_xlib}" = "xyes" || test "x${have_evas_engine_software_xlib}" = "xstatic"; then have_evas_engine_software_x11="yes" AC_DEFINE_UNQUOTED([BUILD_ENGINE_SOFTWARE_X11], [1], [Build software X11 engine]) fi AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_X11], [test "x${have_evas_engine_software_x11}" = "xyes"]) -if test "x${have_evas_engine_software_xlib}" = "xstatic" || test "x${have_evas_engine_software_xcb}" = "xstatic"; then +if test "x${have_evas_engine_software_xlib}" = "xstatic"; then AC_DEFINE_UNQUOTED([EVAS_STATIC_BUILD_SOFTWARE_X11], [1], [Build software X11 engine as part of libevas]) fi -AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_X11], [test "x${have_evas_engine_software_xcb}" = "xstatic" || test "x${have_evas_engine_software_xlib}" = "xstatic"]) +AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_X11], [test "x${have_evas_engine_software_xlib}" = "xstatic"]) # Needed for evas-software-x11.pc AC_SUBST([have_evas_engine_software_xlib]) -AC_SUBST([have_evas_engine_software_xcb]) # Software generic AC_DEFINE([EVAS_STATIC_BUILD_SOFTWARE_GENERIC], [1], [Build software generic engine as part of libevas]) @@ -2584,28 +2556,10 @@ if test "${with_opengl}" = "es" ; then AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support]) fi -# OpenGL XCB - -have_evas_engine_gl_xcb="no" -if test "${want_x11_xcb_opengl}" = "yes"; then - EVAS_CHECK_ENGINE([gl-xcb], [${want_x11_xcb_opengl}], [no], [OpenGL XCB]) -else - AM_CONDITIONAL([BUILD_ENGINE_GL_XCB], [false]) - AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_XCB], [false]) -fi - -AC_MSG_CHECKING([whether to build OpenGL XCB Engine]) -AC_MSG_RESULT([${have_evas_engine_gl_xcb}]) - -# No openGL XCB ? Then try OpenGL Xlib +# OpenGL Xlib have_evas_engine_gl_xlib="no" -if test "x${have_evas_engine_gl_xcb}" = "xno" ; then - EVAS_CHECK_ENGINE([gl-xlib], [${want_x11_xlib_opengl}], [no], [OpenGL XLib]) -else - AM_CONDITIONAL([BUILD_ENGINE_GL_XLIB], [false]) - AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_XLIB], [false]) -fi +EVAS_CHECK_ENGINE([gl-xlib], [${want_x11_xlib_opengl}], [no], [OpenGL XLib]) AC_MSG_CHECKING([whether to build OpenGL Xlib Engine]) AC_MSG_RESULT([${have_evas_engine_gl_xlib}]) @@ -2613,21 +2567,20 @@ AC_MSG_RESULT([${have_evas_engine_gl_xlib}]) # If opengl_x11 is available, define everything needed for X11 have_evas_engine_gl_x11="no" -if test "x${have_evas_engine_gl_xlib}" = "xyes" || test "x${have_evas_engine_gl_xlib}" = "xstatic" || test "x${have_evas_engine_gl_xcb}" = "xyes" || test "x${have_evas_engine_gl_xcb}" = "xstatic" ; then +if test "x${have_evas_engine_gl_xlib}" = "xyes" || test "x${have_evas_engine_gl_xlib}" = "xstatic"; then have_evas_engine_gl_x11="yes" AC_DEFINE_UNQUOTED([BUILD_ENGINE_GL_X11], [1], [Build OpenGL X11 engine]) fi AM_CONDITIONAL([BUILD_ENGINE_GL_X11], [test "x${have_evas_engine_gl_x11}" = "xyes"]) -if test "x${have_evas_engine_gl_xlib}" = "xstatic" || test "x${have_evas_engine_gl_xcb}" = "xstatic"; then +if test "x${have_evas_engine_gl_xlib}" = "xstatic"; then AC_DEFINE_UNQUOTED([EVAS_STATIC_BUILD_GL_X11], [1], [Build OpenGL X11 engine as part of libevas]) fi -AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_X11], [test "x${have_evas_engine_gl_xcb}" = "xstatic" || test "x${have_evas_engine_gl_xlib}" = "xstatic"]) +AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_X11], [test "x${have_evas_engine_gl_xlib}" = "xstatic"]) # Needed for evas-opengl-x11.pc AC_SUBST([have_evas_engine_gl_xlib]) -AC_SUBST([have_evas_engine_gl_xcb]) # OpenGL SDL @@ -2679,7 +2632,6 @@ AC_SUBST([evas_engine_gl_common_libs]) have_evas_engine_gl_common="no" have_static_evas_engine_gl_common="no" if test "x$have_evas_engine_gl_xlib" = "xyes" || \ - test "x$have_evas_engine_gl_xcb" = "xyes" || \ test "x$have_evas_engine_gl_sdl" = "xyes" || \ test "x$have_evas_engine_gl_cocoa" = "xyes" || \ test "x$have_evas_engine_gl_drm" = "xyes" || \ @@ -2688,7 +2640,6 @@ if test "x$have_evas_engine_gl_xlib" = "xyes" || \ have_evas_engine_gl_common="yes" fi if test "x$have_evas_engine_gl_xlib" = "xstatic" || \ - test "x$have_evas_engine_gl_xcb" = "xstatic" || \ test "x$have_evas_engine_gl_sdl" = "xstatic" || \ test "x$have_evas_engine_gl_cocoa" = "xstatic" || \ test "x$have_evas_engine_gl_drm" = "xstatic" || \ @@ -4177,65 +4128,6 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_X], [eina]) ## Xlib -## XCB - -### Checks for header files - -AC_CHECK_DECL([MAXHOSTNAMELEN], [FOUND_MAXHOSTNAMELEN=yes]) - -if test "x${FOUND_MAXHOSTNAMELEN}" != "xyes" ; then - FOUND_MAXHOSTNAMELEN="not found" - - AC_COMPILE_IFELSE( - [ - AC_LANG_PROGRAM( - [[ -#include - ]], - [[ -int h = MAXHOSTNAMELEN; - ]]) - ], - [ - FOUND_MAXHOSTNAMELEN="sys/param.h" - AC_DEFINE([NEED_SYS_PARAM_H], [1], [Define to 1 if you need to define MAXHOSTNAMELEN]) - ]) - - AC_COMPILE_IFELSE( - [ - AC_LANG_PROGRAM( - [[ -#include - ]], - [[ -int h = MAXHOSTNAMELEN; - ]]) - ], - [ - FOUND_MAXHOSTNAMELEN="netdb.h" - AC_DEFINE([NEED_NETDB_H], [1], [Define to 1 if you need to define MAXHOSTNAMELEN]) - ]) - - AC_MSG_CHECKING([for header that defines MAXHOSTNAMELEN]) - AC_MSG_RESULT([$FOUND_MAXHOSTNAMELEN]) -fi - -## Xlib -if test "x${want_x11_xcb}" = "xyes" ; then - KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11 - FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h" - for i in $FILES; do - if test -f "$KEYSYMDEFDIR/$i"; then - KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i" - elif test "x$i" = "xkeysymdef.h"; then - AC_MSG_ERROR([Cannot find keysymdef.h]) - fi - done - AC_MSG_CHECKING([keysym definitions]) - AC_MSG_RESULT([$KEYSYMDEFS]) - AC_SUBST([KEYSYMDEFS]) -fi - ### Checks for types ### Checks for structures @@ -4302,54 +4194,6 @@ if test "x${want_x11_xlib}" = "xyes" ; then EFL_CHECK_FUNCS([ECORE_X], [dlopen dlsym]) fi -## XCB - -if test "${want_x11_xcb}" = "yes"; then -dnl note: added pixman-1 as ecore_xcb_region uses that - EFL_DEPEND_PKG([ECORE_X], [ECORE_X_XCB], - [x11-xcb xcb xcb-shm xcb-event xcb-icccm >= 0.3.8 xcb-util >= 0.3.8 xcb-image xcb-keysyms >= 0.3.8 xcb-composite xcb-present xcb-damage xcb-dpms xcb-randr xcb-render xcb-screensaver xcb-shape xcb-sync xcb-xfixes xcb-xinerama xcb-xtest xcb-renderutil pixman-1]) - -dnl TODO: remove these ifdefs from code! - AC_DEFINE([ECORE_XCB_COMPOSITE], [1], [Build support for XCB composite]) - AC_DEFINE([ECORE_XCB_DAMAGE], [1], [Build support for XCB damage]) - AC_DEFINE([ECORE_XCB_DPMS], [1], [Build support for XCB dpms]) - AC_DEFINE([ECORE_XCB_RANDR], [1], [Build support for XCB randr]) - AC_DEFINE([ECORE_XCB_RENDER], [1], [Build support for XCB render]) - AC_DEFINE([ECORE_XCB_SCREENSAVER], [1], [Build support for XCB screensaver]) - AC_DEFINE([ECORE_XCB_SHAPE], [1], [Build support for XCB shape]) - AC_DEFINE([ECORE_XCB_SYNC], [1], [Build support for XCB sync]) - AC_DEFINE([ECORE_XCB_XFIXES], [1], [Build support for XCB xfixes]) - AC_DEFINE([ECORE_XCB_XINERAMA], [1], [Build support for XCB xinerama]) - AC_DEFINE([ECORE_XCB_XTEST], [1], [Build support for XCB xtest]) - AC_DEFINE([ECORE_XCB_CURSOR], [1], [Build support for XCB cursor]) - - EFL_OPTIONAL_DEPEND_PKG([ECORE_X], [${want_xpresent}], [ECORE_XCB_XPRESENT], - [xcb-present]) - AC_DEFINE_IF([ECORE_XCB_XPRESENT], [test "${want_xpresent}" = "yes"], - [1], [Build support for XCB Present]) - EFL_ADD_FEATURE([ECORE_X], [xpresent]) - - EFL_OPTIONAL_DEPEND_PKG([ECORE_X], [${want_gesture}], [ECORE_XCB_GESTURE], - [xcb-gesture]) - AC_DEFINE_IF([ECORE_XCB_XGESTURE], [test "${want_gesture}" = "yes"], - [1], [Build support for XCB xgesture]) - - EFL_ADD_FEATURE([ECORE_X], [gesture]) - -dnl input extension disabled currently in xcb as xcb-input has some issues -dnl remember to add xcb-xinput to EFL_DEPEND_PKG() -dnl AC_DEFINE([ECORE_XCB_XINPUT], [1], [Build support for XCB input]) - -dnl dri extension disabled currently in xcb -dnl remember to add xcb-dri2 to EFL_DEPEND_PKG() -dnl AC_DEFINE([ECORE_XCB_DRI], [1], [Build support for XCB dri]) - - EFL_EVAL_PKGS([ECORE_X]) - EFL_CHECK_FUNCS([ECORE_X], [dlopen iconv]) - - HAVE_ECORE_X_BACKEND="HAVE_ECORE_X_XCB" -fi - EFL_ADD_LIBS([ECORE_X], [${ECORE_X_LIBS}]) AC_SUBST([HAVE_ECORE_X_BACKEND]) @@ -4357,7 +4201,6 @@ AC_SUBST([HAVE_ECORE_X_BACKEND]) EFL_LIB_END_OPTIONAL([Ecore_X]) AM_CONDITIONAL([HAVE_ECORE_X_XLIB], [test "${want_x11_xlib}" = "yes"]) -AM_CONDITIONAL([HAVE_ECORE_X_XCB], [test "${want_x11_xcb}" = "yes"]) #### End of Ecore_X @@ -4610,7 +4453,6 @@ AM_CONDITIONAL([BUILD_ECORE_EVAS_WIN32], ECORE_EVAS_MODULE([software-x11], [${want_x11_any}]) have_ecore_evas_software_xlib="no" -have_ecore_evas_software_xcb="no" if test "x$have_ecore_evas_software_x11" = "xyes" ; then have_ecore_evas_software_xlib=${have_evas_engine_software_xlib} if test "x${have_ecore_evas_software_xlib}" = "xstatic"; then @@ -4619,13 +4461,6 @@ if test "x$have_ecore_evas_software_x11" = "xyes" ; then if test "x${have_ecore_evas_software_xlib}" = "xyes"; then AC_DEFINE([BUILD_ECORE_EVAS_SOFTWARE_XLIB], [1], [Evas Software Xlib Engine Support]) fi - have_ecore_evas_software_xcb=${have_evas_engine_software_xcb} - if test "x$have_ecore_evas_software_xcb" = "xstatic"; then - have_ecore_evas_software_xcb="yes" - fi - if test "x$have_ecore_evas_software_xcb" = "xyes"; then - AC_DEFINE([BUILD_ECORE_EVAS_SOFTWARE_XCB], [1], [Evas Software XCB Engine Support]) - fi fi # XXX TODO: ecore_evas_opengl_x11 @@ -4633,39 +4468,17 @@ fi ECORE_EVAS_MODULE([opengl-x11], [${want_x11_any_opengl}]) have_ecore_evas_opengl_xlib="no" -have_ecore_evas_opengl_xcb="no" if test "x${have_ecore_evas_opengl_x11}" = "xyes" || test "x${have_ecore_evas_opengl_x11}" = "xstatic" ; then have_ecore_evas_opengl_xlib=${have_evas_engine_gl_xlib} if test "x${have_ecore_evas_opengl_xlib}" = "xyes" ; then AC_DEFINE([BUILD_ECORE_EVAS_OPENGL_XLIB], [1], [OpenGL Xlib rendering backend]) fi - -# opengl does not work with xcb (yet) - have_ecore_evas_opengl_xcb=${have_evas_engine_gl_xcb} - if test "x${have_ecore_evas_opengl_xcb}" = "xstatic"; then - have_ecore_evas_opengl_xcb="yes" - fi - if test "x${have_ecore_evas_opengl_xcb}" = "xyes"; then - PKG_CHECK_MODULES([XCB_X11], - [x11-xcb], - [ - have_ecore_x_opengl_xcb="yes" - requirements_ecore_x="x11-xcb ${requirements_ecore_x}" - AC_DEFINE([BUILD_ECORE_X_OPENGL_XCB], [1], [Build support for XCB-based OpenGL]) - AC_DEFINE([BUILD_ECORE_EVAS_OPENGL_XCB], [1], [OpenGL XCB rendering backend]) - ], - [have_ecore_x_opengl_xcb="no"]) - else - have_ecore_x_opengl_xcb="no" - AC_MSG_NOTICE([XCB-based OpenGL explicitly disabled]) - fi fi build_ecore_evas_x11="no" build_ecore_evas_vnc="no" if test "x$have_ecore_evas_software_x11" = "xyes" || \ - test "x$have_ecore_evas_opengl_x11" = "xyes" || \ - test "x$have_ecore_evas_software_xcb" = "xyes"; then + test "x$have_ecore_evas_opengl_x11" = "xyes"; then AC_DEFINE([BUILD_ECORE_EVAS_X11], [1], [Support for X Window Engines in Ecore_Evas]) build_ecore_evas_x11="yes" if test "$want_vnc_server" = "yes"; then @@ -6062,27 +5875,6 @@ if test -n "$CFOPT_WARNING"; then echo "==-- WARNING --==" echo "" echo "_____________________________________________________________________" - if test "x${with_x11}" = "xxcb"; then - echo "_____________________________________________________________________" - echo "You have chosen to use XCB instead of Xlib. It is a myth that XCB" - echo "is amazingly faster than Xlib (when used sensibly). It can be" - echo "faster in a few corner cases on startup of an app, but it comes" - echo "with many downsides. One of those is more complex code inside" - echo "ecore_x, which is far less tested in XCB mode than Xlib. Also" - echo "the big catch is that OpenGL support basically requires Xlib anyway" - echo "so if you want OpenGL in X11, you need Xlib regardless and so you" - echo "gain nothing really in terms of speed and no savings in memory" - echo "because Xlib is still linked, loaded and used, BUT instead you" - echo "have OpenGL drivers working with an hybrid XCB/Xlib (mostly XCB)" - echo "toolkit and this is basically never tested by anyone working on" - echo "the OpenGL drivers, so you will have bugs. Do not enable XCB" - echo "and use OpenGL. XCB is only useful if you wish to shave a few Kb" - echo "off the memory footprint of a whole system and live with less" - echo "tested code, and possibly unimplemented features in ecore_x. To" - echo "remove the XCB setup, remove the --with-x11=xcb option to" - echo "configure." - echo "_____________________________________________________________________" - fi if test "x${want_physics}" = "xno"; then echo "_____________________________________________________________________" echo "You have chosen to disable physics support. This disables lots of" diff --git a/m4/evas_check_engine.m4 b/m4/evas_check_engine.m4 index a7e0085..4ab7e4c 100644 --- a/m4/evas_check_engine.m4 +++ b/m4/evas_check_engine.m4 @@ -123,167 +123,6 @@ pthread_create(NULL, NULL, NULL, NULL); ]) ]) -dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_XCB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) - -AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_XCB], -[ - -requirement="" -have_dep="no" -evas_engine_[]$1[]_cflags="" -evas_engine_[]$1[]_libs="" - -PKG_CHECK_EXISTS([xcb xcb-shm xcb-image >= 0.2.1 pixman-1], - [ - have_dep="yes" - requirement="xcb xcb-shm xcb-image >= 0.2.1 pixman-1" - ], - [have_dep="no"]) - -if test "x${have_dep}" = "xyes" ; then - if test "x$3" = "xstatic" ; then - requirements_pc_evas="${requirement} ${requirements_pc_evas}" - requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}" - else - PKG_CHECK_MODULES([XCB], [${requirement}]) - evas_engine_[]$1[]_cflags="${XCB_CFLAGS}" - evas_engine_[]$1[]_libs="${XCB_LIBS}" - fi -fi - -AC_SUBST([evas_engine_$1_cflags]) -AC_SUBST([evas_engine_$1_libs]) - -AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5]) - -]) - - -dnl use: EVAS_CHECK_ENGINE_DEP_GL_XCB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) - -AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XCB], -[ - -requirement="" - -EFL_FIND_X(evas_engine_[]$1, [GL/gl.h], - [X11 XCreateColormap Xrender XRenderCreatePicture], - [ - CFLAGS_save="$CFLAGS" - CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags" - CPPFLAGS_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags" - AC_CHECK_HEADER([GL/glext.h], - [have_dep="yes"], - [have_dep="no"], - [ -#include -#include -#include - ]) - CPPFLAGS=$CPPFLAGS_save - CFLAGS=$CFLAGS_save - - gl_pt_lib=""; - have_gl_pt="no" - - AC_MSG_CHECKING([whether pthread_create() is supported]) - CFLAGS_save="${CFLAGS}" - CFLAGS="${CFLAGS} -pthread" - LIBS_save="${LIBS}" - LIBS="${LIBS} -pthread" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[ -#include - ]], - [[ -pthread_create(NULL, NULL, NULL, NULL); - ]])], - [have_gl_pt="yes"], - [have_gl_pt="no"]) - CFLAGS=${CFLAGS_save} - LIBS=${LIBS_save} - AC_MSG_RESULT([${have_gl_pt}]) - - if test "x$have_gl_pt" = "xyes" ; then - gl_pt_lib=" -pthread" - fi - - if test "x$have_dep" = "xyes" ; then - LIBS_save="$LIBS" - LIBS="$LIBS $evas_engine_[]$1[]_libs" - AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib]) - LIBS="$LIBS_save" - fi - ],[ - have_dep=no - ]) - -PKG_CHECK_EXISTS([x11-xcb xcb xcb-glx xcb-render xcb-renderutil], - [ - have_dep="yes" - requirement="x11-xcb xcb xcb-glx xcb-render xcb-renderutil" - ], - [have_dep="no"]) - -if test "x${have_dep}" = "xyes" ; then - if test "x$3" = "xstatic" ; then - requirements_pc_evas="${requirement} ${requirements_pc_evas}" - requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}" - else - PKG_CHECK_MODULES([XCB_GL], [${requirement}]) - fi -fi - -if test "x${with_opengl}" = "xes" ; then - have_dep=no -fi - -if test "x${have_dep}" = "xyes" ; then - evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS" - evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGL $gl_pt_lib" - evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib" -else - CFLAGS_save="$CFLAGS" - CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags" - CPPFLAGS_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags" - AC_CHECK_HEADER([GLES2/gl2.h], - [have_egl="yes"], - [have_egl="no"], - [ -#include -#include -#include - ]) - CPPFLAGS=$CPPFLAGS_save - CFLAGS=$CFLAGS_save - if test "x${have_egl}" = "xyes" ; then - LIBS_save="$LIBS" - LIBS="$LIBS $evas_engine_[]$1[]_libs" - AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib) - if test "x${have_glesv2}" = "xyes" ; then - evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS" - evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGLESv2 -lEGL -lm $gl_pt_lib" - evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib" - have_dep="yes" - AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support]) - gles_variety_sgx="yes" - fi - fi -fi - -if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then - requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}" - requirements_pc_evas="${requirement} ${requirements_pc_evas}" - requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}" -fi - -AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5]) - -]) - - dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_GDI(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_GDI], diff --git a/pc/evas-opengl-x11.pc.in b/pc/evas-opengl-x11.pc.in index 2cb1ec2..753e790 100644 --- a/pc/evas-opengl-x11.pc.in +++ b/pc/evas-opengl-x11.pc.in @@ -3,4 +3,3 @@ Description: Evas OpenGL X11 engine Version: @VERSION@ Xlib=@have_evas_engine_gl_xlib@ -XCB=@have_evas_engine_gl_xcb@ diff --git a/pc/evas-software-x11.pc.in b/pc/evas-software-x11.pc.in index b32556c..a92d072 100644 --- a/pc/evas-software-x11.pc.in +++ b/pc/evas-software-x11.pc.in @@ -3,4 +3,3 @@ Description: Evas software X11 engine Version: @VERSION@ Xlib=@have_evas_engine_software_xlib@ -XCB=@have_evas_engine_software_xcb@ diff --git a/po/ca.po b/po/ca.po index 40b38f0..10e5ffc 100644 --- a/po/ca.po +++ b/po/ca.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2015-02-10 09:34+0000\n" "Last-Translator: JoanColl \n" "Language-Team: Catalan\n" @@ -143,67 +143,67 @@ msgstr "no s'ha definit la llicència.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERROR: opció desconeguda --%s, s'ha ignorat.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "ERROR: l'opció --%s requereix un argument!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ERROR: opció desconeguda -%c, s'ha ignorat.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "ERROR: L'opció -%c requereix un argument!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "ERROR: es requereix argument posicional %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "ERROR: acció no permesa %d per argument posicional %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERROR: no s'ha proporcionat cap analitzador.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERROR: no s'ha proporcionat cap valor.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERROR: no s'ha proporcionat cap argument.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERROR: s'han trobat opcions no vàlides." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Miri --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Miri -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "ERROR: arguments posicionals no vàlids." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERROR: valor geomètric incorrecte '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERROR: tamany incorrecte '%s'\n" diff --git a/po/cs.po b/po/cs.po index 6d94409..1d196b4 100644 --- a/po/cs.po +++ b/po/cs.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-05-22 22:44+0200\n" "Last-Translator: Tomáš Čech \n" "Language-Team: Czech \n" @@ -145,68 +145,68 @@ msgstr "nebyla definována licence.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "CHYBA: neznámá volba --%s, ignoruji.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "CHYBA: volba --%s vyžaduje argument!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "CHYBA: neznámá volba -%c, ignoruji.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "CHYBA: volba -%c vyžaduje argument!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "CHYBA: volba -%c vyžaduje argument!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "CHYBA: nebyl poskytnut parser.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "CHYBA: nebyly poskytnuty hodnoty.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "CHYBA: nebyly poskytnuty argumenty.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "CHYBA: nalezeny neplatné volby." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Viz --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Viz -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "CHYBA: nalezeny neplatné volby." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "CHYBA: neplatná hodnota geometrie '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "CHYBA: neplatná hodnota velikosti '%s'\n" diff --git a/po/de.po b/po/de.po index 838aec0..cec88c9 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary 0.7.0.57309\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2011-02-25 20:22+0100\n" "Last-Translator: Fabian Nowak \n" "Language-Team: German\n" @@ -143,68 +143,68 @@ msgstr "es wurde keine Lizenz angegeben.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "FEHLER: Unbekannte Option --%s, ignoriert\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, 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:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "FEHLER: Unbekannte Option -%c, ignoriert\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, 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:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "FEHLER: Option -%c benötigt ein Argument!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "FEHLER: Kein Parser bereitgestellt.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "FEHLER: Keine Werte bereitgestellt.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "FEHLER: Keine Argumente bereitgestellt.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "FEHLER: Ungültige Optionen gefunden." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Siehe --%s\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Siehe -%c\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "FEHLER: Ungültige Optionen gefunden." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "FEHLER: Falscher Geometriewert \"%s\"\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "FEHLER: Falscher Größenwert \"%s\"\n" diff --git a/po/el.po b/po/el.po index 6915edb..3506e52 100644 --- a/po/el.po +++ b/po/el.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2012-12-19 15:58+0200\n" "Last-Translator: Efstathios Iosifidis \n" "Language-Team: Ελληνικά, Σύγχρονα \n" @@ -146,68 +146,68 @@ msgstr "δεν έχει οριστεί άδεια.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή --%s, αγνοήθηκε.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "ΣΦΑΛΜΑ: η επιλογή --%s απαιτεί μια παράμετρο!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ΣΦΑΛΜΑ: άγνωστη επιλογή -%c, αγνοήθηκε.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "ΣΦAΛΜΑ: η επιλογή -%c απαιτεί μία παράμετρο!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "ΣΦAΛΜΑ: η επιλογή -%c απαιτεί μία παράμετρο!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ΣΦΑΛΜΑ: δεν παρέχεται αναλυτής.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ΣΦΑΛΜΑ: δεν έχουν δοθεί τιμές.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ΣΦΑΛΜΑ:δεν έχουν δοθεί παράμετροι.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ΣΦΑΛΜΑ: βρέθηκαν μη έγκυρες επιλογές." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Δείτε --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Δείτε -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "ΣΦΑΛΜΑ: βρέθηκαν μη έγκυρες επιλογές." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ΣΦΑΛΜΑ: μη έγκυρη γεωμετρική τιμή '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ΣΦΑΛΜΑ: μη έγκυρη τιμή μεγέθους '%s'\n" diff --git a/po/eo.po b/po/eo.po index 97340bf..ae65f90 100644 --- a/po/eo.po +++ b/po/eo.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: enlightenment\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2013-11-05 18:59+0000\n" "Last-Translator: Eliovir \n" "Language-Team: Esperanto \n" @@ -142,67 +142,67 @@ msgstr "neniu permesilo estas difinita.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERARO: nekonata opcio --%s. Ignorita.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "ERARO: opcio --%s postulas argumenton!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ERARO: nekonata opcio -%c. Ignorata.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "ERARO: opcio -%c postulas argumenton!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "ERARO: nepra poziciaj argumento %s mankas.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "ERARO: neeltena tipo de agado %d por pozicia argumento %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERARO: neniu sintaksa analizilo provizita.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERARO: neniu valoro provizita.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERARO: neniu argumento provizita.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERARO: nevalidaj opcioj trovitaj." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Vidu --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Vidu -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "ERARO: nevalida poziciaj argumentoj trovitaj." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERARO: nekorekta geometria valoro '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERARO: nekorekta valoro de grando '%s'\n" diff --git a/po/es.po b/po/es.po index b9ff6e3..d44249e 100644 --- a/po/es.po +++ b/po/es.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2015-05-03 18:19+0100\n" "Last-Translator: Adrián Arévalo \n" "Language-Team: Enlightenment Team\n" @@ -142,67 +142,67 @@ msgstr "no se definió la licencia.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERROR: opción desconocida --%s, ignorada.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "ERROR: La opción --%s requiere un argumento!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ERROR: opción desconocida -%c, ignorada.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "ERROR: La opción -%c requiere un argumento!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "ERROR: Falta un argumento posicional requerido %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "ERROR: tipo de acción %d no permitido para argumento posicional %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERROR: no se proporcionó ningún parser.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERROR: no se proporcionó ningún valor.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERROR: no se proporcionó ningún argumento.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERROR: opciones inválidas." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Vea --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Vea -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "ERROR: argumentos posicionales inválidos encontrados." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERROR: valor geométrico incorrecto '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERROR: tamaño incorrecto '%s'\n" diff --git a/po/fi.po b/po/fi.po index 31004e4..95227eb 100644 --- a/po/fi.po +++ b/po/fi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: enlightenment\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-08-31 15:13+0000\n" "Last-Translator: Kai Huuhko \n" "Language-Team: Finnish \n" @@ -142,67 +142,67 @@ msgstr "lisenssiä ei määritelty.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "VIRHE: tuntematon optio --%s, jätetty huomioimatta.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "VIRHE: optio --%s tarvitsee argumentin!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "VIRHE: tuntematon optio -%c, jätetty huomioimatta.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "VIRHE: optio -%c tarvitsee argumentin\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "VIRHE: puuttuva pakollinen sija-argumentti %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "VIRHE: toimintotyyppi %d ei ole tuettu sija-argumentille %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "VIRHE: jäsennintä ei annettu.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "VIRHE: yhtään arvoa ei annettu.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "VIRHE: yhtään argumenttia ei annettu.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "VIRHE: virheellisiä optioita löydetty." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Katso --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Katso -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "VIRHE: virheellisiä sija-argumentteja löydetty." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "VIRHE: virheellinen geometrinen arvo '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "VIRHE: virheellinen koon arvo '%s'\n" diff --git a/po/fr.po b/po/fr.po index 421b9b8..e3acb64 100644 --- a/po/fr.po +++ b/po/fr.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-05-25 20:18+0000\n" "Last-Translator: Eliovir \n" "Language-Team: French \n" @@ -148,67 +148,67 @@ msgstr "aucune licence n’est définie.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERREUR : option inconnue --%s, non prise en compte.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, 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:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, 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:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, 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:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERREUR : aucun analyseur n’est fourni.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERREUR : aucune valeur n’est fournie.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERREUR : aucun argument n’est fourni.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERREUR : options non valides détectées." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Voir --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Voir -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "" -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERREUR : valeur géométrique incorrecte « %s »\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERREUR : valeur de taille incorrecte « %s »\n" diff --git a/po/gl.po b/po/gl.po index b262ac9..fb7b63e 100644 --- a/po/gl.po +++ b/po/gl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-05-24 08:39+0000\n" "Last-Translator: Kaptan \n" "Language-Team: Galician \n" @@ -141,67 +141,67 @@ msgstr "non se definiu a licenza.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERRO: opción descoñecida --%s, ignorada.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "ERRO: opción --%s require un argumento!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ERRO: opción descoñecida -%c, ignorada.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "ERRO: opción -%c require un argumento!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERRO: non se forneceu ningún procesador.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERRO: non se forneceu ningún valor.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERRO: non se forneceu ningún argumento.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERRO: atopadas opcións inválidas." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Consulte --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Consulte -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "" -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERRO: valor xeométrico incorrecto '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERRO: valor do tamaño incorrecto '%s'\n" diff --git a/po/hu.po b/po/hu.po index 5df53c4..852234d 100644 --- a/po/hu.po +++ b/po/hu.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary 1.8.2\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-01-29 15:27+0100\n" "Last-Translator: rezso \n" "Language-Team: General\n" @@ -142,68 +142,68 @@ msgstr "Nincs definiált licenc.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "HIBA: ismeretlen opció: --%s, figyelmen kívül hagyva.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "HIBA: --%s opció argumentumot igényel.\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "HIBA: ismeretlen opció: -%c, figyelmen kívül hagyva.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "HIBA: -%c opció argumentumot igényel.\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "HIBA: -%c opció argumentumot igényel.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "HIBA: hiányzó parser.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "HIBA: hiányzó értékek.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "HIBA: hiányzó argumentumok.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "HIBA: érvénytelen opciók találhatók." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Lásd --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Lásd -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "HIBA: érvénytelen opciók találhatók." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "HIBA: helytelen geometria érték: '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "HIBA: helytelen méret érték: '%s'\n" diff --git a/po/it.po b/po/it.po index 7efa103..1ddace6 100644 --- a/po/it.po +++ b/po/it.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2015-06-11 14:19+0200\n" "Last-Translator: Massimo Maiurana \n" "Language-Team: General\n" @@ -140,68 +140,68 @@ msgstr "nessuna licenza definita.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERRORE: opzione sconosciuta --%s, ignorata.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, 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:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ERRORE: opzione sconosciuta -%c, ignorata.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, 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:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "ERRORE: manca l'argomento posizionale %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" "ERRORE: azione di tipo %d non supportata per argomento posizionale %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERRORE: nessun parser fornito.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERRORE: nessun valore fornito.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERRORE: nessun argomento fornito.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERRORE: trovate opzioni non valide." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Vedere --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Vedere -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "ERRORE: trovati argomenti posizionali non validi." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERRORE: valore geometrico non corretto '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERRORE: valore dimensione non corretto '%s'\n" diff --git a/po/ja.po b/po/ja.po index 2024859..5afd236 100644 --- a/po/ja.po +++ b/po/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Efl\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2012-06-24 17:10+0900\n" "Last-Translator: Daichi Fukui\n" "Language-Team: Enlightenment Team\n" @@ -140,68 +140,68 @@ msgstr "ライセンスが定義されていません.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "エラー: 不明なオプション --%s, 無視.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "エラー: オプション --%s には引数が必要です.\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "エラー: 不明なオプション -%c, 無視.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "エラー: オプション -%c には引数が必要です.\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "エラー: オプション -%c には引数が必要です.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "エラー: パーサーがありません.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "エラー: 値がありません.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "エラー: 引数がありません.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "エラー: 不正なオプションです." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "--%s を参照.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "-%c を参照.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "エラー: 不正なオプションです." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "エラー: 不正なジオメトリ値 '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "エラー: 不正なsize値です '%s'\n" diff --git a/po/ko.po b/po/ko.po index 1285605..af6a91a 100644 --- a/po/ko.po +++ b/po/ko.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Efl\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-11-10 01:01+0900\n" "Last-Translator: Daniel Juyung Seo \n" "Language-Team: Enlightenment Team\n" @@ -145,67 +145,67 @@ msgstr "정의한 라이선스가 없습니다.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "오류: 알 수 없는 --%s 옵션을 무시합니다.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "오류: --%s 옵션에 인자가 필요합니다!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "오류: 알 수 없는 -%c 옵션을 무시합니다.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "오류: -%c 옵션에 인자가 필요합니다!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "오류: %s 옵션에 위치 인자가 필요합니다!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "오류: 지원하지 않는 동작 형식 %d의 위치 인자 %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "오류: 해석 프로그램이 존재하지 않습니다.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "오류: 값이 존재하지 않습니다.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "인자가 존재하지 않습니다.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "오류: 잘못된 옵션이 있습니다." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " --%s 옵션을 참조하십시오.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " -%c 옵션을 참조하십시오.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "오류: 잘못된 위치 인자가 있습니다." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "오류: '%s' 값의 좌표가 올바르지 않습니다\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "오류: '%s' 값의 크기가 올바르지 않습니다\n" diff --git a/po/lt.po b/po/lt.po index cf404eb..f4d428b 100644 --- a/po/lt.po +++ b/po/lt.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: enlightenment\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-02-21 22:38+0000\n" "Last-Translator: Mantas Kriaučiūnas \n" "Language-Team: Lithuanian \n" @@ -142,67 +142,67 @@ msgstr "" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "KLAIDA: nežinomas parametras --%s, nepaisomas.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "KLAIDA: nežinomas parametras -%c, nepaisomas.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "KLAIDA: aptikti netinkami parametrai." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "" -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "" diff --git a/po/nl.po b/po/nl.po index 4a10b38..d7d981b 100644 --- a/po/nl.po +++ b/po/nl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary 0.7.0.57309\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2011-06-19 16:41+0100\n" "Last-Translator: Heimen Stoffels \n" "Language-Team: Dutch \n" @@ -144,68 +144,68 @@ msgstr "geen licentie was gedefinieerd.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "FOUT: onbekende optie --%s, genegeerd.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "FOUT: optie --%s vereist een argument!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "FOUT: onbekende opties -%c, genegeerd.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "FOUT: optie -%c vereist een argument!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "FOUT: optie -%c vereist een argument!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "FOUT: geen doorvoerder beschikbaar gesteld.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "FOUT: geen waarden beschikbaar gesteld.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "FOUT: geen argumenten beschibaar gesteld.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "FOUT: ongeldige opties gevonden." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "Zie --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "Zie -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "FOUT: ongeldige opties gevonden." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "Fout: foutieve wiskundige waarde '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "FOUT: foutieve grootte-waarden '%s'\n" diff --git a/po/pl.po b/po/pl.po index a3b3a61..8c54ab6 100644 --- a/po/pl.po +++ b/po/pl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2013-11-23 14:48+0100\n" "Last-Translator: Konrad Makowski \n" "Language-Team: General\n" @@ -143,68 +143,68 @@ msgstr "nie zdefiniowano licencji.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "BŁĄD: nieznana opcja --%s, zignorowano.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "BŁĄD: opcja --%s wymaga argumentu!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "BŁĄD: nieznana opcja --%c, zignorowano.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "BŁĄD: opcja --%c wymaga argumentu!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "BŁĄD: opcja --%c wymaga argumentu!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "BŁĄD: nie dostarczono parsera.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "BŁĄD: nie podano wartości.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "BŁĄD: nie podano argumentów.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "BŁĄD: wykryto błędne funkcje." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "Zobacz --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "Zobacz -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "BŁĄD: wykryto błędne funkcje." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "BŁĄD: nieprawidłowa wartość geometryczna \"%s\"\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "BŁĄD: nieprawdiłowy rozmiar wartości \"%s\"\n" diff --git a/po/pt.po b/po/pt.po index 7a9dab6..6f16727 100644 --- a/po/pt.po +++ b/po/pt.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2013-11-05 14:11-0000\n" "Last-Translator: Sérgio Marques \n" "Language-Team: General\n" @@ -142,67 +142,67 @@ msgstr "licença não definida.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ERRO: opção desconhecida --%s, ignorada.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, 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:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ERRO: opção desconhecida --%c, ignorada.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, 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:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "ERRO: falta o argumento de posição necessário %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "ERRO: tipo de ação não suportado %d para o argumento de posição %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ERRO: nenhum processador fornecido.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ERRO: nenhum valor fornecido.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ERRO: nenhum argumento fornecido.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ERRO: encontradas opções inválidas." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "Consulte --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "Consulte -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "ERRO: encontrados argumentos de posição inválidos." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ERRO: valor geométrico incorreto \"%s\"\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ERRO: tamanho incorreto \"%s\"\n" diff --git a/po/ru.po b/po/ru.po index 2b6a5f9..6d29405 100644 --- a/po/ru.po +++ b/po/ru.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary 1.11\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2015-02-07 15:16+0300\n" "Last-Translator: Игорь Мурзов \n" "Language-Team: ru \n" @@ -143,67 +143,67 @@ msgstr "" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "" -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "" -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "" diff --git a/po/sl.po b/po/sl.po index 06a325a..ffb5e51 100644 --- a/po/sl.po +++ b/po/sl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Efl\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2016-09-21 17:00+0200\n" "Last-Translator: Renato Rener \n" "Language-Team: Enlightenment Team\n" @@ -141,67 +141,67 @@ msgstr "definirana ni bila nobena licenca.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "NAPAKA:·neznana možnost·--%s,·prezrto.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "NAPAKA:·možnost·--%s·zahteva argument!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "NAPAKA:·neznana možnost·-%c,·prezrto.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "NAPAKA:·možnost·-%c zahteva argument!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "NAPAKA: manjka zahtevani argument nahajališča %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "NAPAKA: nepodprto dejanje vrste %d za argumente nahajališča %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "NAPAKA:·ni podan razčlenjevalnik.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "NAPAKA::·ni podanih vrednosti.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "NAPAKA::·ni podanih argumentov.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "NAPAKA::·najdene nepravilne možnosti" -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "·Glej·--%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "·Glej·-%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "NAPAKA: nepravilni argumenti nahajališča najdeni." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "NAPAKA::·nepravilna geometrijska vrednost·'%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "NAPAKA::·nepravilna vrednost velikosti·'%s'\n" diff --git a/po/sr.po b/po/sr.po index cc0579a..a7cd58c 100644 --- a/po/sr.po +++ b/po/sr.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: а\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2015-01-31 14:06+0100\n" "Last-Translator: Саша Петровић \n" "Language-Team: српски \n" @@ -145,67 +145,67 @@ msgstr "није одређена дозвола.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "ГРЕШКА: непозната могућност --%s, занемарујем.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "ГРЕШКА: могућност --%s захтева одредницу!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "ГРЕШКА: непозната могућност -%c, занемарујем.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "ГРЕШКА: могућност -%c захтева одредницу!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "Грешка: недостаје потребна одредница положаја %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "Грешка: неподржана радња врсте %d за одредницу положаја %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "ГРЕШКА: није обезбеђен рашчлањивач.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "ГРЕШКА: нема обезбеђених вредности.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "ГРЕШКА: није обезбеђена одредница.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "ГРЕШКА: нађена је неисправна могућност." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Погледајте --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Погледајте -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "Грешка: нађена је неисправна одредница положаја." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "ГРЕШКА: неисправна геометријска вредност „%s“\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "ГРЕШКА: неисправна вредност величине „%s“\n" diff --git a/po/tr.po b/po/tr.po index 04be26e..855d7b5 100644 --- a/po/tr.po +++ b/po/tr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: enlightenment\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2014-04-18 13:35+0000\n" "Last-Translator: Ali E.İMREK \n" "Language-Team: Turkish \n" @@ -142,67 +142,67 @@ msgstr "lisans tanımlanmadı.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "HATA: bilinmeyen seçenek --%s, yoksayıldı.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "HATA: seçenek --%s bağımsız bir değişken gerektirir!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "HATA: bilinmeyen seçenek --%c, yoksayıldı.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "HATA: seçenek --%c bağımsız bir değişken gerektirir!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "HATA: konumsal argüman kayıp %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "HATA: %d desteklenmeyen eylem türü %s konumsal argümanı için.\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "HATA: ayrıştırıcı sağlanmadı.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "HATA: değerler sağlanmadı.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "HATA: bağımsız değişkenler sağlanmadı.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "HATA: geçersiz seçenekler bulundu." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " Bakın --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " Bakın -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "HATA: geçersiz konumsal argümanlar bulundu." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "HATA: yanlış geometri değeri '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "HATA: yanlış boyut değeri '%s'\n" diff --git a/po/vi.po b/po/vi.po index 3d63c1c..978d75e 100644 --- a/po/vi.po +++ b/po/vi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2015-09-29 18:06+0900\n" "Last-Translator: Thiep Ha \n" "Language-Team: General\n" @@ -143,67 +143,67 @@ msgstr "không định nghĩa giấy phép.\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "LỖI: không rõ lựa chọn --%s, bỏ qua.\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "LỖI: lựa chọn --%s đòi hỏi một tham số!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "LỖI: không rõ lựa chọn -%c, bỏ qua.\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "LỖI: lựa chọn -%c đòi hỏi một tham số!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "LỖI: thiếu tham số vị trí được yêu cầu %s.\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "LỖI: kiểu hoạt động không được hỗ trợ %d cho tham số vị trí %s\n" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "LỖI: không cung cấp bộ phân tích.\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "LỖI: không cung cấp giá trị.\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "LỖI: không cung cấp đối số.\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "LỖI: phát hiện các tùy chọn không hợp lệ." -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr "Xem --%s.\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr "Xem -%c.\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 msgid "ERROR: invalid positional arguments found." msgstr "LỖI: phát hiện các đối số vị trí không hợp lệ." -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "LỖI: giá trị hình học không đúng '%s'\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "LỖI: giá trị kích thước không đúng '%s'\n" diff --git a/po/zh_CN.po b/po/zh_CN.po index b71cf8b..42b7588 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: elementary\n" "Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n" -"POT-Creation-Date: 2016-10-28 09:22+0900\n" +"POT-Creation-Date: 2016-11-01 22:10+0900\n" "PO-Revision-Date: 2012-12-22 03:55+0800\n" "Last-Translator: Aron Xu \n" "Language-Team: Chinese (simplified)\n" @@ -142,68 +142,68 @@ msgstr "未定义许可证。\n" msgid "ERROR: unknown option --%s, ignored.\n" msgstr "错误:未知选项 --%s,忽略。\n" -#: src/lib/ecore/ecore_getopt.c:1703 +#: src/lib/ecore/ecore_getopt.c:1710 #, c-format msgid "ERROR: option --%s requires an argument!\n" msgstr "错误:选项 --%s 需要一个参数!\n" -#: src/lib/ecore/ecore_getopt.c:1745 +#: src/lib/ecore/ecore_getopt.c:1752 #, c-format msgid "ERROR: unknown option -%c, ignored.\n" msgstr "错误:未知选项 -%c,忽略。\n" -#: src/lib/ecore/ecore_getopt.c:1783 +#: src/lib/ecore/ecore_getopt.c:1797 #, c-format msgid "ERROR: option -%c requires an argument!\n" msgstr "错误:选项 -%c 需要一个参数!\n" -#: src/lib/ecore/ecore_getopt.c:1878 +#: src/lib/ecore/ecore_getopt.c:1892 #, fuzzy, c-format msgid "ERROR: missing required positional argument %s.\n" msgstr "错误:选项 -%c 需要一个参数!\n" -#: src/lib/ecore/ecore_getopt.c:1910 +#: src/lib/ecore/ecore_getopt.c:1924 #, c-format msgid "ERROR: unsupported action type %d for positional argument %s\n" msgstr "" -#: src/lib/ecore/ecore_getopt.c:2031 src/lib/ecore/ecore_getopt.c:2097 +#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 msgid "ERROR: no parser provided.\n" msgstr "错误:未提供解析器。\n" -#: src/lib/ecore/ecore_getopt.c:2036 src/lib/ecore/ecore_getopt.c:2102 +#: src/lib/ecore/ecore_getopt.c:2050 src/lib/ecore/ecore_getopt.c:2116 msgid "ERROR: no values provided.\n" msgstr "错误:未提供值。\n" -#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111 +#: src/lib/ecore/ecore_getopt.c:2059 src/lib/ecore/ecore_getopt.c:2125 msgid "ERROR: no arguments provided.\n" msgstr "错误:未提供参数。\n" -#: src/lib/ecore/ecore_getopt.c:2071 +#: src/lib/ecore/ecore_getopt.c:2085 msgid "ERROR: invalid options found." msgstr "错误:无效的选项。" -#: src/lib/ecore/ecore_getopt.c:2077 src/lib/ecore/ecore_getopt.c:2143 +#: src/lib/ecore/ecore_getopt.c:2091 src/lib/ecore/ecore_getopt.c:2157 #, c-format msgid " See --%s.\n" msgstr " 参看 --%s\n" -#: src/lib/ecore/ecore_getopt.c:2079 src/lib/ecore/ecore_getopt.c:2145 +#: src/lib/ecore/ecore_getopt.c:2093 src/lib/ecore/ecore_getopt.c:2159 #, c-format msgid " See -%c.\n" msgstr " 参看 -%c\n" -#: src/lib/ecore/ecore_getopt.c:2137 +#: src/lib/ecore/ecore_getopt.c:2151 #, fuzzy msgid "ERROR: invalid positional arguments found." msgstr "错误:无效的选项。" -#: src/lib/ecore/ecore_getopt.c:2172 +#: src/lib/ecore/ecore_getopt.c:2186 #, c-format msgid "ERROR: incorrect geometry value '%s'\n" msgstr "错误:不正确的形状 %s\n" -#: src/lib/ecore/ecore_getopt.c:2190 +#: src/lib/ecore/ecore_getopt.c:2204 #, c-format msgid "ERROR: incorrect size value '%s'\n" msgstr "错误:不正确的大小 %s\n" diff --git a/src/Makefile_Ecore_X.am b/src/Makefile_Ecore_X.am index 673cb70..7172114 100644 --- a/src/Makefile_Ecore_X.am +++ b/src/Makefile_Ecore_X.am @@ -12,88 +12,41 @@ lib/ecore_x/Ecore_X_Atoms.h \ lib/ecore_x/Ecore_X_Cursor.h lib_ecore_x_libecore_x_la_SOURCES = \ -lib/ecore_x/ecore_x_atoms_decl.h - -if HAVE_ECORE_X_XCB -lib_ecore_x_libecore_x_la_SOURCES += \ -lib/ecore_x/xcb/ecore_xcb.c \ -lib/ecore_x/xcb/ecore_xcb_atoms.c \ -lib/ecore_x/xcb/ecore_xcb_extensions.c \ -lib/ecore_x/xcb/ecore_xcb_shape.c \ -lib/ecore_x/xcb/ecore_xcb_screensaver.c \ -lib/ecore_x/xcb/ecore_xcb_sync.c \ -lib/ecore_x/xcb/ecore_xcb_render.c \ -lib/ecore_x/xcb/ecore_xcb_randr.c \ -lib/ecore_x/xcb/ecore_xcb_xfixes.c \ -lib/ecore_x/xcb/ecore_xcb_composite.c \ -lib/ecore_x/xcb/ecore_xcb_cursor.c \ -lib/ecore_x/xcb/ecore_xcb_damage.c \ -lib/ecore_x/xcb/ecore_xcb_dnd.c \ -lib/ecore_x/xcb/ecore_xcb_dpms.c \ -lib/ecore_x/xcb/ecore_xcb_drawable.c \ -lib/ecore_x/xcb/ecore_xcb_e.c \ -lib/ecore_x/xcb/ecore_xcb_gc.c \ -lib/ecore_x/xcb/ecore_xcb_image.c \ -lib/ecore_x/xcb/ecore_xcb_input.c \ -lib/ecore_x/xcb/ecore_xcb_gesture.c \ -lib/ecore_x/xcb/ecore_xcb_mwm.c \ -lib/ecore_x/xcb/ecore_xcb_pixmap.c \ -lib/ecore_x/xcb/ecore_xcb_present.c \ -lib/ecore_x/xcb/ecore_xcb_region.c \ -lib/ecore_x/xcb/ecore_xcb_selection.c \ -lib/ecore_x/xcb/ecore_xcb_textlist.c \ -lib/ecore_x/xcb/ecore_xcb_events.c \ -lib/ecore_x/xcb/ecore_xcb_keymap.c \ -lib/ecore_x/xcb/ecore_xcb_keygrab.c \ -lib/ecore_x/xcb/ecore_xcb_netwm.c \ -lib/ecore_x/xcb/ecore_xcb_icccm.c \ -lib/ecore_x/xcb/ecore_xcb_window.c \ -lib/ecore_x/xcb/ecore_xcb_window_prop.c \ -lib/ecore_x/xcb/ecore_xcb_window_shape.c \ -lib/ecore_x/xcb/ecore_xcb_window_shadow.c \ -lib/ecore_x/xcb/ecore_xcb_xinerama.c \ -lib/ecore_x/xcb/ecore_xcb_error.c \ -lib/ecore_x/xcb/ecore_xcb_xtest.c \ -lib/ecore_x/xcb/ecore_xcb_vsync.c \ -lib/ecore_x/xcb/ecore_xcb_xdefaults.c \ -lib/ecore_x/xcb/ecore_xcb_private.h -else -lib_ecore_x_libecore_x_la_SOURCES += \ -lib/ecore_x/xlib/ecore_x.c \ -lib/ecore_x/xlib/ecore_x_dnd.c \ -lib/ecore_x/xlib/ecore_x_sync.c \ -lib/ecore_x/xlib/ecore_x_randr.c \ -lib/ecore_x/xlib/ecore_x_fixes.c \ -lib/ecore_x/xlib/ecore_x_damage.c \ -lib/ecore_x/xlib/ecore_x_composite.c \ -lib/ecore_x/xlib/ecore_x_error.c \ -lib/ecore_x/xlib/ecore_x_events.c \ -lib/ecore_x/xlib/ecore_x_icccm.c \ -lib/ecore_x/xlib/ecore_x_keygrab.c \ -lib/ecore_x/xlib/ecore_x_netwm.c \ -lib/ecore_x/xlib/ecore_x_mwm.c \ -lib/ecore_x/xlib/ecore_x_e.c \ -lib/ecore_x/xlib/ecore_x_selection.c \ -lib/ecore_x/xlib/ecore_x_window.c \ -lib/ecore_x/xlib/ecore_x_window_prop.c \ -lib/ecore_x/xlib/ecore_x_window_shape.c \ -lib/ecore_x/xlib/ecore_x_pixmap.c \ -lib/ecore_x/xlib/ecore_x_present.c \ -lib/ecore_x/xlib/ecore_x_gc.c \ -lib/ecore_x/xlib/ecore_x_xinerama.c \ -lib/ecore_x/xlib/ecore_x_screensaver.c \ -lib/ecore_x/xlib/ecore_x_dpms.c \ -lib/ecore_x/xlib/ecore_x_drawable.c \ -lib/ecore_x/xlib/ecore_x_cursor.c \ -lib/ecore_x/xlib/ecore_x_test.c \ -lib/ecore_x/xlib/ecore_x_atoms.c \ -lib/ecore_x/xlib/ecore_x_region.c \ -lib/ecore_x/xlib/ecore_x_image.c \ -lib/ecore_x/xlib/ecore_x_xi2.c \ -lib/ecore_x/xlib/ecore_x_vsync.c \ -lib/ecore_x/xlib/ecore_x_gesture.c \ -lib/ecore_x/xlib/ecore_x_private.h -endif +lib/ecore_x/ecore_x_atoms_decl.h \ +lib/ecore_x/ecore_x.c \ +lib/ecore_x/ecore_x_dnd.c \ +lib/ecore_x/ecore_x_sync.c \ +lib/ecore_x/ecore_x_randr.c \ +lib/ecore_x/ecore_x_fixes.c \ +lib/ecore_x/ecore_x_damage.c \ +lib/ecore_x/ecore_x_composite.c \ +lib/ecore_x/ecore_x_error.c \ +lib/ecore_x/ecore_x_events.c \ +lib/ecore_x/ecore_x_icccm.c \ +lib/ecore_x/ecore_x_keygrab.c \ +lib/ecore_x/ecore_x_netwm.c \ +lib/ecore_x/ecore_x_mwm.c \ +lib/ecore_x/ecore_x_e.c \ +lib/ecore_x/ecore_x_selection.c \ +lib/ecore_x/ecore_x_window.c \ +lib/ecore_x/ecore_x_window_prop.c \ +lib/ecore_x/ecore_x_window_shape.c \ +lib/ecore_x/ecore_x_pixmap.c \ +lib/ecore_x/ecore_x_present.c \ +lib/ecore_x/ecore_x_gc.c \ +lib/ecore_x/ecore_x_xinerama.c \ +lib/ecore_x/ecore_x_screensaver.c \ +lib/ecore_x/ecore_x_dpms.c \ +lib/ecore_x/ecore_x_drawable.c \ +lib/ecore_x/ecore_x_cursor.c \ +lib/ecore_x/ecore_x_test.c \ +lib/ecore_x/ecore_x_atoms.c \ +lib/ecore_x/ecore_x_region.c \ +lib/ecore_x/ecore_x_image.c \ +lib/ecore_x/ecore_x_xi2.c \ +lib/ecore_x/ecore_x_vsync.c \ +lib/ecore_x/ecore_x_gesture.c \ +lib/ecore_x/ecore_x_private.h lib_ecore_x_libecore_x_la_CPPFLAGS = \ -I$(top_builddir)/src/lib/efl \ @@ -101,34 +54,9 @@ lib_ecore_x_libecore_x_la_CPPFLAGS = \ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)/ecore_x\" -if HAVE_ECORE_X_XCB -lib_ecore_x_libecore_x_la_CPPFLAGS += -I$(top_builddir)/src/lib/ecore_x/xcb -endif lib_ecore_x_libecore_x_la_LIBADD = @ECORE_X_LIBS@ @USE_ECORE_CON_LIBS@ lib_ecore_x_libecore_x_la_DEPENDENCIES = @ECORE_X_INTERNAL_LIBS@ @USE_ECORE_CON_INTERNAL_LIBS@ lib_ecore_x_libecore_x_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ -if HAVE_ECORE_X_XCB -MAINTAINERCLEANFILES += \ -$(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h \ -$(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table_h - -BUILT_SOURCES += \ -$(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h - -$(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h: $(KEYSYMDEFS) utils/ecore/makekeys$(EXEEXT) - $(MKDIR_P) $(top_builddir)/src/lib/ecore_x/xcb - $(top_builddir)/src/utils/ecore/makekeys $(KEYSYMDEFS) > $(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table_h - mv -f $(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table_h $(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h -endif - -### Utils - -noinst_PROGRAMS += utils/ecore/makekeys - -utils_ecore_makekeys_SOURCES = utils/ecore/makekeys.c -utils_ecore_makekeys_CFLAGS = @ECORE_X_CFLAGS@ - endif -EXTRA_DIST2 += utils/ecore/mkks.sh diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index a7bb362..f690335 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -894,7 +894,7 @@ modules_evas_engines_gl_generic_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ modules_evas_engines_gl_generic_module_la_LIBTOOLFLAGS = --tag=disable-static if BUILD_ENGINE_GL_X11 -modules_evas_engines_gl_common_libevas_engine_gl_common_la_CPPFLAGS += @evas_engine_gl_xlib_cflags@ @evas_engine_gl_xcb_cflags@ +modules_evas_engines_gl_common_libevas_engine_gl_common_la_CPPFLAGS += @evas_engine_gl_xlib_cflags@ endif if BUILD_ENGINE_WAYLAND_EGL modules_evas_engines_gl_common_libevas_engine_gl_common_la_CPPFLAGS += @evas_engine_wayland_egl_cflags@ @@ -996,10 +996,8 @@ modules/evas/engines/gl_x11/evas_x_main.c \ modules/evas/engines/gl_x11/evas_engine.h if EVAS_STATIC_BUILD_GL_X11 lib_evas_libevas_la_SOURCES += $(GL_X11_SOURCES) -lib_evas_libevas_la_CPPFLAGS += \ -@evas_engine_gl_xlib_cflags@ @evas_engine_gl_xcb_cflags@ -lib_evas_libevas_la_LIBADD += \ -@evas_engine_gl_xlib_libs@ @evas_engine_gl_xcb_libs@ +lib_evas_libevas_la_CPPFLAGS += @evas_engine_gl_xlib_cflags@ +lib_evas_libevas_la_LIBADD += @evas_engine_gl_xlib_libs@ else engineglx11pkgdir = $(libdir)/evas/modules/engines/gl_x11/$(MODULE_ARCH) engineglx11pkg_LTLIBRARIES = modules/evas/engines/gl_x11/module.la @@ -1014,12 +1012,10 @@ modules_evas_engines_gl_x11_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/include \ -I$(top_srcdir)/src/lib/evas/cserve2 \ @EVAS_CFLAGS@ \ -@evas_engine_gl_xlib_cflags@ \ -@evas_engine_gl_xcb_cflags@ +@evas_engine_gl_xlib_cflags@ modules_evas_engines_gl_x11_module_la_LIBADD = \ @USE_EVAS_LIBS@ \ -@evas_engine_gl_xlib_libs@ \ -@evas_engine_gl_xcb_libs@ +@evas_engine_gl_xlib_libs@ modules_evas_engines_gl_x11_module_la_DEPENDENCIES = \ @USE_EVAS_INTERNAL_LIBS@ modules_evas_engines_gl_x11_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ @@ -1169,22 +1165,6 @@ modules/evas/engines/software_x11/evas_xlib_dri_image.h SOFTWARE_X11_CPPFLAGS += @evas_engine_software_xlib_cflags@ SOFTWARE_X11_LIBADD += @evas_engine_software_xlib_libs@ endif -if BUILD_ENGINE_SOFTWARE_XCB -SOFTWARE_X11_SOURCES += \ -modules/evas/engines/software_x11/evas_xcb_xdefaults.c \ -modules/evas/engines/software_x11/evas_xcb_outbuf.c \ -modules/evas/engines/software_x11/evas_xcb_buffer.c \ -modules/evas/engines/software_x11/evas_xcb_color.c \ -modules/evas/engines/software_x11/evas_xcb_main.c \ -modules/evas/engines/software_x11/evas_xcb_image.c \ -modules/evas/engines/software_x11/evas_xcb_outbuf.h \ -modules/evas/engines/software_x11/evas_xcb_buffer.h \ -modules/evas/engines/software_x11/evas_xcb_color.h \ -modules/evas/engines/software_x11/evas_xcb_xdefaults.h \ -modules/evas/engines/software_x11/evas_xcb_image.h -SOFTWARE_X11_CPPFLAGS += @evas_engine_software_xcb_cflags@ -SOFTWARE_X11_LIBADD += @evas_engine_software_xcb_libs@ -endif if EVAS_STATIC_BUILD_SOFTWARE_X11 lib_evas_libevas_la_SOURCES += $(SOFTWARE_X11_SOURCES) lib_evas_libevas_la_CPPFLAGS += $(SOFTWARE_X11_CPPFLAGS) diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index e504fc8..e669422 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -111,8 +111,8 @@ typedef enum _Ecore_Evas_Engine_Type ECORE_EVAS_ENGINE_SOFTWARE_XLIB, ECORE_EVAS_ENGINE_XRENDER_X11, ECORE_EVAS_ENGINE_OPENGL_X11, - ECORE_EVAS_ENGINE_SOFTWARE_XCB, - ECORE_EVAS_ENGINE_XRENDER_XCB, + ECORE_EVAS_ENGINE_SOFTWARE_XCB, /* @deprecated */ + ECORE_EVAS_ENGINE_XRENDER_XCB, /* @deprecated */ ECORE_EVAS_ENGINE_SOFTWARE_GDI, ECORE_EVAS_ENGINE_SOFTWARE_DDRAW, ECORE_EVAS_ENGINE_DIRECT3D, diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index cc7f02f..5a722a6 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -261,13 +261,9 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) #else return EINA_FALSE; #endif - case ECORE_EVAS_ENGINE_SOFTWARE_XCB: -#ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB - return EINA_TRUE; -#else + case ECORE_EVAS_ENGINE_SOFTWARE_XCB: /* @deprecated */ return EINA_FALSE; -#endif - case ECORE_EVAS_ENGINE_XRENDER_XCB: + case ECORE_EVAS_ENGINE_XRENDER_XCB: /* @deprecated */ return EINA_FALSE; case ECORE_EVAS_ENGINE_SOFTWARE_GDI: #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c index 320d035..a587ee9 100644 --- a/src/lib/ecore_evas/ecore_evas_module.c +++ b/src/lib/ecore_evas/ecore_evas_module.c @@ -264,10 +264,6 @@ _ecore_evas_available_engines_get(void) #endif #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB ADDENG("software_x11"); -#else -# ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB - ADDENG("software_x11"); -# endif #endif } else if (!strcmp(name, "buffer")) diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index 7337ae2..e732fb9 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -72,8 +72,8 @@ EAPI extern Ecore_X_Version *ecore_x_version; * @li @ref Ecore_X_Window_Parent_Group * @li @ref Ecore_X_Window_Shape * - * When using the XLib backend, setting the ECORE_X_SYNC environment variable - * will cause X calls to be run synchronously for easier debugging. + * The ECORE_X_SYNC environment variable will cause X calls to be run + * synchronously for easier debugging. */ typedef unsigned int Ecore_X_ID; @@ -89,11 +89,7 @@ typedef struct _Ecore_X_Icon #endif // ifndef _ECORE_X_WINDOW_PREDEF typedef void *Ecore_X_Visual; typedef Ecore_X_ID Ecore_X_Drawable; -#ifdef HAVE_ECORE_X_XCB -typedef Ecore_X_ID Ecore_X_GC; -#else // ifdef HAVE_ECORE_X_XCB typedef void *Ecore_X_GC; -#endif /* HAVE_ECORE_X_XCB */ typedef Ecore_X_ID Ecore_X_Colormap; typedef Ecore_X_ID Ecore_X_Time; typedef Ecore_X_ID Ecore_X_Cursor; @@ -1118,7 +1114,7 @@ struct Ecore_X_Event_Present_Idle }; /**< @since 1.9 */ EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on - backend in use, if Xlib will be XEvent, if XCB will be xcb_generic_event_t. + backend in use, will be XEvent. @warning avoid using it. */ EAPI extern int ECORE_X_EVENT_MOUSE_IN; diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/ecore_x.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x.c rename to src/lib/ecore_x/ecore_x.c diff --git a/src/lib/ecore_x/xlib/ecore_x_atoms.c b/src/lib/ecore_x/ecore_x_atoms.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_atoms.c rename to src/lib/ecore_x/ecore_x_atoms.c diff --git a/src/lib/ecore_x/xlib/ecore_x_composite.c b/src/lib/ecore_x/ecore_x_composite.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_composite.c rename to src/lib/ecore_x/ecore_x_composite.c diff --git a/src/lib/ecore_x/xlib/ecore_x_cursor.c b/src/lib/ecore_x/ecore_x_cursor.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_cursor.c rename to src/lib/ecore_x/ecore_x_cursor.c diff --git a/src/lib/ecore_x/xlib/ecore_x_damage.c b/src/lib/ecore_x/ecore_x_damage.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_damage.c rename to src/lib/ecore_x/ecore_x_damage.c diff --git a/src/lib/ecore_x/xlib/ecore_x_dnd.c b/src/lib/ecore_x/ecore_x_dnd.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_dnd.c rename to src/lib/ecore_x/ecore_x_dnd.c diff --git a/src/lib/ecore_x/xlib/ecore_x_dpms.c b/src/lib/ecore_x/ecore_x_dpms.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_dpms.c rename to src/lib/ecore_x/ecore_x_dpms.c diff --git a/src/lib/ecore_x/xlib/ecore_x_drawable.c b/src/lib/ecore_x/ecore_x_drawable.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_drawable.c rename to src/lib/ecore_x/ecore_x_drawable.c diff --git a/src/lib/ecore_x/xlib/ecore_x_e.c b/src/lib/ecore_x/ecore_x_e.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_e.c rename to src/lib/ecore_x/ecore_x_e.c diff --git a/src/lib/ecore_x/xlib/ecore_x_error.c b/src/lib/ecore_x/ecore_x_error.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_error.c rename to src/lib/ecore_x/ecore_x_error.c diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/ecore_x_events.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_events.c rename to src/lib/ecore_x/ecore_x_events.c diff --git a/src/lib/ecore_x/xlib/ecore_x_fixes.c b/src/lib/ecore_x/ecore_x_fixes.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_fixes.c rename to src/lib/ecore_x/ecore_x_fixes.c diff --git a/src/lib/ecore_x/xlib/ecore_x_gc.c b/src/lib/ecore_x/ecore_x_gc.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_gc.c rename to src/lib/ecore_x/ecore_x_gc.c diff --git a/src/lib/ecore_x/xlib/ecore_x_gesture.c b/src/lib/ecore_x/ecore_x_gesture.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_gesture.c rename to src/lib/ecore_x/ecore_x_gesture.c diff --git a/src/lib/ecore_x/xlib/ecore_x_icccm.c b/src/lib/ecore_x/ecore_x_icccm.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_icccm.c rename to src/lib/ecore_x/ecore_x_icccm.c diff --git a/src/lib/ecore_x/xlib/ecore_x_image.c b/src/lib/ecore_x/ecore_x_image.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_image.c rename to src/lib/ecore_x/ecore_x_image.c diff --git a/src/lib/ecore_x/xlib/ecore_x_keygrab.c b/src/lib/ecore_x/ecore_x_keygrab.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_keygrab.c rename to src/lib/ecore_x/ecore_x_keygrab.c diff --git a/src/lib/ecore_x/xlib/ecore_x_mwm.c b/src/lib/ecore_x/ecore_x_mwm.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_mwm.c rename to src/lib/ecore_x/ecore_x_mwm.c diff --git a/src/lib/ecore_x/xlib/ecore_x_netwm.c b/src/lib/ecore_x/ecore_x_netwm.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_netwm.c rename to src/lib/ecore_x/ecore_x_netwm.c diff --git a/src/lib/ecore_x/xlib/ecore_x_pixmap.c b/src/lib/ecore_x/ecore_x_pixmap.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_pixmap.c rename to src/lib/ecore_x/ecore_x_pixmap.c diff --git a/src/lib/ecore_x/xlib/ecore_x_present.c b/src/lib/ecore_x/ecore_x_present.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_present.c rename to src/lib/ecore_x/ecore_x_present.c diff --git a/src/lib/ecore_x/xlib/ecore_x_private.h b/src/lib/ecore_x/ecore_x_private.h similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_private.h rename to src/lib/ecore_x/ecore_x_private.h diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c b/src/lib/ecore_x/ecore_x_randr.c similarity index 99% rename from src/lib/ecore_x/xlib/ecore_x_randr.c rename to src/lib/ecore_x/ecore_x_randr.c index 03da850..f2288cc 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr.c +++ b/src/lib/ecore_x/ecore_x_randr.c @@ -1966,8 +1966,6 @@ ecore_x_randr_crtc_info_free(Ecore_X_Randr_Crtc_Info *info) * @param mode The mode added to the output. * @return @c EINA_FALSE if output or mode equal Ecore_X_Randr_None, else * @c EINA_TRUE. - * Additionally, if xcb backend is used, the success of the addition is - * reported back directly. * @since 1.2.0 */ EAPI Eina_Bool diff --git a/src/lib/ecore_x/xlib/ecore_x_region.c b/src/lib/ecore_x/ecore_x_region.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_region.c rename to src/lib/ecore_x/ecore_x_region.c diff --git a/src/lib/ecore_x/xlib/ecore_x_screensaver.c b/src/lib/ecore_x/ecore_x_screensaver.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_screensaver.c rename to src/lib/ecore_x/ecore_x_screensaver.c diff --git a/src/lib/ecore_x/xlib/ecore_x_selection.c b/src/lib/ecore_x/ecore_x_selection.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_selection.c rename to src/lib/ecore_x/ecore_x_selection.c diff --git a/src/lib/ecore_x/xlib/ecore_x_sync.c b/src/lib/ecore_x/ecore_x_sync.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_sync.c rename to src/lib/ecore_x/ecore_x_sync.c diff --git a/src/lib/ecore_x/xlib/ecore_x_test.c b/src/lib/ecore_x/ecore_x_test.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_test.c rename to src/lib/ecore_x/ecore_x_test.c diff --git a/src/lib/ecore_x/xlib/ecore_x_vsync.c b/src/lib/ecore_x/ecore_x_vsync.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_vsync.c rename to src/lib/ecore_x/ecore_x_vsync.c diff --git a/src/lib/ecore_x/xlib/ecore_x_window.c b/src/lib/ecore_x/ecore_x_window.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_window.c rename to src/lib/ecore_x/ecore_x_window.c diff --git a/src/lib/ecore_x/xlib/ecore_x_window_prop.c b/src/lib/ecore_x/ecore_x_window_prop.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_window_prop.c rename to src/lib/ecore_x/ecore_x_window_prop.c diff --git a/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/src/lib/ecore_x/ecore_x_window_shape.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_window_shape.c rename to src/lib/ecore_x/ecore_x_window_shape.c diff --git a/src/lib/ecore_x/xlib/ecore_x_xi2.c b/src/lib/ecore_x/ecore_x_xi2.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_xi2.c rename to src/lib/ecore_x/ecore_x_xi2.c diff --git a/src/lib/ecore_x/xlib/ecore_x_xinerama.c b/src/lib/ecore_x/ecore_x_xinerama.c similarity index 100% rename from src/lib/ecore_x/xlib/ecore_x_xinerama.c rename to src/lib/ecore_x/ecore_x_xinerama.c diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c deleted file mode 100644 index 9e08aef..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ /dev/null @@ -1,1605 +0,0 @@ -#include "ecore_xcb_private.h" -#include -#include - -/* local function prototypes */ -static int _ecore_xcb_shutdown(Eina_Bool close_display); -static Eina_Bool _ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED); -static Eina_Bool _ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED); -static Eina_Bool _ecore_xcb_idle_enter(void *data EINA_UNUSED); - -/* local variables */ -static int _ecore_xcb_init_count = 0; -static int _ecore_xcb_grab_count = 0; -static Ecore_Fd_Handler *_ecore_xcb_fd_handler = NULL; -static xcb_generic_event_t *_ecore_xcb_event_buffered = NULL; -static Ecore_Idle_Enterer *_ecore_xcb_idle_enterer = NULL; - -static Ecore_X_Version _version = { VMAJ, VMIN, VMIC, VREV }; -EAPI Ecore_X_Version *ecore_x_version = &_version; - -/* external variables */ -int _ecore_xcb_log_dom = -1; -Ecore_X_Display *_ecore_xcb_display = NULL; -Ecore_X_Connection *_ecore_xcb_conn = NULL; -Ecore_X_Screen *_ecore_xcb_screen = NULL; -Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM]; -double _ecore_xcb_double_click_time = 0.25; - -/** - * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions - * @ingroup Ecore_X_Group - * - * Functions that start and shut down the Ecore X Library. - */ - -static int -_ecore_x_init(const char *name, Ecore_X_Display *display) -{ - char *gl = NULL; - uint32_t mask, list[1]; - - /* check if we have initialized already */ - if (++_ecore_xcb_init_count != 1) - return _ecore_xcb_init_count; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - /* try to initialize eina */ - if (!eina_init()) return --_ecore_xcb_init_count; - - /* setup ecore_xcb log domain */ - _ecore_xcb_log_dom = - eina_log_domain_register("ecore_x", ECORE_XCB_DEFAULT_LOG_COLOR); - if (_ecore_xcb_log_dom < 0) - { - EINA_LOG_ERR("Cannot create Ecore Xcb log domain"); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - - /* try to initialize ecore */ - if (!ecore_init()) - { - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - eina_shutdown(); - return --_ecore_xcb_init_count; - } - - /* try to initialize ecore_event */ - if (!ecore_event_init()) - { - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - ecore_shutdown(); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - - /* NB: XLib has XInitThreads */ - - /* check for env var which says we are not going to use GL @ all - * - * NB: This is done because if someone wants a 'pure' xcb implementation - * of ecore_x, all they need do is export this variable in the environment - * and ecore_x will not use xlib stuff at all. - * - * The upside is you can get pure xcb-based ecore_x (w/ all the speed), but - * there is a down-side here in that you cannot get OpenGL without XLib :( - */ - if ((gl = getenv("ECORE_X_NO_XLIB"))) - { - /* we found the env var that says 'Yes, we are not ever gonna try - * OpenGL so it is safe to not use XLib at all' */ - - /* try to connect to the display server */ - _ecore_xcb_conn = xcb_connect(name, NULL); - } - else - { - /* env var was not specified, so we will assume that the user - * may want opengl @ some point. connect this way for opengl to work */ - void *libxcb, *libxlib; - Display *(*_real_display)(const char *display); - xcb_connection_t *(*_real_connection)(Display * dpy); - void (*_real_queue)(Display *dpy, enum XEventQueueOwner owner); - int (*_real_close)(Display *dpy); -#ifdef EVAS_FRAME_QUEUING - Status (*_real_threads)(void); -#endif - - /* want to dlopen here to avoid actual library linkage */ - libxlib = dlopen("libX11.so", (RTLD_LAZY | RTLD_GLOBAL)); - if (!libxlib) - libxlib = dlopen("libX11.so.6", (RTLD_LAZY | RTLD_GLOBAL)); - if (!libxlib) - libxlib = dlopen("libX11.so.6.3.0", (RTLD_LAZY | RTLD_GLOBAL)); - if (!libxlib) - { - ERR("Could not dlsym to libX11"); - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - ecore_event_shutdown(); - ecore_shutdown(); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - - libxcb = dlopen("libX11-xcb.so", (RTLD_LAZY | RTLD_GLOBAL)); - if (!libxcb) - libxcb = dlopen("libX11-xcb.so.1", (RTLD_LAZY | RTLD_GLOBAL)); - if (!libxcb) - libxcb = dlopen("libX11-xcb.so.1.0.0", (RTLD_LAZY | RTLD_GLOBAL)); - if (!libxcb) - { - ERR("Could not dlsym to libX11-xcb"); - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - ecore_event_shutdown(); - ecore_shutdown(); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - - _real_display = dlsym(libxlib, "XOpenDisplay"); - _real_close = dlsym(libxlib, "XCloseDisplay"); - _real_connection = dlsym(libxcb, "XGetXCBConnection"); - _real_queue = dlsym(libxcb, "XSetEventQueueOwner"); -#ifdef EVAS_FRAME_QUEUING - _real_threads = dlsym(libxlib, "XInitThreads"); -#endif - - if (_real_display) - { -#ifdef EVAS_FRAME_QUEUING - if (_real_threads) _real_threads(); -#endif - _ecore_xcb_display = display ? display : _real_display(name); - if (!_ecore_xcb_display) - { - ERR("Could not open Display via XLib"); - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - ecore_event_shutdown(); - ecore_shutdown(); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - if (_real_connection) - _ecore_xcb_conn = _real_connection(_ecore_xcb_display); - if (!_ecore_xcb_conn) - { - ERR("Could not get XCB Connection from XLib"); - - if (_real_close) _real_close(_ecore_xcb_display); - - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - ecore_event_shutdown(); - ecore_shutdown(); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - if (_real_queue) - _real_queue(_ecore_xcb_display, XCBOwnsEventQueue); - } - } - - if (xcb_connection_has_error(_ecore_xcb_conn)) - { - CRI("XCB Connection has error"); - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - ecore_event_shutdown(); - ecore_shutdown(); - eina_shutdown(); - return --_ecore_xcb_init_count; - } - - /* grab the default screen */ - _ecore_xcb_screen = - xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; - - /* NB: This method of init/finalize extensions first, then atoms - * Does end up being 2 round trips to X, BUT if we do extensions init then - * atoms init first, and call the 'finalize' functions later, we end up - * being slower, so it's a trade-off. This current method clocks in - * around 0.003 for fetching atoms VS 0.010 for init both then finalize */ - - /* prefetch extension data */ - _ecore_xcb_extensions_init(); - - /* finalize extensions */ - _ecore_xcb_extensions_finalize(); - - /* set keyboard autorepeat */ - mask = XCB_KB_AUTO_REPEAT_MODE; - list[0] = XCB_AUTO_REPEAT_MODE_ON; - xcb_change_keyboard_control(_ecore_xcb_conn, mask, list); - - /* setup xcb events */ - _ecore_xcb_events_init(); - - /* setup xcb keymasks */ - _ecore_xcb_keymap_init(); - - /* finalize xcb keymasks */ - _ecore_xcb_keymap_finalize(); - - /* prefetch atoms */ - _ecore_xcb_atoms_init(); - - /* finalize atoms */ - _ecore_xcb_atoms_finalize(); - - /* icccm_init: dummy function */ - ecore_x_icccm_init(); - - /* setup netwm */ - ecore_x_netwm_init(); - - /* old e hints init: dummy function */ - ecore_x_e_init(); - - _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = - ECORE_X_ATOM_WM_DELETE_WINDOW; - _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = - ECORE_X_ATOM_WM_TAKE_FOCUS; - _ecore_xcb_atoms_wm_protocol[ECORE_X_NET_WM_PROTOCOL_PING] = - ECORE_X_ATOM_NET_WM_PING; - _ecore_xcb_atoms_wm_protocol[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] = - ECORE_X_ATOM_NET_WM_SYNC_REQUEST; - - /* setup selection */ - _ecore_xcb_selection_init(); - - /* setup dnd */ - _ecore_xcb_dnd_init(); - - _ecore_xcb_idle_enterer = - ecore_idle_enterer_add(_ecore_xcb_idle_enter, NULL); - - /* setup ecore fd handler */ - _ecore_xcb_fd_handler = - ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn), - ECORE_FD_READ, _ecore_xcb_fd_handle, - _ecore_xcb_conn, _ecore_xcb_fd_handle_buff, - _ecore_xcb_conn); - - if (!_ecore_xcb_fd_handler) - return _ecore_xcb_shutdown(EINA_TRUE); - - return _ecore_xcb_init_count; -} - -/** - * Initialize the X display connection to the given display. - * - * @param name Display target name. If @c NULL, the default display is - * assumed. - * @return The number of times the library has been initialized without - * being shut down. 0 is returned if an error occurs. - * @ingroup Ecore_X_Init_Group - */ -EAPI int -ecore_x_init(const char *name) -{ - return _ecore_x_init(name, NULL); -} - -EAPI int -ecore_x_init_from_display(Ecore_X_Display *display) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(display, 0); - return _ecore_x_init(NULL, display); -} - -/** - * Shuts down the Ecore X library. - * - * In shutting down the library, the X display connection is terminated - * and any event handlers for it are removed. - * - * @return The number of times the library has been initialized without - * being shut down. - * @ingroup Ecore_X_Init_Group - */ -EAPI int -ecore_x_shutdown(void) -{ - return _ecore_xcb_shutdown(EINA_TRUE); -} - -/** - * Shuts down the Ecore X library. - * - * As ecore_x_shutdown, except do not close Display, only connection. - * - * @return The number of times the library has been initialized without - * being shut down. 0 is returned if an error occurs. - * @ingroup Ecore_X_Init_Group - */ -EAPI int -ecore_x_disconnect(void) -{ - return _ecore_xcb_shutdown(EINA_FALSE); -} - -/** - * @defgroup Ecore_X_Flush_Group X Synchronization Functions - * @ingroup Ecore_X_Group - * - * Functions that ensure that all commands that have been issued by the - * Ecore X library have been sent to the server. - */ - -/** - * Sends all X commands in the X Display buffer. - * @ingroup Ecore_X_Flush_Group - */ -EAPI void -ecore_x_flush(void) -{ -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - - CHECK_XCB_CONN; - xcb_flush(_ecore_xcb_conn); -} - -/** - * Retrieves the Ecore_X_Screen handle used for the current X connection. - * @return The current default screen. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI Ecore_X_Screen * -ecore_x_default_screen_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return (Ecore_X_Screen *)_ecore_xcb_screen; -} - -EAPI Ecore_X_Connection * -ecore_x_connection_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - CHECK_XCB_CONN; - return (Ecore_X_Connection *)_ecore_xcb_conn; -} - -/** - * Return the last event time - */ -EAPI Ecore_X_Time -ecore_x_current_time_get(void) -{ - return _ecore_xcb_events_last_time_get(); -} - -/** - * Flushes the command buffer and waits until all requests have been - * processed by the server. - * @ingroup Ecore_X_Flush_Group - */ -EAPI void -ecore_x_sync(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - CHECK_XCB_CONN; - free(xcb_get_input_focus_reply(_ecore_xcb_conn, - xcb_get_input_focus_unchecked(_ecore_xcb_conn), - NULL)); -} - -EAPI void -ecore_x_grab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - CHECK_XCB_CONN; - _ecore_xcb_grab_count++; - if (_ecore_xcb_grab_count == 1) - xcb_grab_server(_ecore_xcb_conn); -} - -EAPI void -ecore_x_ungrab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - CHECK_XCB_CONN; - _ecore_xcb_grab_count--; - if (_ecore_xcb_grab_count < 0) _ecore_xcb_grab_count = 0; - if (_ecore_xcb_grab_count == 0) - xcb_ungrab_server(_ecore_xcb_conn); -} - -/** - * Send client message with given type and format 32. - * - * @param win The window the message is sent to. - * @param type The client message type. - * @param mask The mask of the message to be sent. - * @param d0 The client message data item 1 - * @param d1 The client message data item 2 - * @param d2 The client message data item 3 - * @param d3 The client message data item 4 - * @param d4 The client message data item 5 - * - * @return @c EINA_TRUE on success @c EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type, - Ecore_X_Event_Mask mask, - long d0, long d1, long d2, long d3, long d4) -{ - xcb_client_message_event_t ev; - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = type; - ev.data.data32[0] = (uint32_t)d0; - ev.data.data32[1] = (uint32_t)d1; - ev.data.data32[2] = (uint32_t)d2; - ev.data.data32[3] = (uint32_t)d3; - ev.data.data32[4] = (uint32_t)d4; - - cookie = xcb_send_event(_ecore_xcb_conn, 0, win, mask, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - DBG("Problem Sending Event"); - DBG("\tType: %d", type); - DBG("\tWin: %d", win); - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/** - * Send client message with given type and format 8. - * - * @param win The window the message is sent to. - * @param type The client message type. - * @param data Data to be sent. - * @param len Number of data bytes, max @c 20. - * - * @return @c EINA_TRUE on success @c EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type, - const void *data, int len) -{ - xcb_client_message_event_t ev; - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 8; - ev.window = win; - ev.type = type; - if (len > 20) - len = 20; - if (data && len > 0) - memcpy(ev.data.data8, data, len); - if (len < 20) - memset(ev.data.data8 + len, 0, 20 - len); - - cookie = xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - DBG("Problem Sending Event"); - DBG("\tType: %d", type); - DBG("\tWin: %d", win); - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b) -{ - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *reply; - xcb_button_press_event_t ev; - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - Ecore_X_Window root = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ecore_x_window_root_get(win); - cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); - reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - memset(&ev, 0, sizeof(xcb_button_press_event_t)); - - ev.response_type = XCB_BUTTON_PRESS; - ev.event = win; - ev.child = win; - ev.root = root; - ev.event_x = x; - ev.event_y = y; - ev.same_screen = 1; - ev.state = 1 << b; - ev.detail = b; // xcb uses detail for button - ev.root_x = reply->dst_x; - ev.root_y = reply->dst_y; - ev.time = ecore_x_current_time_get(); - free(reply); - - vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, - XCB_EVENT_MASK_BUTTON_PRESS, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b) -{ - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *reply; - xcb_button_release_event_t ev; - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - Ecore_X_Window root = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ecore_x_window_root_get(win); - cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); - reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - memset(&ev, 0, sizeof(xcb_button_release_event_t)); - - ev.response_type = XCB_BUTTON_RELEASE; - ev.event = win; - ev.child = win; - ev.root = root; - ev.event_x = x; - ev.event_y = y; - ev.same_screen = 1; - ev.state = 0; - ev.root_x = reply->dst_x; - ev.root_y = reply->dst_y; - ev.detail = b; // xcb uses detail for button - ev.time = ecore_x_current_time_get(); - free(reply); - - vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, - XCB_EVENT_MASK_BUTTON_RELEASE, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y) -{ - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *reply; - xcb_motion_notify_event_t ev; - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - Ecore_X_Window root = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ecore_x_window_root_get(win); - cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); - reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - memset(&ev, 0, sizeof(xcb_motion_notify_event_t)); - - ev.response_type = XCB_MOTION_NOTIFY; - ev.event = win; - ev.child = win; - ev.root = root; - ev.event_x = x; - ev.event_y = y; - ev.same_screen = 1; - ev.state = 0; - ev.detail = 0; // xcb uses 'detail' for is_hint - ev.root_x = reply->dst_x; - ev.root_y = reply->dst_y; - ev.time = ecore_x_current_time_get(); - free(reply); - - vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, - XCB_EVENT_MASK_POINTER_MOTION, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_mouse_in_send(Ecore_X_Window win, int x, int y) -{ - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *reply; - xcb_enter_notify_event_t ev; - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - Ecore_X_Window root = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ecore_x_window_root_get(win); - cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); - reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - memset(&ev, 0, sizeof(xcb_enter_notify_event_t)); - - ev.response_type = XCB_ENTER_NOTIFY; - ev.event = win; - ev.child = win; - ev.root = root; - ev.event_x = x; - ev.event_y = y; - ev.same_screen_focus = 1; - ev.mode = XCB_NOTIFY_MODE_NORMAL; - ev.detail = XCB_NOTIFY_DETAIL_NONLINEAR; - /* ev.focus = 0; */ - ev.state = 0; - ev.root_x = reply->dst_x; - ev.root_y = reply->dst_y; - ev.time = ecore_x_current_time_get(); - free(reply); - - vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, - XCB_EVENT_MASK_ENTER_WINDOW, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_mouse_out_send(Ecore_X_Window win, int x, int y) -{ - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *reply; - xcb_leave_notify_event_t ev; - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - Ecore_X_Window root = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ecore_x_window_root_get(win); - cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); - reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - memset(&ev, 0, sizeof(xcb_leave_notify_event_t)); - - ev.response_type = XCB_LEAVE_NOTIFY; - ev.event = win; - ev.child = win; - ev.root = root; - ev.event_x = x; - ev.event_y = y; - ev.same_screen_focus = 1; - ev.mode = XCB_NOTIFY_MODE_NORMAL; - ev.detail = XCB_NOTIFY_DETAIL_NONLINEAR; - /* ev.focus = 0; */ - ev.state = 0; - ev.root_x = reply->dst_x; - ev.root_y = reply->dst_y; - ev.time = ecore_x_current_time_get(); - free(reply); - - vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, - XCB_EVENT_MASK_LEAVE_WINDOW, (const char *)&ev); - - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_keyboard_grab(Ecore_X_Window win) -{ - xcb_grab_keyboard_cookie_t cookie; - xcb_grab_keyboard_reply_t *reply; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = - xcb_grab_keyboard_unchecked(_ecore_xcb_conn, 0, win, XCB_CURRENT_TIME, - XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); - reply = xcb_grab_keyboard_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - free(reply); - return EINA_TRUE; -} - -EAPI void -ecore_x_keyboard_ungrab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_ungrab_keyboard(_ecore_xcb_conn, XCB_CURRENT_TIME); -} - -EAPI void -ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y) -{ - xcb_query_pointer_cookie_t cookie; - xcb_query_pointer_reply_t *reply; - -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -// if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (x) *x = -1; - if (y) *y = -1; - - cookie = xcb_query_pointer_unchecked(_ecore_xcb_conn, win); - reply = xcb_query_pointer_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - if (x) *x = reply->win_x; - if (y) *y = reply->win_y; - free(reply); -} - -EAPI Eina_Bool -ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold) -{ - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - vcookie = - xcb_change_pointer_control_checked(_ecore_xcb_conn, - accel_num, accel_denom, threshold, - 1, 1); - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold) -{ - xcb_get_pointer_control_cookie_t cookie; - xcb_get_pointer_control_reply_t *reply; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (accel_num) *accel_num = 0; - if (accel_denom) *accel_denom = 0; - if (threshold) *threshold = 0; - - cookie = xcb_get_pointer_control_unchecked(_ecore_xcb_conn); - reply = xcb_get_pointer_control_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - if (accel_num) *accel_num = reply->acceleration_numerator; - if (accel_denom) *accel_denom = reply->acceleration_denominator; - if (threshold) *threshold = reply->threshold; - free(reply); - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_pointer_mapping_set(unsigned char *map, int nmap) -{ - xcb_set_pointer_mapping_cookie_t cookie; - xcb_set_pointer_mapping_reply_t *reply; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_set_pointer_mapping_unchecked(_ecore_xcb_conn, nmap, map); - reply = xcb_set_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - if (reply->status == XCB_MAPPING_STATUS_SUCCESS) - ret = EINA_TRUE; - - free(reply); - return ret; -} - -EAPI Eina_Bool -ecore_x_pointer_mapping_get(unsigned char *map, int nmap) -{ - xcb_get_pointer_mapping_cookie_t cookie; - xcb_get_pointer_mapping_reply_t *reply; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (map) *map = 0; - nmap = 0; - - cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn); - reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - nmap = xcb_get_pointer_mapping_map_length(reply); - if (nmap <= 0) - { - free(reply); - return EINA_FALSE; - } - - if (map) - { - uint8_t *tmp; - int i = 0; - - tmp = xcb_get_pointer_mapping_map(reply); - for (i = 0; i < nmap; i++) - map[i] = tmp[i]; - } - - free(reply); - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_pointer_grab(Ecore_X_Window win) -{ - xcb_grab_pointer_cookie_t cookie; - xcb_grab_pointer_reply_t *reply; - uint16_t mask; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - mask = (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION); - - cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, win, mask, - XCB_GRAB_MODE_ASYNC, - XCB_GRAB_MODE_ASYNC, - XCB_NONE, XCB_NONE, XCB_CURRENT_TIME); - reply = xcb_grab_pointer_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - ret = (reply->status == XCB_GRAB_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE; - - free(reply); - return ret; -} - -EAPI Eina_Bool -ecore_x_pointer_confine_grab(Ecore_X_Window win) -{ - xcb_grab_pointer_cookie_t cookie; - xcb_grab_pointer_reply_t *reply; - uint16_t mask; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - mask = (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION); - - cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, win, mask, - XCB_GRAB_MODE_ASYNC, - XCB_GRAB_MODE_ASYNC, - win, XCB_NONE, XCB_CURRENT_TIME); - reply = xcb_grab_pointer_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - ret = (reply->status == XCB_GRAB_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE; - - free(reply); - return ret; -} - -EAPI void -ecore_x_pointer_ungrab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_ungrab_pointer(_ecore_xcb_conn, XCB_CURRENT_TIME); -} - -EAPI Eina_Bool -ecore_x_pointer_warp(Ecore_X_Window win, int x, int y) -{ - xcb_void_cookie_t vcookie; - xcb_generic_error_t *err; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - vcookie = - xcb_warp_pointer_checked(_ecore_xcb_conn, XCB_NONE, win, 0, 0, 0, 0, x, y); - err = xcb_request_check(_ecore_xcb_conn, vcookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/** - * Invoke the standard system beep to alert users - * - * @param percent The volume at which the bell rings. Must be in the range - * [-100,+100]. If percent >= 0, the final volume will be: - * base - [(base * percent) / 100] + percent - * Otherwise, it's calculated as: - * base + [(base * percent) / 100] - * where @c base is the bell's base volume as set by XChangeKeyboardControl(3). - * - * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_bell(int percent) -{ - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; - - CHECK_XCB_CONN; - - // FIXME: Use unchecked version after development is ironed out - cookie = xcb_bell_checked(_ecore_xcb_conn, percent); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI void -ecore_x_display_size_get(Ecore_X_Display *dsp EINA_UNUSED, int *w, int *h) -{ - xcb_screen_t *screen; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - /* grab the default screen */ - screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; - if (w) *w = screen->width_in_pixels; - if (h) *h = screen->height_in_pixels; -} - -EAPI unsigned long -ecore_x_display_black_pixel_get(Ecore_X_Display *dsp EINA_UNUSED) -{ - xcb_screen_t *screen; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - /* grab the default screen */ - screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; - return screen->black_pixel; -} - -EAPI unsigned long -ecore_x_display_white_pixel_get(Ecore_X_Display *dsp EINA_UNUSED) -{ - xcb_screen_t *screen; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - /* grab the default screen */ - screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; - return screen->white_pixel; -} - -EAPI void -ecore_x_pointer_last_xy_get(int *x, int *y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (x) *x = _ecore_xcb_event_last_root_x; - if (y) *y = _ecore_xcb_event_last_root_y; -} - -EAPI void -ecore_x_focus_reset(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT, - ((xcb_screen_t *)_ecore_xcb_screen)->root, - XCB_CURRENT_TIME); -// ecore_x_flush(); -} - -EAPI void -ecore_x_events_allow_all(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_allow_events(_ecore_xcb_conn, XCB_ALLOW_ASYNC_BOTH, XCB_CURRENT_TIME); -// ecore_x_flush(); -} - -/** - * Kill a specific client - * - * You can kill a specific client owning window @p win - * - * @param win Window of the client to be killed - */ -EAPI void -ecore_x_kill(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_kill_client(_ecore_xcb_conn, win); -// ecore_x_flush(); -} - -/** - * Kill all clients with subwindows under a given window. - * - * You can kill all clients connected to the X server by using - * @ref ecore_x_window_root_list to get a list of root windows, and - * then passing each root window to this function. - * - * @param root The window whose children will be killed. - */ -EAPI void -ecore_x_killall(Ecore_X_Window root) -{ - int screens = 0, i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - ecore_x_grab(); - - screens = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem; - - /* Traverse window tree starting from root, and drag each - * before the firing squad */ - for (i = 0; i < screens; ++i) - { - xcb_query_tree_cookie_t cookie; - xcb_query_tree_reply_t *reply; - - cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, root); - reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - xcb_window_t *wins = NULL; - int tree_c_len, j = 0; - - wins = xcb_query_tree_children(reply); - tree_c_len = xcb_query_tree_children_length(reply); - for (j = 0; j < tree_c_len; j++) - xcb_kill_client(_ecore_xcb_conn, wins[j]); - free(reply); - } - } - - ecore_x_ungrab(); - ecore_x_sync(); // needed -} - -/** - * Return the screen DPI - * - * This is a simplistic call to get DPI. It does not account for differing - * DPI in the x amd y axes nor does it account for multihead or xinerama and - * xrander where different parts of the screen may have differen DPI etc. - * - * @return the general screen DPI (dots/pixels per inch). - */ -EAPI int -ecore_x_dpi_get(void) -{ - uint16_t mw = 0, w = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - mw = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_millimeters; - if (mw <= 0) return 75; - w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels; - return (((w * 254) / mw) + 5) / 10; -} - -/** - * @defgroup Ecore_X_Display_Attr_Group X Display Attributes - * @ingroup Ecore_X_Group - * - * Functions that set and retrieve X display attributes. - */ - -/** - * Retrieves the Ecore_X_Display handle used for the current X connection. - * @return The current X display. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI Ecore_X_Display * -ecore_x_display_get(void) -{ - char *gl = NULL; - - CHECK_XCB_CONN; - - /* if we have the 'dont use xlib' env var, then we are not using - * XLib and thus cannot return a real XDisplay. - * - * NB: This may break EFL in some places and needs lots of testing !!! */ - if ((gl = getenv("ECORE_X_NO_XLIB"))) - return (Ecore_X_Display *)_ecore_xcb_conn; - else /* we can safely return an XDisplay var */ - return (Ecore_X_Display *)_ecore_xcb_display; -} - -/** - * Retrieves the X display file descriptor. - * @return The current X display file descriptor. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI int -ecore_x_fd_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - return xcb_get_file_descriptor(_ecore_xcb_conn); -} - -EAPI void -ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, int type, void *event), - void *data) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_window_grab_replay_func = func; - _ecore_xcb_window_grab_replay_data = data; -} - -/** - * Retrieves the size of an Ecore_X_Screen. - * @param screen the handle to the screen to query. - * @param w where to return the width. May be NULL. Returns 0 on errors. - * @param h where to return the height. May be NULL. Returns 0 on errors. - * @ingroup Ecore_X_Display_Attr_Group - * @see ecore_x_default_screen_get() - * - * @since 1.1 - */ -EAPI void -ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h) -{ - xcb_screen_t *s; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (w) *w = 0; - if (h) *h = 0; - if (!(s = (xcb_screen_t *)screen)) return; - if (w) *w = s->width_in_pixels; - if (h) *h = s->height_in_pixels; -} - -/** - * Retrieves the count of screens. - * - * @return The count of screens. - * @ingroup Ecore_X_Display_Attr_Group - * - * @since 1.1 - */ -EAPI int -ecore_x_screen_count_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - return xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn)); -} - -/** - * Retrieves the index number of the given screen. - * - * @param screen The screen for which index will be gotten. - * @return The index number of the screen. - * @ingroup Ecore_X_Display_Attr_Group - * - * @since 1.1 - */ -EAPI int -ecore_x_screen_index_get(const Ecore_X_Screen *screen) -{ - xcb_screen_iterator_t iter; - int i = 0; - - CHECK_XCB_CONN; - - iter = - xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); - for (; iter.rem; xcb_screen_next(&iter)) - { - if (iter.data == (xcb_screen_t *)screen) - return i; - i++; - } - - return 0; -} - -/** - * Retrieves the screen based on index number. - * - * @param idx The index that will be used to retrieve the screen. - * @return The Ecore_X_Screen at this index. - * @ingroup Ecore_X_Display_Attr_Group - * - * @since 1.1 - */ -EAPI Ecore_X_Screen * -ecore_x_screen_get(int idx) -{ - xcb_screen_iterator_t iter; - int i = 0; - - CHECK_XCB_CONN; - - iter = - xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); - for (i = 0; iter.rem; xcb_screen_next(&iter), i++) - if (i == idx) return iter.data; - - return NULL; -} - -EAPI unsigned int -ecore_x_visual_id_get(Ecore_X_Visual visual) -{ - return ((xcb_visualtype_t *)visual)->visual_id; -} - -/** - * Retrieve the default Visual. - * - * @param disp The Display to get the Default Visual from - * @param screen The Screen. - * - * @return The default visual. - * @since 1.1.0 - */ -EAPI Ecore_X_Visual -ecore_x_default_visual_get(Ecore_X_Display *disp EINA_UNUSED, Ecore_X_Screen *screen) -{ - xcb_screen_t *s; - xcb_depth_iterator_t diter; - xcb_visualtype_iterator_t viter; - - CHECK_XCB_CONN; - - s = (xcb_screen_t *)screen; - diter = xcb_screen_allowed_depths_iterator(s); - for (; diter.rem; xcb_depth_next(&diter)) - { - viter = xcb_depth_visuals_iterator(diter.data); - for (; viter.rem; xcb_visualtype_next(&viter)) - { - if (viter.data->visual_id == s->root_visual) - return viter.data; - } - } - return 0; -} - -/** - * Retrieve the default Colormap. - * - * @param disp The Display to get the Default Colormap from - * @param screen The Screen. - * - * @return The default colormap. - * @since 1.1.0 - */ -EAPI Ecore_X_Colormap -ecore_x_default_colormap_get(Ecore_X_Display *disp EINA_UNUSED, Ecore_X_Screen *screen) -{ - xcb_screen_t *s; - - s = (xcb_screen_t *)screen; - return s->default_colormap; -} - -/** - * Retrieve the default depth. - * - * @param disp The Display to get the Default Depth from - * @param screen The Screen. - * - * @return The default depth. - * @since 1.1.0 - */ -EAPI int -ecore_x_default_depth_get(Ecore_X_Display *disp EINA_UNUSED, Ecore_X_Screen *screen) -{ - xcb_screen_t *s; - - s = (xcb_screen_t *)screen; - return s->root_depth; -} - -EAPI void -ecore_x_xkb_select_group(int group EINA_UNUSED) -{ - // XXX: implement me */ -} - -/** - * Sets the timeout for a double and triple clicks to be flagged. - * - * This sets the time between clicks before the double_click flag is - * set in a button down event. If 3 clicks occur within double this - * time, the triple_click flag is also set. - * - * @param t The time in seconds - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI void -ecore_x_double_click_time_set(double t) -{ - if (t < 0.0) t = 0.0; - _ecore_xcb_double_click_time = t; -} - -/** - * Retrieves the double and triple click flag timeout. - * - * See @ref ecore_x_double_click_time_set for more information. - * - * @return The timeout for double clicks in seconds. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI double -ecore_x_double_click_time_get(void) -{ - return _ecore_xcb_double_click_time; -} - -/* local function prototypes */ -static int -_ecore_xcb_shutdown(Eina_Bool close_display) -{ - if (--_ecore_xcb_init_count != 0) - return _ecore_xcb_init_count; - - if (!_ecore_xcb_conn) - return _ecore_xcb_init_count; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - ecore_idle_enterer_del(_ecore_xcb_idle_enterer); - _ecore_xcb_idle_enterer = NULL; - - if (_ecore_xcb_fd_handler) - ecore_main_fd_handler_del(_ecore_xcb_fd_handler); - - /* disconnect from display server */ - if (close_display) - xcb_disconnect(_ecore_xcb_conn); - else - { - close(xcb_get_file_descriptor(_ecore_xcb_conn)); - _ecore_xcb_conn = NULL; - } - - /* shutdown events */ - _ecore_xcb_events_shutdown(); - - /* shutdown input extension */ - _ecore_xcb_input_shutdown(); - - /* shutdown gesture extension */ - _ecore_xcb_gesture_shutdown(); - - /* shutdown selection */ - _ecore_xcb_selection_shutdown(); - - /* shutdown dnd */ - _ecore_xcb_dnd_shutdown(); - - /* shutdown netwm */ - ecore_x_netwm_shutdown(); - - /* shutdown keymap */ - _ecore_xcb_keymap_shutdown(); - - /* shutdown ecore_event */ - ecore_event_shutdown(); - - /* shutdown ecore */ - ecore_shutdown(); - - /* unregister log domain */ - eina_log_domain_unregister(_ecore_xcb_log_dom); - _ecore_xcb_log_dom = -1; - - /* shutdown eina */ - eina_shutdown(); - - return _ecore_xcb_init_count; -} - -static Eina_Bool -_ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED) -{ - xcb_connection_t *conn; - xcb_generic_event_t *ev = NULL; - - conn = (xcb_connection_t *)data; - - if (_ecore_xcb_event_buffered) - { - _ecore_xcb_events_handle(_ecore_xcb_event_buffered); - free(_ecore_xcb_event_buffered); - _ecore_xcb_event_buffered = NULL; - } - -// xcb_flush(conn); - - while ((ev = xcb_poll_for_event(conn))) - { - /* NB: Ecore Xlib uses filterevent for xim, but xcb does not support - * xim, so no need for it here */ - - /* check for errors first */ - if (xcb_connection_has_error(conn)) - { - xcb_generic_error_t *err; - - err = (xcb_generic_error_t *)ev; - _ecore_xcb_io_error_handle(err); - } - else - { - /* FIXME: Filter event for XIM */ - _ecore_xcb_events_handle(ev); - free(ev); - } - } - - return ECORE_CALLBACK_RENEW; -} - -static Eina_Bool -_ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED) -{ - xcb_connection_t *conn; - xcb_generic_event_t *ev = NULL; - - conn = (xcb_connection_t *)data; - ev = xcb_poll_for_event(conn); - if (ev) - { - /* check for errors first */ - if (xcb_connection_has_error(conn)) - { - xcb_generic_error_t *err; - - err = (xcb_generic_error_t *)ev; - _ecore_xcb_io_error_handle(err); - return ECORE_CALLBACK_CANCEL; - } - _ecore_xcb_event_buffered = ev; - return ECORE_CALLBACK_RENEW; - } - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_ecore_xcb_idle_enter(void *data EINA_UNUSED) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_flush(_ecore_xcb_conn); - return ECORE_CALLBACK_RENEW; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_atoms.c b/src/lib/ecore_x/xcb/ecore_xcb_atoms.c deleted file mode 100644 index ba31df7..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_atoms.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "ecore_xcb_private.h" -#include "ecore_x_atoms_decl.h" - -/* NB: Increment if you add new atoms */ -#define ECORE_X_ATOMS_COUNT 199 - -/* local function prototypes */ - -/* local variables */ -static xcb_intern_atom_cookie_t cookies[ECORE_X_ATOMS_COUNT]; - -#define MYMIN(X, Y) (((X) < (Y)) ? (X) : (Y)) - -void -_ecore_xcb_atoms_init(void) -{ - int i = 0, num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - num = (sizeof(atom_items) / sizeof(Atom_Item)); - num = MYMIN(num, ECORE_X_ATOMS_COUNT); - for (i = 0; i < num; i++) - { - cookies[i] = - xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, - strlen(atom_items[i].name), atom_items[i].name); - } -} - -void -_ecore_xcb_atoms_finalize(void) -{ - int i = 0, num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - num = (sizeof(atom_items) / sizeof(Atom_Item)); - num = MYMIN(num, ECORE_X_ATOMS_COUNT); - for (i = 0; i < num; i++) - { - xcb_intern_atom_reply_t *reply = NULL; - - if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0))) - continue; - *(atom_items[i].atom) = reply->atom; - free(reply); - } -} - -/** - * @defgroup Ecore_X_Atom_Group X Atom Functions - * @ingroup Ecore_X_Group - * - * Functions that operate on atoms - */ - -/** - * Retrieves the atom value associated to a name. - * - * @param name Unused. - * @return Associated atom value. - * - * Retrieves the atom value associated to a name. The reply is the - * returned value of the function ecore_xcb_intern_atom_reply(). If - * @p reply is @c NULL, the NULL atom is returned. Otherwise, the atom - * associated to the name is returned. - * - * @ingroup Ecore_X_Atom_Group - */ -EAPI Ecore_X_Atom -ecore_x_atom_get(const char *name) -{ - xcb_intern_atom_cookie_t cookie; - xcb_intern_atom_reply_t *reply; - Ecore_X_Atom a; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name); - reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return XCB_ATOM_NONE; - a = reply->atom; - free(reply); - return a; -} - -/** - * Retrieves the name of the given atom. - * - * @param atom - * @return The name of the atom. - * - * @ingroup Ecore_X_Atom_Group - */ -EAPI char * -ecore_x_atom_name_get(Ecore_X_Atom atom) -{ - xcb_get_atom_name_cookie_t cookie; - xcb_get_atom_name_reply_t *reply; - char *name; - int len = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom); - reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - len = xcb_get_atom_name_name_length(reply); - name = (char *)malloc(sizeof(char) * (len + 1)); - if (!name) - { - free(reply); - return NULL; - } - memcpy(name, xcb_get_atom_name_name(reply), len); - name[len] = '\0'; - - free(reply); - return name; -} - -EAPI void -ecore_x_atoms_get(const char **names, - int num, - Ecore_X_Atom *atoms) -{ - xcb_intern_atom_cookie_t cookies[num]; - int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - num = MYMIN(num, ECORE_X_ATOMS_COUNT); - for (i = 0; i < num; i++) - { - cookies[i] = - xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, - strlen(names[i]), names[i]); - } - for (i = 0; i < num; i++) - { - xcb_intern_atom_reply_t *reply = NULL; - - if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0))) - continue; - atoms[i] = reply->atom; - free(reply); - } -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_composite.c b/src/lib/ecore_x/xcb/ecore_xcb_composite.c deleted file mode 100644 index b614d3c..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_composite.c +++ /dev/null @@ -1,291 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_COMPOSITE -# include -#endif - -/* local variables */ -static Eina_Bool _composite_avail = EINA_FALSE; - -void -_ecore_xcb_composite_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_COMPOSITE - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_composite_id); -#endif -} - -void -_ecore_xcb_composite_finalize(void) -{ -#ifdef ECORE_XCB_COMPOSITE - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_COMPOSITE - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_composite_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_composite_query_version_cookie_t cookie; - xcb_composite_query_version_reply_t *reply; - - cookie = - xcb_composite_query_version_unchecked(_ecore_xcb_conn, - XCB_COMPOSITE_MAJOR_VERSION, - XCB_COMPOSITE_MINOR_VERSION); - reply = - xcb_composite_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { -// if ((reply->major_version >= XCB_COMPOSITE_MAJOR_VERSION) && - if (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION) - { -# ifdef ECORE_XCB_RENDER - if (_ecore_xcb_render_avail_get()) - { -# ifdef ECORE_XCB_XFIXES - if (_ecore_xcb_xfixes_avail_get()) - _composite_avail = EINA_TRUE; -# endif - } -# endif - } - - free(reply); - } - } -#endif -} - -/** - * @defgroup Ecore_X_Composite_Group X Composite Extension Functions - * @ingroup Ecore_X_Group - * - * Functions related to the X Composite Extension - */ - -/** - * Return whether the Composite Extension is available - * - * @return @c EINA_TRUE is the Composite Extension is available, @c EINA_FALSE - * if not. - * - * @ingroup Ecore_X_Composite_Group - */ -EAPI Eina_Bool -ecore_x_composite_query(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _composite_avail; -} - -EAPI void -ecore_x_composite_redirect_window(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_COMPOSITE - uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = XCB_COMPOSITE_REDIRECT_MANUAL; - break; - } - xcb_composite_redirect_window(_ecore_xcb_conn, win, update); -// ecore_x_flush(); -#endif -} - -EAPI void -ecore_x_composite_redirect_subwindows(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_COMPOSITE - uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = XCB_COMPOSITE_REDIRECT_MANUAL; - break; - } - xcb_composite_redirect_subwindows(_ecore_xcb_conn, win, update); -// ecore_x_flush(); -#endif -} - -EAPI void -ecore_x_composite_unredirect_window(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_COMPOSITE - uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = XCB_COMPOSITE_REDIRECT_MANUAL; - break; - } - xcb_composite_unredirect_window(_ecore_xcb_conn, win, update); -// ecore_x_flush(); -#endif -} - -EAPI void -ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_COMPOSITE - uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = XCB_COMPOSITE_REDIRECT_MANUAL; - break; - } - xcb_composite_unredirect_subwindows(_ecore_xcb_conn, win, update); -// ecore_x_flush(); -#endif -} - -EAPI Ecore_X_Pixmap -ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) -{ -#ifdef ECORE_XCB_COMPOSITE - Ecore_X_Pixmap pmap = XCB_NONE; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return XCB_NONE; - -#ifdef ECORE_XCB_COMPOSITE - pmap = xcb_generate_id(_ecore_xcb_conn); - xcb_composite_name_window_pixmap(_ecore_xcb_conn, win, pmap); -// ecore_x_flush(); -#endif - - return pmap; -} - -EAPI void -ecore_x_composite_window_events_disable(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_SHAPE - ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1); -// ecore_x_flush(); -#else - return; - win = 0; -#endif -} - -EAPI void -ecore_x_composite_window_events_enable(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_SHAPE - ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535); -// ecore_x_flush(); -#else - return; - win = 0; -#endif -} - -EAPI Ecore_X_Window -ecore_x_composite_render_window_enable(Ecore_X_Window root) -{ - Ecore_X_Window win = 0; -#ifdef ECORE_XCB_COMPOSITE - xcb_composite_get_overlay_window_cookie_t cookie; - xcb_composite_get_overlay_window_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return 0; - -#ifdef ECORE_XCB_COMPOSITE - cookie = xcb_composite_get_overlay_window_unchecked(_ecore_xcb_conn, root); - reply = - xcb_composite_get_overlay_window_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return win; - - win = reply->overlay_win; - free(reply); - - ecore_x_composite_window_events_disable(win); -// ecore_x_flush(); -#endif - - return win; -} - -EAPI void -ecore_x_composite_render_window_disable(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_composite_avail) return; - -#ifdef ECORE_XCB_COMPOSITE - xcb_composite_release_overlay_window(_ecore_xcb_conn, win); -// ecore_x_flush(); -#endif -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_cursor.c b/src/lib/ecore_x/xcb/ecore_xcb_cursor.c deleted file mode 100644 index 755df04..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_cursor.c +++ /dev/null @@ -1,400 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_CURSOR -# include -# include -#endif - -/* local function prototypes */ -#ifdef ECORE_XCB_CURSOR -static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format_get(void); -#endif -static void _ecore_xcb_cursor_default_size_get(void); -static void _ecore_xcb_cursor_dpi_size_get(void); -static void _ecore_xcb_cursor_guess_size(void); -#ifdef ECORE_XCB_CURSOR -static Ecore_X_Cursor _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, - int hot_x, - int hot_y); -#endif -static void _ecore_xcb_cursor_image_destroy(xcb_image_t *img); - -/* local variables */ -static int _ecore_xcb_cursor_size = 0; -static Eina_Bool _ecore_xcb_cursor = EINA_FALSE; -#ifdef ECORE_XCB_CURSOR -static uint32_t _ecore_xcb_cursor_format_id = 0; -// static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format = NULL; -#endif - -void -_ecore_xcb_cursor_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* NB: No-op */ -} - -void -_ecore_xcb_cursor_finalize(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_CURSOR - _ecore_xcb_cursor = _ecore_xcb_render_argb_get(); - - /* find render pict format */ - if (_ecore_xcb_cursor_format_id <= 0) - _ecore_xcb_cursor_format_id = _ecore_xcb_cursor_format_get()->id; -#endif - - /* try to grab cursor size from XDefaults */ - _ecore_xcb_cursor_default_size_get(); - - /* if that failed, try to get it from Xft Dpi setting */ - if (_ecore_xcb_cursor_size == 0) - _ecore_xcb_cursor_dpi_size_get(); - - /* if that failed, try to guess from display size */ - if (_ecore_xcb_cursor_size == 0) - _ecore_xcb_cursor_guess_size(); - - /* NB: Would normally add theme stuff here, but E cursor does not support - * xcursor themes. Delay parsing that stuff out until such time if/when the - * user selects to use X Cursor, rather than E cursor */ -} - -EAPI Eina_Bool -ecore_x_cursor_color_supported_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_cursor; -} - -EAPI Ecore_X_Cursor -ecore_x_cursor_new(Ecore_X_Window win, - int *pixels, - int w, - int h, - int hot_x, - int hot_y) -{ - Ecore_X_Cursor cursor = 0; - xcb_image_t *img; - -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_CURSOR - if (_ecore_xcb_cursor) - { - img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, - 32, NULL, (w * h * sizeof(int)), - (uint8_t *)pixels); - cursor = _ecore_xcb_cursor_image_load_cursor(img, hot_x, hot_y); - _ecore_xcb_cursor_image_destroy(img); - return cursor; - } - else -#endif - { - Ecore_X_GC gc; - xcb_pixmap_t pmap, mask; - uint32_t *pix; - uint8_t fr = 0x00, fg = 0x00, fb = 0x00; - uint8_t br = 0xff, bg = 0xff, bb = 0xff; - uint32_t brightest = 0, darkest = 255 * 3; - uint16_t x, y; - const uint32_t dither[2][2] = - { - {0, 2}, - {3, 1} - }; - - img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, - 1, NULL, ~0, NULL); - if (img->data) free(img->data); - img->data = malloc(img->size); - - pmap = xcb_generate_id(_ecore_xcb_conn); - xcb_create_pixmap(_ecore_xcb_conn, 1, pmap, win, w, h); - mask = xcb_generate_id(_ecore_xcb_conn); - xcb_create_pixmap(_ecore_xcb_conn, 1, mask, win, w, h); - - pix = (uint32_t *)pixels; - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - uint8_t r, g, b, a; - - a = (pix[0] >> 24) & 0xff; - r = (pix[0] >> 16) & 0xff; - g = (pix[0] >> 8) & 0xff; - b = (pix[0]) & 0xff; - if (a > 0) - { - if ((uint32_t)(r + g + b) > brightest) - { - brightest = r + g + b; - br = r; - bg = g; - bb = b; - } - - if ((uint32_t)(r + g + b) < darkest) - { - darkest = r + g + b; - fr = r; - fg = g; - fb = b; - } - } - pix++; - } - } - - pix = (uint32_t *)pixels; - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - uint32_t v; - uint8_t r, g, b; - int32_t d1, d2; - - r = (pix[0] >> 16) & 0xff; - g = (pix[0] >> 8) & 0xff; - b = (pix[0]) & 0xff; - d1 = - ((r - fr) * (r - fr)) + - ((g - fg) * (g - fg)) + - ((b - fb) * (b - fb)); - d2 = - ((r - br) * (r - br)) + - ((g - bg) * (g - bg)) + - ((b - bb) * (b - bb)); - if (d1 + d2) - { - v = (((d2 * 255) / (d1 + d2)) * 5) / 256; - if (v > dither[x & 0x1][y & 0x1]) - v = 1; - else - v = 0; - } - else - v = 0; - - xcb_image_put_pixel(img, x, y, v); - pix++; - } - } - - gc = ecore_x_gc_new(pmap, 0, NULL); - xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, w, h, - 0, 0, 0, img->depth, img->size, img->data); - ecore_x_gc_free(gc); - - pix = (uint32_t *)pixels; - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - uint32_t v; - - v = (((pix[0] >> 24) & 0xff) * 5) / 256; - if (v > dither[x & 0x1][y & 0x1]) - v = 1; - else - v = 0; - - xcb_image_put_pixel(img, x, y, v); - pix++; - } - } - - gc = ecore_x_gc_new(mask, 0, NULL); - xcb_put_image(_ecore_xcb_conn, img->format, mask, gc, w, h, - 0, 0, 0, img->depth, img->size, img->data); - ecore_x_gc_free(gc); - - if (img->data) free(img->data); - _ecore_xcb_cursor_image_destroy(img); - - cursor = xcb_generate_id(_ecore_xcb_conn); - xcb_create_cursor(_ecore_xcb_conn, cursor, pmap, mask, - fr << 8 | fr, fg << 8 | fg, fb << 8 | fb, - br << 8 | br, bg << 8 | bg, bb << 8 | bb, - hot_x, hot_y); - - xcb_free_pixmap(_ecore_xcb_conn, pmap); - xcb_free_pixmap(_ecore_xcb_conn, mask); - - return cursor; - } - - return 0; -} - -EAPI void -ecore_x_cursor_free(Ecore_X_Cursor c) -{ -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_free_cursor(_ecore_xcb_conn, c); -} - -/* - * Returns the cursor for the given shape. - * Note that the return value must not be freed with - * ecore_x_cursor_free()! - */ -EAPI Ecore_X_Cursor -ecore_x_cursor_shape_get(int shape) -{ - Ecore_X_Cursor cursor = 0; - xcb_font_t font; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - font = xcb_generate_id(_ecore_xcb_conn); - xcb_open_font(_ecore_xcb_conn, font, strlen("cursor"), "cursor"); - - cursor = xcb_generate_id(_ecore_xcb_conn); - /* FIXME: Add request check ?? */ - xcb_create_glyph_cursor(_ecore_xcb_conn, cursor, font, font, - shape, shape + 1, 0, 0, 0, 65535, 65535, 65535); - - xcb_close_font(_ecore_xcb_conn, font); - return cursor; -} - -EAPI void -ecore_x_cursor_size_set(int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_cursor_size = size; - /* NB: May need to adjust size of current cursors here */ -} - -EAPI int -ecore_x_cursor_size_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_cursor_size; -} - -/* local functions */ -#ifdef ECORE_XCB_CURSOR -static xcb_render_pictforminfo_t * -_ecore_xcb_cursor_format_get(void) -{ - const xcb_render_query_pict_formats_reply_t *reply; - xcb_render_pictforminfo_t *ret = NULL; - - CHECK_XCB_CONN; - - reply = xcb_render_util_query_formats(_ecore_xcb_conn); - if (reply) - ret = xcb_render_util_find_standard_format(reply, - XCB_PICT_STANDARD_ARGB_32); - - return ret; -} - -#endif - -static void -_ecore_xcb_cursor_default_size_get(void) -{ - char *s = NULL; - int v = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - s = getenv("XCURSOR_SIZE"); - if (!s) - { - _ecore_xcb_xdefaults_init(); - v = _ecore_xcb_xdefaults_int_get("Xcursor", "size"); - _ecore_xcb_xdefaults_shutdown(); - } - else - v = atoi(s); - if (v) _ecore_xcb_cursor_size = ((v * 16) / 72); -} - -static void -_ecore_xcb_cursor_dpi_size_get(void) -{ - int v = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_xdefaults_init(); - v = _ecore_xcb_xdefaults_int_get("Xft", "dpi"); - if (v) _ecore_xcb_cursor_size = ((v * 16) / 72); - _ecore_xcb_xdefaults_shutdown(); -} - -static void -_ecore_xcb_cursor_guess_size(void) -{ - int w = 0, h = 0, s = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_screen_size_get(_ecore_xcb_screen, &w, &h); - if (h < w) s = h; - else s = w; - _ecore_xcb_cursor_size = (s / 48); -} - -#ifdef ECORE_XCB_CURSOR -static Ecore_X_Cursor -_ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, - int hot_x, - int hot_y) -{ - Ecore_X_Cursor cursor = 0; - Ecore_X_GC gc; - xcb_pixmap_t pmap; - xcb_render_picture_t pict; - - CHECK_XCB_CONN; - - pmap = xcb_generate_id(_ecore_xcb_conn); - xcb_create_pixmap(_ecore_xcb_conn, img->depth, pmap, - ((xcb_screen_t *)_ecore_xcb_screen)->root, - img->width, img->height); - - gc = ecore_x_gc_new(pmap, 0, NULL); - xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, - img->width, img->height, 0, 0, 0, img->depth, - img->size, img->data); - ecore_x_gc_free(gc); - - pict = xcb_generate_id(_ecore_xcb_conn); - xcb_render_create_picture(_ecore_xcb_conn, pict, pmap, - _ecore_xcb_cursor_format_id, 0, NULL); - xcb_free_pixmap(_ecore_xcb_conn, pmap); - - cursor = xcb_generate_id(_ecore_xcb_conn); - xcb_render_create_cursor(_ecore_xcb_conn, cursor, pict, hot_x, hot_y); - xcb_render_free_picture(_ecore_xcb_conn, pict); - - return cursor; -} - -#endif - -static void -_ecore_xcb_cursor_image_destroy(xcb_image_t *img) -{ - CHECK_XCB_CONN; - if (img) xcb_image_destroy(img); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_damage.c b/src/lib/ecore_x/xcb/ecore_xcb_damage.c deleted file mode 100644 index fdb7a2a..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_damage.c +++ /dev/null @@ -1,156 +0,0 @@ -#include "ecore_xcb_private.h" -# ifdef ECORE_XCB_DAMAGE -# include -# endif - -/* local variables */ -static Eina_Bool _damage_avail = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_damage = -1; - -void -_ecore_xcb_damage_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_DAMAGE - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_damage_id); -#endif -} - -void -_ecore_xcb_damage_finalize(void) -{ -#ifdef ECORE_XCB_DAMAGE - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_DAMAGE - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_damage_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_damage_query_version_cookie_t cookie; - xcb_damage_query_version_reply_t *reply; - - cookie = - xcb_damage_query_version_unchecked(_ecore_xcb_conn, - XCB_DAMAGE_MAJOR_VERSION, - XCB_DAMAGE_MINOR_VERSION); - reply = xcb_damage_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - _damage_avail = EINA_TRUE; - free(reply); - } - - if (_damage_avail) - _ecore_xcb_event_damage = ext_reply->first_event; - } -#endif -} - -/** - * @defgroup Ecore_X_Damage_Group X Damage Extension Functions - * @ingroup Ecore_X_Group - * - * Functions related to the X Damage Extension. - */ - -EAPI Eina_Bool -ecore_x_damage_query(void) -{ - return _damage_avail; -} - -/** - * Create a damage object - * - * @param drawable The drawable to monitor - * @param level The level of the damage report - * @return The damage object - * - * Creates a damage object to monitor changes to @p drawable, - * with the level @p level. - * - * @ingroup Ecore_X_Damage_Group - */ -EAPI Ecore_X_Damage -ecore_x_damage_new(Ecore_X_Drawable drawable, - Ecore_X_Damage_Report_Level level) -{ - Ecore_X_Damage damage = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_damage_avail) return 0; - -#ifdef ECORE_XCB_DAMAGE - damage = xcb_generate_id(_ecore_xcb_conn); - xcb_damage_create(_ecore_xcb_conn, damage, drawable, level); -// ecore_x_flush(); -#endif - - return damage; -} - -/** - * Destroy a damage object - * - * @param damage The damage object to destroy - * - * Destroys the damage object @p damage - * - * @ingroup Ecore_X_Damage_Group - */ -EAPI void -ecore_x_damage_free(Ecore_X_Damage damage) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_damage_avail) return; - -#ifdef ECORE_XCB_DAMAGE - xcb_damage_destroy(_ecore_xcb_conn, damage); -// ecore_x_flush(); -#endif -} - -/** - * Synchronously modifies the region - * - * @param damage The damage object to destroy - * @param repair The repair region - * @param parts The parts region - * - * Synchronously modifies the regions in the following manner: - * If @p repair is @c XCB_NONE: - * 1) parts = damage - * 2) damage = \ - * Otherwise: - * 1) parts = damage INTERSECT repair - * 2) damage = damage - parts - * 3) Generate DamageNotify for remaining damage areas - * - * @ingroup Ecore_X_Damage_Group - */ -EAPI void -ecore_x_damage_subtract(Ecore_X_Damage damage, - Ecore_X_Region repair, - Ecore_X_Region parts) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_damage_avail) return; - -#ifdef ECORE_XCB_DAMAGE - xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts); -// ecore_x_flush(); -#endif -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_dnd.c b/src/lib/ecore_x/xcb/ecore_xcb_dnd.c deleted file mode 100644 index 974ec0e..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_dnd.c +++ /dev/null @@ -1,720 +0,0 @@ -#include "ecore_xcb_private.h" - -/* local structures */ -typedef struct _Version_Cache_Item -{ - Ecore_X_Window win; - int ver; -} Version_Cache_Item; - -/* local function prototypes */ -static Eina_Bool _ecore_xcb_dnd_converter_copy(char *target EINA_UNUSED, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *tprop EINA_UNUSED, - int *count EINA_UNUSED); - -/* local variables */ -static int _ecore_xcb_dnd_init_count = 0; -static Ecore_X_DND_Source *_source = NULL; -static Ecore_X_DND_Target *_target = NULL; -static Version_Cache_Item *_version_cache = NULL; -static int _version_cache_num = 0, _version_cache_alloc = 0; -static void (*_posupdatecb)(void *, - Ecore_X_Xdnd_Position *); -static void *_posupdatedata; - -/* external variables */ -EAPI int ECORE_X_EVENT_XDND_ENTER = 0; -EAPI int ECORE_X_EVENT_XDND_POSITION = 0; -EAPI int ECORE_X_EVENT_XDND_STATUS = 0; -EAPI int ECORE_X_EVENT_XDND_LEAVE = 0; -EAPI int ECORE_X_EVENT_XDND_DROP = 0; -EAPI int ECORE_X_EVENT_XDND_FINISHED = 0; - -void -_ecore_xcb_dnd_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!_ecore_xcb_dnd_init_count) - { - _source = calloc(1, sizeof(Ecore_X_DND_Source)); - if (!_source) return; - _source->version = ECORE_X_DND_VERSION; - _source->win = XCB_NONE; - _source->dest = XCB_NONE; - _source->state = ECORE_X_DND_SOURCE_IDLE; - _source->prev.window = 0; - - _target = calloc(1, sizeof(Ecore_X_DND_Target)); - if (!_target) - { - free(_source); - _source = NULL; - return; - } - _target->win = XCB_NONE; - _target->source = XCB_NONE; - _target->state = ECORE_X_DND_TARGET_IDLE; - - ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); - ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); - ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); - ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new(); - ECORE_X_EVENT_XDND_DROP = ecore_event_type_new(); - ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new(); - } - _ecore_xcb_dnd_init_count++; -} - -void -_ecore_xcb_dnd_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_dnd_init_count--; - if (_ecore_xcb_dnd_init_count > 0) return; - if (_source) free(_source); - _source = NULL; - if (_target) free(_target); - _target = NULL; - _ecore_xcb_dnd_init_count = 0; -} - -EAPI void -ecore_x_dnd_send_status(Eina_Bool will_accept, - Eina_Bool suppress, - Ecore_X_Rectangle rect, - Ecore_X_Atom action) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (_target->state == ECORE_X_DND_TARGET_IDLE) return; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - _target->will_accept = will_accept; - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.type = ECORE_X_ATOM_XDND_STATUS; - ev.format = 32; - ev.window = _target->source; - ev.data.data32[0] = _target->win; - ev.data.data32[1] = 0; - if (will_accept) ev.data.data32[1] |= 0x1UL; - if (!suppress) ev.data.data32[1] |= 0x2UL; - - ev.data.data32[2] = rect.x; - ev.data.data32[2] <<= 16; - ev.data.data32[2] |= rect.y; - ev.data.data32[3] = rect.width; - ev.data.data32[3] <<= 16; - ev.data.data32[3] |= rect.height; - - if (will_accept) - ev.data.data32[4] = action; - else - ev.data.data32[4] = XCB_NONE; - _target->accepted_action = action; - - xcb_send_event(_ecore_xcb_conn, 0, _target->source, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_dnd_aware_set(Ecore_X_Window win, - Eina_Bool on) -{ - Ecore_X_Atom prop_data = ECORE_X_DND_VERSION; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (on) - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE, - ECORE_X_ATOM_ATOM, 32, &prop_data, 1); - else - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE); -} - -EAPI int -ecore_x_dnd_version_get(Ecore_X_Window win) -{ - unsigned char *data; - int num = 0; - Version_Cache_Item *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) - { - if (_version_cache) - { - int i = 0; - - for (i = 0; i < _version_cache_num; i++) - { - if (_version_cache[i].win == win) - return _version_cache[i].ver; - } - } - } - - if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE, - ECORE_X_ATOM_ATOM, 32, &data, &num)) - { - int version = 0; - - version = (int)*data; - free(data); - if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) - { - _version_cache_num++; - if (_version_cache_num > _version_cache_alloc) - _version_cache_alloc += 16; - t = realloc(_version_cache, - _version_cache_alloc * sizeof(Version_Cache_Item)); - if (!t) return 0; - _version_cache = t; - _version_cache[_version_cache_num - 1].win = win; - _version_cache[_version_cache_num - 1].ver = version; - } - return version; - } - - if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) - { - _version_cache_num++; - if (_version_cache_num > _version_cache_alloc) - _version_cache_alloc += 16; - t = realloc(_version_cache, - _version_cache_alloc * sizeof(Version_Cache_Item)); - if (!t) return 0; - _version_cache = t; - _version_cache[_version_cache_num - 1].win = win; - _version_cache[_version_cache_num - 1].ver = 0; - } - - return 0; -} - -EAPI Eina_Bool -ecore_x_dnd_type_isset(Ecore_X_Window win, - const char *type) -{ - int num = 0, i = 0; - Eina_Bool ret = EINA_FALSE; - unsigned char *data; - Ecore_X_Atom *atoms, atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, &data, &num)) - return ret; - - atom = ecore_x_atom_get(type); - atoms = (Ecore_X_Atom *)data; - for (i = 0; i < num; ++i) - { - if (atom == atoms[i]) - { - ret = EINA_TRUE; - break; - } - } - - free(data); - return ret; -} - -EAPI void -ecore_x_dnd_type_set(Ecore_X_Window win, - const char *type, - Eina_Bool on) -{ - Ecore_X_Atom atom, *oldset = NULL, *newset = NULL; - int i = 0, j = 0, num = 0; - unsigned char *data = NULL, *old_data = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - atom = ecore_x_atom_get(type); - ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, &old_data, &num); - oldset = (Ecore_X_Atom *)old_data; - if (on) - { - if (ecore_x_dnd_type_isset(win, type)) - { - free(old_data); - return; - } - newset = calloc(num + 1, sizeof(Ecore_X_Atom)); - if (!newset) return; - data = (unsigned char *)newset; - for (i = 0; i < num; i++) - newset[i + 1] = oldset[i]; - newset[0] = atom; - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, data, num + 1); - } - else - { - if (!ecore_x_dnd_type_isset(win, type)) - { - free(old_data); - return; - } - newset = calloc(num - 1, sizeof(Ecore_X_Atom)); - if (!newset) - { - free(old_data); - return; - } - data = (unsigned char *)newset; - for (i = 0; i < num; i++) - if (oldset[i] != atom) - newset[j++] = oldset[i]; - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, data, num - 1); - } - free(oldset); - free(newset); -} - -EAPI void -ecore_x_dnd_types_set(Ecore_X_Window win, - const char **types, - unsigned int num_types) -{ - Ecore_X_Atom *newset = NULL; - unsigned int i; - unsigned char *data = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!num_types) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST); - else - { - newset = calloc(num_types, sizeof(Ecore_X_Atom)); - if (!newset) return; - - data = (unsigned char *)newset; - for (i = 0; i < num_types; i++) - { - newset[i] = ecore_x_atom_get(types[i]); - ecore_x_selection_converter_atom_add(newset[i], - _ecore_xcb_dnd_converter_copy); - } - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, data, - num_types); - free(newset); - } -} - -EAPI void -ecore_x_dnd_actions_set(Ecore_X_Window win, - Ecore_X_Atom *actions, - unsigned int num_actions) -{ - unsigned int i; - unsigned char *data = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!num_actions) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST); - else - { - data = (unsigned char *)actions; - for (i = 0; i < num_actions; i++) - ecore_x_selection_converter_atom_add(actions[i], - _ecore_xcb_dnd_converter_copy); - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST, - ECORE_X_ATOM_ATOM, 32, data, - num_actions); - } -} - -/** - * The DND position update cb is called Ecore_X sends a DND position to a - * client. - * - * It essentially mirrors some of the data sent in the position message. - * Generally this cb should be set just before position update is called. - * Please note well you need to look after your own data pointer if someone - * trashes you position update cb set. - * - * It is considered good form to clear this when the dnd event finishes. - * - * @param cb Callback to updated each time ecore_x sends a position update. - * @param data User data. - */ -EAPI void -ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data), - const void *data) -{ - _posupdatecb = cb; - _posupdatedata = (void *)data; -} - -static Eina_Bool -_ecore_x_dnd_begin(Ecore_X_Window source, Eina_Bool self, unsigned char *data, int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_dnd_version_get(source)) return EINA_FALSE; - - /* Take ownership of XdndSelection */ - if (!ecore_x_selection_xdnd_set(source, data, size)) return EINA_FALSE; - - if (_version_cache) - { - free(_version_cache); - _version_cache = NULL; - _version_cache_num = 0; - _version_cache_alloc = 0; - } - - ecore_x_window_shadow_tree_flush(); - - _source->win = source; - if (!self) ecore_x_window_ignore_set(_source->win, 1); - _source->state = ECORE_X_DND_SOURCE_DRAGGING; - _source->time = _ecore_xcb_events_last_time_get(); - _source->prev.window = 0; - - /* Default Accepted Action: move */ - _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE; - _source->accepted_action = XCB_NONE; - _source->dest = XCB_NONE; - - return EINA_TRUE; -} - -static Eina_Bool -_ecore_x_dnd_drop(Eina_Bool self) -{ - xcb_client_message_event_t ev; - Eina_Bool status = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - if (_source->dest) - { - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = _source->dest; - - if (_source->will_accept) - { - ev.type = ECORE_X_ATOM_XDND_DROP; - ev.data.data32[0] = _source->win; - ev.data.data32[1] = 0; - ev.data.data32[2] = _source->time; - - xcb_send_event(_ecore_xcb_conn, 0, _source->dest, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - _source->state = ECORE_X_DND_SOURCE_DROPPED; - status = EINA_TRUE; - } - else - { - ev.type = ECORE_X_ATOM_XDND_LEAVE; - ev.data.data32[0] = _source->win; - ev.data.data32[1] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, _source->dest, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - _source->state = ECORE_X_DND_SOURCE_IDLE; - } - } - else - { - ecore_x_selection_xdnd_clear(); - _source->state = ECORE_X_DND_SOURCE_IDLE; - } - - if (!self) ecore_x_window_ignore_set(_source->win, 0); - _source->prev.window = 0; - - return status; -} - -EAPI Eina_Bool -ecore_x_dnd_begin(Ecore_X_Window source, - unsigned char *data, - int size) -{ - return _ecore_x_dnd_begin(source, EINA_FALSE, data, size); -} - -EAPI Eina_Bool -ecore_x_dnd_drop(void) -{ - return _ecore_x_dnd_drop(EINA_FALSE); -} - -EAPI Eina_Bool -ecore_x_dnd_self_begin(Ecore_X_Window source, - unsigned char *data, - int size) -{ - return _ecore_x_dnd_begin(source, EINA_TRUE, data, size); -} - -EAPI Eina_Bool -ecore_x_dnd_self_drop(void) -{ - return _ecore_x_dnd_drop(EINA_TRUE); -} - -EAPI void -ecore_x_dnd_send_finished(void) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (_target->state == ECORE_X_DND_TARGET_IDLE) return; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.type = ECORE_X_ATOM_XDND_FINISHED; - ev.window = _target->source; - ev.data.data32[0] = _target->win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - if (_target->will_accept) - { - ev.data.data32[1] |= 0x1UL; - ev.data.data32[2] = _target->accepted_action; - } - - xcb_send_event(_ecore_xcb_conn, 0, _target->source, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - _target->state = ECORE_X_DND_TARGET_IDLE; -} - -EAPI void -ecore_x_dnd_source_action_set(Ecore_X_Atom action) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _source->action = action; - if (_source->prev.window) - _ecore_xcb_dnd_drag(_source->prev.window, - _source->prev.x, _source->prev.y); -} - -Ecore_X_DND_Source * -_ecore_xcb_dnd_source_get(void) -{ - return _source; -} - -Ecore_X_DND_Target * -_ecore_xcb_dnd_target_get(void) -{ - return _target; -} - -void -_ecore_xcb_dnd_drag(Ecore_X_Window root, - int x, - int y) -{ - xcb_client_message_event_t ev; - Ecore_X_Window win, *skip; - Ecore_X_Xdnd_Position pos; - int num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (_source->state != ECORE_X_DND_SOURCE_DRAGGING) return; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - - skip = ecore_x_window_ignore_list(&num); - win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, skip, num); - while ((win) && !(ecore_x_dnd_version_get(win))) - win = ecore_x_window_shadow_parent_get(root, win); - - if ((_source->dest) && (win != _source->dest)) - { - ev.window = _source->dest; - ev.type = ECORE_X_ATOM_XDND_LEAVE; - ev.data.data32[0] = _source->win; - ev.data.data32[1] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, _source->dest, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - _source->suppress = 0; - } - - if (win) - { - int x1, x2, y1, y2; - - _source->version = MIN(ECORE_X_DND_VERSION, - ecore_x_dnd_version_get(win)); - if (win != _source->dest) - { - int i = 0; - unsigned char *data; - Ecore_X_Atom *types; - - ecore_x_window_prop_property_get(_source->win, - ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, - &data, &num); - types = (Ecore_X_Atom *)data; - ev.window = win; - ev.type = ECORE_X_ATOM_XDND_ENTER; - ev.data.data32[0] = _source->win; - ev.data.data32[1] = 0; - if (num > 3) - ev.data.data32[1] |= 0x1UL; - else - ev.data.data32[1] &= 0xfffffffeUL; - ev.data.data32[1] |= ((unsigned long)_source->version) << 24; - - for (i = 2; i < 5; i++) - ev.data.data32[i] = 0; - for (i = 0; i < MIN(num, 3); ++i) - ev.data.data32[i + 2] = types[i]; - free(data); - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - _source->await_status = 0; - _source->will_accept = 0; - } - - x1 = _source->rectangle.x; - x2 = _source->rectangle.x + _source->rectangle.width; - y1 = _source->rectangle.y; - y2 = _source->rectangle.y + _source->rectangle.height; - - if ((!_source->await_status) || (!_source->suppress) || - ((x < x1) || (x > x2) || (y < y1) || (y > y2))) - { - ev.window = win; - ev.type = ECORE_X_ATOM_XDND_POSITION; - ev.data.data32[0] = _source->win; - ev.data.data32[1] = 0; - ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); - ev.data.data32[3] = _source->time; - ev.data.data32[4] = _source->action; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - _source->await_status = 1; - } - } - - if (_posupdatecb) - { - pos.position.x = x; - pos.position.y = y; - pos.win = win; - pos.prev = _source->dest; - _posupdatecb(_posupdatedata, &pos); - } - - _source->prev.x = x; - _source->prev.y = y; - _source->prev.window = root; - _source->dest = win; -} - -EAPI Ecore_X_Atom -ecore_x_dnd_source_action_get(void) -{ - return _source->action; -} - -/* local functions */ -static Eina_Bool -_ecore_xcb_dnd_converter_copy(char *target EINA_UNUSED, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *tprop EINA_UNUSED, - int *count EINA_UNUSED) -{ - Ecore_Xcb_Textproperty text_prop; - Ecore_Xcb_Encoding_Style style = XcbTextStyle; - char *mystr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!data) || (!size)) return EINA_FALSE; - - mystr = calloc(1, size + 1); - if (!mystr) return EINA_FALSE; - - memcpy(mystr, data, size); - if (_ecore_xcb_mb_textlist_to_textproperty(&mystr, 1, style, &text_prop)) - { - int len; - - len = strlen((char *)text_prop.value) + 1; - if (!(*data_ret = malloc(len))) - { - free(mystr); - return EINA_FALSE; - } - memcpy(*data_ret, text_prop.value, len); - *size_ret = len; - free(text_prop.value); - free(mystr); - return EINA_TRUE; - } - else - { - free(mystr); - return EINA_FALSE; - } -} - -EAPI Eina_Bool -ecore_x_dnd_abort(Ecore_X_Window xwin_source) -{ - if (xwin_source == _source->win) - { - _source->will_accept = 0; - return ecore_x_dnd_self_drop(); - } - else return EINA_FALSE; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_dpms.c b/src/lib/ecore_x/xcb/ecore_xcb_dpms.c deleted file mode 100644 index 95360e3..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_dpms.c +++ /dev/null @@ -1,354 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_DAMAGE -# include -#endif - -/* local variables */ -static Eina_Bool _dpms_avail = EINA_FALSE; - -void -_ecore_xcb_dpms_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_DPMS - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_dpms_id); -#endif -} - -void -_ecore_xcb_dpms_finalize(void) -{ -#ifdef ECORE_XCB_DPMS - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_DPMS - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_dpms_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_dpms_get_version_cookie_t cookie; - xcb_dpms_get_version_reply_t *reply; - - cookie = - xcb_dpms_get_version_unchecked(_ecore_xcb_conn, - XCB_DPMS_MAJOR_VERSION, - XCB_DPMS_MINOR_VERSION); - reply = xcb_dpms_get_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if (reply->server_major_version >= 1) - _dpms_avail = EINA_TRUE; - free(reply); - } - } -#endif -} - -/** - * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions - * @ingroup Ecore_X_Group - * - * Functions related to the X DPMS Extension - */ - -/** - * Checks if the DPMS extension is available or not. - * - * @return @c EINA_TRUE if the DPMS extension is available, - * @c EINA_FALSE otherwise. - * - * Return @c EINA_TRUE if the X server supports the DPMS Extension version 1.0, - * @c EINA_FALSE otherwise. - * - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_query(void) -{ -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _dpms_avail; -} - -/** - * Checks if the X server is capable of DPMS. - * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_capable_get(void) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_DPMS - xcb_dpms_capable_cookie_t cookie; - xcb_dpms_capable_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_dpms_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_DPMS - cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn); - reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - ret = reply->capable; - free(reply); - } -#endif - - return ret; -} - -/** - * Checks the DPMS state of the display. - * @return @c EINA_TRUE if DPMS is enabled, @c EINA_FALSE otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_enabled_get(void) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_DPMS - xcb_dpms_info_cookie_t cookie; - xcb_dpms_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_dpms_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_DPMS - cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn); - reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - if (reply->state) ret = EINA_TRUE; - free(reply); -#endif - - return ret; -} - -/** - * Sets the DPMS state of the display. - * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_enabled_set(int enabled) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_dpms_avail) return; - -#ifdef ECORE_XCB_DPMS - if (enabled) - xcb_dpms_enable(_ecore_xcb_conn); - else - xcb_dpms_disable(_ecore_xcb_conn); -#endif -} - -/** - * Gets the timeouts. The values are in unit of seconds. - * @param standby Amount of time of inactivity before standby mode will be invoked. - * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. - * @param off Amount of time of inactivity before the monitor is shut off. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_timeouts_get(unsigned int *standby, - unsigned int *suspend, - unsigned int *off) -{ -#ifdef ECORE_XCB_DPMS - xcb_dpms_get_timeouts_cookie_t cookie; - xcb_dpms_get_timeouts_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (standby) *standby = 0; - if (suspend) *suspend = 0; - if (off) *off = 0; - - if (!_dpms_avail) return; - -#ifdef ECORE_XCB_DPMS - cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn); - reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - if (standby) *standby = reply->standby_timeout; - if (suspend) *suspend = reply->suspend_timeout; - if (off) *off = reply->off_timeout; - free(reply); -#endif -} - -/** - * Sets the timeouts. The values are in unit of seconds. - * - * @param standby Amount of time of inactivity before standby mode will be invoked. - * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. - * @param off Amount of time of inactivity before the monitor is shut off. - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_timeouts_set(unsigned int standby, - unsigned int suspend, - unsigned int off) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_dpms_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_DPMS - // FIXME: Add request check - xcb_dpms_set_timeouts(_ecore_xcb_conn, standby, suspend, off); - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - -/** - * Returns the amount of time of inactivity before standby mode is invoked. - * @return The standby timeout value. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI unsigned int -ecore_x_dpms_timeout_standby_get(void) -{ - unsigned int standby = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_dpms_timeouts_get(&standby, NULL, NULL); - return standby; -} - -/** - * Returns the amount of time of inactivity before the second level of - * power saving is invoked. - * @return The suspend timeout value. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI unsigned int -ecore_x_dpms_timeout_suspend_get(void) -{ - unsigned int suspend = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_dpms_timeouts_get(NULL, &suspend, NULL); - return suspend; -} - -/** - * Returns the amount of time of inactivity before the third and final - * level of power saving is invoked. - * @return The off timeout value. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI unsigned int -ecore_x_dpms_timeout_off_get(void) -{ - unsigned int off = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_dpms_timeouts_get(NULL, NULL, &off); - return off; -} - -/** - * Sets the standby timeout (in unit of seconds). - * @param new_timeout Amount of time of inactivity before standby mode will be invoked. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_timeout_standby_set(unsigned int new_timeout) -{ - unsigned int standby = 0, suspend = 0, off = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_dpms_timeouts_get(&standby, &suspend, &off); - ecore_x_dpms_timeouts_set(new_timeout, suspend, off); -} - -/** - * Sets the suspend timeout (in unit of seconds). - * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout) -{ - unsigned int standby = 0, suspend = 0, off = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_dpms_timeouts_get(&standby, &suspend, &off); - ecore_x_dpms_timeouts_set(standby, new_timeout, off); -} - -/** - * Sets the off timeout (in unit of seconds). - * @param new_timeout Amount of time of inactivity before the monitor is shut off. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_timeout_off_set(unsigned int new_timeout) -{ - unsigned int standby = 0, suspend = 0, off = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_dpms_timeouts_get(&standby, &suspend, &off); - ecore_x_dpms_timeouts_set(standby, suspend, new_timeout); -} - -/** - * Check the DPMS power level. - * @return @c 0 if DPMS is :In Use - * @return @c 1 if DPMS is :Blanked, low power - * @return @c 2 if DPMS is :Blanked, lower power - * @return @c 3 if DPMS is :Shut off, awaiting activity - * @return @c -1 otherwise. -*/ -EAPI Ecore_X_Dpms_Mode -ecore_x_dpms_power_level_get(void) -{ - Ecore_X_Dpms_Mode ret = -1; -#ifdef ECORE_XCB_DPMS - xcb_dpms_info_cookie_t cookie; - xcb_dpms_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_dpms_avail) return ret; - -#ifdef ECORE_XCB_DPMS - cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn); - reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return -1; - - ret = reply->power_level; - free(reply); -#endif - - return ret; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_drawable.c b/src/lib/ecore_x/xcb/ecore_xcb_drawable.c deleted file mode 100644 index 30bb880..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_drawable.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "ecore_xcb_private.h" - -/** - * @defgroup Ecore_X_Drawable_Group X Drawable Functions - * @ingroup Ecore_X_Group - * - * Functions that operate on drawables. - */ - -/** - * Fill the specified rectangle on a drawable. - * @param d The given drawable. - * @param gc The graphic context that controls the fill rules. - * @param x The X coordinate of the top-left corner of the rectangle. - * @param y The Y coordinate of the top-left corner of the rectangle. - * @param width The width of the rectangle. - * @param height The height of the rectangle. - */ -EAPI void -ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw, - Ecore_X_GC gc, - int x, - int y, - int w, - int h) -{ - xcb_rectangle_t rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_poly_fill_rectangle(_ecore_xcb_conn, draw, gc, 1, - (const xcb_rectangle_t *)&rect); -// ecore_x_flush(); -} - -/** - * Retrieves the geometry of the given drawable. - * @param d The given drawable. - * @param x Pointer to an integer into which the X position is to be stored. - * @param y Pointer to an integer into which the Y position is to be stored. - * @param w Pointer to an integer into which the width is to be stored. - * @param h Pointer to an integer into which the height is to be stored. - * @ingroup Ecore_X_Drawable_Group - */ -EAPI void -ecore_x_drawable_geometry_get(Ecore_X_Drawable draw, - int *x, - int *y, - int *w, - int *h) -{ - xcb_get_geometry_cookie_t cookie; - xcb_get_geometry_reply_t *reply; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, draw); - reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - if (x) *x = reply->x; - if (y) *y = reply->y; - if (w) *w = (int)reply->width; - if (h) *h = (int)reply->height; - free(reply); -} - -/** - * Retrieves the width of the border of the given drawable. - * @param d The given drawable. - * @return The border width of the given drawable. - * @ingroup Ecore_X_Drawable_Group - */ -EAPI int -ecore_x_drawable_border_width_get(Ecore_X_Drawable d) -{ - xcb_get_geometry_cookie_t cookie; - xcb_get_geometry_reply_t *reply; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, d); - reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - ret = (int)reply->border_width; - free(reply); - return ret; -} - -/** - * Retrieves the depth of the given drawable. - * @param d The given drawable. - * @return The depth of the given drawable. - * @ingroup Ecore_X_Drawable_Group - */ -EAPI int -ecore_x_drawable_depth_get(Ecore_X_Drawable d) -{ - xcb_get_geometry_cookie_t cookie; - xcb_get_geometry_reply_t *reply; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, d); - reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - ret = (int)reply->depth; - free(reply); - return ret; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_e.c b/src/lib/ecore_x/xcb/ecore_xcb_e.c deleted file mode 100644 index 15bd726..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_e.c +++ /dev/null @@ -1,2266 +0,0 @@ -#include "ecore_xcb_private.h" - -/* local function prototypes */ -static Ecore_X_Atom _ecore_xcb_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state); -static Ecore_X_Virtual_Keyboard_State _ecore_xcb_e_vkbd_state_get(Ecore_X_Atom atom); -static Ecore_X_Atom _ecore_xcb_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state); -static Ecore_X_Illume_Quickpanel_State _ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom); -static Ecore_X_Atom _ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode); -static Ecore_X_Illume_Mode _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom); -static Ecore_X_Atom _ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state); -static Ecore_X_Illume_Indicator_State _ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom); - -EAPI void -ecore_x_e_init(void) -{ -} - -EAPI void -ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, - Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; - ev.data.data32[0] = win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, - Ecore_X_Window win, - int w, - int h) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; - ev.data.data32[0] = win; - ev.data.data32[1] = 1; - ev.data.data32[2] = w; - ev.data.data32[3] = h; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, - Ecore_X_Sync_Counter counter) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (counter) - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER, - ECORE_X_ATOM_CARDINAL, &counter, 1); - else - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER); -} - -EAPI Ecore_X_Sync_Counter -ecore_x_e_comp_sync_counter_get(Ecore_X_Window win) -{ - Ecore_X_Sync_Counter counter = 0; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER, - ECORE_X_ATOM_CARDINAL, &counter, 1); - if (ret != 1) return 0; - return counter; -} - -EAPI Eina_Bool -ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) -{ - Ecore_X_Window win, win2; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - ret = - ecore_x_window_prop_xid_get(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - if ((ret == 1) && (win)) - { - ret = - ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win2, 1); - if ((ret == 1) && (win2 == win)) - return EINA_TRUE; - } - return EINA_FALSE; -} - -/* - * @since 1.3 - * @deprecated use ecore_x_e_window_available_profiles_set - */ -EAPI void -ecore_x_e_window_profile_list_set(Ecore_X_Window win, - const char **profiles, - unsigned int num_profiles) -{ - Ecore_X_Atom *atoms; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) - return; - - if ((!profiles) || (num_profiles <= 0)) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST); - else - { - atoms = alloca(num_profiles * sizeof(Ecore_X_Atom)); - ecore_x_atoms_get(profiles, num_profiles, atoms); - ecore_x_window_prop_property_set(win, - ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST, - ECORE_X_ATOM_ATOM, 32, (void *)atoms, - num_profiles); - } -} - -/* - * @since 1.3 - * @deprecated use ecore_x_e_window_available_profiles_get - */ -EAPI Eina_Bool -ecore_x_e_window_profile_list_get(Ecore_X_Window win, - const char ***profiles, - int *ret_num) -{ - unsigned char *data = NULL; - Ecore_X_Atom *atoms; - int num, i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (ret_num) - *ret_num = 0; - - if (profiles) - *profiles = NULL; - - if (!win) - return EINA_FALSE; - - if (!ecore_x_window_prop_property_get(win, - ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST, - ECORE_X_ATOM_ATOM, 32, &data, &num)) - return EINA_FALSE; - - if (ret_num) - *ret_num = num; - - if (profiles) - { - (*profiles) = calloc(num, sizeof(char *)); - if (!(*profiles)) - { - if (ret_num) - *ret_num = 0; - - if (data) - free(data); - - return EINA_FALSE; - } - - atoms = (Ecore_X_Atom *)data; - for (i = 0; i < num; i++) - (*profiles)[i] = ecore_x_atom_name_get(atoms[i]); - } - - if (data) - free(data); - - return EINA_TRUE; -} - -EAPI void -ecore_x_e_window_profile_set(Ecore_X_Window win, - const char *profile) -{ - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) - return; - - if (!profile) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_WINDOW_PROFILE); - else - { - atom = ecore_x_atom_get(profile); - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_E_WINDOW_PROFILE, - ECORE_X_ATOM_ATOM, 32, (void *)&atom, 1); - } -} - -EAPI char * -ecore_x_e_window_profile_get(Ecore_X_Window win) -{ - Ecore_X_Atom *atom = NULL; - unsigned char *data; - char *profile = NULL; - int num; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_E_WINDOW_PROFILE, - ECORE_X_ATOM_ATOM, 32, &data, &num)) - { - if (data) - free(data); - return NULL; - } - - if (data) - atom = (Ecore_X_Atom *)data; - - if (atom) - profile = ecore_x_atom_name_get(atom[0]); - - if (data) free(data); - - return profile; -} - -EAPI void -ecore_x_e_window_profile_supported_set(Ecore_X_Window root, - Eina_Bool enabled) -{ - Ecore_X_Window win; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (enabled) - { - win = ecore_x_window_new(root, 1, 2, 3, 4); - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - } - else - { - int ret = 0; - - ret = ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - if ((ret == 1) && (win)) - { - ecore_x_window_prop_property_del(root, - ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED); - ecore_x_window_free(win); - } - } -} - -EAPI Eina_Bool -ecore_x_e_window_profile_supported_get(Ecore_X_Window root) -{ - Ecore_X_Window win, win2; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ret = - ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win, 1); - if ((ret == 1) && (win)) - { - ret = - ecore_x_window_prop_xid_get(win, - ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win2, 1); - if ((ret == 1) && (win2 == win)) - return EINA_TRUE; - } - return EINA_FALSE; -} - -EAPI void -ecore_x_e_window_available_profiles_set(Ecore_X_Window win, - const char **profiles, - unsigned int count) -{ - Ecore_X_Atom *atoms; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) - return; - - if ((!profiles) || (count <= 0)) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST); - else - { - atoms = alloca(count * sizeof(Ecore_X_Atom)); - ecore_x_atoms_get(profiles, count, atoms); - ecore_x_window_prop_property_set(win, - ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST, - ECORE_X_ATOM_ATOM, 32, (void *)atoms, - count); - } -} - -EAPI Eina_Bool -ecore_x_e_window_available_profiles_get(Ecore_X_Window win, - const char ***profiles, - int *count) -{ - unsigned char *data = NULL; - Ecore_X_Atom *atoms; - int num, i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (count) - *count = 0; - - if (profiles) - *profiles = NULL; - - if (!win) - return EINA_FALSE; - - if (!ecore_x_window_prop_property_get(win, - ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST, - ECORE_X_ATOM_ATOM, 32, &data, &num)) - return EINA_FALSE; - - if (count) - *count = num; - - if (profiles) - { - (*profiles) = calloc(num, sizeof(char *)); - if (!(*profiles)) - { - if (count) - *count = 0; - - if (data) - free(data); - - return EINA_FALSE; - } - - atoms = (Ecore_X_Atom *)data; - for (i = 0; i < num; i++) - (*profiles)[i] = ecore_x_atom_name_get(atoms[i]); - } - - if (data) - free(data); - - return EINA_TRUE; -} - -EAPI void -ecore_x_e_window_profile_change_send(Ecore_X_Window root, - Ecore_X_Window win, - const char *profile) -{ - xcb_client_message_event_t ev; - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (!win) - return; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - atom = ecore_x_atom_get(profile); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE; - ev.data.data32[0] = win; - ev.data.data32[1] = atom; - ev.data.data32[2] = 0; // later - ev.data.data32[3] = 0; // later - ev.data.data32[4] = 0; // later - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), - (const char *)&ev); -} - -EAPI void -ecore_x_e_window_profile_change_request_send(Ecore_X_Window win, - const char *profile) -{ - xcb_client_message_event_t ev; - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) - return; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - atom = ecore_x_atom_get(profile); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_REQUEST; - ev.data.data32[0] = win; - ev.data.data32[1] = atom; - ev.data.data32[2] = 0; // later - ev.data.data32[3] = 0; // later - ev.data.data32[4] = 0; // later - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, - (const char *)&ev); -} - -EAPI void -ecore_x_e_window_profile_change_done_send(Ecore_X_Window root, - Ecore_X_Window win, - const char *profile) -{ - xcb_client_message_event_t ev; - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (!win) - return; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - atom = ecore_x_atom_get(profile); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE; - ev.data.data32[0] = win; - ev.data.data32[1] = atom; - ev.data.data32[2] = 0; // later - ev.data.data32[3] = 0; // later - ev.data.data32[4] = 0; // later - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), - (const char *)&ev); -} - -EAPI void -ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, - Eina_Bool enabled) -{ - Ecore_X_Window win; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - if (enabled) - { - win = ecore_x_window_new(root, 1, 2, 3, 4); - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - } - else - { - int ret = 0; - - ret = ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - if ((ret == 1) && (win)) - { - ecore_x_window_prop_property_del(root, - ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED); - ecore_x_window_free(win); - } - } -} - -EAPI void -ecore_x_e_comp_sync_begin_send(Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_SYNC_BEGIN; - ev.data.data32[0] = win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_sync_end_send(Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_SYNC_END; - ev.data.data32[0] = win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_SYNC_CANCEL; - ev.data.data32[0] = win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_flush_send(Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_FLUSH; - ev.data.data32[0] = win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_dump_send(Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_COMP_DUMP; - ev.data.data32[0] = win; - ev.data.data32[1] = 0; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_e_comp_pixmap_set(Ecore_X_Window win, - Ecore_X_Pixmap pixmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (pixmap) - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP, - ECORE_X_ATOM_PIXMAP, &pixmap, 1); - else - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_PIXMAP); -} - -EAPI Ecore_X_Pixmap -ecore_x_e_comp_pixmap_get(Ecore_X_Window win) -{ - Ecore_X_Pixmap pixmap = 0; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_PIXMAP, - ECORE_X_ATOM_PIXMAP, &pixmap, 1); - if (ret != 1) return 0; - return pixmap; -} - -EAPI void -ecore_x_e_frame_size_set(Ecore_X_Window win, - int fl, - int fr, - int ft, - int fb) -{ - uint32_t frames[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - frames[0] = fl; - frames[1] = fr; - frames[2] = ft; - frames[3] = fb; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4); -} - -EAPI Ecore_X_Virtual_Keyboard_State -ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, - &atom, 1)) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; - - return _ecore_xcb_e_vkbd_state_get(atom); -} - -EAPI void -ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, - Ecore_X_Virtual_Keyboard_State state) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - atom = _ecore_xcb_e_vkbd_atom_get(state); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, - &atom, 1); -} - -EAPI void -ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, - Ecore_X_Virtual_Keyboard_State state) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_xcb_e_vkbd_atom_get(state), - 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, - unsigned int is_keyboard) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, - &is_keyboard, 1); -} - -EAPI Eina_Bool -ecore_x_e_virtual_keyboard_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, - &val, 1)) - return EINA_FALSE; - - return val ? EINA_TRUE : EINA_FALSE; -} - -EAPI int -ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, - &val, 1)) - return 0; - - return val; -} - -EAPI void -ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, - unsigned int priority) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, - &priority, 1); -} - -EAPI int -ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, - &val, 1)) - return 0; - - return val; -} - -EAPI void -ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, - unsigned int priority) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, - &priority, 1); -} - -EAPI void -ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, - unsigned int zone) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, - &zone, 1); -} - -EAPI int -ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, - &val, 1)) - return 0; - - return val; -} - -EAPI void -ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI Eina_Bool -ecore_x_e_illume_conformant_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, - &val, 1)) - return EINA_FALSE; - - return val ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_e_illume_conformant_set(Ecore_X_Window win, - unsigned int is_conformant) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, - &is_conformant, 1); -} - -EAPI void -ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - geom[0] = x; - geom[1] = y; - geom[2] = w; - geom[3] = h; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, - geom, 4); -} - -EAPI Eina_Bool -ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - - if (ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, - geom, 4) != 4) - return EINA_FALSE; - - if (x) *x = geom[0]; - if (y) *y = geom[1]; - if (w) *w = geom[2]; - if (h) *h = geom[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - geom[0] = x; - geom[1] = y; - geom[2] = w; - geom[3] = h; - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, - geom, 4); -} - -EAPI Eina_Bool -ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - - if (ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, - geom, 4) != 4) - return EINA_FALSE; - - if (x) *x = geom[0]; - if (y) *y = geom[1]; - if (w) *w = geom[2]; - if (h) *h = geom[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - geom[0] = x; - geom[1] = y; - geom[2] = w; - geom[3] = h; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, - geom, 4); -} - -EAPI Eina_Bool -ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - - if (ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, - geom, 4) != 4) - return EINA_FALSE; - - if (x) *x = geom[0]; - if (y) *y = geom[1]; - if (w) *w = geom[2]; - if (h) *h = geom[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, - unsigned int is_quickpanel) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, - &is_quickpanel, 1); -} - -EAPI Eina_Bool -ecore_x_e_illume_quickpanel_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, - &val, 1)) - return EINA_FALSE; - - return val ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, - Ecore_X_Illume_Quickpanel_State state) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - atom = _ecore_xcb_e_quickpanel_atom_get(state); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, - &atom, 1); -} - -EAPI Ecore_X_Illume_Quickpanel_State -ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_atom_get(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, - &atom, 1)) - return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; - - return _ecore_xcb_e_quickpanel_state_get(atom); -} - -EAPI void -ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, - Ecore_X_Illume_Quickpanel_State state) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_xcb_e_quickpanel_atom_get(state), - 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 0, 0, 0, 0, 0); -} - -static Ecore_X_Atom -_ecore_xcb_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state) -{ - switch (state) - { - case ECORE_X_ILLUME_CLIPBOARD_STATE_ON: - return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON; - case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF: - return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF; - default: - break; - } - return 0; -} - -static Ecore_X_Illume_Clipboard_State -_ecore_xcb_e_clipboard_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON) - return ECORE_X_ILLUME_CLIPBOARD_STATE_ON; - - if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF) - return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF; - - return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN; -} - -EAPI void -ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win, - Ecore_X_Illume_Clipboard_State state) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = _ecore_xcb_e_clipboard_atom_get(state); - - ecore_x_window_prop_atom_set(win, - ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE, - &atom, 1); -} - -EAPI Ecore_X_Illume_Clipboard_State -ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_atom_get(win, - ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE, - &atom, 1)) - return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN; - return _ecore_xcb_e_clipboard_state_get(atom); -} - -EAPI void -ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win, - int x, int y, int w, int h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - geom[0] = x; - geom[1] = y; - geom[2] = w; - geom[3] = h; - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, - geom, 4); -} - -EAPI Eina_Bool -ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win, - int *x, int *y, int *w, int *h) -{ - int ret = 0; - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = - ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, - geom, 4); - if (ret != 4) return EINA_FALSE; - - if (x) *x = geom[0]; - if (y) *y = geom[1]; - if (w) *w = geom[2]; - if (h) *h = geom[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_e_illume_mode_set(Ecore_X_Window win, - Ecore_X_Illume_Mode mode) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - atom = _ecore_xcb_e_illume_atom_get(mode); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1); -} - -EAPI Ecore_X_Illume_Mode -ecore_x_e_illume_mode_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1)) - return ECORE_X_ILLUME_MODE_UNKNOWN; - - return _ecore_xcb_e_illume_mode_get(atom); -} - -EAPI void -ecore_x_e_illume_mode_send(Ecore_X_Window win, - Ecore_X_Illume_Mode mode) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_xcb_e_illume_atom_get(mode), - 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_focus_back_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_focus_forward_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_focus_home_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_close_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_home_new_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_home_del_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_next_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_prev_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_activate_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_over_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_OVER, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_read_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_read_next_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_read_prev_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_up_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_access_action_down_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - win, - ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN, - 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_drag_set(Ecore_X_Window win, - unsigned int drag) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1); -} - -EAPI void -ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, - unsigned int is_locked) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, - &is_locked, 1); -} - -EAPI Eina_Bool -ecore_x_e_illume_drag_locked_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, - &val, 1)) - return EINA_FALSE; - - return val ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_e_illume_drag_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG, &val, 1)) - return EINA_FALSE; - - return val ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_e_illume_drag_start_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_drag_end_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_zone_set(Ecore_X_Window win, - Ecore_X_Window zone) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE, &zone, 1); -} - -EAPI Ecore_X_Window -ecore_x_e_illume_zone_get(Ecore_X_Window win) -{ - Ecore_X_Window zone = 0; - int ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE, - &zone, 1); - if ((ret == 0) || (ret == -1)) - return 0; - - return zone; -} - -EAPI void -ecore_x_e_illume_zone_list_set(Ecore_X_Window win, - Ecore_X_Window *zones, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST, - zones, num); -} - -/* local functions */ -static Ecore_X_Atom -_ecore_xcb_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state) -{ - switch (state) - { - case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME; - - default: - break; - } - return 0; -} - -static Ecore_X_Virtual_Keyboard_State -_ecore_xcb_e_vkbd_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD; - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME; - - return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_xcb_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state) -{ - switch (state) - { - case ECORE_X_ILLUME_QUICKPANEL_STATE_ON: - return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON; - - case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF: - return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF; - - default: - break; - } - return 0; -} - -static Ecore_X_Illume_Quickpanel_State -_ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON) - return ECORE_X_ILLUME_QUICKPANEL_STATE_ON; - if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF) - return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF; - - return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode) -{ - switch (mode) - { - case ECORE_X_ILLUME_MODE_SINGLE: - return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE; - - case ECORE_X_ILLUME_MODE_DUAL_TOP: - return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP; - - case ECORE_X_ILLUME_MODE_DUAL_LEFT: - return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT; - - default: - break; - } - return ECORE_X_ILLUME_MODE_UNKNOWN; -} - -static Ecore_X_Illume_Mode -_ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE) - return ECORE_X_ILLUME_MODE_SINGLE; - if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP) - return ECORE_X_ILLUME_MODE_DUAL_TOP; - if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT) - return ECORE_X_ILLUME_MODE_DUAL_LEFT; - - return ECORE_X_ILLUME_MODE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state) -{ - switch (state) - { - case ECORE_X_ILLUME_INDICATOR_STATE_ON: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON; - - case ECORE_X_ILLUME_INDICATOR_STATE_OFF: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF; - - default: - break; - } - return 0; -} - -static Ecore_X_Illume_Indicator_State -_ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON) - return ECORE_X_ILLUME_INDICATOR_STATE_ON; - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF) - return ECORE_X_ILLUME_INDICATOR_STATE_OFF; - - return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; -} - -EAPI void -ecore_x_e_illume_indicator_state_set(Ecore_X_Window win, - Ecore_X_Illume_Indicator_State state) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - atom = _ecore_xcb_e_indicator_atom_get(state); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, - &atom, 1); -} - -EAPI Ecore_X_Illume_Indicator_State -ecore_x_e_illume_indicator_state_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_atom_get(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, - &atom, 1)) - return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; - - return _ecore_xcb_e_indicator_state_get(atom); -} - -EAPI void -ecore_x_e_illume_indicator_state_send(Ecore_X_Window win, - Ecore_X_Illume_Indicator_State state) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_xcb_e_indicator_atom_get(state), - 0, 0, 0, 0); -} - -static Ecore_X_Atom -_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode) -{ - switch (mode) - { - case ECORE_X_ILLUME_INDICATOR_OPAQUE: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE; - - case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT; - - case ECORE_X_ILLUME_INDICATOR_TRANSPARENT: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT; - - default: - break; - } - return 0; -} - -static Ecore_X_Illume_Indicator_Opacity_Mode -_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE) - return ECORE_X_ILLUME_INDICATOR_OPAQUE; - - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT) - return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT; - - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT) - return ECORE_X_ILLUME_INDICATOR_TRANSPARENT; - - return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN; -} - -EAPI void -ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win, - Ecore_X_Illume_Indicator_Opacity_Mode mode) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = _ecore_x_e_indicator_opacity_atom_get(mode); - ecore_x_window_prop_atom_set(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, - &atom, 1); -} - -EAPI Ecore_X_Illume_Indicator_Opacity_Mode -ecore_x_e_illume_indicator_opacity_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_INDICATOR_OPACITY_MODE, - &atom, 1)) - return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN; - - return _ecore_x_e_indicator_opacity_get(atom); -} - -EAPI void -ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, - Ecore_X_Illume_Indicator_Opacity_Mode mode) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_x_e_indicator_opacity_atom_get(mode), - 0, 0, 0, 0); -} - -static Ecore_X_Atom -_ecore_x_e_indicator_type_atom_get(Ecore_X_Illume_Indicator_Type_Mode mode) -{ - switch (mode) - { - case ECORE_X_ILLUME_INDICATOR_TYPE_1: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1; - - case ECORE_X_ILLUME_INDICATOR_TYPE_2: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2; - - case ECORE_X_ILLUME_INDICATOR_TYPE_3: - return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_3; - - default: - break; - } - return 0; -} - -static Ecore_X_Illume_Indicator_Type_Mode -_ecore_x_e_indicator_type_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1) - return ECORE_X_ILLUME_INDICATOR_TYPE_1; - - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2) - return ECORE_X_ILLUME_INDICATOR_TYPE_2; - - if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_3) - return ECORE_X_ILLUME_INDICATOR_TYPE_3; - - return ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN; -} - -EAPI void -ecore_x_e_illume_indicator_type_set(Ecore_X_Window win, - Ecore_X_Illume_Indicator_Type_Mode mode) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = _ecore_x_e_indicator_type_atom_get(mode); - ecore_x_window_prop_atom_set(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, - &atom, 1); -} - -EAPI Ecore_X_Illume_Indicator_Type_Mode -ecore_x_e_illume_indicator_type_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_INDICATOR_TYPE_MODE, - &atom, 1)) - return ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN; - - return _ecore_x_e_indicator_type_get(atom); -} - -EAPI void -ecore_x_e_illume_indicator_type_send(Ecore_X_Window win, - Ecore_X_Illume_Indicator_Type_Mode mode) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_x_e_indicator_type_atom_get(mode), - 0, 0, 0, 0); -} - -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_FLOATING: - return ECORE_X_ATOM_E_ILLUME_WINDOW_STATE_FLOATING; - - 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_FLOATING) - return ECORE_X_ILLUME_WINDOW_STATE_FLOATING; - - 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); -} - -EAPI void -ecore_x_e_illume_window_state_send(Ecore_X_Window win, - Ecore_X_Illume_Window_State state) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_ILLUME_WINDOW_STATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_x_e_illume_window_state_atom_get(state), - 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_window_rotation_supported_set(Ecore_X_Window root, - Eina_Bool enabled) -{ - Ecore_X_Window win; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (enabled) - { - win = ecore_x_window_new(root, 1, 2, 3, 4); - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - } - else - { - int ret; - - ret = - ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win, 1); - if ((ret == 1) && (win)) - { - ecore_x_window_prop_property_del( - root, - ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED); - ecore_x_window_free(win); - } - } -} - -EAPI Eina_Bool -ecore_x_e_window_rotation_supported_get(Ecore_X_Window root) -{ - Ecore_X_Window win, win2; - int ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ret = - ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win, 1); - if ((ret == 1) && (win)) - { - ret = - ecore_x_window_prop_xid_get(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win2, 1); - if ((ret == 1) && (win2 == win)) - return EINA_TRUE; - } - - return EINA_FALSE; -} - -EAPI void -ecore_x_e_window_rotation_app_set(Ecore_X_Window win, - Eina_Bool set) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (set) val = 1; - - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED, - &val, 1); -} - -EAPI Eina_Bool -ecore_x_e_window_rotation_app_get(Ecore_X_Window win) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_APP_SUPPORTED, - &val, 1)) - return EINA_FALSE; - - return val ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_e_window_rotation_preferred_rotation_set(Ecore_X_Window win, - int rot) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (rot != -1) - { - val = (unsigned int)rot; - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION, - &val, 1); - } - else - { - ecore_x_window_prop_property_del(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION); - } -} - -EAPI Eina_Bool -ecore_x_e_window_rotation_preferred_rotation_get(Ecore_X_Window win, - int *rot) -{ - unsigned int val = 0; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_ROTATION, - &val, 1); - if (ret == 1) - { - if (rot) *rot = (int)val; - return EINA_TRUE; - } - return EINA_FALSE; -} - -EAPI void -ecore_x_e_window_rotation_available_rotations_set(Ecore_X_Window win, - const int *rots, - unsigned int count) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!win) return; - - if ((rots) && (count > 0)) - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST, - (unsigned int *)rots, count); - else - ecore_x_window_prop_property_del(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST); -} - -EAPI Eina_Bool -ecore_x_e_window_rotation_available_rotations_get(Ecore_X_Window win, - int **rots, - unsigned int *count) -{ - unsigned char *data = NULL; - int num, i; - int *val = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!win) || (!rots) || (!count)) - return EINA_FALSE; - - *rots = NULL; - *count = 0; - - if (!ecore_x_window_prop_property_get(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST, - XCB_ATOM_CARDINAL, 32, &data, &num)) - return EINA_FALSE; - - *count = num; - - if ((num >= 1) && (data)) - { - val = calloc(num, sizeof(int)); - if (!val) - { - *count = 0; - if (data) free(data); - return EINA_FALSE; - } - for (i = 0; i < num; i++) - val[i] = ((int *)data)[i]; - if (data) free(data); - *rots = val; - return EINA_TRUE; - } - if (data) free(data); - return EINA_FALSE; -} - -EAPI void -ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win, - int rot, - Eina_Bool resize, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE, - ECORE_X_EVENT_MASK_NONE, - win, rot, resize, w, h); -} - -EAPI void -ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root, - Ecore_X_Window win, - int rot) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE; - ev.data.data32[0] = win; - ev.data.data32[1] = rot; - ev.data.data32[2] = 0; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -} - -EAPI void -ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win, - int rot) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST, - ECORE_X_EVENT_MASK_NONE, - win, rot, 0, 0, 0); -} - -EAPI void -ecore_x_e_window_rotation_change_done_send(Ecore_X_Window root, - Ecore_X_Window win, - int rot, - int w, - int h) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE; - ev.data.data32[0] = win; - ev.data.data32[1] = rot; - ev.data.data32[2] = w; - ev.data.data32[3] = h; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -} - -EAPI void -ecore_x_e_keyrouter_set(Ecore_X_Window win EINA_UNUSED, Eina_Bool on) -{ - Ecore_X_Window root; - unsigned int val; - - CHECK_XCB_CONN; - - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - val = (on) ? 1 : 0; - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_E_KEYROUTER_SUPPORTED, - &val, 1); -} - -EAPI Eina_Bool -ecore_x_e_keyrouter_get(Ecore_X_Window win EINA_UNUSED) -{ - Ecore_X_Window root; - int ret; - unsigned int val; - - CHECK_XCB_CONN; - - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - ret = - ecore_x_window_prop_card32_get(root, ECORE_X_ATOM_E_KEYROUTER_SUPPORTED, - &val, 1); - if (ret != 1) return EINA_FALSE; - return (val == 1) ? EINA_TRUE : EINA_FALSE; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_error.c b/src/lib/ecore_x/xcb/ecore_xcb_error.c deleted file mode 100644 index 166d5ee..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_error.c +++ /dev/null @@ -1,116 +0,0 @@ -#include "ecore_xcb_private.h" -#include - -/* local variables */ -static void (*_error_func)(void *data) = NULL; -static void *_error_data = NULL; -static void (*_io_error_func)(void *data) = NULL; -static void *_io_error_data = NULL; -static int _error_request_code = 0; -static int _error_code = 0; -static Ecore_X_ID _error_resource_id = 0; - -/** - * Set the error handler. - * @param func The error handler function - * @param data The data to be passed to the handler function - * - * Set the X error handler function - */ -EAPI void -ecore_x_error_handler_set(void (*func)(void *data), - const void *data) -{ - _error_func = func; - _error_data = (void *)data; -} - -/** - * Set the I/O error handler. - * @param func The I/O error handler function - * @param data The data to be passed to the handler function - * - * Set the X I/O error handler function - */ -EAPI void -ecore_x_io_error_handler_set(void (*func)(void *data), - const void *data) -{ - _io_error_func = func; - _io_error_data = (void *)data; -} - -/** - * Get the request code that caused the error. - * @return The request code causing the X error - * - * Return the X request code that caused the last X error - */ -EAPI int -ecore_x_error_request_get(void) -{ - return _error_request_code; -} - -/** - * Get the error code from the error. - * @return The error code from the X error - * - * Return the error code from the last X error - */ -EAPI int -ecore_x_error_code_get(void) -{ - return _error_code; -} - -/** - * 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) -{ - WRN("Got Error:"); - WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code)); - WRN("\tError: %s", xcb_event_get_error_label(err->error_code)); - - if (err->error_code == XCB_VALUE) - WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value); - else if (err->error_code == XCB_WINDOW) - WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value); - - _error_request_code = err->sequence; - _error_code = err->error_code; - _error_resource_id = err->resource_id; - if (_error_func) - _error_func(_error_data); - - return 0; -} - -int -_ecore_xcb_io_error_handle(xcb_generic_error_t *err) -{ - CRI("IO Error:"); - if (err) - { - CRI("\tRequest: %d", err->sequence); - CRI("\tCode: %d", err->error_code); - } - if (_io_error_func) - _io_error_func(_io_error_data); - else - exit(-1); - - return 0; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_events.c b/src/lib/ecore_x/xcb/ecore_xcb_events.c deleted file mode 100644 index c2c944e..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_events.c +++ /dev/null @@ -1,2831 +0,0 @@ -#include "ecore_xcb_private.h" -//#include "Ecore_X_Atoms.h" -#include -#include -#include -# ifdef ECORE_XCB_DAMAGE -# include -# endif -# ifdef ECORE_XCB_RANDR -# include -# endif -# ifdef ECORE_XCB_SCREENSAVER -# include -# endif -# ifdef ECORE_XCB_SYNC -# include -# endif -# ifdef ECORE_XCB_XFIXES -# include -# endif -# ifdef ECORE_XCB_XPRESENT -# include -# endif -# ifdef ECORE_XCB_XGESTURE -# include -# endif - -#ifndef CODESET -# define CODESET "INVALID" -#endif - -typedef struct _Ecore_X_Mouse_Down_Info -{ - EINA_INLIST; - int dev; - Ecore_X_Time last_time; - Ecore_X_Time last_last_time; - Ecore_X_Window last_win; - Ecore_X_Window last_last_win; - Ecore_X_Window last_event_win; - Ecore_X_Window last_last_event_win; - Eina_Bool did_double : 1; - Eina_Bool did_triple : 1; -} Ecore_X_Mouse_Down_Info; - -/* local function prototypes */ -static void _ecore_xcb_event_handle_any_event(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_key_press(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_key_release(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_button_release(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_expose(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_map_request(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_selection_clear(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_damage_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event); -#ifdef ECORE_XCB_XGESTURE -static void _ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event); -#endif -#ifdef ECORE_XCB_SHAPE -static void _ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event); -#endif -static void _ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event EINA_UNUSED); -static void _ecore_xcb_event_handle_xfixes_cursor_notify(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event); -static void _ecore_xcb_event_handle_input_event(xcb_generic_event_t *event); - -static void _ecore_xcb_event_key_press(xcb_generic_event_t *event); -static void _ecore_xcb_event_key_release(xcb_generic_event_t *event); -static void _ecore_xcb_event_mouse_move_free(void *data EINA_UNUSED, - void *event); -static Ecore_X_Event_Mode _ecore_xcb_event_mode_get(uint8_t mode); -static Ecore_X_Event_Detail _ecore_xcb_event_detail_get(uint8_t detail); -static void _ecore_xcb_event_xdnd_enter_free(void *data EINA_UNUSED, - void *event); -static void _ecore_xcb_event_selection_notify_free(void *data EINA_UNUSED, - void *event); -static void _ecore_xcb_event_generic_event_free(void *data, - void *event); -static void _ecore_xcb_event_mouse_down_info_clear(void); -static Ecore_X_Mouse_Down_Info *_ecore_xcb_event_mouse_down_info_get(int dev); - -/* local variables */ -static Eina_Bool _ecore_xcb_event_last_mouse_move = EINA_FALSE; -//static Ecore_Event *_ecore_xcb_event_last_mouse_move_event = NULL; -static Eina_Inlist *_ecore_xcb_mouse_down_info_list = NULL; -static Ecore_X_Time _ecore_xcb_event_last_time; -static Ecore_X_Window _ecore_xcb_event_last_window = 0; - -/* public variables */ -int16_t _ecore_xcb_event_last_root_x = 0; -int16_t _ecore_xcb_event_last_root_y = 0; - -EAPI int ECORE_X_EVENT_ANY = 0; -EAPI int ECORE_X_EVENT_MOUSE_IN = 0; -EAPI int ECORE_X_EVENT_MOUSE_OUT = 0; -EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; -EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; -EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0; -EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0; -EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0; -EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0; -EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0; -EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0; -EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0; -EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0; -EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0; -EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0; -EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_STACK = 0; -EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0; -EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0; -EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0; -EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0; -EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0; -EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0; -EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0; -EAPI int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = 0; -EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0; -EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0; -EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = 0; -EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0; -EAPI int ECORE_X_EVENT_SYNC_ALARM = 0; -EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0; -EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0; -EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0; -EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0; -EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0; -EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; -EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; -EAPI int ECORE_X_EVENT_PING = 0; -EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0; -EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0; -EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0; -EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0; -EAPI int ECORE_X_EVENT_XKB_STATE_NOTIFY = 0; -EAPI int ECORE_X_EVENT_XKB_NEWKBD_NOTIFY = 0; -EAPI int ECORE_X_EVENT_GENERIC = 0; - -EAPI int ECORE_X_EVENT_PRESENT_CONFIGURE = 0; -EAPI int ECORE_X_EVENT_PRESENT_COMPLETE = 0; -EAPI int ECORE_X_EVENT_PRESENT_IDLE = 0; - -EAPI int ECORE_X_RAW_BUTTON_PRESS = 0; -EAPI int ECORE_X_RAW_BUTTON_RELEASE = 0; -EAPI int ECORE_X_RAW_MOTION = 0; - -void -_ecore_xcb_events_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ECORE_X_EVENT_ANY) - { - ECORE_X_EVENT_ANY = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new(); - ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); - ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new(); - ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); - ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new(); - ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_RANDR_CRTC_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_PING = ecore_event_type_new(); - ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new(); - ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new(); - ECORE_X_EVENT_XKB_STATE_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_XKB_NEWKBD_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_GENERIC = ecore_event_type_new(); - - ECORE_X_EVENT_PRESENT_CONFIGURE = ecore_event_type_new(); - ECORE_X_EVENT_PRESENT_COMPLETE = ecore_event_type_new(); - ECORE_X_EVENT_PRESENT_IDLE = ecore_event_type_new(); - - ECORE_X_RAW_BUTTON_PRESS = ecore_event_type_new(); - ECORE_X_RAW_BUTTON_RELEASE = ecore_event_type_new(); - ECORE_X_RAW_MOTION = ecore_event_type_new(); - } -} - -void -_ecore_xcb_events_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_event_mouse_down_info_clear(); - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -// if (_ecore_xcb_event_last_mouse_move_event) -// { -// ecore_event_del(_ecore_xcb_event_last_mouse_move_event); -// _ecore_xcb_event_last_mouse_move_event = NULL; -// } -} - -void -_ecore_xcb_events_handle(xcb_generic_event_t *ev) -{ - uint8_t response = 0; - -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - /* strip highest bit (set if event is generated) */ - response = (ev->response_type & ~0x80); - if (response == 0) - { - xcb_generic_error_t *err; - - err = (xcb_generic_error_t *)ev; - - /* NB: There is no way to check access of destroyed windows, - * so trap those cases and ignore. We also ignore BadValue from - * xcb_grab/ungrab_button (happens when we are using any_mod) - * and a few others */ - if (err->error_code == XCB_WINDOW) return; - else if (err->error_code == XCB_MATCH) - { - if ((err->major_code == XCB_SET_INPUT_FOCUS) || - (err->major_code == XCB_CONFIGURE_WINDOW)) - return; - } - else if (err->error_code == XCB_VALUE) - { - if ((err->major_code == XCB_KILL_CLIENT) || - (err->major_code == XCB_GRAB_BUTTON) || - (err->major_code == XCB_UNGRAB_BUTTON)) - return; - } - WRN("Got Event Error:"); - WRN("\tMajor Code: %d", err->major_code); - WRN("\tMinor Code: %d", err->minor_code); - WRN("\tRequest: %s", xcb_event_get_request_label(err->major_code)); - WRN("\tError: %s", xcb_event_get_error_label(err->error_code)); - if (err->error_code == 2) // bad value - WRN("\tValue: %d", ((xcb_value_error_t *)err)->bad_value); - else if (err->error_code == 8) // bad match - WRN("\tMatch: %d", ((xcb_match_error_t *)err)->bad_value); - - if (err->major_code == XCB_SEND_EVENT) - { - WRN("\tSend Event Error"); - WRN("\t\tSeq: %d", ev->sequence); - WRN("\t\tFull Seq: %d", ev->full_sequence); - WRN("\t\tType: %d", ev->response_type); - } - /* if (err->major_code == 148) */ - /* { */ - /* printf("GOT 148 Error\n"); */ - /* } */ - return; - } - - /* FIXME: Filter event for xim when xcb supports xim */ - - _ecore_xcb_event_handle_any_event(ev); - - if (response == XCB_KEY_PRESS) - _ecore_xcb_event_handle_key_press(ev); - else if (response == XCB_KEY_RELEASE) - _ecore_xcb_event_handle_key_release(ev); - else if (response == XCB_BUTTON_PRESS) - _ecore_xcb_event_handle_button_press(ev); - else if (response == XCB_BUTTON_RELEASE) - _ecore_xcb_event_handle_button_release(ev); - else if (response == XCB_MOTION_NOTIFY) - _ecore_xcb_event_handle_motion_notify(ev); - else if (response == XCB_ENTER_NOTIFY) - _ecore_xcb_event_handle_enter_notify(ev); - else if (response == XCB_LEAVE_NOTIFY) - _ecore_xcb_event_handle_leave_notify(ev); - else if (response == XCB_KEYMAP_NOTIFY) - _ecore_xcb_event_handle_keymap_notify(ev); - else if (response == XCB_FOCUS_IN) - _ecore_xcb_event_handle_focus_in(ev); - else if (response == XCB_FOCUS_OUT) - _ecore_xcb_event_handle_focus_out(ev); - else if (response == XCB_EXPOSE) - _ecore_xcb_event_handle_expose(ev); - else if (response == XCB_GRAPHICS_EXPOSURE) - _ecore_xcb_event_handle_graphics_exposure(ev); - else if (response == XCB_VISIBILITY_NOTIFY) - _ecore_xcb_event_handle_visibility_notify(ev); - else if (response == XCB_CREATE_NOTIFY) - _ecore_xcb_event_handle_create_notify(ev); - else if (response == XCB_DESTROY_NOTIFY) - _ecore_xcb_event_handle_destroy_notify(ev); - else if (response == XCB_MAP_NOTIFY) - _ecore_xcb_event_handle_map_notify(ev); - else if (response == XCB_UNMAP_NOTIFY) - _ecore_xcb_event_handle_unmap_notify(ev); - else if (response == XCB_MAP_REQUEST) - _ecore_xcb_event_handle_map_request(ev); - else if (response == XCB_REPARENT_NOTIFY) - _ecore_xcb_event_handle_reparent_notify(ev); - else if (response == XCB_CONFIGURE_NOTIFY) - _ecore_xcb_event_handle_configure_notify(ev); - else if (response == XCB_CONFIGURE_REQUEST) - _ecore_xcb_event_handle_configure_request(ev); - else if (response == XCB_GRAVITY_NOTIFY) - _ecore_xcb_event_handle_gravity_notify(ev); - else if (response == XCB_RESIZE_REQUEST) - _ecore_xcb_event_handle_resize_request(ev); - else if (response == XCB_CIRCULATE_NOTIFY) - _ecore_xcb_event_handle_circulate_notify(ev); - else if (response == XCB_CIRCULATE_REQUEST) - _ecore_xcb_event_handle_circulate_request(ev); - else if (response == XCB_PROPERTY_NOTIFY) - _ecore_xcb_event_handle_property_notify(ev); - else if (response == XCB_SELECTION_CLEAR) - _ecore_xcb_event_handle_selection_clear(ev); - else if (response == XCB_SELECTION_REQUEST) - _ecore_xcb_event_handle_selection_request(ev); - else if (response == XCB_SELECTION_NOTIFY) - _ecore_xcb_event_handle_selection_notify(ev); - else if (response == XCB_COLORMAP_NOTIFY) - _ecore_xcb_event_handle_colormap_notify(ev); - else if (response == XCB_CLIENT_MESSAGE) - _ecore_xcb_event_handle_client_message(ev); - else if (response == XCB_MAPPING_NOTIFY) - _ecore_xcb_event_handle_mapping_notify(ev); - else if (response == 35) /* GenericEvent == 35 */ - _ecore_xcb_event_handle_generic_event(ev); -#ifdef ECORE_XCB_DAMAGE - else if ((_ecore_xcb_event_damage >= 0) && - (response == (_ecore_xcb_event_damage + XCB_DAMAGE_NOTIFY))) - _ecore_xcb_event_handle_damage_notify(ev); -#endif -#ifdef ECORE_XCB_RANDR - else if ((_ecore_xcb_event_randr >= 0) && - (response == - _ecore_xcb_event_randr + XCB_RANDR_SCREEN_CHANGE_NOTIFY)) - _ecore_xcb_event_handle_randr_change(ev); - else if ((_ecore_xcb_event_randr >= 0) && - (response == (_ecore_xcb_event_randr + XCB_RANDR_NOTIFY))) - _ecore_xcb_event_handle_randr_notify(ev); -#endif -#ifdef ECORE_XCB_SCREENSAVER - else if ((_ecore_xcb_event_screensaver >= 0) && - (response == - _ecore_xcb_event_screensaver + XCB_SCREENSAVER_NOTIFY)) - _ecore_xcb_event_handle_screensaver_notify(ev); -#endif -#ifdef ECORE_XCB_XGESTURE - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_FLICK)) - _ecore_xcb_event_handle_gesture_notify_flick(ev); - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PAN)) - _ecore_xcb_event_handle_gesture_notify_pan(ev); - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PINCH_ROTATION)) - _ecore_xcb_event_handle_gesture_notify_pinchrotation(ev); - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP)) - _ecore_xcb_event_handle_gesture_notify_tap(ev); - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP_N_HOLD)) - _ecore_xcb_event_handle_gesture_notify_tapnhold(ev); - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_HOLD)) - _ecore_xcb_event_handle_gesture_notify_hold(ev); - else if ((_ecore_xcb_event_gesture >= 0) && - (response == - _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_GROUP)) - _ecore_xcb_event_handle_gesture_notify_group(ev); -#endif -#ifdef ECORE_XCB_SHAPE - else if ((_ecore_xcb_event_shape >= 0) && - (response == (_ecore_xcb_event_shape + XCB_SHAPE_NOTIFY))) - _ecore_xcb_event_handle_shape_change(ev); -#endif -#ifdef ECORE_XCB_SYNC - else if ((_ecore_xcb_event_sync >= 0) && - (response == (_ecore_xcb_event_sync + XCB_SYNC_COUNTER_NOTIFY))) - _ecore_xcb_event_handle_sync_counter(ev); - else if ((_ecore_xcb_event_sync >= 0) && - (response == (_ecore_xcb_event_sync + XCB_SYNC_ALARM_NOTIFY))) - _ecore_xcb_event_handle_sync_alarm(ev); -#endif -#ifdef ECORE_XCB_XFIXES - else if ((_ecore_xcb_event_xfixes >= 0) && - (response == - _ecore_xcb_event_xfixes + XCB_XFIXES_SELECTION_NOTIFY)) - _ecore_xcb_event_handle_xfixes_selection_notify(ev); - else if ((_ecore_xcb_event_xfixes >= 0) && - (response == (_ecore_xcb_event_xfixes + XCB_XFIXES_CURSOR_NOTIFY))) - _ecore_xcb_event_handle_xfixes_cursor_notify(ev); -#endif -} - -Ecore_X_Time -_ecore_xcb_events_last_time_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_event_last_time; -} - -EAPI void -ecore_x_event_mask_set(Ecore_X_Window win, - Ecore_X_Event_Mask mask) -{ - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *reply; - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); - reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - - list = (mask | reply->your_event_mask); - free(reply); - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_event_mask_unset(Ecore_X_Window win, - Ecore_X_Event_Mask mask) -{ - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *reply; - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); - reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - - list = (reply->your_event_mask & ~mask); - free(reply); - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); -// ecore_x_flush(); -} - -unsigned int -_ecore_xcb_events_modifiers_get(unsigned int state) -{ - unsigned int modifiers = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (state & ECORE_X_MODIFIER_SHIFT) - modifiers |= ECORE_EVENT_MODIFIER_SHIFT; - if (state & ECORE_X_MODIFIER_CTRL) - modifiers |= ECORE_EVENT_MODIFIER_CTRL; - if (state & ECORE_X_MODIFIER_ALT) - modifiers |= ECORE_EVENT_MODIFIER_ALT; - if (state & ECORE_X_MODIFIER_WIN) - modifiers |= ECORE_EVENT_MODIFIER_WIN; - if (state & ECORE_X_MODIFIER_ALTGR) - modifiers |= ECORE_EVENT_MODIFIER_ALTGR; - if (state & ECORE_X_LOCK_SCROLL) - modifiers |= ECORE_EVENT_LOCK_SCROLL; - if (state & ECORE_X_LOCK_CAPS) - modifiers |= ECORE_EVENT_LOCK_CAPS; - if (state & ECORE_X_LOCK_NUM) - modifiers |= ECORE_EVENT_LOCK_NUM; - if (state & ECORE_X_LOCK_SHIFT) - modifiers |= ECORE_EVENT_LOCK_SHIFT; - - return modifiers; -} - -/* local functions */ -static void -_ecore_xcb_event_handle_any_event(xcb_generic_event_t *event) -{ - xcb_generic_event_t *ev; - -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ev = malloc(sizeof(xcb_generic_event_t)); - if (!ev) return; - - memcpy(ev, event, sizeof(xcb_generic_event_t)); - ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_key_press(xcb_generic_event_t *event) -{ - _ecore_xcb_event_key_press(event); -} - -static void -_ecore_xcb_event_handle_key_release(xcb_generic_event_t *event) -{ - _ecore_xcb_event_key_release(event); -} - -static void -_ecore_xcb_event_handle_button_press(xcb_generic_event_t *event) -{ - xcb_button_press_event_t *ev; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - - ev = (xcb_button_press_event_t *)event; - if ((ev->detail > 3) && (ev->detail < 8)) - { - Ecore_Event_Mouse_Wheel *e; - - if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return; - - e->timestamp = ev->time; - e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); - switch (ev->detail) - { - case 4: - e->direction = 0; - e->z = -1; - break; - - case 5: - e->direction = 0; - e->z = 1; - break; - - case 6: - e->direction = 1; - e->z = -1; - break; - - case 7: - e->direction = 1; - e->z = 1; - break; - - default: - e->direction = 0; - e->z = 0; - break; - } - e->x = ev->event_x; - e->y = ev->event_y; - e->root.x = ev->root_x; - e->root.y = ev->root_y; - if (ev->child) - e->window = ev->child; - else - e->window = ev->event; - - e->event_window = ev->event; - e->same_screen = ev->same_screen; - e->root_window = ev->root; - - _ecore_xcb_event_last_time = e->timestamp; - _ecore_xcb_event_last_window = e->window; - _ecore_xcb_event_last_root_x = e->root.x; - _ecore_xcb_event_last_root_y = e->root.y; - - ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); - - _ecore_xcb_window_grab_allow_events(ev->event, ev->child, - ECORE_EVENT_MOUSE_WHEEL, - e, ev->time); - } - else - { - Ecore_Event_Mouse_Button *e; - unsigned int child_win = 0; - - child_win = (ev->child ? ev->child : ev->event); - - _ecore_xcb_event_mouse_move(ev->time, ev->state, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y, - ev->event, child_win, - ev->root, ev->same_screen, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - - e = _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, - ev->time, - ev->state, ev->detail, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y, ev->event, - child_win, - ev->root, ev->same_screen, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - if (e) - _ecore_xcb_window_grab_allow_events(ev->event, ev->child, - ECORE_EVENT_MOUSE_BUTTON_DOWN, - e, ev->time); - } -} - -static void -_ecore_xcb_event_handle_button_release(xcb_generic_event_t *event) -{ - xcb_button_release_event_t *ev; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_button_release_event_t *)event; - if ((ev->detail <= 3) || (ev->detail > 7)) - { - _ecore_xcb_event_mouse_move(ev->time, ev->state, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y, - ev->event, - (ev->child ? ev->child : ev->event), - ev->root, ev->same_screen, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - - _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, ev->time, - ev->state, ev->detail, - ev->event_x, ev->event_y, ev->root_x, - ev->root_y, ev->event, - (ev->child ? ev->child : ev->event), - ev->root, ev->same_screen, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - } -} - -static void -_ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event) -{ - xcb_motion_notify_event_t *ev; - - ev = (xcb_motion_notify_event_t *)event; - - /* if (_ecore_xcb_event_last_mouse_move_event) */ - /* { */ - /* ecore_event_del(_ecore_xcb_event_last_mouse_move_event); */ - /* _ecore_xcb_event_last_mouse_move = EINA_FALSE; */ - /* _ecore_xcb_event_last_mouse_move_event = NULL; */ - /* } */ - - _ecore_xcb_event_mouse_move(ev->time, ev->state, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y, - ev->event, - (ev->child ? ev->child : ev->event), - ev->root, ev->same_screen, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - _ecore_xcb_event_last_mouse_move = EINA_TRUE; - - _ecore_xcb_dnd_drag(ev->root, ev->root_x, ev->root_y); -} - -static void -_ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event) -{ - xcb_enter_notify_event_t *ev; - Ecore_X_Event_Mouse_In *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_enter_notify_event_t *)event; - - _ecore_xcb_event_mouse_move(ev->time, ev->state, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y, - ev->event, - (ev->child ? ev->child : ev->event), - ev->root, ev->same_screen_focus, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)))) return; - - e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); - e->x = ev->event_x; - e->y = ev->event_y; - e->root.x = ev->root_x; - e->root.y = ev->root_y; - if (ev->child) - e->win = ev->child; - else - e->win = ev->event; - e->event_win = ev->event; - e->same_screen = ev->same_screen_focus; - e->root_win = ev->root; - e->mode = _ecore_xcb_event_mode_get(ev->mode); - e->detail = _ecore_xcb_event_detail_get(ev->detail); - e->time = ev->time; - _ecore_xcb_event_last_time = e->time; - - ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event) -{ - xcb_leave_notify_event_t *ev; - Ecore_X_Event_Mouse_Out *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_enter_notify_event_t *)event; - - _ecore_xcb_event_mouse_move(ev->time, ev->state, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y, - ev->event, - (ev->child ? ev->child : ev->event), - ev->root, ev->same_screen_focus, - 0, 1, 1, 1.0, 0.0, - ev->event_x, ev->event_y, - ev->root_x, ev->root_y); - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)))) return; - - e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); - e->x = ev->event_x; - e->y = ev->event_y; - e->root.x = ev->root_x; - e->root.y = ev->root_y; - if (ev->child) - e->win = ev->child; - else - e->win = ev->event; - e->event_win = ev->event; - e->same_screen = ev->same_screen_focus; - e->root_win = ev->root; - e->mode = _ecore_xcb_event_mode_get(ev->mode); - e->detail = _ecore_xcb_event_detail_get(ev->detail); - - e->time = ev->time; - _ecore_xcb_event_last_time = e->time; - _ecore_xcb_event_last_window = e->win; - _ecore_xcb_event_last_root_x = e->root.x; - _ecore_xcb_event_last_root_y = e->root.y; - - ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event EINA_UNUSED) -{ -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - - // FIXME: handle this event type - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -} - -static void -_ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event) -{ - xcb_focus_in_event_t *ev; - Ecore_X_Event_Window_Focus_In *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_focus_in_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)))) return; - - e->win = ev->event; - e->mode = _ecore_xcb_event_mode_get(ev->mode); - e->detail = _ecore_xcb_event_detail_get(ev->detail); - - e->time = _ecore_xcb_event_last_time; - _ecore_xcb_event_last_time = e->time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event) -{ - xcb_focus_out_event_t *ev; - Ecore_X_Event_Window_Focus_Out *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_focus_out_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)))) return; - - e->win = ev->event; - e->mode = _ecore_xcb_event_mode_get(ev->mode); - e->detail = _ecore_xcb_event_detail_get(ev->detail); - - e->time = _ecore_xcb_event_last_time; - _ecore_xcb_event_last_time = e->time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_expose(xcb_generic_event_t *event) -{ - xcb_expose_event_t *ev; - Ecore_X_Event_Window_Damage *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_expose_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return; - - e->win = ev->window; - e->time = _ecore_xcb_event_last_time; - e->x = ev->x; - e->y = ev->y; - e->w = ev->width; - e->h = ev->height; - e->count = ev->count; - - ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event) -{ - xcb_graphics_exposure_event_t *ev; - Ecore_X_Event_Window_Damage *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_graphics_exposure_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return; - - e->win = ev->drawable; - e->x = ev->x; - e->y = ev->y; - e->w = ev->width; - e->h = ev->height; - e->count = ev->count; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event) -{ - xcb_visibility_notify_event_t *ev; - Ecore_X_Event_Window_Visibility_Change *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_visibility_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change)))) - return; - - e->win = ev->window; - e->time = _ecore_xcb_event_last_time; - if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED) - e->fully_obscured = 1; - else - e->fully_obscured = 0; - - ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event) -{ - xcb_create_notify_event_t *ev; - Ecore_X_Event_Window_Create *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_create_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Create)))) return; - - e->win = ev->window; - e->parent = ev->parent; - if (ev->override_redirect) - e->override = 1; - else - e->override = 0; - e->x = ev->x; - e->y = ev->y; - e->w = ev->width; - e->h = ev->height; - e->border = ev->border_width; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event) -{ - xcb_destroy_notify_event_t *ev; - Ecore_X_Event_Window_Destroy *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_destroy_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)))) return; - - e->win = ev->window; - e->event_win = ev->event; - if (e->win == _ecore_xcb_event_last_window) - _ecore_xcb_event_last_window = 0; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event) -{ - xcb_map_notify_event_t *ev; - Ecore_X_Event_Window_Show *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_map_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show)))) return; - - e->win = ev->window; - e->event_win = ev->event; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event) -{ - xcb_unmap_notify_event_t *ev; - Ecore_X_Event_Window_Hide *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_unmap_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)))) return; - - e->win = ev->window; - e->event_win = ev->event; - e->time = _ecore_xcb_event_last_time; - /* send_event is bit 7 (0x80) of response_type */ - e->send_event = ((ev->response_type & 0x80) ? 1 : 0); - - ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_map_request(xcb_generic_event_t *event) -{ - xcb_map_request_event_t *ev; - Ecore_X_Event_Window_Show_Request *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_map_request_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)))) return; - - e->win = ev->window; - e->parent = ev->parent; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event) -{ - xcb_reparent_notify_event_t *ev; - Ecore_X_Event_Window_Reparent *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_reparent_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)))) return; - - e->win = ev->window; - e->event_win = ev->event; - e->parent = ev->parent; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event) -{ - xcb_configure_notify_event_t *ev; - Ecore_X_Event_Window_Configure *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_configure_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)))) return; - - e->win = ev->window; - e->event_win = ev->event; - e->abovewin = ev->above_sibling; - e->x = ev->x; - e->y = ev->y; - e->w = ev->width; - e->h = ev->height; - e->border = ev->border_width; - e->override = ev->override_redirect; - /* send_event is bit 7 (0x80) of response_type */ - e->from_wm = ((ev->response_type & 0x80) ? 1 : 0); - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event) -{ - xcb_configure_request_event_t *ev; - Ecore_X_Event_Window_Configure_Request *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_configure_request_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request)))) - return; - - e->win = ev->window; - e->parent_win = ev->parent; - e->abovewin = ev->sibling; - e->x = ev->x; - e->y = ev->y; - e->w = ev->width; - e->h = ev->height; - e->border = ev->border_width; - e->value_mask = ev->value_mask; - switch (ev->stack_mode) - { - case XCB_STACK_MODE_ABOVE: - e->detail = ECORE_X_WINDOW_STACK_ABOVE; - break; - - case XCB_STACK_MODE_BELOW: - e->detail = ECORE_X_WINDOW_STACK_BELOW; - break; - - case XCB_STACK_MODE_TOP_IF: - e->detail = ECORE_X_WINDOW_STACK_TOP_IF; - break; - - case XCB_STACK_MODE_BOTTOM_IF: - e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF; - break; - - case XCB_STACK_MODE_OPPOSITE: - e->detail = ECORE_X_WINDOW_STACK_OPPOSITE; - break; - } - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event EINA_UNUSED) -{ -/* - xcb_gravity_notify_event_t *ev; - Ecore_X_Event_Window_Gravity *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_gravity_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Gravity)))) return; - - e->win = ev->window; - e->event_win = ev->event; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_GRAVITY, e, NULL, NULL); - */ -} - -static void -_ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event) -{ - xcb_resize_request_event_t *ev; - Ecore_X_Event_Window_Resize_Request *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_resize_request_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)))) return; - - e->win = ev->window; - e->w = ev->width; - e->h = ev->height; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event) -{ - xcb_circulate_notify_event_t *ev; - Ecore_X_Event_Window_Stack *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_circulate_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)))) return; - - e->win = ev->window; - e->event_win = ev->event; - if (ev->place == XCB_PLACE_ON_TOP) - e->detail = ECORE_X_WINDOW_STACK_ABOVE; - else - e->detail = ECORE_X_WINDOW_STACK_BELOW; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event) -{ - xcb_circulate_request_event_t *ev; - Ecore_X_Event_Window_Stack_Request *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_circulate_request_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)))) return; - - e->win = ev->window; - e->parent = ev->event; - if (ev->place == XCB_PLACE_ON_TOP) - e->detail = ECORE_X_WINDOW_STACK_ABOVE; - else - e->detail = ECORE_X_WINDOW_STACK_BELOW; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event) -{ - xcb_property_notify_event_t *ev; - Ecore_X_Event_Window_Property *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_property_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Property)))) return; - - e->win = ev->window; - e->atom = ev->atom; - e->time = ev->time; - e->state = !!ev->state; - _ecore_xcb_event_last_time = e->time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_selection_clear(xcb_generic_event_t *event) -{ - xcb_selection_clear_event_t *ev; - Ecore_X_Event_Selection_Clear *e; - Ecore_X_Atom sel; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_selection_clear_event_t *)event; - if (!(e = malloc(sizeof(Ecore_X_Event_Selection_Clear)))) return; - - e->win = ev->owner; - e->atom = sel = ev->selection; - if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (sel == ECORE_X_ATOM_SELECTION_XDND) - e->selection = ECORE_X_SELECTION_XDND; - else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - e->time = ev->time; - - ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event) -{ - xcb_selection_request_event_t *ev; - Ecore_X_Event_Selection_Request *e; - Ecore_X_Selection_Intern *sd; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_selection_request_event_t *)event; - if (!(e = malloc(sizeof(Ecore_X_Event_Selection_Request)))) return; - - e->owner = ev->owner; - e->requestor = ev->requestor; - e->selection = ev->selection; - e->target = ev->target; - e->property = ev->property; - e->time = ev->time; - - ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL); - - if ((sd = _ecore_xcb_selection_get(ev->selection)) && - (sd->win == ev->owner)) - { - Ecore_X_Selection_Intern *si; - - si = _ecore_xcb_selection_get(ev->selection); - if (si->data) - { - Ecore_X_Atom property = XCB_NONE, type; - void *data = NULL; - int len = 0, typesize = 0; - - type = ev->target; - typesize = 8; - len = sd->length; - - if (!ecore_x_selection_convert(ev->selection, ev->target, - &data, &len, &type, &typesize)) - property = XCB_NONE; - else if (data) - { - ecore_x_window_prop_property_set(ev->requestor, ev->property, - type, typesize, data, len); - property = ev->property; - free(data); - } - ecore_x_selection_notify_send(ev->requestor, ev->selection, - ev->target, property, ev->time); - } - } -} - -static void -_ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event) -{ - xcb_selection_notify_event_t *ev; - Ecore_X_Event_Selection_Notify *e; - unsigned char *data = NULL; - Ecore_X_Atom selection; - int num = 0, format = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_selection_notify_event_t *)event; - selection = ev->selection; - if (ev->target == ECORE_X_ATOM_SELECTION_TARGETS) - { - format = - ecore_x_window_prop_property_get(ev->requestor, ev->property, - XCB_ATOM_ATOM, 32, &data, &num); - if (!format) - { - /* fallback if targets handling is not working and try get the - * selection directly */ - xcb_convert_selection(_ecore_xcb_conn, ev->requestor, - selection, selection, - ECORE_X_ATOM_UTF8_STRING, XCB_CURRENT_TIME); - return; - } - } - else - { - format = ecore_x_window_prop_property_get(ev->requestor, ev->property, - XCB_GET_PROPERTY_TYPE_ANY, 8, - &data, &num); - if (!format) return; - } - - e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); - if (!e) return; - e->win = ev->requestor; - e->time = ev->time; - e->atom = selection; - e->property = ev->property; - e->target = _ecore_xcb_selection_target_get(ev->target); - - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (selection == ECORE_X_ATOM_SELECTION_XDND) - e->selection = ECORE_X_SELECTION_XDND; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - - e->data = _ecore_xcb_selection_parse(e->target, data, num, format); - - ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, - _ecore_xcb_event_selection_notify_free, NULL); -} - -static void -_ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event) -{ - xcb_colormap_notify_event_t *ev; - Ecore_X_Event_Window_Colormap *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_colormap_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)))) return; - - e->win = ev->window; - e->cmap = ev->colormap; - if (ev->state == XCB_COLORMAP_STATE_INSTALLED) - e->installed = 1; - else - e->installed = 0; - e->time = _ecore_xcb_event_last_time; - - ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_client_message(xcb_generic_event_t *event) -{ - xcb_client_message_event_t *ev; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_client_message_event_t *)event; - - /* Special client message event handling here. need to put LOTS of if */ - /* checks here and generate synthetic events per special message known */ - /* otherwise generate generic client message event. this would handle*/ - /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */ - - if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS) && (ev->format == 32) && - (ev->data.data32[0] == ECORE_X_ATOM_WM_DELETE_WINDOW)) - { - Ecore_X_Event_Window_Delete_Request *e; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request)))) - return; - e->win = ev->window; - e->time = _ecore_xcb_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); - } - else if ((ev->type == ECORE_X_ATOM_NET_WM_MOVERESIZE) && - (ev->format == 32) && (ev->data.data32[2] < 9)) - { - Ecore_X_Event_Window_Move_Resize_Request *e; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request)))) - return; - e->win = ev->window; - e->x = ev->data.data32[0]; - e->y = ev->data.data32[1]; - e->direction = ev->data.data32[2]; - e->button = ev->data.data32[3]; - e->source = ev->data.data32[4]; - ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_XDND_ENTER) - { - Ecore_X_Event_Xdnd_Enter *e; - Ecore_X_DND_Target *target; - - DBG("Got Xdnd Enter Event"); - if (!(e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)))) return; - target = _ecore_xcb_dnd_target_get(); - target->state = ECORE_X_DND_TARGET_ENTERED; - target->source = ev->data.data32[0]; - target->win = ev->window; - target->version = (int)(ev->data.data32[1] >> 24); - if (target->version > ECORE_X_DND_VERSION) - { - WRN("DND: Requested version %d but we only support up to %d", - target->version, ECORE_X_DND_VERSION); - free(e); - return; - } - if (ev->data.data32[1] & 0x1UL) - { - unsigned char *data; - Ecore_X_Atom *types; - int num_ret = 0; - - if (!ecore_x_window_prop_property_get(target->source, - ECORE_X_ATOM_XDND_TYPE_LIST, - ECORE_X_ATOM_ATOM, 32, - &data, &num_ret)) - { - WRN("DND: Could not fetch data type list from source window"); - free(e); - return; - } - types = (Ecore_X_Atom *)data; - e->types = calloc(num_ret, sizeof(char *)); - if (e->types) - { - int i = 0; - - for (i = 0; i < num_ret; i++) - e->types[i] = ecore_x_atom_name_get(types[i]); - } - e->num_types = num_ret; - if (data) free(data); - } - else - { - int i = 0; - - e->types = calloc(3, sizeof(char *)); - if (e->types) - { - while ((i < 3) && (ev->data.data32[i + 2])) - { - e->types[i] = - ecore_x_atom_name_get(ev->data.data32[i + 2]); - i++; - } - } - e->num_types = i; - } - - e->win = target->win; - e->source = target->source; - ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, - _ecore_xcb_event_xdnd_enter_free, NULL); - } - else if (ev->type == ECORE_X_ATOM_XDND_POSITION) - { - Ecore_X_Event_Xdnd_Position *e; - Ecore_X_DND_Target *target; - - DBG("Got Xdnd Position Event"); - target = _ecore_xcb_dnd_target_get(); - if ((target->source != (Ecore_X_Window)ev->data.data32[0]) || - (target->win != ev->window)) return; - target->pos.x = ev->data.data32[2] >> 16; - target->pos.y = ev->data.data32[2] & 0xFFFFUL; - target->action = ev->data.data32[4]; - target->time = (target->version >= 1) ? - (Ecore_X_Time)ev->data.data32[3] : XCB_CURRENT_TIME; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); - if (!e) return; - e->win = target->win; - e->source = target->source; - e->position.x = target->pos.x; - e->position.y = target->pos.y; - e->action = target->action; - ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_XDND_STATUS) - { - Ecore_X_Event_Xdnd_Status *e; - Ecore_X_DND_Source *source; - - DBG("Got Xdnd Status Event"); - source = _ecore_xcb_dnd_source_get(); - if ((source->win != ev->window) || - (source->dest != (Ecore_X_Window)ev->data.data32[0])) - return; - - source->await_status = 0; - source->will_accept = ev->data.data32[1] & 0x1UL; - source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1; - source->rectangle.x = ev->data.data32[2] >> 16; - source->rectangle.y = ev->data.data32[2] & 0xFFFFUL; - source->rectangle.width = ev->data.data32[3] >> 16; - source->rectangle.height = ev->data.data32[3] & 0xFFFFUL; - source->accepted_action = ev->data.data32[4]; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); - if (!e) return; - e->win = source->win; - e->target = source->dest; - e->will_accept = source->will_accept; - e->rectangle.x = source->rectangle.x; - e->rectangle.y = source->rectangle.y; - e->rectangle.width = source->rectangle.width; - e->rectangle.height = source->rectangle.height; - e->action = source->accepted_action; - - ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_XDND_LEAVE) - { - Ecore_X_Event_Xdnd_Leave *e; - Ecore_X_DND_Target *target; - - DBG("Got Xdnd Leave Event"); - target = _ecore_xcb_dnd_target_get(); - if ((target->source != (Ecore_X_Window)ev->data.data32[0]) || - (target->win != ev->window)) - return; - target->state = ECORE_X_DND_TARGET_IDLE; - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave)); - if (!e) return; - e->win = ev->window; - e->source = (Ecore_X_Window)ev->data.data32[0]; - ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_XDND_DROP) - { - Ecore_X_Event_Xdnd_Drop *e; - Ecore_X_DND_Target *target; - - DBG("Got Xdnd Drop Event"); - target = _ecore_xcb_dnd_target_get(); - if ((target->source != (Ecore_X_Window)ev->data.data32[0]) || - (target->win != ev->window)) - return; - target->time = (target->version >= 1) ? - (Ecore_X_Time)ev->data.data32[2] : _ecore_xcb_event_last_time; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop)); - if (!e) return; - e->win = target->win; - e->source = target->source; - e->action = target->action; - e->position.x = target->pos.x; - e->position.y = target->pos.y; - ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_XDND_FINISHED) - { - Ecore_X_Event_Xdnd_Finished *e; - Ecore_X_DND_Source *source; - Eina_Bool completed = EINA_TRUE; - - DBG("Got Xdnd Finished Event"); - source = _ecore_xcb_dnd_source_get(); - if ((source->win != ev->window) || - (source->dest != (Ecore_X_Window)ev->data.data32[0])) - return; - if ((source->version < 5) || (ev->data.data32[1] & 0x1UL)) - { - ecore_x_selection_xdnd_clear(); - source->state = ECORE_X_DND_SOURCE_IDLE; - } - else if (source->version >= 5) - { - completed = EINA_FALSE; - source->state = ECORE_X_DND_SOURCE_CONVERTING; - /* FIXME: Probably need to add a timer to switch back to idle - * and discard the selection data */ - } - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished)))) - return; - e->win = source->win; - e->target = source->dest; - e->completed = completed; - if (source->version >= 5) - { - source->accepted_action = ev->data.data32[2]; - e->action = source->accepted_action; - } - else - { - source->accepted_action = 0; - e->action = source->action; - } - ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_NET_WM_STATE) - { - Ecore_X_Event_Window_State_Request *e; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)))) - return; - e->win = ev->window; - if (ev->data.data32[0] == 0) - e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE; - else if (ev->data.data32[0] == 1) - e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; - else if (ev->data.data32[0] == 2) - e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE; - else - { - free(e); - return; - } - e->state[0] = _ecore_xcb_netwm_window_state_get(ev->data.data32[1]); - if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN) - { - /* FIXME */ - } - e->state[1] = _ecore_xcb_netwm_window_state_get(ev->data.data32[2]); - if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN) - { - /* FIXME */ - } - e->source = ev->data.data32[3]; - ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); - } - else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && (ev->format == 32) && - (ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC)) - { - Ecore_X_Event_Window_State_Request *e; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)))) - return; - e->win = ev->window; - e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; - e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED; - ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); - } - else if ((ev->type == ECORE_X_ATOM_NET_WM_DESKTOP) && (ev->format == 32)) - { - Ecore_X_Event_Desktop_Change *e; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change)))) - return; - e->win = ev->window; - e->desk = ev->data.data32[0]; - e->source = ev->data.data32[1]; - ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL); - } - else if (ev->type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS) - { - Ecore_X_Event_Frame_Extents_Request *e; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request)))) - return; - e->win = ev->window; - ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL); - } - else if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS) && - ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING) && - (ev->format == 32)) - { - Ecore_X_Event_Ping *e; - Ecore_X_Window root = 0; - int count = 0; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Ping)))) return; - e->win = ev->window; - e->time = ev->data.data32[1]; - e->event_win = ev->data.data32[2]; - ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL); - - CHECK_XCB_CONN; - - count = xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn)); - if (count > 1) - root = ecore_x_window_root_get(e->win); - else - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (ev->window != root) - { - ev->window = root; - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), - (const char *)&ev); -// ecore_x_flush(); - } - } - else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) && - (ev->format == 8)) - { - _ecore_xcb_netwm_startup_info_begin(ev->window, ev->data.data8[0]); - } - else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO) && (ev->format == 8)) - { - _ecore_xcb_netwm_startup_info(ev->window, ev->data.data8[0]); - } - else if ((ev->type == 27777) && (ev->data.data32[0] == 0x7162534) && - (ev->format == 32)) // && (ev->window = _private_window)) - { - if (ev->data.data32[1] == 0x10000001) - _ecore_xcb_window_button_grab_remove(ev->data.data32[2]); - else if (ev->data.data32[1] == 0x10000002) - _ecore_xcb_window_key_grab_remove(ev->data.data32[2]); - } - else - { - Ecore_X_Event_Client_Message *e; - int i = 0; - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Client_Message)))) - return; - - e->win = ev->window; - e->message_type = ev->type; - e->format = ev->format; - e->time = _ecore_xcb_event_last_time; - for (i = 0; i < 5; i++) - e->data.l[i] = ev->data.data32[i]; - ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL); - } -} - -static void -_ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event) -{ - xcb_mapping_notify_event_t *ev; - Ecore_X_Event_Mapping_Change *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - - ev = (xcb_mapping_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)))) return; - - _ecore_xcb_keymap_refresh(ev); - _ecore_xcb_modifiers_get(); - - switch (ev->request) - { - case XCB_MAPPING_MODIFIER: - e->type = ECORE_X_MAPPING_MODIFIER; - break; - - case XCB_MAPPING_KEYBOARD: - e->type = ECORE_X_MAPPING_KEYBOARD; - break; - - case XCB_MAPPING_POINTER: - default: - e->type = ECORE_X_MAPPING_MOUSE; - break; - } - e->keycode = ev->first_keycode; - e->num = ev->count; - - ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_damage_notify(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_DAMAGE - xcb_damage_notify_event_t *ev; - Ecore_X_Event_Damage *e; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -#ifdef ECORE_XCB_DAMAGE - ev = (xcb_damage_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Damage)))) return; - - e->level = ev->level; - e->drawable = ev->drawable; - e->damage = ev->damage; - e->time = ev->timestamp; - e->area.x = ev->area.x; - e->area.y = ev->area.y; - e->area.width = ev->area.width; - e->area.height = ev->area.height; - e->geometry.x = ev->geometry.x; - e->geometry.y = ev->geometry.y; - e->geometry.width = ev->geometry.width; - e->geometry.height = ev->geometry.height; - - ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_screen_change_notify_event_t *ev; - Ecore_X_Event_Screen_Change *e; -#endif - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - ev = (xcb_randr_screen_change_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Screen_Change)))) return; - - e->win = ev->request_window; - e->root = ev->root; - e->size.width = ev->width; - e->size.height = ev->height; - e->time = ev->timestamp; - e->config_time = ev->config_timestamp; - e->size.width_mm = ev->mwidth; - e->size.height_mm = ev->mheight; - e->orientation = ev->rotation; - e->subpixel_order = ev->subpixel_order; - - ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_notify_event_t *ev; -#endif - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - ev = (xcb_randr_notify_event_t *)event; - switch (ev->subCode) - { - case XCB_RANDR_NOTIFY_CRTC_CHANGE: - _ecore_xcb_event_handle_randr_crtc_change(event); - break; - - case XCB_RANDR_NOTIFY_OUTPUT_CHANGE: - _ecore_xcb_event_handle_randr_output_change(event); - break; - - case XCB_RANDR_NOTIFY_OUTPUT_PROPERTY: - _ecore_xcb_event_handle_randr_output_property_change(event); - break; - - default: - break; - } -#endif -} - -static void -_ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_notify_event_t *ev; - Ecore_X_Event_Randr_Crtc_Change *e; -#endif - -#ifdef ECORE_XCB_RANDR - ev = (xcb_randr_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change)))) - return; - - e->win = ev->u.cc.window; - e->crtc = ev->u.cc.crtc; - e->mode = ev->u.cc.mode; - e->orientation = ev->u.cc.rotation; - e->geo.x = ev->u.cc.x; - e->geo.y = ev->u.cc.y; - e->geo.w = ev->u.cc.width; - e->geo.h = ev->u.cc.height; - - ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_notify_event_t *ev; - Ecore_X_Event_Randr_Output_Change *e; -#endif - -#ifdef ECORE_XCB_RANDR - ev = (xcb_randr_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change)))) - return; - - e->win = ev->u.oc.window; - e->output = ev->u.oc.output; - e->crtc = ev->u.oc.crtc; - e->mode = ev->u.oc.mode; - e->orientation = ev->u.oc.rotation; - e->connection = ev->u.oc.connection; - e->subpixel_order = ev->u.oc.subpixel_order; - - ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_notify_event_t *ev; - Ecore_X_Event_Randr_Output_Property_Notify *e; -#endif - -#ifdef ECORE_XCB_RANDR - ev = (xcb_randr_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify)))) - return; - - e->win = ev->u.op.window; - e->output = ev->u.op.output; - e->property = ev->u.op.atom; - e->time = ev->u.op.timestamp; - if (ev->u.op.status == XCB_PROPERTY_NEW_VALUE) - e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD; - else - e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; - - ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_screensaver_notify_event_t *ev; - Ecore_X_Event_Screensaver_Notify *e; -#endif - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -#ifdef ECORE_XCB_SCREENSAVER - ev = (xcb_screensaver_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify)))) return; - - e->win = ev->window; - e->on = EINA_FALSE; - if ((ev->state == XCB_SCREENSAVER_STATE_ON) || - (ev->state == XCB_SCREENSAVER_STATE_CYCLE)) e->on = EINA_TRUE; - e->time = ev->time; - - ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL); -#endif -} - -#ifdef ECORE_XCB_XGESTURE -static void -_ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event) -{ - xcb_gesture_notify_flick_event_t *ev; - Ecore_X_Event_Gesture_Notify_Flick *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_flick_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_fingers = ev->num_finger; - e->distance = ev->distance; - e->duration = ev->duration; - e->direction = ev->direction; - e->angle = XFixedToDouble(ev->angle); - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event) -{ - xcb_gesture_notify_pan_event_t *ev; - Ecore_X_Event_Gesture_Notify_Pan *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_pan_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_fingers = ev->num_finger; - e->dx = ev->dx; - e->dy = ev->dy; - e->distance = ev->distance; - e->duration = ev->duration; - e->direction = ev->direction; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event) -{ - xcb_gesture_notify_pinch_rotation_event_t *ev; - Ecore_X_Event_Gesture_Notify_PinchRotation *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_pinch_rotation_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_fingers = ev->num_finger; - e->distance = ev->distance; - e->cx = ev->cx; - e->cy = ev->cy; - e->zoom = XFixedToDouble(ev->zoom); - e->angle = XFixedToDouble(ev->angle); - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event) -{ - xcb_gesture_notify_tap_event_t *ev; - Ecore_X_Event_Gesture_Notify_Tap *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_tap_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_fingers = ev->num_finger; - e->cx = ev->cx; - e->cy = ev->cy; - e->tap_repeat = ev->tap_repeat; - e->interval = ev->interval; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL); -} - -static void -_ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event) -{ - xcb_gesture_notify_tap_n_hold_event_t *ev; - Ecore_X_Event_Gesture_Notify_TapNHold *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_tap_n_hold_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_fingers = ev->num_finger; - e->cx = ev->cx; - e->cy = ev->cy; - e->interval = ev->interval; - e->hold_time = ev->holdtime; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL); -} - -static void - _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event) -{ - xcb_gesture_notify_hold_event_t *ev; - Ecore_X_Event_Gesture_Notify_Hold *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_hold_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_fingers = ev->num_finger; - e->cx = ev->cx; - e->cy = ev->cy; - e->hold_time = ev->holdtime; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL); -} - -static void - _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event) -{ - xcb_gesture_notify_group_event_t *ev; - Ecore_X_Event_Gesture_Notify_Group *e; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); - - ev = (xcb_gesture_notify_group_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)))) return; - - e->win = ev->window; - e->time = ev->time; - e->subtype = ev->kind; - e->num_groups = ev->num_group; - e->group_id = ev->groupid; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL); -} -#endif - -#ifdef ECORE_XCB_SHAPE -static void -_ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event) -{ - xcb_shape_notify_event_t *ev; - Ecore_X_Event_Window_Shape *e; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - ev = (xcb_shape_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)))) return; - - e->win = ev->affected_window; - e->time = ev->server_time; - switch (ev->shape_kind) - { - case XCB_SHAPE_SK_BOUNDING: - e->type = ECORE_X_SHAPE_BOUNDING; - break; - - case XCB_SHAPE_SK_CLIP: - e->type = ECORE_X_SHAPE_CLIP; - break; - - case XCB_SHAPE_SK_INPUT: - e->type = ECORE_X_SHAPE_INPUT; - break; - - default: - break; - } - e->x = ev->extents_x; - e->y = ev->extents_y; - e->w = ev->extents_width; - e->h = ev->extents_height; - e->shaped = ev->shaped; - - ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); -} - -#endif - -static void -_ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_counter_notify_event_t *ev; - Ecore_X_Event_Sync_Counter *e; -#endif - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - -#ifdef ECORE_XCB_SYNC - ev = (xcb_sync_counter_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)))) return; - - e->time = ev->timestamp; - - ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_alarm_notify_event_t *ev; - Ecore_X_Event_Sync_Alarm *e; -#endif - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -#ifdef ECORE_XCB_SYNC - ev = (xcb_sync_alarm_notify_event_t *)event; - if (!(e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)))) return; - - e->time = ev->timestamp; - e->alarm = ev->alarm; - - ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event) -{ -#ifdef ECORE_XCB_XFIXES - Ecore_X_Event_Fixes_Selection_Notify *e; - Ecore_X_Atom sel; - xcb_xfixes_selection_notify_event_t *ev; -#endif - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; -#ifdef ECORE_XCB_XFIXES - ev = (xcb_xfixes_selection_notify_event_t *)event; - - if (!(e = calloc(1, sizeof(*e)))) return; - - e->win = ev->window; - e->owner = ev->owner; - e->time = ev->timestamp; - e->selection_time = ev->selection_timestamp; - e->atom = sel = ev->selection; - if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (sel == ECORE_X_ATOM_SELECTION_XDND) - e->selection = ECORE_X_SELECTION_XDND; - else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - e->reason = ev->subtype; - - ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL); -#endif -} - -static void -_ecore_xcb_event_handle_xfixes_cursor_notify(xcb_generic_event_t *event EINA_UNUSED) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -// FIXME: TBD -} - -static void -_ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event) -{ - xcb_ge_event_t *ev; - Ecore_X_Event_Generic *e; - - ev = (xcb_ge_event_t *)event; - - /* pad0 *IS* extension - bug in xcb */ - if (ev->pad0 == _ecore_xcb_event_input) - { - _ecore_xcb_event_handle_input_event(event); -// FIXME: should we generate generic events as WELL as input events? -// return; - } -#ifdef ECORE_XCB_XPRESENT - else if (ev->pad0 == _ecore_xcb_event_xpresent) - { - _ecore_xcb_event_handle_present_event((xcb_ge_event_t*)event); - return; - } -#endif - - if (!(e = calloc(1, sizeof(Ecore_X_Event_Generic)))) - return; - - DBG("Handle Generic Event: %d", ev->event_type); - - e->cookie = ev->sequence; - /* NB: These are bugs in xcb ge_event structure. The struct should have a - * field for extension & data, but does not. - * - * XCB people have been notified of this issue */ - e->extension = ev->pad0; - /* e->data = ev->pad1; */ - if (ev->length > 0) - { - int len = ev->length * sizeof(int); - e->data = malloc(len); - if (e->data) memcpy(e->data, &(event[1]), len); - } - - e->evtype = ev->event_type; - - ecore_event_add(ECORE_X_EVENT_GENERIC, e, - _ecore_xcb_event_generic_event_free, e->data); -} - -static void -_ecore_xcb_event_handle_input_event(xcb_generic_event_t *event) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_input_handle_event(event); -} - -static void -_ecore_xcb_event_key_press(xcb_generic_event_t *event) -{ - Ecore_Event_Key *e; - xcb_keysym_t sym = XCB_NO_SYMBOL; - xcb_keycode_t keycode = 0; - xcb_key_press_event_t *xevent; - char *keyname = NULL, *key = NULL; - char *compose = NULL; - char compose_buffer[256]; - int val = 0; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - - xevent = (xcb_key_press_event_t *)event; - keycode = xevent->detail; - - sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, xevent->state); - keyname = _ecore_xcb_keymap_keysym_to_string(sym); - if (!keyname) - { - char buff[256]; - - snprintf(buff, sizeof(buff), "Keycode-%i", keycode); - keyname = buff; - } - - val = - _ecore_xcb_keymap_lookup_string(keycode, xevent->state, compose_buffer, - sizeof(compose_buffer), &sym); - if (val > 0) - { - compose_buffer[val] = 0; - compose = - eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer); - if (!compose) - ERR("Ecore_X cannot convert input key string '%s' to UTF-8. " - "Is Eina built with iconv support?", compose_buffer); - } - - key = _ecore_xcb_keymap_keysym_to_string(sym); - if (!key) key = keyname; - - e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + - (compose ? strlen(compose) : 0) + 3); - if (e) - { - e->keyname = (char *)(e + 1); - e->key = e->keyname + strlen(keyname) + 1; - - if (compose) e->compose = (e->key + strlen(key) + 1); - e->string = e->compose; - - strcpy((char *)e->keyname, keyname); - strcpy((char *)e->key, key); - if (compose) strcpy((char *)e->compose, compose); - - e->modifiers = _ecore_xcb_events_modifiers_get(xevent->state); - e->timestamp = xevent->time; - e->window = xevent->child ? xevent->child : xevent->event; - e->event_window = xevent->event; - e->same_screen = xevent->same_screen; - e->root_window = xevent->root; - e->keycode = keycode; - - DBG("Sending Key Down Event: %s", e->keyname); - ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); - } - _ecore_xcb_event_last_time = xevent->time; -} - -static void -_ecore_xcb_event_key_release(xcb_generic_event_t *event) -{ - Ecore_Event_Key *e; - xcb_keysym_t sym = XCB_NO_SYMBOL; - xcb_keycode_t keycode = 0; - xcb_key_release_event_t *xevent; - char *keyname = NULL, *key = NULL; - char *compose = NULL; - char compose_buffer[256]; - int val = 0; - - _ecore_xcb_event_last_mouse_move = EINA_FALSE; - - xevent = (xcb_key_release_event_t *)event; - keycode = xevent->detail; - - sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, xevent->state); - keyname = _ecore_xcb_keymap_keysym_to_string(sym); - if (!keyname) - { - char buff[256]; - - snprintf(buff, sizeof(buff), "Keycode-%i", keycode); - keyname = buff; - } - - val = - _ecore_xcb_keymap_lookup_string(keycode, xevent->state, compose_buffer, - sizeof(compose_buffer), &sym); - if (val > 0) - { - compose_buffer[val] = 0; - compose = - eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer); -// tmp = compose; - } - - key = _ecore_xcb_keymap_keysym_to_string(sym); - if (!key) key = keyname; - - e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + - (compose ? strlen(compose) : 0) + 3); - if (e) - { - e->keyname = (char *)(e + 1); - e->key = e->keyname + strlen(keyname) + 1; - - if (compose) e->compose = (e->key + strlen(key) + 1); - e->string = e->compose; - - strcpy((char *)e->keyname, keyname); - strcpy((char *)e->key, key); - if (compose) strcpy((char *)e->compose, compose); - - e->modifiers = _ecore_xcb_events_modifiers_get(xevent->state); - e->timestamp = xevent->time; - e->window = xevent->child ? xevent->child : xevent->event; - e->event_window = xevent->event; - e->same_screen = xevent->same_screen; - e->root_window = xevent->root; - e->keycode = keycode; - - ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL); - } - _ecore_xcb_event_last_time = xevent->time; -} - -void -_ecore_xcb_event_mouse_move(uint16_t timestamp, - uint16_t modifiers, - int16_t x, - int16_t y, - int16_t root_x, - int16_t root_y, - xcb_window_t event_win, - xcb_window_t win, - xcb_window_t root_win, - uint8_t same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - int16_t mx, - int16_t my, - int16_t mrx, - int16_t mry) -{ - Ecore_Event_Mouse_Move *e; - - if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return; - - e->window = win; - e->root_window = root_win; - e->timestamp = timestamp; - e->same_screen = same_screen; - e->event_window = event_win; - e->modifiers = _ecore_xcb_events_modifiers_get(modifiers); - e->x = x; - e->y = y; - e->root.x = root_x; - e->root.y = root_y; - e->multi.device = dev; - e->multi.radius = ((radx + rady) / 2); - e->multi.radius_x = radx; - e->multi.radius_y = rady; - e->multi.pressure = pressure; - e->multi.angle = angle; - e->multi.x = mx; - e->multi.y = my; - e->multi.root.x = mrx; - e->multi.root.y = mry; - - ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, - _ecore_xcb_event_mouse_move_free, NULL); - - _ecore_xcb_event_last_time = e->timestamp; - _ecore_xcb_event_last_window = e->window; - _ecore_xcb_event_last_root_x = root_x; - _ecore_xcb_event_last_root_y = root_y; -} - -static void -_ecore_xcb_event_mouse_move_free(void *data EINA_UNUSED, - void *event) -{ - Ecore_Event_Mouse_Move *ev; - - ev = event; -// if (_ecore_xcb_event_last_mouse_move_event) -// { -// _ecore_xcb_event_last_mouse_move = EINA_FALSE; -// _ecore_xcb_event_last_mouse_move_event = NULL; -// } - if (ev) free(ev); -} - -Ecore_Event_Mouse_Button * -_ecore_xcb_event_mouse_button(int event, - uint16_t timestamp, - uint16_t modifiers, - xcb_button_t buttons, - int16_t x, - int16_t y, - int16_t root_x, - int16_t root_y, - xcb_window_t event_win, - xcb_window_t win, - xcb_window_t root_win, - uint8_t same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - int16_t mx, - int16_t my, - int16_t mrx, - int16_t mry) -{ - Ecore_Event_Mouse_Button *e; - Ecore_X_Mouse_Down_Info *info = NULL; - - if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return NULL; - - e->window = win; - e->root_window = root_win; - e->timestamp = timestamp; - e->same_screen = same_screen; - e->event_window = event_win; - e->buttons = buttons; - e->modifiers = _ecore_xcb_events_modifiers_get(modifiers); - e->double_click = 0; - e->triple_click = 0; - e->x = x; - e->y = y; - e->root.x = root_x; - e->root.y = root_y; - - if ((info = _ecore_xcb_event_mouse_down_info_get(dev))) - { - if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && - (info->did_triple)) - { - info->last_win = 0; - info->last_last_win = 0; - info->last_event_win = 0; - info->last_time = 0; - info->last_last_time = 0; - } - if (event_win == win) - { - if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) - { - if (((int)(timestamp - info->last_time) <= - (int)(1000 * _ecore_xcb_double_click_time)) && - (win == info->last_win) && - (event_win == info->last_event_win)) - { - e->double_click = 1; - info->did_double = EINA_TRUE; - } - else - { - info->did_double = EINA_FALSE; - info->did_triple = EINA_FALSE; - } - if (((int)(timestamp - info->last_last_time) <= - (int)(2 * 1000 * _ecore_xcb_double_click_time)) && - (win == info->last_win) && - (win == info->last_last_win) && - (event_win == info->last_event_win) && - (event_win == info->last_last_event_win)) - { - e->triple_click = 1; - info->did_triple = EINA_TRUE; - } - else - info->did_triple = EINA_FALSE; - } - else - { - if (info->did_double) e->double_click = 1; - if (info->did_triple) e->triple_click = 1; - } - } - } - - /* NB: Comment out right now because _ecore_xcb_mouse_up_count is - * only used here...nowhere else in the code */ - - /* if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && */ - /* (!e->double_click) && (!e->triple_click)) */ - /* _ecore_xcb_mouse_up_count = 0; */ - - e->multi.device = dev; - e->multi.radius = ((radx + rady) / 2); - e->multi.radius_x = radx; - e->multi.radius_y = rady; - e->multi.pressure = pressure; - e->multi.angle = angle; - e->multi.x = mx; - e->multi.y = my; - e->multi.root.x = mrx; - e->multi.root.y = mry; - - _ecore_xcb_event_last_time = e->timestamp; - _ecore_xcb_event_last_window = e->window; - _ecore_xcb_event_last_root_x = root_x; - _ecore_xcb_event_last_root_y = root_y; - - ecore_event_add(event, e, NULL, NULL); - - if ((info) && (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && - (win == event_win) && (!info->did_triple)) - { - info->last_last_win = info->last_win; - info->last_win = win; - info->last_last_event_win = info->last_event_win; - info->last_event_win = event_win; - info->last_last_time = info->last_time; - info->last_time = timestamp; - } - - return e; -} - -static Ecore_X_Event_Mode -_ecore_xcb_event_mode_get(uint8_t mode) -{ - switch (mode) - { - case XCB_NOTIFY_MODE_NORMAL: - return ECORE_X_EVENT_MODE_NORMAL; - - case XCB_NOTIFY_MODE_WHILE_GRABBED: - return ECORE_X_EVENT_MODE_WHILE_GRABBED; - - case XCB_NOTIFY_MODE_GRAB: - return ECORE_X_EVENT_MODE_GRAB; - - case XCB_NOTIFY_MODE_UNGRAB: - return ECORE_X_EVENT_MODE_UNGRAB; - - default: - return ECORE_X_EVENT_MODE_NORMAL; - } -} - -static Ecore_X_Event_Detail -_ecore_xcb_event_detail_get(uint8_t detail) -{ - switch (detail) - { - case XCB_NOTIFY_DETAIL_ANCESTOR: - return ECORE_X_EVENT_DETAIL_ANCESTOR; - - case XCB_NOTIFY_DETAIL_VIRTUAL: - return ECORE_X_EVENT_DETAIL_VIRTUAL; - - case XCB_NOTIFY_DETAIL_INFERIOR: - return ECORE_X_EVENT_DETAIL_INFERIOR; - - case XCB_NOTIFY_DETAIL_NONLINEAR: - return ECORE_X_EVENT_DETAIL_NON_LINEAR; - - case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL: - return ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; - - case XCB_NOTIFY_DETAIL_POINTER: - return ECORE_X_EVENT_DETAIL_POINTER; - - case XCB_NOTIFY_DETAIL_POINTER_ROOT: - return ECORE_X_EVENT_DETAIL_POINTER_ROOT; - - case XCB_NOTIFY_DETAIL_NONE: - default: - return ECORE_X_EVENT_DETAIL_ANCESTOR; - } -} - -static void -_ecore_xcb_event_xdnd_enter_free(void *data EINA_UNUSED, - void *event) -{ - Ecore_X_Event_Xdnd_Enter *e; - int i = 0; - - e = event; - for (i = 0; i < e->num_types; i++) - free(e->types[i]); - free(e->types); - free(e); -} - -static void -_ecore_xcb_event_selection_notify_free(void *data EINA_UNUSED, - void *event) -{ - Ecore_X_Event_Selection_Notify *e; - Ecore_X_Selection_Data *sel; - - e = event; - if (!(sel = e->data)) return; - if (sel->free) sel->free(sel); - free(e->target); - free(e); -} - -static void -_ecore_xcb_event_generic_event_free(void *data, - void *event) -{ - Ecore_X_Event_Generic *e; - - e = (Ecore_X_Event_Generic *)event; - if (e->data) free(data); - free(e); -} - -static void -_ecore_xcb_event_mouse_down_info_clear(void) -{ - Eina_Inlist *l; - Ecore_X_Mouse_Down_Info *info = NULL; - - l = _ecore_xcb_mouse_down_info_list; - while (l) - { - info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info); - l = eina_inlist_remove(l, l); - free(info); - } - _ecore_xcb_mouse_down_info_list = NULL; -} - -static Ecore_X_Mouse_Down_Info * -_ecore_xcb_event_mouse_down_info_get(int dev) -{ - Eina_Inlist *l; - Ecore_X_Mouse_Down_Info *info = NULL; - - l = _ecore_xcb_mouse_down_info_list; - EINA_INLIST_FOREACH(l, info) - if (info->dev == dev) return info; - - if (!(info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)))) return NULL; - - info->dev = dev; - l = eina_inlist_append(l, (Eina_Inlist *)info); - _ecore_xcb_mouse_down_info_list = l; - - return info; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_extensions.c b/src/lib/ecore_x/xcb/ecore_xcb_extensions.c deleted file mode 100644 index a94c23f..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_extensions.c +++ /dev/null @@ -1,156 +0,0 @@ -#include "ecore_xcb_private.h" - -void -_ecore_xcb_extensions_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_big_requests_id); - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shm_id); - -#ifdef ECORE_XCB_SHAPE - _ecore_xcb_shape_init(); -#endif - -#ifdef ECORE_XCB_SCREENSAVER - _ecore_xcb_screensaver_init(); -#endif - -#ifdef ECORE_XCB_SYNC - _ecore_xcb_sync_init(); -#endif - -#ifdef ECORE_XCB_RANDR - _ecore_xcb_randr_init(); -#endif - -#ifdef ECORE_XCB_XFIXES - _ecore_xcb_xfixes_init(); -#endif - -#ifdef ECORE_XCB_DAMAGE - _ecore_xcb_damage_init(); -#endif - -#ifdef ECORE_XCB_RENDER - _ecore_xcb_render_init(); -#endif - -#ifdef ECORE_XCB_COMPOSITE - _ecore_xcb_composite_init(); -#endif - -#ifdef ECORE_XCB_DPMS - _ecore_xcb_dpms_init(); -#endif - -#ifdef ECORE_XCB_DPMS - _ecore_xcb_dpms_init(); -#endif - -#ifdef ECORE_XCB_CURSOR - _ecore_xcb_cursor_init(); -#endif - -#ifdef ECORE_XCB_XINERAMA - _ecore_xcb_xinerama_init(); -#endif - -#ifdef ECORE_XCB_XINPUT - _ecore_xcb_input_init(); -#endif - -#ifdef ECORE_XCB_GESTURE - _ecore_xcb_gesture_init(); -#endif - -#ifdef ECORE_XCB_XPRESENT - _ecore_xcb_present_init(); -#endif - -/* #ifdef ECORE_XCB_DRI */ -/* _ecore_xcb_dri_init(); */ -/* #endif */ - -#ifdef ECORE_XCB_XTEST - _ecore_xcb_xtest_init(); -#endif - - xcb_prefetch_maximum_request_length(_ecore_xcb_conn); -} - -void -_ecore_xcb_extensions_finalize(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xcb_get_extension_data(_ecore_xcb_conn, &xcb_big_requests_id); - xcb_get_extension_data(_ecore_xcb_conn, &xcb_shm_id); - -#ifdef ECORE_XCB_SHAPE - _ecore_xcb_shape_finalize(); -#endif - -#ifdef ECORE_XCB_SCREENSAVER - _ecore_xcb_screensaver_finalize(); -#endif - -#ifdef ECORE_XCB_SYNC - _ecore_xcb_sync_finalize(); -#endif - -#ifdef ECORE_XCB_RANDR - _ecore_xcb_randr_finalize(); -#endif - -#ifdef ECORE_XCB_XFIXES - _ecore_xcb_xfixes_finalize(); -#endif - -#ifdef ECORE_XCB_DAMAGE - _ecore_xcb_damage_finalize(); -#endif - -#ifdef ECORE_XCB_RENDER - _ecore_xcb_render_finalize(); -#endif - -#ifdef ECORE_XCB_COMPOSITE - _ecore_xcb_composite_finalize(); -#endif - -#ifdef ECORE_XCB_DPMS - _ecore_xcb_dpms_finalize(); -#endif - -#ifdef ECORE_XCB_CURSOR - _ecore_xcb_cursor_finalize(); -#endif - -#ifdef ECORE_XCB_XINERAMA - _ecore_xcb_xinerama_finalize(); -#endif - -#ifdef ECORE_XCB_XINPUT - _ecore_xcb_input_finalize(); -#endif - -#ifdef ECORE_XCB_GESTURE - _ecore_xcb_gesture_finalize(); -#endif - -#ifdef ECORE_XCB_XPRESENT - _ecore_xcb_present_finalize(); -#endif - -/* #ifdef ECORE_XCB_DRI */ -/* _ecore_xcb_dri_finalize(); */ -/* #endif */ - -#ifdef ECORE_XCB_XTEST - _ecore_xcb_xtest_finalize(); -#endif - - xcb_get_maximum_request_length(_ecore_xcb_conn); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_gc.c b/src/lib/ecore_x/xcb/ecore_xcb_gc.c deleted file mode 100644 index d811b54..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_gc.c +++ /dev/null @@ -1,173 +0,0 @@ -#include "ecore_xcb_private.h" - -/** - * Creates a new default graphics context associated with the given - * drawable. - * @param draw Drawable to create graphics context with. If @c 0 is - * given instead, the default root window is used. - * @param value_mask Bitmask values. - * @param value_list List of values. The order of values must be the - * same than the corresponding bitmaks. - * @return The new default graphics context. - */ -EAPI Ecore_X_GC -ecore_x_gc_new(Ecore_X_Drawable drawable, - Ecore_X_GC_Value_Mask value_mask, - const unsigned int *value_list) -{ - xcb_gcontext_t gc; - uint32_t vmask = 0; - int i = 0, mask = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - for (i = 0, mask = 1; i <= 22; i++, mask <<= 1) - { - switch (mask & value_mask) - { - case ECORE_X_GC_VALUE_MASK_FUNCTION: - vmask |= XCB_GC_FUNCTION; - break; - - case ECORE_X_GC_VALUE_MASK_PLANE_MASK: - vmask |= XCB_GC_PLANE_MASK; - break; - - case ECORE_X_GC_VALUE_MASK_FOREGROUND: - vmask |= XCB_GC_FOREGROUND; - break; - - case ECORE_X_GC_VALUE_MASK_BACKGROUND: - vmask |= XCB_GC_BACKGROUND; - break; - - case ECORE_X_GC_VALUE_MASK_LINE_WIDTH: - vmask |= XCB_GC_LINE_WIDTH; - break; - - case ECORE_X_GC_VALUE_MASK_LINE_STYLE: - vmask |= XCB_GC_LINE_STYLE; - break; - - case ECORE_X_GC_VALUE_MASK_CAP_STYLE: - vmask |= XCB_GC_CAP_STYLE; - break; - - case ECORE_X_GC_VALUE_MASK_JOIN_STYLE: - vmask |= XCB_GC_JOIN_STYLE; - break; - - case ECORE_X_GC_VALUE_MASK_FILL_STYLE: - vmask |= XCB_GC_FILL_STYLE; - break; - - case ECORE_X_GC_VALUE_MASK_FILL_RULE: - vmask |= XCB_GC_FILL_RULE; - break; - - case ECORE_X_GC_VALUE_MASK_TILE: - vmask |= XCB_GC_TILE; - break; - - case ECORE_X_GC_VALUE_MASK_STIPPLE: - vmask |= XCB_GC_STIPPLE; - break; - - case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X: - vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_X; - break; - - case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y: - vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_Y; - break; - - case ECORE_X_GC_VALUE_MASK_FONT: - vmask |= XCB_GC_FONT; - break; - - case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE: - vmask |= XCB_GC_SUBWINDOW_MODE; - break; - - case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES: - vmask |= XCB_GC_GRAPHICS_EXPOSURES; - break; - - case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X: - vmask |= XCB_GC_CLIP_ORIGIN_X; - break; - - case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y: - vmask |= XCB_GC_CLIP_ORIGIN_Y; - break; - - case ECORE_X_GC_VALUE_MASK_CLIP_MASK: - vmask |= XCB_GC_CLIP_MASK; - break; - - case ECORE_X_GC_VALUE_MASK_DASH_OFFSET: - vmask |= XCB_GC_DASH_OFFSET; - break; - - case ECORE_X_GC_VALUE_MASK_DASH_LIST: - vmask |= XCB_GC_DASH_LIST; - break; - - case ECORE_X_GC_VALUE_MASK_ARC_MODE: - vmask |= XCB_GC_ARC_MODE; - break; - } - } - - gc = xcb_generate_id(_ecore_xcb_conn); - xcb_create_gc(_ecore_xcb_conn, gc, drawable, vmask, value_list); - -// ecore_x_flush(); - return gc; -} - -/** - * Deletes and frees the given graphics context. - * @param gc The given graphics context. - */ -EAPI void -ecore_x_gc_free(Ecore_X_GC gc) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_free_gc(_ecore_xcb_conn, gc); -// ecore_x_flush(); -} - -EAPI void -ecore_x_gc_foreground_set(Ecore_X_GC gc, - unsigned long foreground) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = foreground; - xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_FOREGROUND, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_gc_background_set(Ecore_X_GC gc, - unsigned long background) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = background; - xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_BACKGROUND, &list); -// ecore_x_flush(); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_gesture.c b/src/lib/ecore_x/xcb/ecore_xcb_gesture.c deleted file mode 100644 index 27c1316..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_gesture.c +++ /dev/null @@ -1,203 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_XGESTURE -# include -# include -#endif - -/* local variables */ -static Eina_Bool _gesture_available = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_gesture = -1; - -void -_ecore_xcb_gesture_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XGESTURE - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_gesture_id); -#endif -} - -void -_ecore_xcb_gesture_finalize(void) -{ -#ifdef ECORE_XCB_XGESTURE - xcb_gesture_query_version_cookie_t cookie; - xcb_gesture_query_version_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XGESTURE - cookie = - xcb_gesture_query_version_unchecked(_ecore_xcb_conn); - reply = - xcb_gesture_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - _gesture_available = EINA_TRUE; - free(reply); - } - - if (_gesture_available) - { - const xcb_query_extension_reply_t *ext_reply; - - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_gesture_id); - if (ext_reply) - _ecore_xcb_event_gesture = ext_reply->first_event; - } -#endif -} - -void -_ecore_xcb_gesture_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -} - -EAPI Eina_Bool -ecore_x_gesture_supported(void) -{ - return _gesture_available; -} - -#ifdef ECORE_XCB_XGESTURE -EAPI Eina_Bool -ecore_x_gesture_events_select(Ecore_X_Window win, - Ecore_X_Gesture_Event_Mask mask) -#else -EAPI Eina_Bool -ecore_x_gesture_events_select(Ecore_X_Window win EINA_UNUSED, - Ecore_X_Gesture_Event_Mask mask EINA_UNUSED) -#endif - -{ -#ifdef ECORE_XCB_XGESTURE - if (!_gesture_available) return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN - - xcb_gesture_select_events(_ecore_xcb_conn, win, mask); - - return EINA_TRUE; -#else - return EINA_FALSE; -#endif -} - -#ifdef ECORE_XCB_XGESTURE -EAPI Ecore_X_Gesture_Event_Mask -ecore_x_gesture_events_selected_get(Ecore_X_Window win) -#else -EAPI Ecore_X_Gesture_Event_Mask -ecore_x_gesture_events_selected_get(Ecore_X_Window win EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XGESTURE - xcb_gesture_get_selected_events_cookie_t ecookie; - xcb_gesture_get_selected_events_reply_t *ereply; - Ecore_X_Gesture_Event_Mask mask = ECORE_X_GESTURE_EVENT_MASK_NONE; - - if (!_gesture_available) return mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN - - ecookie = xcb_gesture_get_selected_events(_ecore_xcb_conn, win); - ereply = - xcb_gesture_get_selected_events_reply(_ecore_xcb_conn, ecookie, NULL); - if (ereply) - { - mask = ereply->mask; - free(ereply); - } - - return mask; -#else - return ECORE_X_GESTURE_EVENT_MASK_NONE; -#endif -} - -#ifdef ECORE_XCB_XGESTURE -EAPI Eina_Bool -ecore_x_gesture_event_grab(Ecore_X_Window win, - Ecore_X_Gesture_Event_Type type, - int num_fingers) -#else -EAPI Eina_Bool -ecore_x_gesture_event_grab(Ecore_X_Window win EINA_UNUSED, - Ecore_X_Gesture_Event_Type type EINA_UNUSED, - int num_fingers EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XGESTURE - Eina_Bool status = EINA_TRUE; - xcb_gesture_grab_event_cookie_t ecookie; - xcb_gesture_grab_event_reply_t *ereply; - - if (!_gesture_available) return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN - - ecookie = - xcb_gesture_grab_event(_ecore_xcb_conn, win, type, num_fingers, 0L); - ereply = xcb_gesture_grab_event_reply(_ecore_xcb_conn, ecookie, NULL); - - if (ereply) - { - if (ereply->status) status = EINA_FALSE; - free(ereply); - } - else - status = EINA_FALSE; - - return status; -#else - return EINA_FALSE; -#endif -} - -#ifdef ECORE_XCB_XGESTURE -EAPI Eina_Bool -ecore_x_gesture_event_ungrab(Ecore_X_Window win, - Ecore_X_Gesture_Event_Type type, - int num_fingers) -#else -EAPI Eina_Bool -ecore_x_gesture_event_ungrab(Ecore_X_Window win EINA_UNUSED, - Ecore_X_Gesture_Event_Type type EINA_UNUSED, - int num_fingers EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XGESTURE - Eina_Bool status = EINA_TRUE; - xcb_gesture_ungrab_event_cookie_t ecookie; - xcb_gesture_ungrab_event_reply_t *ereply; - - if (!_gesture_available) return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN - - ecookie = - xcb_gesture_ungrab_event(_ecore_xcb_conn, win, type, num_fingers, 0L); - ereply = xcb_gesture_ungrab_event_reply(_ecore_xcb_conn, ecookie, NULL); - - if (ereply) - { - if (ereply->status) status = EINA_FALSE; - free(ereply); - } - else - status = EINA_FALSE; - - return status; -#else - return EINA_FALSE; -#endif -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c deleted file mode 100644 index 9514674..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c +++ /dev/null @@ -1,1259 +0,0 @@ -#include "ecore_xcb_private.h" -#include - -EAPI void -ecore_x_icccm_init(void) -{ -} - -/** - * Sets the WM_COMMAND property for @a win. - * - * @param win The window. - * @param argc Number of arguments. - * @param argv Arguments. - */ -EAPI void -ecore_x_icccm_command_set(Ecore_X_Window win, - int argc, - char **argv) -{ - void *buf; - char *b; - int nbytes, i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - for (i = 0, nbytes = 0; i < argc; i++) - if (argv[i]) nbytes += strlen(argv[i]) + 1; - - buf = malloc(sizeof(char) * nbytes); - if (!buf) return; - - b = (char *)buf; - for (i = 0; i < argc; i++) - { - if (argv[i]) - { - strcpy(b, argv[i]); - b += strlen(argv[i]) + 1; - } - else - *b++ = '\0'; - } - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8, - nbytes, buf); - free(buf); -} - -/** - * Get the WM_COMMAND property for @a win. - * - * Return the command of a window. String must be free'd when done with. - * - * @param win The window. - * @param argc Number of arguments. - * @param argv Arguments. - */ -EAPI void -ecore_x_icccm_command_get(Ecore_X_Window win, - int *argc, - char ***argv) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - int len = 0; - char **v, *data, *cp, *start; - int c = 0, i = 0, j = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (argc) *argc = 0; - if (argv) *argv = NULL; - - cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, - ECORE_X_ATOM_WM_COMMAND, - XCB_GET_PROPERTY_TYPE_ANY, - 0, 1000000L); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - - if ((reply->type != ECORE_X_ATOM_STRING) || (reply->format != 8)) - { - free(reply); - return; - } - - len = reply->value_len; - if (len < 1) - { - free(reply); - return; - } - - data = (char *)xcb_get_property_value(reply); - if (len && (data[len - 1] == '\0')) - len--; - - c = 1; - for (cp = (char *)data, i = len; i > 0; cp++, i--) - if (*cp == '\0') c++; - - v = (char **)malloc((c + 1) * sizeof(char *)); - if (!v) - { - free(reply); - return; - } - - start = (char *)malloc((len + 1) * sizeof(char)); - if (!start) - { - free(reply); - free(v); - return; - } - - memcpy(start, (char *)data, len); - start[len] = '\0'; - for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) - { - if (*cp == '\0') - { - v[j] = start; - start = (cp + 1); - j++; - } - } - - if (c < 1) - { - free(reply); - free(v); - return; - } - - if (argc) *argc = c; - - if (argv) - { - (*argv) = malloc(c * sizeof(char *)); - if (!*argv) - { - free(reply); - free(v); - if (argc) *argc = 0; - return; - } - - for (i = 0; i < c; i++) - { - if (v[i]) - (*argv)[i] = strdup(v[i]); - else - (*argv)[i] = strdup(""); - } - } - - free(reply); - free(v); -} - -EAPI char * -ecore_x_icccm_title_get(Ecore_X_Window win) -{ - xcb_get_property_cookie_t cookie; - xcb_icccm_get_text_property_reply_t prop; - uint8_t ret = 0; - char *title = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return NULL; - cookie = xcb_icccm_get_wm_name_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); - if (ret == 0) return NULL; - if (prop.name_len < 1) - { - xcb_icccm_get_text_property_reply_wipe(&prop); - return NULL; - } - - if (!(title = malloc((prop.name_len + 1) * sizeof(char *)))) - { - xcb_icccm_get_text_property_reply_wipe(&prop); - return NULL; - } - memcpy(title, prop.name, sizeof(char *) * prop.name_len); - title[prop.name_len] = '\0'; - - if (prop.encoding != ECORE_X_ATOM_UTF8_STRING) - { - Ecore_Xcb_Textproperty tp; - int count = 0; - char **list = NULL; - Eina_Bool ret = EINA_FALSE; - - tp.value = strdup(title); - tp.nitems = prop.name_len; - tp.encoding = prop.encoding; -#ifdef HAVE_ICONV - ret = _ecore_xcb_utf8_textproperty_to_textlist(&tp, &list, &count); -#else - ret = _ecore_xcb_mb_textproperty_to_textlist(&tp, &list, &count); -#endif - if (ret) - { - if (count > 0) - title = strdup(list[0]); - - if (list) free(list); - } - } - - xcb_icccm_get_text_property_reply_wipe(&prop); - return title; -} - -EAPI void -ecore_x_icccm_title_set(Ecore_X_Window win, - const char *title) -{ - Ecore_Xcb_Textproperty prop; - char *list[1]; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!title) return; - - prop.value = NULL; - list[0] = strdup(title); - -#ifdef HAVE_ICONV - ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle, - &prop); -#else - ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle, - &prop); -#endif - - if (ret) - { - xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8, - strlen(prop.value), prop.value); - if (prop.value) free(prop.value); - } - else - xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8, - strlen(title), title); - free(list[0]); -} - -/** - * Get a window name & class. - * @param win The window - * @param n The name string - * @param c The class string - * - * Get a window name * class - */ -EAPI void -ecore_x_icccm_name_class_get(Ecore_X_Window win, - char **name, - char **class) -{ - xcb_get_property_cookie_t cookie; - xcb_icccm_get_wm_class_reply_t prop; - uint8_t ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (name) *name = NULL; - if (class) *class = NULL; - - cookie = xcb_icccm_get_wm_class_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL); - if (ret == 0) return; - - if (name) *name = strdup(prop.instance_name); - if (class) *class = strdup(prop.class_name); - - xcb_icccm_get_wm_class_reply_wipe(&prop); -} - -/** - * Set a window name & class. - * @param win The window - * @param n The name string - * @param c The class string - * - * Set a window name * class - */ -EAPI void -ecore_x_icccm_name_class_set(Ecore_X_Window win, - const char *name, - const char *class) -{ - char *class_string, *s; - int length_name = 0, length_class = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (name) length_name = strlen(name); - if (class) length_class = strlen(class); - class_string = - (char *)malloc(sizeof(char) * (length_name + length_class + 2)); - if (!class_string) return; - - s = class_string; - if (length_name) - { - strcpy(s, name); - s += length_name + 1; - } - else - *s++ = '\0'; - - if (length_class) - strcpy(s, class); - else - *s = '\0'; - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - ECORE_X_ATOM_WM_CLASS, ECORE_X_ATOM_STRING, 8, - length_name + length_class + 2, (void *)class_string); - free(class_string); -} - -/** - * Specify that a window is transient for another top-level window and should be handled accordingly. - * @param win the transient window - * @param forwin the toplevel window - */ -EAPI void -ecore_x_icccm_transient_for_set(Ecore_X_Window win, - Ecore_X_Window forwindow) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32, - 1, (void *)&forwindow); -} - -/** - * Remove the transient_for setting from a window. - * @param win The window - */ -EAPI void -ecore_x_icccm_transient_for_unset(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_TRANSIENT_FOR); -} - -/** - * Get the window this window is transient for, if any. - * @param win The window to check - * @return The window ID of the top-level window, or 0 if the property does not exist. - */ -EAPI Ecore_X_Window -ecore_x_icccm_transient_for_get(Ecore_X_Window win) -{ - Ecore_X_Window forwin = 0; - xcb_get_property_cookie_t cookie; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_icccm_get_wm_transient_for_unchecked(_ecore_xcb_conn, win); - xcb_icccm_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL); - - return forwin; -} - -/** - * Get the window role. - * @param win The window - * @return The window's role string. - */ -EAPI char * -ecore_x_icccm_window_role_get(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE); -} - -/** - * Set the window role hint. - * @param win The window - * @param role The role string - */ -EAPI void -ecore_x_icccm_window_role_set(Ecore_X_Window win, - const char *role) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE, role); -} - -/** - * Get the window's client leader. - * @param win The window - * @return The window's client leader window, or 0 if unset - */ -EAPI Ecore_X_Window -ecore_x_icccm_client_leader_get(Ecore_X_Window win) -{ - Ecore_X_Window leader; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER, - &leader, 1) > 0) - return leader; - - return 0; -} - -/** - * Set the window's client leader. - * @param win The window - * @param l The client leader window - * - * All non-transient top-level windows created by an app other than - * the main window must have this property set to the app's main window. - */ -EAPI void -ecore_x_icccm_client_leader_set(Ecore_X_Window win, - Ecore_X_Window leader) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER, - &leader, 1); -} - -EAPI Ecore_X_Window_State_Hint -ecore_x_icccm_state_get(Ecore_X_Window win) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - Ecore_X_Window_State_Hint hint = ECORE_X_WINDOW_STATE_HINT_NONE; - uint8_t *prop; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = - xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, - ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE, - 0L, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return hint; - if ((reply->type == 0) || (reply->format != 8) || (reply->value_len != 2)) - { - free(reply); - return hint; - } - - prop = (uint8_t *)xcb_get_property_value(reply); - switch (prop[0]) - { - case XCB_ICCCM_WM_STATE_WITHDRAWN: - hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; - break; - - case XCB_ICCCM_WM_STATE_NORMAL: - hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; - break; - - case XCB_ICCCM_WM_STATE_ICONIC: - hint = ECORE_X_WINDOW_STATE_HINT_ICONIC; - break; - - default: - break; - } - - free(reply); - return hint; -} - -EAPI void -ecore_x_icccm_state_set(Ecore_X_Window win, - Ecore_X_Window_State_Hint state) -{ - xcb_icccm_wm_hints_t hints; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_icccm_wm_hints_set_none(&hints); - - hints.flags = XCB_ICCCM_WM_HINT_STATE; - - if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) - xcb_icccm_wm_hints_set_withdrawn(&hints); - else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) - xcb_icccm_wm_hints_set_normal(&hints); - else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) - xcb_icccm_wm_hints_set_iconic(&hints); - - xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints); -} - -EAPI void -ecore_x_icccm_delete_window_send(Ecore_X_Window win, - Ecore_X_Time t) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, - ECORE_X_EVENT_MASK_NONE, - ECORE_X_ATOM_WM_DELETE_WINDOW, t, 0, 0, 0); -} - -EAPI void -ecore_x_icccm_hints_set(Ecore_X_Window win, - Eina_Bool accepts_focus, - Ecore_X_Window_State_Hint initial_state, - Ecore_X_Pixmap icon_pixmap, - Ecore_X_Pixmap icon_mask, - Ecore_X_Window icon_window, - Ecore_X_Window window_group, - Eina_Bool is_urgent) -{ - xcb_icccm_wm_hints_t hints; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_icccm_wm_hints_set_none(&hints); - xcb_icccm_wm_hints_set_input(&hints, accepts_focus); - - if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) - xcb_icccm_wm_hints_set_withdrawn(&hints); - else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL) - xcb_icccm_wm_hints_set_normal(&hints); - else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC) - xcb_icccm_wm_hints_set_iconic(&hints); - - if (icon_pixmap != 0) - xcb_icccm_wm_hints_set_icon_pixmap(&hints, icon_pixmap); - if (icon_mask != 0) - xcb_icccm_wm_hints_set_icon_mask(&hints, icon_mask); - if (icon_window != 0) - xcb_icccm_wm_hints_set_icon_window(&hints, icon_window); - if (window_group != 0) - xcb_icccm_wm_hints_set_window_group(&hints, window_group); - if (is_urgent) - xcb_icccm_wm_hints_set_urgency(&hints); - - xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints); -} - -EAPI Eina_Bool -ecore_x_icccm_hints_get(Ecore_X_Window win, - Eina_Bool *accepts_focus, - Ecore_X_Window_State_Hint *initial_state, - Ecore_X_Pixmap *icon_pixmap, - Ecore_X_Pixmap *icon_mask, - Ecore_X_Window *icon_window, - Ecore_X_Window *window_group, - Eina_Bool *is_urgent) -{ - xcb_get_property_cookie_t cookie; - xcb_icccm_wm_hints_t hints; - uint8_t ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (accepts_focus) *accepts_focus = EINA_TRUE; - if (initial_state) *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; - if (icon_pixmap) *icon_pixmap = 0; - if (icon_mask) *icon_mask = 0; - if (icon_window) *icon_window = 0; - if (window_group) *window_group = 0; - if (is_urgent) *is_urgent = EINA_FALSE; - - xcb_icccm_wm_hints_set_none(&hints); - cookie = xcb_icccm_get_wm_hints_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); - if (!ret) return EINA_FALSE; - - if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && (accepts_focus)) - { - if (hints.input) - *accepts_focus = EINA_TRUE; - else - *accepts_focus = EINA_FALSE; - } - - if ((hints.flags & XCB_ICCCM_WM_HINT_STATE) && (initial_state)) - { - if (hints.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN) - *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; - else if (hints.initial_state == XCB_ICCCM_WM_STATE_NORMAL) - *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; - else if (hints.initial_state == XCB_ICCCM_WM_STATE_ICONIC) - *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC; - } - - if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_PIXMAP) && (icon_pixmap)) - *icon_pixmap = hints.icon_pixmap; - - if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_MASK) && (icon_mask)) - *icon_mask = hints.icon_mask; - - if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_WINDOW) && (icon_window)) - *icon_window = hints.icon_window; - - if ((hints.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) && (window_group)) - *window_group = hints.window_group; - - if ((hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY) && (is_urgent)) - *is_urgent = EINA_TRUE; - - return EINA_TRUE; -} - -/** - * Get a window icon name. - * @param win The window - * @return The windows icon name string - * - * Return the icon name of a window. String must be free'd when done with. - */ -EAPI char * -ecore_x_icccm_icon_name_get(Ecore_X_Window win) -{ - xcb_get_property_cookie_t cookie; - xcb_icccm_get_text_property_reply_t prop; - uint8_t ret = 0; - char *tmp = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return NULL; - - cookie = xcb_icccm_get_wm_icon_name_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); - if (ret == 0) return NULL; - - if (prop.name_len < 1) - { - xcb_icccm_get_text_property_reply_wipe(&prop); - return NULL; - } - - if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *)))) - { - xcb_icccm_get_text_property_reply_wipe(&prop); - return NULL; - } - memcpy(tmp, prop.name, sizeof(char *) * prop.name_len); - tmp[prop.name_len] = '\0'; - - if (prop.encoding != ECORE_X_ATOM_UTF8_STRING) - { - Ecore_Xcb_Textproperty tp; - int count = 0; - char **list = NULL; - Eina_Bool ret = EINA_FALSE; - - tp.value = strdup(tmp); - tp.nitems = prop.name_len; - tp.encoding = prop.encoding; -#ifdef HAVE_ICONV - ret = _ecore_xcb_utf8_textproperty_to_textlist(&tp, &list, &count); -#else - ret = _ecore_xcb_mb_textproperty_to_textlist(&tp, &list, &count); -#endif - if (ret) - { - if (count > 0) - tmp = strdup(list[0]); - - if (list) free(list); - } - } - - xcb_icccm_get_text_property_reply_wipe(&prop); - return tmp; -} - -/** - * Set a window icon name. - * @param win The window - * @param t The icon name string - * - * Set a window icon name - */ -EAPI void -ecore_x_icccm_icon_name_set(Ecore_X_Window win, - const char *name) -{ - Ecore_Xcb_Textproperty prop; - char *list[1]; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!win) || (!name)) return; - - prop.value = NULL; - list[0] = strdup(name); - -#ifdef HAVE_ICONV - ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle, - &prop); -#else - ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle, - &prop); -#endif - - if (ret) - { - xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, - 8, strlen(prop.value), prop.value); - if (prop.value) free(prop.value); - } - else - xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, - 8, strlen(name), name); - - free(list[0]); -} - -EAPI void -ecore_x_icccm_iconic_request_send(Ecore_X_Window win, - Ecore_X_Window root) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_WM_CHANGE_STATE; - ev.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT), - (const char *)&ev); -// ecore_x_flush(); -} - -/** - * Set or unset a wm protocol property. - * @param win The Window - * @param protocol The protocol to enable/disable - * @param on On/Off - */ -EAPI void -ecore_x_icccm_protocol_set(Ecore_X_Window win, - Ecore_X_WM_Protocol protocol, - Eina_Bool on) -{ - Ecore_X_Atom proto; - xcb_get_property_cookie_t cookie; - xcb_icccm_get_wm_protocols_reply_t protos; - int i = 0, count = 0, set = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return; - proto = _ecore_xcb_atoms_wm_protocol[protocol]; - cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); - if (!xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL)) - count = 0; - else - count = protos.atoms_len; - - for (i = 0; i < count; i++) - { - if (protos.atoms[i] == proto) - { - set = 1; - break; - } - } - - if (on) - { - if (!set) - { - Ecore_X_Atom *atoms = NULL; - - atoms = malloc((count + 1) * sizeof(Ecore_X_Atom)); - if (atoms) - { - for (i = 0; i < count; i++) - atoms[i] = protos.atoms[i]; - atoms[count] = proto; - xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, - ECORE_X_ATOM_WM_PROTOCOLS, - count, atoms); - free(atoms); - } - } - } - else - { - if (set) - { - for (i = 0; i < count; i++) - { - if (protos.atoms[i] == proto) - { - int j = 0; - - for (j = (i + 1); j < count; j++) - protos.atoms[j - 1] = protos.atoms[j]; - if (count > 1) - xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, - ECORE_X_ATOM_WM_PROTOCOLS, - count - 1, protos.atoms); - else - ecore_x_window_prop_property_del(win, - ECORE_X_ATOM_WM_PROTOCOLS); - break; - } - } - } - } - - xcb_icccm_get_wm_protocols_reply_wipe(&protos); -} - -/** - * Determines whether a protocol is set for a window. - * @param win The Window - * @param protocol The protocol to query - * @return 1 if the protocol is set, else 0. - */ -EAPI Eina_Bool -ecore_x_icccm_protocol_isset(Ecore_X_Window win, - Ecore_X_WM_Protocol protocol) -{ - Ecore_X_Atom proto; - Eina_Bool ret = EINA_FALSE; - xcb_get_property_cookie_t cookie; - xcb_icccm_get_wm_protocols_reply_t reply; - uint8_t val = 0; - unsigned int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE; - - proto = _ecore_xcb_atoms_wm_protocol[protocol]; - cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); - val = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL); - if (!val) return EINA_FALSE; - - for (i = 0; i < reply.atoms_len; i++) - if (reply.atoms[i] == proto) - { - ret = EINA_TRUE; - break; - } - - xcb_icccm_get_wm_protocols_reply_wipe(&reply); - - return ret; -} - -/** - * Set protocol atoms explicitly - * @param win The Window - * @param protos An array of protocol atoms - * @param num the number of members of the array - */ -EAPI void -ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, - Ecore_X_Atom *protos, - int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num > 0) - xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, - ECORE_X_ATOM_WM_PROTOCOLS, num, protos); - else - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS); -} - -EAPI Eina_Bool -ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, - Eina_Bool *request_pos, - Ecore_X_Gravity *gravity, - int *min_w, - int *min_h, - int *max_w, - int *max_h, - int *base_w, - int *base_h, - int *step_x, - int *step_y, - double *min_aspect, - double *max_aspect) -{ - xcb_size_hints_t hints; - xcb_get_property_cookie_t cookie; - uint8_t ret = 0; - int32_t minw = 0, minh = 0; - int32_t maxw = 32767, maxh = 32767; - int32_t basew = -1, baseh = -1; - int32_t stepx = -1, stepy = -1; - double mina = 0.0, maxa = 0.0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (request_pos) *request_pos = EINA_FALSE; - if (gravity) *gravity = ECORE_X_GRAVITY_NW; - if (min_w) *min_w = minw; - if (min_h) *min_h = minh; - if (max_w) *max_w = maxw; - if (max_h) *max_h = maxh; - if (base_w) *base_w = basew; - if (base_h) *base_h = baseh; - if (step_x) *step_x = stepx; - if (step_y) *step_y = stepy; - if (min_aspect) *min_aspect = mina; - if (max_aspect) *max_aspect = maxa; - - cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, - &hints, NULL); - if (!ret) return EINA_FALSE; - - if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) || - (hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION)) - { - if (request_pos) *request_pos = EINA_TRUE; - } - - if (hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY) - { - if (gravity) *gravity = hints.win_gravity; - } - - if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) - { - minw = hints.min_width; - minh = hints.min_height; - } - - if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) - { - maxw = hints.max_width; - maxh = hints.max_height; - if (maxw < minw) maxw = minw; - if (maxh < minh) maxh = minh; - } - - if (hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE) - { - basew = hints.base_width; - baseh = hints.base_height; - if (basew > minw) minw = basew; - if (baseh > minh) minh = baseh; - } - - if (hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC) - { - stepx = hints.width_inc; - stepy = hints.height_inc; - if (stepx < 1) stepx = 1; - if (stepy < 1) stepy = 1; - } - - if (hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT) - { - if (hints.min_aspect_den > 0) - mina = ((double)hints.min_aspect_num) / ((double)hints.min_aspect_den); - - if (hints.max_aspect_den > 0) - maxa = ((double)hints.max_aspect_num) / ((double)hints.max_aspect_den); - } - - if (min_w) *min_w = minw; - if (min_h) *min_h = minh; - if (max_w) *max_w = maxw; - if (max_h) *max_h = maxh; - if (base_w) *base_w = basew; - if (base_h) *base_h = baseh; - if (step_x) *step_x = stepx; - if (step_y) *step_y = stepy; - if (min_aspect) *min_aspect = mina; - if (max_aspect) *max_aspect = maxa; - - return EINA_TRUE; -} - -EAPI void -ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, - Eina_Bool request_pos, - Ecore_X_Gravity gravity, - int min_w, - int min_h, - int max_w, - int max_h, - int base_w, - int base_h, - int step_x, - int step_y, - double min_aspect, - double max_aspect) -{ - xcb_get_property_cookie_t cookie; - xcb_size_hints_t hints; - uint8_t ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, - &hints, NULL); - if (!ret) memset(&hints, 0, sizeof(xcb_size_hints_t)); - - hints.flags = 0; - - if (request_pos) - hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION; - - if (gravity != ECORE_X_GRAVITY_NW) - xcb_icccm_size_hints_set_win_gravity(&hints, gravity); - if ((min_w > 0) || (min_h > 0)) - xcb_icccm_size_hints_set_min_size(&hints, min_w, min_h); - if ((max_w > 0) || (max_h > 0)) - xcb_icccm_size_hints_set_max_size(&hints, max_w, max_h); - if ((base_w > 0) || (base_h > 0)) - xcb_icccm_size_hints_set_base_size(&hints, base_w, base_h); - if ((step_x > 1) || (step_y > 1)) - xcb_icccm_size_hints_set_resize_inc(&hints, step_x, step_y); - if ((min_aspect > 0.0) || (max_aspect > 0.0)) - xcb_icccm_size_hints_set_aspect(&hints, - (int32_t)(min_aspect * 10000), 10000, - (int32_t)(max_aspect * 10000), 10000); - - xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints); -} - -EAPI void -ecore_x_icccm_move_resize_send(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - xcb_configure_notify_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - - memset(&ev, 0, sizeof(xcb_configure_notify_event_t)); - - ev.response_type = XCB_CONFIGURE_NOTIFY; - ev.event = win; - ev.window = win; - ev.above_sibling = XCB_NONE; - ev.x = x; - ev.y = y; - ev.width = w; - ev.height = h; - ev.border_width = 0; - ev.override_redirect = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&ev); -// ecore_x_flush(); -} - -/** - * Get a window client machine string. - * @param win The window - * @return The windows client machine string - * - * Return the client machine of a window. String must be free'd when done with. - */ -EAPI char * -ecore_x_icccm_client_machine_get(Ecore_X_Window win) -{ - xcb_get_property_cookie_t cookie; - xcb_icccm_get_text_property_reply_t prop; - uint8_t ret = 0; - char *tmp = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_icccm_get_wm_client_machine_unchecked(_ecore_xcb_conn, win); - ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, - &prop, NULL); - if (ret == 0) return NULL; - - tmp = malloc((prop.name_len + 1) * sizeof(char *)); - if (!tmp) - { - xcb_icccm_get_text_property_reply_wipe(&prop); - return NULL; - } - memcpy(tmp, prop.name, sizeof(char *) * prop.name_len); - tmp[prop.name_len] = '\0'; - - xcb_icccm_get_text_property_reply_wipe(&prop); - - return tmp; -} - -EAPI void -ecore_x_icccm_take_focus_send(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, - ECORE_X_ATOM_WM_TAKE_FOCUS, t, 0, 0, 0); -} - -EAPI void -ecore_x_icccm_save_yourself_send(Ecore_X_Window win, - Ecore_X_Time t) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, - XCB_EVENT_MASK_NO_EVENT, - ECORE_X_ATOM_WM_SAVE_YOURSELF, t, 0, 0, 0); -} - -/** - * Add a subwindow to the list of windows that need a different colormap installed. - * @param win The toplevel window - * @param subwin The subwindow to be added to the colormap windows list - */ -EAPI void -ecore_x_icccm_colormap_window_set(Ecore_X_Window win, - Ecore_X_Window subwin) -{ - int num = 0, i = 0; - unsigned char *odata = NULL, *data = NULL; - Ecore_X_Window *newset = NULL, *oldset = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - ECORE_X_ATOM_WINDOW, 32, &odata, &num)) - { - if (!(newset = calloc(1, sizeof(Ecore_X_Window)))) return; - newset[0] = subwin; - num = 1; - data = (unsigned char *)newset; - } - else - { - if (!(newset = calloc(num + 1, sizeof(Ecore_X_Window)))) return; - oldset = (Ecore_X_Window *)odata; - for (i = 0; i < num; i++) - { - if (oldset[i] == subwin) - { - if (odata) free(odata); - odata = NULL; - free(newset); - return; - } - newset[i] = oldset[i]; - } - newset[num++] = subwin; - if (odata) free(odata); - data = (unsigned char *)newset; - } - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - ECORE_X_ATOM_WINDOW, 32, data, num); - free(newset); -} - -/** - * Remove a window from the list of colormap windows. - * @param win The toplevel window - * @param subwin The window to be removed from the colormap window list. - */ -EAPI void -ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, - Ecore_X_Window subwin) -{ - int num = 0, i = 0, j = 0, k = 0; - unsigned char *odata = NULL, *data = NULL; - Ecore_X_Window *newset = NULL, *oldset = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - ECORE_X_ATOM_WINDOW, 32, &odata, &num)) - return; - - oldset = (Ecore_X_Window *)odata; - for (i = 0; i < num; i++) - { - if (oldset[i] == subwin) - { - if (num == 1) - { - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS); - if (odata) free(odata); - odata = NULL; - return; - } - else - { - newset = calloc(num - 1, sizeof(Ecore_X_Window)); - data = (unsigned char *)newset; - for (j = 0; j < num; ++j) - if (oldset[j] != subwin) - newset[k++] = oldset[j]; - - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - ECORE_X_ATOM_WINDOW, 32, data, k); - if (odata) free(odata); - odata = NULL; - free(newset); - return; - } - } - } - if (odata) free(odata); -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_image.c b/src/lib/ecore_x/xcb/ecore_xcb_image.c deleted file mode 100644 index 7c21781..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_image.c +++ /dev/null @@ -1,782 +0,0 @@ -#include "ecore_xcb_private.h" -#include -#include -#include -#include - -struct _Ecore_X_Image -{ - xcb_shm_segment_info_t shminfo; - xcb_image_t *xim; - Ecore_X_Visual vis; - int depth, w, h; - int bpl, bpp, rows; - unsigned char *data; - Eina_Bool shm : 1; -}; - -/* local function prototypes */ -static void _ecore_xcb_image_shm_check(void); -static void _ecore_xcb_image_shm_create(Ecore_X_Image *im); -static xcb_format_t *_ecore_xcb_image_find_format(const xcb_setup_t *setup, - uint8_t depth); - -/* local variables */ -static int _ecore_xcb_image_shm_can = -1; - -EAPI Ecore_X_Image * -ecore_x_image_new(int w, - int h, - Ecore_X_Visual vis, - int depth) -{ - Ecore_X_Image *im; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(im = calloc(1, sizeof(Ecore_X_Image)))) return NULL; - im->w = w; - im->h = h; - im->vis = vis; - im->depth = depth; - _ecore_xcb_image_shm_check(); - im->shm = _ecore_xcb_image_shm_can; - return im; -} - -EAPI void -ecore_x_image_free(Ecore_X_Image *im) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!im) return; - if (im->shm) - { - if (im->xim) - { - xcb_shm_detach(_ecore_xcb_conn, im->shminfo.shmseg); - xcb_image_destroy(im->xim); - shmdt(im->shminfo.shmaddr); - shmctl(im->shminfo.shmid, IPC_RMID, 0); - } - } - else if (im->xim) - { - if (im->xim->data) free(im->xim->data); - im->xim->data = NULL; - xcb_image_destroy(im->xim); - } - - free(im); -// ecore_x_flush(); -} - -EAPI Eina_Bool -ecore_x_image_get(Ecore_X_Image *im, - Ecore_X_Drawable draw, - int x, - int y, - int sx, - int sy, - int w, - int h) -{ - Eina_Bool ret = EINA_TRUE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (im->shm) - { - if (!im->xim) _ecore_xcb_image_shm_create(im); - if (!im->xim) return EINA_FALSE; - - if ((sx == 0) && (w == im->w)) - { - im->xim->data = (uint8_t *)im->data + (im->xim->stride * sy) + - (sx * im->bpp); - im->xim->width = MIN(w, im->w); - im->xim->height = MIN(h, im->h); - - ecore_x_grab(); - if (!xcb_image_shm_get(_ecore_xcb_conn, draw, im->xim, - im->shminfo, x, y, 0xffffffff)) - { - DBG("\tImage Shm Get Failed"); - ret = EINA_FALSE; - } - ecore_x_ungrab(); - ecore_x_sync(); // needed - } - else - { - Ecore_X_Image *tim; - - tim = ecore_x_image_new(w, h, im->vis, im->depth); - if (tim) - { - ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h); - if (ret) - { - unsigned char *spixels, *pixels; - int sbpp = 0, sbpl = 0, srows = 0; - int bpp = 0, bpl = 0, rows = 0; - - spixels = - ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp); - pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp); - if ((spixels) && (pixels)) - { - unsigned char *p, *sp; - int r = 0; - - p = (pixels + (sy * bpl) + (sx * bpp)); - sp = spixels; - for (r = srows; r > 0; r--) - { - memcpy(p, sp, sbpl); - p += bpl; - sp += sbpl; - } - } - } - ecore_x_image_free(tim); - } - } - } - else - { - ret = EINA_FALSE; - ecore_x_grab(); - im->xim = - xcb_image_get(_ecore_xcb_conn, draw, x, y, w, h, - 0xffffffff, XCB_IMAGE_FORMAT_Z_PIXMAP); - if (!im->xim) ret = EINA_FALSE; - ecore_x_ungrab(); - ecore_x_sync(); // needed - - if (im->xim) - { - im->data = (unsigned char *)im->xim->data; - im->bpl = im->xim->stride; - im->rows = im->xim->height; - if (im->xim->bpp <= 8) - im->bpp = 1; - else if (im->xim->bpp <= 16) - im->bpp = 2; - else - im->bpp = 4; - } - } - - return ret; -} - -EAPI void * -ecore_x_image_data_get(Ecore_X_Image *im, - int *bpl, - int *rows, - int *bpp) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!im) return NULL; - if (!im->xim) _ecore_xcb_image_shm_create(im); - if (!im->xim) return NULL; - - if (bpl) *bpl = im->bpl; - if (rows) *rows = im->rows; - if (bpp) *bpp = im->bpp; - - return im->data; -} - -EAPI void -ecore_x_image_put(Ecore_X_Image *im, - Ecore_X_Drawable draw, - Ecore_X_GC gc, - int x, - int y, - int sx, - int sy, - int w, - int h) -{ - Ecore_X_GC tgc = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!gc) - { - uint32_t mask, values[1]; - - tgc = xcb_generate_id(_ecore_xcb_conn); - mask = XCB_GC_SUBWINDOW_MODE; - values[0] = XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS; - xcb_create_gc(_ecore_xcb_conn, tgc, draw, mask, values); - gc = tgc; - } - if (!im->xim) _ecore_xcb_image_shm_create(im); - if (im->xim) - { - if (im->shm) - xcb_shm_put_image(_ecore_xcb_conn, draw, gc, im->xim->width, - im->xim->height, sx, sy, w, h, x, y, - im->xim->depth, im->xim->format, 0, - im->shminfo.shmseg, - im->xim->data - im->shminfo.shmaddr); -// xcb_image_shm_put(_ecore_xcb_conn, draw, gc, im->xim, -// im->shminfo, sx, sy, x, y, w, h, 0); - else - xcb_image_put(_ecore_xcb_conn, draw, gc, im->xim, sx, sy, 0); - } - if (tgc) ecore_x_gc_free(tgc); - ecore_x_sync(); -} - -EAPI Eina_Bool -ecore_x_image_is_argb32_get(Ecore_X_Image *im) -{ - xcb_visualtype_t *vis; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - vis = (xcb_visualtype_t *)im->vis; - - if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) && - (im->bpp == 4) && - (vis->red_mask == 0xff0000) && - (vis->green_mask == 0x00ff00) && - (vis->blue_mask == 0x0000ff)) - { - const xcb_setup_t *setup = xcb_get_setup(_ecore_xcb_conn); - - if (!setup) return EINA_FALSE; -#ifdef WORDS_BIGENDIAN - if (setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST) return EINA_TRUE; -#else - if (setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST) return EINA_TRUE; -#endif - } - - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_image_to_argb_convert(void *src, - int sbpp, - int sbpl, - Ecore_X_Colormap c, - Ecore_X_Visual v, - int x, - int y, - int w, - int h, - unsigned int *dst, - int dbpl, - int dx, - int dy) -{ - xcb_visualtype_t *vis; - uint32_t *cols; - int n = 0, nret = 0, i, row, mode = 0; - unsigned int pal[256], r, g, b; - enum - { - rgbnone = 0, - rgb565, - bgr565, - rgbx555, - rgb888, - bgr888, - argbx888, - abgrx888, - rgba888x, - bgra888x, - argbx666 - }; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - sbpp *= 8; - - vis = (xcb_visualtype_t *)v; - n = vis->colormap_entries; - if ((n <= 256) && - ((vis->_class == XCB_VISUAL_CLASS_PSEUDO_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) || - (vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY))) - { - xcb_query_colors_cookie_t cookie; - xcb_query_colors_reply_t *reply; - - if (!c) - { - c = (xcb_colormap_t)((xcb_screen_t *) - _ecore_xcb_screen)->default_colormap; - } - - cols = alloca(n * sizeof(uint32_t)); - for (i = 0; i < n; i++) - cols[i] = i; - - cookie = xcb_query_colors_unchecked(_ecore_xcb_conn, c, n, cols); - reply = xcb_query_colors_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - xcb_rgb_iterator_t iter; - xcb_rgb_t *ret; - - iter = xcb_query_colors_colors_iterator(reply); - ret = xcb_query_colors_colors(reply); - if (ret) - { - for (i = 0; iter.rem; xcb_rgb_next(&iter), i++) - { - pal[i] = 0xff000000 | - ((iter.data->red >> 8) << 16) | - ((iter.data->green >> 8) << 8) | - ((iter.data->blue >> 8)); - } - nret = n; - } - free(reply); - } - } - else if ((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) - { - if (sbpp == 24) - { - if ((vis->red_mask == 0x00ff0000) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x000000ff)) - mode = rgb888; - else if ((vis->red_mask == 0x000000ff) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x00ff0000)) - mode = bgr888; - else - return EINA_FALSE; - } - else - { - if ((vis->red_mask == 0x00ff0000) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x000000ff)) - mode = argbx888; - else if ((vis->red_mask == 0x000000ff) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x00ff0000)) - mode = abgrx888; - else if ((vis->red_mask == 0xff000000) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0x0000ff00)) - mode = rgba888x; - else if ((vis->red_mask == 0x0000ff00) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0xff000000)) - mode = bgra888x; - else if ((vis->red_mask == 0x0003f000) && - (vis->green_mask == 0x00000fc0) && - (vis->blue_mask == 0x0000003f)) - mode = argbx666; - else if ((vis->red_mask == 0x0000f800) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgb565; - else if ((vis->red_mask == 0x0000001f) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000f800)) - mode = bgr565; - else if ((vis->red_mask == 0x00007c00) && - (vis->green_mask == 0x000003e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgbx555; - else - return EINA_FALSE; - } - } - for (row = 0; row < h; row++) - { - unsigned char *s8; - unsigned short *s16; - unsigned int *s32, *dp, *de; - - dp = ((unsigned int *)(((unsigned char *)dst) + - ((dy + row) * dbpl))) + dx; - de = dp + w; - switch (sbpp) - { - case 8: - s8 = ((unsigned char *)(((unsigned char *)src) + - ((y + row) * sbpl))) + x; - if (nret > 0) - { - while (dp < de) - { - *dp = pal[*s8]; - s8++; dp++; - } - } - else - return EINA_FALSE; - break; - - case 16: - s16 = ((unsigned short *)(((unsigned char *)src) + - ((y + row) * sbpl))) + x; - switch (mode) - { - case rgb565: - while (dp < de) - { - r = (*s16 & 0xf800) << 8; - g = (*s16 & 0x07e0) << 5; - b = (*s16 & 0x001f) << 3; - r |= (r >> 5) & 0xff0000; - g |= (g >> 6) & 0x00ff00; - b |= (b >> 5); - *dp = 0xff000000 | r | g | b; - s16++; dp++; - } - break; - - case bgr565: - while (dp < de) - { - r = (*s16 & 0x001f) << 19; - g = (*s16 & 0x07e0) << 5; - b = (*s16 & 0xf800) >> 8; - r |= (r >> 5) & 0xff0000; - g |= (g >> 6) & 0x00ff00; - b |= (b >> 5); - *dp = 0xff000000 | r | g | b; - s16++; dp++; - } - break; - - case rgbx555: - while (dp < de) - { - r = (*s16 & 0x7c00) << 9; - g = (*s16 & 0x03e0) << 6; - b = (*s16 & 0x001f) << 3; - r |= (r >> 5) & 0xff0000; - g |= (g >> 5) & 0x00ff00; - b |= (b >> 5); - *dp = 0xff000000 | r | g | b; - s16++; dp++; - } - break; - - default: - return EINA_FALSE; - break; - } - break; - - case 24: - s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + (x * (sbpp / 8)); - switch (mode) - { - case rgb888: - while (dp < de) - { - *dp = 0xff000000 | (s8[2] << 16) | (s8[1] << 8) | s8[0]; - s8 += 3; dp++; - } - break; - case bgr888: - while (dp < de) - { - *dp = 0xff000000 | (s8[0] << 16) | (s8[1] << 8) | s8[2]; - s8 += 3; dp++; - } - break; - default: - return EINA_FALSE; - break; - } - break; - - case 32: - s32 = ((unsigned int *)(((unsigned char *)src) + - ((y + row) * sbpl))) + x; - switch (mode) - { - case argbx888: - while (dp < de) - { - *dp = 0xff000000 | *s32; - s32++; dp++; - } - break; - - case abgrx888: - while (dp < de) - { - r = *s32 & 0x000000ff; - g = *s32 & 0x0000ff00; - b = *s32 & 0x00ff0000; - *dp = 0xff000000 | (r << 16) | (g) | (b >> 16); - s32++; dp++; - } - break; - - case rgba888x: - while (dp < de) - { - *dp = 0xff000000 | (*s32 >> 8); - s32++; dp++; - } - break; - - case bgra888x: - while (dp < de) - { - r = *s32 & 0x0000ff00; - g = *s32 & 0x00ff0000; - b = *s32 & 0xff000000; - *dp = 0xff000000 | (r << 8) | (g >> 8) | (b >> 24); - s32++; dp++; - } - break; - - case argbx666: - while (dp < de) - { - r = (*s32 & 0x3f000) << 6; - g = (*s32 & 0x00fc0) << 4; - b = (*s32 & 0x0003f) << 2; - r |= (r >> 6) & 0xff0000; - g |= (g >> 6) & 0x00ff00; - b |= (b >> 6); - *dp = 0xff000000 | r | g | b; - s32++; dp++; - } - break; - - default: - return EINA_FALSE; - break; - } - break; - - default: - return EINA_FALSE; - break; - } - } - return EINA_TRUE; -} - -/* local functions */ -static void -_ecore_xcb_image_shm_check(void) -{ -// xcb_shm_query_version_reply_t *reply; - xcb_shm_segment_info_t shminfo; - xcb_shm_get_image_cookie_t cookie; - xcb_shm_get_image_reply_t *ireply; - xcb_image_t *img = 0; - uint8_t depth = 0; - - if (_ecore_xcb_image_shm_can != -1) return; - CHECK_XCB_CONN; - - /* reply = */ - /* xcb_shm_query_version_reply(_ecore_xcb_conn, */ - /* xcb_shm_query_version(_ecore_xcb_conn), NULL); */ - /* if (!reply) */ - /* { */ - /* _ecore_xcb_image_shm_can = 0; */ - /* return; */ - /* } */ - - /* if ((reply->major_version < 1) || */ - /* ((reply->major_version == 1) && (reply->minor_version == 0))) */ - /* { */ - /* _ecore_xcb_image_shm_can = 0; */ - /* free(reply); */ - /* return; */ - /* } */ - - /* free(reply); */ - - depth = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth; - - ecore_x_sync(); // needed - - img = _ecore_xcb_image_create_native(1, 1, XCB_IMAGE_FORMAT_Z_PIXMAP, - depth, NULL, ~0, NULL); - if (!img) - { - _ecore_xcb_image_shm_can = 0; - return; - } - - shminfo.shmid = - shmget(IPC_PRIVATE, img->stride * img->height, (IPC_CREAT | 0600)); - if (shminfo.shmid == (uint32_t)-1) - { - xcb_image_destroy(img); - _ecore_xcb_image_shm_can = 0; - return; - } - - shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); - img->data = shminfo.shmaddr; - if (img->data == (uint8_t *)-1) - { - xcb_image_destroy(img); - _ecore_xcb_image_shm_can = 0; - return; - } - - shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn); - xcb_shm_attach(_ecore_xcb_conn, shminfo.shmseg, shminfo.shmid, 0); - - cookie = - xcb_shm_get_image(_ecore_xcb_conn, - ((xcb_screen_t *)_ecore_xcb_screen)->root, - 0, 0, img->width, img->height, - 0xffffffff, img->format, - shminfo.shmseg, img->data - shminfo.shmaddr); - - ecore_x_sync(); // needed - - ireply = xcb_shm_get_image_reply(_ecore_xcb_conn, cookie, NULL); - if (ireply) - { - _ecore_xcb_image_shm_can = 1; - free(ireply); - } - else - _ecore_xcb_image_shm_can = 0; - - xcb_shm_detach(_ecore_xcb_conn, shminfo.shmseg); - xcb_image_destroy(img); - shmdt(shminfo.shmaddr); - shmctl(shminfo.shmid, IPC_RMID, 0); -} - -static void -_ecore_xcb_image_shm_create(Ecore_X_Image *im) -{ - CHECK_XCB_CONN; - - im->xim = - _ecore_xcb_image_create_native(im->w, im->h, XCB_IMAGE_FORMAT_Z_PIXMAP, - im->depth, NULL, ~0, NULL); - if (!im->xim) return; - - im->shminfo.shmid = shmget(IPC_PRIVATE, im->xim->size, (IPC_CREAT | 0600)); - if (im->shminfo.shmid == (uint32_t)-1) - { - xcb_image_destroy(im->xim); - return; - } - - im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0); - im->xim->data = im->shminfo.shmaddr; - if ((!im->xim->data) || (im->xim->data == (uint8_t *)-1)) - { - DBG("Shm Create No Image Data"); - xcb_image_destroy(im->xim); - shmdt(im->shminfo.shmaddr); - shmctl(im->shminfo.shmid, IPC_RMID, 0); - return; - } - - im->shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn); - xcb_shm_attach(_ecore_xcb_conn, im->shminfo.shmseg, im->shminfo.shmid, 0); - - im->data = (unsigned char *)im->xim->data; - im->bpl = im->xim->stride; - im->rows = im->xim->height; - if (im->xim->bpp <= 8) - im->bpp = 1; - else if (im->xim->bpp <= 16) - im->bpp = 2; - else - im->bpp = 4; -} - -xcb_image_t * -_ecore_xcb_image_create_native(int w, - int h, - xcb_image_format_t format, - uint8_t depth, - void *base, - uint32_t bytes, - uint8_t *data) -{ - static uint8_t dpth = 0; - static xcb_format_t *fmt = NULL; - const xcb_setup_t *setup; - xcb_image_format_t xif; - - CHECK_XCB_CONN; - - /* NB: We cannot use xcb_image_create_native as it only creates images - * using MSB_FIRST, so this routine recreates that function and uses - * the endian-ness of the server setup */ - setup = xcb_get_setup(_ecore_xcb_conn); - xif = format; - - if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1)) - xif = XCB_IMAGE_FORMAT_XY_PIXMAP; - - if (dpth != depth) - { - dpth = depth; - fmt = _ecore_xcb_image_find_format(setup, depth); - if (!fmt) return 0; - } - - switch (xif) - { - case XCB_IMAGE_FORMAT_XY_BITMAP: - if (depth != 1) return 0; - - case XCB_IMAGE_FORMAT_XY_PIXMAP: - case XCB_IMAGE_FORMAT_Z_PIXMAP: - return xcb_image_create(w, h, xif, - fmt->scanline_pad, - fmt->depth, fmt->bits_per_pixel, - setup->bitmap_format_scanline_unit, - setup->image_byte_order, - setup->bitmap_format_bit_order, - base, bytes, data); - - default: - break; - } - - return 0; -} - -static xcb_format_t * -_ecore_xcb_image_find_format(const xcb_setup_t *setup, - uint8_t depth) -{ - xcb_format_t *fmt, *fmtend; - - CHECK_XCB_CONN; - - fmt = xcb_setup_pixmap_formats(setup); - fmtend = fmt + xcb_setup_pixmap_formats_length(setup); - for (; fmt != fmtend; ++fmt) - if (fmt->depth == depth) - return fmt; - - return 0; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_input.c b/src/lib/ecore_x/xcb/ecore_xcb_input.c deleted file mode 100644 index cd9e488..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_input.c +++ /dev/null @@ -1,295 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_XINPUT -# include -# include -#endif - -/* FIXME: this is a guess. can't find defines for touch events in xcb libs - * online */ -/* these are not yet defined in xcb support for xi2 - so manually create */ -#ifndef XCB_INPUT_DEVICE_TOUCH_BEGIN -#define XCB_INPUT_DEVICE_TOUCH_BEGIN 18 -#endif -#ifndef XCB_INPUT_DEVICE_TOUCH_END -#define XCB_INPUT_DEVICE_TOUCH_END 19 -#endif -#ifndef XCB_INPUT_DEVICE_TOUCH_UPDATE -#define XCB_INPUT_DEVICE_TOUCH_UPDATE 21 -#endif - -#ifndef XCB_INPUT_POINTER_EMULATED_MASK -#define XCB_INPUT_POINTER_EMULATED_MASK (1 << 16) -#endif - -/* local variables */ -static Eina_Bool _input_avail = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_input = 0; - -void -_ecore_xcb_input_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XINPUT - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_input_id); -#endif -} - -void -_ecore_xcb_input_finalize(void) -{ -#ifdef ECORE_XCB_XINPUT - xcb_input_get_extension_version_cookie_t cookie; - xcb_input_get_extension_version_reply_t *reply; - char buff[128]; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XINPUT - cookie = - xcb_input_get_extension_version_unchecked(_ecore_xcb_conn, 127, buff); - reply = - xcb_input_get_extension_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - _input_avail = EINA_TRUE; - free(reply); - } - - if (_input_avail) - { - const xcb_query_extension_reply_t *ext_reply; - - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_input_id); - if (ext_reply) - _ecore_xcb_event_input = ext_reply->first_event; - } -#endif -} - -void -_ecore_xcb_input_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -} - -void -#ifdef ECORE_XCB_XINPUT -_ecore_xcb_input_handle_event(xcb_generic_event_t *event) -#else -_ecore_xcb_input_handle_event(xcb_generic_event_t * event EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XINPUT - xcb_ge_event_t *ev; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - /* FIXME: look at xlib ecore_x_xi2.c to copy logic in when i can find an - * xcb-input lib to test with */ -#ifdef ECORE_XCB_XINPUT - ev = (xcb_ge_event_t *)event; - switch (ev->event_type) - { - case XCB_INPUT_DEVICE_MOTION_NOTIFY: - { - xcb_input_device_motion_notify_event_t *de; - unsigned int child_win = 0; - - de = (xcb_input_device_motion_notify_event_t *)ev->pad1; - child_win = (de->child ? de->child : de->event); - _ecore_xcb_event_mouse_move(de->time, de->state, de->event_x, - de->event_y, de->root_x, de->root_y, - de->event, child_win, de->root, - de->same_screen, de->device_id, - 1, 1, 1.0, 0.0, - de->event_x, de->event_y, - de->root_x, de->root_y); - } - break; - - case XCB_INPUT_DEVICE_BUTTON_PRESS: - { - xcb_input_device_button_press_event_t *de; - unsigned int child_win = 0; - - de = (xcb_input_device_button_press_event_t *)ev->pad1; - child_win = (de->child ? de->child : de->event); - _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, - de->time, de->state, de->detail, - de->event_x, de->event_y, - de->root_x, de->root_y, de->event, - child_win, de->root, - de->same_screen, de->device_id, - 1, 1, 1.0, 0.0, - de->event_x, de->event_y, - de->root_x, de->root_y); - } - break; - - case XCB_INPUT_DEVICE_BUTTON_RELEASE: - { - xcb_input_device_button_release_event_t *de; - unsigned int child_win = 0; - - de = (xcb_input_device_button_release_event_t *)ev->pad1; - child_win = (de->child ? de->child : de->event); - _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, - de->time, de->state, de->detail, - de->event_x, de->event_y, - de->root_x, de->root_y, de->event, - child_win, de->root, - de->same_screen, de->device_id, - 1, 1, 1.0, 0.0, - de->event_x, de->event_y, - de->root_x, de->root_y); - } - break; - - case XCB_INPUT_DEVICE_TOUCH_UPDATE: - { - xcb_input_device_motion_notify_event_t *de; - unsigned int child_win = 0; - - de = (xcb_input_device_motion_notify_event_t *)ev->pad1; - child_win = (de->child ? de->child : de->event); - _ecore_xcb_event_mouse_move(de->time, de->state, de->event_x, - de->event_y, de->root_x, de->root_y, - de->event, child_win, de->root, - de->same_screen, de->device_id, - 1, 1, 1.0, 0.0, - de->event_x, de->event_y, - de->root_x, de->root_y); - } - break; - - case XCB_INPUT_DEVICE_TOUCH_BEGIN: - { - xcb_input_device_button_press_event_t *de; - unsigned int child_win = 0; - - de = (xcb_input_device_button_press_event_t *)ev->pad1; - child_win = (de->child ? de->child : de->event); - _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, - de->time, de->state, de->detail, - de->event_x, de->event_y, - de->root_x, de->root_y, de->event, - child_win, de->root, - de->same_screen, de->device_id, - 1, 1, 1.0, 0.0, - de->event_x, de->event_y, - de->root_x, de->root_y); - } - break; - - case XCB_INPUT_DEVICE_TOUCH_END: - { - xcb_input_device_button_release_event_t *de; - unsigned int child_win = 0; - - de = (xcb_input_device_button_release_event_t *)ev->pad1; - child_win = (de->child ? de->child : de->event); - _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, - de->time, de->state, de->detail, - de->event_x, de->event_y, - de->root_x, de->root_y, de->event, - child_win, de->root, - de->same_screen, de->device_id, - 1, 1, 1.0, 0.0, - de->event_x, de->event_y, - de->root_x, de->root_y); - } - break; - - default: - break; - } -#endif -} - -EAPI Eina_Bool -ecore_x_input_multi_select(Ecore_X_Window win) -{ - Eina_Bool find = EINA_FALSE; -#ifdef ECORE_XCB_XINPUT - xcb_input_list_input_devices_cookie_t dcookie; - xcb_input_list_input_devices_reply_t *dreply; - xcb_input_device_info_iterator_t diter; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_input_avail) return EINA_FALSE; - - /* FIXME: i can't seemingly test this! no xcb input lib so can't look and - * test and look at types etc. - look at xlib code and copy logic over - * when we can */ -#ifdef ECORE_XCB_XINPUT - dcookie = xcb_input_list_input_devices_unchecked(_ecore_xcb_conn); - dreply = - xcb_input_list_input_devices_reply(_ecore_xcb_conn, dcookie, NULL); - if (!dreply) return EINA_FALSE; - - diter = xcb_input_list_input_devices_devices_iterator(dreply); - while (diter.rem) - { - xcb_input_device_info_t *dev; - const xcb_input_event_class_t iclass[] = - { - XCB_INPUT_DEVICE_BUTTON_PRESS, - XCB_INPUT_DEVICE_BUTTON_RELEASE, - XCB_INPUT_DEVICE_MOTION_NOTIFY, - XCB_INPUT_DEVICE_TOUCH_BEGIN, - XCB_INPUT_DEVICE_TOUCH_END, - XCB_INPUT_DEVICE_TOUCH_UPDATE - }; - - dev = diter.data; - if (dev->device_use == XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE) - { - DBG("Device %d", dev->device_id); - DBG("\tType: %d", dev->device_type); - DBG("\tNum Classes: %d", dev->num_class_info); - DBG("\tUse: %d", dev->device_use); - - xcb_input_select_extension_event(_ecore_xcb_conn, win, - sizeof(iclass) / sizeof(xcb_input_event_class_t), - iclass); - find = EINA_TRUE; - } - xcb_input_device_info_next(&diter); - } - free(dreply); -#else - (void)win; -#endif - - return find; -} - -EAPI Eina_Bool -ecore_x_input_raw_select(Ecore_X_Window win EINA_UNUSED) -{ - /* NB: FIXME: This is just a placeholder. XCB does not have XInput2 yet */ - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_input_touch_devices_grab(Ecore_X_Window win EINA_UNUSED) -{ - /* NB: FIXME: This is just a placeholder. XCB does not have XInput2 yet */ - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_input_touch_devices_ungrab(void) -{ - /* NB: FIXME: This is just a placeholder. XCB does not have XInput2 yet */ - return EINA_FALSE; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_keygrab.c b/src/lib/ecore_x/xcb/ecore_xcb_keygrab.c deleted file mode 100644 index d4f6782..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_keygrab.c +++ /dev/null @@ -1,442 +0,0 @@ -#include "ecore_xcb_private.h" - -////////////////////////////////////////////////////////////////////////////// -// This api and structure only for the key router and window client side -// Application do not use this - -//this mask is defined by key router. -//after discussing with keyrouter module, this mask can be changed -#define GRAB_MASK 0xffff00 -#define OVERRIDE_EXCLUSIVE_GRAB 0xf00000 -#define EXCLUSIVE_GRAB 0x0f0000 -#define TOPMOST_GRAB 0x00f000 -#define SHARED_GRAB 0x000f00 - -//if _ecore_keyrouter = 0, not yet check keyrouter -//if _ecore_keyrouter = -1, keyrouter not exist -//if _ecore_keyrouter = 1, keyrouter exist -int _ecore_keyrouter = 0; - -typedef struct _Ecore_X_Window_Key_Table -{ - Ecore_X_Window win; //windo ID - int *key_list; //list of key - unsigned long key_cnt; // the number of key -} Ecore_X_Window_Key_Table; - -static Ecore_X_Atom _atom_grab_excl_win = XCB_NONE; -#define STR_ATOM_GRAB_EXCL_WIN "_GRAB_EXCL_WIN_KEYCODE" - -static void -_keytable_free(Ecore_X_Window_Key_Table *keytable) -{ - if (keytable->key_list) free(keytable->key_list); - keytable->key_list = NULL; - keytable->win = 0; - keytable->key_cnt = 0; -} - -static int -_keytable_property_list_get(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int **plst) -{ - return ecore_x_window_prop_card32_list_get(win, atom, plst); -} - -static Eina_Bool -_keytable_get(Ecore_X_Window win, Ecore_X_Window_Key_Table *keytable) -{ - int ret = 0; - - ret = _keytable_property_list_get(win, ECORE_X_ATOM_E_KEYROUTER_WINDOW_KEYTABLE, - (unsigned int **)&(keytable->key_list)); - if (ret < 0) return EINA_FALSE; - - keytable->key_cnt = ret; - return EINA_TRUE; -} - -static Eina_Bool -_keytable_keycode_decode(int encoded, int *keycode, Ecore_X_Win_Keygrab_Mode *grab_mode) -{ - int mask = 0; - - *keycode = encoded & (~GRAB_MASK); - mask = encoded & GRAB_MASK; - - if (mask == SHARED_GRAB) - *grab_mode = ECORE_X_WIN_KEYGRAB_SHARED; - else if (mask == TOPMOST_GRAB) - *grab_mode = ECORE_X_WIN_KEYGRAB_TOPMOST; - else if (mask == EXCLUSIVE_GRAB) - *grab_mode = ECORE_X_WIN_KEYGRAB_EXCLUSIVE; - else if (mask == OVERRIDE_EXCLUSIVE_GRAB) - *grab_mode = ECORE_X_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE; - else - { - *grab_mode = ECORE_X_WIN_KEYGRAB_UNKNOWN; - WRN("Keycode decoding failed. Unknown Keygrab mode"); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -static Eina_Bool -_keytable_keycode_encode(int keycode, Ecore_X_Win_Keygrab_Mode grab_mode, int *encoded) -{ - if ((grab_mode <= ECORE_X_WIN_KEYGRAB_UNKNOWN) || - (grab_mode > ECORE_X_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE)) - { - *encoded = 0; - WRN("Keycode encoding failed. Unknown Keygrab mode"); - return EINA_FALSE; - } - - if (grab_mode == ECORE_X_WIN_KEYGRAB_SHARED) - *encoded = keycode | SHARED_GRAB; - else if (grab_mode == ECORE_X_WIN_KEYGRAB_TOPMOST) - *encoded = keycode | TOPMOST_GRAB; - else if (grab_mode == ECORE_X_WIN_KEYGRAB_EXCLUSIVE) - *encoded = keycode | EXCLUSIVE_GRAB; - else if (grab_mode == ECORE_X_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE) - *encoded = keycode | OVERRIDE_EXCLUSIVE_GRAB; - - return EINA_TRUE; -} - -static int -_keytable_key_search(Ecore_X_Window_Key_Table *keytable, int key) -{ - int i, code = 0, *list = NULL; - unsigned long count; - - code = key & (~GRAB_MASK); - count = keytable->key_cnt; - list = keytable->key_list; - - for (i = count - 1; i >= 0; i--) - if ((list[i] & (~GRAB_MASK)) == code) break; - - return i; -} - -static Eina_Bool -_keytable_key_add(Ecore_X_Window_Key_Table *keytable, int keycode, Ecore_X_Win_Keygrab_Mode grab_mode) -{ - Ecore_X_Window win; - unsigned long count; - int i = 0, masked = 0; - - win = keytable->win; - count = keytable->key_cnt; - - if (!_keytable_keycode_encode(keycode, grab_mode, &masked)) - return EINA_FALSE; - - if (count == 0) - { - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - ECORE_X_ATOM_E_KEYROUTER_WINDOW_KEYTABLE, - ECORE_X_ATOM_CARDINAL, 32, 1, - (unsigned char *)&masked); - return EINA_TRUE; - } - else - { - i = _keytable_key_search(keytable, masked); - if (i != -1) - { - WRN("Key already exists"); - return EINA_FALSE; - } - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_APPEND, win, - ECORE_X_ATOM_E_KEYROUTER_WINDOW_KEYTABLE, - ECORE_X_ATOM_CARDINAL, 32, 1, - (unsigned char *)&masked); - return EINA_TRUE; - } -} - -static Eina_Bool -_keytable_key_del(Ecore_X_Window_Key_Table *keytable, int key, Ecore_X_Atom atom) -{ - int i, *new_key_list = NULL; - unsigned long count = 0; - - i = _keytable_key_search(keytable, key); - if (i == -1) - { - WRN("Key does not exist in the key table"); - return EINA_FALSE; - } - - keytable->key_cnt--; - count = keytable->key_cnt; - if (count == 0) - { - ecore_x_window_prop_property_del(keytable->win, atom); - return EINA_TRUE; - } - - new_key_list = malloc(count * sizeof(int)); - if (!new_key_list) return EINA_FALSE; - - if (i > 0) - memcpy(new_key_list, keytable->key_list, sizeof(int) * i); - - if (count - i > 0) - memcpy(new_key_list + i, keytable->key_list + i + 1, - sizeof(int) * (count - i)); - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, keytable->win, - atom, ECORE_X_ATOM_CARDINAL, 32, count, - (unsigned char *)new_key_list); - - free(new_key_list); - return EINA_TRUE; -} - -static Eina_Bool -_keytable_possible_global_exclusiveness_get(int keycode) -{ - Ecore_X_Window_Key_Table keytable; - int ret = 0; - - keytable.win = ecore_x_window_root_first_get(); - keytable.key_list = NULL; - keytable.key_cnt = 0; - - if (_atom_grab_excl_win == XCB_NONE) - _atom_grab_excl_win = ecore_x_atom_get(STR_ATOM_GRAB_EXCL_WIN); - - ret = _keytable_property_list_get(keytable.win, _atom_grab_excl_win, - (unsigned int **)&(keytable.key_list)); - if (ret < 0) return EINA_FALSE; - - keytable.key_cnt = ret; - if (keytable.key_cnt == 0) - { - WRN("There is no keygrab entry in the table"); - return EINA_TRUE; - } - - ret = _keytable_key_search(&keytable, keycode); - if (ret != -1) - { - WRN("Can't search keygrab entry in the table"); - _keytable_free(&keytable); - return EINA_FALSE; - } - - _keytable_free(&keytable); - return EINA_TRUE; -} - -static Eina_Bool -_keytable_possible_global_exclusiveness_set(int keycode) -{ - Ecore_X_Window_Key_Table keytable; - int ret = 0; - - keytable.win = ecore_x_window_root_first_get(); - keytable.key_list = NULL; - keytable.key_cnt = 0; - - if (_atom_grab_excl_win == XCB_NONE) - _atom_grab_excl_win = ecore_x_atom_get(STR_ATOM_GRAB_EXCL_WIN); - - ret = _keytable_property_list_get(keytable.win, _atom_grab_excl_win, - (unsigned int **)&(keytable.key_list)); - if (ret < 0) return EINA_FALSE; - - keytable.key_cnt = ret; - if (keytable.key_cnt == 0) - { - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, - keytable.win, _atom_grab_excl_win, - ECORE_X_ATOM_CARDINAL, 32, 1, - (unsigned char *)&keycode); - _keytable_free(&keytable); - return EINA_TRUE; - } - - ret = _keytable_key_search(&keytable, keycode); - if (ret != -1) - { - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_APPEND, - keytable.win, _atom_grab_excl_win, - ECORE_X_ATOM_CARDINAL, 32, 1, - (unsigned char *)&keycode); - _keytable_free(&keytable); - return EINA_TRUE; - } - - WRN("Key is already grabbed"); - _keytable_free(&keytable); - return EINA_FALSE; -} - -static Eina_Bool -_keytable_possible_global_exclusiveness_unset(int keycode) -{ - Ecore_X_Window_Key_Table keytable; - int ret = 0; - - keytable.win = ecore_x_window_root_first_get(); - keytable.key_list = NULL; - keytable.key_cnt = 0; - - if (_atom_grab_excl_win == XCB_NONE) - _atom_grab_excl_win = ecore_x_atom_get(STR_ATOM_GRAB_EXCL_WIN); - - ret = _keytable_property_list_get(keytable.win, _atom_grab_excl_win, - (unsigned int **)&(keytable.key_list)); - if (ret < 0) return EINA_FALSE; - - keytable.key_cnt = ret; - - ret = _keytable_key_search(&keytable, keycode); - if (ret == -1) - { - WRN("Keygrab already exists"); - _keytable_free(&keytable); - return EINA_FALSE; - } - else - ret = _keytable_key_del(&keytable, keycode, _atom_grab_excl_win); - - _keytable_free(&keytable); - return EINA_FALSE; -} - -static Eina_Bool -_ecore_xcb_window_keygrab_set_internal(Ecore_X_Window win, const char *key, Ecore_X_Win_Keygrab_Mode grab_mode) -{ - Ecore_X_Window_Key_Table keytable; - xcb_keycode_t keycode = 0; - Eina_Bool ret = EINA_FALSE; - - keytable.win = win; - keytable.key_list = NULL; - keytable.key_cnt = 0; - - keycode = _ecore_xcb_keymap_string_to_keycode(key); - if (keycode == XCB_NO_SYMBOL) - { - WRN("Keycode of key(\"%s\") does not exist", key); - return EINA_FALSE; - } - - if (grab_mode == ECORE_X_WIN_KEYGRAB_EXCLUSIVE) - { - if (!_keytable_possible_global_exclusiveness_get(keycode)) - return EINA_FALSE; - } - - if (!_keytable_get(win, &keytable)) return EINA_FALSE; - - ret = _keytable_key_add(&keytable, keycode, grab_mode); - if (!ret) - { - WRN("Key(\"%s\") add failed", key); - goto err; - } - - if (grab_mode == ECORE_X_WIN_KEYGRAB_EXCLUSIVE) - { - if (!_keytable_possible_global_exclusiveness_set(keycode)) - { - _keytable_key_del(&keytable, keycode, ECORE_X_ATOM_E_KEYROUTER_WINDOW_KEYTABLE); - WRN("Key(\"%s\") already is grabbed", key); - goto err; - } - } - - _keytable_free(&keytable); - return EINA_TRUE; - -err: - _keytable_free(&keytable); - return EINA_FALSE; -} - -static Eina_Bool -_ecore_xcb_window_keygrab_unset_internal(Ecore_X_Window win, const char *key) -{ - Ecore_X_Window_Key_Table keytable; - Ecore_X_Win_Keygrab_Mode grab_mode = ECORE_X_WIN_KEYGRAB_UNKNOWN; - xcb_keycode_t keycode = 0; - int i, masked = 0, decoded = 0; - Eina_Bool ret = EINA_FALSE; - - keytable.win = win; - keytable.key_list = NULL; - keytable.key_cnt = 0; - - keycode = _ecore_xcb_keymap_string_to_keycode(key); - if (keycode == XCB_NO_SYMBOL) - { - WRN("Keycode of key(\"%s\") does not exist", key); - return EINA_FALSE; - } - - if (!_keytable_get(win, &keytable)) return EINA_FALSE; - - if (keytable.key_cnt <= 0) return EINA_FALSE; - - i = _keytable_key_search(&keytable, keycode); - if (i == -1) - { - WRN("Key(\"%s\") does not exist", key); - goto err; - } - - masked = keytable.key_list[i]; - - ret = _keytable_keycode_decode(masked, &decoded, &grab_mode); - if (!ret) goto err; - - ret = _keytable_key_del(&keytable, masked, ECORE_X_ATOM_E_KEYROUTER_WINDOW_KEYTABLE); - if (!ret) goto err; - - if (grab_mode == ECORE_X_WIN_KEYGRAB_EXCLUSIVE) - ret = _keytable_possible_global_exclusiveness_unset(keycode); - - _keytable_free(&keytable); - return EINA_TRUE; - -err: - _keytable_free(&keytable); - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_window_keygrab_set(Ecore_X_Window win, const char *key, int mod EINA_UNUSED, int not_mod EINA_UNUSED, int priority EINA_UNUSED, Ecore_X_Win_Keygrab_Mode grab_mode) -{ - if (_ecore_keyrouter == 0) - { - if (ecore_x_e_keyrouter_get(win)) - _ecore_keyrouter = 1; - else - { - WRN("Keyrouter is not supported"); - _ecore_keyrouter = -1; - } - } - - if (_ecore_keyrouter < 0) return EINA_FALSE; - - return _ecore_xcb_window_keygrab_set_internal(win, key, grab_mode); -} - -EAPI Eina_Bool -ecore_x_window_keygrab_unset(Ecore_X_Window win, const char *key, int mod EINA_UNUSED, int any_mod EINA_UNUSED) -{ - if (_ecore_keyrouter != 1) - { - WRN("Keyrouter is not supported"); - return EINA_FALSE; - } - - return _ecore_xcb_window_keygrab_unset_internal(win, key); -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_keymap.c b/src/lib/ecore_x/xcb/ecore_xcb_keymap.c deleted file mode 100644 index 8ec7af1..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_keymap.c +++ /dev/null @@ -1,534 +0,0 @@ -#include "ecore_xcb_private.h" -#define NEED_KEYSYM_TABLE -#define NEED_VTABLE -#include "ecore_xcb_keysym_table.h" -#include -#include - -/* local function prototypes */ -static int _ecore_xcb_keymap_mask_get(void *reply, - xcb_keysym_t sym); -static xcb_keysym_t _ecore_xcb_keymap_string_to_keysym(const char *str); -static int _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, - unsigned int modifiers, - unsigned int *modifiers_return, - xcb_keysym_t *keysym_return); -static int _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, - unsigned int modifiers, - char *buffer, - int bytes); - -/* local variables */ -static xcb_key_symbols_t *_ecore_xcb_keysyms; -static int _ecore_xcb_mode_switch = 0; - -/* public variables */ -EAPI int ECORE_X_MODIFIER_SHIFT = 0; -EAPI int ECORE_X_MODIFIER_CTRL = 0; -EAPI int ECORE_X_MODIFIER_ALT = 0; -EAPI int ECORE_X_MODIFIER_WIN = 0; -EAPI int ECORE_X_MODIFIER_ALTGR = 0; -EAPI int ECORE_X_LOCK_SCROLL = 0; -EAPI int ECORE_X_LOCK_NUM = 0; -EAPI int ECORE_X_LOCK_CAPS = 0; -EAPI int ECORE_X_LOCK_SHIFT = 0; - -void -_ecore_xcb_keymap_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_keysyms = xcb_key_symbols_alloc(_ecore_xcb_conn); -} - -void -_ecore_xcb_keymap_finalize(void) -{ - xcb_get_modifier_mapping_cookie_t cookie; - xcb_get_modifier_mapping_reply_t *reply; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_modifier_mapping_unchecked(_ecore_xcb_conn); - reply = xcb_get_modifier_mapping_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) - { - xcb_key_symbols_free(_ecore_xcb_keysyms); - return; - } - - _ecore_xcb_mode_switch = _ecore_xcb_keymap_mask_get(reply, XK_Mode_switch); - - ECORE_X_MODIFIER_SHIFT = _ecore_xcb_keymap_mask_get(reply, XK_Shift_L); - ECORE_X_MODIFIER_CTRL = _ecore_xcb_keymap_mask_get(reply, XK_Control_L); - - ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Alt_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Meta_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Super_L); - - ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Super_L); - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Meta_L); - - ECORE_X_MODIFIER_ALTGR = _ecore_xcb_keymap_mask_get(reply, XK_Mode_switch); - - 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_ALTGR) - { - if ((ECORE_X_MODIFIER_ALTGR == ECORE_X_MODIFIER_SHIFT) || - (ECORE_X_MODIFIER_ALTGR == ECORE_X_MODIFIER_CTRL) || - (ECORE_X_MODIFIER_ALTGR == ECORE_X_MODIFIER_ALT) || - (ECORE_X_MODIFIER_ALTGR == ECORE_X_MODIFIER_WIN)) - { - ERR("ALTGR conflicts with other modifiers. IGNORE ALTGR"); - ECORE_X_MODIFIER_ALTGR = 0; - } - } - - if (ECORE_X_MODIFIER_ALT) - { - if ((ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_SHIFT) || - (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL) || - (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_WIN)) - { - ERR("ALT conflicts with other modifiers. IGNORE ALT"); - ECORE_X_MODIFIER_ALT = 0; - } - } - - if (ECORE_X_MODIFIER_WIN) - { - if ((ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_SHIFT) || - (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_CTRL)) - { - ERR("WIN conflicts with other modifiers. IGNORE WIN"); - ECORE_X_MODIFIER_WIN = 0; - } - } - - if (ECORE_X_MODIFIER_SHIFT) - { - if ((ECORE_X_MODIFIER_SHIFT == ECORE_X_MODIFIER_CTRL)) - { - ERR("CTRL conflicts with other modifiers. IGNORE CTRL"); - ECORE_X_MODIFIER_CTRL = 0; - } - } - - ECORE_X_LOCK_SCROLL = _ecore_xcb_keymap_mask_get(reply, XK_Scroll_Lock); - ECORE_X_LOCK_NUM = _ecore_xcb_keymap_mask_get(reply, XK_Num_Lock); - ECORE_X_LOCK_CAPS = _ecore_xcb_keymap_mask_get(reply, XK_Caps_Lock); - ECORE_X_LOCK_SHIFT = _ecore_xcb_keymap_mask_get(reply, XK_Shift_Lock); - free(reply); -} - -void -_ecore_xcb_modifiers_get(void) -{ - _ecore_xcb_keymap_finalize(); -} - -void -_ecore_xcb_keymap_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (_ecore_xcb_keysyms) xcb_key_symbols_free(_ecore_xcb_keysyms); -} - -void -_ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event) -{ - CHECK_XCB_CONN; - xcb_refresh_keyboard_mapping(_ecore_xcb_keysyms, event); -} - -xcb_keysym_t -_ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, - int col) -{ - xcb_keysym_t key0, key1; - - CHECK_XCB_CONN; - if (col & _ecore_xcb_mode_switch) - { - key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 4); - key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 5); - } - else - { - key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 0); - key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 1); - } - - if (key1 == XCB_NO_SYMBOL) - key1 = key0; - - if ((col & ECORE_X_LOCK_NUM) && - ((xcb_is_keypad_key(key1)) || (xcb_is_private_keypad_key(key1)))) - { - if ((col & XCB_MOD_MASK_SHIFT) || - ((col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_SHIFT))) - return key0; - else - return key1; - } - else if (!(col & XCB_MOD_MASK_SHIFT) && !(col & XCB_MOD_MASK_LOCK)) - return key0; - else if (!(col & XCB_MOD_MASK_SHIFT) && - (col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_CAPS))) - return key1; - else if ((col & XCB_MOD_MASK_SHIFT) && - (col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_CAPS)) - return key0; - else if ((col & XCB_MOD_MASK_SHIFT) || - (col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_SHIFT))) - return key1; - - return XCB_NO_SYMBOL; -} - -xcb_keycode_t * -_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym) -{ - CHECK_XCB_CONN; - return xcb_key_symbols_get_keycode(_ecore_xcb_keysyms, keysym); -} - -char * -_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym) -{ - int i = 0, n = 0, h = 0, idx = 0; - const unsigned char *entry; - unsigned char val1, val2, val3, val4; - - CHECK_XCB_CONN; - if (!keysym) return NULL; - if (keysym == XK_VoidSymbol) keysym = 0; - if (keysym <= 0x1fffffff) - { - val1 = (keysym >> 24); - val2 = ((keysym >> 16) & 0xff); - val3 = ((keysym >> 8) & 0xff); - val4 = (keysym & 0xff); - i = keysym % VTABLESIZE; - h = i + 1; - n = VMAXHASH; - while ((idx = hashKeysym[i])) - { - entry = &_ecore_xcb_keytable[idx]; - if ((entry[0] == val1) && (entry[1] == val2) && - (entry[2] == val3) && (entry[3] == val4)) - return (char *)entry + 4; - if (!--n) break; - i += h; - if (i >= VTABLESIZE) i -= VTABLESIZE; - } - } - - if ((keysym >= 0x01000100) && (keysym <= 0x0110ffff)) - { - xcb_keysym_t val; - char *s = NULL; - int i = 0; - - val = (keysym & 0xffffff); - if (val & 0xff0000) - i = 10; - else - i = 6; - - if (!(s = malloc(i))) return NULL; - i--; - s[i--] = '\0'; - for (; i; i--) - { - val1 = (val & 0xf); - val >>= 4; - if (val1 < 10) - s[i] = '0' + val1; - else - s[i] = 'A' + val1 - 10; - } - s[i] = 'U'; - return s; - } - - return NULL; -} - -xcb_keycode_t -_ecore_xcb_keymap_string_to_keycode(const char *key) -{ - if (!strncmp(key, "Keycode-", 8)) - return atoi(key + 8); - else - { - xcb_keysym_t keysym = XCB_NO_SYMBOL; - xcb_keycode_t *keycodes, keycode = 0; - int i = 0; - - CHECK_XCB_CONN; - - keysym = _ecore_xcb_keymap_string_to_keysym(key); - if (keysym == XCB_NO_SYMBOL) return XCB_NO_SYMBOL; - - keycodes = _ecore_xcb_keymap_keysym_to_keycode(keysym); - if (!keycodes) return XCB_NO_SYMBOL; - - while (keycodes[i] != XCB_NO_SYMBOL) - { - if (keycodes[i] != 0) - { - keycode = keycodes[i]; - break; - } - i++; - } - return keycode; - } -} - -int -_ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, - int state, - char *buffer, - int bytes, - xcb_keysym_t *sym) -{ - unsigned int modifiers = 0; - xcb_keysym_t keysym; - - CHECK_XCB_CONN; - if (!_ecore_xcb_keymap_translate_key(keycode, state, &modifiers, &keysym)) - return 0; - - if (sym) *sym = keysym; - - return _ecore_xcb_keymap_translate_keysym(keysym, state, buffer, bytes); -} - -EAPI const char * -ecore_x_keysym_string_get(int keysym) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_keymap_keysym_to_string(keysym); -} - -EAPI int -ecore_x_keysym_keycode_get(const char *keyname) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_keymap_string_to_keycode(keyname); -} - -EAPI unsigned int -ecore_x_keysym_get(const char *string) -{ - return _ecore_xcb_keymap_string_to_keysym(string); -} - -/* local functions */ -static int -_ecore_xcb_keymap_mask_get(void *reply, - xcb_keysym_t sym) -{ - xcb_get_modifier_mapping_reply_t *rep; - xcb_keysym_t sym2; - int mask = 0; - const int masks[8] = - { - XCB_MOD_MASK_SHIFT, XCB_MOD_MASK_LOCK, XCB_MOD_MASK_CONTROL, - XCB_MOD_MASK_1, XCB_MOD_MASK_2, XCB_MOD_MASK_3, XCB_MOD_MASK_4, - XCB_MOD_MASK_5 - }; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - rep = (xcb_get_modifier_mapping_reply_t *)reply; - if ((rep) && (rep->keycodes_per_modifier > 0)) - { - int i = 0; - xcb_keycode_t *modmap; - - modmap = xcb_get_modifier_mapping_keycodes(rep); - for (i = 0; i < (8 * rep->keycodes_per_modifier); i++) - { - int j = 0; - - for (j = 0; j < 8; j++) - { - sym2 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, - modmap[i], j); - if (sym2 != 0) break; - } - if (sym2 == sym) mask = masks[i / rep->keycodes_per_modifier]; - } - } - return mask; -} - -static xcb_keysym_t -_ecore_xcb_keymap_string_to_keysym(const char *str) -{ - int i = 0, n = 0, h = 0; - unsigned long sig = 0; - const char *p = NULL; - int c = 0, idx = 0; - const unsigned char *entry; - unsigned char sig1, sig2; - long unsigned int val; - - p = str; - while ((c = *p++)) - sig = (sig << 1) + c; - - i = (sig % KTABLESIZE); - h = i + 1; - sig1 = (sig >> 8) & 0xff; - sig2 = sig & 0xff; - n = KMAXHASH; - - while ((idx = hashString[i])) - { - entry = &_ecore_xcb_keytable[idx]; - if ((entry[0] == sig1) && (entry[1] == sig2) && - !strcmp(str, (char *)entry + 6)) - { - val = ((entry[2] << 24) | (entry[3] << 16) | - (entry[4] << 8) | (entry[5])); - if (!val) val = 0xffffff; - return val; - } - if (!--n) break; - i += h; - if (i >= KTABLESIZE) i -= KTABLESIZE; - } - - if (*str == 'U') - { - val = 0; - for (p = &str[1]; *p; p++) - { - c = *p; - if (('0' <= c) && (c <= '9')) - val = (val << 4) + c - '0'; - else if (('a' <= c) && (c <= 'f')) - val = (val << 4) + c - 'a' + 10; - else if (('A' <= c) && (c <= 'F')) - val = (val << 4) + c - 'A' + 10; - else - return XCB_NO_SYMBOL; - if (val > 0x10ffff) return XCB_NO_SYMBOL; - } - if ((val < 0x20) || ((val > 0x7e) && (val < 0xa0))) - return XCB_NO_SYMBOL; - if (val < 0x100) return val; - return val | 0x01000000; - } - - if ((strlen(str) > 2) && (str[0] == '0') && (str[1] == 'x')) - { - char *tmp = NULL; - - val = strtoul(str, &tmp, 16); - if ((val == ULONG_MAX) || ((tmp) && (*tmp != '\0'))) - return XCB_NO_SYMBOL; - else - return val; - } - - if (!strncmp(str, "XF86_", 5)) - { - long unsigned int ret; - char *tmp; - - tmp = strdup(str); - if (!tmp) return XCB_NO_SYMBOL; - memmove(&tmp[4], &tmp[5], strlen(str) - 5 + 1); - ret = _ecore_xcb_keymap_string_to_keysym(tmp); - free(tmp); - return ret; - } - - return XCB_NO_SYMBOL; -} - -static int -_ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, - unsigned int modifiers, - unsigned int *modifiers_return, - xcb_keysym_t *keysym_return) -{ - xcb_keysym_t sym; - - if (!_ecore_xcb_keysyms) return 0; - - sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, modifiers); - - if (modifiers_return) - *modifiers_return = ((XCB_MOD_MASK_SHIFT | XCB_MOD_MASK_LOCK) | - _ecore_xcb_mode_switch | ECORE_X_LOCK_NUM); - if (keysym_return) - *keysym_return = sym; - - return 1; -} - -static int -_ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, - unsigned int modifiers, - char *buffer, - int bytes) -{ - unsigned long hbytes = 0; - unsigned char c; - - if (!keysym) return 0; - hbytes = (keysym >> 8); - - if (!(bytes && - ((hbytes == 0) || - ((hbytes == 0xFF) && - (((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) || - (keysym == XK_Return) || (keysym == XK_Escape) || - (keysym == XK_KP_Space) || (keysym == XK_KP_Tab) || - (keysym == XK_KP_Enter) || - ((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) || - (keysym == XK_KP_Equal) || (keysym == XK_Delete)))))) - return 0; - - if (keysym == XK_KP_Space) - c = (XK_space & 0x7F); - else if (hbytes == 0xFF) - c = (keysym & 0x7F); - else - c = (keysym & 0xFF); - - if (modifiers & ECORE_X_MODIFIER_CTRL) - { - if (((c >= '@') && (c < '\177')) || c == ' ') - c &= 0x1F; - else if (c == '2') - c = '\000'; - else if ((c >= '3') && (c <= '7')) - c -= ('3' - '\033'); - else if (c == '8') - c = '\177'; - else if (c == '/') - c = '_' & 0x1F; - } - buffer[0] = c; - return 1; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_mwm.c b/src/lib/ecore_x/xcb/ecore_xcb_mwm.c deleted file mode 100644 index 59ab579..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_mwm.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "ecore_xcb_private.h" -//#include "Ecore_X_Atoms.h" - -#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0) -#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1) -#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2) -#define ECORE_X_MWM_HINTS_STATUS (1 << 3) - -typedef struct _mwmhints -{ - uint32_t flags; - uint32_t functions; - uint32_t decorations; - int32_t inputmode; - uint32_t status; -} MWMHints; - -/** - * @defgroup Ecore_X_MWM_Group MWM related functions. - * @ingroup Ecore_X_Group - * - * Functions related to MWM. - */ - -/** - * Sets the borderless flag of a window using MWM. - * - * @param win The window. - * @param borderless The borderless flag. - * - * @ingroup Ecore_X_MWM_Group - */ -EAPI void -ecore_x_mwm_borderless_set(Ecore_X_Window win, - Eina_Bool borderless) -{ - uint32_t data[5] = { 0, 0, 0, 0, 0 }; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - data[0] = 2; - data[2] = !borderless; - - ecore_x_window_prop_property_set(win, - ECORE_X_ATOM_MOTIF_WM_HINTS, - ECORE_X_ATOM_MOTIF_WM_HINTS, 32, - (void *)data, 5); -} - -EAPI Eina_Bool -ecore_x_mwm_hints_get(Ecore_X_Window win, - Ecore_X_MWM_Hint_Func *fhint, - Ecore_X_MWM_Hint_Decor *dhint, - Ecore_X_MWM_Hint_Input *ihint) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - MWMHints *mwmhints = NULL; - int ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = - xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, - ECORE_X_ATOM_MOTIF_WM_HINTS, - ECORE_X_ATOM_MOTIF_WM_HINTS, 0, UINT_MAX); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - if ((reply->format != 32) || (reply->value_len == 0)) - { - free(reply); - return EINA_FALSE; - } - - mwmhints = xcb_get_property_value(reply); - if (reply->value_len >= 4) - { - if (dhint) - { - if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS) - *dhint = mwmhints->decorations; - else - *dhint = ECORE_X_MWM_HINT_DECOR_ALL; - } - if (fhint) - { - if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS) - *fhint = mwmhints->functions; - else - *fhint = ECORE_X_MWM_HINT_FUNC_ALL; - } - if (ihint) - { - if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE) - *ihint = mwmhints->inputmode; - else - *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS; - } - ret = EINA_TRUE; - } - free(reply); - return ret; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_netwm.c b/src/lib/ecore_x/xcb/ecore_xcb_netwm.c deleted file mode 100644 index 856e27d..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_netwm.c +++ /dev/null @@ -1,1590 +0,0 @@ -#include "ecore_xcb_private.h" - -/* local function prototypes */ -/* static void _ecore_xcb_netwm_startup_info_free(void *data); */ -static Ecore_X_Atom _ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type); -static Ecore_X_Window_Type _ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom); -static Ecore_X_Atom _ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state); -static Ecore_X_Atom _ecore_xcb_netwm_action_atom_get(Ecore_X_Action action); - -/* local variables */ -//static Eina_Hash *_startup_info = NULL; - -/* local structures */ -typedef struct _Ecore_Xcb_Startup_Info Ecore_Xcb_Startup_Info; -struct _Ecore_Xcb_Startup_Info -{ - Ecore_X_Window win; - int init, size; - char *buffer; - int length; - - /* sequence info fields */ - char *id, *name; - int screen; - char *bin, *icon; - int desktop, timestamp; - char *description, *wmclass; - int silent; -}; - -EAPI void -ecore_x_netwm_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -// _startup_info = -// eina_hash_string_superfast_new(_ecore_xcb_netwm_startup_info_free); -} - -EAPI void -ecore_x_netwm_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -// if (_startup_info) eina_hash_free(_startup_info); -// _startup_info = NULL; -} - -EAPI Eina_Bool -ecore_x_netwm_pid_get(Ecore_X_Window win, - int *pid) -{ - uint32_t tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1)) - return EINA_FALSE; - - if (pid) *pid = tmp; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_pid_set(Ecore_X_Window win, - int pid) -{ - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - tmp = pid; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1); -} - -EAPI Eina_Bool -ecore_x_netwm_window_type_get(Ecore_X_Window win, - Ecore_X_Window_Type *type) -{ - Ecore_X_Atom *atoms; - int num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL; - - num = - ecore_x_window_prop_atom_list_get(win, - ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atoms); - if ((type) && (num >= 1) && (atoms)) - *type = _ecore_xcb_netwm_window_type_type_get(atoms[0]); - - if (atoms) free(atoms); - - if (num >= 1) return EINA_TRUE; - return EINA_FALSE; -} - -EAPI void -ecore_x_netwm_window_type_set(Ecore_X_Window win, - Ecore_X_Window_Type type) -{ - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - atom = _ecore_xcb_netwm_window_type_atom_get(type); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atom, 1); -} - -EAPI int -ecore_x_netwm_window_types_get(Ecore_X_Window win, - Ecore_X_Window_Type **types) -{ - int num = 0, i = 0; - Ecore_X_Atom *atoms = NULL; - Ecore_X_Window_Type *atoms2 = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (types) *types = NULL; - num = - ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, - &atoms); - if ((num <= 0) || (!atoms)) - { - if (atoms) free(atoms); - return 0; - } - - atoms2 = malloc(num * sizeof(Ecore_X_Window_Type)); - if (!atoms2) - { - if (atoms) free(atoms); - return 0; - } - - for (i = 0; i < num; i++) - atoms2[i] = _ecore_xcb_netwm_window_type_type_get(atoms[i]); - if (atoms) free(atoms); - - if (types) - *types = atoms2; - else - free(atoms2); - - return num; -} - -EAPI int -ecore_x_netwm_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (name) - *name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_NAME); - return 1; -} - -EAPI void -ecore_x_netwm_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_NAME, name); -} - -EAPI void -ecore_x_netwm_opacity_set(Ecore_X_Window win, - unsigned int opacity) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, - &opacity, 1); -} - -EAPI Eina_Bool -ecore_x_netwm_opacity_get(Ecore_X_Window win, - unsigned int *opacity) -{ - unsigned int tmp = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, - &tmp, 1)) - return EINA_FALSE; - - if (opacity) *opacity = tmp; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_wm_identify(Ecore_X_Window root, - Ecore_X_Window check, - const char *wm_name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, - &check, 1); - ecore_x_window_prop_string_set(check, ECORE_X_ATOM_NET_WM_NAME, wm_name); - ecore_x_window_prop_string_set(root, ECORE_X_ATOM_NET_WM_NAME, wm_name); - ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, - &check, 1); -} - -EAPI void -ecore_x_netwm_supported_set(Ecore_X_Window root, - Ecore_X_Atom *supported, - int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, - supported, num); -} - -EAPI Eina_Bool -ecore_x_netwm_supported_get(Ecore_X_Window root, - Ecore_X_Atom **supported, - int *num) -{ - int num_ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (num) *num = 0; - if (supported) *supported = NULL; - - num_ret = - ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED, - supported); - if (num_ret <= 0) return EINA_FALSE; - if (num) *num = num_ret; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_desk_count_set(Ecore_X_Window root, - unsigned int n_desks) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, - &n_desks, 1); -} - -EAPI void -ecore_x_netwm_desk_roots_set(Ecore_X_Window root, - Ecore_X_Window *vroots, - unsigned int n_desks) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, - vroots, n_desks); -} - -EAPI void -ecore_x_netwm_desk_names_set(Ecore_X_Window root, - const char **names, - unsigned int n_desks) -{ - char ss[32], *buf = NULL, *t = NULL; - const char *s; - uint32_t len = 0, i, l; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - for (i = 0; i < n_desks; i++) - { - s = ((names) ? names[i] : NULL); - if (!s) - { - /* Default to "Desk-" */ - sprintf(ss, "Desk-%d", i); - s = ss; - } - - l = strlen(s) + 1; - t = realloc(buf, len + 1); - if (t) - { - buf = t; - memcpy(buf + len, s, l); - } - len += l; - } - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, root, - ECORE_X_ATOM_NET_DESKTOP_NAMES, - ECORE_X_ATOM_UTF8_STRING, 8, len, (const void *)buf); -// ecore_x_flush(); - free(buf); -} - -EAPI void -ecore_x_netwm_desk_size_set(Ecore_X_Window root, - unsigned int width, - unsigned int height) -{ - uint32_t size[2]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - size[0] = width; - size[1] = height; - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, - size, 2); -} - -EAPI void -ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, - unsigned int *origins, - unsigned int n_desks) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, - origins, (2 * n_desks)); -} - -EAPI void -ecore_x_netwm_desk_layout_set(Ecore_X_Window root, - int orientation, - int columns, - int rows, - int starting_corner) -{ - unsigned int layout[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - layout[0] = orientation; - layout[1] = columns; - layout[2] = rows; - layout[3] = starting_corner; - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, - layout, 4); -} - -EAPI void -ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, - unsigned int *areas, - unsigned int n_desks) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas, - 4 * n_desks); -} - -EAPI unsigned int * -ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks) -{ - int ret; - unsigned int *areas = NULL; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA, - &areas); - if (!areas) - { - if (n_desks) *n_desks = 0; - return 0; - } - if (n_desks) *n_desks = ret / 4; - return areas; -} - -EAPI void -ecore_x_netwm_desk_current_set(Ecore_X_Window root, - unsigned int desk) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, - &desk, 1); -} - -EAPI void -ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, - Eina_Bool on) -{ - unsigned int val = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - val = ((on) ? 1 : 0); - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, - &val, 1); -} - -EAPI int -ecore_x_netwm_startup_id_get(Ecore_X_Window win, - char **id) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (id) - { - *id = - ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_STARTUP_ID); - } - - return 1; -} - -EAPI void -ecore_x_netwm_startup_id_set(Ecore_X_Window win, - const char *id) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id); -} - -EAPI void -ecore_x_netwm_state_request_send(Ecore_X_Window win, - Ecore_X_Window root, - Ecore_X_Window_State s1, - Ecore_X_Window_State s2, - Eina_Bool set) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_NET_WM_STATE; - ev.data.data32[0] = !!set; - ev.data.data32[1] = _ecore_xcb_netwm_window_state_atom_get(s1); - ev.data.data32[2] = _ecore_xcb_netwm_window_state_atom_get(s2); - /* 1 == normal client, if used in a pager this should be 2 */ - ev.data.data32[3] = 1; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_netwm_window_state_set(Ecore_X_Window win, - Ecore_X_Window_State *state, - unsigned int num) -{ - Ecore_X_Atom *set; - unsigned int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!num) - { - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE); - return; - } - - set = malloc(num * sizeof(Ecore_X_Atom)); - if (!set) return; - - for (i = 0; i < num; i++) - set[i] = _ecore_xcb_netwm_window_state_atom_get(state[i]); - - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num); - free(set); -} - -EAPI Eina_Bool -ecore_x_netwm_window_state_get(Ecore_X_Window win, - Ecore_X_Window_State **state, - unsigned int *num) -{ - Ecore_X_Atom *atoms; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (num) *num = 0; - if (state) *state = NULL; - - ret = - ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE, &atoms); - - if (ret <= 0) return EINA_FALSE; - - if (state) - { - *state = malloc(ret * sizeof(Ecore_X_Window_State)); - if (*state) - { - int i = 0; - - for (i = 0; i < ret; i++) - (*state)[i] = _ecore_xcb_netwm_window_state_get(atoms[i]); - if (num) *num = ret; - } - } - - free(atoms); - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_client_active_set(Ecore_X_Window root, - Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(root, - ECORE_X_ATOM_NET_ACTIVE_WINDOW, &win, 1); -} - -EAPI void -ecore_x_netwm_client_active_request(Ecore_X_Window root, - Ecore_X_Window win, - int type, - Ecore_X_Window current_win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_NET_ACTIVE_WINDOW; - ev.data.data32[0] = type; - ev.data.data32[1] = XCB_CURRENT_TIME; - ev.data.data32[2] = current_win; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_netwm_client_list_set(Ecore_X_Window root, - Ecore_X_Window *p_clients, - unsigned int n_clients) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST, - p_clients, n_clients); -} - -EAPI void -ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, - Ecore_X_Window *p_clients, - unsigned int n_clients) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, - p_clients, n_clients); -} - -EAPI Eina_Bool -ecore_x_screen_is_composited(int screen) -{ - char buff[32]; - xcb_get_selection_owner_cookie_t ocookie; - xcb_get_selection_owner_reply_t *oreply; - xcb_intern_atom_cookie_t acookie; - xcb_intern_atom_reply_t *areply; - Ecore_X_Window win; - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen); - acookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, strlen(buff), buff); - areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); - if (!areply) return EINA_FALSE; - atom = areply->atom; - free(areply); - if (atom == XCB_NONE) return EINA_FALSE; - ocookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom); - oreply = xcb_get_selection_owner_reply(_ecore_xcb_conn, ocookie, NULL); - if (!oreply) return EINA_FALSE; - win = oreply->owner; - free(oreply); - return (win != XCB_NONE) ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_screen_is_composited_set(int screen, - Ecore_X_Window win) -{ - Ecore_X_Atom atom; - xcb_intern_atom_cookie_t acookie; - xcb_intern_atom_reply_t *areply; - char buff[32]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen); - acookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff); - areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); - if (!areply) return; - atom = areply->atom; - free(areply); - xcb_set_selection_owner(_ecore_xcb_conn, win, atom, - _ecore_xcb_events_last_time_get()); -} - -EAPI void -ecore_x_netwm_ping_send(Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_WM_PROTOCOLS; - ev.data.data32[0] = ECORE_X_ATOM_NET_WM_PING; - ev.data.data32[1] = ecore_x_current_time_get(); - ev.data.data32[2] = win; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_netwm_frame_size_set(Ecore_X_Window win, - int fl, - int fr, - int ft, - int fb) -{ - uint32_t frames[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - frames[0] = fl; - frames[1] = fr; - frames[2] = ft; - frames[3] = fb; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, - frames, 4); -} - -EAPI Eina_Bool -ecore_x_netwm_frame_size_get(Ecore_X_Window win, - int *fl, - int *fr, - int *ft, - int *fb) -{ - int ret = 0; - unsigned int frames[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, - frames, 4); - if (ret != 4) return EINA_FALSE; - - if (fl) *fl = frames[0]; - if (fr) *fr = frames[1]; - if (ft) *ft = frames[2]; - if (fb) *fb = frames[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_sync_request_send(Ecore_X_Window win, - unsigned int serial) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - - /* FIXME: Maybe need XSyncIntToValue ?? */ - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_WM_PROTOCOLS; - ev.data.data32[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; - ev.data.data32[1] = _ecore_xcb_events_last_time_get(); - ev.data.data32[2] = serial; - ev.data.data32[3] = 0; - ev.data.data32[4] = 0; - - xcb_send_event(_ecore_xcb_conn, 0, win, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_netwm_desktop_set(Ecore_X_Window win, - unsigned int desk) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1); -} - -EAPI Eina_Bool -ecore_x_netwm_desktop_get(Ecore_X_Window win, - unsigned int *desk) -{ - unsigned int tmp = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP, - &tmp, 1)) - return EINA_FALSE; - - if (desk) *desk = tmp; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_desktop_request_send(Ecore_X_Window win, - Ecore_X_Window root, - unsigned int desktop) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_NET_WM_DESKTOP; - ev.data.data32[0] = desktop; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -// ecore_x_flush(); -} - -EAPI void -ecore_x_netwm_moveresize_request_send(Ecore_X_Window win, - int x, - int y, - Ecore_X_Netwm_Direction direction, - unsigned int button) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = ECORE_X_ATOM_NET_WM_MOVERESIZE; - ev.data.data32[0] = x; - ev.data.data32[1] = y; - ev.data.data32[2] = direction; - ev.data.data32[3] = button; - ev.data.data32[4] = 1; - - xcb_send_event(_ecore_xcb_conn, 0, win, - (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); -} - -EAPI void -ecore_x_netwm_handled_icons_set(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, - NULL, 0); -} - -EAPI Eina_Bool -ecore_x_netwm_handled_icons_get(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, - NULL, 0)) - return EINA_FALSE; - - return EINA_TRUE; -} - -EAPI int -ecore_x_netwm_icon_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (name) - { - *name = - ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_ICON_NAME); - } - - return 1; -} - -EAPI void -ecore_x_netwm_icon_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); -} - -EAPI void -ecore_x_netwm_icons_set(Ecore_X_Window win, - Ecore_X_Icon *icon, - int num) -{ - unsigned int *data, *p, *p2; - unsigned int i, size, x, y; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - size = 0; - for (i = 0; i < (unsigned int)num; i++) - { - size += 2 + (icon[i].width * icon[i].height); - } - data = malloc(size * sizeof(unsigned int)); - if (!data) return; - p = data; - for (i = 0; i < (unsigned int)num; i++) - { - p[0] = icon[i].width; - p[1] = icon[i].height; - p += 2; - p2 = icon[i].data; - for (y = 0; y < icon[i].height; y++) - { - for (x = 0; x < icon[i].width; x++) - { - unsigned int r, g, b, a; - - a = (*p2 >> 24) & 0xff; - r = (*p2 >> 16) & 0xff; - g = (*p2 >> 8 ) & 0xff; - b = (*p2 ) & 0xff; - if ((a > 0) && (a < 255)) - { - r = (r * 255) / a; - g = (g * 255) / a; - b = (b * 255) / a; - } - *p = (a << 24) | (r << 16) | (g << 8) | b; - p++; - p2++; - } - } - } - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON, - data, size); - free(data); -} - -EAPI Eina_Bool -ecore_x_netwm_icons_get(Ecore_X_Window win, - Ecore_X_Icon **icon, - int *num) -{ - int num_ret = 0; - unsigned int i = 0, len = 0, icons = 0; - unsigned int *data, *p, *src; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (num) *num = 0; - if (icon) *icon = NULL; - - num_ret = - ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON, &data); - - if ((num_ret <= 0) || (!data)) - { - if (data) free(data); - return EINA_FALSE; - } - if (num_ret < 2) - { - if (data) free(data); - return EINA_FALSE; - } - - icons = 0; - p = data; - while (p) - { - len = (p[0] * p[1]); - p += (len + 2); - if ((p - data) > num_ret) - { - if (data) free(data); - return EINA_FALSE; - } - icons++; - if ((p - data) == num_ret) p = NULL; - } - if (num) *num = icons; - if (!icon) - { - if (data) free(data); - return EINA_TRUE; - } - - *icon = malloc(icons * sizeof(Ecore_X_Icon)); - if (!(*icon)) - { - if (data) free(data); - return EINA_FALSE; - } - - /* Fetch the icons */ - p = data; - for (i = 0; i < icons; i++) - { - unsigned int *ps, *pd, *pe; - - len = p[0] * p[1]; - ((*icon)[i]).width = p[0]; - ((*icon)[i]).height = p[1]; - src = &(p[2]); - ((*icon)[i]).data = malloc(len * sizeof(unsigned int)); - if (!((*icon)[i]).data) - { - while (i) - free(((*icon)[--i]).data); - free(*icon); - free(data); - return EINA_FALSE; - } - - pd = ((*icon)[i]).data; - ps = src; - pe = ps + len; - for (; ps < pe; ps++) - { - unsigned int r, g, b, a; - - a = (*ps >> 24) & 0xff; - r = (((*ps >> 16) & 0xff) * a) / 255; - g = (((*ps >> 8) & 0xff) * a) / 255; - b = (((*ps) & 0xff) * a) / 255; - *pd = (a << 24) | (r << 16) | (g << 8) | (b); - pd++; - } - p += (len + 2); - } - - if (data) free(data); - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - geom[0] = x; - geom[1] = y; - geom[2] = w; - geom[3] = h; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, - geom, 4); -} - -EAPI Eina_Bool -ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) -{ - int ret = 0; - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = - ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, - geom, 4); - if (ret != 4) return EINA_FALSE; - if (x) *x = geom[0]; - if (y) *y = geom[1]; - if (w) *w = geom[2]; - if (h) *h = geom[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_strut_set(Ecore_X_Window win, - int l, - int r, - int t, - int b) -{ - unsigned int strut[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - strut[0] = l; - strut[1] = r; - strut[2] = t; - strut[3] = b; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); -} - -EAPI Eina_Bool -ecore_x_netwm_strut_get(Ecore_X_Window win, - int *l, - int *r, - int *t, - int *b) -{ - unsigned int strut[4]; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = - ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); - if (ret != 4) return EINA_FALSE; - - if (l) *l = strut[0]; - if (r) *r = strut[1]; - if (t) *t = strut[2]; - if (b) *b = strut[3]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_strut_partial_set(Ecore_X_Window win, - int left, - int right, - int top, - int bottom, - int left_start_y, - int left_end_y, - int right_start_y, - int right_end_y, - int top_start_x, - int top_end_x, - int bottom_start_x, - int bottom_end_x) -{ - unsigned int strut[12]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - strut[0] = left; - strut[1] = right; - strut[2] = top; - strut[3] = bottom; - strut[4] = left_start_y; - strut[5] = left_end_y; - strut[6] = right_start_y; - strut[7] = right_end_y; - strut[8] = top_start_x; - strut[9] = top_end_x; - strut[10] = bottom_start_x; - strut[11] = bottom_end_x; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, - strut, 12); -} - -EAPI Eina_Bool -ecore_x_netwm_strut_partial_get(Ecore_X_Window win, - int *left, - int *right, - int *top, - int *bottom, - int *left_start_y, - int *left_end_y, - int *right_start_y, - int *right_end_y, - int *top_start_x, - int *top_end_x, - int *bottom_start_x, - int *bottom_end_x) -{ - unsigned int strut[12]; - int ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ret = - ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, - strut, 12); - if (ret != 12) return EINA_FALSE; - - if (left) *left = strut[0]; - if (right) *right = strut[1]; - if (top) *top = strut[2]; - if (bottom) *bottom = strut[3]; - if (left_start_y) *left_start_y = strut[4]; - if (left_end_y) *left_end_y = strut[5]; - if (right_start_y) *right_start_y = strut[6]; - if (right_end_y) *right_end_y = strut[7]; - if (top_start_x) *top_start_x = strut[8]; - if (top_end_x) *top_end_x = strut[9]; - if (bottom_start_x) *bottom_start_x = strut[10]; - if (bottom_end_x) *bottom_end_x = strut[11]; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_user_time_set(Ecore_X_Window win, - unsigned int t) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, &t, 1); -} - -EAPI Eina_Bool -ecore_x_netwm_user_time_get(Ecore_X_Window win, - unsigned int *t) -{ - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME, - &tmp, 1)) - return EINA_FALSE; - - if (t) *t = tmp; - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_visible_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME, - name); -} - -EAPI int -ecore_x_netwm_visible_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (name) - *name = ecore_x_window_prop_string_get(win, - ECORE_X_ATOM_NET_WM_VISIBLE_NAME); - return 1; -} - -EAPI void -ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, - name); -} - -EAPI int -ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (name) - { - *name = - ecore_x_window_prop_string_get(win, - ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME); - } - - return 1; -} - -EAPI Eina_Bool -ecore_x_netwm_sync_counter_get(Ecore_X_Window win, - Ecore_X_Sync_Counter *counter) -{ - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, - &tmp, 1)) - return EINA_FALSE; - - if (counter) *counter = tmp; - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, - Ecore_X_Action action) -{ - int num = 0, i = 0; - Ecore_X_Atom *atoms, atom; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - num = - ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, - &atoms); - if (num <= 0) return EINA_FALSE; - - atom = _ecore_xcb_netwm_action_atom_get(action); - for (i = 0; i < num; i++) - { - if (atoms[i] == atom) - { - ret = EINA_TRUE; - break; - } - } - - if (atoms) free(atoms); - return ret; -} - -EAPI Eina_Bool -ecore_x_netwm_allowed_action_get(Ecore_X_Window win, - Ecore_X_Action **action, - unsigned int *num) -{ - Ecore_X_Atom *atoms; - int num_ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (num) *num = 0; - if (action) *action = NULL; - - num_ret = - ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, - &atoms); - if (num_ret <= 0) return EINA_FALSE; - if (action) - { - *action = malloc(num_ret * sizeof(Ecore_X_Action)); - if (*action) - { - int i = 0; - - for (i = 0; i < num_ret; i++) - (*action)[i] = _ecore_xcb_netwm_action_atom_get(atoms[i]); - } - if (num) *num = num_ret; - } - free(atoms); - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_allowed_action_set(Ecore_X_Window win, - Ecore_X_Action *action, - unsigned int num) -{ - Ecore_X_Atom *set; - unsigned int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!num) - { - ecore_x_window_prop_property_del(win, - ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS); - return; - } - - set = malloc(num * sizeof(Ecore_X_Atom)); - if (!set) return; - - for (i = 0; i < num; i++) - set[i] = _ecore_xcb_netwm_action_atom_get(action[i]); - - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, - set, num); - free(set); -} - -/* local functions */ -int -_ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win EINA_UNUSED, - uint8_t data EINA_UNUSED) -{ - // TODO: TBD - return 1; -} - -int -_ecore_xcb_netwm_startup_info(Ecore_X_Window win EINA_UNUSED, - uint8_t data EINA_UNUSED) -{ - // TODO: TBD - return 1; -} - -/* static void */ -/* _ecore_xcb_netwm_startup_info_free(void *data) */ -/* { */ -/* Ecore_Xcb_Startup_Info *info; */ - -/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */ - -/* if (!(info = data)) return; */ -/* if (info->buffer) free(info->buffer); */ -/* if (info->id) free(info->id); */ -/* if (info->name) free(info->name); */ -/* if (info->bin) free(info->bin); */ -/* if (info->icon) free(info->icon); */ -/* if (info->description) free(info->description); */ -/* if (info->wmclass) free(info->wmclass); */ -/* free(info); */ -/* } */ - -static Ecore_X_Atom -_ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type) -{ - switch (type) - { - case ECORE_X_WINDOW_TYPE_DESKTOP: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; - - case ECORE_X_WINDOW_TYPE_DOCK: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; - - case ECORE_X_WINDOW_TYPE_TOOLBAR: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; - - case ECORE_X_WINDOW_TYPE_MENU: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU; - - case ECORE_X_WINDOW_TYPE_UTILITY: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY; - - case ECORE_X_WINDOW_TYPE_SPLASH: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; - - case ECORE_X_WINDOW_TYPE_DIALOG: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; - - case ECORE_X_WINDOW_TYPE_NORMAL: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; - - case ECORE_X_WINDOW_TYPE_DROPDOWN_MENU: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU; - - case ECORE_X_WINDOW_TYPE_POPUP_MENU: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU; - - case ECORE_X_WINDOW_TYPE_TOOLTIP: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP; - - case ECORE_X_WINDOW_TYPE_NOTIFICATION: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION; - - case ECORE_X_WINDOW_TYPE_COMBO: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO; - - case ECORE_X_WINDOW_TYPE_DND: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND; - - default: - return 0; - } -} - -static Ecore_X_Window_Type -_ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP) - return ECORE_X_WINDOW_TYPE_DESKTOP; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK) - return ECORE_X_WINDOW_TYPE_DOCK; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR) - return ECORE_X_WINDOW_TYPE_TOOLBAR; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU) - return ECORE_X_WINDOW_TYPE_MENU; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY) - return ECORE_X_WINDOW_TYPE_UTILITY; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH) - return ECORE_X_WINDOW_TYPE_SPLASH; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG) - return ECORE_X_WINDOW_TYPE_DIALOG; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL) - return ECORE_X_WINDOW_TYPE_NORMAL; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) - return ECORE_X_WINDOW_TYPE_DROPDOWN_MENU; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU) - return ECORE_X_WINDOW_TYPE_POPUP_MENU; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP) - return ECORE_X_WINDOW_TYPE_TOOLTIP; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION) - return ECORE_X_WINDOW_TYPE_NOTIFICATION; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO) - return ECORE_X_WINDOW_TYPE_COMBO; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND) - return ECORE_X_WINDOW_TYPE_DND; - else - return ECORE_X_WINDOW_TYPE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state) -{ - switch (state) - { - case ECORE_X_WINDOW_STATE_MODAL: - return ECORE_X_ATOM_NET_WM_STATE_MODAL; - - case ECORE_X_WINDOW_STATE_STICKY: - return ECORE_X_ATOM_NET_WM_STATE_STICKY; - - case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: - return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT; - - case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: - return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ; - - case ECORE_X_WINDOW_STATE_SHADED: - return ECORE_X_ATOM_NET_WM_STATE_SHADED; - - case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: - return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR; - - case ECORE_X_WINDOW_STATE_SKIP_PAGER: - return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER; - - case ECORE_X_WINDOW_STATE_HIDDEN: - return ECORE_X_ATOM_NET_WM_STATE_HIDDEN; - - case ECORE_X_WINDOW_STATE_FULLSCREEN: - return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN; - - case ECORE_X_WINDOW_STATE_ABOVE: - return ECORE_X_ATOM_NET_WM_STATE_ABOVE; - - case ECORE_X_WINDOW_STATE_BELOW: - return ECORE_X_ATOM_NET_WM_STATE_BELOW; - - case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION: - return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; - - default: - return 0; - } -} - -Ecore_X_Window_State -_ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_NET_WM_STATE_MODAL) - return ECORE_X_WINDOW_STATE_MODAL; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_STICKY) - return ECORE_X_WINDOW_STATE_STICKY; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT) - return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ) - return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_SHADED) - return ECORE_X_WINDOW_STATE_SHADED; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR) - return ECORE_X_WINDOW_STATE_SKIP_TASKBAR; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER) - return ECORE_X_WINDOW_STATE_SKIP_PAGER; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_HIDDEN) - return ECORE_X_WINDOW_STATE_HIDDEN; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN) - return ECORE_X_WINDOW_STATE_FULLSCREEN; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_ABOVE) - return ECORE_X_WINDOW_STATE_ABOVE; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_BELOW) - return ECORE_X_WINDOW_STATE_BELOW; - else if (atom == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION) - return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; - else - return ECORE_X_WINDOW_STATE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_xcb_netwm_action_atom_get(Ecore_X_Action action) -{ - switch (action) - { - case ECORE_X_ACTION_MOVE: - return ECORE_X_ATOM_NET_WM_ACTION_MOVE; - - case ECORE_X_ACTION_RESIZE: - return ECORE_X_ATOM_NET_WM_ACTION_RESIZE; - - case ECORE_X_ACTION_MINIMIZE: - return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; - - case ECORE_X_ACTION_SHADE: - return ECORE_X_ATOM_NET_WM_ACTION_SHADE; - - case ECORE_X_ACTION_STICK: - return ECORE_X_ATOM_NET_WM_ACTION_STICK; - - case ECORE_X_ACTION_MAXIMIZE_HORZ: - return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; - - case ECORE_X_ACTION_MAXIMIZE_VERT: - return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; - - case ECORE_X_ACTION_FULLSCREEN: - return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; - - case ECORE_X_ACTION_CHANGE_DESKTOP: - return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; - - case ECORE_X_ACTION_CLOSE: - return ECORE_X_ATOM_NET_WM_ACTION_CLOSE; - - case ECORE_X_ACTION_ABOVE: - return ECORE_X_ATOM_NET_WM_ACTION_ABOVE; - - case ECORE_X_ACTION_BELOW: - return ECORE_X_ATOM_NET_WM_ACTION_BELOW; - - default: - return 0; - } -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c b/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c deleted file mode 100644 index 0c04a2a..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c +++ /dev/null @@ -1,129 +0,0 @@ -#include "ecore_xcb_private.h" - -/** - * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions - * @ingroup Ecore_X_Group - * - * Functions that operate on pixmaps. - */ - -/** - * Creates a new pixmap. - * @param win Window used to determine which screen of the display the - * pixmap should be created on. If 0, the default root window - * is used. - * @param w Width of the new pixmap. - * @param h Height of the new pixmap. - * @param dep Depth of the pixmap. If 0, the default depth of the default - * screen is used. - * @return New pixmap. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI Ecore_X_Pixmap -ecore_x_pixmap_new(Ecore_X_Window win, - int w, - int h, - int dep) -{ - Ecore_X_Pixmap pmap; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth; - - pmap = xcb_generate_id(_ecore_xcb_conn); - xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h); - -// ecore_x_flush(); - return pmap; -} - -/** - * Deletes the reference to the given pixmap. - * - * If no other clients have a reference to the given pixmap, the server - * will destroy it. - * - * @param pmap The given pixmap. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI void -ecore_x_pixmap_free(Ecore_X_Pixmap pmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_free_pixmap(_ecore_xcb_conn, pmap); -// ecore_x_flush(); -} - -/** - * Pastes a rectangular area of the given pixmap onto the given drawable. - * @param pmap The given pixmap. - * @param dest The given drawable. - * @param gc The graphics context which governs which operation will - * be used to paste the area onto the drawable. - * @param sx The X position of the area on the pixmap. - * @param sy The Y position of the area on the pixmap. - * @param w The width of the area. - * @param h The height of the area. - * @param dx The X position at which to paste the area on @p dest. - * @param dy The Y position at which to paste the area on @p dest. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI void -ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, - Ecore_X_Drawable dest, - Ecore_X_GC gc, - int sx, - int sy, - int w, - int h, - int dx, - int dy) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h); -// ecore_x_flush(); -} - -/** - * Retrieves the size of the given pixmap. - * @param pmap The given pixmap. - * @param x Pointer to an integer in which to store the X position. - * @param y Pointer to an integer in which to store the Y position. - * @param w Pointer to an integer in which to store the width. - * @param h Pointer to an integer in which to store the height. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI void -ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, - int *x, - int *y, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (pmap) - ecore_x_drawable_geometry_get(pmap, x, y, w, h); -} - -/** - * Retrieves the depth of the given pixmap. - * @param pmap The given pixmap. - * @return The depth of the pixmap. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI int -ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_drawable_depth_get(pmap); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_present.c b/src/lib/ecore_x/xcb/ecore_xcb_present.c deleted file mode 100644 index f722fb4..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_present.c +++ /dev/null @@ -1,200 +0,0 @@ -#include "ecore_xcb_private.h" -# ifdef ECORE_XCB_XPRESENT -# include -# endif - -/* local variables */ -static Eina_Bool _xpresent_avail = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_xpresent = -1; - -void -_ecore_xcb_xpresent_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XPRESENT - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_present_id); -#endif -} - -void -_ecore_xcb_xpresent_finalize(void) -{ -#ifdef ECORE_XCB_XPRESENT - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XPRESENT - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_present_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_present_query_version_cookie_t cookie; - xcb_present_query_version_reply_t *reply; - - cookie = - xcb_present_query_version_unchecked(_ecore_xcb_conn, - XCB_PRESENT_MAJOR_VERSION, - XCB_PRESENT_MINOR_VERSION); - reply = xcb_present_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - _xpresent_avail = EINA_TRUE; - free(reply); - } - - if (_xpresent_avail) - _ecore_xcb_event_xpresent = ext_reply->first_event; - } -#endif -} - -#ifdef ECORE_XCB_XPRESENT -#define SET(X) e->X = ev->X - -static void -_present_configure(xcb_present_configure_notify_event_t *ev) -{ - Ecore_X_Event_Present_Configure *e; - - e = calloc(1, sizeof(Ecore_X_Event_Present_Configure)); - if (!e) return; - - e->win = ev->window; - SET(x), SET(y); - SET(width), SET(height); - SET(off_x), SET(off_y); - SET(pixmap_width), SET(pixmap_height); - SET(pixmap_flags); - - ecore_event_add(ECORE_X_EVENT_PRESENT_CONFIGURE, e, NULL, NULL); -} - -static void -_present_complete(xcb_present_complete_notify_event_t *ev) -{ - unsigned int mode[] = - { - [XCB_PRESENT_COMPLETE_MODE_COPY] = ECORE_X_PRESENT_COMPLETE_MODE_COPY, - [XCB_PRESENT_COMPLETE_MODE_FLIP] = ECORE_X_PRESENT_COMPLETE_MODE_FLIP, - [XCB_PRESENT_COMPLETE_MODE_SKIP] = ECORE_X_PRESENT_COMPLETE_MODE_SKIP, - }; - Ecore_X_Event_Present_Complete *e; - - e = calloc(1, sizeof(Ecore_X_Event_Present_Complete)); - if (!e) return; - - e->win = ev->window; - SET(serial); - SET(ust), SET(msc); - e->kind = (ev->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC); - e->mode = mode[ev->mode]; - ecore_event_add(ECORE_X_EVENT_PRESENT_COMPLETE, e, NULL, NULL); -} - -static void -_present_idle(xcb_present_idle_notify_event_t *ev) -{ - Ecore_X_Event_Present_Idle *e; - - e = calloc(1, sizeof(Ecore_X_Event_Present_Idle)); - if (!e) return; - - e->win = ev->window; - SET(serial); - SET(pixmap); - SET(idle_fence); - ecore_event_add(ECORE_X_EVENT_PRESENT_IDLE, e, NULL, NULL); -} -#undef SET - -void -_ecore_xcb_event_handle_present_event(xcb_ge_event_t *ev) -{ - switch (ev->event_type) - { - case XCB_PRESENT_EVENT_CONFIGURE_NOTIFY: - _present_configure((xcb_present_configure_notify_event_t*)(long)ev->pad1); - break; - case XCB_PRESENT_EVENT_COMPLETE_NOTIFY: - _present_complete((xcb_present_complete_notify_event_t*)(long)ev->pad1); - break; - case XCB_PRESENT_EVENT_IDLE_NOTIFY: - _present_idle((xcb_present_idle_notify_event_t*)(long)ev->pad1); - break; - default: break; - } -} -#endif - - -EAPI void -ecore_x_present_select_events(Ecore_X_Window win, unsigned int events) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef ECORE_XCB_XPRESENT - CHECK_XCB_CONN; - xcb_present_select_input(_ecore_xcb_conn, _ecore_xcb_event_xpresent, win, events); -#else - (void)win; - (void)events; -#endif -} - -EAPI void -ecore_x_present_notify_msc(Ecore_X_Window win, unsigned int serial, unsigned long long target_msc, unsigned long long divisor, unsigned long long remainder) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef ECORE_XCB_XPRESENT - CHECK_XCB_CONN; - xcb_present_notify_msc(_ecore_xcb_conn, win, serial, target_msc, divisor, remainder); -#else - (void)win; - (void)serial; - (void)target_msc; - (void)divisor; - (void)remainder; -#endif -} - -EAPI void -ecore_x_present_pixmap(Ecore_X_Window win, Ecore_X_Pixmap pixmap, unsigned int serial, Ecore_X_Region valid, - Ecore_X_Region update, int x_off, int y_off, Ecore_X_Randr_Crtc target_crtc, - Ecore_X_Sync_Fence wait_fence, Ecore_X_Sync_Fence idle_fence, unsigned int options, - unsigned long long target_msc, unsigned long long divisor, unsigned long long remainder, - Ecore_X_Present *notifies, int num_notifies) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef ECORE_XCB_XPRESENT - CHECK_XCB_CONN; - xcb_present_pixmap(_ecore_xcb_conn, win, pixmap, serial, valid, update, - x_off, y_off, target_crtc, wait_fence, idle_fence, options, target_msc, - divisor, remainder, num_notifies, (xcb_present_notify_t*)notifies); -#else - (void)win; - (void)pixmap; - (void)serial; - (void)valid; - (void)update; - (void)x_off; - (void)y_off; - (void)target_crtc; - (void)wait_fence; - (void)idle_fence; - (void)options; - (void)target_msc; - (void)divisor; - (void)remainder; - (void)notifies; - (void)num_notifies; -#endif -} - -EAPI Eina_Bool -ecore_x_present_exists(void) -{ - return _xpresent_avail; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_private.h b/src/lib/ecore_x/xcb/ecore_xcb_private.h deleted file mode 100644 index f56ecac..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_private.h +++ /dev/null @@ -1,448 +0,0 @@ -#ifndef __ECORE_XCB_PRIVATE_H__ -# define __ECORE_XCB_PRIVATE_H__ - -//# define LOGFNS 1 - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif - -# include // included for close & gethostname functions - -/* generic xcb includes */ -# include -# include -# include -# include - -/* EFL includes */ -# include "Ecore.h" -# include "Ecore_Input.h" -# include "Ecore_X.h" - -/* logging */ -extern int _ecore_xcb_log_dom; - -# ifdef ECORE_XCB_DEFAULT_LOG_COLOR -# undef ECORE_XCB_DEFAULT_LOG_COLOR -# endif -# define ECORE_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE - -# ifdef ERR -# undef ERR -# endif -# define ERR(...) EINA_LOG_DOM_ERR(_ecore_xcb_log_dom, __VA_ARGS__) - -# ifdef DBG -# undef DBG -# endif -# define DBG(...) EINA_LOG_DOM_DBG(_ecore_xcb_log_dom, __VA_ARGS__) - -# ifdef INF -# undef INF -# endif -# define INF(...) EINA_LOG_DOM_INFO(_ecore_xcb_log_dom, __VA_ARGS__) - -# ifdef WRN -# undef WRN -# endif -# define WRN(...) EINA_LOG_DOM_WARN(_ecore_xcb_log_dom, __VA_ARGS__) - -# ifdef CRI -# undef CRI -# endif -# define CRI(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__) - -# ifdef LOGFNS -# include -# define LOGFN(fl, ln, fn) printf("-ECORE-XCB: %25s: %5i - %s\n", fl, ln, fn); -# else -# define LOGFN(fl, ln, fn) -# endif - -# ifndef MAXHOSTNAMELEN -# define MAXHOSTNAMELEN 256 -# endif - -#define CHECK_XCB_CONN \ - { \ - if (!_ecore_xcb_conn || xcb_connection_has_error(_ecore_xcb_conn)) \ - { \ - DBG("XCB Connection Has Error !!"); \ - _ecore_xcb_io_error_handle(NULL); \ - } \ - } - -/* enums */ -typedef enum _Ecore_Xcb_Encoding_Style Ecore_Xcb_Encoding_Style; - -enum _Ecore_Xcb_Encoding_Style -{ - XcbStringStyle, - XcbCompoundTextStyle, - XcbTextStyle, - XcbStdICCTextStyle, - XcbUTF8StringStyle -}; - -/* structures */ -typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source; -typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target; -typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern; -typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter; -typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser; -typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty; - -struct _Ecore_X_DND_Source -{ - int version; - Ecore_X_Window win, dest; - - enum - { - ECORE_X_DND_SOURCE_IDLE, - ECORE_X_DND_SOURCE_DRAGGING, - ECORE_X_DND_SOURCE_DROPPED, - ECORE_X_DND_SOURCE_CONVERTING - } state; - - struct - { - short x, y; - unsigned short width, height; - } rectangle; - - struct - { - Ecore_X_Window window; - int x, y; - } prev; - - Ecore_X_Time time; - - Ecore_X_Atom action, accepted_action; - - int will_accept, suppress; - int await_status; -}; - -struct _Ecore_X_DND_Target -{ - int version; - Ecore_X_Window win, source; - - enum - { - ECORE_X_DND_TARGET_IDLE, - ECORE_X_DND_TARGET_ENTERED - } state; - - struct - { - int x, y; - } pos; - - Ecore_X_Time time; - - Ecore_X_Atom action, accepted_action; - int will_accept; -}; - -struct _Ecore_X_Selection_Intern -{ - Ecore_X_Window win; - Ecore_X_Atom selection; - unsigned char *data; - int length; - Ecore_X_Time time; -}; - -struct _Ecore_X_Selection_Converter -{ - Ecore_X_Atom target; - Eina_Bool (*convert)(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *type, - int *size_type); - Ecore_X_Selection_Converter *next; -}; - -struct _Ecore_X_Selection_Parser -{ - char *target; - void *(*parse)(const char *target, void *data, int size, int format); - Ecore_X_Selection_Parser *next; -}; - -struct _Ecore_Xcb_Textproperty -{ - char *value; - Ecore_X_Atom encoding; - unsigned int format, nitems; -}; - -/* external variables */ -extern Ecore_X_Connection *_ecore_xcb_conn; -extern Ecore_X_Screen *_ecore_xcb_screen; -extern double _ecore_xcb_double_click_time; -extern int16_t _ecore_xcb_event_last_root_x; -extern int16_t _ecore_xcb_event_last_root_y; - -/* external variables for extension events */ -extern int _ecore_xcb_event_damage; -extern int _ecore_xcb_event_randr; -extern int _ecore_xcb_event_screensaver; -extern int _ecore_xcb_event_shape; -extern int _ecore_xcb_event_sync; -extern int _ecore_xcb_event_xfixes; -extern int _ecore_xcb_event_input; -extern int _ecore_xcb_event_gesture; - -extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM]; - -extern int _ecore_xcb_button_grabs_num; -extern int _ecore_xcb_key_grabs_num; -extern Ecore_X_Window *_ecore_xcb_button_grabs; -extern Ecore_X_Window *_ecore_xcb_key_grabs; -extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data, - int type, - void *event); -extern void *_ecore_xcb_window_grab_replay_data; - -/* private function prototypes */ -void _ecore_xcb_error_handler_init(void); -void _ecore_xcb_error_handler_shutdown(void); - -void _ecore_xcb_atoms_init(void); -void _ecore_xcb_atoms_finalize(void); - -void _ecore_xcb_extensions_init(void); -void _ecore_xcb_extensions_finalize(void); - -void _ecore_xcb_shape_init(void); -void _ecore_xcb_shape_finalize(void); - -void _ecore_xcb_screensaver_init(void); -void _ecore_xcb_screensaver_finalize(void); - -void _ecore_xcb_sync_init(void); -void _ecore_xcb_sync_finalize(void); -void _ecore_xcb_sync_magic_send(int val, - Ecore_X_Window win); - -void _ecore_xcb_render_init(void); -void _ecore_xcb_render_finalize(void); -Eina_Bool _ecore_xcb_render_argb_get(void); -Eina_Bool _ecore_xcb_render_anim_get(void); -Eina_Bool _ecore_xcb_render_avail_get(void); - -Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual); -uint32_t _ecore_xcb_render_find_visual_id(int type, - Eina_Bool check_alpha); -Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id); - -void _ecore_xcb_randr_init(void); -void _ecore_xcb_randr_finalize(void); - -void _ecore_xcb_gesture_init(void); -void _ecore_xcb_gesture_finalize(void); -void _ecore_xcb_gesture_shutdown(void); - -void _ecore_xcb_xfixes_init(void); -void _ecore_xcb_xfixes_finalize(void); -Eina_Bool _ecore_xcb_xfixes_avail_get(void); - -void _ecore_xcb_damage_init(void); -void _ecore_xcb_damage_finalize(void); - -void _ecore_xcb_composite_init(void); -void _ecore_xcb_composite_finalize(void); - -void _ecore_xcb_present_init(void); -void _ecore_xcb_present_finalize(void); -void _ecore_xcb_event_handle_present_event(xcb_ge_event_t *ev); -extern int _ecore_xcb_event_xpresent; - -void _ecore_xcb_dpms_init(void); -void _ecore_xcb_dpms_finalize(void); - -void _ecore_xcb_cursor_init(void); -void _ecore_xcb_cursor_finalize(void); - -void _ecore_xcb_xinerama_init(void); -void _ecore_xcb_xinerama_finalize(void); - -void _ecore_xcb_dnd_init(void); -void _ecore_xcb_dnd_shutdown(void); -Ecore_X_DND_Source *_ecore_xcb_dnd_source_get(void); -Ecore_X_DND_Target *_ecore_xcb_dnd_target_get(void); -void _ecore_xcb_dnd_drag(Ecore_X_Window root, - int x, - int y); - -void _ecore_xcb_selection_init(void); -void _ecore_xcb_selection_shutdown(void); -void *_ecore_xcb_selection_parse(const char *target, - void *data, - int size, - int format); -char *_ecore_xcb_selection_target_get(Ecore_X_Atom target); -Ecore_X_Selection_Intern *_ecore_xcb_selection_get(Ecore_X_Atom selection); - -# ifdef HAVE_ICONV -Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list, - int count, - Ecore_Xcb_Encoding_Style style, - Ecore_Xcb_Textproperty *ret); -# endif -Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list, - int count, - Ecore_Xcb_Encoding_Style style, - Ecore_Xcb_Textproperty *ret); -Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type, - char **list, - int count, - Ecore_Xcb_Encoding_Style style, - Ecore_Xcb_Textproperty *ret); - -# ifdef HAVE_ICONV -Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, - char ***list_ret, - int *count_ret); -# endif -Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, - char ***list_ret, - int *count_ret); -Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, - const char *type, - char ***list_ret, - int *count_ret); - -void _ecore_xcb_events_init(void); -void _ecore_xcb_events_shutdown(void); -void _ecore_xcb_events_handle(xcb_generic_event_t *ev); -Ecore_X_Time _ecore_xcb_events_last_time_get(void); -unsigned int _ecore_xcb_events_modifiers_get(unsigned int state); -void _ecore_xcb_event_mouse_move(uint16_t timestamp, - uint16_t modifiers, - int16_t x, - int16_t y, - int16_t root_x, - int16_t root_y, - xcb_window_t event_win, - xcb_window_t win, - xcb_window_t root_win, - uint8_t same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - int16_t mx, - int16_t my, - int16_t mrx, - int16_t mry); -Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event, - uint16_t timestamp, - uint16_t modifiers, - xcb_button_t buttons, - int16_t x, - int16_t y, - int16_t root_x, - int16_t root_y, - xcb_window_t event_win, - xcb_window_t win, - xcb_window_t root_win, - uint8_t same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - int16_t mx, - int16_t my, - int16_t mrx, - int16_t mry); - -void _ecore_xcb_keymap_init(void); -void _ecore_xcb_keymap_finalize(void); -void _ecore_xcb_keymap_shutdown(void); -void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event); -xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, - int col); -xcb_keycode_t *_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym); -char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym); -xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key); -int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, - int state, - char *buffer, - int bytes, - xcb_keysym_t *sym); - -void _ecore_xcb_input_init(void); -void _ecore_xcb_input_finalize(void); -void _ecore_xcb_input_shutdown(void); -# ifdef ECORE_XCB_XINPUT -void _ecore_xcb_input_handle_event(xcb_generic_event_t *event); -# else -void _ecore_xcb_input_handle_event(xcb_generic_event_t *event); -# endif - -void _ecore_xcb_dri_init(void); -void _ecore_xcb_dri_finalize(void); - -void _ecore_xcb_xtest_init(void); -void _ecore_xcb_xtest_finalize(void); - -Ecore_X_Window _ecore_xcb_window_root_of_screen_get(int screen); -void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win, - Ecore_X_Atom atom, - const char *str); -Ecore_X_Visual _ecore_xcb_window_visual_get(Ecore_X_Window win); -void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win); -void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win); -void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win, - Ecore_X_Window child_win, - int type, - void *event, - Ecore_X_Time timestamp); - -int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win, - uint8_t data); -int _ecore_xcb_netwm_startup_info(Ecore_X_Window win, - uint8_t data); -Ecore_X_Window_State _ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom); - -int _ecore_xcb_error_handle(xcb_generic_error_t *err); -int _ecore_xcb_io_error_handle(xcb_generic_error_t *err); - -xcb_image_t *_ecore_xcb_image_create_native(int w, - int h, - xcb_image_format_t format, - uint8_t depth, - void *base, - uint32_t bytes, - uint8_t *data); - -void _ecore_xcb_xdefaults_init(void); -void _ecore_xcb_xdefaults_shutdown(void); -char *_ecore_xcb_xdefaults_string_get(const char *prog, - const char *param); -int _ecore_xcb_xdefaults_int_get(const char *prog, - const char *param); - -void _ecore_xcb_modifiers_get(void); - -#endif diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c deleted file mode 100644 index 74ae2f8..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c +++ /dev/null @@ -1,4323 +0,0 @@ -/* TODO: List of missing functions - * - * ecore_x_randr_edid_display_aspect_ratio_preferred_get - * ecore_x_randr_edid_display_aspect_ratios_get - * ecore_x_randr_edid_display_colorscheme_get - * ecore_x_randr_edid_display_type_digital_get - * ecore_x_randr_edid_display_interface_type_get - * ecore_x_randr_output_subpixel_order_get - * ecore_x_randr_output_wired_clones_get - * ecore_x_randr_output_compatibility_list_get - * ecore_x_randr_output_signal_formats_get - * ecore_x_randr_output_signal_format_set - * ecore_x_randr_output_signal_properties_get - * ecore_x_randr_output_connector_number_get - * ecore_x_randr_output_connector_type_get - * ecore_x_randr_crtc_panning_area_get - * ecore_x_randr_crtc_panning_area_set - * ecore_x_randr_crtc_tracking_area_get - * ecore_x_randr_crtc_tracking_area_set - * ecore_x_randr_crtc_border_area_get - * ecore_x_randr_crtc_border_area_set - */ - -#include "ecore_xcb_private.h" -# ifdef ECORE_XCB_RANDR -# include -# endif - -#define Ecore_X_Randr_None 0 -#define Ecore_X_Randr_Unset -1 - -#define RANDR_1_1 ((1 << 16) | 1) -#define RANDR_1_2 ((1 << 16) | 2) -#define RANDR_1_3 ((1 << 16) | 3) -#define RANDR_1_4 ((1 << 16) | 4) - -#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) return ret -#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) return ret -#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) return ret -#define RANDR_CHECK_1_4_RET(ret) if (_randr_version < RANDR_1_4) return ret - -#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3) -#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12 -#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13 -#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36 -#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3 -#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5 -#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13 -#define _ECORE_X_RANDR_EDID_MANUFACTURER 0x08 - -#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ - for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18) - -#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \ - _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ - if ((block[0] == 0) && (block[1] == 0)) - -#ifdef ECORE_XCB_RANDR -# define RANDR_VALIDATE_ROOT(screen, root) \ - ((screen = _ecore_xcb_randr_root_to_screen(root)) != -1) -#endif - -/* local function prototypes */ -static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root, - Ecore_X_Randr_Output output); -static Eina_Bool _ecore_xcb_randr_crtc_validate(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc); -static Eina_Bool _ecore_xcb_randr_root_validate(Ecore_X_Window root); -static int _ecore_xcb_randr_root_to_screen(Ecore_X_Window root); -#ifdef ECORE_XCB_RANDR -static xcb_randr_get_screen_resources_reply_t *_ecore_xcb_randr_12_get_resources(Ecore_X_Window win); -static xcb_randr_get_screen_resources_current_reply_t *_ecore_xcb_randr_13_get_resources(Ecore_X_Window win); -#endif -static xcb_timestamp_t _ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win); -static xcb_timestamp_t _ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win); - -static Ecore_X_Randr_Mode *_ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num, - int *npreferred); -static Ecore_X_Randr_Mode *_ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num, - int *npreferred); -static Ecore_X_Randr_Mode_Info *_ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode); -static Ecore_X_Randr_Mode_Info *_ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode); -static Ecore_X_Randr_Mode_Info **_ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root, - int *num); -static Ecore_X_Randr_Mode_Info **_ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root, - int *num); -static void _ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h); -static void _ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h); -static Ecore_X_Randr_Output *_ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num); -static Ecore_X_Randr_Output *_ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num); -static Ecore_X_Randr_Crtc *_ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num); -static Ecore_X_Randr_Crtc *_ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num); -static char *_ecore_xcb_randr_12_output_name_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *len); -static char *_ecore_xcb_randr_13_output_name_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *len); -static Ecore_X_Randr_Connection_Status _ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root, - Ecore_X_Randr_Output output); -static Ecore_X_Randr_Connection_Status _ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root, - Ecore_X_Randr_Output output); -static Ecore_X_Randr_Output *_ecore_xcb_randr_12_outputs_get(Ecore_X_Window root, - int *num); -static Ecore_X_Randr_Output *_ecore_xcb_randr_13_outputs_get(Ecore_X_Window root, - int *num); -static Ecore_X_Randr_Crtc _ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root, - Ecore_X_Randr_Output output); -static Ecore_X_Randr_Crtc _ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root, - Ecore_X_Randr_Output output); - -/* local variables */ -static Eina_Bool _randr_avail = EINA_FALSE; -static int _randr_version = -1; - -/* external variables */ -int _ecore_xcb_event_randr = -1; - -void -_ecore_xcb_randr_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_RANDR - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_randr_id); -#endif -} - -void -_ecore_xcb_randr_finalize(void) -{ -#ifdef ECORE_XCB_RANDR - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_RANDR - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_randr_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_randr_query_version_cookie_t cookie; - xcb_randr_query_version_reply_t *reply; - - cookie = - xcb_randr_query_version_unchecked(_ecore_xcb_conn, - XCB_RANDR_MAJOR_VERSION, - XCB_RANDR_MINOR_VERSION); - reply = xcb_randr_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if ((reply->major_version >= XCB_RANDR_MAJOR_VERSION) && - (reply->minor_version >= XCB_RANDR_MINOR_VERSION)) - _randr_avail = EINA_TRUE; - - _randr_version = - ((reply->major_version << 16) | reply->minor_version); - - free(reply); - } - - if (_randr_avail) - _ecore_xcb_event_randr = ext_reply->first_event; - } -#endif -} - -static Eina_Bool -#ifdef ECORE_XCB_RANDR -_ecore_xcb_randr_root_validate(Ecore_X_Window root) -#else -_ecore_xcb_randr_root_validate(Ecore_X_Window root EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Randr_Screen scr = -1; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_RANDR - if ((root) && RANDR_VALIDATE_ROOT(scr, root)) - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - -static int -_ecore_xcb_randr_root_to_screen(Ecore_X_Window root) -{ - int count = 0, num = 0; - - CHECK_XCB_CONN; - - count = xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn)); - for (num = 0; num < count; num++) - if (_ecore_xcb_window_root_of_screen_get(num) == root) - return num; - - return -1; -} - -/* public functions */ - -/* - * @brief Query whether RandR is available or not. - * - * @return @c EINA_TRUE if extension is available, @c EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_randr_query(void) -{ - return _randr_avail; -} - -/* - * @return version of the RandRR extension supported by the server or, - * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1). - * bit version information: 31 MAJOR 16 | 15 MINOR 0 - */ -EAPI int -ecore_x_randr_version_get(void) -{ - return _randr_version; -} - -/** - * @brief This function returns the current config timestamp from - * XRRScreenConfiguration. - * - * @param root root window to query screen configuration from - * - * @returns The screen configuration timestamp - * - * @since 1.8 - */ -EAPI Ecore_X_Time -ecore_x_randr_config_timestamp_get(Ecore_X_Window root) -{ - Ecore_X_Time timestamp = 0; - -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - timestamp = (Ecore_X_Time)reply->config_timestamp; - free(reply); - } -#endif - - return timestamp; -} - -/* - * @param root window which's primary output will be queried - */ -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root) -{ - int ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - ret = reply->rotations; - free(reply); - } -#endif - - return ret; -} - -/* - * @param root window which's primary output will be queried - * @return the current orientation of the root window's screen primary output - */ -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root) -{ - int ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - ret = reply->rotation; - free(reply); - } -#endif - - return ret; -} - -/* - * @brief Sets a given screen's primary output's orientation. - * - * @param root Window which's screen's primary output will be queried. - * @param orientation Orientation which should be set for the root window's - * screen primary output. - * @return @c EINA_TRUE if the primary output's orientation could be - * successfully altered. - */ -EAPI Eina_Bool -ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root, - Ecore_X_Randr_Orientation orientation) -{ - int ret = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - xcb_randr_set_screen_config_cookie_t scookie; - xcb_randr_set_screen_config_reply_t *sreply; - - scookie = - xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root, - XCB_CURRENT_TIME, - reply->config_timestamp, - reply->sizeID, orientation, - reply->rate); - sreply = - xcb_randr_set_screen_config_reply(_ecore_xcb_conn, scookie, NULL); - if (!sreply) - ret = EINA_FALSE; - else - { - ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? - EINA_TRUE : EINA_FALSE; - free(sreply); - } - free(reply); - } -#endif - - return ret; -} - -/* - * @brief gets a screen's primary output's possible sizes - * @param root window which's primary output will be queried - * @param num number of sizes reported as supported by the screen's primary output - * @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL - */ -EAPI Ecore_X_Randr_Screen_Size_MM * -ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, - int *num) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; - Ecore_X_Randr_Screen_Size_MM *ret = NULL; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - int len = 0, i = 0; - xcb_randr_screen_size_t *sizes; - - len = xcb_randr_get_screen_info_sizes_length(reply); - sizes = xcb_randr_get_screen_info_sizes(reply); - if ((!sizes) || (len <= 0)) - { - free(reply); - return NULL; - } - if (num) *num = len; - ret = calloc(len, sizeof(Ecore_X_Randr_Screen_Size_MM)); - if (!ret) - { - free(reply); - return NULL; - } - for (i = 0; i < len; i++) - { - ret[i].width = sizes[i].width; - ret[i].height = sizes[i].height; - ret[i].width_mm = sizes[i].mwidth; - ret[i].height_mm = sizes[i].mheight; - } - - free(reply); - } - - return ret; -#else - return NULL; -#endif -} - -/* - * @brief get the current set size of a given screen's primary output - * @param root window which's primary output will be queried - * @param w the current size's width - * @param h the current size's height - * @param w_mm the current size's width in mm - * @param h_mm the current size's height in mm - * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set() - */ -EAPI void -ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, - int *w, - int *h, - int *w_mm, - int *h_mm, - int *size_index) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - int len = 0, idx = 0; - xcb_randr_screen_size_t *sizes; - - len = xcb_randr_get_screen_info_sizes_length(reply); - sizes = xcb_randr_get_screen_info_sizes(reply); - if ((!sizes) || (len <= 0)) - { - free(reply); - return; - } - idx = reply->sizeID; - if ((idx < len) && (idx >= 0)) - { - if (w) *w = sizes[idx].width; - if (h) *h = sizes[idx].height; - if (w_mm) *w_mm = sizes[idx].mwidth; - if (h_mm) *h_mm = sizes[idx].mheight; - if (size_index) *size_index = idx; - } - - free(reply); - } -#endif -} - -/* - * @brief Sets a given screen's primary output size, but disables all other - * outputs at the same time. - * - * @param root Window which's primary output will be queried. - * @param size_index Within the list of sizes reported as supported by the root - * window's screen primary output. - * @return @c EINA_TRUE on success, @c EINA_FALSE on failure due to e.g. - * invalid times. - */ -EAPI Eina_Bool -ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, - int size_index) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if (!((size_index >= 0) && (_ecore_xcb_randr_root_validate(root)))) - return EINA_FALSE; - - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - int len = 0; - - len = xcb_randr_get_screen_info_sizes_length(reply); - if (len <= 0) - { - free(reply); - return EINA_FALSE; - } - if ((size_index < len) && (size_index >= 0)) - { - xcb_randr_set_screen_config_cookie_t scookie; - xcb_randr_set_screen_config_reply_t *sreply; - - scookie = - xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root, - XCB_CURRENT_TIME, - reply->config_timestamp, - size_index, - reply->rotation, - reply->rate); - sreply = - xcb_randr_set_screen_config_reply(_ecore_xcb_conn, - scookie, NULL); - if (!sreply) - ret = EINA_FALSE; - else - { - ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? - EINA_TRUE : EINA_FALSE; - free(sreply); - } - } - - free(reply); - } -#endif - return ret; -} - -/* - * @param root window which's primary output will be queried - * @return currently used refresh rate or - if request failed or RandRR is not available - 0.0 - */ -EAPI Ecore_X_Randr_Refresh_Rate -ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; - Ecore_X_Randr_Refresh_Rate ret = 0.0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if (!_ecore_xcb_randr_root_validate(root)) return ret; - - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - ret = reply->rate; - free(reply); - } - - return ret; -#else - return 0.0; -#endif -} - -/* - * @param root window which's primary output will be queried - * @param size_index referencing the size to query valid refresh rates for - * @return currently used refresh rate or - if request failed or RandRR is not available - NULL - */ -EAPI Ecore_X_Randr_Refresh_Rate * -ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, - int size_index, - int *num) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; - Ecore_X_Randr_Refresh_Rate *ret = NULL; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if (!_ecore_xcb_randr_root_validate(root)) return ret; - - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - int len = 0; - - len = xcb_randr_get_screen_info_rates_length(reply); - if (num) *num = len; - - ret = malloc(sizeof(Ecore_X_Randr_Refresh_Rate) * len); - if (ret) - { - xcb_randr_refresh_rates_iterator_t iter; - int i = 0; - - iter = xcb_randr_get_screen_info_rates_iterator(reply); - while (i++ < size_index) - xcb_randr_refresh_rates_next(&iter); - - memcpy(ret, xcb_randr_refresh_rates_rates(iter.data), - sizeof(Ecore_X_Randr_Refresh_Rate) * len); - } - free(reply); - } - - return ret; -#else - return NULL; -#endif -} - -/* - * @brief Sets the current primary output's refresh rate. - * - * @param root Window which's primary output will be queried. - * @param size_index Referencing the size to be set. - * @param rate The refresh rate to be set. - * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root, - int size_index, - Ecore_X_Randr_Refresh_Rate rate) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_info_cookie_t cookie; - xcb_randr_get_screen_info_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if (_randr_version < RANDR_1_1) return EINA_FALSE; - - cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - xcb_randr_set_screen_config_cookie_t scookie; - xcb_randr_set_screen_config_reply_t *sreply; - - scookie = - xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root, - XCB_CURRENT_TIME, - reply->config_timestamp, - size_index, - reply->rotation, rate); - sreply = - xcb_randr_set_screen_config_reply(_ecore_xcb_conn, - scookie, NULL); - if (!sreply) - ret = EINA_FALSE; - else - { - ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? - EINA_TRUE : EINA_FALSE; - free(sreply); - } - free(reply); - } -#endif - - return ret; -} - -/* - * @brief Free detailed mode information. The pointer handed in will be set to - * @c NULL after freeing the memory. - * - * @param mode_info The mode information that should be freed. - */ -EAPI void -ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - RANDR_CHECK_1_2_RET(); - - if (!mode_info) return; - - if (mode_info->name) free(mode_info->name); - free(mode_info); -} - -/* - * @param root window which's screen should be queried - * @return Ecore_X_Randr_Ouptut_Id or - if query failed or none is set - Ecore_X_Randr_None - */ -EAPI Ecore_X_Randr_Output -ecore_x_randr_primary_output_get(Ecore_X_Window root) -{ - Ecore_X_Randr_Output ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_output_primary_cookie_t cookie; - xcb_randr_get_output_primary_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_3_RET(Ecore_X_Randr_None); - - if (!_ecore_xcb_randr_root_validate(root)) - return Ecore_X_Randr_None; - - cookie = xcb_randr_get_output_primary_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_output_primary_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - ret = reply->output; - free(reply); - } -#endif - return ret; -} - -/* - * @param root window which's screen should be queried - * @param output that should be set as given root window's screen primary output - */ -EAPI void -ecore_x_randr_primary_output_set(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_3_RET(); - - if ((output) && (_ecore_xcb_randr_root_validate(root))) - xcb_randr_set_output_primary(_ecore_xcb_conn, root, output); -#endif -} - -EAPI Ecore_X_Randr_Mode * -ecore_x_randr_output_modes_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num, - int *npreferred) -{ - Ecore_X_Randr_Mode *modes = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (_randr_version >= RANDR_1_3) - { - modes = - _ecore_xcb_randr_13_output_modes_get(root, output, num, npreferred); - } - else if (_randr_version == RANDR_1_2) - { - modes = - _ecore_xcb_randr_12_output_modes_get(root, output, num, npreferred); - } -#endif - - return modes; -} - -EAPI Eina_Bool -ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, Ecore_X_Randr_Mode mode) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None)) - return EINA_FALSE; - - xcb_randr_add_output_mode(_ecore_xcb_conn, output, mode); - return EINA_TRUE; -#endif - return EINA_FALSE; -} - -/* - * @brief get detailed information for a given mode id - * @param root window which's screen's ressources are queried - * @param mode the XID which identifies the mode of interest - * @return mode's detailed information - */ -EAPI Ecore_X_Randr_Mode_Info * -ecore_x_randr_mode_info_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode) -{ - Ecore_X_Randr_Mode_Info *ret = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (!_ecore_xcb_randr_root_validate(root)) return NULL; - - if (_randr_version >= RANDR_1_3) - ret = _ecore_xcb_randr_13_mode_info_get(root, mode); - else if (_randr_version == RANDR_1_2) - ret = _ecore_xcb_randr_12_mode_info_get(root, mode); -#endif - return ret; -} - -/* - * @brief add a mode to a display - * @param root window to which's screen's ressources are added - * @param mode_info - * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode - * adding failed. - * @since 1.2.0 - */ -EAPI Ecore_X_Randr_Mode -ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info) -{ - Ecore_X_Randr_Mode mode = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_randr_create_mode_cookie_t cookie; - xcb_randr_create_mode_reply_t *reply; - xcb_randr_mode_info_t info; - int namelen = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (!mode_info) return Ecore_X_Randr_None; - if (!_ecore_xcb_randr_root_validate(root)) return Ecore_X_Randr_None; - - namelen = strlen(mode_info->name); - - memset(&info, 0, sizeof(info)); - info.width = mode_info->width; - info.height = mode_info->height; - info.dot_clock = mode_info->dotClock; - info.hsync_start = mode_info->hSyncStart; - info.hsync_end = mode_info->hSyncEnd; - info.htotal = mode_info->hTotal; - info.hskew = mode_info->hSkew; - info.vsync_start = mode_info->vSyncStart; - info.vsync_end = mode_info->vSyncEnd; - info.vtotal = mode_info->vTotal; - info.mode_flags = mode_info->modeFlags; - info.name_len = namelen; - - cookie = - xcb_randr_create_mode_unchecked(_ecore_xcb_conn, root, info, - namelen, mode_info->name); - reply = xcb_randr_create_mode_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - mode = mode_info->xid; - free(reply); - } -#endif - return mode; -} - -/* - * @brief get detailed information for all modes related to a root window's screen - * @param root window which's screen's ressources are queried - * @param num number of modes returned - * @return modes' information - */ -EAPI Ecore_X_Randr_Mode_Info ** -ecore_x_randr_modes_info_get(Ecore_X_Window root, - int *num) -{ - Ecore_X_Randr_Mode_Info **ret = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num) *num = 0; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (!_ecore_xcb_randr_root_validate(root)) return NULL; - - if (_randr_version >= RANDR_1_3) - ret = _ecore_xcb_randr_13_modes_info_get(root, num); - else if (_randr_version == RANDR_1_2) - ret = _ecore_xcb_randr_12_modes_info_get(root, num); -#endif - return ret; -} - -/** - * @brief Gets the width and hight of a given mode. - * - * @param root Window which's screen's ressources are queried. - * @param mode The mode which's size is to be looked up. - * @param w Width of given mode in px. - * @param h Height of given mode in px. - */ -EAPI void -ecore_x_randr_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - - if (mode == Ecore_X_Randr_None) return; - - if (_randr_version >= RANDR_1_3) - _ecore_xcb_randr_13_mode_size_get(root, mode, w, h); - else if (_randr_version == RANDR_1_2) - _ecore_xcb_randr_12_mode_size_get(root, mode, w, h); -#endif -} - -/** - * @brief Gets the EDID information of an attached output if available. - * Note that this information is not to be compared using ordinary string - * comparison functions, since it includes 0-bytes. - * - * @param root Window this information should be queried from. - * @param output The XID of the output. - * @param length Length of the byte-array. If @c NULL, request will fail. - * @return EDID information of the output. - */ -EAPI unsigned char * -ecore_x_randr_output_edid_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - unsigned long *length) -{ - unsigned char *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_output_property_cookie_t cookie; - xcb_randr_get_output_property_reply_t *reply; - Ecore_X_Atom atom; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if ((!length) || (!_ecore_xcb_randr_output_validate(root, output))) - return NULL; - - atom = ecore_x_atom_get("EDID"); - cookie = - xcb_randr_get_output_property_unchecked(_ecore_xcb_conn, output, atom, - XCB_GET_PROPERTY_TYPE_ANY, - 0, 100, 0, 0); - reply = - xcb_randr_get_output_property_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if ((reply->type == XCB_ATOM_INTEGER) && (reply->format == 8)) - { - if (length) *length = reply->num_items; - if ((ret = malloc(reply->num_items * sizeof(unsigned char)))) - { - memcpy(ret, xcb_randr_get_output_property_data(reply), - (reply->num_items * sizeof(unsigned char))); - } - } - free(reply); - } -#endif - return ret; -} - -/** - * @brief Gets the outputs which might be used simultaneously on the same CRTC. - * - * @param root Window that this information should be queried for. - * @param output The output which's clones we concern. - * @param num Number of possible clones. - * @return The existing outputs, @c NULL otherwise. - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_output_clones_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ - Ecore_X_Randr_Output *outputs = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (output == Ecore_X_Randr_None) return NULL; - - if (_randr_version >= RANDR_1_3) - outputs = _ecore_xcb_randr_13_output_clones_get(root, output, num); - else if (_randr_version == RANDR_1_2) - outputs = _ecore_xcb_randr_12_output_clones_get(root, output, num); -#endif - return outputs; -} - -EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ - Ecore_X_Randr_Crtc *crtcs = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (output == Ecore_X_Randr_None) return NULL; - - if (_randr_version >= RANDR_1_3) - crtcs = _ecore_xcb_randr_13_output_possible_crtcs_get(root, output, num); - else if (_randr_version == RANDR_1_2) - crtcs = _ecore_xcb_randr_12_output_possible_crtcs_get(root, output, num); -#endif - return crtcs; -} - -/** - * @brief gets the given output's name as reported by X - * @param root the window which's screen will be queried - * @param output The output name given to be reported. - * @param len length of returned c-string. - * @return name of the output as reported by X - */ -EAPI char * -ecore_x_randr_output_name_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *len) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (output == Ecore_X_Randr_None) return NULL; - - if (_randr_version >= RANDR_1_3) - return _ecore_xcb_randr_13_output_name_get(root, output, len); - else if (_randr_version == RANDR_1_2) - return _ecore_xcb_randr_12_output_name_get(root, output, len); -#endif - - return NULL; -} - -EAPI Ecore_X_Randr_Connection_Status -ecore_x_randr_output_connection_status_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN); - - if (output == Ecore_X_Randr_None) - return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; - - if (_randr_version >= RANDR_1_3) - return _ecore_xcb_randr_13_output_connection_status_get(root, output); - else if (_randr_version == RANDR_1_2) - return _ecore_xcb_randr_12_output_connection_status_get(root, output); -#endif - - return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; -} - -EAPI Ecore_X_Randr_Output * -ecore_x_randr_outputs_get(Ecore_X_Window root, - int *num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (_randr_version >= RANDR_1_3) - return _ecore_xcb_randr_13_outputs_get(root, num); - else if (_randr_version == RANDR_1_2) - return _ecore_xcb_randr_12_outputs_get(root, num); -#endif - - return NULL; -} - -EAPI Ecore_X_Randr_Crtc -ecore_x_randr_output_crtc_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); - - if (output == Ecore_X_Randr_None) return Ecore_X_Randr_None; - - if (_randr_version >= RANDR_1_3) - return _ecore_xcb_randr_13_output_crtc_get(root, output); - else if (_randr_version == RANDR_1_2) - return _ecore_xcb_randr_12_output_crtc_get(root, output); -#endif - - return Ecore_X_Randr_None; -} - -EAPI Eina_Bool -ecore_x_randr_output_crtc_set(Ecore_X_Window root EINA_UNUSED, Ecore_X_Randr_Output output EINA_UNUSED, const Ecore_X_Randr_Crtc crtc EINA_UNUSED) -{ - /* TODO */ - return EINA_FALSE; -} - -EAPI void -ecore_x_randr_output_size_mm_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *w_mm, int *h_mm) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - xcb_timestamp_t timestamp = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (w_mm) *w_mm = 0; - if (h_mm) *h_mm = 0; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - - if ((output != Ecore_X_Randr_None) && (_randr_version >= RANDR_1_3)) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - timestamp = reply->config_timestamp; - free(reply); - } - else if ((output != Ecore_X_Randr_None) && (_randr_version == RANDR_1_2)) - { - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - timestamp = reply->config_timestamp; - free(reply); - } - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - if (w_mm) *w_mm = oreply->mm_width; - if (h_mm) *h_mm = oreply->mm_height; - free(oreply); - } -#endif -} - -/** - * @brief Sets the demanded parameters for a given CRTC. Note that the CRTC is - * auto enabled in it's preferred mode, when it was disabled before. - * - * @param root The root window which's default display will be queried. - * @param crtc The CRTC which's configuration should be altered. - * @param outputs An array of outputs, that should display this CRTC's content. - * @param noutputs Number of outputs in the array of outputs. If set to - * Ecore_X_Randr_Unset, current outputs and number of outputs will be used. If - * set to Ecore_X_Randr_None, CRTC will be disabled. - * @param x New x coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current x - * coordinate will be assumed. - * @param y New y coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current y - * coordinate will be assumed. - * @param mode The new mode to be set. If Ecore_X_Randr_None is passed, the - * CRTC will be disabled. If Ecore_X_Randr_Unset is passed, the current mode is - * assumed. - * @param orientation The new orientation to be set. If Ecore_X_Randr_Unset is - * used, the current mode is assumed. - * @return @c EINA_TRUE if the configuration alteration was successful, - * @c EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_randr_crtc_settings_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Output *outputs, - int noutputs, - int x, - int y, - Ecore_X_Randr_Mode mode, - Ecore_X_Randr_Orientation orientation) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ccookie; - xcb_randr_get_crtc_info_reply_t *creply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ccookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - creply = - xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ccookie, NULL); - if (creply) - { - xcb_randr_set_crtc_config_cookie_t scookie; - xcb_randr_set_crtc_config_reply_t *sreply; - - if ((mode == Ecore_X_Randr_None) || - (noutputs == Ecore_X_Randr_None)) - { - outputs = NULL; - noutputs = 0; - } - else if (noutputs == (int)Ecore_X_Randr_Unset) - { - outputs = xcb_randr_get_crtc_info_outputs(creply); - noutputs = creply->num_outputs; - } - if ((int)mode == Ecore_X_Randr_Unset) mode = creply->mode; - if (x < 0) x = creply->x; - if (y < 0) y = creply->y; - if ((int)orientation == Ecore_X_Randr_Unset) - orientation = creply->rotation; - - scookie = - xcb_randr_set_crtc_config_unchecked(_ecore_xcb_conn, - crtc, XCB_CURRENT_TIME, stamp, - x, y, mode, orientation, - noutputs, outputs); - sreply = - xcb_randr_set_crtc_config_reply(_ecore_xcb_conn, scookie, NULL); - if (sreply) - { - ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? - EINA_TRUE : EINA_FALSE; - free(sreply); - } - free(creply); - } -#endif - - return ret; -} - -/** - * @brief Sets a mode for a CRTC and the outputs attached to it. - * - * @param root The window's screen to be queried - * @param crtc The CRTC which shall be set - * @param outputs Array of outputs which have to be compatible with the mode. If - * @c NULL CRTC will be disabled. - * @param noutputs Number of outputs in array to be used. Use - * Ecore_X_Randr_Unset (or @c -1) to use currently used outputs. - * @param mode XID of the mode to be set. If set to @c 0 the CRTC will be - * disabled. If set to @c -1 the call will fail. - * @return @c EINA_TRUE if mode setting was successful, @c EINA_FALSE - * otherwise. - */ -EAPI Eina_Bool -ecore_x_randr_crtc_mode_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Output *outputs, - int noutputs, - Ecore_X_Randr_Mode mode) -{ - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if ((int)mode == Ecore_X_Randr_Unset) return ret; - ret = - ecore_x_randr_crtc_settings_set(root, crtc, outputs, noutputs, - Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, - mode, Ecore_X_Randr_Unset); -#endif - - return ret; -} - -/** - * @brief Get the current set mode of a given CRTC - * @param root the window's screen to be queried - * @param crtc the CRTC which's should be queried - * @return currently set mode or - in case parameters are invalid - - * Ecore_X_Randr_Unset - */ -EAPI Ecore_X_Randr_Mode -ecore_x_randr_crtc_mode_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ - Ecore_X_Randr_Mode ret = Ecore_X_Randr_Unset; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_Unset); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - ret = oreply->mode; - free(oreply); - } -#endif - - return ret; -} - -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ - Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - ret = oreply->rotation; - free(oreply); - } -#endif - - return ret; -} - -EAPI Eina_Bool -ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Orientation orientation) -{ - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (orientation != Ecore_X_Randr_None) - { - ret = - ecore_x_randr_crtc_settings_set(root, crtc, NULL, - Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, - orientation); - } -#endif - return ret; -} - -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ - Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - oreply = - xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - ret = oreply->rotations; - free(oreply); - } -#endif - - return ret; -} - -/* - * @brief get a CRTC's possible outputs. - * @param root the root window which's screen will be queried - * @param num number of possible outputs referenced by given CRTC - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *num) -{ - Ecore_X_Randr_Output *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_possible_outputs; - ret = malloc(sizeof(Ecore_X_Randr_Output) * - oreply->num_possible_outputs); - if (ret) - { - memcpy(ret, xcb_randr_get_crtc_info_possible(oreply), - sizeof(Ecore_X_Randr_Output) * - oreply->num_possible_outputs); - } - free(oreply); - } -#endif - - return ret; -} - -/* - * @brief get all known CRTCs related to a root window's screen - * @param root window which's screen's ressources are queried - * @param num number of CRTCs returned - * @return CRTC IDs - */ -EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_crtcs_get(Ecore_X_Window root, - int *num) -{ - Ecore_X_Randr_Crtc *ret = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (_randr_version >= RANDR_1_3) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - if (num) *num = reply->num_crtcs; - ret = malloc(sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); - if (ret) - memcpy(ret, xcb_randr_get_screen_resources_current_crtcs(reply), - sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); - free(reply); - } - } - else if (_randr_version == RANDR_1_2) - { - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - if (num) *num = reply->num_crtcs; - ret = malloc(sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); - if (ret) - memcpy(ret, xcb_randr_get_screen_resources_crtcs(reply), - sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); - free(reply); - } - } -#endif - - return ret; -} - -/* - * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead. - * @brief Get the CRTCs, which display a certain window. - * - * @param window Window the displaying CRTCs shall be found for. - * @param num The number of CRTCs displaying the window. - * @return Array of CRTCs that display a certain window. @c NULL if no CRTCs - * was found that displays the specified window. - */ -EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_current_crtc_get(Ecore_X_Window window, - int *num) -{ - return ecore_x_randr_window_crtcs_get(window, num); -} - -/* - * @brief Get the CRTCs, which display a certain window. - * - * @param window Window the displaying crtcs shall be found for. - * @param num The number of crtcs displaying the window. - * @return Array of crtcs that display a certain window. @c NULL if no crtcs - * was found that displays the specified window. - * @since 1.2.0 - */ -EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_window_crtcs_get(Ecore_X_Window window, - int *num) -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Window root; - Eina_Rectangle w_geo, c_geo; - Ecore_X_Randr_Crtc *crtcs, *ret = NULL; - Ecore_X_Randr_Mode mode; - int ncrtcs, i, nret = 0; - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *trans; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h); - - root = ecore_x_window_root_get(window); - crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); - if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail; - - /* now get window RELATIVE to root window - thats what matters. */ - cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0); - trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - w_geo.x = trans->dst_x; - w_geo.y = trans->dst_y; - free(trans); - - ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc)); - if (!ret) - { - free(crtcs); - goto _ecore_x_randr_window_crtcs_get_fail; - } - for (i = 0, nret = 0; i < ncrtcs; i++) - { - /* if crtc is not enabled, don't bother about it any further */ - 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)) - { - ret[nret] = crtcs[i]; - nret++; - } - } - free(crtcs); - - if (num) *num = nret; - return ret; - -_ecore_x_randr_window_crtcs_get_fail: -#endif - if (num) *num = 0; - return NULL; -} - -/* - * @brief get a CRTC's outputs. - * @param root the root window which's screen will be queried - * @param num number of outputs referenced by given CRTC - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *num) -{ - Ecore_X_Randr_Output *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_outputs; - ret = malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_outputs); - if (ret) - memcpy(ret, xcb_randr_get_crtc_info_outputs(oreply), - sizeof(Ecore_X_Randr_Output) * oreply->num_outputs); - free(oreply); - } -#endif - - return ret; -} - -EAPI void -ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *x, - int *y, - int *w, - int *h) -{ -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); - oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - if (x) *x = oreply->x; - if (y) *y = oreply->y; - if (w) *w = oreply->width; - if (h) *h = oreply->height; - free(oreply); - } -#endif -} - -/** - * @brief Sets a CRTC relative to another one. - * - * @param root The window on which CRTC's position will be set. - * @param crtc_r1 The CRTC to be positioned. - * @param crtc_r2 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 @c EINA_TRUE if crtc could be successfully positioned, @c EINA_FALSE - * if repositioning failed or if position of new crtc would be out of given - * screen's min/max bounds. - */ -EAPI Eina_Bool -ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc_r1, - Ecore_X_Randr_Crtc crtc_r2, - Ecore_X_Randr_Output_Policy policy, - Ecore_X_Randr_Relative_Alignment alignment) -{ -#ifdef ECORE_XCB_RANDR - Eina_Rectangle r1, r2; - int w_max = 0, h_max = 0, cw = 0, ch = 0, xn = -1, yn = -1; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if ((ecore_x_randr_crtc_mode_get(root, crtc_r1) == 0) || - (ecore_x_randr_crtc_mode_get(root, crtc_r2) == 0)) - return EINA_FALSE; - - if ((!_ecore_xcb_randr_crtc_validate(root, crtc_r1) || - (!(crtc_r1 != crtc_r2) && (!_ecore_xcb_randr_crtc_validate(root, crtc_r2))))) - return EINA_FALSE; - - ecore_x_randr_crtc_geometry_get(root, crtc_r1, &r1.x, &r1.y, &r1.w, &r1.h); - ecore_x_randr_crtc_geometry_get(root, crtc_r2, &r2.x, &r2.y, &r2.w, &r2.h); - ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max); - ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); - - switch (policy) - { - case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT: - xn = (r2.x + r2.w); - if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) - yn = -1; - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) - yn = ((int)(((double)r2.h / 2.0) + (double)r2.y - ((double)r1.h / 2.0))); - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) - yn = ((int)((double)ch / 2.0) - ((double)r1.h / 2.0)); - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_LEFT: - xn = (r2.x - r1.w); - if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) - yn = -1; - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) - yn = ((int)(((double)r2.h / 2.0) + (double)r2.y - ((double)r1.h / 2.0))); - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) - yn = ((int)((double)ch / 2.0) - ((double)r1.h / 2.0)); - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_BELOW: - yn = (r2.y + r2.h); - if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) - xn = -1; - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) - xn = ((int)((((double)r2.x + (double)r2.w) / 2.0) - ((double)r1.w / 2.0))); - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) - xn = ((int)((double)cw / 2.0)); - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE: - yn = (r2.y - r1.h); - if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) - xn = -1; - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) - xn = ((int)((((double)r2.x + (double)r2.w) / 2.0) - ((double)r1.w / 2.0))); - else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) - xn = ((int)((double)cw / 2.0)); - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_CLONE: - return ecore_x_randr_crtc_pos_set(root, crtc_r1, r2.x, r2.y); - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_NONE: - break; - default: - return EINA_FALSE; - } - - if ((xn == r1.x) && (yn == r1.x)) return EINA_TRUE; - if (((yn + r1.h) > h_max) || ((xn + r1.w) > w_max)) - return EINA_FALSE; - - return ecore_x_randr_crtc_pos_set(root, crtc_r1, xn, yn); -#endif - - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, - const Ecore_X_Randr_Crtc *not_moved, - int num, - int dx, - int dy) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - Ecore_X_Randr_Crtc *crtcs = NULL, *move = NULL; - int i = 0, j = 0, k = 0, n = 0, total = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if ((num <= 0) || (!not_moved) || (!_ecore_xcb_randr_root_validate(root))) - return EINA_FALSE; - - crtcs = ecore_x_randr_crtcs_get(root, &total); - n = (total - num); - move = malloc(sizeof(Ecore_X_Randr_Crtc) * n); - if (move) - { - for (i = 0, k = 0; (i < total) && (k < n); i++) - { - for (j = 0; j < num; j++) - if (crtcs[i] == not_moved[j]) break; - if (j == num) - move[k++] = crtcs[i]; - } - ret = ecore_x_randr_move_crtcs(root, move, n, dx, dy); - free(move); - free(crtcs); - } -#endif - - return ret; -} - -EAPI void -ecore_x_randr_crtc_pos_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *x, - int *y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - - ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL); -#endif -} - -/* - * @brief Sets the position of given CRTC within root window's screen. - * - * @param root The window's screen to be queried. - * @param crtc The CRTC which's position within the mentioned screen is to be - * altered. - * @param x Position on the x-axis (0 == left) of the screen. if x < 0 current - * value will be kept. - * @param y Position on the y-ayis (0 == top) of the screen. if y < 0, current - * value will be kept. - * @return @c EINA_TRUE if position could be successfully be altered. - */ -EAPI Eina_Bool -ecore_x_randr_crtc_pos_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int x, - int y) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_RANDR - int w = 0, h = 0, nw = 0, nh = 0; - Eina_Rectangle rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - ecore_x_randr_crtc_geometry_get(root, crtc, - &rect.x, &rect.y, &rect.w, &rect.h); - ecore_x_randr_screen_current_size_get(root, &w, &h, NULL, NULL); - if (x < 0) x = rect.x; - if (y < 0) y = rect.y; - if ((x + rect.w) > w) - nw = (x + rect.w); - if ((y + rect.h) > h) - nh = (y + rect.h); - - if ((nw != 0) || (nh != 0)) - { - if (!ecore_x_randr_screen_current_size_set(root, nw, nh, 0, 0)) - return EINA_FALSE; - } - - ret = ecore_x_randr_crtc_settings_set(root, crtc, NULL, -1, x, y, -1, -1); -#endif - - return ret; -} - -EAPI Eina_Bool -ecore_x_randr_crtc_panning_area_set(Ecore_X_Window root EINA_UNUSED, Ecore_X_Randr_Crtc crtc, const int x, const int y, const int w, const int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_4_RET(EINA_FALSE); - - Eina_Bool ret = EINA_FALSE; - xcb_randr_get_panning_cookie_t get_cookie; - xcb_randr_get_panning_reply_t *get_reply; - - get_cookie = xcb_randr_get_panning_unchecked(_ecore_xcb_conn, crtc); - get_reply = xcb_randr_get_panning_reply(_ecore_xcb_conn, get_cookie, NULL); - if (get_reply) - { - xcb_randr_set_panning_cookie_t set_cookie; - xcb_randr_set_panning_reply_t *set_reply; - - set_cookie = - xcb_randr_set_panning_unchecked(_ecore_xcb_conn, crtc, - XCB_CURRENT_TIME, - x, y, w, h, - get_reply->track_left, - get_reply->track_top, - get_reply->track_width, - get_reply->track_height, - get_reply->border_left, - get_reply->border_top, - get_reply->border_right, - get_reply->border_bottom); - set_reply = - xcb_randr_set_panning_reply(_ecore_xcb_conn, set_cookie, NULL); - if (!set_reply) - ret = EINA_FALSE; - else - { - if (set_reply->status == XCB_RANDR_SET_CONFIG_SUCCESS) - ret = EINA_TRUE; - - free(set_reply); - } - - free(get_reply); - } - - return ret; -#endif - return EINA_FALSE; -} - -EAPI void -ecore_x_randr_crtc_size_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h); -#endif -} - -EAPI Eina_Bool -ecore_x_randr_crtc_clone_set(Ecore_X_Window root, Ecore_X_Randr_Crtc original, Ecore_X_Randr_Crtc cln) -{ - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (_randr_version >= RANDR_1_3) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - xcb_timestamp_t stamp = 0; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_crtc_info_cookie_t rcookie; - xcb_randr_get_crtc_info_reply_t *rreply; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - rcookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, original, - stamp); - - rreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, - rcookie, NULL); - if (rreply) - { - int ox = 0, oy = 0; - Ecore_X_Randr_Orientation orient = 0; - Ecore_X_Randr_Mode mode = -1; - - ox = rreply->x; - oy = rreply->y; - orient = rreply->rotation; - mode = rreply->mode; - - free(rreply); - - ret = ecore_x_randr_crtc_settings_set(root, cln, NULL, -1, - ox, oy, mode, orient); - } - - free(reply); - } - } -#endif - - return ret; -} - -EAPI Ecore_X_Randr_Crtc_Info * -ecore_x_randr_crtc_info_get(Ecore_X_Window root, const Ecore_X_Randr_Crtc crtc) -{ - Ecore_X_Randr_Crtc_Info *ret = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return NULL; - - if (_randr_version >= RANDR_1_3) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - xcb_timestamp_t stamp = 0; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_crtc_info_cookie_t rcookie; - xcb_randr_get_crtc_info_reply_t *rreply; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - rcookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, - stamp); - - rreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, - rcookie, NULL); - if (rreply) - { - if ((ret = malloc(sizeof(Ecore_X_Randr_Crtc_Info)))) - { - ret->timestamp = rreply->timestamp; - ret->x = rreply->x; - ret->y = rreply->y; - ret->width = rreply->width; - ret->height = rreply->height; - ret->mode = rreply->mode; - ret->rotation = rreply->rotation; - ret->noutput = - xcb_randr_get_crtc_info_outputs_length(rreply); - ret->npossible = - xcb_randr_get_crtc_info_possible_length(rreply); - - if ((ret->outputs = - malloc(ret->noutput * sizeof(Ecore_X_Randr_Output)))) - { - xcb_randr_output_t *outs; - int i = 0; - - outs = xcb_randr_get_crtc_info_outputs(rreply); - for (i = 0; i < ret->noutput; i++) - ret->outputs[i] = outs[i]; - } - - if ((ret->possible = - malloc(ret->npossible * sizeof(Ecore_X_Randr_Output)))) - { - xcb_randr_output_t *outs; - int i = 0; - - outs = xcb_randr_get_crtc_info_possible(rreply); - for (i = 0; i < ret->npossible; i++) - ret->possible[i] = outs[i]; - } - } - free(rreply); - } - - free(reply); - } - } -#endif - - return ret; -} - -EAPI void -ecore_x_randr_crtc_info_free(Ecore_X_Randr_Crtc_Info *info) -{ -#ifdef ECORE_XCB_RANDR - if (_randr_version >= RANDR_1_2) - { - if (info) - { - if (info->outputs) free(info->outputs); - if (info->possible) free(info->possible); - free(info); - } - } -#endif -} - -EAPI Ecore_X_Randr_Refresh_Rate -ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Mode mode) -{ - Ecore_X_Randr_Refresh_Rate ret = 0.0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(0.0); - - if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return 0.0; - - if (_randr_version >= RANDR_1_3) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_mode_info_iterator_t miter; - - miter = - xcb_randr_get_screen_resources_current_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - if (minfo->id == mode) - { - if ((minfo->htotal) && (minfo->vtotal)) - { - ret = ((double)minfo->dot_clock / - ((double)minfo->htotal * - (double)minfo->vtotal)); - } - break; - } - xcb_randr_mode_info_next(&miter); - } - free(reply); - } - } - else if (_randr_version == RANDR_1_2) - { - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_mode_info_iterator_t miter; - - miter = xcb_randr_get_screen_resources_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - if (minfo->id == mode) - { - if ((minfo->htotal) && (minfo->vtotal)) - { - ret = ((double)minfo->dot_clock / - ((double)minfo->htotal * - (double)minfo->vtotal)); - } - break; - } - xcb_randr_mode_info_next(&miter); - } - free(reply); - } - } -#endif - return ret; -} - -/* - * @brief Move given CRTCs belonging to the given root window's screen dx/dy - * pixels relative to their current position. The screen size will be - * automatically adjusted if necessary and possible. - * - * @param root Window which's screen's resources are used. - * @param crtcs List of CRTCs to be moved. - * @param ncrtc Number of CRTCs in array. - * @param dx Amount of pixels the CRTCs should be moved in x direction. - * @param dy Amount of pixels the CRTCs should be moved in y direction. - * @return @c EINA_TRUE if all crtcs could be moved successfully. - */ -EAPI Eina_Bool -ecore_x_randr_move_crtcs(Ecore_X_Window root, - const Ecore_X_Randr_Crtc *crtcs, - int num, - int dx, - int dy) -{ - Eina_Bool ret = EINA_TRUE; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_crtc_info_reply_t *oreply[num]; - int i = 0, cw = 0, ch = 0; - int mw = 0, mh = 0, nw = 0, nh = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (!_ecore_xcb_randr_root_validate(root)) return EINA_FALSE; - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - ecore_x_randr_screen_size_range_get(root, NULL, NULL, &mw, &mh); - ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); - nw = cw; - nh = ch; - - for (i = 0; i < num; i++) - { - xcb_randr_get_crtc_info_cookie_t ocookie; - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtcs[i], - stamp); - oreply[i] = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply[i]) - { - if (((oreply[i]->x + dx) < 0) || - ((oreply[i]->y + dy) < 0) || - ((oreply[i]->x + oreply[i]->width + dx) > mw) || - ((oreply[i]->y + oreply[i]->height + dy) > mh)) - { - continue; - } - nw = MAX((int)(oreply[i]->x + oreply[i]->width + dx), nw); - nh = MAX((int)(oreply[i]->y + oreply[i]->height + dy), nh); - } - } - - if ((nw > cw) || (nh > ch)) - { - if (!ecore_x_randr_screen_current_size_set(root, nw, nh, -1, -1)) - { - for (i = 0; i < num; i++) - if (oreply[i]) free(oreply[i]); - - return EINA_FALSE; - } - } - - for (i = 0; ((i < num) && (oreply[i])); i++) - { - if (!oreply[i]) continue; - if (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, -1, - (oreply[i]->x + dx), - (oreply[i]->y + dy), - oreply[i]->mode, - oreply[i]->rotation)) - { - ret = EINA_FALSE; - break; - } - } - - if (i < num) - { - while (i-- >= 0) - { - if (oreply[i]) - ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, -1, - (oreply[i]->x - dx), - (oreply[i]->y - dy), - oreply[i]->mode, - oreply[i]->rotation); - } - } - - for (i = 0; i < num; i++) - if (oreply[i]) free(oreply[i]); -#endif - - return ret; -} - -/** - * @brief enable event selection. This enables basic interaction with - * output/crtc events and requires RRandR >= 1.2. - * @param win select this window's properties for RandRR events - * @param on enable/disable selecting - */ -EAPI void -ecore_x_randr_events_select(Ecore_X_Window win, - Eina_Bool on) -{ -#ifdef ECORE_XCB_RANDR - uint16_t mask = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if (on) - { - mask = XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE; - if (_randr_version >= ((1 << 16) | 2)) - { - mask |= (XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE | - XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE | - XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY); - } - } - - xcb_randr_select_input(_ecore_xcb_conn, win, mask); -#endif -} - -/** - * @brief removes unused screen space. The most upper left CRTC is set to 0x0 - * and all other CRTCs dx,dy respectively. - * @param root the window's screen which will be reset. - */ -EAPI void -ecore_x_randr_screen_reset(Ecore_X_Window root) -{ -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - Ecore_X_Randr_Crtc *crtcs = NULL; - int total = 0, i = 0, w = 0, h = 0; - int dx = 100000, dy = 100000, num = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if (!_ecore_xcb_randr_root_validate(root)) return; - crtcs = ecore_x_randr_crtcs_get(root, &total); - - if (_randr_version >= RANDR_1_3) - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - else if (_randr_version == RANDR_1_2) - stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); - - /* I hate declaring variables inside code like this, but we need the - * value of 'total' before we can */ - Ecore_X_Randr_Crtc enabled[total]; - - for (i = 0; i < total; i++) - { - xcb_randr_get_crtc_info_cookie_t ocookie; - xcb_randr_get_crtc_info_reply_t *oreply; - - ocookie = - xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtcs[i], stamp); - oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (!oreply) continue; - if ((oreply->mode <= 0) || (oreply->num_outputs == 0)) - { - free(oreply); - continue; - } - - enabled[num++] = crtcs[i]; - if ((int)(oreply->x + oreply->width) > w) - w = (oreply->x + oreply->width); - if ((int)(oreply->y + oreply->height) > h) - h = (oreply->y + oreply->height); - - if (oreply->x < dx) dx = oreply->x; - if (oreply->y < dy) dy = oreply->y; - - free(oreply); - } - free(crtcs); - - if ((dx > 0) || (dy > 0)) - { - if (ecore_x_randr_move_crtcs(root, enabled, num, -dx, -dy)) - { - w -= dx; - h -= dy; - } - } - - ecore_x_randr_screen_current_size_set(root, w, h, -1, -1); -#endif -} - -/* - * @param root window which's screen will be queried - * @param wmin minimum width the screen can be set to - * @param hmin minimum height the screen can be set to - * @param wmax maximum width the screen can be set to - * @param hmax maximum height the screen can be set to - */ -EAPI void -ecore_x_randr_screen_size_range_get(Ecore_X_Window root, - int *minw, - int *minh, - int *maxw, - int *maxh) -{ -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_size_range_cookie_t cookie; - xcb_randr_get_screen_size_range_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - - cookie = xcb_randr_get_screen_size_range_unchecked(_ecore_xcb_conn, root); - reply = xcb_randr_get_screen_size_range_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if (minw) *minw = reply->min_width; - if (minh) *minh = reply->min_height; - if (maxw) *maxw = reply->max_width; - if (maxh) *maxh = reply->max_height; - free(reply); - } -#endif -} - -EAPI void -ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, double level) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - Ecore_X_Randr_Output *outputs; - int i = 0, ret = 0; - - RANDR_CHECK_1_3_RET(); - - outputs = _ecore_xcb_randr_13_outputs_get(root, &ret); - for (i = 0; i < ret; i++) - ecore_x_randr_output_backlight_level_set(root, outputs[i], level); -#endif -} - -/* - * @param w width of screen in px - * @param h height of screen in px - */ -EAPI void -ecore_x_randr_screen_current_size_get(Ecore_X_Window root, - int *w, - int *h, - int *w_mm, - int *h_mm) -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Randr_Screen scr = 0; - xcb_screen_t *s; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(); - - if (!RANDR_VALIDATE_ROOT(scr, root)) return; - - s = ecore_x_screen_get(scr); - if (w) *w = s->width_in_pixels; - if (h) *h = s->height_in_pixels; - if (w_mm) *w_mm = s->width_in_millimeters; - if (h_mm) *h_mm = s->height_in_millimeters; -#endif -} - -/* - * @param root Window which's screen's size should be set. If invalid (e.g. - * @c NULL) no action is taken. - * @param w Width in px the screen should be set to. If out of valid - * boundaries, current value is assumed. - * @param h Height in px the screen should be set to. If out of valid - * boundaries, current value is assumed. - * @param w_mm Width in mm the screen should be set to. If @c 0, current - * aspect is assumed. - * @param h_mm Height in mm the screen should be set to. If @c 0, current - * aspect is assumed. - * @return @c EINA_TRUE if request was successfully sent or screen is already - * in requested size, @c EINA_FALSE if parameters are invalid. - */ -EAPI Eina_Bool -ecore_x_randr_screen_current_size_set(Ecore_X_Window root, - int w, - int h, - int w_mm, - int h_mm) -{ - Eina_Bool ret = EINA_TRUE; -#ifdef ECORE_XCB_RANDR - Ecore_X_Randr_Screen scr; - int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0; - int mw = 0, mh = 0, xw = 0, xh = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (!RANDR_VALIDATE_ROOT(scr, root)) return EINA_FALSE; - ecore_x_randr_screen_current_size_get(root, &wc, &hc, &w_mm_c, &h_mm_c); - if ((w == wc) && (h == hc) && (w_mm == w_mm_c) && (h_mm == h_mm_c)) - return EINA_TRUE; - ecore_x_randr_screen_size_range_get(root, &mw, &mh, &xw, &xh); - if (((w != 1) && ((w < mw) || (w > xw))) || - ((h != -1) && ((h < mh) || (h > xh)))) return EINA_FALSE; - - if (w <= 0) - w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels; - if (h <= 0) - h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels; - - /* NB: Hmmmm, xlib version divides w_mm by width ... that seems wrong */ - if (w_mm <= 0) - w_mm = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_millimeters; - if (h_mm <= 0) - h_mm = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_millimeters; - - xcb_randr_set_screen_size(_ecore_xcb_conn, root, w, h, w_mm, h_mm); -#endif - - return ret; -} - -/* - * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead. - * @brief Get the outputs, which display a certain window. - * - * @param window Window the displaying outputs shall be found for. - * @param num The number of outputs displaying the window. - * @return Array of outputs that display a certain window. @c NULL if no - * outputs was found that displays the specified window. - */ - -Ecore_X_Randr_Output * -ecore_x_randr_current_output_get(Ecore_X_Window window, - int *num) -{ - return ecore_x_randr_window_outputs_get(window, num); -} - -/* - * @brief Get the outputs, which display a certain window. - * - * @param window Window the displaying outputs shall be found for. - * @param num The number of outputs displaying the window. - * @return Array of outputs that display a certain window. @c NULL if no - * outputs was found that displays the specified window. - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_window_outputs_get(Ecore_X_Window window, - int *num) -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Window root; - Ecore_X_Randr_Crtc *crtcs; - Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; - int ncrtcs, noutputs, i, nret = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num) *num = 0; - -#ifdef ECORE_XCB_RANDR - if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; - - root = ecore_x_window_root_get(window); - if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs))) - goto _ecore_x_randr_current_output_get_fail; - - for (i = 0, nret = 0; i < ncrtcs; i++) - { - - outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], - &noutputs); - if (outputs) - { - if (noutputs > 0) - { - tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output))); - if (!tret) goto _ecore_x_randr_current_output_get_fail_free; - ret = tret; - memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output))); - nret += noutputs; - } - free(outputs); - outputs = NULL; - } - } - free(crtcs); - - if (num) - *num = nret; - - return ret; - -_ecore_x_randr_current_output_get_fail_free: - free(outputs); - free(crtcs); - free(ret); -_ecore_x_randr_current_output_get_fail: -#endif - if (num) *num = 0; - return NULL; -} - -/* - * @brief get the backlight level of the given output - * @param root window which's screen should be queried - * @param output from which the backlight level should be retrieved - * @return the backlight level - */ -EAPI double -ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Atom _backlight; - xcb_intern_atom_cookie_t acookie; - xcb_intern_atom_reply_t *areply; - xcb_randr_get_output_property_cookie_t cookie; - xcb_randr_get_output_property_reply_t *reply; - xcb_randr_query_output_property_cookie_t qcookie; - xcb_randr_query_output_property_reply_t *qreply; - double dvalue; - long value, max, min; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(-1); - - acookie = - xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, - strlen("Backlight"), "Backlight"); - areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); - - if (!areply) - { - ERR("Backlight property is not suppported on this server or driver"); - return -1; - } - else - { - _backlight = areply->atom; - free(areply); - } - - if (!_ecore_xcb_randr_output_validate(root, output)) - { - ERR("Invalid output"); - return -1; - } - - cookie = - xcb_randr_get_output_property_unchecked(_ecore_xcb_conn, - output, _backlight, - XCB_ATOM_NONE, 0, 4, 0, 0); - reply = - xcb_randr_get_output_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) - { - WRN("Backlight not supported on this output"); - return -1; - } - - if ((reply->format != 32) || (reply->num_items != 1) || - (reply->type != XCB_ATOM_INTEGER)) - { - free(reply); - return -1; - } - - value = *((long *)xcb_randr_get_output_property_data(reply)); - free (reply); - - /* I have the current value of the backlight */ - /* Now retrieve the min and max intensities of the output */ - qcookie = - xcb_randr_query_output_property_unchecked(_ecore_xcb_conn, - output, _backlight); - qreply = - xcb_randr_query_output_property_reply(_ecore_xcb_conn, qcookie, NULL); - if (qreply) - { - dvalue = -1; - if ((qreply->range) && - (xcb_randr_query_output_property_valid_values_length(qreply) == 2)) - { - int32_t *vals; - - vals = xcb_randr_query_output_property_valid_values(qreply); - /* finally convert the current value in the interval [0..1] */ - min = vals[0]; - max = vals[1]; - dvalue = ((double)(value - min)) / ((double)(max - min)); - } - free(qreply); - return dvalue; - } -#endif - return -1; -} - -/* - * @brief Set the backlight level of a given output. - * - * @param root Window which's screen should be queried. - * @param output That should be set. - * @param level For which the backlight should be set. - * @return @c EINA_TRUE in case of success. - */ -EAPI Eina_Bool -ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, - Ecore_X_Randr_Output output, - double level) -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Atom _backlight; - xcb_intern_atom_cookie_t acookie; - xcb_intern_atom_reply_t *areply; - xcb_randr_query_output_property_cookie_t qcookie; - xcb_randr_query_output_property_reply_t *qreply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if ((level < 0) || (level > 1)) - { - ERR("Backlight level should be between 0 and 1"); - return EINA_FALSE; - } - - if (!_ecore_xcb_randr_output_validate(root, output)) - { - ERR("Wrong output value"); - return EINA_FALSE; - } - - acookie = - xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, - strlen("Backlight"), "Backlight"); - areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); - if (!areply) - { - WRN("Backlight property is not suppported on this server or driver"); - return EINA_FALSE; - } - else - { - _backlight = areply->atom; - free(areply); - } - - qcookie = - xcb_randr_query_output_property_unchecked(_ecore_xcb_conn, - output, _backlight); - qreply = - xcb_randr_query_output_property_reply(_ecore_xcb_conn, qcookie, NULL); - if (qreply) - { - if ((qreply->range) && (qreply->length == 2)) - { - int32_t *vals; - double min, max, tmp; - long n; - - vals = xcb_randr_query_output_property_valid_values(qreply); - min = vals[0]; - max = vals[1]; - tmp = (level * (max - min)) + min; - n = tmp; - if (n > max) n = max; - if (n < min) n = min; - xcb_randr_change_output_property(_ecore_xcb_conn, output, - _backlight, XCB_ATOM_INTEGER, - 32, XCB_PROP_MODE_REPLACE, - 1, (unsigned char *)&n); - ecore_x_flush(); // needed - } - - free(qreply); - return EINA_TRUE; - } -#endif - return EINA_FALSE; -} - -/* - * @brief Check if a backlight is available. - * - * @return Whether a backlight is available. - */ -EAPI Eina_Bool -ecore_x_randr_output_backlight_available(void) -{ -#ifdef ECORE_XCB_RANDR - 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 - { - free(areply); - return EINA_TRUE; - } -#endif - return EINA_FALSE; -} - -EAPI int -ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length) -{ - if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) | - edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR]; - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI char * -ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_length) -{ - unsigned char *block = NULL; - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; - - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc) - { - char *name, *p; - const char *edid_name; - - edid_name = (const char *)block + - _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; - name = - malloc(_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX + 1); - if (!name) return NULL; - - strncpy(name, edid_name, - _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); - name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; - for (p = name; *p; p++) - if ((*p < ' ') || (*p > '~')) *p = 0; - - return name; - } - } - return NULL; -} - -EAPI char * -ecore_x_randr_edid_display_ascii_get(unsigned char *edid, unsigned long edid_length) -{ -#ifdef ECORE_XCB_RANDR - unsigned char *block = NULL; - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; - - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe) - { - char *ascii = NULL, *p = NULL; - const char *edid_ascii; - - edid_ascii = (const char *)block + 5; - - if (!(ascii = malloc(14))) return NULL; - strncpy(ascii, edid_ascii, 13); - ascii[13] = 0; - for (p = ascii; *p; p++) - if ((*p < ' ') || (*p > '~')) *p = 0; - - return ascii; - } - } -#endif - return NULL; -} - -EAPI char * -ecore_x_randr_edid_display_serial_get(unsigned char *edid, unsigned long edid_length) -{ -#ifdef ECORE_XCB_RANDR - unsigned char *block = NULL; - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; - - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff) - { - char *serial = NULL, *p = NULL; - const char *edid_serial; - - edid_serial = (const char *)block + 5; - - if (!(serial = malloc(14))) return NULL; - strncpy(serial, edid_serial, 13); - serial[13] = 0; - for (p = serial; *p; p++) - if ((*p < ' ') || (*p > '~')) *p = 0; - - return serial; - } - } -#endif - return NULL; -} - -EAPI Ecore_X_Randr_Edid_Display_Interface_Type -ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, unsigned long edid_length) -{ -#ifdef ECORE_XCB_RANDR - Ecore_X_Randr_Edid_Display_Interface_Type type; - int version = 0; - - type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return type; - - type = (edid[0x14] & 0x0f); - if (type > ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT) - type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - - return type; -#endif - return 0; -} - -EAPI Eina_Bool -ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_length) -{ - const unsigned char header[] = - { - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 - }; - - if ((!edid) || (edid_length < 8)) return EINA_FALSE; - if (!memcmp(edid, header, 8)) return EINA_TRUE; - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - unsigned char *iter = NULL; - char sum = 0; - int i = 0, version = 0; - - if (edid_length < 128) return EINA_FALSE; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - - for (i = 0; i < 128; i++) - sum += edid[i]; - - if (sum) return EINA_FALSE; - - for (iter = edid; iter < (edid + edid_length); iter += 128) - { - if (iter[0] == 0x02) - { - for (i = 0, sum = 0; i < 128; i++) - sum += iter[i]; - } - } - - if (sum) return EINA_FALSE; - return EINA_TRUE; -#else - return EINA_FALSE; -#endif -} - -EAPI char * -ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if ((edid_length > _ECORE_X_RANDR_EDID_MANUFACTURER + 1) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - { - unsigned char *x; - char *name; - - name = malloc(sizeof(char) * 4); - if (!name) return NULL; - - x = (edid + _ECORE_X_RANDR_EDID_MANUFACTURER); - name[0] = ((x[0] & 0x7c) >> 2) + '@'; - name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xe0) >> 5) + '@'; - name[2] = (x[1] & 0x1f) + '@'; - name[3] = 0; - - return name; - } -#endif - return NULL; -} - -EAPI int -ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if ((edid_length > _ECORE_X_RANDR_EDID_MANUFACTURER + 1) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - return (int)(edid[0x0a] + (edid[0x0b] << 8)); -#endif - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI int -ecore_x_randr_edid_model_get(unsigned char *edid, unsigned long edid_length) -{ - return ecore_x_randr_edid_manufacturer_model_get(edid, edid_length); -} - -EAPI int -ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - if ((edid_length > _ECORE_X_RANDR_EDID_MANUFACTURER + 1) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - return (int)(edid[0x0c] + (edid[0x0d] << 8) + - (edid[0x0e] << 16) + (edid[0x0f] << 24)); -#endif - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_available_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - - return !!(edid[0x18] & 0xE0); -#else - return EINA_FALSE; -#endif -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - - if (edid[0x18] & 0xE0) return !!(edid[0x18] & 0x80); -#endif - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - - if (edid[0x18] & 0xE0) return !!(edid[0x18] & 0x40); -#endif - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, unsigned long edid_length) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - int version = 0; - - version = ecore_x_randr_edid_version_get(edid, edid_length); - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - - if (edid[0x18] & 0xE0) return !!(edid[0x18] & 0x20); -#endif - return EINA_FALSE; -} - -/* local functions */ -static Eina_Bool -_ecore_xcb_randr_output_validate(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if ((output) && (_ecore_xcb_randr_root_validate(root))) - { - if (_randr_version >= RANDR_1_3) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - int len = 0, i = 0; - xcb_randr_output_t *outputs; - - len = - xcb_randr_get_screen_resources_current_outputs_length(reply); - outputs = - xcb_randr_get_screen_resources_current_outputs(reply); - for (i = 0; i < len; i++) - { - if (outputs[i] == output) - { - ret = EINA_TRUE; - break; - } - } - free(reply); - } - } - else if (_randr_version == RANDR_1_2) - { - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - int len = 0, i = 0; - xcb_randr_output_t *outputs; - - len = xcb_randr_get_screen_resources_outputs_length(reply); - outputs = xcb_randr_get_screen_resources_outputs(reply); - for (i = 0; i < len; i++) - { - if (outputs[i] == output) - { - ret = EINA_TRUE; - break; - } - } - free(reply); - } - } - } -#endif - return ret; -} - -/** - * @brief Validates a CRTC for a given root window's screen. - * - * @param root The window which's default display will be queried. - * @param crtc The CRTC to be validated. - * @return In case it is found @c EINA_TRUE will be returned, else - * @c EINA_FALSE is returned. - */ -static Eina_Bool -_ecore_xcb_randr_crtc_validate(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (((int)crtc == Ecore_X_Randr_None) || ((int)crtc == Ecore_X_Randr_Unset)) - return ret; - - if ((crtc) && (_ecore_xcb_randr_root_validate(root))) - { - if (_randr_version >= RANDR_1_3) - { - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - int i = 0; - xcb_randr_crtc_t *crtcs; - - crtcs = xcb_randr_get_screen_resources_current_crtcs(reply); - for (i = 0; i < reply->num_crtcs; i++) - { - if (crtcs[i] == crtc) - { - ret = EINA_TRUE; - break; - } - } - free(reply); - } - } - else if (_randr_version == RANDR_1_2) - { - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - int i = 0; - xcb_randr_crtc_t *crtcs; - - crtcs = xcb_randr_get_screen_resources_crtcs(reply); - for (i = 0; i < reply->num_crtcs; i++) - { - if (crtcs[i] == crtc) - { - ret = EINA_TRUE; - break; - } - } - free(reply); - } - } - } -#endif - - return ret; -} - -static Ecore_X_Randr_Mode * -_ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num, - int *npreferred) -{ - Ecore_X_Randr_Mode *modes = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_modes; - if (npreferred) *npreferred = oreply->num_preferred; - - modes = malloc(sizeof(Ecore_X_Randr_Mode) * - oreply->num_modes); - if (modes) - { - xcb_randr_mode_t *rmodes; - int len = 0; - - len = xcb_randr_get_output_info_modes_length(oreply); - rmodes = xcb_randr_get_output_info_modes(oreply); - memcpy(modes, rmodes, sizeof(Ecore_X_Randr_Mode) * len); - } - free(oreply); - } - free(reply); - } -#endif - return modes; -} - -static Ecore_X_Randr_Mode * -_ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num, - int *npreferred) -{ - Ecore_X_Randr_Mode *modes = NULL; -#ifdef ECORE_XCB_RANDR - xcb_timestamp_t stamp = 0; - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, stamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_modes; - if (npreferred) *npreferred = oreply->num_preferred; - - modes = malloc(sizeof(Ecore_X_Randr_Mode) * oreply->num_modes); - if (modes) - { - xcb_randr_mode_t *rmodes; - int len = 0; - - len = xcb_randr_get_output_info_modes_length(oreply); - rmodes = xcb_randr_get_output_info_modes(oreply); - memcpy(modes, rmodes, sizeof(Ecore_X_Randr_Mode) * len); - } - free(oreply); - } -#endif - return modes; -} - -static Ecore_X_Randr_Mode_Info * -_ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode) -{ - Ecore_X_Randr_Mode_Info *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - if ((ret = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) - { - uint8_t *nbuf; - xcb_randr_mode_info_iterator_t miter; - - nbuf = xcb_randr_get_screen_resources_names(reply); - miter = xcb_randr_get_screen_resources_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - nbuf += minfo->name_len; - - if (minfo->id == mode) - { - ret->xid = minfo->id; - ret->width = minfo->width; - ret->height = minfo->height; - ret->dotClock = minfo->dot_clock; - ret->hSyncStart = minfo->hsync_start; - ret->hSyncEnd = minfo->hsync_end; - ret->hTotal = minfo->htotal; - ret->vSyncStart = minfo->vsync_start; - ret->vSyncEnd = minfo->vsync_end; - ret->vTotal = minfo->vtotal; - ret->modeFlags = minfo->mode_flags; - - ret->name = NULL; - ret->nameLength = minfo->name_len; - if (ret->nameLength > 0) - { - ret->name = malloc(ret->nameLength + 1); - if (ret->name) - memcpy(ret->name, nbuf, ret->nameLength + 1); - } - - break; - } - xcb_randr_mode_info_next(&miter); - } - } - - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Mode_Info * -_ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode) -{ - Ecore_X_Randr_Mode_Info *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - if ((ret = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) - { - uint8_t *nbuf; - xcb_randr_mode_info_iterator_t miter; - - nbuf = xcb_randr_get_screen_resources_current_names(reply); - miter = - xcb_randr_get_screen_resources_current_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - nbuf += minfo->name_len; - - if (minfo->id == mode) - { - ret->xid = minfo->id; - ret->width = minfo->width; - ret->height = minfo->height; - ret->dotClock = minfo->dot_clock; - ret->hSyncStart = minfo->hsync_start; - ret->hSyncEnd = minfo->hsync_end; - ret->hTotal = minfo->htotal; - ret->vSyncStart = minfo->vsync_start; - ret->vSyncEnd = minfo->vsync_end; - ret->vTotal = minfo->vtotal; - ret->modeFlags = minfo->mode_flags; - - ret->name = NULL; - ret->nameLength = minfo->name_len; - if (ret->nameLength > 0) - { - ret->name = malloc(ret->nameLength + 1); - if (ret->name) - memcpy(ret->name, nbuf, ret->nameLength + 1); - } - - break; - } - xcb_randr_mode_info_next(&miter); - } - } - - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Mode_Info ** -_ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root, - int *num) -{ - Ecore_X_Randr_Mode_Info **ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - if (num) *num = reply->num_modes; - ret = malloc(sizeof(Ecore_X_Randr_Mode_Info *) * reply->num_modes); - if (ret) - { - xcb_randr_mode_info_iterator_t miter; - int i = 0; - uint8_t *nbuf; - - nbuf = xcb_randr_get_screen_resources_names(reply); - miter = xcb_randr_get_screen_resources_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - nbuf += minfo->name_len; - if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) - { - ret[i]->xid = minfo->id; - ret[i]->width = minfo->width; - ret[i]->height = minfo->height; - ret[i]->dotClock = minfo->dot_clock; - ret[i]->hSyncStart = minfo->hsync_start; - ret[i]->hSyncEnd = minfo->hsync_end; - ret[i]->hTotal = minfo->htotal; - ret[i]->vSyncStart = minfo->vsync_start; - ret[i]->vSyncEnd = minfo->vsync_end; - ret[i]->vTotal = minfo->vtotal; - ret[i]->modeFlags = minfo->mode_flags; - - ret[i]->name = NULL; - ret[i]->nameLength = minfo->name_len; - if (ret[i]->nameLength > 0) - { - ret[i]->name = malloc(ret[i]->nameLength + 1); - if (ret[i]->name) - memcpy(ret[i]->name, nbuf, - ret[i]->nameLength + 1); - } - } - else - { - while (i > 0) - free(ret[--i]); - free(ret); - ret = NULL; - break; - } - i++; - xcb_randr_mode_info_next(&miter); - } - } - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Mode_Info ** -_ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root, - int *num) -{ - Ecore_X_Randr_Mode_Info **ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - if (num) *num = reply->num_modes; - ret = malloc(sizeof(Ecore_X_Randr_Mode_Info *) * reply->num_modes); - if (ret) - { - xcb_randr_mode_info_iterator_t miter; - int i = 0; - uint8_t *nbuf; - - nbuf = xcb_randr_get_screen_resources_current_names(reply); - miter = - xcb_randr_get_screen_resources_current_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - nbuf += minfo->name_len; - if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) - { - ret[i]->xid = minfo->id; - ret[i]->width = minfo->width; - ret[i]->height = minfo->height; - ret[i]->dotClock = minfo->dot_clock; - ret[i]->hSyncStart = minfo->hsync_start; - ret[i]->hSyncEnd = minfo->hsync_end; - ret[i]->hTotal = minfo->htotal; - ret[i]->vSyncStart = minfo->vsync_start; - ret[i]->vSyncEnd = minfo->vsync_end; - ret[i]->vTotal = minfo->vtotal; - ret[i]->modeFlags = minfo->mode_flags; - - ret[i]->name = NULL; - ret[i]->nameLength = minfo->name_len; - if (ret[i]->nameLength > 0) - { - ret[i]->name = malloc(ret[i]->nameLength + 1); - if (ret[i]->name) - memcpy(ret[i]->name, nbuf, - ret[i]->nameLength + 1); - } - } - else - { - while (i > 0) - free(ret[--i]); - free(ret); - ret = NULL; - break; - } - i++; - xcb_randr_mode_info_next(&miter); - } - } - free(reply); - } -#endif - return ret; -} - -static void -_ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h) -{ - if (w) *w = 0; - if (h) *h = 0; - -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_mode_info_iterator_t miter; - - miter = xcb_randr_get_screen_resources_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - if (minfo->id == mode) - { - if (w) *w = minfo->width; - if (h) *h = minfo->height; - break; - } - xcb_randr_mode_info_next(&miter); - } - free(reply); - } -#endif -} - -static void -_ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h) -{ - if (w) *w = 0; - if (h) *h = 0; - -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_mode_info_iterator_t miter; - - miter = xcb_randr_get_screen_resources_current_modes_iterator(reply); - while (miter.rem) - { - xcb_randr_mode_info_t *minfo; - - minfo = miter.data; - if (minfo->id == mode) - { - if (w) *w = minfo->width; - if (h) *h = minfo->height; - break; - } - xcb_randr_mode_info_next(&miter); - } - free(reply); - } -#endif -} - -static Ecore_X_Randr_Output * -_ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ - Ecore_X_Randr_Output *outputs = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_clones; - - outputs = - malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_clones); - if (outputs) - { - memcpy(outputs, xcb_randr_get_output_info_clones(oreply), - sizeof(Ecore_X_Randr_Output) * oreply->num_clones); - } - free(oreply); - } - free(reply); - } -#endif - return outputs; -} - -static Ecore_X_Randr_Output * -_ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ - Ecore_X_Randr_Output *outputs = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_clones; - - outputs = - malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_clones); - if (outputs) - { - memcpy(outputs, xcb_randr_get_output_info_clones(oreply), - sizeof(Ecore_X_Randr_Output) * oreply->num_clones); - } - free(oreply); - } - free(reply); - } -#endif - return outputs; -} - -static Ecore_X_Randr_Crtc * -_ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ - Ecore_X_Randr_Crtc *crtcs = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_crtcs; - - crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); - if (crtcs) - { - memcpy(crtcs, xcb_randr_get_output_info_crtcs(oreply), - sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); - } - free(oreply); - } - free(reply); - } -#endif - return crtcs; -} - -static Ecore_X_Randr_Crtc * -_ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ - Ecore_X_Randr_Crtc *crtcs = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - if (num) *num = oreply->num_crtcs; - - crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); - if (crtcs) - { - memcpy(crtcs, xcb_randr_get_output_info_crtcs(oreply), - sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); - } - free(oreply); - } - free(reply); - } -#endif - return crtcs; -} - -static char * -_ecore_xcb_randr_12_output_name_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *len) -{ - char *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - uint8_t *nbuf; - - nbuf = xcb_randr_get_output_info_name(oreply); - - if (len) *len = oreply->name_len; - if (oreply->name_len > 0) - { - ret = malloc(oreply->name_len + 1); - if (ret) - { - memcpy(ret, nbuf, oreply->name_len + 1); - ret[oreply->name_len] = '\0'; - } - } - - free(oreply); - } - free(reply); - } -#endif - return ret; -} - -static char * -_ecore_xcb_randr_13_output_name_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *len) -{ - char *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - uint8_t *nbuf; - - nbuf = xcb_randr_get_output_info_name(oreply); - - if (len) *len = oreply->name_len; - if (oreply->name_len > 0) - { - ret = malloc(oreply->name_len + 1); - if (ret) - { - memcpy(ret, nbuf, oreply->name_len + 1); - ret[oreply->name_len] = '\0'; - } - } - - free(oreply); - } - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Connection_Status -_ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - ret = oreply->connection; - free(oreply); - } - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Connection_Status -_ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - ret = oreply->connection; - free(oreply); - } - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Output * -_ecore_xcb_randr_12_outputs_get(Ecore_X_Window root, - int *num) -{ - Ecore_X_Randr_Output *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - if (num) *num = reply->num_outputs; - ret = malloc(sizeof(Ecore_X_Randr_Output) * reply->num_outputs); - if (ret) - memcpy(ret, xcb_randr_get_screen_resources_outputs(reply), - sizeof(Ecore_X_Randr_Output) * reply->num_outputs); - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Output * -_ecore_xcb_randr_13_outputs_get(Ecore_X_Window root, - int *num) -{ - Ecore_X_Randr_Output *ret = NULL; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - if (num) *num = reply->num_outputs; - ret = malloc(sizeof(Ecore_X_Randr_Output) * reply->num_outputs); - if (ret) - memcpy(ret, xcb_randr_get_screen_resources_current_outputs(reply), - sizeof(Ecore_X_Randr_Output) * reply->num_outputs); - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Crtc -_ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - ret = oreply->crtc; - free(oreply); - } - free(reply); - } -#endif - return ret; -} - -static Ecore_X_Randr_Crtc -_ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ - Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(root); - if (reply) - { - xcb_randr_get_output_info_cookie_t ocookie; - xcb_randr_get_output_info_reply_t *oreply; - - ocookie = - xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, - reply->config_timestamp); - oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, - ocookie, NULL); - if (oreply) - { - ret = oreply->crtc; - free(oreply); - } - free(reply); - } -#endif - return ret; -} - -static xcb_randr_get_screen_resources_reply_t * -_ecore_xcb_randr_12_get_resources(Ecore_X_Window win) -{ - xcb_randr_get_screen_resources_cookie_t cookie; - xcb_randr_get_screen_resources_reply_t *reply; - - cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, win); - reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL); - return reply; -} - -static xcb_randr_get_screen_resources_current_reply_t * -_ecore_xcb_randr_13_get_resources(Ecore_X_Window win) -{ - xcb_randr_get_screen_resources_current_cookie_t cookie; - xcb_randr_get_screen_resources_current_reply_t *reply; - - cookie = - xcb_randr_get_screen_resources_current_unchecked(_ecore_xcb_conn, win); - reply = - xcb_randr_get_screen_resources_current_reply(_ecore_xcb_conn, - cookie, NULL); - return reply; -} - -static xcb_timestamp_t -_ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win) -{ - xcb_timestamp_t stamp = 0; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_reply_t *reply; - - reply = _ecore_xcb_randr_12_get_resources(win); - stamp = reply->config_timestamp; - free(reply); -#endif - return stamp; -} - -static xcb_timestamp_t -_ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win) -{ - xcb_timestamp_t stamp = 0; -#ifdef ECORE_XCB_RANDR - xcb_randr_get_screen_resources_current_reply_t *reply; - - reply = _ecore_xcb_randr_13_get_resources(win); - stamp = reply->config_timestamp; - free(reply); -#endif - return stamp; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_region.c b/src/lib/ecore_x/xcb/ecore_xcb_region.c deleted file mode 100644 index a221d8f..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_region.c +++ /dev/null @@ -1,159 +0,0 @@ -#include "ecore_xcb_private.h" -#include - -/* - * [ ] XPolygonRegion - * [ ] XShrinkRegion - * [ ] XClipBox - * [ ] XXorRegion - */ - -EAPI Ecore_X_XRegion * -ecore_x_xregion_new() -{ - pixman_region16_t *region; - - region = (pixman_region16_t *)malloc(sizeof(pixman_region16_t)); - if (!region) return NULL; - - pixman_region_init(region); - - return (Ecore_X_XRegion *)region; -} - -EAPI void -ecore_x_xregion_free(Ecore_X_XRegion *region) -{ - if (!region) return; - - pixman_region_fini(region); - free(region); -} - -EAPI Eina_Bool -ecore_x_xregion_set(Ecore_X_XRegion *region, - Ecore_X_GC gc) -{ - xcb_rectangle_t *rects; - pixman_box16_t *boxes; - int num = 0, i = 0; - - CHECK_XCB_CONN; - - if (!region) return EINA_FALSE; - - boxes = pixman_region_rectangles((pixman_region16_t *)region, &num); - if ((!boxes) || (num == 0)) return EINA_FALSE; - - rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num); - if (!rects) return EINA_FALSE; - - for (i = 0; i < num; i++) - { - rects[i].x = boxes[i].x1; - rects[i].y = boxes[i].y1; - rects[i].width = boxes[i].x2 - boxes[i].x1 + 1; - rects[i].height = boxes[i].y2 - boxes[i].y1 + 1; - } - - xcb_set_clip_rectangles(_ecore_xcb_conn, XCB_CLIP_ORDERING_YX_BANDED, - gc, 0, 0, num, rects); - -// ecore_x_flush(); - return EINA_TRUE; -} - -EAPI void -ecore_x_xregion_translate(Ecore_X_XRegion *region, - int x, - int y) -{ - if (!region) return; - - pixman_region_translate((pixman_region16_t *)region, x, y); -} - -EAPI Eina_Bool -ecore_x_xregion_intersect(Ecore_X_XRegion *dst, - Ecore_X_XRegion *r1, - Ecore_X_XRegion *r2) -{ - return pixman_region_intersect((pixman_region16_t *)dst, - (pixman_region16_t *)r1, - (pixman_region16_t *)r2); -} - -EAPI Eina_Bool -ecore_x_xregion_union(Ecore_X_XRegion *dst, - Ecore_X_XRegion *r1, - Ecore_X_XRegion *r2) -{ - return pixman_region_union((pixman_region16_t *)dst, - (pixman_region16_t *)r1, - (pixman_region16_t *)r2); -} - -EAPI Eina_Bool -ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, - Ecore_X_XRegion *src, - Ecore_X_Rectangle *rect) -{ - return pixman_region_union_rect((pixman_region16_t *)dst, - (pixman_region16_t *)src, - rect->x, rect->y, rect->width, rect->height); -} - -EAPI Eina_Bool -ecore_x_xregion_subtract(Ecore_X_XRegion *dst, - Ecore_X_XRegion *rm, - Ecore_X_XRegion *rs) -{ - return pixman_region_subtract((pixman_region16_t *)dst, - (pixman_region16_t *)rm, - (pixman_region16_t *)rs); -} - -EAPI Eina_Bool -ecore_x_xregion_is_empty(Ecore_X_XRegion *region) -{ - if (!region) return EINA_TRUE; - - return !pixman_region_not_empty((pixman_region16_t *)region); -} - -EAPI Eina_Bool -ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, - Ecore_X_XRegion *r2) -{ - if ((!r1) || (!r2)) return EINA_FALSE; - - return pixman_region_equal((pixman_region16_t *)r1, - (pixman_region16_t *)r2); -} - -EAPI Eina_Bool -ecore_x_xregion_point_contain(Ecore_X_XRegion *region, - int x, - int y) -{ - if (!region) return EINA_FALSE; - - return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL); -} - -EAPI Eina_Bool -ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, - Ecore_X_Rectangle *rect) -{ - pixman_box16_t box; - - if ((!region) || (!rect)) return EINA_FALSE; - - box.x1 = rect->x; - box.y1 = rect->y; - box.x2 = rect->x + rect->width - 1; - box.y2 = rect->y + rect->height - 1; - - return pixman_region_contains_rectangle((pixman_region16_t *)region, &box); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_render.c b/src/lib/ecore_x/xcb/ecore_xcb_render.c deleted file mode 100644 index f36b4d2..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_render.c +++ /dev/null @@ -1,225 +0,0 @@ -#include "ecore_xcb_private.h" -#include // for isupper/tolower -#ifdef ECORE_XCB_RENDER -# include -# include -#endif - -/* local function prototypes */ -static Eina_Bool _ecore_xcb_render_parse_boolean(char *v); - -/* local variables */ -static Eina_Bool _render_avail = EINA_FALSE; -static Eina_Bool _render_argb = EINA_FALSE; -static Eina_Bool _render_anim = EINA_FALSE; - -void -_ecore_xcb_render_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_RENDER - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_render_id); -#endif -} - -void -_ecore_xcb_render_finalize(void) -{ -#ifdef ECORE_XCB_RENDER - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_RENDER - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_render_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_render_query_version_cookie_t cookie; - xcb_render_query_version_reply_t *reply; - - cookie = - xcb_render_query_version_unchecked(_ecore_xcb_conn, - XCB_RENDER_MAJOR_VERSION, - XCB_RENDER_MINOR_VERSION); - reply = xcb_render_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { -// if ((reply->major_version >= XCB_RENDER_MAJOR_VERSION) && - if (reply->minor_version >= XCB_RENDER_MINOR_VERSION) - { - char *v = NULL; - - _render_avail = EINA_TRUE; - _ecore_xcb_xdefaults_init(); - if ((reply->major_version > 0) || (reply->minor_version >= 5)) - { - _render_argb = EINA_TRUE; - v = getenv("XCURSOR_CORE"); - if (!v) - v = _ecore_xcb_xdefaults_string_get("Xcursor", "core"); - if ((v) && (_ecore_xcb_render_parse_boolean(v))) - _render_argb = EINA_FALSE; - } - if ((_render_argb) && - ((reply->major_version > 0) || (reply->minor_version >= 8))) - { - _render_anim = EINA_TRUE; - v = getenv("XCURSOR_ANIM"); - if (!v) - v = _ecore_xcb_xdefaults_string_get("Xcursor", "anim"); - if ((v) && (_ecore_xcb_render_parse_boolean(v))) - _render_anim = EINA_FALSE; - } - _ecore_xcb_xdefaults_shutdown(); - } - } - free(reply); - } -#endif -} - -Eina_Bool -_ecore_xcb_render_avail_get(void) -{ - return _render_avail; -} - -Eina_Bool -_ecore_xcb_render_argb_get(void) -{ - return _render_argb; -} - -Eina_Bool -_ecore_xcb_render_anim_get(void) -{ - return _render_anim; -} - -Eina_Bool -_ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef ECORE_XCB_RENDER - const xcb_render_query_pict_formats_reply_t *reply; - xcb_render_pictvisual_t *vis; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!visual) return EINA_FALSE; - if (!_render_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_RENDER - reply = xcb_render_util_query_formats(_ecore_xcb_conn); - if (!reply) return EINA_FALSE; - - vis = - xcb_render_util_find_visual_format(reply, - ((xcb_visualtype_t *)visual)->visual_id); - if (vis) - { - xcb_render_pictforminfo_t temp; - xcb_render_pictforminfo_t *format; - - temp.id = vis->format; - format = - xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, &temp, 0); - - if ((format->type == XCB_RENDER_PICT_TYPE_DIRECT) && - (format->direct.alpha_mask)) - ret = EINA_TRUE; - } - -#endif - - return ret; -} - -uint32_t -_ecore_xcb_render_find_visual_id(int type, - Eina_Bool check_alpha) -{ -#ifdef ECORE_XCB_RENDER - const xcb_render_query_pict_formats_reply_t *reply; - xcb_render_pictvisual_t *visual = NULL; - xcb_render_pictscreen_iterator_t screens; - xcb_render_pictdepth_iterator_t depths; - xcb_render_pictvisual_iterator_t visuals; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_render_avail) return 0; - -#ifdef ECORE_XCB_RENDER - reply = xcb_render_util_query_formats(_ecore_xcb_conn); - if (!reply) return 0; - - for (screens = xcb_render_query_pict_formats_screens_iterator(reply); - screens.rem; xcb_render_pictscreen_next(&screens)) - { - for (depths = xcb_render_pictscreen_depths_iterator(screens.data); - depths.rem; xcb_render_pictdepth_next(&depths)) - { - for (visuals = xcb_render_pictdepth_visuals_iterator(depths.data); - visuals.rem; xcb_render_pictvisual_next(&visuals)) - { - xcb_render_pictforminfo_t temp; - xcb_render_pictforminfo_t *format; - - visual = visuals.data; - temp.id = visual->format; - - format = - xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, - &temp, 0); - if (!format) continue; - if (format->type == type) - { - if (check_alpha) - { - if (format->direct.alpha_mask) - return visual->visual; - } - else - return visual->visual; - } - } - } - } -#endif - - return 0; -} - -/* local function prototypes */ -static Eina_Bool -_ecore_xcb_render_parse_boolean(char *v) -{ - char c; - - c = *v; - if (isupper((int)c)) - c = tolower(c); - if ((c == 't') || (c == 'y') || (c == '1')) - return EINA_TRUE; - if ((c == 'f') || (c == 'n') || (c == '0')) - return EINA_FALSE; - if (c == 'o') - { - char d; - - d = v[1]; - if (isupper((int)d)) - d = tolower(d); - if (d == 'n') return EINA_TRUE; - if (d == 'f') return EINA_FALSE; - } - return EINA_FALSE; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c b/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c deleted file mode 100644 index 2a6dadc..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c +++ /dev/null @@ -1,404 +0,0 @@ -#include "ecore_xcb_private.h" -# ifdef ECORE_XCB_SCREENSAVER -# include -# endif - -/* local variables */ -static Eina_Bool _screensaver_avail = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_screensaver = -1; - -void -_ecore_xcb_screensaver_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_SCREENSAVER - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_screensaver_id); -#endif -} - -void -_ecore_xcb_screensaver_finalize(void) -{ -#ifdef ECORE_XCB_SCREENSAVER - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_SCREENSAVER - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_screensaver_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_screensaver_query_version_cookie_t cookie; - xcb_screensaver_query_version_reply_t *reply; - - cookie = - xcb_screensaver_query_version_unchecked(_ecore_xcb_conn, - XCB_SCREENSAVER_MAJOR_VERSION, - XCB_SCREENSAVER_MINOR_VERSION); - reply = - xcb_screensaver_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if ((reply->server_major_version >= XCB_SCREENSAVER_MAJOR_VERSION) && - (reply->server_minor_version >= XCB_SCREENSAVER_MINOR_VERSION)) - _screensaver_avail = EINA_TRUE; - - free(reply); - } - - if (_screensaver_avail) - _ecore_xcb_event_screensaver = ext_reply->first_event; - } -#endif -} - -EAPI int -ecore_x_screensaver_idle_time_get(void) -{ - int ret = 0; -#ifdef ECORE_XCB_SCREENSAVER - xcb_screensaver_query_info_cookie_t cookie; - xcb_screensaver_query_info_reply_t *reply; - Ecore_X_Window root; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return 0; - -#ifdef ECORE_XCB_SCREENSAVER - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, root); - reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - ret = (reply->ms_until_server / 1000); - free(reply); -#endif - - return ret; -} - -EAPI void -ecore_x_screensaver_set(int timeout, - int interval, - int prefer_blanking, - int allow_exposures) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return; - -#ifdef ECORE_XCB_SCREENSAVER - xcb_set_screen_saver(_ecore_xcb_conn, - timeout, interval, prefer_blanking, allow_exposures); -#endif -} - -EAPI void -ecore_x_screensaver_timeout_set(int timeout) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; - uint16_t pint; - uint8_t pblank, pexpo; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - pint = reply->interval; - pblank = reply->prefer_blanking; - pexpo = reply->allow_exposures; - free(reply); - xcb_set_screen_saver(_ecore_xcb_conn, timeout, pint, pblank, pexpo); -#endif -} - -EAPI int -ecore_x_screensaver_timeout_get(void) -{ - int timeout = 0; -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return 0; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - timeout = reply->timeout; - free(reply); -#endif - - return timeout; -} - -EAPI void -ecore_x_screensaver_blank_set(int blank) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; - uint16_t pint, pto; - uint8_t pexpo; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - pto = reply->timeout; - pint = reply->interval; - pexpo = reply->allow_exposures; - free(reply); - xcb_set_screen_saver(_ecore_xcb_conn, pto, pint, blank, pexpo); -#endif -} - -EAPI int -ecore_x_screensaver_blank_get(void) -{ - int blank = 0; -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return 0; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - blank = reply->prefer_blanking; - free(reply); -#endif - - return blank; -} - -EAPI void -ecore_x_screensaver_expose_set(int expose) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; - uint16_t pint, pto; - uint8_t pblank; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - pto = reply->timeout; - pint = reply->interval; - pblank = reply->prefer_blanking; - free(reply); - xcb_set_screen_saver(_ecore_xcb_conn, pto, pint, pblank, expose); -#endif -} - -EAPI int -ecore_x_screensaver_expose_get(void) -{ - int expose = 0; -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return 0; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - expose = reply->allow_exposures; - free(reply); -#endif - - return expose; -} - -EAPI void -ecore_x_screensaver_interval_set(int interval) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; - uint16_t pto; - uint8_t pblank, pexpose; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - pto = reply->timeout; - pblank = reply->prefer_blanking; - pexpose = reply->allow_exposures; - free(reply); - xcb_set_screen_saver(_ecore_xcb_conn, pto, interval, pblank, pexpose); -#endif -} - -EAPI int -ecore_x_screensaver_interval_get(void) -{ - int interval = 0; -#ifdef ECORE_XCB_SCREENSAVER - xcb_get_screen_saver_cookie_t cookie; - xcb_get_screen_saver_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return 0; - -#ifdef ECORE_XCB_SCREENSAVER - cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); - reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - interval = reply->interval; - free(reply); -#endif - - return interval; -} - -EAPI void -ecore_x_screensaver_event_listen_set(Eina_Bool on) -{ -#ifdef ECORE_XCB_SCREENSAVER - Ecore_X_Window root; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_screensaver_avail) return; - -#ifdef ECORE_XCB_SCREENSAVER - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - if (on) - xcb_screensaver_select_input(_ecore_xcb_conn, root, - XCB_SCREENSAVER_EVENT_NOTIFY_MASK | - XCB_SCREENSAVER_EVENT_CYCLE_MASK); - else - xcb_screensaver_select_input(_ecore_xcb_conn, root, 0); -#endif -} - -EAPI Eina_Bool -ecore_x_screensaver_event_available_get(void) -{ - return _screensaver_avail; -} - -EAPI Eina_Bool -ecore_x_screensaver_custom_blanking_enable(void) -{ -#ifdef ECORE_XCB_SCREENSAVER - uint32_t mask_list[9]; - - xcb_screensaver_set_attributes_checked - (_ecore_xcb_conn, - ((xcb_screen_t *)_ecore_xcb_screen)->root, - -9999, -9999, 1, 1, 0, - XCB_WINDOW_CLASS_INPUT_ONLY, - XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT, - 0, mask_list); - return EINA_TRUE; -#else - return EINA_FALSE; -#endif -} - -EAPI Eina_Bool -ecore_x_screensaver_custom_blanking_disable(void) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_screensaver_unset_attributes_checked - (_ecore_xcb_conn, - ((xcb_screen_t *)_ecore_xcb_screen)->root); - return EINA_TRUE; -#else - return EINA_FALSE; -#endif -} - -EINA_DEPRECATED EAPI void -ecore_x_screensaver_supend(void) -{ - ecore_x_screensaver_suspend(); -} - -EAPI void -ecore_x_screensaver_suspend(void) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_screensaver_suspend(_ecore_xcb_conn, 1); -#endif -} - -EAPI void -ecore_x_screensaver_resume(void) -{ -#ifdef ECORE_XCB_SCREENSAVER - xcb_screensaver_suspend(_ecore_xcb_conn, 0); -#endif -} - -EAPI void -ecore_x_screensaver_reset(void) -{ - ecore_x_dpms_enabled_set(0); -} - -EAPI void -ecore_x_screensaver_activate(void) -{ - ecore_x_dpms_enabled_set(1); -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_selection.c b/src/lib/ecore_x/xcb/ecore_xcb_selection.c deleted file mode 100644 index c8922d0..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_selection.c +++ /dev/null @@ -1,1111 +0,0 @@ -#include "ecore_xcb_private.h" -//#include "Ecore_X_Atoms.h" - -#define ECORE_XCB_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) - -/* local function prototypes */ -static void *_ecore_xcb_selection_parser_text(const char *target EINA_UNUSED, - void *data, - int size, - int format EINA_UNUSED); -static void *_ecore_xcb_selection_parser_xmozurl(const char *target EINA_UNUSED, - void *data, - int size, - int format EINA_UNUSED); -static void *_ecore_xcb_selection_parser_files(const char *target, - void *data, - int size, - int format EINA_UNUSED); -static void *_ecore_xcb_selection_parser_targets(const char *target EINA_UNUSED, - void *data, - int size, - int format EINA_UNUSED); - -//static int _ecore_xcb_selection_data_free(void *data); -static int _ecore_xcb_selection_data_text_free(void *data); -static int _ecore_xcb_selection_data_targets_free(void *data); -static int _ecore_xcb_selection_data_files_free(void *data); -static int _ecore_xcb_selection_data_default_free(void *data); -static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win, - const void *data, - int size, - Ecore_X_Atom selection); -static void _ecore_xcb_selection_request(Ecore_X_Window win, - Ecore_X_Atom selection, - const char *target); -static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target); - -/* local variables */ -static Ecore_X_Selection_Intern _selections[4]; -static Ecore_X_Selection_Converter *_converters = NULL; -static Ecore_X_Selection_Parser *_parsers = NULL; - -/* local functions */ -void -_ecore_xcb_selection_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - memset(_selections, 0, sizeof(_selections)); - - /* init converters */ - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, - ecore_x_selection_converter_text); - 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_COMPOUND_TEXT, - ecore_x_selection_converter_text); - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, - ecore_x_selection_converter_text); - - /* init parsers */ - ecore_x_selection_parser_add("text/plain", - _ecore_xcb_selection_parser_text); - ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, - _ecore_xcb_selection_parser_text); - ecore_x_selection_parser_add("text/uri-list", - _ecore_xcb_selection_parser_files); - ecore_x_selection_parser_add("text/x-moz-url", - _ecore_xcb_selection_parser_xmozurl); - ecore_x_selection_parser_add("_NETSCAPE_URL", - _ecore_xcb_selection_parser_files); - ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, - _ecore_xcb_selection_parser_targets); -} - -void -_ecore_xcb_selection_shutdown(void) -{ - Ecore_X_Selection_Converter *cnv; - Ecore_X_Selection_Parser *prs; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - /* free selection converters */ - cnv = _converters; - while (cnv) - { - Ecore_X_Selection_Converter *tmp; - - tmp = cnv->next; - free(cnv); - cnv = tmp; - } - _converters = NULL; - - /* free parsers */ - prs = _parsers; - while (prs) - { - Ecore_X_Selection_Parser *tmp; - - tmp = prs; - prs = prs->next; - free(tmp->target); - free(tmp); - } - _parsers = NULL; -} - -/* public functions */ -EAPI void -ecore_x_selection_converter_atom_add(Ecore_X_Atom target, - Eina_Bool (*func)(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *type, - int *size_type)) -{ - Ecore_X_Selection_Converter *cnv; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - cnv = _converters; - if (_converters) - { - while (1) - { - if (cnv->target == target) - { - cnv->convert = func; - return; - } - if (cnv->next) - cnv = cnv->next; - else - break; - } - cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter)); - if (!cnv->next) return; - cnv = cnv->next; - } - else - { - _converters = calloc(1, sizeof(Ecore_X_Selection_Converter)); - if (!_converters) return; - cnv = _converters; - } - cnv->target = target; - cnv->convert = func; -} - -EAPI void -ecore_x_selection_converter_add(char *target, - Eina_Bool (*func)(char *target, - void *data, - int size, - void **date_ret, - int *size_ret, - Ecore_X_Atom *atom_ret, - int *ret)) -{ - Ecore_X_Atom atarget; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!func) || (!target)) return; - atarget = _ecore_xcb_selection_target_atom_get(target); - ecore_x_selection_converter_atom_add(atarget, func); -} - -EAPI void -ecore_x_selection_converter_del(char *target) -{ - Ecore_X_Atom atarget; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!target) return; - atarget = _ecore_xcb_selection_target_atom_get(target); - ecore_x_selection_converter_atom_del(atarget); -} - -EAPI void -ecore_x_selection_converter_atom_del(Ecore_X_Atom target) -{ - Ecore_X_Selection_Converter *conv, *pconv = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - conv = _converters; - while (conv) - { - if (conv->target == target) - { - if (pconv) - pconv->next = conv->next; - else - _converters = conv->next; - free(conv); - return; - } - pconv = conv; - conv = conv->next; - } -} - -EAPI void -ecore_x_selection_parser_add(const char *target, - void *(*func)(const char *target, void *data, int size, int format)) -{ - Ecore_X_Selection_Parser *prs; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!target) return; - prs = _parsers; - if (prs) - { - while (prs->next) - { - if (!strcmp(prs->target, target)) - { - prs->parse = func; - return; - } - prs = prs->next; - } - prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser)); - prs = prs->next; - } - else - { - _parsers = calloc(1, sizeof(Ecore_X_Selection_Parser)); - prs = _parsers; - } - prs->target = strdup(target); - prs->parse = func; -} - -EAPI void -ecore_x_selection_parser_del(const char *target) -{ - Ecore_X_Selection_Parser *prs, *pprs = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!target) return; - - prs = _parsers; - while (prs) - { - if (!strcmp(prs->target, target)) - { - if (pprs) - pprs->next = prs->next; - else - _parsers = prs->next; - free(prs->target); - free(prs); - return; - } - pprs = prs; - prs = prs->next; - } -} - -/** - * Claim ownership of the PRIMARY selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_primary_set(Ecore_X_Window win, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(win, data, size, - ECORE_X_ATOM_SELECTION_PRIMARY); -} - -/** - * Release ownership of the primary selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_primary_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, - ECORE_X_ATOM_SELECTION_PRIMARY); -} - -EAPI void -ecore_x_selection_primary_request(Ecore_X_Window win, - const char *target) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_PRIMARY, target); -} - -/** - * Claim ownership of the SECONDARY selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_secondary_set(Ecore_X_Window win, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(win, data, size, - ECORE_X_ATOM_SELECTION_SECONDARY); -} - -/** - * Release ownership of the secondary selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_secondary_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, - ECORE_X_ATOM_SELECTION_SECONDARY); -} - -EAPI void -ecore_x_selection_secondary_request(Ecore_X_Window win, - const char *target) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_SECONDARY, target); -} - -/** - * Claim ownership of the XDND selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_xdnd_set(Ecore_X_Window win, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(win, data, size, - ECORE_X_ATOM_SELECTION_XDND); -} - -/** - * Release ownership of the XDND selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_xdnd_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, - ECORE_X_ATOM_SELECTION_XDND); -} - -EAPI void -ecore_x_selection_xdnd_request(Ecore_X_Window win, - const char *target) -{ - Ecore_X_Atom atom; - Ecore_X_DND_Target *_target; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - _target = _ecore_xcb_dnd_target_get(); - atom = _ecore_xcb_selection_target_atom_get(target); - - xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND, - atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time); -} - -/** - * Claim ownership of the CLIPBOARD selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - * - * Get the converted data from a previous CLIPBOARD selection - * request. The buffer must be freed when done with. - */ -EAPI Eina_Bool -ecore_x_selection_clipboard_set(Ecore_X_Window win, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(win, data, size, - ECORE_X_ATOM_SELECTION_CLIPBOARD); -} - -/** - * Release ownership of the clipboard selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_clipboard_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, - ECORE_X_ATOM_SELECTION_CLIPBOARD); -} - -EAPI void -ecore_x_selection_clipboard_request(Ecore_X_Window win, - const char *target) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); -} - -EAPI Eina_Bool -ecore_x_selection_convert(Ecore_X_Atom selection, - Ecore_X_Atom target, - void **data_ret, - int *size, - Ecore_X_Atom *targtype, - int *typesize) -{ - Ecore_X_Selection_Intern *sel; - Ecore_X_Selection_Converter *cnv; - void *data = NULL; - char *tgt_str; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - sel = _ecore_xcb_selection_get(selection); - tgt_str = _ecore_xcb_selection_target_get(target); - - for (cnv = _converters; cnv; cnv = cnv->next) - { - if (cnv->target == target) - { - int r; - - r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, - targtype, typesize); - free(tgt_str); - if (r) - { - if (data_ret) *data_ret = data; - return r; - } - else - return EINA_FALSE; - } - } - free(tgt_str); - - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_selection_notify_send(Ecore_X_Window requestor, - Ecore_X_Atom selection, - Ecore_X_Atom target, - Ecore_X_Atom property, - Ecore_X_Time tim) -{ - xcb_selection_notify_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - memset(&ev, 0, sizeof(xcb_selection_notify_event_t)); - - ev.response_type = XCB_SELECTION_NOTIFY; - ev.requestor = requestor; - ev.selection = selection; - ev.target = target; - ev.property = property; - ev.time = tim; - - xcb_send_event(_ecore_xcb_conn, 0, requestor, - XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); -// ecore_x_flush(); - - return EINA_TRUE; -} - -EAPI void -ecore_x_selection_owner_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Time tim) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim); -} - -EAPI Ecore_X_Window -ecore_x_selection_owner_get(Ecore_X_Atom atom) -{ - xcb_get_selection_owner_cookie_t cookie; - xcb_get_selection_owner_reply_t *reply; - Ecore_X_Window ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_selection_owner(_ecore_xcb_conn, atom); - reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - ret = reply->owner; - free(reply); - return ret; -} - -void * -_ecore_xcb_selection_parse(const char *target, - void *data, - int size, - int format) -{ - Ecore_X_Selection_Parser *prs; - Ecore_X_Selection_Data *sel; - - for (prs = _parsers; prs; prs = prs->next) - { - if (!strcmp(prs->target, target)) - { - sel = prs->parse(target, data, size, format); - if (sel) return sel; - } - } - - sel = calloc(1, sizeof(Ecore_X_Selection_Data)); - if (!sel) return NULL; - sel->free = _ecore_xcb_selection_data_default_free; - sel->length = size; - sel->format = format; - sel->data = data; - - return sel; -} - -Ecore_X_Selection_Intern * -_ecore_xcb_selection_get(Ecore_X_Atom selection) -{ - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - return &_selections[0]; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - return &_selections[1]; - else if (selection == ECORE_X_ATOM_SELECTION_XDND) - return &_selections[2]; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - return &_selections[3]; - else - return NULL; -} - -/* local functions */ -static Eina_Bool -_ecore_xcb_selection_set(Ecore_X_Window win, - const void *data, - int size, - Ecore_X_Atom selection) -{ - xcb_get_selection_owner_cookie_t cookie; - xcb_get_selection_owner_reply_t *reply; - int in = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_set_selection_owner(_ecore_xcb_conn, win, selection, XCB_CURRENT_TIME); - - cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection); - reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - if (reply->owner != win) - { - free(reply); - return EINA_FALSE; - } - free(reply); - - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - in = 0; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - in = 1; - else if (selection == ECORE_X_ATOM_SELECTION_XDND) - in = 2; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - in = 3; - else - return EINA_FALSE; - - if (_selections[in].data) - { - free(_selections[in].data); - memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Intern)); - } - - if (data) - { - unsigned char *buff = NULL; - - _selections[in].win = win; - _selections[in].selection = selection; - _selections[in].length = size; - _selections[in].time = _ecore_xcb_events_last_time_get(); - - buff = malloc(size); - if (!buff) return EINA_FALSE; - memcpy(buff, data, size); - _selections[in].data = buff; - } - - return EINA_TRUE; -} - -static void -_ecore_xcb_selection_request(Ecore_X_Window win, - Ecore_X_Atom selection, - const char *target) -{ - Ecore_X_Atom atarget, prop; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD; - else - return; - - atarget = _ecore_xcb_selection_target_atom_get(target); - - xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop, - XCB_CURRENT_TIME); -} - -EAPI Eina_Bool -ecore_x_selection_converter_text(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *type EINA_UNUSED, - int *size_type EINA_UNUSED) -{ - Ecore_Xcb_Encoding_Style style; - Ecore_Xcb_Textproperty ret; - char *str; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!data) || (!size)) return EINA_FALSE; - - if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) - style = XcbTextStyle; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) - style = XcbCompoundTextStyle; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) - style = XcbStringStyle; -#ifdef HAVE_ICONV - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) - style = XcbUTF8StringStyle; -#endif - else - return EINA_FALSE; - - str = alloca(size + 1); - memcpy(str, data, size); - str[size] = '\0'; - -#ifdef HAVE_ICONV - if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret)) - { - int size = 0; - - size = (strlen((char *)ret.value)); - *data_ret = malloc(size); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, ret.value, size); - *size_ret = size; - if (ret.value) free(ret.value); - return EINA_TRUE; - } -#else - if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret)) - { - int size = 0; - - size = (strlen((char *)ret.value)); - *data_ret = malloc(size); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, ret.value, size); - *size_ret = size; - if (ret.value) free(ret.value); - return EINA_TRUE; - } -#endif - else - return EINA_TRUE; -} - -static void * -_ecore_xcb_selection_parser_text(const char *target EINA_UNUSED, - void *data, - int size, - int format EINA_UNUSED) -{ - Ecore_X_Selection_Data_Text *sel; - unsigned char *_data; - void *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(_data = data)) return NULL; - - sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text)); - if (!sel) return NULL; - - if (_data && _data[size - 1]) - { - size++; - t = realloc(_data, size); - if (!t) - { - free(sel); - return NULL; - } - _data = t; - _data[size - 1] = 0; - } - sel->text = (char *)_data; - ECORE_XCB_SELECTION_DATA(sel)->length = size; - ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT; - ECORE_XCB_SELECTION_DATA(sel)->data = _data; - ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_text_free; - return sel; -} - -static int -_ecore_xcb_selection_data_xmozurl_free(void *data) -{ - Ecore_X_Selection_Data_X_Moz_Url *sel = data; - char **buf; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!sel) return 0; - - buf = eina_inarray_nth(sel->links, 0); - free(*buf); - eina_inarray_free(sel->links); - eina_inarray_free(sel->link_names); - free(sel); - return 1; -} - -static void * -_ecore_xcb_selection_parser_xmozurl(const char *target EINA_UNUSED, - void *_data, - int size, - int format EINA_UNUSED) -{ - Ecore_X_Selection_Data_X_Moz_Url *sel; - char *prev, *n, *buf, *data = _data; - size_t sz; - int num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - buf = eina_str_convert_len("UTF-16LE", "UTF-8", data, size, &sz); - if (!buf) return NULL; - sel = calloc(1, sizeof(Ecore_X_Selection_Data_X_Moz_Url)); - if (!sel) - goto error_sel; - - sel->links = eina_inarray_new(sizeof(char*), 0); - if (!sel->links) - goto error_links; - - sel->link_names = eina_inarray_new(sizeof(char*), 0); - if (!sel->link_names) - goto error_link_names; - prev = buf; - for (n = memchr(buf, '\n', sz); n; n = memchr(prev, '\n', sz - (prev - buf))) - { - n[0] = 0; - if (num % 2 == 0) - eina_inarray_push(sel->links, &prev); - else - eina_inarray_push(sel->link_names, &prev); - num++; - prev = n + 1; - } - eina_inarray_push(sel->link_names, &prev[0]); - - ECORE_XCB_SELECTION_DATA(sel)->length = size; - ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_X_MOZ_URL; - ECORE_XCB_SELECTION_DATA(sel)->data = (void*)data; - ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_xmozurl_free; - return sel; - -error_link_names: - eina_inarray_free(sel->links); - -error_links: - free(sel); - -error_sel: - free(buf); - return NULL; -} - -static void * -_ecore_xcb_selection_parser_files(const char *target, - void *data, - int size, - int format EINA_UNUSED) -{ - Ecore_X_Selection_Data_Files *sel; - char *_data, *tmp, *t, **t2; - int i = 0, is = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((strcmp(target, "text/uri-list")) && - (strcmp(target, "_NETSCAPE_URL"))) return NULL; - - if (!(_data = data)) return NULL; - - sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files)); - if (!sel) return NULL; - - ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free; - - if (_data && _data[size - 1]) - { - size++; - t = realloc(_data, size); - if (!t) - { - free(sel); - return NULL; - } - _data = t; - _data[size - 1] = 0; - } - - tmp = malloc(size); - if (!tmp) - { - free(sel); - return NULL; - } - - while ((is < size) && (_data[is])) - { - if ((i == 0) && (_data[is] == '#')) - { - for (; ((_data[is]) && (_data[is] != '\n')); is++) ; - } - else - { - if ((_data[is] != '\r') && (_data[is] != '\n')) - tmp[i++] = _data[is++]; - else - { - while ((_data[is] == '\r') || (_data[is] == '\n')) - is++; - tmp[i] = 0; - sel->num_files++; - t2 = realloc(sel->files, sel->num_files * sizeof(char *)); - if (t2) - { - sel->files = t2; - sel->files[sel->num_files - 1] = strdup(tmp); - } - tmp[0] = 0; - i = 0; - } - } - } - if (i > 0) - { - tmp[i] = 0; - sel->num_files++; - t2 = realloc(sel->files, sel->num_files * sizeof(char *)); - if (t2) - { - sel->files = t2; - sel->files[sel->num_files - 1] = strdup(tmp); - } - } - if (tmp) free(tmp); - if (_data) free(_data); - - ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES; - ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files; - - return ECORE_XCB_SELECTION_DATA(sel); -} - -static void * -_ecore_xcb_selection_parser_targets(const char *target EINA_UNUSED, - void *data, - int size, - int format EINA_UNUSED) -{ - Ecore_X_Selection_Data_Targets *sel; - int *targets; - int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!(targets = data)) return NULL; - - sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets)); - if (!sel) return NULL; - - sel->num_targets = (size - 2); - sel->targets = malloc((size - 2) * sizeof(char *)); - if (!sel->targets) - { - free(sel); - return NULL; - } - - for (i = 2; i < size; i++) - { - xcb_get_atom_name_cookie_t cookie; - xcb_get_atom_name_reply_t *reply; - char *name = NULL; - int len = 0; - - cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]); - reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - len = xcb_get_atom_name_name_length(reply); - name = (char *)malloc(sizeof(char) * (len + 1)); - if (name) - { - memcpy(name, xcb_get_atom_name_name(reply), len); - name[len] = '\0'; - sel->targets[i - 2] = name; - } - free(reply); - } - } - - ECORE_XCB_SELECTION_DATA(sel)->free = - _ecore_xcb_selection_data_targets_free; - ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS; - ECORE_XCB_SELECTION_DATA(sel)->length = size; - ECORE_XCB_SELECTION_DATA(sel)->data = data; - - return sel; -} - -/* - static int - _ecore_xcb_selection_data_free(void *data) - { - Ecore_X_Selection_Data *sel; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(sel = data)) return 0; - if (sel->data) free(sel->data); - free(sel); - return 1; - } - */ - -static int -_ecore_xcb_selection_data_text_free(void *data) -{ - Ecore_X_Selection_Data_Text *sel; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(sel = data)) return 0; - if (sel->text) free(sel->text); - free(sel); - return 1; -} - -static int -_ecore_xcb_selection_data_targets_free(void *data) -{ - Ecore_X_Selection_Data_Targets *sel; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(sel = data)) return 0; - if (sel->targets) free(sel->targets); - free(ECORE_XCB_SELECTION_DATA(sel)->data); - free(sel); - return 1; -} - -static int -_ecore_xcb_selection_data_files_free(void *data) -{ - Ecore_X_Selection_Data_Files *sel; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(sel = data)) return 0; - if (sel->files) - { - int i = 0; - - for (i = 0; i < sel->num_files; i++) - if (sel->files[i]) free(sel->files[i]); - if (sel->files) free(sel->files); - } - free(sel); - return 0; -} - -static int -_ecore_xcb_selection_data_default_free(void *data) -{ - Ecore_X_Selection_Data *sel; - - if (!(sel = data)) return 1; - free(sel->data); - free(sel); - return 1; -} - -static Ecore_X_Atom -_ecore_xcb_selection_target_atom_get(const char *target) -{ - Ecore_X_Atom x_target; - - if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) - x_target = ECORE_X_ATOM_TEXT; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) - x_target = ECORE_X_ATOM_COMPOUND_TEXT; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) - x_target = ECORE_X_ATOM_STRING; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) - x_target = ECORE_X_ATOM_UTF8_STRING; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME)) - x_target = ECORE_X_ATOM_FILE_NAME; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_X_MOZ_URL)) - x_target = ECORE_X_ATOM_X_MOZ_URL; - else - x_target = ecore_x_atom_get(target); - - return x_target; -} - -char * -_ecore_xcb_selection_target_get(Ecore_X_Atom target) -{ - if (target == ECORE_X_ATOM_FILE_NAME) - return strdup(ECORE_X_SELECTION_TARGET_FILENAME); - else if (target == ECORE_X_ATOM_STRING) - return strdup(ECORE_X_SELECTION_TARGET_STRING); - else if (target == ECORE_X_ATOM_UTF8_STRING) - return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); - else if (target == ECORE_X_ATOM_TEXT) - return strdup(ECORE_X_SELECTION_TARGET_TEXT); - else if (target == ECORE_X_ATOM_X_MOZ_URL) - return strdup(ECORE_X_SELECTION_TARGET_X_MOZ_URL); - else - return ecore_x_atom_name_get(target); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_shape.c b/src/lib/ecore_x/xcb/ecore_xcb_shape.c deleted file mode 100644 index 913f199..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_shape.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_SHAPE -# include -#endif - -/* external variables */ -int _ecore_xcb_event_shape = -1; - -void -_ecore_xcb_shape_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_SHAPE - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shape_id); -#endif -} - -void -_ecore_xcb_shape_finalize(void) -{ -#ifdef ECORE_XCB_SHAPE - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_SHAPE - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_shape_query_version_cookie_t cookie; - xcb_shape_query_version_reply_t *reply; - Eina_Bool _shape_avail; - - _shape_avail = EINA_FALSE; - cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn); - reply = xcb_shape_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - _shape_avail = EINA_TRUE; - free(reply); - } - - if (_shape_avail) - _ecore_xcb_event_shape = ext_reply->first_event; - } -#endif -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_sync.c b/src/lib/ecore_x/xcb/ecore_xcb_sync.c deleted file mode 100644 index 75f4e4f..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_sync.c +++ /dev/null @@ -1,338 +0,0 @@ -#include "ecore_xcb_private.h" -# ifdef ECORE_XCB_SYNC -# include -# endif - -/* local variables */ -static Eina_Bool _sync_avail = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_sync = -1; - -void -_ecore_xcb_sync_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_SYNC - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_sync_id); -#endif -} - -void -_ecore_xcb_sync_finalize(void) -{ -#ifdef ECORE_XCB_SYNC - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_SYNC - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_sync_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_sync_initialize_cookie_t cookie; - xcb_sync_initialize_reply_t *reply; - - cookie = - xcb_sync_initialize_unchecked(_ecore_xcb_conn, - XCB_SYNC_MAJOR_VERSION, - XCB_SYNC_MINOR_VERSION); - reply = xcb_sync_initialize_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if (reply->major_version >= 3) _sync_avail = EINA_TRUE; - free(reply); - } - - if (_sync_avail) - _ecore_xcb_event_sync = ext_reply->first_event; - } -#endif -} - -void -_ecore_xcb_sync_magic_send(int val, - Ecore_X_Window win) -{ - xcb_client_message_event_t ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - memset(&ev, 0, sizeof(xcb_client_message_event_t)); - ev.response_type = XCB_CLIENT_MESSAGE; - ev.format = 32; - ev.window = win; - ev.type = 27777; - ev.data.data32[0] = 0x7162534; - ev.data.data32[1] = (0x10000000 + val); - ev.data.data32[2] = win; - - xcb_send_event(_ecore_xcb_conn, 0, win, XCB_EVENT_MASK_NO_EVENT, - (const char *)&ev); -// ecore_x_flush(); -} - -/* public functions */ -EAPI Ecore_X_Sync_Alarm -ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter) -{ -#ifdef ECORE_XCB_SYNC - uint32_t list[6], mask; - xcb_sync_int64_t init; - Ecore_X_Sync_Alarm alarm; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return 0; - -#ifdef ECORE_XCB_SYNC - init.lo = 0; - init.hi = 0; - xcb_sync_set_counter(_ecore_xcb_conn, counter, init); - - mask = (XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE | - XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE | - XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS); - list[0] = counter; - list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE; - list[2] = 1; - list[3] = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON; - list[4] = 1; - list[5] = 1; - alarm = xcb_generate_id(_ecore_xcb_conn); - - xcb_sync_create_alarm(_ecore_xcb_conn, alarm, mask, list); - ecore_x_sync(); // needed - - return alarm; -#endif - return 0; -} - -EAPI Eina_Bool -ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!alarm)) return EINA_FALSE; - -#ifdef ECORE_XCB_SYNC - xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm); -// ecore_x_flush(); - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, - unsigned int *val) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_query_counter_cookie_t cookie; - xcb_sync_query_counter_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return EINA_FALSE; - -#ifdef ECORE_XCB_SYNC - cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter); - reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if (val) *val = (unsigned int)reply->counter_value.lo; - free(reply); - return EINA_TRUE; - } -#endif - return EINA_FALSE; -} - -EAPI void -ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, - int by) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_int64_t v; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return; - -#ifdef ECORE_XCB_SYNC - v.hi = (by < 0) ? ~0 : 0; - v.lo = by; - - xcb_sync_change_counter(_ecore_xcb_conn, counter, v); -// ecore_x_flush(); -#endif -} - -EAPI void -ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, - int val) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_query_counter_cookie_t cookie; - xcb_sync_query_counter_reply_t *reply; - xcb_sync_int64_t v1, v2; - xcb_sync_waitcondition_t cond; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return; - -#ifdef ECORE_XCB_SYNC - cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter); - reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - v1 = reply->counter_value; - free(reply); - - v1.hi = (val < 0) ? ~0 : 0; - v1.lo = val; - v2.hi = ((val + 1) < 0) ? ~0 : 0; - v2.lo = (val + 1); - - cond.trigger.counter = counter; - cond.trigger.wait_type = XCB_SYNC_VALUETYPE_ABSOLUTE; - cond.trigger.wait_value = v1; - cond.trigger.test_type = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON; - cond.event_threshold = v2; - - xcb_sync_await(_ecore_xcb_conn, 1, &cond); -// ecore_x_flush(); -#endif -} - -EAPI Ecore_X_Sync_Counter -ecore_x_sync_counter_new(int val) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_counter_t counter; - xcb_sync_int64_t v; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_sync_avail) return 0; - -#ifdef ECORE_XCB_SYNC - v.hi = (val < 0) ? ~0 : 0; - v.lo = val; - - counter = xcb_generate_id(_ecore_xcb_conn); - xcb_sync_create_counter(_ecore_xcb_conn, counter, v); -// ecore_x_flush(); - - return counter; -#endif - - return 0; -} - -EAPI void -ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return; - -#ifdef ECORE_XCB_SYNC - xcb_sync_destroy_counter(_ecore_xcb_conn, counter); -// ecore_x_flush(); -#endif -} - -EAPI void -ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, - int val) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_int64_t v; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return; - -#ifdef ECORE_XCB_SYNC - v.hi = (val < 0) ? ~0 : 0; - v.lo = val; - - xcb_sync_set_counter(_ecore_xcb_conn, counter, v); -// ecore_x_flush(); -#endif -} - -EAPI void -ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, - int val_hi, - unsigned int val_lo) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_int64_t v; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return; - -#ifdef ECORE_XCB_SYNC - v.hi = val_hi; - v.lo = val_lo; - - xcb_sync_set_counter(_ecore_xcb_conn, counter, v); -// ecore_x_flush(); -#endif -} - -EAPI Eina_Bool -ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, - int *val_hi, - unsigned int *val_lo) -{ -#ifdef ECORE_XCB_SYNC - xcb_sync_query_counter_cookie_t cookie; - xcb_sync_query_counter_reply_t *reply; - xcb_sync_int64_t value; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if ((!_sync_avail) || (!counter)) return EINA_FALSE; - -#ifdef ECORE_XCB_SYNC - cookie = - xcb_sync_query_counter_unchecked(_ecore_xcb_conn, - (xcb_sync_counter_t)counter); - reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - value = reply->counter_value; - free(reply); - if (val_hi) *val_hi = (int)value.hi; - if (val_lo) *val_lo = (unsigned int)value.lo; - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_textlist.c b/src/lib/ecore_x/xcb/ecore_xcb_textlist.c deleted file mode 100644 index 2a5c854..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_textlist.c +++ /dev/null @@ -1,509 +0,0 @@ -#include "ecore_xcb_private.h" -//#include "Ecore_X_Atoms.h" -#include -#ifdef HAVE_ICONV -# include -#endif -#ifndef CODESET -# define CODESET "INVALID" -#endif - -static int _ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, - void *list, - int count); -static int _ecore_xcb_textlist_get_wc_len(wchar_t *wstr); -static void *_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, - int count, - int nitems); -static void _ecore_xcb_textlist_copy_list(Eina_Bool is_wide, - void *text, - char **list, - int count); -static wchar_t *_ecore_xcb_textlist_copy_wchar(wchar_t *str1, - wchar_t *str2); -static int _ecore_xcb_textlist_len_wchar(wchar_t *str); - -#ifdef HAVE_ICONV -Eina_Bool -_ecore_xcb_utf8_textlist_to_textproperty(char **list, - int count, - Ecore_Xcb_Encoding_Style style, - Ecore_Xcb_Textproperty *ret) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_textlist_to_textproperty("utf8string", list, count, - style, ret); -} - -#endif - -Eina_Bool -_ecore_xcb_mb_textlist_to_textproperty(char **list, - int count, - Ecore_Xcb_Encoding_Style style, - Ecore_Xcb_Textproperty *ret) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_textlist_to_textproperty("multiByte", list, count, - style, ret); -} - -/* NB: This Function May Not Be Correct !!! - * (as I do not know text conversion, locales, etc, etc very well) - * - * Portions were ripped from libX11 XTextListToTextProperty - */ -Eina_Bool -_ecore_xcb_textlist_to_textproperty(const char *type, - char **list, - int count, - Ecore_Xcb_Encoding_Style style, - Ecore_Xcb_Textproperty *ret) -{ - Eina_Bool is_wide = EINA_FALSE; - Ecore_X_Atom encoding; - int len = 0, nitems = 0, i = 0; - size_t from_left = 0, to_left = 0; - int unconv_num = 0, val = 0; - char *buff, *to, *value, *from; - const char *to_type, *from_type; - char **mb = NULL; - wchar_t **wc = NULL; -#ifdef HAVE_ICONV - iconv_t conv; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!strcmp("wideChar", type)) is_wide = EINA_TRUE; - len = _ecore_xcb_textlist_get_buffer_size(is_wide, list, count); - if (!(buff = (char *)malloc(len * sizeof(char)))) return EINA_FALSE; - from_type = nl_langinfo(CODESET); - switch (style) - { - case XcbStringStyle: - case XcbStdICCTextStyle: - encoding = ECORE_X_ATOM_STRING; - to_type = nl_langinfo(CODESET); -// to_type = "string"; - break; - - case XcbUTF8StringStyle: - encoding = ECORE_X_ATOM_UTF8_STRING; - to_type = "UTF-8"; - break; - - case XcbCompoundTextStyle: - encoding = ECORE_X_ATOM_COMPOUND_TEXT; - to_type = nl_langinfo(CODESET); -// to_type = "compoundText"; - break; - - case XcbTextStyle: - encoding = ECORE_X_ATOM_TEXT; - to_type = nl_langinfo(CODESET); -// to_type = "multiByte"; - if (!is_wide) - { - nitems = 0; - mb = (char **)list; - to = buff; - for (i = 0; ((i < count) && (len > 0)); i++) - { - if (*mb) strcpy(to, *mb); - else *to = '\0'; - from_left = (*mb ? strlen(*mb) : 0) + 1; - nitems += from_left; - to += from_left; - mb++; - } - unconv_num = 0; - goto done; - } - break; - - default: - free(buff); - return EINA_FALSE; - break; - } - - if (count < 1) - { - nitems = 0; - goto done; - } - -retry: -#ifdef HAVE_ICONV - conv = iconv_open(to_type, from_type); -#endif - - if (is_wide) - wc = (wchar_t **)list; - else - mb = (char **)list; - - to = buff; - to_left = len; - unconv_num = 0; - for (i = 1; to_left > 0; i++) - { - if (is_wide) - { - from = (char *)*wc; - from_left = _ecore_xcb_textlist_get_wc_len(*wc); - wc++; - } - else - { - from = *mb; - from_left = (*mb ? strlen(*mb) : 0); - mb++; - } - -#ifdef HAVE_ICONV - val = iconv(conv, &from, &from_left, &to, &to_left); -#endif - if (val < 0) continue; - if ((val > 0) && (style == XcbStdICCTextStyle) && - (encoding == ECORE_X_ATOM_STRING)) - { -#ifdef HAVE_ICONV - iconv_close(conv); -#endif - encoding = ECORE_X_ATOM_COMPOUND_TEXT; - goto retry; - } - - unconv_num += val; - *to++ = '\0'; - to_left--; - if (i >= count) break; - } - -#ifdef HAVE_ICONV - iconv_close(conv); -#endif - nitems = (to - buff); - -done: - if (nitems <= 0) nitems = 1; - if (!(value = (char *)malloc(nitems * sizeof(char)))) - { - free(buff); - return EINA_FALSE; - } - if (nitems == 1) - *value = 0; - else - memcpy(value, buff, nitems); - nitems--; - free(buff); - - ret->value = value; - ret->encoding = encoding; - ret->format = 8; - ret->nitems = nitems; - - return EINA_TRUE; -} - -#ifdef HAVE_ICONV -Eina_Bool -_ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, - char ***list_ret, - int *count_ret) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_textproperty_to_textlist(text_prop, "utf8String", - list_ret, count_ret); -} - -#endif - -Eina_Bool -_ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, - char ***list_ret, - int *count_ret) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return _ecore_xcb_textproperty_to_textlist(text_prop, "multiByte", - list_ret, count_ret); -} - -Eina_Bool -_ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, - const char *type, - char ***list_ret, - int *count_ret) -{ - Eina_Bool is_wide = EINA_FALSE; - Eina_Bool do_strcpy = EINA_FALSE; - const char *from_type; - char *buff, *to, *from; - char *lptr, *sptr; - int nitems = 0, len = 0, num = 0, ret = 0; - size_t from_left = 0, to_left = 0; -#ifdef HAVE_ICONV - iconv_t conv = 0; -#endif - - *list_ret = NULL; - *count_ret = 0; - if (!strcmp("wideChar", type)) is_wide = EINA_TRUE; - - nitems = text_prop->nitems; - if (nitems <= 0) return EINA_TRUE; - - if (text_prop->format != 8) return EINA_FALSE; - - from_type = nl_langinfo(CODESET); - if (text_prop->encoding == ECORE_X_ATOM_UTF8_STRING) - from_type = "UTF-8"; - - if (is_wide) - len = (text_prop->nitems + 1) * sizeof(wchar_t); - else - { - if (!strcmp(type, "utf8String")) - len = text_prop->nitems * 6 + 1; - else - len = text_prop->nitems * MB_CUR_MAX + 1; - } - - buff = (char *)malloc(len * sizeof(char)); - if (!buff) return EINA_FALSE; - - to = buff; - to_left = len; - - if (!strcmp(from_type, type)) - do_strcpy = EINA_TRUE; - else - { -#ifdef HAVE_ICONV - conv = iconv_open(type, from_type); -#endif - if (!conv) - { - free(buff); - return EINA_FALSE; - } - } - - lptr = sptr = text_prop->value; - num = *count_ret = 0; - while (1) - { - if ((nitems == 0) || (*sptr == 0)) - { - from = lptr; - from_left = sptr - lptr; - lptr = sptr; - if (do_strcpy) - { - int l = 0; - - l = MIN(from_left, to_left); - strncpy(to, from, l); - from += len; - to += len; - from_left -= l; - to_left -= l; - ret = 0; - } - else - ret = iconv(conv, &from, &from_left, &to, &to_left); - - if (ret < 0) continue; - num += ret; - (*count_ret)++; - if (nitems == 0) break; - lptr = ++sptr; - if (is_wide) - { - *((wchar_t *)to) = (wchar_t)0; - to += sizeof(wchar_t); - to_left -= sizeof(wchar_t); - } - else - { - *((char *)to) = '\0'; - to++; - to_left--; - } - } - else - sptr++; - - nitems--; - } - -#if HAVE_ICONV - if (!do_strcpy) iconv_close(conv); -#endif - - if (is_wide) - { - *((wchar_t *)to) = (wchar_t)0; - to_left -= sizeof(wchar_t); - } - else - { - *((char *)to) = '\0'; - to_left--; - } - - *list_ret = - _ecore_xcb_textlist_alloc_list(is_wide, *count_ret, (len - to_left)); - if (*list_ret) - _ecore_xcb_textlist_copy_list(is_wide, buff, *list_ret, *count_ret); - - free(buff); - - return EINA_TRUE; -} - -static int -_ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, - void *list, - int count) -{ - int len = 0; - char **mb; - wchar_t **wc; - - if (!list) return 0; - if (is_wide) - { - wc = (wchar_t **)list; - for (; count-- > 0; wc++) - if (*wc) len += _ecore_xcb_textlist_get_wc_len(*wc) + 1; - len *= 5; - } - else - { - mb = (char **)list; - for (; count-- > 0; mb++) - if (*mb) len += strlen(*mb) + 1; - len *= 3; - } - len = (len / 2048 + 1) * 2048; - return len; -} - -static int -_ecore_xcb_textlist_get_wc_len(wchar_t *wstr) -{ - wchar_t *ptr; - - ptr = wstr; - while (*ptr) - ptr++; - - return ptr - wstr; -} - -static void * -_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, - int count, - int nitems) -{ - if (is_wide) - { - wchar_t **list; - - list = (wchar_t **)malloc(count * sizeof(wchar_t *)); - if (!list) return NULL; - *list = (wchar_t *)malloc(nitems * sizeof(wchar_t)); - if (!*list) - { - free(list); - return NULL; - } - return *list; - } - else - { - char **list; - - list = (char **)malloc(count * sizeof(char *)); - if (!list) return NULL; - *list = (char *)malloc(nitems * sizeof(char)); - if (!*list) - { - free(list); - return NULL; - } - return *list; - } -} - -static void -_ecore_xcb_textlist_copy_list(Eina_Bool is_wide, - void *text, - char **list, - int count) -{ - int len = 0; - - if (is_wide) - { - wchar_t *txt, *str, **wlist; - - txt = (wchar_t *)text; - wlist = (wchar_t **)list; - for (str = *wlist; count > 0; count--, wlist++) - { - _ecore_xcb_textlist_copy_wchar(str, txt); - *wlist = str; - len = (_ecore_xcb_textlist_len_wchar(str) + 1); - str += len; - txt += len; - } - } - else - { - char *txt, *str, **slist; - - txt = (char *)text; - slist = (char **)list; - for (str = *slist; count > 0; count--, slist++) - { - strcpy(str, txt); - *slist = str; - len = strlen(str) + 1; - str += len; - txt += len; - } - } -} - -static wchar_t * -_ecore_xcb_textlist_copy_wchar(wchar_t *str1, - wchar_t *str2) -{ - wchar_t *tmp; - - tmp = str1; - while ((*str1++ = *str2++)) - ; - return tmp; -} - -static int -_ecore_xcb_textlist_len_wchar(wchar_t *str) -{ - wchar_t *ptr; - - ptr = str; - while (*ptr) - ptr++; - return ptr - str; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_vsync.c b/src/lib/ecore_x/xcb/ecore_xcb_vsync.c deleted file mode 100644 index 7888796..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_vsync.c +++ /dev/null @@ -1,375 +0,0 @@ -#include "ecore_xcb_private.h" -# include -# include -# include - -#define ECORE_XCB_VSYNC_DRI2 1 -#define DRM_EVENT_CONTEXT_VERSION 2 - -#ifdef ECORE_XCB_VSYNC_DRI2 - -/* relevant header bits of dri/drm inlined here to avoid needing external */ -/* headers to build drm */ -typedef unsigned int drm_magic_t; - -typedef enum -{ - DRM_VBLANK_ABSOLUTE = 0x00000000, - DRM_VBLANK_RELATIVE = 0x00000001, - DRM_VBLANK_EVENT = 0x04000000, - DRM_VBLANK_FLIP = 0x08000000, - DRM_VBLANK_NEXTONMISS = 0x10000000, - DRM_VBLANK_SECONDARY = 0x20000000, - DRM_VBLANK_SIGNAL = 0x40000000 -} drmVBlankSeqType; - -typedef struct _drmVBlankReq -{ - drmVBlankSeqType type; - unsigned int sequence; - unsigned long signal; -} drmVBlankReq; - -typedef struct _drmVBlankReply -{ - drmVBlankSeqType type; - unsigned int sequence; - long tval_sec, tval_usec; -} drmVBlankReply; - -typedef union _drmVBlank -{ - drmVBlankReq request; - drmVBlankReply reply; -} drmVBlank; - -typedef struct _drmEventContext -{ - int version; - void (*vblank_handler)(int fd, - unsigned int sequence, - unsigned int tv_sec, - unsigned int tv_usec, - void *user_data); - void (*page_flip_handler)(int fd, - unsigned int sequence, - unsigned int tv_sec, - unsigned int tv_usec, - void *user_data); -} drmEventContext; - -static int (*sym_drmClose)(int fd) = NULL; -static int (*sym_drmGetMagic)(int fd, - drm_magic_t *magic) = NULL; -static int (*sym_drmWaitVBlank)(int fd, - drmVBlank *vbl) = NULL; -static int (*sym_drmHandleEvent)(int fd, - drmEventContext *evctx) = NULL; - -/* dri */ -static Bool (*sym_DRI2QueryExtension)(Display *display, - int *eventBase, - int *errorBase) = NULL; -static Bool (*sym_DRI2QueryVersion)(Display *display, - int *major, - int *minor) = NULL; -static Bool (*sym_DRI2Connect)(Display *display, - XID window, - char **driverName, - char **deviceName) = NULL; -static Bool (*sym_DRI2Authenticate)(Display *display, - XID window, - drm_magic_t magic) = NULL; - -/* local function prototypes */ -static Eina_Bool _ecore_xcb_dri_link(void); -static Eina_Bool _ecore_xcb_dri_start(void); -static void _ecore_xcb_dri_shutdown(void); - -static Eina_Bool _ecore_xcb_dri_cb(void *data EINA_UNUSED, - Ecore_Fd_Handler *fdh EINA_UNUSED); -static void _ecore_xcb_dri_tick_begin(void *data EINA_UNUSED); -static void _ecore_xcb_dri_tick_end(void *data EINA_UNUSED); -static void _ecore_xcb_dri_tick_schedule(void); -static void _ecore_xcb_dri_vblank_handler(int fd EINA_UNUSED, - unsigned int frame EINA_UNUSED, - unsigned int sec EINA_UNUSED, - unsigned int usec EINA_UNUSED, - void *data EINA_UNUSED); - -/* local variables */ -static Ecore_X_Window _vsync_root = 0; -static int _drm_fd = -1; -static Ecore_Fd_Handler *_drm_fdh = NULL; -static unsigned int _drm_magic = 0; -static Eina_Bool _drm_event_busy = EINA_FALSE; -static void *_drm_lib = NULL; -static void *_dri_lib = NULL; -static drmEventContext _drm_evctx; -#endif - -void -_ecore_xcb_dri_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -} - -void -_ecore_xcb_dri_finalize(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -} - -EAPI Eina_Bool -ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win) -{ -#ifdef ECORE_XCB_VSYNC_DRI2 - Ecore_X_Window root; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_VSYNC_DRI2 - root = ecore_x_window_root_get(win); - if (root != _vsync_root) - { - _vsync_root = root; - if (_vsync_root) - { - if (!_ecore_xcb_dri_link()) - { - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - return EINA_FALSE; - } - _ecore_xcb_dri_shutdown(); - if (!_ecore_xcb_dri_start()) - { - _vsync_root = 0; - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - return EINA_FALSE; - } - ecore_animator_custom_source_tick_begin_callback_set - (_ecore_xcb_dri_tick_begin, NULL); - ecore_animator_custom_source_tick_end_callback_set - (_ecore_xcb_dri_tick_end, NULL); - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); - } - else - { - if (_drm_fd >= 0) - { - _ecore_xcb_dri_shutdown(); - ecore_animator_custom_source_tick_begin_callback_set - (NULL, NULL); - ecore_animator_custom_source_tick_end_callback_set - (NULL, NULL); - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - } - } - } - return EINA_TRUE; -#else - return EINA_FALSE; - win = 0; -#endif -} - -/* local functions */ -#ifdef ECORE_XCB_VSYNC_DRI2 -static Eina_Bool -_ecore_xcb_dri_link(void) -{ - const char *_drm_libs[] = - { - "libdrm.so.2", - "libdrm.so.1", - "libdrm.so.0", - "libdrm.so", - NULL, - }; - const char *_dri_libs[] = - { - "libdri2.so.2", - "libdri2.so.1", - "libdri2.so.0", - "libdri2.so", - "libGL.so.4", - "libGL.so.3", - "libGL.so.2", - "libGL.so.1", - "libGL.so.0", - "libGL.so", - NULL, - }; - int i = 0, fail = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -# define SYM(lib, xx) \ - do { \ - sym_## xx = dlsym(lib, #xx); \ - if (!(sym_## xx)) { \ - fprintf(stderr, "%s\n", dlerror()); \ - fail = 1; \ - } \ - } while (0); - - if (_drm_lib) return EINA_TRUE; - - for (i = 0; _drm_libs[i]; i++) - { - _drm_lib = dlopen(_drm_libs[i], (RTLD_LOCAL | RTLD_LAZY)); - if (_drm_lib) - { - fail = 0; - SYM(_drm_lib, drmClose); - SYM(_drm_lib, drmGetMagic); - SYM(_drm_lib, drmWaitVBlank); - SYM(_drm_lib, drmHandleEvent); - if (fail) - { - dlclose(_drm_lib); - _drm_lib = NULL; - } - else - break; - } - } - if (!_drm_lib) return EINA_FALSE; - for (i = 0; _dri_libs[i]; i++) - { - if ((_dri_lib = dlopen(_dri_libs[i], (RTLD_LOCAL | RTLD_LAZY)))) - { - fail = 0; - SYM(_dri_lib, DRI2QueryExtension); - SYM(_dri_lib, DRI2QueryVersion); - SYM(_dri_lib, DRI2Connect); - SYM(_dri_lib, DRI2Authenticate); - if (fail) - { - dlclose(_dri_lib); - _dri_lib = NULL; - } - else - break; - } - } - if (!_dri_lib) - { - dlclose(_drm_lib); - _drm_lib = NULL; - return EINA_FALSE; - } - - return EINA_TRUE; -} - -static Eina_Bool -_ecore_xcb_dri_start(void) -{ - Ecore_X_Display *disp; - int _dri2_event = 0, _dri2_error = 0; - int _dri2_major = 0, _dri2_minor = 0; - char *device = NULL, *driver = NULL; - - disp = ecore_x_display_get(); - if (!sym_DRI2QueryExtension(disp, &_dri2_event, &_dri2_error)) - return 0; - if (!sym_DRI2QueryVersion(disp, &_dri2_major, &_dri2_minor)) - return 0; - if (_dri2_major < 2) return 0; - if (!sym_DRI2Connect(disp, _vsync_root, &driver, &device)) - return 0; - - _drm_fd = open(device, O_RDWR); - if (_drm_fd < 0) return 0; - - sym_drmGetMagic(_drm_fd, &_drm_magic); - if (!sym_DRI2Authenticate(disp, _vsync_root, _drm_magic)) - { - close(_drm_fd); - _drm_fd = -1; - return EINA_FALSE; - } - - memset(&_drm_evctx, 0, sizeof(_drm_evctx)); - _drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; - _drm_evctx.vblank_handler = _ecore_xcb_dri_vblank_handler; - _drm_evctx.page_flip_handler = NULL; - - _drm_fdh = ecore_main_fd_handler_add(_drm_fd, ECORE_FD_READ, - _ecore_xcb_dri_cb, NULL, NULL, NULL); - if (!_drm_fdh) - { - close(_drm_fd); - _drm_fd = -1; - return EINA_FALSE; - } - - return EINA_TRUE; -} - -static void -_ecore_xcb_dri_shutdown(void) -{ - if (_drm_fd >= 0) - { - close(_drm_fd); - _drm_fd = -1; - } - if (_drm_fdh) - { - ecore_main_fd_handler_del(_drm_fdh); - _drm_fdh = NULL; - } -} - -static Eina_Bool -_ecore_xcb_dri_cb(void *data EINA_UNUSED, - Ecore_Fd_Handler *fdh EINA_UNUSED) -{ - sym_drmHandleEvent(_drm_fd, &_drm_evctx); - return ECORE_CALLBACK_RENEW; -} - -static void -_ecore_xcb_dri_tick_begin(void *data EINA_UNUSED) -{ - _drm_event_busy = EINA_TRUE; - _ecore_xcb_dri_tick_schedule(); -} - -static void -_ecore_xcb_dri_tick_end(void *data EINA_UNUSED) -{ - _drm_event_busy = EINA_FALSE; -} - -static void -_ecore_xcb_dri_tick_schedule(void) -{ - drmVBlank vbl; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - vbl.request.type = (DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT); - vbl.request.sequence = 1; - vbl.request.signal = 0; - - sym_drmWaitVBlank(_drm_fd, &vbl); -} - -static void -_ecore_xcb_dri_vblank_handler(int fd EINA_UNUSED, - unsigned int frame EINA_UNUSED, - unsigned int sec EINA_UNUSED, - unsigned int usec EINA_UNUSED, - void *data EINA_UNUSED) -{ - ecore_animator_custom_tick(); - if (_drm_event_busy) _ecore_xcb_dri_tick_schedule(); -} - -#endif diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window.c b/src/lib/ecore_x/xcb/ecore_xcb_window.c deleted file mode 100644 index 4b4f308..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_window.c +++ /dev/null @@ -1,2255 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_RENDER -# include -#endif -#ifdef ECORE_XCB_SHAPE -# include -#endif - -/* local function prototypes */ -static Ecore_X_Window _ecore_xcb_window_argb_internal_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h, - uint8_t override_redirect, - uint8_t save_under); -static Ecore_X_Window _ecore_xcb_window_at_xy_get(Ecore_X_Window base, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num); -static int _ecore_xcb_window_modifiers_get(unsigned int state); -static xcb_visualtype_t *_ecore_xcb_window_find_visual_by_id(xcb_visualid_t id); - -/* local variables */ -static int ignore_num = 0; -static Ecore_X_Window *ignore_list = NULL; - -/* external variables */ -int _ecore_xcb_button_grabs_num = 0; -int _ecore_xcb_key_grabs_num = 0; -Ecore_X_Window *_ecore_xcb_button_grabs = NULL; -Ecore_X_Window *_ecore_xcb_key_grabs = NULL; -Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data, - int type, - void *event); -void *_ecore_xcb_window_grab_replay_data; - -/** - * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions - * @ingroup Ecore_X_Group - * - * Functions that can be used to create an X window. - */ - -EAPI Ecore_X_Window -ecore_x_window_full_new(Ecore_X_Window parent, int x, int y, int w, int h, Ecore_X_Visual *visual, Ecore_X_Colormap colormap, int depth EINA_UNUSED, Eina_Bool override) -{ - Ecore_X_Window win; - uint32_t mask, mask_list[10]; - xcb_visualtype_t *vis; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (parent == 0) - parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - vis = (xcb_visualtype_t *)visual; - - /* NB: Order here is very important due to xcb_cw_t enum */ - mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | - XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | - XCB_CW_DONT_PROPAGATE | XCB_CW_COLORMAP); - - mask_list[0] = XCB_BACK_PIXMAP_NONE; - mask_list[1] = 0; - mask_list[2] = XCB_GRAVITY_NORTH_WEST; - mask_list[3] = XCB_GRAVITY_NORTH_WEST; - mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL; - mask_list[5] = override; - mask_list[6] = 0; - mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | - XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE); - mask_list[8] = XCB_EVENT_MASK_NO_EVENT; - mask_list[9] = colormap; - - win = xcb_generate_id(_ecore_xcb_conn); - xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, - win, parent, x, y, w, h, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - vis ? vis->visual_id : XCB_COPY_FROM_PARENT, - mask, mask_list); - - if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) - ecore_x_window_defaults_set(win); - - return win; -} - -/** - * Creates a new window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h) -{ - Ecore_X_Window win; - uint32_t mask, mask_list[9]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (parent == 0) - parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - /* NB: Order here is very important due to xcb_cw_t enum */ - mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | - XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | - XCB_CW_DONT_PROPAGATE); - - mask_list[0] = XCB_BACK_PIXMAP_NONE; - mask_list[1] = 0; - mask_list[2] = XCB_GRAVITY_NORTH_WEST; - mask_list[3] = XCB_GRAVITY_NORTH_WEST; - mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL; - mask_list[5] = 0; - mask_list[6] = 0; - mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | - XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE); - mask_list[8] = XCB_EVENT_MASK_NO_EVENT; - - win = xcb_generate_id(_ecore_xcb_conn); - xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, - win, parent, x, y, w, h, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - XCB_COPY_FROM_PARENT, mask, mask_list); - - if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) - ecore_x_window_defaults_set(win); - - return win; -} - -/** - * Creates a window with the override redirect attribute set to @c True. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h) -{ - Ecore_X_Window win; - uint32_t mask, mask_list[9]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (parent == 0) - parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - /* NB: Order here is very important due to xcb_cw_t enum */ - mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | - XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | - XCB_CW_DONT_PROPAGATE); - - mask_list[0] = XCB_BACK_PIXMAP_NONE; - mask_list[1] = 0; - mask_list[2] = XCB_GRAVITY_NORTH_WEST; - mask_list[3] = XCB_GRAVITY_NORTH_WEST; - mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL; - mask_list[5] = 1; - mask_list[6] = 0; - mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | - XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE); - mask_list[8] = XCB_EVENT_MASK_NO_EVENT; - - win = xcb_generate_id(_ecore_xcb_conn); - xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, - win, parent, x, y, w, h, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - XCB_COPY_FROM_PARENT, mask, mask_list); - - return win; -} - -/** - * Creates a new input window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h) -{ - Ecore_X_Window win; - uint32_t mask, mask_list[3]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__) - CHECK_XCB_CONN; - - if (parent == 0) - parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - /* NB: Order here is very important due to xcb_cw_t enum */ - mask = (XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | - XCB_CW_DONT_PROPAGATE); - - mask_list[0] = 1; - mask_list[1] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | - XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE); - mask_list[2] = XCB_EVENT_MASK_NO_EVENT; - - win = xcb_generate_id(_ecore_xcb_conn); - xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, - win, parent, x, y, w, h, 0, - XCB_WINDOW_CLASS_INPUT_ONLY, - XCB_COPY_FROM_PARENT, mask, mask_list); - - return win; -} - -/** - * Creates a new window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_manager_argb_new(Ecore_X_Window parent, int x, int y, int w, int h) -{ - Ecore_X_Window win = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 1, 0); - - return win; -} - -/** - * Creates a new window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h) -{ - Ecore_X_Window win = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 0, 0); - - return win; -} - -/** - * Creates a window with the override redirect attribute set to @c True. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_override_argb_new(Ecore_X_Window parent, int x, int y, int w, int h) -{ - Ecore_X_Window win = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 1, 0); - - return win; -} - -EAPI Ecore_X_Window -ecore_x_window_permanent_new(Ecore_X_Window parent, Ecore_X_Atom unique_atom) -{ - Ecore_X_Window win, win2, realwin = 0; - uint32_t mask, mask_list[9]; - xcb_get_property_reply_t *reply; - xcb_get_property_cookie_t cookie; - unsigned long ldata, *datap; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!_ecore_xcb_conn) return 0; - - CHECK_XCB_CONN; - - xcb_grab_server(_ecore_xcb_conn); - cookie = - xcb_get_property_unchecked(_ecore_xcb_conn, 0, parent, unique_atom, - ECORE_X_ATOM_WINDOW, 0, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if ((reply->type == ECORE_X_ATOM_WINDOW) && (reply->format == 32) && - (reply->value_len == 1) && - ((datap = (unsigned long *)xcb_get_property_value(reply)))) - { - win = (Ecore_X_Window)(*datap); - free(reply); - cookie = - xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, unique_atom, - ECORE_X_ATOM_WINDOW, 0, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - if ((reply->type == ECORE_X_ATOM_WINDOW) && - (reply->format == 32) && (reply->value_len == 1) && - ((datap = (unsigned long *)xcb_get_property_value(reply)))) - { - win2 = (Ecore_X_Window)(*datap); - free(reply); - if (win2 == win) realwin = win; - } - else free(reply); - } - } - else free(reply); - } - if (realwin != 0) - { - xcb_ungrab_server(_ecore_xcb_conn); - xcb_flush(_ecore_xcb_conn); - return realwin; - } - mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | - XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | - XCB_CW_DONT_PROPAGATE); - mask_list[0] = XCB_BACK_PIXMAP_NONE; - mask_list[1] = 0; - mask_list[2] = XCB_GRAVITY_NORTH_WEST; - mask_list[3] = XCB_GRAVITY_NORTH_WEST; - mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL; - mask_list[5] = 1; - mask_list[6] = 0; - mask_list[7] = XCB_EVENT_MASK_NO_EVENT; - mask_list[8] = XCB_EVENT_MASK_NO_EVENT; - win = xcb_generate_id(_ecore_xcb_conn); - xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, - win, parent, -77, -77, 7, 7, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - XCB_COPY_FROM_PARENT, mask, mask_list); - ldata = (unsigned long)win; - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, - win, unique_atom,ECORE_X_ATOM_WINDOW, 32, 1, - (unsigned char *)ldata); - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, - parent, unique_atom, - ECORE_X_ATOM_WINDOW, 32, 1, (unsigned char *)ldata); - xcb_set_close_down_mode(_ecore_xcb_conn, XCB_CLOSE_DOWN_RETAIN_PERMANENT); - xcb_ungrab_server(_ecore_xcb_conn); - xcb_flush(_ecore_xcb_conn); - - return win; -} - -/** - * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions - * @ingroup Ecore_X_Group - * - * Functions to destroy X windows. - */ - -/** - * Deletes the given window. - * @param win The given window. - * @ingroup Ecore_X_Window_Destroy_Group - */ -EAPI void -ecore_x_window_free(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (win) - { - /* xcb_destroy_notify_event_t ev; */ - /* Ecore_X_Window root; */ - - /* if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1) */ - /* root = ((xcb_screen_t *)_ecore_xcb_screen)->root; */ - /* else */ - /* { */ - /* xcb_get_geometry_cookie_t cookie; */ - /* xcb_get_geometry_reply_t *reply; */ - - /* cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); */ - /* reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); */ - /* if (!reply) return; */ - /* root = reply->root; */ - /* free(reply); */ - /* } */ - - /* memset(&ev, 0, sizeof(xcb_destroy_notify_event_t)); */ - - /* ev.response_type = XCB_DESTROY_NOTIFY; */ - /* ev.window = win; */ - /* ev.event = root; */ - - /* xcb_send_event(_ecore_xcb_conn, 0, root, */ - /* XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | */ - /* XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, */ - /* (const char *)&ev); */ - - xcb_destroy_window(_ecore_xcb_conn, win); -// ecore_x_flush(); - } -} - -/** - * Sends a delete request to the given window. - * @param win The given window. - * @ingroup Ecore_X_Window_Destroy_Group - */ -EAPI void -ecore_x_window_delete_request_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!win) return; - ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, - XCB_EVENT_MASK_NO_EVENT, - ECORE_X_ATOM_WM_DELETE_WINDOW, - XCB_CURRENT_TIME, 0, 0, 0); -} - -EAPI void -ecore_x_window_configure(Ecore_X_Window win, - Ecore_X_Window_Configure_Mask mask, - int x, - int y, - int w, - int h, - int border_width, - Ecore_X_Window sibling, - int stack_mode) -{ - uint16_t vmask = 0; - uint32_t vlist[7]; - unsigned int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - - if (mask & XCB_CONFIG_WINDOW_X) - { - vmask |= XCB_CONFIG_WINDOW_X; - vlist[i++] = x; - } - if (mask & XCB_CONFIG_WINDOW_Y) - { - vmask |= XCB_CONFIG_WINDOW_Y; - vlist[i++] = y; - } - if (mask & XCB_CONFIG_WINDOW_WIDTH) - { - vmask |= XCB_CONFIG_WINDOW_WIDTH; - vlist[i++] = w; - } - if (mask & XCB_CONFIG_WINDOW_HEIGHT) - { - vmask |= XCB_CONFIG_WINDOW_HEIGHT; - vlist[i++] = h; - } - if (mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) - { - vmask |= XCB_CONFIG_WINDOW_BORDER_WIDTH; - vlist[i++] = border_width; - } - if (mask & XCB_CONFIG_WINDOW_SIBLING) - { - vmask |= XCB_CONFIG_WINDOW_SIBLING; - vlist[i++] = sibling; - } - if (mask & XCB_CONFIG_WINDOW_STACK_MODE) - { - vmask |= XCB_CONFIG_WINDOW_STACK_MODE; - vlist[i++] = stack_mode; - } - - xcb_configure_window(_ecore_xcb_conn, win, vmask, - (const uint32_t *)&vlist); -// ecore_x_flush(); -} - -/** - * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions - * @ingroup Ecore_X_Group - * - * Functions that change or retrieve the geometry of X windows. - */ - -/** - * Moves a window to the position @p x, @p y. - * - * The position is relative to the upper left hand corner of the - * parent window. - * - * @param win The window to move. - * @param x X position. - * @param y Y position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_move(Ecore_X_Window win, - int x, - int y) -{ - uint32_t list[2], mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - - mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y); - list[0] = x; - list[1] = y; - - xcb_configure_window(_ecore_xcb_conn, win, mask, - (const uint32_t *)&list); -// ecore_x_flush(); -} - -/** - * Resizes a window. - * @param win The window to resize. - * @param w New width of the window. - * @param h New height of the window. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_resize(Ecore_X_Window win, - int w, - int h) -{ - uint32_t list[2], mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - if (w < 1) w = 1; - if (h < 1) h = 1; - - mask = (XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT); - list[0] = w; - list[1] = h; - - xcb_configure_window(_ecore_xcb_conn, win, mask, - (const uint32_t *)&list); -// ecore_x_flush(); -} - -/** - * Moves and resizes a window. - * @param win The window to move and resize. - * @param x New X position of the window. - * @param y New Y position of the window. - * @param w New width of the window. - * @param h New height of the window. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_move_resize(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - uint32_t list[4], mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - if (w < 1) w = 1; - if (h < 1) h = 1; - - mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | - XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT); - list[0] = x; - list[1] = y; - list[2] = w; - list[3] = h; - - xcb_configure_window(_ecore_xcb_conn, win, mask, - (const uint32_t *)&list); -// ecore_x_flush(); -} - -/** - * Retrieves the width of the border of the given window. - * @param win The given window. - * @return Width of the border of @p win. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI int -ecore_x_window_border_width_get(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!win) return 0; - return ecore_x_drawable_border_width_get(win); -} - -/** - * Sets the width of the border of the given window. - * @param win The given window. - * @param width The new border width. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_border_width_set(Ecore_X_Window win, - int border_width) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) return; - - list = border_width; - - xcb_configure_window(_ecore_xcb_conn, win, - XCB_CONFIG_WINDOW_BORDER_WIDTH, &list); -// ecore_x_flush(); -} - -/** - * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions - * @ingroup Ecore_X_Group - * - * Functions that change the Z order of X windows. - */ - -/** - * Raises the given window. - * @param win The window to raise. - * @ingroup Ecore_X_Window_Z_Order_Group - */ -EAPI void -ecore_x_window_raise(Ecore_X_Window win) -{ - uint32_t list[] = { XCB_STACK_MODE_ABOVE }; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_configure_window(_ecore_xcb_conn, win, - XCB_CONFIG_WINDOW_STACK_MODE, list); -// ecore_x_flush(); -} - -/** - * Lowers the given window. - * @param win The window to lower. - * @ingroup Ecore_X_Window_Z_Order_Group - */ -EAPI void -ecore_x_window_lower(Ecore_X_Window win) -{ - uint32_t list[] = { XCB_STACK_MODE_BELOW }; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_configure_window(_ecore_xcb_conn, win, - XCB_CONFIG_WINDOW_STACK_MODE, list); -// ecore_x_flush(); -} - -/** - * Retrieves the depth of the given window. - * @param win The given window. - * @return Depth of the window. - */ -EAPI int -ecore_x_window_depth_get(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_drawable_depth_get(win); -} - -/** - * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions - * @ingroup Ecore_X_Group - * - * Functions that set window properties. - */ - -/** - * Sets the default properties for the given window. - * - * The default properties set for the window are @c WM_CLIENT_MACHINE and - * @c _NET_WM_PID. - * - * @param win The given window. - * @ingroup Ecore_X_Window_Properties_Group - */ -EAPI void -ecore_x_window_defaults_set(Ecore_X_Window win) -{ - char buff[MAXHOSTNAMELEN], **argv; - int argc; - pid_t pid; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - gethostname(buff, MAXHOSTNAMELEN); - buff[MAXHOSTNAMELEN - 1] = '\0'; - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - ECORE_X_ATOM_WM_CLIENT_MACHINE, ECORE_X_ATOM_STRING, - 8, strlen(buff), buff); - - pid = getpid(); - ecore_x_netwm_pid_set(win, pid); - ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); - ecore_app_args_get(&argc, &argv); - ecore_x_icccm_command_set(win, argc, argv); -} - -/** - * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions - * @ingroup Ecore_X_Group - * - * Functions to access and change the visibility of X windows. - */ - -/** - * Shows a window. - * - * Synonymous to "mapping" a window in X Window System terminology. - * - * @param win The window to show. - * @ingroup Ecore_X_Window_Visibility - */ -EAPI void -ecore_x_window_show(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (win) - xcb_map_window(_ecore_xcb_conn, win); -} - -/** - * Hides a window. - * - * Synonymous to "unmapping" a window in X Window System terminology. - * - * @param win The window to hide. - * @ingroup Ecore_X_Window_Visibility - */ -EAPI void -ecore_x_window_hide(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (win) - { - xcb_unmap_notify_event_t ev; - Ecore_X_Window root; - - if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1) - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - else - { - xcb_get_geometry_cookie_t cookie; - xcb_get_geometry_reply_t *reply; - - cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); - reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - root = reply->root; - free(reply); - } - - xcb_unmap_window(_ecore_xcb_conn, win); - memset(&ev, 0, sizeof(xcb_unmap_notify_event_t)); - - ev.response_type = XCB_UNMAP_NOTIFY; - ev.window = win; - ev.event = root; - ev.from_configure = 0; - - xcb_send_event(_ecore_xcb_conn, 0, root, - (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT), - (const char *)&ev); - -// ecore_x_flush(); - } -} - -/** - * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions - * @ingroup Ecore_X_Group - * - * Functions that give the focus to an X Window. - */ - -/** - * Sets the focus to the window @p win. - * @param win The window to focus. - * @ingroup Ecore_X_Window_Focus_Functions - */ -EAPI void -ecore_x_window_focus(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - xcb_set_input_focus(_ecore_xcb_conn, - XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME); -// ecore_x_flush(); -} - -/** - * Sets the focus to the given window at a specific time. - * @param win The window to focus. - * @param t When to set the focus to the window. - * @ingroup Ecore_X_Window_Focus_Functions - */ -EAPI void -ecore_x_window_focus_at_time(Ecore_X_Window win, - Ecore_X_Time time EINA_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, XCB_CURRENT_TIME); -// ecore_x_flush(); -} - -/** - * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions - * @ingroup Ecore_X_Group - * - * Functions that retrieve or changes the parent window of a window. - */ - -/** - * Moves a window to within another window at a given position. - * @param win The window to reparent. - * @param new_parent The new parent window. - * @param x X position within new parent window. - * @param y Y position within new parent window. - * @ingroup Ecore_X_Window_Parent_Group - */ -EAPI void -ecore_x_window_reparent(Ecore_X_Window win, - Ecore_X_Window parent, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (parent == 0) - parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - xcb_reparent_window(_ecore_xcb_conn, win, parent, x, y); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_pixmap_set(Ecore_X_Window win, - Ecore_X_Pixmap pixmap) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = pixmap; - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_BACK_PIXMAP, &list); -// ecore_x_flush(); -} - -/** - * Sets the background color of the given window. - * @param win The given window - * @param r red value (0...65536, 16 bits) - * @param g green value (0...65536, 16 bits) - * @param b blue value (0...65536, 16 bits) - */ -EAPI void -ecore_x_window_background_color_set(Ecore_X_Window win, - unsigned short red, - unsigned short green, - unsigned short blue) -{ - xcb_alloc_color_cookie_t cookie; - xcb_alloc_color_reply_t *reply; - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = - xcb_alloc_color_unchecked(_ecore_xcb_conn, - ((xcb_screen_t *)_ecore_xcb_screen)->default_colormap, - red, green, blue); - reply = xcb_alloc_color_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return; - list = reply->pixel; - free(reply); - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_BACK_PIXEL, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_pixel_gravity_set(Ecore_X_Window win, - Ecore_X_Gravity gravity) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = gravity; - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_BIT_GRAVITY, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_gravity_set(Ecore_X_Window win, - Ecore_X_Gravity gravity) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = gravity; - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_WIN_GRAVITY, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_override_set(Ecore_X_Window win, - Eina_Bool override) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = override; - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_OVERRIDE_REDIRECT, &list); -// ecore_x_flush(); -} - -/** - * @brief Show the cursor on a window of type Ecore_X_Window. - * @param win The window for which the cursor will be showed. - * @param show Enables the show of the cursor on the window if equals EINA_TRUE, disables if equals EINA_FALSE. - */ -EAPI void -ecore_x_window_cursor_show(Ecore_X_Window win, - Eina_Bool show) -{ - uint32_t list = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (!show) - { - Ecore_X_Cursor cursor; - Ecore_X_Pixmap p, m; - Ecore_X_GC gc; - xcb_point_t point; - - p = xcb_generate_id(_ecore_xcb_conn); - xcb_create_pixmap(_ecore_xcb_conn, 1, p, win, 1, 1); - m = xcb_generate_id(_ecore_xcb_conn); - xcb_create_pixmap(_ecore_xcb_conn, 1, m, win, 1, 1); - gc = xcb_generate_id(_ecore_xcb_conn); - xcb_create_gc(_ecore_xcb_conn, gc, win, 0, NULL); - xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_FOREGROUND, &list); - point.x = 0; - point.y = 0; - xcb_poly_point(_ecore_xcb_conn, XCB_COORD_MODE_ORIGIN, - win, gc, 1, &point); - xcb_free_gc(_ecore_xcb_conn, gc); - - cursor = xcb_generate_id(_ecore_xcb_conn); - xcb_create_cursor(_ecore_xcb_conn, cursor, - p, m, 0, 0, 0, 0, 0, 0, 0, 0); - list = cursor; - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_CURSOR, &list); - - xcb_free_cursor(_ecore_xcb_conn, cursor); - xcb_free_pixmap(_ecore_xcb_conn, m); - xcb_free_pixmap(_ecore_xcb_conn, p); - } - else - { - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_CURSOR, &list); - } -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_cursor_set(Ecore_X_Window win, - Ecore_X_Cursor cursor) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = cursor; - - xcb_change_window_attributes(_ecore_xcb_conn, win, XCB_CW_CURSOR, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_container_manage(Ecore_X_Window win) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY); - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_client_manage(Ecore_X_Window win) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = (XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY); - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); - -#ifdef ECORE_XCB_SHAPE - xcb_shape_select_input(_ecore_xcb_conn, win, EINA_TRUE); -#endif -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_sniff(Ecore_X_Window win) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | - XCB_EVENT_MASK_PROPERTY_CHANGE); - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_client_sniff(Ecore_X_Window win) -{ - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - list = (XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE); - - xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); -#ifdef ECORE_XCB_SHAPE - xcb_shape_select_input(_ecore_xcb_conn, win, EINA_TRUE); -#endif -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_area_clear(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_clear_area(_ecore_xcb_conn, 0, win, x, y, w, h); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_area_expose(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_clear_area(_ecore_xcb_conn, 1, win, x, y, w, h); -// ecore_x_flush(); -} - -EAPI void -ecore_x_window_save_set_add(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_INSERT, win); -} - -EAPI void -ecore_x_window_save_set_del(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_DELETE, win); -} - -/** - * gets the window that has focus. - * @return The window that has focus. - * @ingroup Ecore_X_Window_Focus_Functions - */ -EAPI Ecore_X_Window -ecore_x_window_focus_get(void) -{ - xcb_get_input_focus_cookie_t cookie; - xcb_get_input_focus_reply_t *reply; - Ecore_X_Window focus = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_input_focus_unchecked(_ecore_xcb_conn); - reply = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - focus = reply->focus; - free(reply); - return focus; -} - -EAPI int -ecore_x_window_argb_get(Ecore_X_Window win) -{ - uint8_t ret = 0; -#ifdef ECORE_XCB_RENDER - Ecore_X_Visual visual; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -// if (!win) return ret; - -#ifdef ECORE_XCB_RENDER - /* grab the window's visual */ - visual = _ecore_xcb_window_visual_get(win); - - /* check if this visual supports alpha */ - ret = _ecore_xcb_render_visual_supports_alpha(visual); -#endif - - return ret; -} - -EAPI Eina_Bool -ecore_x_window_manage(Ecore_X_Window win) -{ - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *reply; - xcb_void_cookie_t change_cookie; - xcb_generic_error_t *err; - uint32_t list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_window_attributes(_ecore_xcb_conn, win); - reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - ecore_x_sync(); // needed - - list = (XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_RESIZE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - reply->your_event_mask); - free(reply); - - change_cookie = xcb_change_window_attributes(_ecore_xcb_conn, win, - XCB_CW_EVENT_MASK, &list); - - ecore_x_sync(); // needed - - err = xcb_request_check(_ecore_xcb_conn, change_cookie); - if (err) - { - _ecore_xcb_error_handle(err); - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_window_attributes_get(Ecore_X_Window win, - Ecore_X_Window_Attributes *att_ret) -{ - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *reply; - xcb_get_geometry_cookie_t gcookie; - xcb_get_geometry_reply_t *greply; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); - reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes)); - - if (reply->map_state != XCB_MAP_STATE_UNMAPPED) - att_ret->visible = EINA_TRUE; - - if (reply->map_state == XCB_MAP_STATE_VIEWABLE) - att_ret->viewable = EINA_TRUE; - - if (reply->override_redirect) - att_ret->override = EINA_TRUE; - - if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY) - att_ret->input_only = EINA_TRUE; - - if (reply->save_under) - att_ret->save_under = EINA_TRUE; - - att_ret->event_mask.mine = reply->your_event_mask; - att_ret->event_mask.all = reply->all_event_masks; - att_ret->event_mask.no_propagate = reply->do_not_propagate_mask; - att_ret->window_gravity = reply->win_gravity; - att_ret->pixel_gravity = reply->bit_gravity; - att_ret->colormap = reply->colormap; - att_ret->visual = _ecore_xcb_window_find_visual_by_id(reply->visual); - - free(reply); - - gcookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); - greply = xcb_get_geometry_reply(_ecore_xcb_conn, gcookie, NULL); - if (!greply) return EINA_TRUE; - - /* xcb_translate_coordinates_reply_t *trans; */ - /* xcb_query_tree_cookie_t tcookie; */ - /* xcb_query_tree_reply_t *treply; */ - - /* tcookie = xcb_query_tree(_ecore_xcb_conn, win); */ - /* treply = xcb_query_tree_reply(_ecore_xcb_conn, tcookie, NULL); */ - - /* trans = */ - /* xcb_translate_coordinates_reply(_ecore_xcb_conn, */ - /* xcb_translate_coordinates(_ecore_xcb_conn, */ - /* win, treply->parent, greply->x, greply->y), NULL); */ - /* free(treply); */ - - att_ret->root = greply->root; - att_ret->depth = greply->depth; -// att_ret->x = trans->dst_x; -// att_ret->y = trans->dst_y; - att_ret->x = greply->x; - att_ret->y = greply->y; - att_ret->w = greply->width; - att_ret->h = greply->height; - att_ret->border = greply->border_width; - -// free(trans); - - free(greply); - return EINA_TRUE; -} - -/** - * Retrieves the size of the given window. - * @param win The given window. - * @param w Pointer to an integer into which the width is to be stored. - * @param h Pointer to an integer into which the height is to be stored. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_size_get(Ecore_X_Window win, - int *width, - int *height) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - ecore_x_drawable_geometry_get(win, NULL, NULL, width, height); -} - -/** - * Set if a window should be ignored. - * @param win The given window. - * @param ignore if to ignore - */ -EAPI void -ecore_x_window_ignore_set(Ecore_X_Window win, - int ignore) -{ - int i = 0, j = 0, count = 0; - Ecore_X_Window *temp = ignore_list; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (ignore) - { - if (ignore_list) - { - for (i = 0; i < ignore_num; i++) - if (win == ignore_list[i]) return; - - ignore_list = - realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window)); - if (!ignore_list) - { - ignore_list = temp; - return; - } - - ignore_list[ignore_num++] = win; - } - else - { - ignore_num = 0; - ignore_list = malloc(sizeof(Ecore_X_Window)); - if (!ignore_list) return; - ignore_list[ignore_num++] = win; - } - } - else - { - if (!ignore_list) return; - for (count = ignore_num, i = 0, j = 0; i < count; i++) - { - if (win != ignore_list[i]) - ignore_list[j++] = ignore_list[i]; - else - ignore_num--; - } - if (ignore_num <= 0) - { - free(ignore_list); - ignore_list = NULL; - return; - } - - ignore_list = - realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window)); - if (!ignore_list) - ignore_list = temp; - } -} - -/** - * Get the ignore list - * @param num number of windows in the list - * @return list of windows to ignore - */ -EAPI Ecore_X_Window * -ecore_x_window_ignore_list(int *num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (num) *num = ignore_num; - return ignore_list; -} - -/** - * Get a list of all the root windows on the server. - * - * @note The returned array will need to be freed after use. - * @param num_ret Pointer to integer to put number of windows returned in. - * @return An array of all the root windows. @c NULL is returned if memory - * could not be allocated for the list, or if @p num_ret is @c NULL. - */ -EAPI Ecore_X_Window * -ecore_x_window_root_list(int *num_ret) -{ - xcb_screen_iterator_t iter; - uint8_t i, num; - Ecore_X_Window *roots = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!num_ret) return NULL; - if (num_ret) *num_ret = 0; - - /* if (xcb_connection_has_error(_ecore_xcb_conn)) */ - /* { */ - /* DBG("XCB Connection Has Error !!!"); */ - /* return NULL; */ - /* } */ - - num = ecore_x_screen_count_get(); - - iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); - if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL; - if (num_ret) *num_ret = num; - for (i = 0; iter.rem; xcb_screen_next(&iter), i++) - roots[i] = iter.data->root; - - return roots; -} - -EAPI Ecore_X_Window * -ecore_x_window_children_get(Ecore_X_Window win, - int *num) -{ - xcb_query_tree_cookie_t cookie; - xcb_query_tree_reply_t *reply; - Ecore_X_Window *windows = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num) *num = 0; - cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, win); - reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - - if (num) *num = reply->children_len; - if (reply->children_len > 0) - { - windows = malloc(sizeof(Ecore_X_Window) * reply->children_len); - if (windows) - { - unsigned int i = 0; - xcb_window_t *w; - - w = xcb_query_tree_children(reply); - for (i = 0; i < reply->children_len; i++) - windows[i] = w[i]; - } - } - - free(reply); - return windows; -} - -/** - * Retrieves the root window a given window is on. - * @param win The window to get the root window of - * @return The root window of @p win - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_root_get(Ecore_X_Window win) -{ - xcb_get_geometry_cookie_t gcookie; - xcb_get_geometry_reply_t *greply; - Ecore_X_Window window = 0; - - /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */ - CHECK_XCB_CONN; - - gcookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); - greply = xcb_get_geometry_reply(_ecore_xcb_conn, gcookie, NULL); - if (!greply) return 0; - window = greply->root; - free(greply); - - return window; -} - -EAPI Ecore_X_Window -ecore_x_window_root_first_get(void) -{ - return ((xcb_screen_t *)_ecore_xcb_screen)->root; -} - -/** - * Retrieves the geometry of the given window. - * - * Note that the x & y coordingates are relative to your parent. In - * particular for reparenting window managers - relative to you window border. - * If you want screen coordinates either walk the window tree to the root, - * else for ecore_evas applications see ecore_evas_geometry_get(). Elementary - * applications can use elm_win_screen_position_get(). - * - * @param win The given window. - * @param x Pointer to an integer in which the X position is to be stored. - * @param y Pointer to an integer in which the Y position is to be stored. - * @param w Pointer to an integer in which the width is to be stored. - * @param h Pointer to an integer in which the height is to be stored. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - ecore_x_drawable_geometry_get(win, x, y, w, h); -} - -/** - * Retrieves the top, visible window at the given location. - * @param x The given X position. - * @param y The given Y position. - * @return The window at that position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_at_xy_get(int x, - int y) -{ - Ecore_X_Window root, win = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ecore_x_grab(); - win = _ecore_xcb_window_at_xy_get(root, 0, 0, x, y, NULL, 0); - ecore_x_ungrab(); - - return win ? win : root; -} - -/** - * Retrieves the top, visible window at the given location, - * but skips the windows in the list. - * @param x The given X position. - * @param y The given Y position. - * @param skip The list of windows to be skipped. - * @param skip_num The number of windows to be skipped. - * @return The window at that position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_at_xy_with_skip_get(int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Ecore_X_Window root, win = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - ecore_x_grab(); - win = _ecore_xcb_window_at_xy_get(root, 0, 0, x, y, skip, skip_num); - ecore_x_ungrab(); - - return win ? win : root; -} - -EAPI Ecore_X_Window -ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, - int x, - int y) -{ - Ecore_X_Window win = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - ecore_x_grab(); - win = _ecore_xcb_window_at_xy_get(begin, 0, 0, x, y, NULL, 0); - ecore_x_ungrab(); - - return win ? win : begin; -} - -/** - * Retrieves the parent window of the given window. - * @param win The given window. - * @return The parent window of @p win. - * @ingroup Ecore_X_Window_Parent_Group - */ -EAPI Ecore_X_Window -ecore_x_window_parent_get(Ecore_X_Window win) -{ - xcb_query_tree_cookie_t cookie; - xcb_query_tree_reply_t *reply; - Ecore_X_Window window = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -// if (!win) return 0; - cookie = xcb_query_tree(_ecore_xcb_conn, win); - reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - window = reply->parent; - free(reply); - - return window; -} - -/** - * Finds out whether the given window is currently visible. - * @param win The given window. - * @return 1 if the window is visible, otherwise 0. - * @ingroup Ecore_X_Window_Visibility_Group - */ -EAPI int -ecore_x_window_visible_get(Ecore_X_Window win) -{ - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *reply; - int ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); - reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - if (reply->map_state == XCB_MAP_STATE_VIEWABLE) - ret = EINA_TRUE; - - free(reply); - return ret; -} - -EAPI void -ecore_x_window_button_grab(Ecore_X_Window win, - int button, - Ecore_X_Event_Mask mask, - int mod, - int any_mod) -{ - int i = 0; - uint16_t m, locks[8], ev; - uint8_t b; - Ecore_X_Window *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - b = button; - if (b == 0) - b = XCB_BUTTON_INDEX_ANY; - - m = _ecore_xcb_window_modifiers_get(mod); - if (any_mod) m = XCB_MOD_MASK_ANY; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - - ev = mask; - for (i = 0; i < 8; i++) - xcb_grab_button(_ecore_xcb_conn, 0, win, ev, - XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, - XCB_NONE, XCB_NONE, b, m | locks[i]); - - _ecore_xcb_button_grabs_num++; - t = realloc(_ecore_xcb_button_grabs, - _ecore_xcb_button_grabs_num * sizeof(Ecore_X_Window)); - if (!t) return; - - _ecore_xcb_button_grabs = t; - _ecore_xcb_button_grabs[_ecore_xcb_button_grabs_num - 1] = win; -} - -EAPI void -ecore_x_window_button_ungrab(Ecore_X_Window win, - int button, - int mod, - int any_mod) -{ - int i = 0; - uint16_t m = 0, locks[8]; - uint8_t b; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - b = button; - if (b == 0) b = XCB_BUTTON_INDEX_ANY; - - m = _ecore_xcb_window_modifiers_get(mod); - if (any_mod) m = XCB_MOD_MASK_ANY; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - - for (i = 0; i < 8; i++) - xcb_ungrab_button(_ecore_xcb_conn, b, win, m | locks[i]); - - _ecore_xcb_sync_magic_send(1, win); -} - -EAPI void -ecore_x_window_key_grab(Ecore_X_Window win, - const char *key, - int mod, - int any_mod) -{ - xcb_keycode_t keycode = XCB_NO_SYMBOL; - uint16_t m = 0, locks[8]; - int i = 0; - Ecore_X_Window *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - keycode = _ecore_xcb_keymap_string_to_keycode(key); - if (keycode == XCB_NO_SYMBOL) return; - - m = _ecore_xcb_window_modifiers_get(mod); - if (any_mod) m = XCB_MOD_MASK_ANY; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - - for (i = 0; i < 8; i++) - xcb_grab_key(_ecore_xcb_conn, 0, win, m | locks[i], - keycode, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); - _ecore_xcb_key_grabs_num++; - t = realloc(_ecore_xcb_key_grabs, - _ecore_xcb_key_grabs_num * sizeof(Ecore_X_Window)); - if (!t) return; - _ecore_xcb_key_grabs = t; - _ecore_xcb_key_grabs[_ecore_xcb_key_grabs_num - 1] = win; -} - -EAPI void -ecore_x_window_key_ungrab(Ecore_X_Window win, - const char *key, - int mod, - int any_mod) -{ - xcb_keycode_t keycode = XCB_NO_SYMBOL; - uint16_t m = 0, locks[8]; - int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - keycode = _ecore_xcb_keymap_string_to_keycode(key); - if (keycode == XCB_NO_SYMBOL) return; - - m = _ecore_xcb_window_modifiers_get(mod); - if (any_mod) m = XCB_MOD_MASK_ANY; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - - for (i = 0; i < 8; i++) - xcb_ungrab_key(_ecore_xcb_conn, keycode, win, m | locks[i]); - - _ecore_xcb_sync_magic_send(2, win); -} - -/* local functions */ -Ecore_X_Window -_ecore_xcb_window_root_of_screen_get(int screen) -{ - xcb_screen_iterator_t iter; - - CHECK_XCB_CONN; - iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); - for (; iter.rem; --screen, xcb_screen_next(&iter)) - if (screen == 0) - { - xcb_screen_t *s; - - if ((s = iter.data)) - return s->root; - } - return 0; -} - -static Ecore_X_Window -_ecore_xcb_window_argb_internal_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h, - uint8_t override_redirect, - uint8_t save_under) -{ - Ecore_X_Window win = 0; -#ifdef ECORE_XCB_RENDER - uint32_t value_list[10]; - uint32_t value_mask; - uint32_t vis; - Ecore_X_Colormap colormap; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_RENDER - if (parent == 0) - parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - vis = - _ecore_xcb_render_find_visual_id(XCB_RENDER_PICT_TYPE_DIRECT, EINA_TRUE); - - colormap = xcb_generate_id(_ecore_xcb_conn); - xcb_create_colormap(_ecore_xcb_conn, XCB_COLORMAP_ALLOC_NONE, - colormap, parent, vis); - - value_mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | - XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | - XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | - XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE | XCB_CW_COLORMAP); - - value_list[0] = XCB_BACK_PIXMAP_NONE; - value_list[1] = 0; - value_list[2] = XCB_GRAVITY_NORTH_WEST; - value_list[3] = XCB_GRAVITY_NORTH_WEST; - value_list[4] = XCB_BACKING_STORE_NOT_USEFUL; - value_list[5] = override_redirect; - value_list[6] = save_under; - value_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | - XCB_EVENT_MASK_BUTTON_PRESS | - XCB_EVENT_MASK_BUTTON_RELEASE | - XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | - XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | - XCB_EVENT_MASK_VISIBILITY_CHANGE | - XCB_EVENT_MASK_STRUCTURE_NOTIFY | - XCB_EVENT_MASK_FOCUS_CHANGE | - XCB_EVENT_MASK_PROPERTY_CHANGE | - XCB_EVENT_MASK_COLOR_MAP_CHANGE); - value_list[8] = XCB_EVENT_MASK_NO_EVENT; - value_list[9] = colormap; - - win = xcb_generate_id(_ecore_xcb_conn); - xcb_create_window(_ecore_xcb_conn, 32, win, parent, x, y, w, h, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, vis, value_mask, - value_list); - - xcb_free_colormap(_ecore_xcb_conn, colormap); - - if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) - ecore_x_window_defaults_set(win); -#endif - - return win; -} - -static Ecore_X_Window -_ecore_xcb_window_at_xy_get(Ecore_X_Window base, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - xcb_query_tree_cookie_t cookie; - xcb_query_tree_reply_t *reply; - Ecore_X_Window *windows = NULL; - int wx, wy, ww, wh, num, i = 0; - Eina_Bool skipit = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!ecore_x_window_visible_get(base)) return 0; - - ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh); - wx += bx; - wy += by; - - if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh)))) - return 0; - - cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, base); - reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - - num = reply->children_len; - windows = xcb_query_tree_children(reply); - - for (i = (num - 1); i >= 0; --i) - { - skipit = EINA_FALSE; - - if (skip) - { - int j = 0; - - for (j = 0; j < skip_num; j++) - { - if (windows[i] == skip[j]) - { - skipit = EINA_TRUE; - goto onward; - } - } - } -onward: - if (!skipit) - { - Ecore_X_Window child = 0; - - child = - _ecore_xcb_window_at_xy_get(windows[i], - wx, wy, x, y, skip, skip_num); - if (child) - { - if (reply) free(reply); - return child; - } - } - } - - if (reply) free(reply); - return base; -} - -Ecore_X_Visual -_ecore_xcb_window_visual_get(Ecore_X_Window win) -{ - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *reply; - Ecore_X_Visual visual = 0; - - CHECK_XCB_CONN; - - cookie = xcb_get_window_attributes(_ecore_xcb_conn, win); - reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - visual = _ecore_xcb_window_find_visual_by_id(reply->visual); - free(reply); - - return visual; -} - -void -_ecore_xcb_window_button_grab_remove(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (_ecore_xcb_button_grabs_num > 0) - { - int i = 0, shuffle = 0; - - for (i = 0; i < _ecore_xcb_button_grabs_num; i++) - { - if (shuffle) - _ecore_xcb_button_grabs[i - 1] = _ecore_xcb_button_grabs[i]; - - if ((!shuffle) && (_ecore_xcb_button_grabs[i] == win)) - shuffle = 1; - } - - if (shuffle) - { - Ecore_X_Window *t; - - _ecore_xcb_button_grabs_num--; - if (_ecore_xcb_button_grabs_num <= 0) - { - free(_ecore_xcb_button_grabs); - _ecore_xcb_button_grabs = NULL; - return; - } - - t = realloc(_ecore_xcb_button_grabs, - _ecore_xcb_button_grabs_num * sizeof(Ecore_X_Window)); - if (!t) return; - _ecore_xcb_button_grabs = t; - } - } -} - -void -_ecore_xcb_window_key_grab_remove(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (_ecore_xcb_key_grabs_num > 0) - { - int i = 0, shuffle = 0; - - for (i = 0; i < _ecore_xcb_key_grabs_num; i++) - { - if (shuffle) - _ecore_xcb_key_grabs[i - 1] = _ecore_xcb_key_grabs[i]; - - if ((!shuffle) && (_ecore_xcb_key_grabs[i] == win)) - shuffle = 1; - } - - if (shuffle) - { - Ecore_X_Window *t; - - _ecore_xcb_key_grabs_num--; - if (_ecore_xcb_key_grabs_num <= 0) - { - free(_ecore_xcb_key_grabs); - _ecore_xcb_key_grabs = NULL; - return; - } - - t = realloc(_ecore_xcb_key_grabs, - _ecore_xcb_key_grabs_num * sizeof(Ecore_X_Window)); - if (!t) return; - _ecore_xcb_key_grabs = t; - } - } -} - -void -_ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win, - Ecore_X_Window child_win, - int type, - void *event, - Ecore_X_Time timestamp) -{ - int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - for (i = 0; i < _ecore_xcb_button_grabs_num; i++) - { - if ((_ecore_xcb_button_grabs[i] == event_win) || - (_ecore_xcb_button_grabs[i] == child_win)) - { - Eina_Bool replay = EINA_FALSE; - - if (_ecore_xcb_window_grab_replay_func) - { - replay = - _ecore_xcb_window_grab_replay_func(_ecore_xcb_window_grab_replay_data, - type, event); - } - if (replay) - { - xcb_allow_events(_ecore_xcb_conn, - XCB_ALLOW_REPLAY_POINTER, timestamp); - } - else - { - xcb_allow_events(_ecore_xcb_conn, - XCB_ALLOW_ASYNC_POINTER, timestamp); - } - break; - } - } -} - -static int -_ecore_xcb_window_modifiers_get(unsigned int state) -{ - int xmodifiers = 0; - - if (state & ECORE_EVENT_MODIFIER_SHIFT) - xmodifiers |= ECORE_X_MODIFIER_SHIFT; - if (state & ECORE_EVENT_MODIFIER_CTRL) - xmodifiers |= ECORE_X_MODIFIER_CTRL; - if (state & ECORE_EVENT_MODIFIER_ALT) - xmodifiers |= ECORE_X_MODIFIER_ALT; - if (state & ECORE_EVENT_MODIFIER_WIN) - xmodifiers |= ECORE_X_MODIFIER_WIN; - if (state & ECORE_EVENT_MODIFIER_ALTGR) - xmodifiers |= ECORE_X_MODIFIER_ALTGR; - if (state & ECORE_EVENT_LOCK_SCROLL) - xmodifiers |= ECORE_X_LOCK_SCROLL; - if (state & ECORE_EVENT_LOCK_NUM) - xmodifiers |= ECORE_X_LOCK_NUM; - if (state & ECORE_EVENT_LOCK_CAPS) - xmodifiers |= ECORE_X_LOCK_CAPS; - if (state & ECORE_EVENT_LOCK_SHIFT) - xmodifiers |= ECORE_X_LOCK_SHIFT; - - return xmodifiers; -} - -static xcb_visualtype_t * -_ecore_xcb_window_find_visual_by_id(xcb_visualid_t id) -{ - xcb_depth_iterator_t diter; - xcb_visualtype_iterator_t viter; - - CHECK_XCB_CONN; - diter = xcb_screen_allowed_depths_iterator(_ecore_xcb_screen); - for (; diter.rem; xcb_depth_next(&diter)) - { - viter = xcb_depth_visuals_iterator(diter.data); - for (; viter.rem; xcb_visualtype_next(&viter)) - { - if (viter.data->visual_id == id) - return viter.data; - } - } - return 0; -} diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c b/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c deleted file mode 100644 index d3a049b..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c +++ /dev/null @@ -1,689 +0,0 @@ -#include "ecore_xcb_private.h" -#include - -EAPI int -ecore_x_window_prop_card32_get(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int *val, - unsigned int len) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - int num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, - ECORE_X_ATOM_CARDINAL, 0, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return -1; - - if ((reply->type != ECORE_X_ATOM_CARDINAL) || (reply->format != 32)) - num = -1; - else if (reply->value_len == 0) - num = 0; - else - { - if (reply->value_len < len) - len = reply->value_len; - - if (val) - { - unsigned int i = 0; - unsigned char *v; - - v = xcb_get_property_value(reply); - for (i = 0; i < len; i++) - val[i] = ((uint32_t *)v)[i]; - num = len; - } - } - - if (reply) free(reply); - return num; -} - -EAPI void -ecore_x_window_prop_card32_set(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int *val, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#if SIZEOF_INT == SIZEOF_LONG - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, - ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)val); -// ecore_x_flush(); -#else - long *v2; - unsigned int i; - - v2 = malloc(num * sizeof(long)); - if (!v2) return; - for (i = 0; i < num; i++) - v2[i] = val[i]; - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, - ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)v2); - free(v2); -// ecore_x_flush(); -#endif -} - -EAPI int -ecore_x_window_prop_card32_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int **list) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - int num = -1; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (list) *list = NULL; - - cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, - XCB_ATOM_CARDINAL, 0, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return -1; - - if ((reply->type != XCB_ATOM_CARDINAL) || (reply->format != 32)) - num = -1; - else if ((reply->value_len == 0) || (!xcb_get_property_value(reply))) - num = 0; - else - { - num = reply->value_len; - if (list) - { - unsigned int *val; - void *data; - int i = 0; - - val = malloc(num * sizeof(unsigned int)); - if (!val) - { - free(reply); - return -1; - } - data = xcb_get_property_value(reply); - for (i = 0; i < num; i++) - val[i] = ((uint32_t *)data)[i]; - *list = val; - } - } - - free(reply); - return num; -} - -EAPI int -ecore_x_window_prop_atom_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom *list, - unsigned int len) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len); -} - -EAPI void -ecore_x_window_prop_atom_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom *list, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - /* xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, */ - /* ECORE_X_ATOM_ATOM, 32, num, list); */ - ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num); -} - -EAPI void -ecore_x_window_prop_xid_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID *xids, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#if SIZEOF_INT == SIZEOF_LONG - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, - type, 32, num, (unsigned char *)xids); -// ecore_x_flush(); -#else - long *v2; - unsigned int i; - - v2 = malloc(num * sizeof(long)); - if (!v2) return; - for (i = 0; i < num; i++) - v2[i] = xids[i]; - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, - type, 32, num, (unsigned char *)v2); - free(v2); -// ecore_x_flush(); -#endif -} - -EAPI int -ecore_x_window_prop_xid_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID *xids, - unsigned int len) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - int num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - num = len; - cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type, - 0, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return -1; - - if ((reply->type != type) || (reply->format != 32)) - num = -1; - else if (reply->value_len == 0) - num = 0; - else - { - unsigned int i = 0; - unsigned char *v; - - if (reply->value_len < len) - len = reply->value_len; - - v = xcb_get_property_value(reply); - for (i = 0; i < len; i++) - xids[i] = ((uint32_t *)v)[i]; - - num = len; - } - - if (reply) free(reply); - return num; -} - -EAPI void -ecore_x_window_prop_string_set(Ecore_X_Window win, - Ecore_X_Atom type, - const char *str) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, type, - ECORE_X_ATOM_UTF8_STRING, 8, strlen(str), str); -// ecore_x_flush(); -} - -EAPI char * -ecore_x_window_prop_string_get(Ecore_X_Window win, - Ecore_X_Atom type) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - char *str = NULL; - int len = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - cookie = - xcb_get_property_unchecked(_ecore_xcb_conn, 0, - win ? win : ((xcb_screen_t *)_ecore_xcb_screen)->root, - type, XCB_GET_PROPERTY_TYPE_ANY, 0, 1000000L); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - - len = ((reply->value_len * reply->format) / 8); - str = (char *)malloc((len + 1) * sizeof(char)); - memcpy(str, xcb_get_property_value(reply), len); - str[len] = '\0'; - - if (reply->type != ECORE_X_ATOM_UTF8_STRING) - { - Ecore_Xcb_Textproperty prop; - int count = 0; - char **list = NULL; - Eina_Bool ret = EINA_FALSE; - - prop.value = strdup(str); - prop.nitems = len; - prop.encoding = reply->type; - -#ifdef HAVE_ICONV - ret = _ecore_xcb_utf8_textproperty_to_textlist(&prop, &list, &count); -#else - ret = _ecore_xcb_mb_textproperty_to_textlist(&prop, &list, &count); -#endif - if (ret) - { - if (count > 0) - str = strdup(list[0]); - else - str = strdup((char *)prop.value); - - if (list) free(list); - } - else - str = strdup((char *)prop.value); - } - - free(reply); - return str; -} - -EAPI int -ecore_x_window_prop_window_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Window *list, - unsigned int len) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len); -} - -EAPI void -ecore_x_window_prop_window_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Window *list, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num); -} - -EAPI int -ecore_x_window_prop_window_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Window **plst) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plst); -} - -EAPI Ecore_X_Atom -ecore_x_window_prop_any_type(void) -{ - return XCB_ATOM_ANY; -} - -EAPI void -ecore_x_window_prop_property_del(Ecore_X_Window win, - Ecore_X_Atom property) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - xcb_delete_property(_ecore_xcb_conn, win, property); -} - -EAPI void -ecore_x_window_prop_property_set(Ecore_X_Window win, - Ecore_X_Atom property, - Ecore_X_Atom type, - int size, - void *data, - int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (win == 0) - win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - if (size != 32) - { - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - property, type, size, num, (unsigned char *)data); -// ecore_x_flush(); - } - else - { - uint32_t *dat; - int i = 0, *ptr; - - dat = malloc(sizeof(uint32_t) * num); - if (dat) - { - for (ptr = (int *)data, i = 0; i < num; i++) - dat[i] = ptr[i]; - xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, - property, type, size, num, - (unsigned char *)dat); - free(dat); -// ecore_x_flush(); - } - } -} - -EAPI int -ecore_x_window_prop_property_get(Ecore_X_Window win, - Ecore_X_Atom property, - Ecore_X_Atom type, - int size, - unsigned char **data, - int *num) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - int format = 0; - unsigned int i = 0; - void *value; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num) *num = 0; - - if (data) - *data = NULL; - else - return 0; - - if (win == 0) - win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - cookie = - xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, - property, type, 0, UINT_MAX); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - if ((reply->format != size) || (reply->value_len == 0)) - { - free(reply); - return 0; - } - - if (!(*data = malloc(reply->value_len * reply->format / 8))) - { - free(reply); - return 0; - } - - value = xcb_get_property_value(reply); - switch (reply->format) - { - case 8: - for (i = 0; i < reply->value_len; i++) - (*data)[i] = ((unsigned char *)value)[i]; - break; - - case 16: - for (i = 0; i < reply->value_len; i++) - ((unsigned short *)*data)[i] = ((unsigned short *)value)[i]; - break; - - case 32: - for (i = 0; i < reply->value_len; i++) - ((unsigned int *)*data)[i] = ((uint32_t *)value)[i]; - break; - } - - if (num) *num = reply->value_len; - format = reply->format; - free(reply); - return format; -} - -EAPI int -ecore_x_window_prop_atom_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom **list) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, list); -} - -EAPI void -ecore_x_window_prop_atom_list_change(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom item, - int op) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op); -} - -EAPI int -ecore_x_window_prop_xid_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID **xids) -{ - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *reply; - int num = -1; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (xids) *xids = NULL; - - cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type, - 0, 0x7fffffff); - reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return -1; - - if ((reply->type != type) || (reply->format != 32)) - num = -1; - else if ((reply->value_len == 0) || (!xcb_get_property_value(reply))) - num = 0; - else - { - Ecore_X_Atom *alst; - void *val; - - num = xcb_get_property_value_length(reply); - val = xcb_get_property_value(reply); - alst = malloc(num * sizeof(Ecore_X_ID)); - if (alst) - { - int i = 0; - - for (i = 0; i < num; i++) - alst[i] = ((uint32_t *)val)[i]; - *xids = alst; - } - } - - free(reply); - return num; -} - -EAPI void -ecore_x_window_prop_xid_list_change(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID item, - int op) -{ - Ecore_X_ID *lst, *temp; - int i = 0, num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst); - if (num < 0) return; - - for (i = 0; i < num; i++) - { - if (lst[i] == item) break; - } - - if (i < num) - { - if (op == ECORE_X_PROP_LIST_ADD) - goto done; - num--; - for (; i < num; i++) - lst[i] = lst[i + 1]; - } - else - { - if (op == ECORE_X_PROP_LIST_REMOVE) - goto done; - num++; - temp = lst; - lst = realloc(lst, num * sizeof(Ecore_X_ID)); - if (lst) - lst[i] = item; - else - lst = temp; - } - ecore_x_window_prop_xid_set(win, atom, type, lst, num); - -done: - if (lst) free(lst); -} - -EAPI Eina_Bool -ecore_x_window_prop_protocol_isset(Ecore_X_Window win, - Ecore_X_WM_Protocol protocol) -{ - Eina_Bool ret = EINA_FALSE; - Ecore_X_Atom proto; - xcb_icccm_get_wm_protocols_reply_t protos; - xcb_get_property_cookie_t cookie; - uint8_t reply; - uint32_t count = 0, i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE; - - proto = _ecore_xcb_atoms_wm_protocol[protocol]; - cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, - ECORE_X_ATOM_WM_PROTOCOLS); - reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, - &protos, NULL); - if (!reply) return EINA_FALSE; - - count = protos.atoms_len; - for (i = 0; i < count; i++) - { - if (protos.atoms[i] == proto) - { - ret = EINA_TRUE; - break; - } - } - - xcb_icccm_get_wm_protocols_reply_wipe(&protos); - - return ret; -} - -EAPI Ecore_X_WM_Protocol * -ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, - int *num_ret) -{ - xcb_icccm_get_wm_protocols_reply_t protos; - xcb_get_property_cookie_t cookie; - uint8_t reply; - uint32_t count = 0, i = 0; - Ecore_X_WM_Protocol *prot_ret = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!num_ret) return NULL; - - *num_ret = 0; - - cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, - ECORE_X_ATOM_WM_PROTOCOLS); - reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, - &protos, NULL); - if (!reply) return NULL; - - count = protos.atoms_len; - if (count <= 0) - { - xcb_icccm_get_wm_protocols_reply_wipe(&protos); - return NULL; - } - - prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol)); - if (!prot_ret) - { - xcb_icccm_get_wm_protocols_reply_wipe(&protos); - return NULL; - } - - for (i = 0; i < count; i++) - { - Ecore_X_WM_Protocol j; - - prot_ret[i] = -1; - for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++) - { - if (_ecore_xcb_atoms_wm_protocol[j] == protos.atoms[i]) - prot_ret[i] = j; - } - } - - if (num_ret) *num_ret = count; - - xcb_icccm_get_wm_protocols_reply_wipe(&protos); - return prot_ret; -} - -EAPI Ecore_X_Atom * -ecore_x_window_prop_list(Ecore_X_Window win, - int *num) -{ - xcb_list_properties_cookie_t cookie; - xcb_list_properties_reply_t *reply; - xcb_atom_t *atm; - Ecore_X_Atom *atoms; - int i = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num) *num = 0; - - cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, win); - reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - - atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom)); - if (!atoms) - { - free(reply); - return NULL; - } - - atm = xcb_list_properties_atoms(reply); - for (i = 0; i < reply->atoms_len; i++) - atoms[i] = atm[i]; - - if (num) *num = reply->atoms_len; - free(reply); - - return atoms; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c b/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c deleted file mode 100644 index d46e306..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c +++ /dev/null @@ -1,410 +0,0 @@ -#include "ecore_xcb_private.h" - -typedef struct _Shadow Shadow; -struct _Shadow -{ - Shadow *parent, **children; - Ecore_X_Window win; - int children_num; - short x, y; - unsigned short w, h; -}; - -static Eina_Bool _inside_rects(Shadow *s, - int x, - int y, - int bx, - int by, - Ecore_X_Rectangle *rects, - int num); - -//static int shadow_count = 0; -static Shadow **shadow_base = NULL; -static int shadow_num = 0; - -/* FIXME: round trips */ -static Shadow * -_ecore_x_window_tree_walk(Ecore_X_Window window) -{ - Shadow *s, **sl; - xcb_get_window_attributes_reply_t *reply_attr; - xcb_get_geometry_reply_t *reply_geom; - xcb_query_tree_reply_t *reply_tree; - xcb_get_window_attributes_cookie_t cookie_attr; - xcb_get_geometry_cookie_t cookie_geom; - xcb_query_tree_cookie_t cookie_tree; - int i, j; - - CHECK_XCB_CONN; - - cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window); - reply_attr = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie_attr, NULL); - if (!reply_attr) return NULL; - if (reply_attr->map_state != XCB_MAP_STATE_VIEWABLE) - { - free(reply_attr); - return NULL; - } - - free(reply_attr); - - cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window); - reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL); - if (!reply_geom) return NULL; - - if (!(s = calloc(1, sizeof(Shadow)))) - { - free(reply_geom); - return NULL; - } - - s->win = window; - s->x = reply_geom->x; - s->y = reply_geom->y; - s->w = reply_geom->width; - s->h = reply_geom->height; - - free(reply_geom); - - cookie_tree = xcb_query_tree_unchecked(_ecore_xcb_conn, window); - reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL); - if (reply_tree) - { - xcb_window_t *list; - int num; - - num = xcb_query_tree_children_length(reply_tree); - list = xcb_query_tree_children(reply_tree); - - s->children = calloc(1, sizeof(Shadow *) * num); - if (s->children) - { - s->children_num = num; - for (i = 0; i < num; i++) - { - s->children[i] = _ecore_x_window_tree_walk(list[i]); - if (s->children[i]) - s->children[i]->parent = s; - } - /* compress list down */ - j = 0; - for (i = 0; i < num; i++) - { - if (s->children[i]) - { - s->children[j] = s->children[i]; - j++; - } - } - if (j == 0) - { - free(s->children); - s->children = NULL; - s->children_num = 0; - } - else - { - s->children_num = j; - sl = realloc(s->children, sizeof(Shadow *) * j); - if (sl) s->children = sl; - } - } - - free(reply_tree); - } - - return s; -} - -static void -_ecore_x_window_tree_shadow_free1(Shadow *s) -{ - int i = 0; - - if (!s) return; - if (s->children) - { - for (i = 0; i < s->children_num; i++) - { - if (s->children[i]) - _ecore_x_window_tree_shadow_free1(s->children[i]); - } - free(s->children); - } - - free(s); -} - -static void -_ecore_x_window_tree_shadow_free(void) -{ - int i = 0; - - if (!shadow_base) return; - - for (i = 0; i < shadow_num; i++) - { - if (!shadow_base[i]) continue; - _ecore_x_window_tree_shadow_free1(shadow_base[i]); - } - free(shadow_base); - shadow_base = NULL; - shadow_num = 0; -} - -static void -_ecore_x_window_tree_shadow_populate(void) -{ - Ecore_X_Window *roots = NULL; - int i = 0, num = 0; - - if ((roots = ecore_x_window_root_list(&num))) - { - shadow_base = calloc(1, sizeof(Shadow *) * num); - if (shadow_base) - { - shadow_num = num; - for (i = 0; i < num; i++) - shadow_base[i] = _ecore_x_window_tree_walk(roots[i]); - } - - free(roots); - } -} - -/* - static void - _ecore_x_window_tree_shadow_start(void) - { - shadow_count++; - if (shadow_count > 1) return; - _ecore_x_window_tree_shadow_populate(); - } - - static void - _ecore_x_window_tree_shadow_stop(void) - { - shadow_count--; - if (shadow_count != 0) return; - _ecore_x_window_tree_shadow_free(); - } - */ - -Shadow * -_ecore_x_window_shadow_tree_find_shadow(Shadow *s, - Ecore_X_Window win) -{ - Shadow *ss; - int i = 0; - - if (s->win == win) return s; - - if (s->children) - { - for (i = 0; i < s->children_num; i++) - { - if (!s->children[i]) continue; - - if ((ss = - _ecore_x_window_shadow_tree_find_shadow(s->children[i], win))) - return ss; - } - } - - return NULL; -} - -Shadow * -_ecore_x_window_shadow_tree_find(Ecore_X_Window base) -{ - Shadow *s; - int i = 0; - - for (i = 0; i < shadow_num; i++) - { - if (!shadow_base[i]) continue; - - if ((s = - _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base))) - return s; - } - return NULL; -} - -static Ecore_X_Window -_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Ecore_X_Window child; - Ecore_X_Rectangle *rects; - int i = 0, j = 0, wx = 0, wy = 0, num = 0; - - wx = s->x + bx; - wy = s->y + by; - if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h)))) - return 0; - - rects = ecore_x_window_shape_rectangles_get(s->win, &num); - if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; - num = 0; - rects = ecore_x_window_shape_input_rectangles_get(s->win, &num); - if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; - - if (s->children) - { - int skipit = 0; - - for (i = s->children_num - 1; i >= 0; --i) - { - if (!s->children[i]) continue; - - skipit = 0; - if (skip) - { - for (j = 0; j < skip_num; j++) - { - if (s->children[i]->win == skip[j]) - { - skipit = 1; - goto onward; - } - } - } -onward: - if (!skipit) - { - if ((child = - _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num))) - return child; - } - } - } - - return s->win; -} - -static Ecore_X_Window -_ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Shadow *s; - - if (!shadow_base) - { - _ecore_x_window_tree_shadow_populate(); - if (!shadow_base) return 0; - } - - s = _ecore_x_window_shadow_tree_find(base); - if (!s) return 0; - - return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num); -} - -static Eina_Bool -_inside_rects(Shadow *s, - int x, - int y, - int bx, - int by, - Ecore_X_Rectangle *rects, - int num) -{ - Eina_Bool inside = EINA_FALSE; - int i = 0; - - if (!rects) return EINA_FALSE; - for (i = 0; i < num; i++) - { - if ((x >= s->x + bx + rects[i].x) && - (y >= s->y + by + rects[i].y) && - (x < (int)(s->x + bx + rects[i].x + rects[i].width)) && - (y < (int)(s->y + by + rects[i].y + rects[i].height))) - { - inside = EINA_TRUE; - break; - } - } - free(rects); - return inside; -} - -/** - * Retrieves the top, visible window at the given location, - * but skips the windows in the list. This uses a shadow tree built from the - * window tree that is only updated the first time - * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time - * it is called after a ecore_x_window_shadow_tree_flush() - * @param base The base window to start searching from (normally root). - * @param x The given X position. - * @param y The given Y position. - * @param skip The list of windows to be skipped. - * @param skip_num The number of windows to be skipped. - * @return The window at the desired position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num); -} - -/** - * Retrieves the parent window a given window has. This uses the shadow window - * tree. - * @param root The root window of @p win - if 0, this will be automatically determined with extra processing overhead - * @param win The window to get the parent window of - * @return The parent window of @p win - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_shadow_parent_get(Ecore_X_Window root EINA_UNUSED, - Ecore_X_Window win) -{ - Shadow *s; - int i = 0; - - if (!shadow_base) - { - _ecore_x_window_tree_shadow_populate(); - if (!shadow_base) return 0; - } - - for (i = 0; i < shadow_num; i++) - { - if (!shadow_base[i]) continue; - - s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win); - if (s) - { - if (!s->parent) return 0; - return s->parent->win; - } - } - return 0; -} - -/** - * Flushes the window shadow tree so nothing is stored. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_shadow_tree_flush(void) -{ - _ecore_x_window_tree_shadow_free(); -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c b/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c deleted file mode 100644 index 667457a..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c +++ /dev/null @@ -1,791 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_SHAPE -# include -#endif - -/** - * @defgroup Ecore_X_Window_Shape X Window Shape Functions - * @ingroup Ecore_X_Group - * - * These functions use the shape extension of the X server to change - * shape of given windows. - */ - -/** - * Sets the input shape of the given window to that given by the pixmap @p mask. - * @param win The given window. - * @param mask A 1-bit depth pixmap that provides the new input shape of the - * window. - * @ingroup Ecore_X_Window_Shape - */ -EAPI void -ecore_x_window_shape_input_mask_set(Ecore_X_Window win, - Ecore_X_Pixmap mask) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, - win, 0, 0, mask); -// ecore_x_flush(); -#else - return; - win = 0; - mask = 0; -#endif -} - -/** - * Sets the shape of the given window to that given by the pixmap @p mask. - * @param win The given window. - * @param mask A 2-bit depth pixmap that provides the new shape of the - * window. - * @ingroup Ecore_X_Window_Shape - */ -EAPI void -ecore_x_window_shape_mask_set(Ecore_X_Window win, - Ecore_X_Pixmap mask) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, - win, 0, 0, mask); -// ecore_x_flush(); -#else - return; - win = 0; - mask = 0; -#endif -} - -EAPI void -ecore_x_window_shape_window_set(Ecore_X_Window win, - Ecore_X_Window shape_win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, - XCB_SHAPE_SK_BOUNDING, win, 0, 0, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; -#endif -} - -EAPI void -ecore_x_window_shape_window_set_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, - XCB_SHAPE_SK_BOUNDING, win, x, y, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; - x = 0; - y = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, - XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangles_set(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t *rect = NULL; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!rects) return; - -#ifdef ECORE_XCB_SHAPE - if (num > 0) - { - int i = 0; - - if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) - return; - - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, - XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, num, (xcb_rectangle_t *)rect); - - if (rect) free(rect); -// ecore_x_flush(); -#else - return; - win = 0; - num = 0; - rects = NULL; -#endif -} - -EAPI void -ecore_x_window_shape_window_add(Ecore_X_Window win, - Ecore_X_Window shape_win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, - XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, - win, 0, 0, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; -#endif -} - -EAPI void -ecore_x_window_shape_window_add_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, - XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, - win, x, y, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; - x = 0; - y = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_add(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, - XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT, - XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT, - XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangles_add(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t *rect = NULL; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - if (num > 0) - { - int i = 0; - - if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) - return; - - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, - XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, num, (xcb_rectangle_t *)&rect); - - if (rect) free(rect); -// ecore_x_flush(); -#else - return; - win = 0; - num = 0; - rects = NULL; -#endif -} - -EAPI Ecore_X_Rectangle * -ecore_x_window_shape_rectangles_get(Ecore_X_Window win, - int *num_ret) -{ - Ecore_X_Rectangle *rects = NULL; -#ifdef ECORE_XCB_SHAPE - xcb_shape_get_rectangles_cookie_t cookie; - xcb_shape_get_rectangles_reply_t *reply; - xcb_rectangle_t *r; - unsigned int i = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num_ret) *num_ret = 0; - -#ifdef ECORE_XCB_SHAPE - cookie = - xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_BOUNDING); - reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - if (num_ret) *num_ret = reply->rectangles_len; - - if (reply->rectangles_len < 1) - { - free(reply); - if (num_ret) *num_ret = 0; - return NULL; - } - - rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len); - if (!rects) - { - free(reply); - if (num_ret) *num_ret = 0; - return NULL; - } - r = xcb_shape_get_rectangles_rectangles(reply); - for (i = 0; i < reply->rectangles_len; i++) - { - rects[i].x = r[i].x; - rects[i].y = r[i].y; - rects[i].width = r[i].width; - rects[i].height = r[i].height; - } - - free(reply); - - return rects; -#else - return rects; - win = 0; -#endif -} - -EAPI void -ecore_x_window_shape_events_select(Ecore_X_Window win, - Eina_Bool on) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_select_input(_ecore_xcb_conn, win, on); -// ecore_x_flush(); -#else - return; - win = 0; - on = 0; -#endif -} - -EAPI Ecore_X_Rectangle * -ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, - int *num_ret) -{ - Ecore_X_Rectangle *rects = NULL; -#ifdef ECORE_XCB_SHAPE - xcb_shape_get_rectangles_cookie_t cookie; - xcb_shape_get_rectangles_reply_t *reply; - xcb_rectangle_t *r; - unsigned int i = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num_ret) *num_ret = 0; - -#ifdef ECORE_XCB_SHAPE - cookie = - xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_INPUT); - reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - if (num_ret) *num_ret = reply->rectangles_len; - - if (reply->rectangles_len < 1) - { - free(reply); - if (num_ret) *num_ret = 0; - return NULL; - } - - rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len); - if (!rects) - { - free(reply); - if (num_ret) *num_ret = 0; - return NULL; - } - r = xcb_shape_get_rectangles_rectangles(reply); - for (i = 0; i < reply->rectangles_len; i++) - { - rects[i].x = r[i].x; - rects[i].y = r[i].y; - rects[i].width = r[i].width; - rects[i].height = r[i].height; - } - - free(reply); - - return rects; -#else - xcb_get_geometry_cookie_t cookie; - xcb_get_geometry_reply_t *reply; - - if (!(rects = malloc(sizeof(Ecore_X_Rectangle)))) - return NULL; - - /* get geometry */ - cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); - reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - rects[0].x = reply->x; - rects[0].y = reply->y; - rects[0].width = reply->width; - rects[0].height = reply->height; - free(reply); - } - if (num_ret) *num_ret = 1; - return rects; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t *rect = NULL; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!rects) return; - -#ifdef ECORE_XCB_SHAPE - if (num > 0) - { - int i = 0; - - if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) - return; - - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, - XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, num, (xcb_rectangle_t *)rect); - - if (rect) free(rect); -// ecore_x_flush(); -#else - return; - win = 0; - num = 0; - rects = NULL; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT, - XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, - XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, - XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, - XCB_SHAPE_SK_INPUT, win, x, y, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; - x = 0; - y = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_INPUT, - XCB_SHAPE_SK_INPUT, win, x, y, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; - x = 0; - y = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_window_set(Ecore_X_Window win, - Ecore_X_Window shape_win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, - XCB_SHAPE_SK_INPUT, win, 0, 0, shape_win); -// ecore_x_flush(); -#else - return; - win = 0; - shape_win = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t rect; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT, - XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, 1, &rect); -// ecore_x_flush(); -#else - return; - win = 0; - x = 0; - y = 0; - w = 0; - h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XCB_SHAPE - xcb_rectangle_t *rect = NULL; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - -#ifdef ECORE_XCB_SHAPE - if (num > 0) - { - int i = 0; - - if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) - return; - - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - - xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, - XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, - win, 0, 0, num, (xcb_rectangle_t *)&rect); - - if (rect) free(rect); -// ecore_x_flush(); -#else - return; - win = 0; - num = 0; - rects = NULL; -#endif -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c b/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c deleted file mode 100644 index 30184f3..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c +++ /dev/null @@ -1,120 +0,0 @@ -#include "ecore_xcb_private.h" -#include -#include -#include - -/* local function prototypes */ -static Eina_Bool _ecore_xcb_xdefaults_glob_match(const char *str, - const char *glob); - -/* local variables */ -static Eina_File *_ecore_xcb_xdefaults_file = NULL; -static char *_ecore_xcb_xdefaults_data = NULL; - -void -_ecore_xcb_xdefaults_init(void) -{ - char buff[PATH_MAX]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (eina_environment_home_get()) - snprintf(buff, sizeof(buff), "%s/.Xdefaults", eina_environment_home_get()); - else return; - if ((_ecore_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE))) - { - eina_mmap_safety_enabled_set(EINA_TRUE); - - _ecore_xcb_xdefaults_data = - eina_file_map_all(_ecore_xcb_xdefaults_file, EINA_FILE_SEQUENTIAL); - } -} - -void -_ecore_xcb_xdefaults_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!_ecore_xcb_xdefaults_file) return; - if (_ecore_xcb_xdefaults_data) - eina_file_map_free(_ecore_xcb_xdefaults_file, _ecore_xcb_xdefaults_data); - if (_ecore_xcb_xdefaults_file) eina_file_close(_ecore_xcb_xdefaults_file); -} - -char * -_ecore_xcb_xdefaults_string_get(const char *prog, - const char *param) -{ - char buff[1024], ret[1024]; - char *str = NULL; - char **ea = NULL; - unsigned int count = 0, i = 0; - - if ((!_ecore_xcb_xdefaults_data) || (!_ecore_xcb_xdefaults_file)) - return NULL; - - snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param); - - str = _ecore_xcb_xdefaults_data; - ea = eina_str_split_full(str, "\n", -1, &count); - for (i = 0; i < count; i++) - { - if (_ecore_xcb_xdefaults_glob_match(ea[i], buff)) - sscanf(ea[i], "%*[^:]:%*[ ]%s", ret); - } - if ((ea) && (ea[0])) - { - free(ea[0]); - free(ea); - } - - return strdup(ret); -} - -int -_ecore_xcb_xdefaults_int_get(const char *prog, - const char *param) -{ - char buff[1024]; - char *str = NULL; - char **ea = NULL; - unsigned int count = 0, i = 0; - int ret = -1; - - if ((!_ecore_xcb_xdefaults_data) || (!_ecore_xcb_xdefaults_file)) - return 0; - - snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param); - - str = _ecore_xcb_xdefaults_data; - ea = eina_str_split_full(str, "\n", -1, &count); - for (i = 0; i < count; i++) - { - if (_ecore_xcb_xdefaults_glob_match(ea[i], buff)) - sscanf(ea[i], "%*[^:]:%*[ ]%d", &ret); - } - if ((ea) && (ea[0])) - { - free(ea[0]); - free(ea); - } - - return ret; -} - -/* local functions */ -static Eina_Bool -_ecore_xcb_xdefaults_glob_match(const char *str, - const char *glob) -{ - if ((!str) || (!glob)) return EINA_FALSE; - if (glob[0] == 0) - { - if (str[0] == 0) return EINA_TRUE; - return EINA_FALSE; - } - if (!strcmp(glob, "*")) return EINA_TRUE; - if (!fnmatch(glob, str, 0)) return EINA_TRUE; - return EINA_FALSE; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c b/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c deleted file mode 100644 index 257c617..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c +++ /dev/null @@ -1,745 +0,0 @@ -#include "ecore_xcb_private.h" -# ifdef ECORE_XCB_XFIXES -# include -# endif - -/* local function prototypes */ -static xcb_rectangle_t *_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, - int num); -static Ecore_X_Rectangle *_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, - int num); - -/* local variables */ -static Eina_Bool _xfixes_avail = EINA_FALSE; - -/* external variables */ -int _ecore_xcb_event_xfixes = -1; - -void -_ecore_xcb_xfixes_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XFIXES - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xfixes_id); -#endif -} - -void -_ecore_xcb_xfixes_finalize(void) -{ -#ifdef ECORE_XCB_XFIXES - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XFIXES - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xfixes_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_xfixes_query_version_cookie_t cookie; - xcb_xfixes_query_version_reply_t *reply; - - cookie = - xcb_xfixes_query_version_unchecked(_ecore_xcb_conn, - XCB_XFIXES_MAJOR_VERSION, - XCB_XFIXES_MINOR_VERSION); - reply = xcb_xfixes_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - /* NB: XFixes Extension >= 3 needed for shape stuff. - * for now, I am removing this check so that it matches the - * xlib code closer. If the extension version ends up being - * that important, then re-enable this */ - - /* if (reply->major_version >= 3) */ - _xfixes_avail = EINA_TRUE; - free(reply); - } - - if (_xfixes_avail) - _ecore_xcb_event_xfixes = ext_reply->first_event; - } -#endif -} - -EAPI Eina_Bool -ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection) -{ -#ifdef ECORE_XCB_XFIXES - Ecore_X_Window root = 0; - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; - int mask = 0; -#endif - - CHECK_XCB_CONN; - - if (!_xfixes_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_XFIXES - root = ((xcb_screen_t *)_ecore_xcb_screen)->root; - - mask = (XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER | - XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY | - XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE); - - cookie = - xcb_xfixes_select_selection_input_checked(_ecore_xcb_conn, root, - selection, mask); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - - return EINA_TRUE; -#endif - return EINA_FALSE; -} - -Eina_Bool -_ecore_xcb_xfixes_avail_get(void) -{ - return _xfixes_avail; -} - -/** - * @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions - * @ingroup Ecore_X_Group - * - * Functions related to the X Fixes extension. - */ - -/** - * Create a region from rectangles. - * @param rects The rectangles used to initialize the region. - * @param num The number of rectangles. - * @return The newly created region. - * - * Create a region initialized to the specified list of rectangles - * @p rects. The rectangles may be specified in any order, their union - * becomes the region. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI Ecore_X_Region -ecore_x_region_new(Ecore_X_Rectangle *rects, - int num) -{ - Ecore_X_Region region = 0; -#ifdef ECORE_XCB_XFIXES - xcb_rectangle_t *xrects; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return 0; - -#ifdef ECORE_XCB_XFIXES - xrects = _ecore_xcb_rect_to_xcb(rects, num); - region = xcb_generate_id(_ecore_xcb_conn); - xcb_xfixes_create_region(_ecore_xcb_conn, region, num, xrects); - free(xrects); -// ecore_x_flush(); -#endif - - return region; -} - -/** - * Create a region from a pixmap. - * @param bitmap The bitmap used to initialize the region. - * @return The newly created region. - * - * Creates a region initialized to the set of 'one' pixels in @p bitmap - * (which must be of depth 1, else Match error). - * @ingroup Ecore_X_Fixes_Group - */ -EAPI Ecore_X_Region -ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) -{ - Ecore_X_Region region = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return 0; - -#ifdef ECORE_XCB_XFIXES - region = xcb_generate_id(_ecore_xcb_conn); - xcb_xfixes_create_region_from_bitmap(_ecore_xcb_conn, region, bitmap); -// ecore_x_flush(); -#endif - - return region; -} - -/** - * Create a region from a window. - * @param win The window used to initialize the region. - * @param type The type of the region. - * @return The newly created region. - * - * Creates a region initialized to the specified @p window region. See - * the Shape extension for the definition of Bounding and Clip - * regions. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI Ecore_X_Region -ecore_x_region_new_from_window(Ecore_X_Window win, - Ecore_X_Region_Type type) -{ - Ecore_X_Region region = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return 0; - -#ifdef ECORE_XCB_XFIXES - region = xcb_generate_id(_ecore_xcb_conn); - xcb_xfixes_create_region_from_window(_ecore_xcb_conn, region, win, type); -// ecore_x_flush(); -#endif - - return region; -} - -/** - * Create a region from a graphic context. - * @param gc The graphic context used to initialize the region. - * @return The newly created region. - * - * Creates a region initialized from the clip list of @p gc. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI Ecore_X_Region -ecore_x_region_new_from_gc(Ecore_X_GC gc) -{ - Ecore_X_Region region = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return 0; - -#ifdef ECORE_XCB_XFIXES - region = xcb_generate_id(_ecore_xcb_conn); - xcb_xfixes_create_region_from_gc(_ecore_xcb_conn, region, gc); -// ecore_x_flush(); -#endif - - return region; -} - -/** - * Create a region from a picture. - * @param picture The picture used to initialize the region. - * @return The newly created region. - * - * Creates a region initialized from the clip list of @p picture. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI Ecore_X_Region -ecore_x_region_new_from_picture(Ecore_X_Picture picture) -{ - Ecore_X_Region region = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return 0; - -#ifdef ECORE_XCB_XFIXES - region = xcb_generate_id(_ecore_xcb_conn); - xcb_xfixes_create_region_from_picture(_ecore_xcb_conn, region, picture); -// ecore_x_flush(); -#endif - - return region; -} - -/** - * Destroy a region. - * @param region The region to destroy. - * - * Destroy the specified @p region. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_free(Ecore_X_Region region) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_destroy_region(_ecore_xcb_conn, region); -// ecore_x_flush(); -#endif -} - -/** - * Set the content of a region. - * @param region The region to destroy. - * @param rects The rectangles used to set the region. - * @param num The number of rectangles. - * - * Replace the current contents of @p region with the region formed - * by the union of the rectangles @p rects. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_set(Ecore_X_Region region, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XCB_XFIXES - xcb_rectangle_t *xrects; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xrects = _ecore_xcb_rect_to_xcb(rects, num); - xcb_xfixes_set_region(_ecore_xcb_conn, region, num, xrects); - free(xrects); -// ecore_x_flush(); -#endif -} - -/** - * Copy the content of a region. - * @param dest The destination region. - * @param source The source region. - * - * Replace the contents of @p dest with the contents of @p source. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_copy(Ecore_X_Region dest, - Ecore_X_Region source) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - - // NB: Hmmmm...this may need converting to/fro xcb_rectangle_t -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest); -// ecore_x_flush(); -#endif -} - -/** - * Make the union of two regions. - * @param dest The destination region. - * @param source1 The first source region. - * @param source2 The second source region. - * - * Replace the contents of @p dest with the union of @p source1 and - * @p source2. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_combine(Ecore_X_Region dest, - Ecore_X_Region source1, - Ecore_X_Region source2) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest); -// ecore_x_flush(); -#endif -} - -/** - * Make the intersection of two regions. - * @param dest The destination region. - * @param source1 The first source region. - * @param source2 The second source region. - * - * Replace the contents of @p dest with the intersection of @p source1 and - * @p source2. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_intersect(Ecore_X_Region dest, - Ecore_X_Region source1, - Ecore_X_Region source2) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest); -// ecore_x_flush(); -#endif -} - -/** - * Make the subtraction of two regions. - * @param dest The destination region. - * @param source1 The first source region. - * @param source2 The second source region. - * - * Replace the contents of @p dest with the subtraction of @p source1 by - * @p source2. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_subtract(Ecore_X_Region dest, - Ecore_X_Region source1, - Ecore_X_Region source2) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest); -// ecore_x_flush(); -#endif -} - -/** - * Make the subtraction of regions by bounds. - * @param dest The destination region. - * @param bounds The bounds. - * @param source The source region. - * - * The @p source region is subtracted from the region specified by - * @p bounds. The result is placed in @p dest, replacing its - * contents. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_invert(Ecore_X_Region dest, - Ecore_X_Rectangle *bounds, - Ecore_X_Region source) -{ -#ifdef ECORE_XCB_XFIXES - xcb_rectangle_t xrects; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xrects.x = bounds->x; - xrects.y = bounds->y; - xrects.width = bounds->width; - xrects.height = bounds->height; - - xcb_xfixes_invert_region(_ecore_xcb_conn, source, xrects, dest); -// ecore_x_flush(); -#endif -} - -/** - * Translate a region. - * @param region The region to translate. - * @param dx The horizontal translation. - * @param dy The vertical translation. - * - * The @p region is translated by @p dx and @p dy in place. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_translate(Ecore_X_Region region, - int dx, - int dy) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy); -// ecore_x_flush(); -#endif -} - -/** - * Extent a region. - * @param dest The destination region. - * @param source The source region. - * - * The extents of the @p source region are placed in @p dest. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_extents(Ecore_X_Region dest, - Ecore_X_Region source) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest); -// ecore_x_flush(); -#endif -} - -/** - * Return the rectangles that compose a region. - * @param region The region (Unused). - * @param num The number of returned rectangles. - * @param bounds The returned bounds of the region. - * @return The returned rectangles. - * - * @ingroup Ecore_X_Fixes_Group - */ -EAPI Ecore_X_Rectangle * -ecore_x_region_fetch(Ecore_X_Region region, - int *num, - Ecore_X_Rectangle *bounds) -{ - Ecore_X_Rectangle extents = { 0, 0, 0, 0 }; - Ecore_X_Rectangle *rects = NULL; -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_fetch_region_cookie_t cookie; - xcb_xfixes_fetch_region_reply_t *reply; - xcb_rectangle_t *r; - int n = 0; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (num) *num = 0; - if (bounds) *bounds = extents; - if (!_xfixes_avail) return NULL; - -#ifdef ECORE_XCB_XFIXES - cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region); - reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return NULL; - - r = xcb_xfixes_fetch_region_rectangles(reply); - n = xcb_xfixes_fetch_region_rectangles_length(reply); - rects = _ecore_xcb_rect_to_ecore(r, n); - if (num) *num = n; - - /* rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle)); */ - /* if (!rects) */ - /* { */ - /* free(reply); */ - /* return NULL; */ - /* } */ - - /* for (i = 0; i < n; i++) */ - /* { */ - /* rects[i].x = r[i].x; */ - /* rects[i].y = r[i].y; */ - /* rects[i].width = r[i].width; */ - /* rects[i].height = r[i].height; */ - /* } */ - - (*bounds).x = reply->extents.x; - (*bounds).y = reply->extents.y; - (*bounds).width = reply->extents.width; - (*bounds).height = reply->extents.height; - - free(reply); -#endif - - return rects; -} - -/** - * Expand a region. - * @param dest The destination region. - * @param source The source region. - * @param left The number of pixels to add on the left. - * @param right The number of pixels to add on the right. - * @param top The number of pixels to add at the top. - * @param bottom The number of pixels to add at the bottom. - * - * Put in @p dest the area specified by expanding each rectangle in - * the @p source region by the specified number of pixels to the - * @p left, @p right, @p top and @p bottom. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_expand(Ecore_X_Region dest, - Ecore_X_Region source, - unsigned int left, - unsigned int right, - unsigned int top, - unsigned int bottom) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom); -// ecore_x_flush(); -#endif -} - -/** - * Change clip-mask in a graphic context to the specified region. - * @param region The region to change. - * @param gc The clip-mask graphic context. - * @param x 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. - * Output will be clippped to remain contained within the region. The - * clip origin is interpreted relative to the origin of whatever - * destination drawable is specified in a graphics request. The - * region is interpreted relative to the clip origin. Future changes - * to region have no effect on the gc clip-mask. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_gc_clip_set(Ecore_X_Region region, - Ecore_X_GC gc, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x, y); -// ecore_x_flush(); -#endif -} - -/** - * Change the shape extension of a window. - * @param region The region. - * @param dest The window whose shape is changed. - * @param type The kind of shape. - * @param x 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 - * have no effect on the window shape. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_window_shape_set(Ecore_X_Region region, - Ecore_X_Window dest, - Ecore_X_Shape_Type type, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x, y, region); -// ecore_x_flush(); -#endif -} - -/** - * Change clip-mask in picture to the specified region. - * @param region The region. - * @param picture The picture. - * @param x 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 - * remain contained within the region. The clip origin is interpreted - * relative to the origin of the drawable associated with @p picture. The - * region is interpreted relative to the clip origin. Future changes - * to region have no effect on the picture clip-mask. - * @ingroup Ecore_X_Fixes_Group - */ -EAPI void -ecore_x_region_picture_clip_set(Ecore_X_Region region, - Ecore_X_Picture picture, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xfixes_avail) return; - -#ifdef ECORE_XCB_XFIXES - xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x, y); -// ecore_x_flush(); -#endif -} - -/* local function prototypes */ -static xcb_rectangle_t * -_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, - int num) -{ - xcb_rectangle_t *xrect; - int i = 0; - - if (!num) return NULL; - - xrect = malloc(sizeof(xcb_rectangle_t) * num); - if (!xrect) return NULL; - - for (i = 0; i < num; i++) - { - xrect[i].x = rects[i].x; - xrect[i].y = rects[i].y; - xrect[i].width = rects[i].width; - xrect[i].height = rects[i].height; - } - - return xrect; -} - -static Ecore_X_Rectangle * -_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, - int num) -{ - Ecore_X_Rectangle *erect; - int i = 0; - - if (!num) return NULL; - - erect = malloc(sizeof(Ecore_X_Rectangle) * num); - if (!erect) return NULL; - - for (i = 0; i < num; i++) - { - erect[i].x = rects[i].x; - erect[i].y = rects[i].y; - erect[i].width = rects[i].width; - erect[i].height = rects[i].height; - } - - return erect; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c b/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c deleted file mode 100644 index 37a2339..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c +++ /dev/null @@ -1,139 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_XINERAMA -# include -#endif - -/* local variables */ -static Eina_Bool _xinerama_avail = EINA_FALSE; -static Eina_Bool _xinerama_active = EINA_FALSE; - -void -_ecore_xcb_xinerama_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XINERAMA - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xinerama_id); -#endif -} - -void -_ecore_xcb_xinerama_finalize(void) -{ -#ifdef ECORE_XCB_XINERAMA - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XINERAMA - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xinerama_id); - if ((ext_reply) && (ext_reply->present)) - { - xcb_xinerama_query_version_cookie_t cookie; - xcb_xinerama_query_version_reply_t *reply; - - cookie = - xcb_xinerama_query_version_unchecked(_ecore_xcb_conn, - XCB_XINERAMA_MAJOR_VERSION, - XCB_XINERAMA_MINOR_VERSION); - reply = - xcb_xinerama_query_version_reply(_ecore_xcb_conn, cookie, NULL); - if (reply) - { - _xinerama_avail = EINA_TRUE; - // NB: Do we need to compare version numbers here ? - free(reply); - } - - if (_xinerama_avail) - { - xcb_xinerama_is_active_cookie_t acookie; - xcb_xinerama_is_active_reply_t *areply; - - acookie = xcb_xinerama_is_active_unchecked(_ecore_xcb_conn); - areply = - xcb_xinerama_is_active_reply(_ecore_xcb_conn, acookie, NULL); - if (areply) - { - _xinerama_active = areply->state; - free(areply); - } - } - } -#endif -} - -EAPI int -ecore_x_xinerama_screen_count_get(void) -{ - int count = 0; -#ifdef ECORE_XCB_XINERAMA - xcb_xinerama_query_screens_cookie_t cookie; - xcb_xinerama_query_screens_reply_t *reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_xinerama_avail) return 0; - -#ifdef ECORE_XCB_XINERAMA - cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn); - reply = - xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return 0; - count = reply->number; -#endif - - return count; -} - -EAPI Eina_Bool -ecore_x_xinerama_screen_geometry_get(int screen, - int *x, - int *y, - int *w, - int *h) -{ -#ifdef ECORE_XCB_XINERAMA - xcb_xinerama_query_screens_cookie_t cookie; - xcb_xinerama_query_screens_reply_t *reply; - xcb_xinerama_screen_info_t *info; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels; - if (h) *h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels; - - if (!_xinerama_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_XINERAMA - cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn); - reply = - xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL); - if (!reply) return EINA_FALSE; - - info = xcb_xinerama_query_screens_screen_info(reply); - if (!info) - { - free(reply); - return EINA_FALSE; - } - - if (x) *x = info[screen].x_org; - if (y) *y = info[screen].y_org; - if (w) *w = info[screen].width; - if (h) *h = info[screen].height; - - free(reply); - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xtest.c b/src/lib/ecore_x/xcb/ecore_xcb_xtest.c deleted file mode 100644 index 7f76b2c..0000000 --- a/src/lib/ecore_x/xcb/ecore_xcb_xtest.c +++ /dev/null @@ -1,215 +0,0 @@ -#include "ecore_xcb_private.h" -#ifdef ECORE_XCB_XTEST -# include -# include -#endif - -/* local variables */ -static Eina_Bool _test_avail = EINA_FALSE; - -void -_ecore_xcb_xtest_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XTEST - xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_test_id); -#endif -} - -void -_ecore_xcb_xtest_finalize(void) -{ -#ifdef ECORE_XCB_XTEST - const xcb_query_extension_reply_t *ext_reply; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -#ifdef ECORE_XCB_XTEST - ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_test_id); - if ((ext_reply) && (ext_reply->present)) - _test_avail = EINA_TRUE; -#endif -} - -EAPI Eina_Bool -#ifdef ECORE_XCB_XTEST -ecore_x_test_fake_key_down(const char *key) -#else -ecore_x_test_fake_key_down(const char *key EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XTEST - xcb_keycode_t keycode = 0; - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_test_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_XTEST - keycode = _ecore_xcb_keymap_string_to_keycode(key); - if (keycode == XCB_NO_SYMBOL) return EINA_FALSE; - - cookie = - xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS, - keycode, XCB_CURRENT_TIME, - ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - -EAPI Eina_Bool -#ifdef ECORE_XCB_XTEST -ecore_x_test_fake_key_up(const char *key) -#else -ecore_x_test_fake_key_up(const char *key EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XTEST - xcb_keycode_t keycode = 0; - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_test_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_XTEST - keycode = _ecore_xcb_keymap_string_to_keycode(key); - if (keycode == XCB_NO_SYMBOL) return EINA_FALSE; - - cookie = - xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE, - keycode, XCB_CURRENT_TIME, - ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - return EINA_TRUE; -#endif - - return EINA_FALSE; -} - -EAPI Eina_Bool -#ifdef ECORE_XCB_XTEST -ecore_x_test_fake_key_press(const char *key) -#else -ecore_x_test_fake_key_press(const char *key EINA_UNUSED) -#endif -{ -#ifdef ECORE_XCB_XTEST - xcb_keycode_t keycode = 0; - xcb_keysym_t keysym = 0; - xcb_keycode_t shift_code = 0; - xcb_void_cookie_t cookie; - xcb_generic_error_t *err; - Eina_Bool shift = EINA_FALSE; -#endif - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - CHECK_XCB_CONN; - - if (!_test_avail) return EINA_FALSE; - -#ifdef ECORE_XCB_XTEST - keycode = _ecore_xcb_keymap_string_to_keycode(key); - keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 0); - if (keysym == XCB_NO_SYMBOL) - { - keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 1); - if (keysym != XCB_NO_SYMBOL) - shift = EINA_TRUE; - } - - if (shift) - { - xcb_keycode_t *keycodes; - int i = 0; - - keycodes = _ecore_xcb_keymap_keysym_to_keycode(XK_Shift_L); - while (keycodes[i] != XCB_NO_SYMBOL) - { - if (keycodes[i] != 0) - { - shift_code = keycodes[i]; - break; - } - i++; - } - } - - if (shift) - { - cookie = - xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS, - shift_code, XCB_CURRENT_TIME, - ((xcb_screen_t *)_ecore_xcb_screen)->root, - 0, 0, 0); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - } - - cookie = - xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS, - keycode, XCB_CURRENT_TIME, - ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - cookie = - xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE, - keycode, XCB_CURRENT_TIME, - ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - - if (shift) - { - cookie = - xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE, - shift_code, XCB_CURRENT_TIME, - ((xcb_screen_t *)_ecore_xcb_screen)->root, - 0, 0, 0); - err = xcb_request_check(_ecore_xcb_conn, cookie); - if (err) - { - free(err); - return EINA_FALSE; - } - } - - return EINA_TRUE; -#endif - - return EINA_FALSE; -} diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c index d3c2fcd..4750073 100644 --- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c +++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c @@ -4101,15 +4101,9 @@ ecore_evas_software_x11_new_internal(const char *disp_name, Ecore_X_Window paren redraw_debug = 0; } -# ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB - einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; - einfo->info.connection = ecore_x_connection_get(); - einfo->info.screen = screen; -# else einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; einfo->info.connection = ecore_x_display_get(); einfo->info.screen = NULL; -# endif einfo->info.drawable = ee->prop.window; if (argb) @@ -4309,15 +4303,9 @@ ecore_evas_software_x11_pixmap_new_internal(const char *disp_name, Ecore_X_Windo redraw_debug = 0; } -# ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB - einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; - einfo->info.connection = ecore_x_connection_get(); - einfo->info.screen = screen; -# else einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; einfo->info.connection = ecore_x_display_get(); einfo->info.screen = NULL; -# endif if ((argb) && (ee->prop.window)) { diff --git a/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h b/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h index 6600c5d..f13e55f 100644 --- a/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h +++ b/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h @@ -3,8 +3,7 @@ typedef enum { - EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB, - EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB + EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB } Evas_Engine_Info_Software_X11_Backend; typedef struct _Evas_Engine_Info_Software_X11 Evas_Engine_Info_Software_X11; diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c index 44ad45e..6ef80b4 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.c +++ b/src/modules/evas/engines/software_x11/evas_engine.c @@ -7,26 +7,13 @@ #include "Evas_Engine_Software_X11.h" #include "evas_engine.h" -#ifdef BUILD_ENGINE_SOFTWARE_XLIB -# include "evas_xlib_outbuf.h" -# include "evas_xlib_buffer.h" -# include "evas_xlib_swapbuf.h" -# include "evas_xlib_color.h" -# include "evas_xlib_image.h" -# include "evas_xlib_dri_image.h" -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB -# include "evas_xcb_outbuf.h" -# include "evas_xcb_color.h" -# include "evas_xcb_xdefaults.h" -# include "evas_xcb_image.h" -# include "evas_xcb_buffer.h" -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XLIB +#include "evas_xlib_outbuf.h" +#include "evas_xlib_buffer.h" +#include "evas_xlib_swapbuf.h" +#include "evas_xlib_color.h" +#include "evas_xlib_image.h" +#include "evas_xlib_dri_image.h" #include "evas_x_egl.h" -#endif #include "../software_generic/evas_native_common.h" @@ -60,11 +47,7 @@ struct _Render_Engine }; typedef struct _Region_Push_Hook_Ctx { -#ifdef BUILD_ENGINE_SOFTWARE_XLIB X_Output_Buffer *changed_pixels; -#else - Xcb_Output_Buffer *changed_pixels; -#endif Outbuf *buf; Eina_Spinlock *lock; struct { @@ -97,7 +80,6 @@ _evas_software_x11_region_push_hook_call(void *data) if (eina_list_data_find(_outbufs, ctx->buf)) { -#ifdef BUILD_ENGINE_SOFTWARE_XLIB ctx->region_push_hook.cb(ctx->region_push_hook.evas, ctx->x, ctx->y, ctx->changed_pixels->xim->width, ctx->changed_pixels->xim->height, @@ -105,15 +87,6 @@ _evas_software_x11_region_push_hook_call(void *data) eina_spinlock_take(ctx->lock); evas_software_xlib_x_output_buffer_unref(ctx->changed_pixels, 0); eina_spinlock_release(ctx->lock); -#else - ctx->region_push_hook.cb(ctx->region_push_hook.evas, ctx->x, ctx->y, - ctx->changed_pixels->xim->width, - ctx->changed_pixels->xim->height, - evas_software_xcb_output_buffer_data(ctx->changed_pixels, NULL)); - eina_spinlock_take(ctx->lock); - evas_software_xcb_output_buffer_unref(ctx->changed_pixels, EINA_FALSE); - eina_spinlock_release(ctx->lock); -#endif } free(ctx); } @@ -133,84 +106,13 @@ evas_software_x11_region_push_hook_call(Outbuf *buf, int x, int y, void *out_buf ctx->y = y; ctx->region_push_hook.cb = buf->region_push_hook.cb; ctx->region_push_hook.evas = buf->region_push_hook.evas; -#ifdef BUILD_ENGINE_SOFTWARE_XLIB ctx->changed_pixels = evas_software_xlib_x_output_buffer_ref(out_buf); -#else - ctx->changed_pixels = evas_software_xcb_output_buffer_ref(out_buf); -#endif ctx->buf = buf; ctx->lock = lock; ecore_main_loop_thread_safe_call_async(_evas_software_x11_region_push_hook_call, ctx); } -#ifdef BUILD_ENGINE_SOFTWARE_XLIB - -/* -static void * -_output_egl_setup(int w, int h, int rot, Display *disp, Drawable draw, - Visual *vis, Colormap cmap, int depth, int debug, - int grayscale, int max_colors, Pixmap mask, - int shape_dither, int destination_alpha) -{ - Render_Engine *re; - void *ptr; - int stride = 0; - - if (depth != 32) return NULL; - if (mask) return NULL; - if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL; - re->egl.disp = _egl_x_disp_get(disp); - if (!re->egl.disp) - { - free(re); - return NULL; - } - re->egl.config = _egl_x_disp_choose_config(re->egl.disp); - if (!re->egl.config) - { - _egl_x_disp_terminate(re->egl.disp); - free(re); - return NULL; - } - re->egl.surface = _egl_x_win_surf_new(re->egl.disp, draw, re->egl.config); - if (!re->egl.surface) - { - _egl_x_disp_terminate(re->egl.disp); - free(re); - return NULL; - } - ptr = _egl_x_surf_map(re->egl.disp, re->egl.surface, &stride); - if (!ptr) - { - _egl_x_win_surf_free(re->egl.disp, re->egl.surface); - _egl_x_disp_terminate(re->egl.disp); - free(re); - return NULL; - } - _egl_x_surf_unmap(re->egl.disp, re->egl.surface); - - re->ob = - evas_software_egl_outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp, - draw, vis, cmap, depth, grayscale, - max_colors, mask, shape_dither, - destination_alpha); - - re->tb = evas_common_tilebuf_new(w, h); - if (!re->tb) - { - evas_software_xlib_outbuf_free(re->ob); - free(re); - return NULL; - } - - evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); - - return re; - debug = 0; -} -*/ - static void _output_egl_shutdown(Render_Engine *re) { @@ -337,107 +239,14 @@ _output_swapbuf_setup(int w, int h, int rot, Display *disp, Drawable draw, free(re); return NULL; } -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB -static void * -_output_xcb_setup(int w, int h, int rot, xcb_connection_t *conn, - xcb_screen_t *screen, xcb_drawable_t draw, - xcb_visualtype_t *vis, xcb_colormap_t cmap, int depth, - int debug, int grayscale, int max_colors, xcb_drawable_t mask, - int shape_dither, int destination_alpha) -{ - Render_Engine *re; - Outbuf *ob; - - if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL; - - evas_software_xcb_init(); - evas_software_xcb_color_init(); - evas_software_xcb_outbuf_init(); - - ob = - evas_software_xcb_outbuf_setup(w, h, rot, OUTBUF_DEPTH_INHERIT, conn, - screen, draw, vis, cmap, depth, - grayscale, max_colors, mask, - shape_dither, destination_alpha); - if (!ob) goto on_error; - - /* for updates return 1 big buffer, but only use portions of it, also cache - * it and keepit around until an idle_flush */ - - /* disable for now - i am hunting down why some expedite tests are slower, - * as well as shaped stuff is broken and probable non-32bpp is broken as - * convert funcs dont do the right thing - * - */ -// re->ob->onebuf = 1; - - evas_software_xcb_outbuf_debug_set(ob, debug); - - if (!evas_render_engine_software_generic_init(&re->generic, ob, NULL, - evas_software_xcb_outbuf_rotation_get, - evas_software_xcb_outbuf_reconfigure, - NULL, - NULL, - evas_software_xcb_outbuf_new_region_for_update, - evas_software_xcb_outbuf_push_updated_region, - evas_software_xcb_outbuf_free_region_for_update, - evas_software_xcb_outbuf_idle_flush, - evas_software_xcb_outbuf_flush, - NULL, - evas_software_xcb_outbuf_free, - w, h)) - goto on_error; - return re; - - on_error: - if (ob) evas_software_xcb_outbuf_free(ob); - free(re); - return NULL; -} -#endif static void * _best_visual_get(int backend, void *connection, int screen) { if (!connection) return NULL; -#ifdef BUILD_ENGINE_SOFTWARE_XLIB if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB) return DefaultVisual((Display *)connection, screen); -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB - if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB) - { - xcb_screen_iterator_t iter_screen; - xcb_depth_iterator_t iter_depth; - xcb_screen_t *s = NULL; - - iter_screen = - xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection)); - for (; iter_screen.rem; --screen, xcb_screen_next(&iter_screen)) - if (screen == 0) - { - s = iter_screen.data; - break; - } - - iter_depth = xcb_screen_allowed_depths_iterator(s); - for (; iter_depth.rem; xcb_depth_next(&iter_depth)) - { - xcb_visualtype_iterator_t iter_vis; - - iter_vis = xcb_depth_visuals_iterator(iter_depth.data); - for (; iter_vis.rem; xcb_visualtype_next(&iter_vis)) - { - if (s->root_visual == iter_vis.data->visual_id) - return iter_vis.data; - } - } - } -#endif return NULL; } @@ -447,30 +256,8 @@ _best_colormap_get(int backend, void *connection, int screen) { if (!connection) return 0; -#ifdef BUILD_ENGINE_SOFTWARE_XLIB if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB) return DefaultColormap((Display *)connection, screen); -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB - if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB) - { - xcb_screen_iterator_t iter_screen; - xcb_screen_t *s = NULL; - - iter_screen = - xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection)); - for (; iter_screen.rem; --screen, xcb_screen_next(&iter_screen)) - if (screen == 0) - { - s = iter_screen.data; - break; - } - - if (s) return s->default_colormap; - } -#endif - return 0; } @@ -479,30 +266,8 @@ _best_depth_get(int backend, void *connection, int screen) { if (!connection) return 0; -#ifdef BUILD_ENGINE_SOFTWARE_XLIB if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB) return DefaultDepth((Display *)connection, screen); -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB - if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB) - { - xcb_screen_iterator_t iter_screen; - xcb_screen_t *s = NULL; - - iter_screen = - xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection)); - for (; iter_screen.rem; --screen, xcb_screen_next(&iter_screen)) - if (screen == 0) - { - s = iter_screen.data; - break; - } - - return s->root_depth; - } -#endif - return 0; } @@ -565,7 +330,6 @@ eng_setup(Evas *eo_e, void *in) /* if we haven't initialized - init (automatic abort if already done) */ evas_common_init(); -#ifdef BUILD_ENGINE_SOFTWARE_XLIB if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB) { static int try_swapbuf = -1; @@ -607,26 +371,6 @@ eng_setup(Evas *eo_e, void *in) re->generic.ob->region_push_hook.cb = info->func.region_push_hook; re->generic.ob->region_push_hook.evas = eo_e; } -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB - if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB) - { - re = _output_xcb_setup(e->output.w, e->output.h, - info->info.rotation, info->info.connection, - info->info.screen, info->info.drawable, - info->info.visual, info->info.colormap, - info->info.depth, info->info.debug, - info->info.alloc_grayscale, - info->info.alloc_colors_max, - info->info.mask, info->info.shape_dither, - info->info.destination_alpha); - re->outbuf_alpha_get = evas_software_xcb_outbuf_alpha_get; - re->generic.ob->region_push_hook.cb = info->func.region_push_hook; - re->generic.ob->region_push_hook.evas = eo_e; - } -#endif - e->engine.data.output = re; } else @@ -639,7 +383,6 @@ eng_setup(Evas *eo_e, void *in) _outbufs = eina_list_remove(_outbufs, re->generic.ob); -#ifdef BUILD_ENGINE_SOFTWARE_XLIB if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB) { if (re->generic.outbuf_free == evas_software_xlib_swapbuf_free) @@ -678,30 +421,6 @@ eng_setup(Evas *eo_e, void *in) evas_software_xlib_outbuf_debug_set(ob, info->info.debug); } } -#endif - -#ifdef BUILD_ENGINE_SOFTWARE_XCB - if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB) - { - ob = - evas_software_xcb_outbuf_setup(e->output.w, e->output.h, - info->info.rotation, - OUTBUF_DEPTH_INHERIT, - info->info.connection, - info->info.screen, - info->info.drawable, - info->info.visual, - info->info.colormap, - info->info.depth, - info->info.alloc_grayscale, - info->info.alloc_colors_max, - info->info.mask, - info->info.shape_dither, - info->info.destination_alpha); - evas_software_xcb_outbuf_debug_set(ob, info->info.debug); - } -#endif - if (ob) { evas_render_engine_software_generic_update(&re->generic, ob, e->output.w, e->output.h); @@ -733,9 +452,7 @@ eng_output_free(void *data) { _outbufs = eina_list_remove(_outbufs, re->generic.ob); evas_render_engine_software_generic_clean(&re->generic); -#ifdef BUILD_ENGINE_SOFTWARE_XLIB _output_egl_shutdown(re); -#endif free(re); } @@ -880,16 +597,11 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native) if (ns->type == EVAS_NATIVE_SURFACE_X11) { -#ifdef BUILD_ENGINE_SOFTWARE_XLIB RGBA_Image *ret_im = NULL; ret_im = evas_xlib_image_dri_native_set(re->generic.ob, ie, ns); if (!ret_im) ret_im = evas_xlib_image_native_set(re->generic.ob, ie, ns); return ret_im; -#endif -#ifdef BUILD_ENGINE_SOFTWARE_XCB - return evas_xcb_image_native_set(re->generic.ob, ie, ns); -#endif } else if (ns->type == EVAS_NATIVE_SURFACE_TBM) { diff --git a/src/modules/evas/engines/software_x11/evas_engine.h b/src/modules/evas/engines/software_x11/evas_engine.h index 2be0966..bf1222d 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.h +++ b/src/modules/evas/engines/software_x11/evas_engine.h @@ -4,19 +4,11 @@ # include # include -# ifdef BUILD_ENGINE_SOFTWARE_XLIB -# include -# include -# include -# include -# include // xres - dpi -# endif - -# ifdef BUILD_ENGINE_SOFTWARE_XCB -# include -# include -# include -# endif +# include +# include +# include +# include +# include // xres - dpi #include "../software_generic/Evas_Engine_Software_Generic.h" @@ -60,7 +52,6 @@ struct _Outbuf Convert_Pal *pal; union { -# ifdef BUILD_ENGINE_SOFTWARE_XLIB struct { Display *disp; @@ -73,22 +64,6 @@ struct _Outbuf unsigned char swap : 1; unsigned char bit_swap : 1; } xlib; -# endif -# ifdef BUILD_ENGINE_SOFTWARE_XCB - struct - { - xcb_connection_t *conn; - xcb_screen_t *screen; - xcb_window_t win; - xcb_pixmap_t mask; - xcb_visualtype_t *visual; - xcb_colormap_t cmap; - int depth, imdepth, shm; - xcb_gcontext_t gc, gcm; - unsigned char swap : 1; - unsigned char bit_swap : 1; - } xcb; -# endif } x11; struct { @@ -121,7 +96,6 @@ struct _Outbuf }; void evas_software_xlib_x_init(void); -void evas_software_xcb_init(void); void evas_software_x11_region_push_hook_call(Outbuf *buf, int x, int y, void *out_buf, Eina_Spinlock *lock); diff --git a/src/modules/evas/engines/software_x11/evas_xcb_buffer.c b/src/modules/evas/engines/software_x11/evas_xcb_buffer.c deleted file mode 100644 index 6dbd579..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_buffer.c +++ /dev/null @@ -1,513 +0,0 @@ -#include "evas_common_private.h" -#include "evas_xcb_buffer.h" - -/* local function prototypes */ -static void _xcbob_sync(xcb_connection_t *conn); -static xcb_image_t *_xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data); -static xcb_format_t *_xcbob_find_format(const xcb_setup_t *setup, uint8_t depth); -static xcb_visualtype_t *_xcbob_find_visual_by_id(xcb_screen_t *screen, xcb_visualid_t id); - -void -evas_software_xcb_write_mask_line(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y) -{ - int x, bpl = 0; - DATA32 *src_ptr; - DATA8 *dst_ptr; - - src_ptr = src; - dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl); - dst_ptr = dst_ptr + (bpl * y); - w -= 7; - if (buf->priv.x11.xcb.bit_swap) - { - for (x = 0; x < w; x += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[0])) >> 7) << 7) | - ((A_VAL(&(src_ptr[1])) >> 7) << 6) | - ((A_VAL(&(src_ptr[2])) >> 7) << 5) | - ((A_VAL(&(src_ptr[3])) >> 7) << 4) | - ((A_VAL(&(src_ptr[4])) >> 7) << 3) | - ((A_VAL(&(src_ptr[5])) >> 7) << 2) | - ((A_VAL(&(src_ptr[6])) >> 7) << 1) | - ((A_VAL(&(src_ptr[7])) >> 7) << 0); - src_ptr += 8; - dst_ptr++; - } - } - else - { - for (x = 0; x < w; x += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[0])) >> 7) << 0) | - ((A_VAL(&(src_ptr[1])) >> 7) << 1) | - ((A_VAL(&(src_ptr[2])) >> 7) << 2) | - ((A_VAL(&(src_ptr[3])) >> 7) << 3) | - ((A_VAL(&(src_ptr[4])) >> 7) << 4) | - ((A_VAL(&(src_ptr[5])) >> 7) << 5) | - ((A_VAL(&(src_ptr[6])) >> 7) << 6) | - ((A_VAL(&(src_ptr[7])) >> 7) << 7); - src_ptr += 8; - dst_ptr++; - } - } - w += 7; - for (; x < w; x ++) - { - xcb_image_put_pixel(xcbob->xim, x, y, A_VAL(src_ptr) >> 7); - src_ptr++; - } -} - -void -evas_software_xcb_write_mask_line_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y) -{ - int x, bpl = 0; - DATA32 *src_ptr; - DATA8 *dst_ptr; - - src_ptr = src + w - 1; - dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl); - dst_ptr = dst_ptr + (bpl * y); - w -= 7; - if (buf->priv.x11.xcb.bit_swap) - { - for (x = 0; x < w; x += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[ 0])) >> 7) << 7) | - ((A_VAL(&(src_ptr[-1])) >> 7) << 6) | - ((A_VAL(&(src_ptr[-2])) >> 7) << 5) | - ((A_VAL(&(src_ptr[-3])) >> 7) << 4) | - ((A_VAL(&(src_ptr[-4])) >> 7) << 3) | - ((A_VAL(&(src_ptr[-5])) >> 7) << 2) | - ((A_VAL(&(src_ptr[-6])) >> 7) << 1) | - ((A_VAL(&(src_ptr[-7])) >> 7) << 0); - src_ptr -= 8; - dst_ptr++; - } - } - else - { - for (x = 0; x < w; x += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[ 0])) >> 7) << 0) | - ((A_VAL(&(src_ptr[-1])) >> 7) << 1) | - ((A_VAL(&(src_ptr[-2])) >> 7) << 2) | - ((A_VAL(&(src_ptr[-3])) >> 7) << 3) | - ((A_VAL(&(src_ptr[-4])) >> 7) << 4) | - ((A_VAL(&(src_ptr[-5])) >> 7) << 5) | - ((A_VAL(&(src_ptr[-6])) >> 7) << 6) | - ((A_VAL(&(src_ptr[-7])) >> 7) << 7); - src_ptr -= 8; - dst_ptr++; - } - } - w += 7; - for (; x < w; x ++) - { - xcb_image_put_pixel(xcbob->xim, x, y, A_VAL(src_ptr) >> 7); - src_ptr--; - } -} - -void -evas_software_xcb_write_mask_line_vert(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w) -{ - int yy, bpl = 0; - DATA32 *src_ptr; - DATA8 *dst_ptr; - - src_ptr = src; - dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl); - dst_ptr = dst_ptr + (bpl * y); - h -= 7; - if (buf->priv.x11.xcb.bit_swap) - { - for (yy = 0; yy < h; yy += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[0 * w])) >> 7) << 7) | - ((A_VAL(&(src_ptr[1 * w])) >> 7) << 6) | - ((A_VAL(&(src_ptr[2 * w])) >> 7) << 5) | - ((A_VAL(&(src_ptr[3 * w])) >> 7) << 4) | - ((A_VAL(&(src_ptr[4 * w])) >> 7) << 3) | - ((A_VAL(&(src_ptr[5 * w])) >> 7) << 2) | - ((A_VAL(&(src_ptr[6 * w])) >> 7) << 1) | - ((A_VAL(&(src_ptr[7 * w])) >> 7) << 0); - src_ptr += 8 * w; - dst_ptr++; - } - } - else - { - for (yy = 0; yy < h; yy += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[0 * w])) >> 7) << 0) | - ((A_VAL(&(src_ptr[1 * w])) >> 7) << 1) | - ((A_VAL(&(src_ptr[2 * w])) >> 7) << 2) | - ((A_VAL(&(src_ptr[3 * w])) >> 7) << 3) | - ((A_VAL(&(src_ptr[4 * w])) >> 7) << 4) | - ((A_VAL(&(src_ptr[5 * w])) >> 7) << 5) | - ((A_VAL(&(src_ptr[6 * w])) >> 7) << 6) | - ((A_VAL(&(src_ptr[7 * w])) >> 7) << 7); - src_ptr += 8 * w; - dst_ptr++; - } - } - h += 7; - for (; yy < h; yy ++) - { - xcb_image_put_pixel(xcbob->xim, yy, y, A_VAL(src_ptr) >> 7); - src_ptr += w; - } -} - -void -evas_software_xcb_write_mask_line_vert_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w) -{ - int yy, bpl = 0; - DATA32 *src_ptr; - DATA8 *dst_ptr; - - src_ptr = src + ((h - 1) * w); - dst_ptr = evas_software_xcb_output_buffer_data(xcbob, &bpl); - dst_ptr = dst_ptr + (bpl * y); - h -= 7; - if (buf->priv.x11.xcb.bit_swap) - { - for (yy = 0; yy < h; yy += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 7) | - ((A_VAL(&(src_ptr[-1 * w])) >> 7) << 6) | - ((A_VAL(&(src_ptr[-2 * w])) >> 7) << 5) | - ((A_VAL(&(src_ptr[-3 * w])) >> 7) << 4) | - ((A_VAL(&(src_ptr[-4 * w])) >> 7) << 3) | - ((A_VAL(&(src_ptr[-5 * w])) >> 7) << 2) | - ((A_VAL(&(src_ptr[-6 * w])) >> 7) << 1) | - ((A_VAL(&(src_ptr[-7 * w])) >> 7) << 0); - src_ptr -= 8 * w; - dst_ptr++; - } - } - else - { - for (yy = 0; yy < h; yy += 8) - { - *dst_ptr = - ((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 0) | - ((A_VAL(&(src_ptr[-1 * w])) >> 7) << 1) | - ((A_VAL(&(src_ptr[-2 * w])) >> 7) << 2) | - ((A_VAL(&(src_ptr[-3 * w])) >> 7) << 3) | - ((A_VAL(&(src_ptr[-4 * w])) >> 7) << 4) | - ((A_VAL(&(src_ptr[-5 * w])) >> 7) << 5) | - ((A_VAL(&(src_ptr[-6 * w])) >> 7) << 6) | - ((A_VAL(&(src_ptr[-7 * w])) >> 7) << 7); - src_ptr -= 8 * w; - dst_ptr++; - } - } - h += 7; - for (; yy < h; yy ++) - { - xcb_image_put_pixel(xcbob->xim, yy, y, A_VAL(src_ptr) >> 7); - src_ptr -= w; - } -} - -Eina_Bool -evas_software_xcb_can_do_shm(xcb_connection_t *conn, xcb_screen_t *screen) -{ - const xcb_query_extension_reply_t *reply; - static xcb_connection_t *cached_conn = NULL; - static int cached_result = 0; - - if (conn == cached_conn) return cached_result; - cached_conn = conn; - - reply = xcb_get_extension_data(conn, &xcb_shm_id); - if ((reply) && (reply->present)) - { - xcb_visualtype_t *visual; - Xcb_Output_Buffer *xcbob = NULL; - - visual = _xcbob_find_visual_by_id(screen, screen->root_visual); - xcbob = - evas_software_xcb_output_buffer_new(conn, visual, screen->root_depth, - 16, 16, 2, NULL); - if (!xcbob) - cached_result = 0; - else - { - evas_software_xcb_output_buffer_unref(xcbob, EINA_TRUE); - cached_result = 1; - } - } - else - cached_result = 0; - - return cached_result; -} - -Xcb_Output_Buffer * -evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, int try_shm, unsigned char *data) -{ - Xcb_Output_Buffer *xcbob = NULL; - - if (!(xcbob = calloc(1, sizeof(Xcb_Output_Buffer)))) - return NULL; - - xcbob->connection = conn; - xcbob->visual = vis; - xcbob->xim = NULL; - xcbob->shm_info = NULL; - xcbob->w = w; - xcbob->h = h; - xcbob->refcount = 1; - - if (try_shm > 0) - { - xcbob->shm_info = malloc(sizeof(xcb_shm_segment_info_t)); - if (xcbob->shm_info) - { - xcbob->shm_info->shmseg = xcb_generate_id(conn); - xcbob->xim = - _xcbob_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, - depth, NULL, ~0, NULL); - if (xcbob->xim) - { - xcbob->shm_info->shmid = - shmget(IPC_PRIVATE, - xcbob->xim->stride * xcbob->xim->height, - (IPC_CREAT | 0600)); - if (xcbob->shm_info->shmid == (uint32_t)-1) - { - xcb_image_destroy(xcbob->xim); - free(xcbob->shm_info); - free(xcbob); - return NULL; - } - xcbob->shm_info->shmaddr = xcbob->xim->data = - shmat(xcbob->shm_info->shmid, 0, 0); - if (xcbob->shm_info->shmaddr != ((void *)-1)) - { - /* Sync only needed for testing */ - if (try_shm == 2) _xcbob_sync(conn); - -#if defined(LIBXEXT_VERSION_LOW) - if (evas_common_frameq_enabled()) - xcb_grab_server(conn); -#endif - xcb_shm_attach(conn, xcbob->shm_info->shmseg, - xcbob->shm_info->shmid, 0); -#if defined(LIBXEXT_VERSION_LOW) - if (evas_common_frameq_enabled()) - xcb_ungrab_server(conn); -#endif - if (try_shm == 2) _xcbob_sync(conn); - - xcbob->bpl = xcbob->xim->stride; - xcbob->psize = (xcbob->bpl * xcbob->h); - return xcbob; - } - shmdt(xcbob->shm_info->shmaddr); - shmctl(xcbob->shm_info->shmid, IPC_RMID, 0); - } - if (xcbob->xim) xcb_image_destroy(xcbob->xim); - xcbob->xim = NULL; - } - if (xcbob->shm_info) free(xcbob->shm_info); - xcbob->shm_info = NULL; - } - - if (try_shm > 1) return NULL; - - /* no shm */ - xcbob->xim = - _xcbob_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, - depth, NULL, ~0, NULL); - if (!xcbob->xim) - { - free(xcbob); - return NULL; - } - - xcbob->data = data; - - if (!xcbob->xim->data) - { - xcbob->xim->data = malloc(xcbob->xim->stride * xcbob->xim->height); - if (!xcbob->xim->data) - { - xcb_image_destroy(xcbob->xim); - free(xcbob); - return NULL; - } - } - xcbob->bpl = xcbob->xim->stride; - xcbob->psize = (xcbob->bpl * xcbob->h); - return xcbob; -} - -Xcb_Output_Buffer * -evas_software_xcb_output_buffer_ref(Xcb_Output_Buffer *xcbob) -{ - if (xcbob->refcount == UINT_MAX) - return NULL; - xcbob->refcount++; - return xcbob; -} - -void -evas_software_xcb_output_buffer_unref(Xcb_Output_Buffer *xcbob, Eina_Bool sync) -{ - if (!xcbob->refcount) - return; - xcbob->refcount--; - if (xcbob->refcount) - return; - if (xcbob->shm_info) - { - if (sync) _xcbob_sync(xcbob->connection); - xcb_shm_detach(xcbob->connection, xcbob->shm_info->shmseg); - xcb_image_destroy(xcbob->xim); - shmdt(xcbob->shm_info->shmaddr); - shmctl(xcbob->shm_info->shmid, IPC_RMID, 0); - free(xcbob->shm_info); - } - else - { - if (xcbob->data) xcbob->xim->data = NULL; -// free(xcbob->xim->data); - xcb_image_destroy(xcbob->xim); - } - free(xcbob); -} - -void -evas_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, xcb_drawable_t drawable, xcb_gcontext_t gc, int x, int y, Eina_Bool sync) -{ - if (xcbob->shm_info) - { - xcb_image_shm_put(xcbob->connection, drawable, gc, xcbob->xim, - *xcbob->shm_info, 0, 0, x, y, xcbob->w, xcbob->h, 0); - if (sync) _xcbob_sync(xcbob->connection); - } - else - xcb_image_put(xcbob->connection, drawable, gc, xcbob->xim, x, y, 0); -} - -DATA8 * -evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret) -{ - if (bpl_ret) *bpl_ret = xcbob->xim->stride; - return (DATA8 *)xcbob->xim->data; -} - -int -evas_software_xcb_output_buffer_depth(Xcb_Output_Buffer *xcbob) -{ - return xcbob->xim->bpp; -} - -int -evas_software_xcb_output_buffer_byte_order(Xcb_Output_Buffer *xcbob) -{ - return xcbob->xim->byte_order; -} - -int -evas_software_xcb_output_buffer_bit_order(Xcb_Output_Buffer *xcbob) -{ - return xcbob->xim->bit_order; -} - -/* local functions */ -static void -_xcbob_sync(xcb_connection_t *conn) -{ - free(xcb_get_input_focus_reply(conn, - xcb_get_input_focus_unchecked(conn), NULL)); -} - -static xcb_image_t * -_xcbob_create_native(xcb_connection_t *conn, int w, int h, xcb_image_format_t format, uint8_t depth, void *base, uint32_t bytes, uint8_t *data) -{ - static uint8_t dpth = 0; - static xcb_format_t *fmt = NULL; - const xcb_setup_t *setup; - xcb_image_format_t xif; - - /* NB: We cannot use xcb_image_create_native as it only creates images - * using MSB_FIRST, so this routine recreates that function and uses - * the endian-ness of the server setup */ - setup = xcb_get_setup(conn); - xif = format; - - if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1)) - xif = XCB_IMAGE_FORMAT_XY_PIXMAP; - - if (dpth != depth) - { - dpth = depth; - fmt = _xcbob_find_format(setup, depth); - if (!fmt) return 0; - } - - switch (xif) - { - case XCB_IMAGE_FORMAT_XY_BITMAP: - if (depth != 1) return 0; - case XCB_IMAGE_FORMAT_XY_PIXMAP: - case XCB_IMAGE_FORMAT_Z_PIXMAP: - return xcb_image_create(w, h, xif, - fmt->scanline_pad, - fmt->depth, fmt->bits_per_pixel, - setup->bitmap_format_scanline_unit, - setup->image_byte_order, - setup->bitmap_format_bit_order, - base, bytes, data); - default: - break; - } - - return 0; -} - -static xcb_format_t * -_xcbob_find_format(const xcb_setup_t *setup, uint8_t depth) -{ - xcb_format_t *fmt, *fmtend; - - fmt = xcb_setup_pixmap_formats(setup); - fmtend = fmt + xcb_setup_pixmap_formats_length(setup); - for (; fmt != fmtend; ++fmt) - if (fmt->depth == depth) - return fmt; - - return 0; -} - -static xcb_visualtype_t * -_xcbob_find_visual_by_id(xcb_screen_t *screen, xcb_visualid_t id) -{ - xcb_depth_iterator_t diter; - xcb_visualtype_iterator_t viter; - - diter = xcb_screen_allowed_depths_iterator(screen); - for (; diter.rem; xcb_depth_next(&diter)) - { - viter = xcb_depth_visuals_iterator(diter.data); - for (; viter.rem; xcb_visualtype_next(&viter)) - { - if (viter.data->visual_id == id) - return viter.data; - } - } - - return 0; -} diff --git a/src/modules/evas/engines/software_x11/evas_xcb_buffer.h b/src/modules/evas/engines/software_x11/evas_xcb_buffer.h deleted file mode 100644 index 6e73e5a..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_buffer.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef EVAS_XCB_BUFFER_H -# define EVAS_XCB_BUFFER_H - -# include "evas_engine.h" - -typedef struct _Xcb_Output_Buffer Xcb_Output_Buffer; -struct _Xcb_Output_Buffer -{ - xcb_connection_t *connection; - xcb_visualtype_t *visual; - xcb_image_t *xim; - xcb_shm_segment_info_t *shm_info; - unsigned char *data; - int w, h, bpl, psize; - unsigned int refcount; -}; - -void evas_software_xcb_write_mask_line(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y); -void evas_software_xcb_write_mask_line_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int w, int y); -void evas_software_xcb_write_mask_line_vert(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w); -void evas_software_xcb_write_mask_line_vert_rev(Outbuf *buf, Xcb_Output_Buffer *xcbob, DATA32 *src, int h, int y, int w); -Eina_Bool evas_software_xcb_can_do_shm(xcb_connection_t *conn, xcb_screen_t *screen); -Xcb_Output_Buffer *evas_software_xcb_output_buffer_new(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, int try_shm, unsigned char *data); -void evas_software_xcb_output_buffer_unref(Xcb_Output_Buffer *xcbob, Eina_Bool sync); -Xcb_Output_Buffer *evas_software_xcb_output_buffer_ref(Xcb_Output_Buffer *xcbob); -void evas_software_xcb_output_buffer_paste(Xcb_Output_Buffer *xcbob, xcb_drawable_t drawable, xcb_gcontext_t gc, int x, int y, Eina_Bool sync); -DATA8 *evas_software_xcb_output_buffer_data(Xcb_Output_Buffer *xcbob, int *bpl_ret); -int evas_software_xcb_output_buffer_depth(Xcb_Output_Buffer *xcbob); -int evas_software_xcb_output_buffer_byte_order(Xcb_Output_Buffer *xcbob); -int evas_software_xcb_output_buffer_bit_order(Xcb_Output_Buffer *xcbob); - -#endif diff --git a/src/modules/evas/engines/software_x11/evas_xcb_color.c b/src/modules/evas/engines/software_x11/evas_xcb_color.c deleted file mode 100644 index 65c0516..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_color.c +++ /dev/null @@ -1,424 +0,0 @@ -#include "evas_common_private.h" - -#include "evas_engine.h" - -typedef struct _Convert_Pal_Priv Convert_Pal_Priv; - -struct _Convert_Pal_Priv -{ - xcb_connection_t *conn; - xcb_colormap_t cmap; - xcb_visualtype_t *vis; -}; - -typedef DATA8 * (*Xcb_Func_Alloc_Colors) (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); - -static Xcb_Func_Alloc_Colors x_color_alloc[PAL_MODE_LAST + 1]; -static int x_color_count[PAL_MODE_LAST + 1]; -static Eina_List *palettes = NULL; - -static DATA8 * x_color_alloc_rgb(int nr, int ng, int nb, xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_gray(int ng, xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); - -static DATA8 * x_color_alloc_rgb_332 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_rgb_666 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_rgb_232 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_rgb_222 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_rgb_221 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_rgb_121 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_rgb_111 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_gray_256 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_gray_64 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_gray_16 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_gray_4 (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); -static DATA8 * x_color_alloc_mono (xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *v); - -static DATA8 * -x_color_alloc_rgb(int nr, - int ng, - int nb, - xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - int r, g, b, i; - DATA8 *color_lut; - int sig_mask = 0; - int delt = 0; - - for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i); - sig_mask <<= (16 - v->bits_per_rgb_value); - i = 0; - color_lut = malloc((nr) * (ng) * (nb)); - if (!color_lut) return NULL; - delt = 0x0101 * 3; - /* FIXME: remove the round-trip ? */ - for (r = 0; r < (nr); r++) - { - for (g = 0; g < (ng); g++) - { - for (b = 0; b < (nb); b++) - { - xcb_coloritem_t xcl; - xcb_coloritem_t xcl_in; - xcb_alloc_color_reply_t *rep; - int val; - int dr, dg, db; - - val = (int)(((r * 255) / ((nr) - 1))); - val = (val << 8) | val; - xcl.red = (uint16_t)(val); - val = (int)(((g * 255) / ((ng) - 1))); - val = (val << 8) | val; - xcl.green = (uint16_t)(val); - val = (int)(((b * 255) / ((nb) - 1))); - val = (val << 8) | val; - xcl.blue = (uint16_t)(val); - xcl_in = xcl; - rep = xcb_alloc_color_reply(conn, - xcb_alloc_color_unchecked(conn, - cmap, - xcl.red, - xcl.green, - xcl.blue), - 0); - dr = (int)xcl_in.red - (int)xcl.red; - if (dr < 0) dr = -dr; - dg = (int)xcl_in.green - (int)xcl.green; - if (dg < 0) dg = -dg; - db = (int)xcl_in.blue - (int)xcl.blue; - if (db < 0) db = -db; -/* - printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n", - ret, - xcl_in.red, xcl_in.green, xcl_in.blue, - xcl.red, xcl.green, xcl.blue, - (dr + dg +db), delt); - */ - - /* TODO: XAllocColor tries to approach the color */ - /* in case the allocation fails */ - /* XCB does not that (i think). It should be done */ - /* So if rep == NULL, the other following tests */ - /* should be always satisfied */ - if ((!rep) || - ((dr + dg + db) > delt) - /* - ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) || - ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) || - ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)) - */ - ) - { - uint32_t pixels[256]; - int j; - - if (i > 0) - { - for (j = 0; j < i; j++) - pixels[j] = (uint32_t)color_lut[j]; - xcb_free_colors(conn, cmap, 0, i, pixels); - } - free(color_lut); - return NULL; - } - color_lut[i] = rep->pixel; - i++; - free(rep); - } - } - } - return color_lut; -} - -static DATA8 * -x_color_alloc_gray(int ng, - xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - int g, i; - DATA8 *color_lut; - int sig_mask = 0; - - for (i = 0; i < v->bits_per_rgb_value; i++) sig_mask |= (0x1 << i); - sig_mask <<= (16 - v->bits_per_rgb_value); - i = 0; - color_lut = malloc(ng); - if (!color_lut) return NULL; - /* FIXME: remove the round-trip ? */ - for (g = 0; g < (ng); g++) - { - xcb_coloritem_t xcl; - xcb_coloritem_t xcl_in; - int val; - xcb_alloc_color_reply_t *rep; - - val = (int)(((g * 255) / ((ng) - 1))); - val = (val << 8) | val; - xcl.red = (uint16_t)(val); - xcl.green = (uint16_t)(val); - xcl.blue = (uint16_t)(val); - xcl_in = xcl; - rep = xcb_alloc_color_reply(conn, - xcb_alloc_color_unchecked(conn, - cmap, - xcl.red, - xcl.green, - xcl.blue), - 0); - /* FIXME: XAllocColor tries to approach the color */ - /* in case the allocation fails */ - /* XCB does not that (i think). It should be done */ - /* So if rep == NULL, the other following tests */ - /* should be always satisfied */ - if ((!rep) || - ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) || - ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) || - ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))) - { - uint32_t pixels[256]; - int j; - - if (i > 0) - { - for (j = 0; j < i; j++) - pixels[j] = (uint32_t) color_lut[j]; - xcb_free_colors(conn, cmap, 0, i, pixels); - } - free(color_lut); - return NULL; - } - color_lut[i] = rep->pixel; - i++; - free(rep); - } - return color_lut; -} - -static DATA8 * -x_color_alloc_rgb_332(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(8, 8, 4, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_rgb_666(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(6, 6, 6, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_rgb_232(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(4, 8, 4, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_rgb_222(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(4, 4, 4, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_rgb_221(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(4, 4, 2, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_rgb_121(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(2, 4, 2, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_rgb_111(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_rgb(2, 2, 2, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_gray_256(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_gray(256, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_gray_64(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_gray(64, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_gray_16(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_gray(32, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_gray_4(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_gray(16, conn, cmap, v); -} - -static DATA8 * -x_color_alloc_mono(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *v) -{ - return x_color_alloc_gray(2, conn, cmap, v); -} - -void -evas_software_xcb_color_init(void) -{ - static int initialised = 0; - - if (initialised) return; - x_color_alloc[PAL_MODE_NONE] = NULL; - x_color_count[PAL_MODE_NONE] = 0; - - x_color_alloc[PAL_MODE_MONO] = x_color_alloc_mono; - x_color_count[PAL_MODE_MONO] = 2; - - x_color_alloc[PAL_MODE_GRAY4] = x_color_alloc_gray_4; - x_color_count[PAL_MODE_GRAY4] = 4; - - x_color_alloc[PAL_MODE_GRAY16] = x_color_alloc_gray_16; - x_color_count[PAL_MODE_GRAY16] = 16; - - x_color_alloc[PAL_MODE_GRAY64] = x_color_alloc_gray_64; - x_color_count[PAL_MODE_GRAY64] = 64; - - x_color_alloc[PAL_MODE_GRAY256] = x_color_alloc_gray_256; - x_color_count[PAL_MODE_GRAY256] = 256; - - x_color_alloc[PAL_MODE_RGB111] = x_color_alloc_rgb_111; - x_color_count[PAL_MODE_RGB111] = 2 * 2 * 2; - - x_color_alloc[PAL_MODE_RGB121] = x_color_alloc_rgb_121; - x_color_count[PAL_MODE_RGB121] = 2 * 4 * 2; - - x_color_alloc[PAL_MODE_RGB221] = x_color_alloc_rgb_221; - x_color_count[PAL_MODE_RGB221] = 4 * 4 * 2; - - x_color_alloc[PAL_MODE_RGB222] = x_color_alloc_rgb_222; - x_color_count[PAL_MODE_RGB222] = 4 * 4 * 4; - - x_color_alloc[PAL_MODE_RGB232] = x_color_alloc_rgb_232; - x_color_count[PAL_MODE_RGB232] = 4 * 8 * 4; - - x_color_alloc[PAL_MODE_RGB666] = x_color_alloc_rgb_666; - x_color_count[PAL_MODE_RGB666] = 6 * 6 * 6; - - x_color_alloc[PAL_MODE_RGB332] = x_color_alloc_rgb_332; - x_color_count[PAL_MODE_RGB332] = 8 * 8 * 4; - - x_color_alloc[PAL_MODE_LAST] = NULL; - x_color_count[PAL_MODE_LAST] = 0; - initialised = 1; -} - -Convert_Pal * -evas_software_xcb_color_allocate(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *vis, - Convert_Pal_Mode colors) -{ - Convert_Pal_Priv *palpriv; - Convert_Pal *pal; - Convert_Pal_Mode c; - Eina_List *l; - -/* printf("ALLOC cmap=%i vis=%p\n", cmap, vis);*/ - EINA_LIST_FOREACH(palettes, l, pal) - { - palpriv = pal->data; - if ((conn == palpriv->conn) && - (vis == palpriv->vis) && - (cmap == palpriv->cmap)) - { - pal->references++; - return pal; - } - } - pal = calloc(1, sizeof(struct _Convert_Pal)); - if (!pal) return NULL; - for (c = colors; c > PAL_MODE_NONE; c--) - { - if (x_color_alloc[c]) - { -/* printf("TRY PAL %i\n", c);*/ - pal->lookup = (x_color_alloc[c])(conn, cmap, vis); - if (pal->lookup) break; - } - } - pal->references = 1; - pal->colors = c; - pal->count = x_color_count[c]; - palpriv = calloc(1, sizeof(Convert_Pal_Priv)); - pal->data = palpriv; - if (!palpriv) - { - if (pal->lookup) free(pal->lookup); - free(pal); - return NULL; - } - palpriv->conn = conn; - palpriv->vis = vis; - palpriv->cmap = cmap; - if (pal->colors == PAL_MODE_NONE) - { - if (pal->lookup) free(pal->lookup); - free(pal); - return NULL; - } - palettes = eina_list_append(palettes, pal); - return pal; -} - -void -evas_software_xcb_color_deallocate(xcb_connection_t *conn, - xcb_colormap_t cmap, - xcb_visualtype_t *vis EINA_UNUSED, - Convert_Pal *pal) -{ - uint32_t pixels[256]; - int j; - - pal->references--; - if (pal->references > 0) return; - if (pal->lookup) - { - for(j = 0; j < pal->count; j++) - pixels[j] = (uint32_t) pal->lookup[j]; - xcb_free_colors(conn, cmap, 0, pal->count, pixels); - free(pal->lookup); - } - free(pal->data); - palettes = eina_list_remove(palettes, pal); - free(pal); -} diff --git a/src/modules/evas/engines/software_x11/evas_xcb_color.h b/src/modules/evas/engines/software_x11/evas_xcb_color.h deleted file mode 100644 index 7dcaeaf..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_color.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef EVAS_XCB_COLOR_H -# define EVAS_XCB_COLOR_H - -# include "evas_engine.h" - -void evas_software_xcb_color_init(void); -Convert_Pal *evas_software_xcb_color_allocate(xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *vis, Convert_Pal_Mode colors); -void evas_software_xcb_color_deallocate(xcb_connection_t *conn, xcb_colormap_t cmap, xcb_visualtype_t *vis, Convert_Pal *pal); - -#endif diff --git a/src/modules/evas/engines/software_x11/evas_xcb_image.c b/src/modules/evas/engines/software_x11/evas_xcb_image.c deleted file mode 100644 index 3794cb9..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_image.c +++ /dev/null @@ -1,123 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "evas_common_private.h" -#include "evas_xcb_image.h" - -static void -_evas_xcb_image_update(void *image, int x, int y, int w, int h) -{ - RGBA_Image *im = image; - Native *n; - - n = im->native.data; - - if (ecore_x_image_get(n->ns_data.x11.exim, n->ns_data.x11.pixmap, 0, 0, x, y, w, h)) - { - char *pix; - int bpl, rows, bpp; - - pix = ecore_x_image_data_get(n->ns_data.x11.exim, &bpl, &rows, &bpp); - if (!ecore_x_image_is_argb32_get(n->ns_data.x11.exim)) - { - Ecore_X_Colormap colormap; - - if (!im->image.data) - im->image.data = (DATA32 *)malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32)); - colormap = ecore_x_default_colormap_get(ecore_x_display_get(), ecore_x_default_screen_get()); - ecore_x_image_to_argb_convert(pix, bpp, bpl, colormap, n->ns_data.x11.visual, - x, y, w, h, im->image.data, - (w * sizeof(int)), 0, 0); - } - else - im->image.data = (DATA32 *)pix; - } -} - -static void -_native_cb_bind(void *image, int x, int y, int w, int h) -{ - RGBA_Image *im = image; - Native *n; - - n = im->native.data; - - if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_X11)) - _evas_xcb_image_update(image, x, y, w, h); -} - -static void -_native_cb_free(void *image) -{ - RGBA_Image *im; - Native *n; - - im = image; - n = im->native.data; - - if (n->ns_data.x11.exim) - { - ecore_x_image_free(n->ns_data.x11.exim); - n->ns_data.x11.exim = NULL; - } - n->ns_data.x11.visual = NULL; - - im->native.data = NULL; - im->native.func.bind = NULL; - im->native.func.unbind = NULL; - im->native.func.free = NULL; - im->image.data = NULL; - - free(n); -} - -void * -evas_xcb_image_native_set(void *data EINA_UNUSED, void *image, void *native) -{ - RGBA_Image *im; - Evas_Native_Surface *ns; - - im = image; - ns = native; - if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_X11)) - { - Native *n = NULL; - Ecore_X_Image *exim = NULL; - Ecore_X_Visual *vis = NULL; - Ecore_X_Pixmap pm = 0; - int w, h, depth; - - vis = ns->data.x11.visual; - pm = ns->data.x11.pixmap; - - depth = ecore_x_drawable_depth_get(pm); - w = im->cache_entry.w; - h = im->cache_entry.h; - - n = calloc(1, sizeof(Native)); - if (!n) return NULL; - - exim = ecore_x_image_new(w, h, vis, depth); - if (!exim) - { - ERR("Failed to create new Ecore_X_Image"); - free(n); - return NULL; - } - - memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); - n->ns_data.x11.pixmap = pm; - n->ns_data.x11.visual = vis; - n->ns_data.x11.exim = exim; - - im->native.data = n; - im->native.func.bind = _native_cb_bind; - im->native.func.unbind = NULL; - im->native.func.free = _native_cb_free; - - _evas_xcb_image_update(image, 0, 0, w, h); - } - - return im; -} diff --git a/src/modules/evas/engines/software_x11/evas_xcb_image.h b/src/modules/evas/engines/software_x11/evas_xcb_image.h deleted file mode 100644 index cfe6c63..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_image.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "evas_engine.h" -#include -#include "../software_generic/evas_native_common.h" - -void *evas_xcb_image_native_set(void *data, void *image, void *native); diff --git a/src/modules/evas/engines/software_x11/evas_xcb_main.c b/src/modules/evas/engines/software_x11/evas_xcb_main.c deleted file mode 100644 index c255e79..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "evas_common_private.h" -#include "evas_engine.h" - -void -evas_software_xcb_init(void) -{ - -} diff --git a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c deleted file mode 100644 index dd8af98..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c +++ /dev/null @@ -1,1310 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#ifdef EVAS_CSERVE2 -# include "evas_cs2_private.h" -#endif -#include "evas_common_private.h" -#include "evas_macros.h" -#include "evas_xcb_outbuf.h" -#include "evas_xcb_buffer.h" -#include "evas_xcb_color.h" - -/* local structures */ -typedef struct _Outbuf_Region Outbuf_Region; -struct _Outbuf_Region -{ - Xcb_Output_Buffer *xcbob, *mask; - int x, y, w, h; -}; - -/* local function prototypes */ -static Xcb_Output_Buffer *_find_xcbob(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, Eina_Bool shm, void *data); -static void _unfind_xcbob(Xcb_Output_Buffer *xcbob, Eina_Bool sync); -static void _clear_xcbob(Eina_Bool sync); -static void _xcbob_sync(xcb_connection_t *conn); - -/* local variables */ -static Eina_List *_shmpool = NULL; -static int _shmsize = 0; -static int _shmlimit = 0; -static const unsigned int _shmcountlimit = 32; - -static Eina_Spinlock shmpool_lock; -#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock) -#define SHMPOOL_UNLOCK() eina_spinlock_release(&shmpool_lock) - -void -evas_software_xcb_outbuf_init(void) -{ - eina_spinlock_new(&shmpool_lock); -} - -void -evas_software_xcb_outbuf_free(Outbuf *buf) -{ - SHMPOOL_LOCK(); - _shmlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2; - SHMPOOL_UNLOCK(); - eina_spinlock_take(&(buf->priv.lock)); - while (buf->priv.pending_writes) - { - RGBA_Image *im = NULL; - Outbuf_Region *obr = NULL; - - im = buf->priv.pending_writes->data; - buf->priv.pending_writes = - eina_list_remove_list(buf->priv.pending_writes, - buf->priv.pending_writes); - obr = im->extended_info; -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -#endif - evas_cache_image_drop(&im->cache_entry); - - if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE); - if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE); - free(obr); - } - eina_spinlock_release(&(buf->priv.lock)); - - evas_software_xcb_outbuf_idle_flush(buf); - evas_software_xcb_outbuf_flush(buf, NULL, NULL, MODE_FULL); - - if (buf->priv.x11.xcb.gc) - xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc); - if (buf->priv.x11.xcb.gcm) - xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gcm); - if (buf->priv.pal) - evas_software_xcb_color_deallocate(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.cmap, - buf->priv.x11.xcb.visual, - buf->priv.pal); - - eina_array_flush(&buf->priv.onebuf_regions); - eina_spinlock_free(&(buf->priv.lock)); - free(buf); - _clear_xcbob(EINA_TRUE); -} - -Outbuf * -evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_connection_t *conn, xcb_screen_t *screen, xcb_drawable_t draw, xcb_visualtype_t *vis, xcb_colormap_t cmap, int xdepth, Eina_Bool grayscale, int max_colors, xcb_drawable_t mask, Eina_Bool shape_dither, Eina_Bool alpha) -{ - Outbuf *buf = NULL; - Gfx_Func_Convert func_conv = NULL; - Xcb_Output_Buffer *xob; - const xcb_setup_t *setup; - - if (!(buf = calloc(1, sizeof(Outbuf)))) - return NULL; - - if (xdepth < 15) rot = 0; - - setup = xcb_get_setup(conn); - - buf->w = w; - buf->h = h; - buf->depth = depth; - buf->rot = rot; - buf->priv.x11.xcb.conn = conn; - buf->priv.x11.xcb.screen = screen; - buf->priv.x11.xcb.visual = vis; - buf->priv.x11.xcb.cmap = cmap; - buf->priv.x11.xcb.depth = xdepth; - buf->priv.mask_dither = shape_dither; - buf->priv.destination_alpha = alpha; - buf->priv.x11.xcb.shm = evas_software_xcb_can_do_shm(conn, screen); - - xob = - evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.visual, - buf->priv.x11.xcb.depth, - 1, 1, buf->priv.x11.xcb.shm, - NULL); - if (!xob) buf->priv.x11.xcb.shm = 0; - xob = - evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.visual, - buf->priv.x11.xcb.depth, - 1, 1, buf->priv.x11.xcb.shm, - NULL); - if (!xob) - { - free(buf); - return NULL; - } - buf->priv.x11.xcb.imdepth = evas_software_xcb_output_buffer_depth(xob); - evas_software_xcb_output_buffer_unref(xob, EINA_FALSE); - - eina_array_step_set(&buf->priv.onebuf_regions, sizeof(Eina_Array), 8); - -#ifdef WORDS_BIGENDIAN - if (setup->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST) - buf->priv.x11.xcb.swap = EINA_TRUE; -#else - if (setup->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST) - buf->priv.x11.xcb.swap = EINA_TRUE; -#endif - if (setup->bitmap_format_bit_order == XCB_IMAGE_ORDER_MSB_FIRST) - buf->priv.x11.xcb.bit_swap = EINA_TRUE; - - if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) && (xdepth > 8)) - { - buf->priv.mask.r = (DATA32)vis->red_mask; - buf->priv.mask.g = (DATA32)vis->green_mask; - buf->priv.mask.b = (DATA32)vis->blue_mask; - if (buf->priv.x11.xcb.swap) - { - SWAP32(buf->priv.mask.r); - SWAP32(buf->priv.mask.g); - SWAP32(buf->priv.mask.b); - } - } - else if ((vis->_class == XCB_VISUAL_CLASS_PSEUDO_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) || - (vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) || - (vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY) || - (xdepth <= 8)) - { - Convert_Pal_Mode pm = PAL_MODE_RGB332; - - if ((vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) || - (vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY)) - grayscale = EINA_TRUE; - if (grayscale) - { - if (max_colors >= 256) - pm = PAL_MODE_GRAY256; - else if (max_colors >= 64) - pm = PAL_MODE_GRAY64; - else if (max_colors >= 16) - pm = PAL_MODE_GRAY16; - else if (max_colors >= 4) - pm = PAL_MODE_GRAY4; - else - pm = PAL_MODE_MONO; - } - else - { - if (max_colors >= 256) - pm = PAL_MODE_RGB332; - else if (max_colors >= 216) - pm = PAL_MODE_RGB666; - else if (max_colors >= 128) - pm = PAL_MODE_RGB232; - else if (max_colors >= 64) - pm = PAL_MODE_RGB222; - else if (max_colors >= 32) - pm = PAL_MODE_RGB221; - else if (max_colors >= 16) - pm = PAL_MODE_RGB121; - else if (max_colors >= 8) - pm = PAL_MODE_RGB111; - else if (max_colors >= 4) - pm = PAL_MODE_GRAY4; - else - pm = PAL_MODE_MONO; - } - /* FIXME: Only allocate once per display & colormap */ - buf->priv.pal = - evas_software_xcb_color_allocate(conn, cmap, vis, pm); - if (!buf->priv.pal) - { - free(buf); - return NULL; - } - } - if ((buf->rot == 0) || (buf->rot == 180)) - { - w = buf->w; - h = buf->h; - } - else if ((buf->rot == 90) || (buf->rot == 270)) - { - w = buf->h; - h = buf->w; - } - - if (buf->priv.pal) - { - func_conv = - evas_common_convert_func_get(0, w, h, xdepth, - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - buf->priv.pal->colors, buf->rot); - } - else - { - func_conv = - evas_common_convert_func_get(0, w, h, xdepth, - buf->priv.mask.r, - buf->priv.mask.g, - buf->priv.mask.b, - PAL_MODE_NONE, buf->rot); - } - if (!func_conv) - { - ERR("XCB Engine" - " {" - " At depth %i:" - " RGB format mask: %08x, %08x, %08x" - " Palette mode: %i" - " Not supported by any compiled in converters!" - " }", buf->priv.x11.xcb.depth, buf->priv.mask.r, - buf->priv.mask.g, buf->priv.mask.b, - buf->priv.pal ? (int)buf->priv.pal->colors : -1); - } - - evas_software_xcb_outbuf_drawable_set(buf, draw); - evas_software_xcb_outbuf_mask_set(buf, mask); - eina_spinlock_new(&(buf->priv.lock)); - - SHMPOOL_LOCK(); - _shmlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2; - SHMPOOL_UNLOCK(); - return buf; -} - -void * -evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) -{ - RGBA_Image *im = NULL; - Outbuf_Region *obr = NULL; - Eina_Bool use_shm = EINA_TRUE; - Eina_Bool alpha = EINA_FALSE; - int bpl = 0; - - eina_spinlock_take(&(buf->priv.lock)); - if ((buf->onebuf) && (buf->priv.x11.xcb.shm)) - { - Eina_Rectangle *rect; - - RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h); - - if (!(obr = calloc(1, sizeof(Outbuf_Region)))) - { - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - - if (!(rect = eina_rectangle_new(x, y, w, h))) - { - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - - if ((eina_array_push(&buf->priv.onebuf_regions, rect)) && - (buf->priv.onebuf)) - { - if (cx) *cx = x; - if (cy) *cy = y; - if (cw) *cw = w; - if (ch) *ch = h; - if (!buf->priv.synced) - { - _xcbob_sync(buf->priv.x11.xcb.conn); - buf->priv.synced = EINA_TRUE; - } - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return buf->priv.onebuf; - } - obr->x = 0; - obr->y = 0; - obr->w = buf->w; - obr->h = buf->h; - if (cx) *cx = x; - if (cy) *cy = y; - if (cw) *cw = w; - if (ch) *ch = h; - - alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha)); - use_shm = buf->priv.x11.xcb.shm; - - if ((buf->rot == 0) && - (buf->priv.x11.xcb.imdepth == 32) && - (buf->priv.mask.r == 0xff0000) && - (buf->priv.mask.g == 0x00ff00) && - (buf->priv.mask.b == 0x0000ff)) - { - obr->xcbob = - evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.visual, - buf->priv.x11.xcb.depth, - buf->w, buf->h, use_shm, - NULL); - if (!obr->xcbob) - { - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - { - im = - (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), - buf->w, buf->h, - (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), - alpha, EVAS_COLORSPACE_ARGB8888); - } - else -#endif - { - im = - (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), - buf->w, buf->h, - (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), - alpha, EVAS_COLORSPACE_ARGB8888); - } - - if (!im) - { - evas_software_xcb_output_buffer_unref(obr->xcbob, EINA_FALSE); - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - im->extended_info = obr; - if (buf->priv.x11.xcb.mask) - { - obr->mask = - evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.visual, - 1, buf->w, buf->h, - use_shm, NULL); - } - } - else - { - int bw = 0, bh = 0; - -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - { - im = - (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get()); - } - else -#endif - { - im = - (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); - } - - if (!im) - { - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - im->cache_entry.flags.alpha |= (alpha ? 1 : 0); -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_surface_alloc(&im->cache_entry, buf->w, buf->h); - else -#endif - evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h); - - im->extended_info = obr; - if ((buf->rot == 0) || (buf->rot == 180)) - { - bw = buf->w; - bh = buf->h; - } - else if ((buf->rot == 90) || (buf->rot == 270)) - { - bw = buf->h; - bh = buf->w; - } - obr->xcbob = - evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.visual, - buf->priv.x11.xcb.depth, - bw, bh, use_shm, NULL); - if (!obr->xcbob) - { -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -#endif - evas_cache_image_drop(&im->cache_entry); - - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - if (buf->priv.x11.xcb.mask) - { - obr->mask = - evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.visual, - 1, bw, bh, use_shm, - NULL); - } - } - /* FIXME: We should be able to remove this memset. */ - if ((alpha) && (im->image.data)) - { - /* FIXME: Faster memset */ -// memset(im->image.data, 0, (w * h * sizeof(DATA32))); - } - buf->priv.onebuf = im; - eina_spinlock_release(&(buf->priv.lock)); - return im; - } - - if (!(obr = calloc(1, sizeof(Outbuf_Region)))) - { - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - - obr->x = x; - obr->y = y; - obr->w = w; - obr->h = h; - if (cx) *cx = 0; - if (cy) *cy = 0; - if (cw) *cw = w; - if (ch) *ch = h; - - use_shm = buf->priv.x11.xcb.shm; - alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha)); - if ((buf->rot == 0) && - (buf->priv.x11.xcb.imdepth == 32) && - (buf->priv.mask.r == 0xff0000) && - (buf->priv.mask.g == 0x00ff00) && - (buf->priv.mask.b == 0x0000ff)) - { - obr->xcbob = - _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, - buf->priv.x11.xcb.depth, w, h, use_shm, NULL); - if (!obr->xcbob) - { - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - { - im = - (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), - w, h, - (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), - alpha, EVAS_COLORSPACE_ARGB8888); - } - else -#endif - { - im = - (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), - w, h, - (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), - alpha, EVAS_COLORSPACE_ARGB8888); - } - - if (!im) - { - _unfind_xcbob(obr->xcbob, EINA_FALSE); - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - im->extended_info = obr; - if (buf->priv.x11.xcb.mask) - { - obr->mask = - _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, - 1, w, h, use_shm, NULL); - } - } - else - { - int bw = 0, bh = 0; - -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - { - im = - (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get()); - } - else -#endif - { - im = - (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); - } - - if (!im) - { - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - im->cache_entry.flags.alpha |= (alpha ? 1 : 0); -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_surface_alloc(&im->cache_entry, w, h); - else -#endif - evas_cache_image_surface_alloc(&im->cache_entry, w, h); - - im->extended_info = obr; - if ((buf->rot == 0) || (buf->rot == 180)) - { - bw = w; - bh = h; - } - else if ((buf->rot == 90) || (buf->rot == 270)) - { - bw = h; - bh = w; - } - obr->xcbob = - _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, - buf->priv.x11.xcb.depth, bw, bh, use_shm, NULL); - if (!obr->xcbob) - { -#ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -#endif - evas_cache_image_drop(&im->cache_entry); - free(obr); - eina_spinlock_release(&(buf->priv.lock)); - return NULL; - } - if (buf->priv.x11.xcb.mask) - { - obr->mask = - _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, 1, - bw, bh, use_shm, NULL); - } - } - /* FIXME: We should be able to remove this memset. */ - if (((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha)) && - (im->image.data)) - { - /* FIXME: Faster memset */ -// memset(im->image.data, 0, (w * h * sizeof(DATA32))); - } - - buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im); - - eina_spinlock_release(&(buf->priv.lock)); - return im; -} - -void -evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf EINA_UNUSED, RGBA_Image *update EINA_UNUSED) -{ - /* NOOP: Cleaned up on flush */ -} - -void -evas_software_xcb_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_Rect *buffer_damage EINA_UNUSED, Evas_Render_Mode render_mode EINA_UNUSED) -{ - Eina_List *l = NULL; - RGBA_Image *im = NULL; - Outbuf_Region *obr = NULL; - - eina_spinlock_take(&(buf->priv.lock)); - if ((buf->priv.onebuf) && (eina_array_count(&buf->priv.onebuf_regions))) - { - Eina_Array_Iterator it; - Eina_Rectangle *rect; - unsigned int i = 0; - pixman_region16_t tmpr; - - im = buf->priv.onebuf; - obr = im->extended_info; - pixman_region_init(&tmpr); - EINA_ARRAY_ITER_NEXT(&buf->priv.onebuf_regions, i, rect, it) - { - Eina_Rectangle xr = { 0, 0, 0, 0 }; - - /* rect = buf->priv.onebuf_regions->data; */ - /* buf->priv.onebuf_regions = */ - /* eina_list_remove_list(buf->priv.onebuf_regions, */ - /* buf->priv.onebuf_regions); */ - if (buf->rot == 0) - { - xr.x = rect->x; - xr.y = rect->y; - xr.w = rect->w; - xr.h = rect->h; - } - else if (buf->rot == 90) - { - xr.x = rect->y; - xr.y = buf->w - rect->x - rect->w; - xr.w = rect->h; - xr.h = rect->w; - } - else if (buf->rot == 180) - { - xr.x = buf->w - rect->x - rect->w; - xr.y = buf->h - rect->y - rect->h; - xr.w = rect->w; - xr.h = rect->h; - } - else if (buf->rot == 270) - { - xr.x = buf->h - rect->y - rect->h; - xr.y = rect->x; - xr.w = rect->h; - xr.h = rect->w; - } - pixman_region_union_rect(&tmpr, &tmpr, xr.x, xr.y, xr.w, xr.h); - if (buf->priv.debug) - evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win, - xr.x, xr.y, xr.w, xr.h); - eina_rectangle_free(rect); - } - eina_array_clean(&buf->priv.onebuf_regions); - xcb_set_clip_rectangles(buf->priv.x11.xcb.conn, - XCB_CLIP_ORDERING_YX_BANDED, - buf->priv.x11.xcb.gc, 0, 0, - pixman_region_n_rects(&tmpr), - (const xcb_rectangle_t *)pixman_region_rectangles(&tmpr, NULL)); - if (obr->xcbob) - { - evas_software_x11_region_push_hook_call(buf, 0, 0, obr->xcbob, - &shmpool_lock); - evas_software_xcb_output_buffer_paste(obr->xcbob, - buf->priv.x11.xcb.win, - buf->priv.x11.xcb.gc, 0, 0, 0); - } - if (obr->mask) - { - xcb_set_clip_rectangles(buf->priv.x11.xcb.conn, - XCB_CLIP_ORDERING_YX_BANDED, - buf->priv.x11.xcb.gcm, 0, 0, - pixman_region_n_rects(&tmpr), - (const xcb_rectangle_t *)pixman_region_rectangles(&tmpr, NULL)); - evas_software_xcb_output_buffer_paste(obr->mask, - buf->priv.x11.xcb.mask, - buf->priv.x11.xcb.gcm, - 0, 0, 0); - } - pixman_region_fini(&tmpr); - buf->priv.synced = EINA_FALSE; - } - else - { -#if 1 - _xcbob_sync(buf->priv.x11.xcb.conn); - EINA_LIST_FOREACH(buf->priv.pending_writes, l, im) - { - obr = im->extended_info; - if (buf->priv.debug) - evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win, - obr->x, obr->y, obr->w, obr->h); - if (obr->xcbob) - { - evas_software_x11_region_push_hook_call(buf, obr->x, obr->y, - obr->xcbob, - &shmpool_lock); - evas_software_xcb_output_buffer_paste(obr->xcbob, - buf->priv.x11.xcb.win, - buf->priv.x11.xcb.gc, - obr->x, obr->y, 0); - } - if (obr->mask) - evas_software_xcb_output_buffer_paste(obr->mask, - buf->priv.x11.xcb.mask, - buf->priv.x11.xcb.gcm, - obr->x, obr->y, 0); - } - while (buf->priv.prev_pending_writes) - { - im = buf->priv.prev_pending_writes->data; - buf->priv.prev_pending_writes = - eina_list_remove_list(buf->priv.prev_pending_writes, - buf->priv.prev_pending_writes); - obr = im->extended_info; -# ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -# endif - evas_cache_image_drop(&im->cache_entry); - - if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE); - if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE); - free(obr); - } - buf->priv.prev_pending_writes = buf->priv.pending_writes; - buf->priv.pending_writes = NULL; - xcb_flush(buf->priv.x11.xcb.conn); -#else - /* FIXME: Async Push Disabled */ - - _xcbob_sync(buf->priv.x11.xcb.conn); - while (buf->priv.pending_writes) - { - im = eina_list_data_get(buf->priv.pending_writes); - buf->priv.pending_writes = - eina_list_remove_list(buf->priv.pending_writes, - buf->priv.pending_writes); - obr = im->extended_info; -# ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -# endif - evas_cache_image_drop(&im->cache_entry); - if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE); - if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE); - free(obr); -# ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -# endif - evas_cache_image_drop(&im->cache_entry); - } -#endif - } - eina_spinlock_release(&(buf->priv.lock)); - evas_common_cpu_end_opt(); -} - -void -evas_software_xcb_outbuf_idle_flush(Outbuf *buf) -{ - eina_spinlock_release(&(buf->priv.lock)); - if (buf->priv.onebuf) - { - RGBA_Image *im; - Outbuf_Region *obr; - - im = buf->priv.onebuf; - buf->priv.onebuf = NULL; - obr = im->extended_info; - if (obr->xcbob) - { - SHMPOOL_LOCK(); - evas_software_xcb_output_buffer_unref(obr->xcbob, EINA_FALSE); - SHMPOOL_UNLOCK(); - } - if (obr->mask) - { - SHMPOOL_LOCK(); - evas_software_xcb_output_buffer_unref(obr->mask, EINA_FALSE); - SHMPOOL_UNLOCK(); - } - free(obr); -# ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -# endif - evas_cache_image_drop(&im->cache_entry); - } - else - { - if (buf->priv.prev_pending_writes) - _xcbob_sync(buf->priv.x11.xcb.conn); - while (buf->priv.prev_pending_writes) - { - RGBA_Image *im; - Outbuf_Region *obr; - - im = buf->priv.prev_pending_writes->data; - buf->priv.prev_pending_writes = - eina_list_remove_list(buf->priv.prev_pending_writes, - buf->priv.prev_pending_writes); - obr = im->extended_info; -# ifdef EVAS_CSERVE2 - if (evas_cserve2_use_get()) - evas_cache2_image_close(&im->cache_entry); - else -# endif - evas_cache_image_drop(&im->cache_entry); - if (obr->xcbob) _unfind_xcbob(obr->xcbob, EINA_FALSE); - if (obr->mask) _unfind_xcbob(obr->mask, EINA_FALSE); - free(obr); - } - _clear_xcbob(EINA_FALSE); - } - eina_spinlock_release(&(buf->priv.lock)); -} - -void -evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h) -{ - Gfx_Func_Convert func_conv = NULL; - Outbuf_Region *obr = NULL; - DATA32 *src_data = NULL; - unsigned char *data = NULL; - int bpl = 0, yy = 0; - int bw = 0, bh = 0; - - eina_spinlock_release(&(buf->priv.lock)); - obr = update->extended_info; - if (!obr->xcbob) - { - eina_spinlock_release(&(buf->priv.lock)); - return; - } - - if ((buf->rot == 0) || (buf->rot == 180)) - { - bw = w; - bh = h; - } - else if ((buf->rot == 90) || (buf->rot == 270)) - { - bw = h; - bh = w; - } - if (buf->priv.pal) - { - func_conv = - evas_common_convert_func_get(0, bw, bh, buf->depth, buf->priv.mask.r, - buf->priv.mask.g, buf->priv.mask.b, - buf->priv.pal->colors, buf->rot); - } - else - { - func_conv = - evas_common_convert_func_get(0, bw, bh, buf->depth, buf->priv.mask.r, - buf->priv.mask.g, buf->priv.mask.b, - PAL_MODE_NONE, buf->rot); - } - if (!func_conv) - { - eina_spinlock_release(&(buf->priv.lock)); - return; - } - - if (!(data = evas_software_xcb_output_buffer_data(obr->xcbob, &bpl))) - { - eina_spinlock_release(&(buf->priv.lock)); - return; - } - if (!(src_data = update->image.data)) - { - eina_spinlock_release(&(buf->priv.lock)); - return; - } - if (buf->rot == 0) - { - obr->x = x; - obr->y = y; - obr->w = w; - obr->h = h; - } - else if (buf->rot == 90) - { - obr->x = y; - obr->y = (buf->w - x - w); - obr->w = h; - obr->h = w; - } - else if (buf->rot == 180) - { - obr->x = (buf->w - x - w); - obr->y = (buf->h - y - h); - obr->w = w; - obr->h = h; - } - else if (buf->rot == 270) - { - obr->x = (buf->h - y - h); - obr->y = x; - obr->w = h; - obr->h = w; - } - if (buf->onebuf) - { - src_data += x + (y * update->cache_entry.w); - data += (bpl * obr->y) + (obr->x * (buf->depth / 8)); - } - if (data != (unsigned char *)src_data) - { - if (buf->priv.pal) - { - func_conv(src_data, data, update->cache_entry.w - w, - bpl - obr->w, obr->w, obr->h, x, y, - buf->priv.pal->lookup); - } - else - { - int pixelb = evas_software_xcb_output_buffer_depth(obr->xcbob) / 8; - int run; - int dstjump; - - if (pixelb == 3) - { - run = obr->w * pixelb; - dstjump = bpl - run; - } - else if ((pixelb == 2) || (pixelb == 4)) - { - run = obr->w; - dstjump = (bpl / pixelb) - run; - } - else - { - run = obr->w; - dstjump = bpl - run; - } - func_conv(src_data, data, update->cache_entry.w - w, dstjump, - obr->w, obr->h, x, y, NULL); - } - } -#if 1 -#else - /* Async Push */ - if (!((buf->priv.onebuf) && (eina_array_count(&buf->priv.onebuf_regions)))) - { - if (buf->priv.debug) - evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win, - obr->x, obr->y, obr->w, obr->h); - if (obr->xcbob) - { - evas_software_x11_region_push_hook_call(buf, obr->x, obr->y, - obr->xcbob, - &shmpool_lock); - evas_software_xcb_output_buffer_paste(obr->xcbob, - buf->priv.x11.xcb.win, - buf->priv.x11.xcb.gc, - obr->x, obr->y, 0); - } - } -#endif - if (obr->mask) - { - if (buf->rot == 0) - { - for (yy = 0; yy < obr->h; yy++) - evas_software_xcb_write_mask_line(buf, obr->mask, - src_data + (yy * obr->w), - obr->w, yy); - } - else if (buf->rot == 90) - { - for (yy = 0; yy < obr->h; yy++) - evas_software_xcb_write_mask_line_vert(buf, obr->mask, - src_data + yy, - h, (obr->h - yy - 1), w); - } - else if (buf->rot == 180) - { - for (yy = 0; yy < obr->h; yy++) - evas_software_xcb_write_mask_line_rev(buf, obr->mask, - src_data + (yy * obr->w), - obr->w, (obr->h - yy - 1)); - } - else if (buf->rot == 270) - { - for (yy = 0; yy < obr->h; yy++) - evas_software_xcb_write_mask_line_vert_rev(buf, obr->mask, - src_data + yy, - h, yy, w); - } -#if 1 -#else - /* Async Push */ - if (!((buf->priv.onebuf) && - (eina_array_count(&buf->priv.onebuf_regions)))) - evas_software_xcb_output_buffer_paste(obr->mask, - buf->priv.x11.xcb.mask, - buf->priv.x11.xcb.gcm, - obr->x, obr->y, 0); -#endif - } -#if 1 -#else - xcb_flush(buf->priv.x11.xcb.conn); -#endif - eina_spinlock_release(&(buf->priv.lock)); -} - -void -evas_software_xcb_outbuf_reconfigure(Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth) -{ - if ((w == buf->w) && (h == buf->h) && (rot == buf->rot) && - (depth == buf->depth)) return; - SHMPOOL_LOCK(); - _shmlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2; - buf->w = w; - buf->h = h; - buf->rot = rot; - _shmlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2; - SHMPOOL_UNLOCK(); - evas_software_xcb_outbuf_idle_flush(buf); -} - -int -evas_software_xcb_outbuf_width_get(Outbuf *buf) -{ - return buf->w; -} - -int -evas_software_xcb_outbuf_height_get(Outbuf *buf) -{ - return buf->h; -} - -Outbuf_Depth -evas_software_xcb_outbuf_depth_get(Outbuf *buf) -{ - return buf->depth; -} - -void -evas_software_xcb_outbuf_drawable_set(Outbuf *buf, xcb_drawable_t drawable) -{ - if (buf->priv.x11.xcb.win == drawable) return; - if (buf->priv.x11.xcb.gc) - { - xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc); - buf->priv.x11.xcb.gc = 0; - } - buf->priv.x11.xcb.win = drawable; - buf->priv.x11.xcb.gc = xcb_generate_id(buf->priv.x11.xcb.conn); - xcb_create_gc(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.gc, buf->priv.x11.xcb.win, 0, NULL); -} - -void -evas_software_xcb_outbuf_mask_set(Outbuf *buf, xcb_drawable_t mask) -{ - if (buf->priv.x11.xcb.mask == mask) return; - if (buf->priv.x11.xcb.gcm) - { - xcb_free_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gcm); - buf->priv.x11.xcb.gcm = 0; - } - buf->priv.x11.xcb.mask = mask; - if (buf->priv.x11.xcb.mask) - { - buf->priv.x11.xcb.gcm = xcb_generate_id(buf->priv.x11.xcb.conn); - xcb_create_gc(buf->priv.x11.xcb.conn, - buf->priv.x11.xcb.gcm, buf->priv.x11.xcb.mask, 0, NULL); - } -} - -int -evas_software_xcb_outbuf_rotation_get(Outbuf *buf) -{ - return buf->rot; -} - -void -evas_software_xcb_outbuf_rotation_set(Outbuf *buf, int rotation) -{ - buf->rot = rotation; -} - -Eina_Bool -evas_software_xcb_outbuf_alpha_get(Outbuf *buf) -{ - return buf->priv.x11.xcb.mask; -} - -void -evas_software_xcb_outbuf_debug_set(Outbuf *buf, Eina_Bool debug) -{ - buf->priv.debug = debug; -} - -void -evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x, int y, int w, int h) -{ - int i; - xcb_screen_t *screen = NULL; - xcb_get_geometry_reply_t *geom; - xcb_drawable_t root; - xcb_screen_iterator_t si; - - geom = - xcb_get_geometry_reply(buf->priv.x11.xcb.conn, - xcb_get_geometry_unchecked(buf->priv.x11.xcb.conn, - drawable), 0); - root = geom->root; - free(geom); - geom = - xcb_get_geometry_reply(buf->priv.x11.xcb.conn, - xcb_get_geometry_unchecked(buf->priv.x11.xcb.conn, - root), 0); - - si = xcb_setup_roots_iterator((xcb_setup_t *)xcb_get_setup(buf->priv.x11.xcb.conn)); - for (; si.rem; xcb_screen_next(&si)) - { - if (si.data->root == geom->root) - { - screen = si.data; - break; - } - } - free(geom); - - for (i = 0; i < 20; i++) - { - xcb_rectangle_t rect = { x, y, w, h}; - uint32_t mask; - uint32_t value[2]; - - mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; - value[0] = screen->black_pixel; - value[1] = XCB_EXPOSURES_NOT_ALLOWED; - xcb_change_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc, - mask, value); - xcb_poly_fill_rectangle(buf->priv.x11.xcb.conn, drawable, - buf->priv.x11.xcb.gc, 1, &rect); - _xcbob_sync(buf->priv.x11.xcb.conn); - _xcbob_sync(buf->priv.x11.xcb.conn); - - mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; - value[0] = screen->white_pixel; - value[1] = XCB_EXPOSURES_NOT_ALLOWED; - xcb_change_gc(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.gc, - mask, value); - xcb_poly_fill_rectangle(buf->priv.x11.xcb.conn, drawable, - buf->priv.x11.xcb.gc, 1, &rect); - _xcbob_sync(buf->priv.x11.xcb.conn); - _xcbob_sync(buf->priv.x11.xcb.conn); - } -} - - -/* local functions */ -static Xcb_Output_Buffer * -_find_xcbob(xcb_connection_t *conn, xcb_visualtype_t *vis, int depth, int w, int h, Eina_Bool shm, void *data) -{ - Eina_List *l = NULL, *xl = NULL; - Xcb_Output_Buffer *xcbob = NULL, *xcbob2 = NULL; - int lbytes = 0, bpp = 0, sz = 0; - int fitness = 0x7fffffff; - - if (!shm) - return evas_software_xcb_output_buffer_new(conn, vis, depth, w, h, - shm, data); - - if (depth > 1) - { - bpp = (depth / 8); - if (bpp == 3) bpp = 4; - lbytes = ((((w * bpp) + 3) / 4) * 4); - } - else - lbytes = (((w + 63) / 64) * 8); - - sz = (lbytes * h); - SHMPOOL_LOCK(); - EINA_LIST_FOREACH(_shmpool, l, xcbob2) - { - int szdif = 0; - - if ((xcbob2->xim->depth != depth) || (xcbob2->visual != vis) || - (xcbob2->connection != conn) || (xcbob2->w != w)) continue; - szdif = (xcbob2->psize - sz); - if (szdif < 0) continue; - if (szdif == 0) - { - xcbob = xcbob2; - xl = l; - goto have_xcbob; - } - if (szdif < fitness) - { - xcbob = xcbob2; - xl = l; - fitness = szdif; - } - } - if ( - (fitness > (400 * 400)) || - (!xcbob) - ) - { - SHMPOOL_UNLOCK(); - return evas_software_xcb_output_buffer_new(conn, vis, depth, - w, h, shm, data); - } - -have_xcbob: - _shmpool = eina_list_remove_list(_shmpool, xl); - xcbob->w = w; - xcbob->h = h; -// xcbob->bpl = lbytes; - xcbob->xim->width = xcbob->w; - xcbob->xim->height = xcbob->h; - xcbob->xim->stride = xcbob->bpl; - _shmsize -= (xcbob->psize * (xcbob->xim->depth / 8)); - SHMPOOL_UNLOCK(); - return xcbob; -} - -static void -_unfind_xcbob(Xcb_Output_Buffer *xcbob, Eina_Bool sync) -{ - if (xcbob->shm_info) - { - SHMPOOL_LOCK(); - _shmpool = eina_list_prepend(_shmpool, xcbob); - _shmsize += xcbob->psize * xcbob->xim->depth / 8; - while ((_shmsize > _shmlimit) || - (eina_list_count(_shmpool) > _shmcountlimit)) - { - Eina_List *xl = NULL; - - if (!(xl = eina_list_last(_shmpool))) - { - _shmsize = 0; - break; - } - xcbob = xl->data; - _shmpool = eina_list_remove_list(_shmpool, xl); - _shmsize -= xcbob->psize * xcbob->xim->depth / 8; - evas_software_xcb_output_buffer_unref(xcbob, sync); - } - SHMPOOL_UNLOCK(); - } - else - { - SHMPOOL_LOCK(); - evas_software_xcb_output_buffer_unref(xcbob, sync); - SHMPOOL_UNLOCK(); - } -} - -static void -_clear_xcbob(Eina_Bool sync) -{ - SHMPOOL_LOCK(); - while (_shmpool) - { - Xcb_Output_Buffer *xcbob; - - xcbob = _shmpool->data; - _shmpool = eina_list_remove_list(_shmpool, _shmpool); - evas_software_xcb_output_buffer_unref(xcbob, sync); - } - _shmsize = 0; - SHMPOOL_UNLOCK(); -} - -static void -_xcbob_sync(xcb_connection_t *conn) -{ - free(xcb_get_input_focus_reply(conn, - xcb_get_input_focus_unchecked(conn), NULL)); -} diff --git a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h deleted file mode 100644 index ccb266e..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef EVAS_XCB_OUTBUF_H -# define EVAS_XCB_OUTBUF_H - -# include "evas_engine.h" - -void evas_software_xcb_outbuf_init(void); -void evas_software_xcb_outbuf_free(Outbuf *buf); -Outbuf *evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_connection_t *conn, xcb_screen_t *screen, xcb_drawable_t draw, xcb_visualtype_t *vis, xcb_colormap_t cmap, int xdepth, Eina_Bool grayscale, int max_colors, xcb_drawable_t mask, Eina_Bool shape_dither, Eina_Bool alpha); -void *evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); -void evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update); -void evas_software_xcb_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_damage, Evas_Render_Mode render_mode); -void evas_software_xcb_outbuf_idle_flush(Outbuf *buf); -void evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h); -void evas_software_xcb_outbuf_reconfigure(Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth); -int evas_software_xcb_outbuf_width_get(Outbuf *buf); -int evas_software_xcb_outbuf_height_get(Outbuf *buf); -Outbuf_Depth evas_software_xcb_outbuf_depth_get(Outbuf *buf); -void evas_software_xcb_outbuf_drawable_set(Outbuf *buf, xcb_drawable_t drawable); -void evas_software_xcb_outbuf_mask_set(Outbuf *buf, xcb_drawable_t mask); -int evas_software_xcb_outbuf_rotation_get(Outbuf *buf); -void evas_software_xcb_outbuf_rotation_set(Outbuf *buf, int rotation); -Eina_Bool evas_software_xcb_outbuf_alpha_get(Outbuf *buf); -void evas_software_xcb_outbuf_debug_set(Outbuf *buf, Eina_Bool debug); -void evas_software_xcb_outbuf_debug_show(Outbuf *buf, xcb_drawable_t drawable, int x, int y, int w, int h); - -#endif diff --git a/src/modules/evas/engines/software_x11/evas_xcb_xdefaults.c b/src/modules/evas/engines/software_x11/evas_xcb_xdefaults.c deleted file mode 100644 index de0f599..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_xdefaults.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "evas_common_private.h" -#include "evas_xcb_xdefaults.h" -#include - -/* local function prototypes */ -static Eina_Bool _evas_xcb_xdefaults_glob_match(const char *str, const char *glob); - -/* local variables */ -static Eina_File *_evas_xcb_xdefaults_file = NULL; -static char *_evas_xcb_xdefaults_data = NULL; - -void -_evas_xcb_xdefaults_init(void) -{ - char buff[PATH_MAX]; - - snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME")); - if ((_evas_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE))) - { - eina_mmap_safety_enabled_set(EINA_TRUE); - - _evas_xcb_xdefaults_data = - eina_file_map_all(_evas_xcb_xdefaults_file, EINA_FILE_SEQUENTIAL); - } -} - -void -_evas_xcb_xdefaults_shutdown(void) -{ - if (!_evas_xcb_xdefaults_file) return; - if (_evas_xcb_xdefaults_data) - eina_file_map_free(_evas_xcb_xdefaults_file, _evas_xcb_xdefaults_data); - if (_evas_xcb_xdefaults_file) eina_file_close(_evas_xcb_xdefaults_file); -} - -char * -_evas_xcb_xdefaults_string_get(const char *prog, const char *param) -{ - char buff[1024], ret[1024]; - char *str = NULL; - char **ea = NULL; - unsigned int count = 0, i = 0; - - if ((!_evas_xcb_xdefaults_data) || (!_evas_xcb_xdefaults_file)) - return NULL; - - snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param); - - str = _evas_xcb_xdefaults_data; - ea = eina_str_split_full(str, "\n", -1, &count); - for (i = 0; i < count; i++) - { - if (_evas_xcb_xdefaults_glob_match(ea[i], buff)) - sscanf(ea[i], "%*[^:]:%*[ ]%s", ret); - } - if ((ea) && (ea[0])) - { - free(ea[0]); - free(ea); - } - - return strdup(ret); -} - -int -_evas_xcb_xdefaults_int_get(const char *prog, const char *param) -{ - char buff[1024]; - char *str = NULL; - char **ea = NULL; - unsigned int count = 0, i = 0; - int ret = -1; - - if ((!_evas_xcb_xdefaults_data) || (!_evas_xcb_xdefaults_file)) - return 0; - - snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param); - - str = _evas_xcb_xdefaults_data; - ea = eina_str_split_full(str, "\n", -1, &count); - for (i = 0; i < count; i++) - { - if (_evas_xcb_xdefaults_glob_match(ea[i], buff)) - sscanf(ea[i], "%*[^:]:%*[ ]%d", &ret); - } - if ((ea) && (ea[0])) - { - free(ea[0]); - free(ea); - } - - return ret; -} - -/* local functions */ -static Eina_Bool -_evas_xcb_xdefaults_glob_match(const char *str, const char *glob) -{ - if ((!str) || (!glob)) return EINA_FALSE; - if (glob[0] == 0) - { - if (str[0] == 0) return EINA_TRUE; - return EINA_FALSE; - } - if (!strcmp(glob, "*")) return EINA_TRUE; - if (!fnmatch(glob, str, 0)) return EINA_TRUE; - return EINA_FALSE; -} diff --git a/src/modules/evas/engines/software_x11/evas_xcb_xdefaults.h b/src/modules/evas/engines/software_x11/evas_xcb_xdefaults.h deleted file mode 100644 index c5f4ab8..0000000 --- a/src/modules/evas/engines/software_x11/evas_xcb_xdefaults.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EVAS_XCB_XDEFAULTS_H -# define EVAS_XCB_XDEFAULTS_H - -# include "evas_engine.h" - -void _evas_xcb_xdefaults_init(void); -void _evas_xcb_xdefaults_shutdown(void); -char *_evas_xcb_xdefaults_string_get(const char *prog, const char *param); -int _evas_xcb_xdefaults_int_get(const char *prog, const char *param); - -#endif diff --git a/src/tests/ecore/ecore_test_ecore_x.c b/src/tests/ecore/ecore_test_ecore_x.c index bb33374..bf7e57f 100644 --- a/src/tests/ecore/ecore_test_ecore_x.c +++ b/src/tests/ecore/ecore_test_ecore_x.c @@ -11,7 +11,6 @@ * with getting X on the server. */ #undef HAVE_ECORE_X_XLIB -/* TODO: change to HAVE_ECORE_X when xcb implementation is done */ #ifdef HAVE_ECORE_X_XLIB #include @@ -53,8 +52,6 @@ END_TEST void ecore_test_ecore_x(TCase *tc EINA_UNUSED) { - -/* TODO: change to HAVE_ECORE_X when xcb implementation is done */ #ifdef HAVE_ECORE_X_XLIB tcase_add_test(tc, ecore_test_ecore_x_init); tcase_add_test(tc, ecore_test_ecore_x_bell); diff --git a/src/utils/ecore/.gitignore b/src/utils/ecore/.gitignore index d270923..8b13789 100644 --- a/src/utils/ecore/.gitignore +++ b/src/utils/ecore/.gitignore @@ -1 +1 @@ -/makekeys + diff --git a/src/utils/ecore/makekeys.c b/src/utils/ecore/makekeys.c deleted file mode 100644 index 87b76c6..0000000 --- a/src/utils/ecore/makekeys.c +++ /dev/null @@ -1,326 +0,0 @@ -/* Portions of this code are Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#include -#include -#include -#include - -#define TBLNUM 4000 -#define MIN_REHASH 15 -#define MATCHES 10 - -typedef struct _Info Info; -static struct _Info -{ - char *name; - long unsigned int val; -} info[TBLNUM]; - -/* local function prototypes */ -static int _parseline(const char *buf, char *key, long unsigned int *val, char *prefix); - -/* local variables */ -static int ksnum = 0; - -int -main(int argc, char **argv) -{ - int max_rehash = 0; - unsigned long sig; - int i = 0, j = 0, k = 0, l = 0, z = 0; - FILE *fptr; - char *name = NULL, c; - int first = 0, num_found = 0; - int best_max_rehash = 0, best_z = 0; - long unsigned int val; - char key[128], prefix[128]; - char tab[TBLNUM]; - unsigned short offsets[TBLNUM] = { 0 }; - unsigned short indexes[TBLNUM] = { 0 }; - long unsigned int values[TBLNUM] = { 0 }; - char buf[1024]; - - for (l = 1; l < argc; l++) - { - if (!(fptr = fopen(argv[l], "rb"))) - { - fprintf(stderr, "Could not open %s\n", argv[l]); - continue; - } - - while (fgets(buf, sizeof(buf), fptr)) - { - if (!_parseline(buf, key, &val, prefix)) - continue; - - if (val == XK_VoidSymbol) val = 0; - if (val > 0x1fffffff) - { - fprintf(stderr, "Ignoring illegal keysym (%s %lx)\n", - key, val); - continue; - } - - if (!(name = malloc(strlen(prefix) + strlen(key) + 1))) - { - fprintf(stderr, "Makekeys: Out Of Memory !!\n"); - exit(EXIT_FAILURE); - } - - sprintf(name, "%s%s", prefix, key); - info[ksnum].name = name; - info[ksnum].val = val; - ksnum++; - if (ksnum == TBLNUM) - { - fprintf(stderr, "Makekeys: Too Many Keysyms!!\n"); - exit(EXIT_FAILURE); - } - } - - fclose(fptr); - } - - printf("/* This file is generated from keysymdef.h. */\n"); - printf("/* Do Not Edit !! */\n\n"); - - best_max_rehash = ksnum; - num_found = 0; - for (z = ksnum; z < TBLNUM; z++) - { - max_rehash = 0; - for (name = tab, i = z; --i >= 0;) - *name++ = 0; - for (i = 0; i < ksnum; i++) - { - name = info[i].name; - sig = 0; - while ((c = *name++)) - sig = (sig << 1) + c; - first = j = sig % z; - for (k = 0; tab[j]; k++) - { - j += (first + 1); - if (j >= z) j -= z; - if (j == first) goto next1; - } - tab[j] = 1; - if (k > max_rehash) max_rehash = k; - } - if (max_rehash < MIN_REHASH) - { - if (max_rehash < best_max_rehash) - { - best_max_rehash = max_rehash; - best_z = z; - } - num_found++; - if (num_found >= MATCHES) - break; - } -next1: ; - } - - z = best_z; - if (z == 0) - { - fprintf(stderr, "Makekeys: Failed to find small enough hash !!\n" - "Try increasing TBLNUM in makekeys.c\n"); - exit(EXIT_FAILURE); - } - - printf("#ifdef NEED_KEYSYM_TABLE\n"); - printf("const unsigned char _ecore_xcb_keytable[] = {\n"); - printf("0,\n"); - k = 1; - for (i = 0; i < ksnum; i++) - { - name = info[i].name; - sig = 0; - while ((c = *name++)) - sig = (sig << 1) + c; - first = j = sig % z; - while (offsets[j]) - { - j += (first + 1); - if (j >= z) j -= z; - } - offsets[j] = k; - indexes[i] = k; - val = info[i].val; - printf("0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ", - (sig >> 8) & 0xff, sig & 0xff, - (val >> 24) & 0xff, (val >> 16) & 0xff, - (val >> 8) & 0xff, val & 0xff); - for (name = info[i].name, k += 7; (c = *name++); k++) - printf("'%c',", c); - printf((i == (ksnum - 1)) ? "0\n" : "0,\n"); - } - - printf("};\n\n"); - printf("#define KTABLESIZE %d\n", z); - printf("#define KMAXHASH %d\n", (best_max_rehash + 1)); - printf("\n"); - printf("static const unsigned short hashString[KTABLESIZE] = {\n"); - - for (i = 0; i < z;) - { - printf("0x%.4x", offsets[i]); - i++; - if (i == z) break; - printf((i & 7) ? ", " : ",\n"); - } - - printf("\n"); - printf("};\n"); - printf("#endif\n"); - - best_max_rehash = ksnum; - num_found = 0; - for (z = ksnum; z < TBLNUM; z++) - { - max_rehash = 0; - for (name = tab, i = z; --i >= 0;) - *name++ = 0; - for (i = 0; i < ksnum; i++) - { - val = info[i].val; - first = j = val % z; - for (k = 0; tab[j]; k++) - { - if (values[j] == val) goto skip1; - j += (first + 1); - if (j >= z) j -= z; - if (j == first) goto next2; - } - tab[j] = 1; - values[j] = val; - if (k > max_rehash) max_rehash = k; -skip1: ; - } - if (max_rehash < MIN_REHASH) - { - if (max_rehash < best_max_rehash) - { - best_max_rehash = max_rehash; - best_z = z; - } - num_found++; - if (num_found >= MATCHES) break; - } -next2: ; - } - - z = best_z; - if (z == 0) - { - fprintf(stderr, "Makekeys: Failed to find small enough hash !!\n" - "Try increasing TBLNUM in makekeys.c\n"); - exit(EXIT_FAILURE); - } - for (i = z; --i >= 0;) - offsets[i] = 0; - - for (i = 0; i < ksnum; i++) - { - val = info[i].val; - first = j = val % z; - while (offsets[j]) - { - if (values[j] == val) goto skip2; - j += (first + 1); - if (j >= z) j -= z; - } - offsets[j] = indexes[i] + 2; - values[j] = val; -skip2: ; - } - - printf("\n"); - printf("#ifdef NEED_VTABLE\n"); - printf("#define VTABLESIZE %d\n", z); - printf("#define VMAXHASH %d\n", best_max_rehash + 1); - printf("\n"); - printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n"); - for (i = 0; i < z;) - { - printf("0x%.4x", offsets[i]); - i++; - if (i == z) break; - printf((i & 7) ? ", " : ",\n"); - } - printf("\n"); - printf("};\n"); - printf("#endif\n"); - - return 0; -} - -/* local functions */ -static int -_parseline(const char *buf, char *key, long unsigned int *val, char *prefix) -{ - int i = 0; - char alias[128]; - char *tmp = NULL, *tmpa = NULL; - - /* try to match XK_foo first */ - i = sscanf(buf, "#define %127s 0x%lx", key, val); - if ((i == 2) && (tmp = strstr(key, "XK_"))) - { - memcpy(prefix, key, (tmp - key)); - prefix[tmp - key] = '\0'; - tmp += 3; - memmove(key, tmp, strlen(tmp) + 1); - return 1; - } - - /* try to match an alias */ - i = sscanf(buf, "#define %127s %127s", key, alias); - if (((i == 2) && (tmp = strstr(key, "XK_"))) && - (tmpa = strstr(alias, "XK_"))) - { - memcpy(prefix, key, (tmp - key)); - prefix[tmp - key] = '\0'; - tmp += 3; - memmove(key, tmp, strlen(tmp) + 1); - memmove(tmpa, tmpa + 3, strlen(tmpa + 3) + 1); - - for (i = ksnum - 1; i >= 0; i--) - { - if (!strcmp(info[i].name, alias)) - { - *val = info[i].val; - return 1; - } - } - fprintf(stderr, "Cannot find matching definition %s for keysym %s%s\n", - alias, prefix, key); - } - - return 0; -} diff --git a/src/utils/ecore/mkks.sh b/src/utils/ecore/mkks.sh deleted file mode 100755 index 6669242..0000000 --- a/src/utils/ecore/mkks.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -cat $* | awk 'BEGIN { \ - printf "/*\n * This file is generated from %s. Do not edit.\n */\n", \ - "$(INCLUDESRC)/keysymdef.h";\ -} \ -/^#define/ { \ - len = length($2)-3; \ - printf("{ \"%s\", %s },\n", substr($2,4,len), $3); \ -}' -- 2.7.4